diff --git a/docs/js/benchmark-bundle.min.js b/docs/js/benchmark-bundle.min.js index a18d3977..f9419d40 100644 --- a/docs/js/benchmark-bundle.min.js +++ b/docs/js/benchmark-bundle.min.js @@ -5,4 +5,4 @@ // Copyright (c) 2023- the Peggy authors // Licensed under the MIT License. -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).browser=t()}(this,(function(){var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},browser_stub={},GrammarLocation$4=function(){function e(e,t){this.source=e,this.start=t}return e.prototype.toString=function(){return String(this.source)},e.prototype.offset=function(e){return{line:e.line+this.start.line-1,column:1===e.line?e.column+this.start.column-1:e.column,offset:e.offset+this.start.offset}},e.offsetStart=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.start):e.start},e.offsetEnd=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.end):e.end},e}(),grammarLocation=GrammarLocation$4,__extends=commonjsGlobal&&commonjsGlobal.__extends||(extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},extendStatics(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),extendStatics,GrammarLocation$3=grammarLocation,setProtoOf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},GrammarError$3=function(e){function t(n,r,o){var u=e.call(this,n)||this;return setProtoOf(u,t.prototype),u.name="GrammarError",u.location=r,void 0===o&&(o=[]),u.diagnostics=o,u.stage=null,u.problems=[["error",n,r,o]],u}return __extends(t,e),t.prototype.toString=function(){var t=e.prototype.toString.call(this);this.location&&(t+="\n at ",void 0!==this.location.source&&null!==this.location.source&&(t+="".concat(this.location.source,":")),t+="".concat(this.location.start.line,":").concat(this.location.start.column));for(var n=0,r=this.diagnostics;n<r.length;n++){var o=r[n];t+="\n from ",void 0!==o.location.source&&null!==o.location.source&&(t+="".concat(o.location.source,":")),t+="".concat(o.location.start.line,":").concat(o.location.start.column,": ").concat(o.message)}return t},t.prototype.format=function(e){var t=e.map((function(e){var t=e.source,n=e.text;return{source:t,text:null!=n?String(n).split(/\r\n|\n|\r/g):[]}}));function n(e,n,r){void 0===r&&(r="");var o="",u=t.find((function(t){return t.source===e.source})),a=e.start,i=GrammarLocation$3.offsetStart(e);if(u){var s=e.end,c=u.text[a.line-1],l=(a.line===s.line?s.column:c.length+1)-a.column||1;r&&(o+="\nnote: ".concat(r)),o+="\n --\x3e ".concat(e.source,":").concat(i.line,":").concat(i.column,"\n").concat("".padEnd(n)," |\n").concat(i.line.toString().padStart(n)," | ").concat(c,"\n").concat("".padEnd(n)," | ").concat("".padEnd(a.column-1)).concat("".padEnd(l,"^"))}else o+="\n at ".concat(e.source,":").concat(i.line,":").concat(i.column),r&&(o+=": ".concat(r));return o}function r(e,t,r,o){void 0===o&&(o=[]);var u=-1/0;u=r?o.reduce((function(e,t){var n=t.location;return Math.max(e,GrammarLocation$3.offsetStart(n).line)}),r.start.line):Math.max.apply(null,o.map((function(e){return e.location.start.line}))),u=u.toString().length;var a="".concat(e,": ").concat(t);r&&(a+=n(r,u));for(var i=0,s=o;i<s.length;i++){var c=s[i];a+=n(c.location,u,c.message)}return a}return this.problems.filter((function(e){return"info"!==e[0]})).map((function(e){return r.apply(void 0,e)})).join("\n\n")},t}(Error),grammarError=GrammarError$3,__spreadArray$4=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,u=t.length;o<u;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},visitor$c={build:function(e){function t(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return e[t.type].apply(e,__spreadArray$4([t],n,!1))}function n(){}function r(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return t.apply(void 0,__spreadArray$4([e.expression],n,!1))}function o(e){return function(n){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];n[e].forEach((function(e){return t.apply(void 0,__spreadArray$4([e],r,!1))}))}}var u={grammar:function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];e.topLevelInitializer&&t.apply(void 0,__spreadArray$4([e.topLevelInitializer],n,!1)),e.initializer&&t.apply(void 0,__spreadArray$4([e.initializer],n,!1)),e.rules.forEach((function(e){return t.apply(void 0,__spreadArray$4([e],n,!1))}))},top_level_initializer:n,initializer:n,rule:r,named:r,choice:o("alternatives"),action:r,sequence:o("elements"),labeled:r,text:r,simple_and:r,simple_not:r,optional:r,zero_or_more:r,one_or_more:r,repeated:function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return e.delimiter&&t.apply(void 0,__spreadArray$4([e.delimiter],n,!1)),t.apply(void 0,__spreadArray$4([e.expression],n,!1))},group:r,semantic_and:n,semantic_not:n,rule_ref:n,literal:n,class:n,any:n};return Object.keys(u).forEach((function(t){Object.prototype.hasOwnProperty.call(e,t)||(e[t]=u[t])})),t}},visitor_1=visitor$c,visitor$b=visitor_1,asts$7={findRule:function(e,t){for(var n=0;n<e.rules.length;n++)if(e.rules[n].name===t)return e.rules[n]},indexOfRule:function(e,t){for(var n=0;n<e.rules.length;n++)if(e.rules[n].name===t)return n;return-1},alwaysConsumesOnSuccess:function(e,t){function n(){return!0}function r(){return!1}var o=visitor$b.build({choice:function(e){return e.alternatives.every(o)},sequence:function(e){return e.elements.some(o)},simple_and:r,simple_not:r,optional:r,zero_or_more:r,repeated:function(e){var t=e.min?e.min:e.max;return!("constant"!==t.type||0===t.value||!o(e.expression)&&!(t.value>1&&e.delimiter&&o(e.delimiter)))},semantic_and:r,semantic_not:r,rule_ref:function(t){var n=asts$7.findRule(e,t.name);return n?o(n):void 0},literal:function(e){return""!==e.value},class:n,any:n});return o(t)}},asts_1=asts$7,opcodes={PUSH:0,PUSH_EMPTY_STRING:35,PUSH_UNDEFINED:1,PUSH_NULL:2,PUSH_FAILED:3,PUSH_EMPTY_ARRAY:4,PUSH_CURR_POS:5,POP:6,POP_CURR_POS:7,POP_N:8,NIP:9,APPEND:10,WRAP:11,TEXT:12,PLUCK:36,IF:13,IF_ERROR:14,IF_NOT_ERROR:15,IF_LT:30,IF_GE:31,IF_LT_DYNAMIC:32,IF_GE_DYNAMIC:33,WHILE_NOT_ERROR:16,MATCH_ANY:17,MATCH_STRING:18,MATCH_STRING_IC:19,MATCH_CHAR_CLASS:20,MATCH_REGEXP:20,ACCEPT_N:21,ACCEPT_STRING:22,FAIL:23,LOAD_SAVED_POS:24,UPDATE_SAVED_POS:25,CALL:26,RULE:27,SILENT_FAILS_ON:28,SILENT_FAILS_OFF:29,SOURCE_MAP_PUSH:37,SOURCE_MAP_POP:38,SOURCE_MAP_LABEL_PUSH:39,SOURCE_MAP_LABEL_POP:40},opcodes_1=opcodes,visitor$a=visitor_1,asts$6=asts_1,GrammarError$2=grammarError,ALWAYS_MATCH$1=1,SOMETIMES_MATCH$1=0,NEVER_MATCH$1=-1;function inferenceMatchResult$1(e){function t(e){return e.match=SOMETIMES_MATCH$1}function n(e){return u(e.expression),e.match=ALWAYS_MATCH$1}function r(e){return e.match=u(e.expression)}function o(e,t){for(var n=e.length,r=0,o=0,a=0;a<n;++a){var i=u(e[a]);i===ALWAYS_MATCH$1&&++r,i===NEVER_MATCH$1&&++o}return r===n?ALWAYS_MATCH$1:t?o===n?NEVER_MATCH$1:SOMETIMES_MATCH$1:o>0?NEVER_MATCH$1:SOMETIMES_MATCH$1}var u=visitor$a.build({rule:function(e){var t=void 0,n=0;if(void 0===e.match){e.match=SOMETIMES_MATCH$1;do{if(t=e.match,e.match=u(e.expression),++n>6)throw new GrammarError$2("Infinity cycle detected when trying to evaluate node match result",e.location)}while(t!==e.match)}return e.match},named:r,choice:function(e){return e.match=o(e.alternatives,!0)},action:r,sequence:function(e){return e.match=o(e.elements,!1)},labeled:r,text:r,simple_and:r,simple_not:function(e){return e.match=-u(e.expression)},optional:n,zero_or_more:n,one_or_more:r,repeated:function(e){var t=u(e.expression),n=e.delimiter?u(e.delimiter):NEVER_MATCH$1,r=e.min?e.min:e.max;return"constant"!==r.type||"constant"!==e.max.type?e.match=SOMETIMES_MATCH$1:0===e.max.value||null!==e.max.value&&r.value>e.max.value?e.match=NEVER_MATCH$1:t===NEVER_MATCH$1?e.match=0===r.value?ALWAYS_MATCH$1:NEVER_MATCH$1:t===ALWAYS_MATCH$1?e.delimiter&&r.value>=2?e.match=n:e.match=ALWAYS_MATCH$1:e.delimiter&&r.value>=2?e.match=n===NEVER_MATCH$1?NEVER_MATCH$1:SOMETIMES_MATCH$1:e.match=0===r.value?ALWAYS_MATCH$1:SOMETIMES_MATCH$1},group:r,semantic_and:t,semantic_not:t,rule_ref:function(t){var n=asts$6.findRule(e,t.name);return t.match=u(n)},literal:function(e){var t=0===e.value.length?ALWAYS_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},class:function(e){var t=0===e.parts.length?NEVER_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},any:t});u(e)}inferenceMatchResult$1.ALWAYS_MATCH=ALWAYS_MATCH$1,inferenceMatchResult$1.SOMETIMES_MATCH=SOMETIMES_MATCH$1,inferenceMatchResult$1.NEVER_MATCH=NEVER_MATCH$1;var inferenceMatchResult_1=inferenceMatchResult$1,__spreadArray$3=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,u=t.length;o<u;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},asts$5=asts_1,op$1=opcodes_1,visitor$9=visitor_1,_a$1=inferenceMatchResult_1,ALWAYS_MATCH=_a$1.ALWAYS_MATCH,SOMETIMES_MATCH=_a$1.SOMETIMES_MATCH,NEVER_MATCH=_a$1.NEVER_MATCH;function generateBytecode$1(e,t){var n=[],r=[],o=[],u=[],a=[];function i(e){var t=n.indexOf(e);return-1===t?n.push(e)-1:t}function s(e){var t=JSON.stringify(e),n=o.findIndex((function(e){return JSON.stringify(e)===t}));return-1===n?o.push(e)-1:n}function c(e,t,n){var r={predicate:e,params:t,body:n.code,location:n.codeLocation},o=JSON.stringify(r),a=u.findIndex((function(e){return JSON.stringify(e)===o}));return-1===a?u.push(r)-1:a}function l(e){return a.push(e)-1}function p(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n]})),t}function f(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return e.concat.apply(e,t)}function h(e,t,n,r){return e===ALWAYS_MATCH?n:e===NEVER_MATCH?r:t.concat([n.length,r.length],n,r)}function d(e,t,n,r){var o=Object.keys(n).map((function(e){return r-n[e]}));return[op$1.CALL,e,t,o.length].concat(o)}function g(e,t,n){var r=e.match||0;return f([op$1.PUSH_CURR_POS],[op$1.SILENT_FAILS_ON],C(e,{sp:n.sp+1,env:p(n.env),action:null}),[op$1.SILENT_FAILS_OFF],h(t?-r:r,[t?op$1.IF_ERROR:op$1.IF_NOT_ERROR],f([op$1.POP],[t?op$1.POP:op$1.POP_CURR_POS],[op$1.PUSH_UNDEFINED]),f([op$1.POP],[t?op$1.POP_CURR_POS:op$1.POP],[op$1.PUSH_FAILED])))}function A(e,t,n){var r=c(!0,Object.keys(n.env),e);return f([op$1.UPDATE_SAVED_POS],d(r,0,n.env,n.sp),h(e.match||0,[op$1.IF],f([op$1.POP],t?[op$1.PUSH_FAILED]:[op$1.PUSH_UNDEFINED]),f([op$1.POP],t?[op$1.PUSH_UNDEFINED]:[op$1.PUSH_FAILED])))}function m(e){return t=[op$1.WHILE_NOT_ERROR],n=f([op$1.APPEND],e),t.concat([n.length],n);var t,n}function E(e,t,n,r){switch(e.type){case"constant":return{pre:[],post:[],sp:n};case"variable":return e.sp=r+n-t[e.value],{pre:[],post:[],sp:n};case"function":return e.sp=r,{pre:d(c(!0,Object.keys(t),{code:e.value,codeLocation:e.codeLocation}),0,t,n),post:[op$1.NIP],sp:n+1};default:throw new Error('Unknown boundary type "'.concat(e.type,'" for the "repeated" node'))}}function _(e,t){if(null!==t.value){var n="constant"===t.type?[op$1.IF_GE,t.value]:[op$1.IF_GE_DYNAMIC,t.sp];return h(SOMETIMES_MATCH,n,[op$1.PUSH_FAILED],e)}return e}var v,C=(v={grammar:function(e){e.rules.forEach(C),e.literals=n,e.classes=r,e.expectations=o,e.functions=u,e.locations=a},rule:function(e){e.bytecode=C(e.expression,{sp:-1,env:{},pluck:[],action:null})},named:function(e,t){var n=e.match||0,r=n===NEVER_MATCH?-1:s({type:"rule",value:e.name});return f([op$1.SILENT_FAILS_ON],C(e.expression,t),[op$1.SILENT_FAILS_OFF],h(n,[op$1.IF_ERROR],[op$1.FAIL,r],[]))},choice:function(e,t){return function e(t,n){var r=t[0].match||0,o=C(t[0],{sp:n.sp,env:p(n.env),action:null});return r===ALWAYS_MATCH?o:f(o,t.length>1?h(SOMETIMES_MATCH,[op$1.IF_ERROR],f([op$1.POP],e(t.slice(1),n)),[]):[])}(e.alternatives,t)},action:function(e,t){var n=p(t.env),r="sequence"!==e.expression.type||0===e.expression.elements.length,o=C(e.expression,{sp:t.sp+(r?1:0),env:n,action:e}),u=e.expression.match||0,a=r&&u!==NEVER_MATCH?c(!1,Object.keys(n),e):-1;return r?f([op$1.PUSH_CURR_POS],o,h(u,[op$1.IF_NOT_ERROR],f([op$1.LOAD_SAVED_POS,1],d(a,1,n,t.sp+2)),[]),[op$1.NIP]):o},sequence:function(e,t){return f([op$1.PUSH_CURR_POS],function t(n,r){if(n.length>0){var o=e.elements.length-n.length+1;return f(C(n[0],{sp:r.sp,env:r.env,pluck:r.pluck,action:null}),h(n[0].match||0,[op$1.IF_NOT_ERROR],t(n.slice(1),{sp:r.sp+1,env:r.env,pluck:r.pluck,action:r.action}),f(o>1?[op$1.POP_N,o]:[op$1.POP],[op$1.POP_CURR_POS],[op$1.PUSH_FAILED])))}if(r.pluck.length>0)return f([op$1.PLUCK,e.elements.length+1,r.pluck.length],r.pluck.map((function(e){return r.sp-e})));if(r.action){var u=c(!1,Object.keys(r.env),r.action);return f([op$1.LOAD_SAVED_POS,e.elements.length],d(u,e.elements.length+1,r.env,r.sp))}return f([op$1.WRAP,e.elements.length],[op$1.NIP])}(e.elements,{sp:t.sp+1,env:t.env,pluck:[],action:t.action}))},labeled:function(e,n){var r=n.env,o=e.label,u=n.sp+1;o&&(r=p(n.env),n.env[e.label]=u),e.pick&&n.pluck.push(u);var a=C(e.expression,{sp:n.sp,env:r,action:null});return o&&e.labelLocation&&t&&"source-and-map"===t.output?f([op$1.SOURCE_MAP_LABEL_PUSH,u,i(o),l(e.labelLocation)],a,[op$1.SOURCE_MAP_LABEL_POP,u]):a},text:function(e,t){return f([op$1.PUSH_CURR_POS],C(e.expression,{sp:t.sp+1,env:p(t.env),action:null}),h(e.match||0,[op$1.IF_NOT_ERROR],f([op$1.POP],[op$1.TEXT]),[op$1.NIP]))},simple_and:function(e,t){return g(e.expression,!1,t)},simple_not:function(e,t){return g(e.expression,!0,t)},optional:function(e,t){return f(C(e.expression,{sp:t.sp,env:p(t.env),action:null}),h(-(e.expression.match||0),[op$1.IF_ERROR],f([op$1.POP],[op$1.PUSH_NULL]),[]))},zero_or_more:function(e,t){var n=C(e.expression,{sp:t.sp+1,env:p(t.env),action:null});return f([op$1.PUSH_EMPTY_ARRAY],n,m(n),[op$1.POP])},one_or_more:function(e,t){var n=C(e.expression,{sp:t.sp+1,env:p(t.env),action:null});return f([op$1.PUSH_EMPTY_ARRAY],n,h(e.expression.match||0,[op$1.IF_NOT_ERROR],f(m(n),[op$1.POP]),f([op$1.POP],[op$1.POP],[op$1.PUSH_FAILED])))},repeated:function(e,t){var n=e.min?e.min:e.max,r="constant"!==n.type||n.value>0,o="constant"!==e.max.type&&null!==e.max.value,u=r?2:1,a=e.min?E(e.min,t.env,t.sp,2+("function"===e.max.type?1:0)):{pre:[],post:[],sp:t.sp},i=E(e.max,t.env,a.sp,u),s=C(e.expression,{sp:i.sp+u,env:p(t.env),action:null}),c=null!==e.delimiter?C(e.expression,{sp:i.sp+u+1,env:p(t.env),action:null}):s,l=function(e,t,n,r,o){return e?f([op$1.PUSH_CURR_POS],C(e,{sp:r.sp+o+1,env:p(r.env),action:null}),h(e.match||0,[op$1.IF_NOT_ERROR],f([op$1.POP],n,h(-t,[op$1.IF_ERROR],[op$1.POP,op$1.POP_CURR_POS,op$1.PUSH_FAILED],[op$1.NIP])),[op$1.NIP])):n}(e.delimiter,e.expression.match||0,c,t,u),d=_(l,e.max),g=o?_(s,e.max):s,A=f(r?[op$1.PUSH_CURR_POS]:[],[op$1.PUSH_EMPTY_ARRAY],g,m(d),[op$1.POP]);return f(a.pre,i.pre,r?function(e,t){var n="constant"===t.type?[op$1.IF_LT,t.value]:[op$1.IF_LT_DYNAMIC,t.sp];return f(e,h(SOMETIMES_MATCH,n,[op$1.POP,op$1.POP_CURR_POS,op$1.PUSH_FAILED],[op$1.NIP]))}(A,n):A,i.post,a.post)},group:function(e,t){return C(e.expression,{sp:t.sp,env:p(t.env),action:null})},semantic_and:function(e,t){return A(e,!1,t)},semantic_not:function(e,t){return A(e,!0,t)},rule_ref:function(t){return[op$1.RULE,asts$5.indexOfRule(e,t.name)]},literal:function(e){if(e.value.length>0){var t=e.match||0,n=t===SOMETIMES_MATCH||t===ALWAYS_MATCH&&!e.ignoreCase?i(e.ignoreCase?e.value.toLowerCase():e.value):-1,r=t!==ALWAYS_MATCH?s({type:"literal",value:e.value,ignoreCase:e.ignoreCase}):-1;return h(t,e.ignoreCase?[op$1.MATCH_STRING_IC,n]:[op$1.MATCH_STRING,n],e.ignoreCase?[op$1.ACCEPT_N,e.value.length]:[op$1.ACCEPT_STRING,n],[op$1.FAIL,r])}return[op$1.PUSH_EMPTY_STRING]},class:function(e){var t=e.match||0,n=t===SOMETIMES_MATCH?function(e){var t={value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase},n=JSON.stringify(t),o=r.findIndex((function(e){return JSON.stringify(e)===n}));return-1===o?r.push(t)-1:o}(e):-1,o=t!==ALWAYS_MATCH?s({type:"class",value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase}):-1;return h(t,[op$1.MATCH_CHAR_CLASS,n],[op$1.ACCEPT_N,1],[op$1.FAIL,o])},any:function(e){var t=e.match||0,n=t!==ALWAYS_MATCH?s({type:"any"}):-1;return h(t,[op$1.MATCH_ANY],[op$1.ACCEPT_N,1],[op$1.FAIL,n])}},t&&"source-and-map"===t.output&&Object.keys(v).forEach((function(e){var t=v[e];v[e]=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=t.apply(void 0,__spreadArray$3([e],n,!1));return void 0!==o&&e.location?f([op$1.SOURCE_MAP_PUSH,l(e.location)],o,[op$1.SOURCE_MAP_POP]):o}})),visitor$9.build(v));C(e)}var generateBytecode_1=generateBytecode$1,sourceMap={},sourceMapGenerator={},base64Vlq={},base64$3={};const intToCharMap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");base64$3.encode=function(e){if(0<=e&&e<intToCharMap.length)return intToCharMap[e];throw new TypeError("Must be between 0 and 63: "+e)};const base64$2=base64$3,VLQ_BASE_SHIFT=5,VLQ_BASE=1<<VLQ_BASE_SHIFT,VLQ_BASE_MASK=VLQ_BASE-1,VLQ_CONTINUATION_BIT=VLQ_BASE;function toVLQSigned(e){return e<0?1+(-e<<1):0+(e<<1)}base64Vlq.encode=function(e){let t,n="",r=toVLQSigned(e);do{t=r&VLQ_BASE_MASK,r>>>=VLQ_BASE_SHIFT,r>0&&(t|=VLQ_CONTINUATION_BIT),n+=base64$2.encode(t)}while(r>0);return n};var util$3={};function getArg(e,t,n){if(t in e)return e[t];if(3===arguments.length)return n;throw new Error('"'+t+'" is a required argument.')}util$3.getArg=getArg;const supportsNullProto=!("__proto__"in Object.create(null));function identity(e){return e}function toSetString(e){return isProtoString(e)?"$"+e:e}function fromSetString(e){return isProtoString(e)?e.slice(1):e}function isProtoString(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let n=t-10;n>=0;n--)if(36!==e.charCodeAt(n))return!1;return!0}function strcmp(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated(e,t){let n=e.generatedLine-t.generatedLine;return 0!==n?n:(n=e.generatedColumn-t.generatedColumn,0!==n?n:(n=strcmp(e.source,t.source),0!==n?n:(n=e.originalLine-t.originalLine,0!==n?n:(n=e.originalColumn-t.originalColumn,0!==n?n:strcmp(e.name,t.name)))))}util$3.toSetString=supportsNullProto?identity:toSetString,util$3.fromSetString=supportsNullProto?identity:fromSetString,util$3.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated;const PROTOCOL="http:",PROTOCOL_AND_HOST=`${PROTOCOL}//host`;function createSafeHandler(e){return t=>{const n=getURLType(t),r=buildSafeBase(t),o=new URL(t,r);e(o);const u=o.toString();return"absolute"===n?u:"scheme-relative"===n?u.slice(PROTOCOL.length):"path-absolute"===n?u.slice(PROTOCOL_AND_HOST.length):computeRelativeURL(r,u)}}function withBase(e,t){return new URL(e,t).toString()}function buildUniqueSegment(e,t){let n=0;for(;;){const r=e+n++;if(-1===t.indexOf(r))return r}}function buildSafeBase(e){const t=e.split("..").length-1,n=buildUniqueSegment("p",e);let r=`${PROTOCOL_AND_HOST}/`;for(let e=0;e<t;e++)r+=`${n}/`;return r}const ABSOLUTE_SCHEME=/^[A-Za-z0-9\+\-\.]+:/;function getURLType(e){return"/"===e[0]?"/"===e[1]?"scheme-relative":"path-absolute":ABSOLUTE_SCHEME.test(e)?"absolute":"path-relative"}function computeRelativeURL(e,t){"string"==typeof e&&(e=new URL(e)),"string"==typeof t&&(t=new URL(t));const n=t.pathname.split("/"),r=e.pathname.split("/");for(r.length>0&&!r[r.length-1]&&r.pop();n.length>0&&r.length>0&&n[0]===r[0];)n.shift(),r.shift();return r.map((()=>"..")).concat(n).join("/")+t.search+t.hash}const ensureDirectory=createSafeHandler((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),normalize=createSafeHandler((e=>{}));function join(e,t){const n=getURLType(t),r=getURLType(e);if(e=ensureDirectory(e),"absolute"===n)return withBase(t,void 0);if("absolute"===r)return withBase(t,e);if("scheme-relative"===n)return normalize(t);if("scheme-relative"===r)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL.length);if("path-absolute"===n)return normalize(t);if("path-absolute"===r)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL_AND_HOST.length);const o=buildSafeBase(t+e);return computeRelativeURL(o,withBase(t,withBase(e,o)))}function relative(e,t){const n=relativeIfPossible(e,t);return"string"==typeof n?n:normalize(t)}function relativeIfPossible(e,t){if(getURLType(e)!==getURLType(t))return null;const n=buildSafeBase(e+t),r=new URL(e,n),o=new URL(t,n);try{new URL("",o.toString())}catch(e){return null}return o.protocol!==r.protocol||o.user!==r.user||o.password!==r.password||o.hostname!==r.hostname||o.port!==r.port?null:computeRelativeURL(r,o)}util$3.normalize=normalize,util$3.join=join,util$3.relative=relative;var arraySet={};let ArraySet$1=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,n){const r=new e;for(let e=0,o=t.length;e<o;e++)r.add(t[e],n);return r}size(){return this._set.size}add(e,t){const n=this.has(e),r=this._array.length;n&&!t||this._array.push(e),n||this._set.set(e,r)}has(e){return this._set.has(e)}indexOf(e){const t=this._set.get(e);if(t>=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)}toArray(){return this._array.slice()}};arraySet.ArraySet=ArraySet$1;var mappingList={};const util$2=util$3;function generatedPositionAfter(e,t){const n=e.generatedLine,r=t.generatedLine,o=e.generatedColumn,u=t.generatedColumn;return r>n||r==n&&u>=o||util$2.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$1=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$2.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList.MappingList=MappingList$1;const base64VLQ=base64Vlq,util$1=util$3,ArraySet=arraySet.ArraySet,MappingList=mappingList.MappingList;let SourceMapGenerator$1=class e{constructor(e){e||(e={}),this._file=util$1.getArg(e,"file",null),this._sourceRoot=util$1.getArg(e,"sourceRoot",null),this._skipValidation=util$1.getArg(e,"skipValidation",!1),this._sources=new ArraySet,this._names=new ArraySet,this._mappings=new MappingList,this._sourcesContents=null}static fromSourceMap(t){const n=t.sourceRoot,r=new e({file:t.file,sourceRoot:n});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=n&&(t.source=util$1.relative(n,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),r.addMapping(t)})),t.sources.forEach((function(e){let o=e;null!=n&&(o=util$1.relative(n,e)),r._sources.has(o)||r._sources.add(o);const u=t.sourceContentFor(e);null!=u&&r.setSourceContent(e,u)})),r}addMapping(e){const t=util$1.getArg(e,"generated"),n=util$1.getArg(e,"original",null);let r=util$1.getArg(e,"source",null),o=util$1.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,n,r,o),null!=r&&(r=String(r),this._sources.has(r)||this._sources.add(r)),null!=o&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:n&&n.line,originalColumn:n&&n.column,source:r,name:o})}setSourceContent(e,t){let n=e;null!=this._sourceRoot&&(n=util$1.relative(this._sourceRoot,n)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$1.toSetString(n)]=t):this._sourcesContents&&(delete this._sourcesContents[util$1.toSetString(n)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,n){let r=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');r=e.file}const o=this._sourceRoot;null!=o&&(r=util$1.relative(o,r));const u=this._mappings.toArray().length>0?new ArraySet:this._sources,a=new ArraySet;this._mappings.unsortedForEach((function(t){if(t.source===r&&null!=t.originalLine){const r=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=r.source&&(t.source=r.source,null!=n&&(t.source=util$1.join(n,t.source)),null!=o&&(t.source=util$1.relative(o,t.source)),t.originalLine=r.line,t.originalColumn=r.column,null!=r.name&&(t.name=r.name))}const i=t.source;null==i||u.has(i)||u.add(i);const s=t.name;null==s||a.has(s)||a.add(s)}),this),this._sources=u,this._names=a,e.sources.forEach((function(t){const r=e.sourceContentFor(t);null!=r&&(null!=n&&(t=util$1.join(n,t)),null!=o&&(t=util$1.relative(o,t)),this.setSourceContent(t,r))}),this)}_validateMapping(e,t,n,r){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!n&&!r);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&n))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:t,name:r}))}_serializeMappings(){let e,t,n,r,o=0,u=1,a=0,i=0,s=0,c=0,l="";const p=this._mappings.toArray();for(let f=0,h=p.length;f<h;f++){if(t=p[f],e="",t.generatedLine!==u)for(o=0;t.generatedLine!==u;)e+=";",u++;else if(f>0){if(!util$1.compareByGeneratedPositionsInflated(t,p[f-1]))continue;e+=","}e+=base64VLQ.encode(t.generatedColumn-o),o=t.generatedColumn,null!=t.source&&(r=this._sources.indexOf(t.source),e+=base64VLQ.encode(r-c),c=r,e+=base64VLQ.encode(t.originalLine-1-i),i=t.originalLine-1,e+=base64VLQ.encode(t.originalColumn-a),a=t.originalColumn,null!=t.name&&(n=this._names.indexOf(t.name),e+=base64VLQ.encode(n-s),s=n)),l+=e}return l}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$1.relative(t,e));const n=util$1.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,n)?this._sourcesContents[n]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$1.prototype._version=3,sourceMapGenerator.SourceMapGenerator=SourceMapGenerator$1;var sourceNode={};const SourceMapGenerator=sourceMapGenerator.SourceMapGenerator,util=util$3,REGEX_NEWLINE=/(\r?\n)/,NEWLINE_CODE=10,isSourceNode="$$$isSourceNode$$$";let SourceNode$2=class e{constructor(e,t,n,r,o){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==n?null:n,this.name=null==o?null:o,this[isSourceNode]=!0,null!=r&&this.add(r)}static fromStringWithSourceMap(t,n,r){const o=new e,u=t.split(REGEX_NEWLINE);let a=0;const i=function(){return e()+(e()||"");function e(){return a<u.length?u[a++]:void 0}};let s,c=1,l=0,p=null;return n.eachMapping((function(e){if(null!==p){if(!(c<e.generatedLine)){s=u[a]||"";const t=s.substr(0,e.generatedColumn-l);return u[a]=s.substr(e.generatedColumn-l),l=e.generatedColumn,f(p,t),void(p=e)}f(p,i()),c++,l=0}for(;c<e.generatedLine;)o.add(i()),c++;l<e.generatedColumn&&(s=u[a]||"",o.add(s.substr(0,e.generatedColumn)),u[a]=s.substr(e.generatedColumn),l=e.generatedColumn),p=e}),this),a<u.length&&(p&&f(p,i()),o.add(u.splice(a).join(""))),n.sources.forEach((function(e){const t=n.sourceContentFor(e);null!=t&&(null!=r&&(e=util.join(r,e)),o.setSourceContent(e,t))})),o;function f(t,n){if(null===t||void 0===t.source)o.add(n);else{const u=r?util.join(r,t.source):t.source;o.add(new e(t.originalLine,t.originalColumn,u,n,t.name))}}}add(e){if(Array.isArray(e))e.forEach((function(e){this.add(e)}),this);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this}prepend(e){if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let n=0,r=this.children.length;n<r;n++)t=this.children[n],t[isSourceNode]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})}join(e){let t,n;const r=this.children.length;if(r>0){for(t=[],n=0;n<r-1;n++)t.push(this.children[n]),t.push(e);t.push(this.children[n]),this.children=t}return this}replaceRight(e,t){const n=this.children[this.children.length-1];return n[isSourceNode]?n.replaceRight(e,t):"string"==typeof n?this.children[this.children.length-1]=n.replace(e,t):this.children.push("".replace(e,t)),this}setSourceContent(e,t){this.sourceContents[util.toSetString(e)]=t}walkSourceContents(e){for(let t=0,n=this.children.length;t<n;t++)this.children[t][isSourceNode]&&this.children[t].walkSourceContents(e);const t=Object.keys(this.sourceContents);for(let n=0,r=t.length;n<r;n++)e(util.fromSetString(t[n]),this.sourceContents[t[n]])}toString(){let e="";return this.walk((function(t){e+=t})),e}toStringWithSourceMap(e){const t={code:"",line:1,column:0},n=new SourceMapGenerator(e);let r=!1,o=null,u=null,a=null,i=null;return this.walk((function(e,s){t.code+=e,null!==s.source&&null!==s.line&&null!==s.column?(o===s.source&&u===s.line&&a===s.column&&i===s.name||n.addMapping({source:s.source,original:{line:s.line,column:s.column},generated:{line:t.line,column:t.column},name:s.name}),o=s.source,u=s.line,a=s.column,i=s.name,r=!0):r&&(n.addMapping({generated:{line:t.line,column:t.column}}),o=null,r=!1);for(let u=0,a=e.length;u<a;u++)e.charCodeAt(u)===NEWLINE_CODE?(t.line++,t.column=0,u+1===a?(o=null,r=!1):r&&n.addMapping({source:s.source,original:{line:s.line,column:s.column},generated:{line:t.line,column:t.column},name:s.name})):t.column++})),this.walkSourceContents((function(e,t){n.setSourceContent(e,t)})),{code:t.code,map:n}}};sourceNode.SourceNode=SourceNode$2,sourceMap.SourceMapGenerator=sourceMapGenerator.SourceMapGenerator,sourceMap.SourceNode=sourceNode.SourceNode;var SourceNode$1=sourceMap.SourceNode,GrammarLocation$2=grammarLocation,Stack$1=function(){function e(e,t,n,r){this.sp=-1,this.maxSp=-1,this.varName=t,this.ruleName=e,this.type=n,this.bytecode=r,this.labels={},this.sourceMapStack=[]}return e.prototype.name=function(e){if(e<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack underflow: attempt to use a variable '").concat(this.varName,"<x>' at an index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.varName+e},e.sourceNode=function(e,t,n){var r=GrammarLocation$2.offsetStart(e);return new SourceNode$1(r.line,r.column?r.column-1:null,String(e.source),t,n)},e.prototype.push=function(t){++this.sp>this.maxSp&&(this.maxSp=this.sp);var n=this.labels[this.sp],r=[this.name(this.sp)," = ",t,";"];if(n){if(this.sourceMapStack.length){var o=e.sourceNode(n.location,r.splice(0,2),n.label),u=this.sourceMapPopInternal(),a=u.parts,i=u.location,s=i.start.offset<n.location.end.offset?{start:n.location.end,end:i.end,source:i.source}:i,c=e.sourceNode(s,r.concat("\n"));return this.sourceMapStack.push([a,a.length+1,i]),new SourceNode$1(null,null,n.location.source,[o,c])}return e.sourceNode(n.location,r.concat("\n"))}return r.join("")},e.prototype.pop=function(e){var t=this;return void 0!==e?(this.sp-=e,Array.from({length:e},(function(e,n){return t.name(t.sp+1+n)}))):this.name(this.sp--)},e.prototype.top=function(){return this.name(this.sp)},e.prototype.index=function(e){if(e<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack overflow: attempt to get a variable at a negative index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.name(this.sp-e)},e.prototype.result=function(){if(this.maxSp<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack is empty, can't get the result.\nBytecode: ").concat(this.bytecode));return this.name(0)},e.prototype.defines=function(){var e=this;return this.maxSp<0?"":this.type+" "+Array.from({length:this.maxSp+1},(function(t,n){return e.name(n)})).join(", ")+";"},e.prototype.checkedIf=function(e,t,n){var r=this.sp,o=t();if(!n)return[o];var u=this.sp;this.sp=r;var a=n();if(u!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+e+": Branches of a condition can't move the stack pointer differently (before: "+r+", after then: "+u+", after else: "+this.sp+"). Bytecode: "+this.bytecode);return[o,a]},e.prototype.checkedLoop=function(e,t){var n=this.sp,r=t();if(n!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+e+": Body of a loop can't move the stack pointer (before: "+n+", after: "+this.sp+"). Bytecode: "+this.bytecode);return r},e.prototype.sourceMapPush=function(e,t){if(this.sourceMapStack.length){var n=this.sourceMapStack[this.sourceMapStack.length-1];n[2].start.offset===t.start.offset&&n[2].end.offset>t.end.offset&&(n[2]={start:t.end,end:n[2].end,source:n[2].source})}this.sourceMapStack.push([e,e.length,t])},e.prototype.sourceMapPopInternal=function(){var e=this.sourceMapStack.pop();if(!e)throw new RangeError("Rule '".concat(this.ruleName,"': Attempting to pop an empty source map stack.\nBytecode: ").concat(this.bytecode));var t=e[0],n=e[1],r=e[2],o=t.splice(n).map((function(e){return e instanceof SourceNode$1?e:e+"\n"}));if(o.length){var u=GrammarLocation$2.offsetStart(r);t.push(new SourceNode$1(u.line,u.column-1,String(r.source),o))}return{parts:t,location:r}},e.prototype.sourceMapPop=function(e){var t=this.sourceMapPopInternal().location;if(this.sourceMapStack.length&&t.end.offset<this.sourceMapStack[this.sourceMapStack.length-1][2].end.offset){var n=this.sourceMapPopInternal(),r=n.parts,o=n.location,u=o.start.offset<t.end.offset?{start:t.end,end:o.end,source:o.source}:o;this.sourceMapStack.push([r,r.length+(e||0),u])}},e}(),stack=Stack$1,version="3.0.2",utils={};function hex(e){return e.charCodeAt(0).toString(16).toUpperCase()}function stringEscape$1(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+hex(e)})).replace(/[\x10-\x1F\x7F-\xFF]/g,(function(e){return"\\x"+hex(e)})).replace(/[\u0100-\u0FFF]/g,(function(e){return"\\u0"+hex(e)})).replace(/[\u1000-\uFFFF]/g,(function(e){return"\\u"+hex(e)}))}function regexpClassEscape$1(e){return e.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+hex(e)})).replace(/[\x10-\x1F\x7F-\xFF]/g,(function(e){return"\\x"+hex(e)})).replace(/[\u0100-\u0FFF]/g,(function(e){return"\\u0"+hex(e)})).replace(/[\u1000-\uFFFF]/g,(function(e){return"\\u"+hex(e)}))}function base64$1(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=e.length%3,r=e.length-n,o="",u=0;u<r;u+=3)o+=t[e[u]>>2],o+=t[(3&e[u])<<4|e[u+1]>>4],o+=t[(15&e[u+1])<<2|e[u+2]>>6],o+=t[63&e[u+2]];return 1===n?(o+=t[e[r]>>2],o+=t[(3&e[r])<<4],o+="=="):2===n&&(o+=t[e[r]>>2],o+=t[(3&e[r])<<4|e[r+1]>>4],o+=t[(15&e[r+1])<<2],o+="="),o}utils.hex=hex,utils.stringEscape=stringEscape$1,utils.regexpClassEscape=regexpClassEscape$1,utils.base64=base64$1;var __spreadArray$2=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,u=t.length;o<u;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},asts$4=asts_1,op=opcodes_1,Stack=stack,VERSION$1=version,_a=utils,stringEscape=_a.stringEscape,regexpClassEscape=_a.regexpClassEscape,SourceNode=sourceMap.SourceNode,GrammarLocation$1=grammarLocation;function toSourceNode(e,t,n){var r=GrammarLocation$1.offsetStart(t),o=r.line,u=r.column-1,a=e.split("\n");return 1===a.length?new SourceNode(o,u,String(t.source),e,n):new SourceNode(null,null,String(t.source),a.map((function(e,r){return new SourceNode(o+r,0===r?u:0,String(t.source),r===a.length-1?e:[e,"\n"],n)})))}function wrapInSourceNode(e,t,n,r,o){if(n){var u=GrammarLocation$1.offsetEnd(n);return new SourceNode(null,null,String(n.source),[e,toSourceNode(t,n,o),new SourceNode(u.line,u.column-1,String(n.source),r)])}return new SourceNode(null,null,null,[e,t,r])}function generateJS$1(e,t){if(!(e.literals&&e.locations&&e.classes&&e.expectations&&e.functions))throw new Error("generateJS: generate bytecode was not called.");var n=e.literals,r=e.locations,o=e.classes,u=e.expectations,a=e.functions;if(!t.allowedStartRules)throw new Error("generateJS: options.allowedStartRules was not set.");var i=t.allowedStartRules,s=t.dependencies||{};function c(e){var t=!0,n=0;return function e(r){return Array.isArray(r)?r.map((function(t){return e(t)})):r instanceof SourceNode?(n++,r.children=e(r.children),n--,r):(r=t?r.replace(/^(.+)$/gm," $1"):r.replace(/\n(\s*\S)/g,"\n $1"),t=!n||r.endsWith("\n"),r)}(e)}function l(e){return"peg$c"+e}function p(e){return"peg$r"+e}function f(e){return"peg$e"+e}function h(e){return"peg$f"+e}function d(e){return"peg$parse"+e}function g(e){return e.codeLocation?toSourceNode(e.code,e.codeLocation,"$"+e.type):e.code}e.code=function(e){function n(){return["// @generated by Peggy ".concat(VERSION$1,"."),"//","// https://peggyjs.org/"]}function r(){return t.trace?["{"," SyntaxError: peg$SyntaxError,"," DefaultTracer: peg$DefaultTracer,"," parse: peg$parse","}"].join("\n"):["{"," SyntaxError: peg$SyntaxError,"," parse: peg$parse","}"].join("\n")}var o={bare:function(){return __spreadArray$2(__spreadArray$2([],n(),!0),["(function() {",' "use strict";',"",e,"",c("return "+r()+";"),"})()"],!1)},commonjs:function(){var t=Object.keys(s),o=n();return o.push("",'"use strict";',""),t.length>0&&(t.forEach((function(e){o.push("var "+e+' = require("'+stringEscape(s[e])+'");')})),o.push("")),o.push(e,"","module.exports = "+r()+";"),o},es:function(){var r=Object.keys(s),o=n();return o.push(""),r.length>0&&(r.forEach((function(e){o.push("import "+e+' from "'+stringEscape(s[e])+'";')})),o.push("")),o.push(e,"","export {"," peg$SyntaxError as SyntaxError,",t.trace?" peg$DefaultTracer as DefaultTracer,":""," peg$parse as parse","};"),o},amd:function(){var t=Object.keys(s),o="["+t.map((function(e){return s[e]})).map((function(e){return'"'+stringEscape(e)+'"'})).join(", ")+"]",u=t.join(", ");return __spreadArray$2(__spreadArray$2([],n(),!0),["define("+o+", function("+u+") {",' "use strict";',"",e,"",c("return "+r()+";"),"});"],!1)},globals:function(){return __spreadArray$2(__spreadArray$2([],n(),!0),["(function(root) {",' "use strict";',"",e,"",c("root."+t.exportVar+" = "+r()+";"),"})(this);"],!1)},umd:function(){var o=Object.keys(s),u=o.map((function(e){return s[e]})),a="["+u.map((function(e){return'"'+stringEscape(e)+'"'})).join(", ")+"]",i=u.map((function(e){return'require("'+stringEscape(e)+'")'})).join(", "),l=o.join(", "),p=n();return p.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+a+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+i+");"),null!==t.exportVar&&p.push(" } else {"," root."+t.exportVar+" = factory();"),p.push(" }","})(this, function("+l+") {",' "use strict";',"",e,"",c("return "+r()+";"),"});"),p}}[t.format||"bare"]();return new SourceNode(null,null,t.grammarSource,o.map((function(e){return e instanceof SourceNode?e:e+"\n"})))}(function(){var s=[];e.topLevelInitializer&&(s.push(g(e.topLevelInitializer)),s.push("")),s.push("function peg$subclass(child, parent) {"," function C() { this.constructor = child; }"," C.prototype = parent.prototype;"," child.prototype = new C();","}","","function peg$SyntaxError(message, expected, found, location) {"," var self = Error.call(this, message);"," // istanbul ignore next Check is a necessary evil to support older environments"," if (Object.setPrototypeOf) {"," Object.setPrototypeOf(self, peg$SyntaxError.prototype);"," }"," self.expected = expected;"," self.found = found;"," self.location = location;",' self.name = "SyntaxError";'," return self;","}","","peg$subclass(peg$SyntaxError, Error);","","function peg$padEnd(str, targetLength, padString) {",' padString = padString || " ";'," if (str.length > targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))'," ? this.location.source.offset(s)"," : s;",' var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;'," if (src) {"," var e = this.location.end;"," var filler = peg$padEnd(\"\", offset_s.line.toString().length, ' ');"," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --\x3e " + loc + "\\n"',' + filler + " |\\n"',' + offset_s.line + " | " + line + "\\n"',' + filler + " | " + peg$padEnd("", s.column - 1, \' \')',' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/"/g, "\\\\\\"")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/\\]/g, "\\\\]")',' .replace(/\\^/g, "\\\\^")',' .replace(/-/g, "\\\\-")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),t.trace&&s.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");var A="{ "+i.map((function(e){return e+": "+d(e)})).join(", ")+" }",m=d(i[0]);return s.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+A+";"," var peg$startRuleFunction = "+m+";","",new SourceNode(null,null,t.grammarSource,__spreadArray$2([n.map((function(e,t){return" var "+l(t)+' = "'+stringEscape(e)+'";'})).concat("",o.map((function(e,t){return" var "+p(t)+" = /^["+((n=e).inverted?"^":"")+n.value.map((function(e){return Array.isArray(e)?regexpClassEscape(e[0])+"-"+regexpClassEscape(e[1]):regexpClassEscape(e)})).join("")+"]/"+(n.ignoreCase?"i":"")+";";var n}))).concat("",u.map((function(e,t){return" var "+f(t)+" = "+function(e){switch(e.type){case"rule":return'peg$otherExpectation("'+stringEscape(e.value)+'")';case"literal":return'peg$literalExpectation("'+stringEscape(e.value)+'", '+e.ignoreCase+")";case"class":return"peg$classExpectation(["+e.value.map((function(e){return Array.isArray(e)?'["'+stringEscape(e[0])+'", "'+stringEscape(e[1])+'"]':'"'+stringEscape(e)+'"'})).join(", ")+"], "+e.inverted+", "+e.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(e)+")")}}(e)+";"}))).concat("").join("\n")],a.map((function(e,t){return wrapInSourceNode("\n var ".concat(h(t)," = function(").concat(e.params.join(", "),") {"),e.body,e.location,"};")})),!0)),""," var peg$currPos = 0;"," var peg$savedPos = 0;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = 0;"," var peg$maxFailExpected = [];"," var peg$silentFails = 0;",""),t.cache&&s.push(" var peg$resultsCache = {};",""),t.trace&&s.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),s.push(" var peg$result;","",' if ("startRule" in options) {'," if (!(options.startRule in peg$startRuleFunctions)) {",' throw new Error("Can\'t start parsing from rule \\"" + options.startRule + "\\".");'," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," if (pos >= peg$posDetailsCache.length) {"," p = peg$posDetailsCache.length - 1;"," } else {"," p = pos;"," while (!peg$posDetailsCache[--p]) {}"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos, offset) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," var res = {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };",' if (offset && peg$source && (typeof peg$source.offset === "function")) {'," res.start = peg$source.offset(res.start);"," res.end = peg$source.offset(res.end);"," }"," return res;"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),e.rules.forEach((function(o){s.push.apply(s,c(function(o){var u=[],a=o.bytecode,i=new Stack(o.name,"s","var",a),s=function t(o){var u=0,a=o.length,s=[],g=void 0;function A(e,n,r){var a=n+3,l=o[u+a-2],p=o[u+a-1],f=i.checkedIf(u,(function(){return u+=a+l,(r||t)(o.slice(u-l,u))}),p>0?function(){return u+=p,t(o.slice(u-p,u))}:null),h=f[0],d=f[1];s.push("if ("+e+") {"),s.push.apply(s,c(h)),p>0&&(s.push("} else {"),s.push.apply(s,c(d))),s.push("}")}function m(e,n,r){var a=n+3,c=1===r?"input.charAt(peg$currPos)":"input.substr(peg$currPos, "+r+")",l=null;o[u+a]===op.ACCEPT_N&&o[u+a+1]===r&&(s.push(i.push(c)),c=i.pop(),l=function(e){i.sp++;var n=t(e.slice(2));return n.unshift(1===r?"peg$currPos++;":"peg$currPos += "+r+";"),n}),A(e(c,null!==l),n,l)}for(var E=function(){switch(o[u]){case op.PUSH_EMPTY_STRING:s.push(i.push("''")),u++;break;case op.PUSH_CURR_POS:s.push(i.push("peg$currPos")),u++;break;case op.PUSH_UNDEFINED:s.push(i.push("undefined")),u++;break;case op.PUSH_NULL:s.push(i.push("null")),u++;break;case op.PUSH_FAILED:s.push(i.push("peg$FAILED")),u++;break;case op.PUSH_EMPTY_ARRAY:s.push(i.push("[]")),u++;break;case op.POP:i.pop(),u++;break;case op.POP_CURR_POS:s.push("peg$currPos = "+i.pop()+";"),u++;break;case op.POP_N:i.pop(o[u+1]),u+=2;break;case op.NIP:g=i.pop(),i.pop(),s.push(i.push(g)),u++;break;case op.APPEND:g=i.pop(),s.push(i.top()+".push("+g+");"),u++;break;case op.WRAP:s.push(i.push("["+i.pop(o[u+1]).join(", ")+"]")),u+=2;break;case op.TEXT:s.push(i.push("input.substring("+i.pop()+", peg$currPos)")),u++;break;case op.PLUCK:var a=o[u+3-1],E=3+a;g=o.slice(u+3,u+E),g=1===a?i.index(g[0]):"[ ".concat(g.map((function(e){return i.index(e)})).join(", ")," ]"),i.pop(o[u+1]),s.push(i.push(g)),u+=E;break;case op.IF:A(i.top(),0);break;case op.IF_ERROR:A(i.top()+" === peg$FAILED",0);break;case op.IF_NOT_ERROR:A(i.top()+" !== peg$FAILED",0);break;case op.IF_LT:A(i.top()+".length < "+o[u+1],1);break;case op.IF_GE:A(i.top()+".length >= "+o[u+1],1);break;case op.IF_LT_DYNAMIC:A(i.top()+".length < ("+i.index(o[u+1])+"|0)",1);break;case op.IF_GE_DYNAMIC:A(i.top()+".length >= ("+i.index(o[u+1])+"|0)",1);break;case op.WHILE_NOT_ERROR:S=i.top()+" !== peg$FAILED",y=o[u+2-1],F=i.checkedLoop(u,(function(){return u+=2+y,t(o.slice(u-y,u))})),s.push("while ("+S+") {"),s.push.apply(s,c(F)),s.push("}");break;case op.MATCH_ANY:A("input.length > peg$currPos",0);break;case op.MATCH_STRING:var _=o[u+1],v=n[_];m((function(e,t){return v.length>1?"".concat(e," === ").concat(l(_)):(e=t?"".concat(e,".charCodeAt(0)"):"input.charCodeAt(peg$currPos)","".concat(e," === ").concat(v.charCodeAt(0)))}),1,v.length);break;case op.MATCH_STRING_IC:var C=o[u+1];m((function(e){return"".concat(e,".toLowerCase() === ").concat(l(C))}),1,n[C].length);break;case op.MATCH_CHAR_CLASS:var $=o[u+1];m((function(e){return"".concat(p($),".test(").concat(e,")")}),1,1);break;case op.ACCEPT_N:s.push(i.push(o[u+1]>1?"input.substr(peg$currPos, "+o[u+1]+")":"input.charAt(peg$currPos)")),s.push(o[u+1]>1?"peg$currPos += "+o[u+1]+";":"peg$currPos++;"),u+=2;break;case op.ACCEPT_STRING:s.push(i.push(l(o[u+1]))),s.push(n[o[u+1]].length>1?"peg$currPos += "+n[o[u+1]].length+";":"peg$currPos++;"),u+=2;break;case op.FAIL:s.push(i.push("peg$FAILED")),s.push("if (peg$silentFails === 0) { peg$fail("+f(o[u+1])+"); }"),u+=2;break;case op.LOAD_SAVED_POS:s.push("peg$savedPos = "+i.index(o[u+1])+";"),u+=2;break;case op.UPDATE_SAVED_POS:s.push("peg$savedPos = peg$currPos;"),u++;break;case op.CALL:g=function(e){var t=o[u+4-1];return h(o[u+1])+"("+o.slice(u+4,u+4+t).map((function(e){return i.index(e)})).join(", ")+")"}(),i.pop(o[u+2]),s.push(i.push(g)),u+=4+o[u+3];break;case op.RULE:s.push(i.push(d(e.rules[o[u+1]].name)+"()")),u+=2;break;case op.SILENT_FAILS_ON:s.push("peg$silentFails++;"),u++;break;case op.SILENT_FAILS_OFF:s.push("peg$silentFails--;"),u++;break;case op.SOURCE_MAP_PUSH:i.sourceMapPush(s,r[o[u+1]]),u+=2;break;case op.SOURCE_MAP_POP:i.sourceMapPop(),u++;break;case op.SOURCE_MAP_LABEL_PUSH:i.labels[o[u+1]]={label:n[o[u+2]],location:r[o[u+3]]},u+=4;break;case op.SOURCE_MAP_LABEL_POP:delete i.labels[o[u+1]],u+=2;break;default:throw new Error("Invalid opcode: "+o[u]+".")}var S,y,F};u<a;)E();return s}(a);return u.push(wrapInSourceNode("function ",d(o.name),o.nameLocation,"() {\n",o.name)),t.trace&&u.push(" var startPos = peg$currPos;"),u.push(c(i.defines())),u.push.apply(u,c(function(n,r){var o=[];return o.push(""),t.trace&&o.push("peg$tracer.trace({",' type: "rule.enter",'," rule: "+n+","," location: peg$computeLocation(startPos, startPos, true)","});",""),t.cache&&(o.push("var key = peg$currPos * "+e.rules.length+" + "+r+";","var cached = peg$resultsCache[key];","","if (cached) {"," peg$currPos = cached.nextPos;",""),t.trace&&o.push("if (cached.result !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+n+","," result: cached.result,"," location: peg$computeLocation(startPos, peg$currPos, true)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+n+","," location: peg$computeLocation(startPos, startPos, true)"," });","}",""),o.push(" return cached.result;","}","")),o}('"'+stringEscape(o.name)+'"',asts$4.indexOfRule(e,o.name)))),u.push.apply(u,c(s)),u.push.apply(u,c(function(e,n){var r=[];return t.cache&&r.push("","peg$resultsCache[key] = { nextPos: peg$currPos, result: "+n+" };"),t.trace&&r.push("","if ("+n+" !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+e+","," result: "+n+","," location: peg$computeLocation(startPos, peg$currPos, true)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+e+","," location: peg$computeLocation(startPos, startPos, true)"," });","}"),r.push("","return "+n+";"),r}('"'+stringEscape(o.name)+'"',i.result()))),u.push("}"),u}(o))),s.push("")})),e.initializer&&(s.push(g(e.initializer)),s.push("")),s.push(" peg$result = peg$startRuleFunction();",""," if (peg$result !== peg$FAILED && peg$currPos === input.length) {"," return peg$result;"," } else {"," if (peg$result !== peg$FAILED && peg$currPos < input.length) {"," peg$fail(peg$endExpectation());"," }",""," throw peg$buildStructuredError("," peg$maxFailExpected,"," peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,"," peg$maxFailPos < input.length"," ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)"," : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)"," );"," }","}"),new SourceNode(null,null,t.grammarSource,s.map((function(e){return e instanceof SourceNode?e:e+"\n"})))}())}var generateJs=generateJS$1,asts$3=asts_1,visitor$8=visitor_1;function removeProxyRules$1(e,t,n){var r=[];e.rules.forEach((function(o,u){var a;"rule"===(a=o).type&&"rule_ref"===a.expression.type&&(function(e,t,r){visitor$8.build({rule_ref:function(o){o.name===t&&(o.name=r,n.info('Proxy rule "'.concat(t,'" replaced by the rule "').concat(r,'"'),o.location,[{message:"This rule will be used",location:asts$3.findRule(e,r).nameLocation}]))}})(e)}(e,o.name,o.expression.name),-1===t.allowedStartRules.indexOf(o.name)&&r.push(u))})),r.reverse(),r.forEach((function(t){e.rules.splice(t,1)}))}var removeProxyRules_1=removeProxyRules$1,__assign=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},__assign.apply(this,arguments)},__spreadArray$1=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,u=t.length;o<u;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},visitor$7=visitor_1;function cloneOver(e,t){var n=e,r=t;Object.keys(n).forEach((function(e){return delete n[e]})),Object.keys(r).forEach((function(e){n[e]=r[e]}))}function cleanParts(e){e.sort((function(e,t){var n=Array.isArray(e)?e:[e,e],r=n[0],o=n[1],u=Array.isArray(t)?t:[t,t],a=u[0],i=u[1];return r!==a?r<a?-1:1:o!==i?o>i?-1:1:0}));for(var t="",n="",r=0;r<e.length;r++){var o=e[r],u=Array.isArray(o)?o:[o,o],a=u[0],i=u[1];i<=n?e.splice(r--,1):n.charCodeAt(0)+1>=a.charCodeAt(0)?(e.splice(r--,1),e[r]=[t,n=i]):(t=a,n=i)}return e}function mergeCharacterClasses$1(e){var t=Object.create(null);e.rules.forEach((function(e){return t[e.name]=e.expression}));var n=Object.create(null),r=[function(e,r){if("class"===e.type&&!e.inverted)return r&&((e=__assign({},e)).parts=__spreadArray$1([],e.parts,!0)),e;if("literal"===e.type&&1===e.value.length)return{type:"class",parts:[e.value],inverted:!1,ignoreCase:e.ignoreCase,location:e.location};if("rule_ref"===e.type){var a=t[e.name];if(a){n[e.name]||(n[e.name]=!0,u(a));var i=o(a,!0);return i&&(i.location=e.location),i}}return null},visitor$7.build({choice:function(e){var t=null,n=!1;e.alternatives.forEach((function(r,a){var i;u(r);var s=o(r);s?t&&t.ignoreCase===s.ignoreCase?((i=t.parts).push.apply(i,s.parts),e.alternatives[a-1]=t,e.alternatives[a]=t,t.location={source:t.location.source,start:t.location.start,end:s.location.end},n=!0):t=s:t=null})),n&&(e.alternatives=e.alternatives.filter((function(e,t,n){return!t||e!==n[t-1]})),e.alternatives.forEach((function(t,n){"class"===t.type&&(t.parts=cleanParts(t.parts),1!==t.parts.length||Array.isArray(t.parts[0])||t.inverted||(e.alternatives[n]={type:"literal",value:t.parts[0],ignoreCase:t.ignoreCase,location:t.location}))})),1===e.alternatives.length&&cloneOver(e,e.alternatives[0]))},text:function(e){if(u(e.expression),"class"===e.expression.type||"literal"===e.expression.type){var t=e.location;cloneOver(e,e.expression),e.location=t}}})],o=r[0],u=r[1];e.rules.forEach((function(e){n[e.name]=!0,u(e.expression)}))}var mergeCharacterClasses_1=mergeCharacterClasses$1,visitor$6=visitor_1;function reportDuplicateLabels$1(e,t,n){function r(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n]})),t}function o(e,t){u(e.expression,r(t))}var u=visitor$6.build({rule:function(e){u(e.expression,{})},choice:function(e,t){e.alternatives.forEach((function(e){u(e,r(t))}))},action:o,labeled:function(e,t){var r=e.label;r&&Object.prototype.hasOwnProperty.call(t,r)&&n.error('Label "'.concat(e.label,'" is already defined'),e.labelLocation,[{message:"Original label location",location:t[r]}]),u(e.expression,t),t[e.label]=e.labelLocation},text:o,simple_and:o,simple_not:o,optional:o,zero_or_more:o,one_or_more:o,repeated:function(e,t){e.delimiter&&u(e.delimiter,r(t)),u(e.expression,r(t))},group:o});u(e)}var reportDuplicateLabels_1=reportDuplicateLabels$1,visitor$5=visitor_1;function reportDuplicateRules$1(e,t,n){var r={};visitor$5.build({rule:function(e){Object.prototype.hasOwnProperty.call(r,e.name)?n.error('Rule "'.concat(e.name,'" is already defined'),e.nameLocation,[{message:"Original rule location",location:r[e.name]}]):r[e.name]=e.nameLocation}})(e)}var reportDuplicateRules_1=reportDuplicateRules$1,asts$2=asts_1,visitor$4=visitor_1;function reportInfiniteRecursion$1(e,t,n){var r=[],o=[],u=visitor$4.build({rule:function(e){r.push(e.name),u(e.expression),r.pop()},sequence:function(t){t.elements.every((function(t){return u(t),!asts$2.alwaysConsumesOnSuccess(e,t)}))},repeated:function(t){u(t.expression),t.delimiter&&!asts$2.alwaysConsumesOnSuccess(e,t.expression)&&u(t.delimiter)},rule_ref:function(t){o.push(t);var a=asts$2.findRule(e,t.name);if(-1!==r.indexOf(t.name))return r.push(t.name),void n.error("Possible infinite loop when parsing (left recursion: "+r.join(" -> ")+")",a.nameLocation,o.map((function(e,t,n){return{message:t+1!==n.length?"Step ".concat(t+1,': call of the rule "').concat(e.name,'" without input consumption'):"Step ".concat(t+1,": call itself without input consumption - left recursion"),location:e.location}})));a&&u(a),o.pop()}});u(e)}var reportInfiniteRecursion_1=reportInfiniteRecursion$1,asts$1=asts_1,visitor$3=visitor_1;function reportInfiniteRepetition$1(e,t,n){var r=visitor$3.build({zero_or_more:function(t){asts$1.alwaysConsumesOnSuccess(e,t.expression)||n.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},one_or_more:function(t){asts$1.alwaysConsumesOnSuccess(e,t.expression)||n.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},repeated:function(t){if(t.delimiter&&r(t.delimiter),!(asts$1.alwaysConsumesOnSuccess(e,t.expression)||t.delimiter&&asts$1.alwaysConsumesOnSuccess(e,t.delimiter)))if(null===t.max.value)n.error("Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",t.location);else{var o=t.min?t.min:t.max;n.warning("constant"===o.type&&"constant"===t.max.type?"An expression may not consume any input and may always match ".concat(t.max.value," times"):"An expression may not consume any input and may always match with a maximum repetition count",t.location)}}});r(e)}var reportInfiniteRepetition_1=reportInfiniteRepetition$1,asts=asts_1,visitor$2=visitor_1;function reportUndefinedRules$1(e,t,n){visitor$2.build({rule_ref:function(t){asts.findRule(e,t.name)||n.error('Rule "'.concat(t.name,'" is not defined'),t.location)}})(e)}var reportUndefinedRules_1=reportUndefinedRules$1,visitor$1=visitor_1;function reportIncorrectPlucking$1(e,t,n){var r=visitor$1.build({action:function(e){r(e.expression,e)},labeled:function(e,t){e.pick&&t&&n.error('"@" cannot be used with an action block',e.labelLocation,[{message:"Action block location",location:t.codeLocation}]),r(e.expression)}});r(e)}var reportIncorrectPlucking_1=reportIncorrectPlucking$1,__spreadArray=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,u=t.length;o<u;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},GrammarError$1=grammarError,Defaults=function(){function e(e){"function"==typeof(e=void 0!==e?e:{}).error&&(this.error=e.error),"function"==typeof e.warning&&(this.warning=e.warning),"function"==typeof e.info&&(this.info=e.info)}return e.prototype.error=function(){},e.prototype.warning=function(){},e.prototype.info=function(){},e}(),Session$1=function(){function e(e){this._callbacks=new Defaults(e),this._firstError=null,this.errors=0,this.problems=[],this.stage=null}return e.prototype.error=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];++this.errors,null===this._firstError&&(this._firstError=new(GrammarError$1.bind.apply(GrammarError$1,__spreadArray([void 0],t,!1))),this._firstError.stage=this.stage,this._firstError.problems=this.problems),this.problems.push(__spreadArray(["error"],t,!0)),(e=this._callbacks).error.apply(e,__spreadArray([this.stage],t,!1))},e.prototype.warning=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.problems.push(__spreadArray(["warning"],t,!0)),(e=this._callbacks).warning.apply(e,__spreadArray([this.stage],t,!1))},e.prototype.info=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.problems.push(__spreadArray(["info"],t,!0)),(e=this._callbacks).info.apply(e,__spreadArray([this.stage],t,!1))},e.prototype.checkErrors=function(){if(0!==this.errors)throw this._firstError},e}(),session=Session$1,generateBytecode=generateBytecode_1,generateJS=generateJs,inferenceMatchResult=inferenceMatchResult_1,removeProxyRules=removeProxyRules_1,mergeCharacterClasses=mergeCharacterClasses_1,reportDuplicateLabels=reportDuplicateLabels_1,reportDuplicateRules=reportDuplicateRules_1,reportInfiniteRecursion=reportInfiniteRecursion_1,reportInfiniteRepetition=reportInfiniteRepetition_1,reportUndefinedRules=reportUndefinedRules_1,reportIncorrectPlucking=reportIncorrectPlucking_1,Session=session,visitor=visitor_1,base64=utils.base64;function processOptions(e,t){var n={};return Object.keys(e).forEach((function(t){n[t]=e[t]})),Object.keys(t).forEach((function(e){Object.prototype.hasOwnProperty.call(n,e)||(n[e]=t[e])})),n}function isSourceMapCapable(e){return"string"==typeof e?e.length>0:e&&"function"==typeof e.offset}var compiler$1={visitor:visitor,passes:{check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRecursion,reportInfiniteRepetition,reportIncorrectPlucking],transform:[removeProxyRules,mergeCharacterClasses,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile:function(ast,passes,options){if(options=void 0!==options?options:{},options=processOptions(options,{allowedStartRules:[ast.rules[0].name],cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");if(0===options.allowedStartRules.length)throw new Error("Must have at least one start rule");var allRules=ast.rules.map((function(e){return e.name}));if(options.allowedStartRules.some((function(e){return"*"===e})))options.allowedStartRules=allRules;else for(var _i=0,_a=options.allowedStartRules;_i<_a.length;_i++){var rule=_a[_i];if(-1===allRules.indexOf(rule))throw new Error('Unknown start rule "'.concat(rule,'"'))}if(("source-and-map"===options.output||"source-with-inline-map"===options.output)&&!isSourceMapCapable(options.grammarSource))throw new Error("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps");var session=new Session(options);switch(Object.keys(passes).forEach((function(e){session.stage=e,session.info("Process stage ".concat(e)),passes[e].forEach((function(t){session.info("Process pass ".concat(e,".").concat(t.name)),t(ast,options,session)})),session.checkErrors()})),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;case"source-with-inline-map":if("undefined"==typeof TextEncoder)throw new Error("TextEncoder is not supported by this platform");var sourceMap=ast.code.toStringWithSourceMap(),encoder=new TextEncoder,b64=base64(encoder.encode(JSON.stringify(sourceMap.map.toJSON())));return sourceMap.code+"//# sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(b64,"\n");case"ast":return ast;default:throw new Error("Invalid output format: "+options.output+".")}}},compiler_1=compiler$1,OPS_TO_PREFIXED_TYPES={$:"text","&":"simple_and","!":"simple_not"},OPS_TO_SUFFIXED_TYPES={"?":"optional","*":"zero_or_more","+":"one_or_more"},OPS_TO_SEMANTIC_PREDICATE_TYPES={"&":"semantic_and","!":"semantic_not"};function peg$subclass(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n}function peg$SyntaxError(e,t,n,r){var o=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(o,peg$SyntaxError.prototype),o.expected=t,o.found=n,o.location=r,o.name="SyntaxError",o}function peg$padEnd(e,t,n){return n=n||" ",e.length>t?e:(t-=e.length,e+(n+=n.repeat(t)).slice(0,t))}function peg$parse(e,t){var n,r={},o=(t=void 0!==t?t:{}).grammarSource,u={Grammar:fn},a=fn,i="{",s="}",c="=",l="/",p="@",f=":",h="|",d=",",g="..",A="(",m=")",E="\n",_="\r\n",v="/*",C="*/",$="//",S="\\",y="i",F='"',b="'",x="[",P="^",D="]",B="-",R="0",O="b",L="f",T="n",M="r",w="t",I="v",N="x",k="u",H=".",U=";",j=/^[!$&]/,G=/^[*-+?]/,V=/^[!&]/,Y=/^[\t\v-\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/,z=/^[\n\r\u2028\u2029]/,W=/^[\r\u2028-\u2029]/,J=/^[A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376-\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E-\u066F\u0671-\u06D3\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4-\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0-\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,Q=/^[$0-9_\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7-\u09C8\u09CB-\u09CD\u09D7\u09E2-\u09E3\u09E6-\u09EF\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B62-\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56\u0C62-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5-\u0CD6\u0CE2-\u0CE3\u0CE6-\u0CEF\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62-\u0D63\u0D66-\u0D6F\u0D82-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18-\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F3F\u0F71-\u0F84\u0F86-\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19D9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u200C-\u200D\u203F-\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099-\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880-\uA881\uA8B4-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C-\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7-\uAAB8\uAABE-\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5-\uAAF6\uABE3-\uABEA\uABEC-\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33-\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F]/,q=/^[\n\r"\\\u2028-\u2029]/,X=/^[\n\r'\\\u2028-\u2029]/,K=/^[\n\r\\-\]\u2028-\u2029]/,Z=/^["'\\]/,ee=/^[0-9ux]/,te=/^[0-9]/,ne=/^[0-9a-f]/i,re=/^[{}]/,oe=un("{",!1),ue=un("}",!1),ae=un("=",!1),ie=un("/",!1),se=un("@",!1),ce=un(":",!1),le=an(["!","$","&"],!1,!1),pe=an([["*","+"],"?"],!1,!1),fe=un("|",!1),he=un(",",!1),de=un("..",!1),ge=un("(",!1),Ae=un(")",!1),me=an(["!","&"],!1,!1),Ee={type:"any"},_e=sn("whitespace"),ve=an(["\t",["\v","\f"]," "," "," ",[" "," "]," "," "," ","\ufeff"],!1,!1),Ce=an(["\n","\r","\u2028","\u2029"],!1,!1),$e=sn("end of line"),Se=un("\n",!1),ye=un("\r\n",!1),Fe=an(["\r",["\u2028","\u2029"]],!1,!1),be=sn("comment"),xe=un("/*",!1),Pe=un("*/",!1),De=un("//",!1),Be=sn("identifier"),Re=an([["A","Z"],"_",["a","z"],"ª","µ","º",["À","Ö"],["Ø","ö"],["ø","ˁ"],["ˆ","ˑ"],["ˠ","ˤ"],"ˬ","ˮ",["Ͱ","ʹ"],["Ͷ","ͷ"],["ͺ","ͽ"],"Ϳ","Ά",["Έ","Ί"],"Ό",["Ύ","Ρ"],["Σ","ϵ"],["Ϸ","ҁ"],["Ҋ","ԯ"],["Ա","Ֆ"],"ՙ",["ա","և"],["א","ת"],["װ","ײ"],["ؠ","ي"],["ٮ","ٯ"],["ٱ","ۓ"],"ە",["ۥ","ۦ"],["ۮ","ۯ"],["ۺ","ۼ"],"ۿ","ܐ",["ܒ","ܯ"],["ݍ","ޥ"],"ޱ",["ߊ","ߪ"],["ߴ","ߵ"],"ߺ",["ࠀ","ࠕ"],"ࠚ","ࠤ","ࠨ",["ࡀ","ࡘ"],["ࢠ","ࢴ"],["ऄ","ह"],"ऽ","ॐ",["क़","ॡ"],["ॱ","ঀ"],["অ","ঌ"],["এ","ঐ"],["ও","ন"],["প","র"],"ল",["শ","হ"],"ঽ","ৎ",["ড়","ঢ়"],["য়","ৡ"],["ৰ","ৱ"],["ਅ","ਊ"],["ਏ","ਐ"],["ਓ","ਨ"],["ਪ","ਰ"],["ਲ","ਲ਼"],["ਵ","ਸ਼"],["ਸ","ਹ"],["ਖ਼","ੜ"],"ਫ਼",["ੲ","ੴ"],["અ","ઍ"],["એ","ઑ"],["ઓ","ન"],["પ","ર"],["લ","ળ"],["વ","હ"],"ઽ","ૐ",["ૠ","ૡ"],"ૹ",["ଅ","ଌ"],["ଏ","ଐ"],["ଓ","ନ"],["ପ","ର"],["ଲ","ଳ"],["ଵ","ହ"],"ଽ",["ଡ଼","ଢ଼"],["ୟ","ୡ"],"ୱ","ஃ",["அ","ஊ"],["எ","ஐ"],["ஒ","க"],["ங","ச"],"ஜ",["ஞ","ட"],["ண","த"],["ந","ப"],["ம","ஹ"],"ௐ",["అ","ఌ"],["ఎ","ఐ"],["ఒ","న"],["ప","హ"],"ఽ",["ౘ","ౚ"],["ౠ","ౡ"],["ಅ","ಌ"],["ಎ","ಐ"],["ಒ","ನ"],["ಪ","ಳ"],["ವ","ಹ"],"ಽ","ೞ",["ೠ","ೡ"],["ೱ","ೲ"],["അ","ഌ"],["എ","ഐ"],["ഒ","ഺ"],"ഽ","ൎ",["ൟ","ൡ"],["ൺ","ൿ"],["අ","ඖ"],["ක","න"],["ඳ","ර"],"ල",["ව","ෆ"],["ก","ะ"],["า","ำ"],["เ","ๆ"],["ກ","ຂ"],"ຄ",["ງ","ຈ"],"ຊ","ຍ",["ດ","ທ"],["ນ","ຟ"],["ມ","ຣ"],"ລ","ວ",["ສ","ຫ"],["ອ","ະ"],["າ","ຳ"],"ຽ",["ເ","ໄ"],"ໆ",["ໜ","ໟ"],"ༀ",["ཀ","ཇ"],["ཉ","ཬ"],["ྈ","ྌ"],["က","ဪ"],"ဿ",["ၐ","ၕ"],["ၚ","ၝ"],"ၡ",["ၥ","ၦ"],["ၮ","ၰ"],["ၵ","ႁ"],"ႎ",["Ⴀ","Ⴥ"],"Ⴧ","Ⴭ",["ა","ჺ"],["ჼ","ቈ"],["ቊ","ቍ"],["ቐ","ቖ"],"ቘ",["ቚ","ቝ"],["በ","ኈ"],["ኊ","ኍ"],["ነ","ኰ"],["ኲ","ኵ"],["ኸ","ኾ"],"ዀ",["ዂ","ዅ"],["ወ","ዖ"],["ዘ","ጐ"],["ጒ","ጕ"],["ጘ","ፚ"],["ᎀ","ᎏ"],["Ꭰ","Ᏽ"],["ᏸ","ᏽ"],["ᐁ","ᙬ"],["ᙯ","ᙿ"],["ᚁ","ᚚ"],["ᚠ","ᛪ"],["ᛮ","ᛸ"],["ᜀ","ᜌ"],["ᜎ","ᜑ"],["ᜠ","ᜱ"],["ᝀ","ᝑ"],["ᝠ","ᝬ"],["ᝮ","ᝰ"],["ក","ឳ"],"ៗ","ៜ",["ᠠ","ᡷ"],["ᢀ","ᢨ"],"ᢪ",["ᢰ","ᣵ"],["ᤀ","ᤞ"],["ᥐ","ᥭ"],["ᥰ","ᥴ"],["ᦀ","ᦫ"],["ᦰ","ᧉ"],["ᨀ","ᨖ"],["ᨠ","ᩔ"],"ᪧ",["ᬅ","ᬳ"],["ᭅ","ᭋ"],["ᮃ","ᮠ"],["ᮮ","ᮯ"],["ᮺ","ᯥ"],["ᰀ","ᰣ"],["ᱍ","ᱏ"],["ᱚ","ᱽ"],["ᳩ","ᳬ"],["ᳮ","ᳱ"],["ᳵ","ᳶ"],["ᴀ","ᶿ"],["Ḁ","ἕ"],["Ἐ","Ἕ"],["ἠ","ὅ"],["Ὀ","Ὅ"],["ὐ","ὗ"],"Ὑ","Ὓ","Ὕ",["Ὗ","ώ"],["ᾀ","ᾴ"],["ᾶ","ᾼ"],"ι",["ῂ","ῄ"],["ῆ","ῌ"],["ῐ","ΐ"],["ῖ","Ί"],["ῠ","Ῥ"],["ῲ","ῴ"],["ῶ","ῼ"],"ⁱ","ⁿ",["ₐ","ₜ"],"ℂ","ℇ",["ℊ","ℓ"],"ℕ",["ℙ","ℝ"],"ℤ","Ω","ℨ",["K","ℭ"],["ℯ","ℹ"],["ℼ","ℿ"],["ⅅ","ⅉ"],"ⅎ",["Ⅰ","ↈ"],["Ⰰ","Ⱞ"],["ⰰ","ⱞ"],["Ⱡ","ⳤ"],["Ⳬ","ⳮ"],["Ⳳ","ⳳ"],["ⴀ","ⴥ"],"ⴧ","ⴭ",["ⴰ","ⵧ"],"ⵯ",["ⶀ","ⶖ"],["ⶠ","ⶦ"],["ⶨ","ⶮ"],["ⶰ","ⶶ"],["ⶸ","ⶾ"],["ⷀ","ⷆ"],["ⷈ","ⷎ"],["ⷐ","ⷖ"],["ⷘ","ⷞ"],"ⸯ",["々","〇"],["〡","〩"],["〱","〵"],["〸","〼"],["ぁ","ゖ"],["ゝ","ゟ"],["ァ","ヺ"],["ー","ヿ"],["ㄅ","ㄭ"],["ㄱ","ㆎ"],["ㆠ","ㆺ"],["ㇰ","ㇿ"],["㐀","䶵"],["一","鿕"],["ꀀ","ꒌ"],["ꓐ","ꓽ"],["ꔀ","ꘌ"],["ꘐ","ꘟ"],["ꘪ","ꘫ"],["Ꙁ","ꙮ"],["ꙿ","ꚝ"],["ꚠ","ꛯ"],["ꜗ","ꜟ"],["Ꜣ","ꞈ"],["Ꞌ","Ɬ"],["Ʞ","ꞷ"],["ꟷ","ꠁ"],["ꠃ","ꠅ"],["ꠇ","ꠊ"],["ꠌ","ꠢ"],["ꡀ","ꡳ"],["ꢂ","ꢳ"],["ꣲ","ꣷ"],"ꣻ","ꣽ",["ꤊ","ꤥ"],["ꤰ","ꥆ"],["ꥠ","ꥼ"],["ꦄ","ꦲ"],"ꧏ",["ꧠ","ꧤ"],["ꧦ","ꧯ"],["ꧺ","ꧾ"],["ꨀ","ꨨ"],["ꩀ","ꩂ"],["ꩄ","ꩋ"],["ꩠ","ꩶ"],"ꩺ",["ꩾ","ꪯ"],"ꪱ",["ꪵ","ꪶ"],["ꪹ","ꪽ"],"ꫀ","ꫂ",["ꫛ","ꫝ"],["ꫠ","ꫪ"],["ꫲ","ꫴ"],["ꬁ","ꬆ"],["ꬉ","ꬎ"],["ꬑ","ꬖ"],["ꬠ","ꬦ"],["ꬨ","ꬮ"],["ꬰ","ꭚ"],["ꭜ","ꭥ"],["ꭰ","ꯢ"],["가","힣"],["ힰ","ퟆ"],["ퟋ","ퟻ"],["豈","舘"],["並","龎"],["ff","st"],["ﬓ","ﬗ"],"יִ",["ײַ","ﬨ"],["שׁ","זּ"],["טּ","לּ"],"מּ",["נּ","סּ"],["ףּ","פּ"],["צּ","ﮱ"],["ﯓ","ﴽ"],["ﵐ","ﶏ"],["ﶒ","ﷇ"],["ﷰ","ﷻ"],["ﹰ","ﹴ"],["ﹶ","ﻼ"],["A","Z"],["a","z"],["ヲ","ᄒ"],["ᅡ","ᅦ"],["ᅧ","ᅬ"],["ᅭ","ᅲ"],["ᅳ","ᅵ"]],!1,!1),Oe=un("\\",!1),Le=an(["$",["0","9"],"_",["̀","ͯ"],["҃","҇"],["֑","ֽ"],"ֿ",["ׁ","ׂ"],["ׄ","ׅ"],"ׇ",["ؐ","ؚ"],["ً","٩"],"ٰ",["ۖ","ۜ"],["۟","ۤ"],["ۧ","ۨ"],["۪","ۭ"],["۰","۹"],"ܑ",["ܰ","݊"],["ަ","ް"],["߀","߉"],["߫","߳"],["ࠖ","࠙"],["ࠛ","ࠣ"],["ࠥ","ࠧ"],["ࠩ","࠭"],["࡙","࡛"],["ࣣ","ः"],["ऺ","़"],["ा","ॏ"],["॑","ॗ"],["ॢ","ॣ"],["०","९"],["ঁ","ঃ"],"়",["া","ৄ"],["ে","ৈ"],["ো","্"],"ৗ",["ৢ","ৣ"],["০","৯"],["ਁ","ਃ"],"਼",["ਾ","ੂ"],["ੇ","ੈ"],["ੋ","੍"],"ੑ",["੦","ੱ"],"ੵ",["ઁ","ઃ"],"઼",["ા","ૅ"],["ે","ૉ"],["ો","્"],["ૢ","ૣ"],["૦","૯"],["ଁ","ଃ"],"଼",["ା","ୄ"],["େ","ୈ"],["ୋ","୍"],["ୖ","ୗ"],["ୢ","ୣ"],["୦","୯"],"ஂ",["ா","ூ"],["ெ","ை"],["ொ","்"],"ௗ",["௦","௯"],["ఀ","ః"],["ా","ౄ"],["ె","ై"],["ొ","్"],["ౕ","ౖ"],["ౢ","ౣ"],["౦","౯"],["ಁ","ಃ"],"಼",["ಾ","ೄ"],["ೆ","ೈ"],["ೊ","್"],["ೕ","ೖ"],["ೢ","ೣ"],["೦","೯"],["ഁ","ഃ"],["ാ","ൄ"],["െ","ൈ"],["ൊ","്"],"ൗ",["ൢ","ൣ"],["൦","൯"],["ං","ඃ"],"්",["ා","ු"],"ූ",["ෘ","ෟ"],["෦","෯"],["ෲ","ෳ"],"ั",["ิ","ฺ"],["็","๎"],["๐","๙"],"ັ",["ິ","ູ"],["ົ","ຼ"],["່","ໍ"],["໐","໙"],["༘","༙"],["༠","༩"],"༵","༷","༹",["༾","༿"],["ཱ","྄"],["྆","྇"],["ྍ","ྗ"],["ྙ","ྼ"],"࿆",["ါ","ှ"],["၀","၉"],["ၖ","ၙ"],["ၞ","ၠ"],["ၢ","ၤ"],["ၧ","ၭ"],["ၱ","ၴ"],["ႂ","ႍ"],["ႏ","ႝ"],["፝","፟"],["ᜒ","᜔"],["ᜲ","᜴"],["ᝒ","ᝓ"],["ᝲ","ᝳ"],["឴","៓"],"៝",["០","៩"],["᠋","᠍"],["᠐","᠙"],"ᢩ",["ᤠ","ᤫ"],["ᤰ","᤻"],["᥆","᥏"],["᧐","᧙"],["ᨗ","ᨛ"],["ᩕ","ᩞ"],["᩠","᩼"],["᩿","᪉"],["᪐","᪙"],["᪰","᪽"],["ᬀ","ᬄ"],["᬴","᭄"],["᭐","᭙"],["᭫","᭳"],["ᮀ","ᮂ"],["ᮡ","ᮭ"],["᮰","᮹"],["᯦","᯳"],["ᰤ","᰷"],["᱀","᱉"],["᱐","᱙"],["᳐","᳒"],["᳔","᳨"],"᳭",["ᳲ","᳴"],["᳸","᳹"],["᷀","᷵"],["᷼","᷿"],["",""],["‿","⁀"],"⁔",["⃐","⃜"],"⃡",["⃥","⃰"],["⳯","⳱"],"⵿",["ⷠ","ⷿ"],["〪","〯"],["゙","゚"],["꘠","꘩"],"꙯",["ꙴ","꙽"],["ꚞ","ꚟ"],["꛰","꛱"],"ꠂ","꠆","ꠋ",["ꠣ","ꠧ"],["ꢀ","ꢁ"],["ꢴ","꣄"],["꣐","꣙"],["꣠","꣱"],["꤀","꤉"],["ꤦ","꤭"],["ꥇ","꥓"],["ꦀ","ꦃ"],["꦳","꧀"],["꧐","꧙"],"ꧥ",["꧰","꧹"],["ꨩ","ꨶ"],"ꩃ",["ꩌ","ꩍ"],["꩐","꩙"],["ꩻ","ꩽ"],"ꪰ",["ꪲ","ꪴ"],["ꪷ","ꪸ"],["ꪾ","꪿"],"꫁",["ꫫ","ꫯ"],["ꫵ","꫶"],["ꯣ","ꯪ"],["꯬","꯭"],["꯰","꯹"],"ﬞ",["︀","️"],["︠","︯"],["︳","︴"],["﹍","﹏"],["0","9"],"_"],!1,!1),Te=sn("literal"),Me=un("i",!1),we=sn("string"),Ie=un('"',!1),Ne=un("'",!1),ke=an(["\n","\r",'"',"\\",["\u2028","\u2029"]],!1,!1),He=an(["\n","\r","'","\\",["\u2028","\u2029"]],!1,!1),Ue=sn("character class"),je=un("[",!1),Ge=un("^",!1),Ve=un("]",!1),Ye=un("-",!1),ze=an(["\n","\r",["\\","]"],["\u2028","\u2029"]],!1,!1),We=un("0",!1),Je=an(['"',"'","\\"],!1,!1),Qe=un("b",!1),qe=un("f",!1),Xe=un("n",!1),Ke=un("r",!1),Ze=un("t",!1),et=un("v",!1),tt=an([["0","9"],"u","x"],!1,!1),nt=un("x",!1),rt=un("u",!1),ot=an([["0","9"]],!1,!1),ut=an([["0","9"],["a","f"]],!1,!0),at=un(".",!1),it=sn("code block"),st=an(["{","}"],!1,!1),ct=un(";",!1),lt=function(e,t,n){return{type:"grammar",topLevelInitializer:e,initializer:t,rules:n,location:rn()}},pt=function(e){return{type:"top_level_initializer",code:e[0],codeLocation:e[1],location:rn()}},ft=function(e){return{type:"initializer",code:e[0],codeLocation:e[1],location:rn()}},ht=function(e,t,n){return{type:"rule",name:e[0],nameLocation:e[1],expression:null!==t?{type:"named",name:t,expression:n,location:rn()}:n,location:rn()}},dt=function(e,t){return t.length>0?{type:"choice",alternatives:[e].concat(t),location:rn()}:e},gt=function(e,t){return null!==t?{type:"action",expression:e,code:t[0],codeLocation:t[1],location:rn()}:e},At=function(e,t){return t.length>0||"labeled"===e.type&&e.pick?{type:"sequence",elements:[e].concat(t),location:rn()}:e},mt=function(e,t,n){return n.type.startsWith("semantic_")&&on('"@" cannot be used on a semantic predicate',e),{type:"labeled",label:null!==t?t[0]:null,labelLocation:null!==t?t[1]:e,pick:!0,expression:n,location:rn()}},Et=function(e,t){return{type:"labeled",label:e[0],labelLocation:e[1],expression:t,location:rn()}},_t=function(){return rn()},vt=function(e){return Wn.indexOf(e[0])>=0&&on("Label can't be a reserved word \"".concat(e[0],'"'),e[1]),e},Ct=function(e,t){return{type:OPS_TO_PREFIXED_TYPES[e],expression:t,location:rn()}},$t=function(e,t){return{type:OPS_TO_SUFFIXED_TYPES[t],expression:e,location:rn()}},St=function(e,t,n){var r=t[0],o=t[1];return"constant"===o.type&&0===o.value&&on("The maximum count of repetitions of the rule must be > 0",o.location),{type:"repeated",min:r,max:o,expression:e,delimiter:n,location:rn()}},yt=function(e,t){return[null!==e?e:{type:"constant",value:0},null!==t?t:{type:"constant",value:null}]},Ft=function(e){return[null,e]},bt=function(e){return{type:"constant",value:e,location:rn()}},xt=function(e){return{type:"variable",value:e[0],location:rn()}},Pt=function(e){return{type:"function",value:e[0],codeLocation:e[1],location:rn()}},Dt=function(e){return"labeled"===e.type||"sequence"===e.type?{type:"group",expression:e,location:rn()}:e},Bt=function(e){return{type:"rule_ref",name:e[0],location:rn()}},Rt=function(e,t){return{type:OPS_TO_SEMANTIC_PREDICATE_TYPES[e],code:t[0],codeLocation:t[1],location:rn()}},Ot=function(e,t){return[e+t.join(""),rn()]},Lt=function(e,t){return{type:"literal",value:e,ignoreCase:null!==t,location:rn()}},Tt=function(e){return e.join("")},Mt=function(e){return e.join("")},wt=function(e,t,n){return{type:"class",parts:t.filter((function(e){return""!==e})),inverted:null!==e,ignoreCase:null!==n,location:rn()}},It=function(t,n){return t.charCodeAt(0)>n.charCodeAt(0)&&on("Invalid character range: "+e.substring(Kt,Xt)+"."),[t,n]},Nt=function(){return""},kt=function(){return"\0"},Ht=function(){return"\b"},Ut=function(){return"\f"},jt=function(){return"\n"},Gt=function(){return"\r"},Vt=function(){return"\t"},Yt=function(){return"\v"},zt=function(e){return String.fromCharCode(parseInt(e,16))},Wt=function(e){return String.fromCharCode(parseInt(e,16))},Jt=function(){return{type:"any",location:rn()}},Qt=function(e){return[e,rn()]},qt=function(e){return parseInt(e,10)},Xt=0,Kt=0,Zt=[{line:1,column:1}],en=0,tn=[],nn=0;if("startRule"in t){if(!(t.startRule in u))throw new Error("Can't start parsing from rule \""+t.startRule+'".');a=u[t.startRule]}function rn(){return ln(Kt,Xt)}function on(e,t){throw function(e,t){return new peg$SyntaxError(e,null,null,t)}(e,t=void 0!==t?t:ln(Kt,Xt))}function un(e,t){return{type:"literal",text:e,ignoreCase:t}}function an(e,t,n){return{type:"class",parts:e,inverted:t,ignoreCase:n}}function sn(e){return{type:"other",description:e}}function cn(t){var n,r=Zt[t];if(r)return r;if(t>=Zt.length)n=Zt.length-1;else for(n=t;!Zt[--n];);for(r={line:(r=Zt[n]).line,column:r.column};n<t;)10===e.charCodeAt(n)?(r.line++,r.column=1):r.column++,n++;return Zt[t]=r,r}function ln(e,t,n){var r=cn(e),u=cn(t),a={source:o,start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:u.line,column:u.column}};return n&&o&&"function"==typeof o.offset&&(a.start=o.offset(a.start),a.end=o.offset(a.end)),a}function pn(e){Xt<en||(Xt>en&&(en=Xt,tn=[]),tn.push(e))}function fn(){var t,n,o,u,a,c;if(t=Xt,Yn(),n=Xt,o=function(){var t,n,o,u;return t=Xt,123===e.charCodeAt(Xt)?(n=i,Xt++):(n=r,0===nn&&pn(oe)),n!==r&&(o=Gn())!==r?(125===e.charCodeAt(Xt)?(u=s,Xt++):(u=r,0===nn&&pn(ue)),u!==r&&zn()!==r?(Kt=t,t=pt(o)):(Xt=t,t=r)):(Xt=t,t=r),t}(),o!==r?(u=Yn(),n=o):(Xt=n,n=r),n===r&&(n=null),o=Xt,u=function(){var e,t;return e=Xt,(t=Gn())!==r&&zn()!==r?(Kt=e,e=ft(t)):(Xt=e,e=r),e}(),u!==r?(a=Yn(),o=u):(Xt=o,o=r),o===r&&(o=null),u=[],a=Xt,(c=hn())!==r?(Yn(),a=c):(Xt=a,a=r),a!==r)for(;a!==r;)u.push(a),a=Xt,(c=hn())!==r?(Yn(),a=c):(Xt=a,a=r);else u=r;return u!==r?(Kt=t,t=lt(n,o,u)):(Xt=t,t=r),t}function hn(){var t,n,o,u,a;return t=Xt,(n=Dn())!==r?(Yn(),o=Xt,(u=On())!==r?(Yn(),o=u):(Xt=o,o=r),o===r&&(o=null),61===e.charCodeAt(Xt)?(u=c,Xt++):(u=r,0===nn&&pn(ae)),u!==r?(Yn(),(a=dn())!==r&&zn()!==r?(Kt=t,t=ht(n,o,a)):(Xt=t,t=r)):(Xt=t,t=r)):(Xt=t,t=r),t}function dn(){var t,n,o,u,a,i;if(t=Xt,(n=gn())!==r){for(o=[],u=Xt,Yn(),47===e.charCodeAt(Xt)?(a=l,Xt++):(a=r,0===nn&&pn(ie)),a!==r?(Yn(),(i=gn())!==r?u=i:(Xt=u,u=r)):(Xt=u,u=r);u!==r;)o.push(u),u=Xt,Yn(),47===e.charCodeAt(Xt)?(a=l,Xt++):(a=r,0===nn&&pn(ie)),a!==r?(Yn(),(i=gn())!==r?u=i:(Xt=u,u=r)):(Xt=u,u=r);Kt=t,t=dt(n,o)}else Xt=t,t=r;return t}function gn(){var e,t,n,o;return e=Xt,t=function(){var e,t,n,o,u;if(e=Xt,(t=An())!==r){for(n=[],o=Xt,Yn(),(u=An())!==r?o=u:(Xt=o,o=r);o!==r;)n.push(o),o=Xt,Yn(),(u=An())!==r?o=u:(Xt=o,o=r);Kt=e,e=At(t,n)}else Xt=e,e=r;return e}(),t!==r?(n=Xt,Yn(),(o=Gn())!==r?n=o:(Xt=n,n=r),n===r&&(n=null),Kt=e,e=gt(t,n)):(Xt=e,e=r),e}function An(){var t,n,o,u;return t=Xt,n=function(){var t,n;return t=Xt,64===e.charCodeAt(Xt)?(n=p,Xt++):(n=r,0===nn&&pn(se)),n!==r&&(Kt=t,n=_t()),t=n}(),n!==r?((o=mn())===r&&(o=null),(u=En())!==r?(Kt=t,t=mt(n,o,u)):(Xt=t,t=r)):(Xt=t,t=r),t===r&&(t=Xt,(n=mn())!==r?(o=Yn(),(u=En())!==r?(Kt=t,t=Et(n,u)):(Xt=t,t=r)):(Xt=t,t=r),t===r&&(t=En())),t}function mn(){var t,n,o;return t=Xt,(n=Dn())!==r?(Yn(),58===e.charCodeAt(Xt)?(o=f,Xt++):(o=r,0===nn&&pn(ce)),o!==r?(Kt=t,t=vt(n)):(Xt=t,t=r)):(Xt=t,t=r),t}function En(){var t,n,o;return t=Xt,n=function(){var t;return t=e.charAt(Xt),j.test(t)?Xt++:(t=r,0===nn&&pn(le)),t}(),n!==r?(Yn(),(o=_n())!==r?(Kt=t,t=Ct(n,o)):(Xt=t,t=r)):(Xt=t,t=r),t===r&&(t=_n()),t}function _n(){var t,n,o;return t=Xt,(n=Cn())!==r?(Yn(),o=function(){var t;return t=e.charAt(Xt),G.test(t)?Xt++:(t=r,0===nn&&pn(pe)),t}(),o!==r?(Kt=t,t=$t(n,o)):(Xt=t,t=r)):(Xt=t,t=r),t===r&&(t=function(){var t,n,o,u,a,i,s;return t=Xt,(n=Cn())!==r?(Yn(),124===e.charCodeAt(Xt)?(o=h,Xt++):(o=r,0===nn&&pn(fe)),o!==r?(Yn(),u=function(){var t,n,o,u;return t=Xt,(n=vn())===r&&(n=null),Yn(),e.substr(Xt,2)===g?(o=g,Xt+=2):(o=r,0===nn&&pn(de)),o!==r?(Yn(),(u=vn())===r&&(u=null),Kt=t,t=yt(n,u)):(Xt=t,t=r),t===r&&(t=Xt,(n=vn())!==r&&(Kt=t,n=Ft(n)),t=n),t}(),u!==r?(Yn(),a=Xt,44===e.charCodeAt(Xt)?(i=d,Xt++):(i=r,0===nn&&pn(he)),i!==r?(Yn(),(s=dn())!==r?(Yn(),a=s):(Xt=a,a=r)):(Xt=a,a=r),a===r&&(a=null),124===e.charCodeAt(Xt)?(i=h,Xt++):(i=r,0===nn&&pn(fe)),i!==r?(Kt=t,t=St(n,u,a)):(Xt=t,t=r)):(Xt=t,t=r)):(Xt=t,t=r)):(Xt=t,t=r),t}(),t===r&&(t=Cn())),t}function vn(){var t,n;return t=Xt,n=function(){var t,n,o,u;if(t=Xt,n=Xt,o=[],(u=Un())!==r)for(;u!==r;)o.push(u),u=Un();else o=r;return(n=o!==r?e.substring(n,Xt):o)!==r&&(Kt=t,n=qt(n)),t=n}(),n!==r&&(Kt=t,n=bt(n)),(t=n)===r&&(t=Xt,(n=Dn())!==r&&(Kt=t,n=xt(n)),(t=n)===r&&(t=Xt,(n=Gn())!==r&&(Kt=t,n=Pt(n)),t=n)),t}function Cn(){var t,n,o,u;return t=function(){var t,n,o;return nn++,t=Xt,(n=On())!==r?(105===e.charCodeAt(Xt)?(o=y,Xt++):(o=r,0===nn&&pn(Me)),o===r&&(o=null),Kt=t,t=Lt(n,o)):(Xt=t,t=r),nn--,t===r&&(n=r,0===nn&&pn(Te)),t}(),t===r&&(t=function(){var t,n,o,u,a,i;if(nn++,t=Xt,91===e.charCodeAt(Xt)?(n=x,Xt++):(n=r,0===nn&&pn(je)),n!==r){for(94===e.charCodeAt(Xt)?(o=P,Xt++):(o=r,0===nn&&pn(Ge)),o===r&&(o=null),u=[],(a=Mn())===r&&(a=wn());a!==r;)u.push(a),(a=Mn())===r&&(a=wn());93===e.charCodeAt(Xt)?(a=D,Xt++):(a=r,0===nn&&pn(Ve)),a!==r?(105===e.charCodeAt(Xt)?(i=y,Xt++):(i=r,0===nn&&pn(Me)),i===r&&(i=null),Kt=t,t=wt(o,u,i)):(Xt=t,t=r)}else Xt=t,t=r;return nn--,t===r&&(n=r,0===nn&&pn(Ue)),t}(),t===r&&(t=function(){var t,n;return t=Xt,46===e.charCodeAt(Xt)?(n=H,Xt++):(n=r,0===nn&&pn(at)),n!==r&&(Kt=t,n=Jt()),t=n}(),t===r&&(t=function(){var t,n,o,u,a,i,s;return t=Xt,(n=Dn())!==r?(o=Xt,nn++,u=Xt,a=Yn(),i=Xt,(s=On())!==r?i=s=[s,Yn()]:(Xt=i,i=r),i===r&&(i=null),61===e.charCodeAt(Xt)?(s=c,Xt++):(s=r,0===nn&&pn(ae)),s!==r?u=a=[a,i,s]:(Xt=u,u=r),nn--,u===r?o=void 0:(Xt=o,o=r),o!==r?(Kt=t,t=Bt(n)):(Xt=t,t=r)):(Xt=t,t=r),t}(),t===r&&(t=function(){var t,n,o;return t=Xt,n=function(){var t;return t=e.charAt(Xt),V.test(t)?Xt++:(t=r,0===nn&&pn(me)),t}(),n!==r?(Yn(),(o=Gn())!==r?(Kt=t,t=Rt(n,o)):(Xt=t,t=r)):(Xt=t,t=r),t}(),t===r&&(t=Xt,40===e.charCodeAt(Xt)?(n=A,Xt++):(n=r,0===nn&&pn(ge)),n!==r?(Yn(),(o=dn())!==r?(Yn(),41===e.charCodeAt(Xt)?(u=m,Xt++):(u=r,0===nn&&pn(Ae)),u!==r?(Kt=t,t=Dt(o)):(Xt=t,t=r)):(Xt=t,t=r)):(Xt=t,t=r)))))),t}function $n(){var t;return e.length>Xt?(t=e.charAt(Xt),Xt++):(t=r,0===nn&&pn(Ee)),t}function Sn(){var t;return nn++,t=e.charAt(Xt),Y.test(t)?Xt++:(t=r,0===nn&&pn(ve)),nn--,t===r&&0===nn&&pn(_e),t}function yn(){var t;return t=e.charAt(Xt),z.test(t)?Xt++:(t=r,0===nn&&pn(Ce)),t}function Fn(){var t;return nn++,10===e.charCodeAt(Xt)?(t=E,Xt++):(t=r,0===nn&&pn(Se)),t===r&&(e.substr(Xt,2)===_?(t=_,Xt+=2):(t=r,0===nn&&pn(ye)),t===r&&(t=e.charAt(Xt),W.test(t)?Xt++:(t=r,0===nn&&pn(Fe)))),nn--,t===r&&0===nn&&pn($e),t}function bn(){var t;return nn++,(t=function(){var t,n,o,u,a,i;if(t=Xt,e.substr(Xt,2)===v?(n=v,Xt+=2):(n=r,0===nn&&pn(xe)),n!==r){for(o=[],u=Xt,a=Xt,nn++,e.substr(Xt,2)===C?(i=C,Xt+=2):(i=r,0===nn&&pn(Pe)),nn--,i===r?a=void 0:(Xt=a,a=r),a!==r&&(i=$n())!==r?u=a=[a,i]:(Xt=u,u=r);u!==r;)o.push(u),u=Xt,a=Xt,nn++,e.substr(Xt,2)===C?(i=C,Xt+=2):(i=r,0===nn&&pn(Pe)),nn--,i===r?a=void 0:(Xt=a,a=r),a!==r&&(i=$n())!==r?u=a=[a,i]:(Xt=u,u=r);e.substr(Xt,2)===C?(u=C,Xt+=2):(u=r,0===nn&&pn(Pe)),u!==r?t=n=[n,o,u]:(Xt=t,t=r)}else Xt=t,t=r;return t}())===r&&(t=Pn()),nn--,t===r&&0===nn&&pn(be),t}function xn(){var t,n,o,u,a,i;if(t=Xt,e.substr(Xt,2)===v?(n=v,Xt+=2):(n=r,0===nn&&pn(xe)),n!==r){for(o=[],u=Xt,a=Xt,nn++,e.substr(Xt,2)===C?(i=C,Xt+=2):(i=r,0===nn&&pn(Pe)),i===r&&(i=yn()),nn--,i===r?a=void 0:(Xt=a,a=r),a!==r&&(i=$n())!==r?u=a=[a,i]:(Xt=u,u=r);u!==r;)o.push(u),u=Xt,a=Xt,nn++,e.substr(Xt,2)===C?(i=C,Xt+=2):(i=r,0===nn&&pn(Pe)),i===r&&(i=yn()),nn--,i===r?a=void 0:(Xt=a,a=r),a!==r&&(i=$n())!==r?u=a=[a,i]:(Xt=u,u=r);e.substr(Xt,2)===C?(u=C,Xt+=2):(u=r,0===nn&&pn(Pe)),u!==r?t=n=[n,o,u]:(Xt=t,t=r)}else Xt=t,t=r;return t}function Pn(){var t,n,o,u,a,i;if(t=Xt,e.substr(Xt,2)===$?(n=$,Xt+=2):(n=r,0===nn&&pn(De)),n!==r){for(o=[],u=Xt,a=Xt,nn++,i=yn(),nn--,i===r?a=void 0:(Xt=a,a=r),a!==r&&(i=$n())!==r?u=a=[a,i]:(Xt=u,u=r);u!==r;)o.push(u),u=Xt,a=Xt,nn++,i=yn(),nn--,i===r?a=void 0:(Xt=a,a=r),a!==r&&(i=$n())!==r?u=a=[a,i]:(Xt=u,u=r);t=n=[n,o]}else Xt=t,t=r;return t}function Dn(){var e,t,n,o;if(nn++,e=Xt,(t=Bn())!==r){for(n=[],o=Rn();o!==r;)n.push(o),o=Rn();Kt=e,e=Ot(t,n)}else Xt=e,e=r;return nn--,e===r&&(t=r,0===nn&&pn(Be)),e}function Bn(){var t,n,o;return t=e.charAt(Xt),J.test(t)?Xt++:(t=r,0===nn&&pn(Re)),t===r&&(t=Xt,92===e.charCodeAt(Xt)?(n=S,Xt++):(n=r,0===nn&&pn(Oe)),n!==r&&(o=Hn())!==r?t=o:(Xt=t,t=r)),t}function Rn(){var t;return(t=Bn())===r&&(t=e.charAt(Xt),Q.test(t)?Xt++:(t=r,0===nn&&pn(Le))),t}function On(){var t,n,o,u;if(nn++,t=Xt,34===e.charCodeAt(Xt)?(n=F,Xt++):(n=r,0===nn&&pn(Ie)),n!==r){for(o=[],u=Ln();u!==r;)o.push(u),u=Ln();34===e.charCodeAt(Xt)?(u=F,Xt++):(u=r,0===nn&&pn(Ie)),u!==r?(Kt=t,t=Tt(o)):(Xt=t,t=r)}else Xt=t,t=r;if(t===r)if(t=Xt,39===e.charCodeAt(Xt)?(n=b,Xt++):(n=r,0===nn&&pn(Ne)),n!==r){for(o=[],u=Tn();u!==r;)o.push(u),u=Tn();39===e.charCodeAt(Xt)?(u=b,Xt++):(u=r,0===nn&&pn(Ne)),u!==r?(Kt=t,t=Mt(o)):(Xt=t,t=r)}else Xt=t,t=r;return nn--,t===r&&(n=r,0===nn&&pn(we)),t}function Ln(){var t,n,o,u;return t=Xt,n=Xt,o=Xt,nn++,u=e.charAt(Xt),q.test(u)?Xt++:(u=r,0===nn&&pn(ke)),nn--,u===r?o=void 0:(Xt=o,o=r),o!==r&&(u=$n())!==r?n=o=[o,u]:(Xt=n,n=r),(t=n!==r?e.substring(t,Xt):n)===r&&(t=Xt,92===e.charCodeAt(Xt)?(n=S,Xt++):(n=r,0===nn&&pn(Oe)),n!==r&&(o=Nn())!==r?t=o:(Xt=t,t=r),t===r&&(t=In())),t}function Tn(){var t,n,o,u;return t=Xt,n=Xt,o=Xt,nn++,u=e.charAt(Xt),X.test(u)?Xt++:(u=r,0===nn&&pn(He)),nn--,u===r?o=void 0:(Xt=o,o=r),o!==r&&(u=$n())!==r?n=o=[o,u]:(Xt=n,n=r),(t=n!==r?e.substring(t,Xt):n)===r&&(t=Xt,92===e.charCodeAt(Xt)?(n=S,Xt++):(n=r,0===nn&&pn(Oe)),n!==r&&(o=Nn())!==r?t=o:(Xt=t,t=r),t===r&&(t=In())),t}function Mn(){var t,n,o,u;return t=Xt,(n=wn())!==r?(45===e.charCodeAt(Xt)?(o=B,Xt++):(o=r,0===nn&&pn(Ye)),o!==r&&(u=wn())!==r?(Kt=t,t=It(n,u)):(Xt=t,t=r)):(Xt=t,t=r),t}function wn(){var t,n,o,u;return t=Xt,n=Xt,o=Xt,nn++,u=e.charAt(Xt),K.test(u)?Xt++:(u=r,0===nn&&pn(ze)),nn--,u===r?o=void 0:(Xt=o,o=r),o!==r&&(u=$n())!==r?n=o=[o,u]:(Xt=n,n=r),(t=n!==r?e.substring(t,Xt):n)===r&&(t=Xt,92===e.charCodeAt(Xt)?(n=S,Xt++):(n=r,0===nn&&pn(Oe)),n!==r&&(o=Nn())!==r?t=o:(Xt=t,t=r),t===r&&(t=In())),t}function In(){var t,n;return t=Xt,92===e.charCodeAt(Xt)?(n=S,Xt++):(n=r,0===nn&&pn(Oe)),n!==r&&Fn()!==r?(Kt=t,t=Nt()):(Xt=t,t=r),t}function Nn(){var t,n,o,u;return t=function(){var t;return(t=kn())===r&&(t=function(){var t,n,o,u;return t=Xt,n=Xt,o=Xt,nn++,u=function(){var t;return(t=kn())===r&&(t=e.charAt(Xt),ee.test(t)?Xt++:(t=r,0===nn&&pn(tt))),t}(),u===r&&(u=yn()),nn--,u===r?o=void 0:(Xt=o,o=r),o!==r&&(u=$n())!==r?n=o=[o,u]:(Xt=n,n=r),t=n!==r?e.substring(t,Xt):n}()),t}(),t===r&&(t=Xt,48===e.charCodeAt(Xt)?(n=R,Xt++):(n=r,0===nn&&pn(We)),n!==r?(o=Xt,nn++,u=Un(),nn--,u===r?o=void 0:(Xt=o,o=r),o!==r?(Kt=t,t=kt()):(Xt=t,t=r)):(Xt=t,t=r),t===r&&(t=function(){var t,n,o,u,a,i;return t=Xt,120===e.charCodeAt(Xt)?(n=N,Xt++):(n=r,0===nn&&pn(nt)),n!==r?(o=Xt,u=Xt,(a=jn())!==r&&(i=jn())!==r?u=a=[a,i]:(Xt=u,u=r),(o=u!==r?e.substring(o,Xt):u)!==r?(Kt=t,t=zt(o)):(Xt=t,t=r)):(Xt=t,t=r),t}(),t===r&&(t=Hn()))),t}function kn(){var t,n;return t=e.charAt(Xt),Z.test(t)?Xt++:(t=r,0===nn&&pn(Je)),t===r&&(t=Xt,98===e.charCodeAt(Xt)?(n=O,Xt++):(n=r,0===nn&&pn(Qe)),n!==r&&(Kt=t,n=Ht()),(t=n)===r&&(t=Xt,102===e.charCodeAt(Xt)?(n=L,Xt++):(n=r,0===nn&&pn(qe)),n!==r&&(Kt=t,n=Ut()),(t=n)===r&&(t=Xt,110===e.charCodeAt(Xt)?(n=T,Xt++):(n=r,0===nn&&pn(Xe)),n!==r&&(Kt=t,n=jt()),(t=n)===r&&(t=Xt,114===e.charCodeAt(Xt)?(n=M,Xt++):(n=r,0===nn&&pn(Ke)),n!==r&&(Kt=t,n=Gt()),(t=n)===r&&(t=Xt,116===e.charCodeAt(Xt)?(n=w,Xt++):(n=r,0===nn&&pn(Ze)),n!==r&&(Kt=t,n=Vt()),(t=n)===r&&(t=Xt,118===e.charCodeAt(Xt)?(n=I,Xt++):(n=r,0===nn&&pn(et)),n!==r&&(Kt=t,n=Yt()),t=n)))))),t}function Hn(){var t,n,o,u,a,i,s,c;return t=Xt,117===e.charCodeAt(Xt)?(n=k,Xt++):(n=r,0===nn&&pn(rt)),n!==r?(o=Xt,u=Xt,(a=jn())!==r&&(i=jn())!==r&&(s=jn())!==r&&(c=jn())!==r?u=a=[a,i,s,c]:(Xt=u,u=r),(o=u!==r?e.substring(o,Xt):u)!==r?(Kt=t,t=Wt(o)):(Xt=t,t=r)):(Xt=t,t=r),t}function Un(){var t;return t=e.charAt(Xt),te.test(t)?Xt++:(t=r,0===nn&&pn(ot)),t}function jn(){var t;return t=e.charAt(Xt),ne.test(t)?Xt++:(t=r,0===nn&&pn(ut)),t}function Gn(){var t,n,o,u;return nn++,t=Xt,123===e.charCodeAt(Xt)?(n=i,Xt++):(n=r,0===nn&&pn(oe)),n!==r?(o=function(){var e,t;return e=Xt,t=Vn(),Kt=e,e=t=Qt(t)}(),125===e.charCodeAt(Xt)?(u=s,Xt++):(u=r,0===nn&&pn(ue)),u!==r?t=o:(Xt=t,t=r)):(Xt=t,t=r),nn--,t===r&&(n=r,0===nn&&pn(it)),t}function Vn(){var t,n,o,u,a,c;if(t=Xt,n=[],o=[],u=Xt,a=Xt,nn++,c=e.charAt(Xt),re.test(c)?Xt++:(c=r,0===nn&&pn(st)),nn--,c===r?a=void 0:(Xt=a,a=r),a!==r&&(c=$n())!==r?u=a=[a,c]:(Xt=u,u=r),u!==r)for(;u!==r;)o.push(u),u=Xt,a=Xt,nn++,c=e.charAt(Xt),re.test(c)?Xt++:(c=r,0===nn&&pn(st)),nn--,c===r?a=void 0:(Xt=a,a=r),a!==r&&(c=$n())!==r?u=a=[a,c]:(Xt=u,u=r);else o=r;for(o===r&&(o=Xt,123===e.charCodeAt(Xt)?(u=i,Xt++):(u=r,0===nn&&pn(oe)),u!==r?(a=Vn(),125===e.charCodeAt(Xt)?(c=s,Xt++):(c=r,0===nn&&pn(ue)),c!==r?o=u=[u,a,c]:(Xt=o,o=r)):(Xt=o,o=r));o!==r;){if(n.push(o),o=[],u=Xt,a=Xt,nn++,c=e.charAt(Xt),re.test(c)?Xt++:(c=r,0===nn&&pn(st)),nn--,c===r?a=void 0:(Xt=a,a=r),a!==r&&(c=$n())!==r?u=a=[a,c]:(Xt=u,u=r),u!==r)for(;u!==r;)o.push(u),u=Xt,a=Xt,nn++,c=e.charAt(Xt),re.test(c)?Xt++:(c=r,0===nn&&pn(st)),nn--,c===r?a=void 0:(Xt=a,a=r),a!==r&&(c=$n())!==r?u=a=[a,c]:(Xt=u,u=r);else o=r;o===r&&(o=Xt,123===e.charCodeAt(Xt)?(u=i,Xt++):(u=r,0===nn&&pn(oe)),u!==r?(a=Vn(),125===e.charCodeAt(Xt)?(c=s,Xt++):(c=r,0===nn&&pn(ue)),c!==r?o=u=[u,a,c]:(Xt=o,o=r)):(Xt=o,o=r))}return e.substring(t,Xt)}function Yn(){var e,t;for(e=[],(t=Sn())===r&&(t=Fn())===r&&(t=bn());t!==r;)e.push(t),(t=Sn())===r&&(t=Fn())===r&&(t=bn());return e}function zn(){var t,n,o,u;if(t=[],n=Xt,o=Yn(),59===e.charCodeAt(Xt)?(u=U,Xt++):(u=r,0===nn&&pn(ct)),u!==r?n=o=[o,u]:(Xt=n,n=r),n!==r)for(;n!==r;)t.push(n),n=Xt,o=Yn(),59===e.charCodeAt(Xt)?(u=U,Xt++):(u=r,0===nn&&pn(ct)),u!==r?n=o=[o,u]:(Xt=n,n=r);else t=r;return t===r&&(t=Xt,n=function(){var e,t;for(e=[],(t=Sn())===r&&(t=xn());t!==r;)e.push(t),(t=Sn())===r&&(t=xn());return e}(),(o=Pn())===r&&(o=null),(u=Fn())!==r?t=n=[n,o,u]:(Xt=t,t=r),t===r&&(t=Xt,n=Yn(),o=function(){var t,n;return t=Xt,nn++,e.length>Xt?(n=e.charAt(Xt),Xt++):(n=r,0===nn&&pn(Ee)),nn--,n===r?t=void 0:(Xt=t,t=r),t}(),o!==r?t=n=[n,o]:(Xt=t,t=r))),t}var Wn=t.reservedWords||[];if((n=a())!==r&&Xt===e.length)return n;throw n!==r&&Xt<e.length&&pn({type:"end"}),function(e,t,n){return new peg$SyntaxError(peg$SyntaxError.buildMessage(e,t),e,t,n)}(tn,en<e.length?e.charAt(en):null,en<e.length?ln(en,en+1):ln(en,en))}peg$subclass(peg$SyntaxError,Error),peg$SyntaxError.prototype.format=function(e){var t="Error: "+this.message;if(this.location){var n,r=null;for(n=0;n<e.length;n++)if(e[n].source===this.location.source){r=e[n].text.split(/\r\n|\n|\r/g);break}var o=this.location.start,u=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(o):o,a=this.location.source+":"+u.line+":"+u.column;if(r){var i=this.location.end,s=peg$padEnd("",u.line.toString().length," "),c=r[o.line-1],l=(o.line===i.line?i.column:c.length+1)-o.column||1;t+="\n --\x3e "+a+"\n"+s+" |\n"+u.line+" | "+c+"\n"+s+" | "+peg$padEnd("",o.column-1," ")+peg$padEnd("",l,"^")}else t+="\n at "+a}return t},peg$SyntaxError.buildMessage=function(e,t){var n={literal:function(e){return'"'+o(e.text)+'"'},class:function(e){var t=e.parts.map((function(e){return Array.isArray(e)?u(e[0])+"-"+u(e[1]):u(e)}));return"["+(e.inverted?"^":"")+t.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(e){return e.description}};function r(e){return e.charCodeAt(0).toString(16).toUpperCase()}function o(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+r(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+r(e)}))}function u(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+r(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+r(e)}))}function a(e){return n[e.type](e)}return"Expected "+function(e){var t,n,r=e.map(a);if(r.sort(),r.length>0){for(t=1,n=1;t<r.length;t++)r[t-1]!==r[t]&&(r[n]=r[t],n++);r.length=n}switch(r.length){case 1:return r[0];case 2:return r[0]+" or "+r[1];default:return r.slice(0,-1).join(", ")+", or "+r[r.length-1]}}(e)+" but "+function(e){return e?'"'+o(e)+'"':"end of input"}(t)+" found."};var parser$1={SyntaxError:peg$SyntaxError,parse:peg$parse},GrammarError=grammarError,GrammarLocation=grammarLocation,compiler=compiler_1,parser=parser$1,VERSION=version,RESERVED_WORDS=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","null","true","false","enum","implements","interface","let","package","private","protected","public","static","yield","await","arguments","eval"],peg$1={VERSION:VERSION,RESERVED_WORDS:RESERVED_WORDS,GrammarError:GrammarError,GrammarLocation:GrammarLocation,parser:parser,compiler:compiler,generate:function(e,t){var n,r,o="plugins"in(t=void 0!==t?t:{})?t.plugins:[],u={parser:peg$1.parser,passes:(n=peg$1.compiler.passes,r={},Object.keys(n).forEach((function(e){r[e]=n[e].slice()})),r),reservedWords:peg$1.RESERVED_WORDS.slice()};return o.forEach((function(e){e.use(u,t)})),peg$1.compiler.compile(u.parser.parse(e,{grammarSource:t.grammarSource,reservedWords:u.reservedWords}),u.passes,t)}},peg_1=peg$1,peg=peg_1,Runner$1={run:function(e,t,n,r){var o={functions:[],add:function(e){this.functions.push(e)},run:function(){this.functions.length>0&&(this.functions.shift()(),setTimeout((function(){o.run()}),0))}},u={};o.add((function(){r.start(),u.totalInputSize=0,u.totalParseTime=0})),e.forEach((function(e){o.add(function(e){return function(){r.benchmarkStart(e),u.parser=peg.generate(r.readFile("../examples/"+e.id+".pegjs"),n),u.benchmarkInputSize=0,u.benchmarkParseTime=0}}(e)),e.tests.forEach((function(n){o.add(function(e,n){return function(){r.testStart(e,n);for(var o=r.readFile(e.id+"/"+n.file),a=0,i=0;i<t;i++){var s=(new Date).getTime();u.parser.parse(o),a+=(new Date).getTime()-s}var c=a/t;r.testFinish(e,n,o.length,c),u.benchmarkInputSize+=o.length,u.benchmarkParseTime+=c}}(e,n))})),o.add(function(e){return function(){r.benchmarkFinish(e,u.benchmarkInputSize,u.benchmarkParseTime),u.totalInputSize+=u.benchmarkInputSize,u.totalParseTime+=u.benchmarkParseTime}}(e))})),o.add((function(){r.finish(u.totalInputSize,u.totalParseTime)})),o.run()}},runner=Runner$1,benchmarks$1=[{id:"json",title:"JSON",tests:[{file:"example1.json",title:"Example 1"},{file:"example2.json",title:"Example 2"},{file:"example3.json",title:"Example 3"},{file:"example4.json",title:"Example 4"},{file:"example5.json",title:"Example 5"}]},{id:"css",title:"CSS",tests:[{file:"blueprint/src/reset.css",title:"Blueprint - reset.css (source)"},{file:"blueprint/src/typography.css",title:"Blueprint - typography.css (source)"},{file:"blueprint/src/forms.css",title:"Blueprint - forms.css (source)"},{file:"blueprint/src/grid.css",title:"Blueprint - grid.css (source)"},{file:"blueprint/src/print.css",title:"Blueprint - print.css (source)"},{file:"blueprint/min/screen.css",title:"Blueprint - screen.css (minified)"},{file:"blueprint/min/print.css",title:"Blueprint - print.css (minified)"},{file:"960.gs/src/reset.css",title:"960.gs - reset.css (source)"},{file:"960.gs/src/text.css",title:"960.gs - text.css (source)"},{file:"960.gs/src/960.css",title:"960.gs - 960.css (source)"},{file:"960.gs/src/960_24_col.css",title:"960.gs - 960_24_col.css (source)"},{file:"960.gs/min/reset.css",title:"960.gs - reset.css (minified)"},{file:"960.gs/min/text.css",title:"960.gs - text.css (minified)"},{file:"960.gs/min/960.css",title:"960.gs - 960.css (minified)"},{file:"960.gs/min/960_24_col.css",title:"960.gs - 960_24_col.css (minified)"}]}],benchmarks_1=benchmarks$1,Runner=runner,benchmarks=benchmarks_1,BRANCH=location.hash.match(/branch=([^&]*)/i);return BRANCH=BRANCH?BRANCH[1]:"main",$("#run").click((function(){var e=$("#results-table");function t(t,n,r,o,u){e.append("\n <tr class='".concat(t,"'>\n <td class='title'>\n ").concat(null!==r?"<a href='"+r+"'>":"","\n ").concat(n,"\n ").concat(null!==r?"</a>":"","\n </td>\n <td class='input-size'>\n <span class='value'>\n ").concat((o/1024).toFixed(2),"\n </span>\n <span class='unit'>kB</span>\n </td>\n <td class='parse-time'>\n <span class='value'>\n ").concat(u.toFixed(2),"\n </span>\n <span class='unit'>ms</span>\n </td>\n <td class='parse-speed'>\n <span class='value'>\n ").concat((o/1024/(u/1e3)).toFixed(2),"\n </span>\n <span class='unit'>kB/s</span>\n </td>\n </tr>\n "))}var n=parseInt($("#run-count").val(),10),r={cache:$("#cache").is(":checked")};isNaN(n)||n<=0?alert("Number of runs must be a positive integer."):Runner.run(benchmarks,n,r,{readFile:function(e){return $.ajax({type:"GET",url:"https://raw.githubusercontent.com/peggyjs/peggy/".concat(BRANCH,"/benchmark/").concat(e),dataType:"text",async:!1}).responseText},testStart:function(){},testFinish:function(e,n,r,o){t("individual",n.title,"https://github.com/peggyjs/peggy/blob/".concat(BRANCH,"/benchmark/").concat(e.id,"/").concat(n.file),r,o)},benchmarkStart:function(t){e.append("\n <tr class='heading'>\n <th colspan='4'>\n <a href='https://github.com/pegjs/pegjs/blob/".concat(BRANCH,"/examples/").concat(t.id,".pegjs'> ").concat(t.title,' </a>\n </th>\n </tr>"\n '))},benchmarkFinish:function(e,n,r){t("benchmark-total",e.title+" total",null,n,r)},start:function(){$("#run-count, #cache, #run").attr("disabled","disabled"),e.show(),$("#results-table tr").slice(1).remove()},finish:function(e,n){t("total","Total",null,e,n),$.scrollTo("max",{axis:"y",duration:500}),$("#run-count, #cache, #run").removeAttr("disabled")}})})),$(document).ready((function(){return $("#run").focus()})),browser_stub})); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).browser=t()}(this,(function(){var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},browser_stub={},GrammarLocation$4=function(){function e(e,t){this.source=e,this.start=t}return e.prototype.toString=function(){return String(this.source)},e.prototype.offset=function(e){return{line:e.line+this.start.line-1,column:1===e.line?e.column+this.start.column-1:e.column,offset:e.offset+this.start.offset}},e.offsetStart=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.start):e.start},e.offsetEnd=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.end):e.end},e}(),grammarLocation=GrammarLocation$4,__extends=commonjsGlobal&&commonjsGlobal.__extends||(extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},extendStatics(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),extendStatics,GrammarLocation$3=grammarLocation,setProtoOf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},GrammarError$3=function(e){function t(n,r,o){var u=e.call(this,n)||this;return setProtoOf(u,t.prototype),u.name="GrammarError",u.location=r,void 0===o&&(o=[]),u.diagnostics=o,u.stage=null,u.problems=[["error",n,r,o]],u}return __extends(t,e),t.prototype.toString=function(){var t=e.prototype.toString.call(this);this.location&&(t+="\n at ",void 0!==this.location.source&&null!==this.location.source&&(t+="".concat(this.location.source,":")),t+="".concat(this.location.start.line,":").concat(this.location.start.column));for(var n=0,r=this.diagnostics;n<r.length;n++){var o=r[n];t+="\n from ",void 0!==o.location.source&&null!==o.location.source&&(t+="".concat(o.location.source,":")),t+="".concat(o.location.start.line,":").concat(o.location.start.column,": ").concat(o.message)}return t},t.prototype.format=function(e){var t=e.map((function(e){var t=e.source,n=e.text;return{source:t,text:null!=n?String(n).split(/\r\n|\n|\r/g):[]}}));function n(e,n,r){void 0===r&&(r="");var o="",u=t.find((function(t){return t.source===e.source})),a=e.start,i=GrammarLocation$3.offsetStart(e);if(u){var s=e.end,c=u.text[a.line-1],l=(a.line===s.line?s.column:c.length+1)-a.column||1;r&&(o+="\nnote: ".concat(r)),o+="\n --\x3e ".concat(e.source,":").concat(i.line,":").concat(i.column,"\n").concat("".padEnd(n)," |\n").concat(i.line.toString().padStart(n)," | ").concat(c,"\n").concat("".padEnd(n)," | ").concat("".padEnd(a.column-1)).concat("".padEnd(l,"^"))}else o+="\n at ".concat(e.source,":").concat(i.line,":").concat(i.column),r&&(o+=": ".concat(r));return o}function r(e,t,r,o){void 0===o&&(o=[]);var u=-1/0;u=r?o.reduce((function(e,t){var n=t.location;return Math.max(e,GrammarLocation$3.offsetStart(n).line)}),r.start.line):Math.max.apply(null,o.map((function(e){return e.location.start.line}))),u=u.toString().length;var a="".concat(e,": ").concat(t);r&&(a+=n(r,u));for(var i=0,s=o;i<s.length;i++){var c=s[i];a+=n(c.location,u,c.message)}return a}return this.problems.filter((function(e){return"info"!==e[0]})).map((function(e){return r.apply(void 0,e)})).join("\n\n")},t}(Error),grammarError=GrammarError$3,__spreadArray$4=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,u=t.length;o<u;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},visitor$c={build:function(e){function t(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return e[t.type].apply(e,__spreadArray$4([t],n,!1))}function n(){}function r(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return t.apply(void 0,__spreadArray$4([e.expression],n,!1))}function o(e){return function(n){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];n[e].forEach((function(e){return t.apply(void 0,__spreadArray$4([e],r,!1))}))}}var u={grammar:function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];e.topLevelInitializer&&t.apply(void 0,__spreadArray$4([e.topLevelInitializer],n,!1)),e.initializer&&t.apply(void 0,__spreadArray$4([e.initializer],n,!1)),e.rules.forEach((function(e){return t.apply(void 0,__spreadArray$4([e],n,!1))}))},top_level_initializer:n,initializer:n,rule:r,named:r,choice:o("alternatives"),action:r,sequence:o("elements"),labeled:r,text:r,simple_and:r,simple_not:r,optional:r,zero_or_more:r,one_or_more:r,repeated:function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return e.delimiter&&t.apply(void 0,__spreadArray$4([e.delimiter],n,!1)),t.apply(void 0,__spreadArray$4([e.expression],n,!1))},group:r,semantic_and:n,semantic_not:n,rule_ref:n,literal:n,class:n,any:n};return Object.keys(u).forEach((function(t){Object.prototype.hasOwnProperty.call(e,t)||(e[t]=u[t])})),t}},visitor_1=visitor$c,visitor$b=visitor_1,asts$7={findRule:function(e,t){for(var n=0;n<e.rules.length;n++)if(e.rules[n].name===t)return e.rules[n]},indexOfRule:function(e,t){for(var n=0;n<e.rules.length;n++)if(e.rules[n].name===t)return n;return-1},alwaysConsumesOnSuccess:function(e,t){function n(){return!0}function r(){return!1}var o=visitor$b.build({choice:function(e){return e.alternatives.every(o)},sequence:function(e){return e.elements.some(o)},simple_and:r,simple_not:r,optional:r,zero_or_more:r,repeated:function(e){var t=e.min?e.min:e.max;return!("constant"!==t.type||0===t.value||!o(e.expression)&&!(t.value>1&&e.delimiter&&o(e.delimiter)))},semantic_and:r,semantic_not:r,rule_ref:function(t){var n=asts$7.findRule(e,t.name);return n?o(n):void 0},literal:function(e){return""!==e.value},class:n,any:n});return o(t)}},asts_1=asts$7,opcodes={PUSH:0,PUSH_EMPTY_STRING:35,PUSH_UNDEFINED:1,PUSH_NULL:2,PUSH_FAILED:3,PUSH_EMPTY_ARRAY:4,PUSH_CURR_POS:5,POP:6,POP_CURR_POS:7,POP_N:8,NIP:9,APPEND:10,WRAP:11,TEXT:12,PLUCK:36,IF:13,IF_ERROR:14,IF_NOT_ERROR:15,IF_LT:30,IF_GE:31,IF_LT_DYNAMIC:32,IF_GE_DYNAMIC:33,WHILE_NOT_ERROR:16,MATCH_ANY:17,MATCH_STRING:18,MATCH_STRING_IC:19,MATCH_CHAR_CLASS:20,MATCH_REGEXP:20,ACCEPT_N:21,ACCEPT_STRING:22,FAIL:23,LOAD_SAVED_POS:24,UPDATE_SAVED_POS:25,CALL:26,RULE:27,SILENT_FAILS_ON:28,SILENT_FAILS_OFF:29,SOURCE_MAP_PUSH:37,SOURCE_MAP_POP:38,SOURCE_MAP_LABEL_PUSH:39,SOURCE_MAP_LABEL_POP:40},opcodes_1=opcodes,visitor$a=visitor_1,asts$6=asts_1,GrammarError$2=grammarError,ALWAYS_MATCH$1=1,SOMETIMES_MATCH$1=0,NEVER_MATCH$1=-1;function inferenceMatchResult$1(e){function t(e){return e.match=SOMETIMES_MATCH$1}function n(e){return u(e.expression),e.match=ALWAYS_MATCH$1}function r(e){return e.match=u(e.expression)}function o(e,t){for(var n=e.length,r=0,o=0,a=0;a<n;++a){var i=u(e[a]);i===ALWAYS_MATCH$1&&++r,i===NEVER_MATCH$1&&++o}return r===n?ALWAYS_MATCH$1:t?o===n?NEVER_MATCH$1:SOMETIMES_MATCH$1:o>0?NEVER_MATCH$1:SOMETIMES_MATCH$1}var u=visitor$a.build({rule:function(e){var t=void 0,n=0;if(void 0===e.match){e.match=SOMETIMES_MATCH$1;do{if(t=e.match,e.match=u(e.expression),++n>6)throw new GrammarError$2("Infinity cycle detected when trying to evaluate node match result",e.location)}while(t!==e.match)}return e.match},named:r,choice:function(e){return e.match=o(e.alternatives,!0)},action:r,sequence:function(e){return e.match=o(e.elements,!1)},labeled:r,text:r,simple_and:r,simple_not:function(e){return e.match=-u(e.expression)},optional:n,zero_or_more:n,one_or_more:r,repeated:function(e){var t=u(e.expression),n=e.delimiter?u(e.delimiter):NEVER_MATCH$1,r=e.min?e.min:e.max;return"constant"!==r.type||"constant"!==e.max.type?e.match=SOMETIMES_MATCH$1:0===e.max.value||null!==e.max.value&&r.value>e.max.value?e.match=NEVER_MATCH$1:t===NEVER_MATCH$1?e.match=0===r.value?ALWAYS_MATCH$1:NEVER_MATCH$1:t===ALWAYS_MATCH$1?e.delimiter&&r.value>=2?e.match=n:e.match=ALWAYS_MATCH$1:e.delimiter&&r.value>=2?e.match=n===NEVER_MATCH$1?NEVER_MATCH$1:SOMETIMES_MATCH$1:e.match=0===r.value?ALWAYS_MATCH$1:SOMETIMES_MATCH$1},group:r,semantic_and:t,semantic_not:t,rule_ref:function(t){var n=asts$6.findRule(e,t.name);return t.match=u(n)},literal:function(e){var t=0===e.value.length?ALWAYS_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},class:function(e){var t=0===e.parts.length?NEVER_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},any:t});u(e)}inferenceMatchResult$1.ALWAYS_MATCH=ALWAYS_MATCH$1,inferenceMatchResult$1.SOMETIMES_MATCH=SOMETIMES_MATCH$1,inferenceMatchResult$1.NEVER_MATCH=NEVER_MATCH$1;var inferenceMatchResult_1=inferenceMatchResult$1,__spreadArray$3=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,u=t.length;o<u;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},asts$5=asts_1,op$1=opcodes_1,visitor$9=visitor_1,_a$1=inferenceMatchResult_1,ALWAYS_MATCH=_a$1.ALWAYS_MATCH,SOMETIMES_MATCH=_a$1.SOMETIMES_MATCH,NEVER_MATCH=_a$1.NEVER_MATCH;function generateBytecode$1(e,t){var n=[],r=[],o=[],u=[],a=[];function i(e){var t=n.indexOf(e);return-1===t?n.push(e)-1:t}function s(e){var t=JSON.stringify(e),n=o.findIndex((function(e){return JSON.stringify(e)===t}));return-1===n?o.push(e)-1:n}function c(e,t,n){var r={predicate:e,params:t,body:n.code,location:n.codeLocation},o=JSON.stringify(r),a=u.findIndex((function(e){return JSON.stringify(e)===o}));return-1===a?u.push(r)-1:a}function l(e){return a.push(e)-1}function p(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n]})),t}function f(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return e.concat.apply(e,t)}function h(e,t,n,r){return e===ALWAYS_MATCH?n:e===NEVER_MATCH?r:t.concat([n.length,r.length],n,r)}function d(e,t,n,r){var o=Object.keys(n).map((function(e){return r-n[e]}));return[op$1.CALL,e,t,o.length].concat(o)}function g(e,t,n){var r=e.match||0;return f([op$1.PUSH_CURR_POS],C(e,{sp:n.sp+1,env:p(n.env),action:null}),h(t?-r:r,[t?op$1.IF_ERROR:op$1.IF_NOT_ERROR],f([op$1.POP],[t?op$1.POP:op$1.POP_CURR_POS],[op$1.PUSH_UNDEFINED]),f([op$1.POP],[t?op$1.POP_CURR_POS:op$1.POP],[op$1.PUSH_FAILED])))}function A(e,t,n){var r=c(!0,Object.keys(n.env),e);return f([op$1.UPDATE_SAVED_POS],d(r,0,n.env,n.sp),h(e.match||0,[op$1.IF],f([op$1.POP],t?[op$1.PUSH_FAILED]:[op$1.PUSH_UNDEFINED]),f([op$1.POP],t?[op$1.PUSH_UNDEFINED]:[op$1.PUSH_FAILED])))}function m(e){return t=[op$1.WHILE_NOT_ERROR],n=f([op$1.APPEND],e),t.concat([n.length],n);var t,n}function E(e,t,n,r){switch(e.type){case"constant":return{pre:[],post:[],sp:n};case"variable":return e.sp=r+n-t[e.value],{pre:[],post:[],sp:n};case"function":return e.sp=r,{pre:d(c(!0,Object.keys(t),{code:e.value,codeLocation:e.codeLocation}),0,t,n),post:[op$1.NIP],sp:n+1};default:throw new Error('Unknown boundary type "'.concat(e.type,'" for the "repeated" node'))}}function _(e,t){if(null!==t.value){var n="constant"===t.type?[op$1.IF_GE,t.value]:[op$1.IF_GE_DYNAMIC,t.sp];return h(SOMETIMES_MATCH,n,[op$1.PUSH_FAILED],e)}return e}var v,C=(v={grammar:function(e){e.rules.forEach(C),e.literals=n,e.classes=r,e.expectations=o,e.functions=u,e.locations=a},rule:function(e){e.bytecode=C(e.expression,{sp:-1,env:{},pluck:[],action:null})},named:function(e,t){var n=e.match||0,r=n===NEVER_MATCH?-1:s({type:"rule",value:e.name});return f([op$1.SILENT_FAILS_ON],C(e.expression,t),[op$1.SILENT_FAILS_OFF],h(n,[op$1.IF_ERROR],[op$1.FAIL,r],[]))},choice:function(e,t){return function e(t,n){var r=t[0].match||0,o=C(t[0],{sp:n.sp,env:p(n.env),action:null});return r===ALWAYS_MATCH?o:f(o,t.length>1?h(SOMETIMES_MATCH,[op$1.IF_ERROR],f([op$1.POP],e(t.slice(1),n)),[]):[])}(e.alternatives,t)},action:function(e,t){var n=p(t.env),r="sequence"!==e.expression.type||0===e.expression.elements.length,o=C(e.expression,{sp:t.sp+(r?1:0),env:n,action:e}),u=e.expression.match||0,a=r&&u!==NEVER_MATCH?c(!1,Object.keys(n),e):-1;return r?f([op$1.PUSH_CURR_POS],o,h(u,[op$1.IF_NOT_ERROR],f([op$1.LOAD_SAVED_POS,1],d(a,1,n,t.sp+2)),[]),[op$1.NIP]):o},sequence:function(e,t){return f([op$1.PUSH_CURR_POS],function t(n,r){if(n.length>0){var o=e.elements.length-n.length+1;return f(C(n[0],{sp:r.sp,env:r.env,pluck:r.pluck,action:null}),h(n[0].match||0,[op$1.IF_NOT_ERROR],t(n.slice(1),{sp:r.sp+1,env:r.env,pluck:r.pluck,action:r.action}),f(o>1?[op$1.POP_N,o]:[op$1.POP],[op$1.POP_CURR_POS],[op$1.PUSH_FAILED])))}if(r.pluck.length>0)return f([op$1.PLUCK,e.elements.length+1,r.pluck.length],r.pluck.map((function(e){return r.sp-e})));if(r.action){var u=c(!1,Object.keys(r.env),r.action);return f([op$1.LOAD_SAVED_POS,e.elements.length],d(u,e.elements.length+1,r.env,r.sp))}return f([op$1.WRAP,e.elements.length],[op$1.NIP])}(e.elements,{sp:t.sp+1,env:t.env,pluck:[],action:t.action}))},labeled:function(e,n){var r=n.env,o=e.label,u=n.sp+1;o&&(r=p(n.env),n.env[e.label]=u),e.pick&&n.pluck.push(u);var a=C(e.expression,{sp:n.sp,env:r,action:null});return o&&e.labelLocation&&t&&"source-and-map"===t.output?f([op$1.SOURCE_MAP_LABEL_PUSH,u,i(o),l(e.labelLocation)],a,[op$1.SOURCE_MAP_LABEL_POP,u]):a},text:function(e,t){return f([op$1.PUSH_CURR_POS],C(e.expression,{sp:t.sp+1,env:p(t.env),action:null}),h(e.match||0,[op$1.IF_NOT_ERROR],f([op$1.POP],[op$1.TEXT]),[op$1.NIP]))},simple_and:function(e,t){return g(e.expression,!1,t)},simple_not:function(e,t){return g(e.expression,!0,t)},optional:function(e,t){return f(C(e.expression,{sp:t.sp,env:p(t.env),action:null}),h(-(e.expression.match||0),[op$1.IF_ERROR],f([op$1.POP],[op$1.PUSH_NULL]),[]))},zero_or_more:function(e,t){var n=C(e.expression,{sp:t.sp+1,env:p(t.env),action:null});return f([op$1.PUSH_EMPTY_ARRAY],n,m(n),[op$1.POP])},one_or_more:function(e,t){var n=C(e.expression,{sp:t.sp+1,env:p(t.env),action:null});return f([op$1.PUSH_EMPTY_ARRAY],n,h(e.expression.match||0,[op$1.IF_NOT_ERROR],f(m(n),[op$1.POP]),f([op$1.POP],[op$1.POP],[op$1.PUSH_FAILED])))},repeated:function(e,t){var n=e.min?e.min:e.max,r="constant"!==n.type||n.value>0,o="constant"!==e.max.type&&null!==e.max.value,u=r?2:1,a=e.min?E(e.min,t.env,t.sp,2+("function"===e.max.type?1:0)):{pre:[],post:[],sp:t.sp},i=E(e.max,t.env,a.sp,u),s=C(e.expression,{sp:i.sp+u,env:p(t.env),action:null}),c=null!==e.delimiter?C(e.expression,{sp:i.sp+u+1,env:p(t.env),action:null}):s,l=function(e,t,n,r,o){return e?f([op$1.PUSH_CURR_POS],C(e,{sp:r.sp+o+1,env:p(r.env),action:null}),h(e.match||0,[op$1.IF_NOT_ERROR],f([op$1.POP],n,h(-t,[op$1.IF_ERROR],[op$1.POP,op$1.POP_CURR_POS,op$1.PUSH_FAILED],[op$1.NIP])),[op$1.NIP])):n}(e.delimiter,e.expression.match||0,c,t,u),d=_(l,e.max),g=o?_(s,e.max):s,A=f(r?[op$1.PUSH_CURR_POS]:[],[op$1.PUSH_EMPTY_ARRAY],g,m(d),[op$1.POP]);return f(a.pre,i.pre,r?function(e,t){var n="constant"===t.type?[op$1.IF_LT,t.value]:[op$1.IF_LT_DYNAMIC,t.sp];return f(e,h(SOMETIMES_MATCH,n,[op$1.POP,op$1.POP_CURR_POS,op$1.PUSH_FAILED],[op$1.NIP]))}(A,n):A,i.post,a.post)},group:function(e,t){return C(e.expression,{sp:t.sp,env:p(t.env),action:null})},semantic_and:function(e,t){return A(e,!1,t)},semantic_not:function(e,t){return A(e,!0,t)},rule_ref:function(t){return[op$1.RULE,asts$5.indexOfRule(e,t.name)]},literal:function(e){if(e.value.length>0){var t=e.match||0,n=t===SOMETIMES_MATCH||t===ALWAYS_MATCH&&!e.ignoreCase?i(e.ignoreCase?e.value.toLowerCase():e.value):-1,r=t!==ALWAYS_MATCH?s({type:"literal",value:e.value,ignoreCase:e.ignoreCase}):-1;return h(t,e.ignoreCase?[op$1.MATCH_STRING_IC,n]:[op$1.MATCH_STRING,n],e.ignoreCase?[op$1.ACCEPT_N,e.value.length]:[op$1.ACCEPT_STRING,n],[op$1.FAIL,r])}return[op$1.PUSH_EMPTY_STRING]},class:function(e){var t=e.match||0,n=t===SOMETIMES_MATCH?function(e){var t={value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase},n=JSON.stringify(t),o=r.findIndex((function(e){return JSON.stringify(e)===n}));return-1===o?r.push(t)-1:o}(e):-1,o=t!==ALWAYS_MATCH?s({type:"class",value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase}):-1;return h(t,[op$1.MATCH_CHAR_CLASS,n],[op$1.ACCEPT_N,1],[op$1.FAIL,o])},any:function(e){var t=e.match||0,n=t!==ALWAYS_MATCH?s({type:"any"}):-1;return h(t,[op$1.MATCH_ANY],[op$1.ACCEPT_N,1],[op$1.FAIL,n])}},t&&"source-and-map"===t.output&&Object.keys(v).forEach((function(e){var t=v[e];v[e]=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=t.apply(void 0,__spreadArray$3([e],n,!1));return void 0!==o&&e.location?f([op$1.SOURCE_MAP_PUSH,l(e.location)],o,[op$1.SOURCE_MAP_POP]):o}})),visitor$9.build(v));C(e)}var generateBytecode_1=generateBytecode$1,sourceMap={},sourceMapGenerator={},base64Vlq={},base64$3={};const intToCharMap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");base64$3.encode=function(e){if(0<=e&&e<intToCharMap.length)return intToCharMap[e];throw new TypeError("Must be between 0 and 63: "+e)};const base64$2=base64$3,VLQ_BASE_SHIFT=5,VLQ_BASE=1<<VLQ_BASE_SHIFT,VLQ_BASE_MASK=VLQ_BASE-1,VLQ_CONTINUATION_BIT=VLQ_BASE;function toVLQSigned(e){return e<0?1+(-e<<1):0+(e<<1)}base64Vlq.encode=function(e){let t,n="",r=toVLQSigned(e);do{t=r&VLQ_BASE_MASK,r>>>=VLQ_BASE_SHIFT,r>0&&(t|=VLQ_CONTINUATION_BIT),n+=base64$2.encode(t)}while(r>0);return n};var util$3={};function getArg(e,t,n){if(t in e)return e[t];if(3===arguments.length)return n;throw new Error('"'+t+'" is a required argument.')}util$3.getArg=getArg;const supportsNullProto=!("__proto__"in Object.create(null));function identity(e){return e}function toSetString(e){return isProtoString(e)?"$"+e:e}function fromSetString(e){return isProtoString(e)?e.slice(1):e}function isProtoString(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let n=t-10;n>=0;n--)if(36!==e.charCodeAt(n))return!1;return!0}function strcmp(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated(e,t){let n=e.generatedLine-t.generatedLine;return 0!==n?n:(n=e.generatedColumn-t.generatedColumn,0!==n?n:(n=strcmp(e.source,t.source),0!==n?n:(n=e.originalLine-t.originalLine,0!==n?n:(n=e.originalColumn-t.originalColumn,0!==n?n:strcmp(e.name,t.name)))))}util$3.toSetString=supportsNullProto?identity:toSetString,util$3.fromSetString=supportsNullProto?identity:fromSetString,util$3.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated;const PROTOCOL="http:",PROTOCOL_AND_HOST=`${PROTOCOL}//host`;function createSafeHandler(e){return t=>{const n=getURLType(t),r=buildSafeBase(t),o=new URL(t,r);e(o);const u=o.toString();return"absolute"===n?u:"scheme-relative"===n?u.slice(PROTOCOL.length):"path-absolute"===n?u.slice(PROTOCOL_AND_HOST.length):computeRelativeURL(r,u)}}function withBase(e,t){return new URL(e,t).toString()}function buildUniqueSegment(e,t){let n=0;for(;;){const r=e+n++;if(-1===t.indexOf(r))return r}}function buildSafeBase(e){const t=e.split("..").length-1,n=buildUniqueSegment("p",e);let r=`${PROTOCOL_AND_HOST}/`;for(let e=0;e<t;e++)r+=`${n}/`;return r}const ABSOLUTE_SCHEME=/^[A-Za-z0-9\+\-\.]+:/;function getURLType(e){return"/"===e[0]?"/"===e[1]?"scheme-relative":"path-absolute":ABSOLUTE_SCHEME.test(e)?"absolute":"path-relative"}function computeRelativeURL(e,t){"string"==typeof e&&(e=new URL(e)),"string"==typeof t&&(t=new URL(t));const n=t.pathname.split("/"),r=e.pathname.split("/");for(r.length>0&&!r[r.length-1]&&r.pop();n.length>0&&r.length>0&&n[0]===r[0];)n.shift(),r.shift();return r.map((()=>"..")).concat(n).join("/")+t.search+t.hash}const ensureDirectory=createSafeHandler((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),normalize=createSafeHandler((e=>{}));function join(e,t){const n=getURLType(t),r=getURLType(e);if(e=ensureDirectory(e),"absolute"===n)return withBase(t,void 0);if("absolute"===r)return withBase(t,e);if("scheme-relative"===n)return normalize(t);if("scheme-relative"===r)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL.length);if("path-absolute"===n)return normalize(t);if("path-absolute"===r)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL_AND_HOST.length);const o=buildSafeBase(t+e);return computeRelativeURL(o,withBase(t,withBase(e,o)))}function relative(e,t){const n=relativeIfPossible(e,t);return"string"==typeof n?n:normalize(t)}function relativeIfPossible(e,t){if(getURLType(e)!==getURLType(t))return null;const n=buildSafeBase(e+t),r=new URL(e,n),o=new URL(t,n);try{new URL("",o.toString())}catch(e){return null}return o.protocol!==r.protocol||o.user!==r.user||o.password!==r.password||o.hostname!==r.hostname||o.port!==r.port?null:computeRelativeURL(r,o)}util$3.normalize=normalize,util$3.join=join,util$3.relative=relative;var arraySet={};let ArraySet$1=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,n){const r=new e;for(let e=0,o=t.length;e<o;e++)r.add(t[e],n);return r}size(){return this._set.size}add(e,t){const n=this.has(e),r=this._array.length;n&&!t||this._array.push(e),n||this._set.set(e,r)}has(e){return this._set.has(e)}indexOf(e){const t=this._set.get(e);if(t>=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)}toArray(){return this._array.slice()}};arraySet.ArraySet=ArraySet$1;var mappingList={};const util$2=util$3;function generatedPositionAfter(e,t){const n=e.generatedLine,r=t.generatedLine,o=e.generatedColumn,u=t.generatedColumn;return r>n||r==n&&u>=o||util$2.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$1=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$2.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList.MappingList=MappingList$1;const base64VLQ=base64Vlq,util$1=util$3,ArraySet=arraySet.ArraySet,MappingList=mappingList.MappingList;let SourceMapGenerator$1=class e{constructor(e){e||(e={}),this._file=util$1.getArg(e,"file",null),this._sourceRoot=util$1.getArg(e,"sourceRoot",null),this._skipValidation=util$1.getArg(e,"skipValidation",!1),this._sources=new ArraySet,this._names=new ArraySet,this._mappings=new MappingList,this._sourcesContents=null}static fromSourceMap(t){const n=t.sourceRoot,r=new e({file:t.file,sourceRoot:n});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=n&&(t.source=util$1.relative(n,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),r.addMapping(t)})),t.sources.forEach((function(e){let o=e;null!=n&&(o=util$1.relative(n,e)),r._sources.has(o)||r._sources.add(o);const u=t.sourceContentFor(e);null!=u&&r.setSourceContent(e,u)})),r}addMapping(e){const t=util$1.getArg(e,"generated"),n=util$1.getArg(e,"original",null);let r=util$1.getArg(e,"source",null),o=util$1.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,n,r,o),null!=r&&(r=String(r),this._sources.has(r)||this._sources.add(r)),null!=o&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:n&&n.line,originalColumn:n&&n.column,source:r,name:o})}setSourceContent(e,t){let n=e;null!=this._sourceRoot&&(n=util$1.relative(this._sourceRoot,n)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$1.toSetString(n)]=t):this._sourcesContents&&(delete this._sourcesContents[util$1.toSetString(n)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,n){let r=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');r=e.file}const o=this._sourceRoot;null!=o&&(r=util$1.relative(o,r));const u=this._mappings.toArray().length>0?new ArraySet:this._sources,a=new ArraySet;this._mappings.unsortedForEach((function(t){if(t.source===r&&null!=t.originalLine){const r=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=r.source&&(t.source=r.source,null!=n&&(t.source=util$1.join(n,t.source)),null!=o&&(t.source=util$1.relative(o,t.source)),t.originalLine=r.line,t.originalColumn=r.column,null!=r.name&&(t.name=r.name))}const i=t.source;null==i||u.has(i)||u.add(i);const s=t.name;null==s||a.has(s)||a.add(s)}),this),this._sources=u,this._names=a,e.sources.forEach((function(t){const r=e.sourceContentFor(t);null!=r&&(null!=n&&(t=util$1.join(n,t)),null!=o&&(t=util$1.relative(o,t)),this.setSourceContent(t,r))}),this)}_validateMapping(e,t,n,r){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!n&&!r);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&n))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:t,name:r}))}_serializeMappings(){let e,t,n,r,o=0,u=1,a=0,i=0,s=0,c=0,l="";const p=this._mappings.toArray();for(let f=0,h=p.length;f<h;f++){if(t=p[f],e="",t.generatedLine!==u)for(o=0;t.generatedLine!==u;)e+=";",u++;else if(f>0){if(!util$1.compareByGeneratedPositionsInflated(t,p[f-1]))continue;e+=","}e+=base64VLQ.encode(t.generatedColumn-o),o=t.generatedColumn,null!=t.source&&(r=this._sources.indexOf(t.source),e+=base64VLQ.encode(r-c),c=r,e+=base64VLQ.encode(t.originalLine-1-i),i=t.originalLine-1,e+=base64VLQ.encode(t.originalColumn-a),a=t.originalColumn,null!=t.name&&(n=this._names.indexOf(t.name),e+=base64VLQ.encode(n-s),s=n)),l+=e}return l}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$1.relative(t,e));const n=util$1.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,n)?this._sourcesContents[n]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$1.prototype._version=3,sourceMapGenerator.SourceMapGenerator=SourceMapGenerator$1;var sourceNode={};const SourceMapGenerator=sourceMapGenerator.SourceMapGenerator,util=util$3,REGEX_NEWLINE=/(\r?\n)/,NEWLINE_CODE=10,isSourceNode="$$$isSourceNode$$$";let SourceNode$2=class e{constructor(e,t,n,r,o){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==n?null:n,this.name=null==o?null:o,this[isSourceNode]=!0,null!=r&&this.add(r)}static fromStringWithSourceMap(t,n,r){const o=new e,u=t.split(REGEX_NEWLINE);let a=0;const i=function(){return e()+(e()||"");function e(){return a<u.length?u[a++]:void 0}};let s,c=1,l=0,p=null;return n.eachMapping((function(e){if(null!==p){if(!(c<e.generatedLine)){s=u[a]||"";const t=s.substr(0,e.generatedColumn-l);return u[a]=s.substr(e.generatedColumn-l),l=e.generatedColumn,f(p,t),void(p=e)}f(p,i()),c++,l=0}for(;c<e.generatedLine;)o.add(i()),c++;l<e.generatedColumn&&(s=u[a]||"",o.add(s.substr(0,e.generatedColumn)),u[a]=s.substr(e.generatedColumn),l=e.generatedColumn),p=e}),this),a<u.length&&(p&&f(p,i()),o.add(u.splice(a).join(""))),n.sources.forEach((function(e){const t=n.sourceContentFor(e);null!=t&&(null!=r&&(e=util.join(r,e)),o.setSourceContent(e,t))})),o;function f(t,n){if(null===t||void 0===t.source)o.add(n);else{const u=r?util.join(r,t.source):t.source;o.add(new e(t.originalLine,t.originalColumn,u,n,t.name))}}}add(e){if(Array.isArray(e))e.forEach((function(e){this.add(e)}),this);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this}prepend(e){if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let n=0,r=this.children.length;n<r;n++)t=this.children[n],t[isSourceNode]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})}join(e){let t,n;const r=this.children.length;if(r>0){for(t=[],n=0;n<r-1;n++)t.push(this.children[n]),t.push(e);t.push(this.children[n]),this.children=t}return this}replaceRight(e,t){const n=this.children[this.children.length-1];return n[isSourceNode]?n.replaceRight(e,t):"string"==typeof n?this.children[this.children.length-1]=n.replace(e,t):this.children.push("".replace(e,t)),this}setSourceContent(e,t){this.sourceContents[util.toSetString(e)]=t}walkSourceContents(e){for(let t=0,n=this.children.length;t<n;t++)this.children[t][isSourceNode]&&this.children[t].walkSourceContents(e);const t=Object.keys(this.sourceContents);for(let n=0,r=t.length;n<r;n++)e(util.fromSetString(t[n]),this.sourceContents[t[n]])}toString(){let e="";return this.walk((function(t){e+=t})),e}toStringWithSourceMap(e){const t={code:"",line:1,column:0},n=new SourceMapGenerator(e);let r=!1,o=null,u=null,a=null,i=null;return this.walk((function(e,s){t.code+=e,null!==s.source&&null!==s.line&&null!==s.column?(o===s.source&&u===s.line&&a===s.column&&i===s.name||n.addMapping({source:s.source,original:{line:s.line,column:s.column},generated:{line:t.line,column:t.column},name:s.name}),o=s.source,u=s.line,a=s.column,i=s.name,r=!0):r&&(n.addMapping({generated:{line:t.line,column:t.column}}),o=null,r=!1);for(let u=0,a=e.length;u<a;u++)e.charCodeAt(u)===NEWLINE_CODE?(t.line++,t.column=0,u+1===a?(o=null,r=!1):r&&n.addMapping({source:s.source,original:{line:s.line,column:s.column},generated:{line:t.line,column:t.column},name:s.name})):t.column++})),this.walkSourceContents((function(e,t){n.setSourceContent(e,t)})),{code:t.code,map:n}}};sourceNode.SourceNode=SourceNode$2,sourceMap.SourceMapGenerator=sourceMapGenerator.SourceMapGenerator,sourceMap.SourceNode=sourceNode.SourceNode;var SourceNode$1=sourceMap.SourceNode,GrammarLocation$2=grammarLocation,Stack$1=function(){function e(e,t,n,r){this.sp=-1,this.maxSp=-1,this.varName=t,this.ruleName=e,this.type=n,this.bytecode=r,this.labels={},this.sourceMapStack=[]}return e.prototype.name=function(e){if(e<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack underflow: attempt to use a variable '").concat(this.varName,"<x>' at an index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.varName+e},e.sourceNode=function(e,t,n){var r=GrammarLocation$2.offsetStart(e);return new SourceNode$1(r.line,r.column?r.column-1:null,String(e.source),t,n)},e.prototype.push=function(t){++this.sp>this.maxSp&&(this.maxSp=this.sp);var n=this.labels[this.sp],r=[this.name(this.sp)," = ",t,";"];if(n){if(this.sourceMapStack.length){var o=e.sourceNode(n.location,r.splice(0,2),n.label),u=this.sourceMapPopInternal(),a=u.parts,i=u.location,s=i.start.offset<n.location.end.offset?{start:n.location.end,end:i.end,source:i.source}:i,c=e.sourceNode(s,r.concat("\n"));return this.sourceMapStack.push([a,a.length+1,i]),new SourceNode$1(null,null,n.location.source,[o,c])}return e.sourceNode(n.location,r.concat("\n"))}return r.join("")},e.prototype.pop=function(e){var t=this;return void 0!==e?(this.sp-=e,Array.from({length:e},(function(e,n){return t.name(t.sp+1+n)}))):this.name(this.sp--)},e.prototype.top=function(){return this.name(this.sp)},e.prototype.index=function(e){if(e<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack overflow: attempt to get a variable at a negative index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.name(this.sp-e)},e.prototype.result=function(){if(this.maxSp<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack is empty, can't get the result.\nBytecode: ").concat(this.bytecode));return this.name(0)},e.prototype.defines=function(){var e=this;return this.maxSp<0?"":this.type+" "+Array.from({length:this.maxSp+1},(function(t,n){return e.name(n)})).join(", ")+";"},e.prototype.checkedIf=function(e,t,n){var r=this.sp,o=t();if(!n)return[o];var u=this.sp;this.sp=r;var a=n();if(u!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+e+": Branches of a condition can't move the stack pointer differently (before: "+r+", after then: "+u+", after else: "+this.sp+"). Bytecode: "+this.bytecode);return[o,a]},e.prototype.checkedLoop=function(e,t){var n=this.sp,r=t();if(n!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+e+": Body of a loop can't move the stack pointer (before: "+n+", after: "+this.sp+"). Bytecode: "+this.bytecode);return r},e.prototype.sourceMapPush=function(e,t){if(this.sourceMapStack.length){var n=this.sourceMapStack[this.sourceMapStack.length-1];n[2].start.offset===t.start.offset&&n[2].end.offset>t.end.offset&&(n[2]={start:t.end,end:n[2].end,source:n[2].source})}this.sourceMapStack.push([e,e.length,t])},e.prototype.sourceMapPopInternal=function(){var e=this.sourceMapStack.pop();if(!e)throw new RangeError("Rule '".concat(this.ruleName,"': Attempting to pop an empty source map stack.\nBytecode: ").concat(this.bytecode));var t=e[0],n=e[1],r=e[2],o=t.splice(n).map((function(e){return e instanceof SourceNode$1?e:e+"\n"}));if(o.length){var u=GrammarLocation$2.offsetStart(r);t.push(new SourceNode$1(u.line,u.column-1,String(r.source),o))}return{parts:t,location:r}},e.prototype.sourceMapPop=function(e){var t=this.sourceMapPopInternal().location;if(this.sourceMapStack.length&&t.end.offset<this.sourceMapStack[this.sourceMapStack.length-1][2].end.offset){var n=this.sourceMapPopInternal(),r=n.parts,o=n.location,u=o.start.offset<t.end.offset?{start:t.end,end:o.end,source:o.source}:o;this.sourceMapStack.push([r,r.length+(e||0),u])}},e}(),stack=Stack$1,version="3.0.2",utils={};function hex(e){return e.charCodeAt(0).toString(16).toUpperCase()}function stringEscape$1(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+hex(e)})).replace(/[\x10-\x1F\x7F-\xFF]/g,(function(e){return"\\x"+hex(e)})).replace(/[\u0100-\u0FFF]/g,(function(e){return"\\u0"+hex(e)})).replace(/[\u1000-\uFFFF]/g,(function(e){return"\\u"+hex(e)}))}function regexpClassEscape$1(e){return e.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+hex(e)})).replace(/[\x10-\x1F\x7F-\xFF]/g,(function(e){return"\\x"+hex(e)})).replace(/[\u0100-\u0FFF]/g,(function(e){return"\\u0"+hex(e)})).replace(/[\u1000-\uFFFF]/g,(function(e){return"\\u"+hex(e)}))}function base64$1(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=e.length%3,r=e.length-n,o="",u=0;u<r;u+=3)o+=t[e[u]>>2],o+=t[(3&e[u])<<4|e[u+1]>>4],o+=t[(15&e[u+1])<<2|e[u+2]>>6],o+=t[63&e[u+2]];return 1===n?(o+=t[e[r]>>2],o+=t[(3&e[r])<<4],o+="=="):2===n&&(o+=t[e[r]>>2],o+=t[(3&e[r])<<4|e[r+1]>>4],o+=t[(15&e[r+1])<<2],o+="="),o}utils.hex=hex,utils.stringEscape=stringEscape$1,utils.regexpClassEscape=regexpClassEscape$1,utils.base64=base64$1;var __spreadArray$2=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,u=t.length;o<u;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},asts$4=asts_1,op=opcodes_1,Stack=stack,VERSION$1=version,_a=utils,stringEscape=_a.stringEscape,regexpClassEscape=_a.regexpClassEscape,SourceNode=sourceMap.SourceNode,GrammarLocation$1=grammarLocation;function toSourceNode(e,t,n){var r=GrammarLocation$1.offsetStart(t),o=r.line,u=r.column-1,a=e.split("\n");return 1===a.length?new SourceNode(o,u,String(t.source),e,n):new SourceNode(null,null,String(t.source),a.map((function(e,r){return new SourceNode(o+r,0===r?u:0,String(t.source),r===a.length-1?e:[e,"\n"],n)})))}function wrapInSourceNode(e,t,n,r,o){if(n){var u=GrammarLocation$1.offsetEnd(n);return new SourceNode(null,null,String(n.source),[e,toSourceNode(t,n,o),new SourceNode(u.line,u.column-1,String(n.source),r)])}return new SourceNode(null,null,null,[e,t,r])}function generateJS$1(e,t){if(!(e.literals&&e.locations&&e.classes&&e.expectations&&e.functions))throw new Error("generateJS: generate bytecode was not called.");var n=e.literals,r=e.locations,o=e.classes,u=e.expectations,a=e.functions;if(!t.allowedStartRules)throw new Error("generateJS: options.allowedStartRules was not set.");var i=t.allowedStartRules,s=t.dependencies||{};function c(e){var t=!0,n=0;return function e(r){return Array.isArray(r)?r.map((function(t){return e(t)})):r instanceof SourceNode?(n++,r.children=e(r.children),n--,r):(r=t?r.replace(/^(.+)$/gm," $1"):r.replace(/\n(\s*\S)/g,"\n $1"),t=!n||r.endsWith("\n"),r)}(e)}function l(e){return"peg$c"+e}function p(e){return"peg$r"+e}function f(e){return"peg$e"+e}function h(e){return"peg$f"+e}function d(e){return"peg$parse"+e}function g(e){return e.codeLocation?toSourceNode(e.code,e.codeLocation,"$"+e.type):e.code}e.code=function(e){function n(){return["// @generated by Peggy ".concat(VERSION$1,"."),"//","// https://peggyjs.org/"]}function r(){return t.trace?["{"," SyntaxError: peg$SyntaxError,"," DefaultTracer: peg$DefaultTracer,"," parse: peg$parse","}"].join("\n"):["{"," SyntaxError: peg$SyntaxError,"," parse: peg$parse","}"].join("\n")}var o={bare:function(){return __spreadArray$2(__spreadArray$2([],n(),!0),["(function() {",' "use strict";',"",e,"",c("return "+r()+";"),"})()"],!1)},commonjs:function(){var t=Object.keys(s),o=n();return o.push("",'"use strict";',""),t.length>0&&(t.forEach((function(e){o.push("var "+e+' = require("'+stringEscape(s[e])+'");')})),o.push("")),o.push(e,"","module.exports = "+r()+";"),o},es:function(){var r=Object.keys(s),o=n();return o.push(""),r.length>0&&(r.forEach((function(e){o.push("import "+e+' from "'+stringEscape(s[e])+'";')})),o.push("")),o.push(e,"","export {"," peg$SyntaxError as SyntaxError,",t.trace?" peg$DefaultTracer as DefaultTracer,":""," peg$parse as parse","};"),o},amd:function(){var t=Object.keys(s),o="["+t.map((function(e){return s[e]})).map((function(e){return'"'+stringEscape(e)+'"'})).join(", ")+"]",u=t.join(", ");return __spreadArray$2(__spreadArray$2([],n(),!0),["define("+o+", function("+u+") {",' "use strict";',"",e,"",c("return "+r()+";"),"});"],!1)},globals:function(){return __spreadArray$2(__spreadArray$2([],n(),!0),["(function(root) {",' "use strict";',"",e,"",c("root."+t.exportVar+" = "+r()+";"),"})(this);"],!1)},umd:function(){var o=Object.keys(s),u=o.map((function(e){return s[e]})),a="["+u.map((function(e){return'"'+stringEscape(e)+'"'})).join(", ")+"]",i=u.map((function(e){return'require("'+stringEscape(e)+'")'})).join(", "),l=o.join(", "),p=n();return p.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+a+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+i+");"),null!==t.exportVar&&p.push(" } else {"," root."+t.exportVar+" = factory();"),p.push(" }","})(this, function("+l+") {",' "use strict";',"",e,"",c("return "+r()+";"),"});"),p}}[t.format||"bare"]();return new SourceNode(null,null,t.grammarSource,o.map((function(e){return e instanceof SourceNode?e:e+"\n"})))}(function(){var s=[];e.topLevelInitializer&&(s.push(g(e.topLevelInitializer)),s.push("")),s.push("function peg$subclass(child, parent) {"," function C() { this.constructor = child; }"," C.prototype = parent.prototype;"," child.prototype = new C();","}","","function peg$SyntaxError(message, expected, found, location) {"," var self = Error.call(this, message);"," // istanbul ignore next Check is a necessary evil to support older environments"," if (Object.setPrototypeOf) {"," Object.setPrototypeOf(self, peg$SyntaxError.prototype);"," }"," self.expected = expected;"," self.found = found;"," self.location = location;",' self.name = "SyntaxError";'," return self;","}","","peg$subclass(peg$SyntaxError, Error);","","function peg$padEnd(str, targetLength, padString) {",' padString = padString || " ";'," if (str.length > targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))'," ? this.location.source.offset(s)"," : s;",' var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;'," if (src) {"," var e = this.location.end;"," var filler = peg$padEnd(\"\", offset_s.line.toString().length, ' ');"," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --\x3e " + loc + "\\n"',' + filler + " |\\n"',' + offset_s.line + " | " + line + "\\n"',' + filler + " | " + peg$padEnd("", s.column - 1, \' \')',' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/"/g, "\\\\\\"")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/\\]/g, "\\\\]")',' .replace(/\\^/g, "\\\\^")',' .replace(/-/g, "\\\\-")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),t.trace&&s.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");var A="{ "+i.map((function(e){return e+": "+d(e)})).join(", ")+" }",m=d(i[0]);return s.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+A+";"," var peg$startRuleFunction = "+m+";","",new SourceNode(null,null,t.grammarSource,__spreadArray$2([n.map((function(e,t){return" var "+l(t)+' = "'+stringEscape(e)+'";'})).concat("",o.map((function(e,t){return" var "+p(t)+" = /^["+((n=e).inverted?"^":"")+n.value.map((function(e){return Array.isArray(e)?regexpClassEscape(e[0])+"-"+regexpClassEscape(e[1]):regexpClassEscape(e)})).join("")+"]/"+(n.ignoreCase?"i":"")+";";var n}))).concat("",u.map((function(e,t){return" var "+f(t)+" = "+function(e){switch(e.type){case"rule":return'peg$otherExpectation("'+stringEscape(e.value)+'")';case"literal":return'peg$literalExpectation("'+stringEscape(e.value)+'", '+e.ignoreCase+")";case"class":return"peg$classExpectation(["+e.value.map((function(e){return Array.isArray(e)?'["'+stringEscape(e[0])+'", "'+stringEscape(e[1])+'"]':'"'+stringEscape(e)+'"'})).join(", ")+"], "+e.inverted+", "+e.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(e)+")")}}(e)+";"}))).concat("").join("\n")],a.map((function(e,t){return wrapInSourceNode("\n var ".concat(h(t)," = function(").concat(e.params.join(", "),") {"),e.body,e.location,"};")})),!0)),""," var peg$currPos = 0;"," var peg$savedPos = 0;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = 0;"," var peg$maxFailExpected = [];"," var peg$silentFails = 0;",""),t.cache&&s.push(" var peg$resultsCache = {};",""),t.trace&&s.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),s.push(" var peg$result;","",' if ("startRule" in options) {'," if (!(options.startRule in peg$startRuleFunctions)) {",' throw new Error("Can\'t start parsing from rule \\"" + options.startRule + "\\".");'," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," if (pos >= peg$posDetailsCache.length) {"," p = peg$posDetailsCache.length - 1;"," } else {"," p = pos;"," while (!peg$posDetailsCache[--p]) {}"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos, offset) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," var res = {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };",' if (offset && peg$source && (typeof peg$source.offset === "function")) {'," res.start = peg$source.offset(res.start);"," res.end = peg$source.offset(res.end);"," }"," return res;"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),e.rules.forEach((function(o){s.push.apply(s,c(function(o){var u=[],a=o.bytecode,i=new Stack(o.name,"s","var",a),s=function t(o){var u=0,a=o.length,s=[],g=void 0;function A(e,n,r){var a=n+3,l=o[u+a-2],p=o[u+a-1],f=i.checkedIf(u,(function(){return u+=a+l,(r||t)(o.slice(u-l,u))}),p>0?function(){return u+=p,t(o.slice(u-p,u))}:null),h=f[0],d=f[1];s.push("if ("+e+") {"),s.push.apply(s,c(h)),p>0&&(s.push("} else {"),s.push.apply(s,c(d))),s.push("}")}function m(e,n,r){var a=n+3,c=1===r?"input.charAt(peg$currPos)":"input.substr(peg$currPos, "+r+")",l=null;o[u+a]===op.ACCEPT_N&&o[u+a+1]===r&&(s.push(i.push(c)),c=i.pop(),l=function(e){i.sp++;var n=t(e.slice(2));return n.unshift(1===r?"peg$currPos++;":"peg$currPos += "+r+";"),n}),A(e(c,null!==l),n,l)}for(var E=function(){switch(o[u]){case op.PUSH_EMPTY_STRING:s.push(i.push("''")),u++;break;case op.PUSH_CURR_POS:s.push(i.push("peg$currPos")),u++;break;case op.PUSH_UNDEFINED:s.push(i.push("undefined")),u++;break;case op.PUSH_NULL:s.push(i.push("null")),u++;break;case op.PUSH_FAILED:s.push(i.push("peg$FAILED")),u++;break;case op.PUSH_EMPTY_ARRAY:s.push(i.push("[]")),u++;break;case op.POP:i.pop(),u++;break;case op.POP_CURR_POS:s.push("peg$currPos = "+i.pop()+";"),u++;break;case op.POP_N:i.pop(o[u+1]),u+=2;break;case op.NIP:g=i.pop(),i.pop(),s.push(i.push(g)),u++;break;case op.APPEND:g=i.pop(),s.push(i.top()+".push("+g+");"),u++;break;case op.WRAP:s.push(i.push("["+i.pop(o[u+1]).join(", ")+"]")),u+=2;break;case op.TEXT:s.push(i.push("input.substring("+i.pop()+", peg$currPos)")),u++;break;case op.PLUCK:var a=o[u+3-1],E=3+a;g=o.slice(u+3,u+E),g=1===a?i.index(g[0]):"[ ".concat(g.map((function(e){return i.index(e)})).join(", ")," ]"),i.pop(o[u+1]),s.push(i.push(g)),u+=E;break;case op.IF:A(i.top(),0);break;case op.IF_ERROR:A(i.top()+" === peg$FAILED",0);break;case op.IF_NOT_ERROR:A(i.top()+" !== peg$FAILED",0);break;case op.IF_LT:A(i.top()+".length < "+o[u+1],1);break;case op.IF_GE:A(i.top()+".length >= "+o[u+1],1);break;case op.IF_LT_DYNAMIC:A(i.top()+".length < ("+i.index(o[u+1])+"|0)",1);break;case op.IF_GE_DYNAMIC:A(i.top()+".length >= ("+i.index(o[u+1])+"|0)",1);break;case op.WHILE_NOT_ERROR:y=i.top()+" !== peg$FAILED",S=o[u+2-1],F=i.checkedLoop(u,(function(){return u+=2+S,t(o.slice(u-S,u))})),s.push("while ("+y+") {"),s.push.apply(s,c(F)),s.push("}");break;case op.MATCH_ANY:A("input.length > peg$currPos",0);break;case op.MATCH_STRING:var _=o[u+1],v=n[_];m((function(e,t){return v.length>1?"".concat(e," === ").concat(l(_)):(e=t?"".concat(e,".charCodeAt(0)"):"input.charCodeAt(peg$currPos)","".concat(e," === ").concat(v.charCodeAt(0)))}),1,v.length);break;case op.MATCH_STRING_IC:var C=o[u+1];m((function(e){return"".concat(e,".toLowerCase() === ").concat(l(C))}),1,n[C].length);break;case op.MATCH_CHAR_CLASS:var $=o[u+1];m((function(e){return"".concat(p($),".test(").concat(e,")")}),1,1);break;case op.ACCEPT_N:s.push(i.push(o[u+1]>1?"input.substr(peg$currPos, "+o[u+1]+")":"input.charAt(peg$currPos)")),s.push(o[u+1]>1?"peg$currPos += "+o[u+1]+";":"peg$currPos++;"),u+=2;break;case op.ACCEPT_STRING:s.push(i.push(l(o[u+1]))),s.push(n[o[u+1]].length>1?"peg$currPos += "+n[o[u+1]].length+";":"peg$currPos++;"),u+=2;break;case op.FAIL:s.push(i.push("peg$FAILED")),s.push("if (peg$silentFails === 0) { peg$fail("+f(o[u+1])+"); }"),u+=2;break;case op.LOAD_SAVED_POS:s.push("peg$savedPos = "+i.index(o[u+1])+";"),u+=2;break;case op.UPDATE_SAVED_POS:s.push("peg$savedPos = peg$currPos;"),u++;break;case op.CALL:g=function(e){var t=o[u+4-1];return h(o[u+1])+"("+o.slice(u+4,u+4+t).map((function(e){return i.index(e)})).join(", ")+")"}(),i.pop(o[u+2]),s.push(i.push(g)),u+=4+o[u+3];break;case op.RULE:s.push(i.push(d(e.rules[o[u+1]].name)+"()")),u+=2;break;case op.SILENT_FAILS_ON:s.push("peg$silentFails++;"),u++;break;case op.SILENT_FAILS_OFF:s.push("peg$silentFails--;"),u++;break;case op.SOURCE_MAP_PUSH:i.sourceMapPush(s,r[o[u+1]]),u+=2;break;case op.SOURCE_MAP_POP:i.sourceMapPop(),u++;break;case op.SOURCE_MAP_LABEL_PUSH:i.labels[o[u+1]]={label:n[o[u+2]],location:r[o[u+3]]},u+=4;break;case op.SOURCE_MAP_LABEL_POP:delete i.labels[o[u+1]],u+=2;break;default:throw new Error("Invalid opcode: "+o[u]+".")}var y,S,F};u<a;)E();return s}(a);return u.push(wrapInSourceNode("function ",d(o.name),o.nameLocation,"() {\n",o.name)),t.trace&&u.push(" var startPos = peg$currPos;"),u.push(c(i.defines())),u.push.apply(u,c(function(n,r){var o=[];return o.push(""),t.trace&&o.push("peg$tracer.trace({",' type: "rule.enter",'," rule: "+n+","," location: peg$computeLocation(startPos, startPos, true)","});",""),t.cache&&(o.push("var key = peg$currPos * "+e.rules.length+" + "+r+";","var cached = peg$resultsCache[key];","","if (cached) {"," peg$currPos = cached.nextPos;",""),t.trace&&o.push("if (cached.result !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+n+","," result: cached.result,"," location: peg$computeLocation(startPos, peg$currPos, true)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+n+","," location: peg$computeLocation(startPos, startPos, true)"," });","}",""),o.push(" return cached.result;","}","")),o}('"'+stringEscape(o.name)+'"',asts$4.indexOfRule(e,o.name)))),u.push.apply(u,c(s)),u.push.apply(u,c(function(e,n){var r=[];return t.cache&&r.push("","peg$resultsCache[key] = { nextPos: peg$currPos, result: "+n+" };"),t.trace&&r.push("","if ("+n+" !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+e+","," result: "+n+","," location: peg$computeLocation(startPos, peg$currPos, true)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+e+","," location: peg$computeLocation(startPos, startPos, true)"," });","}"),r.push("","return "+n+";"),r}('"'+stringEscape(o.name)+'"',i.result()))),u.push("}"),u}(o))),s.push("")})),e.initializer&&(s.push(g(e.initializer)),s.push("")),s.push(" peg$result = peg$startRuleFunction();",""," if (peg$result !== peg$FAILED && peg$currPos === input.length) {"," return peg$result;"," } else {"," if (peg$result !== peg$FAILED && peg$currPos < input.length) {"," peg$fail(peg$endExpectation());"," }",""," throw peg$buildStructuredError("," peg$maxFailExpected,"," peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,"," peg$maxFailPos < input.length"," ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)"," : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)"," );"," }","}"),new SourceNode(null,null,t.grammarSource,s.map((function(e){return e instanceof SourceNode?e:e+"\n"})))}())}var generateJs=generateJS$1,asts$3=asts_1,visitor$8=visitor_1;function removeProxyRules$1(e,t,n){var r=[];e.rules.forEach((function(o,u){var a;"rule"===(a=o).type&&"rule_ref"===a.expression.type&&(function(e,t,r){visitor$8.build({rule_ref:function(o){o.name===t&&(o.name=r,n.info('Proxy rule "'.concat(t,'" replaced by the rule "').concat(r,'"'),o.location,[{message:"This rule will be used",location:asts$3.findRule(e,r).nameLocation}]))}})(e)}(e,o.name,o.expression.name),-1===t.allowedStartRules.indexOf(o.name)&&r.push(u))})),r.reverse(),r.forEach((function(t){e.rules.splice(t,1)}))}var removeProxyRules_1=removeProxyRules$1,__assign=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},__assign.apply(this,arguments)},__spreadArray$1=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,u=t.length;o<u;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},visitor$7=visitor_1;function cloneOver(e,t){var n=e,r=t;Object.keys(n).forEach((function(e){return delete n[e]})),Object.keys(r).forEach((function(e){n[e]=r[e]}))}function cleanParts(e){e.sort((function(e,t){var n=Array.isArray(e)?e:[e,e],r=n[0],o=n[1],u=Array.isArray(t)?t:[t,t],a=u[0],i=u[1];return r!==a?r<a?-1:1:o!==i?o>i?-1:1:0}));for(var t="",n="",r=0;r<e.length;r++){var o=e[r],u=Array.isArray(o)?o:[o,o],a=u[0],i=u[1];i<=n?e.splice(r--,1):n.charCodeAt(0)+1>=a.charCodeAt(0)?(e.splice(r--,1),e[r]=[t,n=i]):(t=a,n=i)}return e}function mergeCharacterClasses$1(e){var t=Object.create(null);e.rules.forEach((function(e){return t[e.name]=e.expression}));var n=Object.create(null),r=[function(e,r){if("class"===e.type&&!e.inverted)return r&&((e=__assign({},e)).parts=__spreadArray$1([],e.parts,!0)),e;if("literal"===e.type&&1===e.value.length)return{type:"class",parts:[e.value],inverted:!1,ignoreCase:e.ignoreCase,location:e.location};if("rule_ref"===e.type){var a=t[e.name];if(a){n[e.name]||(n[e.name]=!0,u(a));var i=o(a,!0);return i&&(i.location=e.location),i}}return null},visitor$7.build({choice:function(e){var t=null,n=!1;e.alternatives.forEach((function(r,a){var i;u(r);var s=o(r);s?t&&t.ignoreCase===s.ignoreCase?((i=t.parts).push.apply(i,s.parts),e.alternatives[a-1]=t,e.alternatives[a]=t,t.location={source:t.location.source,start:t.location.start,end:s.location.end},n=!0):t=s:t=null})),n&&(e.alternatives=e.alternatives.filter((function(e,t,n){return!t||e!==n[t-1]})),e.alternatives.forEach((function(t,n){"class"===t.type&&(t.parts=cleanParts(t.parts),1!==t.parts.length||Array.isArray(t.parts[0])||t.inverted||(e.alternatives[n]={type:"literal",value:t.parts[0],ignoreCase:t.ignoreCase,location:t.location}))})),1===e.alternatives.length&&cloneOver(e,e.alternatives[0]))},text:function(e){if(u(e.expression),"class"===e.expression.type||"literal"===e.expression.type){var t=e.location;cloneOver(e,e.expression),e.location=t}}})],o=r[0],u=r[1];e.rules.forEach((function(e){n[e.name]=!0,u(e.expression)}))}var mergeCharacterClasses_1=mergeCharacterClasses$1,visitor$6=visitor_1;function reportDuplicateLabels$1(e,t,n){function r(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n]})),t}function o(e,t){u(e.expression,r(t))}var u=visitor$6.build({rule:function(e){u(e.expression,{})},choice:function(e,t){e.alternatives.forEach((function(e){u(e,r(t))}))},action:o,labeled:function(e,t){var r=e.label;r&&Object.prototype.hasOwnProperty.call(t,r)&&n.error('Label "'.concat(e.label,'" is already defined'),e.labelLocation,[{message:"Original label location",location:t[r]}]),u(e.expression,t),t[e.label]=e.labelLocation},text:o,simple_and:o,simple_not:o,optional:o,zero_or_more:o,one_or_more:o,repeated:function(e,t){e.delimiter&&u(e.delimiter,r(t)),u(e.expression,r(t))},group:o});u(e)}var reportDuplicateLabels_1=reportDuplicateLabels$1,visitor$5=visitor_1;function reportDuplicateRules$1(e,t,n){var r={};visitor$5.build({rule:function(e){Object.prototype.hasOwnProperty.call(r,e.name)?n.error('Rule "'.concat(e.name,'" is already defined'),e.nameLocation,[{message:"Original rule location",location:r[e.name]}]):r[e.name]=e.nameLocation}})(e)}var reportDuplicateRules_1=reportDuplicateRules$1,asts$2=asts_1,visitor$4=visitor_1;function reportInfiniteRecursion$1(e,t,n){var r=[],o=[],u=visitor$4.build({rule:function(e){r.push(e.name),u(e.expression),r.pop()},sequence:function(t){t.elements.every((function(t){return u(t),!asts$2.alwaysConsumesOnSuccess(e,t)}))},repeated:function(t){u(t.expression),t.delimiter&&!asts$2.alwaysConsumesOnSuccess(e,t.expression)&&u(t.delimiter)},rule_ref:function(t){o.push(t);var a=asts$2.findRule(e,t.name);if(-1!==r.indexOf(t.name))return r.push(t.name),void n.error("Possible infinite loop when parsing (left recursion: "+r.join(" -> ")+")",a.nameLocation,o.map((function(e,t,n){return{message:t+1!==n.length?"Step ".concat(t+1,': call of the rule "').concat(e.name,'" without input consumption'):"Step ".concat(t+1,": call itself without input consumption - left recursion"),location:e.location}})));a&&u(a),o.pop()}});u(e)}var reportInfiniteRecursion_1=reportInfiniteRecursion$1,asts$1=asts_1,visitor$3=visitor_1;function reportInfiniteRepetition$1(e,t,n){var r=visitor$3.build({zero_or_more:function(t){asts$1.alwaysConsumesOnSuccess(e,t.expression)||n.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},one_or_more:function(t){asts$1.alwaysConsumesOnSuccess(e,t.expression)||n.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},repeated:function(t){if(t.delimiter&&r(t.delimiter),!(asts$1.alwaysConsumesOnSuccess(e,t.expression)||t.delimiter&&asts$1.alwaysConsumesOnSuccess(e,t.delimiter)))if(null===t.max.value)n.error("Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",t.location);else{var o=t.min?t.min:t.max;n.warning("constant"===o.type&&"constant"===t.max.type?"An expression may not consume any input and may always match ".concat(t.max.value," times"):"An expression may not consume any input and may always match with a maximum repetition count",t.location)}}});r(e)}var reportInfiniteRepetition_1=reportInfiniteRepetition$1,asts=asts_1,visitor$2=visitor_1;function reportUndefinedRules$1(e,t,n){visitor$2.build({rule_ref:function(t){asts.findRule(e,t.name)||n.error('Rule "'.concat(t.name,'" is not defined'),t.location)}})(e)}var reportUndefinedRules_1=reportUndefinedRules$1,visitor$1=visitor_1;function reportIncorrectPlucking$1(e,t,n){var r=visitor$1.build({action:function(e){r(e.expression,e)},labeled:function(e,t){e.pick&&t&&n.error('"@" cannot be used with an action block',e.labelLocation,[{message:"Action block location",location:t.codeLocation}]),r(e.expression)}});r(e)}var reportIncorrectPlucking_1=reportIncorrectPlucking$1,__spreadArray=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,u=t.length;o<u;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},GrammarError$1=grammarError,Defaults=function(){function e(e){"function"==typeof(e=void 0!==e?e:{}).error&&(this.error=e.error),"function"==typeof e.warning&&(this.warning=e.warning),"function"==typeof e.info&&(this.info=e.info)}return e.prototype.error=function(){},e.prototype.warning=function(){},e.prototype.info=function(){},e}(),Session$1=function(){function e(e){this._callbacks=new Defaults(e),this._firstError=null,this.errors=0,this.problems=[],this.stage=null}return e.prototype.error=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];++this.errors,null===this._firstError&&(this._firstError=new(GrammarError$1.bind.apply(GrammarError$1,__spreadArray([void 0],t,!1))),this._firstError.stage=this.stage,this._firstError.problems=this.problems),this.problems.push(__spreadArray(["error"],t,!0)),(e=this._callbacks).error.apply(e,__spreadArray([this.stage],t,!1))},e.prototype.warning=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.problems.push(__spreadArray(["warning"],t,!0)),(e=this._callbacks).warning.apply(e,__spreadArray([this.stage],t,!1))},e.prototype.info=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.problems.push(__spreadArray(["info"],t,!0)),(e=this._callbacks).info.apply(e,__spreadArray([this.stage],t,!1))},e.prototype.checkErrors=function(){if(0!==this.errors)throw this._firstError},e}(),session=Session$1,generateBytecode=generateBytecode_1,generateJS=generateJs,inferenceMatchResult=inferenceMatchResult_1,removeProxyRules=removeProxyRules_1,mergeCharacterClasses=mergeCharacterClasses_1,reportDuplicateLabels=reportDuplicateLabels_1,reportDuplicateRules=reportDuplicateRules_1,reportInfiniteRecursion=reportInfiniteRecursion_1,reportInfiniteRepetition=reportInfiniteRepetition_1,reportUndefinedRules=reportUndefinedRules_1,reportIncorrectPlucking=reportIncorrectPlucking_1,Session=session,visitor=visitor_1,base64=utils.base64;function processOptions(e,t){var n={};return Object.keys(e).forEach((function(t){n[t]=e[t]})),Object.keys(t).forEach((function(e){Object.prototype.hasOwnProperty.call(n,e)||(n[e]=t[e])})),n}function isSourceMapCapable(e){return"string"==typeof e?e.length>0:e&&"function"==typeof e.offset}var compiler$1={visitor:visitor,passes:{check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRecursion,reportInfiniteRepetition,reportIncorrectPlucking],transform:[removeProxyRules,mergeCharacterClasses,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile:function(ast,passes,options){if(options=void 0!==options?options:{},options=processOptions(options,{allowedStartRules:[ast.rules[0].name],cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");if(0===options.allowedStartRules.length)throw new Error("Must have at least one start rule");var allRules=ast.rules.map((function(e){return e.name}));if(options.allowedStartRules.some((function(e){return"*"===e})))options.allowedStartRules=allRules;else for(var _i=0,_a=options.allowedStartRules;_i<_a.length;_i++){var rule=_a[_i];if(-1===allRules.indexOf(rule))throw new Error('Unknown start rule "'.concat(rule,'"'))}if(("source-and-map"===options.output||"source-with-inline-map"===options.output)&&!isSourceMapCapable(options.grammarSource))throw new Error("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps");var session=new Session(options);switch(Object.keys(passes).forEach((function(e){session.stage=e,session.info("Process stage ".concat(e)),passes[e].forEach((function(t){session.info("Process pass ".concat(e,".").concat(t.name)),t(ast,options,session)})),session.checkErrors()})),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;case"source-with-inline-map":if("undefined"==typeof TextEncoder)throw new Error("TextEncoder is not supported by this platform");var sourceMap=ast.code.toStringWithSourceMap(),encoder=new TextEncoder,b64=base64(encoder.encode(JSON.stringify(sourceMap.map.toJSON())));return sourceMap.code+"//# sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(b64,"\n");case"ast":return ast;default:throw new Error("Invalid output format: "+options.output+".")}}},compiler_1=compiler$1,OPS_TO_PREFIXED_TYPES={$:"text","&":"simple_and","!":"simple_not"},OPS_TO_SUFFIXED_TYPES={"?":"optional","*":"zero_or_more","+":"one_or_more"},OPS_TO_SEMANTIC_PREDICATE_TYPES={"&":"semantic_and","!":"semantic_not"};function peg$subclass(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n}function peg$SyntaxError(e,t,n,r){var o=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(o,peg$SyntaxError.prototype),o.expected=t,o.found=n,o.location=r,o.name="SyntaxError",o}function peg$padEnd(e,t,n){return n=n||" ",e.length>t?e:(t-=e.length,e+(n+=n.repeat(t)).slice(0,t))}function peg$parse(e,t){var n,r={},o=(t=void 0!==t?t:{}).grammarSource,u={Grammar:fn},a=fn,i="{",s="}",c="=",l="/",p="@",f=":",h="|",d=",",g="..",A="(",m=")",E="\n",_="\r\n",v="/*",C="*/",$="//",y="\\",S="i",F='"',b="'",x="[",P="^",D="]",B="-",R="0",O="b",L="f",T="n",M="r",w="t",I="v",N="x",k="u",H=".",U=";",j=/^[!$&]/,G=/^[*-+?]/,V=/^[!&]/,Y=/^[\t\v-\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/,z=/^[\n\r\u2028\u2029]/,W=/^[\r\u2028-\u2029]/,J=/^[A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376-\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E-\u066F\u0671-\u06D3\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4-\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0-\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,Q=/^[$0-9_\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7-\u09C8\u09CB-\u09CD\u09D7\u09E2-\u09E3\u09E6-\u09EF\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B62-\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56\u0C62-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5-\u0CD6\u0CE2-\u0CE3\u0CE6-\u0CEF\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62-\u0D63\u0D66-\u0D6F\u0D82-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18-\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F3F\u0F71-\u0F84\u0F86-\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19D9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u200C-\u200D\u203F-\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099-\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880-\uA881\uA8B4-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C-\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7-\uAAB8\uAABE-\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5-\uAAF6\uABE3-\uABEA\uABEC-\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33-\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F]/,q=/^[\n\r"\\\u2028-\u2029]/,X=/^[\n\r'\\\u2028-\u2029]/,K=/^[\n\r\\-\]\u2028-\u2029]/,Z=/^["'\\]/,ee=/^[0-9ux]/,te=/^[0-9]/,ne=/^[0-9a-f]/i,re=/^[{}]/,oe=un("{",!1),ue=un("}",!1),ae=un("=",!1),ie=un("/",!1),se=un("@",!1),ce=un(":",!1),le=an(["!","$","&"],!1,!1),pe=an([["*","+"],"?"],!1,!1),fe=un("|",!1),he=un(",",!1),de=un("..",!1),ge=un("(",!1),Ae=un(")",!1),me=an(["!","&"],!1,!1),Ee={type:"any"},_e=sn("whitespace"),ve=an(["\t",["\v","\f"]," "," "," ",[" "," "]," "," "," ","\ufeff"],!1,!1),Ce=an(["\n","\r","\u2028","\u2029"],!1,!1),$e=sn("end of line"),ye=un("\n",!1),Se=un("\r\n",!1),Fe=an(["\r",["\u2028","\u2029"]],!1,!1),be=sn("comment"),xe=un("/*",!1),Pe=un("*/",!1),De=un("//",!1),Be=sn("identifier"),Re=an([["A","Z"],"_",["a","z"],"ª","µ","º",["À","Ö"],["Ø","ö"],["ø","ˁ"],["ˆ","ˑ"],["ˠ","ˤ"],"ˬ","ˮ",["Ͱ","ʹ"],["Ͷ","ͷ"],["ͺ","ͽ"],"Ϳ","Ά",["Έ","Ί"],"Ό",["Ύ","Ρ"],["Σ","ϵ"],["Ϸ","ҁ"],["Ҋ","ԯ"],["Ա","Ֆ"],"ՙ",["ա","և"],["א","ת"],["װ","ײ"],["ؠ","ي"],["ٮ","ٯ"],["ٱ","ۓ"],"ە",["ۥ","ۦ"],["ۮ","ۯ"],["ۺ","ۼ"],"ۿ","ܐ",["ܒ","ܯ"],["ݍ","ޥ"],"ޱ",["ߊ","ߪ"],["ߴ","ߵ"],"ߺ",["ࠀ","ࠕ"],"ࠚ","ࠤ","ࠨ",["ࡀ","ࡘ"],["ࢠ","ࢴ"],["ऄ","ह"],"ऽ","ॐ",["क़","ॡ"],["ॱ","ঀ"],["অ","ঌ"],["এ","ঐ"],["ও","ন"],["প","র"],"ল",["শ","হ"],"ঽ","ৎ",["ড়","ঢ়"],["য়","ৡ"],["ৰ","ৱ"],["ਅ","ਊ"],["ਏ","ਐ"],["ਓ","ਨ"],["ਪ","ਰ"],["ਲ","ਲ਼"],["ਵ","ਸ਼"],["ਸ","ਹ"],["ਖ਼","ੜ"],"ਫ਼",["ੲ","ੴ"],["અ","ઍ"],["એ","ઑ"],["ઓ","ન"],["પ","ર"],["લ","ળ"],["વ","હ"],"ઽ","ૐ",["ૠ","ૡ"],"ૹ",["ଅ","ଌ"],["ଏ","ଐ"],["ଓ","ନ"],["ପ","ର"],["ଲ","ଳ"],["ଵ","ହ"],"ଽ",["ଡ଼","ଢ଼"],["ୟ","ୡ"],"ୱ","ஃ",["அ","ஊ"],["எ","ஐ"],["ஒ","க"],["ங","ச"],"ஜ",["ஞ","ட"],["ண","த"],["ந","ப"],["ம","ஹ"],"ௐ",["అ","ఌ"],["ఎ","ఐ"],["ఒ","న"],["ప","హ"],"ఽ",["ౘ","ౚ"],["ౠ","ౡ"],["ಅ","ಌ"],["ಎ","ಐ"],["ಒ","ನ"],["ಪ","ಳ"],["ವ","ಹ"],"ಽ","ೞ",["ೠ","ೡ"],["ೱ","ೲ"],["അ","ഌ"],["എ","ഐ"],["ഒ","ഺ"],"ഽ","ൎ",["ൟ","ൡ"],["ൺ","ൿ"],["අ","ඖ"],["ක","න"],["ඳ","ර"],"ල",["ව","ෆ"],["ก","ะ"],["า","ำ"],["เ","ๆ"],["ກ","ຂ"],"ຄ",["ງ","ຈ"],"ຊ","ຍ",["ດ","ທ"],["ນ","ຟ"],["ມ","ຣ"],"ລ","ວ",["ສ","ຫ"],["ອ","ະ"],["າ","ຳ"],"ຽ",["ເ","ໄ"],"ໆ",["ໜ","ໟ"],"ༀ",["ཀ","ཇ"],["ཉ","ཬ"],["ྈ","ྌ"],["က","ဪ"],"ဿ",["ၐ","ၕ"],["ၚ","ၝ"],"ၡ",["ၥ","ၦ"],["ၮ","ၰ"],["ၵ","ႁ"],"ႎ",["Ⴀ","Ⴥ"],"Ⴧ","Ⴭ",["ა","ჺ"],["ჼ","ቈ"],["ቊ","ቍ"],["ቐ","ቖ"],"ቘ",["ቚ","ቝ"],["በ","ኈ"],["ኊ","ኍ"],["ነ","ኰ"],["ኲ","ኵ"],["ኸ","ኾ"],"ዀ",["ዂ","ዅ"],["ወ","ዖ"],["ዘ","ጐ"],["ጒ","ጕ"],["ጘ","ፚ"],["ᎀ","ᎏ"],["Ꭰ","Ᏽ"],["ᏸ","ᏽ"],["ᐁ","ᙬ"],["ᙯ","ᙿ"],["ᚁ","ᚚ"],["ᚠ","ᛪ"],["ᛮ","ᛸ"],["ᜀ","ᜌ"],["ᜎ","ᜑ"],["ᜠ","ᜱ"],["ᝀ","ᝑ"],["ᝠ","ᝬ"],["ᝮ","ᝰ"],["ក","ឳ"],"ៗ","ៜ",["ᠠ","ᡷ"],["ᢀ","ᢨ"],"ᢪ",["ᢰ","ᣵ"],["ᤀ","ᤞ"],["ᥐ","ᥭ"],["ᥰ","ᥴ"],["ᦀ","ᦫ"],["ᦰ","ᧉ"],["ᨀ","ᨖ"],["ᨠ","ᩔ"],"ᪧ",["ᬅ","ᬳ"],["ᭅ","ᭋ"],["ᮃ","ᮠ"],["ᮮ","ᮯ"],["ᮺ","ᯥ"],["ᰀ","ᰣ"],["ᱍ","ᱏ"],["ᱚ","ᱽ"],["ᳩ","ᳬ"],["ᳮ","ᳱ"],["ᳵ","ᳶ"],["ᴀ","ᶿ"],["Ḁ","ἕ"],["Ἐ","Ἕ"],["ἠ","ὅ"],["Ὀ","Ὅ"],["ὐ","ὗ"],"Ὑ","Ὓ","Ὕ",["Ὗ","ώ"],["ᾀ","ᾴ"],["ᾶ","ᾼ"],"ι",["ῂ","ῄ"],["ῆ","ῌ"],["ῐ","ΐ"],["ῖ","Ί"],["ῠ","Ῥ"],["ῲ","ῴ"],["ῶ","ῼ"],"ⁱ","ⁿ",["ₐ","ₜ"],"ℂ","ℇ",["ℊ","ℓ"],"ℕ",["ℙ","ℝ"],"ℤ","Ω","ℨ",["K","ℭ"],["ℯ","ℹ"],["ℼ","ℿ"],["ⅅ","ⅉ"],"ⅎ",["Ⅰ","ↈ"],["Ⰰ","Ⱞ"],["ⰰ","ⱞ"],["Ⱡ","ⳤ"],["Ⳬ","ⳮ"],["Ⳳ","ⳳ"],["ⴀ","ⴥ"],"ⴧ","ⴭ",["ⴰ","ⵧ"],"ⵯ",["ⶀ","ⶖ"],["ⶠ","ⶦ"],["ⶨ","ⶮ"],["ⶰ","ⶶ"],["ⶸ","ⶾ"],["ⷀ","ⷆ"],["ⷈ","ⷎ"],["ⷐ","ⷖ"],["ⷘ","ⷞ"],"ⸯ",["々","〇"],["〡","〩"],["〱","〵"],["〸","〼"],["ぁ","ゖ"],["ゝ","ゟ"],["ァ","ヺ"],["ー","ヿ"],["ㄅ","ㄭ"],["ㄱ","ㆎ"],["ㆠ","ㆺ"],["ㇰ","ㇿ"],["㐀","䶵"],["一","鿕"],["ꀀ","ꒌ"],["ꓐ","ꓽ"],["ꔀ","ꘌ"],["ꘐ","ꘟ"],["ꘪ","ꘫ"],["Ꙁ","ꙮ"],["ꙿ","ꚝ"],["ꚠ","ꛯ"],["ꜗ","ꜟ"],["Ꜣ","ꞈ"],["Ꞌ","Ɬ"],["Ʞ","ꞷ"],["ꟷ","ꠁ"],["ꠃ","ꠅ"],["ꠇ","ꠊ"],["ꠌ","ꠢ"],["ꡀ","ꡳ"],["ꢂ","ꢳ"],["ꣲ","ꣷ"],"ꣻ","ꣽ",["ꤊ","ꤥ"],["ꤰ","ꥆ"],["ꥠ","ꥼ"],["ꦄ","ꦲ"],"ꧏ",["ꧠ","ꧤ"],["ꧦ","ꧯ"],["ꧺ","ꧾ"],["ꨀ","ꨨ"],["ꩀ","ꩂ"],["ꩄ","ꩋ"],["ꩠ","ꩶ"],"ꩺ",["ꩾ","ꪯ"],"ꪱ",["ꪵ","ꪶ"],["ꪹ","ꪽ"],"ꫀ","ꫂ",["ꫛ","ꫝ"],["ꫠ","ꫪ"],["ꫲ","ꫴ"],["ꬁ","ꬆ"],["ꬉ","ꬎ"],["ꬑ","ꬖ"],["ꬠ","ꬦ"],["ꬨ","ꬮ"],["ꬰ","ꭚ"],["ꭜ","ꭥ"],["ꭰ","ꯢ"],["가","힣"],["ힰ","ퟆ"],["ퟋ","ퟻ"],["豈","舘"],["並","龎"],["ff","st"],["ﬓ","ﬗ"],"יִ",["ײַ","ﬨ"],["שׁ","זּ"],["טּ","לּ"],"מּ",["נּ","סּ"],["ףּ","פּ"],["צּ","ﮱ"],["ﯓ","ﴽ"],["ﵐ","ﶏ"],["ﶒ","ﷇ"],["ﷰ","ﷻ"],["ﹰ","ﹴ"],["ﹶ","ﻼ"],["A","Z"],["a","z"],["ヲ","ᄒ"],["ᅡ","ᅦ"],["ᅧ","ᅬ"],["ᅭ","ᅲ"],["ᅳ","ᅵ"]],!1,!1),Oe=un("\\",!1),Le=an(["$",["0","9"],"_",["̀","ͯ"],["҃","҇"],["֑","ֽ"],"ֿ",["ׁ","ׂ"],["ׄ","ׅ"],"ׇ",["ؐ","ؚ"],["ً","٩"],"ٰ",["ۖ","ۜ"],["۟","ۤ"],["ۧ","ۨ"],["۪","ۭ"],["۰","۹"],"ܑ",["ܰ","݊"],["ަ","ް"],["߀","߉"],["߫","߳"],["ࠖ","࠙"],["ࠛ","ࠣ"],["ࠥ","ࠧ"],["ࠩ","࠭"],["࡙","࡛"],["ࣣ","ः"],["ऺ","़"],["ा","ॏ"],["॑","ॗ"],["ॢ","ॣ"],["०","९"],["ঁ","ঃ"],"়",["া","ৄ"],["ে","ৈ"],["ো","্"],"ৗ",["ৢ","ৣ"],["০","৯"],["ਁ","ਃ"],"਼",["ਾ","ੂ"],["ੇ","ੈ"],["ੋ","੍"],"ੑ",["੦","ੱ"],"ੵ",["ઁ","ઃ"],"઼",["ા","ૅ"],["ે","ૉ"],["ો","્"],["ૢ","ૣ"],["૦","૯"],["ଁ","ଃ"],"଼",["ା","ୄ"],["େ","ୈ"],["ୋ","୍"],["ୖ","ୗ"],["ୢ","ୣ"],["୦","୯"],"ஂ",["ா","ூ"],["ெ","ை"],["ொ","்"],"ௗ",["௦","௯"],["ఀ","ః"],["ా","ౄ"],["ె","ై"],["ొ","్"],["ౕ","ౖ"],["ౢ","ౣ"],["౦","౯"],["ಁ","ಃ"],"಼",["ಾ","ೄ"],["ೆ","ೈ"],["ೊ","್"],["ೕ","ೖ"],["ೢ","ೣ"],["೦","೯"],["ഁ","ഃ"],["ാ","ൄ"],["െ","ൈ"],["ൊ","്"],"ൗ",["ൢ","ൣ"],["൦","൯"],["ං","ඃ"],"්",["ා","ු"],"ූ",["ෘ","ෟ"],["෦","෯"],["ෲ","ෳ"],"ั",["ิ","ฺ"],["็","๎"],["๐","๙"],"ັ",["ິ","ູ"],["ົ","ຼ"],["່","ໍ"],["໐","໙"],["༘","༙"],["༠","༩"],"༵","༷","༹",["༾","༿"],["ཱ","྄"],["྆","྇"],["ྍ","ྗ"],["ྙ","ྼ"],"࿆",["ါ","ှ"],["၀","၉"],["ၖ","ၙ"],["ၞ","ၠ"],["ၢ","ၤ"],["ၧ","ၭ"],["ၱ","ၴ"],["ႂ","ႍ"],["ႏ","ႝ"],["፝","፟"],["ᜒ","᜔"],["ᜲ","᜴"],["ᝒ","ᝓ"],["ᝲ","ᝳ"],["឴","៓"],"៝",["០","៩"],["᠋","᠍"],["᠐","᠙"],"ᢩ",["ᤠ","ᤫ"],["ᤰ","᤻"],["᥆","᥏"],["᧐","᧙"],["ᨗ","ᨛ"],["ᩕ","ᩞ"],["᩠","᩼"],["᩿","᪉"],["᪐","᪙"],["᪰","᪽"],["ᬀ","ᬄ"],["᬴","᭄"],["᭐","᭙"],["᭫","᭳"],["ᮀ","ᮂ"],["ᮡ","ᮭ"],["᮰","᮹"],["᯦","᯳"],["ᰤ","᰷"],["᱀","᱉"],["᱐","᱙"],["᳐","᳒"],["᳔","᳨"],"᳭",["ᳲ","᳴"],["᳸","᳹"],["᷀","᷵"],["᷼","᷿"],["",""],["‿","⁀"],"⁔",["⃐","⃜"],"⃡",["⃥","⃰"],["⳯","⳱"],"⵿",["ⷠ","ⷿ"],["〪","〯"],["゙","゚"],["꘠","꘩"],"꙯",["ꙴ","꙽"],["ꚞ","ꚟ"],["꛰","꛱"],"ꠂ","꠆","ꠋ",["ꠣ","ꠧ"],["ꢀ","ꢁ"],["ꢴ","꣄"],["꣐","꣙"],["꣠","꣱"],["꤀","꤉"],["ꤦ","꤭"],["ꥇ","꥓"],["ꦀ","ꦃ"],["꦳","꧀"],["꧐","꧙"],"ꧥ",["꧰","꧹"],["ꨩ","ꨶ"],"ꩃ",["ꩌ","ꩍ"],["꩐","꩙"],["ꩻ","ꩽ"],"ꪰ",["ꪲ","ꪴ"],["ꪷ","ꪸ"],["ꪾ","꪿"],"꫁",["ꫫ","ꫯ"],["ꫵ","꫶"],["ꯣ","ꯪ"],["꯬","꯭"],["꯰","꯹"],"ﬞ",["︀","️"],["︠","︯"],["︳","︴"],["﹍","﹏"],["0","9"],"_"],!1,!1),Te=sn("literal"),Me=un("i",!1),we=sn("string"),Ie=un('"',!1),Ne=un("'",!1),ke=an(["\n","\r",'"',"\\",["\u2028","\u2029"]],!1,!1),He=an(["\n","\r","'","\\",["\u2028","\u2029"]],!1,!1),Ue=sn("character class"),je=un("[",!1),Ge=un("^",!1),Ve=un("]",!1),Ye=un("-",!1),ze=an(["\n","\r",["\\","]"],["\u2028","\u2029"]],!1,!1),We=un("0",!1),Je=an(['"',"'","\\"],!1,!1),Qe=un("b",!1),qe=un("f",!1),Xe=un("n",!1),Ke=un("r",!1),Ze=un("t",!1),et=un("v",!1),tt=an([["0","9"],"u","x"],!1,!1),nt=un("x",!1),rt=un("u",!1),ot=an([["0","9"]],!1,!1),ut=an([["0","9"],["a","f"]],!1,!0),at=un(".",!1),it=sn("code block"),st=an(["{","}"],!1,!1),ct=un(";",!1),lt=function(e,t,n){return{type:"grammar",topLevelInitializer:e,initializer:t,rules:n,location:rn()}},pt=function(e){return{type:"top_level_initializer",code:e[0],codeLocation:e[1],location:rn()}},ft=function(e){return{type:"initializer",code:e[0],codeLocation:e[1],location:rn()}},ht=function(e,t,n){return{type:"rule",name:e[0],nameLocation:e[1],expression:null!==t?{type:"named",name:t,expression:n,location:rn()}:n,location:rn()}},dt=function(e,t){return t.length>0?{type:"choice",alternatives:[e].concat(t),location:rn()}:e},gt=function(e,t){return null!==t?{type:"action",expression:e,code:t[0],codeLocation:t[1],location:rn()}:e},At=function(e,t){return t.length>0||"labeled"===e.type&&e.pick?{type:"sequence",elements:[e].concat(t),location:rn()}:e},mt=function(e,t,n){return n.type.startsWith("semantic_")&&on('"@" cannot be used on a semantic predicate',e),{type:"labeled",label:null!==t?t[0]:null,labelLocation:null!==t?t[1]:e,pick:!0,expression:n,location:rn()}},Et=function(e,t){return{type:"labeled",label:e[0],labelLocation:e[1],expression:t,location:rn()}},_t=function(){return rn()},vt=function(e){return Wn.indexOf(e[0])>=0&&on("Label can't be a reserved word \"".concat(e[0],'"'),e[1]),e},Ct=function(e,t){return{type:OPS_TO_PREFIXED_TYPES[e],expression:t,location:rn()}},$t=function(e,t){return{type:OPS_TO_SUFFIXED_TYPES[t],expression:e,location:rn()}},yt=function(e,t,n){var r=t[0],o=t[1];return"constant"===o.type&&0===o.value&&on("The maximum count of repetitions of the rule must be > 0",o.location),{type:"repeated",min:r,max:o,expression:e,delimiter:n,location:rn()}},St=function(e,t){return[null!==e?e:{type:"constant",value:0},null!==t?t:{type:"constant",value:null}]},Ft=function(e){return[null,e]},bt=function(e){return{type:"constant",value:e,location:rn()}},xt=function(e){return{type:"variable",value:e[0],location:rn()}},Pt=function(e){return{type:"function",value:e[0],codeLocation:e[1],location:rn()}},Dt=function(e){return"labeled"===e.type||"sequence"===e.type?{type:"group",expression:e,location:rn()}:e},Bt=function(e){return{type:"rule_ref",name:e[0],location:rn()}},Rt=function(e,t){return{type:OPS_TO_SEMANTIC_PREDICATE_TYPES[e],code:t[0],codeLocation:t[1],location:rn()}},Ot=function(e,t){return[e+t.join(""),rn()]},Lt=function(e,t){return{type:"literal",value:e,ignoreCase:null!==t,location:rn()}},Tt=function(e){return e.join("")},Mt=function(e){return e.join("")},wt=function(e,t,n){return{type:"class",parts:t.filter((function(e){return""!==e})),inverted:null!==e,ignoreCase:null!==n,location:rn()}},It=function(t,n){return t.charCodeAt(0)>n.charCodeAt(0)&&on("Invalid character range: "+e.substring(Kt,Xt)+"."),[t,n]},Nt=function(){return""},kt=function(){return"\0"},Ht=function(){return"\b"},Ut=function(){return"\f"},jt=function(){return"\n"},Gt=function(){return"\r"},Vt=function(){return"\t"},Yt=function(){return"\v"},zt=function(e){return String.fromCharCode(parseInt(e,16))},Wt=function(e){return String.fromCharCode(parseInt(e,16))},Jt=function(){return{type:"any",location:rn()}},Qt=function(e){return[e,rn()]},qt=function(e){return parseInt(e,10)},Xt=0,Kt=0,Zt=[{line:1,column:1}],en=0,tn=[],nn=0;if("startRule"in t){if(!(t.startRule in u))throw new Error("Can't start parsing from rule \""+t.startRule+'".');a=u[t.startRule]}function rn(){return ln(Kt,Xt)}function on(e,t){throw function(e,t){return new peg$SyntaxError(e,null,null,t)}(e,t=void 0!==t?t:ln(Kt,Xt))}function un(e,t){return{type:"literal",text:e,ignoreCase:t}}function an(e,t,n){return{type:"class",parts:e,inverted:t,ignoreCase:n}}function sn(e){return{type:"other",description:e}}function cn(t){var n,r=Zt[t];if(r)return r;if(t>=Zt.length)n=Zt.length-1;else for(n=t;!Zt[--n];);for(r={line:(r=Zt[n]).line,column:r.column};n<t;)10===e.charCodeAt(n)?(r.line++,r.column=1):r.column++,n++;return Zt[t]=r,r}function ln(e,t,n){var r=cn(e),u=cn(t),a={source:o,start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:u.line,column:u.column}};return n&&o&&"function"==typeof o.offset&&(a.start=o.offset(a.start),a.end=o.offset(a.end)),a}function pn(e){Xt<en||(Xt>en&&(en=Xt,tn=[]),tn.push(e))}function fn(){var t,n,o,u,a,c;if(t=Xt,Yn(),n=Xt,o=function(){var t,n,o,u;return t=Xt,123===e.charCodeAt(Xt)?(n=i,Xt++):(n=r,0===nn&&pn(oe)),n!==r&&(o=Gn())!==r?(125===e.charCodeAt(Xt)?(u=s,Xt++):(u=r,0===nn&&pn(ue)),u!==r&&zn()!==r?(Kt=t,t=pt(o)):(Xt=t,t=r)):(Xt=t,t=r),t}(),o!==r?(u=Yn(),n=o):(Xt=n,n=r),n===r&&(n=null),o=Xt,u=function(){var e,t;return e=Xt,(t=Gn())!==r&&zn()!==r?(Kt=e,e=ft(t)):(Xt=e,e=r),e}(),u!==r?(a=Yn(),o=u):(Xt=o,o=r),o===r&&(o=null),u=[],a=Xt,(c=hn())!==r?(Yn(),a=c):(Xt=a,a=r),a!==r)for(;a!==r;)u.push(a),a=Xt,(c=hn())!==r?(Yn(),a=c):(Xt=a,a=r);else u=r;return u!==r?(Kt=t,t=lt(n,o,u)):(Xt=t,t=r),t}function hn(){var t,n,o,u,a;return t=Xt,(n=Dn())!==r?(Yn(),o=Xt,(u=On())!==r?(Yn(),o=u):(Xt=o,o=r),o===r&&(o=null),61===e.charCodeAt(Xt)?(u=c,Xt++):(u=r,0===nn&&pn(ae)),u!==r?(Yn(),(a=dn())!==r&&zn()!==r?(Kt=t,t=ht(n,o,a)):(Xt=t,t=r)):(Xt=t,t=r)):(Xt=t,t=r),t}function dn(){var t,n,o,u,a,i;if(t=Xt,(n=gn())!==r){for(o=[],u=Xt,Yn(),47===e.charCodeAt(Xt)?(a=l,Xt++):(a=r,0===nn&&pn(ie)),a!==r?(Yn(),(i=gn())!==r?u=i:(Xt=u,u=r)):(Xt=u,u=r);u!==r;)o.push(u),u=Xt,Yn(),47===e.charCodeAt(Xt)?(a=l,Xt++):(a=r,0===nn&&pn(ie)),a!==r?(Yn(),(i=gn())!==r?u=i:(Xt=u,u=r)):(Xt=u,u=r);Kt=t,t=dt(n,o)}else Xt=t,t=r;return t}function gn(){var e,t,n,o;return e=Xt,t=function(){var e,t,n,o,u;if(e=Xt,(t=An())!==r){for(n=[],o=Xt,Yn(),(u=An())!==r?o=u:(Xt=o,o=r);o!==r;)n.push(o),o=Xt,Yn(),(u=An())!==r?o=u:(Xt=o,o=r);Kt=e,e=At(t,n)}else Xt=e,e=r;return e}(),t!==r?(n=Xt,Yn(),(o=Gn())!==r?n=o:(Xt=n,n=r),n===r&&(n=null),Kt=e,e=gt(t,n)):(Xt=e,e=r),e}function An(){var t,n,o,u;return t=Xt,n=function(){var t,n;return t=Xt,64===e.charCodeAt(Xt)?(n=p,Xt++):(n=r,0===nn&&pn(se)),n!==r&&(Kt=t,n=_t()),t=n}(),n!==r?((o=mn())===r&&(o=null),(u=En())!==r?(Kt=t,t=mt(n,o,u)):(Xt=t,t=r)):(Xt=t,t=r),t===r&&(t=Xt,(n=mn())!==r?(o=Yn(),(u=En())!==r?(Kt=t,t=Et(n,u)):(Xt=t,t=r)):(Xt=t,t=r),t===r&&(t=En())),t}function mn(){var t,n,o;return t=Xt,(n=Dn())!==r?(Yn(),58===e.charCodeAt(Xt)?(o=f,Xt++):(o=r,0===nn&&pn(ce)),o!==r?(Kt=t,t=vt(n)):(Xt=t,t=r)):(Xt=t,t=r),t}function En(){var t,n,o;return t=Xt,n=function(){var t;return t=e.charAt(Xt),j.test(t)?Xt++:(t=r,0===nn&&pn(le)),t}(),n!==r?(Yn(),(o=_n())!==r?(Kt=t,t=Ct(n,o)):(Xt=t,t=r)):(Xt=t,t=r),t===r&&(t=_n()),t}function _n(){var t,n,o;return t=Xt,(n=Cn())!==r?(Yn(),o=function(){var t;return t=e.charAt(Xt),G.test(t)?Xt++:(t=r,0===nn&&pn(pe)),t}(),o!==r?(Kt=t,t=$t(n,o)):(Xt=t,t=r)):(Xt=t,t=r),t===r&&(t=function(){var t,n,o,u,a,i,s;return t=Xt,(n=Cn())!==r?(Yn(),124===e.charCodeAt(Xt)?(o=h,Xt++):(o=r,0===nn&&pn(fe)),o!==r?(Yn(),u=function(){var t,n,o,u;return t=Xt,(n=vn())===r&&(n=null),Yn(),e.substr(Xt,2)===g?(o=g,Xt+=2):(o=r,0===nn&&pn(de)),o!==r?(Yn(),(u=vn())===r&&(u=null),Kt=t,t=St(n,u)):(Xt=t,t=r),t===r&&(t=Xt,(n=vn())!==r&&(Kt=t,n=Ft(n)),t=n),t}(),u!==r?(Yn(),a=Xt,44===e.charCodeAt(Xt)?(i=d,Xt++):(i=r,0===nn&&pn(he)),i!==r?(Yn(),(s=dn())!==r?(Yn(),a=s):(Xt=a,a=r)):(Xt=a,a=r),a===r&&(a=null),124===e.charCodeAt(Xt)?(i=h,Xt++):(i=r,0===nn&&pn(fe)),i!==r?(Kt=t,t=yt(n,u,a)):(Xt=t,t=r)):(Xt=t,t=r)):(Xt=t,t=r)):(Xt=t,t=r),t}(),t===r&&(t=Cn())),t}function vn(){var t,n;return t=Xt,n=function(){var t,n,o,u;if(t=Xt,n=Xt,o=[],(u=Un())!==r)for(;u!==r;)o.push(u),u=Un();else o=r;return(n=o!==r?e.substring(n,Xt):o)!==r&&(Kt=t,n=qt(n)),t=n}(),n!==r&&(Kt=t,n=bt(n)),(t=n)===r&&(t=Xt,(n=Dn())!==r&&(Kt=t,n=xt(n)),(t=n)===r&&(t=Xt,(n=Gn())!==r&&(Kt=t,n=Pt(n)),t=n)),t}function Cn(){var t,n,o,u;return t=function(){var t,n,o;return nn++,t=Xt,(n=On())!==r?(105===e.charCodeAt(Xt)?(o=S,Xt++):(o=r,0===nn&&pn(Me)),o===r&&(o=null),Kt=t,t=Lt(n,o)):(Xt=t,t=r),nn--,t===r&&(n=r,0===nn&&pn(Te)),t}(),t===r&&(t=function(){var t,n,o,u,a,i;if(nn++,t=Xt,91===e.charCodeAt(Xt)?(n=x,Xt++):(n=r,0===nn&&pn(je)),n!==r){for(94===e.charCodeAt(Xt)?(o=P,Xt++):(o=r,0===nn&&pn(Ge)),o===r&&(o=null),u=[],(a=Mn())===r&&(a=wn());a!==r;)u.push(a),(a=Mn())===r&&(a=wn());93===e.charCodeAt(Xt)?(a=D,Xt++):(a=r,0===nn&&pn(Ve)),a!==r?(105===e.charCodeAt(Xt)?(i=S,Xt++):(i=r,0===nn&&pn(Me)),i===r&&(i=null),Kt=t,t=wt(o,u,i)):(Xt=t,t=r)}else Xt=t,t=r;return nn--,t===r&&(n=r,0===nn&&pn(Ue)),t}(),t===r&&(t=function(){var t,n;return t=Xt,46===e.charCodeAt(Xt)?(n=H,Xt++):(n=r,0===nn&&pn(at)),n!==r&&(Kt=t,n=Jt()),t=n}(),t===r&&(t=function(){var t,n,o,u,a,i,s;return t=Xt,(n=Dn())!==r?(o=Xt,u=Xt,a=Yn(),i=Xt,(s=On())!==r?i=s=[s,Yn()]:(Xt=i,i=r),i===r&&(i=null),61===e.charCodeAt(Xt)?(s=c,Xt++):(s=r,0===nn&&pn(ae)),s!==r?u=a=[a,i,s]:(Xt=u,u=r),u===r?o=void 0:(Xt=o,o=r),o!==r?(Kt=t,t=Bt(n)):(Xt=t,t=r)):(Xt=t,t=r),t}(),t===r&&(t=function(){var t,n,o;return t=Xt,n=function(){var t;return t=e.charAt(Xt),V.test(t)?Xt++:(t=r,0===nn&&pn(me)),t}(),n!==r?(Yn(),(o=Gn())!==r?(Kt=t,t=Rt(n,o)):(Xt=t,t=r)):(Xt=t,t=r),t}(),t===r&&(t=Xt,40===e.charCodeAt(Xt)?(n=A,Xt++):(n=r,0===nn&&pn(ge)),n!==r?(Yn(),(o=dn())!==r?(Yn(),41===e.charCodeAt(Xt)?(u=m,Xt++):(u=r,0===nn&&pn(Ae)),u!==r?(Kt=t,t=Dt(o)):(Xt=t,t=r)):(Xt=t,t=r)):(Xt=t,t=r)))))),t}function $n(){var t;return e.length>Xt?(t=e.charAt(Xt),Xt++):(t=r,0===nn&&pn(Ee)),t}function yn(){var t;return nn++,t=e.charAt(Xt),Y.test(t)?Xt++:(t=r,0===nn&&pn(ve)),nn--,t===r&&0===nn&&pn(_e),t}function Sn(){var t;return t=e.charAt(Xt),z.test(t)?Xt++:(t=r,0===nn&&pn(Ce)),t}function Fn(){var t;return nn++,10===e.charCodeAt(Xt)?(t=E,Xt++):(t=r,0===nn&&pn(ye)),t===r&&(e.substr(Xt,2)===_?(t=_,Xt+=2):(t=r,0===nn&&pn(Se)),t===r&&(t=e.charAt(Xt),W.test(t)?Xt++:(t=r,0===nn&&pn(Fe)))),nn--,t===r&&0===nn&&pn($e),t}function bn(){var t;return nn++,(t=function(){var t,n,o,u,a,i;if(t=Xt,e.substr(Xt,2)===v?(n=v,Xt+=2):(n=r,0===nn&&pn(xe)),n!==r){for(o=[],u=Xt,a=Xt,e.substr(Xt,2)===C?(i=C,Xt+=2):(i=r,0===nn&&pn(Pe)),i===r?a=void 0:(Xt=a,a=r),a!==r&&(i=$n())!==r?u=a=[a,i]:(Xt=u,u=r);u!==r;)o.push(u),u=Xt,a=Xt,e.substr(Xt,2)===C?(i=C,Xt+=2):(i=r,0===nn&&pn(Pe)),i===r?a=void 0:(Xt=a,a=r),a!==r&&(i=$n())!==r?u=a=[a,i]:(Xt=u,u=r);e.substr(Xt,2)===C?(u=C,Xt+=2):(u=r,0===nn&&pn(Pe)),u!==r?t=n=[n,o,u]:(Xt=t,t=r)}else Xt=t,t=r;return t}())===r&&(t=Pn()),nn--,t===r&&0===nn&&pn(be),t}function xn(){var t,n,o,u,a,i;if(t=Xt,e.substr(Xt,2)===v?(n=v,Xt+=2):(n=r,0===nn&&pn(xe)),n!==r){for(o=[],u=Xt,a=Xt,e.substr(Xt,2)===C?(i=C,Xt+=2):(i=r,0===nn&&pn(Pe)),i===r&&(i=Sn()),i===r?a=void 0:(Xt=a,a=r),a!==r&&(i=$n())!==r?u=a=[a,i]:(Xt=u,u=r);u!==r;)o.push(u),u=Xt,a=Xt,e.substr(Xt,2)===C?(i=C,Xt+=2):(i=r,0===nn&&pn(Pe)),i===r&&(i=Sn()),i===r?a=void 0:(Xt=a,a=r),a!==r&&(i=$n())!==r?u=a=[a,i]:(Xt=u,u=r);e.substr(Xt,2)===C?(u=C,Xt+=2):(u=r,0===nn&&pn(Pe)),u!==r?t=n=[n,o,u]:(Xt=t,t=r)}else Xt=t,t=r;return t}function Pn(){var t,n,o,u,a,i;if(t=Xt,e.substr(Xt,2)===$?(n=$,Xt+=2):(n=r,0===nn&&pn(De)),n!==r){for(o=[],u=Xt,a=Xt,(i=Sn())===r?a=void 0:(Xt=a,a=r),a!==r&&(i=$n())!==r?u=a=[a,i]:(Xt=u,u=r);u!==r;)o.push(u),u=Xt,a=Xt,(i=Sn())===r?a=void 0:(Xt=a,a=r),a!==r&&(i=$n())!==r?u=a=[a,i]:(Xt=u,u=r);t=n=[n,o]}else Xt=t,t=r;return t}function Dn(){var e,t,n,o;if(nn++,e=Xt,(t=Bn())!==r){for(n=[],o=Rn();o!==r;)n.push(o),o=Rn();Kt=e,e=Ot(t,n)}else Xt=e,e=r;return nn--,e===r&&(t=r,0===nn&&pn(Be)),e}function Bn(){var t,n,o;return t=e.charAt(Xt),J.test(t)?Xt++:(t=r,0===nn&&pn(Re)),t===r&&(t=Xt,92===e.charCodeAt(Xt)?(n=y,Xt++):(n=r,0===nn&&pn(Oe)),n!==r&&(o=Hn())!==r?t=o:(Xt=t,t=r)),t}function Rn(){var t;return(t=Bn())===r&&(t=e.charAt(Xt),Q.test(t)?Xt++:(t=r,0===nn&&pn(Le))),t}function On(){var t,n,o,u;if(nn++,t=Xt,34===e.charCodeAt(Xt)?(n=F,Xt++):(n=r,0===nn&&pn(Ie)),n!==r){for(o=[],u=Ln();u!==r;)o.push(u),u=Ln();34===e.charCodeAt(Xt)?(u=F,Xt++):(u=r,0===nn&&pn(Ie)),u!==r?(Kt=t,t=Tt(o)):(Xt=t,t=r)}else Xt=t,t=r;if(t===r)if(t=Xt,39===e.charCodeAt(Xt)?(n=b,Xt++):(n=r,0===nn&&pn(Ne)),n!==r){for(o=[],u=Tn();u!==r;)o.push(u),u=Tn();39===e.charCodeAt(Xt)?(u=b,Xt++):(u=r,0===nn&&pn(Ne)),u!==r?(Kt=t,t=Mt(o)):(Xt=t,t=r)}else Xt=t,t=r;return nn--,t===r&&(n=r,0===nn&&pn(we)),t}function Ln(){var t,n,o,u;return t=Xt,n=Xt,o=Xt,u=e.charAt(Xt),q.test(u)?Xt++:(u=r,0===nn&&pn(ke)),u===r?o=void 0:(Xt=o,o=r),o!==r&&(u=$n())!==r?n=o=[o,u]:(Xt=n,n=r),(t=n!==r?e.substring(t,Xt):n)===r&&(t=Xt,92===e.charCodeAt(Xt)?(n=y,Xt++):(n=r,0===nn&&pn(Oe)),n!==r&&(o=Nn())!==r?t=o:(Xt=t,t=r),t===r&&(t=In())),t}function Tn(){var t,n,o,u;return t=Xt,n=Xt,o=Xt,u=e.charAt(Xt),X.test(u)?Xt++:(u=r,0===nn&&pn(He)),u===r?o=void 0:(Xt=o,o=r),o!==r&&(u=$n())!==r?n=o=[o,u]:(Xt=n,n=r),(t=n!==r?e.substring(t,Xt):n)===r&&(t=Xt,92===e.charCodeAt(Xt)?(n=y,Xt++):(n=r,0===nn&&pn(Oe)),n!==r&&(o=Nn())!==r?t=o:(Xt=t,t=r),t===r&&(t=In())),t}function Mn(){var t,n,o,u;return t=Xt,(n=wn())!==r?(45===e.charCodeAt(Xt)?(o=B,Xt++):(o=r,0===nn&&pn(Ye)),o!==r&&(u=wn())!==r?(Kt=t,t=It(n,u)):(Xt=t,t=r)):(Xt=t,t=r),t}function wn(){var t,n,o,u;return t=Xt,n=Xt,o=Xt,u=e.charAt(Xt),K.test(u)?Xt++:(u=r,0===nn&&pn(ze)),u===r?o=void 0:(Xt=o,o=r),o!==r&&(u=$n())!==r?n=o=[o,u]:(Xt=n,n=r),(t=n!==r?e.substring(t,Xt):n)===r&&(t=Xt,92===e.charCodeAt(Xt)?(n=y,Xt++):(n=r,0===nn&&pn(Oe)),n!==r&&(o=Nn())!==r?t=o:(Xt=t,t=r),t===r&&(t=In())),t}function In(){var t,n;return t=Xt,92===e.charCodeAt(Xt)?(n=y,Xt++):(n=r,0===nn&&pn(Oe)),n!==r&&Fn()!==r?(Kt=t,t=Nt()):(Xt=t,t=r),t}function Nn(){var t,n,o;return t=function(){var t;return(t=kn())===r&&(t=function(){var t,n,o,u;return t=Xt,n=Xt,o=Xt,u=function(){var t;return(t=kn())===r&&(t=e.charAt(Xt),ee.test(t)?Xt++:(t=r,0===nn&&pn(tt))),t}(),u===r&&(u=Sn()),u===r?o=void 0:(Xt=o,o=r),o!==r&&(u=$n())!==r?n=o=[o,u]:(Xt=n,n=r),t=n!==r?e.substring(t,Xt):n}()),t}(),t===r&&(t=Xt,48===e.charCodeAt(Xt)?(n=R,Xt++):(n=r,0===nn&&pn(We)),n!==r?(o=Xt,Un()===r?o=void 0:(Xt=o,o=r),o!==r?(Kt=t,t=kt()):(Xt=t,t=r)):(Xt=t,t=r),t===r&&(t=function(){var t,n,o,u,a,i;return t=Xt,120===e.charCodeAt(Xt)?(n=N,Xt++):(n=r,0===nn&&pn(nt)),n!==r?(o=Xt,u=Xt,(a=jn())!==r&&(i=jn())!==r?u=a=[a,i]:(Xt=u,u=r),(o=u!==r?e.substring(o,Xt):u)!==r?(Kt=t,t=zt(o)):(Xt=t,t=r)):(Xt=t,t=r),t}(),t===r&&(t=Hn()))),t}function kn(){var t,n;return t=e.charAt(Xt),Z.test(t)?Xt++:(t=r,0===nn&&pn(Je)),t===r&&(t=Xt,98===e.charCodeAt(Xt)?(n=O,Xt++):(n=r,0===nn&&pn(Qe)),n!==r&&(Kt=t,n=Ht()),(t=n)===r&&(t=Xt,102===e.charCodeAt(Xt)?(n=L,Xt++):(n=r,0===nn&&pn(qe)),n!==r&&(Kt=t,n=Ut()),(t=n)===r&&(t=Xt,110===e.charCodeAt(Xt)?(n=T,Xt++):(n=r,0===nn&&pn(Xe)),n!==r&&(Kt=t,n=jt()),(t=n)===r&&(t=Xt,114===e.charCodeAt(Xt)?(n=M,Xt++):(n=r,0===nn&&pn(Ke)),n!==r&&(Kt=t,n=Gt()),(t=n)===r&&(t=Xt,116===e.charCodeAt(Xt)?(n=w,Xt++):(n=r,0===nn&&pn(Ze)),n!==r&&(Kt=t,n=Vt()),(t=n)===r&&(t=Xt,118===e.charCodeAt(Xt)?(n=I,Xt++):(n=r,0===nn&&pn(et)),n!==r&&(Kt=t,n=Yt()),t=n)))))),t}function Hn(){var t,n,o,u,a,i,s,c;return t=Xt,117===e.charCodeAt(Xt)?(n=k,Xt++):(n=r,0===nn&&pn(rt)),n!==r?(o=Xt,u=Xt,(a=jn())!==r&&(i=jn())!==r&&(s=jn())!==r&&(c=jn())!==r?u=a=[a,i,s,c]:(Xt=u,u=r),(o=u!==r?e.substring(o,Xt):u)!==r?(Kt=t,t=Wt(o)):(Xt=t,t=r)):(Xt=t,t=r),t}function Un(){var t;return t=e.charAt(Xt),te.test(t)?Xt++:(t=r,0===nn&&pn(ot)),t}function jn(){var t;return t=e.charAt(Xt),ne.test(t)?Xt++:(t=r,0===nn&&pn(ut)),t}function Gn(){var t,n,o,u;return nn++,t=Xt,123===e.charCodeAt(Xt)?(n=i,Xt++):(n=r,0===nn&&pn(oe)),n!==r?(o=function(){var e,t;return e=Xt,t=Vn(),Kt=e,e=t=Qt(t)}(),125===e.charCodeAt(Xt)?(u=s,Xt++):(u=r,0===nn&&pn(ue)),u!==r?t=o:(Xt=t,t=r)):(Xt=t,t=r),nn--,t===r&&(n=r,0===nn&&pn(it)),t}function Vn(){var t,n,o,u,a,c;if(t=Xt,n=[],o=[],u=Xt,a=Xt,c=e.charAt(Xt),re.test(c)?Xt++:(c=r,0===nn&&pn(st)),c===r?a=void 0:(Xt=a,a=r),a!==r&&(c=$n())!==r?u=a=[a,c]:(Xt=u,u=r),u!==r)for(;u!==r;)o.push(u),u=Xt,a=Xt,c=e.charAt(Xt),re.test(c)?Xt++:(c=r,0===nn&&pn(st)),c===r?a=void 0:(Xt=a,a=r),a!==r&&(c=$n())!==r?u=a=[a,c]:(Xt=u,u=r);else o=r;for(o===r&&(o=Xt,123===e.charCodeAt(Xt)?(u=i,Xt++):(u=r,0===nn&&pn(oe)),u!==r?(a=Vn(),125===e.charCodeAt(Xt)?(c=s,Xt++):(c=r,0===nn&&pn(ue)),c!==r?o=u=[u,a,c]:(Xt=o,o=r)):(Xt=o,o=r));o!==r;){if(n.push(o),o=[],u=Xt,a=Xt,c=e.charAt(Xt),re.test(c)?Xt++:(c=r,0===nn&&pn(st)),c===r?a=void 0:(Xt=a,a=r),a!==r&&(c=$n())!==r?u=a=[a,c]:(Xt=u,u=r),u!==r)for(;u!==r;)o.push(u),u=Xt,a=Xt,c=e.charAt(Xt),re.test(c)?Xt++:(c=r,0===nn&&pn(st)),c===r?a=void 0:(Xt=a,a=r),a!==r&&(c=$n())!==r?u=a=[a,c]:(Xt=u,u=r);else o=r;o===r&&(o=Xt,123===e.charCodeAt(Xt)?(u=i,Xt++):(u=r,0===nn&&pn(oe)),u!==r?(a=Vn(),125===e.charCodeAt(Xt)?(c=s,Xt++):(c=r,0===nn&&pn(ue)),c!==r?o=u=[u,a,c]:(Xt=o,o=r)):(Xt=o,o=r))}return e.substring(t,Xt)}function Yn(){var e,t;for(e=[],(t=yn())===r&&(t=Fn())===r&&(t=bn());t!==r;)e.push(t),(t=yn())===r&&(t=Fn())===r&&(t=bn());return e}function zn(){var t,n,o,u;if(t=[],n=Xt,o=Yn(),59===e.charCodeAt(Xt)?(u=U,Xt++):(u=r,0===nn&&pn(ct)),u!==r?n=o=[o,u]:(Xt=n,n=r),n!==r)for(;n!==r;)t.push(n),n=Xt,o=Yn(),59===e.charCodeAt(Xt)?(u=U,Xt++):(u=r,0===nn&&pn(ct)),u!==r?n=o=[o,u]:(Xt=n,n=r);else t=r;return t===r&&(t=Xt,n=function(){var e,t;for(e=[],(t=yn())===r&&(t=xn());t!==r;)e.push(t),(t=yn())===r&&(t=xn());return e}(),(o=Pn())===r&&(o=null),(u=Fn())!==r?t=n=[n,o,u]:(Xt=t,t=r),t===r&&(t=Xt,n=Yn(),o=function(){var t,n;return t=Xt,e.length>Xt?(n=e.charAt(Xt),Xt++):(n=r,0===nn&&pn(Ee)),n===r?t=void 0:(Xt=t,t=r),t}(),o!==r?t=n=[n,o]:(Xt=t,t=r))),t}var Wn=t.reservedWords||[];if((n=a())!==r&&Xt===e.length)return n;throw n!==r&&Xt<e.length&&pn({type:"end"}),function(e,t,n){return new peg$SyntaxError(peg$SyntaxError.buildMessage(e,t),e,t,n)}(tn,en<e.length?e.charAt(en):null,en<e.length?ln(en,en+1):ln(en,en))}peg$subclass(peg$SyntaxError,Error),peg$SyntaxError.prototype.format=function(e){var t="Error: "+this.message;if(this.location){var n,r=null;for(n=0;n<e.length;n++)if(e[n].source===this.location.source){r=e[n].text.split(/\r\n|\n|\r/g);break}var o=this.location.start,u=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(o):o,a=this.location.source+":"+u.line+":"+u.column;if(r){var i=this.location.end,s=peg$padEnd("",u.line.toString().length," "),c=r[o.line-1],l=(o.line===i.line?i.column:c.length+1)-o.column||1;t+="\n --\x3e "+a+"\n"+s+" |\n"+u.line+" | "+c+"\n"+s+" | "+peg$padEnd("",o.column-1," ")+peg$padEnd("",l,"^")}else t+="\n at "+a}return t},peg$SyntaxError.buildMessage=function(e,t){var n={literal:function(e){return'"'+o(e.text)+'"'},class:function(e){var t=e.parts.map((function(e){return Array.isArray(e)?u(e[0])+"-"+u(e[1]):u(e)}));return"["+(e.inverted?"^":"")+t.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(e){return e.description}};function r(e){return e.charCodeAt(0).toString(16).toUpperCase()}function o(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+r(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+r(e)}))}function u(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+r(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+r(e)}))}function a(e){return n[e.type](e)}return"Expected "+function(e){var t,n,r=e.map(a);if(r.sort(),r.length>0){for(t=1,n=1;t<r.length;t++)r[t-1]!==r[t]&&(r[n]=r[t],n++);r.length=n}switch(r.length){case 1:return r[0];case 2:return r[0]+" or "+r[1];default:return r.slice(0,-1).join(", ")+", or "+r[r.length-1]}}(e)+" but "+function(e){return e?'"'+o(e)+'"':"end of input"}(t)+" found."};var parser$1={SyntaxError:peg$SyntaxError,parse:peg$parse},GrammarError=grammarError,GrammarLocation=grammarLocation,compiler=compiler_1,parser=parser$1,VERSION=version,RESERVED_WORDS=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","null","true","false","enum","implements","interface","let","package","private","protected","public","static","yield","await","arguments","eval"],peg$1={VERSION:VERSION,RESERVED_WORDS:RESERVED_WORDS,GrammarError:GrammarError,GrammarLocation:GrammarLocation,parser:parser,compiler:compiler,generate:function(e,t){var n,r,o="plugins"in(t=void 0!==t?t:{})?t.plugins:[],u={parser:peg$1.parser,passes:(n=peg$1.compiler.passes,r={},Object.keys(n).forEach((function(e){r[e]=n[e].slice()})),r),reservedWords:peg$1.RESERVED_WORDS.slice()};return o.forEach((function(e){e.use(u,t)})),peg$1.compiler.compile(u.parser.parse(e,{grammarSource:t.grammarSource,reservedWords:u.reservedWords}),u.passes,t)}},peg_1=peg$1,peg=peg_1,Runner$1={run:function(e,t,n,r){var o={functions:[],add:function(e){this.functions.push(e)},run:function(){this.functions.length>0&&(this.functions.shift()(),setTimeout((function(){o.run()}),0))}},u={};o.add((function(){r.start(),u.totalInputSize=0,u.totalParseTime=0})),e.forEach((function(e){o.add(function(e){return function(){r.benchmarkStart(e),u.parser=peg.generate(r.readFile("../examples/"+e.id+".pegjs"),n),u.benchmarkInputSize=0,u.benchmarkParseTime=0}}(e)),e.tests.forEach((function(n){o.add(function(e,n){return function(){r.testStart(e,n);for(var o=r.readFile(e.id+"/"+n.file),a=0,i=0;i<t;i++){var s=(new Date).getTime();u.parser.parse(o),a+=(new Date).getTime()-s}var c=a/t;r.testFinish(e,n,o.length,c),u.benchmarkInputSize+=o.length,u.benchmarkParseTime+=c}}(e,n))})),o.add(function(e){return function(){r.benchmarkFinish(e,u.benchmarkInputSize,u.benchmarkParseTime),u.totalInputSize+=u.benchmarkInputSize,u.totalParseTime+=u.benchmarkParseTime}}(e))})),o.add((function(){r.finish(u.totalInputSize,u.totalParseTime)})),o.run()}},runner=Runner$1,benchmarks$1=[{id:"json",title:"JSON",tests:[{file:"example1.json",title:"Example 1"},{file:"example2.json",title:"Example 2"},{file:"example3.json",title:"Example 3"},{file:"example4.json",title:"Example 4"},{file:"example5.json",title:"Example 5"}]},{id:"css",title:"CSS",tests:[{file:"blueprint/src/reset.css",title:"Blueprint - reset.css (source)"},{file:"blueprint/src/typography.css",title:"Blueprint - typography.css (source)"},{file:"blueprint/src/forms.css",title:"Blueprint - forms.css (source)"},{file:"blueprint/src/grid.css",title:"Blueprint - grid.css (source)"},{file:"blueprint/src/print.css",title:"Blueprint - print.css (source)"},{file:"blueprint/min/screen.css",title:"Blueprint - screen.css (minified)"},{file:"blueprint/min/print.css",title:"Blueprint - print.css (minified)"},{file:"960.gs/src/reset.css",title:"960.gs - reset.css (source)"},{file:"960.gs/src/text.css",title:"960.gs - text.css (source)"},{file:"960.gs/src/960.css",title:"960.gs - 960.css (source)"},{file:"960.gs/src/960_24_col.css",title:"960.gs - 960_24_col.css (source)"},{file:"960.gs/min/reset.css",title:"960.gs - reset.css (minified)"},{file:"960.gs/min/text.css",title:"960.gs - text.css (minified)"},{file:"960.gs/min/960.css",title:"960.gs - 960.css (minified)"},{file:"960.gs/min/960_24_col.css",title:"960.gs - 960_24_col.css (minified)"}]}],benchmarks_1=benchmarks$1,Runner=runner,benchmarks=benchmarks_1,BRANCH=location.hash.match(/branch=([^&]*)/i);return BRANCH=BRANCH?BRANCH[1]:"main",$("#run").click((function(){var e=$("#results-table");function t(t,n,r,o,u){e.append("\n <tr class='".concat(t,"'>\n <td class='title'>\n ").concat(null!==r?"<a href='"+r+"'>":"","\n ").concat(n,"\n ").concat(null!==r?"</a>":"","\n </td>\n <td class='input-size'>\n <span class='value'>\n ").concat((o/1024).toFixed(2),"\n </span>\n <span class='unit'>kB</span>\n </td>\n <td class='parse-time'>\n <span class='value'>\n ").concat(u.toFixed(2),"\n </span>\n <span class='unit'>ms</span>\n </td>\n <td class='parse-speed'>\n <span class='value'>\n ").concat((o/1024/(u/1e3)).toFixed(2),"\n </span>\n <span class='unit'>kB/s</span>\n </td>\n </tr>\n "))}var n=parseInt($("#run-count").val(),10),r={cache:$("#cache").is(":checked")};isNaN(n)||n<=0?alert("Number of runs must be a positive integer."):Runner.run(benchmarks,n,r,{readFile:function(e){return $.ajax({type:"GET",url:"https://raw.githubusercontent.com/peggyjs/peggy/".concat(BRANCH,"/benchmark/").concat(e),dataType:"text",async:!1}).responseText},testStart:function(){},testFinish:function(e,n,r,o){t("individual",n.title,"https://github.com/peggyjs/peggy/blob/".concat(BRANCH,"/benchmark/").concat(e.id,"/").concat(n.file),r,o)},benchmarkStart:function(t){e.append("\n <tr class='heading'>\n <th colspan='4'>\n <a href='https://github.com/pegjs/pegjs/blob/".concat(BRANCH,"/examples/").concat(t.id,".pegjs'> ").concat(t.title,' </a>\n </th>\n </tr>"\n '))},benchmarkFinish:function(e,n,r){t("benchmark-total",e.title+" total",null,n,r)},start:function(){$("#run-count, #cache, #run").attr("disabled","disabled"),e.show(),$("#results-table tr").slice(1).remove()},finish:function(e,n){t("total","Total",null,e,n),$.scrollTo("max",{axis:"y",duration:500}),$("#run-count, #cache, #run").removeAttr("disabled")}})})),$(document).ready((function(){return $("#run").focus()})),browser_stub})); \ No newline at end of file diff --git a/docs/js/examples.js b/docs/js/examples.js index 1ad9f50c..cb12c482 100644 --- a/docs/js/examples.js +++ b/docs/js/examples.js @@ -833,7 +833,6 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { s2 = peg$currPos; - peg$silentFails++; if (input.charCodeAt(peg$currPos) === 98) { s3 = peg$c4; peg$currPos++; @@ -841,7 +840,6 @@ function peg$parse(input, options) { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e9); } } - peg$silentFails--; if (s3 !== peg$FAILED) { peg$currPos = s2; s2 = undefined; @@ -877,7 +875,6 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { s2 = peg$currPos; - peg$silentFails++; if (input.charCodeAt(peg$currPos) === 98) { s3 = peg$c4; peg$currPos++; @@ -885,7 +882,6 @@ function peg$parse(input, options) { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e9); } } - peg$silentFails--; if (s3 === peg$FAILED) { s2 = undefined; } else { diff --git a/docs/js/test-bundle.min.js b/docs/js/test-bundle.min.js index abb47bdc..bfc1ad38 100644 --- a/docs/js/test-bundle.min.js +++ b/docs/js/test-bundle.min.js @@ -5,4 +5,4 @@ // Copyright (c) 2023- the Peggy authors // Licensed under the MIT License. -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("chai"),require("whatwg-url")):"function"==typeof define&&define.amd?define(["exports","chai","whatwg-url"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).browser={},e.chai,e.whatwgURL)}(this,(function(exports,require$$0,require$$0$1){var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},GrammarLocation$5=function(){function e(e,t){this.source=e,this.start=t}return e.prototype.toString=function(){return String(this.source)},e.prototype.offset=function(e){return{line:e.line+this.start.line-1,column:1===e.line?e.column+this.start.column-1:e.column,offset:e.offset+this.start.offset}},e.offsetStart=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.start):e.start},e.offsetEnd=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.end):e.end},e}(),grammarLocation=GrammarLocation$5,__extends=commonjsGlobal&&commonjsGlobal.__extends||(extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},extendStatics(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),extendStatics,GrammarLocation$4=grammarLocation,setProtoOf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},GrammarError$5=function(e){function t(r,a,n){var o=e.call(this,r)||this;return setProtoOf(o,t.prototype),o.name="GrammarError",o.location=a,void 0===n&&(n=[]),o.diagnostics=n,o.stage=null,o.problems=[["error",r,a,n]],o}return __extends(t,e),t.prototype.toString=function(){var t=e.prototype.toString.call(this);this.location&&(t+="\n at ",void 0!==this.location.source&&null!==this.location.source&&(t+="".concat(this.location.source,":")),t+="".concat(this.location.start.line,":").concat(this.location.start.column));for(var r=0,a=this.diagnostics;r<a.length;r++){var n=a[r];t+="\n from ",void 0!==n.location.source&&null!==n.location.source&&(t+="".concat(n.location.source,":")),t+="".concat(n.location.start.line,":").concat(n.location.start.column,": ").concat(n.message)}return t},t.prototype.format=function(e){var t=e.map((function(e){var t=e.source,r=e.text;return{source:t,text:null!=r?String(r).split(/\r\n|\n|\r/g):[]}}));function r(e,r,a){void 0===a&&(a="");var n="",o=t.find((function(t){return t.source===e.source})),s=e.start,c=GrammarLocation$4.offsetStart(e);if(o){var i=e.end,u=o.text[s.line-1],p=(s.line===i.line?i.column:u.length+1)-s.column||1;a&&(n+="\nnote: ".concat(a)),n+="\n --\x3e ".concat(e.source,":").concat(c.line,":").concat(c.column,"\n").concat("".padEnd(r)," |\n").concat(c.line.toString().padStart(r)," | ").concat(u,"\n").concat("".padEnd(r)," | ").concat("".padEnd(s.column-1)).concat("".padEnd(p,"^"))}else n+="\n at ".concat(e.source,":").concat(c.line,":").concat(c.column),a&&(n+=": ".concat(a));return n}function a(e,t,a,n){void 0===n&&(n=[]);var o=-1/0;o=a?n.reduce((function(e,t){var r=t.location;return Math.max(e,GrammarLocation$4.offsetStart(r).line)}),a.start.line):Math.max.apply(null,n.map((function(e){return e.location.start.line}))),o=o.toString().length;var s="".concat(e,": ").concat(t);a&&(s+=r(a,o));for(var c=0,i=n;c<i.length;c++){var u=i[c];s+=r(u.location,o,u.message)}return s}return this.problems.filter((function(e){return"info"!==e[0]})).map((function(e){return a.apply(void 0,e)})).join("\n\n")},t}(Error),grammarError=GrammarError$5,__spreadArray$6=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n<o;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},visitor$c={build:function(e){function t(t){for(var r=[],a=1;a<arguments.length;a++)r[a-1]=arguments[a];return e[t.type].apply(e,__spreadArray$6([t],r,!1))}function r(){}function a(e){for(var r=[],a=1;a<arguments.length;a++)r[a-1]=arguments[a];return t.apply(void 0,__spreadArray$6([e.expression],r,!1))}function n(e){return function(r){for(var a=[],n=1;n<arguments.length;n++)a[n-1]=arguments[n];r[e].forEach((function(e){return t.apply(void 0,__spreadArray$6([e],a,!1))}))}}var o={grammar:function(e){for(var r=[],a=1;a<arguments.length;a++)r[a-1]=arguments[a];e.topLevelInitializer&&t.apply(void 0,__spreadArray$6([e.topLevelInitializer],r,!1)),e.initializer&&t.apply(void 0,__spreadArray$6([e.initializer],r,!1)),e.rules.forEach((function(e){return t.apply(void 0,__spreadArray$6([e],r,!1))}))},top_level_initializer:r,initializer:r,rule:a,named:a,choice:n("alternatives"),action:a,sequence:n("elements"),labeled:a,text:a,simple_and:a,simple_not:a,optional:a,zero_or_more:a,one_or_more:a,repeated:function(e){for(var r=[],a=1;a<arguments.length;a++)r[a-1]=arguments[a];return e.delimiter&&t.apply(void 0,__spreadArray$6([e.delimiter],r,!1)),t.apply(void 0,__spreadArray$6([e.expression],r,!1))},group:a,semantic_and:r,semantic_not:r,rule_ref:r,literal:r,class:r,any:r};return Object.keys(o).forEach((function(t){Object.prototype.hasOwnProperty.call(e,t)||(e[t]=o[t])})),t}},visitor_1=visitor$c,visitor$b=visitor_1,asts$7={findRule:function(e,t){for(var r=0;r<e.rules.length;r++)if(e.rules[r].name===t)return e.rules[r]},indexOfRule:function(e,t){for(var r=0;r<e.rules.length;r++)if(e.rules[r].name===t)return r;return-1},alwaysConsumesOnSuccess:function(e,t){function r(){return!0}function a(){return!1}var n=visitor$b.build({choice:function(e){return e.alternatives.every(n)},sequence:function(e){return e.elements.some(n)},simple_and:a,simple_not:a,optional:a,zero_or_more:a,repeated:function(e){var t=e.min?e.min:e.max;return!("constant"!==t.type||0===t.value||!n(e.expression)&&!(t.value>1&&e.delimiter&&n(e.delimiter)))},semantic_and:a,semantic_not:a,rule_ref:function(t){var r=asts$7.findRule(e,t.name);return r?n(r):void 0},literal:function(e){return""!==e.value},class:r,any:r});return n(t)}},asts_1=asts$7,opcodes={PUSH:0,PUSH_EMPTY_STRING:35,PUSH_UNDEFINED:1,PUSH_NULL:2,PUSH_FAILED:3,PUSH_EMPTY_ARRAY:4,PUSH_CURR_POS:5,POP:6,POP_CURR_POS:7,POP_N:8,NIP:9,APPEND:10,WRAP:11,TEXT:12,PLUCK:36,IF:13,IF_ERROR:14,IF_NOT_ERROR:15,IF_LT:30,IF_GE:31,IF_LT_DYNAMIC:32,IF_GE_DYNAMIC:33,WHILE_NOT_ERROR:16,MATCH_ANY:17,MATCH_STRING:18,MATCH_STRING_IC:19,MATCH_CHAR_CLASS:20,MATCH_REGEXP:20,ACCEPT_N:21,ACCEPT_STRING:22,FAIL:23,LOAD_SAVED_POS:24,UPDATE_SAVED_POS:25,CALL:26,RULE:27,SILENT_FAILS_ON:28,SILENT_FAILS_OFF:29,SOURCE_MAP_PUSH:37,SOURCE_MAP_POP:38,SOURCE_MAP_LABEL_PUSH:39,SOURCE_MAP_LABEL_POP:40},opcodes_1=opcodes,visitor$a=visitor_1,asts$6=asts_1,GrammarError$4=grammarError,ALWAYS_MATCH$1=1,SOMETIMES_MATCH$1=0,NEVER_MATCH$1=-1;function inferenceMatchResult$1(e){function t(e){return e.match=SOMETIMES_MATCH$1}function r(e){return o(e.expression),e.match=ALWAYS_MATCH$1}function a(e){return e.match=o(e.expression)}function n(e,t){for(var r=e.length,a=0,n=0,s=0;s<r;++s){var c=o(e[s]);c===ALWAYS_MATCH$1&&++a,c===NEVER_MATCH$1&&++n}return a===r?ALWAYS_MATCH$1:t?n===r?NEVER_MATCH$1:SOMETIMES_MATCH$1:n>0?NEVER_MATCH$1:SOMETIMES_MATCH$1}var o=visitor$a.build({rule:function(e){var t=void 0,r=0;if(void 0===e.match){e.match=SOMETIMES_MATCH$1;do{if(t=e.match,e.match=o(e.expression),++r>6)throw new GrammarError$4("Infinity cycle detected when trying to evaluate node match result",e.location)}while(t!==e.match)}return e.match},named:a,choice:function(e){return e.match=n(e.alternatives,!0)},action:a,sequence:function(e){return e.match=n(e.elements,!1)},labeled:a,text:a,simple_and:a,simple_not:function(e){return e.match=-o(e.expression)},optional:r,zero_or_more:r,one_or_more:a,repeated:function(e){var t=o(e.expression),r=e.delimiter?o(e.delimiter):NEVER_MATCH$1,a=e.min?e.min:e.max;return"constant"!==a.type||"constant"!==e.max.type?e.match=SOMETIMES_MATCH$1:0===e.max.value||null!==e.max.value&&a.value>e.max.value?e.match=NEVER_MATCH$1:t===NEVER_MATCH$1?e.match=0===a.value?ALWAYS_MATCH$1:NEVER_MATCH$1:t===ALWAYS_MATCH$1?e.delimiter&&a.value>=2?e.match=r:e.match=ALWAYS_MATCH$1:e.delimiter&&a.value>=2?e.match=r===NEVER_MATCH$1?NEVER_MATCH$1:SOMETIMES_MATCH$1:e.match=0===a.value?ALWAYS_MATCH$1:SOMETIMES_MATCH$1},group:a,semantic_and:t,semantic_not:t,rule_ref:function(t){var r=asts$6.findRule(e,t.name);return t.match=o(r)},literal:function(e){var t=0===e.value.length?ALWAYS_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},class:function(e){var t=0===e.parts.length?NEVER_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},any:t});o(e)}inferenceMatchResult$1.ALWAYS_MATCH=ALWAYS_MATCH$1,inferenceMatchResult$1.SOMETIMES_MATCH=SOMETIMES_MATCH$1,inferenceMatchResult$1.NEVER_MATCH=NEVER_MATCH$1;var inferenceMatchResult_1=inferenceMatchResult$1,__spreadArray$5=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n<o;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},asts$5=asts_1,op$2=opcodes_1,visitor$9=visitor_1,_a$4=inferenceMatchResult_1,ALWAYS_MATCH=_a$4.ALWAYS_MATCH,SOMETIMES_MATCH=_a$4.SOMETIMES_MATCH,NEVER_MATCH=_a$4.NEVER_MATCH;function generateBytecode$1(e,t){var r=[],a=[],n=[],o=[],s=[];function c(e){var t=r.indexOf(e);return-1===t?r.push(e)-1:t}function i(e){var t=JSON.stringify(e),r=n.findIndex((function(e){return JSON.stringify(e)===t}));return-1===r?n.push(e)-1:r}function u(e,t,r){var a={predicate:e,params:t,body:r.code,location:r.codeLocation},n=JSON.stringify(a),s=o.findIndex((function(e){return JSON.stringify(e)===n}));return-1===s?o.push(a)-1:s}function p(e){return s.push(e)-1}function l(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r]})),t}function f(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return e.concat.apply(e,t)}function g(e,t,r,a){return e===ALWAYS_MATCH?r:e===NEVER_MATCH?a:t.concat([r.length,a.length],r,a)}function d(e,t,r,a){var n=Object.keys(r).map((function(e){return a-r[e]}));return[op$2.CALL,e,t,n.length].concat(n)}function m(e,t,r){var a=e.match||0;return f([op$2.PUSH_CURR_POS],[op$2.SILENT_FAILS_ON],A(e,{sp:r.sp+1,env:l(r.env),action:null}),[op$2.SILENT_FAILS_OFF],g(t?-a:a,[t?op$2.IF_ERROR:op$2.IF_NOT_ERROR],f([op$2.POP],[t?op$2.POP:op$2.POP_CURR_POS],[op$2.PUSH_UNDEFINED]),f([op$2.POP],[t?op$2.POP_CURR_POS:op$2.POP],[op$2.PUSH_FAILED])))}function $(e,t,r){var a=u(!0,Object.keys(r.env),e);return f([op$2.UPDATE_SAVED_POS],d(a,0,r.env,r.sp),g(e.match||0,[op$2.IF],f([op$2.POP],t?[op$2.PUSH_FAILED]:[op$2.PUSH_UNDEFINED]),f([op$2.POP],t?[op$2.PUSH_UNDEFINED]:[op$2.PUSH_FAILED])))}function h(e){return t=[op$2.WHILE_NOT_ERROR],r=f([op$2.APPEND],e),t.concat([r.length],r);var t,r}function x(e,t,r,a){switch(e.type){case"constant":return{pre:[],post:[],sp:r};case"variable":return e.sp=a+r-t[e.value],{pre:[],post:[],sp:r};case"function":return e.sp=a,{pre:d(u(!0,Object.keys(t),{code:e.value,codeLocation:e.codeLocation}),0,t,r),post:[op$2.NIP],sp:r+1};default:throw new Error('Unknown boundary type "'.concat(e.type,'" for the "repeated" node'))}}function b(e,t){if(null!==t.value){var r="constant"===t.type?[op$2.IF_GE,t.value]:[op$2.IF_GE_DYNAMIC,t.sp];return g(SOMETIMES_MATCH,r,[op$2.PUSH_FAILED],e)}return e}var v,A=(v={grammar:function(e){e.rules.forEach(A),e.literals=r,e.classes=a,e.expectations=n,e.functions=o,e.locations=s},rule:function(e){e.bytecode=A(e.expression,{sp:-1,env:{},pluck:[],action:null})},named:function(e,t){var r=e.match||0,a=r===NEVER_MATCH?-1:i({type:"rule",value:e.name});return f([op$2.SILENT_FAILS_ON],A(e.expression,t),[op$2.SILENT_FAILS_OFF],g(r,[op$2.IF_ERROR],[op$2.FAIL,a],[]))},choice:function(e,t){return function e(t,r){var a=t[0].match||0,n=A(t[0],{sp:r.sp,env:l(r.env),action:null});return a===ALWAYS_MATCH?n:f(n,t.length>1?g(SOMETIMES_MATCH,[op$2.IF_ERROR],f([op$2.POP],e(t.slice(1),r)),[]):[])}(e.alternatives,t)},action:function(e,t){var r=l(t.env),a="sequence"!==e.expression.type||0===e.expression.elements.length,n=A(e.expression,{sp:t.sp+(a?1:0),env:r,action:e}),o=e.expression.match||0,s=a&&o!==NEVER_MATCH?u(!1,Object.keys(r),e):-1;return a?f([op$2.PUSH_CURR_POS],n,g(o,[op$2.IF_NOT_ERROR],f([op$2.LOAD_SAVED_POS,1],d(s,1,r,t.sp+2)),[]),[op$2.NIP]):n},sequence:function(e,t){return f([op$2.PUSH_CURR_POS],function t(r,a){if(r.length>0){var n=e.elements.length-r.length+1;return f(A(r[0],{sp:a.sp,env:a.env,pluck:a.pluck,action:null}),g(r[0].match||0,[op$2.IF_NOT_ERROR],t(r.slice(1),{sp:a.sp+1,env:a.env,pluck:a.pluck,action:a.action}),f(n>1?[op$2.POP_N,n]:[op$2.POP],[op$2.POP_CURR_POS],[op$2.PUSH_FAILED])))}if(a.pluck.length>0)return f([op$2.PLUCK,e.elements.length+1,a.pluck.length],a.pluck.map((function(e){return a.sp-e})));if(a.action){var o=u(!1,Object.keys(a.env),a.action);return f([op$2.LOAD_SAVED_POS,e.elements.length],d(o,e.elements.length+1,a.env,a.sp))}return f([op$2.WRAP,e.elements.length],[op$2.NIP])}(e.elements,{sp:t.sp+1,env:t.env,pluck:[],action:t.action}))},labeled:function(e,r){var a=r.env,n=e.label,o=r.sp+1;n&&(a=l(r.env),r.env[e.label]=o),e.pick&&r.pluck.push(o);var s=A(e.expression,{sp:r.sp,env:a,action:null});return n&&e.labelLocation&&t&&"source-and-map"===t.output?f([op$2.SOURCE_MAP_LABEL_PUSH,o,c(n),p(e.labelLocation)],s,[op$2.SOURCE_MAP_LABEL_POP,o]):s},text:function(e,t){return f([op$2.PUSH_CURR_POS],A(e.expression,{sp:t.sp+1,env:l(t.env),action:null}),g(e.match||0,[op$2.IF_NOT_ERROR],f([op$2.POP],[op$2.TEXT]),[op$2.NIP]))},simple_and:function(e,t){return m(e.expression,!1,t)},simple_not:function(e,t){return m(e.expression,!0,t)},optional:function(e,t){return f(A(e.expression,{sp:t.sp,env:l(t.env),action:null}),g(-(e.expression.match||0),[op$2.IF_ERROR],f([op$2.POP],[op$2.PUSH_NULL]),[]))},zero_or_more:function(e,t){var r=A(e.expression,{sp:t.sp+1,env:l(t.env),action:null});return f([op$2.PUSH_EMPTY_ARRAY],r,h(r),[op$2.POP])},one_or_more:function(e,t){var r=A(e.expression,{sp:t.sp+1,env:l(t.env),action:null});return f([op$2.PUSH_EMPTY_ARRAY],r,g(e.expression.match||0,[op$2.IF_NOT_ERROR],f(h(r),[op$2.POP]),f([op$2.POP],[op$2.POP],[op$2.PUSH_FAILED])))},repeated:function(e,t){var r=e.min?e.min:e.max,a="constant"!==r.type||r.value>0,n="constant"!==e.max.type&&null!==e.max.value,o=a?2:1,s=e.min?x(e.min,t.env,t.sp,2+("function"===e.max.type?1:0)):{pre:[],post:[],sp:t.sp},c=x(e.max,t.env,s.sp,o),i=A(e.expression,{sp:c.sp+o,env:l(t.env),action:null}),u=null!==e.delimiter?A(e.expression,{sp:c.sp+o+1,env:l(t.env),action:null}):i,p=function(e,t,r,a,n){return e?f([op$2.PUSH_CURR_POS],A(e,{sp:a.sp+n+1,env:l(a.env),action:null}),g(e.match||0,[op$2.IF_NOT_ERROR],f([op$2.POP],r,g(-t,[op$2.IF_ERROR],[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP])),[op$2.NIP])):r}(e.delimiter,e.expression.match||0,u,t,o),d=b(p,e.max),m=n?b(i,e.max):i,$=f(a?[op$2.PUSH_CURR_POS]:[],[op$2.PUSH_EMPTY_ARRAY],m,h(d),[op$2.POP]);return f(s.pre,c.pre,a?function(e,t){var r="constant"===t.type?[op$2.IF_LT,t.value]:[op$2.IF_LT_DYNAMIC,t.sp];return f(e,g(SOMETIMES_MATCH,r,[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP]))}($,r):$,c.post,s.post)},group:function(e,t){return A(e.expression,{sp:t.sp,env:l(t.env),action:null})},semantic_and:function(e,t){return $(e,!1,t)},semantic_not:function(e,t){return $(e,!0,t)},rule_ref:function(t){return[op$2.RULE,asts$5.indexOfRule(e,t.name)]},literal:function(e){if(e.value.length>0){var t=e.match||0,r=t===SOMETIMES_MATCH||t===ALWAYS_MATCH&&!e.ignoreCase?c(e.ignoreCase?e.value.toLowerCase():e.value):-1,a=t!==ALWAYS_MATCH?i({type:"literal",value:e.value,ignoreCase:e.ignoreCase}):-1;return g(t,e.ignoreCase?[op$2.MATCH_STRING_IC,r]:[op$2.MATCH_STRING,r],e.ignoreCase?[op$2.ACCEPT_N,e.value.length]:[op$2.ACCEPT_STRING,r],[op$2.FAIL,a])}return[op$2.PUSH_EMPTY_STRING]},class:function(e){var t=e.match||0,r=t===SOMETIMES_MATCH?function(e){var t={value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase},r=JSON.stringify(t),n=a.findIndex((function(e){return JSON.stringify(e)===r}));return-1===n?a.push(t)-1:n}(e):-1,n=t!==ALWAYS_MATCH?i({type:"class",value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase}):-1;return g(t,[op$2.MATCH_CHAR_CLASS,r],[op$2.ACCEPT_N,1],[op$2.FAIL,n])},any:function(e){var t=e.match||0,r=t!==ALWAYS_MATCH?i({type:"any"}):-1;return g(t,[op$2.MATCH_ANY],[op$2.ACCEPT_N,1],[op$2.FAIL,r])}},t&&"source-and-map"===t.output&&Object.keys(v).forEach((function(e){var t=v[e];v[e]=function(e){for(var r=[],a=1;a<arguments.length;a++)r[a-1]=arguments[a];var n=t.apply(void 0,__spreadArray$5([e],r,!1));return void 0!==n&&e.location?f([op$2.SOURCE_MAP_PUSH,p(e.location)],n,[op$2.SOURCE_MAP_POP]):n}})),visitor$9.build(v));A(e)}var generateBytecode_1=generateBytecode$1,sourceMap$1={},sourceMapGenerator$1={},base64Vlq$1={},base64$6={};const intToCharMap$1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");base64$6.encode=function(e){if(0<=e&&e<intToCharMap$1.length)return intToCharMap$1[e];throw new TypeError("Must be between 0 and 63: "+e)};const base64$5=base64$6,VLQ_BASE_SHIFT$1=5,VLQ_BASE$1=1<<VLQ_BASE_SHIFT$1,VLQ_BASE_MASK$1=VLQ_BASE$1-1,VLQ_CONTINUATION_BIT$1=VLQ_BASE$1;function toVLQSigned$1(e){return e<0?1+(-e<<1):0+(e<<1)}base64Vlq$1.encode=function(e){let t,r="",a=toVLQSigned$1(e);do{t=a&VLQ_BASE_MASK$1,a>>>=VLQ_BASE_SHIFT$1,a>0&&(t|=VLQ_CONTINUATION_BIT$1),r+=base64$5.encode(t)}while(a>0);return r};var util$8={};function getArg$1(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$8.getArg=getArg$1;const supportsNullProto$1=!("__proto__"in Object.create(null));function identity$1(e){return e}function toSetString$1(e){return isProtoString$1(e)?"$"+e:e}function fromSetString$1(e){return isProtoString$1(e)?e.slice(1):e}function isProtoString$1(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp$1(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated$1(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp$1(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp$1(e.name,t.name)))))}util$8.toSetString=supportsNullProto$1?identity$1:toSetString$1,util$8.fromSetString=supportsNullProto$1?identity$1:fromSetString$1,util$8.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated$1;const PROTOCOL$1="http:",PROTOCOL_AND_HOST$1=`${PROTOCOL$1}//host`;function createSafeHandler$1(e){return t=>{const r=getURLType$1(t),a=buildSafeBase$1(t),n=new URL(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL$1.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST$1.length):computeRelativeURL$1(a,o)}}function withBase$1(e,t){return new URL(e,t).toString()}function buildUniqueSegment$1(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase$1(e){const t=e.split("..").length-1,r=buildUniqueSegment$1("p",e);let a=`${PROTOCOL_AND_HOST$1}/`;for(let e=0;e<t;e++)a+=`${r}/`;return a}const ABSOLUTE_SCHEME$1=/^[A-Za-z0-9\+\-\.]+:/;function getURLType$1(e){return"/"===e[0]?"/"===e[1]?"scheme-relative":"path-absolute":ABSOLUTE_SCHEME$1.test(e)?"absolute":"path-relative"}function computeRelativeURL$1(e,t){"string"==typeof e&&(e=new URL(e)),"string"==typeof t&&(t=new URL(t));const r=t.pathname.split("/"),a=e.pathname.split("/");for(a.length>0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory$1=createSafeHandler$1((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),normalize$1=createSafeHandler$1((e=>{}));function join$1(e,t){const r=getURLType$1(t),a=getURLType$1(e);if(e=ensureDirectory$1(e),"absolute"===r)return withBase$1(t,void 0);if("absolute"===a)return withBase$1(t,e);if("scheme-relative"===r)return normalize$1(t);if("scheme-relative"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL$1.length);if("path-absolute"===r)return normalize$1(t);if("path-absolute"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL_AND_HOST$1.length);const n=buildSafeBase$1(t+e);return computeRelativeURL$1(n,withBase$1(t,withBase$1(e,n)))}function relative$1(e,t){const r=relativeIfPossible$1(e,t);return"string"==typeof r?r:normalize$1(t)}function relativeIfPossible$1(e,t){if(getURLType$1(e)!==getURLType$1(t))return null;const r=buildSafeBase$1(e+t),a=new URL(e,r),n=new URL(t,r);try{new URL("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL$1(a,n)}util$8.normalize=normalize$1,util$8.join=join$1,util$8.relative=relative$1;var arraySet$1={};let ArraySet$4=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e<n;e++)a.add(t[e],r);return a}size(){return this._set.size}add(e,t){const r=this.has(e),a=this._array.length;r&&!t||this._array.push(e),r||this._set.set(e,a)}has(e){return this._set.has(e)}indexOf(e){const t=this._set.get(e);if(t>=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)}toArray(){return this._array.slice()}};arraySet$1.ArraySet=ArraySet$4;var mappingList$1={};const util$7=util$8;function generatedPositionAfter$1(e,t){const r=e.generatedLine,a=t.generatedLine,n=e.generatedColumn,o=t.generatedColumn;return a>r||a==r&&o>=n||util$7.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$3=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter$1(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$7.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList$1.MappingList=MappingList$3;const base64VLQ$1=base64Vlq$1,util$6=util$8,ArraySet$3=arraySet$1.ArraySet,MappingList$2=mappingList$1.MappingList;let SourceMapGenerator$3=class e{constructor(e){e||(e={}),this._file=util$6.getArg(e,"file",null),this._sourceRoot=util$6.getArg(e,"sourceRoot",null),this._skipValidation=util$6.getArg(e,"skipValidation",!1),this._sources=new ArraySet$3,this._names=new ArraySet$3,this._mappings=new MappingList$2,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$6.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!=r&&(n=util$6.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$6.getArg(e,"generated"),r=util$6.getArg(e,"original",null);let a=util$6.getArg(e,"source",null),n=util$6.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r&&r.line,originalColumn:r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$6.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$6.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$6.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$6.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$3:this._sources,s=new ArraySet$3;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$6.join(r,t.source)),null!=n&&(t.source=util$6.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$6.join(r,t)),null!=n&&(t=util$6.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,u=0,p="";const l=this._mappings.toArray();for(let f=0,g=l.length;f<g;f++){if(t=l[f],e="",t.generatedLine!==o)for(n=0;t.generatedLine!==o;)e+=";",o++;else if(f>0){if(!util$6.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ$1.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ$1.encode(a-u),u=a,e+=base64VLQ$1.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ$1.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ$1.encode(r-i),i=r)),p+=e}return p}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$6.relative(t,e));const r=util$6.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$3.prototype._version=3,sourceMapGenerator$1.SourceMapGenerator=SourceMapGenerator$3;var sourceNode$1={};const SourceMapGenerator$2=sourceMapGenerator$1.SourceMapGenerator,util$5=util$8,REGEX_NEWLINE$1=/(\r?\n)/,NEWLINE_CODE$1=10,isSourceNode$1="$$$isSourceNode$$$";let SourceNode$4=class e{constructor(e,t,r,a,n){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==n?null:n,this[isSourceNode$1]=!0,null!=a&&this.add(a)}static fromStringWithSourceMap(t,r,a){const n=new e,o=t.split(REGEX_NEWLINE$1);let s=0;const c=function(){return e()+(e()||"");function e(){return s<o.length?o[s++]:void 0}};let i,u=1,p=0,l=null;return r.eachMapping((function(e){if(null!==l){if(!(u<e.generatedLine)){i=o[s]||"";const t=i.substr(0,e.generatedColumn-p);return o[s]=i.substr(e.generatedColumn-p),p=e.generatedColumn,f(l,t),void(l=e)}f(l,c()),u++,p=0}for(;u<e.generatedLine;)n.add(c()),u++;p<e.generatedColumn&&(i=o[s]||"",n.add(i.substr(0,e.generatedColumn)),o[s]=i.substr(e.generatedColumn),p=e.generatedColumn),l=e}),this),s<o.length&&(l&&f(l,c()),n.add(o.splice(s).join(""))),r.sources.forEach((function(e){const t=r.sourceContentFor(e);null!=t&&(null!=a&&(e=util$5.join(a,e)),n.setSourceContent(e,t))})),n;function f(t,r){if(null===t||void 0===t.source)n.add(r);else{const o=a?util$5.join(a,t.source):t.source;n.add(new e(t.originalLine,t.originalColumn,o,r,t.name))}}}add(e){if(Array.isArray(e))e.forEach((function(e){this.add(e)}),this);else{if(!e[isSourceNode$1]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this}prepend(e){if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode$1]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r<a;r++)t=this.children[r],t[isSourceNode$1]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})}join(e){let t,r;const a=this.children.length;if(a>0){for(t=[],r=0;r<a-1;r++)t.push(this.children[r]),t.push(e);t.push(this.children[r]),this.children=t}return this}replaceRight(e,t){const r=this.children[this.children.length-1];return r[isSourceNode$1]?r.replaceRight(e,t):"string"==typeof r?this.children[this.children.length-1]=r.replace(e,t):this.children.push("".replace(e,t)),this}setSourceContent(e,t){this.sourceContents[util$5.toSetString(e)]=t}walkSourceContents(e){for(let t=0,r=this.children.length;t<r;t++)this.children[t][isSourceNode$1]&&this.children[t].walkSourceContents(e);const t=Object.keys(this.sourceContents);for(let r=0,a=t.length;r<a;r++)e(util$5.fromSetString(t[r]),this.sourceContents[t[r]])}toString(){let e="";return this.walk((function(t){e+=t})),e}toStringWithSourceMap(e){const t={code:"",line:1,column:0},r=new SourceMapGenerator$2(e);let a=!1,n=null,o=null,s=null,c=null;return this.walk((function(e,i){t.code+=e,null!==i.source&&null!==i.line&&null!==i.column?(n===i.source&&o===i.line&&s===i.column&&c===i.name||r.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:t.line,column:t.column},name:i.name}),n=i.source,o=i.line,s=i.column,c=i.name,a=!0):a&&(r.addMapping({generated:{line:t.line,column:t.column}}),n=null,a=!1);for(let o=0,s=e.length;o<s;o++)e.charCodeAt(o)===NEWLINE_CODE$1?(t.line++,t.column=0,o+1===s?(n=null,a=!1):a&&r.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:t.line,column:t.column},name:i.name})):t.column++})),this.walkSourceContents((function(e,t){r.setSourceContent(e,t)})),{code:t.code,map:r}}};sourceNode$1.SourceNode=SourceNode$4,sourceMap$1.SourceMapGenerator=sourceMapGenerator$1.SourceMapGenerator,sourceMap$1.SourceNode=sourceNode$1.SourceNode;var SourceNode$3=sourceMap$1.SourceNode,GrammarLocation$3=grammarLocation,Stack$2=function(){function e(e,t,r,a){this.sp=-1,this.maxSp=-1,this.varName=t,this.ruleName=e,this.type=r,this.bytecode=a,this.labels={},this.sourceMapStack=[]}return e.prototype.name=function(e){if(e<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack underflow: attempt to use a variable '").concat(this.varName,"<x>' at an index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.varName+e},e.sourceNode=function(e,t,r){var a=GrammarLocation$3.offsetStart(e);return new SourceNode$3(a.line,a.column?a.column-1:null,String(e.source),t,r)},e.prototype.push=function(t){++this.sp>this.maxSp&&(this.maxSp=this.sp);var r=this.labels[this.sp],a=[this.name(this.sp)," = ",t,";"];if(r){if(this.sourceMapStack.length){var n=e.sourceNode(r.location,a.splice(0,2),r.label),o=this.sourceMapPopInternal(),s=o.parts,c=o.location,i=c.start.offset<r.location.end.offset?{start:r.location.end,end:c.end,source:c.source}:c,u=e.sourceNode(i,a.concat("\n"));return this.sourceMapStack.push([s,s.length+1,c]),new SourceNode$3(null,null,r.location.source,[n,u])}return e.sourceNode(r.location,a.concat("\n"))}return a.join("")},e.prototype.pop=function(e){var t=this;return void 0!==e?(this.sp-=e,Array.from({length:e},(function(e,r){return t.name(t.sp+1+r)}))):this.name(this.sp--)},e.prototype.top=function(){return this.name(this.sp)},e.prototype.index=function(e){if(e<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack overflow: attempt to get a variable at a negative index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.name(this.sp-e)},e.prototype.result=function(){if(this.maxSp<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack is empty, can't get the result.\nBytecode: ").concat(this.bytecode));return this.name(0)},e.prototype.defines=function(){var e=this;return this.maxSp<0?"":this.type+" "+Array.from({length:this.maxSp+1},(function(t,r){return e.name(r)})).join(", ")+";"},e.prototype.checkedIf=function(e,t,r){var a=this.sp,n=t();if(!r)return[n];var o=this.sp;this.sp=a;var s=r();if(o!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+e+": Branches of a condition can't move the stack pointer differently (before: "+a+", after then: "+o+", after else: "+this.sp+"). Bytecode: "+this.bytecode);return[n,s]},e.prototype.checkedLoop=function(e,t){var r=this.sp,a=t();if(r!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+e+": Body of a loop can't move the stack pointer (before: "+r+", after: "+this.sp+"). Bytecode: "+this.bytecode);return a},e.prototype.sourceMapPush=function(e,t){if(this.sourceMapStack.length){var r=this.sourceMapStack[this.sourceMapStack.length-1];r[2].start.offset===t.start.offset&&r[2].end.offset>t.end.offset&&(r[2]={start:t.end,end:r[2].end,source:r[2].source})}this.sourceMapStack.push([e,e.length,t])},e.prototype.sourceMapPopInternal=function(){var e=this.sourceMapStack.pop();if(!e)throw new RangeError("Rule '".concat(this.ruleName,"': Attempting to pop an empty source map stack.\nBytecode: ").concat(this.bytecode));var t=e[0],r=e[1],a=e[2],n=t.splice(r).map((function(e){return e instanceof SourceNode$3?e:e+"\n"}));if(n.length){var o=GrammarLocation$3.offsetStart(a);t.push(new SourceNode$3(o.line,o.column-1,String(a.source),n))}return{parts:t,location:a}},e.prototype.sourceMapPop=function(e){var t=this.sourceMapPopInternal().location;if(this.sourceMapStack.length&&t.end.offset<this.sourceMapStack[this.sourceMapStack.length-1][2].end.offset){var r=this.sourceMapPopInternal(),a=r.parts,n=r.location,o=n.start.offset<t.end.offset?{start:t.end,end:n.end,source:n.source}:n;this.sourceMapStack.push([a,a.length+(e||0),o])}},e}(),stack=Stack$2,version$1="3.0.2",utils$1={};function hex$1(e){return e.charCodeAt(0).toString(16).toUpperCase()}function stringEscape$2(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+hex$1(e)})).replace(/[\x10-\x1F\x7F-\xFF]/g,(function(e){return"\\x"+hex$1(e)})).replace(/[\u0100-\u0FFF]/g,(function(e){return"\\u0"+hex$1(e)})).replace(/[\u1000-\uFFFF]/g,(function(e){return"\\u"+hex$1(e)}))}function regexpClassEscape$2(e){return e.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+hex$1(e)})).replace(/[\x10-\x1F\x7F-\xFF]/g,(function(e){return"\\x"+hex$1(e)})).replace(/[\u0100-\u0FFF]/g,(function(e){return"\\u0"+hex$1(e)})).replace(/[\u1000-\uFFFF]/g,(function(e){return"\\u"+hex$1(e)}))}function base64$4(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=e.length%3,a=e.length-r,n="",o=0;o<a;o+=3)n+=t[e[o]>>2],n+=t[(3&e[o])<<4|e[o+1]>>4],n+=t[(15&e[o+1])<<2|e[o+2]>>6],n+=t[63&e[o+2]];return 1===r?(n+=t[e[a]>>2],n+=t[(3&e[a])<<4],n+="=="):2===r&&(n+=t[e[a]>>2],n+=t[(3&e[a])<<4|e[a+1]>>4],n+=t[(15&e[a+1])<<2],n+="="),n}utils$1.hex=hex$1,utils$1.stringEscape=stringEscape$2,utils$1.regexpClassEscape=regexpClassEscape$2,utils$1.base64=base64$4;var __spreadArray$4=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n<o;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},asts$4=asts_1,op$1=opcodes_1,Stack$1=stack,VERSION$1=version$1,_a$3=utils$1,stringEscape$1=_a$3.stringEscape,regexpClassEscape$1=_a$3.regexpClassEscape,SourceNode$2=sourceMap$1.SourceNode,GrammarLocation$2=grammarLocation;function toSourceNode(e,t,r){var a=GrammarLocation$2.offsetStart(t),n=a.line,o=a.column-1,s=e.split("\n");return 1===s.length?new SourceNode$2(n,o,String(t.source),e,r):new SourceNode$2(null,null,String(t.source),s.map((function(e,a){return new SourceNode$2(n+a,0===a?o:0,String(t.source),a===s.length-1?e:[e,"\n"],r)})))}function wrapInSourceNode(e,t,r,a,n){if(r){var o=GrammarLocation$2.offsetEnd(r);return new SourceNode$2(null,null,String(r.source),[e,toSourceNode(t,r,n),new SourceNode$2(o.line,o.column-1,String(r.source),a)])}return new SourceNode$2(null,null,null,[e,t,a])}function generateJS$1(e,t){if(!(e.literals&&e.locations&&e.classes&&e.expectations&&e.functions))throw new Error("generateJS: generate bytecode was not called.");var r=e.literals,a=e.locations,n=e.classes,o=e.expectations,s=e.functions;if(!t.allowedStartRules)throw new Error("generateJS: options.allowedStartRules was not set.");var c=t.allowedStartRules,i=t.dependencies||{};function u(e){var t=!0,r=0;return function e(a){return Array.isArray(a)?a.map((function(t){return e(t)})):a instanceof SourceNode$2?(r++,a.children=e(a.children),r--,a):(a=t?a.replace(/^(.+)$/gm," $1"):a.replace(/\n(\s*\S)/g,"\n $1"),t=!r||a.endsWith("\n"),a)}(e)}function p(e){return"peg$c"+e}function l(e){return"peg$r"+e}function f(e){return"peg$e"+e}function g(e){return"peg$f"+e}function d(e){return"peg$parse"+e}function m(e){return e.codeLocation?toSourceNode(e.code,e.codeLocation,"$"+e.type):e.code}e.code=function(e){function r(){return["// @generated by Peggy ".concat(VERSION$1,"."),"//","// https://peggyjs.org/"]}function a(){return t.trace?["{"," SyntaxError: peg$SyntaxError,"," DefaultTracer: peg$DefaultTracer,"," parse: peg$parse","}"].join("\n"):["{"," SyntaxError: peg$SyntaxError,"," parse: peg$parse","}"].join("\n")}var n={bare:function(){return __spreadArray$4(__spreadArray$4([],r(),!0),["(function() {",' "use strict";',"",e,"",u("return "+a()+";"),"})()"],!1)},commonjs:function(){var t=Object.keys(i),n=r();return n.push("",'"use strict";',""),t.length>0&&(t.forEach((function(e){n.push("var "+e+' = require("'+stringEscape$1(i[e])+'");')})),n.push("")),n.push(e,"","module.exports = "+a()+";"),n},es:function(){var a=Object.keys(i),n=r();return n.push(""),a.length>0&&(a.forEach((function(e){n.push("import "+e+' from "'+stringEscape$1(i[e])+'";')})),n.push("")),n.push(e,"","export {"," peg$SyntaxError as SyntaxError,",t.trace?" peg$DefaultTracer as DefaultTracer,":""," peg$parse as parse","};"),n},amd:function(){var t=Object.keys(i),n="["+t.map((function(e){return i[e]})).map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",o=t.join(", ");return __spreadArray$4(__spreadArray$4([],r(),!0),["define("+n+", function("+o+") {",' "use strict";',"",e,"",u("return "+a()+";"),"});"],!1)},globals:function(){return __spreadArray$4(__spreadArray$4([],r(),!0),["(function(root) {",' "use strict";',"",e,"",u("root."+t.exportVar+" = "+a()+";"),"})(this);"],!1)},umd:function(){var n=Object.keys(i),o=n.map((function(e){return i[e]})),s="["+o.map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",c=o.map((function(e){return'require("'+stringEscape$1(e)+'")'})).join(", "),p=n.join(", "),l=r();return l.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+s+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+c+");"),null!==t.exportVar&&l.push(" } else {"," root."+t.exportVar+" = factory();"),l.push(" }","})(this, function("+p+") {",' "use strict";',"",e,"",u("return "+a()+";"),"});"),l}}[t.format||"bare"]();return new SourceNode$2(null,null,t.grammarSource,n.map((function(e){return e instanceof SourceNode$2?e:e+"\n"})))}(function(){var i=[];e.topLevelInitializer&&(i.push(m(e.topLevelInitializer)),i.push("")),i.push("function peg$subclass(child, parent) {"," function C() { this.constructor = child; }"," C.prototype = parent.prototype;"," child.prototype = new C();","}","","function peg$SyntaxError(message, expected, found, location) {"," var self = Error.call(this, message);"," // istanbul ignore next Check is a necessary evil to support older environments"," if (Object.setPrototypeOf) {"," Object.setPrototypeOf(self, peg$SyntaxError.prototype);"," }"," self.expected = expected;"," self.found = found;"," self.location = location;",' self.name = "SyntaxError";'," return self;","}","","peg$subclass(peg$SyntaxError, Error);","","function peg$padEnd(str, targetLength, padString) {",' padString = padString || " ";'," if (str.length > targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))'," ? this.location.source.offset(s)"," : s;",' var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;'," if (src) {"," var e = this.location.end;"," var filler = peg$padEnd(\"\", offset_s.line.toString().length, ' ');"," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --\x3e " + loc + "\\n"',' + filler + " |\\n"',' + offset_s.line + " | " + line + "\\n"',' + filler + " | " + peg$padEnd("", s.column - 1, \' \')',' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/"/g, "\\\\\\"")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/\\]/g, "\\\\]")',' .replace(/\\^/g, "\\\\^")',' .replace(/-/g, "\\\\-")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),t.trace&&i.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");var $="{ "+c.map((function(e){return e+": "+d(e)})).join(", ")+" }",h=d(c[0]);return i.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+$+";"," var peg$startRuleFunction = "+h+";","",new SourceNode$2(null,null,t.grammarSource,__spreadArray$4([r.map((function(e,t){return" var "+p(t)+' = "'+stringEscape$1(e)+'";'})).concat("",n.map((function(e,t){return" var "+l(t)+" = /^["+((r=e).inverted?"^":"")+r.value.map((function(e){return Array.isArray(e)?regexpClassEscape$1(e[0])+"-"+regexpClassEscape$1(e[1]):regexpClassEscape$1(e)})).join("")+"]/"+(r.ignoreCase?"i":"")+";";var r}))).concat("",o.map((function(e,t){return" var "+f(t)+" = "+function(e){switch(e.type){case"rule":return'peg$otherExpectation("'+stringEscape$1(e.value)+'")';case"literal":return'peg$literalExpectation("'+stringEscape$1(e.value)+'", '+e.ignoreCase+")";case"class":return"peg$classExpectation(["+e.value.map((function(e){return Array.isArray(e)?'["'+stringEscape$1(e[0])+'", "'+stringEscape$1(e[1])+'"]':'"'+stringEscape$1(e)+'"'})).join(", ")+"], "+e.inverted+", "+e.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(e)+")")}}(e)+";"}))).concat("").join("\n")],s.map((function(e,t){return wrapInSourceNode("\n var ".concat(g(t)," = function(").concat(e.params.join(", "),") {"),e.body,e.location,"};")})),!0)),""," var peg$currPos = 0;"," var peg$savedPos = 0;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = 0;"," var peg$maxFailExpected = [];"," var peg$silentFails = 0;",""),t.cache&&i.push(" var peg$resultsCache = {};",""),t.trace&&i.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),i.push(" var peg$result;","",' if ("startRule" in options) {'," if (!(options.startRule in peg$startRuleFunctions)) {",' throw new Error("Can\'t start parsing from rule \\"" + options.startRule + "\\".");'," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," if (pos >= peg$posDetailsCache.length) {"," p = peg$posDetailsCache.length - 1;"," } else {"," p = pos;"," while (!peg$posDetailsCache[--p]) {}"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos, offset) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," var res = {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };",' if (offset && peg$source && (typeof peg$source.offset === "function")) {'," res.start = peg$source.offset(res.start);"," res.end = peg$source.offset(res.end);"," }"," return res;"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),e.rules.forEach((function(n){i.push.apply(i,u(function(n){var o=[],s=n.bytecode,c=new Stack$1(n.name,"s","var",s),i=function t(n){var o=0,s=n.length,i=[],m=void 0;function $(e,r,a){var s=r+3,p=n[o+s-2],l=n[o+s-1],f=c.checkedIf(o,(function(){return o+=s+p,(a||t)(n.slice(o-p,o))}),l>0?function(){return o+=l,t(n.slice(o-l,o))}:null),g=f[0],d=f[1];i.push("if ("+e+") {"),i.push.apply(i,u(g)),l>0&&(i.push("} else {"),i.push.apply(i,u(d))),i.push("}")}function h(e,r,a){var s=r+3,u=1===a?"input.charAt(peg$currPos)":"input.substr(peg$currPos, "+a+")",p=null;n[o+s]===op$1.ACCEPT_N&&n[o+s+1]===a&&(i.push(c.push(u)),u=c.pop(),p=function(e){c.sp++;var r=t(e.slice(2));return r.unshift(1===a?"peg$currPos++;":"peg$currPos += "+a+";"),r}),$(e(u,null!==p),r,p)}for(var x=function(){switch(n[o]){case op$1.PUSH_EMPTY_STRING:i.push(c.push("''")),o++;break;case op$1.PUSH_CURR_POS:i.push(c.push("peg$currPos")),o++;break;case op$1.PUSH_UNDEFINED:i.push(c.push("undefined")),o++;break;case op$1.PUSH_NULL:i.push(c.push("null")),o++;break;case op$1.PUSH_FAILED:i.push(c.push("peg$FAILED")),o++;break;case op$1.PUSH_EMPTY_ARRAY:i.push(c.push("[]")),o++;break;case op$1.POP:c.pop(),o++;break;case op$1.POP_CURR_POS:i.push("peg$currPos = "+c.pop()+";"),o++;break;case op$1.POP_N:c.pop(n[o+1]),o+=2;break;case op$1.NIP:m=c.pop(),c.pop(),i.push(c.push(m)),o++;break;case op$1.APPEND:m=c.pop(),i.push(c.top()+".push("+m+");"),o++;break;case op$1.WRAP:i.push(c.push("["+c.pop(n[o+1]).join(", ")+"]")),o+=2;break;case op$1.TEXT:i.push(c.push("input.substring("+c.pop()+", peg$currPos)")),o++;break;case op$1.PLUCK:var s=n[o+3-1],x=3+s;m=n.slice(o+3,o+x),m=1===s?c.index(m[0]):"[ ".concat(m.map((function(e){return c.index(e)})).join(", ")," ]"),c.pop(n[o+1]),i.push(c.push(m)),o+=x;break;case op$1.IF:$(c.top(),0);break;case op$1.IF_ERROR:$(c.top()+" === peg$FAILED",0);break;case op$1.IF_NOT_ERROR:$(c.top()+" !== peg$FAILED",0);break;case op$1.IF_LT:$(c.top()+".length < "+n[o+1],1);break;case op$1.IF_GE:$(c.top()+".length >= "+n[o+1],1);break;case op$1.IF_LT_DYNAMIC:$(c.top()+".length < ("+c.index(n[o+1])+"|0)",1);break;case op$1.IF_GE_DYNAMIC:$(c.top()+".length >= ("+c.index(n[o+1])+"|0)",1);break;case op$1.WHILE_NOT_ERROR:S=c.top()+" !== peg$FAILED",_=n[o+2-1],E=c.checkedLoop(o,(function(){return o+=2+_,t(n.slice(o-_,o))})),i.push("while ("+S+") {"),i.push.apply(i,u(E)),i.push("}");break;case op$1.MATCH_ANY:$("input.length > peg$currPos",0);break;case op$1.MATCH_STRING:var b=n[o+1],v=r[b];h((function(e,t){return v.length>1?"".concat(e," === ").concat(p(b)):(e=t?"".concat(e,".charCodeAt(0)"):"input.charCodeAt(peg$currPos)","".concat(e," === ").concat(v.charCodeAt(0)))}),1,v.length);break;case op$1.MATCH_STRING_IC:var A=n[o+1];h((function(e){return"".concat(e,".toLowerCase() === ").concat(p(A))}),1,r[A].length);break;case op$1.MATCH_CHAR_CLASS:var y=n[o+1];h((function(e){return"".concat(l(y),".test(").concat(e,")")}),1,1);break;case op$1.ACCEPT_N:i.push(c.push(n[o+1]>1?"input.substr(peg$currPos, "+n[o+1]+")":"input.charAt(peg$currPos)")),i.push(n[o+1]>1?"peg$currPos += "+n[o+1]+";":"peg$currPos++;"),o+=2;break;case op$1.ACCEPT_STRING:i.push(c.push(p(n[o+1]))),i.push(r[n[o+1]].length>1?"peg$currPos += "+r[n[o+1]].length+";":"peg$currPos++;"),o+=2;break;case op$1.FAIL:i.push(c.push("peg$FAILED")),i.push("if (peg$silentFails === 0) { peg$fail("+f(n[o+1])+"); }"),o+=2;break;case op$1.LOAD_SAVED_POS:i.push("peg$savedPos = "+c.index(n[o+1])+";"),o+=2;break;case op$1.UPDATE_SAVED_POS:i.push("peg$savedPos = peg$currPos;"),o++;break;case op$1.CALL:m=function(e){var t=n[o+4-1];return g(n[o+1])+"("+n.slice(o+4,o+4+t).map((function(e){return c.index(e)})).join(", ")+")"}(),c.pop(n[o+2]),i.push(c.push(m)),o+=4+n[o+3];break;case op$1.RULE:i.push(c.push(d(e.rules[n[o+1]].name)+"()")),o+=2;break;case op$1.SILENT_FAILS_ON:i.push("peg$silentFails++;"),o++;break;case op$1.SILENT_FAILS_OFF:i.push("peg$silentFails--;"),o++;break;case op$1.SOURCE_MAP_PUSH:c.sourceMapPush(i,a[n[o+1]]),o+=2;break;case op$1.SOURCE_MAP_POP:c.sourceMapPop(),o++;break;case op$1.SOURCE_MAP_LABEL_PUSH:c.labels[n[o+1]]={label:r[n[o+2]],location:a[n[o+3]]},o+=4;break;case op$1.SOURCE_MAP_LABEL_POP:delete c.labels[n[o+1]],o+=2;break;default:throw new Error("Invalid opcode: "+n[o]+".")}var S,_,E};o<s;)x();return i}(s);return o.push(wrapInSourceNode("function ",d(n.name),n.nameLocation,"() {\n",n.name)),t.trace&&o.push(" var startPos = peg$currPos;"),o.push(u(c.defines())),o.push.apply(o,u(function(r,a){var n=[];return n.push(""),t.trace&&n.push("peg$tracer.trace({",' type: "rule.enter",'," rule: "+r+","," location: peg$computeLocation(startPos, startPos, true)","});",""),t.cache&&(n.push("var key = peg$currPos * "+e.rules.length+" + "+a+";","var cached = peg$resultsCache[key];","","if (cached) {"," peg$currPos = cached.nextPos;",""),t.trace&&n.push("if (cached.result !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+r+","," result: cached.result,"," location: peg$computeLocation(startPos, peg$currPos, true)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+r+","," location: peg$computeLocation(startPos, startPos, true)"," });","}",""),n.push(" return cached.result;","}","")),n}('"'+stringEscape$1(n.name)+'"',asts$4.indexOfRule(e,n.name)))),o.push.apply(o,u(i)),o.push.apply(o,u(function(e,r){var a=[];return t.cache&&a.push("","peg$resultsCache[key] = { nextPos: peg$currPos, result: "+r+" };"),t.trace&&a.push("","if ("+r+" !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+e+","," result: "+r+","," location: peg$computeLocation(startPos, peg$currPos, true)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+e+","," location: peg$computeLocation(startPos, startPos, true)"," });","}"),a.push("","return "+r+";"),a}('"'+stringEscape$1(n.name)+'"',c.result()))),o.push("}"),o}(n))),i.push("")})),e.initializer&&(i.push(m(e.initializer)),i.push("")),i.push(" peg$result = peg$startRuleFunction();",""," if (peg$result !== peg$FAILED && peg$currPos === input.length) {"," return peg$result;"," } else {"," if (peg$result !== peg$FAILED && peg$currPos < input.length) {"," peg$fail(peg$endExpectation());"," }",""," throw peg$buildStructuredError("," peg$maxFailExpected,"," peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,"," peg$maxFailPos < input.length"," ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)"," : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)"," );"," }","}"),new SourceNode$2(null,null,t.grammarSource,i.map((function(e){return e instanceof SourceNode$2?e:e+"\n"})))}())}var generateJs=generateJS$1,asts$3=asts_1,visitor$8=visitor_1;function removeProxyRules$1(e,t,r){var a=[];e.rules.forEach((function(n,o){var s;"rule"===(s=n).type&&"rule_ref"===s.expression.type&&(function(e,t,a){visitor$8.build({rule_ref:function(n){n.name===t&&(n.name=a,r.info('Proxy rule "'.concat(t,'" replaced by the rule "').concat(a,'"'),n.location,[{message:"This rule will be used",location:asts$3.findRule(e,a).nameLocation}]))}})(e)}(e,n.name,n.expression.name),-1===t.allowedStartRules.indexOf(n.name)&&a.push(o))})),a.reverse(),a.forEach((function(t){e.rules.splice(t,1)}))}var removeProxyRules_1=removeProxyRules$1,__assign$1=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign$1=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},__assign$1.apply(this,arguments)},__spreadArray$3=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n<o;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},visitor$7=visitor_1;function cloneOver(e,t){var r=e,a=t;Object.keys(r).forEach((function(e){return delete r[e]})),Object.keys(a).forEach((function(e){r[e]=a[e]}))}function cleanParts(e){e.sort((function(e,t){var r=Array.isArray(e)?e:[e,e],a=r[0],n=r[1],o=Array.isArray(t)?t:[t,t],s=o[0],c=o[1];return a!==s?a<s?-1:1:n!==c?n>c?-1:1:0}));for(var t="",r="",a=0;a<e.length;a++){var n=e[a],o=Array.isArray(n)?n:[n,n],s=o[0],c=o[1];c<=r?e.splice(a--,1):r.charCodeAt(0)+1>=s.charCodeAt(0)?(e.splice(a--,1),e[a]=[t,r=c]):(t=s,r=c)}return e}function mergeCharacterClasses$1(e){var t=Object.create(null);e.rules.forEach((function(e){return t[e.name]=e.expression}));var r=Object.create(null),a=[function(e,a){if("class"===e.type&&!e.inverted)return a&&((e=__assign$1({},e)).parts=__spreadArray$3([],e.parts,!0)),e;if("literal"===e.type&&1===e.value.length)return{type:"class",parts:[e.value],inverted:!1,ignoreCase:e.ignoreCase,location:e.location};if("rule_ref"===e.type){var s=t[e.name];if(s){r[e.name]||(r[e.name]=!0,o(s));var c=n(s,!0);return c&&(c.location=e.location),c}}return null},visitor$7.build({choice:function(e){var t=null,r=!1;e.alternatives.forEach((function(a,s){var c;o(a);var i=n(a);i?t&&t.ignoreCase===i.ignoreCase?((c=t.parts).push.apply(c,i.parts),e.alternatives[s-1]=t,e.alternatives[s]=t,t.location={source:t.location.source,start:t.location.start,end:i.location.end},r=!0):t=i:t=null})),r&&(e.alternatives=e.alternatives.filter((function(e,t,r){return!t||e!==r[t-1]})),e.alternatives.forEach((function(t,r){"class"===t.type&&(t.parts=cleanParts(t.parts),1!==t.parts.length||Array.isArray(t.parts[0])||t.inverted||(e.alternatives[r]={type:"literal",value:t.parts[0],ignoreCase:t.ignoreCase,location:t.location}))})),1===e.alternatives.length&&cloneOver(e,e.alternatives[0]))},text:function(e){if(o(e.expression),"class"===e.expression.type||"literal"===e.expression.type){var t=e.location;cloneOver(e,e.expression),e.location=t}}})],n=a[0],o=a[1];e.rules.forEach((function(e){r[e.name]=!0,o(e.expression)}))}var mergeCharacterClasses_1=mergeCharacterClasses$1,visitor$6=visitor_1;function reportDuplicateLabels$1(e,t,r){function a(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r]})),t}function n(e,t){o(e.expression,a(t))}var o=visitor$6.build({rule:function(e){o(e.expression,{})},choice:function(e,t){e.alternatives.forEach((function(e){o(e,a(t))}))},action:n,labeled:function(e,t){var a=e.label;a&&Object.prototype.hasOwnProperty.call(t,a)&&r.error('Label "'.concat(e.label,'" is already defined'),e.labelLocation,[{message:"Original label location",location:t[a]}]),o(e.expression,t),t[e.label]=e.labelLocation},text:n,simple_and:n,simple_not:n,optional:n,zero_or_more:n,one_or_more:n,repeated:function(e,t){e.delimiter&&o(e.delimiter,a(t)),o(e.expression,a(t))},group:n});o(e)}var reportDuplicateLabels_1=reportDuplicateLabels$1,visitor$5=visitor_1;function reportDuplicateRules$1(e,t,r){var a={};visitor$5.build({rule:function(e){Object.prototype.hasOwnProperty.call(a,e.name)?r.error('Rule "'.concat(e.name,'" is already defined'),e.nameLocation,[{message:"Original rule location",location:a[e.name]}]):a[e.name]=e.nameLocation}})(e)}var reportDuplicateRules_1=reportDuplicateRules$1,asts$2=asts_1,visitor$4=visitor_1;function reportInfiniteRecursion$1(e,t,r){var a=[],n=[],o=visitor$4.build({rule:function(e){a.push(e.name),o(e.expression),a.pop()},sequence:function(t){t.elements.every((function(t){return o(t),!asts$2.alwaysConsumesOnSuccess(e,t)}))},repeated:function(t){o(t.expression),t.delimiter&&!asts$2.alwaysConsumesOnSuccess(e,t.expression)&&o(t.delimiter)},rule_ref:function(t){n.push(t);var s=asts$2.findRule(e,t.name);if(-1!==a.indexOf(t.name))return a.push(t.name),void r.error("Possible infinite loop when parsing (left recursion: "+a.join(" -> ")+")",s.nameLocation,n.map((function(e,t,r){return{message:t+1!==r.length?"Step ".concat(t+1,': call of the rule "').concat(e.name,'" without input consumption'):"Step ".concat(t+1,": call itself without input consumption - left recursion"),location:e.location}})));s&&o(s),n.pop()}});o(e)}var reportInfiniteRecursion_1=reportInfiniteRecursion$1,asts$1=asts_1,visitor$3=visitor_1;function reportInfiniteRepetition$1(e,t,r){var a=visitor$3.build({zero_or_more:function(t){asts$1.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},one_or_more:function(t){asts$1.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},repeated:function(t){if(t.delimiter&&a(t.delimiter),!(asts$1.alwaysConsumesOnSuccess(e,t.expression)||t.delimiter&&asts$1.alwaysConsumesOnSuccess(e,t.delimiter)))if(null===t.max.value)r.error("Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",t.location);else{var n=t.min?t.min:t.max;r.warning("constant"===n.type&&"constant"===t.max.type?"An expression may not consume any input and may always match ".concat(t.max.value," times"):"An expression may not consume any input and may always match with a maximum repetition count",t.location)}}});a(e)}var reportInfiniteRepetition_1=reportInfiniteRepetition$1,asts=asts_1,visitor$2=visitor_1;function reportUndefinedRules$1(e,t,r){visitor$2.build({rule_ref:function(t){asts.findRule(e,t.name)||r.error('Rule "'.concat(t.name,'" is not defined'),t.location)}})(e)}var reportUndefinedRules_1=reportUndefinedRules$1,visitor$1=visitor_1;function reportIncorrectPlucking$1(e,t,r){var a=visitor$1.build({action:function(e){a(e.expression,e)},labeled:function(e,t){e.pick&&t&&r.error('"@" cannot be used with an action block',e.labelLocation,[{message:"Action block location",location:t.codeLocation}]),a(e.expression)}});a(e)}var reportIncorrectPlucking_1=reportIncorrectPlucking$1,__spreadArray$2=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n<o;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},GrammarError$3=grammarError,Defaults=function(){function e(e){"function"==typeof(e=void 0!==e?e:{}).error&&(this.error=e.error),"function"==typeof e.warning&&(this.warning=e.warning),"function"==typeof e.info&&(this.info=e.info)}return e.prototype.error=function(){},e.prototype.warning=function(){},e.prototype.info=function(){},e}(),Session$2=function(){function e(e){this._callbacks=new Defaults(e),this._firstError=null,this.errors=0,this.problems=[],this.stage=null}return e.prototype.error=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];++this.errors,null===this._firstError&&(this._firstError=new(GrammarError$3.bind.apply(GrammarError$3,__spreadArray$2([void 0],t,!1))),this._firstError.stage=this.stage,this._firstError.problems=this.problems),this.problems.push(__spreadArray$2(["error"],t,!0)),(e=this._callbacks).error.apply(e,__spreadArray$2([this.stage],t,!1))},e.prototype.warning=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.problems.push(__spreadArray$2(["warning"],t,!0)),(e=this._callbacks).warning.apply(e,__spreadArray$2([this.stage],t,!1))},e.prototype.info=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.problems.push(__spreadArray$2(["info"],t,!0)),(e=this._callbacks).info.apply(e,__spreadArray$2([this.stage],t,!1))},e.prototype.checkErrors=function(){if(0!==this.errors)throw this._firstError},e}(),session=Session$2,generateBytecode=generateBytecode_1,generateJS=generateJs,inferenceMatchResult=inferenceMatchResult_1,removeProxyRules=removeProxyRules_1,mergeCharacterClasses=mergeCharacterClasses_1,reportDuplicateLabels=reportDuplicateLabels_1,reportDuplicateRules=reportDuplicateRules_1,reportInfiniteRecursion=reportInfiniteRecursion_1,reportInfiniteRepetition=reportInfiniteRepetition_1,reportUndefinedRules=reportUndefinedRules_1,reportIncorrectPlucking=reportIncorrectPlucking_1,Session$1=session,visitor=visitor_1,base64$3=utils$1.base64;function processOptions(e,t){var r={};return Object.keys(e).forEach((function(t){r[t]=e[t]})),Object.keys(t).forEach((function(e){Object.prototype.hasOwnProperty.call(r,e)||(r[e]=t[e])})),r}function isSourceMapCapable(e){return"string"==typeof e?e.length>0:e&&"function"==typeof e.offset}var compiler$2={visitor:visitor,passes:{check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRecursion,reportInfiniteRepetition,reportIncorrectPlucking],transform:[removeProxyRules,mergeCharacterClasses,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile:function(ast,passes,options){if(options=void 0!==options?options:{},options=processOptions(options,{allowedStartRules:[ast.rules[0].name],cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");if(0===options.allowedStartRules.length)throw new Error("Must have at least one start rule");var allRules=ast.rules.map((function(e){return e.name}));if(options.allowedStartRules.some((function(e){return"*"===e})))options.allowedStartRules=allRules;else for(var _i=0,_a=options.allowedStartRules;_i<_a.length;_i++){var rule=_a[_i];if(-1===allRules.indexOf(rule))throw new Error('Unknown start rule "'.concat(rule,'"'))}if(("source-and-map"===options.output||"source-with-inline-map"===options.output)&&!isSourceMapCapable(options.grammarSource))throw new Error("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps");var session=new Session$1(options);switch(Object.keys(passes).forEach((function(e){session.stage=e,session.info("Process stage ".concat(e)),passes[e].forEach((function(t){session.info("Process pass ".concat(e,".").concat(t.name)),t(ast,options,session)})),session.checkErrors()})),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;case"source-with-inline-map":if("undefined"==typeof TextEncoder)throw new Error("TextEncoder is not supported by this platform");var sourceMap=ast.code.toStringWithSourceMap(),encoder=new TextEncoder,b64=base64$3(encoder.encode(JSON.stringify(sourceMap.map.toJSON())));return sourceMap.code+"//# sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(b64,"\n");case"ast":return ast;default:throw new Error("Invalid output format: "+options.output+".")}}},compiler_1=compiler$2,OPS_TO_PREFIXED_TYPES={$:"text","&":"simple_and","!":"simple_not"},OPS_TO_SUFFIXED_TYPES={"?":"optional","*":"zero_or_more","+":"one_or_more"},OPS_TO_SEMANTIC_PREDICATE_TYPES={"&":"semantic_and","!":"semantic_not"};function peg$subclass(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function peg$SyntaxError(e,t,r,a){var n=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(n,peg$SyntaxError.prototype),n.expected=t,n.found=r,n.location=a,n.name="SyntaxError",n}function peg$padEnd(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,e+(r+=r.repeat(t)).slice(0,t))}function peg$parse(e,t){var r,a={},n=(t=void 0!==t?t:{}).grammarSource,o={Grammar:lr},s=lr,c="{",i="}",u="=",p="/",l="@",f=":",g="|",d=",",m="..",$="(",h=")",x="\n",b="\r\n",v="/*",A="*/",y="//",S="\\",_="i",E='"',T="'",C="[",P="^",w="]",R="-",L="0",F="b",O="f",B="n",M="r",D="t",I="v",k="x",j="u",N=".",U=";",q=/^[!$&]/,G=/^[*-+?]/,H=/^[!&]/,z=/^[\t\v-\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/,W=/^[\n\r\u2028\u2029]/,V=/^[\r\u2028-\u2029]/,Y=/^[A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376-\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E-\u066F\u0671-\u06D3\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4-\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0-\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,Q=/^[$0-9_\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7-\u09C8\u09CB-\u09CD\u09D7\u09E2-\u09E3\u09E6-\u09EF\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B62-\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56\u0C62-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5-\u0CD6\u0CE2-\u0CE3\u0CE6-\u0CEF\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62-\u0D63\u0D66-\u0D6F\u0D82-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18-\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F3F\u0F71-\u0F84\u0F86-\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19D9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u200C-\u200D\u203F-\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099-\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880-\uA881\uA8B4-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C-\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7-\uAAB8\uAABE-\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5-\uAAF6\uABE3-\uABEA\uABEC-\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33-\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F]/,J=/^[\n\r"\\\u2028-\u2029]/,X=/^[\n\r'\\\u2028-\u2029]/,K=/^[\n\r\\-\]\u2028-\u2029]/,Z=/^["'\\]/,ee=/^[0-9ux]/,te=/^[0-9]/,re=/^[0-9a-f]/i,ae=/^[{}]/,ne=or("{",!1),oe=or("}",!1),se=or("=",!1),ce=or("/",!1),ie=or("@",!1),ue=or(":",!1),pe=sr(["!","$","&"],!1,!1),le=sr([["*","+"],"?"],!1,!1),fe=or("|",!1),ge=or(",",!1),de=or("..",!1),me=or("(",!1),$e=or(")",!1),he=sr(["!","&"],!1,!1),xe={type:"any"},be=cr("whitespace"),ve=sr(["\t",["\v","\f"]," "," "," ",[" "," "]," "," "," ","\ufeff"],!1,!1),Ae=sr(["\n","\r","\u2028","\u2029"],!1,!1),ye=cr("end of line"),Se=or("\n",!1),_e=or("\r\n",!1),Ee=sr(["\r",["\u2028","\u2029"]],!1,!1),Te=cr("comment"),Ce=or("/*",!1),Pe=or("*/",!1),we=or("//",!1),Re=cr("identifier"),Le=sr([["A","Z"],"_",["a","z"],"ª","µ","º",["À","Ö"],["Ø","ö"],["ø","ˁ"],["ˆ","ˑ"],["ˠ","ˤ"],"ˬ","ˮ",["Ͱ","ʹ"],["Ͷ","ͷ"],["ͺ","ͽ"],"Ϳ","Ά",["Έ","Ί"],"Ό",["Ύ","Ρ"],["Σ","ϵ"],["Ϸ","ҁ"],["Ҋ","ԯ"],["Ա","Ֆ"],"ՙ",["ա","և"],["א","ת"],["װ","ײ"],["ؠ","ي"],["ٮ","ٯ"],["ٱ","ۓ"],"ە",["ۥ","ۦ"],["ۮ","ۯ"],["ۺ","ۼ"],"ۿ","ܐ",["ܒ","ܯ"],["ݍ","ޥ"],"ޱ",["ߊ","ߪ"],["ߴ","ߵ"],"ߺ",["ࠀ","ࠕ"],"ࠚ","ࠤ","ࠨ",["ࡀ","ࡘ"],["ࢠ","ࢴ"],["ऄ","ह"],"ऽ","ॐ",["क़","ॡ"],["ॱ","ঀ"],["অ","ঌ"],["এ","ঐ"],["ও","ন"],["প","র"],"ল",["শ","হ"],"ঽ","ৎ",["ড়","ঢ়"],["য়","ৡ"],["ৰ","ৱ"],["ਅ","ਊ"],["ਏ","ਐ"],["ਓ","ਨ"],["ਪ","ਰ"],["ਲ","ਲ਼"],["ਵ","ਸ਼"],["ਸ","ਹ"],["ਖ਼","ੜ"],"ਫ਼",["ੲ","ੴ"],["અ","ઍ"],["એ","ઑ"],["ઓ","ન"],["પ","ર"],["લ","ળ"],["વ","હ"],"ઽ","ૐ",["ૠ","ૡ"],"ૹ",["ଅ","ଌ"],["ଏ","ଐ"],["ଓ","ନ"],["ପ","ର"],["ଲ","ଳ"],["ଵ","ହ"],"ଽ",["ଡ଼","ଢ଼"],["ୟ","ୡ"],"ୱ","ஃ",["அ","ஊ"],["எ","ஐ"],["ஒ","க"],["ங","ச"],"ஜ",["ஞ","ட"],["ண","த"],["ந","ப"],["ம","ஹ"],"ௐ",["అ","ఌ"],["ఎ","ఐ"],["ఒ","న"],["ప","హ"],"ఽ",["ౘ","ౚ"],["ౠ","ౡ"],["ಅ","ಌ"],["ಎ","ಐ"],["ಒ","ನ"],["ಪ","ಳ"],["ವ","ಹ"],"ಽ","ೞ",["ೠ","ೡ"],["ೱ","ೲ"],["അ","ഌ"],["എ","ഐ"],["ഒ","ഺ"],"ഽ","ൎ",["ൟ","ൡ"],["ൺ","ൿ"],["අ","ඖ"],["ක","න"],["ඳ","ර"],"ල",["ව","ෆ"],["ก","ะ"],["า","ำ"],["เ","ๆ"],["ກ","ຂ"],"ຄ",["ງ","ຈ"],"ຊ","ຍ",["ດ","ທ"],["ນ","ຟ"],["ມ","ຣ"],"ລ","ວ",["ສ","ຫ"],["ອ","ະ"],["າ","ຳ"],"ຽ",["ເ","ໄ"],"ໆ",["ໜ","ໟ"],"ༀ",["ཀ","ཇ"],["ཉ","ཬ"],["ྈ","ྌ"],["က","ဪ"],"ဿ",["ၐ","ၕ"],["ၚ","ၝ"],"ၡ",["ၥ","ၦ"],["ၮ","ၰ"],["ၵ","ႁ"],"ႎ",["Ⴀ","Ⴥ"],"Ⴧ","Ⴭ",["ა","ჺ"],["ჼ","ቈ"],["ቊ","ቍ"],["ቐ","ቖ"],"ቘ",["ቚ","ቝ"],["በ","ኈ"],["ኊ","ኍ"],["ነ","ኰ"],["ኲ","ኵ"],["ኸ","ኾ"],"ዀ",["ዂ","ዅ"],["ወ","ዖ"],["ዘ","ጐ"],["ጒ","ጕ"],["ጘ","ፚ"],["ᎀ","ᎏ"],["Ꭰ","Ᏽ"],["ᏸ","ᏽ"],["ᐁ","ᙬ"],["ᙯ","ᙿ"],["ᚁ","ᚚ"],["ᚠ","ᛪ"],["ᛮ","ᛸ"],["ᜀ","ᜌ"],["ᜎ","ᜑ"],["ᜠ","ᜱ"],["ᝀ","ᝑ"],["ᝠ","ᝬ"],["ᝮ","ᝰ"],["ក","ឳ"],"ៗ","ៜ",["ᠠ","ᡷ"],["ᢀ","ᢨ"],"ᢪ",["ᢰ","ᣵ"],["ᤀ","ᤞ"],["ᥐ","ᥭ"],["ᥰ","ᥴ"],["ᦀ","ᦫ"],["ᦰ","ᧉ"],["ᨀ","ᨖ"],["ᨠ","ᩔ"],"ᪧ",["ᬅ","ᬳ"],["ᭅ","ᭋ"],["ᮃ","ᮠ"],["ᮮ","ᮯ"],["ᮺ","ᯥ"],["ᰀ","ᰣ"],["ᱍ","ᱏ"],["ᱚ","ᱽ"],["ᳩ","ᳬ"],["ᳮ","ᳱ"],["ᳵ","ᳶ"],["ᴀ","ᶿ"],["Ḁ","ἕ"],["Ἐ","Ἕ"],["ἠ","ὅ"],["Ὀ","Ὅ"],["ὐ","ὗ"],"Ὑ","Ὓ","Ὕ",["Ὗ","ώ"],["ᾀ","ᾴ"],["ᾶ","ᾼ"],"ι",["ῂ","ῄ"],["ῆ","ῌ"],["ῐ","ΐ"],["ῖ","Ί"],["ῠ","Ῥ"],["ῲ","ῴ"],["ῶ","ῼ"],"ⁱ","ⁿ",["ₐ","ₜ"],"ℂ","ℇ",["ℊ","ℓ"],"ℕ",["ℙ","ℝ"],"ℤ","Ω","ℨ",["K","ℭ"],["ℯ","ℹ"],["ℼ","ℿ"],["ⅅ","ⅉ"],"ⅎ",["Ⅰ","ↈ"],["Ⰰ","Ⱞ"],["ⰰ","ⱞ"],["Ⱡ","ⳤ"],["Ⳬ","ⳮ"],["Ⳳ","ⳳ"],["ⴀ","ⴥ"],"ⴧ","ⴭ",["ⴰ","ⵧ"],"ⵯ",["ⶀ","ⶖ"],["ⶠ","ⶦ"],["ⶨ","ⶮ"],["ⶰ","ⶶ"],["ⶸ","ⶾ"],["ⷀ","ⷆ"],["ⷈ","ⷎ"],["ⷐ","ⷖ"],["ⷘ","ⷞ"],"ⸯ",["々","〇"],["〡","〩"],["〱","〵"],["〸","〼"],["ぁ","ゖ"],["ゝ","ゟ"],["ァ","ヺ"],["ー","ヿ"],["ㄅ","ㄭ"],["ㄱ","ㆎ"],["ㆠ","ㆺ"],["ㇰ","ㇿ"],["㐀","䶵"],["一","鿕"],["ꀀ","ꒌ"],["ꓐ","ꓽ"],["ꔀ","ꘌ"],["ꘐ","ꘟ"],["ꘪ","ꘫ"],["Ꙁ","ꙮ"],["ꙿ","ꚝ"],["ꚠ","ꛯ"],["ꜗ","ꜟ"],["Ꜣ","ꞈ"],["Ꞌ","Ɬ"],["Ʞ","ꞷ"],["ꟷ","ꠁ"],["ꠃ","ꠅ"],["ꠇ","ꠊ"],["ꠌ","ꠢ"],["ꡀ","ꡳ"],["ꢂ","ꢳ"],["ꣲ","ꣷ"],"ꣻ","ꣽ",["ꤊ","ꤥ"],["ꤰ","ꥆ"],["ꥠ","ꥼ"],["ꦄ","ꦲ"],"ꧏ",["ꧠ","ꧤ"],["ꧦ","ꧯ"],["ꧺ","ꧾ"],["ꨀ","ꨨ"],["ꩀ","ꩂ"],["ꩄ","ꩋ"],["ꩠ","ꩶ"],"ꩺ",["ꩾ","ꪯ"],"ꪱ",["ꪵ","ꪶ"],["ꪹ","ꪽ"],"ꫀ","ꫂ",["ꫛ","ꫝ"],["ꫠ","ꫪ"],["ꫲ","ꫴ"],["ꬁ","ꬆ"],["ꬉ","ꬎ"],["ꬑ","ꬖ"],["ꬠ","ꬦ"],["ꬨ","ꬮ"],["ꬰ","ꭚ"],["ꭜ","ꭥ"],["ꭰ","ꯢ"],["가","힣"],["ힰ","ퟆ"],["ퟋ","ퟻ"],["豈","舘"],["並","龎"],["ff","st"],["ﬓ","ﬗ"],"יִ",["ײַ","ﬨ"],["שׁ","זּ"],["טּ","לּ"],"מּ",["נּ","סּ"],["ףּ","פּ"],["צּ","ﮱ"],["ﯓ","ﴽ"],["ﵐ","ﶏ"],["ﶒ","ﷇ"],["ﷰ","ﷻ"],["ﹰ","ﹴ"],["ﹶ","ﻼ"],["A","Z"],["a","z"],["ヲ","ᄒ"],["ᅡ","ᅦ"],["ᅧ","ᅬ"],["ᅭ","ᅲ"],["ᅳ","ᅵ"]],!1,!1),Fe=or("\\",!1),Oe=sr(["$",["0","9"],"_",["̀","ͯ"],["҃","҇"],["֑","ֽ"],"ֿ",["ׁ","ׂ"],["ׄ","ׅ"],"ׇ",["ؐ","ؚ"],["ً","٩"],"ٰ",["ۖ","ۜ"],["۟","ۤ"],["ۧ","ۨ"],["۪","ۭ"],["۰","۹"],"ܑ",["ܰ","݊"],["ަ","ް"],["߀","߉"],["߫","߳"],["ࠖ","࠙"],["ࠛ","ࠣ"],["ࠥ","ࠧ"],["ࠩ","࠭"],["࡙","࡛"],["ࣣ","ः"],["ऺ","़"],["ा","ॏ"],["॑","ॗ"],["ॢ","ॣ"],["०","९"],["ঁ","ঃ"],"়",["া","ৄ"],["ে","ৈ"],["ো","্"],"ৗ",["ৢ","ৣ"],["০","৯"],["ਁ","ਃ"],"਼",["ਾ","ੂ"],["ੇ","ੈ"],["ੋ","੍"],"ੑ",["੦","ੱ"],"ੵ",["ઁ","ઃ"],"઼",["ા","ૅ"],["ે","ૉ"],["ો","્"],["ૢ","ૣ"],["૦","૯"],["ଁ","ଃ"],"଼",["ା","ୄ"],["େ","ୈ"],["ୋ","୍"],["ୖ","ୗ"],["ୢ","ୣ"],["୦","୯"],"ஂ",["ா","ூ"],["ெ","ை"],["ொ","்"],"ௗ",["௦","௯"],["ఀ","ః"],["ా","ౄ"],["ె","ై"],["ొ","్"],["ౕ","ౖ"],["ౢ","ౣ"],["౦","౯"],["ಁ","ಃ"],"಼",["ಾ","ೄ"],["ೆ","ೈ"],["ೊ","್"],["ೕ","ೖ"],["ೢ","ೣ"],["೦","೯"],["ഁ","ഃ"],["ാ","ൄ"],["െ","ൈ"],["ൊ","്"],"ൗ",["ൢ","ൣ"],["൦","൯"],["ං","ඃ"],"්",["ා","ු"],"ූ",["ෘ","ෟ"],["෦","෯"],["ෲ","ෳ"],"ั",["ิ","ฺ"],["็","๎"],["๐","๙"],"ັ",["ິ","ູ"],["ົ","ຼ"],["່","ໍ"],["໐","໙"],["༘","༙"],["༠","༩"],"༵","༷","༹",["༾","༿"],["ཱ","྄"],["྆","྇"],["ྍ","ྗ"],["ྙ","ྼ"],"࿆",["ါ","ှ"],["၀","၉"],["ၖ","ၙ"],["ၞ","ၠ"],["ၢ","ၤ"],["ၧ","ၭ"],["ၱ","ၴ"],["ႂ","ႍ"],["ႏ","ႝ"],["፝","፟"],["ᜒ","᜔"],["ᜲ","᜴"],["ᝒ","ᝓ"],["ᝲ","ᝳ"],["឴","៓"],"៝",["០","៩"],["᠋","᠍"],["᠐","᠙"],"ᢩ",["ᤠ","ᤫ"],["ᤰ","᤻"],["᥆","᥏"],["᧐","᧙"],["ᨗ","ᨛ"],["ᩕ","ᩞ"],["᩠","᩼"],["᩿","᪉"],["᪐","᪙"],["᪰","᪽"],["ᬀ","ᬄ"],["᬴","᭄"],["᭐","᭙"],["᭫","᭳"],["ᮀ","ᮂ"],["ᮡ","ᮭ"],["᮰","᮹"],["᯦","᯳"],["ᰤ","᰷"],["᱀","᱉"],["᱐","᱙"],["᳐","᳒"],["᳔","᳨"],"᳭",["ᳲ","᳴"],["᳸","᳹"],["᷀","᷵"],["᷼","᷿"],["",""],["‿","⁀"],"⁔",["⃐","⃜"],"⃡",["⃥","⃰"],["⳯","⳱"],"⵿",["ⷠ","ⷿ"],["〪","〯"],["゙","゚"],["꘠","꘩"],"꙯",["ꙴ","꙽"],["ꚞ","ꚟ"],["꛰","꛱"],"ꠂ","꠆","ꠋ",["ꠣ","ꠧ"],["ꢀ","ꢁ"],["ꢴ","꣄"],["꣐","꣙"],["꣠","꣱"],["꤀","꤉"],["ꤦ","꤭"],["ꥇ","꥓"],["ꦀ","ꦃ"],["꦳","꧀"],["꧐","꧙"],"ꧥ",["꧰","꧹"],["ꨩ","ꨶ"],"ꩃ",["ꩌ","ꩍ"],["꩐","꩙"],["ꩻ","ꩽ"],"ꪰ",["ꪲ","ꪴ"],["ꪷ","ꪸ"],["ꪾ","꪿"],"꫁",["ꫫ","ꫯ"],["ꫵ","꫶"],["ꯣ","ꯪ"],["꯬","꯭"],["꯰","꯹"],"ﬞ",["︀","️"],["︠","︯"],["︳","︴"],["﹍","﹏"],["0","9"],"_"],!1,!1),Be=cr("literal"),Me=or("i",!1),De=cr("string"),Ie=or('"',!1),ke=or("'",!1),je=sr(["\n","\r",'"',"\\",["\u2028","\u2029"]],!1,!1),Ne=sr(["\n","\r","'","\\",["\u2028","\u2029"]],!1,!1),Ue=cr("character class"),qe=or("[",!1),Ge=or("^",!1),He=or("]",!1),ze=or("-",!1),We=sr(["\n","\r",["\\","]"],["\u2028","\u2029"]],!1,!1),Ve=or("0",!1),Ye=sr(['"',"'","\\"],!1,!1),Qe=or("b",!1),Je=or("f",!1),Xe=or("n",!1),Ke=or("r",!1),Ze=or("t",!1),et=or("v",!1),tt=sr([["0","9"],"u","x"],!1,!1),rt=or("x",!1),at=or("u",!1),nt=sr([["0","9"]],!1,!1),ot=sr([["0","9"],["a","f"]],!1,!0),st=or(".",!1),ct=cr("code block"),it=sr(["{","}"],!1,!1),ut=or(";",!1),pt=function(e,t,r){return{type:"grammar",topLevelInitializer:e,initializer:t,rules:r,location:ar()}},lt=function(e){return{type:"top_level_initializer",code:e[0],codeLocation:e[1],location:ar()}},ft=function(e){return{type:"initializer",code:e[0],codeLocation:e[1],location:ar()}},gt=function(e,t,r){return{type:"rule",name:e[0],nameLocation:e[1],expression:null!==t?{type:"named",name:t,expression:r,location:ar()}:r,location:ar()}},dt=function(e,t){return t.length>0?{type:"choice",alternatives:[e].concat(t),location:ar()}:e},mt=function(e,t){return null!==t?{type:"action",expression:e,code:t[0],codeLocation:t[1],location:ar()}:e},$t=function(e,t){return t.length>0||"labeled"===e.type&&e.pick?{type:"sequence",elements:[e].concat(t),location:ar()}:e},ht=function(e,t,r){return r.type.startsWith("semantic_")&&nr('"@" cannot be used on a semantic predicate',e),{type:"labeled",label:null!==t?t[0]:null,labelLocation:null!==t?t[1]:e,pick:!0,expression:r,location:ar()}},xt=function(e,t){return{type:"labeled",label:e[0],labelLocation:e[1],expression:t,location:ar()}},bt=function(){return ar()},vt=function(e){return Wr.indexOf(e[0])>=0&&nr("Label can't be a reserved word \"".concat(e[0],'"'),e[1]),e},At=function(e,t){return{type:OPS_TO_PREFIXED_TYPES[e],expression:t,location:ar()}},yt=function(e,t){return{type:OPS_TO_SUFFIXED_TYPES[t],expression:e,location:ar()}},St=function(e,t,r){var a=t[0],n=t[1];return"constant"===n.type&&0===n.value&&nr("The maximum count of repetitions of the rule must be > 0",n.location),{type:"repeated",min:a,max:n,expression:e,delimiter:r,location:ar()}},_t=function(e,t){return[null!==e?e:{type:"constant",value:0},null!==t?t:{type:"constant",value:null}]},Et=function(e){return[null,e]},Tt=function(e){return{type:"constant",value:e,location:ar()}},Ct=function(e){return{type:"variable",value:e[0],location:ar()}},Pt=function(e){return{type:"function",value:e[0],codeLocation:e[1],location:ar()}},wt=function(e){return"labeled"===e.type||"sequence"===e.type?{type:"group",expression:e,location:ar()}:e},Rt=function(e){return{type:"rule_ref",name:e[0],location:ar()}},Lt=function(e,t){return{type:OPS_TO_SEMANTIC_PREDICATE_TYPES[e],code:t[0],codeLocation:t[1],location:ar()}},Ft=function(e,t){return[e+t.join(""),ar()]},Ot=function(e,t){return{type:"literal",value:e,ignoreCase:null!==t,location:ar()}},Bt=function(e){return e.join("")},Mt=function(e){return e.join("")},Dt=function(e,t,r){return{type:"class",parts:t.filter((function(e){return""!==e})),inverted:null!==e,ignoreCase:null!==r,location:ar()}},It=function(t,r){return t.charCodeAt(0)>r.charCodeAt(0)&&nr("Invalid character range: "+e.substring(Kt,Xt)+"."),[t,r]},kt=function(){return""},jt=function(){return"\0"},Nt=function(){return"\b"},Ut=function(){return"\f"},qt=function(){return"\n"},Gt=function(){return"\r"},Ht=function(){return"\t"},zt=function(){return"\v"},Wt=function(e){return String.fromCharCode(parseInt(e,16))},Vt=function(e){return String.fromCharCode(parseInt(e,16))},Yt=function(){return{type:"any",location:ar()}},Qt=function(e){return[e,ar()]},Jt=function(e){return parseInt(e,10)},Xt=0,Kt=0,Zt=[{line:1,column:1}],er=0,tr=[],rr=0;if("startRule"in t){if(!(t.startRule in o))throw new Error("Can't start parsing from rule \""+t.startRule+'".');s=o[t.startRule]}function ar(){return ur(Kt,Xt)}function nr(e,t){throw function(e,t){return new peg$SyntaxError(e,null,null,t)}(e,t=void 0!==t?t:ur(Kt,Xt))}function or(e,t){return{type:"literal",text:e,ignoreCase:t}}function sr(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function cr(e){return{type:"other",description:e}}function ir(t){var r,a=Zt[t];if(a)return a;if(t>=Zt.length)r=Zt.length-1;else for(r=t;!Zt[--r];);for(a={line:(a=Zt[r]).line,column:a.column};r<t;)10===e.charCodeAt(r)?(a.line++,a.column=1):a.column++,r++;return Zt[t]=a,a}function ur(e,t,r){var a=ir(e),o=ir(t),s={source:n,start:{offset:e,line:a.line,column:a.column},end:{offset:t,line:o.line,column:o.column}};return r&&n&&"function"==typeof n.offset&&(s.start=n.offset(s.start),s.end=n.offset(s.end)),s}function pr(e){Xt<er||(Xt>er&&(er=Xt,tr=[]),tr.push(e))}function lr(){var t,r,n,o,s,u;if(t=Xt,Hr(),r=Xt,n=function(){var t,r,n,o;return t=Xt,123===e.charCodeAt(Xt)?(r=c,Xt++):(r=a,0===rr&&pr(ne)),r!==a&&(n=qr())!==a?(125===e.charCodeAt(Xt)?(o=i,Xt++):(o=a,0===rr&&pr(oe)),o!==a&&zr()!==a?(Kt=t,t=lt(n)):(Xt=t,t=a)):(Xt=t,t=a),t}(),n!==a?(o=Hr(),r=n):(Xt=r,r=a),r===a&&(r=null),n=Xt,o=function(){var e,t;return e=Xt,(t=qr())!==a&&zr()!==a?(Kt=e,e=ft(t)):(Xt=e,e=a),e}(),o!==a?(s=Hr(),n=o):(Xt=n,n=a),n===a&&(n=null),o=[],s=Xt,(u=fr())!==a?(Hr(),s=u):(Xt=s,s=a),s!==a)for(;s!==a;)o.push(s),s=Xt,(u=fr())!==a?(Hr(),s=u):(Xt=s,s=a);else o=a;return o!==a?(Kt=t,t=pt(r,n,o)):(Xt=t,t=a),t}function fr(){var t,r,n,o,s;return t=Xt,(r=Pr())!==a?(Hr(),n=Xt,(o=Lr())!==a?(Hr(),n=o):(Xt=n,n=a),n===a&&(n=null),61===e.charCodeAt(Xt)?(o=u,Xt++):(o=a,0===rr&&pr(se)),o!==a?(Hr(),(s=gr())!==a&&zr()!==a?(Kt=t,t=gt(r,n,s)):(Xt=t,t=a)):(Xt=t,t=a)):(Xt=t,t=a),t}function gr(){var t,r,n,o,s,c;if(t=Xt,(r=dr())!==a){for(n=[],o=Xt,Hr(),47===e.charCodeAt(Xt)?(s=p,Xt++):(s=a,0===rr&&pr(ce)),s!==a?(Hr(),(c=dr())!==a?o=c:(Xt=o,o=a)):(Xt=o,o=a);o!==a;)n.push(o),o=Xt,Hr(),47===e.charCodeAt(Xt)?(s=p,Xt++):(s=a,0===rr&&pr(ce)),s!==a?(Hr(),(c=dr())!==a?o=c:(Xt=o,o=a)):(Xt=o,o=a);Kt=t,t=dt(r,n)}else Xt=t,t=a;return t}function dr(){var e,t,r,n;return e=Xt,t=function(){var e,t,r,n,o;if(e=Xt,(t=mr())!==a){for(r=[],n=Xt,Hr(),(o=mr())!==a?n=o:(Xt=n,n=a);n!==a;)r.push(n),n=Xt,Hr(),(o=mr())!==a?n=o:(Xt=n,n=a);Kt=e,e=$t(t,r)}else Xt=e,e=a;return e}(),t!==a?(r=Xt,Hr(),(n=qr())!==a?r=n:(Xt=r,r=a),r===a&&(r=null),Kt=e,e=mt(t,r)):(Xt=e,e=a),e}function mr(){var t,r,n,o;return t=Xt,r=function(){var t,r;return t=Xt,64===e.charCodeAt(Xt)?(r=l,Xt++):(r=a,0===rr&&pr(ie)),r!==a&&(Kt=t,r=bt()),t=r}(),r!==a?((n=$r())===a&&(n=null),(o=hr())!==a?(Kt=t,t=ht(r,n,o)):(Xt=t,t=a)):(Xt=t,t=a),t===a&&(t=Xt,(r=$r())!==a?(n=Hr(),(o=hr())!==a?(Kt=t,t=xt(r,o)):(Xt=t,t=a)):(Xt=t,t=a),t===a&&(t=hr())),t}function $r(){var t,r,n;return t=Xt,(r=Pr())!==a?(Hr(),58===e.charCodeAt(Xt)?(n=f,Xt++):(n=a,0===rr&&pr(ue)),n!==a?(Kt=t,t=vt(r)):(Xt=t,t=a)):(Xt=t,t=a),t}function hr(){var t,r,n;return t=Xt,r=function(){var t;return t=e.charAt(Xt),q.test(t)?Xt++:(t=a,0===rr&&pr(pe)),t}(),r!==a?(Hr(),(n=xr())!==a?(Kt=t,t=At(r,n)):(Xt=t,t=a)):(Xt=t,t=a),t===a&&(t=xr()),t}function xr(){var t,r,n;return t=Xt,(r=vr())!==a?(Hr(),n=function(){var t;return t=e.charAt(Xt),G.test(t)?Xt++:(t=a,0===rr&&pr(le)),t}(),n!==a?(Kt=t,t=yt(r,n)):(Xt=t,t=a)):(Xt=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Xt,(r=vr())!==a?(Hr(),124===e.charCodeAt(Xt)?(n=g,Xt++):(n=a,0===rr&&pr(fe)),n!==a?(Hr(),o=function(){var t,r,n,o;return t=Xt,(r=br())===a&&(r=null),Hr(),e.substr(Xt,2)===m?(n=m,Xt+=2):(n=a,0===rr&&pr(de)),n!==a?(Hr(),(o=br())===a&&(o=null),Kt=t,t=_t(r,o)):(Xt=t,t=a),t===a&&(t=Xt,(r=br())!==a&&(Kt=t,r=Et(r)),t=r),t}(),o!==a?(Hr(),s=Xt,44===e.charCodeAt(Xt)?(c=d,Xt++):(c=a,0===rr&&pr(ge)),c!==a?(Hr(),(i=gr())!==a?(Hr(),s=i):(Xt=s,s=a)):(Xt=s,s=a),s===a&&(s=null),124===e.charCodeAt(Xt)?(c=g,Xt++):(c=a,0===rr&&pr(fe)),c!==a?(Kt=t,t=St(r,o,s)):(Xt=t,t=a)):(Xt=t,t=a)):(Xt=t,t=a)):(Xt=t,t=a),t}(),t===a&&(t=vr())),t}function br(){var t,r;return t=Xt,r=function(){var t,r,n,o;if(t=Xt,r=Xt,n=[],(o=Nr())!==a)for(;o!==a;)n.push(o),o=Nr();else n=a;return(r=n!==a?e.substring(r,Xt):n)!==a&&(Kt=t,r=Jt(r)),t=r}(),r!==a&&(Kt=t,r=Tt(r)),(t=r)===a&&(t=Xt,(r=Pr())!==a&&(Kt=t,r=Ct(r)),(t=r)===a&&(t=Xt,(r=qr())!==a&&(Kt=t,r=Pt(r)),t=r)),t}function vr(){var t,r,n,o;return t=function(){var t,r,n;return rr++,t=Xt,(r=Lr())!==a?(105===e.charCodeAt(Xt)?(n=_,Xt++):(n=a,0===rr&&pr(Me)),n===a&&(n=null),Kt=t,t=Ot(r,n)):(Xt=t,t=a),rr--,t===a&&(r=a,0===rr&&pr(Be)),t}(),t===a&&(t=function(){var t,r,n,o,s,c;if(rr++,t=Xt,91===e.charCodeAt(Xt)?(r=C,Xt++):(r=a,0===rr&&pr(qe)),r!==a){for(94===e.charCodeAt(Xt)?(n=P,Xt++):(n=a,0===rr&&pr(Ge)),n===a&&(n=null),o=[],(s=Br())===a&&(s=Mr());s!==a;)o.push(s),(s=Br())===a&&(s=Mr());93===e.charCodeAt(Xt)?(s=w,Xt++):(s=a,0===rr&&pr(He)),s!==a?(105===e.charCodeAt(Xt)?(c=_,Xt++):(c=a,0===rr&&pr(Me)),c===a&&(c=null),Kt=t,t=Dt(n,o,c)):(Xt=t,t=a)}else Xt=t,t=a;return rr--,t===a&&(r=a,0===rr&&pr(Ue)),t}(),t===a&&(t=function(){var t,r;return t=Xt,46===e.charCodeAt(Xt)?(r=N,Xt++):(r=a,0===rr&&pr(st)),r!==a&&(Kt=t,r=Yt()),t=r}(),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Xt,(r=Pr())!==a?(n=Xt,rr++,o=Xt,s=Hr(),c=Xt,(i=Lr())!==a?c=i=[i,Hr()]:(Xt=c,c=a),c===a&&(c=null),61===e.charCodeAt(Xt)?(i=u,Xt++):(i=a,0===rr&&pr(se)),i!==a?o=s=[s,c,i]:(Xt=o,o=a),rr--,o===a?n=void 0:(Xt=n,n=a),n!==a?(Kt=t,t=Rt(r)):(Xt=t,t=a)):(Xt=t,t=a),t}(),t===a&&(t=function(){var t,r,n;return t=Xt,r=function(){var t;return t=e.charAt(Xt),H.test(t)?Xt++:(t=a,0===rr&&pr(he)),t}(),r!==a?(Hr(),(n=qr())!==a?(Kt=t,t=Lt(r,n)):(Xt=t,t=a)):(Xt=t,t=a),t}(),t===a&&(t=Xt,40===e.charCodeAt(Xt)?(r=$,Xt++):(r=a,0===rr&&pr(me)),r!==a?(Hr(),(n=gr())!==a?(Hr(),41===e.charCodeAt(Xt)?(o=h,Xt++):(o=a,0===rr&&pr($e)),o!==a?(Kt=t,t=wt(n)):(Xt=t,t=a)):(Xt=t,t=a)):(Xt=t,t=a)))))),t}function Ar(){var t;return e.length>Xt?(t=e.charAt(Xt),Xt++):(t=a,0===rr&&pr(xe)),t}function yr(){var t;return rr++,t=e.charAt(Xt),z.test(t)?Xt++:(t=a,0===rr&&pr(ve)),rr--,t===a&&0===rr&&pr(be),t}function Sr(){var t;return t=e.charAt(Xt),W.test(t)?Xt++:(t=a,0===rr&&pr(Ae)),t}function _r(){var t;return rr++,10===e.charCodeAt(Xt)?(t=x,Xt++):(t=a,0===rr&&pr(Se)),t===a&&(e.substr(Xt,2)===b?(t=b,Xt+=2):(t=a,0===rr&&pr(_e)),t===a&&(t=e.charAt(Xt),V.test(t)?Xt++:(t=a,0===rr&&pr(Ee)))),rr--,t===a&&0===rr&&pr(ye),t}function Er(){var t;return rr++,(t=function(){var t,r,n,o,s,c;if(t=Xt,e.substr(Xt,2)===v?(r=v,Xt+=2):(r=a,0===rr&&pr(Ce)),r!==a){for(n=[],o=Xt,s=Xt,rr++,e.substr(Xt,2)===A?(c=A,Xt+=2):(c=a,0===rr&&pr(Pe)),rr--,c===a?s=void 0:(Xt=s,s=a),s!==a&&(c=Ar())!==a?o=s=[s,c]:(Xt=o,o=a);o!==a;)n.push(o),o=Xt,s=Xt,rr++,e.substr(Xt,2)===A?(c=A,Xt+=2):(c=a,0===rr&&pr(Pe)),rr--,c===a?s=void 0:(Xt=s,s=a),s!==a&&(c=Ar())!==a?o=s=[s,c]:(Xt=o,o=a);e.substr(Xt,2)===A?(o=A,Xt+=2):(o=a,0===rr&&pr(Pe)),o!==a?t=r=[r,n,o]:(Xt=t,t=a)}else Xt=t,t=a;return t}())===a&&(t=Cr()),rr--,t===a&&0===rr&&pr(Te),t}function Tr(){var t,r,n,o,s,c;if(t=Xt,e.substr(Xt,2)===v?(r=v,Xt+=2):(r=a,0===rr&&pr(Ce)),r!==a){for(n=[],o=Xt,s=Xt,rr++,e.substr(Xt,2)===A?(c=A,Xt+=2):(c=a,0===rr&&pr(Pe)),c===a&&(c=Sr()),rr--,c===a?s=void 0:(Xt=s,s=a),s!==a&&(c=Ar())!==a?o=s=[s,c]:(Xt=o,o=a);o!==a;)n.push(o),o=Xt,s=Xt,rr++,e.substr(Xt,2)===A?(c=A,Xt+=2):(c=a,0===rr&&pr(Pe)),c===a&&(c=Sr()),rr--,c===a?s=void 0:(Xt=s,s=a),s!==a&&(c=Ar())!==a?o=s=[s,c]:(Xt=o,o=a);e.substr(Xt,2)===A?(o=A,Xt+=2):(o=a,0===rr&&pr(Pe)),o!==a?t=r=[r,n,o]:(Xt=t,t=a)}else Xt=t,t=a;return t}function Cr(){var t,r,n,o,s,c;if(t=Xt,e.substr(Xt,2)===y?(r=y,Xt+=2):(r=a,0===rr&&pr(we)),r!==a){for(n=[],o=Xt,s=Xt,rr++,c=Sr(),rr--,c===a?s=void 0:(Xt=s,s=a),s!==a&&(c=Ar())!==a?o=s=[s,c]:(Xt=o,o=a);o!==a;)n.push(o),o=Xt,s=Xt,rr++,c=Sr(),rr--,c===a?s=void 0:(Xt=s,s=a),s!==a&&(c=Ar())!==a?o=s=[s,c]:(Xt=o,o=a);t=r=[r,n]}else Xt=t,t=a;return t}function Pr(){var e,t,r,n;if(rr++,e=Xt,(t=wr())!==a){for(r=[],n=Rr();n!==a;)r.push(n),n=Rr();Kt=e,e=Ft(t,r)}else Xt=e,e=a;return rr--,e===a&&(t=a,0===rr&&pr(Re)),e}function wr(){var t,r,n;return t=e.charAt(Xt),Y.test(t)?Xt++:(t=a,0===rr&&pr(Le)),t===a&&(t=Xt,92===e.charCodeAt(Xt)?(r=S,Xt++):(r=a,0===rr&&pr(Fe)),r!==a&&(n=jr())!==a?t=n:(Xt=t,t=a)),t}function Rr(){var t;return(t=wr())===a&&(t=e.charAt(Xt),Q.test(t)?Xt++:(t=a,0===rr&&pr(Oe))),t}function Lr(){var t,r,n,o;if(rr++,t=Xt,34===e.charCodeAt(Xt)?(r=E,Xt++):(r=a,0===rr&&pr(Ie)),r!==a){for(n=[],o=Fr();o!==a;)n.push(o),o=Fr();34===e.charCodeAt(Xt)?(o=E,Xt++):(o=a,0===rr&&pr(Ie)),o!==a?(Kt=t,t=Bt(n)):(Xt=t,t=a)}else Xt=t,t=a;if(t===a)if(t=Xt,39===e.charCodeAt(Xt)?(r=T,Xt++):(r=a,0===rr&&pr(ke)),r!==a){for(n=[],o=Or();o!==a;)n.push(o),o=Or();39===e.charCodeAt(Xt)?(o=T,Xt++):(o=a,0===rr&&pr(ke)),o!==a?(Kt=t,t=Mt(n)):(Xt=t,t=a)}else Xt=t,t=a;return rr--,t===a&&(r=a,0===rr&&pr(De)),t}function Fr(){var t,r,n,o;return t=Xt,r=Xt,n=Xt,rr++,o=e.charAt(Xt),J.test(o)?Xt++:(o=a,0===rr&&pr(je)),rr--,o===a?n=void 0:(Xt=n,n=a),n!==a&&(o=Ar())!==a?r=n=[n,o]:(Xt=r,r=a),(t=r!==a?e.substring(t,Xt):r)===a&&(t=Xt,92===e.charCodeAt(Xt)?(r=S,Xt++):(r=a,0===rr&&pr(Fe)),r!==a&&(n=Ir())!==a?t=n:(Xt=t,t=a),t===a&&(t=Dr())),t}function Or(){var t,r,n,o;return t=Xt,r=Xt,n=Xt,rr++,o=e.charAt(Xt),X.test(o)?Xt++:(o=a,0===rr&&pr(Ne)),rr--,o===a?n=void 0:(Xt=n,n=a),n!==a&&(o=Ar())!==a?r=n=[n,o]:(Xt=r,r=a),(t=r!==a?e.substring(t,Xt):r)===a&&(t=Xt,92===e.charCodeAt(Xt)?(r=S,Xt++):(r=a,0===rr&&pr(Fe)),r!==a&&(n=Ir())!==a?t=n:(Xt=t,t=a),t===a&&(t=Dr())),t}function Br(){var t,r,n,o;return t=Xt,(r=Mr())!==a?(45===e.charCodeAt(Xt)?(n=R,Xt++):(n=a,0===rr&&pr(ze)),n!==a&&(o=Mr())!==a?(Kt=t,t=It(r,o)):(Xt=t,t=a)):(Xt=t,t=a),t}function Mr(){var t,r,n,o;return t=Xt,r=Xt,n=Xt,rr++,o=e.charAt(Xt),K.test(o)?Xt++:(o=a,0===rr&&pr(We)),rr--,o===a?n=void 0:(Xt=n,n=a),n!==a&&(o=Ar())!==a?r=n=[n,o]:(Xt=r,r=a),(t=r!==a?e.substring(t,Xt):r)===a&&(t=Xt,92===e.charCodeAt(Xt)?(r=S,Xt++):(r=a,0===rr&&pr(Fe)),r!==a&&(n=Ir())!==a?t=n:(Xt=t,t=a),t===a&&(t=Dr())),t}function Dr(){var t,r;return t=Xt,92===e.charCodeAt(Xt)?(r=S,Xt++):(r=a,0===rr&&pr(Fe)),r!==a&&_r()!==a?(Kt=t,t=kt()):(Xt=t,t=a),t}function Ir(){var t,r,n,o;return t=function(){var t;return(t=kr())===a&&(t=function(){var t,r,n,o;return t=Xt,r=Xt,n=Xt,rr++,o=function(){var t;return(t=kr())===a&&(t=e.charAt(Xt),ee.test(t)?Xt++:(t=a,0===rr&&pr(tt))),t}(),o===a&&(o=Sr()),rr--,o===a?n=void 0:(Xt=n,n=a),n!==a&&(o=Ar())!==a?r=n=[n,o]:(Xt=r,r=a),t=r!==a?e.substring(t,Xt):r}()),t}(),t===a&&(t=Xt,48===e.charCodeAt(Xt)?(r=L,Xt++):(r=a,0===rr&&pr(Ve)),r!==a?(n=Xt,rr++,o=Nr(),rr--,o===a?n=void 0:(Xt=n,n=a),n!==a?(Kt=t,t=jt()):(Xt=t,t=a)):(Xt=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c;return t=Xt,120===e.charCodeAt(Xt)?(r=k,Xt++):(r=a,0===rr&&pr(rt)),r!==a?(n=Xt,o=Xt,(s=Ur())!==a&&(c=Ur())!==a?o=s=[s,c]:(Xt=o,o=a),(n=o!==a?e.substring(n,Xt):o)!==a?(Kt=t,t=Wt(n)):(Xt=t,t=a)):(Xt=t,t=a),t}(),t===a&&(t=jr()))),t}function kr(){var t,r;return t=e.charAt(Xt),Z.test(t)?Xt++:(t=a,0===rr&&pr(Ye)),t===a&&(t=Xt,98===e.charCodeAt(Xt)?(r=F,Xt++):(r=a,0===rr&&pr(Qe)),r!==a&&(Kt=t,r=Nt()),(t=r)===a&&(t=Xt,102===e.charCodeAt(Xt)?(r=O,Xt++):(r=a,0===rr&&pr(Je)),r!==a&&(Kt=t,r=Ut()),(t=r)===a&&(t=Xt,110===e.charCodeAt(Xt)?(r=B,Xt++):(r=a,0===rr&&pr(Xe)),r!==a&&(Kt=t,r=qt()),(t=r)===a&&(t=Xt,114===e.charCodeAt(Xt)?(r=M,Xt++):(r=a,0===rr&&pr(Ke)),r!==a&&(Kt=t,r=Gt()),(t=r)===a&&(t=Xt,116===e.charCodeAt(Xt)?(r=D,Xt++):(r=a,0===rr&&pr(Ze)),r!==a&&(Kt=t,r=Ht()),(t=r)===a&&(t=Xt,118===e.charCodeAt(Xt)?(r=I,Xt++):(r=a,0===rr&&pr(et)),r!==a&&(Kt=t,r=zt()),t=r)))))),t}function jr(){var t,r,n,o,s,c,i,u;return t=Xt,117===e.charCodeAt(Xt)?(r=j,Xt++):(r=a,0===rr&&pr(at)),r!==a?(n=Xt,o=Xt,(s=Ur())!==a&&(c=Ur())!==a&&(i=Ur())!==a&&(u=Ur())!==a?o=s=[s,c,i,u]:(Xt=o,o=a),(n=o!==a?e.substring(n,Xt):o)!==a?(Kt=t,t=Vt(n)):(Xt=t,t=a)):(Xt=t,t=a),t}function Nr(){var t;return t=e.charAt(Xt),te.test(t)?Xt++:(t=a,0===rr&&pr(nt)),t}function Ur(){var t;return t=e.charAt(Xt),re.test(t)?Xt++:(t=a,0===rr&&pr(ot)),t}function qr(){var t,r,n,o;return rr++,t=Xt,123===e.charCodeAt(Xt)?(r=c,Xt++):(r=a,0===rr&&pr(ne)),r!==a?(n=function(){var e,t;return e=Xt,t=Gr(),Kt=e,e=t=Qt(t)}(),125===e.charCodeAt(Xt)?(o=i,Xt++):(o=a,0===rr&&pr(oe)),o!==a?t=n:(Xt=t,t=a)):(Xt=t,t=a),rr--,t===a&&(r=a,0===rr&&pr(ct)),t}function Gr(){var t,r,n,o,s,u;if(t=Xt,r=[],n=[],o=Xt,s=Xt,rr++,u=e.charAt(Xt),ae.test(u)?Xt++:(u=a,0===rr&&pr(it)),rr--,u===a?s=void 0:(Xt=s,s=a),s!==a&&(u=Ar())!==a?o=s=[s,u]:(Xt=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Xt,s=Xt,rr++,u=e.charAt(Xt),ae.test(u)?Xt++:(u=a,0===rr&&pr(it)),rr--,u===a?s=void 0:(Xt=s,s=a),s!==a&&(u=Ar())!==a?o=s=[s,u]:(Xt=o,o=a);else n=a;for(n===a&&(n=Xt,123===e.charCodeAt(Xt)?(o=c,Xt++):(o=a,0===rr&&pr(ne)),o!==a?(s=Gr(),125===e.charCodeAt(Xt)?(u=i,Xt++):(u=a,0===rr&&pr(oe)),u!==a?n=o=[o,s,u]:(Xt=n,n=a)):(Xt=n,n=a));n!==a;){if(r.push(n),n=[],o=Xt,s=Xt,rr++,u=e.charAt(Xt),ae.test(u)?Xt++:(u=a,0===rr&&pr(it)),rr--,u===a?s=void 0:(Xt=s,s=a),s!==a&&(u=Ar())!==a?o=s=[s,u]:(Xt=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Xt,s=Xt,rr++,u=e.charAt(Xt),ae.test(u)?Xt++:(u=a,0===rr&&pr(it)),rr--,u===a?s=void 0:(Xt=s,s=a),s!==a&&(u=Ar())!==a?o=s=[s,u]:(Xt=o,o=a);else n=a;n===a&&(n=Xt,123===e.charCodeAt(Xt)?(o=c,Xt++):(o=a,0===rr&&pr(ne)),o!==a?(s=Gr(),125===e.charCodeAt(Xt)?(u=i,Xt++):(u=a,0===rr&&pr(oe)),u!==a?n=o=[o,s,u]:(Xt=n,n=a)):(Xt=n,n=a))}return e.substring(t,Xt)}function Hr(){var e,t;for(e=[],(t=yr())===a&&(t=_r())===a&&(t=Er());t!==a;)e.push(t),(t=yr())===a&&(t=_r())===a&&(t=Er());return e}function zr(){var t,r,n,o;if(t=[],r=Xt,n=Hr(),59===e.charCodeAt(Xt)?(o=U,Xt++):(o=a,0===rr&&pr(ut)),o!==a?r=n=[n,o]:(Xt=r,r=a),r!==a)for(;r!==a;)t.push(r),r=Xt,n=Hr(),59===e.charCodeAt(Xt)?(o=U,Xt++):(o=a,0===rr&&pr(ut)),o!==a?r=n=[n,o]:(Xt=r,r=a);else t=a;return t===a&&(t=Xt,r=function(){var e,t;for(e=[],(t=yr())===a&&(t=Tr());t!==a;)e.push(t),(t=yr())===a&&(t=Tr());return e}(),(n=Cr())===a&&(n=null),(o=_r())!==a?t=r=[r,n,o]:(Xt=t,t=a),t===a&&(t=Xt,r=Hr(),n=function(){var t,r;return t=Xt,rr++,e.length>Xt?(r=e.charAt(Xt),Xt++):(r=a,0===rr&&pr(xe)),rr--,r===a?t=void 0:(Xt=t,t=a),t}(),n!==a?t=r=[r,n]:(Xt=t,t=a))),t}var Wr=t.reservedWords||[];if((r=s())!==a&&Xt===e.length)return r;throw r!==a&&Xt<e.length&&pr({type:"end"}),function(e,t,r){return new peg$SyntaxError(peg$SyntaxError.buildMessage(e,t),e,t,r)}(tr,er<e.length?e.charAt(er):null,er<e.length?ur(er,er+1):ur(er,er))}peg$subclass(peg$SyntaxError,Error),peg$SyntaxError.prototype.format=function(e){var t="Error: "+this.message;if(this.location){var r,a=null;for(r=0;r<e.length;r++)if(e[r].source===this.location.source){a=e[r].text.split(/\r\n|\n|\r/g);break}var n=this.location.start,o=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(n):n,s=this.location.source+":"+o.line+":"+o.column;if(a){var c=this.location.end,i=peg$padEnd("",o.line.toString().length," "),u=a[n.line-1],p=(n.line===c.line?c.column:u.length+1)-n.column||1;t+="\n --\x3e "+s+"\n"+i+" |\n"+o.line+" | "+u+"\n"+i+" | "+peg$padEnd("",n.column-1," ")+peg$padEnd("",p,"^")}else t+="\n at "+s}return t},peg$SyntaxError.buildMessage=function(e,t){var r={literal:function(e){return'"'+n(e.text)+'"'},class:function(e){var t=e.parts.map((function(e){return Array.isArray(e)?o(e[0])+"-"+o(e[1]):o(e)}));return"["+(e.inverted?"^":"")+t.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(e){return e.description}};function a(e){return e.charCodeAt(0).toString(16).toUpperCase()}function n(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+a(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+a(e)}))}function o(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+a(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+a(e)}))}function s(e){return r[e.type](e)}return"Expected "+function(e){var t,r,a=e.map(s);if(a.sort(),a.length>0){for(t=1,r=1;t<a.length;t++)a[t-1]!==a[t]&&(a[r]=a[t],r++);a.length=r}switch(a.length){case 1:return a[0];case 2:return a[0]+" or "+a[1];default:return a.slice(0,-1).join(", ")+", or "+a[a.length-1]}}(e)+" but "+function(e){return e?'"'+n(e)+'"':"end of input"}(t)+" found."};var parser$4={SyntaxError:peg$SyntaxError,parse:peg$parse},GrammarError$2=grammarError,GrammarLocation$1=grammarLocation,compiler$1=compiler_1,parser$3=parser$4,VERSION=version$1,RESERVED_WORDS=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","null","true","false","enum","implements","interface","let","package","private","protected","public","static","yield","await","arguments","eval"],peg$4={VERSION:VERSION,RESERVED_WORDS:RESERVED_WORDS,GrammarError:GrammarError$2,GrammarLocation:GrammarLocation$1,parser:parser$3,compiler:compiler$1,generate:function(e,t){var r,a,n="plugins"in(t=void 0!==t?t:{})?t.plugins:[],o={parser:peg$4.parser,passes:(r=peg$4.compiler.passes,a={},Object.keys(r).forEach((function(e){a[e]=r[e].slice()})),a),reservedWords:peg$4.RESERVED_WORDS.slice()};return n.forEach((function(e){e.use(o,t)})),peg$4.compiler.compile(o.parser.parse(e,{grammarSource:t.grammarSource,reservedWords:o.reservedWords}),o.passes,t)}},peg_1=peg$4,utils={},chai$k=require$$0,Call=function(){function e(e){this.args=e}return e.prototype.calledWithExactly=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return chai$k.util.eql(this.args,e)},e}();function dummy(){function e(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];e.callCount++,e.called=!0,e.calls.push(new Call(t))}return e.called=!1,e.callCount=0,e.calls=[],e.getCall=function(t){return e.calls[t]},e}utils.spy=function(){return dummy()},utils.stub=function(e,t){var r=e[t],a=dummy();return e[t]=a,a.restore=function(){e[t]=r},r};var chai$j=require$$0,peg$3=peg_1,_a$2=utils,spy$1=_a$2.spy,stub$1=_a$2.stub,expect$j=chai$j.expect;describe("generated parser API",(function(){describe("parse",(function(){it("parses input",(function(){var e=peg$3.generate("start = 'a'");expect$j(e.parse("a")).to.equal("a")})),it("throws an exception on syntax error",(function(){var e=peg$3.generate("start = 'a'");expect$j((function(){e.parse("b")})).to.throw()})),it("correctly describe character class in syntax error",(function(){var e=peg$3.generate("start = [123-5]");expect$j((function(){e.parse("0")})).to.throw("[123-5]")})),describe("start rule",(function(){var e=peg$3.generate(["a = 'x' { return 'a'; }","b = 'x' { return 'b'; }","c = 'x' { return 'c'; }"].join("\n"),{allowedStartRules:["b","c"]});describe("when |startRule| is not set",(function(){it("starts parsing from the first allowed rule",(function(){expect$j(e.parse("x")).to.equal("b")}))})),describe("when |startRule| is set to an allowed rule",(function(){it("starts parsing from specified rule",(function(){expect$j(e.parse("x",{startRule:"b"})).to.equal("b"),expect$j(e.parse("x",{startRule:"c"})).to.equal("c")}))})),describe("when |startRule| is set to a disallowed start rule",(function(){it("throws an exception",(function(){expect$j((function(){e.parse("x",{startRule:"a"})})).to.throw()}))}))})),describe("tracing",(function(){var e=peg$3.generate(["start = a / b","a = 'a'i","b = 'b'"].join("\n"),{trace:!0});describe("default tracer",(function(){it("traces using console.log (if console is defined)",(function(){var t=["1:1-1:1 rule.enter start","1:1-1:1 rule.enter a","1:1-1:1 rule.fail a","1:1-1:1 rule.enter b","1:1-1:2 rule.match b","1:1-1:2 rule.match start"];"object"==typeof console&&stub$1(console,"log");try{e.parse("b"),"object"==typeof console&&(expect$j(console.log.callCount).to.equal(t.length),t.forEach((function(e,t){var r=console.log.getCall(t);expect$j(r.calledWithExactly(e)).to.equal(!0)})))}finally{"object"==typeof console&&console.log.restore()}}))})),describe("custom tracers",(function(){describe("trace",(function(){it("receives tracing events",(function(){var t=[{type:"rule.enter",rule:"start",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1}}},{type:"rule.enter",rule:"a",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1}}},{type:"rule.fail",rule:"a",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1}}},{type:"rule.enter",rule:"b",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1}}},{type:"rule.match",rule:"b",result:"b",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:1,line:1,column:2}}},{type:"rule.match",rule:"start",result:"b",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:1,line:1,column:2}}}],r={trace:spy$1()};e.parse("b",{tracer:r}),expect$j(r.trace.callCount).to.equal(t.length),t.forEach((function(e,t){var a=r.trace.getCall(t);expect$j(a.calledWithExactly(e)).to.equal(!0)}))}))}))}))})),it("accepts custom options",(function(){peg$3.generate("start = 'a'").parse("a",{foo:42})}))}))}));var name="peggy",version="3.0.2",description="Parser generator for JavaScript",keywords=["grammar","parser generator","PEG","PEG.js"],homepage="https://peggyjs.org/",repository="peggyjs/peggy",bugs="https://github.com/peggyjs/peggy/issues",license="MIT",author="David Majda <david@majda.cz> (https://majda.cz/)",main="lib/peg.js",browser="browser/peggy.min.js",unpkg="browser/peggy.min.js",jsdelivr="browser/peggy.min.js",types="lib/peg.d.ts",bin={peggy:"bin/peggy.js"},scripts={clean:"rimraf build browser bin/*.map && mkdir browser",parser:"node bin/peggy.js -o lib/parser.js --format commonjs src/parser.pegjs",examples:"node bin/peggy.js -c docs/js/options.js docs/js/examples.peggy",set_version:"node ./tools/set_version",lint:"eslint . --ext js,ts,mjs",ts:"tsc --build tsconfig.json",docs:"cd docs && npm run build",test:"jest","test:web":"cd web-test && npm test","test:all":"npm run test && npm run test:web",benchmark:"node ./benchmark/run_bench.js",rollup:"copyfiles package.json build/ts && rollup -c",terser:"npm run terser:peggy && npm run terser:tests && npm run terser:bench","terser:peggy":"terser -c passes=2 -m reserved=['GrammarLocation'] --sequences 40 build/rollup/peggy.umd.js -o build/peggy.min.js","terser:tests":"terser -c passes=2 -m --sequences 40 --module build/rollup/test.umd.js -o build/test-bundle.min.js","terser:bench":"terser -c passes=2 -m --sequences 40 --module build/rollup/benchmark.umd.js -o build/benchmark-bundle.min.js",headers:"node ./tools/header.js build/peggy.min.js build/benchmark-bundle.min.js build/test-bundle.min.js",deploy:"npm run deploy:peggy && npm run deploy:tests && npm run deploy:bench",coverage:"npm run rollup && npm run parser -- -m inline && npm test","deploy:peggy":"copyfiles -f build/peggy.min.js docs/vendor/peggy/ && copyfiles -f build/peggy.min.js browser/","deploy:tests":"copyfiles -f build/test-bundle.min.js docs/js/","deploy:bench":"copyfiles -f build/benchmark-bundle.min.js docs/js/",build:"npm run build:notidy && npm run tidy","build:notidy":"npm run setup && npm run make && npm run lint && npm run audit",setup:"npm run clean && npm run set_version",make:"npm run parser && npm run ts && npm run rollup && npm run terser && npm run examples && npm run docs && npm run headers && npm run deploy",audit:"npm run test && npm run benchmark",tidy:"rimraf build",start:"cd docs && npm start"},devDependencies={"@peggyjs/eslint-config":"^3.0.6","@rollup/plugin-commonjs":"^25.0.3","@rollup/plugin-json":"^6.0.0","@rollup/plugin-multi-entry":"^6.0.0","@rollup/plugin-node-resolve":"^15.1.0","@rollup/plugin-typescript":"^11.1.2","@types/chai":"^4.3.5","@types/jest":"^29.5.3","@types/node":"^20.4.9","@typescript-eslint/eslint-plugin":"^6.3.0","@typescript-eslint/parser":"^6.3.0",chai:"^4.3.7","chai-like":"^1.1.1",copyfiles:"^2.4.1",eslint:"^8.47.0",express:"4.18.2",glob:"^8.1.0",jest:"^29.6.2",rimraf:"^5.0.1",rollup:"^3.28.0","rollup-plugin-ignore":"1.0.10","source-map":"^0.8.0-beta.0",terser:"^5.19.2","ts-jest":"^29.1.1",tslib:"^2.6.1",typescript:"^5.1.6"},dependencies={commander:"^11.0.0","source-map-generator":"0.8.0"},engines={node:">=16"},require$$2={name:name,version:version,description:description,keywords:keywords,homepage:homepage,repository:repository,bugs:bugs,license:license,author:author,main:main,browser:browser,unpkg:unpkg,jsdelivr:jsdelivr,types:types,bin:bin,scripts:scripts,devDependencies:devDependencies,dependencies:dependencies,engines:engines},sourceMap={},sourceMapGenerator={},base64Vlq={},base64$2={};const intToCharMap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");base64$2.encode=function(e){if(0<=e&&e<intToCharMap.length)return intToCharMap[e];throw new TypeError("Must be between 0 and 63: "+e)};const base64$1=base64$2,VLQ_BASE_SHIFT=5,VLQ_BASE=1<<VLQ_BASE_SHIFT,VLQ_BASE_MASK=VLQ_BASE-1,VLQ_CONTINUATION_BIT=VLQ_BASE;function toVLQSigned(e){return e<0?1+(-e<<1):0+(e<<1)}base64Vlq.encode=function(e){let t,r="",a=toVLQSigned(e);do{t=a&VLQ_BASE_MASK,a>>>=VLQ_BASE_SHIFT,a>0&&(t|=VLQ_CONTINUATION_BIT),r+=base64$1.encode(t)}while(a>0);return r};var util$4={},urlBrowser=require$$0$1.URL;const URL$1=urlBrowser;function getArg(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$4.getArg=getArg;const supportsNullProto=!("__proto__"in Object.create(null));function identity(e){return e}function toSetString(e){return isProtoString(e)?"$"+e:e}function fromSetString(e){return isProtoString(e)?e.slice(1):e}function isProtoString(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp(e.name,t.name)))))}function parseSourceMapInput(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}util$4.toSetString=supportsNullProto?identity:toSetString,util$4.fromSetString=supportsNullProto?identity:fromSetString,util$4.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated,util$4.parseSourceMapInput=parseSourceMapInput;const PROTOCOL="http:",PROTOCOL_AND_HOST=`${PROTOCOL}//host`;function createSafeHandler(e){return t=>{const r=getURLType(t),a=buildSafeBase(t),n=new URL$1(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST.length):computeRelativeURL(a,o)}}function withBase(e,t){return new URL$1(e,t).toString()}function buildUniqueSegment(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase(e){const t=e.split("..").length-1,r=buildUniqueSegment("p",e);let a=`${PROTOCOL_AND_HOST}/`;for(let e=0;e<t;e++)a+=`${r}/`;return a}const ABSOLUTE_SCHEME=/^[A-Za-z0-9\+\-\.]+:/;function getURLType(e){return"/"===e[0]?"/"===e[1]?"scheme-relative":"path-absolute":ABSOLUTE_SCHEME.test(e)?"absolute":"path-relative"}function computeRelativeURL(e,t){"string"==typeof e&&(e=new URL$1(e)),"string"==typeof t&&(t=new URL$1(t));const r=t.pathname.split("/"),a=e.pathname.split("/");for(a.length>0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory=createSafeHandler((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),trimFilename=createSafeHandler((e=>{e.href=new URL$1(".",e.toString()).toString()})),normalize=createSafeHandler((e=>{}));function join(e,t){const r=getURLType(t),a=getURLType(e);if(e=ensureDirectory(e),"absolute"===r)return withBase(t,void 0);if("absolute"===a)return withBase(t,e);if("scheme-relative"===r)return normalize(t);if("scheme-relative"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL.length);if("path-absolute"===r)return normalize(t);if("path-absolute"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL_AND_HOST.length);const n=buildSafeBase(t+e);return computeRelativeURL(n,withBase(t,withBase(e,n)))}function relative(e,t){const r=relativeIfPossible(e,t);return"string"==typeof r?r:normalize(t)}function relativeIfPossible(e,t){if(getURLType(e)!==getURLType(t))return null;const r=buildSafeBase(e+t),a=new URL$1(e,r),n=new URL$1(t,r);try{new URL$1("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL(a,n)}function computeSourceURL(e,t,r){e&&"path-absolute"===getURLType(t)&&(t=t.replace(/^\//,""));let a=normalize(t||"");return e&&(a=join(e,a)),r&&(a=join(trimFilename(r),a)),a}util$4.normalize=normalize,util$4.join=join,util$4.relative=relative,util$4.computeSourceURL=computeSourceURL;var arraySet={};let ArraySet$2=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e<n;e++)a.add(t[e],r);return a}size(){return this._set.size}add(e,t){const r=this.has(e),a=this._array.length;r&&!t||this._array.push(e),r||this._set.set(e,a)}has(e){return this._set.has(e)}indexOf(e){const t=this._set.get(e);if(t>=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)}toArray(){return this._array.slice()}};arraySet.ArraySet=ArraySet$2;var mappingList={};const util$3=util$4;function generatedPositionAfter(e,t){const r=e.generatedLine,a=t.generatedLine,n=e.generatedColumn,o=t.generatedColumn;return a>r||a==r&&o>=n||util$3.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$1=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$3.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList.MappingList=MappingList$1;const base64VLQ=base64Vlq,util$2=util$4,ArraySet$1=arraySet.ArraySet,MappingList=mappingList.MappingList;let SourceMapGenerator$1=class e{constructor(e){e||(e={}),this._file=util$2.getArg(e,"file",null),this._sourceRoot=util$2.getArg(e,"sourceRoot",null),this._skipValidation=util$2.getArg(e,"skipValidation",!1),this._sources=new ArraySet$1,this._names=new ArraySet$1,this._mappings=new MappingList,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$2.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!==r&&(n=util$2.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$2.getArg(e,"generated"),r=util$2.getArg(e,"original",null);let a=util$2.getArg(e,"source",null),n=util$2.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$2.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$2.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$2.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$2.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$1:this._sources,s=new ArraySet$1;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$2.join(r,t.source)),null!=n&&(t.source=util$2.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$2.join(r,t)),null!=n&&(t=util$2.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,u=0,p="";const l=this._mappings.toArray();for(let f=0,g=l.length;f<g;f++){if(t=l[f],e="",t.generatedLine!==o)for(n=0;t.generatedLine!==o;)e+=";",o++;else if(f>0){if(!util$2.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ.encode(a-u),u=a,e+=base64VLQ.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ.encode(r-i),i=r)),p+=e}return p}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$2.relative(t,e));const r=util$2.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$1.prototype._version=3,sourceMapGenerator.SourceMapGenerator=SourceMapGenerator$1;var sourceMapConsumer={},binarySearch$1={};!function(e){function t(r,a,n,o,s,c){const i=Math.floor((a-r)/2)+r,u=s(n,o[i],!0);return 0===u?i:u>0?a-i>1?t(i,a,n,o,s,c):c==e.LEAST_UPPER_BOUND?a<o.length?a:-1:i:i-r>1?t(r,i,n,o,s,c):c==e.LEAST_UPPER_BOUND?i:r<0?-1:r}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(r,a,n,o){if(0===a.length)return-1;let s=t(-1,a.length,r,a,n,o||e.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&0===n(a[s],a[s-1],!0);)--s;return s}}(binarySearch$1);var readWasmBrowser={exports:{}};let mappingsWasm=null;readWasmBrowser.exports=function(){if("string"==typeof mappingsWasm)return fetch(mappingsWasm).then((e=>e.arrayBuffer()));if(mappingsWasm instanceof ArrayBuffer)return Promise.resolve(mappingsWasm);throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer")},readWasmBrowser.exports.initialize=e=>{mappingsWasm=e};var readWasmBrowserExports=readWasmBrowser.exports;const readWasm$1=readWasmBrowserExports;function Mapping(){this.generatedLine=0,this.generatedColumn=0,this.lastGeneratedColumn=null,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}let cachedWasm=null;var wasm$1=function(){if(cachedWasm)return cachedWasm;const e=[];return cachedWasm=readWasm$1().then((t=>WebAssembly.instantiate(t,{env:{mapping_callback(t,r,a,n,o,s,c,i,u,p){const l=new Mapping;l.generatedLine=t+1,l.generatedColumn=r,a&&(l.lastGeneratedColumn=n-1),o&&(l.source=s,l.originalLine=c+1,l.originalColumn=i,u&&(l.name=p)),e[e.length-1](l)},start_all_generated_locations_for(){console.time("all_generated_locations_for")},end_all_generated_locations_for(){console.timeEnd("all_generated_locations_for")},start_compute_column_spans(){console.time("compute_column_spans")},end_compute_column_spans(){console.timeEnd("compute_column_spans")},start_generated_location_for(){console.time("generated_location_for")},end_generated_location_for(){console.timeEnd("generated_location_for")},start_original_location_for(){console.time("original_location_for")},end_original_location_for(){console.timeEnd("original_location_for")},start_parse_mappings(){console.time("parse_mappings")},end_parse_mappings(){console.timeEnd("parse_mappings")},start_sort_by_generated_location(){console.time("sort_by_generated_location")},end_sort_by_generated_location(){console.timeEnd("sort_by_generated_location")},start_sort_by_original_location(){console.time("sort_by_original_location")},end_sort_by_original_location(){console.timeEnd("sort_by_original_location")}}}))).then((t=>({exports:t.instance.exports,withMappingCallback:(t,r)=>{e.push(t);try{r()}finally{e.pop()}}}))).then(null,(e=>{throw cachedWasm=null,e})),cachedWasm};const util$1=util$4,binarySearch=binarySearch$1,ArraySet=arraySet.ArraySet,readWasm=readWasmBrowserExports,wasm=wasm$1,INTERNAL=Symbol("smcInternal");let SourceMapConsumer$1=class e{constructor(e,t){return e==INTERNAL?Promise.resolve(this):_factory(e,t)}static initialize(e){readWasm.initialize(e["lib/mappings.wasm"])}static fromSourceMap(e,t){return _factoryBSM(e,t)}static async with(t,r,a){const n=await new e(t,r);try{return await a(n)}finally{n.destroy()}}eachMapping(e,t,r){throw new Error("Subclasses must implement eachMapping")}allGeneratedPositionsFor(e){throw new Error("Subclasses must implement allGeneratedPositionsFor")}destroy(){throw new Error("Subclasses must implement destroy")}};SourceMapConsumer$1.prototype._version=3,SourceMapConsumer$1.GENERATED_ORDER=1,SourceMapConsumer$1.ORIGINAL_ORDER=2,SourceMapConsumer$1.GREATEST_LOWER_BOUND=1,SourceMapConsumer$1.LEAST_UPPER_BOUND=2,sourceMapConsumer.SourceMapConsumer=SourceMapConsumer$1;class BasicSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sources").map(String),s=util$1.getArg(a,"names",[]),c=util$1.getArg(a,"sourceRoot",null),i=util$1.getArg(a,"sourcesContent",null),u=util$1.getArg(a,"mappings"),p=util$1.getArg(a,"file",null);if(n!=r._version)throw new Error("Unsupported version: "+n);return r._sourceLookupCache=new Map,r._names=ArraySet.fromArray(s.map(String),!0),r._sources=ArraySet.fromArray(o,!0),r._absoluteSources=ArraySet.fromArray(r._sources.toArray().map((function(e){return util$1.computeSourceURL(c,e,t)})),!0),r.sourceRoot=c,r.sourcesContent=i,r._mappings=u,r._sourceMapURL=t,r.file=p,r._computedColumnSpans=!1,r._mappingsPtr=0,r._wasm=null,wasm().then((e=>(r._wasm=e,r)))}))}_findSourceIndex(e){const t=this._sourceLookupCache.get(e);if("number"==typeof t)return t;const r=util$1.computeSourceURL(null,e,this._sourceMapURL);if(this._absoluteSources.has(r)){const t=this._absoluteSources.indexOf(r);return this._sourceLookupCache.set(e,t),t}const a=util$1.computeSourceURL(this.sourceRoot,e,this._sourceMapURL);if(this._absoluteSources.has(a)){const t=this._absoluteSources.indexOf(a);return this._sourceLookupCache.set(e,t),t}return-1}static fromSourceMap(e,t){return new BasicSourceMapConsumer(e.toString())}get sources(){return this._absoluteSources.toArray()}_getMappingsPtr(){return 0===this._mappingsPtr&&this._parseMappings(),this._mappingsPtr}_parseMappings(){const e=this._mappings,t=e.length,r=this._wasm.exports.allocate_mappings(t),a=new Uint8Array(this._wasm.exports.memory.buffer,r,t);for(let r=0;r<t;r++)a[r]=e.charCodeAt(r);const n=this._wasm.exports.parse_mappings(r);if(!n){const e=this._wasm.exports.get_last_error();let t=`Error parsing mappings (code ${e}): `;switch(e){case 1:t+="the mappings contained a negative line, column, source index, or name index";break;case 2:t+="the mappings contained a number larger than 2**32";break;case 3:t+="reached EOF while in the middle of parsing a VLQ";break;case 4:t+="invalid base 64 character while parsing a VLQ";break;default:t+="unknown error code"}throw new Error(t)}this._mappingsPtr=n}eachMapping(e,t,r){const a=t||null,n=r||SourceMapConsumer$1.GENERATED_ORDER;this._wasm.withMappingCallback((t=>{null!==t.source&&(t.source=this._absoluteSources.at(t.source),null!==t.name&&(t.name=this._names.at(t.name))),this._computedColumnSpans&&null===t.lastGeneratedColumn&&(t.lastGeneratedColumn=1/0),e.call(a,t)}),(()=>{switch(n){case SourceMapConsumer$1.GENERATED_ORDER:this._wasm.exports.by_generated_location(this._getMappingsPtr());break;case SourceMapConsumer$1.ORIGINAL_ORDER:this._wasm.exports.by_original_location(this._getMappingsPtr());break;default:throw new Error("Unknown order of iteration.")}}))}allGeneratedPositionsFor(e){let t=util$1.getArg(e,"source");const r=util$1.getArg(e,"line"),a=e.column||0;if(t=this._findSourceIndex(t),t<0)return[];if(r<1)throw new Error("Line numbers must be >= 1");if(a<0)throw new Error("Column numbers must be >= 0");const n=[];return this._wasm.withMappingCallback((e=>{let t=e.lastGeneratedColumn;this._computedColumnSpans&&null===t&&(t=1/0),n.push({line:e.generatedLine,column:e.generatedColumn,lastColumn:t})}),(()=>{this._wasm.exports.all_generated_locations_for(this._getMappingsPtr(),t,r-1,"column"in e,a)})),n}destroy(){0!==this._mappingsPtr&&(this._wasm.exports.free_mappings(this._mappingsPtr),this._mappingsPtr=0)}computeColumnSpans(){this._computedColumnSpans||(this._wasm.exports.compute_column_spans(this._getMappingsPtr()),this._computedColumnSpans=!0)}originalPositionFor(e){const t={generatedLine:util$1.getArg(e,"line"),generatedColumn:util$1.getArg(e,"column")};if(t.generatedLine<1)throw new Error("Line numbers must be >= 1");if(t.generatedColumn<0)throw new Error("Column numbers must be >= 0");let r,a=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==a&&(a=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>r=e),(()=>{this._wasm.exports.original_location_for(this._getMappingsPtr(),t.generatedLine-1,t.generatedColumn,a)})),r&&r.generatedLine===t.generatedLine){let e=util$1.getArg(r,"source",null);null!==e&&(e=this._absoluteSources.at(e));let t=util$1.getArg(r,"name",null);return null!==t&&(t=this._names.at(t)),{source:e,line:util$1.getArg(r,"originalLine",null),column:util$1.getArg(r,"originalColumn",null),name:t}}return{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e}))}sourceContentFor(e,t){if(!this.sourcesContent)return null;const r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')}generatedPositionFor(e){let t=util$1.getArg(e,"source");if(t=this._findSourceIndex(t),t<0)return{line:null,column:null,lastColumn:null};const r={source:t,originalLine:util$1.getArg(e,"line"),originalColumn:util$1.getArg(e,"column")};if(r.originalLine<1)throw new Error("Line numbers must be >= 1");if(r.originalColumn<0)throw new Error("Column numbers must be >= 0");let a,n=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==n&&(n=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>a=e),(()=>{this._wasm.exports.generated_location_for(this._getMappingsPtr(),r.source,r.originalLine-1,r.originalColumn,n)})),a&&a.source===r.source){let e=a.lastGeneratedColumn;return this._computedColumnSpans&&null===e&&(e=1/0),{line:util$1.getArg(a,"generatedLine",null),column:util$1.getArg(a,"generatedColumn",null),lastColumn:e}}return{line:null,column:null,lastColumn:null}}}BasicSourceMapConsumer.prototype.consumer=SourceMapConsumer$1,sourceMapConsumer.BasicSourceMapConsumer=BasicSourceMapConsumer;class IndexedSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sections");if(n!=r._version)throw new Error("Unsupported version: "+n);let s={line:-1,column:0};return Promise.all(o.map((e=>{if(e.url)throw new Error("Support for url field in sections not implemented.");const r=util$1.getArg(e,"offset"),a=util$1.getArg(r,"line"),n=util$1.getArg(r,"column");if(a<s.line||a===s.line&&n<s.column)throw new Error("Section offsets must be ordered and non-overlapping.");return s=r,new SourceMapConsumer$1(util$1.getArg(e,"map"),t).then((e=>({generatedOffset:{generatedLine:a+1,generatedColumn:n+1},consumer:e})))}))).then((e=>(r._sections=e,r)))}))}get sources(){const e=[];for(let t=0;t<this._sections.length;t++)for(let r=0;r<this._sections[t].consumer.sources.length;r++)e.push(this._sections[t].consumer.sources[r]);return e}originalPositionFor(e){const t={generatedLine:util$1.getArg(e,"line"),generatedColumn:util$1.getArg(e,"column")},r=binarySearch.search(t,this._sections,(function(e,t){return e.generatedLine-t.generatedOffset.generatedLine||e.generatedColumn-t.generatedOffset.generatedColumn})),a=this._sections[r];return a?a.consumer.originalPositionFor({line:t.generatedLine-(a.generatedOffset.generatedLine-1),column:t.generatedColumn-(a.generatedOffset.generatedLine===t.generatedLine?a.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return this._sections.every((function(e){return e.consumer.hasContentsOfAllSources()}))}sourceContentFor(e,t){for(let t=0;t<this._sections.length;t++){const r=this._sections[t].consumer.sourceContentFor(e,!0);if(r)return r}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')}_findSectionIndex(e){for(let t=0;t<this._sections.length;t++){const{consumer:r}=this._sections[t];if(-1!==r._findSourceIndex(e))return t}return-1}generatedPositionFor(e){const t=this._findSectionIndex(util$1.getArg(e,"source")),r=t>=0?this._sections[t]:null,a=t>=0&&t+1<this._sections.length?this._sections[t+1]:null,n=r&&r.consumer.generatedPositionFor(e);if(n&&null!==n.line){const e=r.generatedOffset.generatedLine-1,t=r.generatedOffset.generatedColumn-1;return 1===n.line&&(n.column+=t,"number"==typeof n.lastColumn&&(n.lastColumn+=t)),n.lastColumn===1/0&&a&&n.line===a.generatedOffset.generatedLine&&(n.lastColumn=a.generatedOffset.generatedColumn-2),n.line+=e,n}return{line:null,column:null,lastColumn:null}}allGeneratedPositionsFor(e){const t=this._findSectionIndex(util$1.getArg(e,"source")),r=t>=0?this._sections[t]:null,a=t>=0&&t+1<this._sections.length?this._sections[t+1]:null;return r?r.consumer.allGeneratedPositionsFor(e).map((e=>{const t=r.generatedOffset.generatedLine-1,n=r.generatedOffset.generatedColumn-1;return 1===e.line&&(e.column+=n,"number"==typeof e.lastColumn&&(e.lastColumn+=n)),e.lastColumn===1/0&&a&&e.line===a.generatedOffset.generatedLine&&(e.lastColumn=a.generatedOffset.generatedColumn-2),e.line+=t,e})):[]}eachMapping(e,t,r){this._sections.forEach(((a,n)=>{const o=n+1<this._sections.length?this._sections[n+1]:null,{generatedOffset:s}=a,c=s.generatedLine-1,i=s.generatedColumn-1;a.consumer.eachMapping((function(t){1===t.generatedLine&&(t.generatedColumn+=i,"number"==typeof t.lastGeneratedColumn&&(t.lastGeneratedColumn+=i)),t.lastGeneratedColumn===1/0&&o&&t.generatedLine===o.generatedOffset.generatedLine&&(t.lastGeneratedColumn=o.generatedOffset.generatedColumn-2),t.generatedLine+=c,e.call(this,t)}),t,r)}))}computeColumnSpans(){for(let e=0;e<this._sections.length;e++)this._sections[e].consumer.computeColumnSpans()}destroy(){for(let e=0;e<this._sections.length;e++)this._sections[e].consumer.destroy()}}function _factory(e,t){let r=e;"string"==typeof e&&(r=util$1.parseSourceMapInput(e));const a=null!=r.sections?new IndexedSourceMapConsumer(r,t):new BasicSourceMapConsumer(r,t);return Promise.resolve(a)}function _factoryBSM(e,t){return BasicSourceMapConsumer.fromSourceMap(e,t)}sourceMapConsumer.IndexedSourceMapConsumer=IndexedSourceMapConsumer;var sourceNode={};const SourceMapGenerator=sourceMapGenerator.SourceMapGenerator,util=util$4,REGEX_NEWLINE=/(\r?\n)/,NEWLINE_CODE=10,isSourceNode="$$$isSourceNode$$$";let SourceNode$1=class e{constructor(e,t,r,a,n){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==n?null:n,this[isSourceNode]=!0,null!=a&&this.add(a)}static fromStringWithSourceMap(t,r,a){const n=new e,o=t.split(REGEX_NEWLINE);let s=0;const c=function(){return e()+(e()||"");function e(){return s<o.length?o[s++]:void 0}};let i,u=1,p=0,l=null;return r.eachMapping((function(e){if(null!==l){if(!(u<e.generatedLine)){i=o[s]||"";const t=i.substr(0,e.generatedColumn-p);return o[s]=i.substr(e.generatedColumn-p),p=e.generatedColumn,f(l,t),void(l=e)}f(l,c()),u++,p=0}for(;u<e.generatedLine;)n.add(c()),u++;p<e.generatedColumn&&(i=o[s]||"",n.add(i.substr(0,e.generatedColumn)),o[s]=i.substr(e.generatedColumn),p=e.generatedColumn),l=e}),this),s<o.length&&(l&&f(l,c()),n.add(o.splice(s).join(""))),r.sources.forEach((function(e){const t=r.sourceContentFor(e);null!=t&&(null!=a&&(e=util.join(a,e)),n.setSourceContent(e,t))})),n;function f(t,r){if(null===t||void 0===t.source)n.add(r);else{const o=a?util.join(a,t.source):t.source;n.add(new e(t.originalLine,t.originalColumn,o,r,t.name))}}}add(e){if(Array.isArray(e))e.forEach((function(e){this.add(e)}),this);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this}prepend(e){if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r<a;r++)t=this.children[r],t[isSourceNode]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})}join(e){let t,r;const a=this.children.length;if(a>0){for(t=[],r=0;r<a-1;r++)t.push(this.children[r]),t.push(e);t.push(this.children[r]),this.children=t}return this}replaceRight(e,t){const r=this.children[this.children.length-1];return r[isSourceNode]?r.replaceRight(e,t):"string"==typeof r?this.children[this.children.length-1]=r.replace(e,t):this.children.push("".replace(e,t)),this}setSourceContent(e,t){this.sourceContents[util.toSetString(e)]=t}walkSourceContents(e){for(let t=0,r=this.children.length;t<r;t++)this.children[t][isSourceNode]&&this.children[t].walkSourceContents(e);const t=Object.keys(this.sourceContents);for(let r=0,a=t.length;r<a;r++)e(util.fromSetString(t[r]),this.sourceContents[t[r]])}toString(){let e="";return this.walk((function(t){e+=t})),e}toStringWithSourceMap(e){const t={code:"",line:1,column:0},r=new SourceMapGenerator(e);let a=!1,n=null,o=null,s=null,c=null;return this.walk((function(e,i){t.code+=e,null!==i.source&&null!==i.line&&null!==i.column?(n===i.source&&o===i.line&&s===i.column&&c===i.name||r.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:t.line,column:t.column},name:i.name}),n=i.source,o=i.line,s=i.column,c=i.name,a=!0):a&&(r.addMapping({generated:{line:t.line,column:t.column}}),n=null,a=!1);for(let o=0,s=e.length;o<s;o++)e.charCodeAt(o)===NEWLINE_CODE?(t.line++,t.column=0,o+1===s?(n=null,a=!1):a&&r.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:t.line,column:t.column},name:i.name})):t.column++})),this.walkSourceContents((function(e,t){r.setSourceContent(e,t)})),{code:t.code,map:r}}};sourceNode.SourceNode=SourceNode$1,sourceMap.SourceMapGenerator=sourceMapGenerator.SourceMapGenerator,sourceMap.SourceMapConsumer=sourceMapConsumer.SourceMapConsumer,sourceMap.SourceNode=sourceNode.SourceNode;var chaiLike$1={exports:{}},hasRequiredChaiLike$1,chaiLike,hasRequiredChaiLike;function requireChaiLike$1(){if(hasRequiredChaiLike$1)return chaiLike$1.exports;hasRequiredChaiLike$1=1;let e=[];return chaiLike$1.exports=function(t,r){function a(e,t){return r.type(t).toUpperCase()===e.toUpperCase()}function n(t,r){for(let a of e)if(a.match(t,r))return a.assert(t,r);if(t===r)return!0;if(a("object",r)&&a("object",t)){for(let e of Object.keys(r)){if(!(e in t))return!1;if(!n(t[e],r[e]))return!1}return!0}if(a("array",r)&&a("array",t)){if(t.length!==r.length)return!1;for(let e=0;e<r.length;e++)if(!n(t[e],r[e]))return!1;return!0}return a("RegExp",t)&&a("RegExp",r)?t.toString()===r.toString():a("Date",t)&&a("Date",r)?t.getTime()===r.getTime():!!(a("string",t)&&a("string",r)||a("number",t)&&a("number",r)||a("boolean",t)&&a("boolean",r))&&t==r}t.Assertion.addMethod("like",(function(e){let a=r.flag(this,"object");this.assert(n(a,e),"expected #{this} to be like #{exp}","expected #{this} to not like #{exp}",e,a,t.config.showDiff)}))},chaiLike$1.exports.extend=function(t){e.push(t)},chaiLike$1.exports.clearPlugins=function(){e=[]},chaiLike$1.exports}function requireChaiLike(){return hasRequiredChaiLike?chaiLike:(hasRequiredChaiLike=1,chaiLike=requireChaiLike$1())}var chai$i=require$$0,peg$2=peg_1,pkg=require$$2,SourceMapConsumer=sourceMap.SourceMapConsumer,spy=utils.spy,peggyVersion=function(){return peg$2.VERSION};chai$i.use(requireChaiLike()),beforeEach((function(){return"undefined"!=typeof window?SourceMapConsumer.initialize({"lib/mappings.wasm":"https://raw.githubusercontent.com/mozilla/source-map/0.7.3/lib/mappings.wasm"}):null}));var expect$i=chai$i.expect;describe("Peggy API",(function(){it("has the correct VERSION",(function(){expect$i(peg$2.VERSION).to.equal(pkg.version)})),describe("generate",(function(){it("generates a parser",(function(){var e=peg$2.generate("start = 'a'");expect$i(e).to.be.an("object"),expect$i(e.parse("a")).to.equal("a")})),it("throws an exception on syntax error",(function(){expect$i((function(){peg$2.generate("start = @")})).to.throw()})),it("throws an exception on semantic error",(function(){expect$i((function(){peg$2.generate("start = undefined")})).to.throw()})),describe("allowed start rules",(function(){var e=["a = 'x'","b = 'x'","c = 'x'"].join("\n");describe("when |allowedStartRules| is not set",(function(){it("generated parser can start only from the first rule",(function(){var t=peg$2.generate(e);expect$i(t.parse("x",{startRule:"a"})).to.equal("x"),expect$i((function(){t.parse("x",{startRule:"b"})})).to.throw(),expect$i((function(){t.parse("x",{startRule:"c"})})).to.throw()}))})),describe("when |allowedStartRules| is set",(function(){it("generated parser can start only from specified rules",(function(){var t=peg$2.generate(e,{allowedStartRules:["b","c"]});expect$i((function(){t.parse("x",{startRule:"a"})})).to.throw(),expect$i(t.parse("x",{startRule:"b"})).to.equal("x"),expect$i(t.parse("x",{startRule:"c"})).to.equal("x")}))}))})),describe("intermediate results caching",(function(){var e=["{ var n = 0; }","start = (a 'b') / (a 'c') { return n; }","a = 'a' { n++; }"].join("\n");describe("when |cache| is not set",(function(){it("generated parser doesn't cache intermediate parse results",(function(){var t=peg$2.generate(e);expect$i(t.parse("ac")).to.equal(2)}))})),describe("when |cache| is set to |false|",(function(){it("generated parser doesn't cache intermediate parse results",(function(){var t=peg$2.generate(e,{cache:!1});expect$i(t.parse("ac")).to.equal(2)}))})),describe("when |cache| is set to |true|",(function(){it("generated parser caches intermediate parse results",(function(){var t=peg$2.generate(e,{cache:!0});expect$i(t.parse("ac")).to.equal(1)}))}))})),describe("tracing",(function(){var e="start = 'a'";describe("when |trace| is not set",(function(){it("generated parser doesn't trace",(function(){var t=peg$2.generate(e),r={trace:spy()};t.parse("a",{tracer:r}),expect$i(r.trace.called).to.equal(!1)}))})),describe("when |trace| is set to |false|",(function(){it("generated parser doesn't trace",(function(){var t=peg$2.generate(e,{trace:!1}),r={trace:spy()};t.parse("a",{tracer:r}),expect$i(r.trace.called).to.equal(!1)}))})),describe("when |trace| is set to |true|",(function(){it("generated parser traces",(function(){var t=peg$2.generate(e,{trace:!0}),r={trace:spy()};t.parse("a",{tracer:r}),expect$i(r.trace.called).to.equal(!0)}))}))})),describe("output",(function(){var grammar="start = 'a'";describe("when |output| is not set",(function(){it("returns generated parser object",(function(){var e=peg$2.generate(grammar);expect$i(e).to.be.an("object"),expect$i(e.parse("a")).to.equal("a")}))})),describe('when |output| is set to |"parser"|',(function(){it("returns generated parser object",(function(){var e=peg$2.generate(grammar,{output:"parser"});expect$i(e).to.be.an("object"),expect$i(e.parse("a")).to.equal("a")}))})),describe('when |output| is set to |"source"|',(function(){it("returns generated parser source code",(function(){var source=peg$2.generate(grammar,{output:"source"});expect$i(source).to.be.a("string"),expect$i(eval(source).parse("a")).to.equal("a")}))})),describe('when |output| is set to |"ast"|',(function(){it("returns generated parser AST",(function(){var e=peg$2.generate(grammar,{output:"ast"});expect$i(e).to.be.an("object"),expect$i(e).to.be.like(peg$2.parser.parse(grammar))}))}))})),describe("reserved words",(function(){describe("throws an exception on reserved JS words used as a label",(function(){for(var e=function(e){it(e,(function(){expect$i((function(){peg$2.generate(["start = "+e+":end","end = 'a'"].join("\n"),{output:"source"})})).to.throw(peg$2.parser.SyntaxError)}))},t=0,r=peg$2.RESERVED_WORDS;t<r.length;t++)e(r[t])})),describe("does not throw an exception on special non-reserved JS words used as a label",(function(){for(var nonReserved=["abstract","boolean","byte","char","double","final","float","goto","int","long","native","short","synchronized","throws","transient","volatile","as","async","from","get","of","set"],_loop_2=function(label){it(label,(function(){var source=peg$2.generate(["start = "+label+":end { return "+label+"; }","end = 'a'"].join("\n"),{output:"source"});expect$i(eval(source).parse("a")).to.equal("a")}))},_i=0,nonReserved_1=nonReserved;_i<nonReserved_1.length;_i++){var label=nonReserved_1[_i];_loop_2(label)}})),describe("does not throw an exception on reserved JS words used as a rule name",(function(){for(var _loop_3=function(rule){it(rule,(function(){var source=peg$2.generate(["start = "+rule,rule+" = 'a'"].join("\n"),{output:"source"});expect$i(eval(source).parse("a")).to.equal("a")}))},_i=0,_a=peg$2.RESERVED_WORDS;_i<_a.length;_i++){var rule=_a[_i];_loop_3(rule)}}))})),it("accepts custom options",(function(){peg$2.generate("start = 'a'",{grammarSource:42})})),describe("generates source map",(function(){function e(e,t,r){for(var a=t instanceof RegExp?e.search(t):e.indexOf(t),n=1,o=0,s=0;s<a;++s)10===e.charCodeAt(s)?(++n,o=0):++o;if(r&&r.offset){var c=r.offset({line:n,column:o,offset:a});return delete c.offset,c}return{line:n,column:o}}var t="GLOBAL\nINITIALIZER",r="PER-PARSE\nINITIALIZER",a="NOT\nBLOCK",n="AND\nBLOCK",o="ACTION\nBLOCK",s="MIN\nBLOCK",c="MAX\nBLOCK",i="EXACT\nBLOCK",u="\n {{".concat(t,"}}\n {").concat(r,"}\n RULE_1 = !{").concat(a,"} 'a' rule:RULE_2 {").concat(o,"};\n RULE_2 'named' = &{").concat(n,"} @'b' [abc] 'def';\n RULE_3 = RULE_1 / RULE_2;\n RULE_4 = RULE_1|{").concat(s,"} .. {").concat(c,"}, RULE_2|{").concat(i,"}| |;\n ");function p(t,r,a,n){void 0===n&&(n=t);var o=peg$2.generate(u,{grammarSource:r,output:"source-and-map"}).toStringWithSourceMap(),s=o.code,c=o.map,i=e(u,t,r),p=e(s,n);return delete i.offset,delete p.offset,SourceMapConsumer.fromSourceMap(c).then((function(e){expect$i(e.originalPositionFor(p)).to.be.deep.equal(Object.assign(i,{source:String(r),name:a}))}))}for(var l=function(e){describe("with source = ".concat(chai$i.util.inspect(e)),(function(){it("global initializer",(function(){return p(t,e,"$top_level_initializer")})),it("per-parse initializer",(function(){return p(r,e,"$initializer")})),it("action block",(function(){return p(o,e,null)})),it("semantic and predicate",(function(){return p(n,e,null)})),it("semantic not predicate",(function(){return p(a,e,null)})),it("min function boundary",(function(){return p(s,e,null)})),it("max function boundary",(function(){return p(c,e,null)})),it("exact function boundary",(function(){return p(i,e,null)})),it("rule name",(function(){return p("RULE_1",e,"RULE_1","peg$parseRULE_1() {")})),it("labelled rule name",(function(){return p("RULE_2 'named'",e,"RULE_2","peg$parseRULE_2() {")})),it("literal expression",(function(){return p("'a'",e,null,"input.charCodeAt(peg$currPos) === 97")})),it("multichar literal",(function(){return p("'def'",e,null,"input.substr(peg$currPos, 3) === peg$c3")})),it("chars expression",(function(){return p("[abc]",e,null,/s\d = input\.charAt\(peg\$currPos\);\s*if \(peg\$r0\.test\(s\d\)\)/)})),it("rule expression",(function(){return p("RULE_2",e,null,"peg$parseRULE_2();")})),it("choice expression",(function(){return p("RULE_1 / RULE_2",e,null,new RegExp([/peg\$parseRULE_1\(\);\s*/,/if \(s. === peg\$FAILED\) \{\s*/,/s. = peg\$parseRULE_2/].map((function(e){return e.source})).join("")))}))}))},f=0,g=["-",new peg$2.GrammarLocation("-",{offset:51,line:13,column:7})];f<g.length;f++)l(g[f])}))}))}));var chai$h=require$$0,SourceNode=sourceMap.SourceNode,peg$1=peg_1,op=opcodes_1,expect$h=chai$h.expect;describe("plugin API",(function(){describe("use",(function(){var e="start = 'a'";it("is called for each plugin",(function(){var t=[!1,!1,!1],r=[{use:function(){t[0]=!0}},{use:function(){t[1]=!0}},{use:function(){t[2]=!0}}];peg$1.generate(e,{plugins:r}),expect$h(t).to.deep.equal([!0,!0,!0])})),it("receives configuration",(function(){var t={use:function(e){expect$h(e).to.be.an("object"),expect$h(e.parser).to.be.an("object"),expect$h(e.parser.parse("start = 'a'")).to.be.an("object"),expect$h(e.passes).to.be.an("object"),expect$h(e.passes.check).to.be.an("array"),e.passes.check.forEach((function(e){expect$h(e).to.be.a("function")})),expect$h(e.passes.transform).to.be.an("array"),e.passes.transform.forEach((function(e){expect$h(e).to.be.a("function")})),expect$h(e.passes.generate).to.be.an("array"),e.passes.generate.forEach((function(e){expect$h(e).to.be.a("function")})),expect$h(e.reservedWords).to.be.an("array"),e.reservedWords.forEach((function(e){expect$h(e).to.be.a("string")}))}};peg$1.generate(e,{plugins:[t]})})),it("receives options",(function(){var t={plugins:[{use:function(e,r){expect$h(r).to.equal(t)}}],foo:42};peg$1.generate(e,t)})),it("can replace parser",(function(){var e={use:function(e){var t=peg$1.generate(["start = .* {"," return {"," type: 'grammar',"," initializer: {"," type: 'initializer',"," code: ['/* included for cover ast2SourceNode in the generate-js pass */'],"," },"," rules: ["," {"," type: 'rule',"," name: 'start',"," expression: { type: 'literal', value: text(), ignoreCase: false }"," }"," ]"," };","}"].join("\n"));e.parser=t}},t=peg$1.generate("a",{plugins:[e]});expect$h(t.parse("a")).to.equal("a")})),it("can change compiler passes",(function(){var t={use:function(e){e.passes.generate=[function(e){e.code=new SourceNode(1,0,"plugin","({ parse: function() { return 42; } })")}]}},r=peg$1.generate(e,{plugins:[t]});expect$h(r.parse("a")).to.equal(42)})),it("can change list of reserved words",(function(){var e={use:function(e){e.reservedWords=[]}};expect$h((function(){peg$1.generate("start = "+peg$1.RESERVED_WORDS[0]+":'a'",{plugins:[e],output:"source"})})).to.not.throw()})),it("can change options",(function(){var e=["a = 'x'","b = 'x'","c = 'x'"].join("\n"),t=peg$1.generate(e,{allowedStartRules:["a"],plugins:[{use:function(e,t){t.allowedStartRules=["b","c"]}}]});expect$h((function(){t.parse("x",{startRule:"a"})})).to.throw(),expect$h(t.parse("x",{startRule:"b"})).to.equal("x"),expect$h(t.parse("x",{startRule:"c"})).to.equal("x")})),it("can use star for start rules",(function(){var e=["a = 'x'","b = 'x'","c = 'x'"].join("\n"),t=peg$1.generate(e,{allowedStartRules:["*"]});expect$h(t.parse("x",{startRule:"a"})).to.equal("x"),expect$h(t.parse("x",{startRule:"b"})).to.equal("x"),expect$h(t.parse("x",{startRule:"c"})).to.equal("x")})),it("can munge the bytecode",(function(){var e={use:function(e){e.passes.generate.splice(1,0,(function(e){expect$h(e.rules.length).to.equal(2);var t=e.rules[0].bytecode;expect$h(t[0]).to.equal(op.MATCH_STRING_IC),t.splice(4,0,op.PUSH_CURR_POS,op.POP),t[2]+=2,t=e.rules[1].bytecode,expect$h(t[0]).to.equal(op.MATCH_STRING),expect$h(t[4]).to.equal(op.ACCEPT_STRING),t[4]=op.ACCEPT_N,t[5]=1}))}},t=peg$1.generate("one = 'abc'i; two = 'a'",{plugins:[e],output:"source"}),r=new RegExp([/if \(input\.substr\(peg\$currPos, 3\)/,/.toLowerCase\(\) === peg\$c0\) \{/,/\s*s0 = peg\$currPos;/,/\s*s0 = input\.substr/].map((function(e){return e.source})).join(""));expect$h(t.search(r)).to.be.greaterThan(0)}))}))}));var chai$g=require$$0,peg=peg_1,expect$g=chai$g.expect,stub=utils.stub;describe("generated parser behavior",(function(){function e(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r]})),t}function t(e){"object"==typeof console&&stub(console,"log");try{return e()}finally{"object"==typeof console&&console.log.restore()}}function r(e,r){var a=e.Assertion;a.addMethod("parse",(function(e,a,n){var o=this;n=void 0!==n?n:{};var s=t((function(){return r.flag(o,"object").parse(e,n)}));void 0!==a&&this.assert(r.eql(s,a),"expected #{this} to parse input as #{exp} but got #{act}","expected #{this} to not parse input as #{exp}",a,s,!r.flag(this,"negate"))})),a.addMethod("failToParse",(function(e,n,o){var s=this;o=void 0!==o?o:{};var c=void 0,i=void 0;try{i=t((function(){return r.flag(s,"object").parse(e,o)})),c=!0}catch(e){i=e,c=!1}this.assert(!c,"expected #{this} to fail to parse input but got #{act}","expected #{this} to not fail to parse input but #{act} was thrown",null,i),c||void 0===n||Object.keys(n).forEach((function(e){new a(i).to.have.property(e).that.is.deep.equal(n[e])}))}))}var a;beforeEach((function(){chai$g.use(r)})),a=function(t){describe("initializer",(function(){it("executes the code before parsing starts",(function(){var e=peg.generate(["{ var result = 42; }","start = 'a' { return result; }"].join("\n"),t);expect$g(e).to.parse("a",42)})),describe("available variables and functions",(function(){it("|options| contains options",(function(){var e=peg.generate(["{ var result = options; }","start = 'a' { return result; }"].join("\n"),t);expect$g(e).to.parse("a",{a:42},{a:42})}))}))})),describe("rule",(function(){t.cache?it("caches rule match results",(function(){var e=peg.generate(["{ var n = 0; }","start = (a 'b') / (a 'c') { return n; }","a = 'a' { n++; }"].join("\n"),t);expect$g(e).to.parse("ac",1)})):it("doesn't cache rule match results",(function(){var e=peg.generate(["{ var n = 0; }","start = (a 'b') / (a 'c') { return n; }","a = 'a' { n++; }"].join("\n"),t);expect$g(e).to.parse("ac",2)})),describe("when the expression matches",(function(){describe("without display name",(function(){describe("returns its match result",(function(){it("when expression may match",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.parse("a","a")})),it("when expression always match",(function(){var e=peg.generate("start = 'a'*",t);expect$g(e).to.parse("",[])}))}))})),describe("with display name",(function(){describe("returns its match result",(function(){it("when expression may match",(function(){var e=peg.generate("start 'start' = 'a'",t);expect$g(e).to.parse("a","a")})),it("when expression always match",(function(){var e=peg.generate("start 'start' = 'a'*",t);expect$g(e).to.parse("",[])}))}))}))})),describe("when the expression doesn't match",(function(){describe("without display name",(function(){describe("reports match failure and records an expectation",(function(){it("when expression may match",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("b",{expected:[{type:"literal",text:"a",ignoreCase:!1}]})})),it("when expression never match",(function(){var e=peg.generate("start = []",t);expect$g(e).to.failToParse("b",{expected:[{type:"class",parts:[],inverted:!1,ignoreCase:!1}]})}))}))})),describe("with display name",(function(){it('reports match failure and records an expectation of type "other" when expression may match',(function(){var e=peg.generate("start 'start' = 'a'",t);expect$g(e).to.failToParse("b",{expected:[{type:"other",description:"start"}]})})),it("reports match failure and doesn't records any expectations when expression never match",(function(){var e=peg.generate("start 'start' = []",t);expect$g(e).to.failToParse("b",{expected:[]})})),it("discards any expectations recorded when matching the expression",(function(){var e=peg.generate("start 'start' = 'a'",t);expect$g(e).to.failToParse("b",{expected:[{type:"other",description:"start"}]})}))}))}))})),describe("literal",(function(){describe("matching",(function(){it("matches empty literals",(function(){var e=peg.generate("start = ''",t);expect$g(e).to.parse("")})),it("matches one-character literals",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.parse("a"),expect$g(e).to.failToParse("b")})),it("matches multi-character literals",(function(){var e=peg.generate("start = 'abcd'",t);expect$g(e).to.parse("abcd"),expect$g(e).to.failToParse("efgh")})),it('is case sensitive without the "i" flag',(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.parse("a"),expect$g(e).to.failToParse("A")})),it('is case insensitive with the "i" flag',(function(){var e=peg.generate("start = 'a'i",t);expect$g(e).to.parse("a"),expect$g(e).to.parse("A")}))})),describe("when it matches",(function(){it("returns the matched text",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.parse("a","a")})),it("consumes the matched text",(function(){var e=peg.generate("start = 'a' .",t);expect$g(e).to.parse("ab")}))})),describe("when it doesn't match",(function(){it('reports match failure and records an expectation of type "literal"',(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("b",{expected:[{type:"literal",text:"a",ignoreCase:!1}]})}))}))})),describe("character class",(function(){describe("matching",(function(){it("matches empty classes",(function(){var e=peg.generate("start = []",t);expect$g(e).to.failToParse("a")})),it("matches classes with a character list",(function(){var e=peg.generate("start = [abc]",t);expect$g(e).to.parse("a"),expect$g(e).to.parse("b"),expect$g(e).to.parse("c"),expect$g(e).to.failToParse("d")})),it("matches classes with a character range",(function(){var e=peg.generate("start = [a-c]",t);expect$g(e).to.parse("a"),expect$g(e).to.parse("b"),expect$g(e).to.parse("c"),expect$g(e).to.failToParse("d")})),it("matches inverted classes",(function(){var e=peg.generate("start = [^a]",t);expect$g(e).to.failToParse("a"),expect$g(e).to.parse("b")})),it('is case sensitive without the "i" flag',(function(){var e=peg.generate("start = [a]",t);expect$g(e).to.parse("a"),expect$g(e).to.failToParse("A")})),it('is case insensitive with the "i" flag',(function(){var e=peg.generate("start = [a]i",t);expect$g(e).to.parse("a"),expect$g(e).to.parse("A")}))})),describe("when it matches",(function(){it("returns the matched character",(function(){var e=peg.generate("start = [a]",t);expect$g(e).to.parse("a","a")})),it("consumes the matched character",(function(){var e=peg.generate("start = [a] .",t);expect$g(e).to.parse("ab")}))})),describe("when it doesn't match",(function(){it('reports match failure and records an expectation of type "class"',(function(){var e=peg.generate("start = [a]",t);expect$g(e).to.failToParse("b",{expected:[{type:"class",parts:["a"],inverted:!1,ignoreCase:!1}]})}))}))})),describe("dot",(function(){describe("matching",(function(){it("matches any character",(function(){var e=peg.generate("start = .",t);expect$g(e).to.parse("a"),expect$g(e).to.parse("b"),expect$g(e).to.parse("c")}))})),describe("when it matches",(function(){it("returns the matched character",(function(){var e=peg.generate("start = .",t);expect$g(e).to.parse("a","a")})),it("consumes the matched character",(function(){var e=peg.generate("start = . .",t);expect$g(e).to.parse("ab")}))})),describe("when it doesn't match",(function(){it('reports match failure and records an expectation of type "any"',(function(){var e=peg.generate("start = .",t);expect$g(e).to.failToParse("",{expected:[{type:"any"}]})}))}))})),describe("rule reference",(function(){describe("when referenced rule's expression matches",(function(){it("returns its result",(function(){var e=peg.generate(["start = a","a = 'a'"].join("\n"),t);expect$g(e).to.parse("a","a")}))})),describe("when referenced rule's expression doesn't match",(function(){it("reports match failure",(function(){var e=peg.generate(["start = a","a = 'a'"].join("\n"),t);expect$g(e).to.failToParse("b")}))}))})),describe("positive semantic predicate",(function(){describe("when the code returns a truthy value",(function(){it("returns |undefined|",(function(){var e=peg.generate("start = &{ return true; } ''",t);expect$g(e).to.parse("",[void 0,""])}))})),describe("when the code returns a falsey value",(function(){it("reports match failure",(function(){var e=peg.generate("start = &{ return false; }",t);expect$g(e).to.failToParse("")}))})),describe("label variables",(function(){describe("in containing sequence",(function(){it("can access variables defined by preceding labeled elements",(function(){var e=peg.generate("start = a:'a' &{ return a === 'a'; }",t);expect$g(e).to.parse("a")})),it("cannot access variable defined by labeled predicate element",(function(){var e=peg.generate("start = 'a' b:&{ return b === undefined; } 'c'",t);expect$g(e).to.failToParse("ac")})),it("cannot access variables defined by following labeled elements",(function(){var e=peg.generate("start = &{ return a === 'a'; } a:'a'",t);expect$g(e).to.failToParse("a")})),it("cannot access variables defined by subexpressions",(function(){[{grammar:"start = (a:'a') &{ return a === 'a'; }",input:"a"},{grammar:"start = (a:'a')? &{ return a === 'a'; }",input:"a"},{grammar:"start = (a:'a')* &{ return a === 'a'; }",input:"a"},{grammar:"start = (a:'a')+ &{ return a === 'a'; }",input:"a"},{grammar:"start = (a:'a')| .. | &{ return a === 'a'; }",input:"a"},{grammar:"start = (a:'a')|0.. | &{ return a === 'a'; }",input:"a"},{grammar:"start = (a:'a')|1.. | &{ return a === 'a'; }",input:"a"},{grammar:"start = (a:'a')|2.. | &{ return a === 'a'; }",input:"aa"},{grammar:"start = (a:'a')| ..1| &{ return a === 'a'; }",input:"a"},{grammar:"start = (a:'a')| ..3| &{ return a === 'a'; }",input:"a"},{grammar:"start = (a:'a')|2..3| &{ return a === 'a'; }",input:"aa"},{grammar:"start = (a:'a')|3| &{ return a === 'a'; }",input:"aaa"},{grammar:"start = $(a:'a') &{ return a === 'a'; }",input:"a"},{grammar:"start = &(a:'a') 'a' &{ return a === 'a'; }",input:"a"},{grammar:"start = !(a:'a') 'b' &{ return a === 'a'; }",input:"b"},{grammar:"start = b:(a:'a') &{ return a === 'a'; }",input:"a"},{grammar:"start = ('a' b:'b' 'c') &{ return b === 'b'; }",input:"abc"},{grammar:"start = (a:'a' { return a; }) &{ return a === 'a'; }",input:"a"},{grammar:"start = ('a' / b:'b' / 'c') &{ return b === 'b'; }",input:"b"}].forEach((function(e){var r=peg.generate(e.grammar,t);expect$g(r).to.failToParse(e.input)}))}))})),describe("in outer sequence",(function(){it("can access variables defined by preceding labeled elements",(function(){var e=peg.generate("start = a:'a' ('b' &{ return a === 'a'; })",t);expect$g(e).to.parse("ab")})),it("cannot access variable defined by labeled predicate element",(function(){var e=peg.generate("start = 'a' b:('b' &{ return b === undefined; }) 'c'",t);expect$g(e).to.failToParse("abc")})),it("cannot access variables defined by following labeled elements",(function(){var e=peg.generate("start = ('a' &{ return b === 'b'; }) b:'b'",t);expect$g(e).to.failToParse("ab")}))}))})),describe("initializer variables & functions",(function(){it("can access variables defined in the initializer",(function(){var e=peg.generate(["{ var v = 42 }","start = &{ return v === 42; }"].join("\n"),t);expect$g(e).to.parse("")})),it("can access functions defined in the initializer",(function(){var e=peg.generate(["{ function f() { return 42; } }","start = &{ return f() === 42; }"].join("\n"),t);expect$g(e).to.parse("")}))})),describe("available variables & functions",(function(){it("|options| contains options",(function(){var e=peg.generate(["{ var result; }","start = &{ result = options; return true; } { return result; }"].join("\n"),t);expect$g(e).to.parse("",{a:42},{a:42})})),it("|location| returns current location info",(function(){var e=peg.generate(["{ var result; }","start = line (nl+ line)* { return result; }","line = thing (' '+ thing)*","thing = digit / mark","digit = [0-9]","mark = &{ result = location(); return true; } 'x'","nl = '\\r'? '\\n'"].join("\n"),t);expect$g(e).to.parse("1\n2\n\n3\n\n\n4 5 x",{source:void 0,start:{offset:13,line:7,column:5},end:{offset:13,line:7,column:5}}),expect$g(e).to.parse("1\nx",{source:void 0,start:{offset:2,line:2,column:1},end:{offset:2,line:2,column:1}}),expect$g(e).to.parse("1\r\nx",{source:void 0,start:{offset:3,line:2,column:1},end:{offset:3,line:2,column:1}})})),it("|offset| returns current start offset",(function(){var e=peg.generate(["start = [0-9]+ @mark","mark = 'xx' { return offset(); }"].join("\n"),t);expect$g(e).to.parse("0123456xx",7)})),it("|range| returns current range",(function(){var e=peg.generate(["start = [0-9]+ @mark","mark = 'xx' { return range(); }"].join("\n"),t);expect$g(e).to.parse("0123456xx",{source:void 0,start:7,end:9})}))}))})),describe("negative semantic predicate",(function(){describe("when the code returns a falsey value",(function(){it("returns |undefined|",(function(){var e=peg.generate("start = !{ return false; } ''",t);expect$g(e).to.parse("",[void 0,""])}))})),describe("when the code returns a truthy value",(function(){it("reports match failure",(function(){var e=peg.generate("start = !{ return true; }",t);expect$g(e).to.failToParse("")}))})),describe("label variables",(function(){describe("in containing sequence",(function(){it("can access variables defined by preceding labeled elements",(function(){var e=peg.generate("start = a:'a' !{ return a !== 'a'; }",t);expect$g(e).to.parse("a")})),it("cannot access variable defined by labeled predicate element",(function(){var e=peg.generate("start = 'a' b:!{ return b !== undefined; } 'c'",t);expect$g(e).to.failToParse("ac")})),it("cannot access variables defined by following labeled elements",(function(){var e=peg.generate("start = !{ return a !== 'a'; } a:'a'",t);expect$g(e).to.failToParse("a")})),it("cannot access variables defined by subexpressions",(function(){[{grammar:"start = (a:'a') !{ return a !== 'a'; }",input:"a"},{grammar:"start = (a:'a')? !{ return a !== 'a'; }",input:"a"},{grammar:"start = (a:'a')* !{ return a !== 'a'; }",input:"a"},{grammar:"start = (a:'a')+ !{ return a !== 'a'; }",input:"a"},{grammar:"start = (a:'a')| .. | !{ return a !== 'a'; }",input:"a"},{grammar:"start = (a:'a')|0.. | !{ return a !== 'a'; }",input:"a"},{grammar:"start = (a:'a')|1.. | !{ return a !== 'a'; }",input:"a"},{grammar:"start = (a:'a')|2.. | !{ return a !== 'a'; }",input:"aa"},{grammar:"start = (a:'a')| ..1| !{ return a !== 'a'; }",input:"a"},{grammar:"start = (a:'a')| ..3| !{ return a !== 'a'; }",input:"a"},{grammar:"start = (a:'a')|2..3| !{ return a !== 'a'; }",input:"aa"},{grammar:"start = (a:'a')|3| !{ return a !== 'a'; }",input:"aaa"},{grammar:"start = $(a:'a') !{ return a !== 'a'; }",input:"a"},{grammar:"start = &(a:'a') 'a' !{ return a !== 'a'; }",input:"a"},{grammar:"start = !(a:'a') 'b' !{ return a !== 'a'; }",input:"b"},{grammar:"start = b:(a:'a') !{ return a !== 'a'; }",input:"a"},{grammar:"start = ('a' b:'b' 'c') !{ return b !== 'b'; }",input:"abc"},{grammar:"start = (a:'a' { return a; }) !{ return a !== 'a'; }",input:"a"},{grammar:"start = ('a' / b:'b' / 'c') !{ return b !== 'b'; }",input:"b"}].forEach((function(e){var r=peg.generate(e.grammar,t);expect$g(r).to.failToParse(e.input)}))}))})),describe("in outer sequence",(function(){it("can access variables defined by preceding labeled elements",(function(){var e=peg.generate("start = a:'a' ('b' !{ return a !== 'a'; })",t);expect$g(e).to.parse("ab")})),it("cannot access variable defined by labeled predicate element",(function(){var e=peg.generate("start = 'a' b:('b' !{ return b !== undefined; }) 'c'",t);expect$g(e).to.failToParse("abc")})),it("cannot access variables defined by following labeled elements",(function(){var e=peg.generate("start = ('a' !{ return b !== 'b'; }) b:'b'",t);expect$g(e).to.failToParse("ab")}))}))})),describe("initializer variables & functions",(function(){it("can access variables defined in the initializer",(function(){var e=peg.generate(["{ var v = 42 }","start = !{ return v !== 42; }"].join("\n"),t);expect$g(e).to.parse("")})),it("can access functions defined in the initializer",(function(){var e=peg.generate(["{ function f() { return 42; } }","start = !{ return f() !== 42; }"].join("\n"),t);expect$g(e).to.parse("")}))})),describe("available variables & functions",(function(){it("|options| contains options",(function(){var e=peg.generate(["{ var result; }","start = !{ result = options; return false; } { return result; }"].join("\n"),t);expect$g(e).to.parse("",{a:42},{a:42})})),it("|location| returns current location info",(function(){var e=peg.generate(["{ var result; }","start = line (nl+ line)* { return result; }","line = thing (' '+ thing)*","thing = digit / mark","digit = [0-9]","mark = !{ result = location(); return false; } 'x'","nl = '\\r'? '\\n'"].join("\n"),t);expect$g(e).to.parse("1\n2\n\n3\n\n\n4 5 x",{source:void 0,start:{offset:13,line:7,column:5},end:{offset:13,line:7,column:5}}),expect$g(e).to.parse("1\nx",{source:void 0,start:{offset:2,line:2,column:1},end:{offset:2,line:2,column:1}}),expect$g(e).to.parse("1\r\nx",{source:void 0,start:{offset:3,line:2,column:1},end:{offset:3,line:2,column:1}})}))}))})),describe("group",(function(){describe("when the expression matches",(function(){it("returns its match result",(function(){var e=peg.generate("start = ('a')",t);expect$g(e).to.parse("a","a")}))})),describe("when the expression doesn't match",(function(){it("reports match failure",(function(){var e=peg.generate("start = ('a')",t);expect$g(e).to.failToParse("b")}))}))})),describe("optional",(function(){describe("when the expression matches",(function(){it("returns its match result",(function(){var e=peg.generate("start = 'a'?",t);expect$g(e).to.parse("a","a")}))})),describe("when the expression doesn't match",(function(){it("returns |null|",(function(){var e=peg.generate("start = 'a'?",t);expect$g(e).to.parse("",null)}))}))})),describe("zero or more",(function(){describe("when the expression matches zero or more times",(function(){it("returns an array of its match results",(function(){var e=peg.generate("start = 'a'*",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("aaa",["a","a","a"])}))}))})),describe("one or more",(function(){describe("when the expression matches one or more times",(function(){it("returns an array of its match results",(function(){var e=peg.generate("start = 'a'+",t);expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("aaa",["a","a","a"])}))})),describe("when the expression doesn't match",(function(){it("reports match failure",(function(){var e=peg.generate("start = 'a'+",t);expect$g(e).to.failToParse("")}))}))})),describe("repeated",(function(){function r(r){for(var a=[],n=1;n<=4;++n)for(var o=1;o<=4;++o)a[a.length]="start"+String(n)+o;var s=e(t);return s.allowedStartRules=a,peg.generate(["start11 = val:n1 x|"+r+"| $.*","start12 = val:n1 data:x|"+r+"| $.*","start13 = val:n1 x|"+r+"| rest:$.*","start14 = val:n1 data:x|"+r+"| rest:$.*","start21 = . val:n1 x|"+r+"| $.*","start22 = . val:n1 data:x|"+r+"| $.*","start23 = . val:n1 x|"+r+"| rest:$.*","start24 = . val:n1 data:x|"+r+"| rest:$.*","start31 = a:. val:n1 x|"+r+"| $.*","start32 = a:. val:n1 data:x|"+r+"| $.*","start33 = a:. val:n1 x|"+r+"| rest:$.*","start34 = a:. val:n1 data:x|"+r+"| rest:$.*","start41 = a:. b:. val:n1 x|"+r+"| $.*","start42 = a:. b:. val:n1 data:x|"+r+"| $.*","start43 = a:. b:. val:n1 x|"+r+"| rest:$.*","start44 = a:. b:. val:n1 data:x|"+r+"| rest:$.*","n1 = n:$[0-9] { return parseInt(n, 10); }","x = '='"].join(";\n"),s)}describe("without delimiter",(function(){describe("with constant boundaries",(function(){it("| .. | matches correctly",(function(){var e=peg.generate("start = 'a'|..|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.parse("aaa",["a","a","a"])})),it("|0.. | matches correctly",(function(){var e=peg.generate("start = 'a'|0..|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.parse("aaa",["a","a","a"])})),it("|1.. | matches correctly",(function(){var e=peg.generate("start = 'a'|1..|",t);expect$g(e).to.failToParse(""),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.parse("aaa",["a","a","a"])})),it("|2.. | matches correctly",(function(){var e=peg.generate("start = 'a'|2..|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.parse("aaa",["a","a","a"])})),it("| ..1| matches correctly",(function(){var e=peg.generate("start = 'a'|..1|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.failToParse("aa"),expect$g(e).to.failToParse("aaa")})),it("| ..2| matches correctly",(function(){var e=peg.generate("start = 'a'|..2|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.failToParse("aaa")})),it("|2..3| matches correctly",(function(){var e=peg.generate("start = 'a'|2..3|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.parse("aaa",["a","a","a"]),expect$g(e).to.failToParse("aaaa")})),it("|2..2| matches correctly",(function(){var e=peg.generate("start = 'a'|2..2|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.failToParse("aaa")})),it("| 2 | matches correctly",(function(){var e=peg.generate("start = 'a'|2|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.failToParse("aaa")})),it("|3..2| matches correctly",(function(){var e=peg.generate("start = 'a'|3..2|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.failToParse("aa"),expect$g(e).to.failToParse("aaa")})),it("does not consume input on failure",(function(){var e=peg.generate("start = 'a'|3| / 'a'|2| { return 42; }",t);expect$g(e).to.parse("aa",42)})),it("correctly pass external references to labels to repeated expression",(function(){var e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|..|",t);expect$g(e).to.parse("abb",["a",[["b",void 0],["b",void 0]]]),e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|2..|",t),expect$g(e).to.parse("abb",["a",[["b",void 0],["b",void 0]]]),e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|..3|",t),expect$g(e).to.parse("abb",["a",[["b",void 0],["b",void 0]]]),e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|2..3|",t),expect$g(e).to.parse("abb",["a",[["b",void 0],["b",void 0]]]),e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|2|",t),expect$g(e).to.parse("abb",["a",[["b",void 0],["b",void 0]]])}))})),describe("with variable boundaries",(function(){it("|min.. | matches correctly",(function(){for(var e=r("val.."),t=1;t<=4;++t){var a={startRule:"start1"+t};expect$g(e).to.failToParse("",void 0,a),expect$g(e).to.parse("0",[0,[],""],a),expect$g(e).to.parse("0==",[0,["=","="],""],a),expect$g(e).to.failToParse("1",void 0,a),expect$g(e).to.failToParse("2=",void 0,a),expect$g(e).to.parse("2==",[2,["=","="],""],a),expect$g(e).to.parse("2=====",[2,["=","=","=","=","="],""],a)}for(t=1;t<=4;++t)a={startRule:"start2"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,["=","="],""],a),expect$g(e).to.failToParse("-1",void 0,a),expect$g(e).to.failToParse("-2=",void 0,a),expect$g(e).to.parse("-2==",["-",2,["=","="],""],a),expect$g(e).to.parse("-2=====",["-",2,["=","=","=","=","="],""],a);for(t=1;t<=4;++t)a={startRule:"start3"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,["=","="],""],a),expect$g(e).to.failToParse("-1",void 0,a),expect$g(e).to.failToParse("-2=",void 0,a),expect$g(e).to.parse("-2==",["-",2,["=","="],""],a),expect$g(e).to.parse("-2=====",["-",2,["=","=","=","=","="],""],a);for(t=1;t<=4;++t)a={startRule:"start4"+t},expect$g(e).to.failToParse("--",void 0,a),expect$g(e).to.parse("--0",["-","-",0,[],""],a),expect$g(e).to.parse("--0==",["-","-",0,["=","="],""],a),expect$g(e).to.failToParse("--1",void 0,a),expect$g(e).to.failToParse("--2=",void 0,a),expect$g(e).to.parse("--2==",["-","-",2,["=","="],""],a),expect$g(e).to.parse("--2=====",["-","-",2,["=","=","=","=","="],""],a)})),it("| ..max| matches correctly",(function(){for(var e=r("..val"),t=1;t<=4;++t){var a={startRule:"start1"+t};expect$g(e).to.failToParse("",void 0,a),expect$g(e).to.parse("0",[0,[],""],a),expect$g(e).to.parse("0==",[0,[],"=="],a),expect$g(e).to.parse("3",[3,[],""],a),expect$g(e).to.parse("3=",[3,["="],""],a),expect$g(e).to.parse("3===",[3,["=","=","="],""],a),expect$g(e).to.parse("3=====",[3,["=","=","="],"=="],a)}for(t=1;t<=4;++t)a={startRule:"start2"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.parse("-3",["-",3,[],""],a),expect$g(e).to.parse("-3=",["-",3,["="],""],a),expect$g(e).to.parse("-3===",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=====",["-",3,["=","=","="],"=="],a);for(t=1;t<=4;++t)a={startRule:"start3"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.parse("-3",["-",3,[],""],a),expect$g(e).to.parse("-3=",["-",3,["="],""],a),expect$g(e).to.parse("-3===",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=====",["-",3,["=","=","="],"=="],a);for(t=1;t<=4;++t)a={startRule:"start4"+t},expect$g(e).to.failToParse("--",void 0,a),expect$g(e).to.parse("--0",["-","-",0,[],""],a),expect$g(e).to.parse("--0==",["-","-",0,[],"=="],a),expect$g(e).to.parse("--3",["-","-",3,[],""],a),expect$g(e).to.parse("--3=",["-","-",3,["="],""],a),expect$g(e).to.parse("--3===",["-","-",3,["=","=","="],""],a),expect$g(e).to.parse("--3=====",["-","-",3,["=","=","="],"=="],a)})),it("|min..max| matches correctly",(function(){for(var r=function(){for(var r=[],a=1;a<=4;++a)for(var n=1;n<=4;++n)r[r.length]="start"+String(a)+n;var o=e(t);return o.allowedStartRules=r,peg.generate(["start11 = min:n1 max:n1 .|min..max| $.*","start12 = min:n1 max:n1 data:.|min..max| $.*","start13 = min:n1 max:n1 .|min..max| rest:$.*","start14 = min:n1 max:n1 data:.|min..max| rest:$.*","start21 = . min:n1 max:n1 .|min..max| $.*","start22 = . min:n1 max:n1 data:.|min..max| $.*","start23 = . min:n1 max:n1 .|min..max| rest:$.*","start24 = . min:n1 max:n1 data:.|min..max| rest:$.*","start31 = a:. min:n1 max:n1 .|min..max| $.*","start32 = a:. min:n1 max:n1 data:.|min..max| $.*","start33 = a:. min:n1 max:n1 .|min..max| rest:$.*","start34 = a:. min:n1 max:n1 data:.|min..max| rest:$.*","start41 = a:. b:. min:n1 max:n1 .|min..max| $.*","start42 = a:. b:. min:n1 max:n1 data:.|min..max| $.*","start43 = a:. b:. min:n1 max:n1 .|min..max| rest:$.*","start44 = a:. b:. min:n1 max:n1 data:.|min..max| rest:$.*","n1 = n:$[0-9] { return parseInt(n, 10); }"].join(";\n"),o)}(),a=1;a<=4;++a){var n={startRule:"start1"+a};expect$g(r).to.failToParse("",void 0,n),expect$g(r).to.parse("00",[0,0,[],""],n),expect$g(r).to.parse("00==",[0,0,[],"=="],n),expect$g(r).to.failToParse("23",void 0,n),expect$g(r).to.failToParse("23=",void 0,n),expect$g(r).to.parse("23==",[2,3,["=","="],""],n),expect$g(r).to.parse("23===",[2,3,["=","=","="],""],n),expect$g(r).to.parse("23=====",[2,3,["=","=","="],"=="],n)}for(a=1;a<=4;++a)n={startRule:"start2"+a},expect$g(r).to.failToParse("-",void 0,n),expect$g(r).to.parse("-00",["-",0,0,[],""],n),expect$g(r).to.parse("-00==",["-",0,0,[],"=="],n),expect$g(r).to.failToParse("-23",void 0,n),expect$g(r).to.failToParse("-23=",void 0,n),expect$g(r).to.parse("-23==",["-",2,3,["=","="],""],n),expect$g(r).to.parse("-23===",["-",2,3,["=","=","="],""],n),expect$g(r).to.parse("-23=====",["-",2,3,["=","=","="],"=="],n);for(a=1;a<=4;++a)n={startRule:"start3"+a},expect$g(r).to.failToParse("-",void 0,n),expect$g(r).to.parse("-00",["-",0,0,[],""],n),expect$g(r).to.parse("-00==",["-",0,0,[],"=="],n),expect$g(r).to.failToParse("-23",void 0,n),expect$g(r).to.failToParse("-23=",void 0,n),expect$g(r).to.parse("-23==",["-",2,3,["=","="],""],n),expect$g(r).to.parse("-23===",["-",2,3,["=","=","="],""],n),expect$g(r).to.parse("-23=====",["-",2,3,["=","=","="],"=="],n);for(a=1;a<=4;++a)n={startRule:"start4"+a},expect$g(r).to.failToParse("--",void 0,n),expect$g(r).to.parse("--00",["-","-",0,0,[],""],n),expect$g(r).to.parse("--00==",["-","-",0,0,[],"=="],n),expect$g(r).to.failToParse("--23",void 0,n),expect$g(r).to.failToParse("--23=",void 0,n),expect$g(r).to.parse("--23==",["-","-",2,3,["=","="],""],n),expect$g(r).to.parse("--23===",["-","-",2,3,["=","=","="],""],n),expect$g(r).to.parse("--23=====",["-","-",2,3,["=","=","="],"=="],n)})),it("|val..val| matches correctly",(function(){for(var e=r("val"),t=1;t<=4;++t){var a={startRule:"start1"+t};expect$g(e).to.failToParse("",void 0,a),expect$g(e).to.parse("0",[0,[],""],a),expect$g(e).to.parse("0==",[0,[],"=="],a),expect$g(e).to.failToParse("3",void 0,a),expect$g(e).to.failToParse("3=",void 0,a),expect$g(e).to.parse("3===",[3,["=","=","="],""],a),expect$g(e).to.parse("3=====",[3,["=","=","="],"=="],a)}for(t=1;t<=4;++t)a={startRule:"start2"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.failToParse("-3",void 0,a),expect$g(e).to.failToParse("-3=",void 0,a),expect$g(e).to.parse("-3===",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=====",["-",3,["=","=","="],"=="],a);for(t=1;t<=4;++t)a={startRule:"start3"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.failToParse("-3",void 0,a),expect$g(e).to.failToParse("-3=",void 0,a),expect$g(e).to.parse("-3===",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=====",["-",3,["=","=","="],"=="],a);for(t=1;t<=4;++t)a={startRule:"start4"+t},expect$g(e).to.failToParse("--",void 0,a),expect$g(e).to.parse("--0",["-","-",0,[],""],a),expect$g(e).to.parse("--0==",["-","-",0,[],"=="],a),expect$g(e).to.failToParse("--3",void 0,a),expect$g(e).to.failToParse("--3=",void 0,a),expect$g(e).to.parse("--3===",["-","-",3,["=","=","="],""],a),expect$g(e).to.parse("--3=====",["-","-",3,["=","=","="],"=="],a)})),it("| exact | matches correctly",(function(){for(var e=r("val"),t=1;t<=4;++t){var a={startRule:"start1"+t};expect$g(e).to.failToParse("",void 0,a),expect$g(e).to.parse("0",[0,[],""],a),expect$g(e).to.parse("0==",[0,[],"=="],a),expect$g(e).to.failToParse("3",void 0,a),expect$g(e).to.failToParse("3=",void 0,a),expect$g(e).to.parse("3===",[3,["=","=","="],""],a),expect$g(e).to.parse("3=====",[3,["=","=","="],"=="],a)}for(t=1;t<=4;++t)a={startRule:"start2"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.failToParse("-3",void 0,a),expect$g(e).to.failToParse("-3=",void 0,a),expect$g(e).to.parse("-3===",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=====",["-",3,["=","=","="],"=="],a);for(t=1;t<=4;++t)a={startRule:"start3"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.failToParse("-3",void 0,a),expect$g(e).to.failToParse("-3=",void 0,a),expect$g(e).to.parse("-3===",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=====",["-",3,["=","=","="],"=="],a);for(t=1;t<=4;++t)a={startRule:"start4"+t},expect$g(e).to.failToParse("--",void 0,a),expect$g(e).to.parse("--0",["-","-",0,[],""],a),expect$g(e).to.parse("--0==",["-","-",0,[],"=="],a),expect$g(e).to.failToParse("--3",void 0,a),expect$g(e).to.failToParse("--3=",void 0,a),expect$g(e).to.parse("--3===",["-","-",3,["=","=","="],""],a),expect$g(e).to.parse("--3=====",["-","-",3,["=","=","="],"=="],a)}))})),describe("with function boundaries",(function(){it("|{min}.. | matches correctly",(function(){var e=peg.generate("start = 'a'|{ return 2; }..|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.parse("aaa",["a","a","a"])})),it("| ..{max}| matches correctly",(function(){var e=peg.generate("start = 'a'|..{ return 2; }|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.failToParse("aaa")})),it("|{min}..{max}| matches correctly",(function(){var e=peg.generate("start = 'a'|{ return 2; }..{ return 3; }|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.parse("aaa",["a","a","a"]),expect$g(e).to.failToParse("aaaa")})),it("|{val}..{val}| matches correctly",(function(){var e=peg.generate("start = 'a'|{ return 2; }..{ return 2; }|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.failToParse("aaa")})),it("| {exact} | matches correctly",(function(){var e=peg.generate("start = 'a'|{ return 2; }|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.failToParse("aaa")})),describe("function called only once",(function(){it("in |{min}.. |",(function(){var e=peg.generate("\n { let min = 0; }\n start = 'a'|{ ++min; return 2; }..| { return min; }\n ",t);expect$g(e).to.parse("aa",1),expect$g(e).to.parse("aaa",1)})),it("in | ..{max}|",(function(){var e=peg.generate("\n { let max = 0; }\n start = 'a'|..{ ++max; return 3; }| { return max; }\n ",t);expect$g(e).to.parse("aa",1),expect$g(e).to.parse("aaa",1)})),it("in |{min}..{max}|",(function(){var e=peg.generate("\n {\n let min = 0;\n let max = 0;\n }\n start = 'a'|\n { ++min; return 0; }\n ..\n { ++max; return 3; }\n | { return [min, max]; }\n ",t);expect$g(e).to.parse("",[1,1]),expect$g(e).to.parse("a",[1,1]),expect$g(e).to.parse("aa",[1,1]),expect$g(e).to.parse("aaa",[1,1])})),it("in | {exact} |",(function(){var e=peg.generate("\n { let count = 0; }\n start = 'a'|{ ++count; return options.exact; }| { return count; }\n ",t);expect$g(e).to.parse("",1,{exact:0}),expect$g(e).to.parse("aa",1,{exact:2})}))})),it("correctly pass external references to labels to boundary expression",(function(){var e=peg.generate("start = ref:'a' 'b'|{ return ref === 'a' ? 2 : 0; }..|",t);expect$g(e).to.parse("abb",["a",["b","b"]]),e=peg.generate("start = ref:'a' 'b'|..{ return ref === 'a' ? 3 : 0; }|",t),expect$g(e).to.parse("abb",["a",["b","b"]]),e=peg.generate("start = ref:'a' 'b'|{ return ref === 'a' ? 2 : 0; }..{ return ref === 'a' ? 3 : 0; }|",t),expect$g(e).to.parse("abb",["a",["b","b"]]),e=peg.generate("start = ref:'a' 'b'|{ return ref === 'a' ? 2 : 0; }|",t),expect$g(e).to.parse("abb",["a",["b","b"]])}))})),it("with functions returning non-integers",(function(){var e=peg.generate("start = 'a'|{ return 'a' }|",t);expect$g(e).to.parse("",[]),expect$g(e).to.failToParse("aaa",{expected:[{type:"end"}]}),e=peg.generate("start = 'a'|{ return 'a' }..2|",t),expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.failToParse("aaa",{expected:[{type:"end"}]}),e=peg.generate("start = 'a'|..{ return 'a' }|",t),expect$g(e).to.parse("",[]),expect$g(e).to.failToParse("a",{expected:[{type:"end"}]}),e=peg.generate("start = 'a'|{return '1.8e0' }..{ return 2.8 }|",t),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.failToParse("aaa",{expected:[{type:"end"}]})}))})),describe("with delimiter",(function(){describe("with constant boundaries",(function(){it("| .. , delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|.., '~'|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.parse("a~a~a",["a","a","a"])})),it("|0.. , delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|0.., '~'|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.parse("a~a~a",["a","a","a"])})),it("|1.. , delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|1.., '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.parse("a~a~a",["a","a","a"])})),it("|2.. , delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|2.., '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.parse("a~a~a",["a","a","a"])})),it("| ..1, delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|..1, '~'|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.failToParse("a~a"),expect$g(e).to.failToParse("a~a~a")})),it("| ..2, delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|..2, '~'|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.failToParse("a~a~a")})),it("|2..3, delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|2..3, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.parse("a~a~a",["a","a","a"]),expect$g(e).to.failToParse("a~a~a~a")})),it("|2..2, delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|2..2, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.failToParse("a~a~a")})),it("|2 , delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|2, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.failToParse("a~a~a")})),it("|3..2, delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|3..2, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.failToParse("a~a"),expect$g(e).to.failToParse("a~a~a")})),it("correctly pass external references to labels to repeated expression",(function(){var e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|.., ' '|",t);expect$g(e).to.parse("ab b",["a",[["b",void 0],["b",void 0]]]),e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|2.., ' '|",t),expect$g(e).to.parse("ab b",["a",[["b",void 0],["b",void 0]]]),e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|..3, ' '|",t),expect$g(e).to.parse("ab b",["a",[["b",void 0],["b",void 0]]]),e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|2..3, ' '|",t),expect$g(e).to.parse("ab b",["a",[["b",void 0],["b",void 0]]]),e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|2, ' '|",t),expect$g(e).to.parse("ab b",["a",[["b",void 0],["b",void 0]]]),e=peg.generate("start = ref:'a' 'b'|{ return ref === 'a' ? 2 : 0; }, ' '|",t),expect$g(e).to.parse("ab b",["a",["b","b"]])}))})),describe("with variable boundaries",(function(){it("|min.. , delimiter| matches correctly",(function(){for(var e=r("val.., '~'"),t=1;t<=4;++t){var a={startRule:"start1"+t};expect$g(e).to.failToParse("",void 0,a),expect$g(e).to.parse("0",[0,[],""],a),expect$g(e).to.parse("0==",[0,["="],"="],a),expect$g(e).to.parse("0=~=",[0,["=","="],""],a),expect$g(e).to.failToParse("1",void 0,a),expect$g(e).to.failToParse("1~",void 0,a),expect$g(e).to.failToParse("2=",void 0,a),expect$g(e).to.failToParse("2=~",void 0,a),expect$g(e).to.failToParse("2==",void 0,a),expect$g(e).to.parse("2=~=",[2,["=","="],""],a),expect$g(e).to.parse("2=~=~",[2,["=","="],"~"],a),expect$g(e).to.parse("2=~=~=~=~=",[2,["=","=","=","=","="],""],a)}for(t=1;t<=4;++t)a={startRule:"start2"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,["="],"="],a),expect$g(e).to.parse("-0=~=",["-",0,["=","="],""],a),expect$g(e).to.failToParse("-1",void 0,a),expect$g(e).to.failToParse("-1~",void 0,a),expect$g(e).to.failToParse("-2=",void 0,a),expect$g(e).to.failToParse("-2=~",void 0,a),expect$g(e).to.failToParse("-2==",void 0,a),expect$g(e).to.parse("-2=~=",["-",2,["=","="],""],a),expect$g(e).to.parse("-2=~=~",["-",2,["=","="],"~"],a),expect$g(e).to.parse("-2=~=~=~=~=",["-",2,["=","=","=","=","="],""],a);for(t=1;t<=4;++t)a={startRule:"start3"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,["="],"="],a),expect$g(e).to.parse("-0=~=",["-",0,["=","="],""],a),expect$g(e).to.failToParse("-1",void 0,a),expect$g(e).to.failToParse("-1~",void 0,a),expect$g(e).to.failToParse("-2=",void 0,a),expect$g(e).to.failToParse("-2=~",void 0,a),expect$g(e).to.failToParse("-2==",void 0,a),expect$g(e).to.parse("-2=~=",["-",2,["=","="],""],a),expect$g(e).to.parse("-2=~=~",["-",2,["=","="],"~"],a),expect$g(e).to.parse("-2=~=~=~=~=",["-",2,["=","=","=","=","="],""],a);for(t=1;t<=4;++t)a={startRule:"start4"+t},expect$g(e).to.failToParse("--",void 0,a),expect$g(e).to.parse("--0",["-","-",0,[],""],a),expect$g(e).to.parse("--0==",["-","-",0,["="],"="],a),expect$g(e).to.parse("--0=~=",["-","-",0,["=","="],""],a),expect$g(e).to.failToParse("--1",void 0,a),expect$g(e).to.failToParse("--1~",void 0,a),expect$g(e).to.failToParse("--2=",void 0,a),expect$g(e).to.failToParse("--2=~",void 0,a),expect$g(e).to.failToParse("--2==",void 0,a),expect$g(e).to.parse("--2=~=",["-","-",2,["=","="],""],a),expect$g(e).to.parse("--2=~=~",["-","-",2,["=","="],"~"],a),expect$g(e).to.parse("--2=~=~=~=~=",["-","-",2,["=","=","=","=","="],""],a)})),it("| ..max, delimiter| matches correctly",(function(){for(var e=r("..val, '~'"),t=1;t<=4;++t){var a={startRule:"start1"+t};expect$g(e).to.failToParse("",void 0,a),expect$g(e).to.parse("0",[0,[],""],a),expect$g(e).to.parse("0==",[0,[],"=="],a),expect$g(e).to.parse("0=~=",[0,[],"=~="],a),expect$g(e).to.parse("3",[3,[],""],a),expect$g(e).to.parse("3=",[3,["="],""],a),expect$g(e).to.parse("3===",[3,["="],"=="],a),expect$g(e).to.parse("3=~=~",[3,["=","="],"~"],a),expect$g(e).to.parse("3=~=~=",[3,["=","=","="],""],a),expect$g(e).to.parse("3=~=~=~=~=",[3,["=","=","="],"~=~="],a)}for(t=1;t<=4;++t)a={startRule:"start2"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.parse("-0=~=",["-",0,[],"=~="],a),expect$g(e).to.parse("-3",["-",3,[],""],a),expect$g(e).to.parse("-3=",["-",3,["="],""],a),expect$g(e).to.parse("-3===",["-",3,["="],"=="],a),expect$g(e).to.parse("-3=~=~",["-",3,["=","="],"~"],a),expect$g(e).to.parse("-3=~=~=",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=~=~=~=~=",["-",3,["=","=","="],"~=~="],a);for(t=1;t<=4;++t)a={startRule:"start3"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.parse("-0=~=",["-",0,[],"=~="],a),expect$g(e).to.parse("-3",["-",3,[],""],a),expect$g(e).to.parse("-3=",["-",3,["="],""],a),expect$g(e).to.parse("-3===",["-",3,["="],"=="],a),expect$g(e).to.parse("-3=~=~",["-",3,["=","="],"~"],a),expect$g(e).to.parse("-3=~=~=",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=~=~=~=~=",["-",3,["=","=","="],"~=~="],a);for(t=1;t<=4;++t)a={startRule:"start4"+t},expect$g(e).to.failToParse("--",void 0,a),expect$g(e).to.parse("--0",["-","-",0,[],""],a),expect$g(e).to.parse("--0==",["-","-",0,[],"=="],a),expect$g(e).to.parse("--0=~=",["-","-",0,[],"=~="],a),expect$g(e).to.parse("--3",["-","-",3,[],""],a),expect$g(e).to.parse("--3=",["-","-",3,["="],""],a),expect$g(e).to.parse("--3===",["-","-",3,["="],"=="],a),expect$g(e).to.parse("--3=~=~",["-","-",3,["=","="],"~"],a),expect$g(e).to.parse("--3=~=~=",["-","-",3,["=","=","="],""],a),expect$g(e).to.parse("--3=~=~=~=~=",["-","-",3,["=","=","="],"~=~="],a)})),it("|min..max, delimiter| matches correctly",(function(){for(var r=function(){for(var r=[],a=1;a<=4;++a)for(var n=1;n<=4;++n)r[r.length]="start"+String(a)+n;var o=e(t);return o.allowedStartRules=r,peg.generate(["start11 = min:n1 max:n1 .|min..max, '~'| $.*","start12 = min:n1 max:n1 data:.|min..max, '~'| $.*","start13 = min:n1 max:n1 .|min..max, '~'| rest:$.*","start14 = min:n1 max:n1 data:.|min..max, '~'| rest:$.*","start21 = . min:n1 max:n1 .|min..max, '~'| $.*","start22 = . min:n1 max:n1 data:.|min..max, '~'| $.*","start23 = . min:n1 max:n1 .|min..max, '~'| rest:$.*","start24 = . min:n1 max:n1 data:.|min..max, '~'| rest:$.*","start31 = a:. min:n1 max:n1 .|min..max, '~'| $.*","start32 = a:. min:n1 max:n1 data:.|min..max, '~'| $.*","start33 = a:. min:n1 max:n1 .|min..max, '~'| rest:$.*","start34 = a:. min:n1 max:n1 data:.|min..max, '~'| rest:$.*","start41 = a:. b:. min:n1 max:n1 .|min..max, '~'| $.*","start42 = a:. b:. min:n1 max:n1 data:.|min..max, '~'| $.*","start43 = a:. b:. min:n1 max:n1 .|min..max, '~'| rest:$.*","start44 = a:. b:. min:n1 max:n1 data:.|min..max, '~'| rest:$.*","n1 = n:$[0-9] { return parseInt(n, 10); }"].join(";\n"),o)}(),a=1;a<=4;++a){var n={startRule:"start1"+a};expect$g(r).to.failToParse("",void 0,n),expect$g(r).to.parse("00",[0,0,[],""],n),expect$g(r).to.parse("00==",[0,0,[],"=="],n),expect$g(r).to.parse("00=~=",[0,0,[],"=~="],n),expect$g(r).to.failToParse("23",void 0,n),expect$g(r).to.failToParse("23=",void 0,n),expect$g(r).to.failToParse("23=~",void 0,n),expect$g(r).to.failToParse("23==",void 0,n),expect$g(r).to.parse("23=~=",[2,3,["=","="],""],n),expect$g(r).to.parse("23=~=~",[2,3,["=","="],"~"],n),expect$g(r).to.parse("23=~=~=",[2,3,["=","=","="],""],n),expect$g(r).to.parse("23=~=~=~=~=",[2,3,["=","=","="],"~=~="],n)}for(a=1;a<=4;++a)n={startRule:"start2"+a},expect$g(r).to.failToParse("-",void 0,n),expect$g(r).to.parse("-00",["-",0,0,[],""],n),expect$g(r).to.parse("-00==",["-",0,0,[],"=="],n),expect$g(r).to.parse("-00=~=",["-",0,0,[],"=~="],n),expect$g(r).to.failToParse("-23",void 0,n),expect$g(r).to.failToParse("-23=",void 0,n),expect$g(r).to.failToParse("-23=~",void 0,n),expect$g(r).to.failToParse("-23==",void 0,n),expect$g(r).to.parse("-23=~=",["-",2,3,["=","="],""],n),expect$g(r).to.parse("-23=~=~",["-",2,3,["=","="],"~"],n),expect$g(r).to.parse("-23=~=~=",["-",2,3,["=","=","="],""],n),expect$g(r).to.parse("-23=~=~=~=~=",["-",2,3,["=","=","="],"~=~="],n);for(a=1;a<=4;++a)n={startRule:"start3"+a},expect$g(r).to.failToParse("-",void 0,n),expect$g(r).to.parse("-00",["-",0,0,[],""],n),expect$g(r).to.parse("-00==",["-",0,0,[],"=="],n),expect$g(r).to.parse("-00=~=",["-",0,0,[],"=~="],n),expect$g(r).to.failToParse("-23",void 0,n),expect$g(r).to.failToParse("-23=",void 0,n),expect$g(r).to.failToParse("-23=~",void 0,n),expect$g(r).to.failToParse("-23==",void 0,n),expect$g(r).to.parse("-23=~=",["-",2,3,["=","="],""],n),expect$g(r).to.parse("-23=~=~",["-",2,3,["=","="],"~"],n),expect$g(r).to.parse("-23=~=~=",["-",2,3,["=","=","="],""],n),expect$g(r).to.parse("-23=~=~=~=~=",["-",2,3,["=","=","="],"~=~="],n);for(a=1;a<=4;++a)n={startRule:"start4"+a},expect$g(r).to.failToParse("--",void 0,n),expect$g(r).to.parse("--00",["-","-",0,0,[],""],n),expect$g(r).to.parse("--00==",["-","-",0,0,[],"=="],n),expect$g(r).to.parse("--00=~=",["-","-",0,0,[],"=~="],n),expect$g(r).to.failToParse("--23",void 0,n),expect$g(r).to.failToParse("--23=",void 0,n),expect$g(r).to.failToParse("--23=~",void 0,n),expect$g(r).to.failToParse("--23==",void 0,n),expect$g(r).to.parse("--23=~=",["-","-",2,3,["=","="],""],n),expect$g(r).to.parse("--23=~=~",["-","-",2,3,["=","="],"~"],n),expect$g(r).to.parse("--23=~=~=",["-","-",2,3,["=","=","="],""],n),expect$g(r).to.parse("--23=~=~=~=~=",["-","-",2,3,["=","=","="],"~=~="],n)})),it("|val..val, delimiter| matches correctly",(function(){for(var e=r("val, '~'"),t=1;t<=4;++t){var a={startRule:"start1"+t};expect$g(e).to.failToParse("",void 0,a),expect$g(e).to.parse("0",[0,[],""],a),expect$g(e).to.parse("0==",[0,[],"=="],a),expect$g(e).to.parse("0=~=",[0,[],"=~="],a),expect$g(e).to.failToParse("3",void 0,a),expect$g(e).to.failToParse("3=",void 0,a),expect$g(e).to.failToParse("3=~",void 0,a),expect$g(e).to.parse("3=~=~=",[3,["=","=","="],""],a),expect$g(e).to.parse("3=~=~=~",[3,["=","=","="],"~"],a),expect$g(e).to.parse("3=~=~=~=~=",[3,["=","=","="],"~=~="],a)}for(t=1;t<=4;++t)a={startRule:"start2"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.parse("-0=~=",["-",0,[],"=~="],a),expect$g(e).to.failToParse("-3",void 0,a),expect$g(e).to.failToParse("-3=",void 0,a),expect$g(e).to.failToParse("-3=~",void 0,a),expect$g(e).to.parse("-3=~=~=",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=~=~=~",["-",3,["=","=","="],"~"],a),expect$g(e).to.parse("-3=~=~=~=~=",["-",3,["=","=","="],"~=~="],a);for(t=1;t<=4;++t)a={startRule:"start3"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.parse("-0=~=",["-",0,[],"=~="],a),expect$g(e).to.failToParse("-3",void 0,a),expect$g(e).to.failToParse("-3=",void 0,a),expect$g(e).to.failToParse("-3=~",void 0,a),expect$g(e).to.parse("-3=~=~=",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=~=~=~",["-",3,["=","=","="],"~"],a),expect$g(e).to.parse("-3=~=~=~=~=",["-",3,["=","=","="],"~=~="],a);for(t=1;t<=4;++t)a={startRule:"start4"+t},expect$g(e).to.failToParse("--",void 0,a),expect$g(e).to.parse("--0",["-","-",0,[],""],a),expect$g(e).to.parse("--0==",["-","-",0,[],"=="],a),expect$g(e).to.parse("--0=~=",["-","-",0,[],"=~="],a),expect$g(e).to.failToParse("--3",void 0,a),expect$g(e).to.failToParse("--3=",void 0,a),expect$g(e).to.failToParse("--3=~",void 0,a),expect$g(e).to.parse("--3=~=~=",["-","-",3,["=","=","="],""],a),expect$g(e).to.parse("--3=~=~=~",["-","-",3,["=","=","="],"~"],a),expect$g(e).to.parse("--3=~=~=~=~=",["-","-",3,["=","=","="],"~=~="],a)})),it("| exact , delimiter| matches correctly",(function(){for(var e=r("val, '~'"),t=1;t<=4;++t){var a={startRule:"start1"+t};expect$g(e).to.failToParse("",void 0,a),expect$g(e).to.parse("0",[0,[],""],a),expect$g(e).to.parse("0==",[0,[],"=="],a),expect$g(e).to.parse("0=~=",[0,[],"=~="],a),expect$g(e).to.failToParse("3",void 0,a),expect$g(e).to.failToParse("3=",void 0,a),expect$g(e).to.failToParse("3=~",void 0,a),expect$g(e).to.parse("3=~=~=",[3,["=","=","="],""],a),expect$g(e).to.parse("3=~=~=~",[3,["=","=","="],"~"],a),expect$g(e).to.parse("3=~=~=~=~=",[3,["=","=","="],"~=~="],a)}for(t=1;t<=4;++t)a={startRule:"start2"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.parse("-0=~=",["-",0,[],"=~="],a),expect$g(e).to.failToParse("-3",void 0,a),expect$g(e).to.failToParse("-3=",void 0,a),expect$g(e).to.failToParse("-3=~",void 0,a),expect$g(e).to.parse("-3=~=~=",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=~=~=~",["-",3,["=","=","="],"~"],a),expect$g(e).to.parse("-3=~=~=~=~=",["-",3,["=","=","="],"~=~="],a);for(t=1;t<=4;++t)a={startRule:"start3"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.parse("-0=~=",["-",0,[],"=~="],a),expect$g(e).to.failToParse("-3",void 0,a),expect$g(e).to.failToParse("-3=",void 0,a),expect$g(e).to.failToParse("-3=~",void 0,a),expect$g(e).to.parse("-3=~=~=",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=~=~=~",["-",3,["=","=","="],"~"],a),expect$g(e).to.parse("-3=~=~=~=~=",["-",3,["=","=","="],"~=~="],a);for(t=1;t<=4;++t)a={startRule:"start4"+t},expect$g(e).to.failToParse("--",void 0,a),expect$g(e).to.parse("--0",["-","-",0,[],""],a),expect$g(e).to.parse("--0==",["-","-",0,[],"=="],a),expect$g(e).to.parse("--0=~=",["-","-",0,[],"=~="],a),expect$g(e).to.failToParse("--3",void 0,a),expect$g(e).to.failToParse("--3=",void 0,a),expect$g(e).to.failToParse("--3=~",void 0,a),expect$g(e).to.parse("--3=~=~=",["-","-",3,["=","=","="],""],a),expect$g(e).to.parse("--3=~=~=~",["-","-",3,["=","=","="],"~"],a),expect$g(e).to.parse("--3=~=~=~=~=",["-","-",3,["=","=","="],"~=~="],a)}))})),describe("with function boundaries",(function(){it("|{2}.. , delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|{ return 2; }.., '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.parse("a~a~a",["a","a","a"])})),it("| ..{2}, delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|..{ return 2; }, '~'|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.failToParse("a~a~a")})),it("|{2}..{3}, delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|{ return 2; }..{ return 3; }, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.parse("a~a~a",["a","a","a"]),expect$g(e).to.failToParse("a~a~a~a")})),it("|{2}..{2}, delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|{ return 2; }..{ return 2; }, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.failToParse("a~a~a")})),it("|{2} , delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|{ return 2; }, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.failToParse("a~a~a")})),it("|{3}..{2}, delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|{ return 3; }..{ return 2; }, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.failToParse("a~a"),expect$g(e).to.failToParse("a~a~a")})),it("correctly pass external references to labels to boundary expression",(function(){var e=peg.generate("start = ref:'a' 'b'|{ return ref === 'a' ? 2 : 0; }.., ' '|",t);expect$g(e).to.parse("ab b",["a",["b","b"]]),e=peg.generate("start = ref:'a' 'b'|..{ return ref === 'a' ? 3 : 0; }, ' '|",t),expect$g(e).to.parse("ab b",["a",["b","b"]]),e=peg.generate("start = ref:'a' 'b'|{ return ref === 'a' ? 2 : 0; }..{ return ref === 'a' ? 3 : 0; }, ' '|",t),expect$g(e).to.parse("ab b",["a",["b","b"]]),e=peg.generate("start = ref:'a' 'b'|{ return ref === 'a' ? 2 : 0; }, ' '|",t),expect$g(e).to.parse("ab b",["a",["b","b"]])}))}))})),describe("handle delimiter correctly",(function(){it("with constant boundaries",(function(){var e=peg.generate("start = 'a'|2..3, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.failToParse("aa"),expect$g(e).to.failToParse("a~"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.failToParse("a~a~"),expect$g(e).to.parse("a~a~a",["a","a","a"]),expect$g(e).to.failToParse("a~a~a~"),expect$g(e).to.failToParse("a~a~a~a")})),it("with variable boundaries",(function(){var e=peg.generate(["start = min:n1 max:n1 'a'|min..max, '~'|","n1 = n:$[0-9] { return parseInt(n, 10); }"].join(";\n"),t);expect$g(e).to.failToParse("23"),expect$g(e).to.failToParse("23a"),expect$g(e).to.failToParse("23aa"),expect$g(e).to.failToParse("23a~"),expect$g(e).to.parse("23a~a",[2,3,["a","a"]]),expect$g(e).to.failToParse("23a~a~"),expect$g(e).to.parse("23a~a~a",[2,3,["a","a","a"]]),expect$g(e).to.failToParse("23a~a~a~"),expect$g(e).to.failToParse("23a~a~a~a")})),it("with variable boundaries in delimiter",(function(){var e=peg.generate(["start = min:n1 max:n1 'a'|2, '~'|min..max||","n1 = n:$[0-9] { return parseInt(n, 10); }"].join(";\n"),t);expect$g(e).to.failToParse("23"),expect$g(e).to.failToParse("23a"),expect$g(e).to.failToParse("23aa"),expect$g(e).to.failToParse("23a~"),expect$g(e).to.failToParse("23a~a"),expect$g(e).to.failToParse("23a~~"),expect$g(e).to.parse("23a~~a",[2,3,["a","a"]]),expect$g(e).to.parse("23a~~~a",[2,3,["a","a"]]),expect$g(e).to.failToParse("23a~~~~a"),expect$g(e).to.failToParse("23a~~a~~a")})),it("with function boundaries",(function(){var e=peg.generate("start = 'a'|{ return 2; }..{ return 3; }, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.failToParse("aa"),expect$g(e).to.failToParse("a~"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.failToParse("a~a~"),expect$g(e).to.parse("a~a~a",["a","a","a"]),expect$g(e).to.failToParse("a~a~a~"),expect$g(e).to.failToParse("a~a~a~a")}))}))})),describe("text",(function(){describe("when the expression matches",(function(){it("returns the matched text",(function(){var e=peg.generate("start = $('a' 'b' 'c')",t);expect$g(e).to.parse("abc","abc")}))})),describe("when the expression doesn't match",(function(){it("reports match failure",(function(){var e=peg.generate("start = $('a')",t);expect$g(e).to.failToParse("b")}))}))})),describe("positive simple predicate",(function(){describe("when the expression matches",(function(){it("returns |undefined|",(function(){var e=peg.generate("start = &'a' 'a'",t);expect$g(e).to.parse("a",[void 0,"a"])})),it("resets parse position",(function(){var e=peg.generate("start = &'a' 'a'",t);expect$g(e).to.parse("a")}))})),describe("when the expression doesn't match",(function(){it("reports match failure",(function(){var e=peg.generate("start = &'a'",t);expect$g(e).to.failToParse("b")})),it("discards any expectations recorded when matching the expression",(function(){var e=peg.generate("start = 'a' / &'b' / 'c'",t);expect$g(e).to.failToParse("d",{expected:[{type:"literal",text:"a",ignoreCase:!1},{type:"literal",text:"c",ignoreCase:!1}]})}))}))})),describe("negative simple predicate",(function(){describe("when the expression matches",(function(){it("reports match failure",(function(){var e=peg.generate("start = !'a'",t);expect$g(e).to.failToParse("a")}))})),describe("when the expression doesn't match",(function(){it("returns |undefined|",(function(){var e=peg.generate("start = !'a' 'b'",t);expect$g(e).to.parse("b",[void 0,"b"])})),it("resets parse position",(function(){var e=peg.generate("start = !'a' 'b'",t);expect$g(e).to.parse("b")})),it("discards any expectations recorded when matching the expression",(function(){var e=peg.generate("start = 'a' / !'b' / 'c'",t);expect$g(e).to.failToParse("b",{expected:[{type:"literal",text:"a",ignoreCase:!1},{type:"literal",text:"c",ignoreCase:!1}]})}))}))})),describe("label",(function(){describe("when the expression matches",(function(){it("returns its match result",(function(){var e=peg.generate("start = a:'a'",t);expect$g(e).to.parse("a","a")}))})),describe("when the expression doesn't match",(function(){it("reports match failure",(function(){var e=peg.generate("start = a:'a'",t);expect$g(e).to.failToParse("b")}))}))})),describe("sequence",(function(){describe("when all expressions match",(function(){it("returns an array of their match results",(function(){var e=peg.generate("start = 'a' 'b' 'c'",t);expect$g(e).to.parse("abc",["a","b","c"])})),it("plucks a single value",(function(){var e=peg.generate("start = @'a'",t);expect$g(e).to.parse("a","a"),e=peg.generate("start = @'a' / @'b'",t),expect$g(e).to.parse("a","a"),expect$g(e).to.parse("b","b"),e=peg.generate("start = 'a' @'b' 'c'",t),expect$g(e).to.parse("abc","b"),e=peg.generate("start = 'a' ( @'b' 'c' )",t),expect$g(e).to.parse("abc",["a","b"]),e=peg.generate("start = 'a' @( 'b' @'c' 'd' )",t),expect$g(e).to.parse("abcd","c"),e=peg.generate("start = 'a' ( @'b' 'c' ) @'d'",t),expect$g(e).to.parse("abcd","d"),e=peg.generate("start = 'a' @'b' 'c' / 'd' 'e' @'f'",t),expect$g(e).to.parse("def","f")})),it("plucks a multiple values",(function(){var e=peg.generate("start = 'a' @'b' @'c'",t);expect$g(e).to.parse("abc",["b","c"]),e=peg.generate("start = 'a' ( @'b' @'c' )",t),expect$g(e).to.parse("abc",["a",["b","c"]]),e=peg.generate("start = 'a' @( 'b' @'c' @'d' )",t),expect$g(e).to.parse("abcd",["c","d"]),e=peg.generate("start = 'a' @( @'b' 'c' ) @'d' 'e'",t),expect$g(e).to.parse("abcde",["b","d"]),e=peg.generate("start = 'a' @'b' 'c' / @'d' 'e' @'f'",t),expect$g(e).to.parse("def",["d","f"])})),it('prevents "@" on a semantic predicate',(function(){expect$g((function(){return peg.generate("start1 = 'a' @&{ /* semantic_and */ } 'c'")}),t).to.throw(),expect$g((function(){return peg.generate("start2 = 'a' @!{ /* semantic_not */ } 'c'")}),t).to.throw()}))})),describe("when any expression doesn't match",(function(){it("reports match failure",(function(){var e=peg.generate("start = 'a' 'b' 'c'",t);expect$g(e).to.failToParse("dbc"),expect$g(e).to.failToParse("adc"),expect$g(e).to.failToParse("abd")})),it("resets parse position",(function(){var e=peg.generate("start = 'a' 'b' / 'a'",t);expect$g(e).to.parse("a","a")}))}))})),describe("action",(function(){describe("when the expression matches",(function(){it("returns the value returned by the code",(function(){var e=peg.generate("start = 'a' { return 42; }",t);expect$g(e).to.parse("a",42)})),describe("label variables",(function(){describe("in the expression",(function(){it("can access variable defined by labeled expression",(function(){var e=peg.generate("start = a:'a' { return a; }",t);expect$g(e).to.parse("a","a")})),it("can access variables defined by labeled sequence elements",(function(){var e=peg.generate("start = a:'a' b:'b' c:'c' { return [a, b, c]; }",t);expect$g(e).to.parse("abc",["a","b","c"])})),it("cannot access variables defined by subexpressions",(function(){[{grammar:"start = (a:'a') { return a; }",input:"a"},{grammar:"start = (a:'a')? { return a; }",input:"a"},{grammar:"start = (a:'a')* { return a; }",input:"a"},{grammar:"start = (a:'a')+ { return a; }",input:"a"},{grammar:"start = (a:'a')| .. | { return a; }",input:"a"},{grammar:"start = (a:'a')|0.. | { return a; }",input:"a"},{grammar:"start = (a:'a')|1.. | { return a; }",input:"a"},{grammar:"start = (a:'a')|2.. | { return a; }",input:"aa"},{grammar:"start = (a:'a')| ..1| { return a; }",input:"a"},{grammar:"start = (a:'a')| ..3| { return a; }",input:"a"},{grammar:"start = (a:'a')|2..3| { return a; }",input:"aa"},{grammar:"start = (a:'a')|3| { return a; }",input:"aaa"},{grammar:"start = $(a:'a') { return a; }",input:"a"},{grammar:"start = &(a:'a') 'a' { return a; }",input:"a"},{grammar:"start = !(a:'a') 'b' { return a; }",input:"b"},{grammar:"start = b:(a:'a') { return a; }",input:"a"},{grammar:"start = ('a' b:'b' 'c') { return b; }",input:"abc"},{grammar:"start = (a:'a' { return a; }) { return a; }",input:"a"},{grammar:"start = ('a' / b:'b' / 'c') { return b; }",input:"b"}].forEach((function(e){var r=peg.generate(e.grammar,t);expect$g(r).to.failToParse(e.input)}))}))})),describe("in outer sequence",(function(){it("can access variables defined by preceding labeled elements",(function(){var e=peg.generate("start = a:'a' ('b' { return a; })",t);expect$g(e).to.parse("ab",["a","a"])})),it("cannot access variable defined by labeled action element",(function(){var e=peg.generate("start = 'a' b:('b' { return b; }) c:'c'",t);expect$g(e).to.failToParse("abc")})),it("cannot access variables defined by following labeled elements",(function(){var e=peg.generate("start = ('a' { return b; }) b:'b'",t);expect$g(e).to.failToParse("ab")}))}))})),describe("initializer variables & functions",(function(){it("can access variables defined in the initializer",(function(){var e=peg.generate(["{ var v = 42 }","start = 'a' { return v; }"].join("\n"),t);expect$g(e).to.parse("a",42)})),it("can access functions defined in the initializer",(function(){var e=peg.generate(["{ function f() { return 42; } }","start = 'a' { return f(); }"].join("\n"),t);expect$g(e).to.parse("a",42)}))})),describe("available variables & functions",(function(){it("|options| contains options",(function(){var e=peg.generate("start = 'a' { return options; }",t);expect$g(e).to.parse("a",{a:42},{a:42})})),it("|text| returns text matched by the expression",(function(){var e=peg.generate("start = 'a' { return text(); }",t);expect$g(e).to.parse("a","a")})),it("|location| returns location info of the expression",(function(){var e=peg.generate(["{ var result; }","start = line (nl+ line)* { return result; }","line = thing (' '+ thing)*","thing = digit / mark","digit = [0-9]","mark = 'x' { result = location(); }","nl = '\\r'? '\\n'"].join("\n"),t);expect$g(e).to.parse("1\n2\n\n3\n\n\n4 5 x",{source:void 0,start:{offset:13,line:7,column:5},end:{offset:14,line:7,column:6}}),expect$g(e).to.parse("1\nx",{source:void 0,start:{offset:2,line:2,column:1},end:{offset:3,line:2,column:2}}),expect$g(e).to.parse("1\r\nx",{source:void 0,start:{offset:3,line:2,column:1},end:{offset:4,line:2,column:2}})})),describe("|expected|",(function(){it("terminates parsing and throws an exception",(function(){var e=peg.generate("start = 'a' { expected('a'); }",t);expect$g(e).to.failToParse("a",{message:'Expected a but "a" found.',expected:[{type:"other",description:"a"}],found:"a",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:1,line:1,column:2}}})})),it("allows to set custom location info",(function(){var e=peg.generate(["start = 'a' {"," expected('a', {"," start: { offset: 1, line: 1, column: 2 },"," end: { offset: 2, line: 1, column: 3 }"," });","}"].join("\n"),t);expect$g(e).to.failToParse("a",{message:'Expected a but "a" found.',expected:[{type:"other",description:"a"}],found:"a",location:{start:{offset:1,line:1,column:2},end:{offset:2,line:1,column:3}}})}))})),describe("|error|",(function(){it("terminates parsing and throws an exception",(function(){var e=peg.generate("start = 'a' { error('a'); }",t);expect$g(e).to.failToParse("a",{message:"a",found:null,expected:null,location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:1,line:1,column:2}}})})),it("allows to set custom location info",(function(){var e=peg.generate(["start = 'a' {"," error('a', {"," start: { offset: 1, line: 1, column: 2 },"," end: { offset: 2, line: 1, column: 3 }"," });","}"].join("\n"),t);expect$g(e).to.failToParse("a",{message:"a",expected:null,found:null,location:{start:{offset:1,line:1,column:2},end:{offset:2,line:1,column:3}}})}))}))}))})),describe("when the expression doesn't match",(function(){it("reports match failure",(function(){var e=peg.generate("start = 'a' { return 42; }",t);expect$g(e).to.failToParse("b")})),it("doesn't execute the code",(function(){var e=peg.generate("start = 'a' { throw 'Boom!'; } / 'b'",t);expect$g(e).to.parse("b")}))}))})),describe("choice",(function(){describe("when any expression matches",(function(){it("returns its match result",(function(){var e=peg.generate("start = 'a' / 'b' / 'c'",t);expect$g(e).to.parse("a","a"),expect$g(e).to.parse("b","b"),expect$g(e).to.parse("c","c")}))})),describe("when all expressions don't match",(function(){it("reports match failure",(function(){var e=peg.generate("start = 'a' / 'b' / 'c'",t);expect$g(e).to.failToParse("d")}))}))})),describe("error reporting",(function(){describe("behavior",(function(){it("reports only the rightmost error",(function(){var e=peg.generate("start = 'a' 'b' / 'a' 'c' 'd'",t);expect$g(e).to.failToParse("ace",{expected:[{type:"literal",text:"d",ignoreCase:!1}]})}))})),describe("expectations reporting",(function(){it("reports expectations correctly with no alternative",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("ab",{expected:[{type:"end"}]})})),it("reports expectations correctly with one alternative",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("b",{expected:[{type:"literal",text:"a",ignoreCase:!1}]})})),it("reports expectations correctly with multiple alternatives",(function(){var e=peg.generate("start = 'aa' / 'bb' / 'cc'",t);expect$g(e).to.failToParse("dd",{expected:[{type:"literal",text:"aa",ignoreCase:!1},{type:"literal",text:"bb",ignoreCase:!1},{type:"literal",text:"cc",ignoreCase:!1}]})}))})),describe("found string reporting",(function(){it("reports found string correctly at the end of input",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("",{found:null})})),it("reports found string correctly in the middle of input",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("b",{found:"b"})}))})),describe("message building",(function(){it("builds message correctly with no alternative",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("ab",{message:'Expected end of input but "b" found.'})})),it("builds message correctly with one alternative",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("b",{message:'Expected "a" but "b" found.'})})),it("builds message correctly with multiple alternatives",(function(){var e=peg.generate("start = 'aa' / 'bb' / 'cc'",t);expect$g(e).to.failToParse("dd",{message:'Expected "aa", "bb", or "cc" but "d" found.'})})),it("builds message correctly at the end of input",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("",{message:'Expected "a" but end of input found.'})})),it("builds message correctly in the middle of input",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("b",{message:'Expected "a" but "b" found.'})})),it("removes duplicates from expectations",(function(){var e=peg.generate("start = 'a' / 'a'",t);expect$g(e).to.failToParse("b",{message:'Expected "a" but "b" found.'})})),it("sorts expectations",(function(){var e=peg.generate("start = 'cc' / 'bb' / 'aa'",t);expect$g(e).to.failToParse("d",{message:'Expected "aa", "bb", or "cc" but "d" found.'})}))})),describe("position reporting",(function(){it("reports position correctly at the end of input",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("",{location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1}}})})),it("reports position correctly in the middle of input",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("b",{location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:1,line:1,column:2}}})})),it("reports position correctly with trailing input",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("aa",{location:{source:void 0,start:{offset:1,line:1,column:2},end:{offset:2,line:1,column:3}}})})),it("reports position correctly in complex cases",(function(){var e=peg.generate(["start = line (nl+ line)*","line = digit (' '+ digit)*","digit = [0-9]","nl = '\\r'? '\\n'"].join("\n"),t);expect$g(e).to.failToParse("1\n2\n\n3\n\n\n4 5 x",{location:{source:void 0,start:{offset:13,line:7,column:5},end:{offset:14,line:7,column:6}}}),expect$g(e).to.failToParse("1\nx",{location:{source:void 0,start:{offset:2,line:2,column:1},end:{offset:3,line:2,column:2}}}),expect$g(e).to.failToParse("1\r\nx",{location:{source:void 0,start:{offset:3,line:2,column:1},end:{offset:4,line:2,column:2}}})})),it("reports location source correctly",(function(){var e={source:"object"},r=peg.generate(["start = line (nl+ line)*","line = digit (' '+ digit)*","digit = [0-9]","nl = '\\r'? '\\n'"].join("\n"),t);expect$g(r).to.failToParse("1\n2\n\n3\n\n\n4 5 x",{location:{source:e,start:{offset:13,line:7,column:5},end:{offset:14,line:7,column:6}}},{grammarSource:e})}))}))})),describe("complex examples",(function(){it("handles arithmetics example correctly",(function(){var e=peg.generate(["Expr = Sum","Sum = head:Product tail:(('+' / '-') Product)* {"," return tail.reduce(function(result, element) {"," if (element[0] === '+') { return result + element[1]; }"," if (element[0] === '-') { return result - element[1]; }"," }, head);"," }","Product = head:Value tail:(('*' / '/') Value)* {"," return tail.reduce(function(result, element) {"," if (element[0] === '*') { return result * element[1]; }"," if (element[0] === '/') { return result / element[1]; }"," }, head);"," }","Value = digits:[0-9]+ { return parseInt(digits.join(''), 10); }"," / '(' expr:Expr ')' { return expr; }"].join("\n"),t);expect$g(e).to.parse("0",0),expect$g(e).to.parse("123",123),expect$g(e).to.parse("(42+43)",85),expect$g(e).to.parse("42",42),expect$g(e).to.parse("42*43",1806),expect$g(e).to.parse("42*43*44*45",3575880),expect$g(e).to.parse("42/43",42/43),expect$g(e).to.parse("42/43/44/45",42/43/44/45),expect$g(e).to.parse("42*43",1806),expect$g(e).to.parse("42*43+44*45",3786),expect$g(e).to.parse("42*43+44*45+46*47+48*49",8300),expect$g(e).to.parse("42*43-44*45",-174),expect$g(e).to.parse("42*43-44*45-46*47-48*49",-4688),expect$g(e).to.parse("42+43",85),expect$g(e).to.parse("(1+2)*(3+4)",21)})),it("handles non-context-free language correctly",(function(){var e=peg.generate(["S = &(A 'c') a:'a'+ B:B !('a' / 'b' / 'c') { return a.join('') + B; }","A = a:'a' A:A? b:'b' { return [a, A, b].join(''); }","B = b:'b' B:B? c:'c' { return [b, B, c].join(''); }"].join("\n"),t);expect$g(e).to.parse("abc","abc"),expect$g(e).to.parse("aaabbbccc","aaabbbccc"),expect$g(e).to.failToParse("aabbbccc"),expect$g(e).to.failToParse("aaaabbbccc"),expect$g(e).to.failToParse("aaabbccc"),expect$g(e).to.failToParse("aaabbbbccc"),expect$g(e).to.failToParse("aaabbbcc"),expect$g(e).to.failToParse("aaabbbcccc")})),it("handles nested comments example correctly",(function(){var e=peg.generate(["C = begin:Begin ns:N* end:End { return begin + ns.join('') + end; }","N = C"," / !Begin !End z:Z { return z; }","Z = .","Begin = '(*'","End = '*)'"].join("\n"),t);expect$g(e).to.parse("(**)","(**)"),expect$g(e).to.parse("(*abc*)","(*abc*)"),expect$g(e).to.parse("(*(**)*)","(*(**)*)"),expect$g(e).to.parse("(*abc(*def*)ghi(*(*(*jkl*)*)*)mno*)","(*abc(*def*)ghi(*(*(*jkl*)*)*)mno*)")}))})),describe("run side-effects in non-matching",(function(){it("positive semantic predicate",(function(){var e=peg.generate("\n { let i = 0; }\n start = (neverMatched / .) { return i; };\n neverMatched = &{ i = 1; return true; } [];\n ",t);expect$g(e).to.parse("b",1),e=peg.generate('\n { let i = 0; }\n start = ("a" / neverMatched / .) { return i; };\n neverMatched = &{ i = 1; return true; } [];\n ',t),expect$g(e).to.parse("b",1)})),it("negative semantic predicate",(function(){var e=peg.generate("\n { let i = 0; }\n start = (neverMatched / .) { return i; };\n neverMatched = !{ i = 1; return false; } [];\n ",t);expect$g(e).to.parse("b",1),e=peg.generate('\n { let i = 0; }\n start = ("a" / neverMatched / .) { return i; };\n neverMatched = !{ i = 1; return false; } [];\n ',t),expect$g(e).to.parse("b",1)})),it("action",(function(){var e=peg.generate("\n { let i = 0; }\n start = (neverMatched / .) { return i; };\n neverMatched = (. { i = 1; }) [];\n ",t);expect$g(e).to.parse("b",1),e=peg.generate('\n { let i = 0; }\n start = ("a" / neverMatched / .) { return i; };\n neverMatched = (. { i = 1; }) [];\n ',t),expect$g(e).to.parse("b",1)}))}))},[{cache:!1,trace:!1},{cache:!1,trace:!0},{cache:!0,trace:!1},{cache:!0,trace:!0}].forEach((function(t){describe("with options "+chai$g.util.inspect(t),(function(){a(e(t))}))})),describe("syntax errors",(function(){it("formats",(function(){var e={source:"stdin",text:"==="};try{peg.generate(e.text,{grammarSource:e.source})}catch(t){expect$g(t).to.be.an.instanceof(peg.parser.SyntaxError),expect$g(t.format([e])).to.equal('Error: Expected "{", code block, comment, end of line, identifier, or whitespace but "=" found.\n --\x3e stdin:1:1\n |\n1 | ===\n | ^')}try{peg.generate("===",{grammarSource:"stdin"})}catch(e){expect$g(e).to.be.an.instanceof(peg.parser.SyntaxError),expect$g(e.format([])).to.equal('Error: Expected "{", code block, comment, end of line, identifier, or whitespace but "=" found.\n at stdin:1:1')}})),it("reports multiple errors in each compilation stage",(function(){try{peg.generate("\n start = leftRecursion\n leftRecursion = duplicatedLabel:duplicatedRule duplicatedLabel:missingRule\n duplicatedRule = missingRule\n duplicatedRule = start\n ")}catch(t){expect$g(t).with.property("stage","check"),expect$g(t).with.property("problems").to.be.an("array"),t.problems.forEach((function(e){expect$g(e).to.be.an("array").lengthOf.gte(2),expect$g(e[0]).to.be.oneOf(["error","warning","info"])}));var e=t.problems.filter((function(e){return"error"===e[0]})).map((function(e){return e[1]}));expect$g(e).to.include.members(['Rule "missingRule" is not defined','Rule "duplicatedRule" is already defined','Label "duplicatedLabel" is already defined',"Possible infinite loop when parsing (left recursion: duplicatedRule -> start -> leftRecursion -> duplicatedRule)"])}}))}))}));var chai$f=require$$0,parser$2=parser$4,compiler=compiler_1,expect$f=chai$f.expect;describe("Peggy compiler",(function(){it("checks start rules",(function(){var e=parser$2.parse("foo='1'");expect$f(compiler.compile(e,compiler.passes)).to.be.an("object"),expect$f((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:null})})).to.throw("allowedStartRules must be an array"),expect$f((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:[]})})).to.throw("Must have at least one start rule"),expect$f((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:["bar"]})})).to.throw('Unknown start rule "bar"')})),it("checks output type",(function(){var e=parser$2.parse("foo='1'");expect$f(compiler.compile(e,compiler.passes,{output:"source"})).to.be.a("string"),expect$f((function(){return compiler.compile(e,compiler.passes,{output:"INVALID OUTPUT TYPE"})})).to.throw("Invalid output format: INVALID OUTPUT TYPE.")})),it("generates inline sourceMappingURL",(function(){var e=parser$2.parse("foo='1'");if(expect$f(e).to.be.an("object"),"function"==typeof TextEncoder&&(expect$f(compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})).to.match(/^\/\/# sourceMappingURL=data:application\/json;charset=utf-8;base64,/m),"object"==typeof globalThis)){var t=globalThis.TextEncoder;delete globalThis.TextEncoder,expect$f((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})})).to.throw("TextEncoder is not supported by this platform"),globalThis.TextEncoder=t}})),it("requires grammarSource with source-map",(function(){var e=parser$2.parse("foo='1'");expect$f(e).to.be.an("object"),expect$f((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map"})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),expect$f((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map",grammarSource:""})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),"function"==typeof TextEncoder&&expect$f((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:{toString:function(){return""}}})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps")}))}));var __spreadArray$1=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n<o;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},GrammarError$1=peg_1.GrammarError,parser$1=parser$4,Session=session,helpers$a=function(e,t){var r=e.Assertion;e.use(requireChaiLike()),r.addMethod("changeAST",(function(e,a,n){n=void 0!==n?n:{};var o=parser$1.parse(e,n);t.flag(this,"object")(o,n,new Session({error:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];throw new(GrammarError$1.bind.apply(GrammarError$1,__spreadArray$1([void 0],t,!1)))}})),new r(o).like(a)})),r.addMethod("reportError",(function(e,a){var n=parser$1.parse(e),o=void 0,s=void 0;try{t.flag(this,"object")(n,{},new Session({error:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];throw new(GrammarError$1.bind.apply(GrammarError$1,__spreadArray$1([void 0],t,!1)))}})),o=!0}catch(e){s=e,o=!1}this.assert(!o,"expected #{this} to report an error but it didn't","expected #{this} to not report an error but #{act} was reported",null,s),o||void 0===a||Object.keys(a).forEach((function(e){new r(s).to.have.property(e).that.is.deep.equal(a[e])}))}))},chai$e=require$$0,helpers$9=helpers$a,pass$a=generateBytecode_1;chai$e.use(helpers$9);var expect$e=chai$e.expect;describe("compiler pass |generateBytecode|",(function(){function e(e){return{rules:[{bytecode:e}]}}function t(e,t){return{rules:[{bytecode:e}],locations:t}}function r(e,t,r,a){return{literals:e,classes:t,expectations:r,functions:a}}describe("for grammar",(function(){it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(["a = 'a'","b = 'b'","c = 'c'"].join("\n"),{rules:[{bytecode:[18,0,2,2,22,0,23,0]},{bytecode:[18,1,2,2,22,1,23,1]},{bytecode:[18,2,2,2,22,2,23,2]}]})})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(["a = 'a'","b = 'b'","c = 'c'"].join("\n"),r(["a","b","c"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1},{type:"literal",value:"c",ignoreCase:!1}],[]))})),it("generates correct source mapping",(function(){expect$e(pass$a).to.changeAST(["a = 'a'"].join("\n"),t([37,0,18,0,2,2,22,0,23,0,38],[{source:"-",start:{offset:4,line:1,column:5},end:{offset:7,line:1,column:8}}]),{grammarSource:"-",output:"source-and-map"})})),it("generates correct plucking bytecode",(function(){expect$e(pass$a).to.changeAST("start = 'a' @'b' 'c'",e([5,18,0,2,2,22,0,23,0,15,34,3,18,1,2,2,22,1,23,1,15,19,4,18,2,2,2,22,2,23,2,15,4,4,36,4,1,1,8,3,7,3,8,2,7,3,6,7,3])),expect$e(pass$a).to.changeAST("start = 'a' @'b' @'c'",e([5,18,0,2,2,22,0,23,0,15,35,3,18,1,2,2,22,1,23,1,15,20,4,18,2,2,2,22,2,23,2,15,5,4,36,4,2,1,0,8,3,7,3,8,2,7,3,6,7,3]))}))})),describe("for rule",(function(){it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST("start = 'a'",e([18,0,2,2,22,0,23,0]))}))})),describe("for named",(function(){var t="start 'start' = 'a'";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([28,18,0,2,2,22,0,23,1,29,14,2,0,23,0]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"rule",value:"start"},{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("for choice",(function(){it("generates correct bytecode and source mapping",(function(){expect$e(pass$a).to.changeAST("start = 'a' / label:'b' / 'c'",t([37,5,37,0,18,0,2,2,22,0,23,0,38,14,36,0,6,37,3,39,0,2,2,37,1,18,1,2,2,22,1,23,1,38,40,0,38,14,12,0,6,37,4,18,3,2,2,22,3,23,2,38,38],[{source:"-",start:{offset:8,line:1,column:9},end:{offset:11,line:1,column:12}},{source:"-",start:{offset:20,line:1,column:21},end:{offset:23,line:1,column:24}},{source:"-",start:{offset:14,line:1,column:15},end:{offset:19,line:1,column:20}},{source:"-",start:{offset:14,line:1,column:15},end:{offset:23,line:1,column:24}},{source:"-",start:{offset:26,line:1,column:27},end:{offset:29,line:1,column:30}},{source:"-",start:{offset:8,line:1,column:9},end:{offset:29,line:1,column:30}}]),{grammarSource:"-",output:"source-and-map"})}))})),describe("for action",(function(){describe("without labels",(function(){var t="start = 'a' { code }";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,18,0,2,2,22,0,23,0,15,6,0,24,1,26,0,1,0,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!1,params:[],body:" code ",location:{source:void 0,start:{offset:13,line:1,column:14},end:{offset:19,line:1,column:20}}}]))}))})),describe("with one label",(function(){var t="start = a:'a' { code }";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,18,0,2,2,22,0,23,0,15,7,0,24,1,26,0,1,1,0,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!1,params:["a"],body:" code ",location:{source:void 0,start:{offset:15,line:1,column:16},end:{offset:21,line:1,column:22}}}]))}))})),describe("with multiple labels",(function(){var t="start = a:'a' b:'b' c:'c' { code }";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,18,0,2,2,22,0,23,0,15,39,3,18,1,2,2,22,1,23,1,15,24,4,18,2,2,2,22,2,23,2,15,9,4,24,3,26,0,4,3,2,1,0,8,3,7,3,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b","c"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1},{type:"literal",value:"c",ignoreCase:!1}],[{predicate:!1,params:["a","b","c"],body:" code ",location:{source:void 0,start:{offset:27,line:1,column:28},end:{offset:33,line:1,column:34}}}]))}))}))})),describe("for sequence",(function(){var t="start = 'a' 'b' 'c'";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,18,0,2,2,22,0,23,0,15,33,3,18,1,2,2,22,1,23,1,15,18,4,18,2,2,2,22,2,23,2,15,3,4,11,3,9,8,3,7,3,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b","c"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1},{type:"literal",value:"c",ignoreCase:!1}],[]))}))})),describe("for labeled",(function(){it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST("start = a:'a'",e([18,0,2,2,22,0,23,0]))}))})),describe("for text",(function(){it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST("start = $'a'",e([5,18,0,2,2,22,0,23,0,15,2,1,6,12,9]))}))})),describe("for simple_and",(function(){var t="start = &'a'";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,28,18,0,2,2,22,0,23,0,29,15,3,3,6,7,1,6,6,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("for simple_not",(function(){var t="start = !'a'";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,28,18,0,2,2,22,0,23,0,29,14,3,3,6,6,1,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("for optional",(function(){var t="start = 'a'?";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([18,0,2,2,22,0,23,0,14,2,0,6,2]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("for zero_or_more",(function(){var t="start = 'a'*";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,16,9,10,18,0,2,2,22,0,23,0,6]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("for one_or_more",(function(){var t="start = 'a'+";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,15,12,3,16,9,10,18,0,2,2,22,0,23,0,6,6,6,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("for repeated",(function(){describe("without delimiter",(function(){describe("| .. | (edge case -- no boundaries)",(function(){var t="start = 'a'| .. |";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,16,9,10,18,0,2,2,22,0,23,0,6]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("with constant boundaries",(function(){describe("| ..3| (edge case -- no min boundary)",(function(){var t="start = 'a'| ..3|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,16,14,10,31,3,1,8,3,18,0,2,2,22,0,23,0,6]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("| ..1| (edge case -- no min boundary -- same as |optional|)",(function(){var t="start = 'a'| ..1|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,16,14,10,31,1,1,8,3,18,0,2,2,22,0,23,0,6]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("|2.. | (edge case -- no max boundary)",(function(){var t="start = 'a'|2.. |";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,4,18,0,2,2,22,0,23,0,16,9,10,18,0,2,2,22,0,23,0,6,30,2,3,1,6,7,3,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("|0.. | (edge case -- no max boundary -- same as |zero or more|)",(function(){var t="start = 'a'|0.. |";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,16,9,10,18,0,2,2,22,0,23,0,6]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("|1.. | (edge case -- no max boundary -- same as |one or more|)",(function(){var t="start = 'a'|1.. |";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,4,18,0,2,2,22,0,23,0,16,9,10,18,0,2,2,22,0,23,0,6,30,1,3,1,6,7,3,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("|2..3|",(function(){var t="start = 'a'|2..3|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,4,18,0,2,2,22,0,23,0,16,14,10,31,3,1,8,3,18,0,2,2,22,0,23,0,6,30,2,3,1,6,7,3,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("| 42 | (edge case -- exact repetitions)",(function(){var t="start = 'a'|42|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,4,18,0,2,2,22,0,23,0,16,14,10,31,42,1,8,3,18,0,2,2,22,0,23,0,6,30,42,3,1,6,7,3,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))}))})),describe("with variable boundaries",(function(){describe("| ..x| (edge case -- no min boundary)",(function(){var t="start = max:('a'{return 42;}) 'a'| ..max|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,18,0,2,2,22,0,23,0,15,6,0,24,1,26,0,1,0,9,15,41,3,4,33,1,1,8,3,18,0,2,2,22,0,23,0,16,14,10,33,1,1,8,3,18,0,2,2,22,0,23,0,6,15,3,4,11,2,9,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"}]))}))})),describe("|x.. | (edge case -- no max boundary)",(function(){var t="start = min:('a'{return 42;}) 'a'|min.. |";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,18,0,2,2,22,0,23,0,15,6,0,24,1,26,0,1,0,9,15,40,3,5,4,18,0,2,2,22,0,23,0,16,9,10,18,0,2,2,22,0,23,0,6,32,2,3,1,6,7,3,9,15,3,4,11,2,9,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"}]))}))})),describe("|x..y|",(function(){var t="start = min:('a'{return 42;}) max:('a'{return 42;}) 'a'|min..max|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,18,0,2,2,22,0,23,0,15,6,0,24,1,26,0,1,0,9,15,77,3,5,18,0,2,2,22,0,23,0,15,7,0,24,1,26,1,1,1,2,9,15,50,4,5,4,33,2,1,8,3,18,0,2,2,22,0,23,0,16,14,10,33,2,1,8,3,18,0,2,2,22,0,23,0,6,32,3,3,1,6,7,3,9,15,3,4,11,3,9,8,3,7,3,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"},{predicate:!1,params:["min"],body:"return 42;"}]))}))})),describe("|exact| (edge case -- exact repetitions)",(function(){var t="start = exact:('a'{return 42;}) 'a'|exact|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,18,0,2,2,22,0,23,0,15,6,0,24,1,26,0,1,0,9,15,50,3,5,4,33,2,1,8,3,18,0,2,2,22,0,23,0,16,14,10,33,2,1,8,3,18,0,2,2,22,0,23,0,6,32,2,3,1,6,7,3,9,15,3,4,11,2,9,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"}]))}))}))})),describe("with function boundaries",(function(){describe("| ..x| (edge case -- no min boundary)",(function(){var t="start = 'a'| ..{return 42;}|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([26,0,0,0,4,33,1,1,8,3,18,0,2,2,22,0,23,0,16,14,10,33,1,1,8,3,18,0,2,2,22,0,23,0,6,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!0,params:[],body:"return 42;"}]))}))})),describe("|x.. | (edge case -- no max boundary)",(function(){var t="start = 'a'|{return 42;}.. |";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([26,0,0,0,5,4,18,0,2,2,22,0,23,0,16,9,10,18,0,2,2,22,0,23,0,6,32,2,3,1,6,7,3,9,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!0,params:[],body:"return 42;"}]))}))})),describe("|x..y|",(function(){var t="start = 'a'|{return 41;}..{return 43;}|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([26,0,0,0,26,1,0,0,5,4,33,2,1,8,3,18,0,2,2,22,0,23,0,16,14,10,33,2,1,8,3,18,0,2,2,22,0,23,0,6,32,3,3,1,6,7,3,9,9,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!0,params:[],body:"return 41;"},{predicate:!0,params:[],body:"return 43;"}]))}))})),describe("|exact| (edge case -- exact repetitions)",(function(){var t="start = 'a'|{return 42;}|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([26,0,0,0,5,4,33,2,1,8,3,18,0,2,2,22,0,23,0,16,14,10,33,2,1,8,3,18,0,2,2,22,0,23,0,6,32,2,3,1,6,7,3,9,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!0,params:[],body:"return 42;"}]))}))}))}))})),describe("with delimiter",(function(){describe("| .. , delim| (edge case -- no boundaries)",(function(){var t="start = 'a'| .. , 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,16,30,10,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[]))}))})),describe("with constant boundaries",(function(){describe("| ..3, delim| (edge case -- no min boundary)",(function(){var t="start = 'a'| ..3, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,16,35,10,31,3,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[]))}))})),describe("| ..1, delim| (edge case -- no min boundary -- same as |optional|)",(function(){var t="start = 'a'| ..1, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,16,35,10,31,1,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[]))}))})),describe("|2.. , delim| (edge case -- no max boundary)",(function(){var t="start = 'a'|2.. , 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,4,18,0,2,2,22,0,23,0,16,30,10,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,30,2,3,1,6,7,3,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[]))}))})),describe("|0.. , delim| (edge case -- no max boundary -- same as |zero or more|)",(function(){var t="start = 'a'|0.. , 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,16,30,10,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[]))}))})),describe("|1.. , delim| (edge case -- no max boundary -- same as |one or more|)",(function(){var t="start = 'a'|1.. , 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,4,18,0,2,2,22,0,23,0,16,30,10,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,30,1,3,1,6,7,3,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[]))}))})),describe("|2..3, delim|",(function(){var t="start = 'a'|2..3, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,4,18,0,2,2,22,0,23,0,16,35,10,31,3,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,30,2,3,1,6,7,3,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[]))}))})),describe("| 42 , delim| (edge case -- exact repetitions)",(function(){var t="start = 'a'|42, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,4,18,0,2,2,22,0,23,0,16,35,10,31,42,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,30,42,3,1,6,7,3,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[]))}))}))})),describe("with variable boundaries",(function(){describe("| ..x, delim| (edge case -- no min boundary)",(function(){var t="start = max:(''{return 42;}) 'a'| ..max, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,35,15,6,0,24,1,26,0,1,0,9,15,62,3,4,33,1,1,8,3,18,0,2,2,22,0,23,0,16,35,10,33,1,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,15,3,4,11,2,9,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"}]))}))})),describe("|x.. , delim| (edge case -- no max boundary)",(function(){var t="start = min:(''{return 42;}) 'a'|min.. , 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,35,15,6,0,24,1,26,0,1,0,9,15,61,3,5,4,18,0,2,2,22,0,23,0,16,30,10,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,32,2,3,1,6,7,3,9,15,3,4,11,2,9,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"}]))}))})),describe("|x..y, delim|",(function(){var t="start = min:(''{return 42;}) max:(''{return 42;}) 'a'|min..max, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,35,15,6,0,24,1,26,0,1,0,9,15,91,3,5,35,15,7,0,24,1,26,1,1,1,2,9,15,71,4,5,4,33,2,1,8,3,18,0,2,2,22,0,23,0,16,35,10,33,2,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,32,3,3,1,6,7,3,9,15,3,4,11,3,9,8,3,7,3,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"},{predicate:!1,params:["min"],body:"return 42;"}]))}))})),describe("|exact, delim| (edge case -- exact repetitions)",(function(){var t="start = exact:(''{return 42;}) 'a'|exact, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,35,15,6,0,24,1,26,0,1,0,9,15,71,3,5,4,33,2,1,8,3,18,0,2,2,22,0,23,0,16,35,10,33,2,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,32,2,3,1,6,7,3,9,15,3,4,11,2,9,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"}]))}))})),describe("used in delimiter",(function(){describe("delim|min..|",(function(){var t="start = min:(''{return 42;}) 'a'|.., 'b'|min..| |";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,35,15,6,0,24,1,26,0,1,0,9,15,74,3,4,18,0,2,2,22,0,23,0,16,52,10,5,5,4,18,1,2,2,22,1,23,1,16,9,10,18,1,2,2,22,1,23,1,6,32,4,3,1,6,7,3,9,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,15,3,4,11,2,9,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"}]))}))})),describe("delim|..max|",(function(){var t="start = max:(''{return 42;}) 'a'|.., 'b'|..max| |";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,35,15,6,0,24,1,26,0,1,0,9,15,75,3,4,18,0,2,2,22,0,23,0,16,53,10,5,4,33,3,1,8,3,18,1,2,2,22,1,23,1,16,14,10,33,3,1,8,3,18,1,2,2,22,1,23,1,6,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,15,3,4,11,2,9,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"}]))}))})),describe("delim|exact|",(function(){var t="start = exact:(''{return 42;}) 'a'|.., 'b'|exact| |";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,35,15,6,0,24,1,26,0,1,0,9,15,84,3,4,18,0,2,2,22,0,23,0,16,62,10,5,5,4,33,4,1,8,3,18,1,2,2,22,1,23,1,16,14,10,33,4,1,8,3,18,1,2,2,22,1,23,1,6,32,4,3,1,6,7,3,9,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,15,3,4,11,2,9,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"}]))}))}))}))})),describe("with function boundaries",(function(){describe("| ..x, delim| (edge case -- no min boundary)",(function(){var t="start = 'a'| ..{return 42;}, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([26,0,0,0,4,33,1,1,8,3,18,0,2,2,22,0,23,0,16,35,10,33,1,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!0,params:[],body:"return 42;"}]))}))})),describe("|x.. , delim| (edge case -- no max boundary)",(function(){var t="start = 'a'|{return 42;}.. , 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([26,0,0,0,5,4,18,0,2,2,22,0,23,0,16,30,10,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,32,2,3,1,6,7,3,9,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!0,params:[],body:"return 42;"}]))}))})),describe("|x..y, delim|",(function(){var t="start = 'a'|{return 41;}..{return 43;}, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([26,0,0,0,26,1,0,0,5,4,33,2,1,8,3,18,0,2,2,22,0,23,0,16,35,10,33,2,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,32,3,3,1,6,7,3,9,9,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!0,params:[],body:"return 41;"},{predicate:!0,params:[],body:"return 43;"}]))}))})),describe("|exact, delim| (edge case -- exact repetitions)",(function(){var t="start = 'a'|{return 42;}, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([26,0,0,0,5,4,33,2,1,8,3,18,0,2,2,22,0,23,0,16,35,10,33,2,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,32,2,3,1,6,7,3,9,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!0,params:[],body:"return 42;"}]))}))}))}))}))})),describe("for group",(function(){var t="start = ('a')";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([18,0,2,2,22,0,23,0]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("for semantic_and",(function(){describe("without labels",(function(){var t="start = &{ code }";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([25,26,0,0,0,13,2,2,6,1,6,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r([],[],[],[{predicate:!0,params:[],body:" code ",location:{source:void 0,start:{offset:10,line:1,column:11},end:{offset:16,line:1,column:17}}}]))}))})),describe("with labels",(function(){var t="start = a:'a' b:'b' c:'c' &{ code }";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,18,0,2,2,22,0,23,0,15,55,3,18,1,2,2,22,1,23,1,15,40,4,18,2,2,2,22,2,23,2,15,25,4,25,26,0,0,3,2,1,0,13,2,2,6,1,6,3,15,3,4,11,4,9,8,4,7,3,8,3,7,3,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b","c"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1},{type:"literal",value:"c",ignoreCase:!1}],[{predicate:!0,params:["a","b","c"],body:" code ",location:{source:void 0,start:{offset:28,line:1,column:29},end:{offset:34,line:1,column:35}}}]))}))}))})),describe("for semantic_not",(function(){describe("without labels",(function(){var t="start = !{ code }";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([25,26,0,0,0,13,2,2,6,3,6,1]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r([],[],[],[{predicate:!0,params:[],body:" code ",location:{source:void 0,start:{offset:10,line:1,column:11},end:{offset:16,line:1,column:17}}}]))}))})),describe("with labels",(function(){var t="start = a:'a' b:'b' c:'c' !{ code }";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,18,0,2,2,22,0,23,0,15,55,3,18,1,2,2,22,1,23,1,15,40,4,18,2,2,2,22,2,23,2,15,25,4,25,26,0,0,3,2,1,0,13,2,2,6,3,6,1,15,3,4,11,4,9,8,4,7,3,8,3,7,3,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b","c"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1},{type:"literal",value:"c",ignoreCase:!1}],[{predicate:!0,params:["a","b","c"],body:" code ",location:{source:void 0,start:{offset:28,line:1,column:29},end:{offset:34,line:1,column:35}}}]))}))}))})),describe("for rule_ref",(function(){it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(["start = other","other = 'other'"].join("\n"),{rules:[{bytecode:[27,1]},{}]})}))})),describe("for literal",(function(){describe("empty",(function(){var t="start = ''";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([35]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r([],[],[],[]))}))})),describe("non-empty case-sensitive",(function(){var t="start = 'a'";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([18,0,2,2,22,0,23,0]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("non-empty case-insensitive",(function(){var t="start = 'A'i";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([19,0,2,2,21,1,23,0]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"A",ignoreCase:!0}],[]))}))}))})),describe("for class",(function(){it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST("start = [a]",e([20,0,2,2,21,1,23,0]))})),describe("non-inverted case-sensitive",(function(){it("defines correct constants",(function(){expect$e(pass$a).to.changeAST("start = [a]",r([],[{value:["a"],ignoreCase:!1,inverted:!1}],[{type:"class",value:["a"],ignoreCase:!1,inverted:!1}],[]))}))})),describe("inverted case-sensitive",(function(){it("defines correct constants",(function(){expect$e(pass$a).to.changeAST("start = [^a]",r([],[{value:["a"],ignoreCase:!1,inverted:!0}],[{type:"class",value:["a"],ignoreCase:!1,inverted:!0}],[]))}))})),describe("non-inverted case-insensitive",(function(){it("defines correct constants",(function(){expect$e(pass$a).to.changeAST("start = [a]i",r([],[{value:["a"],ignoreCase:!0,inverted:!1}],[{type:"class",value:["a"],ignoreCase:!0,inverted:!1}],[]))}))})),describe("complex",(function(){it("defines correct constants",(function(){expect$e(pass$a).to.changeAST("start = [ab-def-hij-l]",r([],[{value:["a",["b","d"],"e",["f","h"],"i",["j","l"]],ignoreCase:!1,inverted:!1}],[{type:"class",value:["a",["b","d"],"e",["f","h"],"i",["j","l"]],ignoreCase:!1,inverted:!1}],[]))}))}))})),describe("for any",(function(){var t="start = .";it("generates bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([17,2,2,21,1,23,0]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r([],[],[{type:"any"}],[]))}))}))}));var __assign=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},__assign.apply(this,arguments)},chai$d=require$$0,pass$9=generateJs,expect$d=chai$d.expect;describe("compiler pass |generateJS|",(function(){describe("coverage",(function(){var e={type:"grammar",rules:[],location:{source:"",start:{line:1,column:1,offset:0},end:{line:1,column:1,offset:0}}},t={};it("throws unless various grammar fields are set",(function(){expect$d((function(){return pass$9(e,t)})).to.throw(Error,"generateJS: generate bytecode was not called."),e.literals=[],expect$d((function(){return pass$9(__assign(__assign({},e),{literals:[]}),t)})).to.throw(Error,"generateJS: generate bytecode was not called."),e.locations=[],expect$d((function(){return pass$9(__assign(__assign({},e),{literals:[]}),t)})).to.throw(Error,"generateJS: generate bytecode was not called."),e.classes=[],expect$d((function(){return pass$9(__assign(__assign({},e),{literals:[]}),t)})).to.throw(Error,"generateJS: generate bytecode was not called."),e.expectations=[],expect$d((function(){return pass$9(__assign(__assign({},e),{literals:[]}),t)})).to.throw(Error,"generateJS: generate bytecode was not called."),e.functions=[],expect$d((function(){return pass$9(e,t)})).to.throw(Error,"generateJS: options.allowedStartRules was not set."),t.allowedStartRules=["start"],expect$d((function(){return pass$9(e,t)})).to.not.throw()}))}))}));var chai$c=require$$0,helpers$8=helpers$a,pass$8=inferenceMatchResult_1;chai$c.use(helpers$8);var expect$c=chai$c.expect;describe("compiler pass |inferenceMatchResult|",(function(){it("calculate |match| property for |any| correctly",(function(){expect$c(pass$8).to.changeAST("start = .",{rules:[{match:0}]})})),it("calculate |match| property for |literal| correctly",(function(){expect$c(pass$8).to.changeAST("start = ''",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''i",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = 'a'",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = 'a'i",{rules:[{match:0}]})})),it("calculate |match| property for |class| correctly",(function(){expect$c(pass$8).to.changeAST("start = []",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []i",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = [a]",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = [a]i",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = [a-b]",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = [a-b]i",{rules:[{match:0}]})})),it("calculate |match| property for |sequence| correctly",(function(){expect$c(pass$8).to.changeAST("start = 'a' 'b'",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = 'a' ''",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = '' 'b'",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = '' ''",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = 'a' []",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = [] 'b'",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = [] []",{rules:[{match:-1}]})})),it("calculate |match| property for |choice| correctly",(function(){expect$c(pass$8).to.changeAST("start = 'a' / 'b'",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = 'a' / ''",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = '' / 'b'",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = '' / ''",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = 'a' / []",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = [] / 'b'",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = [] / []",{rules:[{match:-1}]})})),it("calculate |match| property for predicates correctly",(function(){expect$c(pass$8).to.changeAST("start = &.",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = &''",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = &[]",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = !.",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = !''",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = ![]",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = &{ code }",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = !{ code }",{rules:[{match:0}]})})),it("calculate |match| property for |text| correctly",(function(){expect$c(pass$8).to.changeAST("start = $.",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = $''",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = $[]",{rules:[{match:-1}]})})),it("calculate |match| property for |action| correctly",(function(){expect$c(pass$8).to.changeAST("start = . { code }",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = '' { code }",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = [] { code }",{rules:[{match:-1}]})})),it("calculate |match| property for |labeled| correctly",(function(){expect$c(pass$8).to.changeAST("start = a:.",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = a:''",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = a:[]",{rules:[{match:-1}]})})),it("calculate |match| property for |named| correctly",(function(){expect$c(pass$8).to.changeAST("start 'start' = .",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start 'start' = ''",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start 'start' = []",{rules:[{match:-1}]})})),it("calculate |match| property for |optional| correctly",(function(){expect$c(pass$8).to.changeAST("start = .?",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''?",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []?",{rules:[{match:1}]})})),it("calculate |match| property for |zero_or_more| correctly",(function(){expect$c(pass$8).to.changeAST("start = .*",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''*",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []*",{rules:[{match:1}]})})),it("calculate |match| property for |one_or_more| correctly",(function(){expect$c(pass$8).to.changeAST("start = .+",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''+",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []+",{rules:[{match:-1}]})})),describe("calculate |match| property for |repeated|",(function(){describe("without delimiter",(function(){describe("with constant boundaries",(function(){it("for | .. | correctly",(function(){expect$c(pass$8).to.changeAST("start = .| .. |",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| .. |",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| .. |",{rules:[{match:1}]})})),it("for | ..1| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| ..1|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| ..1|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| ..1|",{rules:[{match:1}]})})),it("for | ..3| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| ..3|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| ..3|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| ..3|",{rules:[{match:1}]})})),it("for |0.. | correctly",(function(){expect$c(pass$8).to.changeAST("start = .|0.. |",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''|0.. |",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []|0.. |",{rules:[{match:1}]})})),it("for |1.. | correctly",(function(){expect$c(pass$8).to.changeAST("start = .|1.. |",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|1.. |",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []|1.. |",{rules:[{match:-1}]})})),it("for |2.. | correctly",(function(){expect$c(pass$8).to.changeAST("start = .|2.. |",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|2.. |",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []|2.. |",{rules:[{match:-1}]})})),it("for |2..3| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|2..3|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|2..3|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []|2..3|",{rules:[{match:-1}]})})),it("for | 42 | correctly",(function(){expect$c(pass$8).to.changeAST("start = .| 42 |",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| 42 |",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| 42 |",{rules:[{match:-1}]})}))})),describe("with variable boundaries",(function(){it("for | ..max| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| ..max|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| ..max|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| ..max|",{rules:[{match:0}]})})),it("for |min.. | correctly",(function(){expect$c(pass$8).to.changeAST("start = .|min.. |",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|min.. |",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|min.. |",{rules:[{match:0}]})})),it("for |min..max| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|min..max|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|min..max|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|min..max|",{rules:[{match:0}]})})),it("for | exact | correctly",(function(){expect$c(pass$8).to.changeAST("start = .|exact|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|exact|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|exact|",{rules:[{match:0}]})}))})),describe("with function boundaries",(function(){it("for | ..{}| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| ..{}|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| ..{}|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| ..{}|",{rules:[{match:0}]})})),it("for |{}.. | correctly",(function(){expect$c(pass$8).to.changeAST("start = .|{}.. |",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|{}.. |",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|{}.. |",{rules:[{match:0}]})})),it("for |{}..{}| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|{}..{}|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|{}..{}|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|{}..{}|",{rules:[{match:0}]})})),it("for | {} | correctly",(function(){expect$c(pass$8).to.changeAST("start = .|{}|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|{}|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|{}|",{rules:[{match:0}]})}))}))})),describe("with delimiter",(function(){describe("with constant boundaries",(function(){it("for | .. , delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| .. , .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = .| .. ,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = .| .. ,[]|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| .. , .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| .. ,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| .. ,[]|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| .. , .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| .. ,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| .. ,[]|",{rules:[{match:1}]})})),it("for | ..1, delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| ..1, .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = .| ..1,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = .| ..1,[]|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| ..1, .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| ..1,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| ..1,[]|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| ..1, .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| ..1,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| ..1,[]|",{rules:[{match:1}]})})),it("for | ..3, delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| ..3, .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = .| ..3,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = .| ..3,[]|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| ..3, .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| ..3,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| ..3,[]|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| ..3, .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| ..3,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| ..3,[]|",{rules:[{match:1}]})})),it("for |0.. , delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|0.. , .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = .|0.. ,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = .|0.. ,[]|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''|0.. , .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''|0.. ,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''|0.. ,[]|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []|0.. , .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []|0.. ,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []|0.. ,[]|",{rules:[{match:1}]})})),it("for |1.. , delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|1.. , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|1.. ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|1.. ,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|1.. , .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''|1.. ,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''|1.. ,[]|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []|1.. , .|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []|1.. ,''|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []|1.. ,[]|",{rules:[{match:-1}]})})),it("for |2.. , delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|2.. , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|2.. ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|2.. ,[]|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = ''|2.. , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|2.. ,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''|2.. ,[]|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []|2.. , .|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []|2.. ,''|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []|2.. ,[]|",{rules:[{match:-1}]})})),it("for |2..3, delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|2..3, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|2..3,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|2..3,[]|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = ''|2..3, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|2..3,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''|2..3,[]|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []|2..3, .|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []|2..3,''|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []|2..3,[]|",{rules:[{match:-1}]})})),it("for | 42 , delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| 42 , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| 42 ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| 42 ,[]|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = ''| 42 , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| 42 ,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| 42 ,[]|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []| 42 , .|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []| 42 ,''|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []| 42 ,[]|",{rules:[{match:-1}]})}))})),describe("with variable boundaries",(function(){it("for | ..max, delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| ..max, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| ..max,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| ..max,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| ..max, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| ..max,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| ..max,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| ..max, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| ..max,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| ..max,[]|",{rules:[{match:0}]})})),it("for |min.. , delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|min.. , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|min.. ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|min.. ,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|min.. , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|min.. ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|min.. ,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|min.. , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|min.. ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|min.. ,[]|",{rules:[{match:0}]})})),it("for |min..max, delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|min..max, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|min..max,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|min..max,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|min..max, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|min..max,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|min..max,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|min..max, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|min..max,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|min..max,[]|",{rules:[{match:0}]})})),it("for | exact , delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| exact , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| exact ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| exact ,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| exact , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| exact ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| exact ,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| exact , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| exact ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| exact ,[]|",{rules:[{match:0}]})}))})),describe("with function boundaries",(function(){it("for | ..{}, delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| ..{}, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| ..{},''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| ..{},[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| ..{}, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| ..{},''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| ..{},[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| ..{}, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| ..{},''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| ..{},[]|",{rules:[{match:0}]})})),it("for |{}.. , delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|{}.. , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|{}.. ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|{}.. ,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|{}.. , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|{}.. ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|{}.. ,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|{}.. , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|{}.. ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|{}.. ,[]|",{rules:[{match:0}]})})),it("for |{}..{}, delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|{}..{}, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|{}..{},''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|{}..{},[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|{}..{}, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|{}..{},''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|{}..{},[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|{}..{}, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|{}..{},''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|{}..{},[]|",{rules:[{match:0}]})})),it("for | {} , delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| {} , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| {} ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| {} ,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| {} , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| {} ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| {} ,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| {} , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| {} ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| {} ,[]|",{rules:[{match:0}]})}))}))}))})),it("calculate |match| property for |group| correctly",(function(){expect$c(pass$8).to.changeAST("start = (.)",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ('')",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ([])",{rules:[{match:-1}]})})),it("calculate |match| property for |rule_ref| correctly",(function(){expect$c(pass$8).to.changeAST(["start = end","end = . "].join("\n"),{rules:[{match:0},{match:0}]}),expect$c(pass$8).to.changeAST(["start = end","end = ''"].join("\n"),{rules:[{match:1},{match:1}]}),expect$c(pass$8).to.changeAST(["start = end","end = []"].join("\n"),{rules:[{match:-1},{match:-1}]}),expect$c(pass$8).to.changeAST("start = . start",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = '' start",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = [] start",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = . start []",{rules:[{match:-1}]})}))}));var chai$b=require$$0,helpers$7=helpers$a,pass$7=mergeCharacterClasses_1;chai$b.use(helpers$7);var expect$b=chai$b.expect;describe("compiler pass |mergeCharacterClasses|",(function(){it("Merges single character literals, class, and ref_rules",(function(){expect$b(pass$7).to.changeAST(["one = three / $('a' / 'd') / [c-f] / [efh] / [c-h] / [c-g]","two = 'P' / 'P' / three / 'P' / [Q-T]","three = $('x' / [u-w])","four = 'a' / [aaa] / 'a'"].join("\n"),{rules:[{name:"one",expression:{type:"class",parts:["a",["c","h"],["u","x"]],ignoreCase:!1,inverted:!1,location:{start:{line:1,column:7},end:{line:1,column:59}}}},{name:"two",expression:{type:"class",parts:[["P","T"],["u","x"]],ignoreCase:!1,inverted:!1,location:{start:{line:2,column:7},end:{line:2,column:38}}}},{name:"three",expression:{type:"class",parts:[["u","x"]],ignoreCase:!1,inverted:!1,location:{start:{line:3,column:9},end:{line:3,column:23}}}},{name:"four",expression:{type:"literal",value:"a",ignoreCase:!1,location:{start:{line:4,column:8},end:{line:4,column:25}}}}]},{mergeCharacterClasses:!0})})),it("Merges case-independent single character literals, class, and ref_rules",(function(){expect$b(pass$7).to.changeAST(["one = three / $('a'i / 'd'i) / [c-f]i / [efh]i / [c-h]i / [c-g]i","two = 'P'i / 'P'i / three / 'P'i / [Q-T]i","three = $('x'i / [u-w]i)","four = 'a'i / [aaa]i / 'a'i"].join("\n"),{rules:[{name:"one",expression:{type:"class",parts:["a",["c","h"],["u","x"]],ignoreCase:!0,inverted:!1,location:{start:{line:1,column:7},end:{line:1,column:65}}}},{name:"two",expression:{type:"class",parts:[["P","T"],["u","x"]],ignoreCase:!0,inverted:!1,location:{start:{line:2,column:7},end:{line:2,column:42}}}},{name:"three",expression:{type:"class",parts:[["u","x"]],ignoreCase:!0,inverted:!1,location:{start:{line:3,column:9},end:{line:3,column:25}}}},{name:"four",expression:{type:"literal",value:"a",ignoreCase:!0,location:{start:{line:4,column:8},end:{line:4,column:28}}}}]},{mergeCharacterClasses:!0})})),it("Doesn't merge inappropriately",(function(){expect$b(pass$7).to.changeAST(["case = action / 'a'i / [c-g]","invert = action / 'P' / [^Q-T]","action = 'x' { return 42; } / [u-w]"].join("\n"),{rules:[{name:"case",expression:{type:"choice",alternatives:[{type:"rule_ref",name:"action"},{type:"literal",value:"a",ignoreCase:!0},{type:"class",parts:[["c","g"]],ignoreCase:!1,inverted:!1}]}},{name:"invert",expression:{type:"choice",alternatives:[{type:"rule_ref",name:"action"},{type:"literal",value:"P",ignoreCase:!1},{type:"class",parts:[["Q","T"]],ignoreCase:!1,inverted:!0}]}},{name:"action",expression:{type:"choice",alternatives:[{type:"action"},{type:"class",parts:[["u","w"]],ignoreCase:!1,inverted:!1}]}}]},{mergeCharacterClasses:!0})})),it("Handles undefined rule_refs",(function(){expect$b(pass$7).to.changeAST(["start = unknown / 'a' / [c-g]"].join("\n"),{rules:[{name:"start",expression:{type:"choice",alternatives:[{type:"rule_ref",name:"unknown"},{type:"class",parts:["a",["c","g"]],ignoreCase:!1,inverted:!1}]}}]},{mergeCharacterClasses:!0})}))}));var chai$a=require$$0,helpers$6=helpers$a,pass$6=removeProxyRules_1;chai$a.use(helpers$6);var expect$a=chai$a.expect;describe("compiler pass |removeProxyRules|",(function(){describe("when a proxy rule isn't listed in |allowedStartRules|",(function(){it("updates references and removes it",(function(){expect$a(pass$6).to.changeAST(["start = proxy","proxy = proxied","proxied = 'a'"].join("\n"),{rules:[{name:"start",expression:{type:"rule_ref",name:"proxied"}},{name:"proxied"}]},{allowedStartRules:["start"]})}))})),describe("when a proxy rule is listed in |allowedStartRules|",(function(){it("updates references but doesn't remove it",(function(){expect$a(pass$6).to.changeAST(["start = proxy","proxy = proxied","proxied = 'a'"].join("\n"),{rules:[{name:"start",expression:{type:"rule_ref",name:"proxied"}},{name:"proxy",expression:{type:"rule_ref",name:"proxied"}},{name:"proxied"}]},{allowedStartRules:["start","proxy"]})}))}))}));var chai$9=require$$0,helpers$5=helpers$a,pass$5=reportDuplicateLabels_1;chai$9.use(helpers$5);var expect$9=chai$9.expect;describe("compiler pass |reportDuplicateLabels|",(function(){describe("in a sequence",(function(){it("reports labels duplicate with labels of preceding elements",(function(){expect$9(pass$5).to.reportError("start = a:'a' a:'a'",{message:'Label "a" is already defined',location:{source:void 0,start:{offset:14,line:1,column:15},end:{offset:15,line:1,column:16}},diagnostics:[{message:"Original label location",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:9,line:1,column:10}}}]})})),it("doesn't report labels duplicate with labels in subexpressions",(function(){expect$9(pass$5).to.not.reportError("start = ('a' / a:'a' / 'a') a:'a'"),expect$9(pass$5).to.not.reportError("start = (a:'a' { }) a:'a'"),expect$9(pass$5).to.not.reportError("start = ('a' a:'a' 'a') a:'a'"),expect$9(pass$5).to.not.reportError("start = b:(a:'a') a:'a'"),expect$9(pass$5).to.not.reportError("start = $(a:'a') a:'a'"),expect$9(pass$5).to.not.reportError("start = &(a:'a') a:'a'"),expect$9(pass$5).to.not.reportError("start = !(a:'a') a:'a'"),expect$9(pass$5).to.not.reportError("start = (a:'a')? a:'a'"),expect$9(pass$5).to.not.reportError("start = (a:'a')* a:'a'"),expect$9(pass$5).to.not.reportError("start = (a:'a')+ a:'a'"),expect$9(pass$5).to.not.reportError("start = (a:'a')|2..3| a:'a'"),expect$9(pass$5).to.not.reportError("start = 'a'|2..3, a:'a'| a:'a'"),expect$9(pass$5).to.not.reportError("start = (a:'a') a:'a'")}))})),describe("in a choice",(function(){it("doesn't report labels duplicate with labels of preceding alternatives",(function(){expect$9(pass$5).to.not.reportError("start = a:'a' / a:'a'")}))})),describe("in outer sequence",(function(){it("reports labels duplicate with labels of preceding elements",(function(){expect$9(pass$5).to.reportError("start = a:'a' (a:'a')",{message:'Label "a" is already defined',location:{source:void 0,start:{offset:15,line:1,column:16},end:{offset:16,line:1,column:17}},diagnostics:[{message:"Original label location",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:9,line:1,column:10}}}]})})),it("doesn't report labels duplicate with the label of the current element",(function(){expect$9(pass$5).to.not.reportError("start = a:(a:'a')")})),it("doesn't report labels duplicate with labels of following elements",(function(){expect$9(pass$5).to.not.reportError("start = (a:'a') a:'a'")}))}))}));var chai$8=require$$0,helpers$4=helpers$a,pass$4=reportDuplicateRules_1;chai$8.use(helpers$4);var expect$8=chai$8.expect;describe("compiler pass |reportDuplicateRules|",(function(){it("reports duplicate rules",(function(){expect$8(pass$4).to.reportError(["start = 'a'","start = 'b'"].join("\n"),{message:'Rule "start" is already defined',location:{source:void 0,start:{offset:12,line:2,column:1},end:{offset:17,line:2,column:6}},diagnostics:[{message:"Original rule location",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}}]})}))}));var chai$7=require$$0,helpers$3=helpers$a,pass$3=reportIncorrectPlucking_1;chai$7.use(helpers$3);var expect$7=chai$7.expect;describe("compiler pass |reportIncorrectPlucking|",(function(){it('prevents "@" from being used with an action block',(function(){expect$7(pass$3).to.reportError("start1 = 'a' @'b' 'c' { /* empty action block */ }",{message:'"@" cannot be used with an action block',location:{source:void 0,start:{offset:13,line:1,column:14},end:{offset:14,line:1,column:15}},diagnostics:[{message:"Action block location",location:{source:void 0,start:{offset:23,line:1,column:24},end:{offset:49,line:1,column:50}}}]}),expect$7(pass$3).to.reportError("start2 = 'a' @('b' @'c' { /* empty action block */ })",{message:'"@" cannot be used with an action block',location:{source:void 0,start:{offset:19,line:1,column:20},end:{offset:20,line:1,column:21}},diagnostics:[{message:"Action block location",location:{source:void 0,start:{offset:25,line:1,column:26},end:{offset:51,line:1,column:52}}}]})})),it("allows valid plucking",(function(){expect$7(pass$3).not.to.reportError("\n\n start1 = @'1' // return '1'\n start2 = @'1' / @'2' // return '1' or '2'\n start2 = '1' @'2' '3' // return '2'\n start3 = '1' @b:'2' '3' // return '2', label \"b\" can be used in semantic predicates\n start4 = a:'1' @b:'2' '3' // return '2', labels \"a\" and \"b\" can be used in semantic predicates\n start5 = @'1' @'2' '3' // return ['1', '2']\n start6 = @'1' @b:'2' '3' // return ['1', '2'], label \"b\" can be used in semantic predicates\n start7 = a:'1' @'2' &{} // return '2' if the semantic predicate doesnt fail\n start8 = @a:$[a-z]i+ &{ return a === 'foo' } // return \"foo\"\n\n ")}))}));var chai$6=require$$0,helpers$2=helpers$a,pass$2=reportInfiniteRecursion_1;chai$6.use(helpers$2);var expect$6=chai$6.expect;describe("compiler pass |reportInfiniteRecursion|",(function(){it("reports direct left recursion",(function(){expect$6(pass$2).to.reportError("start = start",{message:"Possible infinite loop when parsing (left recursion: start -> start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),it("reports indirect left recursion",(function(){expect$6(pass$2).to.reportError(["start = stop","stop = start"].join("\n"),{message:"Possible infinite loop when parsing (left recursion: start -> stop -> start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),describe("in sequences",(function(){it("reports left recursion if all preceding elements match empty string",(function(){expect$6(pass$2).to.reportError("start = '' '' '' start")})),it("doesn't report left recursion if some preceding element doesn't match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a' '' '' start"),expect$6(pass$2).to.not.reportError("start = '' 'a' '' start"),expect$6(pass$2).to.not.reportError("start = '' '' 'a' start")})),it("reports left recursion when rule reference is wrapped in an expression",(function(){expect$6(pass$2).to.reportError("start = '' start?")})),it("computes expressions that always consume input on success correctly",(function(){expect$6(pass$2).to.reportError(["start = a start","a 'a' = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a 'a' = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = ('' / 'a' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / '' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / 'b' / '') start"),expect$6(pass$2).to.not.reportError("start = ('a' / 'b' / 'c') start"),expect$6(pass$2).to.reportError("start = ('' { }) start"),expect$6(pass$2).to.not.reportError("start = ('a' { }) start"),expect$6(pass$2).to.reportError("start = ('' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('a' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('' 'a' '') start"),expect$6(pass$2).to.not.reportError("start = ('' '' 'a') start"),expect$6(pass$2).to.reportError("start = a:'' start"),expect$6(pass$2).to.not.reportError("start = a:'a' start"),expect$6(pass$2).to.reportError("start = $'' start"),expect$6(pass$2).to.not.reportError("start = $'a' start"),expect$6(pass$2).to.reportError("start = &'' start"),expect$6(pass$2).to.reportError("start = &'a' start"),expect$6(pass$2).to.reportError("start = !'' start"),expect$6(pass$2).to.reportError("start = !'a' start"),expect$6(pass$2).to.reportError("start = ''? start"),expect$6(pass$2).to.reportError("start = 'a'? start"),expect$6(pass$2).to.reportError("start = ''* start"),expect$6(pass$2).to.reportError("start = 'a'* start"),expect$6(pass$2).to.reportError("start = ''+ start"),expect$6(pass$2).to.not.reportError("start = 'a'+ start"),expect$6(pass$2).to.reportError("start = ''| .. | start"),expect$6(pass$2).to.reportError("start = ''|0.. | start"),expect$6(pass$2).to.reportError("start = ''|1.. | start"),expect$6(pass$2).to.reportError("start = ''|2.. | start"),expect$6(pass$2).to.reportError("start = ''| ..1| start"),expect$6(pass$2).to.reportError("start = ''| ..3| start"),expect$6(pass$2).to.reportError("start = ''|2..3| start"),expect$6(pass$2).to.reportError("start = ''| 42 | start"),expect$6(pass$2).to.reportError("start = 'a'| .. | start"),expect$6(pass$2).to.reportError("start = 'a'|0.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. | start"),expect$6(pass$2).to.reportError("start = 'a'| ..1| start"),expect$6(pass$2).to.reportError("start = 'a'| ..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 | start"),expect$6(pass$2).to.reportError("start = ('') start"),expect$6(pass$2).to.not.reportError("start = ('a') start"),expect$6(pass$2).to.reportError("start = &{ } start"),expect$6(pass$2).to.reportError("start = !{ } start"),expect$6(pass$2).to.reportError(["start = a start","a = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = '' start"),expect$6(pass$2).to.not.reportError("start = 'a' start"),expect$6(pass$2).to.not.reportError("start = [a-d] start"),expect$6(pass$2).to.not.reportError("start = . start")}))})),describe("in repeated with delimiter",(function(){it("doesn't report left recursion for delimiter if expression not match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a'| .. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|0.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'| ..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 , start|")})),it("reports left recursion for delimiter if expression match empty string",(function(){expect$6(pass$2).to.reportError("start = ''| .. , start|"),expect$6(pass$2).to.reportError("start = ''|0.. , start|"),expect$6(pass$2).to.reportError("start = ''|1.. , start|"),expect$6(pass$2).to.reportError("start = ''|2.. , start|"),expect$6(pass$2).to.reportError("start = ''| ..3, start|"),expect$6(pass$2).to.reportError("start = ''|2..3, start|"),expect$6(pass$2).to.reportError("start = ''| 42 , start|")}))}))}));var chai$5=require$$0,helpers$1=helpers$a,pass$1=reportInfiniteRepetition_1;chai$5.use(helpers$1);var expect$5=chai$5.expect;describe("compiler pass |reportInfiniteRepetition|",(function(){it("reports infinite loops for zero_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')*",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),it("reports infinite loops for one_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')+",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),describe("reports infinite loops for repeated",(function(){describe("without delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:16,line:1,column:17}}}),expect$5(pass$1).to.reportError("start = ('')|0..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|1..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|2..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 |")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:19,line:1,column:20}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2|"),expect$5(pass$1).to.not.reportError("start = ('')|len|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:18,line:1,column:19}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}|")}))})),describe("with empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')| .., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|0.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|1.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|2.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , ''|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:23,line:1,column:24}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len, ''|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:22,line:1,column:23}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, ''|")}))})),describe("with non-empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')| .., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|0.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|1.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..1, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , 'a'|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|len.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..len, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len, 'a'|")})),it("with function boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|{}.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, 'a'|")}))}))})),it("computes expressions that always consume input on success correctly",(function(){expect$5(pass$1).to.reportError(["start = a*","a 'a' = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a 'a' = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ('' / 'a' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / '' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / 'b' / '')*"),expect$5(pass$1).to.not.reportError("start = ('a' / 'b' / 'c')*"),expect$5(pass$1).to.reportError("start = ('' { })*"),expect$5(pass$1).to.not.reportError("start = ('a' { })*"),expect$5(pass$1).to.reportError("start = ('' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('a' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('' 'a' '')*"),expect$5(pass$1).to.not.reportError("start = ('' '' 'a')*"),expect$5(pass$1).to.reportError("start = (a:'')*"),expect$5(pass$1).to.not.reportError("start = (a:'a')*"),expect$5(pass$1).to.reportError("start = ($'')*"),expect$5(pass$1).to.not.reportError("start = ($'a')*"),expect$5(pass$1).to.reportError("start = (&'')*"),expect$5(pass$1).to.reportError("start = (&'a')*"),expect$5(pass$1).to.reportError("start = (!'')*"),expect$5(pass$1).to.reportError("start = (!'a')*"),expect$5(pass$1).to.reportError("start = (''?)*"),expect$5(pass$1).to.reportError("start = ('a'?)*"),expect$5(pass$1).to.reportError("start = (''*)*"),expect$5(pass$1).to.reportError("start = ('a'*)*"),expect$5(pass$1).to.reportError("start = (''+)*"),expect$5(pass$1).to.not.reportError("start = ('a'+)*"),expect$5(pass$1).to.reportError("start = ('')*"),expect$5(pass$1).to.not.reportError("start = ('a')*"),expect$5(pass$1).to.reportError("start = (&{ })*"),expect$5(pass$1).to.reportError("start = (!{ })*"),expect$5(pass$1).to.reportError("start = 'a'|.., ('')*|"),expect$5(pass$1).to.not.reportError("start = 'a'|.., ('b')*|"),expect$5(pass$1).to.reportError(["start = a*","a = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ''*"),expect$5(pass$1).to.not.reportError("start = 'a'*"),expect$5(pass$1).to.not.reportError("start = [a-d]*"),expect$5(pass$1).to.not.reportError("start = .*")}))}));var chai$4=require$$0,helpers=helpers$a,pass=reportUndefinedRules_1;chai$4.use(helpers);var expect$4=chai$4.expect;describe("compiler pass |reportUndefinedRules|",(function(){it("reports undefined rules",(function(){expect$4(pass).to.reportError("start = undefined",{message:'Rule "undefined" is not defined',location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}})}))}));var chai$3=require$$0,Stack=stack,expect$3=chai$3.expect;describe("utility class Stack",(function(){describe("for an empty stack",(function(){var e=void 0;beforeEach((function(){e=new Stack("rule","v","let",[42])})),describe("throws an error when attempting",(function(){it("`pop`",(function(){expect$3((function(){return e.pop()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v<x>' at an index -1.\nBytecode: 42")})),it("`top`",(function(){expect$3((function(){return e.top()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v<x>' at an index -1.\nBytecode: 42")})),it("`result`",(function(){expect$3((function(){return e.result()})).to.throw(RangeError,"Rule 'rule': The variable stack is empty, can't get the result")})),it("`index`",(function(){expect$3((function(){return e.index(-2)})).to.throw(RangeError,"Rule 'rule': The variable stack overflow: attempt to get a variable at a negative index -2.\nBytecode: 42"),expect$3((function(){return e.index(0)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v<x>' at an index -1.\nBytecode: 42"),expect$3((function(){return e.index(2)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v<x>' at an index -3.\nBytecode: 42")})),it("`sourceMapPop`",(function(){expect$3((function(){return e.sourceMapPop()})).to.throw(RangeError,"Rule 'rule': Attempting to pop an empty source map stack.\nBytecode: 42")}))})),it("`defines` returns an empty string",(function(){expect$3(e.defines()).to.equal("")}))})),it("throws an error when attempting `pop` more than `push`",(function(){var e=new Stack("rule","v","let",[42]);e.push("1"),expect$3((function(){return e.pop(3)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v<x>' at an index -2.\nBytecode: 42")})),it("returns a variable with an index 0 for `result`",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),expect$3(e.result()).to.equal("v0")})),it("`defines` returns a define expression for all used variables",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),e.push("2"),e.pop(),e.push("3"),expect$3(e.defines()).to.equal("let v0, v1;")})),describe("`checkedIf` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),describe("does not throws an error",(function(){it("without the else brach",(function(){expect$3((function(){return e.checkedIf(0,(function(){}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.pop()}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.push("2")}))})).to.not.throw()})),describe("when the stack pointer",(function(){it("was not moving in both the arms",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedIf(0,t,t)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,r,r)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,a,a)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,n,n)})).to.not.throw()})),it("increases on the same value in both the arms",(function(){expect$3((function(){return e.checkedIf(0,(function(){return e.push("1")}),(function(){return e.push("2")}))})).to.not.throw()})),it("decreases on the same value in both the arms",(function(){e.push("2"),expect$3((function(){return e.checkedIf(0,(function(){return e.pop(2)}),(function(){e.pop(),e.pop()}))})).to.not.throw()}))}))})),describe("throws an error when the stack pointer",(function(){it("was not moving in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: -1). Bytecode: 42")})),it("decreases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 0). Bytecode: 42")})),it("was not moving in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: 1). Bytecode: 42")})),it("increases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: 0). Bytecode: 42")})),it("decreases in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 1). Bytecode: 42")})),it("increases in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: -1). Bytecode: 42")}))}))})),describe("`checkedLoop` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),it("does not throws an error when the stack pointer was not moving",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedLoop(0,t)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,r)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,a)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,n)})).to.not.throw()})),it("throws an error when the stack pointer increases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.push("1")}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: 1). Bytecode: 42")})),it("throws an error when the stack pointer decreases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: -1). Bytecode: 42")}))})),describe("SourceNode handling",(function(){it("sourceNode handles unknown column",(function(){expect$3(Stack.sourceNode({source:"",start:{line:1,column:0,offset:0},end:{line:1,column:0,offset:0}},["foo"],"test").column).to.equal(null)}))}))}));var chai$2=require$$0,_a$1=utils$1,hex=_a$1.hex,stringEscape=_a$1.stringEscape,regexpClassEscape=_a$1.regexpClassEscape,base64=_a$1.base64,expect$2=chai$2.expect;describe("utility functions",(function(){it("hex",(function(){expect$2(hex("0")).to.equal("30"),expect$2(hex("\0")).to.equal("0"),expect$2(hex("\n")).to.equal("A"),expect$2(hex("\ufeff")).to.equal("FEFF")})),it("stringEscape",(function(){expect$2(stringEscape("abc")).to.equal("abc"),expect$2(stringEscape('\\"\0\b\t\n\v\f\r')).to.equal('\\\\\\"\\0\\b\\t\\n\\v\\f\\r'),expect$2(stringEscape("")).to.equal("\\x01\\x0F"),expect$2(stringEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(stringEscape("Ā")).to.equal("\\u0100\\u0FFF"),expect$2(stringEscape("က")).to.equal("\\u1000\\uFFFF")})),it("regexpClassEscape",(function(){expect$2(regexpClassEscape("\\\0\b\t\n\v\f\r")).to.equal("\\\\\\0\\b\\t\\n\\v\\f\\r"),expect$2(regexpClassEscape("/]^-")).to.equal("\\/\\]\\^\\-"),expect$2(regexpClassEscape("")).to.equal("\\x01\\x0F"),expect$2(regexpClassEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(regexpClassEscape("Ā")).to.equal("\\u0100\\u0FFF"),expect$2(regexpClassEscape("က")).to.equal("\\u1000\\uFFFF")})),it("base64",(function(){expect$2(base64(new Uint8Array([]))).to.equal(""),expect$2(base64(new Uint8Array([97]))).to.equal("YQ=="),expect$2(base64(new Uint8Array([97,98]))).to.equal("YWI="),expect$2(base64(new Uint8Array([97,98,99]))).to.equal("YWJj"),expect$2(base64(new Uint8Array([97,98,99,100]))).to.equal("YWJjZA=="),expect$2(base64(new Uint8Array([97,98,99,100,101]))).to.equal("YWJjZGU="),expect$2(base64(new Uint8Array([97,98,99,100,101,102]))).to.equal("YWJjZGVm")}))}));var chai$1=require$$0,_a=peg_1,GrammarError=_a.GrammarError,GrammarLocation=_a.GrammarLocation,expect$1=chai$1.expect,location={source:void 0,start:{offset:0,line:1,column:1},end:{offset:4,line:1,column:5}};describe("Grammar Errors",(function(){it("might not have a location",(function(){var e=new GrammarError("message");expect$1(e.location).to.equal(void 0),expect$1(e.toString()).to.equal("GrammarError: message")})),it("might have locations",(function(){location.source=void 0;var e=new GrammarError("message",location);expect$1(e.location).to.eql(location),expect$1(e.toString()).to.equal("GrammarError: message\n at 1:1"),e=new GrammarError("message",null,[{message:"Subinfo",location:location}]),expect$1(e.location).to.equal(null),expect$1(e.toString()).to.equal("GrammarError: message\n from 1:1: Subinfo"),location.source="foo.peggy",e=new GrammarError("message",location,[{message:"Subinfo",location:location}]),expect$1(e.toString()).to.equal("GrammarError: message\n at foo.peggy:1:1\n from foo.peggy:1:1: Subinfo")})),describe("formats",(function(){var e={source:"foo.peggy",text:"some error\nthat"},t={source:"foo.peggy",start:{offset:5,line:1,column:6},end:{offset:11,line:2,column:1}},r=[{message:"Subinfo",location:t}];describe("single problem",(function(){describe("with main location",(function(){location.source="foo.peggy";var t=new GrammarError("message",location,r);it("with zero-length error at the end",(function(){var t=new GrammarError("message",{source:"foo.peggy",start:{offset:4,line:1,column:5},end:{offset:4,line:1,column:5}});expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:5\n |\n1 | some error\n | ^")})),it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo")}))})),describe("without main location",(function(){var t=new GrammarError("message",null,r);it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo")}))}))})),describe("several problems",(function(){describe("with main location",(function(){location.source="foo.peggy";var a=new GrammarError("message",location,r);a.problems.push(["warning","Warning message",t,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("null source text",(function(){expect$1(a.format([{source:null,text:null}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo"),expect$1(a.format([{source:null,text:void 0}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")})),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("with GrammarLocation",(function(){var r=new GrammarLocation("foo.peggy",{offset:12,line:15,column:8});expect$1(String(r)).to.equal("foo.peggy"),location.source=r,t.source=r,a.diagnostics.push({message:"Column not offset",location:{source:r,start:{offset:11,line:2,column:1},end:{offset:15,line:2,column:5}}}),expect$1(a.format([{source:r,text:e.text}])).to.equal("error: message\n --\x3e foo.peggy:15:8\n |\n15 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Column not offset\n --\x3e foo.peggy:16:1\n |\n16 | that\n | ^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^"),location.source="foo.peggy",t.source="foo.peggy",a.diagnostics.pop()})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")}))})),describe("without main location",(function(){var a=new GrammarError("message",null,r);a.problems.push(["warning","Warning message",null,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6: Warning Subinfo")}))}))}))}))}));var __spreadArray=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n<o;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},chai=require$$0,parser=parser$4,expect=chai.expect;describe("Peggy grammar parser",(function(){var e={type:"literal",value:"abcd",ignoreCase:!1},t={type:"literal",value:"efgh",ignoreCase:!1},r={type:"literal",value:"ijkl",ignoreCase:!1},a={type:"literal",value:"mnop",ignoreCase:!1},n={type:"semantic_and",code:" code "},o={type:"semantic_not",code:" code "},s={type:"optional",expression:e},c={type:"zero_or_more",expression:e},i={type:"one_or_more",expression:e},u={type:"text",expression:s},p={type:"simple_not",expression:e},l={type:"simple_and",expression:s},f={type:"simple_not",expression:s},g={type:"labeled",label:"a",expression:e},d={type:"labeled",label:"b",expression:t},m={type:"labeled",label:"a",expression:p},$={type:"sequence",elements:[e,t,r]},h={type:"sequence",elements:[g,d]},x={type:"sequence",elements:[g,d,{type:"labeled",label:"c",expression:r},{type:"labeled",label:"d",expression:a}]},b={type:"group",expression:g},v={type:"group",expression:$},A={type:"action",expression:e,code:" code "},y={type:"action",expression:t,code:" code "},S={type:"action",expression:$,code:" code "},_={type:"choice",alternatives:[e,t,r]},E={type:"choice",alternatives:[A,y]},T={type:"choice",alternatives:[A,y,{type:"action",expression:r,code:" code "},{type:"action",expression:a,code:" code "}]},C={type:"named",name:"start rule",expression:e},P={type:"rule",name:"a",expression:e},w={type:"rule",name:"b",expression:t},R={type:"rule",name:"c",expression:r},L={type:"rule",name:"start",expression:e},F={type:"top_level_initializer",code:" top level code "},O={type:"initializer",code:" code "};function B(e){return{type:"grammar",topLevelInitializer:null,initializer:null,rules:[{type:"rule",name:"start",expression:e}]}}function M(t){return B({type:"action",expression:e,code:t})}function D(e,t){return B({type:"literal",value:e,ignoreCase:t})}function I(e,t,r){return B({type:"class",parts:e,inverted:t,ignoreCase:r})}function k(){return B({type:"any"})}function j(e){return B({type:"rule_ref",name:e})}function N(t,r,a,n){return void 0===a&&(a="variable"),void 0===n&&(n=null),B({type:"repeated",min:{type:"string"==typeof t?a:"constant",value:t},max:{type:"string"==typeof r?a:"constant",value:r},expression:e,delimiter:n})}function U(e,t){return N(e,t,"function")}function q(e,r){return N(e,r,"variable",t)}function G(e,r){return N(e,r,"function",t)}var H=D("abcd",!1),z={type:"grammar",topLevelInitializer:null,initializer:null,rules:[P,w]},W=function(){function e(e){delete e.location,delete e.codeLocation,delete e.nameLocation,delete e.labelLocation}function t(e){delete e.location,delete e.codeLocation,delete e.nameLocation,delete e.labelLocation,n(e.expression)}function r(e){return function(t){delete t.location,delete t.codeLocation,delete t.nameLocation,delete t.labelLocation,t[e].forEach(n)}}var a,n=(a={grammar:function(e){delete e.location,delete e.codeLocation,delete e.nameLocation,delete e.labelLocation,e.topLevelInitializer&&n(e.topLevelInitializer),e.initializer&&n(e.initializer),e.rules.forEach(n)},top_level_initializer:e,initializer:e,rule:t,named:t,choice:r("alternatives"),action:t,sequence:r("elements"),labeled:t,text:t,simple_and:t,simple_not:t,optional:t,zero_or_more:t,one_or_more:t,repeated:function(e){e.min&&(delete e.min.location,delete e.min.codeLocation),delete e.max.location,delete e.max.codeLocation,delete e.location,n(e.expression),e.delimiter&&(delete e.delimiter.location,n(e.delimiter))},group:t,semantic_and:e,semantic_not:e,rule_ref:e,literal:e,class:e,any:e},function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return a[e.type].apply(a,__spreadArray([e],t,!1))});return n}();function V(e,t){var r=e.Assertion;r.addMethod("parseAs",(function(e){var r=parser.parse(t.flag(this,"object"));W(r),this.assert(t.eql(r,e),"expected #{this} to parse as #{exp} but got #{act}","expected #{this} to not parse as #{exp}",e,r,!t.flag(this,"negate"))})),r.addMethod("failToParse",(function(e){var a=void 0,n=void 0;try{n=parser.parse(t.flag(this,"object")),a=!0}catch(e){n=e,a=!1}a&&W(n),this.assert(!a,"expected #{this} to fail to parse but got #{act}","expected #{this} to not fail to parse but it failed with #{act}",null,n),a||void 0===e||Object.keys(e).forEach((function(t){new r(n).to.have.property(t).that.is.deep.equal(e[t])}))}))}beforeEach((function(){chai.use(V)})),it("parses Grammar",(function(){expect("\na = 'abcd';\n").to.parseAs({type:"grammar",topLevelInitializer:null,initializer:null,rules:[P]}),expect("\na = 'abcd'; /* comment */; // comment\n;\nb = 'efgh';\nc = 'ijkl';\n").to.parseAs({type:"grammar",topLevelInitializer:null,initializer:null,rules:[P,w,R]}),expect("\n{ code };\na = 'abcd';\n").to.parseAs({type:"grammar",topLevelInitializer:null,initializer:O,rules:[P]}),expect("\n{{ top level code }};\na = 'abcd';\n").to.parseAs({type:"grammar",topLevelInitializer:F,initializer:null,rules:[P]}),expect("\n{{ top level code }};\n{ code };\na = 'abcd';\n").to.parseAs({type:"grammar",topLevelInitializer:F,initializer:O,rules:[P]})})),it("parses Top-Level Initializer",(function(){expect("{{ top level code }};start = 'abcd'").to.parseAs({type:"grammar",topLevelInitializer:F,initializer:null,rules:[L]})})),it("parses Initializer",(function(){expect("{ code };start = 'abcd'").to.parseAs({type:"grammar",topLevelInitializer:null,initializer:O,rules:[L]})})),it("parses Rule",(function(){expect("start\n=\n'abcd';").to.parseAs(B(e)),expect("start\n'start rule'\n=\n'abcd';").to.parseAs(B(C))})),it("parses Expression",(function(){expect("start = 'abcd' / 'efgh' / 'ijkl'").to.parseAs(B(_))})),it("parses ChoiceExpression",(function(){expect("start = 'abcd' { code }").to.parseAs(B(A)),expect("start = 'abcd' { code }\n/\n'efgh' { code }").to.parseAs(B(E)),expect("start = 'abcd' { code }\n/\n'efgh' { code }\n/\n'ijkl' { code }\n/\n'mnop' { code }").to.parseAs(B(T))})),it("parses ActionExpression",(function(){expect("start = 'abcd' 'efgh' 'ijkl'").to.parseAs(B($)),expect("start = 'abcd' 'efgh' 'ijkl'\n{ code }").to.parseAs(B(S))})),it("parses SequenceExpression",(function(){expect("start = a:'abcd'").to.parseAs(B(g)),expect("start = a:'abcd'\nb:'efgh'").to.parseAs(B(h)),expect("start = a:'abcd'\nb:'efgh'\nc:'ijkl'\nd:'mnop'").to.parseAs(B(x))})),it("parses `@` (value plucking)",(function(){function n(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return B({type:"sequence",elements:e})}function o(e,t){return{type:"labeled",pick:!0,label:e,expression:t}}expect("start = @'abcd'").to.parseAs(n(o(null,e))),expect("start = @a:'abcd'").to.parseAs(n(o("a",e))),expect("start = 'abcd' @'efgh'").to.parseAs(n(e,o(null,t))),expect("start = a:'abcd' @b:'efgh'").to.parseAs(n(g,o("b",t))),expect("start = @'abcd' b:'efgh'").to.parseAs(n(o(null,e),d)),expect("start = a:'abcd' @'efgh' 'ijkl' @d:'mnop'").to.parseAs(n(g,o(null,t),r,o("d",a)))})),it("parses LabeledExpression",(function(){expect("start = a\n:\n!'abcd'").to.parseAs(B(m)),expect("start = !'abcd'").to.parseAs(B(p))})),it("parses PrefixedExpression",(function(){expect("start = !\n'abcd'?").to.parseAs(B(f)),expect("start = 'abcd'?").to.parseAs(B(s))})),it("parses PrefixedOperator",(function(){expect("start = $'abcd'?").to.parseAs(B(u)),expect("start = &'abcd'?").to.parseAs(B(l)),expect("start = !'abcd'?").to.parseAs(B(f))})),it("parses SuffixedExpression",(function(){expect("start = 'abcd'\n?").to.parseAs(B(s)),expect("start = 'abcd'").to.parseAs(B(e))})),it("parses SuffixedOperator",(function(){expect("start = 'abcd'?").to.parseAs(B(s)),expect("start = 'abcd'*").to.parseAs(B(c)),expect("start = 'abcd'+").to.parseAs(B(i))})),it("parses PrimaryExpression",(function(){expect("start = 'abcd'").to.parseAs(H),expect("start = [a-d]").to.parseAs(I([["a","d"]],!1,!1)),expect("start = .").to.parseAs(k()),expect("start = a").to.parseAs(j("a")),expect("start = &{ code }").to.parseAs(B(n)),expect("start = (\na:'abcd'\n)").to.parseAs(B(b)),expect("start = (\n'abcd' 'efgh' 'ijkl'\n)").to.parseAs(B(v)),expect("start = (\n'abcd'\n)").to.parseAs(H)})),describe("parses RepeatedExpression",(function(){describe("without delimiter",(function(){it("with constant boundaries",(function(){var t=N(2,3);expect("start = 'abcd'|2..3| ").to.parseAs(t),expect("start = 'abcd'\n|2..3|").to.parseAs(t),expect("start = 'abcd'|\n2..3|").to.parseAs(t),expect("start = 'abcd'|2\n..3|").to.parseAs(t),expect("start = 'abcd'|2..\n3|").to.parseAs(t),expect("start = 'abcd'|2..3\n|").to.parseAs(t),t=B({type:"repeated",min:null,max:{type:"constant",value:3},expression:e,delimiter:null}),expect("start = 'abcd'\n|3|").to.parseAs(t),expect("start = 'abcd'|\n3|").to.parseAs(t),expect("start = 'abcd'|3\n|").to.parseAs(t)})),it("with variable boundaries",(function(){var t=N("min","max");expect("start = 'abcd'|min..max| ").to.parseAs(t),expect("start = 'abcd'\n|min..max|").to.parseAs(t),expect("start = 'abcd'|\nmin..max|").to.parseAs(t),expect("start = 'abcd'|min\n..max|").to.parseAs(t),expect("start = 'abcd'|min..\nmax|").to.parseAs(t),expect("start = 'abcd'|min..max\n|").to.parseAs(t),t=B({type:"repeated",min:null,max:{type:"variable",value:"exact"},expression:e,delimiter:null}),expect("start = 'abcd'\n|exact|").to.parseAs(t),expect("start = 'abcd'|\nexact|").to.parseAs(t),expect("start = 'abcd'|exact\n|").to.parseAs(t)})),it("with function boundaries",(function(){var t=U("min","max");expect("start = 'abcd'|{min}..{max}| ").to.parseAs(t),expect("start = 'abcd'\n|{min}..{max}|").to.parseAs(t),expect("start = 'abcd'|\n{min}..{max}|").to.parseAs(t),expect("start = 'abcd'|{min}\n..{max}|").to.parseAs(t),expect("start = 'abcd'|{min}..\n{max}|").to.parseAs(t),expect("start = 'abcd'|{min}..{max}\n|").to.parseAs(t),t=B({type:"repeated",min:null,max:{type:"function",value:"exact"},expression:e,delimiter:null}),expect("start = 'abcd'\n|{exact}|").to.parseAs(t),expect("start = 'abcd'|\n{exact}|").to.parseAs(t),expect("start = 'abcd'|{exact}\n|").to.parseAs(t)})),it("with mixed boundaries",(function(){var e=N(2,"max");expect("start = 'abcd'|2..max| ").to.parseAs(e),expect("start = 'abcd'\n|2..max|").to.parseAs(e),expect("start = 'abcd'|\n2..max|").to.parseAs(e),expect("start = 'abcd'|2\n..max|").to.parseAs(e),expect("start = 'abcd'|2..\nmax|").to.parseAs(e),expect("start = 'abcd'|2..max\n|").to.parseAs(e),e=N("min",3),expect("start = 'abcd'|min..3| ").to.parseAs(e),expect("start = 'abcd'\n|min..3|").to.parseAs(e),expect("start = 'abcd'|\nmin..3|").to.parseAs(e),expect("start = 'abcd'|min\n..3|").to.parseAs(e),expect("start = 'abcd'|min..\n3|").to.parseAs(e),expect("start = 'abcd'|min..3\n|").to.parseAs(e)}))})),describe("with delimiter",(function(){it("with constant boundaries",(function(){var r=q(2,3);expect("start = 'abcd'|2..3,'efgh'| ").to.parseAs(r),expect("start = 'abcd'\n|2..3,'efgh'|").to.parseAs(r),expect("start = 'abcd'|\n2..3,'efgh'|").to.parseAs(r),expect("start = 'abcd'|2\n..3,'efgh'|").to.parseAs(r),expect("start = 'abcd'|2..\n3,'efgh'|").to.parseAs(r),expect("start = 'abcd'|2..3\n,'efgh'|").to.parseAs(r),expect("start = 'abcd'|2..3,\n'efgh'|").to.parseAs(r),expect("start = 'abcd'|2..3,'efgh'\n|").to.parseAs(r),r=B({type:"repeated",min:null,max:{type:"constant",value:3},expression:e,delimiter:t}),expect("start = 'abcd'\n|3,'efgh'|").to.parseAs(r),expect("start = 'abcd'|\n3,'efgh'|").to.parseAs(r),expect("start = 'abcd'|3\n,'efgh'|").to.parseAs(r),expect("start = 'abcd'|3,\n'efgh'|").to.parseAs(r),expect("start = 'abcd'|3,'efgh'\n|").to.parseAs(r),expect("start = 'abcd'|3, 'efgh'?|").to.parseAs(B({type:"repeated",min:null,max:{type:"constant",value:3},expression:e,delimiter:{type:"optional",expression:t}}))})),it("with variable boundaries",(function(){var r=q("min","max");expect("start = 'abcd'|min..max,'efgh'| ").to.parseAs(r),expect("start = 'abcd'\n|min..max,'efgh'|").to.parseAs(r),expect("start = 'abcd'|\nmin..max,'efgh'|").to.parseAs(r),expect("start = 'abcd'|min\n..max,'efgh'|").to.parseAs(r),expect("start = 'abcd'|min..\nmax,'efgh'|").to.parseAs(r),expect("start = 'abcd'|min..max\n,'efgh'|").to.parseAs(r),expect("start = 'abcd'|min..max,\n'efgh'|").to.parseAs(r),expect("start = 'abcd'|min..max,'efgh'\n|").to.parseAs(r),r=B({type:"repeated",min:null,max:{type:"variable",value:"exact"},expression:e,delimiter:t}),expect("start = 'abcd'\n|exact,'efgh'|").to.parseAs(r),expect("start = 'abcd'|\nexact,'efgh'|").to.parseAs(r),expect("start = 'abcd'|exact\n,'efgh'|").to.parseAs(r),expect("start = 'abcd'|exact,\n'efgh'|").to.parseAs(r),expect("start = 'abcd'|exact,'efgh'\n|").to.parseAs(r),expect("start = 'abcd'|exact, 'efgh'?|").to.parseAs(B({type:"repeated",min:null,max:{type:"variable",value:"exact"},expression:e,delimiter:{type:"optional",expression:t}}))})),it("with function boundaries",(function(){var r=G("min","max");expect("start = 'abcd'|{min}..{max},'efgh'| ").to.parseAs(r),expect("start = 'abcd'\n|{min}..{max},'efgh'|").to.parseAs(r),expect("start = 'abcd'|\n{min}..{max},'efgh'|").to.parseAs(r),expect("start = 'abcd'|{min}\n..{max},'efgh'|").to.parseAs(r),expect("start = 'abcd'|{min}..\n{max},'efgh'|").to.parseAs(r),expect("start = 'abcd'|{min}..{max}\n,'efgh'|").to.parseAs(r),expect("start = 'abcd'|{min}..{max},\n'efgh'|").to.parseAs(r),expect("start = 'abcd'|{min}..{max},'efgh'\n|").to.parseAs(r),r=B({type:"repeated",min:null,max:{type:"function",value:"exact"},expression:e,delimiter:t}),expect("start = 'abcd'\n|{exact},'efgh'|").to.parseAs(r),expect("start = 'abcd'|\n{exact},'efgh'|").to.parseAs(r),expect("start = 'abcd'|{exact}\n,'efgh'|").to.parseAs(r),expect("start = 'abcd'|{exact},\n'efgh'|").to.parseAs(r),expect("start = 'abcd'|{exact},'efgh'\n|").to.parseAs(r),expect("start = 'abcd'|{exact}, 'efgh'?|").to.parseAs(B({type:"repeated",min:null,max:{type:"function",value:"exact"},expression:e,delimiter:{type:"optional",expression:t}}))})),it("with mixed boundaries",(function(){var e=q(2,"max");expect("start = 'abcd'|2..max,'efgh'| ").to.parseAs(e),expect("start = 'abcd'\n|2..max,'efgh'|").to.parseAs(e),expect("start = 'abcd'|\n2..max,'efgh'|").to.parseAs(e),expect("start = 'abcd'|2\n..max,'efgh'|").to.parseAs(e),expect("start = 'abcd'|2..\nmax,'efgh'|").to.parseAs(e),expect("start = 'abcd'|2..max\n,'efgh'|").to.parseAs(e),expect("start = 'abcd'|2..max,\n'efgh'|").to.parseAs(e),expect("start = 'abcd'|2..max,'efgh'\n|").to.parseAs(e),e=q("min",3),expect("start = 'abcd'|min..3,'efgh'| ").to.parseAs(e),expect("start = 'abcd'\n|min..3,'efgh'|").to.parseAs(e),expect("start = 'abcd'|\nmin..3,'efgh'|").to.parseAs(e),expect("start = 'abcd'|min\n..3,'efgh'|").to.parseAs(e),expect("start = 'abcd'|min..\n3,'efgh'|").to.parseAs(e),expect("start = 'abcd'|min..3\n,'efgh'|").to.parseAs(e),expect("start = 'abcd'|min..3,\n'efgh'|").to.parseAs(e),expect("start = 'abcd'|min..3,'efgh'\n|").to.parseAs(e),e=G(2,"max"),expect("start = 'abcd'|2..{max},'efgh'| ").to.parseAs(e),expect("start = 'abcd'\n|2..{max},'efgh'|").to.parseAs(e),expect("start = 'abcd'|\n2..{max},'efgh'|").to.parseAs(e),expect("start = 'abcd'|2\n..{max},'efgh'|").to.parseAs(e),expect("start = 'abcd'|2..\n{max},'efgh'|").to.parseAs(e),expect("start = 'abcd'|2..{max}\n,'efgh'|").to.parseAs(e),expect("start = 'abcd'|2..{max},\n'efgh'|").to.parseAs(e),expect("start = 'abcd'|2..{max},'efgh'\n|").to.parseAs(e),e=G("min",3),expect("start = 'abcd'|{min}..3,'efgh'| ").to.parseAs(e),expect("start = 'abcd'\n|{min}..3,'efgh'|").to.parseAs(e),expect("start = 'abcd'|\n{min}..3,'efgh'|").to.parseAs(e),expect("start = 'abcd'|{min}\n..3,'efgh'|").to.parseAs(e),expect("start = 'abcd'|{min}..\n3,'efgh'|").to.parseAs(e),expect("start = 'abcd'|{min}..3\n,'efgh'|").to.parseAs(e),expect("start = 'abcd'|{min}..3,\n'efgh'|").to.parseAs(e),expect("start = 'abcd'|{min}..3,'efgh'\n|").to.parseAs(e)}))}))})),describe("parses RepeatedOperator",(function(){describe("without delimiter",(function(){it("with constant boundaries",(function(){expect("start = 'abcd'| .. |").to.parseAs(N(0,null)),expect("start = 'abcd'|0.. |").to.parseAs(N(0,null)),expect("start = 'abcd'|1.. |").to.parseAs(N(1,null)),expect("start = 'abcd'|2.. |").to.parseAs(N(2,null)),expect("start = 'abcd'| ..1|").to.parseAs(N(0,1)),expect("start = 'abcd'| ..2|").to.parseAs(N(0,2)),expect("start = 'abcd'|2..2|").to.parseAs(N(2,2)),expect("start = 'abcd'|2..3|").to.parseAs(N(2,3)),expect("start = 'abcd'|3| ").to.parseAs(B({type:"repeated",min:null,max:{type:"constant",value:3},expression:e,delimiter:null})),expect("start = 'abcd'| ..0|").to.failToParse(),expect("start = 'abcd'|0..0|").to.failToParse(),expect("start = 'abcd'|0| ").to.failToParse()})),it("with variable boundaries",(function(){expect("start = 'abcd'|min.. |").to.parseAs(N("min",null)),expect("start = 'abcd'| ..max|").to.parseAs(N(0,"max")),expect("start = 'abcd'|min..max|").to.parseAs(N("min","max")),expect("start = 'abcd'|exact| ").to.parseAs(B({type:"repeated",min:null,max:{type:"variable",value:"exact"},expression:e,delimiter:null}))})),it("with function boundaries",(function(){expect("start = 'abcd'|{min}.. |").to.parseAs(U("min",null)),expect("start = 'abcd'| ..{max}|").to.parseAs(U(0,"max")),expect("start = 'abcd'|{min}..{max}|").to.parseAs(U("min","max")),expect("start = 'abcd'|{exact}| ").to.parseAs(B({type:"repeated",min:null,max:{type:"function",value:"exact"},expression:e,delimiter:null}))})),it("with mixed boundaries",(function(){expect("start = 'abcd'|2..max|").to.parseAs(N(2,"max")),expect("start = 'abcd'|min..3|").to.parseAs(N("min",3)),expect("start = 'abcd'|2..{max}|").to.parseAs(U(2,"max")),expect("start = 'abcd'|{min}..3|").to.parseAs(U("min",3))}))})),describe("with delimiter",(function(){it("with constant boundaries",(function(){expect("start = 'abcd'| .. , 'efgh'|").to.parseAs(q(0,null)),expect("start = 'abcd'|0.. , 'efgh'|").to.parseAs(q(0,null)),expect("start = 'abcd'|1.. , 'efgh'|").to.parseAs(q(1,null)),expect("start = 'abcd'|2.. , 'efgh'|").to.parseAs(q(2,null)),expect("start = 'abcd'| ..1, 'efgh'|").to.parseAs(q(0,1)),expect("start = 'abcd'| ..2, 'efgh'|").to.parseAs(q(0,2)),expect("start = 'abcd'|2..2, 'efgh'|").to.parseAs(q(2,2)),expect("start = 'abcd'|2..3, 'efgh'|").to.parseAs(q(2,3)),expect("start = 'abcd'|3 , 'efgh'|").to.parseAs(B({type:"repeated",min:null,max:{type:"constant",value:3},expression:e,delimiter:t})),expect("start = 'abcd'| ..0, 'efgh'|").to.failToParse(),expect("start = 'abcd'|0..0, 'efgh'|").to.failToParse(),expect("start = 'abcd'|0 , 'efgh'|").to.failToParse()})),it("with variable boundaries",(function(){expect("start = 'abcd'|min.. , 'efgh'|").to.parseAs(q("min",null)),expect("start = 'abcd'| ..max, 'efgh'|").to.parseAs(q(0,"max")),expect("start = 'abcd'|min..max, 'efgh'|").to.parseAs(q("min","max")),expect("start = 'abcd'|exact, 'efgh'| ").to.parseAs(B({type:"repeated",min:null,max:{type:"variable",value:"exact"},expression:e,delimiter:t}))})),it("with function boundaries",(function(){expect("start = 'abcd'|{min}.. , 'efgh'|").to.parseAs(G("min",null)),expect("start = 'abcd'| ..{max}, 'efgh'|").to.parseAs(G(0,"max")),expect("start = 'abcd'|{min}..{max}, 'efgh'|").to.parseAs(G("min","max")),expect("start = 'abcd'|{exact}, 'efgh'|").to.parseAs(B({type:"repeated",min:null,max:{type:"function",value:"exact"},expression:e,delimiter:t}))})),it("with mixed boundaries",(function(){expect("start = 'abcd'|2..max, 'efgh'|").to.parseAs(q(2,"max")),expect("start = 'abcd'|min..3, 'efgh'|").to.parseAs(q("min",3)),expect("start = 'abcd'|2..{max}, 'efgh'|").to.parseAs(G(2,"max")),expect("start = 'abcd'|{min}..3, 'efgh'|").to.parseAs(G("min",3))}))}))})),it("parses RuleReferenceExpression",(function(){expect("start = a").to.parseAs(j("a")),expect("start = a\n=").to.failToParse(),expect("start = a\n'abcd'\n=").to.failToParse()})),it("parses SemanticPredicateExpression",(function(){expect("start = !\n{ code }").to.parseAs(B(o))})),it("parses SemanticPredicateOperator",(function(){expect("start = &{ code }").to.parseAs(B(n)),expect("start = !{ code }").to.parseAs(B(o))})),it("parses WhiteSpace",(function(){expect("start =\t'abcd'").to.parseAs(H),expect("start =\v'abcd'").to.parseAs(H),expect("start =\f'abcd'").to.parseAs(H),expect("start = 'abcd'").to.parseAs(H),expect("start = 'abcd'").to.parseAs(H),expect("start =\ufeff'abcd'").to.parseAs(H),expect("start = 'abcd'").to.parseAs(H)})),it("parses LineTerminator",(function(){expect("start = '\n'").to.failToParse(),expect("start = '\r'").to.failToParse(),expect("start = '\u2028'").to.failToParse(),expect("start = '\u2029'").to.failToParse()})),it("parses LineTerminatorSequence",(function(){expect("start =\n'abcd'").to.parseAs(H),expect("start =\r\n'abcd'").to.parseAs(H),expect("start =\r'abcd'").to.parseAs(H),expect("start =\u2028'abcd'").to.parseAs(H),expect("start =\u2029'abcd'").to.parseAs(H)})),it("parses Comment",(function(){expect("start =// comment\n'abcd'").to.parseAs(H),expect("start =/* comment */'abcd'").to.parseAs(H)})),it("parses MultiLineComment",(function(){expect("start =/**/'abcd'").to.parseAs(H),expect("start =/*a*/'abcd'").to.parseAs(H),expect("start =/*abc*/'abcd'").to.parseAs(H),expect("start =/**/*/'abcd'").to.failToParse()})),it("parses MultiLineCommentNoLineTerminator",(function(){expect("a = 'abcd'/**/\r\nb = 'efgh'").to.parseAs(z),expect("a = 'abcd'/*a*/\r\nb = 'efgh'").to.parseAs(z),expect("a = 'abcd'/*abc*/\r\nb = 'efgh'").to.parseAs(z),expect("a = 'abcd'/**/*/\r\nb = 'efgh'").to.failToParse(),expect("a = 'abcd'/*\n*/\r\nb = 'efgh'").to.failToParse()})),it("parses SingleLineComment",(function(){expect("start =//\n'abcd'").to.parseAs(H),expect("start =//a\n'abcd'").to.parseAs(H),expect("start =//abc\n'abcd'").to.parseAs(H),expect("start =//\n@\n'abcd'").to.failToParse()})),it("parses Identifier",(function(){expect("start = a:'abcd'").to.parseAs(B(g))})),it("parses IdentifierName",(function(){expect("start = a").to.parseAs(j("a")),expect("start = ab").to.parseAs(j("ab")),expect("start = abcd").to.parseAs(j("abcd"))})),it("parses IdentifierStart",(function(){expect("start = a").to.parseAs(j("a")),expect("start = $").to.failToParse(),expect("$start = a").to.failToParse(),expect("start = a$b").to.parseAs(j("a$b")),expect("start = _").to.parseAs(j("_")),expect("start = \\u0061").to.parseAs(j("a"))})),it("parses IdentifierPart",(function(){expect("start = aa").to.parseAs(j("aa")),expect("start = à").to.parseAs(j("à")),expect("start = a0").to.parseAs(j("a0")),expect("start = a‿").to.parseAs(j("a‿")),expect("start = a").to.parseAs(j("a")),expect("start = a").to.parseAs(j("a"))})),it("parses LiteralMatcher",(function(){expect("start = 'abcd'").to.parseAs(D("abcd",!1)),expect("start = 'abcd'i").to.parseAs(D("abcd",!0))})),it("parses StringLiteral",(function(){expect('start = ""').to.parseAs(D("",!1)),expect('start = "a"').to.parseAs(D("a",!1)),expect('start = "abc"').to.parseAs(D("abc",!1)),expect("start = ''").to.parseAs(D("",!1)),expect("start = 'a'").to.parseAs(D("a",!1)),expect("start = 'abc'").to.parseAs(D("abc",!1))})),it("parses DoubleStringCharacter",(function(){expect('start = "a"').to.parseAs(D("a",!1)),expect('start = "\\n"').to.parseAs(D("\n",!1)),expect('start = "\\\n"').to.parseAs(D("",!1)),expect('start = """').to.failToParse(),expect('start = "\\"').to.failToParse(),expect('start = "\n"').to.failToParse()})),it("parses SingleStringCharacter",(function(){expect("start = 'a'").to.parseAs(D("a",!1)),expect("start = '\\n'").to.parseAs(D("\n",!1)),expect("start = '\\\n'").to.parseAs(D("",!1)),expect("start = '''").to.failToParse(),expect("start = '\\'").to.failToParse(),expect("start = '\n'").to.failToParse()})),it("parses CharacterClassMatcher",(function(){expect("start = []").to.parseAs(I([],!1,!1)),expect("start = [a-d]").to.parseAs(I([["a","d"]],!1,!1)),expect("start = [a]").to.parseAs(I(["a"],!1,!1)),expect("start = [a-de-hi-l]").to.parseAs(I([["a","d"],["e","h"],["i","l"]],!1,!1)),expect("start = [^a-d]").to.parseAs(I([["a","d"]],!0,!1)),expect("start = [a-d]i").to.parseAs(I([["a","d"]],!1,!0)),expect("start = [\\\n]").to.parseAs(I([],!1,!1))})),it("parses ClassCharacterRange",(function(){expect("start = [a-d]").to.parseAs(I([["a","d"]],!1,!1)),expect("start = [a-a]").to.parseAs(I([["a","a"]],!1,!1)),expect("start = [b-a]").to.failToParse({message:"Invalid character range: b-a."})})),it("parses ClassCharacter",(function(){expect("start = [a]").to.parseAs(I(["a"],!1,!1)),expect("start = [\\n]").to.parseAs(I(["\n"],!1,!1)),expect("start = [\\\n]").to.parseAs(I([],!1,!1)),expect("start = []]").to.failToParse(),expect("start = [\\]").to.failToParse(),expect("start = [\n]").to.failToParse()})),it("parses LineContinuation",(function(){expect("start = '\\\r\n'").to.parseAs(D("",!1))})),it("parses EscapeSequence",(function(){expect("start = '\\n'").to.parseAs(D("\n",!1)),expect("start = '\\0'").to.parseAs(D("\0",!1)),expect("start = '\\xFF'").to.parseAs(D("ÿ",!1)),expect("start = '\\uFFFF'").to.parseAs(D("",!1)),expect("start = '\\09'").to.failToParse()})),it("parses CharacterEscapeSequence",(function(){expect("start = '\\n'").to.parseAs(D("\n",!1)),expect("start = '\\a'").to.parseAs(D("a",!1))})),it("parses SingleEscapeCharacter",(function(){expect("start = '\\''").to.parseAs(D("'",!1)),expect("start = '\\\"'").to.parseAs(D('"',!1)),expect("start = '\\\\'").to.parseAs(D("\\",!1)),expect("start = '\\b'").to.parseAs(D("\b",!1)),expect("start = '\\f'").to.parseAs(D("\f",!1)),expect("start = '\\n'").to.parseAs(D("\n",!1)),expect("start = '\\r'").to.parseAs(D("\r",!1)),expect("start = '\\t'").to.parseAs(D("\t",!1)),expect("start = '\\v'").to.parseAs(D("\v",!1))})),it("parses NonEscapeCharacter",(function(){expect("start = '\\a'").to.parseAs(D("a",!1))})),it("parses HexEscapeSequence",(function(){expect("start = '\\xFF'").to.parseAs(D("ÿ",!1))})),it("parses UnicodeEscapeSequence",(function(){expect("start = '\\uFFFF'").to.parseAs(D("",!1))})),it("parses AnyMatcher",(function(){expect("start = .").to.parseAs(k())})),it("parses CodeBlock",(function(){expect("start = 'abcd' { code }").to.parseAs(M(" code "))})),it("parses Code",(function(){expect("start = 'abcd' {a}").to.parseAs(M("a")),expect("start = 'abcd' {abc}").to.parseAs(M("abc")),expect("start = 'abcd' {{a}}").to.parseAs(M("{a}")),expect("start = 'abcd' {{a}{b}{c}}").to.parseAs(M("{a}{b}{c}")),expect("start = 'abcd' {{}").to.failToParse(),expect("start = 'abcd' {}}").to.failToParse()})),it("parses __",(function(){expect("start ='abcd'").to.parseAs(H),expect("start = 'abcd'").to.parseAs(H),expect("start =\r\n'abcd'").to.parseAs(H),expect("start =/* comment */'abcd'").to.parseAs(H),expect("start = 'abcd'").to.parseAs(H)})),it("parses _",(function(){expect("a = 'abcd'\r\nb = 'efgh'").to.parseAs(z),expect("a = 'abcd' \r\nb = 'efgh'").to.parseAs(z),expect("a = 'abcd'/* comment */\r\nb = 'efgh'").to.parseAs(z),expect("a = 'abcd' \r\nb = 'efgh'").to.parseAs(z)})),it("parses EOS",(function(){expect("a = 'abcd'\n;b = 'efgh'").to.parseAs(z),expect("a = 'abcd' \r\nb = 'efgh'").to.parseAs(z),expect("a = 'abcd' // comment\r\nb = 'efgh'").to.parseAs(z),expect("a = 'abcd'\nb = 'efgh'").to.parseAs(z)})),it("parses EOF",(function(){expect("start = 'abcd'\n").to.parseAs(H)})),it("generates codeLocation / nameLocation / labelLocation",(function(){var e=parser.parse("\n{{\n const foo = 12;\n}}\n{\n const bar = 13;\n}\na = label:'abcd' &{ return true; } !{ return false; } { return 'so true'; }\nb = @LABEL:'efgh'\nc = @'ijkl'\n");expect(e).to.eql({type:"grammar",topLevelInitializer:{type:"top_level_initializer",code:"\n const foo = 12;\n",codeLocation:{source:void 0,start:{offset:3,line:2,column:3},end:{offset:22,line:4,column:1}},location:{source:void 0,start:{offset:1,line:2,column:1},end:{offset:25,line:5,column:1}}},initializer:{type:"initializer",code:"\n const bar = 13;\n",codeLocation:{source:void 0,start:{offset:26,line:5,column:2},end:{offset:45,line:7,column:1}},location:{source:void 0,start:{offset:25,line:5,column:1},end:{offset:47,line:8,column:1}}},rules:[{type:"rule",name:"a",nameLocation:{source:void 0,start:{offset:47,line:8,column:1},end:{offset:48,line:8,column:2}},expression:{type:"action",expression:{type:"sequence",elements:[{type:"labeled",label:"label",labelLocation:{source:void 0,start:{offset:51,line:8,column:5},end:{offset:56,line:8,column:10}},expression:{type:"literal",value:"abcd",ignoreCase:!1,location:{source:void 0,start:{offset:57,line:8,column:11},end:{offset:63,line:8,column:17}}},location:{source:void 0,start:{offset:51,line:8,column:5},end:{offset:63,line:8,column:17}}},{type:"semantic_and",code:" return true; ",codeLocation:{source:void 0,start:{offset:66,line:8,column:20},end:{offset:80,line:8,column:34}},location:{source:void 0,start:{offset:64,line:8,column:18},end:{offset:81,line:8,column:35}}},{type:"semantic_not",code:" return false; ",codeLocation:{source:void 0,start:{offset:84,line:8,column:38},end:{offset:99,line:8,column:53}},location:{source:void 0,start:{offset:82,line:8,column:36},end:{offset:100,line:8,column:54}}}],location:{source:void 0,start:{offset:51,line:8,column:5},end:{offset:100,line:8,column:54}}},code:" return 'so true'; ",codeLocation:{source:void 0,start:{offset:102,line:8,column:56},end:{offset:121,line:8,column:75}},location:{source:void 0,start:{offset:51,line:8,column:5},end:{offset:122,line:8,column:76}}},location:{source:void 0,start:{offset:47,line:8,column:1},end:{offset:123,line:9,column:1}}},{type:"rule",name:"b",nameLocation:{source:void 0,start:{offset:123,line:9,column:1},end:{offset:124,line:9,column:2}},expression:{type:"sequence",elements:[{type:"labeled",label:"LABEL",labelLocation:{source:void 0,start:{offset:128,line:9,column:6},end:{offset:133,line:9,column:11}},pick:!0,expression:{type:"literal",value:"efgh",ignoreCase:!1,location:{source:void 0,start:{offset:134,line:9,column:12},end:{offset:140,line:9,column:18}}},location:{source:void 0,start:{offset:127,line:9,column:5},end:{offset:140,line:9,column:18}}}],location:{source:void 0,start:{offset:127,line:9,column:5},end:{offset:140,line:9,column:18}}},location:{source:void 0,start:{offset:123,line:9,column:1},end:{offset:141,line:10,column:1}}},{type:"rule",name:"c",nameLocation:{source:void 0,start:{offset:141,line:10,column:1},end:{offset:142,line:10,column:2}},expression:{type:"sequence",elements:[{type:"labeled",label:null,labelLocation:{source:void 0,start:{offset:145,line:10,column:5},end:{offset:146,line:10,column:6}},pick:!0,expression:{type:"literal",value:"ijkl",ignoreCase:!1,location:{source:void 0,start:{offset:146,line:10,column:6},end:{offset:152,line:10,column:12}}},location:{source:void 0,start:{offset:145,line:10,column:5},end:{offset:152,line:10,column:12}}}],location:{source:void 0,start:{offset:145,line:10,column:5},end:{offset:152,line:10,column:12}}},location:{source:void 0,start:{offset:141,line:10,column:1},end:{offset:153,line:11,column:1}}}],location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:153,line:11,column:1}}})}))})),exports.peggyVersion=peggyVersion})); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("chai"),require("whatwg-url")):"function"==typeof define&&define.amd?define(["exports","chai","whatwg-url"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).browser={},e.chai,e.whatwgURL)}(this,(function(exports,require$$0,require$$0$1){var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},GrammarLocation$5=function(){function e(e,t){this.source=e,this.start=t}return e.prototype.toString=function(){return String(this.source)},e.prototype.offset=function(e){return{line:e.line+this.start.line-1,column:1===e.line?e.column+this.start.column-1:e.column,offset:e.offset+this.start.offset}},e.offsetStart=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.start):e.start},e.offsetEnd=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.end):e.end},e}(),grammarLocation=GrammarLocation$5,__extends=commonjsGlobal&&commonjsGlobal.__extends||(extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},extendStatics(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),extendStatics,GrammarLocation$4=grammarLocation,setProtoOf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},GrammarError$5=function(e){function t(r,a,n){var o=e.call(this,r)||this;return setProtoOf(o,t.prototype),o.name="GrammarError",o.location=a,void 0===n&&(n=[]),o.diagnostics=n,o.stage=null,o.problems=[["error",r,a,n]],o}return __extends(t,e),t.prototype.toString=function(){var t=e.prototype.toString.call(this);this.location&&(t+="\n at ",void 0!==this.location.source&&null!==this.location.source&&(t+="".concat(this.location.source,":")),t+="".concat(this.location.start.line,":").concat(this.location.start.column));for(var r=0,a=this.diagnostics;r<a.length;r++){var n=a[r];t+="\n from ",void 0!==n.location.source&&null!==n.location.source&&(t+="".concat(n.location.source,":")),t+="".concat(n.location.start.line,":").concat(n.location.start.column,": ").concat(n.message)}return t},t.prototype.format=function(e){var t=e.map((function(e){var t=e.source,r=e.text;return{source:t,text:null!=r?String(r).split(/\r\n|\n|\r/g):[]}}));function r(e,r,a){void 0===a&&(a="");var n="",o=t.find((function(t){return t.source===e.source})),s=e.start,c=GrammarLocation$4.offsetStart(e);if(o){var i=e.end,u=o.text[s.line-1],p=(s.line===i.line?i.column:u.length+1)-s.column||1;a&&(n+="\nnote: ".concat(a)),n+="\n --\x3e ".concat(e.source,":").concat(c.line,":").concat(c.column,"\n").concat("".padEnd(r)," |\n").concat(c.line.toString().padStart(r)," | ").concat(u,"\n").concat("".padEnd(r)," | ").concat("".padEnd(s.column-1)).concat("".padEnd(p,"^"))}else n+="\n at ".concat(e.source,":").concat(c.line,":").concat(c.column),a&&(n+=": ".concat(a));return n}function a(e,t,a,n){void 0===n&&(n=[]);var o=-1/0;o=a?n.reduce((function(e,t){var r=t.location;return Math.max(e,GrammarLocation$4.offsetStart(r).line)}),a.start.line):Math.max.apply(null,n.map((function(e){return e.location.start.line}))),o=o.toString().length;var s="".concat(e,": ").concat(t);a&&(s+=r(a,o));for(var c=0,i=n;c<i.length;c++){var u=i[c];s+=r(u.location,o,u.message)}return s}return this.problems.filter((function(e){return"info"!==e[0]})).map((function(e){return a.apply(void 0,e)})).join("\n\n")},t}(Error),grammarError=GrammarError$5,__spreadArray$6=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n<o;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},visitor$c={build:function(e){function t(t){for(var r=[],a=1;a<arguments.length;a++)r[a-1]=arguments[a];return e[t.type].apply(e,__spreadArray$6([t],r,!1))}function r(){}function a(e){for(var r=[],a=1;a<arguments.length;a++)r[a-1]=arguments[a];return t.apply(void 0,__spreadArray$6([e.expression],r,!1))}function n(e){return function(r){for(var a=[],n=1;n<arguments.length;n++)a[n-1]=arguments[n];r[e].forEach((function(e){return t.apply(void 0,__spreadArray$6([e],a,!1))}))}}var o={grammar:function(e){for(var r=[],a=1;a<arguments.length;a++)r[a-1]=arguments[a];e.topLevelInitializer&&t.apply(void 0,__spreadArray$6([e.topLevelInitializer],r,!1)),e.initializer&&t.apply(void 0,__spreadArray$6([e.initializer],r,!1)),e.rules.forEach((function(e){return t.apply(void 0,__spreadArray$6([e],r,!1))}))},top_level_initializer:r,initializer:r,rule:a,named:a,choice:n("alternatives"),action:a,sequence:n("elements"),labeled:a,text:a,simple_and:a,simple_not:a,optional:a,zero_or_more:a,one_or_more:a,repeated:function(e){for(var r=[],a=1;a<arguments.length;a++)r[a-1]=arguments[a];return e.delimiter&&t.apply(void 0,__spreadArray$6([e.delimiter],r,!1)),t.apply(void 0,__spreadArray$6([e.expression],r,!1))},group:a,semantic_and:r,semantic_not:r,rule_ref:r,literal:r,class:r,any:r};return Object.keys(o).forEach((function(t){Object.prototype.hasOwnProperty.call(e,t)||(e[t]=o[t])})),t}},visitor_1=visitor$c,visitor$b=visitor_1,asts$7={findRule:function(e,t){for(var r=0;r<e.rules.length;r++)if(e.rules[r].name===t)return e.rules[r]},indexOfRule:function(e,t){for(var r=0;r<e.rules.length;r++)if(e.rules[r].name===t)return r;return-1},alwaysConsumesOnSuccess:function(e,t){function r(){return!0}function a(){return!1}var n=visitor$b.build({choice:function(e){return e.alternatives.every(n)},sequence:function(e){return e.elements.some(n)},simple_and:a,simple_not:a,optional:a,zero_or_more:a,repeated:function(e){var t=e.min?e.min:e.max;return!("constant"!==t.type||0===t.value||!n(e.expression)&&!(t.value>1&&e.delimiter&&n(e.delimiter)))},semantic_and:a,semantic_not:a,rule_ref:function(t){var r=asts$7.findRule(e,t.name);return r?n(r):void 0},literal:function(e){return""!==e.value},class:r,any:r});return n(t)}},asts_1=asts$7,opcodes={PUSH:0,PUSH_EMPTY_STRING:35,PUSH_UNDEFINED:1,PUSH_NULL:2,PUSH_FAILED:3,PUSH_EMPTY_ARRAY:4,PUSH_CURR_POS:5,POP:6,POP_CURR_POS:7,POP_N:8,NIP:9,APPEND:10,WRAP:11,TEXT:12,PLUCK:36,IF:13,IF_ERROR:14,IF_NOT_ERROR:15,IF_LT:30,IF_GE:31,IF_LT_DYNAMIC:32,IF_GE_DYNAMIC:33,WHILE_NOT_ERROR:16,MATCH_ANY:17,MATCH_STRING:18,MATCH_STRING_IC:19,MATCH_CHAR_CLASS:20,MATCH_REGEXP:20,ACCEPT_N:21,ACCEPT_STRING:22,FAIL:23,LOAD_SAVED_POS:24,UPDATE_SAVED_POS:25,CALL:26,RULE:27,SILENT_FAILS_ON:28,SILENT_FAILS_OFF:29,SOURCE_MAP_PUSH:37,SOURCE_MAP_POP:38,SOURCE_MAP_LABEL_PUSH:39,SOURCE_MAP_LABEL_POP:40},opcodes_1=opcodes,visitor$a=visitor_1,asts$6=asts_1,GrammarError$4=grammarError,ALWAYS_MATCH$1=1,SOMETIMES_MATCH$1=0,NEVER_MATCH$1=-1;function inferenceMatchResult$1(e){function t(e){return e.match=SOMETIMES_MATCH$1}function r(e){return o(e.expression),e.match=ALWAYS_MATCH$1}function a(e){return e.match=o(e.expression)}function n(e,t){for(var r=e.length,a=0,n=0,s=0;s<r;++s){var c=o(e[s]);c===ALWAYS_MATCH$1&&++a,c===NEVER_MATCH$1&&++n}return a===r?ALWAYS_MATCH$1:t?n===r?NEVER_MATCH$1:SOMETIMES_MATCH$1:n>0?NEVER_MATCH$1:SOMETIMES_MATCH$1}var o=visitor$a.build({rule:function(e){var t=void 0,r=0;if(void 0===e.match){e.match=SOMETIMES_MATCH$1;do{if(t=e.match,e.match=o(e.expression),++r>6)throw new GrammarError$4("Infinity cycle detected when trying to evaluate node match result",e.location)}while(t!==e.match)}return e.match},named:a,choice:function(e){return e.match=n(e.alternatives,!0)},action:a,sequence:function(e){return e.match=n(e.elements,!1)},labeled:a,text:a,simple_and:a,simple_not:function(e){return e.match=-o(e.expression)},optional:r,zero_or_more:r,one_or_more:a,repeated:function(e){var t=o(e.expression),r=e.delimiter?o(e.delimiter):NEVER_MATCH$1,a=e.min?e.min:e.max;return"constant"!==a.type||"constant"!==e.max.type?e.match=SOMETIMES_MATCH$1:0===e.max.value||null!==e.max.value&&a.value>e.max.value?e.match=NEVER_MATCH$1:t===NEVER_MATCH$1?e.match=0===a.value?ALWAYS_MATCH$1:NEVER_MATCH$1:t===ALWAYS_MATCH$1?e.delimiter&&a.value>=2?e.match=r:e.match=ALWAYS_MATCH$1:e.delimiter&&a.value>=2?e.match=r===NEVER_MATCH$1?NEVER_MATCH$1:SOMETIMES_MATCH$1:e.match=0===a.value?ALWAYS_MATCH$1:SOMETIMES_MATCH$1},group:a,semantic_and:t,semantic_not:t,rule_ref:function(t){var r=asts$6.findRule(e,t.name);return t.match=o(r)},literal:function(e){var t=0===e.value.length?ALWAYS_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},class:function(e){var t=0===e.parts.length?NEVER_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},any:t});o(e)}inferenceMatchResult$1.ALWAYS_MATCH=ALWAYS_MATCH$1,inferenceMatchResult$1.SOMETIMES_MATCH=SOMETIMES_MATCH$1,inferenceMatchResult$1.NEVER_MATCH=NEVER_MATCH$1;var inferenceMatchResult_1=inferenceMatchResult$1,__spreadArray$5=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n<o;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},asts$5=asts_1,op$2=opcodes_1,visitor$9=visitor_1,_a$4=inferenceMatchResult_1,ALWAYS_MATCH=_a$4.ALWAYS_MATCH,SOMETIMES_MATCH=_a$4.SOMETIMES_MATCH,NEVER_MATCH=_a$4.NEVER_MATCH;function generateBytecode$1(e,t){var r=[],a=[],n=[],o=[],s=[];function c(e){var t=r.indexOf(e);return-1===t?r.push(e)-1:t}function i(e){var t=JSON.stringify(e),r=n.findIndex((function(e){return JSON.stringify(e)===t}));return-1===r?n.push(e)-1:r}function u(e,t,r){var a={predicate:e,params:t,body:r.code,location:r.codeLocation},n=JSON.stringify(a),s=o.findIndex((function(e){return JSON.stringify(e)===n}));return-1===s?o.push(a)-1:s}function p(e){return s.push(e)-1}function l(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r]})),t}function f(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return e.concat.apply(e,t)}function g(e,t,r,a){return e===ALWAYS_MATCH?r:e===NEVER_MATCH?a:t.concat([r.length,a.length],r,a)}function d(e,t,r,a){var n=Object.keys(r).map((function(e){return a-r[e]}));return[op$2.CALL,e,t,n.length].concat(n)}function m(e,t,r){var a=e.match||0;return f([op$2.PUSH_CURR_POS],A(e,{sp:r.sp+1,env:l(r.env),action:null}),g(t?-a:a,[t?op$2.IF_ERROR:op$2.IF_NOT_ERROR],f([op$2.POP],[t?op$2.POP:op$2.POP_CURR_POS],[op$2.PUSH_UNDEFINED]),f([op$2.POP],[t?op$2.POP_CURR_POS:op$2.POP],[op$2.PUSH_FAILED])))}function $(e,t,r){var a=u(!0,Object.keys(r.env),e);return f([op$2.UPDATE_SAVED_POS],d(a,0,r.env,r.sp),g(e.match||0,[op$2.IF],f([op$2.POP],t?[op$2.PUSH_FAILED]:[op$2.PUSH_UNDEFINED]),f([op$2.POP],t?[op$2.PUSH_UNDEFINED]:[op$2.PUSH_FAILED])))}function h(e){return t=[op$2.WHILE_NOT_ERROR],r=f([op$2.APPEND],e),t.concat([r.length],r);var t,r}function x(e,t,r,a){switch(e.type){case"constant":return{pre:[],post:[],sp:r};case"variable":return e.sp=a+r-t[e.value],{pre:[],post:[],sp:r};case"function":return e.sp=a,{pre:d(u(!0,Object.keys(t),{code:e.value,codeLocation:e.codeLocation}),0,t,r),post:[op$2.NIP],sp:r+1};default:throw new Error('Unknown boundary type "'.concat(e.type,'" for the "repeated" node'))}}function b(e,t){if(null!==t.value){var r="constant"===t.type?[op$2.IF_GE,t.value]:[op$2.IF_GE_DYNAMIC,t.sp];return g(SOMETIMES_MATCH,r,[op$2.PUSH_FAILED],e)}return e}var v,A=(v={grammar:function(e){e.rules.forEach(A),e.literals=r,e.classes=a,e.expectations=n,e.functions=o,e.locations=s},rule:function(e){e.bytecode=A(e.expression,{sp:-1,env:{},pluck:[],action:null})},named:function(e,t){var r=e.match||0,a=r===NEVER_MATCH?-1:i({type:"rule",value:e.name});return f([op$2.SILENT_FAILS_ON],A(e.expression,t),[op$2.SILENT_FAILS_OFF],g(r,[op$2.IF_ERROR],[op$2.FAIL,a],[]))},choice:function(e,t){return function e(t,r){var a=t[0].match||0,n=A(t[0],{sp:r.sp,env:l(r.env),action:null});return a===ALWAYS_MATCH?n:f(n,t.length>1?g(SOMETIMES_MATCH,[op$2.IF_ERROR],f([op$2.POP],e(t.slice(1),r)),[]):[])}(e.alternatives,t)},action:function(e,t){var r=l(t.env),a="sequence"!==e.expression.type||0===e.expression.elements.length,n=A(e.expression,{sp:t.sp+(a?1:0),env:r,action:e}),o=e.expression.match||0,s=a&&o!==NEVER_MATCH?u(!1,Object.keys(r),e):-1;return a?f([op$2.PUSH_CURR_POS],n,g(o,[op$2.IF_NOT_ERROR],f([op$2.LOAD_SAVED_POS,1],d(s,1,r,t.sp+2)),[]),[op$2.NIP]):n},sequence:function(e,t){return f([op$2.PUSH_CURR_POS],function t(r,a){if(r.length>0){var n=e.elements.length-r.length+1;return f(A(r[0],{sp:a.sp,env:a.env,pluck:a.pluck,action:null}),g(r[0].match||0,[op$2.IF_NOT_ERROR],t(r.slice(1),{sp:a.sp+1,env:a.env,pluck:a.pluck,action:a.action}),f(n>1?[op$2.POP_N,n]:[op$2.POP],[op$2.POP_CURR_POS],[op$2.PUSH_FAILED])))}if(a.pluck.length>0)return f([op$2.PLUCK,e.elements.length+1,a.pluck.length],a.pluck.map((function(e){return a.sp-e})));if(a.action){var o=u(!1,Object.keys(a.env),a.action);return f([op$2.LOAD_SAVED_POS,e.elements.length],d(o,e.elements.length+1,a.env,a.sp))}return f([op$2.WRAP,e.elements.length],[op$2.NIP])}(e.elements,{sp:t.sp+1,env:t.env,pluck:[],action:t.action}))},labeled:function(e,r){var a=r.env,n=e.label,o=r.sp+1;n&&(a=l(r.env),r.env[e.label]=o),e.pick&&r.pluck.push(o);var s=A(e.expression,{sp:r.sp,env:a,action:null});return n&&e.labelLocation&&t&&"source-and-map"===t.output?f([op$2.SOURCE_MAP_LABEL_PUSH,o,c(n),p(e.labelLocation)],s,[op$2.SOURCE_MAP_LABEL_POP,o]):s},text:function(e,t){return f([op$2.PUSH_CURR_POS],A(e.expression,{sp:t.sp+1,env:l(t.env),action:null}),g(e.match||0,[op$2.IF_NOT_ERROR],f([op$2.POP],[op$2.TEXT]),[op$2.NIP]))},simple_and:function(e,t){return m(e.expression,!1,t)},simple_not:function(e,t){return m(e.expression,!0,t)},optional:function(e,t){return f(A(e.expression,{sp:t.sp,env:l(t.env),action:null}),g(-(e.expression.match||0),[op$2.IF_ERROR],f([op$2.POP],[op$2.PUSH_NULL]),[]))},zero_or_more:function(e,t){var r=A(e.expression,{sp:t.sp+1,env:l(t.env),action:null});return f([op$2.PUSH_EMPTY_ARRAY],r,h(r),[op$2.POP])},one_or_more:function(e,t){var r=A(e.expression,{sp:t.sp+1,env:l(t.env),action:null});return f([op$2.PUSH_EMPTY_ARRAY],r,g(e.expression.match||0,[op$2.IF_NOT_ERROR],f(h(r),[op$2.POP]),f([op$2.POP],[op$2.POP],[op$2.PUSH_FAILED])))},repeated:function(e,t){var r=e.min?e.min:e.max,a="constant"!==r.type||r.value>0,n="constant"!==e.max.type&&null!==e.max.value,o=a?2:1,s=e.min?x(e.min,t.env,t.sp,2+("function"===e.max.type?1:0)):{pre:[],post:[],sp:t.sp},c=x(e.max,t.env,s.sp,o),i=A(e.expression,{sp:c.sp+o,env:l(t.env),action:null}),u=null!==e.delimiter?A(e.expression,{sp:c.sp+o+1,env:l(t.env),action:null}):i,p=function(e,t,r,a,n){return e?f([op$2.PUSH_CURR_POS],A(e,{sp:a.sp+n+1,env:l(a.env),action:null}),g(e.match||0,[op$2.IF_NOT_ERROR],f([op$2.POP],r,g(-t,[op$2.IF_ERROR],[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP])),[op$2.NIP])):r}(e.delimiter,e.expression.match||0,u,t,o),d=b(p,e.max),m=n?b(i,e.max):i,$=f(a?[op$2.PUSH_CURR_POS]:[],[op$2.PUSH_EMPTY_ARRAY],m,h(d),[op$2.POP]);return f(s.pre,c.pre,a?function(e,t){var r="constant"===t.type?[op$2.IF_LT,t.value]:[op$2.IF_LT_DYNAMIC,t.sp];return f(e,g(SOMETIMES_MATCH,r,[op$2.POP,op$2.POP_CURR_POS,op$2.PUSH_FAILED],[op$2.NIP]))}($,r):$,c.post,s.post)},group:function(e,t){return A(e.expression,{sp:t.sp,env:l(t.env),action:null})},semantic_and:function(e,t){return $(e,!1,t)},semantic_not:function(e,t){return $(e,!0,t)},rule_ref:function(t){return[op$2.RULE,asts$5.indexOfRule(e,t.name)]},literal:function(e){if(e.value.length>0){var t=e.match||0,r=t===SOMETIMES_MATCH||t===ALWAYS_MATCH&&!e.ignoreCase?c(e.ignoreCase?e.value.toLowerCase():e.value):-1,a=t!==ALWAYS_MATCH?i({type:"literal",value:e.value,ignoreCase:e.ignoreCase}):-1;return g(t,e.ignoreCase?[op$2.MATCH_STRING_IC,r]:[op$2.MATCH_STRING,r],e.ignoreCase?[op$2.ACCEPT_N,e.value.length]:[op$2.ACCEPT_STRING,r],[op$2.FAIL,a])}return[op$2.PUSH_EMPTY_STRING]},class:function(e){var t=e.match||0,r=t===SOMETIMES_MATCH?function(e){var t={value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase},r=JSON.stringify(t),n=a.findIndex((function(e){return JSON.stringify(e)===r}));return-1===n?a.push(t)-1:n}(e):-1,n=t!==ALWAYS_MATCH?i({type:"class",value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase}):-1;return g(t,[op$2.MATCH_CHAR_CLASS,r],[op$2.ACCEPT_N,1],[op$2.FAIL,n])},any:function(e){var t=e.match||0,r=t!==ALWAYS_MATCH?i({type:"any"}):-1;return g(t,[op$2.MATCH_ANY],[op$2.ACCEPT_N,1],[op$2.FAIL,r])}},t&&"source-and-map"===t.output&&Object.keys(v).forEach((function(e){var t=v[e];v[e]=function(e){for(var r=[],a=1;a<arguments.length;a++)r[a-1]=arguments[a];var n=t.apply(void 0,__spreadArray$5([e],r,!1));return void 0!==n&&e.location?f([op$2.SOURCE_MAP_PUSH,p(e.location)],n,[op$2.SOURCE_MAP_POP]):n}})),visitor$9.build(v));A(e)}var generateBytecode_1=generateBytecode$1,sourceMap$1={},sourceMapGenerator$1={},base64Vlq$1={},base64$6={};const intToCharMap$1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");base64$6.encode=function(e){if(0<=e&&e<intToCharMap$1.length)return intToCharMap$1[e];throw new TypeError("Must be between 0 and 63: "+e)};const base64$5=base64$6,VLQ_BASE_SHIFT$1=5,VLQ_BASE$1=1<<VLQ_BASE_SHIFT$1,VLQ_BASE_MASK$1=VLQ_BASE$1-1,VLQ_CONTINUATION_BIT$1=VLQ_BASE$1;function toVLQSigned$1(e){return e<0?1+(-e<<1):0+(e<<1)}base64Vlq$1.encode=function(e){let t,r="",a=toVLQSigned$1(e);do{t=a&VLQ_BASE_MASK$1,a>>>=VLQ_BASE_SHIFT$1,a>0&&(t|=VLQ_CONTINUATION_BIT$1),r+=base64$5.encode(t)}while(a>0);return r};var util$8={};function getArg$1(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$8.getArg=getArg$1;const supportsNullProto$1=!("__proto__"in Object.create(null));function identity$1(e){return e}function toSetString$1(e){return isProtoString$1(e)?"$"+e:e}function fromSetString$1(e){return isProtoString$1(e)?e.slice(1):e}function isProtoString$1(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp$1(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated$1(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp$1(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp$1(e.name,t.name)))))}util$8.toSetString=supportsNullProto$1?identity$1:toSetString$1,util$8.fromSetString=supportsNullProto$1?identity$1:fromSetString$1,util$8.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated$1;const PROTOCOL$1="http:",PROTOCOL_AND_HOST$1=`${PROTOCOL$1}//host`;function createSafeHandler$1(e){return t=>{const r=getURLType$1(t),a=buildSafeBase$1(t),n=new URL(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL$1.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST$1.length):computeRelativeURL$1(a,o)}}function withBase$1(e,t){return new URL(e,t).toString()}function buildUniqueSegment$1(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase$1(e){const t=e.split("..").length-1,r=buildUniqueSegment$1("p",e);let a=`${PROTOCOL_AND_HOST$1}/`;for(let e=0;e<t;e++)a+=`${r}/`;return a}const ABSOLUTE_SCHEME$1=/^[A-Za-z0-9\+\-\.]+:/;function getURLType$1(e){return"/"===e[0]?"/"===e[1]?"scheme-relative":"path-absolute":ABSOLUTE_SCHEME$1.test(e)?"absolute":"path-relative"}function computeRelativeURL$1(e,t){"string"==typeof e&&(e=new URL(e)),"string"==typeof t&&(t=new URL(t));const r=t.pathname.split("/"),a=e.pathname.split("/");for(a.length>0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory$1=createSafeHandler$1((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),normalize$1=createSafeHandler$1((e=>{}));function join$1(e,t){const r=getURLType$1(t),a=getURLType$1(e);if(e=ensureDirectory$1(e),"absolute"===r)return withBase$1(t,void 0);if("absolute"===a)return withBase$1(t,e);if("scheme-relative"===r)return normalize$1(t);if("scheme-relative"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL$1.length);if("path-absolute"===r)return normalize$1(t);if("path-absolute"===a)return withBase$1(t,withBase$1(e,PROTOCOL_AND_HOST$1)).slice(PROTOCOL_AND_HOST$1.length);const n=buildSafeBase$1(t+e);return computeRelativeURL$1(n,withBase$1(t,withBase$1(e,n)))}function relative$1(e,t){const r=relativeIfPossible$1(e,t);return"string"==typeof r?r:normalize$1(t)}function relativeIfPossible$1(e,t){if(getURLType$1(e)!==getURLType$1(t))return null;const r=buildSafeBase$1(e+t),a=new URL(e,r),n=new URL(t,r);try{new URL("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL$1(a,n)}util$8.normalize=normalize$1,util$8.join=join$1,util$8.relative=relative$1;var arraySet$1={};let ArraySet$4=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e<n;e++)a.add(t[e],r);return a}size(){return this._set.size}add(e,t){const r=this.has(e),a=this._array.length;r&&!t||this._array.push(e),r||this._set.set(e,a)}has(e){return this._set.has(e)}indexOf(e){const t=this._set.get(e);if(t>=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)}toArray(){return this._array.slice()}};arraySet$1.ArraySet=ArraySet$4;var mappingList$1={};const util$7=util$8;function generatedPositionAfter$1(e,t){const r=e.generatedLine,a=t.generatedLine,n=e.generatedColumn,o=t.generatedColumn;return a>r||a==r&&o>=n||util$7.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$3=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter$1(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$7.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList$1.MappingList=MappingList$3;const base64VLQ$1=base64Vlq$1,util$6=util$8,ArraySet$3=arraySet$1.ArraySet,MappingList$2=mappingList$1.MappingList;let SourceMapGenerator$3=class e{constructor(e){e||(e={}),this._file=util$6.getArg(e,"file",null),this._sourceRoot=util$6.getArg(e,"sourceRoot",null),this._skipValidation=util$6.getArg(e,"skipValidation",!1),this._sources=new ArraySet$3,this._names=new ArraySet$3,this._mappings=new MappingList$2,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$6.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!=r&&(n=util$6.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$6.getArg(e,"generated"),r=util$6.getArg(e,"original",null);let a=util$6.getArg(e,"source",null),n=util$6.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r&&r.line,originalColumn:r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$6.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$6.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$6.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$6.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$3:this._sources,s=new ArraySet$3;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$6.join(r,t.source)),null!=n&&(t.source=util$6.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$6.join(r,t)),null!=n&&(t=util$6.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,u=0,p="";const l=this._mappings.toArray();for(let f=0,g=l.length;f<g;f++){if(t=l[f],e="",t.generatedLine!==o)for(n=0;t.generatedLine!==o;)e+=";",o++;else if(f>0){if(!util$6.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ$1.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ$1.encode(a-u),u=a,e+=base64VLQ$1.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ$1.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ$1.encode(r-i),i=r)),p+=e}return p}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$6.relative(t,e));const r=util$6.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$3.prototype._version=3,sourceMapGenerator$1.SourceMapGenerator=SourceMapGenerator$3;var sourceNode$1={};const SourceMapGenerator$2=sourceMapGenerator$1.SourceMapGenerator,util$5=util$8,REGEX_NEWLINE$1=/(\r?\n)/,NEWLINE_CODE$1=10,isSourceNode$1="$$$isSourceNode$$$";let SourceNode$4=class e{constructor(e,t,r,a,n){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==n?null:n,this[isSourceNode$1]=!0,null!=a&&this.add(a)}static fromStringWithSourceMap(t,r,a){const n=new e,o=t.split(REGEX_NEWLINE$1);let s=0;const c=function(){return e()+(e()||"");function e(){return s<o.length?o[s++]:void 0}};let i,u=1,p=0,l=null;return r.eachMapping((function(e){if(null!==l){if(!(u<e.generatedLine)){i=o[s]||"";const t=i.substr(0,e.generatedColumn-p);return o[s]=i.substr(e.generatedColumn-p),p=e.generatedColumn,f(l,t),void(l=e)}f(l,c()),u++,p=0}for(;u<e.generatedLine;)n.add(c()),u++;p<e.generatedColumn&&(i=o[s]||"",n.add(i.substr(0,e.generatedColumn)),o[s]=i.substr(e.generatedColumn),p=e.generatedColumn),l=e}),this),s<o.length&&(l&&f(l,c()),n.add(o.splice(s).join(""))),r.sources.forEach((function(e){const t=r.sourceContentFor(e);null!=t&&(null!=a&&(e=util$5.join(a,e)),n.setSourceContent(e,t))})),n;function f(t,r){if(null===t||void 0===t.source)n.add(r);else{const o=a?util$5.join(a,t.source):t.source;n.add(new e(t.originalLine,t.originalColumn,o,r,t.name))}}}add(e){if(Array.isArray(e))e.forEach((function(e){this.add(e)}),this);else{if(!e[isSourceNode$1]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this}prepend(e){if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode$1]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r<a;r++)t=this.children[r],t[isSourceNode$1]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})}join(e){let t,r;const a=this.children.length;if(a>0){for(t=[],r=0;r<a-1;r++)t.push(this.children[r]),t.push(e);t.push(this.children[r]),this.children=t}return this}replaceRight(e,t){const r=this.children[this.children.length-1];return r[isSourceNode$1]?r.replaceRight(e,t):"string"==typeof r?this.children[this.children.length-1]=r.replace(e,t):this.children.push("".replace(e,t)),this}setSourceContent(e,t){this.sourceContents[util$5.toSetString(e)]=t}walkSourceContents(e){for(let t=0,r=this.children.length;t<r;t++)this.children[t][isSourceNode$1]&&this.children[t].walkSourceContents(e);const t=Object.keys(this.sourceContents);for(let r=0,a=t.length;r<a;r++)e(util$5.fromSetString(t[r]),this.sourceContents[t[r]])}toString(){let e="";return this.walk((function(t){e+=t})),e}toStringWithSourceMap(e){const t={code:"",line:1,column:0},r=new SourceMapGenerator$2(e);let a=!1,n=null,o=null,s=null,c=null;return this.walk((function(e,i){t.code+=e,null!==i.source&&null!==i.line&&null!==i.column?(n===i.source&&o===i.line&&s===i.column&&c===i.name||r.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:t.line,column:t.column},name:i.name}),n=i.source,o=i.line,s=i.column,c=i.name,a=!0):a&&(r.addMapping({generated:{line:t.line,column:t.column}}),n=null,a=!1);for(let o=0,s=e.length;o<s;o++)e.charCodeAt(o)===NEWLINE_CODE$1?(t.line++,t.column=0,o+1===s?(n=null,a=!1):a&&r.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:t.line,column:t.column},name:i.name})):t.column++})),this.walkSourceContents((function(e,t){r.setSourceContent(e,t)})),{code:t.code,map:r}}};sourceNode$1.SourceNode=SourceNode$4,sourceMap$1.SourceMapGenerator=sourceMapGenerator$1.SourceMapGenerator,sourceMap$1.SourceNode=sourceNode$1.SourceNode;var SourceNode$3=sourceMap$1.SourceNode,GrammarLocation$3=grammarLocation,Stack$2=function(){function e(e,t,r,a){this.sp=-1,this.maxSp=-1,this.varName=t,this.ruleName=e,this.type=r,this.bytecode=a,this.labels={},this.sourceMapStack=[]}return e.prototype.name=function(e){if(e<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack underflow: attempt to use a variable '").concat(this.varName,"<x>' at an index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.varName+e},e.sourceNode=function(e,t,r){var a=GrammarLocation$3.offsetStart(e);return new SourceNode$3(a.line,a.column?a.column-1:null,String(e.source),t,r)},e.prototype.push=function(t){++this.sp>this.maxSp&&(this.maxSp=this.sp);var r=this.labels[this.sp],a=[this.name(this.sp)," = ",t,";"];if(r){if(this.sourceMapStack.length){var n=e.sourceNode(r.location,a.splice(0,2),r.label),o=this.sourceMapPopInternal(),s=o.parts,c=o.location,i=c.start.offset<r.location.end.offset?{start:r.location.end,end:c.end,source:c.source}:c,u=e.sourceNode(i,a.concat("\n"));return this.sourceMapStack.push([s,s.length+1,c]),new SourceNode$3(null,null,r.location.source,[n,u])}return e.sourceNode(r.location,a.concat("\n"))}return a.join("")},e.prototype.pop=function(e){var t=this;return void 0!==e?(this.sp-=e,Array.from({length:e},(function(e,r){return t.name(t.sp+1+r)}))):this.name(this.sp--)},e.prototype.top=function(){return this.name(this.sp)},e.prototype.index=function(e){if(e<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack overflow: attempt to get a variable at a negative index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.name(this.sp-e)},e.prototype.result=function(){if(this.maxSp<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack is empty, can't get the result.\nBytecode: ").concat(this.bytecode));return this.name(0)},e.prototype.defines=function(){var e=this;return this.maxSp<0?"":this.type+" "+Array.from({length:this.maxSp+1},(function(t,r){return e.name(r)})).join(", ")+";"},e.prototype.checkedIf=function(e,t,r){var a=this.sp,n=t();if(!r)return[n];var o=this.sp;this.sp=a;var s=r();if(o!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+e+": Branches of a condition can't move the stack pointer differently (before: "+a+", after then: "+o+", after else: "+this.sp+"). Bytecode: "+this.bytecode);return[n,s]},e.prototype.checkedLoop=function(e,t){var r=this.sp,a=t();if(r!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+e+": Body of a loop can't move the stack pointer (before: "+r+", after: "+this.sp+"). Bytecode: "+this.bytecode);return a},e.prototype.sourceMapPush=function(e,t){if(this.sourceMapStack.length){var r=this.sourceMapStack[this.sourceMapStack.length-1];r[2].start.offset===t.start.offset&&r[2].end.offset>t.end.offset&&(r[2]={start:t.end,end:r[2].end,source:r[2].source})}this.sourceMapStack.push([e,e.length,t])},e.prototype.sourceMapPopInternal=function(){var e=this.sourceMapStack.pop();if(!e)throw new RangeError("Rule '".concat(this.ruleName,"': Attempting to pop an empty source map stack.\nBytecode: ").concat(this.bytecode));var t=e[0],r=e[1],a=e[2],n=t.splice(r).map((function(e){return e instanceof SourceNode$3?e:e+"\n"}));if(n.length){var o=GrammarLocation$3.offsetStart(a);t.push(new SourceNode$3(o.line,o.column-1,String(a.source),n))}return{parts:t,location:a}},e.prototype.sourceMapPop=function(e){var t=this.sourceMapPopInternal().location;if(this.sourceMapStack.length&&t.end.offset<this.sourceMapStack[this.sourceMapStack.length-1][2].end.offset){var r=this.sourceMapPopInternal(),a=r.parts,n=r.location,o=n.start.offset<t.end.offset?{start:t.end,end:n.end,source:n.source}:n;this.sourceMapStack.push([a,a.length+(e||0),o])}},e}(),stack=Stack$2,version$1="3.0.2",utils$1={};function hex$1(e){return e.charCodeAt(0).toString(16).toUpperCase()}function stringEscape$2(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+hex$1(e)})).replace(/[\x10-\x1F\x7F-\xFF]/g,(function(e){return"\\x"+hex$1(e)})).replace(/[\u0100-\u0FFF]/g,(function(e){return"\\u0"+hex$1(e)})).replace(/[\u1000-\uFFFF]/g,(function(e){return"\\u"+hex$1(e)}))}function regexpClassEscape$2(e){return e.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+hex$1(e)})).replace(/[\x10-\x1F\x7F-\xFF]/g,(function(e){return"\\x"+hex$1(e)})).replace(/[\u0100-\u0FFF]/g,(function(e){return"\\u0"+hex$1(e)})).replace(/[\u1000-\uFFFF]/g,(function(e){return"\\u"+hex$1(e)}))}function base64$4(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=e.length%3,a=e.length-r,n="",o=0;o<a;o+=3)n+=t[e[o]>>2],n+=t[(3&e[o])<<4|e[o+1]>>4],n+=t[(15&e[o+1])<<2|e[o+2]>>6],n+=t[63&e[o+2]];return 1===r?(n+=t[e[a]>>2],n+=t[(3&e[a])<<4],n+="=="):2===r&&(n+=t[e[a]>>2],n+=t[(3&e[a])<<4|e[a+1]>>4],n+=t[(15&e[a+1])<<2],n+="="),n}utils$1.hex=hex$1,utils$1.stringEscape=stringEscape$2,utils$1.regexpClassEscape=regexpClassEscape$2,utils$1.base64=base64$4;var __spreadArray$4=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n<o;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},asts$4=asts_1,op$1=opcodes_1,Stack$1=stack,VERSION$1=version$1,_a$3=utils$1,stringEscape$1=_a$3.stringEscape,regexpClassEscape$1=_a$3.regexpClassEscape,SourceNode$2=sourceMap$1.SourceNode,GrammarLocation$2=grammarLocation;function toSourceNode(e,t,r){var a=GrammarLocation$2.offsetStart(t),n=a.line,o=a.column-1,s=e.split("\n");return 1===s.length?new SourceNode$2(n,o,String(t.source),e,r):new SourceNode$2(null,null,String(t.source),s.map((function(e,a){return new SourceNode$2(n+a,0===a?o:0,String(t.source),a===s.length-1?e:[e,"\n"],r)})))}function wrapInSourceNode(e,t,r,a,n){if(r){var o=GrammarLocation$2.offsetEnd(r);return new SourceNode$2(null,null,String(r.source),[e,toSourceNode(t,r,n),new SourceNode$2(o.line,o.column-1,String(r.source),a)])}return new SourceNode$2(null,null,null,[e,t,a])}function generateJS$1(e,t){if(!(e.literals&&e.locations&&e.classes&&e.expectations&&e.functions))throw new Error("generateJS: generate bytecode was not called.");var r=e.literals,a=e.locations,n=e.classes,o=e.expectations,s=e.functions;if(!t.allowedStartRules)throw new Error("generateJS: options.allowedStartRules was not set.");var c=t.allowedStartRules,i=t.dependencies||{};function u(e){var t=!0,r=0;return function e(a){return Array.isArray(a)?a.map((function(t){return e(t)})):a instanceof SourceNode$2?(r++,a.children=e(a.children),r--,a):(a=t?a.replace(/^(.+)$/gm," $1"):a.replace(/\n(\s*\S)/g,"\n $1"),t=!r||a.endsWith("\n"),a)}(e)}function p(e){return"peg$c"+e}function l(e){return"peg$r"+e}function f(e){return"peg$e"+e}function g(e){return"peg$f"+e}function d(e){return"peg$parse"+e}function m(e){return e.codeLocation?toSourceNode(e.code,e.codeLocation,"$"+e.type):e.code}e.code=function(e){function r(){return["// @generated by Peggy ".concat(VERSION$1,"."),"//","// https://peggyjs.org/"]}function a(){return t.trace?["{"," SyntaxError: peg$SyntaxError,"," DefaultTracer: peg$DefaultTracer,"," parse: peg$parse","}"].join("\n"):["{"," SyntaxError: peg$SyntaxError,"," parse: peg$parse","}"].join("\n")}var n={bare:function(){return __spreadArray$4(__spreadArray$4([],r(),!0),["(function() {",' "use strict";',"",e,"",u("return "+a()+";"),"})()"],!1)},commonjs:function(){var t=Object.keys(i),n=r();return n.push("",'"use strict";',""),t.length>0&&(t.forEach((function(e){n.push("var "+e+' = require("'+stringEscape$1(i[e])+'");')})),n.push("")),n.push(e,"","module.exports = "+a()+";"),n},es:function(){var a=Object.keys(i),n=r();return n.push(""),a.length>0&&(a.forEach((function(e){n.push("import "+e+' from "'+stringEscape$1(i[e])+'";')})),n.push("")),n.push(e,"","export {"," peg$SyntaxError as SyntaxError,",t.trace?" peg$DefaultTracer as DefaultTracer,":""," peg$parse as parse","};"),n},amd:function(){var t=Object.keys(i),n="["+t.map((function(e){return i[e]})).map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",o=t.join(", ");return __spreadArray$4(__spreadArray$4([],r(),!0),["define("+n+", function("+o+") {",' "use strict";',"",e,"",u("return "+a()+";"),"});"],!1)},globals:function(){return __spreadArray$4(__spreadArray$4([],r(),!0),["(function(root) {",' "use strict";',"",e,"",u("root."+t.exportVar+" = "+a()+";"),"})(this);"],!1)},umd:function(){var n=Object.keys(i),o=n.map((function(e){return i[e]})),s="["+o.map((function(e){return'"'+stringEscape$1(e)+'"'})).join(", ")+"]",c=o.map((function(e){return'require("'+stringEscape$1(e)+'")'})).join(", "),p=n.join(", "),l=r();return l.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+s+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+c+");"),null!==t.exportVar&&l.push(" } else {"," root."+t.exportVar+" = factory();"),l.push(" }","})(this, function("+p+") {",' "use strict";',"",e,"",u("return "+a()+";"),"});"),l}}[t.format||"bare"]();return new SourceNode$2(null,null,t.grammarSource,n.map((function(e){return e instanceof SourceNode$2?e:e+"\n"})))}(function(){var i=[];e.topLevelInitializer&&(i.push(m(e.topLevelInitializer)),i.push("")),i.push("function peg$subclass(child, parent) {"," function C() { this.constructor = child; }"," C.prototype = parent.prototype;"," child.prototype = new C();","}","","function peg$SyntaxError(message, expected, found, location) {"," var self = Error.call(this, message);"," // istanbul ignore next Check is a necessary evil to support older environments"," if (Object.setPrototypeOf) {"," Object.setPrototypeOf(self, peg$SyntaxError.prototype);"," }"," self.expected = expected;"," self.found = found;"," self.location = location;",' self.name = "SyntaxError";'," return self;","}","","peg$subclass(peg$SyntaxError, Error);","","function peg$padEnd(str, targetLength, padString) {",' padString = padString || " ";'," if (str.length > targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))'," ? this.location.source.offset(s)"," : s;",' var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;'," if (src) {"," var e = this.location.end;"," var filler = peg$padEnd(\"\", offset_s.line.toString().length, ' ');"," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --\x3e " + loc + "\\n"',' + filler + " |\\n"',' + offset_s.line + " | " + line + "\\n"',' + filler + " | " + peg$padEnd("", s.column - 1, \' \')',' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/"/g, "\\\\\\"")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/\\]/g, "\\\\]")',' .replace(/\\^/g, "\\\\^")',' .replace(/-/g, "\\\\-")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),t.trace&&i.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");var $="{ "+c.map((function(e){return e+": "+d(e)})).join(", ")+" }",h=d(c[0]);return i.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+$+";"," var peg$startRuleFunction = "+h+";","",new SourceNode$2(null,null,t.grammarSource,__spreadArray$4([r.map((function(e,t){return" var "+p(t)+' = "'+stringEscape$1(e)+'";'})).concat("",n.map((function(e,t){return" var "+l(t)+" = /^["+((r=e).inverted?"^":"")+r.value.map((function(e){return Array.isArray(e)?regexpClassEscape$1(e[0])+"-"+regexpClassEscape$1(e[1]):regexpClassEscape$1(e)})).join("")+"]/"+(r.ignoreCase?"i":"")+";";var r}))).concat("",o.map((function(e,t){return" var "+f(t)+" = "+function(e){switch(e.type){case"rule":return'peg$otherExpectation("'+stringEscape$1(e.value)+'")';case"literal":return'peg$literalExpectation("'+stringEscape$1(e.value)+'", '+e.ignoreCase+")";case"class":return"peg$classExpectation(["+e.value.map((function(e){return Array.isArray(e)?'["'+stringEscape$1(e[0])+'", "'+stringEscape$1(e[1])+'"]':'"'+stringEscape$1(e)+'"'})).join(", ")+"], "+e.inverted+", "+e.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(e)+")")}}(e)+";"}))).concat("").join("\n")],s.map((function(e,t){return wrapInSourceNode("\n var ".concat(g(t)," = function(").concat(e.params.join(", "),") {"),e.body,e.location,"};")})),!0)),""," var peg$currPos = 0;"," var peg$savedPos = 0;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = 0;"," var peg$maxFailExpected = [];"," var peg$silentFails = 0;",""),t.cache&&i.push(" var peg$resultsCache = {};",""),t.trace&&i.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),i.push(" var peg$result;","",' if ("startRule" in options) {'," if (!(options.startRule in peg$startRuleFunctions)) {",' throw new Error("Can\'t start parsing from rule \\"" + options.startRule + "\\".");'," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," if (pos >= peg$posDetailsCache.length) {"," p = peg$posDetailsCache.length - 1;"," } else {"," p = pos;"," while (!peg$posDetailsCache[--p]) {}"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos, offset) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," var res = {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };",' if (offset && peg$source && (typeof peg$source.offset === "function")) {'," res.start = peg$source.offset(res.start);"," res.end = peg$source.offset(res.end);"," }"," return res;"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),e.rules.forEach((function(n){i.push.apply(i,u(function(n){var o=[],s=n.bytecode,c=new Stack$1(n.name,"s","var",s),i=function t(n){var o=0,s=n.length,i=[],m=void 0;function $(e,r,a){var s=r+3,p=n[o+s-2],l=n[o+s-1],f=c.checkedIf(o,(function(){return o+=s+p,(a||t)(n.slice(o-p,o))}),l>0?function(){return o+=l,t(n.slice(o-l,o))}:null),g=f[0],d=f[1];i.push("if ("+e+") {"),i.push.apply(i,u(g)),l>0&&(i.push("} else {"),i.push.apply(i,u(d))),i.push("}")}function h(e,r,a){var s=r+3,u=1===a?"input.charAt(peg$currPos)":"input.substr(peg$currPos, "+a+")",p=null;n[o+s]===op$1.ACCEPT_N&&n[o+s+1]===a&&(i.push(c.push(u)),u=c.pop(),p=function(e){c.sp++;var r=t(e.slice(2));return r.unshift(1===a?"peg$currPos++;":"peg$currPos += "+a+";"),r}),$(e(u,null!==p),r,p)}for(var x=function(){switch(n[o]){case op$1.PUSH_EMPTY_STRING:i.push(c.push("''")),o++;break;case op$1.PUSH_CURR_POS:i.push(c.push("peg$currPos")),o++;break;case op$1.PUSH_UNDEFINED:i.push(c.push("undefined")),o++;break;case op$1.PUSH_NULL:i.push(c.push("null")),o++;break;case op$1.PUSH_FAILED:i.push(c.push("peg$FAILED")),o++;break;case op$1.PUSH_EMPTY_ARRAY:i.push(c.push("[]")),o++;break;case op$1.POP:c.pop(),o++;break;case op$1.POP_CURR_POS:i.push("peg$currPos = "+c.pop()+";"),o++;break;case op$1.POP_N:c.pop(n[o+1]),o+=2;break;case op$1.NIP:m=c.pop(),c.pop(),i.push(c.push(m)),o++;break;case op$1.APPEND:m=c.pop(),i.push(c.top()+".push("+m+");"),o++;break;case op$1.WRAP:i.push(c.push("["+c.pop(n[o+1]).join(", ")+"]")),o+=2;break;case op$1.TEXT:i.push(c.push("input.substring("+c.pop()+", peg$currPos)")),o++;break;case op$1.PLUCK:var s=n[o+3-1],x=3+s;m=n.slice(o+3,o+x),m=1===s?c.index(m[0]):"[ ".concat(m.map((function(e){return c.index(e)})).join(", ")," ]"),c.pop(n[o+1]),i.push(c.push(m)),o+=x;break;case op$1.IF:$(c.top(),0);break;case op$1.IF_ERROR:$(c.top()+" === peg$FAILED",0);break;case op$1.IF_NOT_ERROR:$(c.top()+" !== peg$FAILED",0);break;case op$1.IF_LT:$(c.top()+".length < "+n[o+1],1);break;case op$1.IF_GE:$(c.top()+".length >= "+n[o+1],1);break;case op$1.IF_LT_DYNAMIC:$(c.top()+".length < ("+c.index(n[o+1])+"|0)",1);break;case op$1.IF_GE_DYNAMIC:$(c.top()+".length >= ("+c.index(n[o+1])+"|0)",1);break;case op$1.WHILE_NOT_ERROR:S=c.top()+" !== peg$FAILED",_=n[o+2-1],E=c.checkedLoop(o,(function(){return o+=2+_,t(n.slice(o-_,o))})),i.push("while ("+S+") {"),i.push.apply(i,u(E)),i.push("}");break;case op$1.MATCH_ANY:$("input.length > peg$currPos",0);break;case op$1.MATCH_STRING:var b=n[o+1],v=r[b];h((function(e,t){return v.length>1?"".concat(e," === ").concat(p(b)):(e=t?"".concat(e,".charCodeAt(0)"):"input.charCodeAt(peg$currPos)","".concat(e," === ").concat(v.charCodeAt(0)))}),1,v.length);break;case op$1.MATCH_STRING_IC:var A=n[o+1];h((function(e){return"".concat(e,".toLowerCase() === ").concat(p(A))}),1,r[A].length);break;case op$1.MATCH_CHAR_CLASS:var y=n[o+1];h((function(e){return"".concat(l(y),".test(").concat(e,")")}),1,1);break;case op$1.ACCEPT_N:i.push(c.push(n[o+1]>1?"input.substr(peg$currPos, "+n[o+1]+")":"input.charAt(peg$currPos)")),i.push(n[o+1]>1?"peg$currPos += "+n[o+1]+";":"peg$currPos++;"),o+=2;break;case op$1.ACCEPT_STRING:i.push(c.push(p(n[o+1]))),i.push(r[n[o+1]].length>1?"peg$currPos += "+r[n[o+1]].length+";":"peg$currPos++;"),o+=2;break;case op$1.FAIL:i.push(c.push("peg$FAILED")),i.push("if (peg$silentFails === 0) { peg$fail("+f(n[o+1])+"); }"),o+=2;break;case op$1.LOAD_SAVED_POS:i.push("peg$savedPos = "+c.index(n[o+1])+";"),o+=2;break;case op$1.UPDATE_SAVED_POS:i.push("peg$savedPos = peg$currPos;"),o++;break;case op$1.CALL:m=function(e){var t=n[o+4-1];return g(n[o+1])+"("+n.slice(o+4,o+4+t).map((function(e){return c.index(e)})).join(", ")+")"}(),c.pop(n[o+2]),i.push(c.push(m)),o+=4+n[o+3];break;case op$1.RULE:i.push(c.push(d(e.rules[n[o+1]].name)+"()")),o+=2;break;case op$1.SILENT_FAILS_ON:i.push("peg$silentFails++;"),o++;break;case op$1.SILENT_FAILS_OFF:i.push("peg$silentFails--;"),o++;break;case op$1.SOURCE_MAP_PUSH:c.sourceMapPush(i,a[n[o+1]]),o+=2;break;case op$1.SOURCE_MAP_POP:c.sourceMapPop(),o++;break;case op$1.SOURCE_MAP_LABEL_PUSH:c.labels[n[o+1]]={label:r[n[o+2]],location:a[n[o+3]]},o+=4;break;case op$1.SOURCE_MAP_LABEL_POP:delete c.labels[n[o+1]],o+=2;break;default:throw new Error("Invalid opcode: "+n[o]+".")}var S,_,E};o<s;)x();return i}(s);return o.push(wrapInSourceNode("function ",d(n.name),n.nameLocation,"() {\n",n.name)),t.trace&&o.push(" var startPos = peg$currPos;"),o.push(u(c.defines())),o.push.apply(o,u(function(r,a){var n=[];return n.push(""),t.trace&&n.push("peg$tracer.trace({",' type: "rule.enter",'," rule: "+r+","," location: peg$computeLocation(startPos, startPos, true)","});",""),t.cache&&(n.push("var key = peg$currPos * "+e.rules.length+" + "+a+";","var cached = peg$resultsCache[key];","","if (cached) {"," peg$currPos = cached.nextPos;",""),t.trace&&n.push("if (cached.result !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+r+","," result: cached.result,"," location: peg$computeLocation(startPos, peg$currPos, true)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+r+","," location: peg$computeLocation(startPos, startPos, true)"," });","}",""),n.push(" return cached.result;","}","")),n}('"'+stringEscape$1(n.name)+'"',asts$4.indexOfRule(e,n.name)))),o.push.apply(o,u(i)),o.push.apply(o,u(function(e,r){var a=[];return t.cache&&a.push("","peg$resultsCache[key] = { nextPos: peg$currPos, result: "+r+" };"),t.trace&&a.push("","if ("+r+" !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+e+","," result: "+r+","," location: peg$computeLocation(startPos, peg$currPos, true)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+e+","," location: peg$computeLocation(startPos, startPos, true)"," });","}"),a.push("","return "+r+";"),a}('"'+stringEscape$1(n.name)+'"',c.result()))),o.push("}"),o}(n))),i.push("")})),e.initializer&&(i.push(m(e.initializer)),i.push("")),i.push(" peg$result = peg$startRuleFunction();",""," if (peg$result !== peg$FAILED && peg$currPos === input.length) {"," return peg$result;"," } else {"," if (peg$result !== peg$FAILED && peg$currPos < input.length) {"," peg$fail(peg$endExpectation());"," }",""," throw peg$buildStructuredError("," peg$maxFailExpected,"," peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,"," peg$maxFailPos < input.length"," ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)"," : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)"," );"," }","}"),new SourceNode$2(null,null,t.grammarSource,i.map((function(e){return e instanceof SourceNode$2?e:e+"\n"})))}())}var generateJs=generateJS$1,asts$3=asts_1,visitor$8=visitor_1;function removeProxyRules$1(e,t,r){var a=[];e.rules.forEach((function(n,o){var s;"rule"===(s=n).type&&"rule_ref"===s.expression.type&&(function(e,t,a){visitor$8.build({rule_ref:function(n){n.name===t&&(n.name=a,r.info('Proxy rule "'.concat(t,'" replaced by the rule "').concat(a,'"'),n.location,[{message:"This rule will be used",location:asts$3.findRule(e,a).nameLocation}]))}})(e)}(e,n.name,n.expression.name),-1===t.allowedStartRules.indexOf(n.name)&&a.push(o))})),a.reverse(),a.forEach((function(t){e.rules.splice(t,1)}))}var removeProxyRules_1=removeProxyRules$1,__assign$1=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign$1=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},__assign$1.apply(this,arguments)},__spreadArray$3=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n<o;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},visitor$7=visitor_1;function cloneOver(e,t){var r=e,a=t;Object.keys(r).forEach((function(e){return delete r[e]})),Object.keys(a).forEach((function(e){r[e]=a[e]}))}function cleanParts(e){e.sort((function(e,t){var r=Array.isArray(e)?e:[e,e],a=r[0],n=r[1],o=Array.isArray(t)?t:[t,t],s=o[0],c=o[1];return a!==s?a<s?-1:1:n!==c?n>c?-1:1:0}));for(var t="",r="",a=0;a<e.length;a++){var n=e[a],o=Array.isArray(n)?n:[n,n],s=o[0],c=o[1];c<=r?e.splice(a--,1):r.charCodeAt(0)+1>=s.charCodeAt(0)?(e.splice(a--,1),e[a]=[t,r=c]):(t=s,r=c)}return e}function mergeCharacterClasses$1(e){var t=Object.create(null);e.rules.forEach((function(e){return t[e.name]=e.expression}));var r=Object.create(null),a=[function(e,a){if("class"===e.type&&!e.inverted)return a&&((e=__assign$1({},e)).parts=__spreadArray$3([],e.parts,!0)),e;if("literal"===e.type&&1===e.value.length)return{type:"class",parts:[e.value],inverted:!1,ignoreCase:e.ignoreCase,location:e.location};if("rule_ref"===e.type){var s=t[e.name];if(s){r[e.name]||(r[e.name]=!0,o(s));var c=n(s,!0);return c&&(c.location=e.location),c}}return null},visitor$7.build({choice:function(e){var t=null,r=!1;e.alternatives.forEach((function(a,s){var c;o(a);var i=n(a);i?t&&t.ignoreCase===i.ignoreCase?((c=t.parts).push.apply(c,i.parts),e.alternatives[s-1]=t,e.alternatives[s]=t,t.location={source:t.location.source,start:t.location.start,end:i.location.end},r=!0):t=i:t=null})),r&&(e.alternatives=e.alternatives.filter((function(e,t,r){return!t||e!==r[t-1]})),e.alternatives.forEach((function(t,r){"class"===t.type&&(t.parts=cleanParts(t.parts),1!==t.parts.length||Array.isArray(t.parts[0])||t.inverted||(e.alternatives[r]={type:"literal",value:t.parts[0],ignoreCase:t.ignoreCase,location:t.location}))})),1===e.alternatives.length&&cloneOver(e,e.alternatives[0]))},text:function(e){if(o(e.expression),"class"===e.expression.type||"literal"===e.expression.type){var t=e.location;cloneOver(e,e.expression),e.location=t}}})],n=a[0],o=a[1];e.rules.forEach((function(e){r[e.name]=!0,o(e.expression)}))}var mergeCharacterClasses_1=mergeCharacterClasses$1,visitor$6=visitor_1;function reportDuplicateLabels$1(e,t,r){function a(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r]})),t}function n(e,t){o(e.expression,a(t))}var o=visitor$6.build({rule:function(e){o(e.expression,{})},choice:function(e,t){e.alternatives.forEach((function(e){o(e,a(t))}))},action:n,labeled:function(e,t){var a=e.label;a&&Object.prototype.hasOwnProperty.call(t,a)&&r.error('Label "'.concat(e.label,'" is already defined'),e.labelLocation,[{message:"Original label location",location:t[a]}]),o(e.expression,t),t[e.label]=e.labelLocation},text:n,simple_and:n,simple_not:n,optional:n,zero_or_more:n,one_or_more:n,repeated:function(e,t){e.delimiter&&o(e.delimiter,a(t)),o(e.expression,a(t))},group:n});o(e)}var reportDuplicateLabels_1=reportDuplicateLabels$1,visitor$5=visitor_1;function reportDuplicateRules$1(e,t,r){var a={};visitor$5.build({rule:function(e){Object.prototype.hasOwnProperty.call(a,e.name)?r.error('Rule "'.concat(e.name,'" is already defined'),e.nameLocation,[{message:"Original rule location",location:a[e.name]}]):a[e.name]=e.nameLocation}})(e)}var reportDuplicateRules_1=reportDuplicateRules$1,asts$2=asts_1,visitor$4=visitor_1;function reportInfiniteRecursion$1(e,t,r){var a=[],n=[],o=visitor$4.build({rule:function(e){a.push(e.name),o(e.expression),a.pop()},sequence:function(t){t.elements.every((function(t){return o(t),!asts$2.alwaysConsumesOnSuccess(e,t)}))},repeated:function(t){o(t.expression),t.delimiter&&!asts$2.alwaysConsumesOnSuccess(e,t.expression)&&o(t.delimiter)},rule_ref:function(t){n.push(t);var s=asts$2.findRule(e,t.name);if(-1!==a.indexOf(t.name))return a.push(t.name),void r.error("Possible infinite loop when parsing (left recursion: "+a.join(" -> ")+")",s.nameLocation,n.map((function(e,t,r){return{message:t+1!==r.length?"Step ".concat(t+1,': call of the rule "').concat(e.name,'" without input consumption'):"Step ".concat(t+1,": call itself without input consumption - left recursion"),location:e.location}})));s&&o(s),n.pop()}});o(e)}var reportInfiniteRecursion_1=reportInfiniteRecursion$1,asts$1=asts_1,visitor$3=visitor_1;function reportInfiniteRepetition$1(e,t,r){var a=visitor$3.build({zero_or_more:function(t){asts$1.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},one_or_more:function(t){asts$1.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},repeated:function(t){if(t.delimiter&&a(t.delimiter),!(asts$1.alwaysConsumesOnSuccess(e,t.expression)||t.delimiter&&asts$1.alwaysConsumesOnSuccess(e,t.delimiter)))if(null===t.max.value)r.error("Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",t.location);else{var n=t.min?t.min:t.max;r.warning("constant"===n.type&&"constant"===t.max.type?"An expression may not consume any input and may always match ".concat(t.max.value," times"):"An expression may not consume any input and may always match with a maximum repetition count",t.location)}}});a(e)}var reportInfiniteRepetition_1=reportInfiniteRepetition$1,asts=asts_1,visitor$2=visitor_1;function reportUndefinedRules$1(e,t,r){visitor$2.build({rule_ref:function(t){asts.findRule(e,t.name)||r.error('Rule "'.concat(t.name,'" is not defined'),t.location)}})(e)}var reportUndefinedRules_1=reportUndefinedRules$1,visitor$1=visitor_1;function reportIncorrectPlucking$1(e,t,r){var a=visitor$1.build({action:function(e){a(e.expression,e)},labeled:function(e,t){e.pick&&t&&r.error('"@" cannot be used with an action block',e.labelLocation,[{message:"Action block location",location:t.codeLocation}]),a(e.expression)}});a(e)}var reportIncorrectPlucking_1=reportIncorrectPlucking$1,__spreadArray$2=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n<o;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},GrammarError$3=grammarError,Defaults=function(){function e(e){"function"==typeof(e=void 0!==e?e:{}).error&&(this.error=e.error),"function"==typeof e.warning&&(this.warning=e.warning),"function"==typeof e.info&&(this.info=e.info)}return e.prototype.error=function(){},e.prototype.warning=function(){},e.prototype.info=function(){},e}(),Session$2=function(){function e(e){this._callbacks=new Defaults(e),this._firstError=null,this.errors=0,this.problems=[],this.stage=null}return e.prototype.error=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];++this.errors,null===this._firstError&&(this._firstError=new(GrammarError$3.bind.apply(GrammarError$3,__spreadArray$2([void 0],t,!1))),this._firstError.stage=this.stage,this._firstError.problems=this.problems),this.problems.push(__spreadArray$2(["error"],t,!0)),(e=this._callbacks).error.apply(e,__spreadArray$2([this.stage],t,!1))},e.prototype.warning=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.problems.push(__spreadArray$2(["warning"],t,!0)),(e=this._callbacks).warning.apply(e,__spreadArray$2([this.stage],t,!1))},e.prototype.info=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.problems.push(__spreadArray$2(["info"],t,!0)),(e=this._callbacks).info.apply(e,__spreadArray$2([this.stage],t,!1))},e.prototype.checkErrors=function(){if(0!==this.errors)throw this._firstError},e}(),session=Session$2,generateBytecode=generateBytecode_1,generateJS=generateJs,inferenceMatchResult=inferenceMatchResult_1,removeProxyRules=removeProxyRules_1,mergeCharacterClasses=mergeCharacterClasses_1,reportDuplicateLabels=reportDuplicateLabels_1,reportDuplicateRules=reportDuplicateRules_1,reportInfiniteRecursion=reportInfiniteRecursion_1,reportInfiniteRepetition=reportInfiniteRepetition_1,reportUndefinedRules=reportUndefinedRules_1,reportIncorrectPlucking=reportIncorrectPlucking_1,Session$1=session,visitor=visitor_1,base64$3=utils$1.base64;function processOptions(e,t){var r={};return Object.keys(e).forEach((function(t){r[t]=e[t]})),Object.keys(t).forEach((function(e){Object.prototype.hasOwnProperty.call(r,e)||(r[e]=t[e])})),r}function isSourceMapCapable(e){return"string"==typeof e?e.length>0:e&&"function"==typeof e.offset}var compiler$2={visitor:visitor,passes:{check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRecursion,reportInfiniteRepetition,reportIncorrectPlucking],transform:[removeProxyRules,mergeCharacterClasses,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile:function(ast,passes,options){if(options=void 0!==options?options:{},options=processOptions(options,{allowedStartRules:[ast.rules[0].name],cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");if(0===options.allowedStartRules.length)throw new Error("Must have at least one start rule");var allRules=ast.rules.map((function(e){return e.name}));if(options.allowedStartRules.some((function(e){return"*"===e})))options.allowedStartRules=allRules;else for(var _i=0,_a=options.allowedStartRules;_i<_a.length;_i++){var rule=_a[_i];if(-1===allRules.indexOf(rule))throw new Error('Unknown start rule "'.concat(rule,'"'))}if(("source-and-map"===options.output||"source-with-inline-map"===options.output)&&!isSourceMapCapable(options.grammarSource))throw new Error("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps");var session=new Session$1(options);switch(Object.keys(passes).forEach((function(e){session.stage=e,session.info("Process stage ".concat(e)),passes[e].forEach((function(t){session.info("Process pass ".concat(e,".").concat(t.name)),t(ast,options,session)})),session.checkErrors()})),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;case"source-with-inline-map":if("undefined"==typeof TextEncoder)throw new Error("TextEncoder is not supported by this platform");var sourceMap=ast.code.toStringWithSourceMap(),encoder=new TextEncoder,b64=base64$3(encoder.encode(JSON.stringify(sourceMap.map.toJSON())));return sourceMap.code+"//# sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(b64,"\n");case"ast":return ast;default:throw new Error("Invalid output format: "+options.output+".")}}},compiler_1=compiler$2,OPS_TO_PREFIXED_TYPES={$:"text","&":"simple_and","!":"simple_not"},OPS_TO_SUFFIXED_TYPES={"?":"optional","*":"zero_or_more","+":"one_or_more"},OPS_TO_SEMANTIC_PREDICATE_TYPES={"&":"semantic_and","!":"semantic_not"};function peg$subclass(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function peg$SyntaxError(e,t,r,a){var n=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(n,peg$SyntaxError.prototype),n.expected=t,n.found=r,n.location=a,n.name="SyntaxError",n}function peg$padEnd(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,e+(r+=r.repeat(t)).slice(0,t))}function peg$parse(e,t){var r,a={},n=(t=void 0!==t?t:{}).grammarSource,o={Grammar:lr},s=lr,c="{",i="}",u="=",p="/",l="@",f=":",g="|",d=",",m="..",$="(",h=")",x="\n",b="\r\n",v="/*",A="*/",y="//",S="\\",_="i",E='"',T="'",C="[",P="^",w="]",R="-",L="0",F="b",O="f",B="n",M="r",D="t",k="v",I="x",j="u",N=".",U=";",q=/^[!$&]/,G=/^[*-+?]/,H=/^[!&]/,z=/^[\t\v-\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/,W=/^[\n\r\u2028\u2029]/,V=/^[\r\u2028-\u2029]/,Y=/^[A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376-\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E-\u066F\u0671-\u06D3\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4-\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0-\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,Q=/^[$0-9_\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7-\u09C8\u09CB-\u09CD\u09D7\u09E2-\u09E3\u09E6-\u09EF\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B62-\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56\u0C62-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5-\u0CD6\u0CE2-\u0CE3\u0CE6-\u0CEF\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62-\u0D63\u0D66-\u0D6F\u0D82-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18-\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F3F\u0F71-\u0F84\u0F86-\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19D9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u200C-\u200D\u203F-\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099-\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880-\uA881\uA8B4-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C-\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7-\uAAB8\uAABE-\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5-\uAAF6\uABE3-\uABEA\uABEC-\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33-\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F]/,J=/^[\n\r"\\\u2028-\u2029]/,X=/^[\n\r'\\\u2028-\u2029]/,K=/^[\n\r\\-\]\u2028-\u2029]/,Z=/^["'\\]/,ee=/^[0-9ux]/,te=/^[0-9]/,re=/^[0-9a-f]/i,ae=/^[{}]/,ne=or("{",!1),oe=or("}",!1),se=or("=",!1),ce=or("/",!1),ie=or("@",!1),ue=or(":",!1),pe=sr(["!","$","&"],!1,!1),le=sr([["*","+"],"?"],!1,!1),fe=or("|",!1),ge=or(",",!1),de=or("..",!1),me=or("(",!1),$e=or(")",!1),he=sr(["!","&"],!1,!1),xe={type:"any"},be=cr("whitespace"),ve=sr(["\t",["\v","\f"]," "," "," ",[" "," "]," "," "," ","\ufeff"],!1,!1),Ae=sr(["\n","\r","\u2028","\u2029"],!1,!1),ye=cr("end of line"),Se=or("\n",!1),_e=or("\r\n",!1),Ee=sr(["\r",["\u2028","\u2029"]],!1,!1),Te=cr("comment"),Ce=or("/*",!1),Pe=or("*/",!1),we=or("//",!1),Re=cr("identifier"),Le=sr([["A","Z"],"_",["a","z"],"ª","µ","º",["À","Ö"],["Ø","ö"],["ø","ˁ"],["ˆ","ˑ"],["ˠ","ˤ"],"ˬ","ˮ",["Ͱ","ʹ"],["Ͷ","ͷ"],["ͺ","ͽ"],"Ϳ","Ά",["Έ","Ί"],"Ό",["Ύ","Ρ"],["Σ","ϵ"],["Ϸ","ҁ"],["Ҋ","ԯ"],["Ա","Ֆ"],"ՙ",["ա","և"],["א","ת"],["װ","ײ"],["ؠ","ي"],["ٮ","ٯ"],["ٱ","ۓ"],"ە",["ۥ","ۦ"],["ۮ","ۯ"],["ۺ","ۼ"],"ۿ","ܐ",["ܒ","ܯ"],["ݍ","ޥ"],"ޱ",["ߊ","ߪ"],["ߴ","ߵ"],"ߺ",["ࠀ","ࠕ"],"ࠚ","ࠤ","ࠨ",["ࡀ","ࡘ"],["ࢠ","ࢴ"],["ऄ","ह"],"ऽ","ॐ",["क़","ॡ"],["ॱ","ঀ"],["অ","ঌ"],["এ","ঐ"],["ও","ন"],["প","র"],"ল",["শ","হ"],"ঽ","ৎ",["ড়","ঢ়"],["য়","ৡ"],["ৰ","ৱ"],["ਅ","ਊ"],["ਏ","ਐ"],["ਓ","ਨ"],["ਪ","ਰ"],["ਲ","ਲ਼"],["ਵ","ਸ਼"],["ਸ","ਹ"],["ਖ਼","ੜ"],"ਫ਼",["ੲ","ੴ"],["અ","ઍ"],["એ","ઑ"],["ઓ","ન"],["પ","ર"],["લ","ળ"],["વ","હ"],"ઽ","ૐ",["ૠ","ૡ"],"ૹ",["ଅ","ଌ"],["ଏ","ଐ"],["ଓ","ନ"],["ପ","ର"],["ଲ","ଳ"],["ଵ","ହ"],"ଽ",["ଡ଼","ଢ଼"],["ୟ","ୡ"],"ୱ","ஃ",["அ","ஊ"],["எ","ஐ"],["ஒ","க"],["ங","ச"],"ஜ",["ஞ","ட"],["ண","த"],["ந","ப"],["ம","ஹ"],"ௐ",["అ","ఌ"],["ఎ","ఐ"],["ఒ","న"],["ప","హ"],"ఽ",["ౘ","ౚ"],["ౠ","ౡ"],["ಅ","ಌ"],["ಎ","ಐ"],["ಒ","ನ"],["ಪ","ಳ"],["ವ","ಹ"],"ಽ","ೞ",["ೠ","ೡ"],["ೱ","ೲ"],["അ","ഌ"],["എ","ഐ"],["ഒ","ഺ"],"ഽ","ൎ",["ൟ","ൡ"],["ൺ","ൿ"],["අ","ඖ"],["ක","න"],["ඳ","ර"],"ල",["ව","ෆ"],["ก","ะ"],["า","ำ"],["เ","ๆ"],["ກ","ຂ"],"ຄ",["ງ","ຈ"],"ຊ","ຍ",["ດ","ທ"],["ນ","ຟ"],["ມ","ຣ"],"ລ","ວ",["ສ","ຫ"],["ອ","ະ"],["າ","ຳ"],"ຽ",["ເ","ໄ"],"ໆ",["ໜ","ໟ"],"ༀ",["ཀ","ཇ"],["ཉ","ཬ"],["ྈ","ྌ"],["က","ဪ"],"ဿ",["ၐ","ၕ"],["ၚ","ၝ"],"ၡ",["ၥ","ၦ"],["ၮ","ၰ"],["ၵ","ႁ"],"ႎ",["Ⴀ","Ⴥ"],"Ⴧ","Ⴭ",["ა","ჺ"],["ჼ","ቈ"],["ቊ","ቍ"],["ቐ","ቖ"],"ቘ",["ቚ","ቝ"],["በ","ኈ"],["ኊ","ኍ"],["ነ","ኰ"],["ኲ","ኵ"],["ኸ","ኾ"],"ዀ",["ዂ","ዅ"],["ወ","ዖ"],["ዘ","ጐ"],["ጒ","ጕ"],["ጘ","ፚ"],["ᎀ","ᎏ"],["Ꭰ","Ᏽ"],["ᏸ","ᏽ"],["ᐁ","ᙬ"],["ᙯ","ᙿ"],["ᚁ","ᚚ"],["ᚠ","ᛪ"],["ᛮ","ᛸ"],["ᜀ","ᜌ"],["ᜎ","ᜑ"],["ᜠ","ᜱ"],["ᝀ","ᝑ"],["ᝠ","ᝬ"],["ᝮ","ᝰ"],["ក","ឳ"],"ៗ","ៜ",["ᠠ","ᡷ"],["ᢀ","ᢨ"],"ᢪ",["ᢰ","ᣵ"],["ᤀ","ᤞ"],["ᥐ","ᥭ"],["ᥰ","ᥴ"],["ᦀ","ᦫ"],["ᦰ","ᧉ"],["ᨀ","ᨖ"],["ᨠ","ᩔ"],"ᪧ",["ᬅ","ᬳ"],["ᭅ","ᭋ"],["ᮃ","ᮠ"],["ᮮ","ᮯ"],["ᮺ","ᯥ"],["ᰀ","ᰣ"],["ᱍ","ᱏ"],["ᱚ","ᱽ"],["ᳩ","ᳬ"],["ᳮ","ᳱ"],["ᳵ","ᳶ"],["ᴀ","ᶿ"],["Ḁ","ἕ"],["Ἐ","Ἕ"],["ἠ","ὅ"],["Ὀ","Ὅ"],["ὐ","ὗ"],"Ὑ","Ὓ","Ὕ",["Ὗ","ώ"],["ᾀ","ᾴ"],["ᾶ","ᾼ"],"ι",["ῂ","ῄ"],["ῆ","ῌ"],["ῐ","ΐ"],["ῖ","Ί"],["ῠ","Ῥ"],["ῲ","ῴ"],["ῶ","ῼ"],"ⁱ","ⁿ",["ₐ","ₜ"],"ℂ","ℇ",["ℊ","ℓ"],"ℕ",["ℙ","ℝ"],"ℤ","Ω","ℨ",["K","ℭ"],["ℯ","ℹ"],["ℼ","ℿ"],["ⅅ","ⅉ"],"ⅎ",["Ⅰ","ↈ"],["Ⰰ","Ⱞ"],["ⰰ","ⱞ"],["Ⱡ","ⳤ"],["Ⳬ","ⳮ"],["Ⳳ","ⳳ"],["ⴀ","ⴥ"],"ⴧ","ⴭ",["ⴰ","ⵧ"],"ⵯ",["ⶀ","ⶖ"],["ⶠ","ⶦ"],["ⶨ","ⶮ"],["ⶰ","ⶶ"],["ⶸ","ⶾ"],["ⷀ","ⷆ"],["ⷈ","ⷎ"],["ⷐ","ⷖ"],["ⷘ","ⷞ"],"ⸯ",["々","〇"],["〡","〩"],["〱","〵"],["〸","〼"],["ぁ","ゖ"],["ゝ","ゟ"],["ァ","ヺ"],["ー","ヿ"],["ㄅ","ㄭ"],["ㄱ","ㆎ"],["ㆠ","ㆺ"],["ㇰ","ㇿ"],["㐀","䶵"],["一","鿕"],["ꀀ","ꒌ"],["ꓐ","ꓽ"],["ꔀ","ꘌ"],["ꘐ","ꘟ"],["ꘪ","ꘫ"],["Ꙁ","ꙮ"],["ꙿ","ꚝ"],["ꚠ","ꛯ"],["ꜗ","ꜟ"],["Ꜣ","ꞈ"],["Ꞌ","Ɬ"],["Ʞ","ꞷ"],["ꟷ","ꠁ"],["ꠃ","ꠅ"],["ꠇ","ꠊ"],["ꠌ","ꠢ"],["ꡀ","ꡳ"],["ꢂ","ꢳ"],["ꣲ","ꣷ"],"ꣻ","ꣽ",["ꤊ","ꤥ"],["ꤰ","ꥆ"],["ꥠ","ꥼ"],["ꦄ","ꦲ"],"ꧏ",["ꧠ","ꧤ"],["ꧦ","ꧯ"],["ꧺ","ꧾ"],["ꨀ","ꨨ"],["ꩀ","ꩂ"],["ꩄ","ꩋ"],["ꩠ","ꩶ"],"ꩺ",["ꩾ","ꪯ"],"ꪱ",["ꪵ","ꪶ"],["ꪹ","ꪽ"],"ꫀ","ꫂ",["ꫛ","ꫝ"],["ꫠ","ꫪ"],["ꫲ","ꫴ"],["ꬁ","ꬆ"],["ꬉ","ꬎ"],["ꬑ","ꬖ"],["ꬠ","ꬦ"],["ꬨ","ꬮ"],["ꬰ","ꭚ"],["ꭜ","ꭥ"],["ꭰ","ꯢ"],["가","힣"],["ힰ","ퟆ"],["ퟋ","ퟻ"],["豈","舘"],["並","龎"],["ff","st"],["ﬓ","ﬗ"],"יִ",["ײַ","ﬨ"],["שׁ","זּ"],["טּ","לּ"],"מּ",["נּ","סּ"],["ףּ","פּ"],["צּ","ﮱ"],["ﯓ","ﴽ"],["ﵐ","ﶏ"],["ﶒ","ﷇ"],["ﷰ","ﷻ"],["ﹰ","ﹴ"],["ﹶ","ﻼ"],["A","Z"],["a","z"],["ヲ","ᄒ"],["ᅡ","ᅦ"],["ᅧ","ᅬ"],["ᅭ","ᅲ"],["ᅳ","ᅵ"]],!1,!1),Fe=or("\\",!1),Oe=sr(["$",["0","9"],"_",["̀","ͯ"],["҃","҇"],["֑","ֽ"],"ֿ",["ׁ","ׂ"],["ׄ","ׅ"],"ׇ",["ؐ","ؚ"],["ً","٩"],"ٰ",["ۖ","ۜ"],["۟","ۤ"],["ۧ","ۨ"],["۪","ۭ"],["۰","۹"],"ܑ",["ܰ","݊"],["ަ","ް"],["߀","߉"],["߫","߳"],["ࠖ","࠙"],["ࠛ","ࠣ"],["ࠥ","ࠧ"],["ࠩ","࠭"],["࡙","࡛"],["ࣣ","ः"],["ऺ","़"],["ा","ॏ"],["॑","ॗ"],["ॢ","ॣ"],["०","९"],["ঁ","ঃ"],"়",["া","ৄ"],["ে","ৈ"],["ো","্"],"ৗ",["ৢ","ৣ"],["০","৯"],["ਁ","ਃ"],"਼",["ਾ","ੂ"],["ੇ","ੈ"],["ੋ","੍"],"ੑ",["੦","ੱ"],"ੵ",["ઁ","ઃ"],"઼",["ા","ૅ"],["ે","ૉ"],["ો","્"],["ૢ","ૣ"],["૦","૯"],["ଁ","ଃ"],"଼",["ା","ୄ"],["େ","ୈ"],["ୋ","୍"],["ୖ","ୗ"],["ୢ","ୣ"],["୦","୯"],"ஂ",["ா","ூ"],["ெ","ை"],["ொ","்"],"ௗ",["௦","௯"],["ఀ","ః"],["ా","ౄ"],["ె","ై"],["ొ","్"],["ౕ","ౖ"],["ౢ","ౣ"],["౦","౯"],["ಁ","ಃ"],"಼",["ಾ","ೄ"],["ೆ","ೈ"],["ೊ","್"],["ೕ","ೖ"],["ೢ","ೣ"],["೦","೯"],["ഁ","ഃ"],["ാ","ൄ"],["െ","ൈ"],["ൊ","്"],"ൗ",["ൢ","ൣ"],["൦","൯"],["ං","ඃ"],"්",["ා","ු"],"ූ",["ෘ","ෟ"],["෦","෯"],["ෲ","ෳ"],"ั",["ิ","ฺ"],["็","๎"],["๐","๙"],"ັ",["ິ","ູ"],["ົ","ຼ"],["່","ໍ"],["໐","໙"],["༘","༙"],["༠","༩"],"༵","༷","༹",["༾","༿"],["ཱ","྄"],["྆","྇"],["ྍ","ྗ"],["ྙ","ྼ"],"࿆",["ါ","ှ"],["၀","၉"],["ၖ","ၙ"],["ၞ","ၠ"],["ၢ","ၤ"],["ၧ","ၭ"],["ၱ","ၴ"],["ႂ","ႍ"],["ႏ","ႝ"],["፝","፟"],["ᜒ","᜔"],["ᜲ","᜴"],["ᝒ","ᝓ"],["ᝲ","ᝳ"],["឴","៓"],"៝",["០","៩"],["᠋","᠍"],["᠐","᠙"],"ᢩ",["ᤠ","ᤫ"],["ᤰ","᤻"],["᥆","᥏"],["᧐","᧙"],["ᨗ","ᨛ"],["ᩕ","ᩞ"],["᩠","᩼"],["᩿","᪉"],["᪐","᪙"],["᪰","᪽"],["ᬀ","ᬄ"],["᬴","᭄"],["᭐","᭙"],["᭫","᭳"],["ᮀ","ᮂ"],["ᮡ","ᮭ"],["᮰","᮹"],["᯦","᯳"],["ᰤ","᰷"],["᱀","᱉"],["᱐","᱙"],["᳐","᳒"],["᳔","᳨"],"᳭",["ᳲ","᳴"],["᳸","᳹"],["᷀","᷵"],["᷼","᷿"],["",""],["‿","⁀"],"⁔",["⃐","⃜"],"⃡",["⃥","⃰"],["⳯","⳱"],"⵿",["ⷠ","ⷿ"],["〪","〯"],["゙","゚"],["꘠","꘩"],"꙯",["ꙴ","꙽"],["ꚞ","ꚟ"],["꛰","꛱"],"ꠂ","꠆","ꠋ",["ꠣ","ꠧ"],["ꢀ","ꢁ"],["ꢴ","꣄"],["꣐","꣙"],["꣠","꣱"],["꤀","꤉"],["ꤦ","꤭"],["ꥇ","꥓"],["ꦀ","ꦃ"],["꦳","꧀"],["꧐","꧙"],"ꧥ",["꧰","꧹"],["ꨩ","ꨶ"],"ꩃ",["ꩌ","ꩍ"],["꩐","꩙"],["ꩻ","ꩽ"],"ꪰ",["ꪲ","ꪴ"],["ꪷ","ꪸ"],["ꪾ","꪿"],"꫁",["ꫫ","ꫯ"],["ꫵ","꫶"],["ꯣ","ꯪ"],["꯬","꯭"],["꯰","꯹"],"ﬞ",["︀","️"],["︠","︯"],["︳","︴"],["﹍","﹏"],["0","9"],"_"],!1,!1),Be=cr("literal"),Me=or("i",!1),De=cr("string"),ke=or('"',!1),Ie=or("'",!1),je=sr(["\n","\r",'"',"\\",["\u2028","\u2029"]],!1,!1),Ne=sr(["\n","\r","'","\\",["\u2028","\u2029"]],!1,!1),Ue=cr("character class"),qe=or("[",!1),Ge=or("^",!1),He=or("]",!1),ze=or("-",!1),We=sr(["\n","\r",["\\","]"],["\u2028","\u2029"]],!1,!1),Ve=or("0",!1),Ye=sr(['"',"'","\\"],!1,!1),Qe=or("b",!1),Je=or("f",!1),Xe=or("n",!1),Ke=or("r",!1),Ze=or("t",!1),et=or("v",!1),tt=sr([["0","9"],"u","x"],!1,!1),rt=or("x",!1),at=or("u",!1),nt=sr([["0","9"]],!1,!1),ot=sr([["0","9"],["a","f"]],!1,!0),st=or(".",!1),ct=cr("code block"),it=sr(["{","}"],!1,!1),ut=or(";",!1),pt=function(e,t,r){return{type:"grammar",topLevelInitializer:e,initializer:t,rules:r,location:ar()}},lt=function(e){return{type:"top_level_initializer",code:e[0],codeLocation:e[1],location:ar()}},ft=function(e){return{type:"initializer",code:e[0],codeLocation:e[1],location:ar()}},gt=function(e,t,r){return{type:"rule",name:e[0],nameLocation:e[1],expression:null!==t?{type:"named",name:t,expression:r,location:ar()}:r,location:ar()}},dt=function(e,t){return t.length>0?{type:"choice",alternatives:[e].concat(t),location:ar()}:e},mt=function(e,t){return null!==t?{type:"action",expression:e,code:t[0],codeLocation:t[1],location:ar()}:e},$t=function(e,t){return t.length>0||"labeled"===e.type&&e.pick?{type:"sequence",elements:[e].concat(t),location:ar()}:e},ht=function(e,t,r){return r.type.startsWith("semantic_")&&nr('"@" cannot be used on a semantic predicate',e),{type:"labeled",label:null!==t?t[0]:null,labelLocation:null!==t?t[1]:e,pick:!0,expression:r,location:ar()}},xt=function(e,t){return{type:"labeled",label:e[0],labelLocation:e[1],expression:t,location:ar()}},bt=function(){return ar()},vt=function(e){return Wr.indexOf(e[0])>=0&&nr("Label can't be a reserved word \"".concat(e[0],'"'),e[1]),e},At=function(e,t){return{type:OPS_TO_PREFIXED_TYPES[e],expression:t,location:ar()}},yt=function(e,t){return{type:OPS_TO_SUFFIXED_TYPES[t],expression:e,location:ar()}},St=function(e,t,r){var a=t[0],n=t[1];return"constant"===n.type&&0===n.value&&nr("The maximum count of repetitions of the rule must be > 0",n.location),{type:"repeated",min:a,max:n,expression:e,delimiter:r,location:ar()}},_t=function(e,t){return[null!==e?e:{type:"constant",value:0},null!==t?t:{type:"constant",value:null}]},Et=function(e){return[null,e]},Tt=function(e){return{type:"constant",value:e,location:ar()}},Ct=function(e){return{type:"variable",value:e[0],location:ar()}},Pt=function(e){return{type:"function",value:e[0],codeLocation:e[1],location:ar()}},wt=function(e){return"labeled"===e.type||"sequence"===e.type?{type:"group",expression:e,location:ar()}:e},Rt=function(e){return{type:"rule_ref",name:e[0],location:ar()}},Lt=function(e,t){return{type:OPS_TO_SEMANTIC_PREDICATE_TYPES[e],code:t[0],codeLocation:t[1],location:ar()}},Ft=function(e,t){return[e+t.join(""),ar()]},Ot=function(e,t){return{type:"literal",value:e,ignoreCase:null!==t,location:ar()}},Bt=function(e){return e.join("")},Mt=function(e){return e.join("")},Dt=function(e,t,r){return{type:"class",parts:t.filter((function(e){return""!==e})),inverted:null!==e,ignoreCase:null!==r,location:ar()}},kt=function(t,r){return t.charCodeAt(0)>r.charCodeAt(0)&&nr("Invalid character range: "+e.substring(Kt,Xt)+"."),[t,r]},It=function(){return""},jt=function(){return"\0"},Nt=function(){return"\b"},Ut=function(){return"\f"},qt=function(){return"\n"},Gt=function(){return"\r"},Ht=function(){return"\t"},zt=function(){return"\v"},Wt=function(e){return String.fromCharCode(parseInt(e,16))},Vt=function(e){return String.fromCharCode(parseInt(e,16))},Yt=function(){return{type:"any",location:ar()}},Qt=function(e){return[e,ar()]},Jt=function(e){return parseInt(e,10)},Xt=0,Kt=0,Zt=[{line:1,column:1}],er=0,tr=[],rr=0;if("startRule"in t){if(!(t.startRule in o))throw new Error("Can't start parsing from rule \""+t.startRule+'".');s=o[t.startRule]}function ar(){return ur(Kt,Xt)}function nr(e,t){throw function(e,t){return new peg$SyntaxError(e,null,null,t)}(e,t=void 0!==t?t:ur(Kt,Xt))}function or(e,t){return{type:"literal",text:e,ignoreCase:t}}function sr(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function cr(e){return{type:"other",description:e}}function ir(t){var r,a=Zt[t];if(a)return a;if(t>=Zt.length)r=Zt.length-1;else for(r=t;!Zt[--r];);for(a={line:(a=Zt[r]).line,column:a.column};r<t;)10===e.charCodeAt(r)?(a.line++,a.column=1):a.column++,r++;return Zt[t]=a,a}function ur(e,t,r){var a=ir(e),o=ir(t),s={source:n,start:{offset:e,line:a.line,column:a.column},end:{offset:t,line:o.line,column:o.column}};return r&&n&&"function"==typeof n.offset&&(s.start=n.offset(s.start),s.end=n.offset(s.end)),s}function pr(e){Xt<er||(Xt>er&&(er=Xt,tr=[]),tr.push(e))}function lr(){var t,r,n,o,s,u;if(t=Xt,Hr(),r=Xt,n=function(){var t,r,n,o;return t=Xt,123===e.charCodeAt(Xt)?(r=c,Xt++):(r=a,0===rr&&pr(ne)),r!==a&&(n=qr())!==a?(125===e.charCodeAt(Xt)?(o=i,Xt++):(o=a,0===rr&&pr(oe)),o!==a&&zr()!==a?(Kt=t,t=lt(n)):(Xt=t,t=a)):(Xt=t,t=a),t}(),n!==a?(o=Hr(),r=n):(Xt=r,r=a),r===a&&(r=null),n=Xt,o=function(){var e,t;return e=Xt,(t=qr())!==a&&zr()!==a?(Kt=e,e=ft(t)):(Xt=e,e=a),e}(),o!==a?(s=Hr(),n=o):(Xt=n,n=a),n===a&&(n=null),o=[],s=Xt,(u=fr())!==a?(Hr(),s=u):(Xt=s,s=a),s!==a)for(;s!==a;)o.push(s),s=Xt,(u=fr())!==a?(Hr(),s=u):(Xt=s,s=a);else o=a;return o!==a?(Kt=t,t=pt(r,n,o)):(Xt=t,t=a),t}function fr(){var t,r,n,o,s;return t=Xt,(r=Pr())!==a?(Hr(),n=Xt,(o=Lr())!==a?(Hr(),n=o):(Xt=n,n=a),n===a&&(n=null),61===e.charCodeAt(Xt)?(o=u,Xt++):(o=a,0===rr&&pr(se)),o!==a?(Hr(),(s=gr())!==a&&zr()!==a?(Kt=t,t=gt(r,n,s)):(Xt=t,t=a)):(Xt=t,t=a)):(Xt=t,t=a),t}function gr(){var t,r,n,o,s,c;if(t=Xt,(r=dr())!==a){for(n=[],o=Xt,Hr(),47===e.charCodeAt(Xt)?(s=p,Xt++):(s=a,0===rr&&pr(ce)),s!==a?(Hr(),(c=dr())!==a?o=c:(Xt=o,o=a)):(Xt=o,o=a);o!==a;)n.push(o),o=Xt,Hr(),47===e.charCodeAt(Xt)?(s=p,Xt++):(s=a,0===rr&&pr(ce)),s!==a?(Hr(),(c=dr())!==a?o=c:(Xt=o,o=a)):(Xt=o,o=a);Kt=t,t=dt(r,n)}else Xt=t,t=a;return t}function dr(){var e,t,r,n;return e=Xt,t=function(){var e,t,r,n,o;if(e=Xt,(t=mr())!==a){for(r=[],n=Xt,Hr(),(o=mr())!==a?n=o:(Xt=n,n=a);n!==a;)r.push(n),n=Xt,Hr(),(o=mr())!==a?n=o:(Xt=n,n=a);Kt=e,e=$t(t,r)}else Xt=e,e=a;return e}(),t!==a?(r=Xt,Hr(),(n=qr())!==a?r=n:(Xt=r,r=a),r===a&&(r=null),Kt=e,e=mt(t,r)):(Xt=e,e=a),e}function mr(){var t,r,n,o;return t=Xt,r=function(){var t,r;return t=Xt,64===e.charCodeAt(Xt)?(r=l,Xt++):(r=a,0===rr&&pr(ie)),r!==a&&(Kt=t,r=bt()),t=r}(),r!==a?((n=$r())===a&&(n=null),(o=hr())!==a?(Kt=t,t=ht(r,n,o)):(Xt=t,t=a)):(Xt=t,t=a),t===a&&(t=Xt,(r=$r())!==a?(n=Hr(),(o=hr())!==a?(Kt=t,t=xt(r,o)):(Xt=t,t=a)):(Xt=t,t=a),t===a&&(t=hr())),t}function $r(){var t,r,n;return t=Xt,(r=Pr())!==a?(Hr(),58===e.charCodeAt(Xt)?(n=f,Xt++):(n=a,0===rr&&pr(ue)),n!==a?(Kt=t,t=vt(r)):(Xt=t,t=a)):(Xt=t,t=a),t}function hr(){var t,r,n;return t=Xt,r=function(){var t;return t=e.charAt(Xt),q.test(t)?Xt++:(t=a,0===rr&&pr(pe)),t}(),r!==a?(Hr(),(n=xr())!==a?(Kt=t,t=At(r,n)):(Xt=t,t=a)):(Xt=t,t=a),t===a&&(t=xr()),t}function xr(){var t,r,n;return t=Xt,(r=vr())!==a?(Hr(),n=function(){var t;return t=e.charAt(Xt),G.test(t)?Xt++:(t=a,0===rr&&pr(le)),t}(),n!==a?(Kt=t,t=yt(r,n)):(Xt=t,t=a)):(Xt=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Xt,(r=vr())!==a?(Hr(),124===e.charCodeAt(Xt)?(n=g,Xt++):(n=a,0===rr&&pr(fe)),n!==a?(Hr(),o=function(){var t,r,n,o;return t=Xt,(r=br())===a&&(r=null),Hr(),e.substr(Xt,2)===m?(n=m,Xt+=2):(n=a,0===rr&&pr(de)),n!==a?(Hr(),(o=br())===a&&(o=null),Kt=t,t=_t(r,o)):(Xt=t,t=a),t===a&&(t=Xt,(r=br())!==a&&(Kt=t,r=Et(r)),t=r),t}(),o!==a?(Hr(),s=Xt,44===e.charCodeAt(Xt)?(c=d,Xt++):(c=a,0===rr&&pr(ge)),c!==a?(Hr(),(i=gr())!==a?(Hr(),s=i):(Xt=s,s=a)):(Xt=s,s=a),s===a&&(s=null),124===e.charCodeAt(Xt)?(c=g,Xt++):(c=a,0===rr&&pr(fe)),c!==a?(Kt=t,t=St(r,o,s)):(Xt=t,t=a)):(Xt=t,t=a)):(Xt=t,t=a)):(Xt=t,t=a),t}(),t===a&&(t=vr())),t}function br(){var t,r;return t=Xt,r=function(){var t,r,n,o;if(t=Xt,r=Xt,n=[],(o=Nr())!==a)for(;o!==a;)n.push(o),o=Nr();else n=a;return(r=n!==a?e.substring(r,Xt):n)!==a&&(Kt=t,r=Jt(r)),t=r}(),r!==a&&(Kt=t,r=Tt(r)),(t=r)===a&&(t=Xt,(r=Pr())!==a&&(Kt=t,r=Ct(r)),(t=r)===a&&(t=Xt,(r=qr())!==a&&(Kt=t,r=Pt(r)),t=r)),t}function vr(){var t,r,n,o;return t=function(){var t,r,n;return rr++,t=Xt,(r=Lr())!==a?(105===e.charCodeAt(Xt)?(n=_,Xt++):(n=a,0===rr&&pr(Me)),n===a&&(n=null),Kt=t,t=Ot(r,n)):(Xt=t,t=a),rr--,t===a&&(r=a,0===rr&&pr(Be)),t}(),t===a&&(t=function(){var t,r,n,o,s,c;if(rr++,t=Xt,91===e.charCodeAt(Xt)?(r=C,Xt++):(r=a,0===rr&&pr(qe)),r!==a){for(94===e.charCodeAt(Xt)?(n=P,Xt++):(n=a,0===rr&&pr(Ge)),n===a&&(n=null),o=[],(s=Br())===a&&(s=Mr());s!==a;)o.push(s),(s=Br())===a&&(s=Mr());93===e.charCodeAt(Xt)?(s=w,Xt++):(s=a,0===rr&&pr(He)),s!==a?(105===e.charCodeAt(Xt)?(c=_,Xt++):(c=a,0===rr&&pr(Me)),c===a&&(c=null),Kt=t,t=Dt(n,o,c)):(Xt=t,t=a)}else Xt=t,t=a;return rr--,t===a&&(r=a,0===rr&&pr(Ue)),t}(),t===a&&(t=function(){var t,r;return t=Xt,46===e.charCodeAt(Xt)?(r=N,Xt++):(r=a,0===rr&&pr(st)),r!==a&&(Kt=t,r=Yt()),t=r}(),t===a&&(t=function(){var t,r,n,o,s,c,i;return t=Xt,(r=Pr())!==a?(n=Xt,o=Xt,s=Hr(),c=Xt,(i=Lr())!==a?c=i=[i,Hr()]:(Xt=c,c=a),c===a&&(c=null),61===e.charCodeAt(Xt)?(i=u,Xt++):(i=a,0===rr&&pr(se)),i!==a?o=s=[s,c,i]:(Xt=o,o=a),o===a?n=void 0:(Xt=n,n=a),n!==a?(Kt=t,t=Rt(r)):(Xt=t,t=a)):(Xt=t,t=a),t}(),t===a&&(t=function(){var t,r,n;return t=Xt,r=function(){var t;return t=e.charAt(Xt),H.test(t)?Xt++:(t=a,0===rr&&pr(he)),t}(),r!==a?(Hr(),(n=qr())!==a?(Kt=t,t=Lt(r,n)):(Xt=t,t=a)):(Xt=t,t=a),t}(),t===a&&(t=Xt,40===e.charCodeAt(Xt)?(r=$,Xt++):(r=a,0===rr&&pr(me)),r!==a?(Hr(),(n=gr())!==a?(Hr(),41===e.charCodeAt(Xt)?(o=h,Xt++):(o=a,0===rr&&pr($e)),o!==a?(Kt=t,t=wt(n)):(Xt=t,t=a)):(Xt=t,t=a)):(Xt=t,t=a)))))),t}function Ar(){var t;return e.length>Xt?(t=e.charAt(Xt),Xt++):(t=a,0===rr&&pr(xe)),t}function yr(){var t;return rr++,t=e.charAt(Xt),z.test(t)?Xt++:(t=a,0===rr&&pr(ve)),rr--,t===a&&0===rr&&pr(be),t}function Sr(){var t;return t=e.charAt(Xt),W.test(t)?Xt++:(t=a,0===rr&&pr(Ae)),t}function _r(){var t;return rr++,10===e.charCodeAt(Xt)?(t=x,Xt++):(t=a,0===rr&&pr(Se)),t===a&&(e.substr(Xt,2)===b?(t=b,Xt+=2):(t=a,0===rr&&pr(_e)),t===a&&(t=e.charAt(Xt),V.test(t)?Xt++:(t=a,0===rr&&pr(Ee)))),rr--,t===a&&0===rr&&pr(ye),t}function Er(){var t;return rr++,(t=function(){var t,r,n,o,s,c;if(t=Xt,e.substr(Xt,2)===v?(r=v,Xt+=2):(r=a,0===rr&&pr(Ce)),r!==a){for(n=[],o=Xt,s=Xt,e.substr(Xt,2)===A?(c=A,Xt+=2):(c=a,0===rr&&pr(Pe)),c===a?s=void 0:(Xt=s,s=a),s!==a&&(c=Ar())!==a?o=s=[s,c]:(Xt=o,o=a);o!==a;)n.push(o),o=Xt,s=Xt,e.substr(Xt,2)===A?(c=A,Xt+=2):(c=a,0===rr&&pr(Pe)),c===a?s=void 0:(Xt=s,s=a),s!==a&&(c=Ar())!==a?o=s=[s,c]:(Xt=o,o=a);e.substr(Xt,2)===A?(o=A,Xt+=2):(o=a,0===rr&&pr(Pe)),o!==a?t=r=[r,n,o]:(Xt=t,t=a)}else Xt=t,t=a;return t}())===a&&(t=Cr()),rr--,t===a&&0===rr&&pr(Te),t}function Tr(){var t,r,n,o,s,c;if(t=Xt,e.substr(Xt,2)===v?(r=v,Xt+=2):(r=a,0===rr&&pr(Ce)),r!==a){for(n=[],o=Xt,s=Xt,e.substr(Xt,2)===A?(c=A,Xt+=2):(c=a,0===rr&&pr(Pe)),c===a&&(c=Sr()),c===a?s=void 0:(Xt=s,s=a),s!==a&&(c=Ar())!==a?o=s=[s,c]:(Xt=o,o=a);o!==a;)n.push(o),o=Xt,s=Xt,e.substr(Xt,2)===A?(c=A,Xt+=2):(c=a,0===rr&&pr(Pe)),c===a&&(c=Sr()),c===a?s=void 0:(Xt=s,s=a),s!==a&&(c=Ar())!==a?o=s=[s,c]:(Xt=o,o=a);e.substr(Xt,2)===A?(o=A,Xt+=2):(o=a,0===rr&&pr(Pe)),o!==a?t=r=[r,n,o]:(Xt=t,t=a)}else Xt=t,t=a;return t}function Cr(){var t,r,n,o,s,c;if(t=Xt,e.substr(Xt,2)===y?(r=y,Xt+=2):(r=a,0===rr&&pr(we)),r!==a){for(n=[],o=Xt,s=Xt,(c=Sr())===a?s=void 0:(Xt=s,s=a),s!==a&&(c=Ar())!==a?o=s=[s,c]:(Xt=o,o=a);o!==a;)n.push(o),o=Xt,s=Xt,(c=Sr())===a?s=void 0:(Xt=s,s=a),s!==a&&(c=Ar())!==a?o=s=[s,c]:(Xt=o,o=a);t=r=[r,n]}else Xt=t,t=a;return t}function Pr(){var e,t,r,n;if(rr++,e=Xt,(t=wr())!==a){for(r=[],n=Rr();n!==a;)r.push(n),n=Rr();Kt=e,e=Ft(t,r)}else Xt=e,e=a;return rr--,e===a&&(t=a,0===rr&&pr(Re)),e}function wr(){var t,r,n;return t=e.charAt(Xt),Y.test(t)?Xt++:(t=a,0===rr&&pr(Le)),t===a&&(t=Xt,92===e.charCodeAt(Xt)?(r=S,Xt++):(r=a,0===rr&&pr(Fe)),r!==a&&(n=jr())!==a?t=n:(Xt=t,t=a)),t}function Rr(){var t;return(t=wr())===a&&(t=e.charAt(Xt),Q.test(t)?Xt++:(t=a,0===rr&&pr(Oe))),t}function Lr(){var t,r,n,o;if(rr++,t=Xt,34===e.charCodeAt(Xt)?(r=E,Xt++):(r=a,0===rr&&pr(ke)),r!==a){for(n=[],o=Fr();o!==a;)n.push(o),o=Fr();34===e.charCodeAt(Xt)?(o=E,Xt++):(o=a,0===rr&&pr(ke)),o!==a?(Kt=t,t=Bt(n)):(Xt=t,t=a)}else Xt=t,t=a;if(t===a)if(t=Xt,39===e.charCodeAt(Xt)?(r=T,Xt++):(r=a,0===rr&&pr(Ie)),r!==a){for(n=[],o=Or();o!==a;)n.push(o),o=Or();39===e.charCodeAt(Xt)?(o=T,Xt++):(o=a,0===rr&&pr(Ie)),o!==a?(Kt=t,t=Mt(n)):(Xt=t,t=a)}else Xt=t,t=a;return rr--,t===a&&(r=a,0===rr&&pr(De)),t}function Fr(){var t,r,n,o;return t=Xt,r=Xt,n=Xt,o=e.charAt(Xt),J.test(o)?Xt++:(o=a,0===rr&&pr(je)),o===a?n=void 0:(Xt=n,n=a),n!==a&&(o=Ar())!==a?r=n=[n,o]:(Xt=r,r=a),(t=r!==a?e.substring(t,Xt):r)===a&&(t=Xt,92===e.charCodeAt(Xt)?(r=S,Xt++):(r=a,0===rr&&pr(Fe)),r!==a&&(n=kr())!==a?t=n:(Xt=t,t=a),t===a&&(t=Dr())),t}function Or(){var t,r,n,o;return t=Xt,r=Xt,n=Xt,o=e.charAt(Xt),X.test(o)?Xt++:(o=a,0===rr&&pr(Ne)),o===a?n=void 0:(Xt=n,n=a),n!==a&&(o=Ar())!==a?r=n=[n,o]:(Xt=r,r=a),(t=r!==a?e.substring(t,Xt):r)===a&&(t=Xt,92===e.charCodeAt(Xt)?(r=S,Xt++):(r=a,0===rr&&pr(Fe)),r!==a&&(n=kr())!==a?t=n:(Xt=t,t=a),t===a&&(t=Dr())),t}function Br(){var t,r,n,o;return t=Xt,(r=Mr())!==a?(45===e.charCodeAt(Xt)?(n=R,Xt++):(n=a,0===rr&&pr(ze)),n!==a&&(o=Mr())!==a?(Kt=t,t=kt(r,o)):(Xt=t,t=a)):(Xt=t,t=a),t}function Mr(){var t,r,n,o;return t=Xt,r=Xt,n=Xt,o=e.charAt(Xt),K.test(o)?Xt++:(o=a,0===rr&&pr(We)),o===a?n=void 0:(Xt=n,n=a),n!==a&&(o=Ar())!==a?r=n=[n,o]:(Xt=r,r=a),(t=r!==a?e.substring(t,Xt):r)===a&&(t=Xt,92===e.charCodeAt(Xt)?(r=S,Xt++):(r=a,0===rr&&pr(Fe)),r!==a&&(n=kr())!==a?t=n:(Xt=t,t=a),t===a&&(t=Dr())),t}function Dr(){var t,r;return t=Xt,92===e.charCodeAt(Xt)?(r=S,Xt++):(r=a,0===rr&&pr(Fe)),r!==a&&_r()!==a?(Kt=t,t=It()):(Xt=t,t=a),t}function kr(){var t,r,n;return t=function(){var t;return(t=Ir())===a&&(t=function(){var t,r,n,o;return t=Xt,r=Xt,n=Xt,o=function(){var t;return(t=Ir())===a&&(t=e.charAt(Xt),ee.test(t)?Xt++:(t=a,0===rr&&pr(tt))),t}(),o===a&&(o=Sr()),o===a?n=void 0:(Xt=n,n=a),n!==a&&(o=Ar())!==a?r=n=[n,o]:(Xt=r,r=a),t=r!==a?e.substring(t,Xt):r}()),t}(),t===a&&(t=Xt,48===e.charCodeAt(Xt)?(r=L,Xt++):(r=a,0===rr&&pr(Ve)),r!==a?(n=Xt,Nr()===a?n=void 0:(Xt=n,n=a),n!==a?(Kt=t,t=jt()):(Xt=t,t=a)):(Xt=t,t=a),t===a&&(t=function(){var t,r,n,o,s,c;return t=Xt,120===e.charCodeAt(Xt)?(r=I,Xt++):(r=a,0===rr&&pr(rt)),r!==a?(n=Xt,o=Xt,(s=Ur())!==a&&(c=Ur())!==a?o=s=[s,c]:(Xt=o,o=a),(n=o!==a?e.substring(n,Xt):o)!==a?(Kt=t,t=Wt(n)):(Xt=t,t=a)):(Xt=t,t=a),t}(),t===a&&(t=jr()))),t}function Ir(){var t,r;return t=e.charAt(Xt),Z.test(t)?Xt++:(t=a,0===rr&&pr(Ye)),t===a&&(t=Xt,98===e.charCodeAt(Xt)?(r=F,Xt++):(r=a,0===rr&&pr(Qe)),r!==a&&(Kt=t,r=Nt()),(t=r)===a&&(t=Xt,102===e.charCodeAt(Xt)?(r=O,Xt++):(r=a,0===rr&&pr(Je)),r!==a&&(Kt=t,r=Ut()),(t=r)===a&&(t=Xt,110===e.charCodeAt(Xt)?(r=B,Xt++):(r=a,0===rr&&pr(Xe)),r!==a&&(Kt=t,r=qt()),(t=r)===a&&(t=Xt,114===e.charCodeAt(Xt)?(r=M,Xt++):(r=a,0===rr&&pr(Ke)),r!==a&&(Kt=t,r=Gt()),(t=r)===a&&(t=Xt,116===e.charCodeAt(Xt)?(r=D,Xt++):(r=a,0===rr&&pr(Ze)),r!==a&&(Kt=t,r=Ht()),(t=r)===a&&(t=Xt,118===e.charCodeAt(Xt)?(r=k,Xt++):(r=a,0===rr&&pr(et)),r!==a&&(Kt=t,r=zt()),t=r)))))),t}function jr(){var t,r,n,o,s,c,i,u;return t=Xt,117===e.charCodeAt(Xt)?(r=j,Xt++):(r=a,0===rr&&pr(at)),r!==a?(n=Xt,o=Xt,(s=Ur())!==a&&(c=Ur())!==a&&(i=Ur())!==a&&(u=Ur())!==a?o=s=[s,c,i,u]:(Xt=o,o=a),(n=o!==a?e.substring(n,Xt):o)!==a?(Kt=t,t=Vt(n)):(Xt=t,t=a)):(Xt=t,t=a),t}function Nr(){var t;return t=e.charAt(Xt),te.test(t)?Xt++:(t=a,0===rr&&pr(nt)),t}function Ur(){var t;return t=e.charAt(Xt),re.test(t)?Xt++:(t=a,0===rr&&pr(ot)),t}function qr(){var t,r,n,o;return rr++,t=Xt,123===e.charCodeAt(Xt)?(r=c,Xt++):(r=a,0===rr&&pr(ne)),r!==a?(n=function(){var e,t;return e=Xt,t=Gr(),Kt=e,e=t=Qt(t)}(),125===e.charCodeAt(Xt)?(o=i,Xt++):(o=a,0===rr&&pr(oe)),o!==a?t=n:(Xt=t,t=a)):(Xt=t,t=a),rr--,t===a&&(r=a,0===rr&&pr(ct)),t}function Gr(){var t,r,n,o,s,u;if(t=Xt,r=[],n=[],o=Xt,s=Xt,u=e.charAt(Xt),ae.test(u)?Xt++:(u=a,0===rr&&pr(it)),u===a?s=void 0:(Xt=s,s=a),s!==a&&(u=Ar())!==a?o=s=[s,u]:(Xt=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Xt,s=Xt,u=e.charAt(Xt),ae.test(u)?Xt++:(u=a,0===rr&&pr(it)),u===a?s=void 0:(Xt=s,s=a),s!==a&&(u=Ar())!==a?o=s=[s,u]:(Xt=o,o=a);else n=a;for(n===a&&(n=Xt,123===e.charCodeAt(Xt)?(o=c,Xt++):(o=a,0===rr&&pr(ne)),o!==a?(s=Gr(),125===e.charCodeAt(Xt)?(u=i,Xt++):(u=a,0===rr&&pr(oe)),u!==a?n=o=[o,s,u]:(Xt=n,n=a)):(Xt=n,n=a));n!==a;){if(r.push(n),n=[],o=Xt,s=Xt,u=e.charAt(Xt),ae.test(u)?Xt++:(u=a,0===rr&&pr(it)),u===a?s=void 0:(Xt=s,s=a),s!==a&&(u=Ar())!==a?o=s=[s,u]:(Xt=o,o=a),o!==a)for(;o!==a;)n.push(o),o=Xt,s=Xt,u=e.charAt(Xt),ae.test(u)?Xt++:(u=a,0===rr&&pr(it)),u===a?s=void 0:(Xt=s,s=a),s!==a&&(u=Ar())!==a?o=s=[s,u]:(Xt=o,o=a);else n=a;n===a&&(n=Xt,123===e.charCodeAt(Xt)?(o=c,Xt++):(o=a,0===rr&&pr(ne)),o!==a?(s=Gr(),125===e.charCodeAt(Xt)?(u=i,Xt++):(u=a,0===rr&&pr(oe)),u!==a?n=o=[o,s,u]:(Xt=n,n=a)):(Xt=n,n=a))}return e.substring(t,Xt)}function Hr(){var e,t;for(e=[],(t=yr())===a&&(t=_r())===a&&(t=Er());t!==a;)e.push(t),(t=yr())===a&&(t=_r())===a&&(t=Er());return e}function zr(){var t,r,n,o;if(t=[],r=Xt,n=Hr(),59===e.charCodeAt(Xt)?(o=U,Xt++):(o=a,0===rr&&pr(ut)),o!==a?r=n=[n,o]:(Xt=r,r=a),r!==a)for(;r!==a;)t.push(r),r=Xt,n=Hr(),59===e.charCodeAt(Xt)?(o=U,Xt++):(o=a,0===rr&&pr(ut)),o!==a?r=n=[n,o]:(Xt=r,r=a);else t=a;return t===a&&(t=Xt,r=function(){var e,t;for(e=[],(t=yr())===a&&(t=Tr());t!==a;)e.push(t),(t=yr())===a&&(t=Tr());return e}(),(n=Cr())===a&&(n=null),(o=_r())!==a?t=r=[r,n,o]:(Xt=t,t=a),t===a&&(t=Xt,r=Hr(),n=function(){var t,r;return t=Xt,e.length>Xt?(r=e.charAt(Xt),Xt++):(r=a,0===rr&&pr(xe)),r===a?t=void 0:(Xt=t,t=a),t}(),n!==a?t=r=[r,n]:(Xt=t,t=a))),t}var Wr=t.reservedWords||[];if((r=s())!==a&&Xt===e.length)return r;throw r!==a&&Xt<e.length&&pr({type:"end"}),function(e,t,r){return new peg$SyntaxError(peg$SyntaxError.buildMessage(e,t),e,t,r)}(tr,er<e.length?e.charAt(er):null,er<e.length?ur(er,er+1):ur(er,er))}peg$subclass(peg$SyntaxError,Error),peg$SyntaxError.prototype.format=function(e){var t="Error: "+this.message;if(this.location){var r,a=null;for(r=0;r<e.length;r++)if(e[r].source===this.location.source){a=e[r].text.split(/\r\n|\n|\r/g);break}var n=this.location.start,o=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(n):n,s=this.location.source+":"+o.line+":"+o.column;if(a){var c=this.location.end,i=peg$padEnd("",o.line.toString().length," "),u=a[n.line-1],p=(n.line===c.line?c.column:u.length+1)-n.column||1;t+="\n --\x3e "+s+"\n"+i+" |\n"+o.line+" | "+u+"\n"+i+" | "+peg$padEnd("",n.column-1," ")+peg$padEnd("",p,"^")}else t+="\n at "+s}return t},peg$SyntaxError.buildMessage=function(e,t){var r={literal:function(e){return'"'+n(e.text)+'"'},class:function(e){var t=e.parts.map((function(e){return Array.isArray(e)?o(e[0])+"-"+o(e[1]):o(e)}));return"["+(e.inverted?"^":"")+t.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(e){return e.description}};function a(e){return e.charCodeAt(0).toString(16).toUpperCase()}function n(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+a(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+a(e)}))}function o(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+a(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+a(e)}))}function s(e){return r[e.type](e)}return"Expected "+function(e){var t,r,a=e.map(s);if(a.sort(),a.length>0){for(t=1,r=1;t<a.length;t++)a[t-1]!==a[t]&&(a[r]=a[t],r++);a.length=r}switch(a.length){case 1:return a[0];case 2:return a[0]+" or "+a[1];default:return a.slice(0,-1).join(", ")+", or "+a[a.length-1]}}(e)+" but "+function(e){return e?'"'+n(e)+'"':"end of input"}(t)+" found."};var parser$4={SyntaxError:peg$SyntaxError,parse:peg$parse},GrammarError$2=grammarError,GrammarLocation$1=grammarLocation,compiler$1=compiler_1,parser$3=parser$4,VERSION=version$1,RESERVED_WORDS=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","null","true","false","enum","implements","interface","let","package","private","protected","public","static","yield","await","arguments","eval"],peg$4={VERSION:VERSION,RESERVED_WORDS:RESERVED_WORDS,GrammarError:GrammarError$2,GrammarLocation:GrammarLocation$1,parser:parser$3,compiler:compiler$1,generate:function(e,t){var r,a,n="plugins"in(t=void 0!==t?t:{})?t.plugins:[],o={parser:peg$4.parser,passes:(r=peg$4.compiler.passes,a={},Object.keys(r).forEach((function(e){a[e]=r[e].slice()})),a),reservedWords:peg$4.RESERVED_WORDS.slice()};return n.forEach((function(e){e.use(o,t)})),peg$4.compiler.compile(o.parser.parse(e,{grammarSource:t.grammarSource,reservedWords:o.reservedWords}),o.passes,t)}},peg_1=peg$4,utils={},chai$k=require$$0,Call=function(){function e(e){this.args=e}return e.prototype.calledWithExactly=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return chai$k.util.eql(this.args,e)},e}();function dummy(){function e(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];e.callCount++,e.called=!0,e.calls.push(new Call(t))}return e.called=!1,e.callCount=0,e.calls=[],e.getCall=function(t){return e.calls[t]},e}utils.spy=function(){return dummy()},utils.stub=function(e,t){var r=e[t],a=dummy();return e[t]=a,a.restore=function(){e[t]=r},r};var chai$j=require$$0,peg$3=peg_1,_a$2=utils,spy$1=_a$2.spy,stub$1=_a$2.stub,expect$j=chai$j.expect;describe("generated parser API",(function(){describe("parse",(function(){it("parses input",(function(){var e=peg$3.generate("start = 'a'");expect$j(e.parse("a")).to.equal("a")})),it("throws an exception on syntax error",(function(){var e=peg$3.generate("start = 'a'");expect$j((function(){e.parse("b")})).to.throw()})),it("correctly describe character class in syntax error",(function(){var e=peg$3.generate("start = [123-5]");expect$j((function(){e.parse("0")})).to.throw("[123-5]")})),describe("start rule",(function(){var e=peg$3.generate(["a = 'x' { return 'a'; }","b = 'x' { return 'b'; }","c = 'x' { return 'c'; }"].join("\n"),{allowedStartRules:["b","c"]});describe("when |startRule| is not set",(function(){it("starts parsing from the first allowed rule",(function(){expect$j(e.parse("x")).to.equal("b")}))})),describe("when |startRule| is set to an allowed rule",(function(){it("starts parsing from specified rule",(function(){expect$j(e.parse("x",{startRule:"b"})).to.equal("b"),expect$j(e.parse("x",{startRule:"c"})).to.equal("c")}))})),describe("when |startRule| is set to a disallowed start rule",(function(){it("throws an exception",(function(){expect$j((function(){e.parse("x",{startRule:"a"})})).to.throw()}))}))})),describe("tracing",(function(){var e=peg$3.generate(["start = a / b","a = 'a'i","b = 'b'"].join("\n"),{trace:!0});describe("default tracer",(function(){it("traces using console.log (if console is defined)",(function(){var t=["1:1-1:1 rule.enter start","1:1-1:1 rule.enter a","1:1-1:1 rule.fail a","1:1-1:1 rule.enter b","1:1-1:2 rule.match b","1:1-1:2 rule.match start"];"object"==typeof console&&stub$1(console,"log");try{e.parse("b"),"object"==typeof console&&(expect$j(console.log.callCount).to.equal(t.length),t.forEach((function(e,t){var r=console.log.getCall(t);expect$j(r.calledWithExactly(e)).to.equal(!0)})))}finally{"object"==typeof console&&console.log.restore()}}))})),describe("custom tracers",(function(){describe("trace",(function(){it("receives tracing events",(function(){var t=[{type:"rule.enter",rule:"start",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1}}},{type:"rule.enter",rule:"a",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1}}},{type:"rule.fail",rule:"a",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1}}},{type:"rule.enter",rule:"b",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1}}},{type:"rule.match",rule:"b",result:"b",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:1,line:1,column:2}}},{type:"rule.match",rule:"start",result:"b",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:1,line:1,column:2}}}],r={trace:spy$1()};e.parse("b",{tracer:r}),expect$j(r.trace.callCount).to.equal(t.length),t.forEach((function(e,t){var a=r.trace.getCall(t);expect$j(a.calledWithExactly(e)).to.equal(!0)}))}))}))}))})),it("accepts custom options",(function(){peg$3.generate("start = 'a'").parse("a",{foo:42})}))}))}));var name="peggy",version="3.0.2",description="Parser generator for JavaScript",keywords=["grammar","parser generator","PEG","PEG.js"],homepage="https://peggyjs.org/",repository="peggyjs/peggy",bugs="https://github.com/peggyjs/peggy/issues",license="MIT",author="David Majda <david@majda.cz> (https://majda.cz/)",main="lib/peg.js",browser="browser/peggy.min.js",unpkg="browser/peggy.min.js",jsdelivr="browser/peggy.min.js",types="lib/peg.d.ts",bin={peggy:"bin/peggy.js"},scripts={clean:"rimraf build browser bin/*.map && mkdir browser",parser:"node bin/peggy.js -o lib/parser.js --format commonjs src/parser.pegjs",examples:"node bin/peggy.js -c docs/js/options.js docs/js/examples.peggy",set_version:"node ./tools/set_version",lint:"eslint . --ext js,ts,mjs",ts:"tsc --build tsconfig.json",docs:"cd docs && npm run build",test:"jest","test:web":"cd web-test && npm test","test:all":"npm run test && npm run test:web",benchmark:"node ./benchmark/run_bench.js",rollup:"copyfiles package.json build/ts && rollup -c",terser:"npm run terser:peggy && npm run terser:tests && npm run terser:bench","terser:peggy":"terser -c passes=2 -m reserved=['GrammarLocation'] --sequences 40 build/rollup/peggy.umd.js -o build/peggy.min.js","terser:tests":"terser -c passes=2 -m --sequences 40 --module build/rollup/test.umd.js -o build/test-bundle.min.js","terser:bench":"terser -c passes=2 -m --sequences 40 --module build/rollup/benchmark.umd.js -o build/benchmark-bundle.min.js",headers:"node ./tools/header.js build/peggy.min.js build/benchmark-bundle.min.js build/test-bundle.min.js",deploy:"npm run deploy:peggy && npm run deploy:tests && npm run deploy:bench",coverage:"npm run rollup && npm run parser -- -m inline && npm test","deploy:peggy":"copyfiles -f build/peggy.min.js docs/vendor/peggy/ && copyfiles -f build/peggy.min.js browser/","deploy:tests":"copyfiles -f build/test-bundle.min.js docs/js/","deploy:bench":"copyfiles -f build/benchmark-bundle.min.js docs/js/",build:"npm run build:notidy && npm run tidy","build:notidy":"npm run setup && npm run make && npm run lint && npm run audit",setup:"npm run clean && npm run set_version",make:"npm run parser && npm run ts && npm run rollup && npm run terser && npm run examples && npm run docs && npm run headers && npm run deploy",audit:"npm run test && npm run benchmark",tidy:"rimraf build",start:"cd docs && npm start"},devDependencies={"@peggyjs/eslint-config":"^3.0.6","@rollup/plugin-commonjs":"^25.0.3","@rollup/plugin-json":"^6.0.0","@rollup/plugin-multi-entry":"^6.0.0","@rollup/plugin-node-resolve":"^15.1.0","@rollup/plugin-typescript":"^11.1.2","@types/chai":"^4.3.5","@types/jest":"^29.5.3","@types/node":"^20.4.9","@typescript-eslint/eslint-plugin":"^6.3.0","@typescript-eslint/parser":"^6.3.0",chai:"^4.3.7","chai-like":"^1.1.1",copyfiles:"^2.4.1",eslint:"^8.47.0",express:"4.18.2",glob:"^8.1.0",jest:"^29.6.2",rimraf:"^5.0.1",rollup:"^3.28.0","rollup-plugin-ignore":"1.0.10","source-map":"^0.8.0-beta.0",terser:"^5.19.2","ts-jest":"^29.1.1",tslib:"^2.6.1",typescript:"^5.1.6"},dependencies={commander:"^11.0.0","source-map-generator":"0.8.0"},engines={node:">=16"},require$$2={name:name,version:version,description:description,keywords:keywords,homepage:homepage,repository:repository,bugs:bugs,license:license,author:author,main:main,browser:browser,unpkg:unpkg,jsdelivr:jsdelivr,types:types,bin:bin,scripts:scripts,devDependencies:devDependencies,dependencies:dependencies,engines:engines},sourceMap={},sourceMapGenerator={},base64Vlq={},base64$2={};const intToCharMap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");base64$2.encode=function(e){if(0<=e&&e<intToCharMap.length)return intToCharMap[e];throw new TypeError("Must be between 0 and 63: "+e)};const base64$1=base64$2,VLQ_BASE_SHIFT=5,VLQ_BASE=1<<VLQ_BASE_SHIFT,VLQ_BASE_MASK=VLQ_BASE-1,VLQ_CONTINUATION_BIT=VLQ_BASE;function toVLQSigned(e){return e<0?1+(-e<<1):0+(e<<1)}base64Vlq.encode=function(e){let t,r="",a=toVLQSigned(e);do{t=a&VLQ_BASE_MASK,a>>>=VLQ_BASE_SHIFT,a>0&&(t|=VLQ_CONTINUATION_BIT),r+=base64$1.encode(t)}while(a>0);return r};var util$4={},urlBrowser=require$$0$1.URL;const URL$1=urlBrowser;function getArg(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$4.getArg=getArg;const supportsNullProto=!("__proto__"in Object.create(null));function identity(e){return e}function toSetString(e){return isProtoString(e)?"$"+e:e}function fromSetString(e){return isProtoString(e)?e.slice(1):e}function isProtoString(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp(e.name,t.name)))))}function parseSourceMapInput(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}util$4.toSetString=supportsNullProto?identity:toSetString,util$4.fromSetString=supportsNullProto?identity:fromSetString,util$4.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated,util$4.parseSourceMapInput=parseSourceMapInput;const PROTOCOL="http:",PROTOCOL_AND_HOST=`${PROTOCOL}//host`;function createSafeHandler(e){return t=>{const r=getURLType(t),a=buildSafeBase(t),n=new URL$1(t,a);e(n);const o=n.toString();return"absolute"===r?o:"scheme-relative"===r?o.slice(PROTOCOL.length):"path-absolute"===r?o.slice(PROTOCOL_AND_HOST.length):computeRelativeURL(a,o)}}function withBase(e,t){return new URL$1(e,t).toString()}function buildUniqueSegment(e,t){let r=0;for(;;){const a=e+r++;if(-1===t.indexOf(a))return a}}function buildSafeBase(e){const t=e.split("..").length-1,r=buildUniqueSegment("p",e);let a=`${PROTOCOL_AND_HOST}/`;for(let e=0;e<t;e++)a+=`${r}/`;return a}const ABSOLUTE_SCHEME=/^[A-Za-z0-9\+\-\.]+:/;function getURLType(e){return"/"===e[0]?"/"===e[1]?"scheme-relative":"path-absolute":ABSOLUTE_SCHEME.test(e)?"absolute":"path-relative"}function computeRelativeURL(e,t){"string"==typeof e&&(e=new URL$1(e)),"string"==typeof t&&(t=new URL$1(t));const r=t.pathname.split("/"),a=e.pathname.split("/");for(a.length>0&&!a[a.length-1]&&a.pop();r.length>0&&a.length>0&&r[0]===a[0];)r.shift(),a.shift();return a.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory=createSafeHandler((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),trimFilename=createSafeHandler((e=>{e.href=new URL$1(".",e.toString()).toString()})),normalize=createSafeHandler((e=>{}));function join(e,t){const r=getURLType(t),a=getURLType(e);if(e=ensureDirectory(e),"absolute"===r)return withBase(t,void 0);if("absolute"===a)return withBase(t,e);if("scheme-relative"===r)return normalize(t);if("scheme-relative"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL.length);if("path-absolute"===r)return normalize(t);if("path-absolute"===a)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL_AND_HOST.length);const n=buildSafeBase(t+e);return computeRelativeURL(n,withBase(t,withBase(e,n)))}function relative(e,t){const r=relativeIfPossible(e,t);return"string"==typeof r?r:normalize(t)}function relativeIfPossible(e,t){if(getURLType(e)!==getURLType(t))return null;const r=buildSafeBase(e+t),a=new URL$1(e,r),n=new URL$1(t,r);try{new URL$1("",n.toString())}catch(e){return null}return n.protocol!==a.protocol||n.user!==a.user||n.password!==a.password||n.hostname!==a.hostname||n.port!==a.port?null:computeRelativeURL(a,n)}function computeSourceURL(e,t,r){e&&"path-absolute"===getURLType(t)&&(t=t.replace(/^\//,""));let a=normalize(t||"");return e&&(a=join(e,a)),r&&(a=join(trimFilename(r),a)),a}util$4.normalize=normalize,util$4.join=join,util$4.relative=relative,util$4.computeSourceURL=computeSourceURL;var arraySet={};let ArraySet$2=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const a=new e;for(let e=0,n=t.length;e<n;e++)a.add(t[e],r);return a}size(){return this._set.size}add(e,t){const r=this.has(e),a=this._array.length;r&&!t||this._array.push(e),r||this._set.set(e,a)}has(e){return this._set.has(e)}indexOf(e){const t=this._set.get(e);if(t>=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)}toArray(){return this._array.slice()}};arraySet.ArraySet=ArraySet$2;var mappingList={};const util$3=util$4;function generatedPositionAfter(e,t){const r=e.generatedLine,a=t.generatedLine,n=e.generatedColumn,o=t.generatedColumn;return a>r||a==r&&o>=n||util$3.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$1=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$3.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList.MappingList=MappingList$1;const base64VLQ=base64Vlq,util$2=util$4,ArraySet$1=arraySet.ArraySet,MappingList=mappingList.MappingList;let SourceMapGenerator$1=class e{constructor(e){e||(e={}),this._file=util$2.getArg(e,"file",null),this._sourceRoot=util$2.getArg(e,"sourceRoot",null),this._skipValidation=util$2.getArg(e,"skipValidation",!1),this._sources=new ArraySet$1,this._names=new ArraySet$1,this._mappings=new MappingList,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,a=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$2.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),a.addMapping(t)})),t.sources.forEach((function(e){let n=e;null!==r&&(n=util$2.relative(r,e)),a._sources.has(n)||a._sources.add(n);const o=t.sourceContentFor(e);null!=o&&a.setSourceContent(e,o)})),a}addMapping(e){const t=util$2.getArg(e,"generated"),r=util$2.getArg(e,"original",null);let a=util$2.getArg(e,"source",null),n=util$2.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,a,n),null!=a&&(a=String(a),this._sources.has(a)||this._sources.add(a)),null!=n&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:a,name:n})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$2.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$2.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$2.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let a=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=e.file}const n=this._sourceRoot;null!=n&&(a=util$2.relative(n,a));const o=this._mappings.toArray().length>0?new ArraySet$1:this._sources,s=new ArraySet$1;this._mappings.unsortedForEach((function(t){if(t.source===a&&null!=t.originalLine){const a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=util$2.join(r,t.source)),null!=n&&(t.source=util$2.relative(n,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}const c=t.source;null==c||o.has(c)||o.add(c);const i=t.name;null==i||s.has(i)||s.add(i)}),this),this._sources=o,this._names=s,e.sources.forEach((function(t){const a=e.sourceContentFor(t);null!=a&&(null!=r&&(t=util$2.join(r,t)),null!=n&&(t=util$2.relative(n,t)),this.setSourceContent(t,a))}),this)}_validateMapping(e,t,r,a){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!a);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:a}))}_serializeMappings(){let e,t,r,a,n=0,o=1,s=0,c=0,i=0,u=0,p="";const l=this._mappings.toArray();for(let f=0,g=l.length;f<g;f++){if(t=l[f],e="",t.generatedLine!==o)for(n=0;t.generatedLine!==o;)e+=";",o++;else if(f>0){if(!util$2.compareByGeneratedPositionsInflated(t,l[f-1]))continue;e+=","}e+=base64VLQ.encode(t.generatedColumn-n),n=t.generatedColumn,null!=t.source&&(a=this._sources.indexOf(t.source),e+=base64VLQ.encode(a-u),u=a,e+=base64VLQ.encode(t.originalLine-1-c),c=t.originalLine-1,e+=base64VLQ.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ.encode(r-i),i=r)),p+=e}return p}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$2.relative(t,e));const r=util$2.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$1.prototype._version=3,sourceMapGenerator.SourceMapGenerator=SourceMapGenerator$1;var sourceMapConsumer={},binarySearch$1={};!function(e){function t(r,a,n,o,s,c){const i=Math.floor((a-r)/2)+r,u=s(n,o[i],!0);return 0===u?i:u>0?a-i>1?t(i,a,n,o,s,c):c==e.LEAST_UPPER_BOUND?a<o.length?a:-1:i:i-r>1?t(r,i,n,o,s,c):c==e.LEAST_UPPER_BOUND?i:r<0?-1:r}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(r,a,n,o){if(0===a.length)return-1;let s=t(-1,a.length,r,a,n,o||e.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&0===n(a[s],a[s-1],!0);)--s;return s}}(binarySearch$1);var readWasmBrowser={exports:{}};let mappingsWasm=null;readWasmBrowser.exports=function(){if("string"==typeof mappingsWasm)return fetch(mappingsWasm).then((e=>e.arrayBuffer()));if(mappingsWasm instanceof ArrayBuffer)return Promise.resolve(mappingsWasm);throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer")},readWasmBrowser.exports.initialize=e=>{mappingsWasm=e};var readWasmBrowserExports=readWasmBrowser.exports;const readWasm$1=readWasmBrowserExports;function Mapping(){this.generatedLine=0,this.generatedColumn=0,this.lastGeneratedColumn=null,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}let cachedWasm=null;var wasm$1=function(){if(cachedWasm)return cachedWasm;const e=[];return cachedWasm=readWasm$1().then((t=>WebAssembly.instantiate(t,{env:{mapping_callback(t,r,a,n,o,s,c,i,u,p){const l=new Mapping;l.generatedLine=t+1,l.generatedColumn=r,a&&(l.lastGeneratedColumn=n-1),o&&(l.source=s,l.originalLine=c+1,l.originalColumn=i,u&&(l.name=p)),e[e.length-1](l)},start_all_generated_locations_for(){console.time("all_generated_locations_for")},end_all_generated_locations_for(){console.timeEnd("all_generated_locations_for")},start_compute_column_spans(){console.time("compute_column_spans")},end_compute_column_spans(){console.timeEnd("compute_column_spans")},start_generated_location_for(){console.time("generated_location_for")},end_generated_location_for(){console.timeEnd("generated_location_for")},start_original_location_for(){console.time("original_location_for")},end_original_location_for(){console.timeEnd("original_location_for")},start_parse_mappings(){console.time("parse_mappings")},end_parse_mappings(){console.timeEnd("parse_mappings")},start_sort_by_generated_location(){console.time("sort_by_generated_location")},end_sort_by_generated_location(){console.timeEnd("sort_by_generated_location")},start_sort_by_original_location(){console.time("sort_by_original_location")},end_sort_by_original_location(){console.timeEnd("sort_by_original_location")}}}))).then((t=>({exports:t.instance.exports,withMappingCallback:(t,r)=>{e.push(t);try{r()}finally{e.pop()}}}))).then(null,(e=>{throw cachedWasm=null,e})),cachedWasm};const util$1=util$4,binarySearch=binarySearch$1,ArraySet=arraySet.ArraySet,readWasm=readWasmBrowserExports,wasm=wasm$1,INTERNAL=Symbol("smcInternal");let SourceMapConsumer$1=class e{constructor(e,t){return e==INTERNAL?Promise.resolve(this):_factory(e,t)}static initialize(e){readWasm.initialize(e["lib/mappings.wasm"])}static fromSourceMap(e,t){return _factoryBSM(e,t)}static async with(t,r,a){const n=await new e(t,r);try{return await a(n)}finally{n.destroy()}}eachMapping(e,t,r){throw new Error("Subclasses must implement eachMapping")}allGeneratedPositionsFor(e){throw new Error("Subclasses must implement allGeneratedPositionsFor")}destroy(){throw new Error("Subclasses must implement destroy")}};SourceMapConsumer$1.prototype._version=3,SourceMapConsumer$1.GENERATED_ORDER=1,SourceMapConsumer$1.ORIGINAL_ORDER=2,SourceMapConsumer$1.GREATEST_LOWER_BOUND=1,SourceMapConsumer$1.LEAST_UPPER_BOUND=2,sourceMapConsumer.SourceMapConsumer=SourceMapConsumer$1;class BasicSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sources").map(String),s=util$1.getArg(a,"names",[]),c=util$1.getArg(a,"sourceRoot",null),i=util$1.getArg(a,"sourcesContent",null),u=util$1.getArg(a,"mappings"),p=util$1.getArg(a,"file",null);if(n!=r._version)throw new Error("Unsupported version: "+n);return r._sourceLookupCache=new Map,r._names=ArraySet.fromArray(s.map(String),!0),r._sources=ArraySet.fromArray(o,!0),r._absoluteSources=ArraySet.fromArray(r._sources.toArray().map((function(e){return util$1.computeSourceURL(c,e,t)})),!0),r.sourceRoot=c,r.sourcesContent=i,r._mappings=u,r._sourceMapURL=t,r.file=p,r._computedColumnSpans=!1,r._mappingsPtr=0,r._wasm=null,wasm().then((e=>(r._wasm=e,r)))}))}_findSourceIndex(e){const t=this._sourceLookupCache.get(e);if("number"==typeof t)return t;const r=util$1.computeSourceURL(null,e,this._sourceMapURL);if(this._absoluteSources.has(r)){const t=this._absoluteSources.indexOf(r);return this._sourceLookupCache.set(e,t),t}const a=util$1.computeSourceURL(this.sourceRoot,e,this._sourceMapURL);if(this._absoluteSources.has(a)){const t=this._absoluteSources.indexOf(a);return this._sourceLookupCache.set(e,t),t}return-1}static fromSourceMap(e,t){return new BasicSourceMapConsumer(e.toString())}get sources(){return this._absoluteSources.toArray()}_getMappingsPtr(){return 0===this._mappingsPtr&&this._parseMappings(),this._mappingsPtr}_parseMappings(){const e=this._mappings,t=e.length,r=this._wasm.exports.allocate_mappings(t),a=new Uint8Array(this._wasm.exports.memory.buffer,r,t);for(let r=0;r<t;r++)a[r]=e.charCodeAt(r);const n=this._wasm.exports.parse_mappings(r);if(!n){const e=this._wasm.exports.get_last_error();let t=`Error parsing mappings (code ${e}): `;switch(e){case 1:t+="the mappings contained a negative line, column, source index, or name index";break;case 2:t+="the mappings contained a number larger than 2**32";break;case 3:t+="reached EOF while in the middle of parsing a VLQ";break;case 4:t+="invalid base 64 character while parsing a VLQ";break;default:t+="unknown error code"}throw new Error(t)}this._mappingsPtr=n}eachMapping(e,t,r){const a=t||null,n=r||SourceMapConsumer$1.GENERATED_ORDER;this._wasm.withMappingCallback((t=>{null!==t.source&&(t.source=this._absoluteSources.at(t.source),null!==t.name&&(t.name=this._names.at(t.name))),this._computedColumnSpans&&null===t.lastGeneratedColumn&&(t.lastGeneratedColumn=1/0),e.call(a,t)}),(()=>{switch(n){case SourceMapConsumer$1.GENERATED_ORDER:this._wasm.exports.by_generated_location(this._getMappingsPtr());break;case SourceMapConsumer$1.ORIGINAL_ORDER:this._wasm.exports.by_original_location(this._getMappingsPtr());break;default:throw new Error("Unknown order of iteration.")}}))}allGeneratedPositionsFor(e){let t=util$1.getArg(e,"source");const r=util$1.getArg(e,"line"),a=e.column||0;if(t=this._findSourceIndex(t),t<0)return[];if(r<1)throw new Error("Line numbers must be >= 1");if(a<0)throw new Error("Column numbers must be >= 0");const n=[];return this._wasm.withMappingCallback((e=>{let t=e.lastGeneratedColumn;this._computedColumnSpans&&null===t&&(t=1/0),n.push({line:e.generatedLine,column:e.generatedColumn,lastColumn:t})}),(()=>{this._wasm.exports.all_generated_locations_for(this._getMappingsPtr(),t,r-1,"column"in e,a)})),n}destroy(){0!==this._mappingsPtr&&(this._wasm.exports.free_mappings(this._mappingsPtr),this._mappingsPtr=0)}computeColumnSpans(){this._computedColumnSpans||(this._wasm.exports.compute_column_spans(this._getMappingsPtr()),this._computedColumnSpans=!0)}originalPositionFor(e){const t={generatedLine:util$1.getArg(e,"line"),generatedColumn:util$1.getArg(e,"column")};if(t.generatedLine<1)throw new Error("Line numbers must be >= 1");if(t.generatedColumn<0)throw new Error("Column numbers must be >= 0");let r,a=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==a&&(a=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>r=e),(()=>{this._wasm.exports.original_location_for(this._getMappingsPtr(),t.generatedLine-1,t.generatedColumn,a)})),r&&r.generatedLine===t.generatedLine){let e=util$1.getArg(r,"source",null);null!==e&&(e=this._absoluteSources.at(e));let t=util$1.getArg(r,"name",null);return null!==t&&(t=this._names.at(t)),{source:e,line:util$1.getArg(r,"originalLine",null),column:util$1.getArg(r,"originalColumn",null),name:t}}return{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e}))}sourceContentFor(e,t){if(!this.sourcesContent)return null;const r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')}generatedPositionFor(e){let t=util$1.getArg(e,"source");if(t=this._findSourceIndex(t),t<0)return{line:null,column:null,lastColumn:null};const r={source:t,originalLine:util$1.getArg(e,"line"),originalColumn:util$1.getArg(e,"column")};if(r.originalLine<1)throw new Error("Line numbers must be >= 1");if(r.originalColumn<0)throw new Error("Column numbers must be >= 0");let a,n=util$1.getArg(e,"bias",SourceMapConsumer$1.GREATEST_LOWER_BOUND);if(null==n&&(n=SourceMapConsumer$1.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback((e=>a=e),(()=>{this._wasm.exports.generated_location_for(this._getMappingsPtr(),r.source,r.originalLine-1,r.originalColumn,n)})),a&&a.source===r.source){let e=a.lastGeneratedColumn;return this._computedColumnSpans&&null===e&&(e=1/0),{line:util$1.getArg(a,"generatedLine",null),column:util$1.getArg(a,"generatedColumn",null),lastColumn:e}}return{line:null,column:null,lastColumn:null}}}BasicSourceMapConsumer.prototype.consumer=SourceMapConsumer$1,sourceMapConsumer.BasicSourceMapConsumer=BasicSourceMapConsumer;class IndexedSourceMapConsumer extends SourceMapConsumer$1{constructor(e,t){return super(INTERNAL).then((r=>{let a=e;"string"==typeof e&&(a=util$1.parseSourceMapInput(e));const n=util$1.getArg(a,"version"),o=util$1.getArg(a,"sections");if(n!=r._version)throw new Error("Unsupported version: "+n);let s={line:-1,column:0};return Promise.all(o.map((e=>{if(e.url)throw new Error("Support for url field in sections not implemented.");const r=util$1.getArg(e,"offset"),a=util$1.getArg(r,"line"),n=util$1.getArg(r,"column");if(a<s.line||a===s.line&&n<s.column)throw new Error("Section offsets must be ordered and non-overlapping.");return s=r,new SourceMapConsumer$1(util$1.getArg(e,"map"),t).then((e=>({generatedOffset:{generatedLine:a+1,generatedColumn:n+1},consumer:e})))}))).then((e=>(r._sections=e,r)))}))}get sources(){const e=[];for(let t=0;t<this._sections.length;t++)for(let r=0;r<this._sections[t].consumer.sources.length;r++)e.push(this._sections[t].consumer.sources[r]);return e}originalPositionFor(e){const t={generatedLine:util$1.getArg(e,"line"),generatedColumn:util$1.getArg(e,"column")},r=binarySearch.search(t,this._sections,(function(e,t){return e.generatedLine-t.generatedOffset.generatedLine||e.generatedColumn-t.generatedOffset.generatedColumn})),a=this._sections[r];return a?a.consumer.originalPositionFor({line:t.generatedLine-(a.generatedOffset.generatedLine-1),column:t.generatedColumn-(a.generatedOffset.generatedLine===t.generatedLine?a.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return this._sections.every((function(e){return e.consumer.hasContentsOfAllSources()}))}sourceContentFor(e,t){for(let t=0;t<this._sections.length;t++){const r=this._sections[t].consumer.sourceContentFor(e,!0);if(r)return r}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')}_findSectionIndex(e){for(let t=0;t<this._sections.length;t++){const{consumer:r}=this._sections[t];if(-1!==r._findSourceIndex(e))return t}return-1}generatedPositionFor(e){const t=this._findSectionIndex(util$1.getArg(e,"source")),r=t>=0?this._sections[t]:null,a=t>=0&&t+1<this._sections.length?this._sections[t+1]:null,n=r&&r.consumer.generatedPositionFor(e);if(n&&null!==n.line){const e=r.generatedOffset.generatedLine-1,t=r.generatedOffset.generatedColumn-1;return 1===n.line&&(n.column+=t,"number"==typeof n.lastColumn&&(n.lastColumn+=t)),n.lastColumn===1/0&&a&&n.line===a.generatedOffset.generatedLine&&(n.lastColumn=a.generatedOffset.generatedColumn-2),n.line+=e,n}return{line:null,column:null,lastColumn:null}}allGeneratedPositionsFor(e){const t=this._findSectionIndex(util$1.getArg(e,"source")),r=t>=0?this._sections[t]:null,a=t>=0&&t+1<this._sections.length?this._sections[t+1]:null;return r?r.consumer.allGeneratedPositionsFor(e).map((e=>{const t=r.generatedOffset.generatedLine-1,n=r.generatedOffset.generatedColumn-1;return 1===e.line&&(e.column+=n,"number"==typeof e.lastColumn&&(e.lastColumn+=n)),e.lastColumn===1/0&&a&&e.line===a.generatedOffset.generatedLine&&(e.lastColumn=a.generatedOffset.generatedColumn-2),e.line+=t,e})):[]}eachMapping(e,t,r){this._sections.forEach(((a,n)=>{const o=n+1<this._sections.length?this._sections[n+1]:null,{generatedOffset:s}=a,c=s.generatedLine-1,i=s.generatedColumn-1;a.consumer.eachMapping((function(t){1===t.generatedLine&&(t.generatedColumn+=i,"number"==typeof t.lastGeneratedColumn&&(t.lastGeneratedColumn+=i)),t.lastGeneratedColumn===1/0&&o&&t.generatedLine===o.generatedOffset.generatedLine&&(t.lastGeneratedColumn=o.generatedOffset.generatedColumn-2),t.generatedLine+=c,e.call(this,t)}),t,r)}))}computeColumnSpans(){for(let e=0;e<this._sections.length;e++)this._sections[e].consumer.computeColumnSpans()}destroy(){for(let e=0;e<this._sections.length;e++)this._sections[e].consumer.destroy()}}function _factory(e,t){let r=e;"string"==typeof e&&(r=util$1.parseSourceMapInput(e));const a=null!=r.sections?new IndexedSourceMapConsumer(r,t):new BasicSourceMapConsumer(r,t);return Promise.resolve(a)}function _factoryBSM(e,t){return BasicSourceMapConsumer.fromSourceMap(e,t)}sourceMapConsumer.IndexedSourceMapConsumer=IndexedSourceMapConsumer;var sourceNode={};const SourceMapGenerator=sourceMapGenerator.SourceMapGenerator,util=util$4,REGEX_NEWLINE=/(\r?\n)/,NEWLINE_CODE=10,isSourceNode="$$$isSourceNode$$$";let SourceNode$1=class e{constructor(e,t,r,a,n){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==n?null:n,this[isSourceNode]=!0,null!=a&&this.add(a)}static fromStringWithSourceMap(t,r,a){const n=new e,o=t.split(REGEX_NEWLINE);let s=0;const c=function(){return e()+(e()||"");function e(){return s<o.length?o[s++]:void 0}};let i,u=1,p=0,l=null;return r.eachMapping((function(e){if(null!==l){if(!(u<e.generatedLine)){i=o[s]||"";const t=i.substr(0,e.generatedColumn-p);return o[s]=i.substr(e.generatedColumn-p),p=e.generatedColumn,f(l,t),void(l=e)}f(l,c()),u++,p=0}for(;u<e.generatedLine;)n.add(c()),u++;p<e.generatedColumn&&(i=o[s]||"",n.add(i.substr(0,e.generatedColumn)),o[s]=i.substr(e.generatedColumn),p=e.generatedColumn),l=e}),this),s<o.length&&(l&&f(l,c()),n.add(o.splice(s).join(""))),r.sources.forEach((function(e){const t=r.sourceContentFor(e);null!=t&&(null!=a&&(e=util.join(a,e)),n.setSourceContent(e,t))})),n;function f(t,r){if(null===t||void 0===t.source)n.add(r);else{const o=a?util.join(a,t.source):t.source;n.add(new e(t.originalLine,t.originalColumn,o,r,t.name))}}}add(e){if(Array.isArray(e))e.forEach((function(e){this.add(e)}),this);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this}prepend(e){if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,a=this.children.length;r<a;r++)t=this.children[r],t[isSourceNode]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})}join(e){let t,r;const a=this.children.length;if(a>0){for(t=[],r=0;r<a-1;r++)t.push(this.children[r]),t.push(e);t.push(this.children[r]),this.children=t}return this}replaceRight(e,t){const r=this.children[this.children.length-1];return r[isSourceNode]?r.replaceRight(e,t):"string"==typeof r?this.children[this.children.length-1]=r.replace(e,t):this.children.push("".replace(e,t)),this}setSourceContent(e,t){this.sourceContents[util.toSetString(e)]=t}walkSourceContents(e){for(let t=0,r=this.children.length;t<r;t++)this.children[t][isSourceNode]&&this.children[t].walkSourceContents(e);const t=Object.keys(this.sourceContents);for(let r=0,a=t.length;r<a;r++)e(util.fromSetString(t[r]),this.sourceContents[t[r]])}toString(){let e="";return this.walk((function(t){e+=t})),e}toStringWithSourceMap(e){const t={code:"",line:1,column:0},r=new SourceMapGenerator(e);let a=!1,n=null,o=null,s=null,c=null;return this.walk((function(e,i){t.code+=e,null!==i.source&&null!==i.line&&null!==i.column?(n===i.source&&o===i.line&&s===i.column&&c===i.name||r.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:t.line,column:t.column},name:i.name}),n=i.source,o=i.line,s=i.column,c=i.name,a=!0):a&&(r.addMapping({generated:{line:t.line,column:t.column}}),n=null,a=!1);for(let o=0,s=e.length;o<s;o++)e.charCodeAt(o)===NEWLINE_CODE?(t.line++,t.column=0,o+1===s?(n=null,a=!1):a&&r.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:t.line,column:t.column},name:i.name})):t.column++})),this.walkSourceContents((function(e,t){r.setSourceContent(e,t)})),{code:t.code,map:r}}};sourceNode.SourceNode=SourceNode$1,sourceMap.SourceMapGenerator=sourceMapGenerator.SourceMapGenerator,sourceMap.SourceMapConsumer=sourceMapConsumer.SourceMapConsumer,sourceMap.SourceNode=sourceNode.SourceNode;var chaiLike$1={exports:{}},hasRequiredChaiLike$1,chaiLike,hasRequiredChaiLike;function requireChaiLike$1(){if(hasRequiredChaiLike$1)return chaiLike$1.exports;hasRequiredChaiLike$1=1;let e=[];return chaiLike$1.exports=function(t,r){function a(e,t){return r.type(t).toUpperCase()===e.toUpperCase()}function n(t,r){for(let a of e)if(a.match(t,r))return a.assert(t,r);if(t===r)return!0;if(a("object",r)&&a("object",t)){for(let e of Object.keys(r)){if(!(e in t))return!1;if(!n(t[e],r[e]))return!1}return!0}if(a("array",r)&&a("array",t)){if(t.length!==r.length)return!1;for(let e=0;e<r.length;e++)if(!n(t[e],r[e]))return!1;return!0}return a("RegExp",t)&&a("RegExp",r)?t.toString()===r.toString():a("Date",t)&&a("Date",r)?t.getTime()===r.getTime():!!(a("string",t)&&a("string",r)||a("number",t)&&a("number",r)||a("boolean",t)&&a("boolean",r))&&t==r}t.Assertion.addMethod("like",(function(e){let a=r.flag(this,"object");this.assert(n(a,e),"expected #{this} to be like #{exp}","expected #{this} to not like #{exp}",e,a,t.config.showDiff)}))},chaiLike$1.exports.extend=function(t){e.push(t)},chaiLike$1.exports.clearPlugins=function(){e=[]},chaiLike$1.exports}function requireChaiLike(){return hasRequiredChaiLike?chaiLike:(hasRequiredChaiLike=1,chaiLike=requireChaiLike$1())}var chai$i=require$$0,peg$2=peg_1,pkg=require$$2,SourceMapConsumer=sourceMap.SourceMapConsumer,spy=utils.spy,peggyVersion=function(){return peg$2.VERSION};chai$i.use(requireChaiLike()),beforeEach((function(){return"undefined"!=typeof window?SourceMapConsumer.initialize({"lib/mappings.wasm":"https://raw.githubusercontent.com/mozilla/source-map/0.7.3/lib/mappings.wasm"}):null}));var expect$i=chai$i.expect;describe("Peggy API",(function(){it("has the correct VERSION",(function(){expect$i(peg$2.VERSION).to.equal(pkg.version)})),describe("generate",(function(){it("generates a parser",(function(){var e=peg$2.generate("start = 'a'");expect$i(e).to.be.an("object"),expect$i(e.parse("a")).to.equal("a")})),it("throws an exception on syntax error",(function(){expect$i((function(){peg$2.generate("start = @")})).to.throw()})),it("throws an exception on semantic error",(function(){expect$i((function(){peg$2.generate("start = undefined")})).to.throw()})),describe("allowed start rules",(function(){var e=["a = 'x'","b = 'x'","c = 'x'"].join("\n");describe("when |allowedStartRules| is not set",(function(){it("generated parser can start only from the first rule",(function(){var t=peg$2.generate(e);expect$i(t.parse("x",{startRule:"a"})).to.equal("x"),expect$i((function(){t.parse("x",{startRule:"b"})})).to.throw(),expect$i((function(){t.parse("x",{startRule:"c"})})).to.throw()}))})),describe("when |allowedStartRules| is set",(function(){it("generated parser can start only from specified rules",(function(){var t=peg$2.generate(e,{allowedStartRules:["b","c"]});expect$i((function(){t.parse("x",{startRule:"a"})})).to.throw(),expect$i(t.parse("x",{startRule:"b"})).to.equal("x"),expect$i(t.parse("x",{startRule:"c"})).to.equal("x")}))}))})),describe("intermediate results caching",(function(){var e=["{ var n = 0; }","start = (a 'b') / (a 'c') { return n; }","a = 'a' { n++; }"].join("\n");describe("when |cache| is not set",(function(){it("generated parser doesn't cache intermediate parse results",(function(){var t=peg$2.generate(e);expect$i(t.parse("ac")).to.equal(2)}))})),describe("when |cache| is set to |false|",(function(){it("generated parser doesn't cache intermediate parse results",(function(){var t=peg$2.generate(e,{cache:!1});expect$i(t.parse("ac")).to.equal(2)}))})),describe("when |cache| is set to |true|",(function(){it("generated parser caches intermediate parse results",(function(){var t=peg$2.generate(e,{cache:!0});expect$i(t.parse("ac")).to.equal(1)}))}))})),describe("tracing",(function(){var e="start = 'a'";describe("when |trace| is not set",(function(){it("generated parser doesn't trace",(function(){var t=peg$2.generate(e),r={trace:spy()};t.parse("a",{tracer:r}),expect$i(r.trace.called).to.equal(!1)}))})),describe("when |trace| is set to |false|",(function(){it("generated parser doesn't trace",(function(){var t=peg$2.generate(e,{trace:!1}),r={trace:spy()};t.parse("a",{tracer:r}),expect$i(r.trace.called).to.equal(!1)}))})),describe("when |trace| is set to |true|",(function(){it("generated parser traces",(function(){var t=peg$2.generate(e,{trace:!0}),r={trace:spy()};t.parse("a",{tracer:r}),expect$i(r.trace.called).to.equal(!0)}))}))})),describe("output",(function(){var grammar="start = 'a'";describe("when |output| is not set",(function(){it("returns generated parser object",(function(){var e=peg$2.generate(grammar);expect$i(e).to.be.an("object"),expect$i(e.parse("a")).to.equal("a")}))})),describe('when |output| is set to |"parser"|',(function(){it("returns generated parser object",(function(){var e=peg$2.generate(grammar,{output:"parser"});expect$i(e).to.be.an("object"),expect$i(e.parse("a")).to.equal("a")}))})),describe('when |output| is set to |"source"|',(function(){it("returns generated parser source code",(function(){var source=peg$2.generate(grammar,{output:"source"});expect$i(source).to.be.a("string"),expect$i(eval(source).parse("a")).to.equal("a")}))})),describe('when |output| is set to |"ast"|',(function(){it("returns generated parser AST",(function(){var e=peg$2.generate(grammar,{output:"ast"});expect$i(e).to.be.an("object"),expect$i(e).to.be.like(peg$2.parser.parse(grammar))}))}))})),describe("reserved words",(function(){describe("throws an exception on reserved JS words used as a label",(function(){for(var e=function(e){it(e,(function(){expect$i((function(){peg$2.generate(["start = "+e+":end","end = 'a'"].join("\n"),{output:"source"})})).to.throw(peg$2.parser.SyntaxError)}))},t=0,r=peg$2.RESERVED_WORDS;t<r.length;t++)e(r[t])})),describe("does not throw an exception on special non-reserved JS words used as a label",(function(){for(var nonReserved=["abstract","boolean","byte","char","double","final","float","goto","int","long","native","short","synchronized","throws","transient","volatile","as","async","from","get","of","set"],_loop_2=function(label){it(label,(function(){var source=peg$2.generate(["start = "+label+":end { return "+label+"; }","end = 'a'"].join("\n"),{output:"source"});expect$i(eval(source).parse("a")).to.equal("a")}))},_i=0,nonReserved_1=nonReserved;_i<nonReserved_1.length;_i++){var label=nonReserved_1[_i];_loop_2(label)}})),describe("does not throw an exception on reserved JS words used as a rule name",(function(){for(var _loop_3=function(rule){it(rule,(function(){var source=peg$2.generate(["start = "+rule,rule+" = 'a'"].join("\n"),{output:"source"});expect$i(eval(source).parse("a")).to.equal("a")}))},_i=0,_a=peg$2.RESERVED_WORDS;_i<_a.length;_i++){var rule=_a[_i];_loop_3(rule)}}))})),it("accepts custom options",(function(){peg$2.generate("start = 'a'",{grammarSource:42})})),describe("generates source map",(function(){function e(e,t,r){for(var a=t instanceof RegExp?e.search(t):e.indexOf(t),n=1,o=0,s=0;s<a;++s)10===e.charCodeAt(s)?(++n,o=0):++o;if(r&&r.offset){var c=r.offset({line:n,column:o,offset:a});return delete c.offset,c}return{line:n,column:o}}var t="GLOBAL\nINITIALIZER",r="PER-PARSE\nINITIALIZER",a="NOT\nBLOCK",n="AND\nBLOCK",o="ACTION\nBLOCK",s="MIN\nBLOCK",c="MAX\nBLOCK",i="EXACT\nBLOCK",u="\n {{".concat(t,"}}\n {").concat(r,"}\n RULE_1 = !{").concat(a,"} 'a' rule:RULE_2 {").concat(o,"};\n RULE_2 'named' = &{").concat(n,"} @'b' [abc] 'def';\n RULE_3 = RULE_1 / RULE_2;\n RULE_4 = RULE_1|{").concat(s,"} .. {").concat(c,"}, RULE_2|{").concat(i,"}| |;\n ");function p(t,r,a,n){void 0===n&&(n=t);var o=peg$2.generate(u,{grammarSource:r,output:"source-and-map"}).toStringWithSourceMap(),s=o.code,c=o.map,i=e(u,t,r),p=e(s,n);return delete i.offset,delete p.offset,SourceMapConsumer.fromSourceMap(c).then((function(e){expect$i(e.originalPositionFor(p)).to.be.deep.equal(Object.assign(i,{source:String(r),name:a}))}))}for(var l=function(e){describe("with source = ".concat(chai$i.util.inspect(e)),(function(){it("global initializer",(function(){return p(t,e,"$top_level_initializer")})),it("per-parse initializer",(function(){return p(r,e,"$initializer")})),it("action block",(function(){return p(o,e,null)})),it("semantic and predicate",(function(){return p(n,e,null)})),it("semantic not predicate",(function(){return p(a,e,null)})),it("min function boundary",(function(){return p(s,e,null)})),it("max function boundary",(function(){return p(c,e,null)})),it("exact function boundary",(function(){return p(i,e,null)})),it("rule name",(function(){return p("RULE_1",e,"RULE_1","peg$parseRULE_1() {")})),it("labelled rule name",(function(){return p("RULE_2 'named'",e,"RULE_2","peg$parseRULE_2() {")})),it("literal expression",(function(){return p("'a'",e,null,"input.charCodeAt(peg$currPos) === 97")})),it("multichar literal",(function(){return p("'def'",e,null,"input.substr(peg$currPos, 3) === peg$c3")})),it("chars expression",(function(){return p("[abc]",e,null,/s\d = input\.charAt\(peg\$currPos\);\s*if \(peg\$r0\.test\(s\d\)\)/)})),it("rule expression",(function(){return p("RULE_2",e,null,"peg$parseRULE_2();")})),it("choice expression",(function(){return p("RULE_1 / RULE_2",e,null,new RegExp([/peg\$parseRULE_1\(\);\s*/,/if \(s. === peg\$FAILED\) \{\s*/,/s. = peg\$parseRULE_2/].map((function(e){return e.source})).join("")))}))}))},f=0,g=["-",new peg$2.GrammarLocation("-",{offset:51,line:13,column:7})];f<g.length;f++)l(g[f])}))}))}));var chai$h=require$$0,SourceNode=sourceMap.SourceNode,peg$1=peg_1,op=opcodes_1,expect$h=chai$h.expect;describe("plugin API",(function(){describe("use",(function(){var e="start = 'a'";it("is called for each plugin",(function(){var t=[!1,!1,!1],r=[{use:function(){t[0]=!0}},{use:function(){t[1]=!0}},{use:function(){t[2]=!0}}];peg$1.generate(e,{plugins:r}),expect$h(t).to.deep.equal([!0,!0,!0])})),it("receives configuration",(function(){var t={use:function(e){expect$h(e).to.be.an("object"),expect$h(e.parser).to.be.an("object"),expect$h(e.parser.parse("start = 'a'")).to.be.an("object"),expect$h(e.passes).to.be.an("object"),expect$h(e.passes.check).to.be.an("array"),e.passes.check.forEach((function(e){expect$h(e).to.be.a("function")})),expect$h(e.passes.transform).to.be.an("array"),e.passes.transform.forEach((function(e){expect$h(e).to.be.a("function")})),expect$h(e.passes.generate).to.be.an("array"),e.passes.generate.forEach((function(e){expect$h(e).to.be.a("function")})),expect$h(e.reservedWords).to.be.an("array"),e.reservedWords.forEach((function(e){expect$h(e).to.be.a("string")}))}};peg$1.generate(e,{plugins:[t]})})),it("receives options",(function(){var t={plugins:[{use:function(e,r){expect$h(r).to.equal(t)}}],foo:42};peg$1.generate(e,t)})),it("can replace parser",(function(){var e={use:function(e){var t=peg$1.generate(["start = .* {"," return {"," type: 'grammar',"," initializer: {"," type: 'initializer',"," code: ['/* included for cover ast2SourceNode in the generate-js pass */'],"," },"," rules: ["," {"," type: 'rule',"," name: 'start',"," expression: { type: 'literal', value: text(), ignoreCase: false }"," }"," ]"," };","}"].join("\n"));e.parser=t}},t=peg$1.generate("a",{plugins:[e]});expect$h(t.parse("a")).to.equal("a")})),it("can change compiler passes",(function(){var t={use:function(e){e.passes.generate=[function(e){e.code=new SourceNode(1,0,"plugin","({ parse: function() { return 42; } })")}]}},r=peg$1.generate(e,{plugins:[t]});expect$h(r.parse("a")).to.equal(42)})),it("can change list of reserved words",(function(){var e={use:function(e){e.reservedWords=[]}};expect$h((function(){peg$1.generate("start = "+peg$1.RESERVED_WORDS[0]+":'a'",{plugins:[e],output:"source"})})).to.not.throw()})),it("can change options",(function(){var e=["a = 'x'","b = 'x'","c = 'x'"].join("\n"),t=peg$1.generate(e,{allowedStartRules:["a"],plugins:[{use:function(e,t){t.allowedStartRules=["b","c"]}}]});expect$h((function(){t.parse("x",{startRule:"a"})})).to.throw(),expect$h(t.parse("x",{startRule:"b"})).to.equal("x"),expect$h(t.parse("x",{startRule:"c"})).to.equal("x")})),it("can use star for start rules",(function(){var e=["a = 'x'","b = 'x'","c = 'x'"].join("\n"),t=peg$1.generate(e,{allowedStartRules:["*"]});expect$h(t.parse("x",{startRule:"a"})).to.equal("x"),expect$h(t.parse("x",{startRule:"b"})).to.equal("x"),expect$h(t.parse("x",{startRule:"c"})).to.equal("x")})),it("can munge the bytecode",(function(){var e={use:function(e){e.passes.generate.splice(1,0,(function(e){expect$h(e.rules.length).to.equal(2);var t=e.rules[0].bytecode;expect$h(t[0]).to.equal(op.MATCH_STRING_IC),t.splice(4,0,op.PUSH_CURR_POS,op.POP),t[2]+=2,t=e.rules[1].bytecode,expect$h(t[0]).to.equal(op.MATCH_STRING),expect$h(t[4]).to.equal(op.ACCEPT_STRING),t[4]=op.ACCEPT_N,t[5]=1}))}},t=peg$1.generate("one = 'abc'i; two = 'a'",{plugins:[e],output:"source"}),r=new RegExp([/if \(input\.substr\(peg\$currPos, 3\)/,/.toLowerCase\(\) === peg\$c0\) \{/,/\s*s0 = peg\$currPos;/,/\s*s0 = input\.substr/].map((function(e){return e.source})).join(""));expect$h(t.search(r)).to.be.greaterThan(0)}))}))}));var chai$g=require$$0,peg=peg_1,expect$g=chai$g.expect,stub=utils.stub;describe("generated parser behavior",(function(){function e(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r]})),t}function t(e){"object"==typeof console&&stub(console,"log");try{return e()}finally{"object"==typeof console&&console.log.restore()}}function r(e,r){var a=e.Assertion;a.addMethod("parse",(function(e,a,n){var o=this;n=void 0!==n?n:{};var s=t((function(){return r.flag(o,"object").parse(e,n)}));void 0!==a&&this.assert(r.eql(s,a),"expected #{this} to parse input as #{exp} but got #{act}","expected #{this} to not parse input as #{exp}",a,s,!r.flag(this,"negate"))})),a.addMethod("failToParse",(function(e,n,o){var s=this;o=void 0!==o?o:{};var c=void 0,i=void 0;try{i=t((function(){return r.flag(s,"object").parse(e,o)})),c=!0}catch(e){i=e,c=!1}this.assert(!c,"expected #{this} to fail to parse input but got #{act}","expected #{this} to not fail to parse input but #{act} was thrown",null,i),c||void 0===n||Object.keys(n).forEach((function(e){new a(i).to.have.property(e).that.is.deep.equal(n[e])}))}))}var a;beforeEach((function(){chai$g.use(r)})),a=function(t){describe("initializer",(function(){it("executes the code before parsing starts",(function(){var e=peg.generate(["{ var result = 42; }","start = 'a' { return result; }"].join("\n"),t);expect$g(e).to.parse("a",42)})),describe("available variables and functions",(function(){it("|options| contains options",(function(){var e=peg.generate(["{ var result = options; }","start = 'a' { return result; }"].join("\n"),t);expect$g(e).to.parse("a",{a:42},{a:42})}))}))})),describe("rule",(function(){t.cache?it("caches rule match results",(function(){var e=peg.generate(["{ var n = 0; }","start = (a 'b') / (a 'c') { return n; }","a = 'a' { n++; }"].join("\n"),t);expect$g(e).to.parse("ac",1)})):it("doesn't cache rule match results",(function(){var e=peg.generate(["{ var n = 0; }","start = (a 'b') / (a 'c') { return n; }","a = 'a' { n++; }"].join("\n"),t);expect$g(e).to.parse("ac",2)})),describe("when the expression matches",(function(){describe("without display name",(function(){describe("returns its match result",(function(){it("when expression may match",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.parse("a","a")})),it("when expression always match",(function(){var e=peg.generate("start = 'a'*",t);expect$g(e).to.parse("",[])}))}))})),describe("with display name",(function(){describe("returns its match result",(function(){it("when expression may match",(function(){var e=peg.generate("start 'start' = 'a'",t);expect$g(e).to.parse("a","a")})),it("when expression always match",(function(){var e=peg.generate("start 'start' = 'a'*",t);expect$g(e).to.parse("",[])}))}))}))})),describe("when the expression doesn't match",(function(){describe("without display name",(function(){describe("reports match failure and records an expectation",(function(){it("when expression may match",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("b",{expected:[{type:"literal",text:"a",ignoreCase:!1}]})})),it("when expression never match",(function(){var e=peg.generate("start = []",t);expect$g(e).to.failToParse("b",{expected:[{type:"class",parts:[],inverted:!1,ignoreCase:!1}]})}))}))})),describe("with display name",(function(){it('reports match failure and records an expectation of type "other" when expression may match',(function(){var e=peg.generate("start 'start' = 'a'",t);expect$g(e).to.failToParse("b",{expected:[{type:"other",description:"start"}]})})),it("reports match failure and doesn't records any expectations when expression never match",(function(){var e=peg.generate("start 'start' = []",t);expect$g(e).to.failToParse("b",{expected:[]})})),it("discards any expectations recorded when matching the expression",(function(){var e=peg.generate("start 'start' = 'a'",t);expect$g(e).to.failToParse("b",{expected:[{type:"other",description:"start"}]})}))}))}))})),describe("literal",(function(){describe("matching",(function(){it("matches empty literals",(function(){var e=peg.generate("start = ''",t);expect$g(e).to.parse("")})),it("matches one-character literals",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.parse("a"),expect$g(e).to.failToParse("b")})),it("matches multi-character literals",(function(){var e=peg.generate("start = 'abcd'",t);expect$g(e).to.parse("abcd"),expect$g(e).to.failToParse("efgh")})),it('is case sensitive without the "i" flag',(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.parse("a"),expect$g(e).to.failToParse("A")})),it('is case insensitive with the "i" flag',(function(){var e=peg.generate("start = 'a'i",t);expect$g(e).to.parse("a"),expect$g(e).to.parse("A")}))})),describe("when it matches",(function(){it("returns the matched text",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.parse("a","a")})),it("consumes the matched text",(function(){var e=peg.generate("start = 'a' .",t);expect$g(e).to.parse("ab")}))})),describe("when it doesn't match",(function(){it('reports match failure and records an expectation of type "literal"',(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("b",{expected:[{type:"literal",text:"a",ignoreCase:!1}]})}))}))})),describe("character class",(function(){describe("matching",(function(){it("matches empty classes",(function(){var e=peg.generate("start = []",t);expect$g(e).to.failToParse("a")})),it("matches classes with a character list",(function(){var e=peg.generate("start = [abc]",t);expect$g(e).to.parse("a"),expect$g(e).to.parse("b"),expect$g(e).to.parse("c"),expect$g(e).to.failToParse("d")})),it("matches classes with a character range",(function(){var e=peg.generate("start = [a-c]",t);expect$g(e).to.parse("a"),expect$g(e).to.parse("b"),expect$g(e).to.parse("c"),expect$g(e).to.failToParse("d")})),it("matches inverted classes",(function(){var e=peg.generate("start = [^a]",t);expect$g(e).to.failToParse("a"),expect$g(e).to.parse("b")})),it('is case sensitive without the "i" flag',(function(){var e=peg.generate("start = [a]",t);expect$g(e).to.parse("a"),expect$g(e).to.failToParse("A")})),it('is case insensitive with the "i" flag',(function(){var e=peg.generate("start = [a]i",t);expect$g(e).to.parse("a"),expect$g(e).to.parse("A")}))})),describe("when it matches",(function(){it("returns the matched character",(function(){var e=peg.generate("start = [a]",t);expect$g(e).to.parse("a","a")})),it("consumes the matched character",(function(){var e=peg.generate("start = [a] .",t);expect$g(e).to.parse("ab")}))})),describe("when it doesn't match",(function(){it('reports match failure and records an expectation of type "class"',(function(){var e=peg.generate("start = [a]",t);expect$g(e).to.failToParse("b",{expected:[{type:"class",parts:["a"],inverted:!1,ignoreCase:!1}]})}))}))})),describe("dot",(function(){describe("matching",(function(){it("matches any character",(function(){var e=peg.generate("start = .",t);expect$g(e).to.parse("a"),expect$g(e).to.parse("b"),expect$g(e).to.parse("c")}))})),describe("when it matches",(function(){it("returns the matched character",(function(){var e=peg.generate("start = .",t);expect$g(e).to.parse("a","a")})),it("consumes the matched character",(function(){var e=peg.generate("start = . .",t);expect$g(e).to.parse("ab")}))})),describe("when it doesn't match",(function(){it('reports match failure and records an expectation of type "any"',(function(){var e=peg.generate("start = .",t);expect$g(e).to.failToParse("",{expected:[{type:"any"}]})}))}))})),describe("rule reference",(function(){describe("when referenced rule's expression matches",(function(){it("returns its result",(function(){var e=peg.generate(["start = a","a = 'a'"].join("\n"),t);expect$g(e).to.parse("a","a")}))})),describe("when referenced rule's expression doesn't match",(function(){it("reports match failure",(function(){var e=peg.generate(["start = a","a = 'a'"].join("\n"),t);expect$g(e).to.failToParse("b")}))}))})),describe("positive semantic predicate",(function(){describe("when the code returns a truthy value",(function(){it("returns |undefined|",(function(){var e=peg.generate("start = &{ return true; } ''",t);expect$g(e).to.parse("",[void 0,""])}))})),describe("when the code returns a falsey value",(function(){it("reports match failure",(function(){var e=peg.generate("start = &{ return false; }",t);expect$g(e).to.failToParse("")}))})),describe("label variables",(function(){describe("in containing sequence",(function(){it("can access variables defined by preceding labeled elements",(function(){var e=peg.generate("start = a:'a' &{ return a === 'a'; }",t);expect$g(e).to.parse("a")})),it("cannot access variable defined by labeled predicate element",(function(){var e=peg.generate("start = 'a' b:&{ return b === undefined; } 'c'",t);expect$g(e).to.failToParse("ac")})),it("cannot access variables defined by following labeled elements",(function(){var e=peg.generate("start = &{ return a === 'a'; } a:'a'",t);expect$g(e).to.failToParse("a")})),it("cannot access variables defined by subexpressions",(function(){[{grammar:"start = (a:'a') &{ return a === 'a'; }",input:"a"},{grammar:"start = (a:'a')? &{ return a === 'a'; }",input:"a"},{grammar:"start = (a:'a')* &{ return a === 'a'; }",input:"a"},{grammar:"start = (a:'a')+ &{ return a === 'a'; }",input:"a"},{grammar:"start = (a:'a')| .. | &{ return a === 'a'; }",input:"a"},{grammar:"start = (a:'a')|0.. | &{ return a === 'a'; }",input:"a"},{grammar:"start = (a:'a')|1.. | &{ return a === 'a'; }",input:"a"},{grammar:"start = (a:'a')|2.. | &{ return a === 'a'; }",input:"aa"},{grammar:"start = (a:'a')| ..1| &{ return a === 'a'; }",input:"a"},{grammar:"start = (a:'a')| ..3| &{ return a === 'a'; }",input:"a"},{grammar:"start = (a:'a')|2..3| &{ return a === 'a'; }",input:"aa"},{grammar:"start = (a:'a')|3| &{ return a === 'a'; }",input:"aaa"},{grammar:"start = $(a:'a') &{ return a === 'a'; }",input:"a"},{grammar:"start = &(a:'a') 'a' &{ return a === 'a'; }",input:"a"},{grammar:"start = !(a:'a') 'b' &{ return a === 'a'; }",input:"b"},{grammar:"start = b:(a:'a') &{ return a === 'a'; }",input:"a"},{grammar:"start = ('a' b:'b' 'c') &{ return b === 'b'; }",input:"abc"},{grammar:"start = (a:'a' { return a; }) &{ return a === 'a'; }",input:"a"},{grammar:"start = ('a' / b:'b' / 'c') &{ return b === 'b'; }",input:"b"}].forEach((function(e){var r=peg.generate(e.grammar,t);expect$g(r).to.failToParse(e.input)}))}))})),describe("in outer sequence",(function(){it("can access variables defined by preceding labeled elements",(function(){var e=peg.generate("start = a:'a' ('b' &{ return a === 'a'; })",t);expect$g(e).to.parse("ab")})),it("cannot access variable defined by labeled predicate element",(function(){var e=peg.generate("start = 'a' b:('b' &{ return b === undefined; }) 'c'",t);expect$g(e).to.failToParse("abc")})),it("cannot access variables defined by following labeled elements",(function(){var e=peg.generate("start = ('a' &{ return b === 'b'; }) b:'b'",t);expect$g(e).to.failToParse("ab")}))}))})),describe("initializer variables & functions",(function(){it("can access variables defined in the initializer",(function(){var e=peg.generate(["{ var v = 42 }","start = &{ return v === 42; }"].join("\n"),t);expect$g(e).to.parse("")})),it("can access functions defined in the initializer",(function(){var e=peg.generate(["{ function f() { return 42; } }","start = &{ return f() === 42; }"].join("\n"),t);expect$g(e).to.parse("")}))})),describe("available variables & functions",(function(){it("|options| contains options",(function(){var e=peg.generate(["{ var result; }","start = &{ result = options; return true; } { return result; }"].join("\n"),t);expect$g(e).to.parse("",{a:42},{a:42})})),it("|location| returns current location info",(function(){var e=peg.generate(["{ var result; }","start = line (nl+ line)* { return result; }","line = thing (' '+ thing)*","thing = digit / mark","digit = [0-9]","mark = &{ result = location(); return true; } 'x'","nl = '\\r'? '\\n'"].join("\n"),t);expect$g(e).to.parse("1\n2\n\n3\n\n\n4 5 x",{source:void 0,start:{offset:13,line:7,column:5},end:{offset:13,line:7,column:5}}),expect$g(e).to.parse("1\nx",{source:void 0,start:{offset:2,line:2,column:1},end:{offset:2,line:2,column:1}}),expect$g(e).to.parse("1\r\nx",{source:void 0,start:{offset:3,line:2,column:1},end:{offset:3,line:2,column:1}})})),it("|offset| returns current start offset",(function(){var e=peg.generate(["start = [0-9]+ @mark","mark = 'xx' { return offset(); }"].join("\n"),t);expect$g(e).to.parse("0123456xx",7)})),it("|range| returns current range",(function(){var e=peg.generate(["start = [0-9]+ @mark","mark = 'xx' { return range(); }"].join("\n"),t);expect$g(e).to.parse("0123456xx",{source:void 0,start:7,end:9})}))}))})),describe("negative semantic predicate",(function(){describe("when the code returns a falsey value",(function(){it("returns |undefined|",(function(){var e=peg.generate("start = !{ return false; } ''",t);expect$g(e).to.parse("",[void 0,""])}))})),describe("when the code returns a truthy value",(function(){it("reports match failure",(function(){var e=peg.generate("start = !{ return true; }",t);expect$g(e).to.failToParse("")}))})),describe("label variables",(function(){describe("in containing sequence",(function(){it("can access variables defined by preceding labeled elements",(function(){var e=peg.generate("start = a:'a' !{ return a !== 'a'; }",t);expect$g(e).to.parse("a")})),it("cannot access variable defined by labeled predicate element",(function(){var e=peg.generate("start = 'a' b:!{ return b !== undefined; } 'c'",t);expect$g(e).to.failToParse("ac")})),it("cannot access variables defined by following labeled elements",(function(){var e=peg.generate("start = !{ return a !== 'a'; } a:'a'",t);expect$g(e).to.failToParse("a")})),it("cannot access variables defined by subexpressions",(function(){[{grammar:"start = (a:'a') !{ return a !== 'a'; }",input:"a"},{grammar:"start = (a:'a')? !{ return a !== 'a'; }",input:"a"},{grammar:"start = (a:'a')* !{ return a !== 'a'; }",input:"a"},{grammar:"start = (a:'a')+ !{ return a !== 'a'; }",input:"a"},{grammar:"start = (a:'a')| .. | !{ return a !== 'a'; }",input:"a"},{grammar:"start = (a:'a')|0.. | !{ return a !== 'a'; }",input:"a"},{grammar:"start = (a:'a')|1.. | !{ return a !== 'a'; }",input:"a"},{grammar:"start = (a:'a')|2.. | !{ return a !== 'a'; }",input:"aa"},{grammar:"start = (a:'a')| ..1| !{ return a !== 'a'; }",input:"a"},{grammar:"start = (a:'a')| ..3| !{ return a !== 'a'; }",input:"a"},{grammar:"start = (a:'a')|2..3| !{ return a !== 'a'; }",input:"aa"},{grammar:"start = (a:'a')|3| !{ return a !== 'a'; }",input:"aaa"},{grammar:"start = $(a:'a') !{ return a !== 'a'; }",input:"a"},{grammar:"start = &(a:'a') 'a' !{ return a !== 'a'; }",input:"a"},{grammar:"start = !(a:'a') 'b' !{ return a !== 'a'; }",input:"b"},{grammar:"start = b:(a:'a') !{ return a !== 'a'; }",input:"a"},{grammar:"start = ('a' b:'b' 'c') !{ return b !== 'b'; }",input:"abc"},{grammar:"start = (a:'a' { return a; }) !{ return a !== 'a'; }",input:"a"},{grammar:"start = ('a' / b:'b' / 'c') !{ return b !== 'b'; }",input:"b"}].forEach((function(e){var r=peg.generate(e.grammar,t);expect$g(r).to.failToParse(e.input)}))}))})),describe("in outer sequence",(function(){it("can access variables defined by preceding labeled elements",(function(){var e=peg.generate("start = a:'a' ('b' !{ return a !== 'a'; })",t);expect$g(e).to.parse("ab")})),it("cannot access variable defined by labeled predicate element",(function(){var e=peg.generate("start = 'a' b:('b' !{ return b !== undefined; }) 'c'",t);expect$g(e).to.failToParse("abc")})),it("cannot access variables defined by following labeled elements",(function(){var e=peg.generate("start = ('a' !{ return b !== 'b'; }) b:'b'",t);expect$g(e).to.failToParse("ab")}))}))})),describe("initializer variables & functions",(function(){it("can access variables defined in the initializer",(function(){var e=peg.generate(["{ var v = 42 }","start = !{ return v !== 42; }"].join("\n"),t);expect$g(e).to.parse("")})),it("can access functions defined in the initializer",(function(){var e=peg.generate(["{ function f() { return 42; } }","start = !{ return f() !== 42; }"].join("\n"),t);expect$g(e).to.parse("")}))})),describe("available variables & functions",(function(){it("|options| contains options",(function(){var e=peg.generate(["{ var result; }","start = !{ result = options; return false; } { return result; }"].join("\n"),t);expect$g(e).to.parse("",{a:42},{a:42})})),it("|location| returns current location info",(function(){var e=peg.generate(["{ var result; }","start = line (nl+ line)* { return result; }","line = thing (' '+ thing)*","thing = digit / mark","digit = [0-9]","mark = !{ result = location(); return false; } 'x'","nl = '\\r'? '\\n'"].join("\n"),t);expect$g(e).to.parse("1\n2\n\n3\n\n\n4 5 x",{source:void 0,start:{offset:13,line:7,column:5},end:{offset:13,line:7,column:5}}),expect$g(e).to.parse("1\nx",{source:void 0,start:{offset:2,line:2,column:1},end:{offset:2,line:2,column:1}}),expect$g(e).to.parse("1\r\nx",{source:void 0,start:{offset:3,line:2,column:1},end:{offset:3,line:2,column:1}})}))}))})),describe("group",(function(){describe("when the expression matches",(function(){it("returns its match result",(function(){var e=peg.generate("start = ('a')",t);expect$g(e).to.parse("a","a")}))})),describe("when the expression doesn't match",(function(){it("reports match failure",(function(){var e=peg.generate("start = ('a')",t);expect$g(e).to.failToParse("b")}))}))})),describe("optional",(function(){describe("when the expression matches",(function(){it("returns its match result",(function(){var e=peg.generate("start = 'a'?",t);expect$g(e).to.parse("a","a")}))})),describe("when the expression doesn't match",(function(){it("returns |null|",(function(){var e=peg.generate("start = 'a'?",t);expect$g(e).to.parse("",null)}))}))})),describe("zero or more",(function(){describe("when the expression matches zero or more times",(function(){it("returns an array of its match results",(function(){var e=peg.generate("start = 'a'*",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("aaa",["a","a","a"])}))}))})),describe("one or more",(function(){describe("when the expression matches one or more times",(function(){it("returns an array of its match results",(function(){var e=peg.generate("start = 'a'+",t);expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("aaa",["a","a","a"])}))})),describe("when the expression doesn't match",(function(){it("reports match failure",(function(){var e=peg.generate("start = 'a'+",t);expect$g(e).to.failToParse("")}))}))})),describe("repeated",(function(){function r(r){for(var a=[],n=1;n<=4;++n)for(var o=1;o<=4;++o)a[a.length]="start"+String(n)+o;var s=e(t);return s.allowedStartRules=a,peg.generate(["start11 = val:n1 x|"+r+"| $.*","start12 = val:n1 data:x|"+r+"| $.*","start13 = val:n1 x|"+r+"| rest:$.*","start14 = val:n1 data:x|"+r+"| rest:$.*","start21 = . val:n1 x|"+r+"| $.*","start22 = . val:n1 data:x|"+r+"| $.*","start23 = . val:n1 x|"+r+"| rest:$.*","start24 = . val:n1 data:x|"+r+"| rest:$.*","start31 = a:. val:n1 x|"+r+"| $.*","start32 = a:. val:n1 data:x|"+r+"| $.*","start33 = a:. val:n1 x|"+r+"| rest:$.*","start34 = a:. val:n1 data:x|"+r+"| rest:$.*","start41 = a:. b:. val:n1 x|"+r+"| $.*","start42 = a:. b:. val:n1 data:x|"+r+"| $.*","start43 = a:. b:. val:n1 x|"+r+"| rest:$.*","start44 = a:. b:. val:n1 data:x|"+r+"| rest:$.*","n1 = n:$[0-9] { return parseInt(n, 10); }","x = '='"].join(";\n"),s)}describe("without delimiter",(function(){describe("with constant boundaries",(function(){it("| .. | matches correctly",(function(){var e=peg.generate("start = 'a'|..|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.parse("aaa",["a","a","a"])})),it("|0.. | matches correctly",(function(){var e=peg.generate("start = 'a'|0..|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.parse("aaa",["a","a","a"])})),it("|1.. | matches correctly",(function(){var e=peg.generate("start = 'a'|1..|",t);expect$g(e).to.failToParse(""),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.parse("aaa",["a","a","a"])})),it("|2.. | matches correctly",(function(){var e=peg.generate("start = 'a'|2..|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.parse("aaa",["a","a","a"])})),it("| ..1| matches correctly",(function(){var e=peg.generate("start = 'a'|..1|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.failToParse("aa"),expect$g(e).to.failToParse("aaa")})),it("| ..2| matches correctly",(function(){var e=peg.generate("start = 'a'|..2|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.failToParse("aaa")})),it("|2..3| matches correctly",(function(){var e=peg.generate("start = 'a'|2..3|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.parse("aaa",["a","a","a"]),expect$g(e).to.failToParse("aaaa")})),it("|2..2| matches correctly",(function(){var e=peg.generate("start = 'a'|2..2|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.failToParse("aaa")})),it("| 2 | matches correctly",(function(){var e=peg.generate("start = 'a'|2|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.failToParse("aaa")})),it("|3..2| matches correctly",(function(){var e=peg.generate("start = 'a'|3..2|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.failToParse("aa"),expect$g(e).to.failToParse("aaa")})),it("does not consume input on failure",(function(){var e=peg.generate("start = 'a'|3| / 'a'|2| { return 42; }",t);expect$g(e).to.parse("aa",42)})),it("correctly pass external references to labels to repeated expression",(function(){var e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|..|",t);expect$g(e).to.parse("abb",["a",[["b",void 0],["b",void 0]]]),e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|2..|",t),expect$g(e).to.parse("abb",["a",[["b",void 0],["b",void 0]]]),e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|..3|",t),expect$g(e).to.parse("abb",["a",[["b",void 0],["b",void 0]]]),e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|2..3|",t),expect$g(e).to.parse("abb",["a",[["b",void 0],["b",void 0]]]),e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|2|",t),expect$g(e).to.parse("abb",["a",[["b",void 0],["b",void 0]]])}))})),describe("with variable boundaries",(function(){it("|min.. | matches correctly",(function(){for(var e=r("val.."),t=1;t<=4;++t){var a={startRule:"start1"+t};expect$g(e).to.failToParse("",void 0,a),expect$g(e).to.parse("0",[0,[],""],a),expect$g(e).to.parse("0==",[0,["=","="],""],a),expect$g(e).to.failToParse("1",void 0,a),expect$g(e).to.failToParse("2=",void 0,a),expect$g(e).to.parse("2==",[2,["=","="],""],a),expect$g(e).to.parse("2=====",[2,["=","=","=","=","="],""],a)}for(t=1;t<=4;++t)a={startRule:"start2"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,["=","="],""],a),expect$g(e).to.failToParse("-1",void 0,a),expect$g(e).to.failToParse("-2=",void 0,a),expect$g(e).to.parse("-2==",["-",2,["=","="],""],a),expect$g(e).to.parse("-2=====",["-",2,["=","=","=","=","="],""],a);for(t=1;t<=4;++t)a={startRule:"start3"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,["=","="],""],a),expect$g(e).to.failToParse("-1",void 0,a),expect$g(e).to.failToParse("-2=",void 0,a),expect$g(e).to.parse("-2==",["-",2,["=","="],""],a),expect$g(e).to.parse("-2=====",["-",2,["=","=","=","=","="],""],a);for(t=1;t<=4;++t)a={startRule:"start4"+t},expect$g(e).to.failToParse("--",void 0,a),expect$g(e).to.parse("--0",["-","-",0,[],""],a),expect$g(e).to.parse("--0==",["-","-",0,["=","="],""],a),expect$g(e).to.failToParse("--1",void 0,a),expect$g(e).to.failToParse("--2=",void 0,a),expect$g(e).to.parse("--2==",["-","-",2,["=","="],""],a),expect$g(e).to.parse("--2=====",["-","-",2,["=","=","=","=","="],""],a)})),it("| ..max| matches correctly",(function(){for(var e=r("..val"),t=1;t<=4;++t){var a={startRule:"start1"+t};expect$g(e).to.failToParse("",void 0,a),expect$g(e).to.parse("0",[0,[],""],a),expect$g(e).to.parse("0==",[0,[],"=="],a),expect$g(e).to.parse("3",[3,[],""],a),expect$g(e).to.parse("3=",[3,["="],""],a),expect$g(e).to.parse("3===",[3,["=","=","="],""],a),expect$g(e).to.parse("3=====",[3,["=","=","="],"=="],a)}for(t=1;t<=4;++t)a={startRule:"start2"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.parse("-3",["-",3,[],""],a),expect$g(e).to.parse("-3=",["-",3,["="],""],a),expect$g(e).to.parse("-3===",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=====",["-",3,["=","=","="],"=="],a);for(t=1;t<=4;++t)a={startRule:"start3"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.parse("-3",["-",3,[],""],a),expect$g(e).to.parse("-3=",["-",3,["="],""],a),expect$g(e).to.parse("-3===",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=====",["-",3,["=","=","="],"=="],a);for(t=1;t<=4;++t)a={startRule:"start4"+t},expect$g(e).to.failToParse("--",void 0,a),expect$g(e).to.parse("--0",["-","-",0,[],""],a),expect$g(e).to.parse("--0==",["-","-",0,[],"=="],a),expect$g(e).to.parse("--3",["-","-",3,[],""],a),expect$g(e).to.parse("--3=",["-","-",3,["="],""],a),expect$g(e).to.parse("--3===",["-","-",3,["=","=","="],""],a),expect$g(e).to.parse("--3=====",["-","-",3,["=","=","="],"=="],a)})),it("|min..max| matches correctly",(function(){for(var r=function(){for(var r=[],a=1;a<=4;++a)for(var n=1;n<=4;++n)r[r.length]="start"+String(a)+n;var o=e(t);return o.allowedStartRules=r,peg.generate(["start11 = min:n1 max:n1 .|min..max| $.*","start12 = min:n1 max:n1 data:.|min..max| $.*","start13 = min:n1 max:n1 .|min..max| rest:$.*","start14 = min:n1 max:n1 data:.|min..max| rest:$.*","start21 = . min:n1 max:n1 .|min..max| $.*","start22 = . min:n1 max:n1 data:.|min..max| $.*","start23 = . min:n1 max:n1 .|min..max| rest:$.*","start24 = . min:n1 max:n1 data:.|min..max| rest:$.*","start31 = a:. min:n1 max:n1 .|min..max| $.*","start32 = a:. min:n1 max:n1 data:.|min..max| $.*","start33 = a:. min:n1 max:n1 .|min..max| rest:$.*","start34 = a:. min:n1 max:n1 data:.|min..max| rest:$.*","start41 = a:. b:. min:n1 max:n1 .|min..max| $.*","start42 = a:. b:. min:n1 max:n1 data:.|min..max| $.*","start43 = a:. b:. min:n1 max:n1 .|min..max| rest:$.*","start44 = a:. b:. min:n1 max:n1 data:.|min..max| rest:$.*","n1 = n:$[0-9] { return parseInt(n, 10); }"].join(";\n"),o)}(),a=1;a<=4;++a){var n={startRule:"start1"+a};expect$g(r).to.failToParse("",void 0,n),expect$g(r).to.parse("00",[0,0,[],""],n),expect$g(r).to.parse("00==",[0,0,[],"=="],n),expect$g(r).to.failToParse("23",void 0,n),expect$g(r).to.failToParse("23=",void 0,n),expect$g(r).to.parse("23==",[2,3,["=","="],""],n),expect$g(r).to.parse("23===",[2,3,["=","=","="],""],n),expect$g(r).to.parse("23=====",[2,3,["=","=","="],"=="],n)}for(a=1;a<=4;++a)n={startRule:"start2"+a},expect$g(r).to.failToParse("-",void 0,n),expect$g(r).to.parse("-00",["-",0,0,[],""],n),expect$g(r).to.parse("-00==",["-",0,0,[],"=="],n),expect$g(r).to.failToParse("-23",void 0,n),expect$g(r).to.failToParse("-23=",void 0,n),expect$g(r).to.parse("-23==",["-",2,3,["=","="],""],n),expect$g(r).to.parse("-23===",["-",2,3,["=","=","="],""],n),expect$g(r).to.parse("-23=====",["-",2,3,["=","=","="],"=="],n);for(a=1;a<=4;++a)n={startRule:"start3"+a},expect$g(r).to.failToParse("-",void 0,n),expect$g(r).to.parse("-00",["-",0,0,[],""],n),expect$g(r).to.parse("-00==",["-",0,0,[],"=="],n),expect$g(r).to.failToParse("-23",void 0,n),expect$g(r).to.failToParse("-23=",void 0,n),expect$g(r).to.parse("-23==",["-",2,3,["=","="],""],n),expect$g(r).to.parse("-23===",["-",2,3,["=","=","="],""],n),expect$g(r).to.parse("-23=====",["-",2,3,["=","=","="],"=="],n);for(a=1;a<=4;++a)n={startRule:"start4"+a},expect$g(r).to.failToParse("--",void 0,n),expect$g(r).to.parse("--00",["-","-",0,0,[],""],n),expect$g(r).to.parse("--00==",["-","-",0,0,[],"=="],n),expect$g(r).to.failToParse("--23",void 0,n),expect$g(r).to.failToParse("--23=",void 0,n),expect$g(r).to.parse("--23==",["-","-",2,3,["=","="],""],n),expect$g(r).to.parse("--23===",["-","-",2,3,["=","=","="],""],n),expect$g(r).to.parse("--23=====",["-","-",2,3,["=","=","="],"=="],n)})),it("|val..val| matches correctly",(function(){for(var e=r("val"),t=1;t<=4;++t){var a={startRule:"start1"+t};expect$g(e).to.failToParse("",void 0,a),expect$g(e).to.parse("0",[0,[],""],a),expect$g(e).to.parse("0==",[0,[],"=="],a),expect$g(e).to.failToParse("3",void 0,a),expect$g(e).to.failToParse("3=",void 0,a),expect$g(e).to.parse("3===",[3,["=","=","="],""],a),expect$g(e).to.parse("3=====",[3,["=","=","="],"=="],a)}for(t=1;t<=4;++t)a={startRule:"start2"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.failToParse("-3",void 0,a),expect$g(e).to.failToParse("-3=",void 0,a),expect$g(e).to.parse("-3===",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=====",["-",3,["=","=","="],"=="],a);for(t=1;t<=4;++t)a={startRule:"start3"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.failToParse("-3",void 0,a),expect$g(e).to.failToParse("-3=",void 0,a),expect$g(e).to.parse("-3===",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=====",["-",3,["=","=","="],"=="],a);for(t=1;t<=4;++t)a={startRule:"start4"+t},expect$g(e).to.failToParse("--",void 0,a),expect$g(e).to.parse("--0",["-","-",0,[],""],a),expect$g(e).to.parse("--0==",["-","-",0,[],"=="],a),expect$g(e).to.failToParse("--3",void 0,a),expect$g(e).to.failToParse("--3=",void 0,a),expect$g(e).to.parse("--3===",["-","-",3,["=","=","="],""],a),expect$g(e).to.parse("--3=====",["-","-",3,["=","=","="],"=="],a)})),it("| exact | matches correctly",(function(){for(var e=r("val"),t=1;t<=4;++t){var a={startRule:"start1"+t};expect$g(e).to.failToParse("",void 0,a),expect$g(e).to.parse("0",[0,[],""],a),expect$g(e).to.parse("0==",[0,[],"=="],a),expect$g(e).to.failToParse("3",void 0,a),expect$g(e).to.failToParse("3=",void 0,a),expect$g(e).to.parse("3===",[3,["=","=","="],""],a),expect$g(e).to.parse("3=====",[3,["=","=","="],"=="],a)}for(t=1;t<=4;++t)a={startRule:"start2"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.failToParse("-3",void 0,a),expect$g(e).to.failToParse("-3=",void 0,a),expect$g(e).to.parse("-3===",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=====",["-",3,["=","=","="],"=="],a);for(t=1;t<=4;++t)a={startRule:"start3"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.failToParse("-3",void 0,a),expect$g(e).to.failToParse("-3=",void 0,a),expect$g(e).to.parse("-3===",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=====",["-",3,["=","=","="],"=="],a);for(t=1;t<=4;++t)a={startRule:"start4"+t},expect$g(e).to.failToParse("--",void 0,a),expect$g(e).to.parse("--0",["-","-",0,[],""],a),expect$g(e).to.parse("--0==",["-","-",0,[],"=="],a),expect$g(e).to.failToParse("--3",void 0,a),expect$g(e).to.failToParse("--3=",void 0,a),expect$g(e).to.parse("--3===",["-","-",3,["=","=","="],""],a),expect$g(e).to.parse("--3=====",["-","-",3,["=","=","="],"=="],a)}))})),describe("with function boundaries",(function(){it("|{min}.. | matches correctly",(function(){var e=peg.generate("start = 'a'|{ return 2; }..|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.parse("aaa",["a","a","a"])})),it("| ..{max}| matches correctly",(function(){var e=peg.generate("start = 'a'|..{ return 2; }|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.failToParse("aaa")})),it("|{min}..{max}| matches correctly",(function(){var e=peg.generate("start = 'a'|{ return 2; }..{ return 3; }|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.parse("aaa",["a","a","a"]),expect$g(e).to.failToParse("aaaa")})),it("|{val}..{val}| matches correctly",(function(){var e=peg.generate("start = 'a'|{ return 2; }..{ return 2; }|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.failToParse("aaa")})),it("| {exact} | matches correctly",(function(){var e=peg.generate("start = 'a'|{ return 2; }|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.failToParse("aaa")})),describe("function called only once",(function(){it("in |{min}.. |",(function(){var e=peg.generate("\n { let min = 0; }\n start = 'a'|{ ++min; return 2; }..| { return min; }\n ",t);expect$g(e).to.parse("aa",1),expect$g(e).to.parse("aaa",1)})),it("in | ..{max}|",(function(){var e=peg.generate("\n { let max = 0; }\n start = 'a'|..{ ++max; return 3; }| { return max; }\n ",t);expect$g(e).to.parse("aa",1),expect$g(e).to.parse("aaa",1)})),it("in |{min}..{max}|",(function(){var e=peg.generate("\n {\n let min = 0;\n let max = 0;\n }\n start = 'a'|\n { ++min; return 0; }\n ..\n { ++max; return 3; }\n | { return [min, max]; }\n ",t);expect$g(e).to.parse("",[1,1]),expect$g(e).to.parse("a",[1,1]),expect$g(e).to.parse("aa",[1,1]),expect$g(e).to.parse("aaa",[1,1])})),it("in | {exact} |",(function(){var e=peg.generate("\n { let count = 0; }\n start = 'a'|{ ++count; return options.exact; }| { return count; }\n ",t);expect$g(e).to.parse("",1,{exact:0}),expect$g(e).to.parse("aa",1,{exact:2})}))})),it("correctly pass external references to labels to boundary expression",(function(){var e=peg.generate("start = ref:'a' 'b'|{ return ref === 'a' ? 2 : 0; }..|",t);expect$g(e).to.parse("abb",["a",["b","b"]]),e=peg.generate("start = ref:'a' 'b'|..{ return ref === 'a' ? 3 : 0; }|",t),expect$g(e).to.parse("abb",["a",["b","b"]]),e=peg.generate("start = ref:'a' 'b'|{ return ref === 'a' ? 2 : 0; }..{ return ref === 'a' ? 3 : 0; }|",t),expect$g(e).to.parse("abb",["a",["b","b"]]),e=peg.generate("start = ref:'a' 'b'|{ return ref === 'a' ? 2 : 0; }|",t),expect$g(e).to.parse("abb",["a",["b","b"]])}))})),it("with functions returning non-integers",(function(){var e=peg.generate("start = 'a'|{ return 'a' }|",t);expect$g(e).to.parse("",[]),expect$g(e).to.failToParse("aaa",{expected:[{type:"end"}]}),e=peg.generate("start = 'a'|{ return 'a' }..2|",t),expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.failToParse("aaa",{expected:[{type:"end"}]}),e=peg.generate("start = 'a'|..{ return 'a' }|",t),expect$g(e).to.parse("",[]),expect$g(e).to.failToParse("a",{expected:[{type:"end"}]}),e=peg.generate("start = 'a'|{return '1.8e0' }..{ return 2.8 }|",t),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("aa",["a","a"]),expect$g(e).to.failToParse("aaa",{expected:[{type:"end"}]})}))})),describe("with delimiter",(function(){describe("with constant boundaries",(function(){it("| .. , delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|.., '~'|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.parse("a~a~a",["a","a","a"])})),it("|0.. , delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|0.., '~'|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.parse("a~a~a",["a","a","a"])})),it("|1.. , delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|1.., '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.parse("a~a~a",["a","a","a"])})),it("|2.. , delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|2.., '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.parse("a~a~a",["a","a","a"])})),it("| ..1, delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|..1, '~'|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.failToParse("a~a"),expect$g(e).to.failToParse("a~a~a")})),it("| ..2, delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|..2, '~'|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.failToParse("a~a~a")})),it("|2..3, delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|2..3, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.parse("a~a~a",["a","a","a"]),expect$g(e).to.failToParse("a~a~a~a")})),it("|2..2, delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|2..2, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.failToParse("a~a~a")})),it("|2 , delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|2, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.failToParse("a~a~a")})),it("|3..2, delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|3..2, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.failToParse("a~a"),expect$g(e).to.failToParse("a~a~a")})),it("correctly pass external references to labels to repeated expression",(function(){var e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|.., ' '|",t);expect$g(e).to.parse("ab b",["a",[["b",void 0],["b",void 0]]]),e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|2.., ' '|",t),expect$g(e).to.parse("ab b",["a",[["b",void 0],["b",void 0]]]),e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|..3, ' '|",t),expect$g(e).to.parse("ab b",["a",[["b",void 0],["b",void 0]]]),e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|2..3, ' '|",t),expect$g(e).to.parse("ab b",["a",[["b",void 0],["b",void 0]]]),e=peg.generate("start = ref:'a' ('b' &{ return ref === 'a'; })|2, ' '|",t),expect$g(e).to.parse("ab b",["a",[["b",void 0],["b",void 0]]]),e=peg.generate("start = ref:'a' 'b'|{ return ref === 'a' ? 2 : 0; }, ' '|",t),expect$g(e).to.parse("ab b",["a",["b","b"]])}))})),describe("with variable boundaries",(function(){it("|min.. , delimiter| matches correctly",(function(){for(var e=r("val.., '~'"),t=1;t<=4;++t){var a={startRule:"start1"+t};expect$g(e).to.failToParse("",void 0,a),expect$g(e).to.parse("0",[0,[],""],a),expect$g(e).to.parse("0==",[0,["="],"="],a),expect$g(e).to.parse("0=~=",[0,["=","="],""],a),expect$g(e).to.failToParse("1",void 0,a),expect$g(e).to.failToParse("1~",void 0,a),expect$g(e).to.failToParse("2=",void 0,a),expect$g(e).to.failToParse("2=~",void 0,a),expect$g(e).to.failToParse("2==",void 0,a),expect$g(e).to.parse("2=~=",[2,["=","="],""],a),expect$g(e).to.parse("2=~=~",[2,["=","="],"~"],a),expect$g(e).to.parse("2=~=~=~=~=",[2,["=","=","=","=","="],""],a)}for(t=1;t<=4;++t)a={startRule:"start2"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,["="],"="],a),expect$g(e).to.parse("-0=~=",["-",0,["=","="],""],a),expect$g(e).to.failToParse("-1",void 0,a),expect$g(e).to.failToParse("-1~",void 0,a),expect$g(e).to.failToParse("-2=",void 0,a),expect$g(e).to.failToParse("-2=~",void 0,a),expect$g(e).to.failToParse("-2==",void 0,a),expect$g(e).to.parse("-2=~=",["-",2,["=","="],""],a),expect$g(e).to.parse("-2=~=~",["-",2,["=","="],"~"],a),expect$g(e).to.parse("-2=~=~=~=~=",["-",2,["=","=","=","=","="],""],a);for(t=1;t<=4;++t)a={startRule:"start3"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,["="],"="],a),expect$g(e).to.parse("-0=~=",["-",0,["=","="],""],a),expect$g(e).to.failToParse("-1",void 0,a),expect$g(e).to.failToParse("-1~",void 0,a),expect$g(e).to.failToParse("-2=",void 0,a),expect$g(e).to.failToParse("-2=~",void 0,a),expect$g(e).to.failToParse("-2==",void 0,a),expect$g(e).to.parse("-2=~=",["-",2,["=","="],""],a),expect$g(e).to.parse("-2=~=~",["-",2,["=","="],"~"],a),expect$g(e).to.parse("-2=~=~=~=~=",["-",2,["=","=","=","=","="],""],a);for(t=1;t<=4;++t)a={startRule:"start4"+t},expect$g(e).to.failToParse("--",void 0,a),expect$g(e).to.parse("--0",["-","-",0,[],""],a),expect$g(e).to.parse("--0==",["-","-",0,["="],"="],a),expect$g(e).to.parse("--0=~=",["-","-",0,["=","="],""],a),expect$g(e).to.failToParse("--1",void 0,a),expect$g(e).to.failToParse("--1~",void 0,a),expect$g(e).to.failToParse("--2=",void 0,a),expect$g(e).to.failToParse("--2=~",void 0,a),expect$g(e).to.failToParse("--2==",void 0,a),expect$g(e).to.parse("--2=~=",["-","-",2,["=","="],""],a),expect$g(e).to.parse("--2=~=~",["-","-",2,["=","="],"~"],a),expect$g(e).to.parse("--2=~=~=~=~=",["-","-",2,["=","=","=","=","="],""],a)})),it("| ..max, delimiter| matches correctly",(function(){for(var e=r("..val, '~'"),t=1;t<=4;++t){var a={startRule:"start1"+t};expect$g(e).to.failToParse("",void 0,a),expect$g(e).to.parse("0",[0,[],""],a),expect$g(e).to.parse("0==",[0,[],"=="],a),expect$g(e).to.parse("0=~=",[0,[],"=~="],a),expect$g(e).to.parse("3",[3,[],""],a),expect$g(e).to.parse("3=",[3,["="],""],a),expect$g(e).to.parse("3===",[3,["="],"=="],a),expect$g(e).to.parse("3=~=~",[3,["=","="],"~"],a),expect$g(e).to.parse("3=~=~=",[3,["=","=","="],""],a),expect$g(e).to.parse("3=~=~=~=~=",[3,["=","=","="],"~=~="],a)}for(t=1;t<=4;++t)a={startRule:"start2"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.parse("-0=~=",["-",0,[],"=~="],a),expect$g(e).to.parse("-3",["-",3,[],""],a),expect$g(e).to.parse("-3=",["-",3,["="],""],a),expect$g(e).to.parse("-3===",["-",3,["="],"=="],a),expect$g(e).to.parse("-3=~=~",["-",3,["=","="],"~"],a),expect$g(e).to.parse("-3=~=~=",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=~=~=~=~=",["-",3,["=","=","="],"~=~="],a);for(t=1;t<=4;++t)a={startRule:"start3"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.parse("-0=~=",["-",0,[],"=~="],a),expect$g(e).to.parse("-3",["-",3,[],""],a),expect$g(e).to.parse("-3=",["-",3,["="],""],a),expect$g(e).to.parse("-3===",["-",3,["="],"=="],a),expect$g(e).to.parse("-3=~=~",["-",3,["=","="],"~"],a),expect$g(e).to.parse("-3=~=~=",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=~=~=~=~=",["-",3,["=","=","="],"~=~="],a);for(t=1;t<=4;++t)a={startRule:"start4"+t},expect$g(e).to.failToParse("--",void 0,a),expect$g(e).to.parse("--0",["-","-",0,[],""],a),expect$g(e).to.parse("--0==",["-","-",0,[],"=="],a),expect$g(e).to.parse("--0=~=",["-","-",0,[],"=~="],a),expect$g(e).to.parse("--3",["-","-",3,[],""],a),expect$g(e).to.parse("--3=",["-","-",3,["="],""],a),expect$g(e).to.parse("--3===",["-","-",3,["="],"=="],a),expect$g(e).to.parse("--3=~=~",["-","-",3,["=","="],"~"],a),expect$g(e).to.parse("--3=~=~=",["-","-",3,["=","=","="],""],a),expect$g(e).to.parse("--3=~=~=~=~=",["-","-",3,["=","=","="],"~=~="],a)})),it("|min..max, delimiter| matches correctly",(function(){for(var r=function(){for(var r=[],a=1;a<=4;++a)for(var n=1;n<=4;++n)r[r.length]="start"+String(a)+n;var o=e(t);return o.allowedStartRules=r,peg.generate(["start11 = min:n1 max:n1 .|min..max, '~'| $.*","start12 = min:n1 max:n1 data:.|min..max, '~'| $.*","start13 = min:n1 max:n1 .|min..max, '~'| rest:$.*","start14 = min:n1 max:n1 data:.|min..max, '~'| rest:$.*","start21 = . min:n1 max:n1 .|min..max, '~'| $.*","start22 = . min:n1 max:n1 data:.|min..max, '~'| $.*","start23 = . min:n1 max:n1 .|min..max, '~'| rest:$.*","start24 = . min:n1 max:n1 data:.|min..max, '~'| rest:$.*","start31 = a:. min:n1 max:n1 .|min..max, '~'| $.*","start32 = a:. min:n1 max:n1 data:.|min..max, '~'| $.*","start33 = a:. min:n1 max:n1 .|min..max, '~'| rest:$.*","start34 = a:. min:n1 max:n1 data:.|min..max, '~'| rest:$.*","start41 = a:. b:. min:n1 max:n1 .|min..max, '~'| $.*","start42 = a:. b:. min:n1 max:n1 data:.|min..max, '~'| $.*","start43 = a:. b:. min:n1 max:n1 .|min..max, '~'| rest:$.*","start44 = a:. b:. min:n1 max:n1 data:.|min..max, '~'| rest:$.*","n1 = n:$[0-9] { return parseInt(n, 10); }"].join(";\n"),o)}(),a=1;a<=4;++a){var n={startRule:"start1"+a};expect$g(r).to.failToParse("",void 0,n),expect$g(r).to.parse("00",[0,0,[],""],n),expect$g(r).to.parse("00==",[0,0,[],"=="],n),expect$g(r).to.parse("00=~=",[0,0,[],"=~="],n),expect$g(r).to.failToParse("23",void 0,n),expect$g(r).to.failToParse("23=",void 0,n),expect$g(r).to.failToParse("23=~",void 0,n),expect$g(r).to.failToParse("23==",void 0,n),expect$g(r).to.parse("23=~=",[2,3,["=","="],""],n),expect$g(r).to.parse("23=~=~",[2,3,["=","="],"~"],n),expect$g(r).to.parse("23=~=~=",[2,3,["=","=","="],""],n),expect$g(r).to.parse("23=~=~=~=~=",[2,3,["=","=","="],"~=~="],n)}for(a=1;a<=4;++a)n={startRule:"start2"+a},expect$g(r).to.failToParse("-",void 0,n),expect$g(r).to.parse("-00",["-",0,0,[],""],n),expect$g(r).to.parse("-00==",["-",0,0,[],"=="],n),expect$g(r).to.parse("-00=~=",["-",0,0,[],"=~="],n),expect$g(r).to.failToParse("-23",void 0,n),expect$g(r).to.failToParse("-23=",void 0,n),expect$g(r).to.failToParse("-23=~",void 0,n),expect$g(r).to.failToParse("-23==",void 0,n),expect$g(r).to.parse("-23=~=",["-",2,3,["=","="],""],n),expect$g(r).to.parse("-23=~=~",["-",2,3,["=","="],"~"],n),expect$g(r).to.parse("-23=~=~=",["-",2,3,["=","=","="],""],n),expect$g(r).to.parse("-23=~=~=~=~=",["-",2,3,["=","=","="],"~=~="],n);for(a=1;a<=4;++a)n={startRule:"start3"+a},expect$g(r).to.failToParse("-",void 0,n),expect$g(r).to.parse("-00",["-",0,0,[],""],n),expect$g(r).to.parse("-00==",["-",0,0,[],"=="],n),expect$g(r).to.parse("-00=~=",["-",0,0,[],"=~="],n),expect$g(r).to.failToParse("-23",void 0,n),expect$g(r).to.failToParse("-23=",void 0,n),expect$g(r).to.failToParse("-23=~",void 0,n),expect$g(r).to.failToParse("-23==",void 0,n),expect$g(r).to.parse("-23=~=",["-",2,3,["=","="],""],n),expect$g(r).to.parse("-23=~=~",["-",2,3,["=","="],"~"],n),expect$g(r).to.parse("-23=~=~=",["-",2,3,["=","=","="],""],n),expect$g(r).to.parse("-23=~=~=~=~=",["-",2,3,["=","=","="],"~=~="],n);for(a=1;a<=4;++a)n={startRule:"start4"+a},expect$g(r).to.failToParse("--",void 0,n),expect$g(r).to.parse("--00",["-","-",0,0,[],""],n),expect$g(r).to.parse("--00==",["-","-",0,0,[],"=="],n),expect$g(r).to.parse("--00=~=",["-","-",0,0,[],"=~="],n),expect$g(r).to.failToParse("--23",void 0,n),expect$g(r).to.failToParse("--23=",void 0,n),expect$g(r).to.failToParse("--23=~",void 0,n),expect$g(r).to.failToParse("--23==",void 0,n),expect$g(r).to.parse("--23=~=",["-","-",2,3,["=","="],""],n),expect$g(r).to.parse("--23=~=~",["-","-",2,3,["=","="],"~"],n),expect$g(r).to.parse("--23=~=~=",["-","-",2,3,["=","=","="],""],n),expect$g(r).to.parse("--23=~=~=~=~=",["-","-",2,3,["=","=","="],"~=~="],n)})),it("|val..val, delimiter| matches correctly",(function(){for(var e=r("val, '~'"),t=1;t<=4;++t){var a={startRule:"start1"+t};expect$g(e).to.failToParse("",void 0,a),expect$g(e).to.parse("0",[0,[],""],a),expect$g(e).to.parse("0==",[0,[],"=="],a),expect$g(e).to.parse("0=~=",[0,[],"=~="],a),expect$g(e).to.failToParse("3",void 0,a),expect$g(e).to.failToParse("3=",void 0,a),expect$g(e).to.failToParse("3=~",void 0,a),expect$g(e).to.parse("3=~=~=",[3,["=","=","="],""],a),expect$g(e).to.parse("3=~=~=~",[3,["=","=","="],"~"],a),expect$g(e).to.parse("3=~=~=~=~=",[3,["=","=","="],"~=~="],a)}for(t=1;t<=4;++t)a={startRule:"start2"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.parse("-0=~=",["-",0,[],"=~="],a),expect$g(e).to.failToParse("-3",void 0,a),expect$g(e).to.failToParse("-3=",void 0,a),expect$g(e).to.failToParse("-3=~",void 0,a),expect$g(e).to.parse("-3=~=~=",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=~=~=~",["-",3,["=","=","="],"~"],a),expect$g(e).to.parse("-3=~=~=~=~=",["-",3,["=","=","="],"~=~="],a);for(t=1;t<=4;++t)a={startRule:"start3"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.parse("-0=~=",["-",0,[],"=~="],a),expect$g(e).to.failToParse("-3",void 0,a),expect$g(e).to.failToParse("-3=",void 0,a),expect$g(e).to.failToParse("-3=~",void 0,a),expect$g(e).to.parse("-3=~=~=",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=~=~=~",["-",3,["=","=","="],"~"],a),expect$g(e).to.parse("-3=~=~=~=~=",["-",3,["=","=","="],"~=~="],a);for(t=1;t<=4;++t)a={startRule:"start4"+t},expect$g(e).to.failToParse("--",void 0,a),expect$g(e).to.parse("--0",["-","-",0,[],""],a),expect$g(e).to.parse("--0==",["-","-",0,[],"=="],a),expect$g(e).to.parse("--0=~=",["-","-",0,[],"=~="],a),expect$g(e).to.failToParse("--3",void 0,a),expect$g(e).to.failToParse("--3=",void 0,a),expect$g(e).to.failToParse("--3=~",void 0,a),expect$g(e).to.parse("--3=~=~=",["-","-",3,["=","=","="],""],a),expect$g(e).to.parse("--3=~=~=~",["-","-",3,["=","=","="],"~"],a),expect$g(e).to.parse("--3=~=~=~=~=",["-","-",3,["=","=","="],"~=~="],a)})),it("| exact , delimiter| matches correctly",(function(){for(var e=r("val, '~'"),t=1;t<=4;++t){var a={startRule:"start1"+t};expect$g(e).to.failToParse("",void 0,a),expect$g(e).to.parse("0",[0,[],""],a),expect$g(e).to.parse("0==",[0,[],"=="],a),expect$g(e).to.parse("0=~=",[0,[],"=~="],a),expect$g(e).to.failToParse("3",void 0,a),expect$g(e).to.failToParse("3=",void 0,a),expect$g(e).to.failToParse("3=~",void 0,a),expect$g(e).to.parse("3=~=~=",[3,["=","=","="],""],a),expect$g(e).to.parse("3=~=~=~",[3,["=","=","="],"~"],a),expect$g(e).to.parse("3=~=~=~=~=",[3,["=","=","="],"~=~="],a)}for(t=1;t<=4;++t)a={startRule:"start2"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.parse("-0=~=",["-",0,[],"=~="],a),expect$g(e).to.failToParse("-3",void 0,a),expect$g(e).to.failToParse("-3=",void 0,a),expect$g(e).to.failToParse("-3=~",void 0,a),expect$g(e).to.parse("-3=~=~=",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=~=~=~",["-",3,["=","=","="],"~"],a),expect$g(e).to.parse("-3=~=~=~=~=",["-",3,["=","=","="],"~=~="],a);for(t=1;t<=4;++t)a={startRule:"start3"+t},expect$g(e).to.failToParse("-",void 0,a),expect$g(e).to.parse("-0",["-",0,[],""],a),expect$g(e).to.parse("-0==",["-",0,[],"=="],a),expect$g(e).to.parse("-0=~=",["-",0,[],"=~="],a),expect$g(e).to.failToParse("-3",void 0,a),expect$g(e).to.failToParse("-3=",void 0,a),expect$g(e).to.failToParse("-3=~",void 0,a),expect$g(e).to.parse("-3=~=~=",["-",3,["=","=","="],""],a),expect$g(e).to.parse("-3=~=~=~",["-",3,["=","=","="],"~"],a),expect$g(e).to.parse("-3=~=~=~=~=",["-",3,["=","=","="],"~=~="],a);for(t=1;t<=4;++t)a={startRule:"start4"+t},expect$g(e).to.failToParse("--",void 0,a),expect$g(e).to.parse("--0",["-","-",0,[],""],a),expect$g(e).to.parse("--0==",["-","-",0,[],"=="],a),expect$g(e).to.parse("--0=~=",["-","-",0,[],"=~="],a),expect$g(e).to.failToParse("--3",void 0,a),expect$g(e).to.failToParse("--3=",void 0,a),expect$g(e).to.failToParse("--3=~",void 0,a),expect$g(e).to.parse("--3=~=~=",["-","-",3,["=","=","="],""],a),expect$g(e).to.parse("--3=~=~=~",["-","-",3,["=","=","="],"~"],a),expect$g(e).to.parse("--3=~=~=~=~=",["-","-",3,["=","=","="],"~=~="],a)}))})),describe("with function boundaries",(function(){it("|{2}.. , delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|{ return 2; }.., '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.parse("a~a~a",["a","a","a"])})),it("| ..{2}, delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|..{ return 2; }, '~'|",t);expect$g(e).to.parse("",[]),expect$g(e).to.parse("a",["a"]),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.failToParse("a~a~a")})),it("|{2}..{3}, delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|{ return 2; }..{ return 3; }, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.parse("a~a~a",["a","a","a"]),expect$g(e).to.failToParse("a~a~a~a")})),it("|{2}..{2}, delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|{ return 2; }..{ return 2; }, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.failToParse("a~a~a")})),it("|{2} , delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|{ return 2; }, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.failToParse("a~a~a")})),it("|{3}..{2}, delimiter| matches correctly",(function(){var e=peg.generate("start = 'a'|{ return 3; }..{ return 2; }, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.failToParse("a~a"),expect$g(e).to.failToParse("a~a~a")})),it("correctly pass external references to labels to boundary expression",(function(){var e=peg.generate("start = ref:'a' 'b'|{ return ref === 'a' ? 2 : 0; }.., ' '|",t);expect$g(e).to.parse("ab b",["a",["b","b"]]),e=peg.generate("start = ref:'a' 'b'|..{ return ref === 'a' ? 3 : 0; }, ' '|",t),expect$g(e).to.parse("ab b",["a",["b","b"]]),e=peg.generate("start = ref:'a' 'b'|{ return ref === 'a' ? 2 : 0; }..{ return ref === 'a' ? 3 : 0; }, ' '|",t),expect$g(e).to.parse("ab b",["a",["b","b"]]),e=peg.generate("start = ref:'a' 'b'|{ return ref === 'a' ? 2 : 0; }, ' '|",t),expect$g(e).to.parse("ab b",["a",["b","b"]])}))}))})),describe("handle delimiter correctly",(function(){it("with constant boundaries",(function(){var e=peg.generate("start = 'a'|2..3, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.failToParse("aa"),expect$g(e).to.failToParse("a~"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.failToParse("a~a~"),expect$g(e).to.parse("a~a~a",["a","a","a"]),expect$g(e).to.failToParse("a~a~a~"),expect$g(e).to.failToParse("a~a~a~a")})),it("with variable boundaries",(function(){var e=peg.generate(["start = min:n1 max:n1 'a'|min..max, '~'|","n1 = n:$[0-9] { return parseInt(n, 10); }"].join(";\n"),t);expect$g(e).to.failToParse("23"),expect$g(e).to.failToParse("23a"),expect$g(e).to.failToParse("23aa"),expect$g(e).to.failToParse("23a~"),expect$g(e).to.parse("23a~a",[2,3,["a","a"]]),expect$g(e).to.failToParse("23a~a~"),expect$g(e).to.parse("23a~a~a",[2,3,["a","a","a"]]),expect$g(e).to.failToParse("23a~a~a~"),expect$g(e).to.failToParse("23a~a~a~a")})),it("with variable boundaries in delimiter",(function(){var e=peg.generate(["start = min:n1 max:n1 'a'|2, '~'|min..max||","n1 = n:$[0-9] { return parseInt(n, 10); }"].join(";\n"),t);expect$g(e).to.failToParse("23"),expect$g(e).to.failToParse("23a"),expect$g(e).to.failToParse("23aa"),expect$g(e).to.failToParse("23a~"),expect$g(e).to.failToParse("23a~a"),expect$g(e).to.failToParse("23a~~"),expect$g(e).to.parse("23a~~a",[2,3,["a","a"]]),expect$g(e).to.parse("23a~~~a",[2,3,["a","a"]]),expect$g(e).to.failToParse("23a~~~~a"),expect$g(e).to.failToParse("23a~~a~~a")})),it("with function boundaries",(function(){var e=peg.generate("start = 'a'|{ return 2; }..{ return 3; }, '~'|",t);expect$g(e).to.failToParse(""),expect$g(e).to.failToParse("a"),expect$g(e).to.failToParse("aa"),expect$g(e).to.failToParse("a~"),expect$g(e).to.parse("a~a",["a","a"]),expect$g(e).to.failToParse("a~a~"),expect$g(e).to.parse("a~a~a",["a","a","a"]),expect$g(e).to.failToParse("a~a~a~"),expect$g(e).to.failToParse("a~a~a~a")}))}))})),describe("text",(function(){describe("when the expression matches",(function(){it("returns the matched text",(function(){var e=peg.generate("start = $('a' 'b' 'c')",t);expect$g(e).to.parse("abc","abc")}))})),describe("when the expression doesn't match",(function(){it("reports match failure",(function(){var e=peg.generate("start = $('a')",t);expect$g(e).to.failToParse("b")}))}))})),describe("positive simple predicate",(function(){describe("when the expression matches",(function(){it("returns |undefined|",(function(){var e=peg.generate("start = &'a' 'a'",t);expect$g(e).to.parse("a",[void 0,"a"])})),it("resets parse position",(function(){var e=peg.generate("start = &'a' 'a'",t);expect$g(e).to.parse("a")}))})),describe("when the expression doesn't match",(function(){it("reports match failure",(function(){var e=peg.generate("start = &'a'",t);expect$g(e).to.failToParse("b")})),it("discards any expectations recorded when matching the expression",(function(){var e=peg.generate("start = 'a' / &'b' / 'c'",t);expect$g(e).to.failToParse("d",{expected:[{type:"literal",text:"a",ignoreCase:!1},{type:"literal",text:"b",ignoreCase:!1},{type:"literal",text:"c",ignoreCase:!1}]})}))}))})),describe("negative simple predicate",(function(){describe("when the expression matches",(function(){it("reports match failure",(function(){var e=peg.generate("start = !'a'",t);expect$g(e).to.failToParse("a")}))})),describe("when the expression doesn't match",(function(){it("returns |undefined|",(function(){var e=peg.generate("start = !'a' 'b'",t);expect$g(e).to.parse("b",[void 0,"b"])})),it("resets parse position",(function(){var e=peg.generate("start = !'a' 'b'",t);expect$g(e).to.parse("b")})),it("discards any expectations recorded when matching the expression",(function(){var e=peg.generate("start = 'a' / !'b' / 'c'",t);expect$g(e).to.failToParse("b",{expected:[{type:"literal",text:"a",ignoreCase:!1},{type:"literal",text:"c",ignoreCase:!1}]})}))}))})),describe("label",(function(){describe("when the expression matches",(function(){it("returns its match result",(function(){var e=peg.generate("start = a:'a'",t);expect$g(e).to.parse("a","a")}))})),describe("when the expression doesn't match",(function(){it("reports match failure",(function(){var e=peg.generate("start = a:'a'",t);expect$g(e).to.failToParse("b")}))}))})),describe("sequence",(function(){describe("when all expressions match",(function(){it("returns an array of their match results",(function(){var e=peg.generate("start = 'a' 'b' 'c'",t);expect$g(e).to.parse("abc",["a","b","c"])})),it("plucks a single value",(function(){var e=peg.generate("start = @'a'",t);expect$g(e).to.parse("a","a"),e=peg.generate("start = @'a' / @'b'",t),expect$g(e).to.parse("a","a"),expect$g(e).to.parse("b","b"),e=peg.generate("start = 'a' @'b' 'c'",t),expect$g(e).to.parse("abc","b"),e=peg.generate("start = 'a' ( @'b' 'c' )",t),expect$g(e).to.parse("abc",["a","b"]),e=peg.generate("start = 'a' @( 'b' @'c' 'd' )",t),expect$g(e).to.parse("abcd","c"),e=peg.generate("start = 'a' ( @'b' 'c' ) @'d'",t),expect$g(e).to.parse("abcd","d"),e=peg.generate("start = 'a' @'b' 'c' / 'd' 'e' @'f'",t),expect$g(e).to.parse("def","f")})),it("plucks a multiple values",(function(){var e=peg.generate("start = 'a' @'b' @'c'",t);expect$g(e).to.parse("abc",["b","c"]),e=peg.generate("start = 'a' ( @'b' @'c' )",t),expect$g(e).to.parse("abc",["a",["b","c"]]),e=peg.generate("start = 'a' @( 'b' @'c' @'d' )",t),expect$g(e).to.parse("abcd",["c","d"]),e=peg.generate("start = 'a' @( @'b' 'c' ) @'d' 'e'",t),expect$g(e).to.parse("abcde",["b","d"]),e=peg.generate("start = 'a' @'b' 'c' / @'d' 'e' @'f'",t),expect$g(e).to.parse("def",["d","f"])})),it('prevents "@" on a semantic predicate',(function(){expect$g((function(){return peg.generate("start1 = 'a' @&{ /* semantic_and */ } 'c'")}),t).to.throw(),expect$g((function(){return peg.generate("start2 = 'a' @!{ /* semantic_not */ } 'c'")}),t).to.throw()}))})),describe("when any expression doesn't match",(function(){it("reports match failure",(function(){var e=peg.generate("start = 'a' 'b' 'c'",t);expect$g(e).to.failToParse("dbc"),expect$g(e).to.failToParse("adc"),expect$g(e).to.failToParse("abd")})),it("resets parse position",(function(){var e=peg.generate("start = 'a' 'b' / 'a'",t);expect$g(e).to.parse("a","a")}))}))})),describe("action",(function(){describe("when the expression matches",(function(){it("returns the value returned by the code",(function(){var e=peg.generate("start = 'a' { return 42; }",t);expect$g(e).to.parse("a",42)})),describe("label variables",(function(){describe("in the expression",(function(){it("can access variable defined by labeled expression",(function(){var e=peg.generate("start = a:'a' { return a; }",t);expect$g(e).to.parse("a","a")})),it("can access variables defined by labeled sequence elements",(function(){var e=peg.generate("start = a:'a' b:'b' c:'c' { return [a, b, c]; }",t);expect$g(e).to.parse("abc",["a","b","c"])})),it("cannot access variables defined by subexpressions",(function(){[{grammar:"start = (a:'a') { return a; }",input:"a"},{grammar:"start = (a:'a')? { return a; }",input:"a"},{grammar:"start = (a:'a')* { return a; }",input:"a"},{grammar:"start = (a:'a')+ { return a; }",input:"a"},{grammar:"start = (a:'a')| .. | { return a; }",input:"a"},{grammar:"start = (a:'a')|0.. | { return a; }",input:"a"},{grammar:"start = (a:'a')|1.. | { return a; }",input:"a"},{grammar:"start = (a:'a')|2.. | { return a; }",input:"aa"},{grammar:"start = (a:'a')| ..1| { return a; }",input:"a"},{grammar:"start = (a:'a')| ..3| { return a; }",input:"a"},{grammar:"start = (a:'a')|2..3| { return a; }",input:"aa"},{grammar:"start = (a:'a')|3| { return a; }",input:"aaa"},{grammar:"start = $(a:'a') { return a; }",input:"a"},{grammar:"start = &(a:'a') 'a' { return a; }",input:"a"},{grammar:"start = !(a:'a') 'b' { return a; }",input:"b"},{grammar:"start = b:(a:'a') { return a; }",input:"a"},{grammar:"start = ('a' b:'b' 'c') { return b; }",input:"abc"},{grammar:"start = (a:'a' { return a; }) { return a; }",input:"a"},{grammar:"start = ('a' / b:'b' / 'c') { return b; }",input:"b"}].forEach((function(e){var r=peg.generate(e.grammar,t);expect$g(r).to.failToParse(e.input)}))}))})),describe("in outer sequence",(function(){it("can access variables defined by preceding labeled elements",(function(){var e=peg.generate("start = a:'a' ('b' { return a; })",t);expect$g(e).to.parse("ab",["a","a"])})),it("cannot access variable defined by labeled action element",(function(){var e=peg.generate("start = 'a' b:('b' { return b; }) c:'c'",t);expect$g(e).to.failToParse("abc")})),it("cannot access variables defined by following labeled elements",(function(){var e=peg.generate("start = ('a' { return b; }) b:'b'",t);expect$g(e).to.failToParse("ab")}))}))})),describe("initializer variables & functions",(function(){it("can access variables defined in the initializer",(function(){var e=peg.generate(["{ var v = 42 }","start = 'a' { return v; }"].join("\n"),t);expect$g(e).to.parse("a",42)})),it("can access functions defined in the initializer",(function(){var e=peg.generate(["{ function f() { return 42; } }","start = 'a' { return f(); }"].join("\n"),t);expect$g(e).to.parse("a",42)}))})),describe("available variables & functions",(function(){it("|options| contains options",(function(){var e=peg.generate("start = 'a' { return options; }",t);expect$g(e).to.parse("a",{a:42},{a:42})})),it("|text| returns text matched by the expression",(function(){var e=peg.generate("start = 'a' { return text(); }",t);expect$g(e).to.parse("a","a")})),it("|location| returns location info of the expression",(function(){var e=peg.generate(["{ var result; }","start = line (nl+ line)* { return result; }","line = thing (' '+ thing)*","thing = digit / mark","digit = [0-9]","mark = 'x' { result = location(); }","nl = '\\r'? '\\n'"].join("\n"),t);expect$g(e).to.parse("1\n2\n\n3\n\n\n4 5 x",{source:void 0,start:{offset:13,line:7,column:5},end:{offset:14,line:7,column:6}}),expect$g(e).to.parse("1\nx",{source:void 0,start:{offset:2,line:2,column:1},end:{offset:3,line:2,column:2}}),expect$g(e).to.parse("1\r\nx",{source:void 0,start:{offset:3,line:2,column:1},end:{offset:4,line:2,column:2}})})),describe("|expected|",(function(){it("terminates parsing and throws an exception",(function(){var e=peg.generate("start = 'a' { expected('a'); }",t);expect$g(e).to.failToParse("a",{message:'Expected a but "a" found.',expected:[{type:"other",description:"a"}],found:"a",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:1,line:1,column:2}}})})),it("allows to set custom location info",(function(){var e=peg.generate(["start = 'a' {"," expected('a', {"," start: { offset: 1, line: 1, column: 2 },"," end: { offset: 2, line: 1, column: 3 }"," });","}"].join("\n"),t);expect$g(e).to.failToParse("a",{message:'Expected a but "a" found.',expected:[{type:"other",description:"a"}],found:"a",location:{start:{offset:1,line:1,column:2},end:{offset:2,line:1,column:3}}})}))})),describe("|error|",(function(){it("terminates parsing and throws an exception",(function(){var e=peg.generate("start = 'a' { error('a'); }",t);expect$g(e).to.failToParse("a",{message:"a",found:null,expected:null,location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:1,line:1,column:2}}})})),it("allows to set custom location info",(function(){var e=peg.generate(["start = 'a' {"," error('a', {"," start: { offset: 1, line: 1, column: 2 },"," end: { offset: 2, line: 1, column: 3 }"," });","}"].join("\n"),t);expect$g(e).to.failToParse("a",{message:"a",expected:null,found:null,location:{start:{offset:1,line:1,column:2},end:{offset:2,line:1,column:3}}})}))}))}))})),describe("when the expression doesn't match",(function(){it("reports match failure",(function(){var e=peg.generate("start = 'a' { return 42; }",t);expect$g(e).to.failToParse("b")})),it("doesn't execute the code",(function(){var e=peg.generate("start = 'a' { throw 'Boom!'; } / 'b'",t);expect$g(e).to.parse("b")}))}))})),describe("choice",(function(){describe("when any expression matches",(function(){it("returns its match result",(function(){var e=peg.generate("start = 'a' / 'b' / 'c'",t);expect$g(e).to.parse("a","a"),expect$g(e).to.parse("b","b"),expect$g(e).to.parse("c","c")}))})),describe("when all expressions don't match",(function(){it("reports match failure",(function(){var e=peg.generate("start = 'a' / 'b' / 'c'",t);expect$g(e).to.failToParse("d")}))}))})),describe("error reporting",(function(){describe("behavior",(function(){it("reports only the rightmost error",(function(){var e=peg.generate("start = 'a' 'b' / 'a' 'c' 'd'",t);expect$g(e).to.failToParse("ace",{expected:[{type:"literal",text:"d",ignoreCase:!1}]})}))})),describe("expectations reporting",(function(){it("reports expectations correctly with no alternative",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("ab",{expected:[{type:"end"}]})})),it("reports expectations correctly with one alternative",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("b",{expected:[{type:"literal",text:"a",ignoreCase:!1}]})})),it("reports expectations correctly with multiple alternatives",(function(){var e=peg.generate("start = 'aa' / 'bb' / 'cc'",t);expect$g(e).to.failToParse("dd",{expected:[{type:"literal",text:"aa",ignoreCase:!1},{type:"literal",text:"bb",ignoreCase:!1},{type:"literal",text:"cc",ignoreCase:!1}]})}))})),describe("found string reporting",(function(){it("reports found string correctly at the end of input",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("",{found:null})})),it("reports found string correctly in the middle of input",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("b",{found:"b"})}))})),describe("message building",(function(){it("builds message correctly with no alternative",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("ab",{message:'Expected end of input but "b" found.'})})),it("builds message correctly with one alternative",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("b",{message:'Expected "a" but "b" found.'})})),it("builds message correctly with multiple alternatives",(function(){var e=peg.generate("start = 'aa' / 'bb' / 'cc'",t);expect$g(e).to.failToParse("dd",{message:'Expected "aa", "bb", or "cc" but "d" found.'})})),it("builds message correctly at the end of input",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("",{message:'Expected "a" but end of input found.'})})),it("builds message correctly in the middle of input",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("b",{message:'Expected "a" but "b" found.'})})),it("removes duplicates from expectations",(function(){var e=peg.generate("start = 'a' / 'a'",t);expect$g(e).to.failToParse("b",{message:'Expected "a" but "b" found.'})})),it("sorts expectations",(function(){var e=peg.generate("start = 'cc' / 'bb' / 'aa'",t);expect$g(e).to.failToParse("d",{message:'Expected "aa", "bb", or "cc" but "d" found.'})}))})),describe("position reporting",(function(){it("reports position correctly at the end of input",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("",{location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1}}})})),it("reports position correctly in the middle of input",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("b",{location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:1,line:1,column:2}}})})),it("reports position correctly with trailing input",(function(){var e=peg.generate("start = 'a'",t);expect$g(e).to.failToParse("aa",{location:{source:void 0,start:{offset:1,line:1,column:2},end:{offset:2,line:1,column:3}}})})),it("reports position correctly in complex cases",(function(){var e=peg.generate(["start = line (nl+ line)*","line = digit (' '+ digit)*","digit = [0-9]","nl = '\\r'? '\\n'"].join("\n"),t);expect$g(e).to.failToParse("1\n2\n\n3\n\n\n4 5 x",{location:{source:void 0,start:{offset:13,line:7,column:5},end:{offset:14,line:7,column:6}}}),expect$g(e).to.failToParse("1\nx",{location:{source:void 0,start:{offset:2,line:2,column:1},end:{offset:3,line:2,column:2}}}),expect$g(e).to.failToParse("1\r\nx",{location:{source:void 0,start:{offset:3,line:2,column:1},end:{offset:4,line:2,column:2}}})})),it("reports location source correctly",(function(){var e={source:"object"},r=peg.generate(["start = line (nl+ line)*","line = digit (' '+ digit)*","digit = [0-9]","nl = '\\r'? '\\n'"].join("\n"),t);expect$g(r).to.failToParse("1\n2\n\n3\n\n\n4 5 x",{location:{source:e,start:{offset:13,line:7,column:5},end:{offset:14,line:7,column:6}}},{grammarSource:e})}))}))})),describe("complex examples",(function(){it("handles arithmetics example correctly",(function(){var e=peg.generate(["Expr = Sum","Sum = head:Product tail:(('+' / '-') Product)* {"," return tail.reduce(function(result, element) {"," if (element[0] === '+') { return result + element[1]; }"," if (element[0] === '-') { return result - element[1]; }"," }, head);"," }","Product = head:Value tail:(('*' / '/') Value)* {"," return tail.reduce(function(result, element) {"," if (element[0] === '*') { return result * element[1]; }"," if (element[0] === '/') { return result / element[1]; }"," }, head);"," }","Value = digits:[0-9]+ { return parseInt(digits.join(''), 10); }"," / '(' expr:Expr ')' { return expr; }"].join("\n"),t);expect$g(e).to.parse("0",0),expect$g(e).to.parse("123",123),expect$g(e).to.parse("(42+43)",85),expect$g(e).to.parse("42",42),expect$g(e).to.parse("42*43",1806),expect$g(e).to.parse("42*43*44*45",3575880),expect$g(e).to.parse("42/43",42/43),expect$g(e).to.parse("42/43/44/45",42/43/44/45),expect$g(e).to.parse("42*43",1806),expect$g(e).to.parse("42*43+44*45",3786),expect$g(e).to.parse("42*43+44*45+46*47+48*49",8300),expect$g(e).to.parse("42*43-44*45",-174),expect$g(e).to.parse("42*43-44*45-46*47-48*49",-4688),expect$g(e).to.parse("42+43",85),expect$g(e).to.parse("(1+2)*(3+4)",21)})),it("handles non-context-free language correctly",(function(){var e=peg.generate(["S = &(A 'c') a:'a'+ B:B !('a' / 'b' / 'c') { return a.join('') + B; }","A = a:'a' A:A? b:'b' { return [a, A, b].join(''); }","B = b:'b' B:B? c:'c' { return [b, B, c].join(''); }"].join("\n"),t);expect$g(e).to.parse("abc","abc"),expect$g(e).to.parse("aaabbbccc","aaabbbccc"),expect$g(e).to.failToParse("aabbbccc"),expect$g(e).to.failToParse("aaaabbbccc"),expect$g(e).to.failToParse("aaabbccc"),expect$g(e).to.failToParse("aaabbbbccc"),expect$g(e).to.failToParse("aaabbbcc"),expect$g(e).to.failToParse("aaabbbcccc")})),it("handles nested comments example correctly",(function(){var e=peg.generate(["C = begin:Begin ns:N* end:End { return begin + ns.join('') + end; }","N = C"," / !Begin !End z:Z { return z; }","Z = .","Begin = '(*'","End = '*)'"].join("\n"),t);expect$g(e).to.parse("(**)","(**)"),expect$g(e).to.parse("(*abc*)","(*abc*)"),expect$g(e).to.parse("(*(**)*)","(*(**)*)"),expect$g(e).to.parse("(*abc(*def*)ghi(*(*(*jkl*)*)*)mno*)","(*abc(*def*)ghi(*(*(*jkl*)*)*)mno*)")}))})),describe("run side-effects in non-matching",(function(){it("positive semantic predicate",(function(){var e=peg.generate("\n { let i = 0; }\n start = (neverMatched / .) { return i; };\n neverMatched = &{ i = 1; return true; } [];\n ",t);expect$g(e).to.parse("b",1),e=peg.generate('\n { let i = 0; }\n start = ("a" / neverMatched / .) { return i; };\n neverMatched = &{ i = 1; return true; } [];\n ',t),expect$g(e).to.parse("b",1)})),it("negative semantic predicate",(function(){var e=peg.generate("\n { let i = 0; }\n start = (neverMatched / .) { return i; };\n neverMatched = !{ i = 1; return false; } [];\n ",t);expect$g(e).to.parse("b",1),e=peg.generate('\n { let i = 0; }\n start = ("a" / neverMatched / .) { return i; };\n neverMatched = !{ i = 1; return false; } [];\n ',t),expect$g(e).to.parse("b",1)})),it("action",(function(){var e=peg.generate("\n { let i = 0; }\n start = (neverMatched / .) { return i; };\n neverMatched = (. { i = 1; }) [];\n ",t);expect$g(e).to.parse("b",1),e=peg.generate('\n { let i = 0; }\n start = ("a" / neverMatched / .) { return i; };\n neverMatched = (. { i = 1; }) [];\n ',t),expect$g(e).to.parse("b",1)}))}))},[{cache:!1,trace:!1},{cache:!1,trace:!0},{cache:!0,trace:!1},{cache:!0,trace:!0}].forEach((function(t){describe("with options "+chai$g.util.inspect(t),(function(){a(e(t))}))})),describe("syntax errors",(function(){it("formats",(function(){var e={source:"stdin",text:"==="};try{peg.generate(e.text,{grammarSource:e.source})}catch(t){expect$g(t).to.be.an.instanceof(peg.parser.SyntaxError),expect$g(t.format([e])).to.equal('Error: Expected "{", code block, comment, end of line, identifier, or whitespace but "=" found.\n --\x3e stdin:1:1\n |\n1 | ===\n | ^')}try{peg.generate("===",{grammarSource:"stdin"})}catch(e){expect$g(e).to.be.an.instanceof(peg.parser.SyntaxError),expect$g(e.format([])).to.equal('Error: Expected "{", code block, comment, end of line, identifier, or whitespace but "=" found.\n at stdin:1:1')}})),it("reports multiple errors in each compilation stage",(function(){try{peg.generate("\n start = leftRecursion\n leftRecursion = duplicatedLabel:duplicatedRule duplicatedLabel:missingRule\n duplicatedRule = missingRule\n duplicatedRule = start\n ")}catch(t){expect$g(t).with.property("stage","check"),expect$g(t).with.property("problems").to.be.an("array"),t.problems.forEach((function(e){expect$g(e).to.be.an("array").lengthOf.gte(2),expect$g(e[0]).to.be.oneOf(["error","warning","info"])}));var e=t.problems.filter((function(e){return"error"===e[0]})).map((function(e){return e[1]}));expect$g(e).to.include.members(['Rule "missingRule" is not defined','Rule "duplicatedRule" is already defined','Label "duplicatedLabel" is already defined',"Possible infinite loop when parsing (left recursion: duplicatedRule -> start -> leftRecursion -> duplicatedRule)"])}}))}))}));var chai$f=require$$0,parser$2=parser$4,compiler=compiler_1,expect$f=chai$f.expect;describe("Peggy compiler",(function(){it("checks start rules",(function(){var e=parser$2.parse("foo='1'");expect$f(compiler.compile(e,compiler.passes)).to.be.an("object"),expect$f((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:null})})).to.throw("allowedStartRules must be an array"),expect$f((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:[]})})).to.throw("Must have at least one start rule"),expect$f((function(){return compiler.compile(e,compiler.passes,{allowedStartRules:["bar"]})})).to.throw('Unknown start rule "bar"')})),it("checks output type",(function(){var e=parser$2.parse("foo='1'");expect$f(compiler.compile(e,compiler.passes,{output:"source"})).to.be.a("string"),expect$f((function(){return compiler.compile(e,compiler.passes,{output:"INVALID OUTPUT TYPE"})})).to.throw("Invalid output format: INVALID OUTPUT TYPE.")})),it("generates inline sourceMappingURL",(function(){var e=parser$2.parse("foo='1'");if(expect$f(e).to.be.an("object"),"function"==typeof TextEncoder&&(expect$f(compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})).to.match(/^\/\/# sourceMappingURL=data:application\/json;charset=utf-8;base64,/m),"object"==typeof globalThis)){var t=globalThis.TextEncoder;delete globalThis.TextEncoder,expect$f((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:"src.peggy"})})).to.throw("TextEncoder is not supported by this platform"),globalThis.TextEncoder=t}})),it("requires grammarSource with source-map",(function(){var e=parser$2.parse("foo='1'");expect$f(e).to.be.an("object"),expect$f((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map"})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),expect$f((function(){return compiler.compile(e,compiler.passes,{output:"source-and-map",grammarSource:""})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps"),"function"==typeof TextEncoder&&expect$f((function(){return compiler.compile(e,compiler.passes,{output:"source-with-inline-map",grammarSource:{toString:function(){return""}}})})).to.throw("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps")}))}));var __spreadArray$1=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n<o;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},GrammarError$1=peg_1.GrammarError,parser$1=parser$4,Session=session,helpers$a=function(e,t){var r=e.Assertion;e.use(requireChaiLike()),r.addMethod("changeAST",(function(e,a,n){n=void 0!==n?n:{};var o=parser$1.parse(e,n);t.flag(this,"object")(o,n,new Session({error:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];throw new(GrammarError$1.bind.apply(GrammarError$1,__spreadArray$1([void 0],t,!1)))}})),new r(o).like(a)})),r.addMethod("reportError",(function(e,a){var n=parser$1.parse(e),o=void 0,s=void 0;try{t.flag(this,"object")(n,{},new Session({error:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];throw new(GrammarError$1.bind.apply(GrammarError$1,__spreadArray$1([void 0],t,!1)))}})),o=!0}catch(e){s=e,o=!1}this.assert(!o,"expected #{this} to report an error but it didn't","expected #{this} to not report an error but #{act} was reported",null,s),o||void 0===a||Object.keys(a).forEach((function(e){new r(s).to.have.property(e).that.is.deep.equal(a[e])}))}))},chai$e=require$$0,helpers$9=helpers$a,pass$a=generateBytecode_1;chai$e.use(helpers$9);var expect$e=chai$e.expect;describe("compiler pass |generateBytecode|",(function(){function e(e){return{rules:[{bytecode:e}]}}function t(e,t){return{rules:[{bytecode:e}],locations:t}}function r(e,t,r,a){return{literals:e,classes:t,expectations:r,functions:a}}describe("for grammar",(function(){it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(["a = 'a'","b = 'b'","c = 'c'"].join("\n"),{rules:[{bytecode:[18,0,2,2,22,0,23,0]},{bytecode:[18,1,2,2,22,1,23,1]},{bytecode:[18,2,2,2,22,2,23,2]}]})})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(["a = 'a'","b = 'b'","c = 'c'"].join("\n"),r(["a","b","c"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1},{type:"literal",value:"c",ignoreCase:!1}],[]))})),it("generates correct source mapping",(function(){expect$e(pass$a).to.changeAST(["a = 'a'"].join("\n"),t([37,0,18,0,2,2,22,0,23,0,38],[{source:"-",start:{offset:4,line:1,column:5},end:{offset:7,line:1,column:8}}]),{grammarSource:"-",output:"source-and-map"})})),it("generates correct plucking bytecode",(function(){expect$e(pass$a).to.changeAST("start = 'a' @'b' 'c'",e([5,18,0,2,2,22,0,23,0,15,34,3,18,1,2,2,22,1,23,1,15,19,4,18,2,2,2,22,2,23,2,15,4,4,36,4,1,1,8,3,7,3,8,2,7,3,6,7,3])),expect$e(pass$a).to.changeAST("start = 'a' @'b' @'c'",e([5,18,0,2,2,22,0,23,0,15,35,3,18,1,2,2,22,1,23,1,15,20,4,18,2,2,2,22,2,23,2,15,5,4,36,4,2,1,0,8,3,7,3,8,2,7,3,6,7,3]))}))})),describe("for rule",(function(){it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST("start = 'a'",e([18,0,2,2,22,0,23,0]))}))})),describe("for named",(function(){var t="start 'start' = 'a'";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([28,18,0,2,2,22,0,23,1,29,14,2,0,23,0]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"rule",value:"start"},{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("for choice",(function(){it("generates correct bytecode and source mapping",(function(){expect$e(pass$a).to.changeAST("start = 'a' / label:'b' / 'c'",t([37,5,37,0,18,0,2,2,22,0,23,0,38,14,36,0,6,37,3,39,0,2,2,37,1,18,1,2,2,22,1,23,1,38,40,0,38,14,12,0,6,37,4,18,3,2,2,22,3,23,2,38,38],[{source:"-",start:{offset:8,line:1,column:9},end:{offset:11,line:1,column:12}},{source:"-",start:{offset:20,line:1,column:21},end:{offset:23,line:1,column:24}},{source:"-",start:{offset:14,line:1,column:15},end:{offset:19,line:1,column:20}},{source:"-",start:{offset:14,line:1,column:15},end:{offset:23,line:1,column:24}},{source:"-",start:{offset:26,line:1,column:27},end:{offset:29,line:1,column:30}},{source:"-",start:{offset:8,line:1,column:9},end:{offset:29,line:1,column:30}}]),{grammarSource:"-",output:"source-and-map"})}))})),describe("for action",(function(){describe("without labels",(function(){var t="start = 'a' { code }";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,18,0,2,2,22,0,23,0,15,6,0,24,1,26,0,1,0,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!1,params:[],body:" code ",location:{source:void 0,start:{offset:13,line:1,column:14},end:{offset:19,line:1,column:20}}}]))}))})),describe("with one label",(function(){var t="start = a:'a' { code }";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,18,0,2,2,22,0,23,0,15,7,0,24,1,26,0,1,1,0,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!1,params:["a"],body:" code ",location:{source:void 0,start:{offset:15,line:1,column:16},end:{offset:21,line:1,column:22}}}]))}))})),describe("with multiple labels",(function(){var t="start = a:'a' b:'b' c:'c' { code }";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,18,0,2,2,22,0,23,0,15,39,3,18,1,2,2,22,1,23,1,15,24,4,18,2,2,2,22,2,23,2,15,9,4,24,3,26,0,4,3,2,1,0,8,3,7,3,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b","c"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1},{type:"literal",value:"c",ignoreCase:!1}],[{predicate:!1,params:["a","b","c"],body:" code ",location:{source:void 0,start:{offset:27,line:1,column:28},end:{offset:33,line:1,column:34}}}]))}))}))})),describe("for sequence",(function(){var t="start = 'a' 'b' 'c'";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,18,0,2,2,22,0,23,0,15,33,3,18,1,2,2,22,1,23,1,15,18,4,18,2,2,2,22,2,23,2,15,3,4,11,3,9,8,3,7,3,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b","c"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1},{type:"literal",value:"c",ignoreCase:!1}],[]))}))})),describe("for labeled",(function(){it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST("start = a:'a'",e([18,0,2,2,22,0,23,0]))}))})),describe("for text",(function(){it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST("start = $'a'",e([5,18,0,2,2,22,0,23,0,15,2,1,6,12,9]))}))})),describe("for simple_and",(function(){var t="start = &'a'";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,18,0,2,2,22,0,23,0,15,3,3,6,7,1,6,6,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("for simple_not",(function(){var t="start = !'a'";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,18,0,2,2,22,0,23,0,14,3,3,6,6,1,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("for optional",(function(){var t="start = 'a'?";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([18,0,2,2,22,0,23,0,14,2,0,6,2]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("for zero_or_more",(function(){var t="start = 'a'*";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,16,9,10,18,0,2,2,22,0,23,0,6]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("for one_or_more",(function(){var t="start = 'a'+";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,15,12,3,16,9,10,18,0,2,2,22,0,23,0,6,6,6,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("for repeated",(function(){describe("without delimiter",(function(){describe("| .. | (edge case -- no boundaries)",(function(){var t="start = 'a'| .. |";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,16,9,10,18,0,2,2,22,0,23,0,6]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("with constant boundaries",(function(){describe("| ..3| (edge case -- no min boundary)",(function(){var t="start = 'a'| ..3|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,16,14,10,31,3,1,8,3,18,0,2,2,22,0,23,0,6]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("| ..1| (edge case -- no min boundary -- same as |optional|)",(function(){var t="start = 'a'| ..1|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,16,14,10,31,1,1,8,3,18,0,2,2,22,0,23,0,6]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("|2.. | (edge case -- no max boundary)",(function(){var t="start = 'a'|2.. |";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,4,18,0,2,2,22,0,23,0,16,9,10,18,0,2,2,22,0,23,0,6,30,2,3,1,6,7,3,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("|0.. | (edge case -- no max boundary -- same as |zero or more|)",(function(){var t="start = 'a'|0.. |";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,16,9,10,18,0,2,2,22,0,23,0,6]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("|1.. | (edge case -- no max boundary -- same as |one or more|)",(function(){var t="start = 'a'|1.. |";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,4,18,0,2,2,22,0,23,0,16,9,10,18,0,2,2,22,0,23,0,6,30,1,3,1,6,7,3,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("|2..3|",(function(){var t="start = 'a'|2..3|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,4,18,0,2,2,22,0,23,0,16,14,10,31,3,1,8,3,18,0,2,2,22,0,23,0,6,30,2,3,1,6,7,3,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("| 42 | (edge case -- exact repetitions)",(function(){var t="start = 'a'|42|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,4,18,0,2,2,22,0,23,0,16,14,10,31,42,1,8,3,18,0,2,2,22,0,23,0,6,30,42,3,1,6,7,3,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))}))})),describe("with variable boundaries",(function(){describe("| ..x| (edge case -- no min boundary)",(function(){var t="start = max:('a'{return 42;}) 'a'| ..max|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,18,0,2,2,22,0,23,0,15,6,0,24,1,26,0,1,0,9,15,41,3,4,33,1,1,8,3,18,0,2,2,22,0,23,0,16,14,10,33,1,1,8,3,18,0,2,2,22,0,23,0,6,15,3,4,11,2,9,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"}]))}))})),describe("|x.. | (edge case -- no max boundary)",(function(){var t="start = min:('a'{return 42;}) 'a'|min.. |";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,18,0,2,2,22,0,23,0,15,6,0,24,1,26,0,1,0,9,15,40,3,5,4,18,0,2,2,22,0,23,0,16,9,10,18,0,2,2,22,0,23,0,6,32,2,3,1,6,7,3,9,15,3,4,11,2,9,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"}]))}))})),describe("|x..y|",(function(){var t="start = min:('a'{return 42;}) max:('a'{return 42;}) 'a'|min..max|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,18,0,2,2,22,0,23,0,15,6,0,24,1,26,0,1,0,9,15,77,3,5,18,0,2,2,22,0,23,0,15,7,0,24,1,26,1,1,1,2,9,15,50,4,5,4,33,2,1,8,3,18,0,2,2,22,0,23,0,16,14,10,33,2,1,8,3,18,0,2,2,22,0,23,0,6,32,3,3,1,6,7,3,9,15,3,4,11,3,9,8,3,7,3,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"},{predicate:!1,params:["min"],body:"return 42;"}]))}))})),describe("|exact| (edge case -- exact repetitions)",(function(){var t="start = exact:('a'{return 42;}) 'a'|exact|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,18,0,2,2,22,0,23,0,15,6,0,24,1,26,0,1,0,9,15,50,3,5,4,33,2,1,8,3,18,0,2,2,22,0,23,0,16,14,10,33,2,1,8,3,18,0,2,2,22,0,23,0,6,32,2,3,1,6,7,3,9,15,3,4,11,2,9,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"}]))}))}))})),describe("with function boundaries",(function(){describe("| ..x| (edge case -- no min boundary)",(function(){var t="start = 'a'| ..{return 42;}|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([26,0,0,0,4,33,1,1,8,3,18,0,2,2,22,0,23,0,16,14,10,33,1,1,8,3,18,0,2,2,22,0,23,0,6,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!0,params:[],body:"return 42;"}]))}))})),describe("|x.. | (edge case -- no max boundary)",(function(){var t="start = 'a'|{return 42;}.. |";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([26,0,0,0,5,4,18,0,2,2,22,0,23,0,16,9,10,18,0,2,2,22,0,23,0,6,32,2,3,1,6,7,3,9,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!0,params:[],body:"return 42;"}]))}))})),describe("|x..y|",(function(){var t="start = 'a'|{return 41;}..{return 43;}|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([26,0,0,0,26,1,0,0,5,4,33,2,1,8,3,18,0,2,2,22,0,23,0,16,14,10,33,2,1,8,3,18,0,2,2,22,0,23,0,6,32,3,3,1,6,7,3,9,9,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!0,params:[],body:"return 41;"},{predicate:!0,params:[],body:"return 43;"}]))}))})),describe("|exact| (edge case -- exact repetitions)",(function(){var t="start = 'a'|{return 42;}|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([26,0,0,0,5,4,33,2,1,8,3,18,0,2,2,22,0,23,0,16,14,10,33,2,1,8,3,18,0,2,2,22,0,23,0,6,32,2,3,1,6,7,3,9,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[{predicate:!0,params:[],body:"return 42;"}]))}))}))}))})),describe("with delimiter",(function(){describe("| .. , delim| (edge case -- no boundaries)",(function(){var t="start = 'a'| .. , 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,16,30,10,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[]))}))})),describe("with constant boundaries",(function(){describe("| ..3, delim| (edge case -- no min boundary)",(function(){var t="start = 'a'| ..3, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,16,35,10,31,3,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[]))}))})),describe("| ..1, delim| (edge case -- no min boundary -- same as |optional|)",(function(){var t="start = 'a'| ..1, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,16,35,10,31,1,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[]))}))})),describe("|2.. , delim| (edge case -- no max boundary)",(function(){var t="start = 'a'|2.. , 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,4,18,0,2,2,22,0,23,0,16,30,10,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,30,2,3,1,6,7,3,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[]))}))})),describe("|0.. , delim| (edge case -- no max boundary -- same as |zero or more|)",(function(){var t="start = 'a'|0.. , 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([4,18,0,2,2,22,0,23,0,16,30,10,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[]))}))})),describe("|1.. , delim| (edge case -- no max boundary -- same as |one or more|)",(function(){var t="start = 'a'|1.. , 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,4,18,0,2,2,22,0,23,0,16,30,10,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,30,1,3,1,6,7,3,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[]))}))})),describe("|2..3, delim|",(function(){var t="start = 'a'|2..3, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,4,18,0,2,2,22,0,23,0,16,35,10,31,3,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,30,2,3,1,6,7,3,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[]))}))})),describe("| 42 , delim| (edge case -- exact repetitions)",(function(){var t="start = 'a'|42, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,4,18,0,2,2,22,0,23,0,16,35,10,31,42,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,30,42,3,1,6,7,3,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[]))}))}))})),describe("with variable boundaries",(function(){describe("| ..x, delim| (edge case -- no min boundary)",(function(){var t="start = max:(''{return 42;}) 'a'| ..max, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,35,15,6,0,24,1,26,0,1,0,9,15,62,3,4,33,1,1,8,3,18,0,2,2,22,0,23,0,16,35,10,33,1,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,15,3,4,11,2,9,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"}]))}))})),describe("|x.. , delim| (edge case -- no max boundary)",(function(){var t="start = min:(''{return 42;}) 'a'|min.. , 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,35,15,6,0,24,1,26,0,1,0,9,15,61,3,5,4,18,0,2,2,22,0,23,0,16,30,10,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,32,2,3,1,6,7,3,9,15,3,4,11,2,9,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"}]))}))})),describe("|x..y, delim|",(function(){var t="start = min:(''{return 42;}) max:(''{return 42;}) 'a'|min..max, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,35,15,6,0,24,1,26,0,1,0,9,15,91,3,5,35,15,7,0,24,1,26,1,1,1,2,9,15,71,4,5,4,33,2,1,8,3,18,0,2,2,22,0,23,0,16,35,10,33,2,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,32,3,3,1,6,7,3,9,15,3,4,11,3,9,8,3,7,3,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"},{predicate:!1,params:["min"],body:"return 42;"}]))}))})),describe("|exact, delim| (edge case -- exact repetitions)",(function(){var t="start = exact:(''{return 42;}) 'a'|exact, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,35,15,6,0,24,1,26,0,1,0,9,15,71,3,5,4,33,2,1,8,3,18,0,2,2,22,0,23,0,16,35,10,33,2,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,32,2,3,1,6,7,3,9,15,3,4,11,2,9,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"}]))}))})),describe("used in delimiter",(function(){describe("delim|min..|",(function(){var t="start = min:(''{return 42;}) 'a'|.., 'b'|min..| |";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,35,15,6,0,24,1,26,0,1,0,9,15,74,3,4,18,0,2,2,22,0,23,0,16,52,10,5,5,4,18,1,2,2,22,1,23,1,16,9,10,18,1,2,2,22,1,23,1,6,32,4,3,1,6,7,3,9,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,15,3,4,11,2,9,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"}]))}))})),describe("delim|..max|",(function(){var t="start = max:(''{return 42;}) 'a'|.., 'b'|..max| |";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,35,15,6,0,24,1,26,0,1,0,9,15,75,3,4,18,0,2,2,22,0,23,0,16,53,10,5,4,33,3,1,8,3,18,1,2,2,22,1,23,1,16,14,10,33,3,1,8,3,18,1,2,2,22,1,23,1,6,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,15,3,4,11,2,9,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"}]))}))})),describe("delim|exact|",(function(){var t="start = exact:(''{return 42;}) 'a'|.., 'b'|exact| |";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,5,35,15,6,0,24,1,26,0,1,0,9,15,84,3,4,18,0,2,2,22,0,23,0,16,62,10,5,5,4,33,4,1,8,3,18,1,2,2,22,1,23,1,16,14,10,33,4,1,8,3,18,1,2,2,22,1,23,1,6,32,4,3,1,6,7,3,9,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,15,3,4,11,2,9,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!1,params:[],body:"return 42;"}]))}))}))}))})),describe("with function boundaries",(function(){describe("| ..x, delim| (edge case -- no min boundary)",(function(){var t="start = 'a'| ..{return 42;}, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([26,0,0,0,4,33,1,1,8,3,18,0,2,2,22,0,23,0,16,35,10,33,1,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!0,params:[],body:"return 42;"}]))}))})),describe("|x.. , delim| (edge case -- no max boundary)",(function(){var t="start = 'a'|{return 42;}.. , 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([26,0,0,0,5,4,18,0,2,2,22,0,23,0,16,30,10,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,32,2,3,1,6,7,3,9,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!0,params:[],body:"return 42;"}]))}))})),describe("|x..y, delim|",(function(){var t="start = 'a'|{return 41;}..{return 43;}, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([26,0,0,0,26,1,0,0,5,4,33,2,1,8,3,18,0,2,2,22,0,23,0,16,35,10,33,2,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,32,3,3,1,6,7,3,9,9,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!0,params:[],body:"return 41;"},{predicate:!0,params:[],body:"return 43;"}]))}))})),describe("|exact, delim| (edge case -- exact repetitions)",(function(){var t="start = 'a'|{return 42;}, 'b'|";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([26,0,0,0,5,4,33,2,1,8,3,18,0,2,2,22,0,23,0,16,35,10,33,2,1,29,3,5,18,1,2,2,22,1,23,1,15,16,1,6,18,0,2,2,22,0,23,0,14,3,1,6,7,3,9,9,6,32,2,3,1,6,7,3,9,9]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1}],[{predicate:!0,params:[],body:"return 42;"}]))}))}))}))}))})),describe("for group",(function(){var t="start = ('a')";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([18,0,2,2,22,0,23,0]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("for semantic_and",(function(){describe("without labels",(function(){var t="start = &{ code }";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([25,26,0,0,0,13,2,2,6,1,6,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r([],[],[],[{predicate:!0,params:[],body:" code ",location:{source:void 0,start:{offset:10,line:1,column:11},end:{offset:16,line:1,column:17}}}]))}))})),describe("with labels",(function(){var t="start = a:'a' b:'b' c:'c' &{ code }";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,18,0,2,2,22,0,23,0,15,55,3,18,1,2,2,22,1,23,1,15,40,4,18,2,2,2,22,2,23,2,15,25,4,25,26,0,0,3,2,1,0,13,2,2,6,1,6,3,15,3,4,11,4,9,8,4,7,3,8,3,7,3,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b","c"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1},{type:"literal",value:"c",ignoreCase:!1}],[{predicate:!0,params:["a","b","c"],body:" code ",location:{source:void 0,start:{offset:28,line:1,column:29},end:{offset:34,line:1,column:35}}}]))}))}))})),describe("for semantic_not",(function(){describe("without labels",(function(){var t="start = !{ code }";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([25,26,0,0,0,13,2,2,6,3,6,1]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r([],[],[],[{predicate:!0,params:[],body:" code ",location:{source:void 0,start:{offset:10,line:1,column:11},end:{offset:16,line:1,column:17}}}]))}))})),describe("with labels",(function(){var t="start = a:'a' b:'b' c:'c' !{ code }";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([5,18,0,2,2,22,0,23,0,15,55,3,18,1,2,2,22,1,23,1,15,40,4,18,2,2,2,22,2,23,2,15,25,4,25,26,0,0,3,2,1,0,13,2,2,6,3,6,1,15,3,4,11,4,9,8,4,7,3,8,3,7,3,8,2,7,3,6,7,3]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a","b","c"],[],[{type:"literal",value:"a",ignoreCase:!1},{type:"literal",value:"b",ignoreCase:!1},{type:"literal",value:"c",ignoreCase:!1}],[{predicate:!0,params:["a","b","c"],body:" code ",location:{source:void 0,start:{offset:28,line:1,column:29},end:{offset:34,line:1,column:35}}}]))}))}))})),describe("for rule_ref",(function(){it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(["start = other","other = 'other'"].join("\n"),{rules:[{bytecode:[27,1]},{}]})}))})),describe("for literal",(function(){describe("empty",(function(){var t="start = ''";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([35]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r([],[],[],[]))}))})),describe("non-empty case-sensitive",(function(){var t="start = 'a'";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([18,0,2,2,22,0,23,0]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"a",ignoreCase:!1}],[]))}))})),describe("non-empty case-insensitive",(function(){var t="start = 'A'i";it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([19,0,2,2,21,1,23,0]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r(["a"],[],[{type:"literal",value:"A",ignoreCase:!0}],[]))}))}))})),describe("for class",(function(){it("generates correct bytecode",(function(){expect$e(pass$a).to.changeAST("start = [a]",e([20,0,2,2,21,1,23,0]))})),describe("non-inverted case-sensitive",(function(){it("defines correct constants",(function(){expect$e(pass$a).to.changeAST("start = [a]",r([],[{value:["a"],ignoreCase:!1,inverted:!1}],[{type:"class",value:["a"],ignoreCase:!1,inverted:!1}],[]))}))})),describe("inverted case-sensitive",(function(){it("defines correct constants",(function(){expect$e(pass$a).to.changeAST("start = [^a]",r([],[{value:["a"],ignoreCase:!1,inverted:!0}],[{type:"class",value:["a"],ignoreCase:!1,inverted:!0}],[]))}))})),describe("non-inverted case-insensitive",(function(){it("defines correct constants",(function(){expect$e(pass$a).to.changeAST("start = [a]i",r([],[{value:["a"],ignoreCase:!0,inverted:!1}],[{type:"class",value:["a"],ignoreCase:!0,inverted:!1}],[]))}))})),describe("complex",(function(){it("defines correct constants",(function(){expect$e(pass$a).to.changeAST("start = [ab-def-hij-l]",r([],[{value:["a",["b","d"],"e",["f","h"],"i",["j","l"]],ignoreCase:!1,inverted:!1}],[{type:"class",value:["a",["b","d"],"e",["f","h"],"i",["j","l"]],ignoreCase:!1,inverted:!1}],[]))}))}))})),describe("for any",(function(){var t="start = .";it("generates bytecode",(function(){expect$e(pass$a).to.changeAST(t,e([17,2,2,21,1,23,0]))})),it("defines correct constants",(function(){expect$e(pass$a).to.changeAST(t,r([],[],[{type:"any"}],[]))}))}))}));var __assign=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},__assign.apply(this,arguments)},chai$d=require$$0,pass$9=generateJs,expect$d=chai$d.expect;describe("compiler pass |generateJS|",(function(){describe("coverage",(function(){var e={type:"grammar",rules:[],location:{source:"",start:{line:1,column:1,offset:0},end:{line:1,column:1,offset:0}}},t={};it("throws unless various grammar fields are set",(function(){expect$d((function(){return pass$9(e,t)})).to.throw(Error,"generateJS: generate bytecode was not called."),e.literals=[],expect$d((function(){return pass$9(__assign(__assign({},e),{literals:[]}),t)})).to.throw(Error,"generateJS: generate bytecode was not called."),e.locations=[],expect$d((function(){return pass$9(__assign(__assign({},e),{literals:[]}),t)})).to.throw(Error,"generateJS: generate bytecode was not called."),e.classes=[],expect$d((function(){return pass$9(__assign(__assign({},e),{literals:[]}),t)})).to.throw(Error,"generateJS: generate bytecode was not called."),e.expectations=[],expect$d((function(){return pass$9(__assign(__assign({},e),{literals:[]}),t)})).to.throw(Error,"generateJS: generate bytecode was not called."),e.functions=[],expect$d((function(){return pass$9(e,t)})).to.throw(Error,"generateJS: options.allowedStartRules was not set."),t.allowedStartRules=["start"],expect$d((function(){return pass$9(e,t)})).to.not.throw()}))}))}));var chai$c=require$$0,helpers$8=helpers$a,pass$8=inferenceMatchResult_1;chai$c.use(helpers$8);var expect$c=chai$c.expect;describe("compiler pass |inferenceMatchResult|",(function(){it("calculate |match| property for |any| correctly",(function(){expect$c(pass$8).to.changeAST("start = .",{rules:[{match:0}]})})),it("calculate |match| property for |literal| correctly",(function(){expect$c(pass$8).to.changeAST("start = ''",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''i",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = 'a'",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = 'a'i",{rules:[{match:0}]})})),it("calculate |match| property for |class| correctly",(function(){expect$c(pass$8).to.changeAST("start = []",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []i",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = [a]",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = [a]i",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = [a-b]",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = [a-b]i",{rules:[{match:0}]})})),it("calculate |match| property for |sequence| correctly",(function(){expect$c(pass$8).to.changeAST("start = 'a' 'b'",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = 'a' ''",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = '' 'b'",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = '' ''",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = 'a' []",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = [] 'b'",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = [] []",{rules:[{match:-1}]})})),it("calculate |match| property for |choice| correctly",(function(){expect$c(pass$8).to.changeAST("start = 'a' / 'b'",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = 'a' / ''",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = '' / 'b'",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = '' / ''",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = 'a' / []",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = [] / 'b'",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = [] / []",{rules:[{match:-1}]})})),it("calculate |match| property for predicates correctly",(function(){expect$c(pass$8).to.changeAST("start = &.",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = &''",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = &[]",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = !.",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = !''",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = ![]",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = &{ code }",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = !{ code }",{rules:[{match:0}]})})),it("calculate |match| property for |text| correctly",(function(){expect$c(pass$8).to.changeAST("start = $.",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = $''",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = $[]",{rules:[{match:-1}]})})),it("calculate |match| property for |action| correctly",(function(){expect$c(pass$8).to.changeAST("start = . { code }",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = '' { code }",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = [] { code }",{rules:[{match:-1}]})})),it("calculate |match| property for |labeled| correctly",(function(){expect$c(pass$8).to.changeAST("start = a:.",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = a:''",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = a:[]",{rules:[{match:-1}]})})),it("calculate |match| property for |named| correctly",(function(){expect$c(pass$8).to.changeAST("start 'start' = .",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start 'start' = ''",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start 'start' = []",{rules:[{match:-1}]})})),it("calculate |match| property for |optional| correctly",(function(){expect$c(pass$8).to.changeAST("start = .?",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''?",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []?",{rules:[{match:1}]})})),it("calculate |match| property for |zero_or_more| correctly",(function(){expect$c(pass$8).to.changeAST("start = .*",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''*",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []*",{rules:[{match:1}]})})),it("calculate |match| property for |one_or_more| correctly",(function(){expect$c(pass$8).to.changeAST("start = .+",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''+",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []+",{rules:[{match:-1}]})})),describe("calculate |match| property for |repeated|",(function(){describe("without delimiter",(function(){describe("with constant boundaries",(function(){it("for | .. | correctly",(function(){expect$c(pass$8).to.changeAST("start = .| .. |",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| .. |",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| .. |",{rules:[{match:1}]})})),it("for | ..1| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| ..1|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| ..1|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| ..1|",{rules:[{match:1}]})})),it("for | ..3| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| ..3|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| ..3|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| ..3|",{rules:[{match:1}]})})),it("for |0.. | correctly",(function(){expect$c(pass$8).to.changeAST("start = .|0.. |",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''|0.. |",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []|0.. |",{rules:[{match:1}]})})),it("for |1.. | correctly",(function(){expect$c(pass$8).to.changeAST("start = .|1.. |",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|1.. |",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []|1.. |",{rules:[{match:-1}]})})),it("for |2.. | correctly",(function(){expect$c(pass$8).to.changeAST("start = .|2.. |",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|2.. |",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []|2.. |",{rules:[{match:-1}]})})),it("for |2..3| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|2..3|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|2..3|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []|2..3|",{rules:[{match:-1}]})})),it("for | 42 | correctly",(function(){expect$c(pass$8).to.changeAST("start = .| 42 |",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| 42 |",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| 42 |",{rules:[{match:-1}]})}))})),describe("with variable boundaries",(function(){it("for | ..max| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| ..max|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| ..max|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| ..max|",{rules:[{match:0}]})})),it("for |min.. | correctly",(function(){expect$c(pass$8).to.changeAST("start = .|min.. |",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|min.. |",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|min.. |",{rules:[{match:0}]})})),it("for |min..max| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|min..max|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|min..max|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|min..max|",{rules:[{match:0}]})})),it("for | exact | correctly",(function(){expect$c(pass$8).to.changeAST("start = .|exact|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|exact|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|exact|",{rules:[{match:0}]})}))})),describe("with function boundaries",(function(){it("for | ..{}| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| ..{}|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| ..{}|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| ..{}|",{rules:[{match:0}]})})),it("for |{}.. | correctly",(function(){expect$c(pass$8).to.changeAST("start = .|{}.. |",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|{}.. |",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|{}.. |",{rules:[{match:0}]})})),it("for |{}..{}| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|{}..{}|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|{}..{}|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|{}..{}|",{rules:[{match:0}]})})),it("for | {} | correctly",(function(){expect$c(pass$8).to.changeAST("start = .|{}|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|{}|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|{}|",{rules:[{match:0}]})}))}))})),describe("with delimiter",(function(){describe("with constant boundaries",(function(){it("for | .. , delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| .. , .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = .| .. ,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = .| .. ,[]|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| .. , .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| .. ,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| .. ,[]|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| .. , .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| .. ,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| .. ,[]|",{rules:[{match:1}]})})),it("for | ..1, delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| ..1, .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = .| ..1,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = .| ..1,[]|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| ..1, .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| ..1,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| ..1,[]|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| ..1, .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| ..1,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| ..1,[]|",{rules:[{match:1}]})})),it("for | ..3, delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| ..3, .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = .| ..3,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = .| ..3,[]|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| ..3, .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| ..3,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| ..3,[]|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| ..3, .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| ..3,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []| ..3,[]|",{rules:[{match:1}]})})),it("for |0.. , delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|0.. , .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = .|0.. ,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = .|0.. ,[]|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''|0.. , .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''|0.. ,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''|0.. ,[]|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []|0.. , .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []|0.. ,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []|0.. ,[]|",{rules:[{match:1}]})})),it("for |1.. , delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|1.. , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|1.. ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|1.. ,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|1.. , .|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''|1.. ,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''|1.. ,[]|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = []|1.. , .|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []|1.. ,''|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []|1.. ,[]|",{rules:[{match:-1}]})})),it("for |2.. , delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|2.. , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|2.. ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|2.. ,[]|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = ''|2.. , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|2.. ,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''|2.. ,[]|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []|2.. , .|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []|2.. ,''|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []|2.. ,[]|",{rules:[{match:-1}]})})),it("for |2..3, delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|2..3, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|2..3,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|2..3,[]|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = ''|2..3, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|2..3,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''|2..3,[]|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []|2..3, .|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []|2..3,''|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []|2..3,[]|",{rules:[{match:-1}]})})),it("for | 42 , delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| 42 , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| 42 ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| 42 ,[]|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = ''| 42 , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| 42 ,''|",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ''| 42 ,[]|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []| 42 , .|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []| 42 ,''|",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = []| 42 ,[]|",{rules:[{match:-1}]})}))})),describe("with variable boundaries",(function(){it("for | ..max, delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| ..max, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| ..max,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| ..max,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| ..max, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| ..max,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| ..max,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| ..max, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| ..max,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| ..max,[]|",{rules:[{match:0}]})})),it("for |min.. , delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|min.. , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|min.. ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|min.. ,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|min.. , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|min.. ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|min.. ,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|min.. , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|min.. ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|min.. ,[]|",{rules:[{match:0}]})})),it("for |min..max, delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|min..max, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|min..max,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|min..max,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|min..max, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|min..max,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|min..max,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|min..max, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|min..max,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|min..max,[]|",{rules:[{match:0}]})})),it("for | exact , delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| exact , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| exact ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| exact ,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| exact , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| exact ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| exact ,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| exact , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| exact ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| exact ,[]|",{rules:[{match:0}]})}))})),describe("with function boundaries",(function(){it("for | ..{}, delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| ..{}, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| ..{},''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| ..{},[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| ..{}, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| ..{},''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| ..{},[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| ..{}, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| ..{},''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| ..{},[]|",{rules:[{match:0}]})})),it("for |{}.. , delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|{}.. , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|{}.. ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|{}.. ,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|{}.. , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|{}.. ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|{}.. ,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|{}.. , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|{}.. ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|{}.. ,[]|",{rules:[{match:0}]})})),it("for |{}..{}, delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .|{}..{}, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|{}..{},''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .|{}..{},[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|{}..{}, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|{}..{},''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''|{}..{},[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|{}..{}, .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|{}..{},''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []|{}..{},[]|",{rules:[{match:0}]})})),it("for | {} , delimiter| correctly",(function(){expect$c(pass$8).to.changeAST("start = .| {} , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| {} ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = .| {} ,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| {} , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| {} ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ''| {} ,[]|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| {} , .|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| {} ,''|",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = []| {} ,[]|",{rules:[{match:0}]})}))}))}))})),it("calculate |match| property for |group| correctly",(function(){expect$c(pass$8).to.changeAST("start = (.)",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = ('')",{rules:[{match:1}]}),expect$c(pass$8).to.changeAST("start = ([])",{rules:[{match:-1}]})})),it("calculate |match| property for |rule_ref| correctly",(function(){expect$c(pass$8).to.changeAST(["start = end","end = . "].join("\n"),{rules:[{match:0},{match:0}]}),expect$c(pass$8).to.changeAST(["start = end","end = ''"].join("\n"),{rules:[{match:1},{match:1}]}),expect$c(pass$8).to.changeAST(["start = end","end = []"].join("\n"),{rules:[{match:-1},{match:-1}]}),expect$c(pass$8).to.changeAST("start = . start",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = '' start",{rules:[{match:0}]}),expect$c(pass$8).to.changeAST("start = [] start",{rules:[{match:-1}]}),expect$c(pass$8).to.changeAST("start = . start []",{rules:[{match:-1}]})}))}));var chai$b=require$$0,helpers$7=helpers$a,pass$7=mergeCharacterClasses_1;chai$b.use(helpers$7);var expect$b=chai$b.expect;describe("compiler pass |mergeCharacterClasses|",(function(){it("Merges single character literals, class, and ref_rules",(function(){expect$b(pass$7).to.changeAST(["one = three / $('a' / 'd') / [c-f] / [efh] / [c-h] / [c-g]","two = 'P' / 'P' / three / 'P' / [Q-T]","three = $('x' / [u-w])","four = 'a' / [aaa] / 'a'"].join("\n"),{rules:[{name:"one",expression:{type:"class",parts:["a",["c","h"],["u","x"]],ignoreCase:!1,inverted:!1,location:{start:{line:1,column:7},end:{line:1,column:59}}}},{name:"two",expression:{type:"class",parts:[["P","T"],["u","x"]],ignoreCase:!1,inverted:!1,location:{start:{line:2,column:7},end:{line:2,column:38}}}},{name:"three",expression:{type:"class",parts:[["u","x"]],ignoreCase:!1,inverted:!1,location:{start:{line:3,column:9},end:{line:3,column:23}}}},{name:"four",expression:{type:"literal",value:"a",ignoreCase:!1,location:{start:{line:4,column:8},end:{line:4,column:25}}}}]},{mergeCharacterClasses:!0})})),it("Merges case-independent single character literals, class, and ref_rules",(function(){expect$b(pass$7).to.changeAST(["one = three / $('a'i / 'd'i) / [c-f]i / [efh]i / [c-h]i / [c-g]i","two = 'P'i / 'P'i / three / 'P'i / [Q-T]i","three = $('x'i / [u-w]i)","four = 'a'i / [aaa]i / 'a'i"].join("\n"),{rules:[{name:"one",expression:{type:"class",parts:["a",["c","h"],["u","x"]],ignoreCase:!0,inverted:!1,location:{start:{line:1,column:7},end:{line:1,column:65}}}},{name:"two",expression:{type:"class",parts:[["P","T"],["u","x"]],ignoreCase:!0,inverted:!1,location:{start:{line:2,column:7},end:{line:2,column:42}}}},{name:"three",expression:{type:"class",parts:[["u","x"]],ignoreCase:!0,inverted:!1,location:{start:{line:3,column:9},end:{line:3,column:25}}}},{name:"four",expression:{type:"literal",value:"a",ignoreCase:!0,location:{start:{line:4,column:8},end:{line:4,column:28}}}}]},{mergeCharacterClasses:!0})})),it("Doesn't merge inappropriately",(function(){expect$b(pass$7).to.changeAST(["case = action / 'a'i / [c-g]","invert = action / 'P' / [^Q-T]","action = 'x' { return 42; } / [u-w]"].join("\n"),{rules:[{name:"case",expression:{type:"choice",alternatives:[{type:"rule_ref",name:"action"},{type:"literal",value:"a",ignoreCase:!0},{type:"class",parts:[["c","g"]],ignoreCase:!1,inverted:!1}]}},{name:"invert",expression:{type:"choice",alternatives:[{type:"rule_ref",name:"action"},{type:"literal",value:"P",ignoreCase:!1},{type:"class",parts:[["Q","T"]],ignoreCase:!1,inverted:!0}]}},{name:"action",expression:{type:"choice",alternatives:[{type:"action"},{type:"class",parts:[["u","w"]],ignoreCase:!1,inverted:!1}]}}]},{mergeCharacterClasses:!0})})),it("Handles undefined rule_refs",(function(){expect$b(pass$7).to.changeAST(["start = unknown / 'a' / [c-g]"].join("\n"),{rules:[{name:"start",expression:{type:"choice",alternatives:[{type:"rule_ref",name:"unknown"},{type:"class",parts:["a",["c","g"]],ignoreCase:!1,inverted:!1}]}}]},{mergeCharacterClasses:!0})}))}));var chai$a=require$$0,helpers$6=helpers$a,pass$6=removeProxyRules_1;chai$a.use(helpers$6);var expect$a=chai$a.expect;describe("compiler pass |removeProxyRules|",(function(){describe("when a proxy rule isn't listed in |allowedStartRules|",(function(){it("updates references and removes it",(function(){expect$a(pass$6).to.changeAST(["start = proxy","proxy = proxied","proxied = 'a'"].join("\n"),{rules:[{name:"start",expression:{type:"rule_ref",name:"proxied"}},{name:"proxied"}]},{allowedStartRules:["start"]})}))})),describe("when a proxy rule is listed in |allowedStartRules|",(function(){it("updates references but doesn't remove it",(function(){expect$a(pass$6).to.changeAST(["start = proxy","proxy = proxied","proxied = 'a'"].join("\n"),{rules:[{name:"start",expression:{type:"rule_ref",name:"proxied"}},{name:"proxy",expression:{type:"rule_ref",name:"proxied"}},{name:"proxied"}]},{allowedStartRules:["start","proxy"]})}))}))}));var chai$9=require$$0,helpers$5=helpers$a,pass$5=reportDuplicateLabels_1;chai$9.use(helpers$5);var expect$9=chai$9.expect;describe("compiler pass |reportDuplicateLabels|",(function(){describe("in a sequence",(function(){it("reports labels duplicate with labels of preceding elements",(function(){expect$9(pass$5).to.reportError("start = a:'a' a:'a'",{message:'Label "a" is already defined',location:{source:void 0,start:{offset:14,line:1,column:15},end:{offset:15,line:1,column:16}},diagnostics:[{message:"Original label location",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:9,line:1,column:10}}}]})})),it("doesn't report labels duplicate with labels in subexpressions",(function(){expect$9(pass$5).to.not.reportError("start = ('a' / a:'a' / 'a') a:'a'"),expect$9(pass$5).to.not.reportError("start = (a:'a' { }) a:'a'"),expect$9(pass$5).to.not.reportError("start = ('a' a:'a' 'a') a:'a'"),expect$9(pass$5).to.not.reportError("start = b:(a:'a') a:'a'"),expect$9(pass$5).to.not.reportError("start = $(a:'a') a:'a'"),expect$9(pass$5).to.not.reportError("start = &(a:'a') a:'a'"),expect$9(pass$5).to.not.reportError("start = !(a:'a') a:'a'"),expect$9(pass$5).to.not.reportError("start = (a:'a')? a:'a'"),expect$9(pass$5).to.not.reportError("start = (a:'a')* a:'a'"),expect$9(pass$5).to.not.reportError("start = (a:'a')+ a:'a'"),expect$9(pass$5).to.not.reportError("start = (a:'a')|2..3| a:'a'"),expect$9(pass$5).to.not.reportError("start = 'a'|2..3, a:'a'| a:'a'"),expect$9(pass$5).to.not.reportError("start = (a:'a') a:'a'")}))})),describe("in a choice",(function(){it("doesn't report labels duplicate with labels of preceding alternatives",(function(){expect$9(pass$5).to.not.reportError("start = a:'a' / a:'a'")}))})),describe("in outer sequence",(function(){it("reports labels duplicate with labels of preceding elements",(function(){expect$9(pass$5).to.reportError("start = a:'a' (a:'a')",{message:'Label "a" is already defined',location:{source:void 0,start:{offset:15,line:1,column:16},end:{offset:16,line:1,column:17}},diagnostics:[{message:"Original label location",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:9,line:1,column:10}}}]})})),it("doesn't report labels duplicate with the label of the current element",(function(){expect$9(pass$5).to.not.reportError("start = a:(a:'a')")})),it("doesn't report labels duplicate with labels of following elements",(function(){expect$9(pass$5).to.not.reportError("start = (a:'a') a:'a'")}))}))}));var chai$8=require$$0,helpers$4=helpers$a,pass$4=reportDuplicateRules_1;chai$8.use(helpers$4);var expect$8=chai$8.expect;describe("compiler pass |reportDuplicateRules|",(function(){it("reports duplicate rules",(function(){expect$8(pass$4).to.reportError(["start = 'a'","start = 'b'"].join("\n"),{message:'Rule "start" is already defined',location:{source:void 0,start:{offset:12,line:2,column:1},end:{offset:17,line:2,column:6}},diagnostics:[{message:"Original rule location",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}}]})}))}));var chai$7=require$$0,helpers$3=helpers$a,pass$3=reportIncorrectPlucking_1;chai$7.use(helpers$3);var expect$7=chai$7.expect;describe("compiler pass |reportIncorrectPlucking|",(function(){it('prevents "@" from being used with an action block',(function(){expect$7(pass$3).to.reportError("start1 = 'a' @'b' 'c' { /* empty action block */ }",{message:'"@" cannot be used with an action block',location:{source:void 0,start:{offset:13,line:1,column:14},end:{offset:14,line:1,column:15}},diagnostics:[{message:"Action block location",location:{source:void 0,start:{offset:23,line:1,column:24},end:{offset:49,line:1,column:50}}}]}),expect$7(pass$3).to.reportError("start2 = 'a' @('b' @'c' { /* empty action block */ })",{message:'"@" cannot be used with an action block',location:{source:void 0,start:{offset:19,line:1,column:20},end:{offset:20,line:1,column:21}},diagnostics:[{message:"Action block location",location:{source:void 0,start:{offset:25,line:1,column:26},end:{offset:51,line:1,column:52}}}]})})),it("allows valid plucking",(function(){expect$7(pass$3).not.to.reportError("\n\n start1 = @'1' // return '1'\n start2 = @'1' / @'2' // return '1' or '2'\n start2 = '1' @'2' '3' // return '2'\n start3 = '1' @b:'2' '3' // return '2', label \"b\" can be used in semantic predicates\n start4 = a:'1' @b:'2' '3' // return '2', labels \"a\" and \"b\" can be used in semantic predicates\n start5 = @'1' @'2' '3' // return ['1', '2']\n start6 = @'1' @b:'2' '3' // return ['1', '2'], label \"b\" can be used in semantic predicates\n start7 = a:'1' @'2' &{} // return '2' if the semantic predicate doesnt fail\n start8 = @a:$[a-z]i+ &{ return a === 'foo' } // return \"foo\"\n\n ")}))}));var chai$6=require$$0,helpers$2=helpers$a,pass$2=reportInfiniteRecursion_1;chai$6.use(helpers$2);var expect$6=chai$6.expect;describe("compiler pass |reportInfiniteRecursion|",(function(){it("reports direct left recursion",(function(){expect$6(pass$2).to.reportError("start = start",{message:"Possible infinite loop when parsing (left recursion: start -> start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),it("reports indirect left recursion",(function(){expect$6(pass$2).to.reportError(["start = stop","stop = start"].join("\n"),{message:"Possible infinite loop when parsing (left recursion: start -> stop -> start)",location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:5,line:1,column:6}}})})),describe("in sequences",(function(){it("reports left recursion if all preceding elements match empty string",(function(){expect$6(pass$2).to.reportError("start = '' '' '' start")})),it("doesn't report left recursion if some preceding element doesn't match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a' '' '' start"),expect$6(pass$2).to.not.reportError("start = '' 'a' '' start"),expect$6(pass$2).to.not.reportError("start = '' '' 'a' start")})),it("reports left recursion when rule reference is wrapped in an expression",(function(){expect$6(pass$2).to.reportError("start = '' start?")})),it("computes expressions that always consume input on success correctly",(function(){expect$6(pass$2).to.reportError(["start = a start","a 'a' = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a 'a' = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = ('' / 'a' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / '' / 'b') start"),expect$6(pass$2).to.reportError("start = ('a' / 'b' / '') start"),expect$6(pass$2).to.not.reportError("start = ('a' / 'b' / 'c') start"),expect$6(pass$2).to.reportError("start = ('' { }) start"),expect$6(pass$2).to.not.reportError("start = ('a' { }) start"),expect$6(pass$2).to.reportError("start = ('' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('a' '' '') start"),expect$6(pass$2).to.not.reportError("start = ('' 'a' '') start"),expect$6(pass$2).to.not.reportError("start = ('' '' 'a') start"),expect$6(pass$2).to.reportError("start = a:'' start"),expect$6(pass$2).to.not.reportError("start = a:'a' start"),expect$6(pass$2).to.reportError("start = $'' start"),expect$6(pass$2).to.not.reportError("start = $'a' start"),expect$6(pass$2).to.reportError("start = &'' start"),expect$6(pass$2).to.reportError("start = &'a' start"),expect$6(pass$2).to.reportError("start = !'' start"),expect$6(pass$2).to.reportError("start = !'a' start"),expect$6(pass$2).to.reportError("start = ''? start"),expect$6(pass$2).to.reportError("start = 'a'? start"),expect$6(pass$2).to.reportError("start = ''* start"),expect$6(pass$2).to.reportError("start = 'a'* start"),expect$6(pass$2).to.reportError("start = ''+ start"),expect$6(pass$2).to.not.reportError("start = 'a'+ start"),expect$6(pass$2).to.reportError("start = ''| .. | start"),expect$6(pass$2).to.reportError("start = ''|0.. | start"),expect$6(pass$2).to.reportError("start = ''|1.. | start"),expect$6(pass$2).to.reportError("start = ''|2.. | start"),expect$6(pass$2).to.reportError("start = ''| ..1| start"),expect$6(pass$2).to.reportError("start = ''| ..3| start"),expect$6(pass$2).to.reportError("start = ''|2..3| start"),expect$6(pass$2).to.reportError("start = ''| 42 | start"),expect$6(pass$2).to.reportError("start = 'a'| .. | start"),expect$6(pass$2).to.reportError("start = 'a'|0.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. | start"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. | start"),expect$6(pass$2).to.reportError("start = 'a'| ..1| start"),expect$6(pass$2).to.reportError("start = 'a'| ..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3| start"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 | start"),expect$6(pass$2).to.reportError("start = ('') start"),expect$6(pass$2).to.not.reportError("start = ('a') start"),expect$6(pass$2).to.reportError("start = &{ } start"),expect$6(pass$2).to.reportError("start = !{ } start"),expect$6(pass$2).to.reportError(["start = a start","a = ''"].join("\n")),expect$6(pass$2).to.not.reportError(["start = a start","a = 'a'"].join("\n")),expect$6(pass$2).to.reportError("start = '' start"),expect$6(pass$2).to.not.reportError("start = 'a' start"),expect$6(pass$2).to.not.reportError("start = [a-d] start"),expect$6(pass$2).to.not.reportError("start = . start")}))})),describe("in repeated with delimiter",(function(){it("doesn't report left recursion for delimiter if expression not match empty string",(function(){expect$6(pass$2).to.not.reportError("start = 'a'| .. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|0.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|1.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2.. , start|"),expect$6(pass$2).to.not.reportError("start = 'a'| ..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'|2..3, start|"),expect$6(pass$2).to.not.reportError("start = 'a'| 42 , start|")})),it("reports left recursion for delimiter if expression match empty string",(function(){expect$6(pass$2).to.reportError("start = ''| .. , start|"),expect$6(pass$2).to.reportError("start = ''|0.. , start|"),expect$6(pass$2).to.reportError("start = ''|1.. , start|"),expect$6(pass$2).to.reportError("start = ''|2.. , start|"),expect$6(pass$2).to.reportError("start = ''| ..3, start|"),expect$6(pass$2).to.reportError("start = ''|2..3, start|"),expect$6(pass$2).to.reportError("start = ''| 42 , start|")}))}))}));var chai$5=require$$0,helpers$1=helpers$a,pass$1=reportInfiniteRepetition_1;chai$5.use(helpers$1);var expect$5=chai$5.expect;describe("compiler pass |reportInfiniteRepetition|",(function(){it("reports infinite loops for zero_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')*",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),it("reports infinite loops for one_or_more",(function(){expect$5(pass$1).to.reportError("start = ('')+",{message:"Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:13,line:1,column:14}}})})),describe("reports infinite loops for repeated",(function(){describe("without delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:16,line:1,column:17}}}),expect$5(pass$1).to.reportError("start = ('')|0..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|1..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.reportError("start = ('')|2..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 |")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:19,line:1,column:20}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2|"),expect$5(pass$1).to.not.reportError("start = ('')|len|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}..|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:18,line:1,column:19}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}|"),expect$5(pass$1).to.not.reportError("start = ('')|{}|")}))})),describe("with empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')| .., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|0.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|1.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.reportError("start = ('')|2.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:21,line:1,column:22}}}),expect$5(pass$1).to.not.reportError("start = ('')| ..1, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, ''|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , ''|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|len.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:23,line:1,column:24}}}),expect$5(pass$1).to.not.reportError("start = ('')|..len, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|len, ''|")})),it("with function boundaries",(function(){expect$5(pass$1).to.reportError("start = ('')|{}.., ''|",{message:"Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:22,line:1,column:23}}}),expect$5(pass$1).to.not.reportError("start = ('')|..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, ''|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, ''|")}))})),describe("with non-empty delimiter",(function(){it("with constant boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')| .., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|0.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|1.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..1, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| ..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|2..3, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')| 42 , 'a'|")})),it("with variable boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|len.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..len, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len1..len2, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|len, 'a'|")})),it("with function boundaries",(function(){expect$5(pass$1).to.not.reportError("start = ('')|{}.., 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}..{}, 'a'|"),expect$5(pass$1).to.not.reportError("start = ('')|{}, 'a'|")}))}))})),it("computes expressions that always consume input on success correctly",(function(){expect$5(pass$1).to.reportError(["start = a*","a 'a' = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a 'a' = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ('' / 'a' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / '' / 'b')*"),expect$5(pass$1).to.reportError("start = ('a' / 'b' / '')*"),expect$5(pass$1).to.not.reportError("start = ('a' / 'b' / 'c')*"),expect$5(pass$1).to.reportError("start = ('' { })*"),expect$5(pass$1).to.not.reportError("start = ('a' { })*"),expect$5(pass$1).to.reportError("start = ('' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('a' '' '')*"),expect$5(pass$1).to.not.reportError("start = ('' 'a' '')*"),expect$5(pass$1).to.not.reportError("start = ('' '' 'a')*"),expect$5(pass$1).to.reportError("start = (a:'')*"),expect$5(pass$1).to.not.reportError("start = (a:'a')*"),expect$5(pass$1).to.reportError("start = ($'')*"),expect$5(pass$1).to.not.reportError("start = ($'a')*"),expect$5(pass$1).to.reportError("start = (&'')*"),expect$5(pass$1).to.reportError("start = (&'a')*"),expect$5(pass$1).to.reportError("start = (!'')*"),expect$5(pass$1).to.reportError("start = (!'a')*"),expect$5(pass$1).to.reportError("start = (''?)*"),expect$5(pass$1).to.reportError("start = ('a'?)*"),expect$5(pass$1).to.reportError("start = (''*)*"),expect$5(pass$1).to.reportError("start = ('a'*)*"),expect$5(pass$1).to.reportError("start = (''+)*"),expect$5(pass$1).to.not.reportError("start = ('a'+)*"),expect$5(pass$1).to.reportError("start = ('')*"),expect$5(pass$1).to.not.reportError("start = ('a')*"),expect$5(pass$1).to.reportError("start = (&{ })*"),expect$5(pass$1).to.reportError("start = (!{ })*"),expect$5(pass$1).to.reportError("start = 'a'|.., ('')*|"),expect$5(pass$1).to.not.reportError("start = 'a'|.., ('b')*|"),expect$5(pass$1).to.reportError(["start = a*","a = ''"].join("\n")),expect$5(pass$1).to.not.reportError(["start = a*","a = 'a'"].join("\n")),expect$5(pass$1).to.reportError("start = ''*"),expect$5(pass$1).to.not.reportError("start = 'a'*"),expect$5(pass$1).to.not.reportError("start = [a-d]*"),expect$5(pass$1).to.not.reportError("start = .*")}))}));var chai$4=require$$0,helpers=helpers$a,pass=reportUndefinedRules_1;chai$4.use(helpers);var expect$4=chai$4.expect;describe("compiler pass |reportUndefinedRules|",(function(){it("reports undefined rules",(function(){expect$4(pass).to.reportError("start = undefined",{message:'Rule "undefined" is not defined',location:{source:void 0,start:{offset:8,line:1,column:9},end:{offset:17,line:1,column:18}}})}))}));var chai$3=require$$0,Stack=stack,expect$3=chai$3.expect;describe("utility class Stack",(function(){describe("for an empty stack",(function(){var e=void 0;beforeEach((function(){e=new Stack("rule","v","let",[42])})),describe("throws an error when attempting",(function(){it("`pop`",(function(){expect$3((function(){return e.pop()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v<x>' at an index -1.\nBytecode: 42")})),it("`top`",(function(){expect$3((function(){return e.top()})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v<x>' at an index -1.\nBytecode: 42")})),it("`result`",(function(){expect$3((function(){return e.result()})).to.throw(RangeError,"Rule 'rule': The variable stack is empty, can't get the result")})),it("`index`",(function(){expect$3((function(){return e.index(-2)})).to.throw(RangeError,"Rule 'rule': The variable stack overflow: attempt to get a variable at a negative index -2.\nBytecode: 42"),expect$3((function(){return e.index(0)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v<x>' at an index -1.\nBytecode: 42"),expect$3((function(){return e.index(2)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v<x>' at an index -3.\nBytecode: 42")})),it("`sourceMapPop`",(function(){expect$3((function(){return e.sourceMapPop()})).to.throw(RangeError,"Rule 'rule': Attempting to pop an empty source map stack.\nBytecode: 42")}))})),it("`defines` returns an empty string",(function(){expect$3(e.defines()).to.equal("")}))})),it("throws an error when attempting `pop` more than `push`",(function(){var e=new Stack("rule","v","let",[42]);e.push("1"),expect$3((function(){return e.pop(3)})).to.throw(RangeError,"Rule 'rule': The variable stack underflow: attempt to use a variable 'v<x>' at an index -2.\nBytecode: 42")})),it("returns a variable with an index 0 for `result`",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),expect$3(e.result()).to.equal("v0")})),it("`defines` returns a define expression for all used variables",(function(){var e=new Stack("rule","v","let",[]);e.push("1"),e.push("2"),e.pop(),e.push("3"),expect$3(e.defines()).to.equal("let v0, v1;")})),describe("`checkedIf` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),describe("does not throws an error",(function(){it("without the else brach",(function(){expect$3((function(){return e.checkedIf(0,(function(){}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.pop()}))})).to.not.throw(),expect$3((function(){return e.checkedIf(0,(function(){return e.push("2")}))})).to.not.throw()})),describe("when the stack pointer",(function(){it("was not moving in both the arms",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedIf(0,t,t)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,r,r)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,a,a)})).to.not.throw(),expect$3((function(){return e.checkedIf(0,n,n)})).to.not.throw()})),it("increases on the same value in both the arms",(function(){expect$3((function(){return e.checkedIf(0,(function(){return e.push("1")}),(function(){return e.push("2")}))})).to.not.throw()})),it("decreases on the same value in both the arms",(function(){e.push("2"),expect$3((function(){return e.checkedIf(0,(function(){return e.pop(2)}),(function(){e.pop(),e.pop()}))})).to.not.throw()}))}))})),describe("throws an error when the stack pointer",(function(){it("was not moving in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: -1). Bytecode: 42")})),it("decreases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 0). Bytecode: 42")})),it("was not moving in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 0, after else: 1). Bytecode: 42")})),it("increases in `if` and was not moving in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: 0). Bytecode: 42")})),it("decreases in `if` and increases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.pop()}),(function(){return e.push("2")}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: -1, after else: 1). Bytecode: 42")})),it("increases in `if` and decreases in `then`",(function(){expect$3((function(){e.checkedIf(0,(function(){return e.push("2")}),(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Branches of a condition can't move the stack pointer differently (before: 0, after then: 1, after else: -1). Bytecode: 42")}))}))})),describe("`checkedLoop` method",(function(){var e=void 0;beforeEach((function(){(e=new Stack("rule","v","let",[42])).push("1")})),it("does not throws an error when the stack pointer was not moving",(function(){function t(){}function r(){e.push("1"),e.pop()}function a(){e.push("1"),e.push("2"),e.pop(2)}function n(){e.push("1"),e.pop(),e.push("2"),e.pop()}expect$3((function(){return e.checkedLoop(0,t)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,r)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,a)})).to.not.throw(),expect$3((function(){return e.checkedLoop(0,n)})).to.not.throw()})),it("throws an error when the stack pointer increases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.push("1")}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: 1). Bytecode: 42")})),it("throws an error when the stack pointer decreases",(function(){expect$3((function(){return e.checkedLoop(0,(function(){return e.pop()}))})).to.throw(Error,"Rule 'rule', position 0: Body of a loop can't move the stack pointer (before: 0, after: -1). Bytecode: 42")}))})),describe("SourceNode handling",(function(){it("sourceNode handles unknown column",(function(){expect$3(Stack.sourceNode({source:"",start:{line:1,column:0,offset:0},end:{line:1,column:0,offset:0}},["foo"],"test").column).to.equal(null)}))}))}));var chai$2=require$$0,_a$1=utils$1,hex=_a$1.hex,stringEscape=_a$1.stringEscape,regexpClassEscape=_a$1.regexpClassEscape,base64=_a$1.base64,expect$2=chai$2.expect;describe("utility functions",(function(){it("hex",(function(){expect$2(hex("0")).to.equal("30"),expect$2(hex("\0")).to.equal("0"),expect$2(hex("\n")).to.equal("A"),expect$2(hex("\ufeff")).to.equal("FEFF")})),it("stringEscape",(function(){expect$2(stringEscape("abc")).to.equal("abc"),expect$2(stringEscape('\\"\0\b\t\n\v\f\r')).to.equal('\\\\\\"\\0\\b\\t\\n\\v\\f\\r'),expect$2(stringEscape("")).to.equal("\\x01\\x0F"),expect$2(stringEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(stringEscape("Ā")).to.equal("\\u0100\\u0FFF"),expect$2(stringEscape("က")).to.equal("\\u1000\\uFFFF")})),it("regexpClassEscape",(function(){expect$2(regexpClassEscape("\\\0\b\t\n\v\f\r")).to.equal("\\\\\\0\\b\\t\\n\\v\\f\\r"),expect$2(regexpClassEscape("/]^-")).to.equal("\\/\\]\\^\\-"),expect$2(regexpClassEscape("")).to.equal("\\x01\\x0F"),expect$2(regexpClassEscape("")).to.equal("\\x10\\x1F\\x7F"),expect$2(regexpClassEscape("Ā")).to.equal("\\u0100\\u0FFF"),expect$2(regexpClassEscape("က")).to.equal("\\u1000\\uFFFF")})),it("base64",(function(){expect$2(base64(new Uint8Array([]))).to.equal(""),expect$2(base64(new Uint8Array([97]))).to.equal("YQ=="),expect$2(base64(new Uint8Array([97,98]))).to.equal("YWI="),expect$2(base64(new Uint8Array([97,98,99]))).to.equal("YWJj"),expect$2(base64(new Uint8Array([97,98,99,100]))).to.equal("YWJjZA=="),expect$2(base64(new Uint8Array([97,98,99,100,101]))).to.equal("YWJjZGU="),expect$2(base64(new Uint8Array([97,98,99,100,101,102]))).to.equal("YWJjZGVm")}))}));var chai$1=require$$0,_a=peg_1,GrammarError=_a.GrammarError,GrammarLocation=_a.GrammarLocation,expect$1=chai$1.expect,location={source:void 0,start:{offset:0,line:1,column:1},end:{offset:4,line:1,column:5}};describe("Grammar Errors",(function(){it("might not have a location",(function(){var e=new GrammarError("message");expect$1(e.location).to.equal(void 0),expect$1(e.toString()).to.equal("GrammarError: message")})),it("might have locations",(function(){location.source=void 0;var e=new GrammarError("message",location);expect$1(e.location).to.eql(location),expect$1(e.toString()).to.equal("GrammarError: message\n at 1:1"),e=new GrammarError("message",null,[{message:"Subinfo",location:location}]),expect$1(e.location).to.equal(null),expect$1(e.toString()).to.equal("GrammarError: message\n from 1:1: Subinfo"),location.source="foo.peggy",e=new GrammarError("message",location,[{message:"Subinfo",location:location}]),expect$1(e.toString()).to.equal("GrammarError: message\n at foo.peggy:1:1\n from foo.peggy:1:1: Subinfo")})),describe("formats",(function(){var e={source:"foo.peggy",text:"some error\nthat"},t={source:"foo.peggy",start:{offset:5,line:1,column:6},end:{offset:11,line:2,column:1}},r=[{message:"Subinfo",location:t}];describe("single problem",(function(){describe("with main location",(function(){location.source="foo.peggy";var t=new GrammarError("message",location,r);it("with zero-length error at the end",(function(){var t=new GrammarError("message",{source:"foo.peggy",start:{offset:4,line:1,column:5},end:{offset:4,line:1,column:5}});expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:5\n |\n1 | some error\n | ^")})),it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo")}))})),describe("without main location",(function(){var t=new GrammarError("message",null,r);it("with source",(function(){expect$1(t.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(t.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo")}))}))})),describe("several problems",(function(){describe("with main location",(function(){location.source="foo.peggy";var a=new GrammarError("message",location,r);a.problems.push(["warning","Warning message",t,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("null source text",(function(){expect$1(a.format([{source:null,text:null}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo"),expect$1(a.format([{source:null,text:void 0}])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")})),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\n --\x3e foo.peggy:1:1\n |\n1 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("with GrammarLocation",(function(){var r=new GrammarLocation("foo.peggy",{offset:12,line:15,column:8});expect$1(String(r)).to.equal("foo.peggy"),location.source=r,t.source=r,a.diagnostics.push({message:"Column not offset",location:{source:r,start:{offset:11,line:2,column:1},end:{offset:15,line:2,column:5}}}),expect$1(a.format([{source:r,text:e.text}])).to.equal("error: message\n --\x3e foo.peggy:15:8\n |\n15 | some error\n | ^^^^\nnote: Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Column not offset\n --\x3e foo.peggy:16:1\n |\n16 | that\n | ^^^^\n\nwarning: Warning message\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^\nnote: Warning Subinfo\n --\x3e foo.peggy:15:13\n |\n15 | some error\n | ^^^^^"),location.source="foo.peggy",t.source="foo.peggy",a.diagnostics.pop()})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:1\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6\n at foo.peggy:1:6: Warning Subinfo")}))})),describe("without main location",(function(){var a=new GrammarError("message",null,r);a.problems.push(["warning","Warning message",null,[{message:"Warning Subinfo",location:t}]]),a.problems.push(["info","Info message",null,[]]),it("with source",(function(){expect$1(a.format([e])).to.equal("error: message\nnote: Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^\n\nwarning: Warning message\nnote: Warning Subinfo\n --\x3e foo.peggy:1:6\n |\n1 | some error\n | ^^^^^")})),it("without source",(function(){expect$1(a.format([])).to.equal("error: message\n at foo.peggy:1:6: Subinfo\n\nwarning: Warning message\n at foo.peggy:1:6: Warning Subinfo")}))}))}))}))}));var __spreadArray=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n<o;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))},chai=require$$0,parser=parser$4,expect=chai.expect;describe("Peggy grammar parser",(function(){var e={type:"literal",value:"abcd",ignoreCase:!1},t={type:"literal",value:"efgh",ignoreCase:!1},r={type:"literal",value:"ijkl",ignoreCase:!1},a={type:"literal",value:"mnop",ignoreCase:!1},n={type:"semantic_and",code:" code "},o={type:"semantic_not",code:" code "},s={type:"optional",expression:e},c={type:"zero_or_more",expression:e},i={type:"one_or_more",expression:e},u={type:"text",expression:s},p={type:"simple_not",expression:e},l={type:"simple_and",expression:s},f={type:"simple_not",expression:s},g={type:"labeled",label:"a",expression:e},d={type:"labeled",label:"b",expression:t},m={type:"labeled",label:"a",expression:p},$={type:"sequence",elements:[e,t,r]},h={type:"sequence",elements:[g,d]},x={type:"sequence",elements:[g,d,{type:"labeled",label:"c",expression:r},{type:"labeled",label:"d",expression:a}]},b={type:"group",expression:g},v={type:"group",expression:$},A={type:"action",expression:e,code:" code "},y={type:"action",expression:t,code:" code "},S={type:"action",expression:$,code:" code "},_={type:"choice",alternatives:[e,t,r]},E={type:"choice",alternatives:[A,y]},T={type:"choice",alternatives:[A,y,{type:"action",expression:r,code:" code "},{type:"action",expression:a,code:" code "}]},C={type:"named",name:"start rule",expression:e},P={type:"rule",name:"a",expression:e},w={type:"rule",name:"b",expression:t},R={type:"rule",name:"c",expression:r},L={type:"rule",name:"start",expression:e},F={type:"top_level_initializer",code:" top level code "},O={type:"initializer",code:" code "};function B(e){return{type:"grammar",topLevelInitializer:null,initializer:null,rules:[{type:"rule",name:"start",expression:e}]}}function M(t){return B({type:"action",expression:e,code:t})}function D(e,t){return B({type:"literal",value:e,ignoreCase:t})}function k(e,t,r){return B({type:"class",parts:e,inverted:t,ignoreCase:r})}function I(){return B({type:"any"})}function j(e){return B({type:"rule_ref",name:e})}function N(t,r,a,n){return void 0===a&&(a="variable"),void 0===n&&(n=null),B({type:"repeated",min:{type:"string"==typeof t?a:"constant",value:t},max:{type:"string"==typeof r?a:"constant",value:r},expression:e,delimiter:n})}function U(e,t){return N(e,t,"function")}function q(e,r){return N(e,r,"variable",t)}function G(e,r){return N(e,r,"function",t)}var H=D("abcd",!1),z={type:"grammar",topLevelInitializer:null,initializer:null,rules:[P,w]},W=function(){function e(e){delete e.location,delete e.codeLocation,delete e.nameLocation,delete e.labelLocation}function t(e){delete e.location,delete e.codeLocation,delete e.nameLocation,delete e.labelLocation,n(e.expression)}function r(e){return function(t){delete t.location,delete t.codeLocation,delete t.nameLocation,delete t.labelLocation,t[e].forEach(n)}}var a,n=(a={grammar:function(e){delete e.location,delete e.codeLocation,delete e.nameLocation,delete e.labelLocation,e.topLevelInitializer&&n(e.topLevelInitializer),e.initializer&&n(e.initializer),e.rules.forEach(n)},top_level_initializer:e,initializer:e,rule:t,named:t,choice:r("alternatives"),action:t,sequence:r("elements"),labeled:t,text:t,simple_and:t,simple_not:t,optional:t,zero_or_more:t,one_or_more:t,repeated:function(e){e.min&&(delete e.min.location,delete e.min.codeLocation),delete e.max.location,delete e.max.codeLocation,delete e.location,n(e.expression),e.delimiter&&(delete e.delimiter.location,n(e.delimiter))},group:t,semantic_and:e,semantic_not:e,rule_ref:e,literal:e,class:e,any:e},function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return a[e.type].apply(a,__spreadArray([e],t,!1))});return n}();function V(e,t){var r=e.Assertion;r.addMethod("parseAs",(function(e){var r=parser.parse(t.flag(this,"object"));W(r),this.assert(t.eql(r,e),"expected #{this} to parse as #{exp} but got #{act}","expected #{this} to not parse as #{exp}",e,r,!t.flag(this,"negate"))})),r.addMethod("failToParse",(function(e){var a=void 0,n=void 0;try{n=parser.parse(t.flag(this,"object")),a=!0}catch(e){n=e,a=!1}a&&W(n),this.assert(!a,"expected #{this} to fail to parse but got #{act}","expected #{this} to not fail to parse but it failed with #{act}",null,n),a||void 0===e||Object.keys(e).forEach((function(t){new r(n).to.have.property(t).that.is.deep.equal(e[t])}))}))}beforeEach((function(){chai.use(V)})),it("parses Grammar",(function(){expect("\na = 'abcd';\n").to.parseAs({type:"grammar",topLevelInitializer:null,initializer:null,rules:[P]}),expect("\na = 'abcd'; /* comment */; // comment\n;\nb = 'efgh';\nc = 'ijkl';\n").to.parseAs({type:"grammar",topLevelInitializer:null,initializer:null,rules:[P,w,R]}),expect("\n{ code };\na = 'abcd';\n").to.parseAs({type:"grammar",topLevelInitializer:null,initializer:O,rules:[P]}),expect("\n{{ top level code }};\na = 'abcd';\n").to.parseAs({type:"grammar",topLevelInitializer:F,initializer:null,rules:[P]}),expect("\n{{ top level code }};\n{ code };\na = 'abcd';\n").to.parseAs({type:"grammar",topLevelInitializer:F,initializer:O,rules:[P]})})),it("parses Top-Level Initializer",(function(){expect("{{ top level code }};start = 'abcd'").to.parseAs({type:"grammar",topLevelInitializer:F,initializer:null,rules:[L]})})),it("parses Initializer",(function(){expect("{ code };start = 'abcd'").to.parseAs({type:"grammar",topLevelInitializer:null,initializer:O,rules:[L]})})),it("parses Rule",(function(){expect("start\n=\n'abcd';").to.parseAs(B(e)),expect("start\n'start rule'\n=\n'abcd';").to.parseAs(B(C))})),it("parses Expression",(function(){expect("start = 'abcd' / 'efgh' / 'ijkl'").to.parseAs(B(_))})),it("parses ChoiceExpression",(function(){expect("start = 'abcd' { code }").to.parseAs(B(A)),expect("start = 'abcd' { code }\n/\n'efgh' { code }").to.parseAs(B(E)),expect("start = 'abcd' { code }\n/\n'efgh' { code }\n/\n'ijkl' { code }\n/\n'mnop' { code }").to.parseAs(B(T))})),it("parses ActionExpression",(function(){expect("start = 'abcd' 'efgh' 'ijkl'").to.parseAs(B($)),expect("start = 'abcd' 'efgh' 'ijkl'\n{ code }").to.parseAs(B(S))})),it("parses SequenceExpression",(function(){expect("start = a:'abcd'").to.parseAs(B(g)),expect("start = a:'abcd'\nb:'efgh'").to.parseAs(B(h)),expect("start = a:'abcd'\nb:'efgh'\nc:'ijkl'\nd:'mnop'").to.parseAs(B(x))})),it("parses `@` (value plucking)",(function(){function n(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return B({type:"sequence",elements:e})}function o(e,t){return{type:"labeled",pick:!0,label:e,expression:t}}expect("start = @'abcd'").to.parseAs(n(o(null,e))),expect("start = @a:'abcd'").to.parseAs(n(o("a",e))),expect("start = 'abcd' @'efgh'").to.parseAs(n(e,o(null,t))),expect("start = a:'abcd' @b:'efgh'").to.parseAs(n(g,o("b",t))),expect("start = @'abcd' b:'efgh'").to.parseAs(n(o(null,e),d)),expect("start = a:'abcd' @'efgh' 'ijkl' @d:'mnop'").to.parseAs(n(g,o(null,t),r,o("d",a)))})),it("parses LabeledExpression",(function(){expect("start = a\n:\n!'abcd'").to.parseAs(B(m)),expect("start = !'abcd'").to.parseAs(B(p))})),it("parses PrefixedExpression",(function(){expect("start = !\n'abcd'?").to.parseAs(B(f)),expect("start = 'abcd'?").to.parseAs(B(s))})),it("parses PrefixedOperator",(function(){expect("start = $'abcd'?").to.parseAs(B(u)),expect("start = &'abcd'?").to.parseAs(B(l)),expect("start = !'abcd'?").to.parseAs(B(f))})),it("parses SuffixedExpression",(function(){expect("start = 'abcd'\n?").to.parseAs(B(s)),expect("start = 'abcd'").to.parseAs(B(e))})),it("parses SuffixedOperator",(function(){expect("start = 'abcd'?").to.parseAs(B(s)),expect("start = 'abcd'*").to.parseAs(B(c)),expect("start = 'abcd'+").to.parseAs(B(i))})),it("parses PrimaryExpression",(function(){expect("start = 'abcd'").to.parseAs(H),expect("start = [a-d]").to.parseAs(k([["a","d"]],!1,!1)),expect("start = .").to.parseAs(I()),expect("start = a").to.parseAs(j("a")),expect("start = &{ code }").to.parseAs(B(n)),expect("start = (\na:'abcd'\n)").to.parseAs(B(b)),expect("start = (\n'abcd' 'efgh' 'ijkl'\n)").to.parseAs(B(v)),expect("start = (\n'abcd'\n)").to.parseAs(H)})),describe("parses RepeatedExpression",(function(){describe("without delimiter",(function(){it("with constant boundaries",(function(){var t=N(2,3);expect("start = 'abcd'|2..3| ").to.parseAs(t),expect("start = 'abcd'\n|2..3|").to.parseAs(t),expect("start = 'abcd'|\n2..3|").to.parseAs(t),expect("start = 'abcd'|2\n..3|").to.parseAs(t),expect("start = 'abcd'|2..\n3|").to.parseAs(t),expect("start = 'abcd'|2..3\n|").to.parseAs(t),t=B({type:"repeated",min:null,max:{type:"constant",value:3},expression:e,delimiter:null}),expect("start = 'abcd'\n|3|").to.parseAs(t),expect("start = 'abcd'|\n3|").to.parseAs(t),expect("start = 'abcd'|3\n|").to.parseAs(t)})),it("with variable boundaries",(function(){var t=N("min","max");expect("start = 'abcd'|min..max| ").to.parseAs(t),expect("start = 'abcd'\n|min..max|").to.parseAs(t),expect("start = 'abcd'|\nmin..max|").to.parseAs(t),expect("start = 'abcd'|min\n..max|").to.parseAs(t),expect("start = 'abcd'|min..\nmax|").to.parseAs(t),expect("start = 'abcd'|min..max\n|").to.parseAs(t),t=B({type:"repeated",min:null,max:{type:"variable",value:"exact"},expression:e,delimiter:null}),expect("start = 'abcd'\n|exact|").to.parseAs(t),expect("start = 'abcd'|\nexact|").to.parseAs(t),expect("start = 'abcd'|exact\n|").to.parseAs(t)})),it("with function boundaries",(function(){var t=U("min","max");expect("start = 'abcd'|{min}..{max}| ").to.parseAs(t),expect("start = 'abcd'\n|{min}..{max}|").to.parseAs(t),expect("start = 'abcd'|\n{min}..{max}|").to.parseAs(t),expect("start = 'abcd'|{min}\n..{max}|").to.parseAs(t),expect("start = 'abcd'|{min}..\n{max}|").to.parseAs(t),expect("start = 'abcd'|{min}..{max}\n|").to.parseAs(t),t=B({type:"repeated",min:null,max:{type:"function",value:"exact"},expression:e,delimiter:null}),expect("start = 'abcd'\n|{exact}|").to.parseAs(t),expect("start = 'abcd'|\n{exact}|").to.parseAs(t),expect("start = 'abcd'|{exact}\n|").to.parseAs(t)})),it("with mixed boundaries",(function(){var e=N(2,"max");expect("start = 'abcd'|2..max| ").to.parseAs(e),expect("start = 'abcd'\n|2..max|").to.parseAs(e),expect("start = 'abcd'|\n2..max|").to.parseAs(e),expect("start = 'abcd'|2\n..max|").to.parseAs(e),expect("start = 'abcd'|2..\nmax|").to.parseAs(e),expect("start = 'abcd'|2..max\n|").to.parseAs(e),e=N("min",3),expect("start = 'abcd'|min..3| ").to.parseAs(e),expect("start = 'abcd'\n|min..3|").to.parseAs(e),expect("start = 'abcd'|\nmin..3|").to.parseAs(e),expect("start = 'abcd'|min\n..3|").to.parseAs(e),expect("start = 'abcd'|min..\n3|").to.parseAs(e),expect("start = 'abcd'|min..3\n|").to.parseAs(e)}))})),describe("with delimiter",(function(){it("with constant boundaries",(function(){var r=q(2,3);expect("start = 'abcd'|2..3,'efgh'| ").to.parseAs(r),expect("start = 'abcd'\n|2..3,'efgh'|").to.parseAs(r),expect("start = 'abcd'|\n2..3,'efgh'|").to.parseAs(r),expect("start = 'abcd'|2\n..3,'efgh'|").to.parseAs(r),expect("start = 'abcd'|2..\n3,'efgh'|").to.parseAs(r),expect("start = 'abcd'|2..3\n,'efgh'|").to.parseAs(r),expect("start = 'abcd'|2..3,\n'efgh'|").to.parseAs(r),expect("start = 'abcd'|2..3,'efgh'\n|").to.parseAs(r),r=B({type:"repeated",min:null,max:{type:"constant",value:3},expression:e,delimiter:t}),expect("start = 'abcd'\n|3,'efgh'|").to.parseAs(r),expect("start = 'abcd'|\n3,'efgh'|").to.parseAs(r),expect("start = 'abcd'|3\n,'efgh'|").to.parseAs(r),expect("start = 'abcd'|3,\n'efgh'|").to.parseAs(r),expect("start = 'abcd'|3,'efgh'\n|").to.parseAs(r),expect("start = 'abcd'|3, 'efgh'?|").to.parseAs(B({type:"repeated",min:null,max:{type:"constant",value:3},expression:e,delimiter:{type:"optional",expression:t}}))})),it("with variable boundaries",(function(){var r=q("min","max");expect("start = 'abcd'|min..max,'efgh'| ").to.parseAs(r),expect("start = 'abcd'\n|min..max,'efgh'|").to.parseAs(r),expect("start = 'abcd'|\nmin..max,'efgh'|").to.parseAs(r),expect("start = 'abcd'|min\n..max,'efgh'|").to.parseAs(r),expect("start = 'abcd'|min..\nmax,'efgh'|").to.parseAs(r),expect("start = 'abcd'|min..max\n,'efgh'|").to.parseAs(r),expect("start = 'abcd'|min..max,\n'efgh'|").to.parseAs(r),expect("start = 'abcd'|min..max,'efgh'\n|").to.parseAs(r),r=B({type:"repeated",min:null,max:{type:"variable",value:"exact"},expression:e,delimiter:t}),expect("start = 'abcd'\n|exact,'efgh'|").to.parseAs(r),expect("start = 'abcd'|\nexact,'efgh'|").to.parseAs(r),expect("start = 'abcd'|exact\n,'efgh'|").to.parseAs(r),expect("start = 'abcd'|exact,\n'efgh'|").to.parseAs(r),expect("start = 'abcd'|exact,'efgh'\n|").to.parseAs(r),expect("start = 'abcd'|exact, 'efgh'?|").to.parseAs(B({type:"repeated",min:null,max:{type:"variable",value:"exact"},expression:e,delimiter:{type:"optional",expression:t}}))})),it("with function boundaries",(function(){var r=G("min","max");expect("start = 'abcd'|{min}..{max},'efgh'| ").to.parseAs(r),expect("start = 'abcd'\n|{min}..{max},'efgh'|").to.parseAs(r),expect("start = 'abcd'|\n{min}..{max},'efgh'|").to.parseAs(r),expect("start = 'abcd'|{min}\n..{max},'efgh'|").to.parseAs(r),expect("start = 'abcd'|{min}..\n{max},'efgh'|").to.parseAs(r),expect("start = 'abcd'|{min}..{max}\n,'efgh'|").to.parseAs(r),expect("start = 'abcd'|{min}..{max},\n'efgh'|").to.parseAs(r),expect("start = 'abcd'|{min}..{max},'efgh'\n|").to.parseAs(r),r=B({type:"repeated",min:null,max:{type:"function",value:"exact"},expression:e,delimiter:t}),expect("start = 'abcd'\n|{exact},'efgh'|").to.parseAs(r),expect("start = 'abcd'|\n{exact},'efgh'|").to.parseAs(r),expect("start = 'abcd'|{exact}\n,'efgh'|").to.parseAs(r),expect("start = 'abcd'|{exact},\n'efgh'|").to.parseAs(r),expect("start = 'abcd'|{exact},'efgh'\n|").to.parseAs(r),expect("start = 'abcd'|{exact}, 'efgh'?|").to.parseAs(B({type:"repeated",min:null,max:{type:"function",value:"exact"},expression:e,delimiter:{type:"optional",expression:t}}))})),it("with mixed boundaries",(function(){var e=q(2,"max");expect("start = 'abcd'|2..max,'efgh'| ").to.parseAs(e),expect("start = 'abcd'\n|2..max,'efgh'|").to.parseAs(e),expect("start = 'abcd'|\n2..max,'efgh'|").to.parseAs(e),expect("start = 'abcd'|2\n..max,'efgh'|").to.parseAs(e),expect("start = 'abcd'|2..\nmax,'efgh'|").to.parseAs(e),expect("start = 'abcd'|2..max\n,'efgh'|").to.parseAs(e),expect("start = 'abcd'|2..max,\n'efgh'|").to.parseAs(e),expect("start = 'abcd'|2..max,'efgh'\n|").to.parseAs(e),e=q("min",3),expect("start = 'abcd'|min..3,'efgh'| ").to.parseAs(e),expect("start = 'abcd'\n|min..3,'efgh'|").to.parseAs(e),expect("start = 'abcd'|\nmin..3,'efgh'|").to.parseAs(e),expect("start = 'abcd'|min\n..3,'efgh'|").to.parseAs(e),expect("start = 'abcd'|min..\n3,'efgh'|").to.parseAs(e),expect("start = 'abcd'|min..3\n,'efgh'|").to.parseAs(e),expect("start = 'abcd'|min..3,\n'efgh'|").to.parseAs(e),expect("start = 'abcd'|min..3,'efgh'\n|").to.parseAs(e),e=G(2,"max"),expect("start = 'abcd'|2..{max},'efgh'| ").to.parseAs(e),expect("start = 'abcd'\n|2..{max},'efgh'|").to.parseAs(e),expect("start = 'abcd'|\n2..{max},'efgh'|").to.parseAs(e),expect("start = 'abcd'|2\n..{max},'efgh'|").to.parseAs(e),expect("start = 'abcd'|2..\n{max},'efgh'|").to.parseAs(e),expect("start = 'abcd'|2..{max}\n,'efgh'|").to.parseAs(e),expect("start = 'abcd'|2..{max},\n'efgh'|").to.parseAs(e),expect("start = 'abcd'|2..{max},'efgh'\n|").to.parseAs(e),e=G("min",3),expect("start = 'abcd'|{min}..3,'efgh'| ").to.parseAs(e),expect("start = 'abcd'\n|{min}..3,'efgh'|").to.parseAs(e),expect("start = 'abcd'|\n{min}..3,'efgh'|").to.parseAs(e),expect("start = 'abcd'|{min}\n..3,'efgh'|").to.parseAs(e),expect("start = 'abcd'|{min}..\n3,'efgh'|").to.parseAs(e),expect("start = 'abcd'|{min}..3\n,'efgh'|").to.parseAs(e),expect("start = 'abcd'|{min}..3,\n'efgh'|").to.parseAs(e),expect("start = 'abcd'|{min}..3,'efgh'\n|").to.parseAs(e)}))}))})),describe("parses RepeatedOperator",(function(){describe("without delimiter",(function(){it("with constant boundaries",(function(){expect("start = 'abcd'| .. |").to.parseAs(N(0,null)),expect("start = 'abcd'|0.. |").to.parseAs(N(0,null)),expect("start = 'abcd'|1.. |").to.parseAs(N(1,null)),expect("start = 'abcd'|2.. |").to.parseAs(N(2,null)),expect("start = 'abcd'| ..1|").to.parseAs(N(0,1)),expect("start = 'abcd'| ..2|").to.parseAs(N(0,2)),expect("start = 'abcd'|2..2|").to.parseAs(N(2,2)),expect("start = 'abcd'|2..3|").to.parseAs(N(2,3)),expect("start = 'abcd'|3| ").to.parseAs(B({type:"repeated",min:null,max:{type:"constant",value:3},expression:e,delimiter:null})),expect("start = 'abcd'| ..0|").to.failToParse(),expect("start = 'abcd'|0..0|").to.failToParse(),expect("start = 'abcd'|0| ").to.failToParse()})),it("with variable boundaries",(function(){expect("start = 'abcd'|min.. |").to.parseAs(N("min",null)),expect("start = 'abcd'| ..max|").to.parseAs(N(0,"max")),expect("start = 'abcd'|min..max|").to.parseAs(N("min","max")),expect("start = 'abcd'|exact| ").to.parseAs(B({type:"repeated",min:null,max:{type:"variable",value:"exact"},expression:e,delimiter:null}))})),it("with function boundaries",(function(){expect("start = 'abcd'|{min}.. |").to.parseAs(U("min",null)),expect("start = 'abcd'| ..{max}|").to.parseAs(U(0,"max")),expect("start = 'abcd'|{min}..{max}|").to.parseAs(U("min","max")),expect("start = 'abcd'|{exact}| ").to.parseAs(B({type:"repeated",min:null,max:{type:"function",value:"exact"},expression:e,delimiter:null}))})),it("with mixed boundaries",(function(){expect("start = 'abcd'|2..max|").to.parseAs(N(2,"max")),expect("start = 'abcd'|min..3|").to.parseAs(N("min",3)),expect("start = 'abcd'|2..{max}|").to.parseAs(U(2,"max")),expect("start = 'abcd'|{min}..3|").to.parseAs(U("min",3))}))})),describe("with delimiter",(function(){it("with constant boundaries",(function(){expect("start = 'abcd'| .. , 'efgh'|").to.parseAs(q(0,null)),expect("start = 'abcd'|0.. , 'efgh'|").to.parseAs(q(0,null)),expect("start = 'abcd'|1.. , 'efgh'|").to.parseAs(q(1,null)),expect("start = 'abcd'|2.. , 'efgh'|").to.parseAs(q(2,null)),expect("start = 'abcd'| ..1, 'efgh'|").to.parseAs(q(0,1)),expect("start = 'abcd'| ..2, 'efgh'|").to.parseAs(q(0,2)),expect("start = 'abcd'|2..2, 'efgh'|").to.parseAs(q(2,2)),expect("start = 'abcd'|2..3, 'efgh'|").to.parseAs(q(2,3)),expect("start = 'abcd'|3 , 'efgh'|").to.parseAs(B({type:"repeated",min:null,max:{type:"constant",value:3},expression:e,delimiter:t})),expect("start = 'abcd'| ..0, 'efgh'|").to.failToParse(),expect("start = 'abcd'|0..0, 'efgh'|").to.failToParse(),expect("start = 'abcd'|0 , 'efgh'|").to.failToParse()})),it("with variable boundaries",(function(){expect("start = 'abcd'|min.. , 'efgh'|").to.parseAs(q("min",null)),expect("start = 'abcd'| ..max, 'efgh'|").to.parseAs(q(0,"max")),expect("start = 'abcd'|min..max, 'efgh'|").to.parseAs(q("min","max")),expect("start = 'abcd'|exact, 'efgh'| ").to.parseAs(B({type:"repeated",min:null,max:{type:"variable",value:"exact"},expression:e,delimiter:t}))})),it("with function boundaries",(function(){expect("start = 'abcd'|{min}.. , 'efgh'|").to.parseAs(G("min",null)),expect("start = 'abcd'| ..{max}, 'efgh'|").to.parseAs(G(0,"max")),expect("start = 'abcd'|{min}..{max}, 'efgh'|").to.parseAs(G("min","max")),expect("start = 'abcd'|{exact}, 'efgh'|").to.parseAs(B({type:"repeated",min:null,max:{type:"function",value:"exact"},expression:e,delimiter:t}))})),it("with mixed boundaries",(function(){expect("start = 'abcd'|2..max, 'efgh'|").to.parseAs(q(2,"max")),expect("start = 'abcd'|min..3, 'efgh'|").to.parseAs(q("min",3)),expect("start = 'abcd'|2..{max}, 'efgh'|").to.parseAs(G(2,"max")),expect("start = 'abcd'|{min}..3, 'efgh'|").to.parseAs(G("min",3))}))}))})),it("parses RuleReferenceExpression",(function(){expect("start = a").to.parseAs(j("a")),expect("start = a\n=").to.failToParse(),expect("start = a\n'abcd'\n=").to.failToParse()})),it("parses SemanticPredicateExpression",(function(){expect("start = !\n{ code }").to.parseAs(B(o))})),it("parses SemanticPredicateOperator",(function(){expect("start = &{ code }").to.parseAs(B(n)),expect("start = !{ code }").to.parseAs(B(o))})),it("parses WhiteSpace",(function(){expect("start =\t'abcd'").to.parseAs(H),expect("start =\v'abcd'").to.parseAs(H),expect("start =\f'abcd'").to.parseAs(H),expect("start = 'abcd'").to.parseAs(H),expect("start = 'abcd'").to.parseAs(H),expect("start =\ufeff'abcd'").to.parseAs(H),expect("start = 'abcd'").to.parseAs(H)})),it("parses LineTerminator",(function(){expect("start = '\n'").to.failToParse(),expect("start = '\r'").to.failToParse(),expect("start = '\u2028'").to.failToParse(),expect("start = '\u2029'").to.failToParse()})),it("parses LineTerminatorSequence",(function(){expect("start =\n'abcd'").to.parseAs(H),expect("start =\r\n'abcd'").to.parseAs(H),expect("start =\r'abcd'").to.parseAs(H),expect("start =\u2028'abcd'").to.parseAs(H),expect("start =\u2029'abcd'").to.parseAs(H)})),it("parses Comment",(function(){expect("start =// comment\n'abcd'").to.parseAs(H),expect("start =/* comment */'abcd'").to.parseAs(H)})),it("parses MultiLineComment",(function(){expect("start =/**/'abcd'").to.parseAs(H),expect("start =/*a*/'abcd'").to.parseAs(H),expect("start =/*abc*/'abcd'").to.parseAs(H),expect("start =/**/*/'abcd'").to.failToParse()})),it("parses MultiLineCommentNoLineTerminator",(function(){expect("a = 'abcd'/**/\r\nb = 'efgh'").to.parseAs(z),expect("a = 'abcd'/*a*/\r\nb = 'efgh'").to.parseAs(z),expect("a = 'abcd'/*abc*/\r\nb = 'efgh'").to.parseAs(z),expect("a = 'abcd'/**/*/\r\nb = 'efgh'").to.failToParse(),expect("a = 'abcd'/*\n*/\r\nb = 'efgh'").to.failToParse()})),it("parses SingleLineComment",(function(){expect("start =//\n'abcd'").to.parseAs(H),expect("start =//a\n'abcd'").to.parseAs(H),expect("start =//abc\n'abcd'").to.parseAs(H),expect("start =//\n@\n'abcd'").to.failToParse()})),it("parses Identifier",(function(){expect("start = a:'abcd'").to.parseAs(B(g))})),it("parses IdentifierName",(function(){expect("start = a").to.parseAs(j("a")),expect("start = ab").to.parseAs(j("ab")),expect("start = abcd").to.parseAs(j("abcd"))})),it("parses IdentifierStart",(function(){expect("start = a").to.parseAs(j("a")),expect("start = $").to.failToParse(),expect("$start = a").to.failToParse(),expect("start = a$b").to.parseAs(j("a$b")),expect("start = _").to.parseAs(j("_")),expect("start = \\u0061").to.parseAs(j("a"))})),it("parses IdentifierPart",(function(){expect("start = aa").to.parseAs(j("aa")),expect("start = à").to.parseAs(j("à")),expect("start = a0").to.parseAs(j("a0")),expect("start = a‿").to.parseAs(j("a‿")),expect("start = a").to.parseAs(j("a")),expect("start = a").to.parseAs(j("a"))})),it("parses LiteralMatcher",(function(){expect("start = 'abcd'").to.parseAs(D("abcd",!1)),expect("start = 'abcd'i").to.parseAs(D("abcd",!0))})),it("parses StringLiteral",(function(){expect('start = ""').to.parseAs(D("",!1)),expect('start = "a"').to.parseAs(D("a",!1)),expect('start = "abc"').to.parseAs(D("abc",!1)),expect("start = ''").to.parseAs(D("",!1)),expect("start = 'a'").to.parseAs(D("a",!1)),expect("start = 'abc'").to.parseAs(D("abc",!1))})),it("parses DoubleStringCharacter",(function(){expect('start = "a"').to.parseAs(D("a",!1)),expect('start = "\\n"').to.parseAs(D("\n",!1)),expect('start = "\\\n"').to.parseAs(D("",!1)),expect('start = """').to.failToParse(),expect('start = "\\"').to.failToParse(),expect('start = "\n"').to.failToParse()})),it("parses SingleStringCharacter",(function(){expect("start = 'a'").to.parseAs(D("a",!1)),expect("start = '\\n'").to.parseAs(D("\n",!1)),expect("start = '\\\n'").to.parseAs(D("",!1)),expect("start = '''").to.failToParse(),expect("start = '\\'").to.failToParse(),expect("start = '\n'").to.failToParse()})),it("parses CharacterClassMatcher",(function(){expect("start = []").to.parseAs(k([],!1,!1)),expect("start = [a-d]").to.parseAs(k([["a","d"]],!1,!1)),expect("start = [a]").to.parseAs(k(["a"],!1,!1)),expect("start = [a-de-hi-l]").to.parseAs(k([["a","d"],["e","h"],["i","l"]],!1,!1)),expect("start = [^a-d]").to.parseAs(k([["a","d"]],!0,!1)),expect("start = [a-d]i").to.parseAs(k([["a","d"]],!1,!0)),expect("start = [\\\n]").to.parseAs(k([],!1,!1))})),it("parses ClassCharacterRange",(function(){expect("start = [a-d]").to.parseAs(k([["a","d"]],!1,!1)),expect("start = [a-a]").to.parseAs(k([["a","a"]],!1,!1)),expect("start = [b-a]").to.failToParse({message:"Invalid character range: b-a."})})),it("parses ClassCharacter",(function(){expect("start = [a]").to.parseAs(k(["a"],!1,!1)),expect("start = [\\n]").to.parseAs(k(["\n"],!1,!1)),expect("start = [\\\n]").to.parseAs(k([],!1,!1)),expect("start = []]").to.failToParse(),expect("start = [\\]").to.failToParse(),expect("start = [\n]").to.failToParse()})),it("parses LineContinuation",(function(){expect("start = '\\\r\n'").to.parseAs(D("",!1))})),it("parses EscapeSequence",(function(){expect("start = '\\n'").to.parseAs(D("\n",!1)),expect("start = '\\0'").to.parseAs(D("\0",!1)),expect("start = '\\xFF'").to.parseAs(D("ÿ",!1)),expect("start = '\\uFFFF'").to.parseAs(D("",!1)),expect("start = '\\09'").to.failToParse()})),it("parses CharacterEscapeSequence",(function(){expect("start = '\\n'").to.parseAs(D("\n",!1)),expect("start = '\\a'").to.parseAs(D("a",!1))})),it("parses SingleEscapeCharacter",(function(){expect("start = '\\''").to.parseAs(D("'",!1)),expect("start = '\\\"'").to.parseAs(D('"',!1)),expect("start = '\\\\'").to.parseAs(D("\\",!1)),expect("start = '\\b'").to.parseAs(D("\b",!1)),expect("start = '\\f'").to.parseAs(D("\f",!1)),expect("start = '\\n'").to.parseAs(D("\n",!1)),expect("start = '\\r'").to.parseAs(D("\r",!1)),expect("start = '\\t'").to.parseAs(D("\t",!1)),expect("start = '\\v'").to.parseAs(D("\v",!1))})),it("parses NonEscapeCharacter",(function(){expect("start = '\\a'").to.parseAs(D("a",!1))})),it("parses HexEscapeSequence",(function(){expect("start = '\\xFF'").to.parseAs(D("ÿ",!1))})),it("parses UnicodeEscapeSequence",(function(){expect("start = '\\uFFFF'").to.parseAs(D("",!1))})),it("parses AnyMatcher",(function(){expect("start = .").to.parseAs(I())})),it("parses CodeBlock",(function(){expect("start = 'abcd' { code }").to.parseAs(M(" code "))})),it("parses Code",(function(){expect("start = 'abcd' {a}").to.parseAs(M("a")),expect("start = 'abcd' {abc}").to.parseAs(M("abc")),expect("start = 'abcd' {{a}}").to.parseAs(M("{a}")),expect("start = 'abcd' {{a}{b}{c}}").to.parseAs(M("{a}{b}{c}")),expect("start = 'abcd' {{}").to.failToParse(),expect("start = 'abcd' {}}").to.failToParse()})),it("parses __",(function(){expect("start ='abcd'").to.parseAs(H),expect("start = 'abcd'").to.parseAs(H),expect("start =\r\n'abcd'").to.parseAs(H),expect("start =/* comment */'abcd'").to.parseAs(H),expect("start = 'abcd'").to.parseAs(H)})),it("parses _",(function(){expect("a = 'abcd'\r\nb = 'efgh'").to.parseAs(z),expect("a = 'abcd' \r\nb = 'efgh'").to.parseAs(z),expect("a = 'abcd'/* comment */\r\nb = 'efgh'").to.parseAs(z),expect("a = 'abcd' \r\nb = 'efgh'").to.parseAs(z)})),it("parses EOS",(function(){expect("a = 'abcd'\n;b = 'efgh'").to.parseAs(z),expect("a = 'abcd' \r\nb = 'efgh'").to.parseAs(z),expect("a = 'abcd' // comment\r\nb = 'efgh'").to.parseAs(z),expect("a = 'abcd'\nb = 'efgh'").to.parseAs(z)})),it("parses EOF",(function(){expect("start = 'abcd'\n").to.parseAs(H)})),it("generates codeLocation / nameLocation / labelLocation",(function(){var e=parser.parse("\n{{\n const foo = 12;\n}}\n{\n const bar = 13;\n}\na = label:'abcd' &{ return true; } !{ return false; } { return 'so true'; }\nb = @LABEL:'efgh'\nc = @'ijkl'\n");expect(e).to.eql({type:"grammar",topLevelInitializer:{type:"top_level_initializer",code:"\n const foo = 12;\n",codeLocation:{source:void 0,start:{offset:3,line:2,column:3},end:{offset:22,line:4,column:1}},location:{source:void 0,start:{offset:1,line:2,column:1},end:{offset:25,line:5,column:1}}},initializer:{type:"initializer",code:"\n const bar = 13;\n",codeLocation:{source:void 0,start:{offset:26,line:5,column:2},end:{offset:45,line:7,column:1}},location:{source:void 0,start:{offset:25,line:5,column:1},end:{offset:47,line:8,column:1}}},rules:[{type:"rule",name:"a",nameLocation:{source:void 0,start:{offset:47,line:8,column:1},end:{offset:48,line:8,column:2}},expression:{type:"action",expression:{type:"sequence",elements:[{type:"labeled",label:"label",labelLocation:{source:void 0,start:{offset:51,line:8,column:5},end:{offset:56,line:8,column:10}},expression:{type:"literal",value:"abcd",ignoreCase:!1,location:{source:void 0,start:{offset:57,line:8,column:11},end:{offset:63,line:8,column:17}}},location:{source:void 0,start:{offset:51,line:8,column:5},end:{offset:63,line:8,column:17}}},{type:"semantic_and",code:" return true; ",codeLocation:{source:void 0,start:{offset:66,line:8,column:20},end:{offset:80,line:8,column:34}},location:{source:void 0,start:{offset:64,line:8,column:18},end:{offset:81,line:8,column:35}}},{type:"semantic_not",code:" return false; ",codeLocation:{source:void 0,start:{offset:84,line:8,column:38},end:{offset:99,line:8,column:53}},location:{source:void 0,start:{offset:82,line:8,column:36},end:{offset:100,line:8,column:54}}}],location:{source:void 0,start:{offset:51,line:8,column:5},end:{offset:100,line:8,column:54}}},code:" return 'so true'; ",codeLocation:{source:void 0,start:{offset:102,line:8,column:56},end:{offset:121,line:8,column:75}},location:{source:void 0,start:{offset:51,line:8,column:5},end:{offset:122,line:8,column:76}}},location:{source:void 0,start:{offset:47,line:8,column:1},end:{offset:123,line:9,column:1}}},{type:"rule",name:"b",nameLocation:{source:void 0,start:{offset:123,line:9,column:1},end:{offset:124,line:9,column:2}},expression:{type:"sequence",elements:[{type:"labeled",label:"LABEL",labelLocation:{source:void 0,start:{offset:128,line:9,column:6},end:{offset:133,line:9,column:11}},pick:!0,expression:{type:"literal",value:"efgh",ignoreCase:!1,location:{source:void 0,start:{offset:134,line:9,column:12},end:{offset:140,line:9,column:18}}},location:{source:void 0,start:{offset:127,line:9,column:5},end:{offset:140,line:9,column:18}}}],location:{source:void 0,start:{offset:127,line:9,column:5},end:{offset:140,line:9,column:18}}},location:{source:void 0,start:{offset:123,line:9,column:1},end:{offset:141,line:10,column:1}}},{type:"rule",name:"c",nameLocation:{source:void 0,start:{offset:141,line:10,column:1},end:{offset:142,line:10,column:2}},expression:{type:"sequence",elements:[{type:"labeled",label:null,labelLocation:{source:void 0,start:{offset:145,line:10,column:5},end:{offset:146,line:10,column:6}},pick:!0,expression:{type:"literal",value:"ijkl",ignoreCase:!1,location:{source:void 0,start:{offset:146,line:10,column:6},end:{offset:152,line:10,column:12}}},location:{source:void 0,start:{offset:145,line:10,column:5},end:{offset:152,line:10,column:12}}}],location:{source:void 0,start:{offset:145,line:10,column:5},end:{offset:152,line:10,column:12}}},location:{source:void 0,start:{offset:141,line:10,column:1},end:{offset:153,line:11,column:1}}}],location:{source:void 0,start:{offset:0,line:1,column:1},end:{offset:153,line:11,column:1}}})}))})),exports.peggyVersion=peggyVersion})); \ No newline at end of file diff --git a/docs/vendor/peggy/peggy.min.js b/docs/vendor/peggy/peggy.min.js index a30d8faa..c27bfab5 100644 --- a/docs/vendor/peggy/peggy.min.js +++ b/docs/vendor/peggy/peggy.min.js @@ -5,4 +5,4 @@ // Copyright (c) 2023- the Peggy authors // Licensed under the MIT License. -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).peggy=t()}(this,(function(){"use strict";var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var GrammarLocation$4=function(){function GrammarLocation(e,t){this.source=e,this.start=t}return GrammarLocation.prototype.toString=function(){return String(this.source)},GrammarLocation.prototype.offset=function(e){return{line:e.line+this.start.line-1,column:1===e.line?e.column+this.start.column-1:e.column,offset:e.offset+this.start.offset}},GrammarLocation.offsetStart=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.start):e.start},GrammarLocation.offsetEnd=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.end):e.end},GrammarLocation}(),grammarLocation=GrammarLocation$4,__extends=commonjsGlobal&&commonjsGlobal.__extends||(extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},extendStatics(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),extendStatics,GrammarLocation$3=grammarLocation,setProtoOf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},GrammarError$3=function(e){function t(r,n,o){var u=e.call(this,r)||this;return setProtoOf(u,t.prototype),u.name="GrammarError",u.location=n,void 0===o&&(o=[]),u.diagnostics=o,u.stage=null,u.problems=[["error",r,n,o]],u}return __extends(t,e),t.prototype.toString=function(){var t=e.prototype.toString.call(this);this.location&&(t+="\n at ",void 0!==this.location.source&&null!==this.location.source&&(t+="".concat(this.location.source,":")),t+="".concat(this.location.start.line,":").concat(this.location.start.column));for(var r=0,n=this.diagnostics;r<n.length;r++){var o=n[r];t+="\n from ",void 0!==o.location.source&&null!==o.location.source&&(t+="".concat(o.location.source,":")),t+="".concat(o.location.start.line,":").concat(o.location.start.column,": ").concat(o.message)}return t},t.prototype.format=function(e){var t=e.map((function(e){var t=e.source,r=e.text;return{source:t,text:null!=r?String(r).split(/\r\n|\n|\r/g):[]}}));function r(e,r,n){void 0===n&&(n="");var o="",u=t.find((function(t){return t.source===e.source})),a=e.start,i=GrammarLocation$3.offsetStart(e);if(u){var s=e.end,c=u.text[a.line-1],l=(a.line===s.line?s.column:c.length+1)-a.column||1;n&&(o+="\nnote: ".concat(n)),o+="\n --\x3e ".concat(e.source,":").concat(i.line,":").concat(i.column,"\n").concat("".padEnd(r)," |\n").concat(i.line.toString().padStart(r)," | ").concat(c,"\n").concat("".padEnd(r)," | ").concat("".padEnd(a.column-1)).concat("".padEnd(l,"^"))}else o+="\n at ".concat(e.source,":").concat(i.line,":").concat(i.column),n&&(o+=": ".concat(n));return o}function n(e,t,n,o){void 0===o&&(o=[]);var u=-1/0;u=n?o.reduce((function(e,t){var r=t.location;return Math.max(e,GrammarLocation$3.offsetStart(r).line)}),n.start.line):Math.max.apply(null,o.map((function(e){return e.location.start.line}))),u=u.toString().length;var a="".concat(e,": ").concat(t);n&&(a+=r(n,u));for(var i=0,s=o;i<s.length;i++){var c=s[i];a+=r(c.location,u,c.message)}return a}return this.problems.filter((function(e){return"info"!==e[0]})).map((function(e){return n.apply(void 0,e)})).join("\n\n")},t}(Error),grammarError=GrammarError$3,__spreadArray$4=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,u=t.length;o<u;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},visitor$c={build:function(e){function t(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return e[t.type].apply(e,__spreadArray$4([t],r,!1))}function r(){}function n(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return t.apply(void 0,__spreadArray$4([e.expression],r,!1))}function o(e){return function(r){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];r[e].forEach((function(e){return t.apply(void 0,__spreadArray$4([e],n,!1))}))}}var u={grammar:function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];e.topLevelInitializer&&t.apply(void 0,__spreadArray$4([e.topLevelInitializer],r,!1)),e.initializer&&t.apply(void 0,__spreadArray$4([e.initializer],r,!1)),e.rules.forEach((function(e){return t.apply(void 0,__spreadArray$4([e],r,!1))}))},top_level_initializer:r,initializer:r,rule:n,named:n,choice:o("alternatives"),action:n,sequence:o("elements"),labeled:n,text:n,simple_and:n,simple_not:n,optional:n,zero_or_more:n,one_or_more:n,repeated:function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return e.delimiter&&t.apply(void 0,__spreadArray$4([e.delimiter],r,!1)),t.apply(void 0,__spreadArray$4([e.expression],r,!1))},group:n,semantic_and:r,semantic_not:r,rule_ref:r,literal:r,class:r,any:r};return Object.keys(u).forEach((function(t){Object.prototype.hasOwnProperty.call(e,t)||(e[t]=u[t])})),t}},visitor_1=visitor$c,visitor$b=visitor_1,asts$7={findRule:function(e,t){for(var r=0;r<e.rules.length;r++)if(e.rules[r].name===t)return e.rules[r]},indexOfRule:function(e,t){for(var r=0;r<e.rules.length;r++)if(e.rules[r].name===t)return r;return-1},alwaysConsumesOnSuccess:function(e,t){function r(){return!0}function n(){return!1}var o=visitor$b.build({choice:function(e){return e.alternatives.every(o)},sequence:function(e){return e.elements.some(o)},simple_and:n,simple_not:n,optional:n,zero_or_more:n,repeated:function(e){var t=e.min?e.min:e.max;return!("constant"!==t.type||0===t.value||!o(e.expression)&&!(t.value>1&&e.delimiter&&o(e.delimiter)))},semantic_and:n,semantic_not:n,rule_ref:function(t){var r=asts$7.findRule(e,t.name);return r?o(r):void 0},literal:function(e){return""!==e.value},class:r,any:r});return o(t)}},asts_1=asts$7,opcodes={PUSH:0,PUSH_EMPTY_STRING:35,PUSH_UNDEFINED:1,PUSH_NULL:2,PUSH_FAILED:3,PUSH_EMPTY_ARRAY:4,PUSH_CURR_POS:5,POP:6,POP_CURR_POS:7,POP_N:8,NIP:9,APPEND:10,WRAP:11,TEXT:12,PLUCK:36,IF:13,IF_ERROR:14,IF_NOT_ERROR:15,IF_LT:30,IF_GE:31,IF_LT_DYNAMIC:32,IF_GE_DYNAMIC:33,WHILE_NOT_ERROR:16,MATCH_ANY:17,MATCH_STRING:18,MATCH_STRING_IC:19,MATCH_CHAR_CLASS:20,MATCH_REGEXP:20,ACCEPT_N:21,ACCEPT_STRING:22,FAIL:23,LOAD_SAVED_POS:24,UPDATE_SAVED_POS:25,CALL:26,RULE:27,SILENT_FAILS_ON:28,SILENT_FAILS_OFF:29,SOURCE_MAP_PUSH:37,SOURCE_MAP_POP:38,SOURCE_MAP_LABEL_PUSH:39,SOURCE_MAP_LABEL_POP:40},opcodes_1=opcodes,visitor$a=visitor_1,asts$6=asts_1,GrammarError$2=grammarError,ALWAYS_MATCH$1=1,SOMETIMES_MATCH$1=0,NEVER_MATCH$1=-1;function inferenceMatchResult$1(e){function t(e){return e.match=SOMETIMES_MATCH$1}function r(e){return u(e.expression),e.match=ALWAYS_MATCH$1}function n(e){return e.match=u(e.expression)}function o(e,t){for(var r=e.length,n=0,o=0,a=0;a<r;++a){var i=u(e[a]);i===ALWAYS_MATCH$1&&++n,i===NEVER_MATCH$1&&++o}return n===r?ALWAYS_MATCH$1:t?o===r?NEVER_MATCH$1:SOMETIMES_MATCH$1:o>0?NEVER_MATCH$1:SOMETIMES_MATCH$1}var u=visitor$a.build({rule:function(e){var t=void 0,r=0;if(void 0===e.match){e.match=SOMETIMES_MATCH$1;do{if(t=e.match,e.match=u(e.expression),++r>6)throw new GrammarError$2("Infinity cycle detected when trying to evaluate node match result",e.location)}while(t!==e.match)}return e.match},named:n,choice:function(e){return e.match=o(e.alternatives,!0)},action:n,sequence:function(e){return e.match=o(e.elements,!1)},labeled:n,text:n,simple_and:n,simple_not:function(e){return e.match=-u(e.expression)},optional:r,zero_or_more:r,one_or_more:n,repeated:function(e){var t=u(e.expression),r=e.delimiter?u(e.delimiter):NEVER_MATCH$1,n=e.min?e.min:e.max;return"constant"!==n.type||"constant"!==e.max.type?e.match=SOMETIMES_MATCH$1:0===e.max.value||null!==e.max.value&&n.value>e.max.value?e.match=NEVER_MATCH$1:t===NEVER_MATCH$1?e.match=0===n.value?ALWAYS_MATCH$1:NEVER_MATCH$1:t===ALWAYS_MATCH$1?e.delimiter&&n.value>=2?e.match=r:e.match=ALWAYS_MATCH$1:e.delimiter&&n.value>=2?e.match=r===NEVER_MATCH$1?NEVER_MATCH$1:SOMETIMES_MATCH$1:e.match=0===n.value?ALWAYS_MATCH$1:SOMETIMES_MATCH$1},group:n,semantic_and:t,semantic_not:t,rule_ref:function(t){var r=asts$6.findRule(e,t.name);return t.match=u(r)},literal:function(e){var t=0===e.value.length?ALWAYS_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},class:function(e){var t=0===e.parts.length?NEVER_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},any:t});u(e)}inferenceMatchResult$1.ALWAYS_MATCH=ALWAYS_MATCH$1,inferenceMatchResult$1.SOMETIMES_MATCH=SOMETIMES_MATCH$1,inferenceMatchResult$1.NEVER_MATCH=NEVER_MATCH$1;var inferenceMatchResult_1=inferenceMatchResult$1,__spreadArray$3=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,u=t.length;o<u;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},asts$5=asts_1,op$1=opcodes_1,visitor$9=visitor_1,_a$1=inferenceMatchResult_1,ALWAYS_MATCH=_a$1.ALWAYS_MATCH,SOMETIMES_MATCH=_a$1.SOMETIMES_MATCH,NEVER_MATCH=_a$1.NEVER_MATCH;function generateBytecode$1(e,t){var r=[],n=[],o=[],u=[],a=[];function i(e){var t=r.indexOf(e);return-1===t?r.push(e)-1:t}function s(e){var t=JSON.stringify(e),r=o.findIndex((function(e){return JSON.stringify(e)===t}));return-1===r?o.push(e)-1:r}function c(e,t,r){var n={predicate:e,params:t,body:r.code,location:r.codeLocation},o=JSON.stringify(n),a=u.findIndex((function(e){return JSON.stringify(e)===o}));return-1===a?u.push(n)-1:a}function l(e){return a.push(e)-1}function p(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r]})),t}function f(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return e.concat.apply(e,t)}function h(e,t,r,n){return e===ALWAYS_MATCH?r:e===NEVER_MATCH?n:t.concat([r.length,n.length],r,n)}function d(e,t,r,n){var o=Object.keys(r).map((function(e){return n-r[e]}));return[op$1.CALL,e,t,o.length].concat(o)}function g(e,t,r){var n=e.match||0;return f([op$1.PUSH_CURR_POS],[op$1.SILENT_FAILS_ON],C(e,{sp:r.sp+1,env:p(r.env),action:null}),[op$1.SILENT_FAILS_OFF],h(t?-n:n,[t?op$1.IF_ERROR:op$1.IF_NOT_ERROR],f([op$1.POP],[t?op$1.POP:op$1.POP_CURR_POS],[op$1.PUSH_UNDEFINED]),f([op$1.POP],[t?op$1.POP_CURR_POS:op$1.POP],[op$1.PUSH_FAILED])))}function A(e,t,r){var n=c(!0,Object.keys(r.env),e);return f([op$1.UPDATE_SAVED_POS],d(n,0,r.env,r.sp),h(e.match||0,[op$1.IF],f([op$1.POP],t?[op$1.PUSH_FAILED]:[op$1.PUSH_UNDEFINED]),f([op$1.POP],t?[op$1.PUSH_UNDEFINED]:[op$1.PUSH_FAILED])))}function m(e){return t=[op$1.WHILE_NOT_ERROR],r=f([op$1.APPEND],e),t.concat([r.length],r);var t,r}function E(e,t,r,n){switch(e.type){case"constant":return{pre:[],post:[],sp:r};case"variable":return e.sp=n+r-t[e.value],{pre:[],post:[],sp:r};case"function":return e.sp=n,{pre:d(c(!0,Object.keys(t),{code:e.value,codeLocation:e.codeLocation}),0,t,r),post:[op$1.NIP],sp:r+1};default:throw new Error('Unknown boundary type "'.concat(e.type,'" for the "repeated" node'))}}function _(e,t){if(null!==t.value){var r="constant"===t.type?[op$1.IF_GE,t.value]:[op$1.IF_GE_DYNAMIC,t.sp];return h(SOMETIMES_MATCH,r,[op$1.PUSH_FAILED],e)}return e}var v,C=(v={grammar:function(e){e.rules.forEach(C),e.literals=r,e.classes=n,e.expectations=o,e.functions=u,e.locations=a},rule:function(e){e.bytecode=C(e.expression,{sp:-1,env:{},pluck:[],action:null})},named:function(e,t){var r=e.match||0,n=r===NEVER_MATCH?-1:s({type:"rule",value:e.name});return f([op$1.SILENT_FAILS_ON],C(e.expression,t),[op$1.SILENT_FAILS_OFF],h(r,[op$1.IF_ERROR],[op$1.FAIL,n],[]))},choice:function(e,t){return function e(t,r){var n=t[0].match||0,o=C(t[0],{sp:r.sp,env:p(r.env),action:null});return n===ALWAYS_MATCH?o:f(o,t.length>1?h(SOMETIMES_MATCH,[op$1.IF_ERROR],f([op$1.POP],e(t.slice(1),r)),[]):[])}(e.alternatives,t)},action:function(e,t){var r=p(t.env),n="sequence"!==e.expression.type||0===e.expression.elements.length,o=C(e.expression,{sp:t.sp+(n?1:0),env:r,action:e}),u=e.expression.match||0,a=n&&u!==NEVER_MATCH?c(!1,Object.keys(r),e):-1;return n?f([op$1.PUSH_CURR_POS],o,h(u,[op$1.IF_NOT_ERROR],f([op$1.LOAD_SAVED_POS,1],d(a,1,r,t.sp+2)),[]),[op$1.NIP]):o},sequence:function(e,t){return f([op$1.PUSH_CURR_POS],function t(r,n){if(r.length>0){var o=e.elements.length-r.length+1;return f(C(r[0],{sp:n.sp,env:n.env,pluck:n.pluck,action:null}),h(r[0].match||0,[op$1.IF_NOT_ERROR],t(r.slice(1),{sp:n.sp+1,env:n.env,pluck:n.pluck,action:n.action}),f(o>1?[op$1.POP_N,o]:[op$1.POP],[op$1.POP_CURR_POS],[op$1.PUSH_FAILED])))}if(n.pluck.length>0)return f([op$1.PLUCK,e.elements.length+1,n.pluck.length],n.pluck.map((function(e){return n.sp-e})));if(n.action){var u=c(!1,Object.keys(n.env),n.action);return f([op$1.LOAD_SAVED_POS,e.elements.length],d(u,e.elements.length+1,n.env,n.sp))}return f([op$1.WRAP,e.elements.length],[op$1.NIP])}(e.elements,{sp:t.sp+1,env:t.env,pluck:[],action:t.action}))},labeled:function(e,r){var n=r.env,o=e.label,u=r.sp+1;o&&(n=p(r.env),r.env[e.label]=u),e.pick&&r.pluck.push(u);var a=C(e.expression,{sp:r.sp,env:n,action:null});return o&&e.labelLocation&&t&&"source-and-map"===t.output?f([op$1.SOURCE_MAP_LABEL_PUSH,u,i(o),l(e.labelLocation)],a,[op$1.SOURCE_MAP_LABEL_POP,u]):a},text:function(e,t){return f([op$1.PUSH_CURR_POS],C(e.expression,{sp:t.sp+1,env:p(t.env),action:null}),h(e.match||0,[op$1.IF_NOT_ERROR],f([op$1.POP],[op$1.TEXT]),[op$1.NIP]))},simple_and:function(e,t){return g(e.expression,!1,t)},simple_not:function(e,t){return g(e.expression,!0,t)},optional:function(e,t){return f(C(e.expression,{sp:t.sp,env:p(t.env),action:null}),h(-(e.expression.match||0),[op$1.IF_ERROR],f([op$1.POP],[op$1.PUSH_NULL]),[]))},zero_or_more:function(e,t){var r=C(e.expression,{sp:t.sp+1,env:p(t.env),action:null});return f([op$1.PUSH_EMPTY_ARRAY],r,m(r),[op$1.POP])},one_or_more:function(e,t){var r=C(e.expression,{sp:t.sp+1,env:p(t.env),action:null});return f([op$1.PUSH_EMPTY_ARRAY],r,h(e.expression.match||0,[op$1.IF_NOT_ERROR],f(m(r),[op$1.POP]),f([op$1.POP],[op$1.POP],[op$1.PUSH_FAILED])))},repeated:function(e,t){var r=e.min?e.min:e.max,n="constant"!==r.type||r.value>0,o="constant"!==e.max.type&&null!==e.max.value,u=n?2:1,a=e.min?E(e.min,t.env,t.sp,2+("function"===e.max.type?1:0)):{pre:[],post:[],sp:t.sp},i=E(e.max,t.env,a.sp,u),s=C(e.expression,{sp:i.sp+u,env:p(t.env),action:null}),c=null!==e.delimiter?C(e.expression,{sp:i.sp+u+1,env:p(t.env),action:null}):s,l=function(e,t,r,n,o){return e?f([op$1.PUSH_CURR_POS],C(e,{sp:n.sp+o+1,env:p(n.env),action:null}),h(e.match||0,[op$1.IF_NOT_ERROR],f([op$1.POP],r,h(-t,[op$1.IF_ERROR],[op$1.POP,op$1.POP_CURR_POS,op$1.PUSH_FAILED],[op$1.NIP])),[op$1.NIP])):r}(e.delimiter,e.expression.match||0,c,t,u),d=_(l,e.max),g=o?_(s,e.max):s,A=f(n?[op$1.PUSH_CURR_POS]:[],[op$1.PUSH_EMPTY_ARRAY],g,m(d),[op$1.POP]);return f(a.pre,i.pre,n?function(e,t){var r="constant"===t.type?[op$1.IF_LT,t.value]:[op$1.IF_LT_DYNAMIC,t.sp];return f(e,h(SOMETIMES_MATCH,r,[op$1.POP,op$1.POP_CURR_POS,op$1.PUSH_FAILED],[op$1.NIP]))}(A,r):A,i.post,a.post)},group:function(e,t){return C(e.expression,{sp:t.sp,env:p(t.env),action:null})},semantic_and:function(e,t){return A(e,!1,t)},semantic_not:function(e,t){return A(e,!0,t)},rule_ref:function(t){return[op$1.RULE,asts$5.indexOfRule(e,t.name)]},literal:function(e){if(e.value.length>0){var t=e.match||0,r=t===SOMETIMES_MATCH||t===ALWAYS_MATCH&&!e.ignoreCase?i(e.ignoreCase?e.value.toLowerCase():e.value):-1,n=t!==ALWAYS_MATCH?s({type:"literal",value:e.value,ignoreCase:e.ignoreCase}):-1;return h(t,e.ignoreCase?[op$1.MATCH_STRING_IC,r]:[op$1.MATCH_STRING,r],e.ignoreCase?[op$1.ACCEPT_N,e.value.length]:[op$1.ACCEPT_STRING,r],[op$1.FAIL,n])}return[op$1.PUSH_EMPTY_STRING]},class:function(e){var t=e.match||0,r=t===SOMETIMES_MATCH?function(e){var t={value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase},r=JSON.stringify(t),o=n.findIndex((function(e){return JSON.stringify(e)===r}));return-1===o?n.push(t)-1:o}(e):-1,o=t!==ALWAYS_MATCH?s({type:"class",value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase}):-1;return h(t,[op$1.MATCH_CHAR_CLASS,r],[op$1.ACCEPT_N,1],[op$1.FAIL,o])},any:function(e){var t=e.match||0,r=t!==ALWAYS_MATCH?s({type:"any"}):-1;return h(t,[op$1.MATCH_ANY],[op$1.ACCEPT_N,1],[op$1.FAIL,r])}},t&&"source-and-map"===t.output&&Object.keys(v).forEach((function(e){var t=v[e];v[e]=function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=t.apply(void 0,__spreadArray$3([e],r,!1));return void 0!==o&&e.location?f([op$1.SOURCE_MAP_PUSH,l(e.location)],o,[op$1.SOURCE_MAP_POP]):o}})),visitor$9.build(v));C(e)}var generateBytecode_1=generateBytecode$1,sourceMap={},sourceMapGenerator={},base64Vlq={},base64$3={};const intToCharMap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");base64$3.encode=function(e){if(0<=e&&e<intToCharMap.length)return intToCharMap[e];throw new TypeError("Must be between 0 and 63: "+e)};const base64$2=base64$3,VLQ_BASE_SHIFT=5,VLQ_BASE=1<<VLQ_BASE_SHIFT,VLQ_BASE_MASK=VLQ_BASE-1,VLQ_CONTINUATION_BIT=VLQ_BASE;function toVLQSigned(e){return e<0?1+(-e<<1):0+(e<<1)}base64Vlq.encode=function(e){let t,r="",n=toVLQSigned(e);do{t=n&VLQ_BASE_MASK,n>>>=VLQ_BASE_SHIFT,n>0&&(t|=VLQ_CONTINUATION_BIT),r+=base64$2.encode(t)}while(n>0);return r};var util$3={};function getArg(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$3.getArg=getArg;const supportsNullProto=!("__proto__"in Object.create(null));function identity(e){return e}function toSetString(e){return isProtoString(e)?"$"+e:e}function fromSetString(e){return isProtoString(e)?e.slice(1):e}function isProtoString(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp(e.name,t.name)))))}util$3.toSetString=supportsNullProto?identity:toSetString,util$3.fromSetString=supportsNullProto?identity:fromSetString,util$3.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated;const PROTOCOL="http:",PROTOCOL_AND_HOST=`${PROTOCOL}//host`;function createSafeHandler(e){return t=>{const r=getURLType(t),n=buildSafeBase(t),o=new URL(t,n);e(o);const u=o.toString();return"absolute"===r?u:"scheme-relative"===r?u.slice(PROTOCOL.length):"path-absolute"===r?u.slice(PROTOCOL_AND_HOST.length):computeRelativeURL(n,u)}}function withBase(e,t){return new URL(e,t).toString()}function buildUniqueSegment(e,t){let r=0;for(;;){const n=e+r++;if(-1===t.indexOf(n))return n}}function buildSafeBase(e){const t=e.split("..").length-1,r=buildUniqueSegment("p",e);let n=`${PROTOCOL_AND_HOST}/`;for(let e=0;e<t;e++)n+=`${r}/`;return n}const ABSOLUTE_SCHEME=/^[A-Za-z0-9\+\-\.]+:/;function getURLType(e){return"/"===e[0]?"/"===e[1]?"scheme-relative":"path-absolute":ABSOLUTE_SCHEME.test(e)?"absolute":"path-relative"}function computeRelativeURL(e,t){"string"==typeof e&&(e=new URL(e)),"string"==typeof t&&(t=new URL(t));const r=t.pathname.split("/"),n=e.pathname.split("/");for(n.length>0&&!n[n.length-1]&&n.pop();r.length>0&&n.length>0&&r[0]===n[0];)r.shift(),n.shift();return n.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory=createSafeHandler((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),normalize=createSafeHandler((e=>{}));function join(e,t){const r=getURLType(t),n=getURLType(e);if(e=ensureDirectory(e),"absolute"===r)return withBase(t,void 0);if("absolute"===n)return withBase(t,e);if("scheme-relative"===r)return normalize(t);if("scheme-relative"===n)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL.length);if("path-absolute"===r)return normalize(t);if("path-absolute"===n)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL_AND_HOST.length);const o=buildSafeBase(t+e);return computeRelativeURL(o,withBase(t,withBase(e,o)))}function relative(e,t){const r=relativeIfPossible(e,t);return"string"==typeof r?r:normalize(t)}function relativeIfPossible(e,t){if(getURLType(e)!==getURLType(t))return null;const r=buildSafeBase(e+t),n=new URL(e,r),o=new URL(t,r);try{new URL("",o.toString())}catch(e){return null}return o.protocol!==n.protocol||o.user!==n.user||o.password!==n.password||o.hostname!==n.hostname||o.port!==n.port?null:computeRelativeURL(n,o)}util$3.normalize=normalize,util$3.join=join,util$3.relative=relative;var arraySet={};let ArraySet$1=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const n=new e;for(let e=0,o=t.length;e<o;e++)n.add(t[e],r);return n}size(){return this._set.size}add(e,t){const r=this.has(e),n=this._array.length;r&&!t||this._array.push(e),r||this._set.set(e,n)}has(e){return this._set.has(e)}indexOf(e){const t=this._set.get(e);if(t>=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)}toArray(){return this._array.slice()}};arraySet.ArraySet=ArraySet$1;var mappingList={};const util$2=util$3;function generatedPositionAfter(e,t){const r=e.generatedLine,n=t.generatedLine,o=e.generatedColumn,u=t.generatedColumn;return n>r||n==r&&u>=o||util$2.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$1=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$2.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList.MappingList=MappingList$1;const base64VLQ=base64Vlq,util$1=util$3,ArraySet=arraySet.ArraySet,MappingList=mappingList.MappingList;let SourceMapGenerator$1=class e{constructor(e){e||(e={}),this._file=util$1.getArg(e,"file",null),this._sourceRoot=util$1.getArg(e,"sourceRoot",null),this._skipValidation=util$1.getArg(e,"skipValidation",!1),this._sources=new ArraySet,this._names=new ArraySet,this._mappings=new MappingList,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,n=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$1.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),n.addMapping(t)})),t.sources.forEach((function(e){let o=e;null!=r&&(o=util$1.relative(r,e)),n._sources.has(o)||n._sources.add(o);const u=t.sourceContentFor(e);null!=u&&n.setSourceContent(e,u)})),n}addMapping(e){const t=util$1.getArg(e,"generated"),r=util$1.getArg(e,"original",null);let n=util$1.getArg(e,"source",null),o=util$1.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,n,o),null!=n&&(n=String(n),this._sources.has(n)||this._sources.add(n)),null!=o&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r&&r.line,originalColumn:r&&r.column,source:n,name:o})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$1.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$1.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$1.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let n=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');n=e.file}const o=this._sourceRoot;null!=o&&(n=util$1.relative(o,n));const u=this._mappings.toArray().length>0?new ArraySet:this._sources,a=new ArraySet;this._mappings.unsortedForEach((function(t){if(t.source===n&&null!=t.originalLine){const n=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=n.source&&(t.source=n.source,null!=r&&(t.source=util$1.join(r,t.source)),null!=o&&(t.source=util$1.relative(o,t.source)),t.originalLine=n.line,t.originalColumn=n.column,null!=n.name&&(t.name=n.name))}const i=t.source;null==i||u.has(i)||u.add(i);const s=t.name;null==s||a.has(s)||a.add(s)}),this),this._sources=u,this._names=a,e.sources.forEach((function(t){const n=e.sourceContentFor(t);null!=n&&(null!=r&&(t=util$1.join(r,t)),null!=o&&(t=util$1.relative(o,t)),this.setSourceContent(t,n))}),this)}_validateMapping(e,t,r,n){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!n);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:n}))}_serializeMappings(){let e,t,r,n,o=0,u=1,a=0,i=0,s=0,c=0,l="";const p=this._mappings.toArray();for(let f=0,h=p.length;f<h;f++){if(t=p[f],e="",t.generatedLine!==u)for(o=0;t.generatedLine!==u;)e+=";",u++;else if(f>0){if(!util$1.compareByGeneratedPositionsInflated(t,p[f-1]))continue;e+=","}e+=base64VLQ.encode(t.generatedColumn-o),o=t.generatedColumn,null!=t.source&&(n=this._sources.indexOf(t.source),e+=base64VLQ.encode(n-c),c=n,e+=base64VLQ.encode(t.originalLine-1-i),i=t.originalLine-1,e+=base64VLQ.encode(t.originalColumn-a),a=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ.encode(r-s),s=r)),l+=e}return l}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$1.relative(t,e));const r=util$1.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$1.prototype._version=3,sourceMapGenerator.SourceMapGenerator=SourceMapGenerator$1;var sourceNode={};const SourceMapGenerator=sourceMapGenerator.SourceMapGenerator,util=util$3,REGEX_NEWLINE=/(\r?\n)/,NEWLINE_CODE=10,isSourceNode="$$$isSourceNode$$$";let SourceNode$2=class e{constructor(e,t,r,n,o){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==o?null:o,this[isSourceNode]=!0,null!=n&&this.add(n)}static fromStringWithSourceMap(t,r,n){const o=new e,u=t.split(REGEX_NEWLINE);let a=0;const i=function(){return e()+(e()||"");function e(){return a<u.length?u[a++]:void 0}};let s,c=1,l=0,p=null;return r.eachMapping((function(e){if(null!==p){if(!(c<e.generatedLine)){s=u[a]||"";const t=s.substr(0,e.generatedColumn-l);return u[a]=s.substr(e.generatedColumn-l),l=e.generatedColumn,f(p,t),void(p=e)}f(p,i()),c++,l=0}for(;c<e.generatedLine;)o.add(i()),c++;l<e.generatedColumn&&(s=u[a]||"",o.add(s.substr(0,e.generatedColumn)),u[a]=s.substr(e.generatedColumn),l=e.generatedColumn),p=e}),this),a<u.length&&(p&&f(p,i()),o.add(u.splice(a).join(""))),r.sources.forEach((function(e){const t=r.sourceContentFor(e);null!=t&&(null!=n&&(e=util.join(n,e)),o.setSourceContent(e,t))})),o;function f(t,r){if(null===t||void 0===t.source)o.add(r);else{const u=n?util.join(n,t.source):t.source;o.add(new e(t.originalLine,t.originalColumn,u,r,t.name))}}}add(e){if(Array.isArray(e))e.forEach((function(e){this.add(e)}),this);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this}prepend(e){if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,n=this.children.length;r<n;r++)t=this.children[r],t[isSourceNode]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})}join(e){let t,r;const n=this.children.length;if(n>0){for(t=[],r=0;r<n-1;r++)t.push(this.children[r]),t.push(e);t.push(this.children[r]),this.children=t}return this}replaceRight(e,t){const r=this.children[this.children.length-1];return r[isSourceNode]?r.replaceRight(e,t):"string"==typeof r?this.children[this.children.length-1]=r.replace(e,t):this.children.push("".replace(e,t)),this}setSourceContent(e,t){this.sourceContents[util.toSetString(e)]=t}walkSourceContents(e){for(let t=0,r=this.children.length;t<r;t++)this.children[t][isSourceNode]&&this.children[t].walkSourceContents(e);const t=Object.keys(this.sourceContents);for(let r=0,n=t.length;r<n;r++)e(util.fromSetString(t[r]),this.sourceContents[t[r]])}toString(){let e="";return this.walk((function(t){e+=t})),e}toStringWithSourceMap(e){const t={code:"",line:1,column:0},r=new SourceMapGenerator(e);let n=!1,o=null,u=null,a=null,i=null;return this.walk((function(e,s){t.code+=e,null!==s.source&&null!==s.line&&null!==s.column?(o===s.source&&u===s.line&&a===s.column&&i===s.name||r.addMapping({source:s.source,original:{line:s.line,column:s.column},generated:{line:t.line,column:t.column},name:s.name}),o=s.source,u=s.line,a=s.column,i=s.name,n=!0):n&&(r.addMapping({generated:{line:t.line,column:t.column}}),o=null,n=!1);for(let u=0,a=e.length;u<a;u++)e.charCodeAt(u)===NEWLINE_CODE?(t.line++,t.column=0,u+1===a?(o=null,n=!1):n&&r.addMapping({source:s.source,original:{line:s.line,column:s.column},generated:{line:t.line,column:t.column},name:s.name})):t.column++})),this.walkSourceContents((function(e,t){r.setSourceContent(e,t)})),{code:t.code,map:r}}};sourceNode.SourceNode=SourceNode$2,sourceMap.SourceMapGenerator=sourceMapGenerator.SourceMapGenerator,sourceMap.SourceNode=sourceNode.SourceNode;var SourceNode$1=sourceMap.SourceNode,GrammarLocation$2=grammarLocation,Stack$1=function(){function e(e,t,r,n){this.sp=-1,this.maxSp=-1,this.varName=t,this.ruleName=e,this.type=r,this.bytecode=n,this.labels={},this.sourceMapStack=[]}return e.prototype.name=function(e){if(e<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack underflow: attempt to use a variable '").concat(this.varName,"<x>' at an index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.varName+e},e.sourceNode=function(e,t,r){var n=GrammarLocation$2.offsetStart(e);return new SourceNode$1(n.line,n.column?n.column-1:null,String(e.source),t,r)},e.prototype.push=function(t){++this.sp>this.maxSp&&(this.maxSp=this.sp);var r=this.labels[this.sp],n=[this.name(this.sp)," = ",t,";"];if(r){if(this.sourceMapStack.length){var o=e.sourceNode(r.location,n.splice(0,2),r.label),u=this.sourceMapPopInternal(),a=u.parts,i=u.location,s=i.start.offset<r.location.end.offset?{start:r.location.end,end:i.end,source:i.source}:i,c=e.sourceNode(s,n.concat("\n"));return this.sourceMapStack.push([a,a.length+1,i]),new SourceNode$1(null,null,r.location.source,[o,c])}return e.sourceNode(r.location,n.concat("\n"))}return n.join("")},e.prototype.pop=function(e){var t=this;return void 0!==e?(this.sp-=e,Array.from({length:e},(function(e,r){return t.name(t.sp+1+r)}))):this.name(this.sp--)},e.prototype.top=function(){return this.name(this.sp)},e.prototype.index=function(e){if(e<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack overflow: attempt to get a variable at a negative index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.name(this.sp-e)},e.prototype.result=function(){if(this.maxSp<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack is empty, can't get the result.\nBytecode: ").concat(this.bytecode));return this.name(0)},e.prototype.defines=function(){var e=this;return this.maxSp<0?"":this.type+" "+Array.from({length:this.maxSp+1},(function(t,r){return e.name(r)})).join(", ")+";"},e.prototype.checkedIf=function(e,t,r){var n=this.sp,o=t();if(!r)return[o];var u=this.sp;this.sp=n;var a=r();if(u!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+e+": Branches of a condition can't move the stack pointer differently (before: "+n+", after then: "+u+", after else: "+this.sp+"). Bytecode: "+this.bytecode);return[o,a]},e.prototype.checkedLoop=function(e,t){var r=this.sp,n=t();if(r!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+e+": Body of a loop can't move the stack pointer (before: "+r+", after: "+this.sp+"). Bytecode: "+this.bytecode);return n},e.prototype.sourceMapPush=function(e,t){if(this.sourceMapStack.length){var r=this.sourceMapStack[this.sourceMapStack.length-1];r[2].start.offset===t.start.offset&&r[2].end.offset>t.end.offset&&(r[2]={start:t.end,end:r[2].end,source:r[2].source})}this.sourceMapStack.push([e,e.length,t])},e.prototype.sourceMapPopInternal=function(){var e=this.sourceMapStack.pop();if(!e)throw new RangeError("Rule '".concat(this.ruleName,"': Attempting to pop an empty source map stack.\nBytecode: ").concat(this.bytecode));var t=e[0],r=e[1],n=e[2],o=t.splice(r).map((function(e){return e instanceof SourceNode$1?e:e+"\n"}));if(o.length){var u=GrammarLocation$2.offsetStart(n);t.push(new SourceNode$1(u.line,u.column-1,String(n.source),o))}return{parts:t,location:n}},e.prototype.sourceMapPop=function(e){var t=this.sourceMapPopInternal().location;if(this.sourceMapStack.length&&t.end.offset<this.sourceMapStack[this.sourceMapStack.length-1][2].end.offset){var r=this.sourceMapPopInternal(),n=r.parts,o=r.location,u=o.start.offset<t.end.offset?{start:t.end,end:o.end,source:o.source}:o;this.sourceMapStack.push([n,n.length+(e||0),u])}},e}(),stack=Stack$1,version="3.0.2",utils={};function hex(e){return e.charCodeAt(0).toString(16).toUpperCase()}function stringEscape$1(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+hex(e)})).replace(/[\x10-\x1F\x7F-\xFF]/g,(function(e){return"\\x"+hex(e)})).replace(/[\u0100-\u0FFF]/g,(function(e){return"\\u0"+hex(e)})).replace(/[\u1000-\uFFFF]/g,(function(e){return"\\u"+hex(e)}))}function regexpClassEscape$1(e){return e.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+hex(e)})).replace(/[\x10-\x1F\x7F-\xFF]/g,(function(e){return"\\x"+hex(e)})).replace(/[\u0100-\u0FFF]/g,(function(e){return"\\u0"+hex(e)})).replace(/[\u1000-\uFFFF]/g,(function(e){return"\\u"+hex(e)}))}function base64$1(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=e.length%3,n=e.length-r,o="",u=0;u<n;u+=3)o+=t[e[u]>>2],o+=t[(3&e[u])<<4|e[u+1]>>4],o+=t[(15&e[u+1])<<2|e[u+2]>>6],o+=t[63&e[u+2]];return 1===r?(o+=t[e[n]>>2],o+=t[(3&e[n])<<4],o+="=="):2===r&&(o+=t[e[n]>>2],o+=t[(3&e[n])<<4|e[n+1]>>4],o+=t[(15&e[n+1])<<2],o+="="),o}utils.hex=hex,utils.stringEscape=stringEscape$1,utils.regexpClassEscape=regexpClassEscape$1,utils.base64=base64$1;var __spreadArray$2=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,u=t.length;o<u;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},asts$4=asts_1,op=opcodes_1,Stack=stack,VERSION$1=version,_a=utils,stringEscape=_a.stringEscape,regexpClassEscape=_a.regexpClassEscape,SourceNode=sourceMap.SourceNode,GrammarLocation$1=grammarLocation;function toSourceNode(e,t,r){var n=GrammarLocation$1.offsetStart(t),o=n.line,u=n.column-1,a=e.split("\n");return 1===a.length?new SourceNode(o,u,String(t.source),e,r):new SourceNode(null,null,String(t.source),a.map((function(e,n){return new SourceNode(o+n,0===n?u:0,String(t.source),n===a.length-1?e:[e,"\n"],r)})))}function wrapInSourceNode(e,t,r,n,o){if(r){var u=GrammarLocation$1.offsetEnd(r);return new SourceNode(null,null,String(r.source),[e,toSourceNode(t,r,o),new SourceNode(u.line,u.column-1,String(r.source),n)])}return new SourceNode(null,null,null,[e,t,n])}function generateJS$1(e,t){if(!(e.literals&&e.locations&&e.classes&&e.expectations&&e.functions))throw new Error("generateJS: generate bytecode was not called.");var r=e.literals,n=e.locations,o=e.classes,u=e.expectations,a=e.functions;if(!t.allowedStartRules)throw new Error("generateJS: options.allowedStartRules was not set.");var i=t.allowedStartRules,s=t.dependencies||{};function c(e){var t=!0,r=0;return function e(n){return Array.isArray(n)?n.map((function(t){return e(t)})):n instanceof SourceNode?(r++,n.children=e(n.children),r--,n):(n=t?n.replace(/^(.+)$/gm," $1"):n.replace(/\n(\s*\S)/g,"\n $1"),t=!r||n.endsWith("\n"),n)}(e)}function l(e){return"peg$c"+e}function p(e){return"peg$r"+e}function f(e){return"peg$e"+e}function h(e){return"peg$f"+e}function d(e){return"peg$parse"+e}function g(e){return e.codeLocation?toSourceNode(e.code,e.codeLocation,"$"+e.type):e.code}e.code=function(e){function r(){return["// @generated by Peggy ".concat(VERSION$1,"."),"//","// https://peggyjs.org/"]}function n(){return t.trace?["{"," SyntaxError: peg$SyntaxError,"," DefaultTracer: peg$DefaultTracer,"," parse: peg$parse","}"].join("\n"):["{"," SyntaxError: peg$SyntaxError,"," parse: peg$parse","}"].join("\n")}var o={bare:function(){return __spreadArray$2(__spreadArray$2([],r(),!0),["(function() {",' "use strict";',"",e,"",c("return "+n()+";"),"})()"],!1)},commonjs:function(){var t=Object.keys(s),o=r();return o.push("",'"use strict";',""),t.length>0&&(t.forEach((function(e){o.push("var "+e+' = require("'+stringEscape(s[e])+'");')})),o.push("")),o.push(e,"","module.exports = "+n()+";"),o},es:function(){var n=Object.keys(s),o=r();return o.push(""),n.length>0&&(n.forEach((function(e){o.push("import "+e+' from "'+stringEscape(s[e])+'";')})),o.push("")),o.push(e,"","export {"," peg$SyntaxError as SyntaxError,",t.trace?" peg$DefaultTracer as DefaultTracer,":""," peg$parse as parse","};"),o},amd:function(){var t=Object.keys(s),o="["+t.map((function(e){return s[e]})).map((function(e){return'"'+stringEscape(e)+'"'})).join(", ")+"]",u=t.join(", ");return __spreadArray$2(__spreadArray$2([],r(),!0),["define("+o+", function("+u+") {",' "use strict";',"",e,"",c("return "+n()+";"),"});"],!1)},globals:function(){return __spreadArray$2(__spreadArray$2([],r(),!0),["(function(root) {",' "use strict";',"",e,"",c("root."+t.exportVar+" = "+n()+";"),"})(this);"],!1)},umd:function(){var o=Object.keys(s),u=o.map((function(e){return s[e]})),a="["+u.map((function(e){return'"'+stringEscape(e)+'"'})).join(", ")+"]",i=u.map((function(e){return'require("'+stringEscape(e)+'")'})).join(", "),l=o.join(", "),p=r();return p.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+a+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+i+");"),null!==t.exportVar&&p.push(" } else {"," root."+t.exportVar+" = factory();"),p.push(" }","})(this, function("+l+") {",' "use strict";',"",e,"",c("return "+n()+";"),"});"),p}}[t.format||"bare"]();return new SourceNode(null,null,t.grammarSource,o.map((function(e){return e instanceof SourceNode?e:e+"\n"})))}(function(){var s=[];e.topLevelInitializer&&(s.push(g(e.topLevelInitializer)),s.push("")),s.push("function peg$subclass(child, parent) {"," function C() { this.constructor = child; }"," C.prototype = parent.prototype;"," child.prototype = new C();","}","","function peg$SyntaxError(message, expected, found, location) {"," var self = Error.call(this, message);"," // istanbul ignore next Check is a necessary evil to support older environments"," if (Object.setPrototypeOf) {"," Object.setPrototypeOf(self, peg$SyntaxError.prototype);"," }"," self.expected = expected;"," self.found = found;"," self.location = location;",' self.name = "SyntaxError";'," return self;","}","","peg$subclass(peg$SyntaxError, Error);","","function peg$padEnd(str, targetLength, padString) {",' padString = padString || " ";'," if (str.length > targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))'," ? this.location.source.offset(s)"," : s;",' var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;'," if (src) {"," var e = this.location.end;"," var filler = peg$padEnd(\"\", offset_s.line.toString().length, ' ');"," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --\x3e " + loc + "\\n"',' + filler + " |\\n"',' + offset_s.line + " | " + line + "\\n"',' + filler + " | " + peg$padEnd("", s.column - 1, \' \')',' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/"/g, "\\\\\\"")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/\\]/g, "\\\\]")',' .replace(/\\^/g, "\\\\^")',' .replace(/-/g, "\\\\-")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),t.trace&&s.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");var A="{ "+i.map((function(e){return e+": "+d(e)})).join(", ")+" }",m=d(i[0]);return s.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+A+";"," var peg$startRuleFunction = "+m+";","",new SourceNode(null,null,t.grammarSource,__spreadArray$2([r.map((function(e,t){return" var "+l(t)+' = "'+stringEscape(e)+'";'})).concat("",o.map((function(e,t){return" var "+p(t)+" = /^["+((r=e).inverted?"^":"")+r.value.map((function(e){return Array.isArray(e)?regexpClassEscape(e[0])+"-"+regexpClassEscape(e[1]):regexpClassEscape(e)})).join("")+"]/"+(r.ignoreCase?"i":"")+";";var r}))).concat("",u.map((function(e,t){return" var "+f(t)+" = "+function(e){switch(e.type){case"rule":return'peg$otherExpectation("'+stringEscape(e.value)+'")';case"literal":return'peg$literalExpectation("'+stringEscape(e.value)+'", '+e.ignoreCase+")";case"class":return"peg$classExpectation(["+e.value.map((function(e){return Array.isArray(e)?'["'+stringEscape(e[0])+'", "'+stringEscape(e[1])+'"]':'"'+stringEscape(e)+'"'})).join(", ")+"], "+e.inverted+", "+e.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(e)+")")}}(e)+";"}))).concat("").join("\n")],a.map((function(e,t){return wrapInSourceNode("\n var ".concat(h(t)," = function(").concat(e.params.join(", "),") {"),e.body,e.location,"};")})),!0)),""," var peg$currPos = 0;"," var peg$savedPos = 0;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = 0;"," var peg$maxFailExpected = [];"," var peg$silentFails = 0;",""),t.cache&&s.push(" var peg$resultsCache = {};",""),t.trace&&s.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),s.push(" var peg$result;","",' if ("startRule" in options) {'," if (!(options.startRule in peg$startRuleFunctions)) {",' throw new Error("Can\'t start parsing from rule \\"" + options.startRule + "\\".");'," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," if (pos >= peg$posDetailsCache.length) {"," p = peg$posDetailsCache.length - 1;"," } else {"," p = pos;"," while (!peg$posDetailsCache[--p]) {}"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos, offset) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," var res = {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };",' if (offset && peg$source && (typeof peg$source.offset === "function")) {'," res.start = peg$source.offset(res.start);"," res.end = peg$source.offset(res.end);"," }"," return res;"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),e.rules.forEach((function(o){s.push.apply(s,c(function(o){var u=[],a=o.bytecode,i=new Stack(o.name,"s","var",a),s=function t(o){var u=0,a=o.length,s=[],g=void 0;function A(e,r,n){var a=r+3,l=o[u+a-2],p=o[u+a-1],f=i.checkedIf(u,(function(){return u+=a+l,(n||t)(o.slice(u-l,u))}),p>0?function(){return u+=p,t(o.slice(u-p,u))}:null),h=f[0],d=f[1];s.push("if ("+e+") {"),s.push.apply(s,c(h)),p>0&&(s.push("} else {"),s.push.apply(s,c(d))),s.push("}")}function m(e,r,n){var a=r+3,c=1===n?"input.charAt(peg$currPos)":"input.substr(peg$currPos, "+n+")",l=null;o[u+a]===op.ACCEPT_N&&o[u+a+1]===n&&(s.push(i.push(c)),c=i.pop(),l=function(e){i.sp++;var r=t(e.slice(2));return r.unshift(1===n?"peg$currPos++;":"peg$currPos += "+n+";"),r}),A(e(c,null!==l),r,l)}for(var E=function(){switch(o[u]){case op.PUSH_EMPTY_STRING:s.push(i.push("''")),u++;break;case op.PUSH_CURR_POS:s.push(i.push("peg$currPos")),u++;break;case op.PUSH_UNDEFINED:s.push(i.push("undefined")),u++;break;case op.PUSH_NULL:s.push(i.push("null")),u++;break;case op.PUSH_FAILED:s.push(i.push("peg$FAILED")),u++;break;case op.PUSH_EMPTY_ARRAY:s.push(i.push("[]")),u++;break;case op.POP:i.pop(),u++;break;case op.POP_CURR_POS:s.push("peg$currPos = "+i.pop()+";"),u++;break;case op.POP_N:i.pop(o[u+1]),u+=2;break;case op.NIP:g=i.pop(),i.pop(),s.push(i.push(g)),u++;break;case op.APPEND:g=i.pop(),s.push(i.top()+".push("+g+");"),u++;break;case op.WRAP:s.push(i.push("["+i.pop(o[u+1]).join(", ")+"]")),u+=2;break;case op.TEXT:s.push(i.push("input.substring("+i.pop()+", peg$currPos)")),u++;break;case op.PLUCK:var a=o[u+3-1],E=3+a;g=o.slice(u+3,u+E),g=1===a?i.index(g[0]):"[ ".concat(g.map((function(e){return i.index(e)})).join(", ")," ]"),i.pop(o[u+1]),s.push(i.push(g)),u+=E;break;case op.IF:A(i.top(),0);break;case op.IF_ERROR:A(i.top()+" === peg$FAILED",0);break;case op.IF_NOT_ERROR:A(i.top()+" !== peg$FAILED",0);break;case op.IF_LT:A(i.top()+".length < "+o[u+1],1);break;case op.IF_GE:A(i.top()+".length >= "+o[u+1],1);break;case op.IF_LT_DYNAMIC:A(i.top()+".length < ("+i.index(o[u+1])+"|0)",1);break;case op.IF_GE_DYNAMIC:A(i.top()+".length >= ("+i.index(o[u+1])+"|0)",1);break;case op.WHILE_NOT_ERROR:y=i.top()+" !== peg$FAILED",S=o[u+2-1],F=i.checkedLoop(u,(function(){return u+=2+S,t(o.slice(u-S,u))})),s.push("while ("+y+") {"),s.push.apply(s,c(F)),s.push("}");break;case op.MATCH_ANY:A("input.length > peg$currPos",0);break;case op.MATCH_STRING:var _=o[u+1],v=r[_];m((function(e,t){return v.length>1?"".concat(e," === ").concat(l(_)):(e=t?"".concat(e,".charCodeAt(0)"):"input.charCodeAt(peg$currPos)","".concat(e," === ").concat(v.charCodeAt(0)))}),1,v.length);break;case op.MATCH_STRING_IC:var C=o[u+1];m((function(e){return"".concat(e,".toLowerCase() === ").concat(l(C))}),1,r[C].length);break;case op.MATCH_CHAR_CLASS:var $=o[u+1];m((function(e){return"".concat(p($),".test(").concat(e,")")}),1,1);break;case op.ACCEPT_N:s.push(i.push(o[u+1]>1?"input.substr(peg$currPos, "+o[u+1]+")":"input.charAt(peg$currPos)")),s.push(o[u+1]>1?"peg$currPos += "+o[u+1]+";":"peg$currPos++;"),u+=2;break;case op.ACCEPT_STRING:s.push(i.push(l(o[u+1]))),s.push(r[o[u+1]].length>1?"peg$currPos += "+r[o[u+1]].length+";":"peg$currPos++;"),u+=2;break;case op.FAIL:s.push(i.push("peg$FAILED")),s.push("if (peg$silentFails === 0) { peg$fail("+f(o[u+1])+"); }"),u+=2;break;case op.LOAD_SAVED_POS:s.push("peg$savedPos = "+i.index(o[u+1])+";"),u+=2;break;case op.UPDATE_SAVED_POS:s.push("peg$savedPos = peg$currPos;"),u++;break;case op.CALL:g=function(e){var t=o[u+4-1];return h(o[u+1])+"("+o.slice(u+4,u+4+t).map((function(e){return i.index(e)})).join(", ")+")"}(),i.pop(o[u+2]),s.push(i.push(g)),u+=4+o[u+3];break;case op.RULE:s.push(i.push(d(e.rules[o[u+1]].name)+"()")),u+=2;break;case op.SILENT_FAILS_ON:s.push("peg$silentFails++;"),u++;break;case op.SILENT_FAILS_OFF:s.push("peg$silentFails--;"),u++;break;case op.SOURCE_MAP_PUSH:i.sourceMapPush(s,n[o[u+1]]),u+=2;break;case op.SOURCE_MAP_POP:i.sourceMapPop(),u++;break;case op.SOURCE_MAP_LABEL_PUSH:i.labels[o[u+1]]={label:r[o[u+2]],location:n[o[u+3]]},u+=4;break;case op.SOURCE_MAP_LABEL_POP:delete i.labels[o[u+1]],u+=2;break;default:throw new Error("Invalid opcode: "+o[u]+".")}var y,S,F};u<a;)E();return s}(a);return u.push(wrapInSourceNode("function ",d(o.name),o.nameLocation,"() {\n",o.name)),t.trace&&u.push(" var startPos = peg$currPos;"),u.push(c(i.defines())),u.push.apply(u,c(function(r,n){var o=[];return o.push(""),t.trace&&o.push("peg$tracer.trace({",' type: "rule.enter",'," rule: "+r+","," location: peg$computeLocation(startPos, startPos, true)","});",""),t.cache&&(o.push("var key = peg$currPos * "+e.rules.length+" + "+n+";","var cached = peg$resultsCache[key];","","if (cached) {"," peg$currPos = cached.nextPos;",""),t.trace&&o.push("if (cached.result !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+r+","," result: cached.result,"," location: peg$computeLocation(startPos, peg$currPos, true)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+r+","," location: peg$computeLocation(startPos, startPos, true)"," });","}",""),o.push(" return cached.result;","}","")),o}('"'+stringEscape(o.name)+'"',asts$4.indexOfRule(e,o.name)))),u.push.apply(u,c(s)),u.push.apply(u,c(function(e,r){var n=[];return t.cache&&n.push("","peg$resultsCache[key] = { nextPos: peg$currPos, result: "+r+" };"),t.trace&&n.push("","if ("+r+" !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+e+","," result: "+r+","," location: peg$computeLocation(startPos, peg$currPos, true)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+e+","," location: peg$computeLocation(startPos, startPos, true)"," });","}"),n.push("","return "+r+";"),n}('"'+stringEscape(o.name)+'"',i.result()))),u.push("}"),u}(o))),s.push("")})),e.initializer&&(s.push(g(e.initializer)),s.push("")),s.push(" peg$result = peg$startRuleFunction();",""," if (peg$result !== peg$FAILED && peg$currPos === input.length) {"," return peg$result;"," } else {"," if (peg$result !== peg$FAILED && peg$currPos < input.length) {"," peg$fail(peg$endExpectation());"," }",""," throw peg$buildStructuredError("," peg$maxFailExpected,"," peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,"," peg$maxFailPos < input.length"," ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)"," : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)"," );"," }","}"),new SourceNode(null,null,t.grammarSource,s.map((function(e){return e instanceof SourceNode?e:e+"\n"})))}())}var generateJs=generateJS$1,asts$3=asts_1,visitor$8=visitor_1;function removeProxyRules$1(e,t,r){var n=[];e.rules.forEach((function(o,u){var a;"rule"===(a=o).type&&"rule_ref"===a.expression.type&&(function(e,t,n){visitor$8.build({rule_ref:function(o){o.name===t&&(o.name=n,r.info('Proxy rule "'.concat(t,'" replaced by the rule "').concat(n,'"'),o.location,[{message:"This rule will be used",location:asts$3.findRule(e,n).nameLocation}]))}})(e)}(e,o.name,o.expression.name),-1===t.allowedStartRules.indexOf(o.name)&&n.push(u))})),n.reverse(),n.forEach((function(t){e.rules.splice(t,1)}))}var removeProxyRules_1=removeProxyRules$1,__assign=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},__assign.apply(this,arguments)},__spreadArray$1=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,u=t.length;o<u;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},visitor$7=visitor_1;function cloneOver(e,t){var r=e,n=t;Object.keys(r).forEach((function(e){return delete r[e]})),Object.keys(n).forEach((function(e){r[e]=n[e]}))}function cleanParts(e){e.sort((function(e,t){var r=Array.isArray(e)?e:[e,e],n=r[0],o=r[1],u=Array.isArray(t)?t:[t,t],a=u[0],i=u[1];return n!==a?n<a?-1:1:o!==i?o>i?-1:1:0}));for(var t="",r="",n=0;n<e.length;n++){var o=e[n],u=Array.isArray(o)?o:[o,o],a=u[0],i=u[1];i<=r?e.splice(n--,1):r.charCodeAt(0)+1>=a.charCodeAt(0)?(e.splice(n--,1),e[n]=[t,r=i]):(t=a,r=i)}return e}function mergeCharacterClasses$1(e){var t=Object.create(null);e.rules.forEach((function(e){return t[e.name]=e.expression}));var r=Object.create(null),n=[function(e,n){if("class"===e.type&&!e.inverted)return n&&((e=__assign({},e)).parts=__spreadArray$1([],e.parts,!0)),e;if("literal"===e.type&&1===e.value.length)return{type:"class",parts:[e.value],inverted:!1,ignoreCase:e.ignoreCase,location:e.location};if("rule_ref"===e.type){var a=t[e.name];if(a){r[e.name]||(r[e.name]=!0,u(a));var i=o(a,!0);return i&&(i.location=e.location),i}}return null},visitor$7.build({choice:function(e){var t=null,r=!1;e.alternatives.forEach((function(n,a){var i;u(n);var s=o(n);s?t&&t.ignoreCase===s.ignoreCase?((i=t.parts).push.apply(i,s.parts),e.alternatives[a-1]=t,e.alternatives[a]=t,t.location={source:t.location.source,start:t.location.start,end:s.location.end},r=!0):t=s:t=null})),r&&(e.alternatives=e.alternatives.filter((function(e,t,r){return!t||e!==r[t-1]})),e.alternatives.forEach((function(t,r){"class"===t.type&&(t.parts=cleanParts(t.parts),1!==t.parts.length||Array.isArray(t.parts[0])||t.inverted||(e.alternatives[r]={type:"literal",value:t.parts[0],ignoreCase:t.ignoreCase,location:t.location}))})),1===e.alternatives.length&&cloneOver(e,e.alternatives[0]))},text:function(e){if(u(e.expression),"class"===e.expression.type||"literal"===e.expression.type){var t=e.location;cloneOver(e,e.expression),e.location=t}}})],o=n[0],u=n[1];e.rules.forEach((function(e){r[e.name]=!0,u(e.expression)}))}var mergeCharacterClasses_1=mergeCharacterClasses$1,visitor$6=visitor_1;function reportDuplicateLabels$1(e,t,r){function n(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r]})),t}function o(e,t){u(e.expression,n(t))}var u=visitor$6.build({rule:function(e){u(e.expression,{})},choice:function(e,t){e.alternatives.forEach((function(e){u(e,n(t))}))},action:o,labeled:function(e,t){var n=e.label;n&&Object.prototype.hasOwnProperty.call(t,n)&&r.error('Label "'.concat(e.label,'" is already defined'),e.labelLocation,[{message:"Original label location",location:t[n]}]),u(e.expression,t),t[e.label]=e.labelLocation},text:o,simple_and:o,simple_not:o,optional:o,zero_or_more:o,one_or_more:o,repeated:function(e,t){e.delimiter&&u(e.delimiter,n(t)),u(e.expression,n(t))},group:o});u(e)}var reportDuplicateLabels_1=reportDuplicateLabels$1,visitor$5=visitor_1;function reportDuplicateRules$1(e,t,r){var n={};visitor$5.build({rule:function(e){Object.prototype.hasOwnProperty.call(n,e.name)?r.error('Rule "'.concat(e.name,'" is already defined'),e.nameLocation,[{message:"Original rule location",location:n[e.name]}]):n[e.name]=e.nameLocation}})(e)}var reportDuplicateRules_1=reportDuplicateRules$1,asts$2=asts_1,visitor$4=visitor_1;function reportInfiniteRecursion$1(e,t,r){var n=[],o=[],u=visitor$4.build({rule:function(e){n.push(e.name),u(e.expression),n.pop()},sequence:function(t){t.elements.every((function(t){return u(t),!asts$2.alwaysConsumesOnSuccess(e,t)}))},repeated:function(t){u(t.expression),t.delimiter&&!asts$2.alwaysConsumesOnSuccess(e,t.expression)&&u(t.delimiter)},rule_ref:function(t){o.push(t);var a=asts$2.findRule(e,t.name);if(-1!==n.indexOf(t.name))return n.push(t.name),void r.error("Possible infinite loop when parsing (left recursion: "+n.join(" -> ")+")",a.nameLocation,o.map((function(e,t,r){return{message:t+1!==r.length?"Step ".concat(t+1,': call of the rule "').concat(e.name,'" without input consumption'):"Step ".concat(t+1,": call itself without input consumption - left recursion"),location:e.location}})));a&&u(a),o.pop()}});u(e)}var reportInfiniteRecursion_1=reportInfiniteRecursion$1,asts$1=asts_1,visitor$3=visitor_1;function reportInfiniteRepetition$1(e,t,r){var n=visitor$3.build({zero_or_more:function(t){asts$1.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},one_or_more:function(t){asts$1.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},repeated:function(t){if(t.delimiter&&n(t.delimiter),!(asts$1.alwaysConsumesOnSuccess(e,t.expression)||t.delimiter&&asts$1.alwaysConsumesOnSuccess(e,t.delimiter)))if(null===t.max.value)r.error("Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",t.location);else{var o=t.min?t.min:t.max;r.warning("constant"===o.type&&"constant"===t.max.type?"An expression may not consume any input and may always match ".concat(t.max.value," times"):"An expression may not consume any input and may always match with a maximum repetition count",t.location)}}});n(e)}var reportInfiniteRepetition_1=reportInfiniteRepetition$1,asts=asts_1,visitor$2=visitor_1;function reportUndefinedRules$1(e,t,r){visitor$2.build({rule_ref:function(t){asts.findRule(e,t.name)||r.error('Rule "'.concat(t.name,'" is not defined'),t.location)}})(e)}var reportUndefinedRules_1=reportUndefinedRules$1,visitor$1=visitor_1;function reportIncorrectPlucking$1(e,t,r){var n=visitor$1.build({action:function(e){n(e.expression,e)},labeled:function(e,t){e.pick&&t&&r.error('"@" cannot be used with an action block',e.labelLocation,[{message:"Action block location",location:t.codeLocation}]),n(e.expression)}});n(e)}var reportIncorrectPlucking_1=reportIncorrectPlucking$1,__spreadArray=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,u=t.length;o<u;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},GrammarError$1=grammarError,Defaults=function(){function e(e){"function"==typeof(e=void 0!==e?e:{}).error&&(this.error=e.error),"function"==typeof e.warning&&(this.warning=e.warning),"function"==typeof e.info&&(this.info=e.info)}return e.prototype.error=function(){},e.prototype.warning=function(){},e.prototype.info=function(){},e}(),Session$1=function(){function e(e){this._callbacks=new Defaults(e),this._firstError=null,this.errors=0,this.problems=[],this.stage=null}return e.prototype.error=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];++this.errors,null===this._firstError&&(this._firstError=new(GrammarError$1.bind.apply(GrammarError$1,__spreadArray([void 0],t,!1))),this._firstError.stage=this.stage,this._firstError.problems=this.problems),this.problems.push(__spreadArray(["error"],t,!0)),(e=this._callbacks).error.apply(e,__spreadArray([this.stage],t,!1))},e.prototype.warning=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.problems.push(__spreadArray(["warning"],t,!0)),(e=this._callbacks).warning.apply(e,__spreadArray([this.stage],t,!1))},e.prototype.info=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.problems.push(__spreadArray(["info"],t,!0)),(e=this._callbacks).info.apply(e,__spreadArray([this.stage],t,!1))},e.prototype.checkErrors=function(){if(0!==this.errors)throw this._firstError},e}(),session=Session$1,generateBytecode=generateBytecode_1,generateJS=generateJs,inferenceMatchResult=inferenceMatchResult_1,removeProxyRules=removeProxyRules_1,mergeCharacterClasses=mergeCharacterClasses_1,reportDuplicateLabels=reportDuplicateLabels_1,reportDuplicateRules=reportDuplicateRules_1,reportInfiniteRecursion=reportInfiniteRecursion_1,reportInfiniteRepetition=reportInfiniteRepetition_1,reportUndefinedRules=reportUndefinedRules_1,reportIncorrectPlucking=reportIncorrectPlucking_1,Session=session,visitor=visitor_1,base64=utils.base64;function processOptions(e,t){var r={};return Object.keys(e).forEach((function(t){r[t]=e[t]})),Object.keys(t).forEach((function(e){Object.prototype.hasOwnProperty.call(r,e)||(r[e]=t[e])})),r}function isSourceMapCapable(e){return"string"==typeof e?e.length>0:e&&"function"==typeof e.offset}var compiler$1={visitor:visitor,passes:{check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRecursion,reportInfiniteRepetition,reportIncorrectPlucking],transform:[removeProxyRules,mergeCharacterClasses,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile:function(ast,passes,options){if(options=void 0!==options?options:{},options=processOptions(options,{allowedStartRules:[ast.rules[0].name],cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");if(0===options.allowedStartRules.length)throw new Error("Must have at least one start rule");var allRules=ast.rules.map((function(e){return e.name}));if(options.allowedStartRules.some((function(e){return"*"===e})))options.allowedStartRules=allRules;else for(var _i=0,_a=options.allowedStartRules;_i<_a.length;_i++){var rule=_a[_i];if(-1===allRules.indexOf(rule))throw new Error('Unknown start rule "'.concat(rule,'"'))}if(("source-and-map"===options.output||"source-with-inline-map"===options.output)&&!isSourceMapCapable(options.grammarSource))throw new Error("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps");var session=new Session(options);switch(Object.keys(passes).forEach((function(e){session.stage=e,session.info("Process stage ".concat(e)),passes[e].forEach((function(t){session.info("Process pass ".concat(e,".").concat(t.name)),t(ast,options,session)})),session.checkErrors()})),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;case"source-with-inline-map":if("undefined"==typeof TextEncoder)throw new Error("TextEncoder is not supported by this platform");var sourceMap=ast.code.toStringWithSourceMap(),encoder=new TextEncoder,b64=base64(encoder.encode(JSON.stringify(sourceMap.map.toJSON())));return sourceMap.code+"//# sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(b64,"\n");case"ast":return ast;default:throw new Error("Invalid output format: "+options.output+".")}}},compiler_1=compiler$1,OPS_TO_PREFIXED_TYPES={$:"text","&":"simple_and","!":"simple_not"},OPS_TO_SUFFIXED_TYPES={"?":"optional","*":"zero_or_more","+":"one_or_more"},OPS_TO_SEMANTIC_PREDICATE_TYPES={"&":"semantic_and","!":"semantic_not"};function peg$subclass(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function peg$SyntaxError(e,t,r,n){var o=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(o,peg$SyntaxError.prototype),o.expected=t,o.found=r,o.location=n,o.name="SyntaxError",o}function peg$padEnd(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,e+(r+=r.repeat(t)).slice(0,t))}function peg$parse(e,t){var r,n={},o=(t=void 0!==t?t:{}).grammarSource,u={Grammar:pr},a=pr,i="{",s="}",c="=",l="/",p="@",f=":",h="|",d=",",g="..",A="(",m=")",E="\n",_="\r\n",v="/*",C="*/",$="//",y="\\",S="i",F='"',P="'",x="[",D="^",b="]",B="-",R="0",O="b",L="f",M="n",T="r",w="t",I="v",N="x",k="u",H=".",U=";",j=/^[!$&]/,G=/^[*-+?]/,V=/^[!&]/,Y=/^[\t\v-\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/,W=/^[\n\r\u2028\u2029]/,z=/^[\r\u2028-\u2029]/,J=/^[A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376-\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E-\u066F\u0671-\u06D3\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4-\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0-\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,Q=/^[$0-9_\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7-\u09C8\u09CB-\u09CD\u09D7\u09E2-\u09E3\u09E6-\u09EF\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B62-\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56\u0C62-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5-\u0CD6\u0CE2-\u0CE3\u0CE6-\u0CEF\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62-\u0D63\u0D66-\u0D6F\u0D82-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18-\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F3F\u0F71-\u0F84\u0F86-\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19D9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u200C-\u200D\u203F-\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099-\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880-\uA881\uA8B4-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C-\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7-\uAAB8\uAABE-\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5-\uAAF6\uABE3-\uABEA\uABEC-\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33-\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F]/,q=/^[\n\r"\\\u2028-\u2029]/,X=/^[\n\r'\\\u2028-\u2029]/,K=/^[\n\r\\-\]\u2028-\u2029]/,Z=/^["'\\]/,ee=/^[0-9ux]/,te=/^[0-9]/,re=/^[0-9a-f]/i,ne=/^[{}]/,oe=ur("{",!1),ue=ur("}",!1),ae=ur("=",!1),ie=ur("/",!1),se=ur("@",!1),ce=ur(":",!1),le=ar(["!","$","&"],!1,!1),pe=ar([["*","+"],"?"],!1,!1),fe=ur("|",!1),he=ur(",",!1),de=ur("..",!1),ge=ur("(",!1),Ae=ur(")",!1),me=ar(["!","&"],!1,!1),Ee={type:"any"},_e=ir("whitespace"),ve=ar(["\t",["\v","\f"]," "," "," ",[" "," "]," "," "," ","\ufeff"],!1,!1),Ce=ar(["\n","\r","\u2028","\u2029"],!1,!1),$e=ir("end of line"),ye=ur("\n",!1),Se=ur("\r\n",!1),Fe=ar(["\r",["\u2028","\u2029"]],!1,!1),Pe=ir("comment"),xe=ur("/*",!1),De=ur("*/",!1),be=ur("//",!1),Be=ir("identifier"),Re=ar([["A","Z"],"_",["a","z"],"ª","µ","º",["À","Ö"],["Ø","ö"],["ø","ˁ"],["ˆ","ˑ"],["ˠ","ˤ"],"ˬ","ˮ",["Ͱ","ʹ"],["Ͷ","ͷ"],["ͺ","ͽ"],"Ϳ","Ά",["Έ","Ί"],"Ό",["Ύ","Ρ"],["Σ","ϵ"],["Ϸ","ҁ"],["Ҋ","ԯ"],["Ա","Ֆ"],"ՙ",["ա","և"],["א","ת"],["װ","ײ"],["ؠ","ي"],["ٮ","ٯ"],["ٱ","ۓ"],"ە",["ۥ","ۦ"],["ۮ","ۯ"],["ۺ","ۼ"],"ۿ","ܐ",["ܒ","ܯ"],["ݍ","ޥ"],"ޱ",["ߊ","ߪ"],["ߴ","ߵ"],"ߺ",["ࠀ","ࠕ"],"ࠚ","ࠤ","ࠨ",["ࡀ","ࡘ"],["ࢠ","ࢴ"],["ऄ","ह"],"ऽ","ॐ",["क़","ॡ"],["ॱ","ঀ"],["অ","ঌ"],["এ","ঐ"],["ও","ন"],["প","র"],"ল",["শ","হ"],"ঽ","ৎ",["ড়","ঢ়"],["য়","ৡ"],["ৰ","ৱ"],["ਅ","ਊ"],["ਏ","ਐ"],["ਓ","ਨ"],["ਪ","ਰ"],["ਲ","ਲ਼"],["ਵ","ਸ਼"],["ਸ","ਹ"],["ਖ਼","ੜ"],"ਫ਼",["ੲ","ੴ"],["અ","ઍ"],["એ","ઑ"],["ઓ","ન"],["પ","ર"],["લ","ળ"],["વ","હ"],"ઽ","ૐ",["ૠ","ૡ"],"ૹ",["ଅ","ଌ"],["ଏ","ଐ"],["ଓ","ନ"],["ପ","ର"],["ଲ","ଳ"],["ଵ","ହ"],"ଽ",["ଡ଼","ଢ଼"],["ୟ","ୡ"],"ୱ","ஃ",["அ","ஊ"],["எ","ஐ"],["ஒ","க"],["ங","ச"],"ஜ",["ஞ","ட"],["ண","த"],["ந","ப"],["ம","ஹ"],"ௐ",["అ","ఌ"],["ఎ","ఐ"],["ఒ","న"],["ప","హ"],"ఽ",["ౘ","ౚ"],["ౠ","ౡ"],["ಅ","ಌ"],["ಎ","ಐ"],["ಒ","ನ"],["ಪ","ಳ"],["ವ","ಹ"],"ಽ","ೞ",["ೠ","ೡ"],["ೱ","ೲ"],["അ","ഌ"],["എ","ഐ"],["ഒ","ഺ"],"ഽ","ൎ",["ൟ","ൡ"],["ൺ","ൿ"],["අ","ඖ"],["ක","න"],["ඳ","ර"],"ල",["ව","ෆ"],["ก","ะ"],["า","ำ"],["เ","ๆ"],["ກ","ຂ"],"ຄ",["ງ","ຈ"],"ຊ","ຍ",["ດ","ທ"],["ນ","ຟ"],["ມ","ຣ"],"ລ","ວ",["ສ","ຫ"],["ອ","ະ"],["າ","ຳ"],"ຽ",["ເ","ໄ"],"ໆ",["ໜ","ໟ"],"ༀ",["ཀ","ཇ"],["ཉ","ཬ"],["ྈ","ྌ"],["က","ဪ"],"ဿ",["ၐ","ၕ"],["ၚ","ၝ"],"ၡ",["ၥ","ၦ"],["ၮ","ၰ"],["ၵ","ႁ"],"ႎ",["Ⴀ","Ⴥ"],"Ⴧ","Ⴭ",["ა","ჺ"],["ჼ","ቈ"],["ቊ","ቍ"],["ቐ","ቖ"],"ቘ",["ቚ","ቝ"],["በ","ኈ"],["ኊ","ኍ"],["ነ","ኰ"],["ኲ","ኵ"],["ኸ","ኾ"],"ዀ",["ዂ","ዅ"],["ወ","ዖ"],["ዘ","ጐ"],["ጒ","ጕ"],["ጘ","ፚ"],["ᎀ","ᎏ"],["Ꭰ","Ᏽ"],["ᏸ","ᏽ"],["ᐁ","ᙬ"],["ᙯ","ᙿ"],["ᚁ","ᚚ"],["ᚠ","ᛪ"],["ᛮ","ᛸ"],["ᜀ","ᜌ"],["ᜎ","ᜑ"],["ᜠ","ᜱ"],["ᝀ","ᝑ"],["ᝠ","ᝬ"],["ᝮ","ᝰ"],["ក","ឳ"],"ៗ","ៜ",["ᠠ","ᡷ"],["ᢀ","ᢨ"],"ᢪ",["ᢰ","ᣵ"],["ᤀ","ᤞ"],["ᥐ","ᥭ"],["ᥰ","ᥴ"],["ᦀ","ᦫ"],["ᦰ","ᧉ"],["ᨀ","ᨖ"],["ᨠ","ᩔ"],"ᪧ",["ᬅ","ᬳ"],["ᭅ","ᭋ"],["ᮃ","ᮠ"],["ᮮ","ᮯ"],["ᮺ","ᯥ"],["ᰀ","ᰣ"],["ᱍ","ᱏ"],["ᱚ","ᱽ"],["ᳩ","ᳬ"],["ᳮ","ᳱ"],["ᳵ","ᳶ"],["ᴀ","ᶿ"],["Ḁ","ἕ"],["Ἐ","Ἕ"],["ἠ","ὅ"],["Ὀ","Ὅ"],["ὐ","ὗ"],"Ὑ","Ὓ","Ὕ",["Ὗ","ώ"],["ᾀ","ᾴ"],["ᾶ","ᾼ"],"ι",["ῂ","ῄ"],["ῆ","ῌ"],["ῐ","ΐ"],["ῖ","Ί"],["ῠ","Ῥ"],["ῲ","ῴ"],["ῶ","ῼ"],"ⁱ","ⁿ",["ₐ","ₜ"],"ℂ","ℇ",["ℊ","ℓ"],"ℕ",["ℙ","ℝ"],"ℤ","Ω","ℨ",["K","ℭ"],["ℯ","ℹ"],["ℼ","ℿ"],["ⅅ","ⅉ"],"ⅎ",["Ⅰ","ↈ"],["Ⰰ","Ⱞ"],["ⰰ","ⱞ"],["Ⱡ","ⳤ"],["Ⳬ","ⳮ"],["Ⳳ","ⳳ"],["ⴀ","ⴥ"],"ⴧ","ⴭ",["ⴰ","ⵧ"],"ⵯ",["ⶀ","ⶖ"],["ⶠ","ⶦ"],["ⶨ","ⶮ"],["ⶰ","ⶶ"],["ⶸ","ⶾ"],["ⷀ","ⷆ"],["ⷈ","ⷎ"],["ⷐ","ⷖ"],["ⷘ","ⷞ"],"ⸯ",["々","〇"],["〡","〩"],["〱","〵"],["〸","〼"],["ぁ","ゖ"],["ゝ","ゟ"],["ァ","ヺ"],["ー","ヿ"],["ㄅ","ㄭ"],["ㄱ","ㆎ"],["ㆠ","ㆺ"],["ㇰ","ㇿ"],["㐀","䶵"],["一","鿕"],["ꀀ","ꒌ"],["ꓐ","ꓽ"],["ꔀ","ꘌ"],["ꘐ","ꘟ"],["ꘪ","ꘫ"],["Ꙁ","ꙮ"],["ꙿ","ꚝ"],["ꚠ","ꛯ"],["ꜗ","ꜟ"],["Ꜣ","ꞈ"],["Ꞌ","Ɬ"],["Ʞ","ꞷ"],["ꟷ","ꠁ"],["ꠃ","ꠅ"],["ꠇ","ꠊ"],["ꠌ","ꠢ"],["ꡀ","ꡳ"],["ꢂ","ꢳ"],["ꣲ","ꣷ"],"ꣻ","ꣽ",["ꤊ","ꤥ"],["ꤰ","ꥆ"],["ꥠ","ꥼ"],["ꦄ","ꦲ"],"ꧏ",["ꧠ","ꧤ"],["ꧦ","ꧯ"],["ꧺ","ꧾ"],["ꨀ","ꨨ"],["ꩀ","ꩂ"],["ꩄ","ꩋ"],["ꩠ","ꩶ"],"ꩺ",["ꩾ","ꪯ"],"ꪱ",["ꪵ","ꪶ"],["ꪹ","ꪽ"],"ꫀ","ꫂ",["ꫛ","ꫝ"],["ꫠ","ꫪ"],["ꫲ","ꫴ"],["ꬁ","ꬆ"],["ꬉ","ꬎ"],["ꬑ","ꬖ"],["ꬠ","ꬦ"],["ꬨ","ꬮ"],["ꬰ","ꭚ"],["ꭜ","ꭥ"],["ꭰ","ꯢ"],["가","힣"],["ힰ","ퟆ"],["ퟋ","ퟻ"],["豈","舘"],["並","龎"],["ff","st"],["ﬓ","ﬗ"],"יִ",["ײַ","ﬨ"],["שׁ","זּ"],["טּ","לּ"],"מּ",["נּ","סּ"],["ףּ","פּ"],["צּ","ﮱ"],["ﯓ","ﴽ"],["ﵐ","ﶏ"],["ﶒ","ﷇ"],["ﷰ","ﷻ"],["ﹰ","ﹴ"],["ﹶ","ﻼ"],["A","Z"],["a","z"],["ヲ","ᄒ"],["ᅡ","ᅦ"],["ᅧ","ᅬ"],["ᅭ","ᅲ"],["ᅳ","ᅵ"]],!1,!1),Oe=ur("\\",!1),Le=ar(["$",["0","9"],"_",["̀","ͯ"],["҃","҇"],["֑","ֽ"],"ֿ",["ׁ","ׂ"],["ׄ","ׅ"],"ׇ",["ؐ","ؚ"],["ً","٩"],"ٰ",["ۖ","ۜ"],["۟","ۤ"],["ۧ","ۨ"],["۪","ۭ"],["۰","۹"],"ܑ",["ܰ","݊"],["ަ","ް"],["߀","߉"],["߫","߳"],["ࠖ","࠙"],["ࠛ","ࠣ"],["ࠥ","ࠧ"],["ࠩ","࠭"],["࡙","࡛"],["ࣣ","ः"],["ऺ","़"],["ा","ॏ"],["॑","ॗ"],["ॢ","ॣ"],["०","९"],["ঁ","ঃ"],"়",["া","ৄ"],["ে","ৈ"],["ো","্"],"ৗ",["ৢ","ৣ"],["০","৯"],["ਁ","ਃ"],"਼",["ਾ","ੂ"],["ੇ","ੈ"],["ੋ","੍"],"ੑ",["੦","ੱ"],"ੵ",["ઁ","ઃ"],"઼",["ા","ૅ"],["ે","ૉ"],["ો","્"],["ૢ","ૣ"],["૦","૯"],["ଁ","ଃ"],"଼",["ା","ୄ"],["େ","ୈ"],["ୋ","୍"],["ୖ","ୗ"],["ୢ","ୣ"],["୦","୯"],"ஂ",["ா","ூ"],["ெ","ை"],["ொ","்"],"ௗ",["௦","௯"],["ఀ","ః"],["ా","ౄ"],["ె","ై"],["ొ","్"],["ౕ","ౖ"],["ౢ","ౣ"],["౦","౯"],["ಁ","ಃ"],"಼",["ಾ","ೄ"],["ೆ","ೈ"],["ೊ","್"],["ೕ","ೖ"],["ೢ","ೣ"],["೦","೯"],["ഁ","ഃ"],["ാ","ൄ"],["െ","ൈ"],["ൊ","്"],"ൗ",["ൢ","ൣ"],["൦","൯"],["ං","ඃ"],"්",["ා","ු"],"ූ",["ෘ","ෟ"],["෦","෯"],["ෲ","ෳ"],"ั",["ิ","ฺ"],["็","๎"],["๐","๙"],"ັ",["ິ","ູ"],["ົ","ຼ"],["່","ໍ"],["໐","໙"],["༘","༙"],["༠","༩"],"༵","༷","༹",["༾","༿"],["ཱ","྄"],["྆","྇"],["ྍ","ྗ"],["ྙ","ྼ"],"࿆",["ါ","ှ"],["၀","၉"],["ၖ","ၙ"],["ၞ","ၠ"],["ၢ","ၤ"],["ၧ","ၭ"],["ၱ","ၴ"],["ႂ","ႍ"],["ႏ","ႝ"],["፝","፟"],["ᜒ","᜔"],["ᜲ","᜴"],["ᝒ","ᝓ"],["ᝲ","ᝳ"],["឴","៓"],"៝",["០","៩"],["᠋","᠍"],["᠐","᠙"],"ᢩ",["ᤠ","ᤫ"],["ᤰ","᤻"],["᥆","᥏"],["᧐","᧙"],["ᨗ","ᨛ"],["ᩕ","ᩞ"],["᩠","᩼"],["᩿","᪉"],["᪐","᪙"],["᪰","᪽"],["ᬀ","ᬄ"],["᬴","᭄"],["᭐","᭙"],["᭫","᭳"],["ᮀ","ᮂ"],["ᮡ","ᮭ"],["᮰","᮹"],["᯦","᯳"],["ᰤ","᰷"],["᱀","᱉"],["᱐","᱙"],["᳐","᳒"],["᳔","᳨"],"᳭",["ᳲ","᳴"],["᳸","᳹"],["᷀","᷵"],["᷼","᷿"],["",""],["‿","⁀"],"⁔",["⃐","⃜"],"⃡",["⃥","⃰"],["⳯","⳱"],"⵿",["ⷠ","ⷿ"],["〪","〯"],["゙","゚"],["꘠","꘩"],"꙯",["ꙴ","꙽"],["ꚞ","ꚟ"],["꛰","꛱"],"ꠂ","꠆","ꠋ",["ꠣ","ꠧ"],["ꢀ","ꢁ"],["ꢴ","꣄"],["꣐","꣙"],["꣠","꣱"],["꤀","꤉"],["ꤦ","꤭"],["ꥇ","꥓"],["ꦀ","ꦃ"],["꦳","꧀"],["꧐","꧙"],"ꧥ",["꧰","꧹"],["ꨩ","ꨶ"],"ꩃ",["ꩌ","ꩍ"],["꩐","꩙"],["ꩻ","ꩽ"],"ꪰ",["ꪲ","ꪴ"],["ꪷ","ꪸ"],["ꪾ","꪿"],"꫁",["ꫫ","ꫯ"],["ꫵ","꫶"],["ꯣ","ꯪ"],["꯬","꯭"],["꯰","꯹"],"ﬞ",["︀","️"],["︠","︯"],["︳","︴"],["﹍","﹏"],["0","9"],"_"],!1,!1),Me=ir("literal"),Te=ur("i",!1),we=ir("string"),Ie=ur('"',!1),Ne=ur("'",!1),ke=ar(["\n","\r",'"',"\\",["\u2028","\u2029"]],!1,!1),He=ar(["\n","\r","'","\\",["\u2028","\u2029"]],!1,!1),Ue=ir("character class"),je=ur("[",!1),Ge=ur("^",!1),Ve=ur("]",!1),Ye=ur("-",!1),We=ar(["\n","\r",["\\","]"],["\u2028","\u2029"]],!1,!1),ze=ur("0",!1),Je=ar(['"',"'","\\"],!1,!1),Qe=ur("b",!1),qe=ur("f",!1),Xe=ur("n",!1),Ke=ur("r",!1),Ze=ur("t",!1),et=ur("v",!1),tt=ar([["0","9"],"u","x"],!1,!1),rt=ur("x",!1),nt=ur("u",!1),ot=ar([["0","9"]],!1,!1),ut=ar([["0","9"],["a","f"]],!1,!0),at=ur(".",!1),it=ir("code block"),st=ar(["{","}"],!1,!1),ct=ur(";",!1),lt=function(e,t,r){return{type:"grammar",topLevelInitializer:e,initializer:t,rules:r,location:nr()}},pt=function(e){return{type:"top_level_initializer",code:e[0],codeLocation:e[1],location:nr()}},ft=function(e){return{type:"initializer",code:e[0],codeLocation:e[1],location:nr()}},ht=function(e,t,r){return{type:"rule",name:e[0],nameLocation:e[1],expression:null!==t?{type:"named",name:t,expression:r,location:nr()}:r,location:nr()}},dt=function(e,t){return t.length>0?{type:"choice",alternatives:[e].concat(t),location:nr()}:e},gt=function(e,t){return null!==t?{type:"action",expression:e,code:t[0],codeLocation:t[1],location:nr()}:e},At=function(e,t){return t.length>0||"labeled"===e.type&&e.pick?{type:"sequence",elements:[e].concat(t),location:nr()}:e},mt=function(e,t,r){return r.type.startsWith("semantic_")&&or('"@" cannot be used on a semantic predicate',e),{type:"labeled",label:null!==t?t[0]:null,labelLocation:null!==t?t[1]:e,pick:!0,expression:r,location:nr()}},Et=function(e,t){return{type:"labeled",label:e[0],labelLocation:e[1],expression:t,location:nr()}},_t=function(){return nr()},vt=function(e){return Wr.indexOf(e[0])>=0&&or("Label can't be a reserved word \"".concat(e[0],'"'),e[1]),e},Ct=function(e,t){return{type:OPS_TO_PREFIXED_TYPES[e],expression:t,location:nr()}},$t=function(e,t){return{type:OPS_TO_SUFFIXED_TYPES[t],expression:e,location:nr()}},yt=function(e,t,r){var n=t[0],o=t[1];return"constant"===o.type&&0===o.value&&or("The maximum count of repetitions of the rule must be > 0",o.location),{type:"repeated",min:n,max:o,expression:e,delimiter:r,location:nr()}},St=function(e,t){return[null!==e?e:{type:"constant",value:0},null!==t?t:{type:"constant",value:null}]},Ft=function(e){return[null,e]},Pt=function(e){return{type:"constant",value:e,location:nr()}},xt=function(e){return{type:"variable",value:e[0],location:nr()}},Dt=function(e){return{type:"function",value:e[0],codeLocation:e[1],location:nr()}},bt=function(e){return"labeled"===e.type||"sequence"===e.type?{type:"group",expression:e,location:nr()}:e},Bt=function(e){return{type:"rule_ref",name:e[0],location:nr()}},Rt=function(e,t){return{type:OPS_TO_SEMANTIC_PREDICATE_TYPES[e],code:t[0],codeLocation:t[1],location:nr()}},Ot=function(e,t){return[e+t.join(""),nr()]},Lt=function(e,t){return{type:"literal",value:e,ignoreCase:null!==t,location:nr()}},Mt=function(e){return e.join("")},Tt=function(e){return e.join("")},wt=function(e,t,r){return{type:"class",parts:t.filter((function(e){return""!==e})),inverted:null!==e,ignoreCase:null!==r,location:nr()}},It=function(t,r){return t.charCodeAt(0)>r.charCodeAt(0)&&or("Invalid character range: "+e.substring(Kt,Xt)+"."),[t,r]},Nt=function(){return""},kt=function(){return"\0"},Ht=function(){return"\b"},Ut=function(){return"\f"},jt=function(){return"\n"},Gt=function(){return"\r"},Vt=function(){return"\t"},Yt=function(){return"\v"},Wt=function(e){return String.fromCharCode(parseInt(e,16))},zt=function(e){return String.fromCharCode(parseInt(e,16))},Jt=function(){return{type:"any",location:nr()}},Qt=function(e){return[e,nr()]},qt=function(e){return parseInt(e,10)},Xt=0,Kt=0,Zt=[{line:1,column:1}],er=0,tr=[],rr=0;if("startRule"in t){if(!(t.startRule in u))throw new Error("Can't start parsing from rule \""+t.startRule+'".');a=u[t.startRule]}function nr(){return cr(Kt,Xt)}function or(e,t){throw function(e,t){return new peg$SyntaxError(e,null,null,t)}(e,t=void 0!==t?t:cr(Kt,Xt))}function ur(e,t){return{type:"literal",text:e,ignoreCase:t}}function ar(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function ir(e){return{type:"other",description:e}}function sr(t){var r,n=Zt[t];if(n)return n;if(t>=Zt.length)r=Zt.length-1;else for(r=t;!Zt[--r];);for(n={line:(n=Zt[r]).line,column:n.column};r<t;)10===e.charCodeAt(r)?(n.line++,n.column=1):n.column++,r++;return Zt[t]=n,n}function cr(e,t,r){var n=sr(e),u=sr(t),a={source:o,start:{offset:e,line:n.line,column:n.column},end:{offset:t,line:u.line,column:u.column}};return r&&o&&"function"==typeof o.offset&&(a.start=o.offset(a.start),a.end=o.offset(a.end)),a}function lr(e){Xt<er||(Xt>er&&(er=Xt,tr=[]),tr.push(e))}function pr(){var t,r,o,u,a,c;if(t=Xt,Vr(),r=Xt,o=function(){var t,r,o,u;return t=Xt,123===e.charCodeAt(Xt)?(r=i,Xt++):(r=n,0===rr&&lr(oe)),r!==n&&(o=jr())!==n?(125===e.charCodeAt(Xt)?(u=s,Xt++):(u=n,0===rr&&lr(ue)),u!==n&&Yr()!==n?(Kt=t,t=pt(o)):(Xt=t,t=n)):(Xt=t,t=n),t}(),o!==n?(u=Vr(),r=o):(Xt=r,r=n),r===n&&(r=null),o=Xt,u=function(){var e,t;return e=Xt,(t=jr())!==n&&Yr()!==n?(Kt=e,e=ft(t)):(Xt=e,e=n),e}(),u!==n?(a=Vr(),o=u):(Xt=o,o=n),o===n&&(o=null),u=[],a=Xt,(c=fr())!==n?(Vr(),a=c):(Xt=a,a=n),a!==n)for(;a!==n;)u.push(a),a=Xt,(c=fr())!==n?(Vr(),a=c):(Xt=a,a=n);else u=n;return u!==n?(Kt=t,t=lt(r,o,u)):(Xt=t,t=n),t}function fr(){var t,r,o,u,a;return t=Xt,(r=Dr())!==n?(Vr(),o=Xt,(u=Rr())!==n?(Vr(),o=u):(Xt=o,o=n),o===n&&(o=null),61===e.charCodeAt(Xt)?(u=c,Xt++):(u=n,0===rr&&lr(ae)),u!==n?(Vr(),(a=hr())!==n&&Yr()!==n?(Kt=t,t=ht(r,o,a)):(Xt=t,t=n)):(Xt=t,t=n)):(Xt=t,t=n),t}function hr(){var t,r,o,u,a,i;if(t=Xt,(r=dr())!==n){for(o=[],u=Xt,Vr(),47===e.charCodeAt(Xt)?(a=l,Xt++):(a=n,0===rr&&lr(ie)),a!==n?(Vr(),(i=dr())!==n?u=i:(Xt=u,u=n)):(Xt=u,u=n);u!==n;)o.push(u),u=Xt,Vr(),47===e.charCodeAt(Xt)?(a=l,Xt++):(a=n,0===rr&&lr(ie)),a!==n?(Vr(),(i=dr())!==n?u=i:(Xt=u,u=n)):(Xt=u,u=n);Kt=t,t=dt(r,o)}else Xt=t,t=n;return t}function dr(){var e,t,r,o;return e=Xt,t=function(){var e,t,r,o,u;if(e=Xt,(t=gr())!==n){for(r=[],o=Xt,Vr(),(u=gr())!==n?o=u:(Xt=o,o=n);o!==n;)r.push(o),o=Xt,Vr(),(u=gr())!==n?o=u:(Xt=o,o=n);Kt=e,e=At(t,r)}else Xt=e,e=n;return e}(),t!==n?(r=Xt,Vr(),(o=jr())!==n?r=o:(Xt=r,r=n),r===n&&(r=null),Kt=e,e=gt(t,r)):(Xt=e,e=n),e}function gr(){var t,r,o,u;return t=Xt,r=function(){var t,r;return t=Xt,64===e.charCodeAt(Xt)?(r=p,Xt++):(r=n,0===rr&&lr(se)),r!==n&&(Kt=t,r=_t()),t=r}(),r!==n?((o=Ar())===n&&(o=null),(u=mr())!==n?(Kt=t,t=mt(r,o,u)):(Xt=t,t=n)):(Xt=t,t=n),t===n&&(t=Xt,(r=Ar())!==n?(o=Vr(),(u=mr())!==n?(Kt=t,t=Et(r,u)):(Xt=t,t=n)):(Xt=t,t=n),t===n&&(t=mr())),t}function Ar(){var t,r,o;return t=Xt,(r=Dr())!==n?(Vr(),58===e.charCodeAt(Xt)?(o=f,Xt++):(o=n,0===rr&&lr(ce)),o!==n?(Kt=t,t=vt(r)):(Xt=t,t=n)):(Xt=t,t=n),t}function mr(){var t,r,o;return t=Xt,r=function(){var t;return t=e.charAt(Xt),j.test(t)?Xt++:(t=n,0===rr&&lr(le)),t}(),r!==n?(Vr(),(o=Er())!==n?(Kt=t,t=Ct(r,o)):(Xt=t,t=n)):(Xt=t,t=n),t===n&&(t=Er()),t}function Er(){var t,r,o;return t=Xt,(r=vr())!==n?(Vr(),o=function(){var t;return t=e.charAt(Xt),G.test(t)?Xt++:(t=n,0===rr&&lr(pe)),t}(),o!==n?(Kt=t,t=$t(r,o)):(Xt=t,t=n)):(Xt=t,t=n),t===n&&(t=function(){var t,r,o,u,a,i,s;return t=Xt,(r=vr())!==n?(Vr(),124===e.charCodeAt(Xt)?(o=h,Xt++):(o=n,0===rr&&lr(fe)),o!==n?(Vr(),u=function(){var t,r,o,u;return t=Xt,(r=_r())===n&&(r=null),Vr(),e.substr(Xt,2)===g?(o=g,Xt+=2):(o=n,0===rr&&lr(de)),o!==n?(Vr(),(u=_r())===n&&(u=null),Kt=t,t=St(r,u)):(Xt=t,t=n),t===n&&(t=Xt,(r=_r())!==n&&(Kt=t,r=Ft(r)),t=r),t}(),u!==n?(Vr(),a=Xt,44===e.charCodeAt(Xt)?(i=d,Xt++):(i=n,0===rr&&lr(he)),i!==n?(Vr(),(s=hr())!==n?(Vr(),a=s):(Xt=a,a=n)):(Xt=a,a=n),a===n&&(a=null),124===e.charCodeAt(Xt)?(i=h,Xt++):(i=n,0===rr&&lr(fe)),i!==n?(Kt=t,t=yt(r,u,a)):(Xt=t,t=n)):(Xt=t,t=n)):(Xt=t,t=n)):(Xt=t,t=n),t}(),t===n&&(t=vr())),t}function _r(){var t,r;return t=Xt,r=function(){var t,r,o,u;if(t=Xt,r=Xt,o=[],(u=Hr())!==n)for(;u!==n;)o.push(u),u=Hr();else o=n;return(r=o!==n?e.substring(r,Xt):o)!==n&&(Kt=t,r=qt(r)),t=r}(),r!==n&&(Kt=t,r=Pt(r)),(t=r)===n&&(t=Xt,(r=Dr())!==n&&(Kt=t,r=xt(r)),(t=r)===n&&(t=Xt,(r=jr())!==n&&(Kt=t,r=Dt(r)),t=r)),t}function vr(){var t,r,o,u;return t=function(){var t,r,o;return rr++,t=Xt,(r=Rr())!==n?(105===e.charCodeAt(Xt)?(o=S,Xt++):(o=n,0===rr&&lr(Te)),o===n&&(o=null),Kt=t,t=Lt(r,o)):(Xt=t,t=n),rr--,t===n&&(r=n,0===rr&&lr(Me)),t}(),t===n&&(t=function(){var t,r,o,u,a,i;if(rr++,t=Xt,91===e.charCodeAt(Xt)?(r=x,Xt++):(r=n,0===rr&&lr(je)),r!==n){for(94===e.charCodeAt(Xt)?(o=D,Xt++):(o=n,0===rr&&lr(Ge)),o===n&&(o=null),u=[],(a=Mr())===n&&(a=Tr());a!==n;)u.push(a),(a=Mr())===n&&(a=Tr());93===e.charCodeAt(Xt)?(a=b,Xt++):(a=n,0===rr&&lr(Ve)),a!==n?(105===e.charCodeAt(Xt)?(i=S,Xt++):(i=n,0===rr&&lr(Te)),i===n&&(i=null),Kt=t,t=wt(o,u,i)):(Xt=t,t=n)}else Xt=t,t=n;return rr--,t===n&&(r=n,0===rr&&lr(Ue)),t}(),t===n&&(t=function(){var t,r;return t=Xt,46===e.charCodeAt(Xt)?(r=H,Xt++):(r=n,0===rr&&lr(at)),r!==n&&(Kt=t,r=Jt()),t=r}(),t===n&&(t=function(){var t,r,o,u,a,i,s;return t=Xt,(r=Dr())!==n?(o=Xt,rr++,u=Xt,a=Vr(),i=Xt,(s=Rr())!==n?i=s=[s,Vr()]:(Xt=i,i=n),i===n&&(i=null),61===e.charCodeAt(Xt)?(s=c,Xt++):(s=n,0===rr&&lr(ae)),s!==n?u=a=[a,i,s]:(Xt=u,u=n),rr--,u===n?o=void 0:(Xt=o,o=n),o!==n?(Kt=t,t=Bt(r)):(Xt=t,t=n)):(Xt=t,t=n),t}(),t===n&&(t=function(){var t,r,o;return t=Xt,r=function(){var t;return t=e.charAt(Xt),V.test(t)?Xt++:(t=n,0===rr&&lr(me)),t}(),r!==n?(Vr(),(o=jr())!==n?(Kt=t,t=Rt(r,o)):(Xt=t,t=n)):(Xt=t,t=n),t}(),t===n&&(t=Xt,40===e.charCodeAt(Xt)?(r=A,Xt++):(r=n,0===rr&&lr(ge)),r!==n?(Vr(),(o=hr())!==n?(Vr(),41===e.charCodeAt(Xt)?(u=m,Xt++):(u=n,0===rr&&lr(Ae)),u!==n?(Kt=t,t=bt(o)):(Xt=t,t=n)):(Xt=t,t=n)):(Xt=t,t=n)))))),t}function Cr(){var t;return e.length>Xt?(t=e.charAt(Xt),Xt++):(t=n,0===rr&&lr(Ee)),t}function $r(){var t;return rr++,t=e.charAt(Xt),Y.test(t)?Xt++:(t=n,0===rr&&lr(ve)),rr--,t===n&&0===rr&&lr(_e),t}function yr(){var t;return t=e.charAt(Xt),W.test(t)?Xt++:(t=n,0===rr&&lr(Ce)),t}function Sr(){var t;return rr++,10===e.charCodeAt(Xt)?(t=E,Xt++):(t=n,0===rr&&lr(ye)),t===n&&(e.substr(Xt,2)===_?(t=_,Xt+=2):(t=n,0===rr&&lr(Se)),t===n&&(t=e.charAt(Xt),z.test(t)?Xt++:(t=n,0===rr&&lr(Fe)))),rr--,t===n&&0===rr&&lr($e),t}function Fr(){var t;return rr++,(t=function(){var t,r,o,u,a,i;if(t=Xt,e.substr(Xt,2)===v?(r=v,Xt+=2):(r=n,0===rr&&lr(xe)),r!==n){for(o=[],u=Xt,a=Xt,rr++,e.substr(Xt,2)===C?(i=C,Xt+=2):(i=n,0===rr&&lr(De)),rr--,i===n?a=void 0:(Xt=a,a=n),a!==n&&(i=Cr())!==n?u=a=[a,i]:(Xt=u,u=n);u!==n;)o.push(u),u=Xt,a=Xt,rr++,e.substr(Xt,2)===C?(i=C,Xt+=2):(i=n,0===rr&&lr(De)),rr--,i===n?a=void 0:(Xt=a,a=n),a!==n&&(i=Cr())!==n?u=a=[a,i]:(Xt=u,u=n);e.substr(Xt,2)===C?(u=C,Xt+=2):(u=n,0===rr&&lr(De)),u!==n?t=r=[r,o,u]:(Xt=t,t=n)}else Xt=t,t=n;return t}())===n&&(t=xr()),rr--,t===n&&0===rr&&lr(Pe),t}function Pr(){var t,r,o,u,a,i;if(t=Xt,e.substr(Xt,2)===v?(r=v,Xt+=2):(r=n,0===rr&&lr(xe)),r!==n){for(o=[],u=Xt,a=Xt,rr++,e.substr(Xt,2)===C?(i=C,Xt+=2):(i=n,0===rr&&lr(De)),i===n&&(i=yr()),rr--,i===n?a=void 0:(Xt=a,a=n),a!==n&&(i=Cr())!==n?u=a=[a,i]:(Xt=u,u=n);u!==n;)o.push(u),u=Xt,a=Xt,rr++,e.substr(Xt,2)===C?(i=C,Xt+=2):(i=n,0===rr&&lr(De)),i===n&&(i=yr()),rr--,i===n?a=void 0:(Xt=a,a=n),a!==n&&(i=Cr())!==n?u=a=[a,i]:(Xt=u,u=n);e.substr(Xt,2)===C?(u=C,Xt+=2):(u=n,0===rr&&lr(De)),u!==n?t=r=[r,o,u]:(Xt=t,t=n)}else Xt=t,t=n;return t}function xr(){var t,r,o,u,a,i;if(t=Xt,e.substr(Xt,2)===$?(r=$,Xt+=2):(r=n,0===rr&&lr(be)),r!==n){for(o=[],u=Xt,a=Xt,rr++,i=yr(),rr--,i===n?a=void 0:(Xt=a,a=n),a!==n&&(i=Cr())!==n?u=a=[a,i]:(Xt=u,u=n);u!==n;)o.push(u),u=Xt,a=Xt,rr++,i=yr(),rr--,i===n?a=void 0:(Xt=a,a=n),a!==n&&(i=Cr())!==n?u=a=[a,i]:(Xt=u,u=n);t=r=[r,o]}else Xt=t,t=n;return t}function Dr(){var e,t,r,o;if(rr++,e=Xt,(t=br())!==n){for(r=[],o=Br();o!==n;)r.push(o),o=Br();Kt=e,e=Ot(t,r)}else Xt=e,e=n;return rr--,e===n&&(t=n,0===rr&&lr(Be)),e}function br(){var t,r,o;return t=e.charAt(Xt),J.test(t)?Xt++:(t=n,0===rr&&lr(Re)),t===n&&(t=Xt,92===e.charCodeAt(Xt)?(r=y,Xt++):(r=n,0===rr&&lr(Oe)),r!==n&&(o=kr())!==n?t=o:(Xt=t,t=n)),t}function Br(){var t;return(t=br())===n&&(t=e.charAt(Xt),Q.test(t)?Xt++:(t=n,0===rr&&lr(Le))),t}function Rr(){var t,r,o,u;if(rr++,t=Xt,34===e.charCodeAt(Xt)?(r=F,Xt++):(r=n,0===rr&&lr(Ie)),r!==n){for(o=[],u=Or();u!==n;)o.push(u),u=Or();34===e.charCodeAt(Xt)?(u=F,Xt++):(u=n,0===rr&&lr(Ie)),u!==n?(Kt=t,t=Mt(o)):(Xt=t,t=n)}else Xt=t,t=n;if(t===n)if(t=Xt,39===e.charCodeAt(Xt)?(r=P,Xt++):(r=n,0===rr&&lr(Ne)),r!==n){for(o=[],u=Lr();u!==n;)o.push(u),u=Lr();39===e.charCodeAt(Xt)?(u=P,Xt++):(u=n,0===rr&&lr(Ne)),u!==n?(Kt=t,t=Tt(o)):(Xt=t,t=n)}else Xt=t,t=n;return rr--,t===n&&(r=n,0===rr&&lr(we)),t}function Or(){var t,r,o,u;return t=Xt,r=Xt,o=Xt,rr++,u=e.charAt(Xt),q.test(u)?Xt++:(u=n,0===rr&&lr(ke)),rr--,u===n?o=void 0:(Xt=o,o=n),o!==n&&(u=Cr())!==n?r=o=[o,u]:(Xt=r,r=n),(t=r!==n?e.substring(t,Xt):r)===n&&(t=Xt,92===e.charCodeAt(Xt)?(r=y,Xt++):(r=n,0===rr&&lr(Oe)),r!==n&&(o=Ir())!==n?t=o:(Xt=t,t=n),t===n&&(t=wr())),t}function Lr(){var t,r,o,u;return t=Xt,r=Xt,o=Xt,rr++,u=e.charAt(Xt),X.test(u)?Xt++:(u=n,0===rr&&lr(He)),rr--,u===n?o=void 0:(Xt=o,o=n),o!==n&&(u=Cr())!==n?r=o=[o,u]:(Xt=r,r=n),(t=r!==n?e.substring(t,Xt):r)===n&&(t=Xt,92===e.charCodeAt(Xt)?(r=y,Xt++):(r=n,0===rr&&lr(Oe)),r!==n&&(o=Ir())!==n?t=o:(Xt=t,t=n),t===n&&(t=wr())),t}function Mr(){var t,r,o,u;return t=Xt,(r=Tr())!==n?(45===e.charCodeAt(Xt)?(o=B,Xt++):(o=n,0===rr&&lr(Ye)),o!==n&&(u=Tr())!==n?(Kt=t,t=It(r,u)):(Xt=t,t=n)):(Xt=t,t=n),t}function Tr(){var t,r,o,u;return t=Xt,r=Xt,o=Xt,rr++,u=e.charAt(Xt),K.test(u)?Xt++:(u=n,0===rr&&lr(We)),rr--,u===n?o=void 0:(Xt=o,o=n),o!==n&&(u=Cr())!==n?r=o=[o,u]:(Xt=r,r=n),(t=r!==n?e.substring(t,Xt):r)===n&&(t=Xt,92===e.charCodeAt(Xt)?(r=y,Xt++):(r=n,0===rr&&lr(Oe)),r!==n&&(o=Ir())!==n?t=o:(Xt=t,t=n),t===n&&(t=wr())),t}function wr(){var t,r;return t=Xt,92===e.charCodeAt(Xt)?(r=y,Xt++):(r=n,0===rr&&lr(Oe)),r!==n&&Sr()!==n?(Kt=t,t=Nt()):(Xt=t,t=n),t}function Ir(){var t,r,o,u;return t=function(){var t;return(t=Nr())===n&&(t=function(){var t,r,o,u;return t=Xt,r=Xt,o=Xt,rr++,u=function(){var t;return(t=Nr())===n&&(t=e.charAt(Xt),ee.test(t)?Xt++:(t=n,0===rr&&lr(tt))),t}(),u===n&&(u=yr()),rr--,u===n?o=void 0:(Xt=o,o=n),o!==n&&(u=Cr())!==n?r=o=[o,u]:(Xt=r,r=n),t=r!==n?e.substring(t,Xt):r}()),t}(),t===n&&(t=Xt,48===e.charCodeAt(Xt)?(r=R,Xt++):(r=n,0===rr&&lr(ze)),r!==n?(o=Xt,rr++,u=Hr(),rr--,u===n?o=void 0:(Xt=o,o=n),o!==n?(Kt=t,t=kt()):(Xt=t,t=n)):(Xt=t,t=n),t===n&&(t=function(){var t,r,o,u,a,i;return t=Xt,120===e.charCodeAt(Xt)?(r=N,Xt++):(r=n,0===rr&&lr(rt)),r!==n?(o=Xt,u=Xt,(a=Ur())!==n&&(i=Ur())!==n?u=a=[a,i]:(Xt=u,u=n),(o=u!==n?e.substring(o,Xt):u)!==n?(Kt=t,t=Wt(o)):(Xt=t,t=n)):(Xt=t,t=n),t}(),t===n&&(t=kr()))),t}function Nr(){var t,r;return t=e.charAt(Xt),Z.test(t)?Xt++:(t=n,0===rr&&lr(Je)),t===n&&(t=Xt,98===e.charCodeAt(Xt)?(r=O,Xt++):(r=n,0===rr&&lr(Qe)),r!==n&&(Kt=t,r=Ht()),(t=r)===n&&(t=Xt,102===e.charCodeAt(Xt)?(r=L,Xt++):(r=n,0===rr&&lr(qe)),r!==n&&(Kt=t,r=Ut()),(t=r)===n&&(t=Xt,110===e.charCodeAt(Xt)?(r=M,Xt++):(r=n,0===rr&&lr(Xe)),r!==n&&(Kt=t,r=jt()),(t=r)===n&&(t=Xt,114===e.charCodeAt(Xt)?(r=T,Xt++):(r=n,0===rr&&lr(Ke)),r!==n&&(Kt=t,r=Gt()),(t=r)===n&&(t=Xt,116===e.charCodeAt(Xt)?(r=w,Xt++):(r=n,0===rr&&lr(Ze)),r!==n&&(Kt=t,r=Vt()),(t=r)===n&&(t=Xt,118===e.charCodeAt(Xt)?(r=I,Xt++):(r=n,0===rr&&lr(et)),r!==n&&(Kt=t,r=Yt()),t=r)))))),t}function kr(){var t,r,o,u,a,i,s,c;return t=Xt,117===e.charCodeAt(Xt)?(r=k,Xt++):(r=n,0===rr&&lr(nt)),r!==n?(o=Xt,u=Xt,(a=Ur())!==n&&(i=Ur())!==n&&(s=Ur())!==n&&(c=Ur())!==n?u=a=[a,i,s,c]:(Xt=u,u=n),(o=u!==n?e.substring(o,Xt):u)!==n?(Kt=t,t=zt(o)):(Xt=t,t=n)):(Xt=t,t=n),t}function Hr(){var t;return t=e.charAt(Xt),te.test(t)?Xt++:(t=n,0===rr&&lr(ot)),t}function Ur(){var t;return t=e.charAt(Xt),re.test(t)?Xt++:(t=n,0===rr&&lr(ut)),t}function jr(){var t,r,o,u;return rr++,t=Xt,123===e.charCodeAt(Xt)?(r=i,Xt++):(r=n,0===rr&&lr(oe)),r!==n?(o=function(){var e,t;return e=Xt,t=Gr(),Kt=e,e=t=Qt(t)}(),125===e.charCodeAt(Xt)?(u=s,Xt++):(u=n,0===rr&&lr(ue)),u!==n?t=o:(Xt=t,t=n)):(Xt=t,t=n),rr--,t===n&&(r=n,0===rr&&lr(it)),t}function Gr(){var t,r,o,u,a,c;if(t=Xt,r=[],o=[],u=Xt,a=Xt,rr++,c=e.charAt(Xt),ne.test(c)?Xt++:(c=n,0===rr&&lr(st)),rr--,c===n?a=void 0:(Xt=a,a=n),a!==n&&(c=Cr())!==n?u=a=[a,c]:(Xt=u,u=n),u!==n)for(;u!==n;)o.push(u),u=Xt,a=Xt,rr++,c=e.charAt(Xt),ne.test(c)?Xt++:(c=n,0===rr&&lr(st)),rr--,c===n?a=void 0:(Xt=a,a=n),a!==n&&(c=Cr())!==n?u=a=[a,c]:(Xt=u,u=n);else o=n;for(o===n&&(o=Xt,123===e.charCodeAt(Xt)?(u=i,Xt++):(u=n,0===rr&&lr(oe)),u!==n?(a=Gr(),125===e.charCodeAt(Xt)?(c=s,Xt++):(c=n,0===rr&&lr(ue)),c!==n?o=u=[u,a,c]:(Xt=o,o=n)):(Xt=o,o=n));o!==n;){if(r.push(o),o=[],u=Xt,a=Xt,rr++,c=e.charAt(Xt),ne.test(c)?Xt++:(c=n,0===rr&&lr(st)),rr--,c===n?a=void 0:(Xt=a,a=n),a!==n&&(c=Cr())!==n?u=a=[a,c]:(Xt=u,u=n),u!==n)for(;u!==n;)o.push(u),u=Xt,a=Xt,rr++,c=e.charAt(Xt),ne.test(c)?Xt++:(c=n,0===rr&&lr(st)),rr--,c===n?a=void 0:(Xt=a,a=n),a!==n&&(c=Cr())!==n?u=a=[a,c]:(Xt=u,u=n);else o=n;o===n&&(o=Xt,123===e.charCodeAt(Xt)?(u=i,Xt++):(u=n,0===rr&&lr(oe)),u!==n?(a=Gr(),125===e.charCodeAt(Xt)?(c=s,Xt++):(c=n,0===rr&&lr(ue)),c!==n?o=u=[u,a,c]:(Xt=o,o=n)):(Xt=o,o=n))}return e.substring(t,Xt)}function Vr(){var e,t;for(e=[],(t=$r())===n&&(t=Sr())===n&&(t=Fr());t!==n;)e.push(t),(t=$r())===n&&(t=Sr())===n&&(t=Fr());return e}function Yr(){var t,r,o,u;if(t=[],r=Xt,o=Vr(),59===e.charCodeAt(Xt)?(u=U,Xt++):(u=n,0===rr&&lr(ct)),u!==n?r=o=[o,u]:(Xt=r,r=n),r!==n)for(;r!==n;)t.push(r),r=Xt,o=Vr(),59===e.charCodeAt(Xt)?(u=U,Xt++):(u=n,0===rr&&lr(ct)),u!==n?r=o=[o,u]:(Xt=r,r=n);else t=n;return t===n&&(t=Xt,r=function(){var e,t;for(e=[],(t=$r())===n&&(t=Pr());t!==n;)e.push(t),(t=$r())===n&&(t=Pr());return e}(),(o=xr())===n&&(o=null),(u=Sr())!==n?t=r=[r,o,u]:(Xt=t,t=n),t===n&&(t=Xt,r=Vr(),o=function(){var t,r;return t=Xt,rr++,e.length>Xt?(r=e.charAt(Xt),Xt++):(r=n,0===rr&&lr(Ee)),rr--,r===n?t=void 0:(Xt=t,t=n),t}(),o!==n?t=r=[r,o]:(Xt=t,t=n))),t}var Wr=t.reservedWords||[];if((r=a())!==n&&Xt===e.length)return r;throw r!==n&&Xt<e.length&&lr({type:"end"}),function(e,t,r){return new peg$SyntaxError(peg$SyntaxError.buildMessage(e,t),e,t,r)}(tr,er<e.length?e.charAt(er):null,er<e.length?cr(er,er+1):cr(er,er))}peg$subclass(peg$SyntaxError,Error),peg$SyntaxError.prototype.format=function(e){var t="Error: "+this.message;if(this.location){var r,n=null;for(r=0;r<e.length;r++)if(e[r].source===this.location.source){n=e[r].text.split(/\r\n|\n|\r/g);break}var o=this.location.start,u=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(o):o,a=this.location.source+":"+u.line+":"+u.column;if(n){var i=this.location.end,s=peg$padEnd("",u.line.toString().length," "),c=n[o.line-1],l=(o.line===i.line?i.column:c.length+1)-o.column||1;t+="\n --\x3e "+a+"\n"+s+" |\n"+u.line+" | "+c+"\n"+s+" | "+peg$padEnd("",o.column-1," ")+peg$padEnd("",l,"^")}else t+="\n at "+a}return t},peg$SyntaxError.buildMessage=function(e,t){var r={literal:function(e){return'"'+o(e.text)+'"'},class:function(e){var t=e.parts.map((function(e){return Array.isArray(e)?u(e[0])+"-"+u(e[1]):u(e)}));return"["+(e.inverted?"^":"")+t.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(e){return e.description}};function n(e){return e.charCodeAt(0).toString(16).toUpperCase()}function o(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+n(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+n(e)}))}function u(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+n(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+n(e)}))}function a(e){return r[e.type](e)}return"Expected "+function(e){var t,r,n=e.map(a);if(n.sort(),n.length>0){for(t=1,r=1;t<n.length;t++)n[t-1]!==n[t]&&(n[r]=n[t],r++);n.length=r}switch(n.length){case 1:return n[0];case 2:return n[0]+" or "+n[1];default:return n.slice(0,-1).join(", ")+", or "+n[n.length-1]}}(e)+" but "+function(e){return e?'"'+o(e)+'"':"end of input"}(t)+" found."};var parser$1={SyntaxError:peg$SyntaxError,parse:peg$parse},GrammarError=grammarError,GrammarLocation=grammarLocation,compiler=compiler_1,parser=parser$1,VERSION=version,RESERVED_WORDS=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","null","true","false","enum","implements","interface","let","package","private","protected","public","static","yield","await","arguments","eval"],peg={VERSION:VERSION,RESERVED_WORDS:RESERVED_WORDS,GrammarError:GrammarError,GrammarLocation:GrammarLocation,parser:parser,compiler:compiler,generate:function(e,t){var r,n,o="plugins"in(t=void 0!==t?t:{})?t.plugins:[],u={parser:peg.parser,passes:(r=peg.compiler.passes,n={},Object.keys(r).forEach((function(e){n[e]=r[e].slice()})),n),reservedWords:peg.RESERVED_WORDS.slice()};return o.forEach((function(e){e.use(u,t)})),peg.compiler.compile(u.parser.parse(e,{grammarSource:t.grammarSource,reservedWords:u.reservedWords}),u.passes,t)}},peg_1=peg,peg$1=getDefaultExportFromCjs(peg_1);return peg$1})); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).peggy=t()}(this,(function(){"use strict";var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var GrammarLocation$4=function(){function GrammarLocation(e,t){this.source=e,this.start=t}return GrammarLocation.prototype.toString=function(){return String(this.source)},GrammarLocation.prototype.offset=function(e){return{line:e.line+this.start.line-1,column:1===e.line?e.column+this.start.column-1:e.column,offset:e.offset+this.start.offset}},GrammarLocation.offsetStart=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.start):e.start},GrammarLocation.offsetEnd=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.end):e.end},GrammarLocation}(),grammarLocation=GrammarLocation$4,__extends=commonjsGlobal&&commonjsGlobal.__extends||(extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},extendStatics(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),extendStatics,GrammarLocation$3=grammarLocation,setProtoOf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},GrammarError$3=function(e){function t(r,n,o){var u=e.call(this,r)||this;return setProtoOf(u,t.prototype),u.name="GrammarError",u.location=n,void 0===o&&(o=[]),u.diagnostics=o,u.stage=null,u.problems=[["error",r,n,o]],u}return __extends(t,e),t.prototype.toString=function(){var t=e.prototype.toString.call(this);this.location&&(t+="\n at ",void 0!==this.location.source&&null!==this.location.source&&(t+="".concat(this.location.source,":")),t+="".concat(this.location.start.line,":").concat(this.location.start.column));for(var r=0,n=this.diagnostics;r<n.length;r++){var o=n[r];t+="\n from ",void 0!==o.location.source&&null!==o.location.source&&(t+="".concat(o.location.source,":")),t+="".concat(o.location.start.line,":").concat(o.location.start.column,": ").concat(o.message)}return t},t.prototype.format=function(e){var t=e.map((function(e){var t=e.source,r=e.text;return{source:t,text:null!=r?String(r).split(/\r\n|\n|\r/g):[]}}));function r(e,r,n){void 0===n&&(n="");var o="",u=t.find((function(t){return t.source===e.source})),a=e.start,i=GrammarLocation$3.offsetStart(e);if(u){var s=e.end,c=u.text[a.line-1],l=(a.line===s.line?s.column:c.length+1)-a.column||1;n&&(o+="\nnote: ".concat(n)),o+="\n --\x3e ".concat(e.source,":").concat(i.line,":").concat(i.column,"\n").concat("".padEnd(r)," |\n").concat(i.line.toString().padStart(r)," | ").concat(c,"\n").concat("".padEnd(r)," | ").concat("".padEnd(a.column-1)).concat("".padEnd(l,"^"))}else o+="\n at ".concat(e.source,":").concat(i.line,":").concat(i.column),n&&(o+=": ".concat(n));return o}function n(e,t,n,o){void 0===o&&(o=[]);var u=-1/0;u=n?o.reduce((function(e,t){var r=t.location;return Math.max(e,GrammarLocation$3.offsetStart(r).line)}),n.start.line):Math.max.apply(null,o.map((function(e){return e.location.start.line}))),u=u.toString().length;var a="".concat(e,": ").concat(t);n&&(a+=r(n,u));for(var i=0,s=o;i<s.length;i++){var c=s[i];a+=r(c.location,u,c.message)}return a}return this.problems.filter((function(e){return"info"!==e[0]})).map((function(e){return n.apply(void 0,e)})).join("\n\n")},t}(Error),grammarError=GrammarError$3,__spreadArray$4=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,u=t.length;o<u;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},visitor$c={build:function(e){function t(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return e[t.type].apply(e,__spreadArray$4([t],r,!1))}function r(){}function n(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return t.apply(void 0,__spreadArray$4([e.expression],r,!1))}function o(e){return function(r){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];r[e].forEach((function(e){return t.apply(void 0,__spreadArray$4([e],n,!1))}))}}var u={grammar:function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];e.topLevelInitializer&&t.apply(void 0,__spreadArray$4([e.topLevelInitializer],r,!1)),e.initializer&&t.apply(void 0,__spreadArray$4([e.initializer],r,!1)),e.rules.forEach((function(e){return t.apply(void 0,__spreadArray$4([e],r,!1))}))},top_level_initializer:r,initializer:r,rule:n,named:n,choice:o("alternatives"),action:n,sequence:o("elements"),labeled:n,text:n,simple_and:n,simple_not:n,optional:n,zero_or_more:n,one_or_more:n,repeated:function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return e.delimiter&&t.apply(void 0,__spreadArray$4([e.delimiter],r,!1)),t.apply(void 0,__spreadArray$4([e.expression],r,!1))},group:n,semantic_and:r,semantic_not:r,rule_ref:r,literal:r,class:r,any:r};return Object.keys(u).forEach((function(t){Object.prototype.hasOwnProperty.call(e,t)||(e[t]=u[t])})),t}},visitor_1=visitor$c,visitor$b=visitor_1,asts$7={findRule:function(e,t){for(var r=0;r<e.rules.length;r++)if(e.rules[r].name===t)return e.rules[r]},indexOfRule:function(e,t){for(var r=0;r<e.rules.length;r++)if(e.rules[r].name===t)return r;return-1},alwaysConsumesOnSuccess:function(e,t){function r(){return!0}function n(){return!1}var o=visitor$b.build({choice:function(e){return e.alternatives.every(o)},sequence:function(e){return e.elements.some(o)},simple_and:n,simple_not:n,optional:n,zero_or_more:n,repeated:function(e){var t=e.min?e.min:e.max;return!("constant"!==t.type||0===t.value||!o(e.expression)&&!(t.value>1&&e.delimiter&&o(e.delimiter)))},semantic_and:n,semantic_not:n,rule_ref:function(t){var r=asts$7.findRule(e,t.name);return r?o(r):void 0},literal:function(e){return""!==e.value},class:r,any:r});return o(t)}},asts_1=asts$7,opcodes={PUSH:0,PUSH_EMPTY_STRING:35,PUSH_UNDEFINED:1,PUSH_NULL:2,PUSH_FAILED:3,PUSH_EMPTY_ARRAY:4,PUSH_CURR_POS:5,POP:6,POP_CURR_POS:7,POP_N:8,NIP:9,APPEND:10,WRAP:11,TEXT:12,PLUCK:36,IF:13,IF_ERROR:14,IF_NOT_ERROR:15,IF_LT:30,IF_GE:31,IF_LT_DYNAMIC:32,IF_GE_DYNAMIC:33,WHILE_NOT_ERROR:16,MATCH_ANY:17,MATCH_STRING:18,MATCH_STRING_IC:19,MATCH_CHAR_CLASS:20,MATCH_REGEXP:20,ACCEPT_N:21,ACCEPT_STRING:22,FAIL:23,LOAD_SAVED_POS:24,UPDATE_SAVED_POS:25,CALL:26,RULE:27,SILENT_FAILS_ON:28,SILENT_FAILS_OFF:29,SOURCE_MAP_PUSH:37,SOURCE_MAP_POP:38,SOURCE_MAP_LABEL_PUSH:39,SOURCE_MAP_LABEL_POP:40},opcodes_1=opcodes,visitor$a=visitor_1,asts$6=asts_1,GrammarError$2=grammarError,ALWAYS_MATCH$1=1,SOMETIMES_MATCH$1=0,NEVER_MATCH$1=-1;function inferenceMatchResult$1(e){function t(e){return e.match=SOMETIMES_MATCH$1}function r(e){return u(e.expression),e.match=ALWAYS_MATCH$1}function n(e){return e.match=u(e.expression)}function o(e,t){for(var r=e.length,n=0,o=0,a=0;a<r;++a){var i=u(e[a]);i===ALWAYS_MATCH$1&&++n,i===NEVER_MATCH$1&&++o}return n===r?ALWAYS_MATCH$1:t?o===r?NEVER_MATCH$1:SOMETIMES_MATCH$1:o>0?NEVER_MATCH$1:SOMETIMES_MATCH$1}var u=visitor$a.build({rule:function(e){var t=void 0,r=0;if(void 0===e.match){e.match=SOMETIMES_MATCH$1;do{if(t=e.match,e.match=u(e.expression),++r>6)throw new GrammarError$2("Infinity cycle detected when trying to evaluate node match result",e.location)}while(t!==e.match)}return e.match},named:n,choice:function(e){return e.match=o(e.alternatives,!0)},action:n,sequence:function(e){return e.match=o(e.elements,!1)},labeled:n,text:n,simple_and:n,simple_not:function(e){return e.match=-u(e.expression)},optional:r,zero_or_more:r,one_or_more:n,repeated:function(e){var t=u(e.expression),r=e.delimiter?u(e.delimiter):NEVER_MATCH$1,n=e.min?e.min:e.max;return"constant"!==n.type||"constant"!==e.max.type?e.match=SOMETIMES_MATCH$1:0===e.max.value||null!==e.max.value&&n.value>e.max.value?e.match=NEVER_MATCH$1:t===NEVER_MATCH$1?e.match=0===n.value?ALWAYS_MATCH$1:NEVER_MATCH$1:t===ALWAYS_MATCH$1?e.delimiter&&n.value>=2?e.match=r:e.match=ALWAYS_MATCH$1:e.delimiter&&n.value>=2?e.match=r===NEVER_MATCH$1?NEVER_MATCH$1:SOMETIMES_MATCH$1:e.match=0===n.value?ALWAYS_MATCH$1:SOMETIMES_MATCH$1},group:n,semantic_and:t,semantic_not:t,rule_ref:function(t){var r=asts$6.findRule(e,t.name);return t.match=u(r)},literal:function(e){var t=0===e.value.length?ALWAYS_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},class:function(e){var t=0===e.parts.length?NEVER_MATCH$1:SOMETIMES_MATCH$1;return e.match=t},any:t});u(e)}inferenceMatchResult$1.ALWAYS_MATCH=ALWAYS_MATCH$1,inferenceMatchResult$1.SOMETIMES_MATCH=SOMETIMES_MATCH$1,inferenceMatchResult$1.NEVER_MATCH=NEVER_MATCH$1;var inferenceMatchResult_1=inferenceMatchResult$1,__spreadArray$3=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,u=t.length;o<u;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},asts$5=asts_1,op$1=opcodes_1,visitor$9=visitor_1,_a$1=inferenceMatchResult_1,ALWAYS_MATCH=_a$1.ALWAYS_MATCH,SOMETIMES_MATCH=_a$1.SOMETIMES_MATCH,NEVER_MATCH=_a$1.NEVER_MATCH;function generateBytecode$1(e,t){var r=[],n=[],o=[],u=[],a=[];function i(e){var t=r.indexOf(e);return-1===t?r.push(e)-1:t}function s(e){var t=JSON.stringify(e),r=o.findIndex((function(e){return JSON.stringify(e)===t}));return-1===r?o.push(e)-1:r}function c(e,t,r){var n={predicate:e,params:t,body:r.code,location:r.codeLocation},o=JSON.stringify(n),a=u.findIndex((function(e){return JSON.stringify(e)===o}));return-1===a?u.push(n)-1:a}function l(e){return a.push(e)-1}function p(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r]})),t}function f(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return e.concat.apply(e,t)}function h(e,t,r,n){return e===ALWAYS_MATCH?r:e===NEVER_MATCH?n:t.concat([r.length,n.length],r,n)}function d(e,t,r,n){var o=Object.keys(r).map((function(e){return n-r[e]}));return[op$1.CALL,e,t,o.length].concat(o)}function g(e,t,r){var n=e.match||0;return f([op$1.PUSH_CURR_POS],C(e,{sp:r.sp+1,env:p(r.env),action:null}),h(t?-n:n,[t?op$1.IF_ERROR:op$1.IF_NOT_ERROR],f([op$1.POP],[t?op$1.POP:op$1.POP_CURR_POS],[op$1.PUSH_UNDEFINED]),f([op$1.POP],[t?op$1.POP_CURR_POS:op$1.POP],[op$1.PUSH_FAILED])))}function A(e,t,r){var n=c(!0,Object.keys(r.env),e);return f([op$1.UPDATE_SAVED_POS],d(n,0,r.env,r.sp),h(e.match||0,[op$1.IF],f([op$1.POP],t?[op$1.PUSH_FAILED]:[op$1.PUSH_UNDEFINED]),f([op$1.POP],t?[op$1.PUSH_UNDEFINED]:[op$1.PUSH_FAILED])))}function m(e){return t=[op$1.WHILE_NOT_ERROR],r=f([op$1.APPEND],e),t.concat([r.length],r);var t,r}function E(e,t,r,n){switch(e.type){case"constant":return{pre:[],post:[],sp:r};case"variable":return e.sp=n+r-t[e.value],{pre:[],post:[],sp:r};case"function":return e.sp=n,{pre:d(c(!0,Object.keys(t),{code:e.value,codeLocation:e.codeLocation}),0,t,r),post:[op$1.NIP],sp:r+1};default:throw new Error('Unknown boundary type "'.concat(e.type,'" for the "repeated" node'))}}function _(e,t){if(null!==t.value){var r="constant"===t.type?[op$1.IF_GE,t.value]:[op$1.IF_GE_DYNAMIC,t.sp];return h(SOMETIMES_MATCH,r,[op$1.PUSH_FAILED],e)}return e}var v,C=(v={grammar:function(e){e.rules.forEach(C),e.literals=r,e.classes=n,e.expectations=o,e.functions=u,e.locations=a},rule:function(e){e.bytecode=C(e.expression,{sp:-1,env:{},pluck:[],action:null})},named:function(e,t){var r=e.match||0,n=r===NEVER_MATCH?-1:s({type:"rule",value:e.name});return f([op$1.SILENT_FAILS_ON],C(e.expression,t),[op$1.SILENT_FAILS_OFF],h(r,[op$1.IF_ERROR],[op$1.FAIL,n],[]))},choice:function(e,t){return function e(t,r){var n=t[0].match||0,o=C(t[0],{sp:r.sp,env:p(r.env),action:null});return n===ALWAYS_MATCH?o:f(o,t.length>1?h(SOMETIMES_MATCH,[op$1.IF_ERROR],f([op$1.POP],e(t.slice(1),r)),[]):[])}(e.alternatives,t)},action:function(e,t){var r=p(t.env),n="sequence"!==e.expression.type||0===e.expression.elements.length,o=C(e.expression,{sp:t.sp+(n?1:0),env:r,action:e}),u=e.expression.match||0,a=n&&u!==NEVER_MATCH?c(!1,Object.keys(r),e):-1;return n?f([op$1.PUSH_CURR_POS],o,h(u,[op$1.IF_NOT_ERROR],f([op$1.LOAD_SAVED_POS,1],d(a,1,r,t.sp+2)),[]),[op$1.NIP]):o},sequence:function(e,t){return f([op$1.PUSH_CURR_POS],function t(r,n){if(r.length>0){var o=e.elements.length-r.length+1;return f(C(r[0],{sp:n.sp,env:n.env,pluck:n.pluck,action:null}),h(r[0].match||0,[op$1.IF_NOT_ERROR],t(r.slice(1),{sp:n.sp+1,env:n.env,pluck:n.pluck,action:n.action}),f(o>1?[op$1.POP_N,o]:[op$1.POP],[op$1.POP_CURR_POS],[op$1.PUSH_FAILED])))}if(n.pluck.length>0)return f([op$1.PLUCK,e.elements.length+1,n.pluck.length],n.pluck.map((function(e){return n.sp-e})));if(n.action){var u=c(!1,Object.keys(n.env),n.action);return f([op$1.LOAD_SAVED_POS,e.elements.length],d(u,e.elements.length+1,n.env,n.sp))}return f([op$1.WRAP,e.elements.length],[op$1.NIP])}(e.elements,{sp:t.sp+1,env:t.env,pluck:[],action:t.action}))},labeled:function(e,r){var n=r.env,o=e.label,u=r.sp+1;o&&(n=p(r.env),r.env[e.label]=u),e.pick&&r.pluck.push(u);var a=C(e.expression,{sp:r.sp,env:n,action:null});return o&&e.labelLocation&&t&&"source-and-map"===t.output?f([op$1.SOURCE_MAP_LABEL_PUSH,u,i(o),l(e.labelLocation)],a,[op$1.SOURCE_MAP_LABEL_POP,u]):a},text:function(e,t){return f([op$1.PUSH_CURR_POS],C(e.expression,{sp:t.sp+1,env:p(t.env),action:null}),h(e.match||0,[op$1.IF_NOT_ERROR],f([op$1.POP],[op$1.TEXT]),[op$1.NIP]))},simple_and:function(e,t){return g(e.expression,!1,t)},simple_not:function(e,t){return g(e.expression,!0,t)},optional:function(e,t){return f(C(e.expression,{sp:t.sp,env:p(t.env),action:null}),h(-(e.expression.match||0),[op$1.IF_ERROR],f([op$1.POP],[op$1.PUSH_NULL]),[]))},zero_or_more:function(e,t){var r=C(e.expression,{sp:t.sp+1,env:p(t.env),action:null});return f([op$1.PUSH_EMPTY_ARRAY],r,m(r),[op$1.POP])},one_or_more:function(e,t){var r=C(e.expression,{sp:t.sp+1,env:p(t.env),action:null});return f([op$1.PUSH_EMPTY_ARRAY],r,h(e.expression.match||0,[op$1.IF_NOT_ERROR],f(m(r),[op$1.POP]),f([op$1.POP],[op$1.POP],[op$1.PUSH_FAILED])))},repeated:function(e,t){var r=e.min?e.min:e.max,n="constant"!==r.type||r.value>0,o="constant"!==e.max.type&&null!==e.max.value,u=n?2:1,a=e.min?E(e.min,t.env,t.sp,2+("function"===e.max.type?1:0)):{pre:[],post:[],sp:t.sp},i=E(e.max,t.env,a.sp,u),s=C(e.expression,{sp:i.sp+u,env:p(t.env),action:null}),c=null!==e.delimiter?C(e.expression,{sp:i.sp+u+1,env:p(t.env),action:null}):s,l=function(e,t,r,n,o){return e?f([op$1.PUSH_CURR_POS],C(e,{sp:n.sp+o+1,env:p(n.env),action:null}),h(e.match||0,[op$1.IF_NOT_ERROR],f([op$1.POP],r,h(-t,[op$1.IF_ERROR],[op$1.POP,op$1.POP_CURR_POS,op$1.PUSH_FAILED],[op$1.NIP])),[op$1.NIP])):r}(e.delimiter,e.expression.match||0,c,t,u),d=_(l,e.max),g=o?_(s,e.max):s,A=f(n?[op$1.PUSH_CURR_POS]:[],[op$1.PUSH_EMPTY_ARRAY],g,m(d),[op$1.POP]);return f(a.pre,i.pre,n?function(e,t){var r="constant"===t.type?[op$1.IF_LT,t.value]:[op$1.IF_LT_DYNAMIC,t.sp];return f(e,h(SOMETIMES_MATCH,r,[op$1.POP,op$1.POP_CURR_POS,op$1.PUSH_FAILED],[op$1.NIP]))}(A,r):A,i.post,a.post)},group:function(e,t){return C(e.expression,{sp:t.sp,env:p(t.env),action:null})},semantic_and:function(e,t){return A(e,!1,t)},semantic_not:function(e,t){return A(e,!0,t)},rule_ref:function(t){return[op$1.RULE,asts$5.indexOfRule(e,t.name)]},literal:function(e){if(e.value.length>0){var t=e.match||0,r=t===SOMETIMES_MATCH||t===ALWAYS_MATCH&&!e.ignoreCase?i(e.ignoreCase?e.value.toLowerCase():e.value):-1,n=t!==ALWAYS_MATCH?s({type:"literal",value:e.value,ignoreCase:e.ignoreCase}):-1;return h(t,e.ignoreCase?[op$1.MATCH_STRING_IC,r]:[op$1.MATCH_STRING,r],e.ignoreCase?[op$1.ACCEPT_N,e.value.length]:[op$1.ACCEPT_STRING,r],[op$1.FAIL,n])}return[op$1.PUSH_EMPTY_STRING]},class:function(e){var t=e.match||0,r=t===SOMETIMES_MATCH?function(e){var t={value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase},r=JSON.stringify(t),o=n.findIndex((function(e){return JSON.stringify(e)===r}));return-1===o?n.push(t)-1:o}(e):-1,o=t!==ALWAYS_MATCH?s({type:"class",value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase}):-1;return h(t,[op$1.MATCH_CHAR_CLASS,r],[op$1.ACCEPT_N,1],[op$1.FAIL,o])},any:function(e){var t=e.match||0,r=t!==ALWAYS_MATCH?s({type:"any"}):-1;return h(t,[op$1.MATCH_ANY],[op$1.ACCEPT_N,1],[op$1.FAIL,r])}},t&&"source-and-map"===t.output&&Object.keys(v).forEach((function(e){var t=v[e];v[e]=function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=t.apply(void 0,__spreadArray$3([e],r,!1));return void 0!==o&&e.location?f([op$1.SOURCE_MAP_PUSH,l(e.location)],o,[op$1.SOURCE_MAP_POP]):o}})),visitor$9.build(v));C(e)}var generateBytecode_1=generateBytecode$1,sourceMap={},sourceMapGenerator={},base64Vlq={},base64$3={};const intToCharMap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");base64$3.encode=function(e){if(0<=e&&e<intToCharMap.length)return intToCharMap[e];throw new TypeError("Must be between 0 and 63: "+e)};const base64$2=base64$3,VLQ_BASE_SHIFT=5,VLQ_BASE=1<<VLQ_BASE_SHIFT,VLQ_BASE_MASK=VLQ_BASE-1,VLQ_CONTINUATION_BIT=VLQ_BASE;function toVLQSigned(e){return e<0?1+(-e<<1):0+(e<<1)}base64Vlq.encode=function(e){let t,r="",n=toVLQSigned(e);do{t=n&VLQ_BASE_MASK,n>>>=VLQ_BASE_SHIFT,n>0&&(t|=VLQ_CONTINUATION_BIT),r+=base64$2.encode(t)}while(n>0);return r};var util$3={};function getArg(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}util$3.getArg=getArg;const supportsNullProto=!("__proto__"in Object.create(null));function identity(e){return e}function toSetString(e){return isProtoString(e)?"$"+e:e}function fromSetString(e){return isProtoString(e)?e.slice(1):e}function isProtoString(e){if(!e)return!1;const t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function compareByGeneratedPositionsInflated(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=strcmp(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:strcmp(e.name,t.name)))))}util$3.toSetString=supportsNullProto?identity:toSetString,util$3.fromSetString=supportsNullProto?identity:fromSetString,util$3.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated;const PROTOCOL="http:",PROTOCOL_AND_HOST=`${PROTOCOL}//host`;function createSafeHandler(e){return t=>{const r=getURLType(t),n=buildSafeBase(t),o=new URL(t,n);e(o);const u=o.toString();return"absolute"===r?u:"scheme-relative"===r?u.slice(PROTOCOL.length):"path-absolute"===r?u.slice(PROTOCOL_AND_HOST.length):computeRelativeURL(n,u)}}function withBase(e,t){return new URL(e,t).toString()}function buildUniqueSegment(e,t){let r=0;for(;;){const n=e+r++;if(-1===t.indexOf(n))return n}}function buildSafeBase(e){const t=e.split("..").length-1,r=buildUniqueSegment("p",e);let n=`${PROTOCOL_AND_HOST}/`;for(let e=0;e<t;e++)n+=`${r}/`;return n}const ABSOLUTE_SCHEME=/^[A-Za-z0-9\+\-\.]+:/;function getURLType(e){return"/"===e[0]?"/"===e[1]?"scheme-relative":"path-absolute":ABSOLUTE_SCHEME.test(e)?"absolute":"path-relative"}function computeRelativeURL(e,t){"string"==typeof e&&(e=new URL(e)),"string"==typeof t&&(t=new URL(t));const r=t.pathname.split("/"),n=e.pathname.split("/");for(n.length>0&&!n[n.length-1]&&n.pop();r.length>0&&n.length>0&&r[0]===n[0];)r.shift(),n.shift();return n.map((()=>"..")).concat(r).join("/")+t.search+t.hash}const ensureDirectory=createSafeHandler((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),normalize=createSafeHandler((e=>{}));function join(e,t){const r=getURLType(t),n=getURLType(e);if(e=ensureDirectory(e),"absolute"===r)return withBase(t,void 0);if("absolute"===n)return withBase(t,e);if("scheme-relative"===r)return normalize(t);if("scheme-relative"===n)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL.length);if("path-absolute"===r)return normalize(t);if("path-absolute"===n)return withBase(t,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL_AND_HOST.length);const o=buildSafeBase(t+e);return computeRelativeURL(o,withBase(t,withBase(e,o)))}function relative(e,t){const r=relativeIfPossible(e,t);return"string"==typeof r?r:normalize(t)}function relativeIfPossible(e,t){if(getURLType(e)!==getURLType(t))return null;const r=buildSafeBase(e+t),n=new URL(e,r),o=new URL(t,r);try{new URL("",o.toString())}catch(e){return null}return o.protocol!==n.protocol||o.user!==n.user||o.password!==n.password||o.hostname!==n.hostname||o.port!==n.port?null:computeRelativeURL(n,o)}util$3.normalize=normalize,util$3.join=join,util$3.relative=relative;var arraySet={};let ArraySet$1=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){const n=new e;for(let e=0,o=t.length;e<o;e++)n.add(t[e],r);return n}size(){return this._set.size}add(e,t){const r=this.has(e),n=this._array.length;r&&!t||this._array.push(e),r||this._set.set(e,n)}has(e){return this._set.has(e)}indexOf(e){const t=this._set.get(e);if(t>=0)return t;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)}toArray(){return this._array.slice()}};arraySet.ArraySet=ArraySet$1;var mappingList={};const util$2=util$3;function generatedPositionAfter(e,t){const r=e.generatedLine,n=t.generatedLine,o=e.generatedColumn,u=t.generatedColumn;return n>r||n==r&&u>=o||util$2.compareByGeneratedPositionsInflated(e,t)<=0}let MappingList$1=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,t){this._array.forEach(e,t)}add(e){generatedPositionAfter(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(util$2.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList.MappingList=MappingList$1;const base64VLQ=base64Vlq,util$1=util$3,ArraySet=arraySet.ArraySet,MappingList=mappingList.MappingList;let SourceMapGenerator$1=class e{constructor(e){e||(e={}),this._file=util$1.getArg(e,"file",null),this._sourceRoot=util$1.getArg(e,"sourceRoot",null),this._skipValidation=util$1.getArg(e,"skipValidation",!1),this._sources=new ArraySet,this._names=new ArraySet,this._mappings=new MappingList,this._sourcesContents=null}static fromSourceMap(t){const r=t.sourceRoot,n=new e({file:t.file,sourceRoot:r});return t.eachMapping((function(e){const t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=util$1.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),n.addMapping(t)})),t.sources.forEach((function(e){let o=e;null!=r&&(o=util$1.relative(r,e)),n._sources.has(o)||n._sources.add(o);const u=t.sourceContentFor(e);null!=u&&n.setSourceContent(e,u)})),n}addMapping(e){const t=util$1.getArg(e,"generated"),r=util$1.getArg(e,"original",null);let n=util$1.getArg(e,"source",null),o=util$1.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,n,o),null!=n&&(n=String(n),this._sources.has(n)||this._sources.add(n)),null!=o&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r&&r.line,originalColumn:r&&r.column,source:n,name:o})}setSourceContent(e,t){let r=e;null!=this._sourceRoot&&(r=util$1.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$1.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[util$1.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,t,r){let n=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');n=e.file}const o=this._sourceRoot;null!=o&&(n=util$1.relative(o,n));const u=this._mappings.toArray().length>0?new ArraySet:this._sources,a=new ArraySet;this._mappings.unsortedForEach((function(t){if(t.source===n&&null!=t.originalLine){const n=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=n.source&&(t.source=n.source,null!=r&&(t.source=util$1.join(r,t.source)),null!=o&&(t.source=util$1.relative(o,t.source)),t.originalLine=n.line,t.originalColumn=n.column,null!=n.name&&(t.name=n.name))}const i=t.source;null==i||u.has(i)||u.add(i);const s=t.name;null==s||a.has(s)||a.add(s)}),this),this._sources=u,this._names=a,e.sources.forEach((function(t){const n=e.sourceContentFor(t);null!=n&&(null!=r&&(t=util$1.join(r,t)),null!=o&&(t=util$1.relative(o,t)),this.setSourceContent(t,n))}),this)}_validateMapping(e,t,r,n){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!n);else if(!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:n}))}_serializeMappings(){let e,t,r,n,o=0,u=1,a=0,i=0,s=0,c=0,l="";const p=this._mappings.toArray();for(let f=0,h=p.length;f<h;f++){if(t=p[f],e="",t.generatedLine!==u)for(o=0;t.generatedLine!==u;)e+=";",u++;else if(f>0){if(!util$1.compareByGeneratedPositionsInflated(t,p[f-1]))continue;e+=","}e+=base64VLQ.encode(t.generatedColumn-o),o=t.generatedColumn,null!=t.source&&(n=this._sources.indexOf(t.source),e+=base64VLQ.encode(n-c),c=n,e+=base64VLQ.encode(t.originalLine-1-i),i=t.originalLine-1,e+=base64VLQ.encode(t.originalColumn-a),a=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=base64VLQ.encode(r-s),s=r)),l+=e}return l}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=util$1.relative(t,e));const r=util$1.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$1.prototype._version=3,sourceMapGenerator.SourceMapGenerator=SourceMapGenerator$1;var sourceNode={};const SourceMapGenerator=sourceMapGenerator.SourceMapGenerator,util=util$3,REGEX_NEWLINE=/(\r?\n)/,NEWLINE_CODE=10,isSourceNode="$$$isSourceNode$$$";let SourceNode$2=class e{constructor(e,t,r,n,o){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==o?null:o,this[isSourceNode]=!0,null!=n&&this.add(n)}static fromStringWithSourceMap(t,r,n){const o=new e,u=t.split(REGEX_NEWLINE);let a=0;const i=function(){return e()+(e()||"");function e(){return a<u.length?u[a++]:void 0}};let s,c=1,l=0,p=null;return r.eachMapping((function(e){if(null!==p){if(!(c<e.generatedLine)){s=u[a]||"";const t=s.substr(0,e.generatedColumn-l);return u[a]=s.substr(e.generatedColumn-l),l=e.generatedColumn,f(p,t),void(p=e)}f(p,i()),c++,l=0}for(;c<e.generatedLine;)o.add(i()),c++;l<e.generatedColumn&&(s=u[a]||"",o.add(s.substr(0,e.generatedColumn)),u[a]=s.substr(e.generatedColumn),l=e.generatedColumn),p=e}),this),a<u.length&&(p&&f(p,i()),o.add(u.splice(a).join(""))),r.sources.forEach((function(e){const t=r.sourceContentFor(e);null!=t&&(null!=n&&(e=util.join(n,e)),o.setSourceContent(e,t))})),o;function f(t,r){if(null===t||void 0===t.source)o.add(r);else{const u=n?util.join(n,t.source):t.source;o.add(new e(t.originalLine,t.originalColumn,u,r,t.name))}}}add(e){if(Array.isArray(e))e.forEach((function(e){this.add(e)}),this);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this}prepend(e){if(Array.isArray(e))for(let t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[isSourceNode]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let t;for(let r=0,n=this.children.length;r<n;r++)t=this.children[r],t[isSourceNode]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})}join(e){let t,r;const n=this.children.length;if(n>0){for(t=[],r=0;r<n-1;r++)t.push(this.children[r]),t.push(e);t.push(this.children[r]),this.children=t}return this}replaceRight(e,t){const r=this.children[this.children.length-1];return r[isSourceNode]?r.replaceRight(e,t):"string"==typeof r?this.children[this.children.length-1]=r.replace(e,t):this.children.push("".replace(e,t)),this}setSourceContent(e,t){this.sourceContents[util.toSetString(e)]=t}walkSourceContents(e){for(let t=0,r=this.children.length;t<r;t++)this.children[t][isSourceNode]&&this.children[t].walkSourceContents(e);const t=Object.keys(this.sourceContents);for(let r=0,n=t.length;r<n;r++)e(util.fromSetString(t[r]),this.sourceContents[t[r]])}toString(){let e="";return this.walk((function(t){e+=t})),e}toStringWithSourceMap(e){const t={code:"",line:1,column:0},r=new SourceMapGenerator(e);let n=!1,o=null,u=null,a=null,i=null;return this.walk((function(e,s){t.code+=e,null!==s.source&&null!==s.line&&null!==s.column?(o===s.source&&u===s.line&&a===s.column&&i===s.name||r.addMapping({source:s.source,original:{line:s.line,column:s.column},generated:{line:t.line,column:t.column},name:s.name}),o=s.source,u=s.line,a=s.column,i=s.name,n=!0):n&&(r.addMapping({generated:{line:t.line,column:t.column}}),o=null,n=!1);for(let u=0,a=e.length;u<a;u++)e.charCodeAt(u)===NEWLINE_CODE?(t.line++,t.column=0,u+1===a?(o=null,n=!1):n&&r.addMapping({source:s.source,original:{line:s.line,column:s.column},generated:{line:t.line,column:t.column},name:s.name})):t.column++})),this.walkSourceContents((function(e,t){r.setSourceContent(e,t)})),{code:t.code,map:r}}};sourceNode.SourceNode=SourceNode$2,sourceMap.SourceMapGenerator=sourceMapGenerator.SourceMapGenerator,sourceMap.SourceNode=sourceNode.SourceNode;var SourceNode$1=sourceMap.SourceNode,GrammarLocation$2=grammarLocation,Stack$1=function(){function e(e,t,r,n){this.sp=-1,this.maxSp=-1,this.varName=t,this.ruleName=e,this.type=r,this.bytecode=n,this.labels={},this.sourceMapStack=[]}return e.prototype.name=function(e){if(e<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack underflow: attempt to use a variable '").concat(this.varName,"<x>' at an index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.varName+e},e.sourceNode=function(e,t,r){var n=GrammarLocation$2.offsetStart(e);return new SourceNode$1(n.line,n.column?n.column-1:null,String(e.source),t,r)},e.prototype.push=function(t){++this.sp>this.maxSp&&(this.maxSp=this.sp);var r=this.labels[this.sp],n=[this.name(this.sp)," = ",t,";"];if(r){if(this.sourceMapStack.length){var o=e.sourceNode(r.location,n.splice(0,2),r.label),u=this.sourceMapPopInternal(),a=u.parts,i=u.location,s=i.start.offset<r.location.end.offset?{start:r.location.end,end:i.end,source:i.source}:i,c=e.sourceNode(s,n.concat("\n"));return this.sourceMapStack.push([a,a.length+1,i]),new SourceNode$1(null,null,r.location.source,[o,c])}return e.sourceNode(r.location,n.concat("\n"))}return n.join("")},e.prototype.pop=function(e){var t=this;return void 0!==e?(this.sp-=e,Array.from({length:e},(function(e,r){return t.name(t.sp+1+r)}))):this.name(this.sp--)},e.prototype.top=function(){return this.name(this.sp)},e.prototype.index=function(e){if(e<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack overflow: attempt to get a variable at a negative index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.name(this.sp-e)},e.prototype.result=function(){if(this.maxSp<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack is empty, can't get the result.\nBytecode: ").concat(this.bytecode));return this.name(0)},e.prototype.defines=function(){var e=this;return this.maxSp<0?"":this.type+" "+Array.from({length:this.maxSp+1},(function(t,r){return e.name(r)})).join(", ")+";"},e.prototype.checkedIf=function(e,t,r){var n=this.sp,o=t();if(!r)return[o];var u=this.sp;this.sp=n;var a=r();if(u!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+e+": Branches of a condition can't move the stack pointer differently (before: "+n+", after then: "+u+", after else: "+this.sp+"). Bytecode: "+this.bytecode);return[o,a]},e.prototype.checkedLoop=function(e,t){var r=this.sp,n=t();if(r!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+e+": Body of a loop can't move the stack pointer (before: "+r+", after: "+this.sp+"). Bytecode: "+this.bytecode);return n},e.prototype.sourceMapPush=function(e,t){if(this.sourceMapStack.length){var r=this.sourceMapStack[this.sourceMapStack.length-1];r[2].start.offset===t.start.offset&&r[2].end.offset>t.end.offset&&(r[2]={start:t.end,end:r[2].end,source:r[2].source})}this.sourceMapStack.push([e,e.length,t])},e.prototype.sourceMapPopInternal=function(){var e=this.sourceMapStack.pop();if(!e)throw new RangeError("Rule '".concat(this.ruleName,"': Attempting to pop an empty source map stack.\nBytecode: ").concat(this.bytecode));var t=e[0],r=e[1],n=e[2],o=t.splice(r).map((function(e){return e instanceof SourceNode$1?e:e+"\n"}));if(o.length){var u=GrammarLocation$2.offsetStart(n);t.push(new SourceNode$1(u.line,u.column-1,String(n.source),o))}return{parts:t,location:n}},e.prototype.sourceMapPop=function(e){var t=this.sourceMapPopInternal().location;if(this.sourceMapStack.length&&t.end.offset<this.sourceMapStack[this.sourceMapStack.length-1][2].end.offset){var r=this.sourceMapPopInternal(),n=r.parts,o=r.location,u=o.start.offset<t.end.offset?{start:t.end,end:o.end,source:o.source}:o;this.sourceMapStack.push([n,n.length+(e||0),u])}},e}(),stack=Stack$1,version="3.0.2",utils={};function hex(e){return e.charCodeAt(0).toString(16).toUpperCase()}function stringEscape$1(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+hex(e)})).replace(/[\x10-\x1F\x7F-\xFF]/g,(function(e){return"\\x"+hex(e)})).replace(/[\u0100-\u0FFF]/g,(function(e){return"\\u0"+hex(e)})).replace(/[\u1000-\uFFFF]/g,(function(e){return"\\u"+hex(e)}))}function regexpClassEscape$1(e){return e.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+hex(e)})).replace(/[\x10-\x1F\x7F-\xFF]/g,(function(e){return"\\x"+hex(e)})).replace(/[\u0100-\u0FFF]/g,(function(e){return"\\u0"+hex(e)})).replace(/[\u1000-\uFFFF]/g,(function(e){return"\\u"+hex(e)}))}function base64$1(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=e.length%3,n=e.length-r,o="",u=0;u<n;u+=3)o+=t[e[u]>>2],o+=t[(3&e[u])<<4|e[u+1]>>4],o+=t[(15&e[u+1])<<2|e[u+2]>>6],o+=t[63&e[u+2]];return 1===r?(o+=t[e[n]>>2],o+=t[(3&e[n])<<4],o+="=="):2===r&&(o+=t[e[n]>>2],o+=t[(3&e[n])<<4|e[n+1]>>4],o+=t[(15&e[n+1])<<2],o+="="),o}utils.hex=hex,utils.stringEscape=stringEscape$1,utils.regexpClassEscape=regexpClassEscape$1,utils.base64=base64$1;var __spreadArray$2=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,u=t.length;o<u;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},asts$4=asts_1,op=opcodes_1,Stack=stack,VERSION$1=version,_a=utils,stringEscape=_a.stringEscape,regexpClassEscape=_a.regexpClassEscape,SourceNode=sourceMap.SourceNode,GrammarLocation$1=grammarLocation;function toSourceNode(e,t,r){var n=GrammarLocation$1.offsetStart(t),o=n.line,u=n.column-1,a=e.split("\n");return 1===a.length?new SourceNode(o,u,String(t.source),e,r):new SourceNode(null,null,String(t.source),a.map((function(e,n){return new SourceNode(o+n,0===n?u:0,String(t.source),n===a.length-1?e:[e,"\n"],r)})))}function wrapInSourceNode(e,t,r,n,o){if(r){var u=GrammarLocation$1.offsetEnd(r);return new SourceNode(null,null,String(r.source),[e,toSourceNode(t,r,o),new SourceNode(u.line,u.column-1,String(r.source),n)])}return new SourceNode(null,null,null,[e,t,n])}function generateJS$1(e,t){if(!(e.literals&&e.locations&&e.classes&&e.expectations&&e.functions))throw new Error("generateJS: generate bytecode was not called.");var r=e.literals,n=e.locations,o=e.classes,u=e.expectations,a=e.functions;if(!t.allowedStartRules)throw new Error("generateJS: options.allowedStartRules was not set.");var i=t.allowedStartRules,s=t.dependencies||{};function c(e){var t=!0,r=0;return function e(n){return Array.isArray(n)?n.map((function(t){return e(t)})):n instanceof SourceNode?(r++,n.children=e(n.children),r--,n):(n=t?n.replace(/^(.+)$/gm," $1"):n.replace(/\n(\s*\S)/g,"\n $1"),t=!r||n.endsWith("\n"),n)}(e)}function l(e){return"peg$c"+e}function p(e){return"peg$r"+e}function f(e){return"peg$e"+e}function h(e){return"peg$f"+e}function d(e){return"peg$parse"+e}function g(e){return e.codeLocation?toSourceNode(e.code,e.codeLocation,"$"+e.type):e.code}e.code=function(e){function r(){return["// @generated by Peggy ".concat(VERSION$1,"."),"//","// https://peggyjs.org/"]}function n(){return t.trace?["{"," SyntaxError: peg$SyntaxError,"," DefaultTracer: peg$DefaultTracer,"," parse: peg$parse","}"].join("\n"):["{"," SyntaxError: peg$SyntaxError,"," parse: peg$parse","}"].join("\n")}var o={bare:function(){return __spreadArray$2(__spreadArray$2([],r(),!0),["(function() {",' "use strict";',"",e,"",c("return "+n()+";"),"})()"],!1)},commonjs:function(){var t=Object.keys(s),o=r();return o.push("",'"use strict";',""),t.length>0&&(t.forEach((function(e){o.push("var "+e+' = require("'+stringEscape(s[e])+'");')})),o.push("")),o.push(e,"","module.exports = "+n()+";"),o},es:function(){var n=Object.keys(s),o=r();return o.push(""),n.length>0&&(n.forEach((function(e){o.push("import "+e+' from "'+stringEscape(s[e])+'";')})),o.push("")),o.push(e,"","export {"," peg$SyntaxError as SyntaxError,",t.trace?" peg$DefaultTracer as DefaultTracer,":""," peg$parse as parse","};"),o},amd:function(){var t=Object.keys(s),o="["+t.map((function(e){return s[e]})).map((function(e){return'"'+stringEscape(e)+'"'})).join(", ")+"]",u=t.join(", ");return __spreadArray$2(__spreadArray$2([],r(),!0),["define("+o+", function("+u+") {",' "use strict";',"",e,"",c("return "+n()+";"),"});"],!1)},globals:function(){return __spreadArray$2(__spreadArray$2([],r(),!0),["(function(root) {",' "use strict";',"",e,"",c("root."+t.exportVar+" = "+n()+";"),"})(this);"],!1)},umd:function(){var o=Object.keys(s),u=o.map((function(e){return s[e]})),a="["+u.map((function(e){return'"'+stringEscape(e)+'"'})).join(", ")+"]",i=u.map((function(e){return'require("'+stringEscape(e)+'")'})).join(", "),l=o.join(", "),p=r();return p.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+a+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+i+");"),null!==t.exportVar&&p.push(" } else {"," root."+t.exportVar+" = factory();"),p.push(" }","})(this, function("+l+") {",' "use strict";',"",e,"",c("return "+n()+";"),"});"),p}}[t.format||"bare"]();return new SourceNode(null,null,t.grammarSource,o.map((function(e){return e instanceof SourceNode?e:e+"\n"})))}(function(){var s=[];e.topLevelInitializer&&(s.push(g(e.topLevelInitializer)),s.push("")),s.push("function peg$subclass(child, parent) {"," function C() { this.constructor = child; }"," C.prototype = parent.prototype;"," child.prototype = new C();","}","","function peg$SyntaxError(message, expected, found, location) {"," var self = Error.call(this, message);"," // istanbul ignore next Check is a necessary evil to support older environments"," if (Object.setPrototypeOf) {"," Object.setPrototypeOf(self, peg$SyntaxError.prototype);"," }"," self.expected = expected;"," self.found = found;"," self.location = location;",' self.name = "SyntaxError";'," return self;","}","","peg$subclass(peg$SyntaxError, Error);","","function peg$padEnd(str, targetLength, padString) {",' padString = padString || " ";'," if (str.length > targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))'," ? this.location.source.offset(s)"," : s;",' var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;'," if (src) {"," var e = this.location.end;"," var filler = peg$padEnd(\"\", offset_s.line.toString().length, ' ');"," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --\x3e " + loc + "\\n"',' + filler + " |\\n"',' + offset_s.line + " | " + line + "\\n"',' + filler + " | " + peg$padEnd("", s.column - 1, \' \')',' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/"/g, "\\\\\\"")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/\\]/g, "\\\\]")',' .replace(/\\^/g, "\\\\^")',' .replace(/-/g, "\\\\-")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),t.trace&&s.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");var A="{ "+i.map((function(e){return e+": "+d(e)})).join(", ")+" }",m=d(i[0]);return s.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+A+";"," var peg$startRuleFunction = "+m+";","",new SourceNode(null,null,t.grammarSource,__spreadArray$2([r.map((function(e,t){return" var "+l(t)+' = "'+stringEscape(e)+'";'})).concat("",o.map((function(e,t){return" var "+p(t)+" = /^["+((r=e).inverted?"^":"")+r.value.map((function(e){return Array.isArray(e)?regexpClassEscape(e[0])+"-"+regexpClassEscape(e[1]):regexpClassEscape(e)})).join("")+"]/"+(r.ignoreCase?"i":"")+";";var r}))).concat("",u.map((function(e,t){return" var "+f(t)+" = "+function(e){switch(e.type){case"rule":return'peg$otherExpectation("'+stringEscape(e.value)+'")';case"literal":return'peg$literalExpectation("'+stringEscape(e.value)+'", '+e.ignoreCase+")";case"class":return"peg$classExpectation(["+e.value.map((function(e){return Array.isArray(e)?'["'+stringEscape(e[0])+'", "'+stringEscape(e[1])+'"]':'"'+stringEscape(e)+'"'})).join(", ")+"], "+e.inverted+", "+e.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(e)+")")}}(e)+";"}))).concat("").join("\n")],a.map((function(e,t){return wrapInSourceNode("\n var ".concat(h(t)," = function(").concat(e.params.join(", "),") {"),e.body,e.location,"};")})),!0)),""," var peg$currPos = 0;"," var peg$savedPos = 0;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = 0;"," var peg$maxFailExpected = [];"," var peg$silentFails = 0;",""),t.cache&&s.push(" var peg$resultsCache = {};",""),t.trace&&s.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),s.push(" var peg$result;","",' if ("startRule" in options) {'," if (!(options.startRule in peg$startRuleFunctions)) {",' throw new Error("Can\'t start parsing from rule \\"" + options.startRule + "\\".");'," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," if (pos >= peg$posDetailsCache.length) {"," p = peg$posDetailsCache.length - 1;"," } else {"," p = pos;"," while (!peg$posDetailsCache[--p]) {}"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos, offset) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," var res = {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };",' if (offset && peg$source && (typeof peg$source.offset === "function")) {'," res.start = peg$source.offset(res.start);"," res.end = peg$source.offset(res.end);"," }"," return res;"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),e.rules.forEach((function(o){s.push.apply(s,c(function(o){var u=[],a=o.bytecode,i=new Stack(o.name,"s","var",a),s=function t(o){var u=0,a=o.length,s=[],g=void 0;function A(e,r,n){var a=r+3,l=o[u+a-2],p=o[u+a-1],f=i.checkedIf(u,(function(){return u+=a+l,(n||t)(o.slice(u-l,u))}),p>0?function(){return u+=p,t(o.slice(u-p,u))}:null),h=f[0],d=f[1];s.push("if ("+e+") {"),s.push.apply(s,c(h)),p>0&&(s.push("} else {"),s.push.apply(s,c(d))),s.push("}")}function m(e,r,n){var a=r+3,c=1===n?"input.charAt(peg$currPos)":"input.substr(peg$currPos, "+n+")",l=null;o[u+a]===op.ACCEPT_N&&o[u+a+1]===n&&(s.push(i.push(c)),c=i.pop(),l=function(e){i.sp++;var r=t(e.slice(2));return r.unshift(1===n?"peg$currPos++;":"peg$currPos += "+n+";"),r}),A(e(c,null!==l),r,l)}for(var E=function(){switch(o[u]){case op.PUSH_EMPTY_STRING:s.push(i.push("''")),u++;break;case op.PUSH_CURR_POS:s.push(i.push("peg$currPos")),u++;break;case op.PUSH_UNDEFINED:s.push(i.push("undefined")),u++;break;case op.PUSH_NULL:s.push(i.push("null")),u++;break;case op.PUSH_FAILED:s.push(i.push("peg$FAILED")),u++;break;case op.PUSH_EMPTY_ARRAY:s.push(i.push("[]")),u++;break;case op.POP:i.pop(),u++;break;case op.POP_CURR_POS:s.push("peg$currPos = "+i.pop()+";"),u++;break;case op.POP_N:i.pop(o[u+1]),u+=2;break;case op.NIP:g=i.pop(),i.pop(),s.push(i.push(g)),u++;break;case op.APPEND:g=i.pop(),s.push(i.top()+".push("+g+");"),u++;break;case op.WRAP:s.push(i.push("["+i.pop(o[u+1]).join(", ")+"]")),u+=2;break;case op.TEXT:s.push(i.push("input.substring("+i.pop()+", peg$currPos)")),u++;break;case op.PLUCK:var a=o[u+3-1],E=3+a;g=o.slice(u+3,u+E),g=1===a?i.index(g[0]):"[ ".concat(g.map((function(e){return i.index(e)})).join(", ")," ]"),i.pop(o[u+1]),s.push(i.push(g)),u+=E;break;case op.IF:A(i.top(),0);break;case op.IF_ERROR:A(i.top()+" === peg$FAILED",0);break;case op.IF_NOT_ERROR:A(i.top()+" !== peg$FAILED",0);break;case op.IF_LT:A(i.top()+".length < "+o[u+1],1);break;case op.IF_GE:A(i.top()+".length >= "+o[u+1],1);break;case op.IF_LT_DYNAMIC:A(i.top()+".length < ("+i.index(o[u+1])+"|0)",1);break;case op.IF_GE_DYNAMIC:A(i.top()+".length >= ("+i.index(o[u+1])+"|0)",1);break;case op.WHILE_NOT_ERROR:y=i.top()+" !== peg$FAILED",S=o[u+2-1],F=i.checkedLoop(u,(function(){return u+=2+S,t(o.slice(u-S,u))})),s.push("while ("+y+") {"),s.push.apply(s,c(F)),s.push("}");break;case op.MATCH_ANY:A("input.length > peg$currPos",0);break;case op.MATCH_STRING:var _=o[u+1],v=r[_];m((function(e,t){return v.length>1?"".concat(e," === ").concat(l(_)):(e=t?"".concat(e,".charCodeAt(0)"):"input.charCodeAt(peg$currPos)","".concat(e," === ").concat(v.charCodeAt(0)))}),1,v.length);break;case op.MATCH_STRING_IC:var C=o[u+1];m((function(e){return"".concat(e,".toLowerCase() === ").concat(l(C))}),1,r[C].length);break;case op.MATCH_CHAR_CLASS:var $=o[u+1];m((function(e){return"".concat(p($),".test(").concat(e,")")}),1,1);break;case op.ACCEPT_N:s.push(i.push(o[u+1]>1?"input.substr(peg$currPos, "+o[u+1]+")":"input.charAt(peg$currPos)")),s.push(o[u+1]>1?"peg$currPos += "+o[u+1]+";":"peg$currPos++;"),u+=2;break;case op.ACCEPT_STRING:s.push(i.push(l(o[u+1]))),s.push(r[o[u+1]].length>1?"peg$currPos += "+r[o[u+1]].length+";":"peg$currPos++;"),u+=2;break;case op.FAIL:s.push(i.push("peg$FAILED")),s.push("if (peg$silentFails === 0) { peg$fail("+f(o[u+1])+"); }"),u+=2;break;case op.LOAD_SAVED_POS:s.push("peg$savedPos = "+i.index(o[u+1])+";"),u+=2;break;case op.UPDATE_SAVED_POS:s.push("peg$savedPos = peg$currPos;"),u++;break;case op.CALL:g=function(e){var t=o[u+4-1];return h(o[u+1])+"("+o.slice(u+4,u+4+t).map((function(e){return i.index(e)})).join(", ")+")"}(),i.pop(o[u+2]),s.push(i.push(g)),u+=4+o[u+3];break;case op.RULE:s.push(i.push(d(e.rules[o[u+1]].name)+"()")),u+=2;break;case op.SILENT_FAILS_ON:s.push("peg$silentFails++;"),u++;break;case op.SILENT_FAILS_OFF:s.push("peg$silentFails--;"),u++;break;case op.SOURCE_MAP_PUSH:i.sourceMapPush(s,n[o[u+1]]),u+=2;break;case op.SOURCE_MAP_POP:i.sourceMapPop(),u++;break;case op.SOURCE_MAP_LABEL_PUSH:i.labels[o[u+1]]={label:r[o[u+2]],location:n[o[u+3]]},u+=4;break;case op.SOURCE_MAP_LABEL_POP:delete i.labels[o[u+1]],u+=2;break;default:throw new Error("Invalid opcode: "+o[u]+".")}var y,S,F};u<a;)E();return s}(a);return u.push(wrapInSourceNode("function ",d(o.name),o.nameLocation,"() {\n",o.name)),t.trace&&u.push(" var startPos = peg$currPos;"),u.push(c(i.defines())),u.push.apply(u,c(function(r,n){var o=[];return o.push(""),t.trace&&o.push("peg$tracer.trace({",' type: "rule.enter",'," rule: "+r+","," location: peg$computeLocation(startPos, startPos, true)","});",""),t.cache&&(o.push("var key = peg$currPos * "+e.rules.length+" + "+n+";","var cached = peg$resultsCache[key];","","if (cached) {"," peg$currPos = cached.nextPos;",""),t.trace&&o.push("if (cached.result !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+r+","," result: cached.result,"," location: peg$computeLocation(startPos, peg$currPos, true)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+r+","," location: peg$computeLocation(startPos, startPos, true)"," });","}",""),o.push(" return cached.result;","}","")),o}('"'+stringEscape(o.name)+'"',asts$4.indexOfRule(e,o.name)))),u.push.apply(u,c(s)),u.push.apply(u,c(function(e,r){var n=[];return t.cache&&n.push("","peg$resultsCache[key] = { nextPos: peg$currPos, result: "+r+" };"),t.trace&&n.push("","if ("+r+" !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+e+","," result: "+r+","," location: peg$computeLocation(startPos, peg$currPos, true)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+e+","," location: peg$computeLocation(startPos, startPos, true)"," });","}"),n.push("","return "+r+";"),n}('"'+stringEscape(o.name)+'"',i.result()))),u.push("}"),u}(o))),s.push("")})),e.initializer&&(s.push(g(e.initializer)),s.push("")),s.push(" peg$result = peg$startRuleFunction();",""," if (peg$result !== peg$FAILED && peg$currPos === input.length) {"," return peg$result;"," } else {"," if (peg$result !== peg$FAILED && peg$currPos < input.length) {"," peg$fail(peg$endExpectation());"," }",""," throw peg$buildStructuredError("," peg$maxFailExpected,"," peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,"," peg$maxFailPos < input.length"," ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)"," : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)"," );"," }","}"),new SourceNode(null,null,t.grammarSource,s.map((function(e){return e instanceof SourceNode?e:e+"\n"})))}())}var generateJs=generateJS$1,asts$3=asts_1,visitor$8=visitor_1;function removeProxyRules$1(e,t,r){var n=[];e.rules.forEach((function(o,u){var a;"rule"===(a=o).type&&"rule_ref"===a.expression.type&&(function(e,t,n){visitor$8.build({rule_ref:function(o){o.name===t&&(o.name=n,r.info('Proxy rule "'.concat(t,'" replaced by the rule "').concat(n,'"'),o.location,[{message:"This rule will be used",location:asts$3.findRule(e,n).nameLocation}]))}})(e)}(e,o.name,o.expression.name),-1===t.allowedStartRules.indexOf(o.name)&&n.push(u))})),n.reverse(),n.forEach((function(t){e.rules.splice(t,1)}))}var removeProxyRules_1=removeProxyRules$1,__assign=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},__assign.apply(this,arguments)},__spreadArray$1=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,u=t.length;o<u;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},visitor$7=visitor_1;function cloneOver(e,t){var r=e,n=t;Object.keys(r).forEach((function(e){return delete r[e]})),Object.keys(n).forEach((function(e){r[e]=n[e]}))}function cleanParts(e){e.sort((function(e,t){var r=Array.isArray(e)?e:[e,e],n=r[0],o=r[1],u=Array.isArray(t)?t:[t,t],a=u[0],i=u[1];return n!==a?n<a?-1:1:o!==i?o>i?-1:1:0}));for(var t="",r="",n=0;n<e.length;n++){var o=e[n],u=Array.isArray(o)?o:[o,o],a=u[0],i=u[1];i<=r?e.splice(n--,1):r.charCodeAt(0)+1>=a.charCodeAt(0)?(e.splice(n--,1),e[n]=[t,r=i]):(t=a,r=i)}return e}function mergeCharacterClasses$1(e){var t=Object.create(null);e.rules.forEach((function(e){return t[e.name]=e.expression}));var r=Object.create(null),n=[function(e,n){if("class"===e.type&&!e.inverted)return n&&((e=__assign({},e)).parts=__spreadArray$1([],e.parts,!0)),e;if("literal"===e.type&&1===e.value.length)return{type:"class",parts:[e.value],inverted:!1,ignoreCase:e.ignoreCase,location:e.location};if("rule_ref"===e.type){var a=t[e.name];if(a){r[e.name]||(r[e.name]=!0,u(a));var i=o(a,!0);return i&&(i.location=e.location),i}}return null},visitor$7.build({choice:function(e){var t=null,r=!1;e.alternatives.forEach((function(n,a){var i;u(n);var s=o(n);s?t&&t.ignoreCase===s.ignoreCase?((i=t.parts).push.apply(i,s.parts),e.alternatives[a-1]=t,e.alternatives[a]=t,t.location={source:t.location.source,start:t.location.start,end:s.location.end},r=!0):t=s:t=null})),r&&(e.alternatives=e.alternatives.filter((function(e,t,r){return!t||e!==r[t-1]})),e.alternatives.forEach((function(t,r){"class"===t.type&&(t.parts=cleanParts(t.parts),1!==t.parts.length||Array.isArray(t.parts[0])||t.inverted||(e.alternatives[r]={type:"literal",value:t.parts[0],ignoreCase:t.ignoreCase,location:t.location}))})),1===e.alternatives.length&&cloneOver(e,e.alternatives[0]))},text:function(e){if(u(e.expression),"class"===e.expression.type||"literal"===e.expression.type){var t=e.location;cloneOver(e,e.expression),e.location=t}}})],o=n[0],u=n[1];e.rules.forEach((function(e){r[e.name]=!0,u(e.expression)}))}var mergeCharacterClasses_1=mergeCharacterClasses$1,visitor$6=visitor_1;function reportDuplicateLabels$1(e,t,r){function n(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r]})),t}function o(e,t){u(e.expression,n(t))}var u=visitor$6.build({rule:function(e){u(e.expression,{})},choice:function(e,t){e.alternatives.forEach((function(e){u(e,n(t))}))},action:o,labeled:function(e,t){var n=e.label;n&&Object.prototype.hasOwnProperty.call(t,n)&&r.error('Label "'.concat(e.label,'" is already defined'),e.labelLocation,[{message:"Original label location",location:t[n]}]),u(e.expression,t),t[e.label]=e.labelLocation},text:o,simple_and:o,simple_not:o,optional:o,zero_or_more:o,one_or_more:o,repeated:function(e,t){e.delimiter&&u(e.delimiter,n(t)),u(e.expression,n(t))},group:o});u(e)}var reportDuplicateLabels_1=reportDuplicateLabels$1,visitor$5=visitor_1;function reportDuplicateRules$1(e,t,r){var n={};visitor$5.build({rule:function(e){Object.prototype.hasOwnProperty.call(n,e.name)?r.error('Rule "'.concat(e.name,'" is already defined'),e.nameLocation,[{message:"Original rule location",location:n[e.name]}]):n[e.name]=e.nameLocation}})(e)}var reportDuplicateRules_1=reportDuplicateRules$1,asts$2=asts_1,visitor$4=visitor_1;function reportInfiniteRecursion$1(e,t,r){var n=[],o=[],u=visitor$4.build({rule:function(e){n.push(e.name),u(e.expression),n.pop()},sequence:function(t){t.elements.every((function(t){return u(t),!asts$2.alwaysConsumesOnSuccess(e,t)}))},repeated:function(t){u(t.expression),t.delimiter&&!asts$2.alwaysConsumesOnSuccess(e,t.expression)&&u(t.delimiter)},rule_ref:function(t){o.push(t);var a=asts$2.findRule(e,t.name);if(-1!==n.indexOf(t.name))return n.push(t.name),void r.error("Possible infinite loop when parsing (left recursion: "+n.join(" -> ")+")",a.nameLocation,o.map((function(e,t,r){return{message:t+1!==r.length?"Step ".concat(t+1,': call of the rule "').concat(e.name,'" without input consumption'):"Step ".concat(t+1,": call itself without input consumption - left recursion"),location:e.location}})));a&&u(a),o.pop()}});u(e)}var reportInfiniteRecursion_1=reportInfiniteRecursion$1,asts$1=asts_1,visitor$3=visitor_1;function reportInfiniteRepetition$1(e,t,r){var n=visitor$3.build({zero_or_more:function(t){asts$1.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},one_or_more:function(t){asts$1.alwaysConsumesOnSuccess(e,t.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",t.location)},repeated:function(t){if(t.delimiter&&n(t.delimiter),!(asts$1.alwaysConsumesOnSuccess(e,t.expression)||t.delimiter&&asts$1.alwaysConsumesOnSuccess(e,t.delimiter)))if(null===t.max.value)r.error("Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",t.location);else{var o=t.min?t.min:t.max;r.warning("constant"===o.type&&"constant"===t.max.type?"An expression may not consume any input and may always match ".concat(t.max.value," times"):"An expression may not consume any input and may always match with a maximum repetition count",t.location)}}});n(e)}var reportInfiniteRepetition_1=reportInfiniteRepetition$1,asts=asts_1,visitor$2=visitor_1;function reportUndefinedRules$1(e,t,r){visitor$2.build({rule_ref:function(t){asts.findRule(e,t.name)||r.error('Rule "'.concat(t.name,'" is not defined'),t.location)}})(e)}var reportUndefinedRules_1=reportUndefinedRules$1,visitor$1=visitor_1;function reportIncorrectPlucking$1(e,t,r){var n=visitor$1.build({action:function(e){n(e.expression,e)},labeled:function(e,t){e.pick&&t&&r.error('"@" cannot be used with an action block',e.labelLocation,[{message:"Action block location",location:t.codeLocation}]),n(e.expression)}});n(e)}var reportIncorrectPlucking_1=reportIncorrectPlucking$1,__spreadArray=commonjsGlobal&&commonjsGlobal.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,u=t.length;o<u;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},GrammarError$1=grammarError,Defaults=function(){function e(e){"function"==typeof(e=void 0!==e?e:{}).error&&(this.error=e.error),"function"==typeof e.warning&&(this.warning=e.warning),"function"==typeof e.info&&(this.info=e.info)}return e.prototype.error=function(){},e.prototype.warning=function(){},e.prototype.info=function(){},e}(),Session$1=function(){function e(e){this._callbacks=new Defaults(e),this._firstError=null,this.errors=0,this.problems=[],this.stage=null}return e.prototype.error=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];++this.errors,null===this._firstError&&(this._firstError=new(GrammarError$1.bind.apply(GrammarError$1,__spreadArray([void 0],t,!1))),this._firstError.stage=this.stage,this._firstError.problems=this.problems),this.problems.push(__spreadArray(["error"],t,!0)),(e=this._callbacks).error.apply(e,__spreadArray([this.stage],t,!1))},e.prototype.warning=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.problems.push(__spreadArray(["warning"],t,!0)),(e=this._callbacks).warning.apply(e,__spreadArray([this.stage],t,!1))},e.prototype.info=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.problems.push(__spreadArray(["info"],t,!0)),(e=this._callbacks).info.apply(e,__spreadArray([this.stage],t,!1))},e.prototype.checkErrors=function(){if(0!==this.errors)throw this._firstError},e}(),session=Session$1,generateBytecode=generateBytecode_1,generateJS=generateJs,inferenceMatchResult=inferenceMatchResult_1,removeProxyRules=removeProxyRules_1,mergeCharacterClasses=mergeCharacterClasses_1,reportDuplicateLabels=reportDuplicateLabels_1,reportDuplicateRules=reportDuplicateRules_1,reportInfiniteRecursion=reportInfiniteRecursion_1,reportInfiniteRepetition=reportInfiniteRepetition_1,reportUndefinedRules=reportUndefinedRules_1,reportIncorrectPlucking=reportIncorrectPlucking_1,Session=session,visitor=visitor_1,base64=utils.base64;function processOptions(e,t){var r={};return Object.keys(e).forEach((function(t){r[t]=e[t]})),Object.keys(t).forEach((function(e){Object.prototype.hasOwnProperty.call(r,e)||(r[e]=t[e])})),r}function isSourceMapCapable(e){return"string"==typeof e?e.length>0:e&&"function"==typeof e.offset}var compiler$1={visitor:visitor,passes:{check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRecursion,reportInfiniteRepetition,reportIncorrectPlucking],transform:[removeProxyRules,mergeCharacterClasses,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile:function(ast,passes,options){if(options=void 0!==options?options:{},options=processOptions(options,{allowedStartRules:[ast.rules[0].name],cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");if(0===options.allowedStartRules.length)throw new Error("Must have at least one start rule");var allRules=ast.rules.map((function(e){return e.name}));if(options.allowedStartRules.some((function(e){return"*"===e})))options.allowedStartRules=allRules;else for(var _i=0,_a=options.allowedStartRules;_i<_a.length;_i++){var rule=_a[_i];if(-1===allRules.indexOf(rule))throw new Error('Unknown start rule "'.concat(rule,'"'))}if(("source-and-map"===options.output||"source-with-inline-map"===options.output)&&!isSourceMapCapable(options.grammarSource))throw new Error("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps");var session=new Session(options);switch(Object.keys(passes).forEach((function(e){session.stage=e,session.info("Process stage ".concat(e)),passes[e].forEach((function(t){session.info("Process pass ".concat(e,".").concat(t.name)),t(ast,options,session)})),session.checkErrors()})),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;case"source-with-inline-map":if("undefined"==typeof TextEncoder)throw new Error("TextEncoder is not supported by this platform");var sourceMap=ast.code.toStringWithSourceMap(),encoder=new TextEncoder,b64=base64(encoder.encode(JSON.stringify(sourceMap.map.toJSON())));return sourceMap.code+"//# sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(b64,"\n");case"ast":return ast;default:throw new Error("Invalid output format: "+options.output+".")}}},compiler_1=compiler$1,OPS_TO_PREFIXED_TYPES={$:"text","&":"simple_and","!":"simple_not"},OPS_TO_SUFFIXED_TYPES={"?":"optional","*":"zero_or_more","+":"one_or_more"},OPS_TO_SEMANTIC_PREDICATE_TYPES={"&":"semantic_and","!":"semantic_not"};function peg$subclass(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function peg$SyntaxError(e,t,r,n){var o=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(o,peg$SyntaxError.prototype),o.expected=t,o.found=r,o.location=n,o.name="SyntaxError",o}function peg$padEnd(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,e+(r+=r.repeat(t)).slice(0,t))}function peg$parse(e,t){var r,n={},o=(t=void 0!==t?t:{}).grammarSource,u={Grammar:pr},a=pr,i="{",s="}",c="=",l="/",p="@",f=":",h="|",d=",",g="..",A="(",m=")",E="\n",_="\r\n",v="/*",C="*/",$="//",y="\\",S="i",F='"',P="'",x="[",D="^",b="]",B="-",R="0",O="b",L="f",M="n",T="r",w="t",I="v",N="x",k="u",H=".",U=";",j=/^[!$&]/,G=/^[*-+?]/,V=/^[!&]/,Y=/^[\t\v-\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/,W=/^[\n\r\u2028\u2029]/,z=/^[\r\u2028-\u2029]/,J=/^[A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376-\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E-\u066F\u0671-\u06D3\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4-\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0-\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,Q=/^[$0-9_\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7-\u09C8\u09CB-\u09CD\u09D7\u09E2-\u09E3\u09E6-\u09EF\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B62-\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56\u0C62-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5-\u0CD6\u0CE2-\u0CE3\u0CE6-\u0CEF\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62-\u0D63\u0D66-\u0D6F\u0D82-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18-\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F3F\u0F71-\u0F84\u0F86-\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19D9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u200C-\u200D\u203F-\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099-\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880-\uA881\uA8B4-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C-\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7-\uAAB8\uAABE-\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5-\uAAF6\uABE3-\uABEA\uABEC-\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33-\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F]/,q=/^[\n\r"\\\u2028-\u2029]/,X=/^[\n\r'\\\u2028-\u2029]/,K=/^[\n\r\\-\]\u2028-\u2029]/,Z=/^["'\\]/,ee=/^[0-9ux]/,te=/^[0-9]/,re=/^[0-9a-f]/i,ne=/^[{}]/,oe=ur("{",!1),ue=ur("}",!1),ae=ur("=",!1),ie=ur("/",!1),se=ur("@",!1),ce=ur(":",!1),le=ar(["!","$","&"],!1,!1),pe=ar([["*","+"],"?"],!1,!1),fe=ur("|",!1),he=ur(",",!1),de=ur("..",!1),ge=ur("(",!1),Ae=ur(")",!1),me=ar(["!","&"],!1,!1),Ee={type:"any"},_e=ir("whitespace"),ve=ar(["\t",["\v","\f"]," "," "," ",[" "," "]," "," "," ","\ufeff"],!1,!1),Ce=ar(["\n","\r","\u2028","\u2029"],!1,!1),$e=ir("end of line"),ye=ur("\n",!1),Se=ur("\r\n",!1),Fe=ar(["\r",["\u2028","\u2029"]],!1,!1),Pe=ir("comment"),xe=ur("/*",!1),De=ur("*/",!1),be=ur("//",!1),Be=ir("identifier"),Re=ar([["A","Z"],"_",["a","z"],"ª","µ","º",["À","Ö"],["Ø","ö"],["ø","ˁ"],["ˆ","ˑ"],["ˠ","ˤ"],"ˬ","ˮ",["Ͱ","ʹ"],["Ͷ","ͷ"],["ͺ","ͽ"],"Ϳ","Ά",["Έ","Ί"],"Ό",["Ύ","Ρ"],["Σ","ϵ"],["Ϸ","ҁ"],["Ҋ","ԯ"],["Ա","Ֆ"],"ՙ",["ա","և"],["א","ת"],["װ","ײ"],["ؠ","ي"],["ٮ","ٯ"],["ٱ","ۓ"],"ە",["ۥ","ۦ"],["ۮ","ۯ"],["ۺ","ۼ"],"ۿ","ܐ",["ܒ","ܯ"],["ݍ","ޥ"],"ޱ",["ߊ","ߪ"],["ߴ","ߵ"],"ߺ",["ࠀ","ࠕ"],"ࠚ","ࠤ","ࠨ",["ࡀ","ࡘ"],["ࢠ","ࢴ"],["ऄ","ह"],"ऽ","ॐ",["क़","ॡ"],["ॱ","ঀ"],["অ","ঌ"],["এ","ঐ"],["ও","ন"],["প","র"],"ল",["শ","হ"],"ঽ","ৎ",["ড়","ঢ়"],["য়","ৡ"],["ৰ","ৱ"],["ਅ","ਊ"],["ਏ","ਐ"],["ਓ","ਨ"],["ਪ","ਰ"],["ਲ","ਲ਼"],["ਵ","ਸ਼"],["ਸ","ਹ"],["ਖ਼","ੜ"],"ਫ਼",["ੲ","ੴ"],["અ","ઍ"],["એ","ઑ"],["ઓ","ન"],["પ","ર"],["લ","ળ"],["વ","હ"],"ઽ","ૐ",["ૠ","ૡ"],"ૹ",["ଅ","ଌ"],["ଏ","ଐ"],["ଓ","ନ"],["ପ","ର"],["ଲ","ଳ"],["ଵ","ହ"],"ଽ",["ଡ଼","ଢ଼"],["ୟ","ୡ"],"ୱ","ஃ",["அ","ஊ"],["எ","ஐ"],["ஒ","க"],["ங","ச"],"ஜ",["ஞ","ட"],["ண","த"],["ந","ப"],["ம","ஹ"],"ௐ",["అ","ఌ"],["ఎ","ఐ"],["ఒ","న"],["ప","హ"],"ఽ",["ౘ","ౚ"],["ౠ","ౡ"],["ಅ","ಌ"],["ಎ","ಐ"],["ಒ","ನ"],["ಪ","ಳ"],["ವ","ಹ"],"ಽ","ೞ",["ೠ","ೡ"],["ೱ","ೲ"],["അ","ഌ"],["എ","ഐ"],["ഒ","ഺ"],"ഽ","ൎ",["ൟ","ൡ"],["ൺ","ൿ"],["අ","ඖ"],["ක","න"],["ඳ","ර"],"ල",["ව","ෆ"],["ก","ะ"],["า","ำ"],["เ","ๆ"],["ກ","ຂ"],"ຄ",["ງ","ຈ"],"ຊ","ຍ",["ດ","ທ"],["ນ","ຟ"],["ມ","ຣ"],"ລ","ວ",["ສ","ຫ"],["ອ","ະ"],["າ","ຳ"],"ຽ",["ເ","ໄ"],"ໆ",["ໜ","ໟ"],"ༀ",["ཀ","ཇ"],["ཉ","ཬ"],["ྈ","ྌ"],["က","ဪ"],"ဿ",["ၐ","ၕ"],["ၚ","ၝ"],"ၡ",["ၥ","ၦ"],["ၮ","ၰ"],["ၵ","ႁ"],"ႎ",["Ⴀ","Ⴥ"],"Ⴧ","Ⴭ",["ა","ჺ"],["ჼ","ቈ"],["ቊ","ቍ"],["ቐ","ቖ"],"ቘ",["ቚ","ቝ"],["በ","ኈ"],["ኊ","ኍ"],["ነ","ኰ"],["ኲ","ኵ"],["ኸ","ኾ"],"ዀ",["ዂ","ዅ"],["ወ","ዖ"],["ዘ","ጐ"],["ጒ","ጕ"],["ጘ","ፚ"],["ᎀ","ᎏ"],["Ꭰ","Ᏽ"],["ᏸ","ᏽ"],["ᐁ","ᙬ"],["ᙯ","ᙿ"],["ᚁ","ᚚ"],["ᚠ","ᛪ"],["ᛮ","ᛸ"],["ᜀ","ᜌ"],["ᜎ","ᜑ"],["ᜠ","ᜱ"],["ᝀ","ᝑ"],["ᝠ","ᝬ"],["ᝮ","ᝰ"],["ក","ឳ"],"ៗ","ៜ",["ᠠ","ᡷ"],["ᢀ","ᢨ"],"ᢪ",["ᢰ","ᣵ"],["ᤀ","ᤞ"],["ᥐ","ᥭ"],["ᥰ","ᥴ"],["ᦀ","ᦫ"],["ᦰ","ᧉ"],["ᨀ","ᨖ"],["ᨠ","ᩔ"],"ᪧ",["ᬅ","ᬳ"],["ᭅ","ᭋ"],["ᮃ","ᮠ"],["ᮮ","ᮯ"],["ᮺ","ᯥ"],["ᰀ","ᰣ"],["ᱍ","ᱏ"],["ᱚ","ᱽ"],["ᳩ","ᳬ"],["ᳮ","ᳱ"],["ᳵ","ᳶ"],["ᴀ","ᶿ"],["Ḁ","ἕ"],["Ἐ","Ἕ"],["ἠ","ὅ"],["Ὀ","Ὅ"],["ὐ","ὗ"],"Ὑ","Ὓ","Ὕ",["Ὗ","ώ"],["ᾀ","ᾴ"],["ᾶ","ᾼ"],"ι",["ῂ","ῄ"],["ῆ","ῌ"],["ῐ","ΐ"],["ῖ","Ί"],["ῠ","Ῥ"],["ῲ","ῴ"],["ῶ","ῼ"],"ⁱ","ⁿ",["ₐ","ₜ"],"ℂ","ℇ",["ℊ","ℓ"],"ℕ",["ℙ","ℝ"],"ℤ","Ω","ℨ",["K","ℭ"],["ℯ","ℹ"],["ℼ","ℿ"],["ⅅ","ⅉ"],"ⅎ",["Ⅰ","ↈ"],["Ⰰ","Ⱞ"],["ⰰ","ⱞ"],["Ⱡ","ⳤ"],["Ⳬ","ⳮ"],["Ⳳ","ⳳ"],["ⴀ","ⴥ"],"ⴧ","ⴭ",["ⴰ","ⵧ"],"ⵯ",["ⶀ","ⶖ"],["ⶠ","ⶦ"],["ⶨ","ⶮ"],["ⶰ","ⶶ"],["ⶸ","ⶾ"],["ⷀ","ⷆ"],["ⷈ","ⷎ"],["ⷐ","ⷖ"],["ⷘ","ⷞ"],"ⸯ",["々","〇"],["〡","〩"],["〱","〵"],["〸","〼"],["ぁ","ゖ"],["ゝ","ゟ"],["ァ","ヺ"],["ー","ヿ"],["ㄅ","ㄭ"],["ㄱ","ㆎ"],["ㆠ","ㆺ"],["ㇰ","ㇿ"],["㐀","䶵"],["一","鿕"],["ꀀ","ꒌ"],["ꓐ","ꓽ"],["ꔀ","ꘌ"],["ꘐ","ꘟ"],["ꘪ","ꘫ"],["Ꙁ","ꙮ"],["ꙿ","ꚝ"],["ꚠ","ꛯ"],["ꜗ","ꜟ"],["Ꜣ","ꞈ"],["Ꞌ","Ɬ"],["Ʞ","ꞷ"],["ꟷ","ꠁ"],["ꠃ","ꠅ"],["ꠇ","ꠊ"],["ꠌ","ꠢ"],["ꡀ","ꡳ"],["ꢂ","ꢳ"],["ꣲ","ꣷ"],"ꣻ","ꣽ",["ꤊ","ꤥ"],["ꤰ","ꥆ"],["ꥠ","ꥼ"],["ꦄ","ꦲ"],"ꧏ",["ꧠ","ꧤ"],["ꧦ","ꧯ"],["ꧺ","ꧾ"],["ꨀ","ꨨ"],["ꩀ","ꩂ"],["ꩄ","ꩋ"],["ꩠ","ꩶ"],"ꩺ",["ꩾ","ꪯ"],"ꪱ",["ꪵ","ꪶ"],["ꪹ","ꪽ"],"ꫀ","ꫂ",["ꫛ","ꫝ"],["ꫠ","ꫪ"],["ꫲ","ꫴ"],["ꬁ","ꬆ"],["ꬉ","ꬎ"],["ꬑ","ꬖ"],["ꬠ","ꬦ"],["ꬨ","ꬮ"],["ꬰ","ꭚ"],["ꭜ","ꭥ"],["ꭰ","ꯢ"],["가","힣"],["ힰ","ퟆ"],["ퟋ","ퟻ"],["豈","舘"],["並","龎"],["ff","st"],["ﬓ","ﬗ"],"יִ",["ײַ","ﬨ"],["שׁ","זּ"],["טּ","לּ"],"מּ",["נּ","סּ"],["ףּ","פּ"],["צּ","ﮱ"],["ﯓ","ﴽ"],["ﵐ","ﶏ"],["ﶒ","ﷇ"],["ﷰ","ﷻ"],["ﹰ","ﹴ"],["ﹶ","ﻼ"],["A","Z"],["a","z"],["ヲ","ᄒ"],["ᅡ","ᅦ"],["ᅧ","ᅬ"],["ᅭ","ᅲ"],["ᅳ","ᅵ"]],!1,!1),Oe=ur("\\",!1),Le=ar(["$",["0","9"],"_",["̀","ͯ"],["҃","҇"],["֑","ֽ"],"ֿ",["ׁ","ׂ"],["ׄ","ׅ"],"ׇ",["ؐ","ؚ"],["ً","٩"],"ٰ",["ۖ","ۜ"],["۟","ۤ"],["ۧ","ۨ"],["۪","ۭ"],["۰","۹"],"ܑ",["ܰ","݊"],["ަ","ް"],["߀","߉"],["߫","߳"],["ࠖ","࠙"],["ࠛ","ࠣ"],["ࠥ","ࠧ"],["ࠩ","࠭"],["࡙","࡛"],["ࣣ","ः"],["ऺ","़"],["ा","ॏ"],["॑","ॗ"],["ॢ","ॣ"],["०","९"],["ঁ","ঃ"],"়",["া","ৄ"],["ে","ৈ"],["ো","্"],"ৗ",["ৢ","ৣ"],["০","৯"],["ਁ","ਃ"],"਼",["ਾ","ੂ"],["ੇ","ੈ"],["ੋ","੍"],"ੑ",["੦","ੱ"],"ੵ",["ઁ","ઃ"],"઼",["ા","ૅ"],["ે","ૉ"],["ો","્"],["ૢ","ૣ"],["૦","૯"],["ଁ","ଃ"],"଼",["ା","ୄ"],["େ","ୈ"],["ୋ","୍"],["ୖ","ୗ"],["ୢ","ୣ"],["୦","୯"],"ஂ",["ா","ூ"],["ெ","ை"],["ொ","்"],"ௗ",["௦","௯"],["ఀ","ః"],["ా","ౄ"],["ె","ై"],["ొ","్"],["ౕ","ౖ"],["ౢ","ౣ"],["౦","౯"],["ಁ","ಃ"],"಼",["ಾ","ೄ"],["ೆ","ೈ"],["ೊ","್"],["ೕ","ೖ"],["ೢ","ೣ"],["೦","೯"],["ഁ","ഃ"],["ാ","ൄ"],["െ","ൈ"],["ൊ","്"],"ൗ",["ൢ","ൣ"],["൦","൯"],["ං","ඃ"],"්",["ා","ු"],"ූ",["ෘ","ෟ"],["෦","෯"],["ෲ","ෳ"],"ั",["ิ","ฺ"],["็","๎"],["๐","๙"],"ັ",["ິ","ູ"],["ົ","ຼ"],["່","ໍ"],["໐","໙"],["༘","༙"],["༠","༩"],"༵","༷","༹",["༾","༿"],["ཱ","྄"],["྆","྇"],["ྍ","ྗ"],["ྙ","ྼ"],"࿆",["ါ","ှ"],["၀","၉"],["ၖ","ၙ"],["ၞ","ၠ"],["ၢ","ၤ"],["ၧ","ၭ"],["ၱ","ၴ"],["ႂ","ႍ"],["ႏ","ႝ"],["፝","፟"],["ᜒ","᜔"],["ᜲ","᜴"],["ᝒ","ᝓ"],["ᝲ","ᝳ"],["឴","៓"],"៝",["០","៩"],["᠋","᠍"],["᠐","᠙"],"ᢩ",["ᤠ","ᤫ"],["ᤰ","᤻"],["᥆","᥏"],["᧐","᧙"],["ᨗ","ᨛ"],["ᩕ","ᩞ"],["᩠","᩼"],["᩿","᪉"],["᪐","᪙"],["᪰","᪽"],["ᬀ","ᬄ"],["᬴","᭄"],["᭐","᭙"],["᭫","᭳"],["ᮀ","ᮂ"],["ᮡ","ᮭ"],["᮰","᮹"],["᯦","᯳"],["ᰤ","᰷"],["᱀","᱉"],["᱐","᱙"],["᳐","᳒"],["᳔","᳨"],"᳭",["ᳲ","᳴"],["᳸","᳹"],["᷀","᷵"],["᷼","᷿"],["",""],["‿","⁀"],"⁔",["⃐","⃜"],"⃡",["⃥","⃰"],["⳯","⳱"],"⵿",["ⷠ","ⷿ"],["〪","〯"],["゙","゚"],["꘠","꘩"],"꙯",["ꙴ","꙽"],["ꚞ","ꚟ"],["꛰","꛱"],"ꠂ","꠆","ꠋ",["ꠣ","ꠧ"],["ꢀ","ꢁ"],["ꢴ","꣄"],["꣐","꣙"],["꣠","꣱"],["꤀","꤉"],["ꤦ","꤭"],["ꥇ","꥓"],["ꦀ","ꦃ"],["꦳","꧀"],["꧐","꧙"],"ꧥ",["꧰","꧹"],["ꨩ","ꨶ"],"ꩃ",["ꩌ","ꩍ"],["꩐","꩙"],["ꩻ","ꩽ"],"ꪰ",["ꪲ","ꪴ"],["ꪷ","ꪸ"],["ꪾ","꪿"],"꫁",["ꫫ","ꫯ"],["ꫵ","꫶"],["ꯣ","ꯪ"],["꯬","꯭"],["꯰","꯹"],"ﬞ",["︀","️"],["︠","︯"],["︳","︴"],["﹍","﹏"],["0","9"],"_"],!1,!1),Me=ir("literal"),Te=ur("i",!1),we=ir("string"),Ie=ur('"',!1),Ne=ur("'",!1),ke=ar(["\n","\r",'"',"\\",["\u2028","\u2029"]],!1,!1),He=ar(["\n","\r","'","\\",["\u2028","\u2029"]],!1,!1),Ue=ir("character class"),je=ur("[",!1),Ge=ur("^",!1),Ve=ur("]",!1),Ye=ur("-",!1),We=ar(["\n","\r",["\\","]"],["\u2028","\u2029"]],!1,!1),ze=ur("0",!1),Je=ar(['"',"'","\\"],!1,!1),Qe=ur("b",!1),qe=ur("f",!1),Xe=ur("n",!1),Ke=ur("r",!1),Ze=ur("t",!1),et=ur("v",!1),tt=ar([["0","9"],"u","x"],!1,!1),rt=ur("x",!1),nt=ur("u",!1),ot=ar([["0","9"]],!1,!1),ut=ar([["0","9"],["a","f"]],!1,!0),at=ur(".",!1),it=ir("code block"),st=ar(["{","}"],!1,!1),ct=ur(";",!1),lt=function(e,t,r){return{type:"grammar",topLevelInitializer:e,initializer:t,rules:r,location:nr()}},pt=function(e){return{type:"top_level_initializer",code:e[0],codeLocation:e[1],location:nr()}},ft=function(e){return{type:"initializer",code:e[0],codeLocation:e[1],location:nr()}},ht=function(e,t,r){return{type:"rule",name:e[0],nameLocation:e[1],expression:null!==t?{type:"named",name:t,expression:r,location:nr()}:r,location:nr()}},dt=function(e,t){return t.length>0?{type:"choice",alternatives:[e].concat(t),location:nr()}:e},gt=function(e,t){return null!==t?{type:"action",expression:e,code:t[0],codeLocation:t[1],location:nr()}:e},At=function(e,t){return t.length>0||"labeled"===e.type&&e.pick?{type:"sequence",elements:[e].concat(t),location:nr()}:e},mt=function(e,t,r){return r.type.startsWith("semantic_")&&or('"@" cannot be used on a semantic predicate',e),{type:"labeled",label:null!==t?t[0]:null,labelLocation:null!==t?t[1]:e,pick:!0,expression:r,location:nr()}},Et=function(e,t){return{type:"labeled",label:e[0],labelLocation:e[1],expression:t,location:nr()}},_t=function(){return nr()},vt=function(e){return Wr.indexOf(e[0])>=0&&or("Label can't be a reserved word \"".concat(e[0],'"'),e[1]),e},Ct=function(e,t){return{type:OPS_TO_PREFIXED_TYPES[e],expression:t,location:nr()}},$t=function(e,t){return{type:OPS_TO_SUFFIXED_TYPES[t],expression:e,location:nr()}},yt=function(e,t,r){var n=t[0],o=t[1];return"constant"===o.type&&0===o.value&&or("The maximum count of repetitions of the rule must be > 0",o.location),{type:"repeated",min:n,max:o,expression:e,delimiter:r,location:nr()}},St=function(e,t){return[null!==e?e:{type:"constant",value:0},null!==t?t:{type:"constant",value:null}]},Ft=function(e){return[null,e]},Pt=function(e){return{type:"constant",value:e,location:nr()}},xt=function(e){return{type:"variable",value:e[0],location:nr()}},Dt=function(e){return{type:"function",value:e[0],codeLocation:e[1],location:nr()}},bt=function(e){return"labeled"===e.type||"sequence"===e.type?{type:"group",expression:e,location:nr()}:e},Bt=function(e){return{type:"rule_ref",name:e[0],location:nr()}},Rt=function(e,t){return{type:OPS_TO_SEMANTIC_PREDICATE_TYPES[e],code:t[0],codeLocation:t[1],location:nr()}},Ot=function(e,t){return[e+t.join(""),nr()]},Lt=function(e,t){return{type:"literal",value:e,ignoreCase:null!==t,location:nr()}},Mt=function(e){return e.join("")},Tt=function(e){return e.join("")},wt=function(e,t,r){return{type:"class",parts:t.filter((function(e){return""!==e})),inverted:null!==e,ignoreCase:null!==r,location:nr()}},It=function(t,r){return t.charCodeAt(0)>r.charCodeAt(0)&&or("Invalid character range: "+e.substring(Kt,Xt)+"."),[t,r]},Nt=function(){return""},kt=function(){return"\0"},Ht=function(){return"\b"},Ut=function(){return"\f"},jt=function(){return"\n"},Gt=function(){return"\r"},Vt=function(){return"\t"},Yt=function(){return"\v"},Wt=function(e){return String.fromCharCode(parseInt(e,16))},zt=function(e){return String.fromCharCode(parseInt(e,16))},Jt=function(){return{type:"any",location:nr()}},Qt=function(e){return[e,nr()]},qt=function(e){return parseInt(e,10)},Xt=0,Kt=0,Zt=[{line:1,column:1}],er=0,tr=[],rr=0;if("startRule"in t){if(!(t.startRule in u))throw new Error("Can't start parsing from rule \""+t.startRule+'".');a=u[t.startRule]}function nr(){return cr(Kt,Xt)}function or(e,t){throw function(e,t){return new peg$SyntaxError(e,null,null,t)}(e,t=void 0!==t?t:cr(Kt,Xt))}function ur(e,t){return{type:"literal",text:e,ignoreCase:t}}function ar(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function ir(e){return{type:"other",description:e}}function sr(t){var r,n=Zt[t];if(n)return n;if(t>=Zt.length)r=Zt.length-1;else for(r=t;!Zt[--r];);for(n={line:(n=Zt[r]).line,column:n.column};r<t;)10===e.charCodeAt(r)?(n.line++,n.column=1):n.column++,r++;return Zt[t]=n,n}function cr(e,t,r){var n=sr(e),u=sr(t),a={source:o,start:{offset:e,line:n.line,column:n.column},end:{offset:t,line:u.line,column:u.column}};return r&&o&&"function"==typeof o.offset&&(a.start=o.offset(a.start),a.end=o.offset(a.end)),a}function lr(e){Xt<er||(Xt>er&&(er=Xt,tr=[]),tr.push(e))}function pr(){var t,r,o,u,a,c;if(t=Xt,Vr(),r=Xt,o=function(){var t,r,o,u;return t=Xt,123===e.charCodeAt(Xt)?(r=i,Xt++):(r=n,0===rr&&lr(oe)),r!==n&&(o=jr())!==n?(125===e.charCodeAt(Xt)?(u=s,Xt++):(u=n,0===rr&&lr(ue)),u!==n&&Yr()!==n?(Kt=t,t=pt(o)):(Xt=t,t=n)):(Xt=t,t=n),t}(),o!==n?(u=Vr(),r=o):(Xt=r,r=n),r===n&&(r=null),o=Xt,u=function(){var e,t;return e=Xt,(t=jr())!==n&&Yr()!==n?(Kt=e,e=ft(t)):(Xt=e,e=n),e}(),u!==n?(a=Vr(),o=u):(Xt=o,o=n),o===n&&(o=null),u=[],a=Xt,(c=fr())!==n?(Vr(),a=c):(Xt=a,a=n),a!==n)for(;a!==n;)u.push(a),a=Xt,(c=fr())!==n?(Vr(),a=c):(Xt=a,a=n);else u=n;return u!==n?(Kt=t,t=lt(r,o,u)):(Xt=t,t=n),t}function fr(){var t,r,o,u,a;return t=Xt,(r=Dr())!==n?(Vr(),o=Xt,(u=Rr())!==n?(Vr(),o=u):(Xt=o,o=n),o===n&&(o=null),61===e.charCodeAt(Xt)?(u=c,Xt++):(u=n,0===rr&&lr(ae)),u!==n?(Vr(),(a=hr())!==n&&Yr()!==n?(Kt=t,t=ht(r,o,a)):(Xt=t,t=n)):(Xt=t,t=n)):(Xt=t,t=n),t}function hr(){var t,r,o,u,a,i;if(t=Xt,(r=dr())!==n){for(o=[],u=Xt,Vr(),47===e.charCodeAt(Xt)?(a=l,Xt++):(a=n,0===rr&&lr(ie)),a!==n?(Vr(),(i=dr())!==n?u=i:(Xt=u,u=n)):(Xt=u,u=n);u!==n;)o.push(u),u=Xt,Vr(),47===e.charCodeAt(Xt)?(a=l,Xt++):(a=n,0===rr&&lr(ie)),a!==n?(Vr(),(i=dr())!==n?u=i:(Xt=u,u=n)):(Xt=u,u=n);Kt=t,t=dt(r,o)}else Xt=t,t=n;return t}function dr(){var e,t,r,o;return e=Xt,t=function(){var e,t,r,o,u;if(e=Xt,(t=gr())!==n){for(r=[],o=Xt,Vr(),(u=gr())!==n?o=u:(Xt=o,o=n);o!==n;)r.push(o),o=Xt,Vr(),(u=gr())!==n?o=u:(Xt=o,o=n);Kt=e,e=At(t,r)}else Xt=e,e=n;return e}(),t!==n?(r=Xt,Vr(),(o=jr())!==n?r=o:(Xt=r,r=n),r===n&&(r=null),Kt=e,e=gt(t,r)):(Xt=e,e=n),e}function gr(){var t,r,o,u;return t=Xt,r=function(){var t,r;return t=Xt,64===e.charCodeAt(Xt)?(r=p,Xt++):(r=n,0===rr&&lr(se)),r!==n&&(Kt=t,r=_t()),t=r}(),r!==n?((o=Ar())===n&&(o=null),(u=mr())!==n?(Kt=t,t=mt(r,o,u)):(Xt=t,t=n)):(Xt=t,t=n),t===n&&(t=Xt,(r=Ar())!==n?(o=Vr(),(u=mr())!==n?(Kt=t,t=Et(r,u)):(Xt=t,t=n)):(Xt=t,t=n),t===n&&(t=mr())),t}function Ar(){var t,r,o;return t=Xt,(r=Dr())!==n?(Vr(),58===e.charCodeAt(Xt)?(o=f,Xt++):(o=n,0===rr&&lr(ce)),o!==n?(Kt=t,t=vt(r)):(Xt=t,t=n)):(Xt=t,t=n),t}function mr(){var t,r,o;return t=Xt,r=function(){var t;return t=e.charAt(Xt),j.test(t)?Xt++:(t=n,0===rr&&lr(le)),t}(),r!==n?(Vr(),(o=Er())!==n?(Kt=t,t=Ct(r,o)):(Xt=t,t=n)):(Xt=t,t=n),t===n&&(t=Er()),t}function Er(){var t,r,o;return t=Xt,(r=vr())!==n?(Vr(),o=function(){var t;return t=e.charAt(Xt),G.test(t)?Xt++:(t=n,0===rr&&lr(pe)),t}(),o!==n?(Kt=t,t=$t(r,o)):(Xt=t,t=n)):(Xt=t,t=n),t===n&&(t=function(){var t,r,o,u,a,i,s;return t=Xt,(r=vr())!==n?(Vr(),124===e.charCodeAt(Xt)?(o=h,Xt++):(o=n,0===rr&&lr(fe)),o!==n?(Vr(),u=function(){var t,r,o,u;return t=Xt,(r=_r())===n&&(r=null),Vr(),e.substr(Xt,2)===g?(o=g,Xt+=2):(o=n,0===rr&&lr(de)),o!==n?(Vr(),(u=_r())===n&&(u=null),Kt=t,t=St(r,u)):(Xt=t,t=n),t===n&&(t=Xt,(r=_r())!==n&&(Kt=t,r=Ft(r)),t=r),t}(),u!==n?(Vr(),a=Xt,44===e.charCodeAt(Xt)?(i=d,Xt++):(i=n,0===rr&&lr(he)),i!==n?(Vr(),(s=hr())!==n?(Vr(),a=s):(Xt=a,a=n)):(Xt=a,a=n),a===n&&(a=null),124===e.charCodeAt(Xt)?(i=h,Xt++):(i=n,0===rr&&lr(fe)),i!==n?(Kt=t,t=yt(r,u,a)):(Xt=t,t=n)):(Xt=t,t=n)):(Xt=t,t=n)):(Xt=t,t=n),t}(),t===n&&(t=vr())),t}function _r(){var t,r;return t=Xt,r=function(){var t,r,o,u;if(t=Xt,r=Xt,o=[],(u=Hr())!==n)for(;u!==n;)o.push(u),u=Hr();else o=n;return(r=o!==n?e.substring(r,Xt):o)!==n&&(Kt=t,r=qt(r)),t=r}(),r!==n&&(Kt=t,r=Pt(r)),(t=r)===n&&(t=Xt,(r=Dr())!==n&&(Kt=t,r=xt(r)),(t=r)===n&&(t=Xt,(r=jr())!==n&&(Kt=t,r=Dt(r)),t=r)),t}function vr(){var t,r,o,u;return t=function(){var t,r,o;return rr++,t=Xt,(r=Rr())!==n?(105===e.charCodeAt(Xt)?(o=S,Xt++):(o=n,0===rr&&lr(Te)),o===n&&(o=null),Kt=t,t=Lt(r,o)):(Xt=t,t=n),rr--,t===n&&(r=n,0===rr&&lr(Me)),t}(),t===n&&(t=function(){var t,r,o,u,a,i;if(rr++,t=Xt,91===e.charCodeAt(Xt)?(r=x,Xt++):(r=n,0===rr&&lr(je)),r!==n){for(94===e.charCodeAt(Xt)?(o=D,Xt++):(o=n,0===rr&&lr(Ge)),o===n&&(o=null),u=[],(a=Mr())===n&&(a=Tr());a!==n;)u.push(a),(a=Mr())===n&&(a=Tr());93===e.charCodeAt(Xt)?(a=b,Xt++):(a=n,0===rr&&lr(Ve)),a!==n?(105===e.charCodeAt(Xt)?(i=S,Xt++):(i=n,0===rr&&lr(Te)),i===n&&(i=null),Kt=t,t=wt(o,u,i)):(Xt=t,t=n)}else Xt=t,t=n;return rr--,t===n&&(r=n,0===rr&&lr(Ue)),t}(),t===n&&(t=function(){var t,r;return t=Xt,46===e.charCodeAt(Xt)?(r=H,Xt++):(r=n,0===rr&&lr(at)),r!==n&&(Kt=t,r=Jt()),t=r}(),t===n&&(t=function(){var t,r,o,u,a,i,s;return t=Xt,(r=Dr())!==n?(o=Xt,u=Xt,a=Vr(),i=Xt,(s=Rr())!==n?i=s=[s,Vr()]:(Xt=i,i=n),i===n&&(i=null),61===e.charCodeAt(Xt)?(s=c,Xt++):(s=n,0===rr&&lr(ae)),s!==n?u=a=[a,i,s]:(Xt=u,u=n),u===n?o=void 0:(Xt=o,o=n),o!==n?(Kt=t,t=Bt(r)):(Xt=t,t=n)):(Xt=t,t=n),t}(),t===n&&(t=function(){var t,r,o;return t=Xt,r=function(){var t;return t=e.charAt(Xt),V.test(t)?Xt++:(t=n,0===rr&&lr(me)),t}(),r!==n?(Vr(),(o=jr())!==n?(Kt=t,t=Rt(r,o)):(Xt=t,t=n)):(Xt=t,t=n),t}(),t===n&&(t=Xt,40===e.charCodeAt(Xt)?(r=A,Xt++):(r=n,0===rr&&lr(ge)),r!==n?(Vr(),(o=hr())!==n?(Vr(),41===e.charCodeAt(Xt)?(u=m,Xt++):(u=n,0===rr&&lr(Ae)),u!==n?(Kt=t,t=bt(o)):(Xt=t,t=n)):(Xt=t,t=n)):(Xt=t,t=n)))))),t}function Cr(){var t;return e.length>Xt?(t=e.charAt(Xt),Xt++):(t=n,0===rr&&lr(Ee)),t}function $r(){var t;return rr++,t=e.charAt(Xt),Y.test(t)?Xt++:(t=n,0===rr&&lr(ve)),rr--,t===n&&0===rr&&lr(_e),t}function yr(){var t;return t=e.charAt(Xt),W.test(t)?Xt++:(t=n,0===rr&&lr(Ce)),t}function Sr(){var t;return rr++,10===e.charCodeAt(Xt)?(t=E,Xt++):(t=n,0===rr&&lr(ye)),t===n&&(e.substr(Xt,2)===_?(t=_,Xt+=2):(t=n,0===rr&&lr(Se)),t===n&&(t=e.charAt(Xt),z.test(t)?Xt++:(t=n,0===rr&&lr(Fe)))),rr--,t===n&&0===rr&&lr($e),t}function Fr(){var t;return rr++,(t=function(){var t,r,o,u,a,i;if(t=Xt,e.substr(Xt,2)===v?(r=v,Xt+=2):(r=n,0===rr&&lr(xe)),r!==n){for(o=[],u=Xt,a=Xt,e.substr(Xt,2)===C?(i=C,Xt+=2):(i=n,0===rr&&lr(De)),i===n?a=void 0:(Xt=a,a=n),a!==n&&(i=Cr())!==n?u=a=[a,i]:(Xt=u,u=n);u!==n;)o.push(u),u=Xt,a=Xt,e.substr(Xt,2)===C?(i=C,Xt+=2):(i=n,0===rr&&lr(De)),i===n?a=void 0:(Xt=a,a=n),a!==n&&(i=Cr())!==n?u=a=[a,i]:(Xt=u,u=n);e.substr(Xt,2)===C?(u=C,Xt+=2):(u=n,0===rr&&lr(De)),u!==n?t=r=[r,o,u]:(Xt=t,t=n)}else Xt=t,t=n;return t}())===n&&(t=xr()),rr--,t===n&&0===rr&&lr(Pe),t}function Pr(){var t,r,o,u,a,i;if(t=Xt,e.substr(Xt,2)===v?(r=v,Xt+=2):(r=n,0===rr&&lr(xe)),r!==n){for(o=[],u=Xt,a=Xt,e.substr(Xt,2)===C?(i=C,Xt+=2):(i=n,0===rr&&lr(De)),i===n&&(i=yr()),i===n?a=void 0:(Xt=a,a=n),a!==n&&(i=Cr())!==n?u=a=[a,i]:(Xt=u,u=n);u!==n;)o.push(u),u=Xt,a=Xt,e.substr(Xt,2)===C?(i=C,Xt+=2):(i=n,0===rr&&lr(De)),i===n&&(i=yr()),i===n?a=void 0:(Xt=a,a=n),a!==n&&(i=Cr())!==n?u=a=[a,i]:(Xt=u,u=n);e.substr(Xt,2)===C?(u=C,Xt+=2):(u=n,0===rr&&lr(De)),u!==n?t=r=[r,o,u]:(Xt=t,t=n)}else Xt=t,t=n;return t}function xr(){var t,r,o,u,a,i;if(t=Xt,e.substr(Xt,2)===$?(r=$,Xt+=2):(r=n,0===rr&&lr(be)),r!==n){for(o=[],u=Xt,a=Xt,(i=yr())===n?a=void 0:(Xt=a,a=n),a!==n&&(i=Cr())!==n?u=a=[a,i]:(Xt=u,u=n);u!==n;)o.push(u),u=Xt,a=Xt,(i=yr())===n?a=void 0:(Xt=a,a=n),a!==n&&(i=Cr())!==n?u=a=[a,i]:(Xt=u,u=n);t=r=[r,o]}else Xt=t,t=n;return t}function Dr(){var e,t,r,o;if(rr++,e=Xt,(t=br())!==n){for(r=[],o=Br();o!==n;)r.push(o),o=Br();Kt=e,e=Ot(t,r)}else Xt=e,e=n;return rr--,e===n&&(t=n,0===rr&&lr(Be)),e}function br(){var t,r,o;return t=e.charAt(Xt),J.test(t)?Xt++:(t=n,0===rr&&lr(Re)),t===n&&(t=Xt,92===e.charCodeAt(Xt)?(r=y,Xt++):(r=n,0===rr&&lr(Oe)),r!==n&&(o=kr())!==n?t=o:(Xt=t,t=n)),t}function Br(){var t;return(t=br())===n&&(t=e.charAt(Xt),Q.test(t)?Xt++:(t=n,0===rr&&lr(Le))),t}function Rr(){var t,r,o,u;if(rr++,t=Xt,34===e.charCodeAt(Xt)?(r=F,Xt++):(r=n,0===rr&&lr(Ie)),r!==n){for(o=[],u=Or();u!==n;)o.push(u),u=Or();34===e.charCodeAt(Xt)?(u=F,Xt++):(u=n,0===rr&&lr(Ie)),u!==n?(Kt=t,t=Mt(o)):(Xt=t,t=n)}else Xt=t,t=n;if(t===n)if(t=Xt,39===e.charCodeAt(Xt)?(r=P,Xt++):(r=n,0===rr&&lr(Ne)),r!==n){for(o=[],u=Lr();u!==n;)o.push(u),u=Lr();39===e.charCodeAt(Xt)?(u=P,Xt++):(u=n,0===rr&&lr(Ne)),u!==n?(Kt=t,t=Tt(o)):(Xt=t,t=n)}else Xt=t,t=n;return rr--,t===n&&(r=n,0===rr&&lr(we)),t}function Or(){var t,r,o,u;return t=Xt,r=Xt,o=Xt,u=e.charAt(Xt),q.test(u)?Xt++:(u=n,0===rr&&lr(ke)),u===n?o=void 0:(Xt=o,o=n),o!==n&&(u=Cr())!==n?r=o=[o,u]:(Xt=r,r=n),(t=r!==n?e.substring(t,Xt):r)===n&&(t=Xt,92===e.charCodeAt(Xt)?(r=y,Xt++):(r=n,0===rr&&lr(Oe)),r!==n&&(o=Ir())!==n?t=o:(Xt=t,t=n),t===n&&(t=wr())),t}function Lr(){var t,r,o,u;return t=Xt,r=Xt,o=Xt,u=e.charAt(Xt),X.test(u)?Xt++:(u=n,0===rr&&lr(He)),u===n?o=void 0:(Xt=o,o=n),o!==n&&(u=Cr())!==n?r=o=[o,u]:(Xt=r,r=n),(t=r!==n?e.substring(t,Xt):r)===n&&(t=Xt,92===e.charCodeAt(Xt)?(r=y,Xt++):(r=n,0===rr&&lr(Oe)),r!==n&&(o=Ir())!==n?t=o:(Xt=t,t=n),t===n&&(t=wr())),t}function Mr(){var t,r,o,u;return t=Xt,(r=Tr())!==n?(45===e.charCodeAt(Xt)?(o=B,Xt++):(o=n,0===rr&&lr(Ye)),o!==n&&(u=Tr())!==n?(Kt=t,t=It(r,u)):(Xt=t,t=n)):(Xt=t,t=n),t}function Tr(){var t,r,o,u;return t=Xt,r=Xt,o=Xt,u=e.charAt(Xt),K.test(u)?Xt++:(u=n,0===rr&&lr(We)),u===n?o=void 0:(Xt=o,o=n),o!==n&&(u=Cr())!==n?r=o=[o,u]:(Xt=r,r=n),(t=r!==n?e.substring(t,Xt):r)===n&&(t=Xt,92===e.charCodeAt(Xt)?(r=y,Xt++):(r=n,0===rr&&lr(Oe)),r!==n&&(o=Ir())!==n?t=o:(Xt=t,t=n),t===n&&(t=wr())),t}function wr(){var t,r;return t=Xt,92===e.charCodeAt(Xt)?(r=y,Xt++):(r=n,0===rr&&lr(Oe)),r!==n&&Sr()!==n?(Kt=t,t=Nt()):(Xt=t,t=n),t}function Ir(){var t,r,o;return t=function(){var t;return(t=Nr())===n&&(t=function(){var t,r,o,u;return t=Xt,r=Xt,o=Xt,u=function(){var t;return(t=Nr())===n&&(t=e.charAt(Xt),ee.test(t)?Xt++:(t=n,0===rr&&lr(tt))),t}(),u===n&&(u=yr()),u===n?o=void 0:(Xt=o,o=n),o!==n&&(u=Cr())!==n?r=o=[o,u]:(Xt=r,r=n),t=r!==n?e.substring(t,Xt):r}()),t}(),t===n&&(t=Xt,48===e.charCodeAt(Xt)?(r=R,Xt++):(r=n,0===rr&&lr(ze)),r!==n?(o=Xt,Hr()===n?o=void 0:(Xt=o,o=n),o!==n?(Kt=t,t=kt()):(Xt=t,t=n)):(Xt=t,t=n),t===n&&(t=function(){var t,r,o,u,a,i;return t=Xt,120===e.charCodeAt(Xt)?(r=N,Xt++):(r=n,0===rr&&lr(rt)),r!==n?(o=Xt,u=Xt,(a=Ur())!==n&&(i=Ur())!==n?u=a=[a,i]:(Xt=u,u=n),(o=u!==n?e.substring(o,Xt):u)!==n?(Kt=t,t=Wt(o)):(Xt=t,t=n)):(Xt=t,t=n),t}(),t===n&&(t=kr()))),t}function Nr(){var t,r;return t=e.charAt(Xt),Z.test(t)?Xt++:(t=n,0===rr&&lr(Je)),t===n&&(t=Xt,98===e.charCodeAt(Xt)?(r=O,Xt++):(r=n,0===rr&&lr(Qe)),r!==n&&(Kt=t,r=Ht()),(t=r)===n&&(t=Xt,102===e.charCodeAt(Xt)?(r=L,Xt++):(r=n,0===rr&&lr(qe)),r!==n&&(Kt=t,r=Ut()),(t=r)===n&&(t=Xt,110===e.charCodeAt(Xt)?(r=M,Xt++):(r=n,0===rr&&lr(Xe)),r!==n&&(Kt=t,r=jt()),(t=r)===n&&(t=Xt,114===e.charCodeAt(Xt)?(r=T,Xt++):(r=n,0===rr&&lr(Ke)),r!==n&&(Kt=t,r=Gt()),(t=r)===n&&(t=Xt,116===e.charCodeAt(Xt)?(r=w,Xt++):(r=n,0===rr&&lr(Ze)),r!==n&&(Kt=t,r=Vt()),(t=r)===n&&(t=Xt,118===e.charCodeAt(Xt)?(r=I,Xt++):(r=n,0===rr&&lr(et)),r!==n&&(Kt=t,r=Yt()),t=r)))))),t}function kr(){var t,r,o,u,a,i,s,c;return t=Xt,117===e.charCodeAt(Xt)?(r=k,Xt++):(r=n,0===rr&&lr(nt)),r!==n?(o=Xt,u=Xt,(a=Ur())!==n&&(i=Ur())!==n&&(s=Ur())!==n&&(c=Ur())!==n?u=a=[a,i,s,c]:(Xt=u,u=n),(o=u!==n?e.substring(o,Xt):u)!==n?(Kt=t,t=zt(o)):(Xt=t,t=n)):(Xt=t,t=n),t}function Hr(){var t;return t=e.charAt(Xt),te.test(t)?Xt++:(t=n,0===rr&&lr(ot)),t}function Ur(){var t;return t=e.charAt(Xt),re.test(t)?Xt++:(t=n,0===rr&&lr(ut)),t}function jr(){var t,r,o,u;return rr++,t=Xt,123===e.charCodeAt(Xt)?(r=i,Xt++):(r=n,0===rr&&lr(oe)),r!==n?(o=function(){var e,t;return e=Xt,t=Gr(),Kt=e,e=t=Qt(t)}(),125===e.charCodeAt(Xt)?(u=s,Xt++):(u=n,0===rr&&lr(ue)),u!==n?t=o:(Xt=t,t=n)):(Xt=t,t=n),rr--,t===n&&(r=n,0===rr&&lr(it)),t}function Gr(){var t,r,o,u,a,c;if(t=Xt,r=[],o=[],u=Xt,a=Xt,c=e.charAt(Xt),ne.test(c)?Xt++:(c=n,0===rr&&lr(st)),c===n?a=void 0:(Xt=a,a=n),a!==n&&(c=Cr())!==n?u=a=[a,c]:(Xt=u,u=n),u!==n)for(;u!==n;)o.push(u),u=Xt,a=Xt,c=e.charAt(Xt),ne.test(c)?Xt++:(c=n,0===rr&&lr(st)),c===n?a=void 0:(Xt=a,a=n),a!==n&&(c=Cr())!==n?u=a=[a,c]:(Xt=u,u=n);else o=n;for(o===n&&(o=Xt,123===e.charCodeAt(Xt)?(u=i,Xt++):(u=n,0===rr&&lr(oe)),u!==n?(a=Gr(),125===e.charCodeAt(Xt)?(c=s,Xt++):(c=n,0===rr&&lr(ue)),c!==n?o=u=[u,a,c]:(Xt=o,o=n)):(Xt=o,o=n));o!==n;){if(r.push(o),o=[],u=Xt,a=Xt,c=e.charAt(Xt),ne.test(c)?Xt++:(c=n,0===rr&&lr(st)),c===n?a=void 0:(Xt=a,a=n),a!==n&&(c=Cr())!==n?u=a=[a,c]:(Xt=u,u=n),u!==n)for(;u!==n;)o.push(u),u=Xt,a=Xt,c=e.charAt(Xt),ne.test(c)?Xt++:(c=n,0===rr&&lr(st)),c===n?a=void 0:(Xt=a,a=n),a!==n&&(c=Cr())!==n?u=a=[a,c]:(Xt=u,u=n);else o=n;o===n&&(o=Xt,123===e.charCodeAt(Xt)?(u=i,Xt++):(u=n,0===rr&&lr(oe)),u!==n?(a=Gr(),125===e.charCodeAt(Xt)?(c=s,Xt++):(c=n,0===rr&&lr(ue)),c!==n?o=u=[u,a,c]:(Xt=o,o=n)):(Xt=o,o=n))}return e.substring(t,Xt)}function Vr(){var e,t;for(e=[],(t=$r())===n&&(t=Sr())===n&&(t=Fr());t!==n;)e.push(t),(t=$r())===n&&(t=Sr())===n&&(t=Fr());return e}function Yr(){var t,r,o,u;if(t=[],r=Xt,o=Vr(),59===e.charCodeAt(Xt)?(u=U,Xt++):(u=n,0===rr&&lr(ct)),u!==n?r=o=[o,u]:(Xt=r,r=n),r!==n)for(;r!==n;)t.push(r),r=Xt,o=Vr(),59===e.charCodeAt(Xt)?(u=U,Xt++):(u=n,0===rr&&lr(ct)),u!==n?r=o=[o,u]:(Xt=r,r=n);else t=n;return t===n&&(t=Xt,r=function(){var e,t;for(e=[],(t=$r())===n&&(t=Pr());t!==n;)e.push(t),(t=$r())===n&&(t=Pr());return e}(),(o=xr())===n&&(o=null),(u=Sr())!==n?t=r=[r,o,u]:(Xt=t,t=n),t===n&&(t=Xt,r=Vr(),o=function(){var t,r;return t=Xt,e.length>Xt?(r=e.charAt(Xt),Xt++):(r=n,0===rr&&lr(Ee)),r===n?t=void 0:(Xt=t,t=n),t}(),o!==n?t=r=[r,o]:(Xt=t,t=n))),t}var Wr=t.reservedWords||[];if((r=a())!==n&&Xt===e.length)return r;throw r!==n&&Xt<e.length&&lr({type:"end"}),function(e,t,r){return new peg$SyntaxError(peg$SyntaxError.buildMessage(e,t),e,t,r)}(tr,er<e.length?e.charAt(er):null,er<e.length?cr(er,er+1):cr(er,er))}peg$subclass(peg$SyntaxError,Error),peg$SyntaxError.prototype.format=function(e){var t="Error: "+this.message;if(this.location){var r,n=null;for(r=0;r<e.length;r++)if(e[r].source===this.location.source){n=e[r].text.split(/\r\n|\n|\r/g);break}var o=this.location.start,u=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(o):o,a=this.location.source+":"+u.line+":"+u.column;if(n){var i=this.location.end,s=peg$padEnd("",u.line.toString().length," "),c=n[o.line-1],l=(o.line===i.line?i.column:c.length+1)-o.column||1;t+="\n --\x3e "+a+"\n"+s+" |\n"+u.line+" | "+c+"\n"+s+" | "+peg$padEnd("",o.column-1," ")+peg$padEnd("",l,"^")}else t+="\n at "+a}return t},peg$SyntaxError.buildMessage=function(e,t){var r={literal:function(e){return'"'+o(e.text)+'"'},class:function(e){var t=e.parts.map((function(e){return Array.isArray(e)?u(e[0])+"-"+u(e[1]):u(e)}));return"["+(e.inverted?"^":"")+t.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(e){return e.description}};function n(e){return e.charCodeAt(0).toString(16).toUpperCase()}function o(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+n(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+n(e)}))}function u(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+n(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+n(e)}))}function a(e){return r[e.type](e)}return"Expected "+function(e){var t,r,n=e.map(a);if(n.sort(),n.length>0){for(t=1,r=1;t<n.length;t++)n[t-1]!==n[t]&&(n[r]=n[t],r++);n.length=r}switch(n.length){case 1:return n[0];case 2:return n[0]+" or "+n[1];default:return n.slice(0,-1).join(", ")+", or "+n[n.length-1]}}(e)+" but "+function(e){return e?'"'+o(e)+'"':"end of input"}(t)+" found."};var parser$1={SyntaxError:peg$SyntaxError,parse:peg$parse},GrammarError=grammarError,GrammarLocation=grammarLocation,compiler=compiler_1,parser=parser$1,VERSION=version,RESERVED_WORDS=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","null","true","false","enum","implements","interface","let","package","private","protected","public","static","yield","await","arguments","eval"],peg={VERSION:VERSION,RESERVED_WORDS:RESERVED_WORDS,GrammarError:GrammarError,GrammarLocation:GrammarLocation,parser:parser,compiler:compiler,generate:function(e,t){var r,n,o="plugins"in(t=void 0!==t?t:{})?t.plugins:[],u={parser:peg.parser,passes:(r=peg.compiler.passes,n={},Object.keys(r).forEach((function(e){n[e]=r[e].slice()})),n),reservedWords:peg.RESERVED_WORDS.slice()};return o.forEach((function(e){e.use(u,t)})),peg.compiler.compile(u.parser.parse(e,{grammarSource:t.grammarSource,reservedWords:u.reservedWords}),u.passes,t)}},peg_1=peg,peg$1=getDefaultExportFromCjs(peg_1);return peg$1})); \ No newline at end of file diff --git a/lib/compiler/passes/generate-bytecode.js b/lib/compiler/passes/generate-bytecode.js index 65caf799..fd8c838d 100644 --- a/lib/compiler/passes/generate-bytecode.js +++ b/lib/compiler/passes/generate-bytecode.js @@ -362,14 +362,12 @@ function generateBytecode(ast, options) { return buildSequence( [op.PUSH_CURR_POS], - [op.SILENT_FAILS_ON], // eslint-disable-next-line no-use-before-define -- Mutual recursion generate(expression, { sp: context.sp + 1, env: cloneEnv(context.env), action: null, }), - [op.SILENT_FAILS_OFF], buildCondition( negative ? -match : match, [negative ? op.IF_ERROR : op.IF_NOT_ERROR], diff --git a/lib/parser.js b/lib/parser.js index 55f2a8b9..8c0f28d2 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -1420,7 +1420,6 @@ function peg$parse(input, options) { s1 = peg$parseIdentifierName(); if (s1 !== peg$FAILED) { s2 = peg$currPos; - peg$silentFails++; s3 = peg$currPos; s4 = peg$parse__(); s5 = peg$currPos; @@ -1450,7 +1449,6 @@ function peg$parse(input, options) { peg$currPos = s3; s3 = peg$FAILED; } - peg$silentFails--; if (s3 === peg$FAILED) { s2 = undefined; } else { @@ -1627,7 +1625,6 @@ function peg$parse(input, options) { s2 = []; s3 = peg$currPos; s4 = peg$currPos; - peg$silentFails++; if (input.substr(peg$currPos, 2) === peg$c14) { s5 = peg$c14; peg$currPos += 2; @@ -1635,7 +1632,6 @@ function peg$parse(input, options) { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e24); } } - peg$silentFails--; if (s5 === peg$FAILED) { s4 = undefined; } else { @@ -1659,7 +1655,6 @@ function peg$parse(input, options) { s2.push(s3); s3 = peg$currPos; s4 = peg$currPos; - peg$silentFails++; if (input.substr(peg$currPos, 2) === peg$c14) { s5 = peg$c14; peg$currPos += 2; @@ -1667,7 +1662,6 @@ function peg$parse(input, options) { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e24); } } - peg$silentFails--; if (s5 === peg$FAILED) { s4 = undefined; } else { @@ -1725,7 +1719,6 @@ function peg$parse(input, options) { s2 = []; s3 = peg$currPos; s4 = peg$currPos; - peg$silentFails++; if (input.substr(peg$currPos, 2) === peg$c14) { s5 = peg$c14; peg$currPos += 2; @@ -1736,7 +1729,6 @@ function peg$parse(input, options) { if (s5 === peg$FAILED) { s5 = peg$parseLineTerminator(); } - peg$silentFails--; if (s5 === peg$FAILED) { s4 = undefined; } else { @@ -1760,7 +1752,6 @@ function peg$parse(input, options) { s2.push(s3); s3 = peg$currPos; s4 = peg$currPos; - peg$silentFails++; if (input.substr(peg$currPos, 2) === peg$c14) { s5 = peg$c14; peg$currPos += 2; @@ -1771,7 +1762,6 @@ function peg$parse(input, options) { if (s5 === peg$FAILED) { s5 = peg$parseLineTerminator(); } - peg$silentFails--; if (s5 === peg$FAILED) { s4 = undefined; } else { @@ -1829,9 +1819,7 @@ function peg$parse(input, options) { s2 = []; s3 = peg$currPos; s4 = peg$currPos; - peg$silentFails++; s5 = peg$parseLineTerminator(); - peg$silentFails--; if (s5 === peg$FAILED) { s4 = undefined; } else { @@ -1855,9 +1843,7 @@ function peg$parse(input, options) { s2.push(s3); s3 = peg$currPos; s4 = peg$currPos; - peg$silentFails++; s5 = peg$parseLineTerminator(); - peg$silentFails--; if (s5 === peg$FAILED) { s4 = undefined; } else { @@ -2116,7 +2102,6 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$currPos; s2 = peg$currPos; - peg$silentFails++; s3 = input.charAt(peg$currPos); if (peg$r10.test(s3)) { peg$currPos++; @@ -2124,7 +2109,6 @@ function peg$parse(input, options) { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e37); } } - peg$silentFails--; if (s3 === peg$FAILED) { s2 = undefined; } else { @@ -2184,7 +2168,6 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$currPos; s2 = peg$currPos; - peg$silentFails++; s3 = input.charAt(peg$currPos); if (peg$r11.test(s3)) { peg$currPos++; @@ -2192,7 +2175,6 @@ function peg$parse(input, options) { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e38); } } - peg$silentFails--; if (s3 === peg$FAILED) { s2 = undefined; } else { @@ -2358,7 +2340,6 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$currPos; s2 = peg$currPos; - peg$silentFails++; s3 = input.charAt(peg$currPos); if (peg$r12.test(s3)) { peg$currPos++; @@ -2366,7 +2347,6 @@ function peg$parse(input, options) { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e44); } } - peg$silentFails--; if (s3 === peg$FAILED) { s2 = undefined; } else { @@ -2463,9 +2443,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { s2 = peg$currPos; - peg$silentFails++; s3 = peg$parseDecimalDigit(); - peg$silentFails--; if (s3 === peg$FAILED) { s2 = undefined; } else { @@ -2615,12 +2593,10 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$currPos; s2 = peg$currPos; - peg$silentFails++; s3 = peg$parseEscapeCharacter(); if (s3 === peg$FAILED) { s3 = peg$parseLineTerminator(); } - peg$silentFails--; if (s3 === peg$FAILED) { s2 = undefined; } else { @@ -2882,7 +2858,6 @@ function peg$parse(input, options) { s2 = []; s3 = peg$currPos; s4 = peg$currPos; - peg$silentFails++; s5 = input.charAt(peg$currPos); if (peg$r17.test(s5)) { peg$currPos++; @@ -2890,7 +2865,6 @@ function peg$parse(input, options) { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e60); } } - peg$silentFails--; if (s5 === peg$FAILED) { s4 = undefined; } else { @@ -2915,7 +2889,6 @@ function peg$parse(input, options) { s2.push(s3); s3 = peg$currPos; s4 = peg$currPos; - peg$silentFails++; s5 = input.charAt(peg$currPos); if (peg$r17.test(s5)) { peg$currPos++; @@ -2923,7 +2896,6 @@ function peg$parse(input, options) { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e60); } } - peg$silentFails--; if (s5 === peg$FAILED) { s4 = undefined; } else { @@ -2982,7 +2954,6 @@ function peg$parse(input, options) { s2 = []; s3 = peg$currPos; s4 = peg$currPos; - peg$silentFails++; s5 = input.charAt(peg$currPos); if (peg$r17.test(s5)) { peg$currPos++; @@ -2990,7 +2961,6 @@ function peg$parse(input, options) { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e60); } } - peg$silentFails--; if (s5 === peg$FAILED) { s4 = undefined; } else { @@ -3015,7 +2985,6 @@ function peg$parse(input, options) { s2.push(s3); s3 = peg$currPos; s4 = peg$currPos; - peg$silentFails++; s5 = input.charAt(peg$currPos); if (peg$r17.test(s5)) { peg$currPos++; @@ -3023,7 +2992,6 @@ function peg$parse(input, options) { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e60); } } - peg$silentFails--; if (s5 === peg$FAILED) { s4 = undefined; } else { @@ -3389,7 +3357,6 @@ function peg$parse(input, options) { var s0, s1; s0 = peg$currPos; - peg$silentFails++; if (input.length > peg$currPos) { s1 = input.charAt(peg$currPos); peg$currPos++; @@ -3397,7 +3364,6 @@ function peg$parse(input, options) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e14); } } - peg$silentFails--; if (s1 === peg$FAILED) { s0 = undefined; } else { diff --git a/test/behavior/generated-parser-behavior.spec.js b/test/behavior/generated-parser-behavior.spec.js index 013c7aa3..83329629 100644 --- a/test/behavior/generated-parser-behavior.spec.js +++ b/test/behavior/generated-parser-behavior.spec.js @@ -2177,12 +2177,13 @@ describe("generated parser behavior", () => { expect(parser).to.failToParse("b"); }); - it("discards any expectations recorded when matching the expression", () => { + it("keeps any expectations recorded when matching the expression", () => { const parser = peg.generate("start = 'a' / &'b' / 'c'", options); expect(parser).to.failToParse("d", { expected: [ { type: "literal", text: "a", ignoreCase: false }, + { type: "literal", text: "b", ignoreCase: false }, { type: "literal", text: "c", ignoreCase: false }, ], }); diff --git a/test/unit/compiler/passes/generate-bytecode.spec.js b/test/unit/compiler/passes/generate-bytecode.spec.js index bea90657..901b5e08 100644 --- a/test/unit/compiler/passes/generate-bytecode.spec.js +++ b/test/unit/compiler/passes/generate-bytecode.spec.js @@ -398,9 +398,7 @@ describe("compiler pass |generateBytecode|", () => { it("generates correct bytecode", () => { expect(pass).to.changeAST(grammar, bytecodeDetails([ 5, // PUSH_CURR_POS - 28, // SILENT_FAILS_ON 18, 0, 2, 2, 22, 0, 23, 0, // <expression> - 29, // SILENT_FAILS_OFF 15, 3, 3, // IF_NOT_ERROR 6, // * POP 7, // POP_CURR_POS @@ -427,9 +425,7 @@ describe("compiler pass |generateBytecode|", () => { it("generates correct bytecode", () => { expect(pass).to.changeAST(grammar, bytecodeDetails([ 5, // PUSH_CURR_POS - 28, // SILENT_FAILS_ON 18, 0, 2, 2, 22, 0, 23, 0, // <expression> - 29, // SILENT_FAILS_OFF 14, 3, 3, // IF_ERROR 6, // * POP 6, // POP