mirror of
https://github.com/pdemian/human2regex.git
synced 2025-05-16 12:30:09 -07:00
8 lines
369 KiB
JavaScript
8 lines
369 KiB
JavaScript
(()=>{var e={8877:function(e,t){"use strict";var n=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};function r(e){return e&&0===e.length}function i(e){return null==e?[]:Object.keys(e)}function o(e){for(var t=[],n=Object.keys(e),r=0;r<n.length;r++)t.push(e[n[r]]);return t}function a(e,t){for(var n=[],r=i(e),o=0;o<r.length;o++){var a=r[o];n.push(t.call(null,e[a],a))}return n}function s(e,t){for(var n=[],r=0;r<e.length;r++)n.push(t.call(null,e[r],r));return n}function l(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];Array.isArray(r)?t=t.concat(l(r)):t.push(r)}return t}function u(e){return r(e)?void 0:e[0]}function c(e){var t=e&&e.length;return t?e[t-1]:void 0}function h(e,t){if(Array.isArray(e))for(var n=0;n<e.length;n++)t.call(null,e[n],n);else{if(!I(e))throw Error("non exhaustive match");var r=i(e);for(n=0;n<r.length;n++){var o=r[n],a=e[o];t.call(null,a,o)}}}function f(e){return"string"==typeof e}function p(e){return void 0===e}function d(e){return e instanceof Function}function m(e,t){return void 0===t&&(t=1),e.slice(t,e.length)}function g(e,t){return void 0===t&&(t=1),e.slice(0,e.length-t)}function v(e,t){var n=[];if(Array.isArray(e))for(var r=0;r<e.length;r++){var i=e[r];t.call(null,i)&&n.push(i)}return n}function y(e,t){return v(e,(function(e){return!t(e)}))}function T(e,t){for(var n=Object.keys(e),r={},i=0;i<n.length;i++){var o=n[i],a=e[o];t(a)&&(r[o]=a)}return r}function E(e,t){return!!I(e)&&e.hasOwnProperty(t)}function S(e,t){return void 0!==C(e,(function(e){return e===t}))}function x(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n]);return t}function O(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}function C(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(t.call(null,r))return r}}function b(e,t){for(var n=[],r=0;r<e.length;r++){var i=e[r];t.call(null,i)&&n.push(i)}return n}function k(e,t,n){for(var r=Array.isArray(e),a=r?e:o(e),s=r?[]:i(e),l=n,u=0;u<a.length;u++)l=t.call(null,l,a[u],r?u:s[u]);return l}function N(e){return y(e,(function(e){return null==e}))}function L(e,t){void 0===t&&(t=function(e){return e});var n=[];return k(e,(function(e,r){var i=t(r);return S(n,i)?e:(n.push(i),e.concat(r))}),[])}function A(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=[null],i=r.concat(t);return Function.bind.apply(e,i)}function R(e){return Array.isArray(e)}function w(e){return e instanceof RegExp}function I(e){return e instanceof Object}function M(e,t){for(var n=0;n<e.length;n++)if(!t(e[n],n))return!1;return!0}function _(e,t){return y(e,(function(e){return S(t,e)}))}function P(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return!0;return!1}function D(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1}function F(e,t){var n=x(e);return n.sort((function(e,n){return t(e)-t(n)})),n}function U(e,t){if(e.length!==t.length)throw Error("can't zipObject with different number of keys and values!");for(var n={},r=0;r<e.length;r++)n[e[r]]=t[r];return n}function W(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0;r<t.length;r++)for(var o=t[r],a=i(o),s=0;s<a.length;s++){var l=a[s];e[l]=o[l]}return e}function B(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0;r<t.length;r++)for(var o=t[r],a=i(o),s=0;s<a.length;s++){var l=a[s];E(e,l)||(e[l]=o[l])}return e}function H(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return B.apply(void 0,n([{}],e))}function G(e,t){var n={};return h(e,(function(e){var r=t(e),i=n[r];i?i.push(e):n[r]=[e]})),n}function z(e,t){for(var n=O(e),r=i(t),o=0;o<r.length;o++){var a=r[o],s=t[a];n[a]=s}return n}function j(){}function V(e){return e}function K(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(void 0!==r?r:void 0)}return t}function Y(e){console&&console.error&&console.error("Error: "+e)}function X(e){console&&console.warn&&console.warn("Warning: "+e)}function $(){return"function"==typeof Map}function q(e){return e[e.length-1]}function Z(e){var t=(new Date).getTime(),n=e();return{time:(new Date).getTime()-t,value:n}}function J(e){function t(){}t.prototype=e;var n=new t;function r(){return typeof n.bar}return r(),r(),e}function Q(e){if(!e)return e;var t=te(e,0);return t.toUpperCase()+e.substring(t.length)}Object.defineProperty(t,"__esModule",{value:!0}),t.toFastProperties=t.timer=t.peek=t.isES2015MapSupported=t.PRINT_WARNING=t.PRINT_ERROR=t.packArray=t.IDENTITY=t.NOOP=t.merge=t.groupBy=t.defaults=t.assignNoOverwrite=t.assign=t.zipObject=t.sortBy=t.indexOf=t.some=t.difference=t.every=t.isObject=t.isRegExp=t.isArray=t.partial=t.uniq=t.compact=t.reduce=t.findAll=t.find=t.cloneObj=t.cloneArr=t.contains=t.has=t.pick=t.reject=t.filter=t.dropRight=t.drop=t.isFunction=t.isUndefined=t.isString=t.forEach=t.last=t.first=t.flatten=t.map=t.mapValues=t.values=t.keys=t.isEmpty=void 0,t.upperFirst=void 0,t.isEmpty=r,t.keys=i,t.values=o,t.mapValues=a,t.map=s,t.flatten=l,t.first=u,t.last=c,t.forEach=h,t.isString=f,t.isUndefined=p,t.isFunction=d,t.drop=m,t.dropRight=g,t.filter=v,t.reject=y,t.pick=T,t.has=E,t.contains=S,t.cloneArr=x,t.cloneObj=O,t.find=C,t.findAll=b,t.reduce=k,t.compact=N,t.uniq=L,t.partial=A,t.isArray=R,t.isRegExp=w,t.isObject=I,t.every=M,t.difference=_,t.some=P,t.indexOf=D,t.sortBy=F,t.zipObject=U,t.assign=W,t.assignNoOverwrite=B,t.defaults=H,t.groupBy=G,t.merge=z,t.NOOP=j,t.IDENTITY=V,t.packArray=K,t.PRINT_ERROR=Y,t.PRINT_WARNING=X,t.isES2015MapSupported=$,t.peek=q,t.timer=Z,t.toFastProperties=J,t.upperFirst=Q;var ee=/[\uD800-\uDBFF][\uDC00-\uDFFF]/;function te(e,t){var n=e.substring(t,t+1);return ee.test(n)?n:e[t]}},417:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Parser=t.createSyntaxDiagramsCode=t.clearCache=t.GAstVisitor=t.serializeProduction=t.serializeGrammar=t.Terminal=t.Rule=t.RepetitionWithSeparator=t.RepetitionMandatoryWithSeparator=t.RepetitionMandatory=t.Repetition=t.Option=t.NonTerminal=t.Alternative=t.Alternation=t.defaultLexerErrorProvider=t.NoViableAltException=t.NotAllInputParsedException=t.MismatchedTokenException=t.isRecognitionException=t.EarlyExitException=t.defaultParserErrorProvider=t.tokenName=t.tokenMatcher=t.tokenLabel=t.EOF=t.createTokenInstance=t.createToken=t.LexerDefinitionErrorType=t.Lexer=t.EMPTY_ALT=t.ParserDefinitionErrorType=t.EmbeddedActionsParser=t.CstParser=t.VERSION=void 0;var r=n(7657);Object.defineProperty(t,"VERSION",{enumerable:!0,get:function(){return r.VERSION}});var i=n(1183);Object.defineProperty(t,"CstParser",{enumerable:!0,get:function(){return i.CstParser}}),Object.defineProperty(t,"EmbeddedActionsParser",{enumerable:!0,get:function(){return i.EmbeddedActionsParser}}),Object.defineProperty(t,"ParserDefinitionErrorType",{enumerable:!0,get:function(){return i.ParserDefinitionErrorType}}),Object.defineProperty(t,"EMPTY_ALT",{enumerable:!0,get:function(){return i.EMPTY_ALT}});var o=n(8200);Object.defineProperty(t,"Lexer",{enumerable:!0,get:function(){return o.Lexer}}),Object.defineProperty(t,"LexerDefinitionErrorType",{enumerable:!0,get:function(){return o.LexerDefinitionErrorType}});var a=n(8980);Object.defineProperty(t,"createToken",{enumerable:!0,get:function(){return a.createToken}}),Object.defineProperty(t,"createTokenInstance",{enumerable:!0,get:function(){return a.createTokenInstance}}),Object.defineProperty(t,"EOF",{enumerable:!0,get:function(){return a.EOF}}),Object.defineProperty(t,"tokenLabel",{enumerable:!0,get:function(){return a.tokenLabel}}),Object.defineProperty(t,"tokenMatcher",{enumerable:!0,get:function(){return a.tokenMatcher}}),Object.defineProperty(t,"tokenName",{enumerable:!0,get:function(){return a.tokenName}});var s=n(7621);Object.defineProperty(t,"defaultParserErrorProvider",{enumerable:!0,get:function(){return s.defaultParserErrorProvider}});var l=n(4400);Object.defineProperty(t,"EarlyExitException",{enumerable:!0,get:function(){return l.EarlyExitException}}),Object.defineProperty(t,"isRecognitionException",{enumerable:!0,get:function(){return l.isRecognitionException}}),Object.defineProperty(t,"MismatchedTokenException",{enumerable:!0,get:function(){return l.MismatchedTokenException}}),Object.defineProperty(t,"NotAllInputParsedException",{enumerable:!0,get:function(){return l.NotAllInputParsedException}}),Object.defineProperty(t,"NoViableAltException",{enumerable:!0,get:function(){return l.NoViableAltException}});var u=n(8232);Object.defineProperty(t,"defaultLexerErrorProvider",{enumerable:!0,get:function(){return u.defaultLexerErrorProvider}});var c=n(2496);Object.defineProperty(t,"Alternation",{enumerable:!0,get:function(){return c.Alternation}}),Object.defineProperty(t,"Alternative",{enumerable:!0,get:function(){return c.Alternative}}),Object.defineProperty(t,"NonTerminal",{enumerable:!0,get:function(){return c.NonTerminal}}),Object.defineProperty(t,"Option",{enumerable:!0,get:function(){return c.Option}}),Object.defineProperty(t,"Repetition",{enumerable:!0,get:function(){return c.Repetition}}),Object.defineProperty(t,"RepetitionMandatory",{enumerable:!0,get:function(){return c.RepetitionMandatory}}),Object.defineProperty(t,"RepetitionMandatoryWithSeparator",{enumerable:!0,get:function(){return c.RepetitionMandatoryWithSeparator}}),Object.defineProperty(t,"RepetitionWithSeparator",{enumerable:!0,get:function(){return c.RepetitionWithSeparator}}),Object.defineProperty(t,"Rule",{enumerable:!0,get:function(){return c.Rule}}),Object.defineProperty(t,"Terminal",{enumerable:!0,get:function(){return c.Terminal}});var h=n(2496);Object.defineProperty(t,"serializeGrammar",{enumerable:!0,get:function(){return h.serializeGrammar}}),Object.defineProperty(t,"serializeProduction",{enumerable:!0,get:function(){return h.serializeProduction}});var f=n(6687);Object.defineProperty(t,"GAstVisitor",{enumerable:!0,get:function(){return f.GAstVisitor}}),t.clearCache=function(){console.warn("The clearCache function was 'soft' removed from the Chevrotain API.\n\t It performs no action other than printing this message.\n\t Please avoid using it as it will be completely removed in the future")};var p=n(7141);Object.defineProperty(t,"createSyntaxDiagramsCode",{enumerable:!0,get:function(){return p.createSyntaxDiagramsCode}});var d=function(){throw new Error("The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead.\t\nSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0")};t.Parser=d},7141:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createSyntaxDiagramsCode=void 0;var r=n(7657);t.createSyntaxDiagramsCode=function(e,t){var n=void 0===t?{}:t,i=n.resourceBase,o=void 0===i?"https://unpkg.com/chevrotain@"+r.VERSION+"/diagrams/":i,a=n.css;return'\n\x3c!-- This is a generated file --\x3e\n<!DOCTYPE html>\n<meta charset="utf-8">\n<style>\n body {\n background-color: hsl(30, 20%, 95%)\n }\n</style>\n\n'+("\n<link rel='stylesheet' href='"+(void 0===a?"https://unpkg.com/chevrotain@"+r.VERSION+"/diagrams/diagrams.css":a)+"'>\n")+("\n<script src='"+o+"vendor/railroad-diagrams.js'><\/script>\n<script src='"+o+"src/diagrams_builder.js'><\/script>\n<script src='"+o+"src/diagrams_behavior.js'><\/script>\n<script src='"+o+"src/main.js'><\/script>\n")+'\n<div id="diagrams" align="center"></div> \n'+("\n<script>\n window.serializedGrammar = "+JSON.stringify(e,null," ")+";\n<\/script>\n")+'\n<script>\n var diagramsDiv = document.getElementById("diagrams");\n main.drawDiagramsFromSerializedGrammar(serializedGrammar, diagramsDiv);\n<\/script>\n'}},9164:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defineNameProp=t.functionName=t.classNameFromInstance=void 0;var r=n(8877);t.classNameFromInstance=function(e){return o(e.constructor)};var i="name";function o(e){var t=e.name;return t||"anonymous"}t.functionName=o,t.defineNameProp=function(e,t){var n=Object.getOwnPropertyDescriptor(e,i);return!(!r.isUndefined(n)&&!n.configurable)&&(Object.defineProperty(e,i,{enumerable:!1,configurable:!0,writable:!1,value:t}),!0)}},4997:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IN=void 0,t.IN="_~IN~_"},3059:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addNoneTerminalToCst=t.addTerminalToCst=t.setNodeLocationFull=t.setNodeLocationOnlyOffset=void 0,t.setNodeLocationOnlyOffset=function(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset)},t.setNodeLocationFull=function(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)},t.addTerminalToCst=function(e,t,n){void 0===e.children[n]?e.children[n]=[t]:e.children[n].push(t)},t.addNoneTerminalToCst=function(e,t,n){void 0===e.children[t]?e.children[t]=[n]:e.children[t].push(n)}},5480:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateRedundantMethods=t.validateMissingCstMethods=t.validateVisitor=t.CstVisitorDefinitionError=t.createBaseVisitorConstructorWithDefaults=t.createBaseSemanticVisitorConstructor=t.defaultVisit=void 0;var r,i=n(8877),o=n(9164);function a(e,t){for(var n=i.keys(e),r=n.length,o=0;o<r;o++)for(var a=e[n[o]],s=a.length,l=0;l<s;l++){var u=a[l];void 0===u.tokenTypeIdx&&this[u.name](u.children,t)}}function s(e,t){var n=l(e,t),r=c(e,t);return n.concat(r)}function l(e,t){var n=i.map(t,(function(t){if(!i.isFunction(e[t]))return{msg:"Missing visitor method: <"+t+"> on "+o.functionName(e.constructor)+" CST Visitor.",type:r.MISSING_METHOD,methodName:t}}));return i.compact(n)}t.defaultVisit=a,t.createBaseSemanticVisitorConstructor=function(e,t){var n=function(){};return o.defineNameProp(n,e+"BaseSemantics"),(n.prototype={visit:function(e,t){if(i.isArray(e)&&(e=e[0]),!i.isUndefined(e))return this[e.name](e.children,t)},validateVisitor:function(){var e=s(this,t);if(!i.isEmpty(e)){var n=i.map(e,(function(e){return e.msg}));throw Error("Errors Detected in CST Visitor <"+o.functionName(this.constructor)+">:\n\t"+n.join("\n\n").replace(/\n/g,"\n\t"))}}}).constructor=n,n._RULE_NAMES=t,n},t.createBaseVisitorConstructorWithDefaults=function(e,t,n){var r=function(){};o.defineNameProp(r,e+"BaseSemanticsWithDefaults");var s=Object.create(n.prototype);return i.forEach(t,(function(e){s[e]=a})),(r.prototype=s).constructor=r,r},function(e){e[e.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",e[e.MISSING_METHOD=1]="MISSING_METHOD"}(r=t.CstVisitorDefinitionError||(t.CstVisitorDefinitionError={})),t.validateVisitor=s,t.validateMissingCstMethods=l;var u=["constructor","visit","validateVisitor"];function c(e,t){var n=[];for(var a in e)!i.isFunction(e[a])||i.contains(u,a)||i.contains(t,a)||n.push({msg:"Redundant visitor method: <"+a+"> on "+o.functionName(e.constructor)+" CST Visitor\nThere is no Grammar Rule corresponding to this method's name.\n",type:r.REDUNDANT_METHOD,methodName:a});return n}t.validateRedundantMethods=c},7621:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultGrammarValidatorErrorProvider=t.defaultGrammarResolverErrorProvider=t.defaultParserErrorProvider=void 0;var r=n(8980),i=n(8877),o=n(8877),a=n(2496),s=n(3081);t.defaultParserErrorProvider={buildMismatchTokenMessage:function(e){var t=e.expected,n=e.actual;e.previous,e.ruleName;return"Expecting "+(r.hasTokenLabel(t)?"--\x3e "+r.tokenLabel(t)+" <--":"token of type --\x3e "+t.name+" <--")+" but found --\x3e '"+n.image+"' <--"},buildNotAllInputParsedMessage:function(e){var t=e.firstRedundant;e.ruleName;return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage:function(e){var t=e.expectedPathsPerAlt,n=e.actual,i=(e.previous,e.customUserDescription),a=(e.ruleName,"Expecting: "),s="\nbut found: '"+o.first(n).image+"'";if(i)return a+i+s;var l=o.reduce(t,(function(e,t){return e.concat(t)}),[]),u=o.map(l,(function(e){return"["+o.map(e,(function(e){return r.tokenLabel(e)})).join(", ")+"]"}));return a+("one of these possible Token sequences:\n"+o.map(u,(function(e,t){return" "+(t+1)+". "+e})).join("\n"))+s},buildEarlyExitMessage:function(e){var t=e.expectedIterationPaths,n=e.actual,i=e.customUserDescription,a=(e.ruleName,"Expecting: "),s="\nbut found: '"+o.first(n).image+"'";return i?a+i+s:a+("expecting at least one iteration which starts with one of these possible Token sequences::\n <"+o.map(t,(function(e){return"["+o.map(e,(function(e){return r.tokenLabel(e)})).join(",")+"]"})).join(" ,")+">")+s}},Object.freeze(t.defaultParserErrorProvider),t.defaultGrammarResolverErrorProvider={buildRuleNotFoundError:function(e,t){return"Invalid grammar, reference to a rule which is not defined: ->"+t.nonTerminalName+"<-\ninside top level rule: ->"+e.name+"<-"}},t.defaultGrammarValidatorErrorProvider={buildDuplicateFoundError:function(e,t){var n,r=e.name,i=o.first(t),l=i.idx,u=s.getProductionDslName(i),c=(n=i)instanceof a.Terminal?n.terminalType.name:n instanceof a.NonTerminal?n.nonTerminalName:"",h="->"+u+(l>0?l:"")+"<- "+(c?"with argument: ->"+c+"<-":"")+"\n appears more than once ("+t.length+" times) in the top level rule: ->"+r+"<-. \n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \n ";return h=(h=h.replace(/[ \t]+/g," ")).replace(/\s\s+/g,"\n")},buildNamespaceConflictError:function(e){return"Namespace conflict found in grammar.\nThe grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <"+e.name+">.\nTo resolve this make sure each Terminal and Non-Terminal names are unique\nThis is easy to accomplish by using the convention that Terminal names start with an uppercase letter\nand Non-Terminal names start with a lower case letter."},buildAlternationPrefixAmbiguityError:function(e){var t=o.map(e.prefixPath,(function(e){return r.tokenLabel(e)})).join(", "),n=0===e.alternation.idx?"":e.alternation.idx;return"Ambiguous alternatives: <"+e.ambiguityIndices.join(" ,")+"> due to common lookahead prefix\nin <OR"+n+"> inside <"+e.topLevelRule.name+"> Rule,\n<"+t+"> may appears as a prefix path in all these alternatives.\nSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\nFor Further details."},buildAlternationAmbiguityError:function(e){var t=o.map(e.prefixPath,(function(e){return r.tokenLabel(e)})).join(", "),n=0===e.alternation.idx?"":e.alternation.idx,i="Ambiguous Alternatives Detected: <"+e.ambiguityIndices.join(" ,")+"> in <OR"+n+"> inside <"+e.topLevelRule.name+"> Rule,\n<"+t+"> may appears as a prefix path in all these alternatives.\n";return i+="See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details."},buildEmptyRepetitionError:function(e){var t=s.getProductionDslName(e.repetition);return 0!==e.repetition.idx&&(t+=e.repetition.idx),"The repetition <"+t+"> within Rule <"+e.topLevelRule.name+"> can never consume any tokens.\nThis could lead to an infinite loop."},buildTokenNameError:function(e){return"deprecated"},buildEmptyAlternationError:function(e){return"Ambiguous empty alternative: <"+(e.emptyChoiceIdx+1)+"> in <OR"+e.alternation.idx+"> inside <"+e.topLevelRule.name+"> Rule.\nOnly the last alternative may be an empty alternative."},buildTooManyAlternativesError:function(e){return"An Alternation cannot have more than 256 alternatives:\n<OR"+e.alternation.idx+"> inside <"+e.topLevelRule.name+"> Rule.\n has "+(e.alternation.definition.length+1)+" alternatives."},buildLeftRecursionError:function(e){var t=e.topLevelRule.name;return"Left Recursion found in grammar.\nrule: <"+t+"> can be invoked from itself (directly or indirectly)\nwithout consuming any Tokens. The grammar path that causes this is: \n "+(t+" --\x3e "+i.map(e.leftRecursionPath,(function(e){return e.name})).concat([t]).join(" --\x3e "))+"\n To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring."},buildInvalidRuleNameError:function(e){return"deprecated"},buildDuplicateRuleNameError:function(e){return"Duplicate definition, rule: ->"+(e.topLevelRule instanceof a.Rule?e.topLevelRule.name:e.topLevelRule)+"<- is already defined in the grammar: ->"+e.grammarName+"<-"}}},4400:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=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])})(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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.EarlyExitException=t.NotAllInputParsedException=t.NoViableAltException=t.MismatchedTokenException=t.isRecognitionException=void 0;var o=n(8877),a="MismatchedTokenException",s="NoViableAltException",l="EarlyExitException",u="NotAllInputParsedException",c=[a,s,l,u];Object.freeze(c),t.isRecognitionException=function(e){return o.contains(c,e.name)};var h=function(e){function t(t,n){var r=this.constructor,i=e.call(this,t)||this;return i.token=n,i.resyncedTokens=[],Object.setPrototypeOf(i,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(i,i.constructor),i}return i(t,e),t}(Error),f=function(e){function t(t,n,r){var i=e.call(this,t,n)||this;return i.previousToken=r,i.name=a,i}return i(t,e),t}(h);t.MismatchedTokenException=f;var p=function(e){function t(t,n,r){var i=e.call(this,t,n)||this;return i.previousToken=r,i.name=s,i}return i(t,e),t}(h);t.NoViableAltException=p;var d=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name=u,r}return i(t,e),t}(h);t.NotAllInputParsedException=d;var m=function(e){function t(t,n,r){var i=e.call(this,t,n)||this;return i.previousToken=r,i.name=l,i}return i(t,e),t}(h);t.EarlyExitException=m},4046:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=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])})(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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.checkPrefixAlternativesAmbiguities=t.validateSomeNonEmptyLookaheadPath=t.validateTooManyAlts=t.RepetionCollector=t.validateAmbiguousAlternationAlternatives=t.validateEmptyOrAlternative=t.getFirstNoneTerminal=t.validateNoLeftRecursion=t.validateRuleIsOverridden=t.validateRuleDoesNotAlreadyExist=t.OccurrenceValidationCollector=t.identifyProductionForDuplicates=t.validateGrammar=void 0;var o=n(8877),a=n(8877),s=n(1183),l=n(3081),u=n(3670),c=n(6331),h=n(2496),f=n(6687);function p(e){return l.getProductionDslName(e)+"_#_"+e.idx+"_#_"+d(e)}function d(e){return e instanceof h.Terminal?e.terminalType.name:e instanceof h.NonTerminal?e.nonTerminalName:""}t.validateGrammar=function(e,t,n,r,i){var u=o.map(e,(function(e){return function(e,t){var n=new m;e.accept(n);var r=n.allProductions,i=o.groupBy(r,p),a=o.pick(i,(function(e){return e.length>1}));return o.map(o.values(a),(function(n){var r=o.first(n),i=t.buildDuplicateFoundError(e,n),a=l.getProductionDslName(r),u={message:i,type:s.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:a,occurrence:r.idx},c=d(r);return c&&(u.parameter=c),u}))}(e,r)})),c=o.map(e,(function(e){return v(e,e,r)})),h=[],f=[],y=[];a.every(c,a.isEmpty)&&(h=a.map(e,(function(e){return E(e,r)})),f=a.map(e,(function(e){return S(e,t,r)})),y=C(e,t,r));var T=function(e,t,n){var r=[],i=a.map(t,(function(e){return e.name}));return a.forEach(e,(function(e){var t=e.name;if(a.contains(i,t)){var o=n.buildNamespaceConflictError(e);r.push({message:o,type:s.ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}})),r}(e,n,r),x=a.map(e,(function(e){return O(e,r)})),b=a.map(e,(function(t){return g(t,e,i,r)}));return o.flatten(u.concat(y,c,h,f,T,x,b))},t.identifyProductionForDuplicates=p;var m=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.allProductions=[],t}return i(t,e),t.prototype.visitNonTerminal=function(e){this.allProductions.push(e)},t.prototype.visitOption=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatory=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetition=function(e){this.allProductions.push(e)},t.prototype.visitAlternation=function(e){this.allProductions.push(e)},t.prototype.visitTerminal=function(e){this.allProductions.push(e)},t}(f.GAstVisitor);function g(e,t,n,r){var i=[];if(a.reduce(t,(function(t,n){return n.name===e.name?t+1:t}),0)>1){var o=r.buildDuplicateRuleNameError({topLevelRule:e,grammarName:n});i.push({message:o,type:s.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}function v(e,t,n,r){void 0===r&&(r=[]);var i=[],a=y(t.definition);if(o.isEmpty(a))return[];var l=e.name;o.contains(a,e)&&i.push({message:n.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:r}),type:s.ParserDefinitionErrorType.LEFT_RECURSION,ruleName:l});var u=o.difference(a,r.concat([e])),c=o.map(u,(function(t){var i=o.cloneArr(r);return i.push(t),v(e,t,n,i)}));return i.concat(o.flatten(c))}function y(e){var t=[];if(o.isEmpty(e))return t;var n=o.first(e);if(n instanceof h.NonTerminal)t.push(n.referencedRule);else if(n instanceof h.Alternative||n instanceof h.Option||n instanceof h.RepetitionMandatory||n instanceof h.RepetitionMandatoryWithSeparator||n instanceof h.RepetitionWithSeparator||n instanceof h.Repetition)t=t.concat(y(n.definition));else if(n instanceof h.Alternation)t=o.flatten(o.map(n.definition,(function(e){return y(e.definition)})));else if(!(n instanceof h.Terminal))throw Error("non exhaustive match");var r=l.isOptionalProd(n),i=e.length>1;if(r&&i){var a=o.drop(e);return t.concat(y(a))}return t}t.OccurrenceValidationCollector=m,t.validateRuleDoesNotAlreadyExist=g,t.validateRuleIsOverridden=function(e,t,n){var r,i=[];return o.contains(t,e)||(r="Invalid rule override, rule: ->"+e+"<- cannot be overridden in the grammar: ->"+n+"<-as it is not defined in any of the super grammars ",i.push({message:r,type:s.ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,ruleName:e})),i},t.validateNoLeftRecursion=v,t.getFirstNoneTerminal=y;var T=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.alternations=[],t}return i(t,e),t.prototype.visitAlternation=function(e){this.alternations.push(e)},t}(f.GAstVisitor);function E(e,t){var n=new T;e.accept(n);var r=n.alternations;return o.reduce(r,(function(n,r){var i=o.dropRight(r.definition),a=o.map(i,(function(n,i){var a=c.nextPossibleTokensAfter([n],[],null,1);return o.isEmpty(a)?{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:r,emptyChoiceIdx:i}),type:s.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:r.idx,alternative:i+1}:null}));return n.concat(o.compact(a))}),[])}function S(e,t,n){var r=new T;e.accept(r);var i=r.alternations;return i=a.reject(i,(function(e){return!0===e.ignoreAmbiguities})),o.reduce(i,(function(r,i){var l=i.idx,c=i.maxLookahead||t,h=u.getLookaheadPathsForOr(l,e,c,i),f=function(e,t,n,r){var i=[],l=a.reduce(e,(function(n,r,o){return!0===t.definition[o].ignoreAmbiguities||a.forEach(r,(function(r){var s=[o];a.forEach(e,(function(e,n){o!==n&&u.containsPath(e,r)&&!0!==t.definition[n].ignoreAmbiguities&&s.push(n)})),s.length>1&&!u.containsPath(i,r)&&(i.push(r),n.push({alts:s,path:r}))})),n}),[]);return o.map(l,(function(e){var i=a.map(e.alts,(function(e){return e+1}));return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:s.ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:t.idx,alternatives:[e.alts]}}))}(h,i,e,n),p=b(h,i,e,n);return r.concat(f,p)}),[])}t.validateEmptyOrAlternative=E,t.validateAmbiguousAlternationAlternatives=S;var x=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.allProductions=[],t}return i(t,e),t.prototype.visitRepetitionWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatory=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetition=function(e){this.allProductions.push(e)},t}(f.GAstVisitor);function O(e,t){var n=new T;e.accept(n);var r=n.alternations;return o.reduce(r,(function(n,r){return r.definition.length>255&&n.push({message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:r}),type:s.ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:e.name,occurrence:r.idx}),n}),[])}function C(e,t,n){var r=[];return a.forEach(e,(function(e){var i=new x;e.accept(i);var o=i.allProductions;a.forEach(o,(function(i){var o=u.getProdType(i),l=i.maxLookahead||t,c=i.idx,h=u.getLookaheadPathsForOptionalProd(c,e,o,l)[0];if(a.isEmpty(a.flatten(h))){var f=n.buildEmptyRepetitionError({topLevelRule:e,repetition:i});r.push({message:f,type:s.ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}}))})),r}function b(e,t,n,r){var i=[],o=a.reduce(e,(function(e,t,n){var r=a.map(t,(function(e){return{idx:n,path:e}}));return e.concat(r)}),[]);return a.forEach(o,(function(e){if(!0!==t.definition[e.idx].ignoreAmbiguities){var l=e.idx,c=e.path,h=a.findAll(o,(function(e){return!0!==t.definition[e.idx].ignoreAmbiguities&&e.idx<l&&u.isStrictPrefixOfPath(e.path,c)})),f=a.map(h,(function(e){var i=[e.idx+1,l+1],o=0===t.idx?"":t.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:s.ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:o,alternatives:i}}));i=i.concat(f)}})),i}t.RepetionCollector=x,t.validateTooManyAlts=O,t.validateSomeNonEmptyLookaheadPath=C,t.checkPrefixAlternativesAmbiguities=b},825:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.firstForTerminal=t.firstForBranching=t.firstForSequence=t.first=void 0;var r=n(8877),i=n(2496),o=n(3081);function a(e){if(e instanceof i.NonTerminal)return a(e.referencedRule);if(e instanceof i.Terminal)return u(e);if(o.isSequenceProd(e))return s(e);if(o.isBranchingProd(e))return l(e);throw Error("non exhaustive match")}function s(e){for(var t,n=[],i=e.definition,s=0,l=i.length>s,u=!0;l&&u;)t=i[s],u=o.isOptionalProd(t),n=n.concat(a(t)),s+=1,l=i.length>s;return r.uniq(n)}function l(e){var t=r.map(e.definition,(function(e){return a(e)}));return r.uniq(r.flatten(t))}function u(e){return[e.terminalType]}t.first=a,t.firstForSequence=s,t.firstForBranching=l,t.firstForTerminal=u},9476:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=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])})(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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.buildInProdFollowPrefix=t.buildBetweenProdsFollowPrefix=t.computeAllProdsFollows=t.ResyncFollowsWalker=void 0;var o=n(318),a=n(825),s=n(8877),l=n(4997),u=n(2496),c=function(e){function t(t){var n=e.call(this)||this;return n.topProd=t,n.follows={},n}return i(t,e),t.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},t.prototype.walkTerminal=function(e,t,n){},t.prototype.walkProdRef=function(e,t,n){var r=h(e.referencedRule,e.idx)+this.topProd.name,i=t.concat(n),o=new u.Alternative({definition:i}),s=a.first(o);this.follows[r]=s},t}(o.RestWalker);function h(e,t){return e.name+t+l.IN}t.ResyncFollowsWalker=c,t.computeAllProdsFollows=function(e){var t={};return s.forEach(e,(function(e){var n=new c(e).startWalking();s.assign(t,n)})),t},t.buildBetweenProdsFollowPrefix=h,t.buildInProdFollowPrefix=function(e){return e.terminalType.name+e.idx+l.IN}},3081:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=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])})(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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.collectMethods=t.DslMethodsCollectorVisitor=t.getProductionDslName=t.isBranchingProd=t.isOptionalProd=t.isSequenceProd=void 0;var o=n(8877),a=n(2496),s=n(6687);t.isSequenceProd=function(e){return e instanceof a.Alternative||e instanceof a.Option||e instanceof a.Repetition||e instanceof a.RepetitionMandatory||e instanceof a.RepetitionMandatoryWithSeparator||e instanceof a.RepetitionWithSeparator||e instanceof a.Terminal||e instanceof a.Rule},t.isOptionalProd=function e(t,n){return void 0===n&&(n=[]),!!(t instanceof a.Option||t instanceof a.Repetition||t instanceof a.RepetitionWithSeparator)||(t instanceof a.Alternation?o.some(t.definition,(function(t){return e(t,n)})):!(t instanceof a.NonTerminal&&o.contains(n,t))&&(t instanceof a.AbstractProduction&&(t instanceof a.NonTerminal&&n.push(t),o.every(t.definition,(function(t){return e(t,n)})))))},t.isBranchingProd=function(e){return e instanceof a.Alternation},t.getProductionDslName=function(e){if(e instanceof a.NonTerminal)return"SUBRULE";if(e instanceof a.Option)return"OPTION";if(e instanceof a.Alternation)return"OR";if(e instanceof a.RepetitionMandatory)return"AT_LEAST_ONE";if(e instanceof a.RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(e instanceof a.RepetitionWithSeparator)return"MANY_SEP";if(e instanceof a.Repetition)return"MANY";if(e instanceof a.Terminal)return"CONSUME";throw Error("non exhaustive match")};var l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.separator="-",t.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},t}return i(t,e),t.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},t.prototype.visitTerminal=function(e){var t=e.terminalType.name+this.separator+"Terminal";o.has(this.dslMethods,t)||(this.dslMethods[t]=[]),this.dslMethods[t].push(e)},t.prototype.visitNonTerminal=function(e){var t=e.nonTerminalName+this.separator+"Terminal";o.has(this.dslMethods,t)||(this.dslMethods[t]=[]),this.dslMethods[t].push(e)},t.prototype.visitOption=function(e){this.dslMethods.option.push(e)},t.prototype.visitRepetitionWithSeparator=function(e){this.dslMethods.repetitionWithSeparator.push(e)},t.prototype.visitRepetitionMandatory=function(e){this.dslMethods.repetitionMandatory.push(e)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)},t.prototype.visitRepetition=function(e){this.dslMethods.repetition.push(e)},t.prototype.visitAlternation=function(e){this.dslMethods.alternation.push(e)},t}(s.GAstVisitor);t.DslMethodsCollectorVisitor=l;var u=new l;t.collectMethods=function(e){u.reset(),e.accept(u);var t=u.dslMethods;return u.reset(),t}},2496:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=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])})(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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.serializeProduction=t.serializeGrammar=t.Terminal=t.Alternation=t.RepetitionWithSeparator=t.Repetition=t.RepetitionMandatoryWithSeparator=t.RepetitionMandatory=t.Option=t.Alternative=t.Rule=t.NonTerminal=t.AbstractProduction=void 0;var o=n(8877),a=n(8980),s=function(){function e(e){this._definition=e}return Object.defineProperty(e.prototype,"definition",{get:function(){return this._definition},set:function(e){this._definition=e},enumerable:!1,configurable:!0}),e.prototype.accept=function(e){e.visit(this),o.forEach(this.definition,(function(t){t.accept(e)}))},e}();t.AbstractProduction=s;var l=function(e){function t(t){var n=e.call(this,[])||this;return n.idx=1,o.assign(n,o.pick(t,(function(e){return void 0!==e}))),n}return i(t,e),Object.defineProperty(t.prototype,"definition",{get:function(){return void 0!==this.referencedRule?this.referencedRule.definition:[]},set:function(e){},enumerable:!1,configurable:!0}),t.prototype.accept=function(e){e.visit(this)},t}(s);t.NonTerminal=l;var u=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.orgText="",o.assign(n,o.pick(t,(function(e){return void 0!==e}))),n}return i(t,e),t}(s);t.Rule=u;var c=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.ignoreAmbiguities=!1,o.assign(n,o.pick(t,(function(e){return void 0!==e}))),n}return i(t,e),t}(s);t.Alternative=c;var h=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,o.assign(n,o.pick(t,(function(e){return void 0!==e}))),n}return i(t,e),t}(s);t.Option=h;var f=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,o.assign(n,o.pick(t,(function(e){return void 0!==e}))),n}return i(t,e),t}(s);t.RepetitionMandatory=f;var p=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,o.assign(n,o.pick(t,(function(e){return void 0!==e}))),n}return i(t,e),t}(s);t.RepetitionMandatoryWithSeparator=p;var d=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,o.assign(n,o.pick(t,(function(e){return void 0!==e}))),n}return i(t,e),t}(s);t.Repetition=d;var m=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,o.assign(n,o.pick(t,(function(e){return void 0!==e}))),n}return i(t,e),t}(s);t.RepetitionWithSeparator=m;var g=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,n.ignoreAmbiguities=!1,n.hasPredicates=!1,o.assign(n,o.pick(t,(function(e){return void 0!==e}))),n}return i(t,e),Object.defineProperty(t.prototype,"definition",{get:function(){return this._definition},set:function(e){this._definition=e},enumerable:!1,configurable:!0}),t}(s);t.Alternation=g;var v=function(){function e(e){this.idx=1,o.assign(this,o.pick(e,(function(e){return void 0!==e})))}return e.prototype.accept=function(e){e.visit(this)},e}();function y(e){function t(e){return o.map(e,y)}if(e instanceof l){var n={type:"NonTerminal",name:e.nonTerminalName,idx:e.idx};return o.isString(e.label)&&(n.label=e.label),n}if(e instanceof c)return{type:"Alternative",definition:t(e.definition)};if(e instanceof h)return{type:"Option",idx:e.idx,definition:t(e.definition)};if(e instanceof f)return{type:"RepetitionMandatory",idx:e.idx,definition:t(e.definition)};if(e instanceof p)return{type:"RepetitionMandatoryWithSeparator",idx:e.idx,separator:y(new v({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof m)return{type:"RepetitionWithSeparator",idx:e.idx,separator:y(new v({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof d)return{type:"Repetition",idx:e.idx,definition:t(e.definition)};if(e instanceof g)return{type:"Alternation",idx:e.idx,definition:t(e.definition)};if(e instanceof v){var r={type:"Terminal",name:e.terminalType.name,label:a.tokenLabel(e.terminalType),idx:e.idx};o.isString(e.label)&&(r.terminalLabel=e.label);var i=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(r.pattern=o.isRegExp(i)?i.source:i),r}if(e instanceof u)return{type:"Rule",name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error("non exhaustive match")}t.Terminal=v,t.serializeGrammar=function(e){return o.map(e,y)},t.serializeProduction=y},5143:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateGrammar=t.resolveGrammar=void 0;var r=n(8877),i=n(6671),o=n(4046),a=n(7621);t.resolveGrammar=function(e){e=r.defaults(e,{errMsgProvider:a.defaultGrammarResolverErrorProvider});var t={};return r.forEach(e.rules,(function(e){t[e.name]=e})),i.resolveGrammar(t,e.errMsgProvider)},t.validateGrammar=function(e){return e=r.defaults(e,{errMsgProvider:a.defaultGrammarValidatorErrorProvider}),o.validateGrammar(e.rules,e.maxLookahead,e.tokenTypes,e.errMsgProvider,e.grammarName)}},6687:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GAstVisitor=void 0;var r=n(2496),i=function(){function e(){}return e.prototype.visit=function(e){var t=e;switch(t.constructor){case r.NonTerminal:return this.visitNonTerminal(t);case r.Alternative:return this.visitAlternative(t);case r.Option:return this.visitOption(t);case r.RepetitionMandatory:return this.visitRepetitionMandatory(t);case r.RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(t);case r.RepetitionWithSeparator:return this.visitRepetitionWithSeparator(t);case r.Repetition:return this.visitRepetition(t);case r.Alternation:return this.visitAlternation(t);case r.Terminal:return this.visitTerminal(t);case r.Rule:return this.visitRule(t);default:throw Error("non exhaustive match")}},e.prototype.visitNonTerminal=function(e){},e.prototype.visitAlternative=function(e){},e.prototype.visitOption=function(e){},e.prototype.visitRepetition=function(e){},e.prototype.visitRepetitionMandatory=function(e){},e.prototype.visitRepetitionMandatoryWithSeparator=function(e){},e.prototype.visitRepetitionWithSeparator=function(e){},e.prototype.visitAlternation=function(e){},e.prototype.visitTerminal=function(e){},e.prototype.visitRule=function(e){},e}();t.GAstVisitor=i},6331:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=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])})(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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.nextPossibleTokensAfter=t.possiblePathsFrom=t.NextTerminalAfterAtLeastOneSepWalker=t.NextTerminalAfterAtLeastOneWalker=t.NextTerminalAfterManySepWalker=t.NextTerminalAfterManyWalker=t.AbstractNextTerminalAfterProductionWalker=t.NextAfterTokenWalker=t.AbstractNextPossibleTokensWalker=void 0;var o=n(318),a=n(8877),s=n(825),l=n(2496),u=function(e){function t(t,n){var r=e.call(this)||this;return r.topProd=t,r.path=n,r.possibleTokTypes=[],r.nextProductionName="",r.nextProductionOccurrence=0,r.found=!1,r.isAtEndOfPath=!1,r}return i(t,e),t.prototype.startWalking=function(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=a.cloneArr(this.path.ruleStack).reverse(),this.occurrenceStack=a.cloneArr(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes},t.prototype.walk=function(t,n){void 0===n&&(n=[]),this.found||e.prototype.walk.call(this,t,n)},t.prototype.walkProdRef=function(e,t,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){var r=t.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,r)}},t.prototype.updateExpectedNext=function(){a.isEmpty(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},t}(o.RestWalker);t.AbstractNextPossibleTokensWalker=u;var c=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.path=n,r.nextTerminalName="",r.nextTerminalOccurrence=0,r.nextTerminalName=r.path.lastTok.name,r.nextTerminalOccurrence=r.path.lastTokOccurrence,r}return i(t,e),t.prototype.walkTerminal=function(e,t,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){var r=t.concat(n),i=new l.Alternative({definition:r});this.possibleTokTypes=s.first(i),this.found=!0}},t}(u);t.NextAfterTokenWalker=c;var h=function(e){function t(t,n){var r=e.call(this)||this;return r.topRule=t,r.occurrence=n,r.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},r}return i(t,e),t.prototype.startWalking=function(){return this.walk(this.topRule),this.result},t}(o.RestWalker);t.AbstractNextTerminalAfterProductionWalker=h;var f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.walkMany=function(t,n,r){if(t.idx===this.occurrence){var i=a.first(n.concat(r));this.result.isEndOfRule=void 0===i,i instanceof l.Terminal&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else e.prototype.walkMany.call(this,t,n,r)},t}(h);t.NextTerminalAfterManyWalker=f;var p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.walkManySep=function(t,n,r){if(t.idx===this.occurrence){var i=a.first(n.concat(r));this.result.isEndOfRule=void 0===i,i instanceof l.Terminal&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else e.prototype.walkManySep.call(this,t,n,r)},t}(h);t.NextTerminalAfterManySepWalker=p;var d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.walkAtLeastOne=function(t,n,r){if(t.idx===this.occurrence){var i=a.first(n.concat(r));this.result.isEndOfRule=void 0===i,i instanceof l.Terminal&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else e.prototype.walkAtLeastOne.call(this,t,n,r)},t}(h);t.NextTerminalAfterAtLeastOneWalker=d;var m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.walkAtLeastOneSep=function(t,n,r){if(t.idx===this.occurrence){var i=a.first(n.concat(r));this.result.isEndOfRule=void 0===i,i instanceof l.Terminal&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else e.prototype.walkAtLeastOneSep.call(this,t,n,r)},t}(h);function g(e,t,n,r){var i=a.cloneArr(n);i.push(e.name);var o=a.cloneArr(r);return o.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:o}}t.NextTerminalAfterAtLeastOneSepWalker=m,t.possiblePathsFrom=function e(t,n,r){void 0===r&&(r=[]),r=a.cloneArr(r);var i=[],o=0;function s(s){var l=e(s.concat(a.drop(t,o+1)),n,r);return i.concat(l)}for(;r.length<n&&o<t.length;){var u=t[o];if(u instanceof l.Alternative)return s(u.definition);if(u instanceof l.NonTerminal)return s(u.definition);if(u instanceof l.Option)i=s(u.definition);else{if(u instanceof l.RepetitionMandatory)return s(c=u.definition.concat([new l.Repetition({definition:u.definition})]));if(u instanceof l.RepetitionMandatoryWithSeparator)return s(c=[new l.Alternative({definition:u.definition}),new l.Repetition({definition:[new l.Terminal({terminalType:u.separator})].concat(u.definition)})]);if(u instanceof l.RepetitionWithSeparator){var c=u.definition.concat([new l.Repetition({definition:[new l.Terminal({terminalType:u.separator})].concat(u.definition)})]);i=s(c)}else if(u instanceof l.Repetition){c=u.definition.concat([new l.Repetition({definition:u.definition})]);i=s(c)}else{if(u instanceof l.Alternation)return a.forEach(u.definition,(function(e){!1===a.isEmpty(e.definition)&&(i=s(e.definition))})),i;if(!(u instanceof l.Terminal))throw Error("non exhaustive match");r.push(u.terminalType)}}o++}return i.push({partialPath:r,suffixDef:a.drop(t,o)}),i},t.nextPossibleTokensAfter=function(e,t,n,r){var i="EXIT_NONE_TERMINAL",o=[i],s="EXIT_ALTERNATIVE",u=!1,c=t.length,h=c-r-1,f=[],p=[];for(p.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});!a.isEmpty(p);){var d=p.pop();if(d!==s){var m=d.def,v=d.idx,y=d.ruleStack,T=d.occurrenceStack;if(!a.isEmpty(m)){var E=m[0];if(E===i){var S={idx:v,def:a.drop(m),ruleStack:a.dropRight(y),occurrenceStack:a.dropRight(T)};p.push(S)}else if(E instanceof l.Terminal)if(v<c-1){var x=v+1;if(n(t[x],E.terminalType)){S={idx:x,def:a.drop(m),ruleStack:y,occurrenceStack:T};p.push(S)}}else{if(v!==c-1)throw Error("non exhaustive match");f.push({nextTokenType:E.terminalType,nextTokenOccurrence:E.idx,ruleStack:y,occurrenceStack:T}),u=!0}else if(E instanceof l.NonTerminal){var O=a.cloneArr(y);O.push(E.nonTerminalName);var C=a.cloneArr(T);C.push(E.idx);S={idx:v,def:E.definition.concat(o,a.drop(m)),ruleStack:O,occurrenceStack:C};p.push(S)}else if(E instanceof l.Option){var b={idx:v,def:a.drop(m),ruleStack:y,occurrenceStack:T};p.push(b),p.push(s);var k={idx:v,def:E.definition.concat(a.drop(m)),ruleStack:y,occurrenceStack:T};p.push(k)}else if(E instanceof l.RepetitionMandatory){var N=new l.Repetition({definition:E.definition,idx:E.idx});S={idx:v,def:E.definition.concat([N],a.drop(m)),ruleStack:y,occurrenceStack:T};p.push(S)}else if(E instanceof l.RepetitionMandatoryWithSeparator){var L=new l.Terminal({terminalType:E.separator});N=new l.Repetition({definition:[L].concat(E.definition),idx:E.idx}),S={idx:v,def:E.definition.concat([N],a.drop(m)),ruleStack:y,occurrenceStack:T};p.push(S)}else if(E instanceof l.RepetitionWithSeparator){b={idx:v,def:a.drop(m),ruleStack:y,occurrenceStack:T};p.push(b),p.push(s);L=new l.Terminal({terminalType:E.separator});var A=new l.Repetition({definition:[L].concat(E.definition),idx:E.idx});k={idx:v,def:E.definition.concat([A],a.drop(m)),ruleStack:y,occurrenceStack:T};p.push(k)}else if(E instanceof l.Repetition){b={idx:v,def:a.drop(m),ruleStack:y,occurrenceStack:T};p.push(b),p.push(s);A=new l.Repetition({definition:E.definition,idx:E.idx}),k={idx:v,def:E.definition.concat([A],a.drop(m)),ruleStack:y,occurrenceStack:T};p.push(k)}else if(E instanceof l.Alternation)for(var R=E.definition.length-1;R>=0;R--){var w={idx:v,def:E.definition[R].definition.concat(a.drop(m)),ruleStack:y,occurrenceStack:T};p.push(w),p.push(s)}else if(E instanceof l.Alternative)p.push({idx:v,def:E.definition.concat(a.drop(m)),ruleStack:y,occurrenceStack:T});else{if(!(E instanceof l.Rule))throw Error("non exhaustive match");p.push(g(E,v,y,T))}}}else u&&a.last(p).idx<=h&&p.pop()}return f}},8567:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getKeyForAutomaticLookahead=t.AT_LEAST_ONE_SEP_IDX=t.MANY_SEP_IDX=t.AT_LEAST_ONE_IDX=t.MANY_IDX=t.OPTION_IDX=t.OR_IDX=t.BITS_FOR_ALT_IDX=t.BITS_FOR_RULE_IDX=t.BITS_FOR_OCCURRENCE_IDX=t.BITS_FOR_METHOD_TYPE=void 0,t.BITS_FOR_METHOD_TYPE=4,t.BITS_FOR_OCCURRENCE_IDX=8,t.BITS_FOR_RULE_IDX=12,t.BITS_FOR_ALT_IDX=8,t.OR_IDX=1<<t.BITS_FOR_OCCURRENCE_IDX,t.OPTION_IDX=2<<t.BITS_FOR_OCCURRENCE_IDX,t.MANY_IDX=3<<t.BITS_FOR_OCCURRENCE_IDX,t.AT_LEAST_ONE_IDX=4<<t.BITS_FOR_OCCURRENCE_IDX,t.MANY_SEP_IDX=5<<t.BITS_FOR_OCCURRENCE_IDX,t.AT_LEAST_ONE_SEP_IDX=6<<t.BITS_FOR_OCCURRENCE_IDX,t.getKeyForAutomaticLookahead=function(e,t,n){return n|t|e};t.BITS_FOR_ALT_IDX},3670:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=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])})(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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.areTokenCategoriesNotUsed=t.isStrictPrefixOfPath=t.containsPath=t.getLookaheadPathsForOptionalProd=t.getLookaheadPathsForOr=t.lookAheadSequenceFromAlternatives=t.buildSingleAlternativeLookaheadFunction=t.buildAlternativesLookAheadFunc=t.buildLookaheadFuncForOptionalProd=t.buildLookaheadFuncForOr=t.getProdType=t.PROD_TYPE=void 0;var o,a=n(8877),s=n(6331),l=n(318),u=n(6570),c=n(2496),h=n(6687);!function(e){e[e.OPTION=0]="OPTION",e[e.REPETITION=1]="REPETITION",e[e.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",e[e.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",e[e.ALTERNATION=5]="ALTERNATION"}(o=t.PROD_TYPE||(t.PROD_TYPE={})),t.getProdType=function(e){if(e instanceof c.Option)return o.OPTION;if(e instanceof c.Repetition)return o.REPETITION;if(e instanceof c.RepetitionMandatory)return o.REPETITION_MANDATORY;if(e instanceof c.RepetitionMandatoryWithSeparator)return o.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof c.RepetitionWithSeparator)return o.REPETITION_WITH_SEPARATOR;if(e instanceof c.Alternation)return o.ALTERNATION;throw Error("non exhaustive match")},t.buildLookaheadFuncForOr=function(e,t,n,r,i,o){var a=y(e,t,n);return o(a,r,S(a)?u.tokenStructuredMatcherNoCategories:u.tokenStructuredMatcher,i)},t.buildLookaheadFuncForOptionalProd=function(e,t,n,r,i,o){var a=T(e,t,i,n),s=S(a)?u.tokenStructuredMatcherNoCategories:u.tokenStructuredMatcher;return o(a[0],s,r)},t.buildAlternativesLookAheadFunc=function(e,t,n,r){var i=e.length,o=a.every(e,(function(e){return a.every(e,(function(e){return 1===e.length}))}));if(t)return function(t){for(var r=a.map(t,(function(e){return e.GATE})),o=0;o<i;o++){var s=e[o],l=s.length,u=r[o];if(void 0===u||!1!==u.call(this))e:for(var c=0;c<l;c++){for(var h=s[c],f=h.length,p=0;p<f;p++){var d=this.LA(p+1);if(!1===n(d,h[p]))continue e}return o}}};if(o&&!r){var s=a.map(e,(function(e){return a.flatten(e)})),l=a.reduce(s,(function(e,t,n){return a.forEach(t,(function(t){a.has(e,t.tokenTypeIdx)||(e[t.tokenTypeIdx]=n),a.forEach(t.categoryMatches,(function(t){a.has(e,t)||(e[t]=n)}))})),e}),[]);return function(){var e=this.LA(1);return l[e.tokenTypeIdx]}}return function(){for(var t=0;t<i;t++){var r=e[t],o=r.length;e:for(var a=0;a<o;a++){for(var s=r[a],l=s.length,u=0;u<l;u++){var c=this.LA(u+1);if(!1===n(c,s[u]))continue e}return t}}}},t.buildSingleAlternativeLookaheadFunction=function(e,t,n){var r=a.every(e,(function(e){return 1===e.length})),i=e.length;if(r&&!n){var o=a.flatten(e);if(1===o.length&&a.isEmpty(o[0].categoryMatches)){var s=o[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===s}}var l=a.reduce(o,(function(e,t,n){return e[t.tokenTypeIdx]=!0,a.forEach(t.categoryMatches,(function(t){e[t]=!0})),e}),[]);return function(){var e=this.LA(1);return!0===l[e.tokenTypeIdx]}}return function(){e:for(var n=0;n<i;n++){for(var r=e[n],o=r.length,a=0;a<o;a++){var s=this.LA(a+1);if(!1===t(s,r[a]))continue e}return!0}return!1}};var f=function(e){function t(t,n,r){var i=e.call(this)||this;return i.topProd=t,i.targetOccurrence=n,i.targetProdType=r,i}return i(t,e),t.prototype.startWalking=function(){return this.walk(this.topProd),this.restDef},t.prototype.checkIsTarget=function(e,t,n,r){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=n.concat(r),!0)},t.prototype.walkOption=function(t,n,r){this.checkIsTarget(t,o.OPTION,n,r)||e.prototype.walkOption.call(this,t,n,r)},t.prototype.walkAtLeastOne=function(t,n,r){this.checkIsTarget(t,o.REPETITION_MANDATORY,n,r)||e.prototype.walkOption.call(this,t,n,r)},t.prototype.walkAtLeastOneSep=function(t,n,r){this.checkIsTarget(t,o.REPETITION_MANDATORY_WITH_SEPARATOR,n,r)||e.prototype.walkOption.call(this,t,n,r)},t.prototype.walkMany=function(t,n,r){this.checkIsTarget(t,o.REPETITION,n,r)||e.prototype.walkOption.call(this,t,n,r)},t.prototype.walkManySep=function(t,n,r){this.checkIsTarget(t,o.REPETITION_WITH_SEPARATOR,n,r)||e.prototype.walkOption.call(this,t,n,r)},t}(l.RestWalker),p=function(e){function t(t,n,r){var i=e.call(this)||this;return i.targetOccurrence=t,i.targetProdType=n,i.targetRef=r,i.result=[],i}return i(t,e),t.prototype.checkIsTarget=function(e,t){e.idx!==this.targetOccurrence||this.targetProdType!==t||void 0!==this.targetRef&&e!==this.targetRef||(this.result=e.definition)},t.prototype.visitOption=function(e){this.checkIsTarget(e,o.OPTION)},t.prototype.visitRepetition=function(e){this.checkIsTarget(e,o.REPETITION)},t.prototype.visitRepetitionMandatory=function(e){this.checkIsTarget(e,o.REPETITION_MANDATORY)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.checkIsTarget(e,o.REPETITION_MANDATORY_WITH_SEPARATOR)},t.prototype.visitRepetitionWithSeparator=function(e){this.checkIsTarget(e,o.REPETITION_WITH_SEPARATOR)},t.prototype.visitAlternation=function(e){this.checkIsTarget(e,o.ALTERNATION)},t}(h.GAstVisitor);function d(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=[];return t}function m(e){for(var t=[""],n=0;n<e.length;n++){for(var r=e[n],i=[],o=0;o<t.length;o++){var a=t[o];i.push(a+"_"+r.tokenTypeIdx);for(var s=0;s<r.categoryMatches.length;s++){var l="_"+r.categoryMatches[s];i.push(a+l)}}t=i}return t}function g(e,t,n){for(var r=0;r<e.length;r++)if(r!==n)for(var i=e[r],o=0;o<t.length;o++){if(!0===i[t[o]])return!1}return!0}function v(e,t){for(var n=a.map(e,(function(e){return s.possiblePathsFrom([e],1)})),r=d(n.length),i=a.map(n,(function(e){var t={};return a.forEach(e,(function(e){var n=m(e.partialPath);a.forEach(n,(function(e){t[e]=!0}))})),t})),o=n,l=1;l<=t;l++){var u=o;o=d(u.length);for(var c=function(e){for(var n=u[e],c=0;c<n.length;c++){var h=n[c].partialPath,f=n[c].suffixDef,p=m(h);if(g(i,p,e)||a.isEmpty(f)||h.length===t){var d=r[e];if(!1===E(d,h)){d.push(h);for(var v=0;v<p.length;v++){var y=p[v];i[e][y]=!0}}}else{var T=s.possiblePathsFrom(f,l+1,h);o[e]=o[e].concat(T),a.forEach(T,(function(t){var n=m(t.partialPath);a.forEach(n,(function(t){i[e][t]=!0}))}))}}},h=0;h<u.length;h++)c(h)}return r}function y(e,t,n,r){var i=new p(e,o.ALTERNATION,r);return t.accept(i),v(i.result,n)}function T(e,t,n,r){var i=new p(e,n);t.accept(i);var o=i.result,a=new f(t,e,n).startWalking();return v([new c.Alternative({definition:o}),new c.Alternative({definition:a})],r)}function E(e,t){e:for(var n=0;n<e.length;n++){var r=e[n];if(r.length===t.length){for(var i=0;i<r.length;i++){var o=t[i],a=r[i];if(!1===(o===a||void 0!==a.categoryMatchesMap[o.tokenTypeIdx]))continue e}return!0}}return!1}function S(e){return a.every(e,(function(e){return a.every(e,(function(e){return a.every(e,(function(e){return a.isEmpty(e.categoryMatches)}))}))}))}t.lookAheadSequenceFromAlternatives=v,t.getLookaheadPathsForOr=y,t.getLookaheadPathsForOptionalProd=T,t.containsPath=E,t.isStrictPrefixOfPath=function(e,t){return e.length<t.length&&a.every(e,(function(e,n){var r=t[n];return e===r||r.categoryMatchesMap[e.tokenTypeIdx]}))},t.areTokenCategoriesNotUsed=S},6671:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=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])})(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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.GastRefResolverVisitor=t.resolveGrammar=void 0;var o=n(1183),a=n(8877),s=n(6687);t.resolveGrammar=function(e,t){var n=new l(e,t);return n.resolveRefs(),n.errors};var l=function(e){function t(t,n){var r=e.call(this)||this;return r.nameToTopRule=t,r.errMsgProvider=n,r.errors=[],r}return i(t,e),t.prototype.resolveRefs=function(){var e=this;a.forEach(a.values(this.nameToTopRule),(function(t){e.currTopLevel=t,t.accept(e)}))},t.prototype.visitNonTerminal=function(e){var t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{var n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:o.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}},t}(s.GAstVisitor);t.GastRefResolverVisitor=l},318:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RestWalker=void 0;var r=n(8877),i=n(2496),o=function(){function e(){}return e.prototype.walk=function(e,t){var n=this;void 0===t&&(t=[]),r.forEach(e.definition,(function(o,a){var s=r.drop(e.definition,a+1);if(o instanceof i.NonTerminal)n.walkProdRef(o,s,t);else if(o instanceof i.Terminal)n.walkTerminal(o,s,t);else if(o instanceof i.Alternative)n.walkFlat(o,s,t);else if(o instanceof i.Option)n.walkOption(o,s,t);else if(o instanceof i.RepetitionMandatory)n.walkAtLeastOne(o,s,t);else if(o instanceof i.RepetitionMandatoryWithSeparator)n.walkAtLeastOneSep(o,s,t);else if(o instanceof i.RepetitionWithSeparator)n.walkManySep(o,s,t);else if(o instanceof i.Repetition)n.walkMany(o,s,t);else{if(!(o instanceof i.Alternation))throw Error("non exhaustive match");n.walkOr(o,s,t)}}))},e.prototype.walkTerminal=function(e,t,n){},e.prototype.walkProdRef=function(e,t,n){},e.prototype.walkFlat=function(e,t,n){var r=t.concat(n);this.walk(e,r)},e.prototype.walkOption=function(e,t,n){var r=t.concat(n);this.walk(e,r)},e.prototype.walkAtLeastOne=function(e,t,n){var r=[new i.Option({definition:e.definition})].concat(t,n);this.walk(e,r)},e.prototype.walkAtLeastOneSep=function(e,t,n){var r=a(e,t,n);this.walk(e,r)},e.prototype.walkMany=function(e,t,n){var r=[new i.Option({definition:e.definition})].concat(t,n);this.walk(e,r)},e.prototype.walkManySep=function(e,t,n){var r=a(e,t,n);this.walk(e,r)},e.prototype.walkOr=function(e,t,n){var o=this,a=t.concat(n);r.forEach(e.definition,(function(e){var t=new i.Alternative({definition:[e]});o.walk(t,a)}))},e}();function a(e,t,n){return[new i.Option({definition:[new i.Terminal({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}t.RestWalker=o},1183:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=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])})(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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.EmbeddedActionsParser=t.CstParser=t.Parser=t.EMPTY_ALT=t.ParserDefinitionErrorType=t.DEFAULT_RULE_CONFIG=t.DEFAULT_PARSER_CONFIG=t.END_OF_FILE=void 0;var o=n(8877),a=n(9476),s=n(8980),l=n(7621),u=n(5143),c=n(5786),h=n(4421),f=n(943),p=n(1540),d=n(951),m=n(2691),g=n(8205),v=n(3701),y=n(3398),T=n(6427),E=n(4989);t.END_OF_FILE=s.createTokenInstance(s.EOF,"",NaN,NaN,NaN,NaN,NaN,NaN),Object.freeze(t.END_OF_FILE),t.DEFAULT_PARSER_CONFIG=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:l.defaultParserErrorProvider,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),t.DEFAULT_RULE_CONFIG=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0}),function(e){e[e.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",e[e.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",e[e.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",e[e.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",e[e.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",e[e.LEFT_RECURSION=5]="LEFT_RECURSION",e[e.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",e[e.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",e[e.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",e[e.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",e[e.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",e[e.TOO_MANY_ALTS=12]="TOO_MANY_ALTS"}(t.ParserDefinitionErrorType||(t.ParserDefinitionErrorType={})),t.EMPTY_ALT=function(e){return void 0===e&&(e=void 0),function(){return e}};var S=function(){function e(e,n){this.definitionErrors=[],this.selfAnalysisDone=!1;var r=this;if(r.initErrorHandler(n),r.initLexerAdapter(),r.initLooksAhead(n),r.initRecognizerEngine(e,n),r.initRecoverable(n),r.initTreeBuilder(n),r.initContentAssist(),r.initGastRecorder(n),r.initPerformanceTracer(n),o.has(n,"ignoredIssues"))throw new Error("The <ignoredIssues> IParserConfig property has been deprecated.\n\tPlease use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.\n\tSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\n\tFor further details.");this.skipValidations=o.has(n,"skipValidations")?n.skipValidations:t.DEFAULT_PARSER_CONFIG.skipValidations}return e.performSelfAnalysis=function(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated.\t\nUse the **instance** method with the same name instead.")},e.prototype.performSelfAnalysis=function(){var t=this;this.TRACE_INIT("performSelfAnalysis",(function(){var n;t.selfAnalysisDone=!0;var r=t.className;t.TRACE_INIT("toFastProps",(function(){o.toFastProperties(t)})),t.TRACE_INIT("Grammar Recording",(function(){try{t.enableRecording(),o.forEach(t.definedRulesNames,(function(e){var n=t[e].originalGrammarAction,r=void 0;t.TRACE_INIT(e+" Rule",(function(){r=t.topLevelRuleRecord(e,n)})),t.gastProductionsCache[e]=r}))}finally{t.disableRecording()}}));var i=[];if(t.TRACE_INIT("Grammar Resolving",(function(){i=u.resolveGrammar({rules:o.values(t.gastProductionsCache)}),t.definitionErrors=t.definitionErrors.concat(i)})),t.TRACE_INIT("Grammar Validations",(function(){if(o.isEmpty(i)&&!1===t.skipValidations){var e=u.validateGrammar({rules:o.values(t.gastProductionsCache),maxLookahead:t.maxLookahead,tokenTypes:o.values(t.tokensMap),errMsgProvider:l.defaultGrammarValidatorErrorProvider,grammarName:r});t.definitionErrors=t.definitionErrors.concat(e)}})),o.isEmpty(t.definitionErrors)&&(t.recoveryEnabled&&t.TRACE_INIT("computeAllProdsFollows",(function(){var e=a.computeAllProdsFollows(o.values(t.gastProductionsCache));t.resyncFollows=e})),t.TRACE_INIT("ComputeLookaheadFunctions",(function(){t.preComputeLookaheadFunctions(o.values(t.gastProductionsCache))}))),!e.DEFER_DEFINITION_ERRORS_HANDLING&&!o.isEmpty(t.definitionErrors))throw n=o.map(t.definitionErrors,(function(e){return e.message})),new Error("Parser Definition Errors detected:\n "+n.join("\n-------------------------------\n"))}))},e.DEFER_DEFINITION_ERRORS_HANDLING=!1,e}();t.Parser=S,E.applyMixins(S,[c.Recoverable,h.LooksAhead,f.TreeBuilder,p.LexerAdapter,m.RecognizerEngine,d.RecognizerApi,g.ErrorHandler,v.ContentAssist,y.GastRecorder,T.PerformanceTracer]);var x=function(e){function n(n,r){void 0===r&&(r=t.DEFAULT_PARSER_CONFIG);var i=o.cloneObj(r);return i.outputCst=!0,e.call(this,n,i)||this}return i(n,e),n}(S);t.CstParser=x;var O=function(e){function n(n,r){void 0===r&&(r=t.DEFAULT_PARSER_CONFIG);var i=o.cloneObj(r);return i.outputCst=!1,e.call(this,n,i)||this}return i(n,e),n}(S);t.EmbeddedActionsParser=O},3701:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContentAssist=void 0;var r=n(6331),i=n(8877),o=function(){function e(){}return e.prototype.initContentAssist=function(){},e.prototype.computeContentAssist=function(e,t){var n=this.gastProductionsCache[e];if(i.isUndefined(n))throw Error("Rule ->"+e+"<- does not exist in this grammar.");return r.nextPossibleTokensAfter([n],t,this.tokenMatcher,this.maxLookahead)},e.prototype.getNextPossibleTokenTypes=function(e){var t=i.first(e.ruleStack),n=this.getGAstProductions()[t];return new r.NextAfterTokenWalker(n,e).startWalking()},e}();t.ContentAssist=o},8205:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorHandler=void 0;var r=n(4400),i=n(8877),o=n(3670),a=n(1183),s=function(){function e(){}return e.prototype.initErrorHandler=function(e){this._errors=[],this.errorMessageProvider=i.has(e,"errorMessageProvider")?e.errorMessageProvider:a.DEFAULT_PARSER_CONFIG.errorMessageProvider},e.prototype.SAVE_ERROR=function(e){if(r.isRecognitionException(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:i.cloneArr(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(e.prototype,"errors",{get:function(){return i.cloneArr(this._errors)},set:function(e){this._errors=e},enumerable:!1,configurable:!0}),e.prototype.raiseEarlyExitException=function(e,t,n){for(var i=this.getCurrRuleFullName(),a=this.getGAstProductions()[i],s=o.getLookaheadPathsForOptionalProd(e,a,t,this.maxLookahead)[0],l=[],u=1;u<=this.maxLookahead;u++)l.push(this.LA(u));var c=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:s,actual:l,previous:this.LA(0),customUserDescription:n,ruleName:i});throw this.SAVE_ERROR(new r.EarlyExitException(c,this.LA(1),this.LA(0)))},e.prototype.raiseNoAltException=function(e,t){for(var n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],a=o.getLookaheadPathsForOr(e,i,this.maxLookahead),s=[],l=1;l<=this.maxLookahead;l++)s.push(this.LA(l));var u=this.LA(0),c=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:a,actual:s,previous:u,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new r.NoViableAltException(c,this.LA(1),u))},e}();t.ErrorHandler=s},3398:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GastRecorder=void 0;var r=n(8877),i=n(2496),o=n(8200),a=n(6570),s=n(8980),l=n(1183),u=n(8567),c={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(c);var h=Math.pow(2,u.BITS_FOR_OCCURRENCE_IDX)-1,f=s.createToken({name:"RECORDING_PHASE_TOKEN",pattern:o.Lexer.NA});a.augmentTokenTypes([f]);var p=s.createTokenInstance(f,"This IToken indicates the Parser is in Recording Phase\n\tSee: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",-1,-1,-1,-1,-1,-1);Object.freeze(p);var d={name:"This CSTNode indicates the Parser is in Recording Phase\n\tSee: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",children:{}},m=function(){function e(){}return e.prototype.initGastRecorder=function(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1},e.prototype.enableRecording=function(){var e=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",(function(){for(var t=function(t){var n=t>0?t:"";e["CONSUME"+n]=function(e,n){return this.consumeInternalRecord(e,t,n)},e["SUBRULE"+n]=function(e,n){return this.subruleInternalRecord(e,t,n)},e["OPTION"+n]=function(e){return this.optionInternalRecord(e,t)},e["OR"+n]=function(e){return this.orInternalRecord(e,t)},e["MANY"+n]=function(e){this.manyInternalRecord(t,e)},e["MANY_SEP"+n]=function(e){this.manySepFirstInternalRecord(t,e)},e["AT_LEAST_ONE"+n]=function(e){this.atLeastOneInternalRecord(t,e)},e["AT_LEAST_ONE_SEP"+n]=function(e){this.atLeastOneSepFirstInternalRecord(t,e)}},n=0;n<10;n++)t(n);e.consume=function(e,t,n){return this.consumeInternalRecord(t,e,n)},e.subrule=function(e,t,n){return this.subruleInternalRecord(t,e,n)},e.option=function(e,t){return this.optionInternalRecord(t,e)},e.or=function(e,t){return this.orInternalRecord(t,e)},e.many=function(e,t){this.manyInternalRecord(e,t)},e.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},e.ACTION=e.ACTION_RECORD,e.BACKTRACK=e.BACKTRACK_RECORD,e.LA=e.LA_RECORD}))},e.prototype.disableRecording=function(){var e=this;this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",(function(){for(var t=0;t<10;t++){var n=t>0?t:"";delete e["CONSUME"+n],delete e["SUBRULE"+n],delete e["OPTION"+n],delete e["OR"+n],delete e["MANY"+n],delete e["MANY_SEP"+n],delete e["AT_LEAST_ONE"+n],delete e["AT_LEAST_ONE_SEP"+n]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA}))},e.prototype.ACTION_RECORD=function(e){},e.prototype.BACKTRACK_RECORD=function(e,t){return function(){return!0}},e.prototype.LA_RECORD=function(e){return l.END_OF_FILE},e.prototype.topLevelRuleRecord=function(e,t){try{var n=new i.Rule({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(e){if(!0!==e.KNOWN_RECORDER_ERROR)try{e.message=e.message+'\n\t This error was thrown during the "grammar recording phase" For more info see:\n\thttps://chevrotain.io/docs/guide/internals.html#grammar-recording'}catch(t){throw e}throw e}},e.prototype.optionInternalRecord=function(e,t){return g.call(this,i.Option,e,t)},e.prototype.atLeastOneInternalRecord=function(e,t){g.call(this,i.RepetitionMandatory,t,e)},e.prototype.atLeastOneSepFirstInternalRecord=function(e,t){g.call(this,i.RepetitionMandatoryWithSeparator,t,e,true)},e.prototype.manyInternalRecord=function(e,t){g.call(this,i.Repetition,t,e)},e.prototype.manySepFirstInternalRecord=function(e,t){g.call(this,i.RepetitionWithSeparator,t,e,true)},e.prototype.orInternalRecord=function(e,t){return v.call(this,e,t)},e.prototype.subruleInternalRecord=function(e,t,n){if(T(t),!e||!1===r.has(e,"ruleName")){var o=new Error("<SUBRULE"+y(t)+"> argument is invalid expecting a Parser method reference but got: <"+JSON.stringify(e)+">\n inside top level rule: <"+this.recordingProdStack[0].name+">");throw o.KNOWN_RECORDER_ERROR=!0,o}var a=r.peek(this.recordingProdStack),s=e.ruleName,l=new i.NonTerminal({idx:t,nonTerminalName:s,label:null==n?void 0:n.LABEL,referencedRule:void 0});return a.definition.push(l),this.outputCst?d:c},e.prototype.consumeInternalRecord=function(e,t,n){if(T(t),!a.hasShortKeyProperty(e)){var o=new Error("<CONSUME"+y(t)+"> argument is invalid expecting a TokenType reference but got: <"+JSON.stringify(e)+">\n inside top level rule: <"+this.recordingProdStack[0].name+">");throw o.KNOWN_RECORDER_ERROR=!0,o}var s=r.peek(this.recordingProdStack),l=new i.Terminal({idx:t,terminalType:e,label:null==n?void 0:n.LABEL});return s.definition.push(l),p},e}();function g(e,t,n,i){void 0===i&&(i=!1),T(n);var o=r.peek(this.recordingProdStack),a=r.isFunction(t)?t:t.DEF,s=new e({definition:[],idx:n});return i&&(s.separator=t.SEP),r.has(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(s),a.call(this),o.definition.push(s),this.recordingProdStack.pop(),c}function v(e,t){var n=this;T(t);var o=r.peek(this.recordingProdStack),a=!1===r.isArray(e),s=!1===a?e:e.DEF,l=new i.Alternation({definition:[],idx:t,ignoreAmbiguities:a&&!0===e.IGNORE_AMBIGUITIES});r.has(e,"MAX_LOOKAHEAD")&&(l.maxLookahead=e.MAX_LOOKAHEAD);var u=r.some(s,(function(e){return r.isFunction(e.GATE)}));return l.hasPredicates=u,o.definition.push(l),r.forEach(s,(function(e){var t=new i.Alternative({definition:[]});l.definition.push(t),r.has(e,"IGNORE_AMBIGUITIES")?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:r.has(e,"GATE")&&(t.ignoreAmbiguities=!0),n.recordingProdStack.push(t),e.ALT.call(n),n.recordingProdStack.pop()})),c}function y(e){return 0===e?"":""+e}function T(e){if(e<0||e>h){var t=new Error("Invalid DSL Method idx value: <"+e+">\n\tIdx value must be a none negative value smaller than "+(h+1));throw t.KNOWN_RECORDER_ERROR=!0,t}}t.GastRecorder=m},1540:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LexerAdapter=void 0;var r=n(1183),i=function(){function e(){}return e.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(e.prototype,"input",{get:function(){return this.tokVector},set:function(e){if(!0!==this.selfAnalysisDone)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length},enumerable:!1,configurable:!0}),e.prototype.SKIP_TOKEN=function(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):r.END_OF_FILE},e.prototype.LA=function(e){var t=this.currIdx+e;return t<0||this.tokVectorLength<=t?r.END_OF_FILE:this.tokVector[t]},e.prototype.consumeToken=function(){this.currIdx++},e.prototype.exportLexerState=function(){return this.currIdx},e.prototype.importLexerState=function(e){this.currIdx=e},e.prototype.resetLexerState=function(){this.currIdx=-1},e.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},e.prototype.getLexerPosition=function(){return this.exportLexerState()},e}();t.LexerAdapter=i},4421:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LooksAhead=void 0;var r=n(3670),i=n(8877),o=n(1183),a=n(8567),s=n(3081),l=function(){function e(){}return e.prototype.initLooksAhead=function(e){this.dynamicTokensEnabled=i.has(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:o.DEFAULT_PARSER_CONFIG.dynamicTokensEnabled,this.maxLookahead=i.has(e,"maxLookahead")?e.maxLookahead:o.DEFAULT_PARSER_CONFIG.maxLookahead,this.lookAheadFuncsCache=i.isES2015MapSupported()?new Map:[],i.isES2015MapSupported()?(this.getLaFuncFromCache=this.getLaFuncFromMap,this.setLaFuncCache=this.setLaFuncCacheUsingMap):(this.getLaFuncFromCache=this.getLaFuncFromObj,this.setLaFuncCache=this.setLaFuncUsingObj)},e.prototype.preComputeLookaheadFunctions=function(e){var t=this;i.forEach(e,(function(e){t.TRACE_INIT(e.name+" Rule Lookahead",(function(){var n=s.collectMethods(e),o=n.alternation,l=n.repetition,u=n.option,c=n.repetitionMandatory,h=n.repetitionMandatoryWithSeparator,f=n.repetitionWithSeparator;i.forEach(o,(function(n){var i=0===n.idx?"":n.idx;t.TRACE_INIT(""+s.getProductionDslName(n)+i,(function(){var i=r.buildLookaheadFuncForOr(n.idx,e,n.maxLookahead||t.maxLookahead,n.hasPredicates,t.dynamicTokensEnabled,t.lookAheadBuilderForAlternatives),o=a.getKeyForAutomaticLookahead(t.fullRuleNameToShort[e.name],a.OR_IDX,n.idx);t.setLaFuncCache(o,i)}))})),i.forEach(l,(function(n){t.computeLookaheadFunc(e,n.idx,a.MANY_IDX,r.PROD_TYPE.REPETITION,n.maxLookahead,s.getProductionDslName(n))})),i.forEach(u,(function(n){t.computeLookaheadFunc(e,n.idx,a.OPTION_IDX,r.PROD_TYPE.OPTION,n.maxLookahead,s.getProductionDslName(n))})),i.forEach(c,(function(n){t.computeLookaheadFunc(e,n.idx,a.AT_LEAST_ONE_IDX,r.PROD_TYPE.REPETITION_MANDATORY,n.maxLookahead,s.getProductionDslName(n))})),i.forEach(h,(function(n){t.computeLookaheadFunc(e,n.idx,a.AT_LEAST_ONE_SEP_IDX,r.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,n.maxLookahead,s.getProductionDslName(n))})),i.forEach(f,(function(n){t.computeLookaheadFunc(e,n.idx,a.MANY_SEP_IDX,r.PROD_TYPE.REPETITION_WITH_SEPARATOR,n.maxLookahead,s.getProductionDslName(n))}))}))}))},e.prototype.computeLookaheadFunc=function(e,t,n,i,o,s){var l=this;this.TRACE_INIT(""+s+(0===t?"":t),(function(){var s=r.buildLookaheadFuncForOptionalProd(t,e,o||l.maxLookahead,l.dynamicTokensEnabled,i,l.lookAheadBuilderForOptional),u=a.getKeyForAutomaticLookahead(l.fullRuleNameToShort[e.name],n,t);l.setLaFuncCache(u,s)}))},e.prototype.lookAheadBuilderForOptional=function(e,t,n){return r.buildSingleAlternativeLookaheadFunction(e,t,n)},e.prototype.lookAheadBuilderForAlternatives=function(e,t,n,i){return r.buildAlternativesLookAheadFunc(e,t,n,i)},e.prototype.getKeyForAutomaticLookahead=function(e,t){var n=this.getLastExplicitRuleShortName();return a.getKeyForAutomaticLookahead(n,e,t)},e.prototype.getLaFuncFromCache=function(e){},e.prototype.getLaFuncFromMap=function(e){return this.lookAheadFuncsCache.get(e)},e.prototype.getLaFuncFromObj=function(e){return this.lookAheadFuncsCache[e]},e.prototype.setLaFuncCache=function(e,t){},e.prototype.setLaFuncCacheUsingMap=function(e,t){this.lookAheadFuncsCache.set(e,t)},e.prototype.setLaFuncUsingObj=function(e,t){this.lookAheadFuncsCache[e]=t},e}();t.LooksAhead=l},6427:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PerformanceTracer=void 0;var r=n(8877),i=n(1183),o=function(){function e(){}return e.prototype.initPerformanceTracer=function(e){if(r.has(e,"traceInitPerf")){var t=e.traceInitPerf,n="number"==typeof t;this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=i.DEFAULT_PARSER_CONFIG.traceInitPerf;this.traceInitIndent=-1},e.prototype.TRACE_INIT=function(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;var n=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(n+"--\x3e <"+e+">");var i=r.timer(t),o=i.time,a=i.value,s=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(n+"<-- <"+e+"> time: "+o+"ms"),this.traceInitIndent--,a}return t()},e}();t.PerformanceTracer=o},951:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RecognizerApi=void 0;var r=n(8877),i=n(4400),o=n(1183),a=n(7621),s=n(4046),l=n(2496),u=function(){function e(){}return e.prototype.ACTION=function(e){return e.call(this)},e.prototype.consume=function(e,t,n){return this.consumeInternal(t,e,n)},e.prototype.subrule=function(e,t,n){return this.subruleInternal(t,e,n)},e.prototype.option=function(e,t){return this.optionInternal(t,e)},e.prototype.or=function(e,t){return this.orInternal(t,e)},e.prototype.many=function(e,t){return this.manyInternal(e,t)},e.prototype.atLeastOne=function(e,t){return this.atLeastOneInternal(e,t)},e.prototype.CONSUME=function(e,t){return this.consumeInternal(e,0,t)},e.prototype.CONSUME1=function(e,t){return this.consumeInternal(e,1,t)},e.prototype.CONSUME2=function(e,t){return this.consumeInternal(e,2,t)},e.prototype.CONSUME3=function(e,t){return this.consumeInternal(e,3,t)},e.prototype.CONSUME4=function(e,t){return this.consumeInternal(e,4,t)},e.prototype.CONSUME5=function(e,t){return this.consumeInternal(e,5,t)},e.prototype.CONSUME6=function(e,t){return this.consumeInternal(e,6,t)},e.prototype.CONSUME7=function(e,t){return this.consumeInternal(e,7,t)},e.prototype.CONSUME8=function(e,t){return this.consumeInternal(e,8,t)},e.prototype.CONSUME9=function(e,t){return this.consumeInternal(e,9,t)},e.prototype.SUBRULE=function(e,t){return this.subruleInternal(e,0,t)},e.prototype.SUBRULE1=function(e,t){return this.subruleInternal(e,1,t)},e.prototype.SUBRULE2=function(e,t){return this.subruleInternal(e,2,t)},e.prototype.SUBRULE3=function(e,t){return this.subruleInternal(e,3,t)},e.prototype.SUBRULE4=function(e,t){return this.subruleInternal(e,4,t)},e.prototype.SUBRULE5=function(e,t){return this.subruleInternal(e,5,t)},e.prototype.SUBRULE6=function(e,t){return this.subruleInternal(e,6,t)},e.prototype.SUBRULE7=function(e,t){return this.subruleInternal(e,7,t)},e.prototype.SUBRULE8=function(e,t){return this.subruleInternal(e,8,t)},e.prototype.SUBRULE9=function(e,t){return this.subruleInternal(e,9,t)},e.prototype.OPTION=function(e){return this.optionInternal(e,0)},e.prototype.OPTION1=function(e){return this.optionInternal(e,1)},e.prototype.OPTION2=function(e){return this.optionInternal(e,2)},e.prototype.OPTION3=function(e){return this.optionInternal(e,3)},e.prototype.OPTION4=function(e){return this.optionInternal(e,4)},e.prototype.OPTION5=function(e){return this.optionInternal(e,5)},e.prototype.OPTION6=function(e){return this.optionInternal(e,6)},e.prototype.OPTION7=function(e){return this.optionInternal(e,7)},e.prototype.OPTION8=function(e){return this.optionInternal(e,8)},e.prototype.OPTION9=function(e){return this.optionInternal(e,9)},e.prototype.OR=function(e){return this.orInternal(e,0)},e.prototype.OR1=function(e){return this.orInternal(e,1)},e.prototype.OR2=function(e){return this.orInternal(e,2)},e.prototype.OR3=function(e){return this.orInternal(e,3)},e.prototype.OR4=function(e){return this.orInternal(e,4)},e.prototype.OR5=function(e){return this.orInternal(e,5)},e.prototype.OR6=function(e){return this.orInternal(e,6)},e.prototype.OR7=function(e){return this.orInternal(e,7)},e.prototype.OR8=function(e){return this.orInternal(e,8)},e.prototype.OR9=function(e){return this.orInternal(e,9)},e.prototype.MANY=function(e){this.manyInternal(0,e)},e.prototype.MANY1=function(e){this.manyInternal(1,e)},e.prototype.MANY2=function(e){this.manyInternal(2,e)},e.prototype.MANY3=function(e){this.manyInternal(3,e)},e.prototype.MANY4=function(e){this.manyInternal(4,e)},e.prototype.MANY5=function(e){this.manyInternal(5,e)},e.prototype.MANY6=function(e){this.manyInternal(6,e)},e.prototype.MANY7=function(e){this.manyInternal(7,e)},e.prototype.MANY8=function(e){this.manyInternal(8,e)},e.prototype.MANY9=function(e){this.manyInternal(9,e)},e.prototype.MANY_SEP=function(e){this.manySepFirstInternal(0,e)},e.prototype.MANY_SEP1=function(e){this.manySepFirstInternal(1,e)},e.prototype.MANY_SEP2=function(e){this.manySepFirstInternal(2,e)},e.prototype.MANY_SEP3=function(e){this.manySepFirstInternal(3,e)},e.prototype.MANY_SEP4=function(e){this.manySepFirstInternal(4,e)},e.prototype.MANY_SEP5=function(e){this.manySepFirstInternal(5,e)},e.prototype.MANY_SEP6=function(e){this.manySepFirstInternal(6,e)},e.prototype.MANY_SEP7=function(e){this.manySepFirstInternal(7,e)},e.prototype.MANY_SEP8=function(e){this.manySepFirstInternal(8,e)},e.prototype.MANY_SEP9=function(e){this.manySepFirstInternal(9,e)},e.prototype.AT_LEAST_ONE=function(e){this.atLeastOneInternal(0,e)},e.prototype.AT_LEAST_ONE1=function(e){return this.atLeastOneInternal(1,e)},e.prototype.AT_LEAST_ONE2=function(e){this.atLeastOneInternal(2,e)},e.prototype.AT_LEAST_ONE3=function(e){this.atLeastOneInternal(3,e)},e.prototype.AT_LEAST_ONE4=function(e){this.atLeastOneInternal(4,e)},e.prototype.AT_LEAST_ONE5=function(e){this.atLeastOneInternal(5,e)},e.prototype.AT_LEAST_ONE6=function(e){this.atLeastOneInternal(6,e)},e.prototype.AT_LEAST_ONE7=function(e){this.atLeastOneInternal(7,e)},e.prototype.AT_LEAST_ONE8=function(e){this.atLeastOneInternal(8,e)},e.prototype.AT_LEAST_ONE9=function(e){this.atLeastOneInternal(9,e)},e.prototype.AT_LEAST_ONE_SEP=function(e){this.atLeastOneSepFirstInternal(0,e)},e.prototype.AT_LEAST_ONE_SEP1=function(e){this.atLeastOneSepFirstInternal(1,e)},e.prototype.AT_LEAST_ONE_SEP2=function(e){this.atLeastOneSepFirstInternal(2,e)},e.prototype.AT_LEAST_ONE_SEP3=function(e){this.atLeastOneSepFirstInternal(3,e)},e.prototype.AT_LEAST_ONE_SEP4=function(e){this.atLeastOneSepFirstInternal(4,e)},e.prototype.AT_LEAST_ONE_SEP5=function(e){this.atLeastOneSepFirstInternal(5,e)},e.prototype.AT_LEAST_ONE_SEP6=function(e){this.atLeastOneSepFirstInternal(6,e)},e.prototype.AT_LEAST_ONE_SEP7=function(e){this.atLeastOneSepFirstInternal(7,e)},e.prototype.AT_LEAST_ONE_SEP8=function(e){this.atLeastOneSepFirstInternal(8,e)},e.prototype.AT_LEAST_ONE_SEP9=function(e){this.atLeastOneSepFirstInternal(9,e)},e.prototype.RULE=function(e,t,n){if(void 0===n&&(n=o.DEFAULT_RULE_CONFIG),r.contains(this.definedRulesNames,e)){var i={message:a.defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:o.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(i)}this.definedRulesNames.push(e);var s=this.defineRule(e,t,n);return this[e]=s,s},e.prototype.OVERRIDE_RULE=function(e,t,n){void 0===n&&(n=o.DEFAULT_RULE_CONFIG);var r=[];r=r.concat(s.validateRuleIsOverridden(e,this.definedRulesNames,this.className)),this.definitionErrors=this.definitionErrors.concat(r);var i=this.defineRule(e,t,n);return this[e]=i,i},e.prototype.BACKTRACK=function(e,t){return function(){this.isBackTrackingStack.push(1);var n=this.saveRecogState();try{return e.apply(this,t),!0}catch(e){if(i.isRecognitionException(e))return!1;throw e}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}},e.prototype.getGAstProductions=function(){return this.gastProductionsCache},e.prototype.getSerializedGastProductions=function(){return l.serializeGrammar(r.values(this.gastProductionsCache))},e}();t.RecognizerApi=u},2691:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RecognizerEngine=void 0;var r=n(8877),i=n(8567),o=n(4400),a=n(3670),s=n(6331),l=n(1183),u=n(5786),c=n(8980),h=n(6570),f=n(9164),p=function(){function e(){}return e.prototype.initRecognizerEngine=function(e,t){if(this.className=f.classNameFromInstance(this),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=h.tokenStructuredMatcherNoCategories,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},r.has(t,"serializedGrammar"))throw Error("The Parser's configuration can no longer contain a <serializedGrammar> property.\n\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\n\tFor Further details.");if(r.isArray(e)){if(r.isEmpty(e))throw Error("A Token Vocabulary cannot be empty.\n\tNote that the first argument for the parser constructor\n\tis no longer a Token vector (since v4.0).");if("number"==typeof e[0].startOffset)throw Error("The Parser constructor no longer accepts a token vector as the first argument.\n\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\n\tFor Further details.")}if(r.isArray(e))this.tokensMap=r.reduce(e,(function(e,t){return e[t.name]=t,e}),{});else if(r.has(e,"modes")&&r.every(r.flatten(r.values(e.modes)),h.isTokenType)){var n=r.flatten(r.values(e.modes)),i=r.uniq(n);this.tokensMap=r.reduce(i,(function(e,t){return e[t.name]=t,e}),{})}else{if(!r.isObject(e))throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap=r.cloneObj(e)}this.tokensMap.EOF=c.EOF;var o=r.every(r.values(e),(function(e){return r.isEmpty(e.categoryMatches)}));this.tokenMatcher=o?h.tokenStructuredMatcherNoCategories:h.tokenStructuredMatcher,h.augmentTokenTypes(r.values(this.tokensMap))},e.prototype.defineRule=function(e,t,n){if(this.selfAnalysisDone)throw Error("Grammar rule <"+e+"> may not be defined after the 'performSelfAnalysis' method has been called'\nMake sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.");var o=r.has(n,"resyncEnabled")?n.resyncEnabled:l.DEFAULT_RULE_CONFIG.resyncEnabled,a=r.has(n,"recoveryValueFunc")?n.recoveryValueFunc:l.DEFAULT_RULE_CONFIG.recoveryValueFunc,s=this.ruleShortNameIdx<<i.BITS_FOR_METHOD_TYPE+i.BITS_FOR_OCCURRENCE_IDX;function u(e){try{if(!0===this.outputCst){t.apply(this,e);var n=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(n),n}return t.apply(this,e)}catch(e){return this.invokeRuleCatch(e,o,a)}finally{this.ruleFinallyStateUpdate()}}this.ruleShortNameIdx++,this.shortRuleNameToFull[s]=e,this.fullRuleNameToShort[e]=s;var c=function(t,n){return void 0===t&&(t=0),this.ruleInvocationStateUpdate(s,e,t),u.call(this,n)};return c.ruleName=e,c.originalGrammarAction=t,c},e.prototype.invokeRuleCatch=function(e,t,n){var r=1===this.RULE_STACK.length,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if(o.isRecognitionException(e)){var a=e;if(i){var s,l=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(l))return a.resyncedTokens=this.reSyncTo(l),this.outputCst?((s=this.CST_STACK[this.CST_STACK.length-1]).recoveredNode=!0,s):n();throw this.outputCst&&((s=this.CST_STACK[this.CST_STACK.length-1]).recoveredNode=!0,a.partialCstResult=s),a}if(r)return this.moveToTerminatedState(),n();throw a}throw e},e.prototype.optionInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(i.OPTION_IDX,t);return this.optionInternalLogic(e,t,n)},e.prototype.optionInternalLogic=function(e,t,n){var r,i,o=this,a=this.getLaFuncFromCache(n);if(void 0!==e.DEF){if(r=e.DEF,void 0!==(i=e.GATE)){var s=a;a=function(){return i.call(o)&&s.call(o)}}}else r=e;if(!0===a.call(this))return r.call(this)},e.prototype.atLeastOneInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(i.AT_LEAST_ONE_IDX,e);return this.atLeastOneInternalLogic(e,t,n)},e.prototype.atLeastOneInternalLogic=function(e,t,n){var r,o,l=this,u=this.getLaFuncFromCache(n);if(void 0!==t.DEF){if(r=t.DEF,void 0!==(o=t.GATE)){var c=u;u=function(){return o.call(l)&&c.call(l)}}}else r=t;if(!0!==u.call(this))throw this.raiseEarlyExitException(e,a.PROD_TYPE.REPETITION_MANDATORY,t.ERR_MSG);for(var h=this.doSingleRepetition(r);!0===u.call(this)&&!0===h;)h=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],u,i.AT_LEAST_ONE_IDX,e,s.NextTerminalAfterAtLeastOneWalker)},e.prototype.atLeastOneSepFirstInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(i.AT_LEAST_ONE_SEP_IDX,e);this.atLeastOneSepFirstInternalLogic(e,t,n)},e.prototype.atLeastOneSepFirstInternalLogic=function(e,t,n){var r=this,o=t.DEF,l=t.SEP;if(!0!==this.getLaFuncFromCache(n).call(this))throw this.raiseEarlyExitException(e,a.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG);o.call(this);for(var u=function(){return r.tokenMatcher(r.LA(1),l)};!0===this.tokenMatcher(this.LA(1),l);)this.CONSUME(l),o.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,l,u,o,s.NextTerminalAfterAtLeastOneSepWalker],u,i.AT_LEAST_ONE_SEP_IDX,e,s.NextTerminalAfterAtLeastOneSepWalker)},e.prototype.manyInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(i.MANY_IDX,e);return this.manyInternalLogic(e,t,n)},e.prototype.manyInternalLogic=function(e,t,n){var r,o,a=this,l=this.getLaFuncFromCache(n);if(void 0!==t.DEF){if(r=t.DEF,void 0!==(o=t.GATE)){var u=l;l=function(){return o.call(a)&&u.call(a)}}}else r=t;for(var c=!0;!0===l.call(this)&&!0===c;)c=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],l,i.MANY_IDX,e,s.NextTerminalAfterManyWalker,c)},e.prototype.manySepFirstInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(i.MANY_SEP_IDX,e);this.manySepFirstInternalLogic(e,t,n)},e.prototype.manySepFirstInternalLogic=function(e,t,n){var r=this,o=t.DEF,a=t.SEP;if(!0===this.getLaFuncFromCache(n).call(this)){o.call(this);for(var l=function(){return r.tokenMatcher(r.LA(1),a)};!0===this.tokenMatcher(this.LA(1),a);)this.CONSUME(a),o.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,a,l,o,s.NextTerminalAfterManySepWalker],l,i.MANY_SEP_IDX,e,s.NextTerminalAfterManySepWalker)}},e.prototype.repetitionSepSecondInternal=function(e,t,n,r,o){for(;n();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,r,o],n,i.AT_LEAST_ONE_SEP_IDX,e,o)},e.prototype.doSingleRepetition=function(e){var t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t},e.prototype.orInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(i.OR_IDX,t),o=r.isArray(e)?e:e.DEF,a=this.getLaFuncFromCache(n).call(this,o);if(void 0!==a)return o[a].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)},e.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),0===this.RULE_STACK.length&&!1===this.isAtEndOfInput()){var e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new o.NotAllInputParsedException(t,e))}},e.prototype.subruleInternal=function(e,t,n){var r;try{var i=void 0!==n?n.ARGS:void 0;return r=e.call(this,t,i),this.cstPostNonTerminal(r,void 0!==n&&void 0!==n.LABEL?n.LABEL:e.ruleName),r}catch(t){this.subruleInternalError(t,n,e.ruleName)}},e.prototype.subruleInternalError=function(e,t,n){throw o.isRecognitionException(e)&&void 0!==e.partialCstResult&&(this.cstPostNonTerminal(e.partialCstResult,void 0!==t&&void 0!==t.LABEL?t.LABEL:n),delete e.partialCstResult),e},e.prototype.consumeInternal=function(e,t,n){var r;try{var i=this.LA(1);!0===this.tokenMatcher(i,e)?(this.consumeToken(),r=i):this.consumeInternalError(e,i,n)}catch(n){r=this.consumeInternalRecovery(e,t,n)}return this.cstPostTerminal(void 0!==n&&void 0!==n.LABEL?n.LABEL:e.name,r),r},e.prototype.consumeInternalError=function(e,t,n){var r,i=this.LA(0);throw r=void 0!==n&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new o.MismatchedTokenException(r,t,i))},e.prototype.consumeInternalRecovery=function(e,t,n){if(!this.recoveryEnabled||"MismatchedTokenException"!==n.name||this.isBackTracking())throw n;var r=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,r)}catch(e){throw e.name===u.IN_RULE_RECOVERY_EXCEPTION?n:e}},e.prototype.saveRecogState=function(){var e=this.errors,t=r.cloneArr(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}},e.prototype.reloadRecogState=function(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK},e.prototype.ruleInvocationStateUpdate=function(e,t,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t,e)},e.prototype.isBackTracking=function(){return 0!==this.isBackTrackingStack.length},e.prototype.getCurrRuleFullName=function(){var e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]},e.prototype.shortRuleNameToFullName=function(e){return this.shortRuleNameToFull[e]},e.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),c.EOF)},e.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},e}();t.RecognizerEngine=p},5786:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.attemptInRepetitionRecovery=t.Recoverable=t.InRuleRecoveryException=t.IN_RULE_RECOVERY_EXCEPTION=t.EOF_FOLLOW_KEY=void 0;var r=n(8980),i=n(8877),o=n(4400),a=n(4997),s=n(1183);function l(e){this.name=t.IN_RULE_RECOVERY_EXCEPTION,this.message=e}t.EOF_FOLLOW_KEY={},t.IN_RULE_RECOVERY_EXCEPTION="InRuleRecoveryException",t.InRuleRecoveryException=l,l.prototype=Error.prototype;var u=function(){function e(){}return e.prototype.initRecoverable=function(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=i.has(e,"recoveryEnabled")?e.recoveryEnabled:s.DEFAULT_PARSER_CONFIG.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=c)},e.prototype.getTokenToInsert=function(e){var t=r.createTokenInstance(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t},e.prototype.canTokenTypeBeInsertedInRecovery=function(e){return!0},e.prototype.tryInRepetitionRecovery=function(e,t,n,r){for(var a=this,s=this.findReSyncTokenType(),l=this.exportLexerState(),u=[],c=!1,h=this.LA(1),f=this.LA(1),p=function(){var e=a.LA(0),t=a.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:h,previous:e,ruleName:a.getCurrRuleFullName()}),n=new o.MismatchedTokenException(t,h,a.LA(0));n.resyncedTokens=i.dropRight(u),a.SAVE_ERROR(n)};!c;){if(this.tokenMatcher(f,r))return void p();if(n.call(this))return p(),void e.apply(this,t);this.tokenMatcher(f,s)?c=!0:(f=this.SKIP_TOKEN(),this.addToResyncTokens(f,u))}this.importLexerState(l)},e.prototype.shouldInRepetitionRecoveryBeTried=function(e,t,n){return!1!==n&&(void 0!==e&&void 0!==t&&(!this.tokenMatcher(this.LA(1),e)&&(!this.isBackTracking()&&!this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))))},e.prototype.getFollowsForInRuleRecovery=function(e,t){var n=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(n)},e.prototype.tryInRuleRecovery=function(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){var n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new l("sad sad panda")},e.prototype.canPerformInRuleRecovery=function(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)},e.prototype.canRecoverWithSingleTokenInsertion=function(e,t){var n=this;if(!this.canTokenTypeBeInsertedInRecovery(e))return!1;if(i.isEmpty(t))return!1;var r=this.LA(1);return void 0!==i.find(t,(function(e){return n.tokenMatcher(r,e)}))},e.prototype.canRecoverWithSingleTokenDeletion=function(e){return this.tokenMatcher(this.LA(2),e)},e.prototype.isInCurrentRuleReSyncSet=function(e){var t=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(t);return i.contains(n,e)},e.prototype.findReSyncTokenType=function(){for(var e=this.flattenFollowSet(),t=this.LA(1),n=2;;){var r=t.tokenType;if(i.contains(e,r))return r;t=this.LA(n),n++}},e.prototype.getCurrFollowKey=function(){if(1===this.RULE_STACK.length)return t.EOF_FOLLOW_KEY;var e=this.getLastExplicitRuleShortName(),n=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:n,inRule:this.shortRuleNameToFullName(r)}},e.prototype.buildFullFollowKeyStack=function(){var e=this,n=this.RULE_STACK,r=this.RULE_OCCURRENCE_STACK;return i.map(n,(function(i,o){return 0===o?t.EOF_FOLLOW_KEY:{ruleName:e.shortRuleNameToFullName(i),idxInCallingRule:r[o],inRule:e.shortRuleNameToFullName(n[o-1])}}))},e.prototype.flattenFollowSet=function(){var e=this,t=i.map(this.buildFullFollowKeyStack(),(function(t){return e.getFollowSetFromFollowKey(t)}));return i.flatten(t)},e.prototype.getFollowSetFromFollowKey=function(e){if(e===t.EOF_FOLLOW_KEY)return[r.EOF];var n=e.ruleName+e.idxInCallingRule+a.IN+e.inRule;return this.resyncFollows[n]},e.prototype.addToResyncTokens=function(e,t){return this.tokenMatcher(e,r.EOF)||t.push(e),t},e.prototype.reSyncTo=function(e){for(var t=[],n=this.LA(1);!1===this.tokenMatcher(n,e);)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,t);return i.dropRight(t)},e.prototype.attemptInRepetitionRecovery=function(e,t,n,r,i,o,a){},e.prototype.getCurrentGrammarPath=function(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:i.cloneArr(this.RULE_OCCURRENCE_STACK),lastTok:e,lastTokOccurrence:t}},e.prototype.getHumanReadableRuleStack=function(){var e=this;return i.map(this.RULE_STACK,(function(t){return e.shortRuleNameToFullName(t)}))},e}();function c(e,t,n,i,o,a,s){var l=this.getKeyForAutomaticLookahead(i,o),u=this.firstAfterRepMap[l];if(void 0===u){var c=this.getCurrRuleFullName();u=new a(this.getGAstProductions()[c],o).startWalking(),this.firstAfterRepMap[l]=u}var h=u.token,f=u.occurrence,p=u.isEndOfRule;1===this.RULE_STACK.length&&p&&void 0===h&&(h=r.EOF,f=1),this.shouldInRepetitionRecoveryBeTried(h,f,s)&&this.tryInRepetitionRecovery(e,t,n,h)}t.Recoverable=u,t.attemptInRepetitionRecovery=c},943:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TreeBuilder=void 0;var r=n(3059),i=n(8877),o=n(5480),a=n(1183),s=function(){function e(){}return e.prototype.initTreeBuilder=function(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=i.has(e,"nodeLocationTracking")?e.nodeLocationTracking:a.DEFAULT_PARSER_CONFIG.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=r.setNodeLocationFull,this.setNodeLocationFromNode=r.setNodeLocationFull,this.cstPostRule=i.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=i.NOOP,this.setNodeLocationFromNode=i.NOOP,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=r.setNodeLocationOnlyOffset,this.setNodeLocationFromNode=r.setNodeLocationOnlyOffset,this.cstPostRule=i.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=i.NOOP,this.setNodeLocationFromNode=i.NOOP,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else{if(!/none/i.test(this.nodeLocationTracking))throw Error('Invalid <nodeLocationTracking> config option: "'+e.nodeLocationTracking+'"');this.setNodeLocationFromToken=i.NOOP,this.setNodeLocationFromNode=i.NOOP,this.cstPostRule=i.NOOP,this.setInitialNodeLocation=i.NOOP}else this.cstInvocationStateUpdate=i.NOOP,this.cstFinallyStateUpdate=i.NOOP,this.cstPostTerminal=i.NOOP,this.cstPostNonTerminal=i.NOOP,this.cstPostRule=i.NOOP},e.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(e){e.location={startOffset:NaN,endOffset:NaN}},e.prototype.setInitialNodeLocationOnlyOffsetRegular=function(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},e.prototype.setInitialNodeLocationFullRecovery=function(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},e.prototype.setInitialNodeLocationFullRegular=function(e){var t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},e.prototype.cstInvocationStateUpdate=function(e,t){var n={name:e,children:{}};this.setInitialNodeLocation(n),this.CST_STACK.push(n)},e.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},e.prototype.cstPostRuleFull=function(e){var t=this.LA(0),n=e.location;n.startOffset<=t.startOffset==!0?(n.endOffset=t.endOffset,n.endLine=t.endLine,n.endColumn=t.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)},e.prototype.cstPostRuleOnlyOffset=function(e){var t=this.LA(0),n=e.location;n.startOffset<=t.startOffset==!0?n.endOffset=t.endOffset:n.startOffset=NaN},e.prototype.cstPostTerminal=function(e,t){var n=this.CST_STACK[this.CST_STACK.length-1];r.addTerminalToCst(n,t,e),this.setNodeLocationFromToken(n.location,t)},e.prototype.cstPostNonTerminal=function(e,t){var n=this.CST_STACK[this.CST_STACK.length-1];r.addNoneTerminalToCst(n,t,e),this.setNodeLocationFromNode(n.location,e.location)},e.prototype.getBaseCstVisitorConstructor=function(){if(i.isUndefined(this.baseCstVisitorConstructor)){var e=o.createBaseSemanticVisitorConstructor(this.className,i.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor},e.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if(i.isUndefined(this.baseCstVisitorWithDefaultsConstructor)){var e=o.createBaseVisitorConstructorWithDefaults(this.className,i.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor},e.prototype.getLastExplicitRuleShortName=function(){var e=this.RULE_STACK;return e[e.length-1]},e.prototype.getPreviousExplicitRuleShortName=function(){var e=this.RULE_STACK;return e[e.length-2]},e.prototype.getLastExplicitRuleOccurrenceIndex=function(){var e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]},e}();t.TreeBuilder=s},4989:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.applyMixins=void 0,t.applyMixins=function(e,t){t.forEach((function(t){var n=t.prototype;Object.getOwnPropertyNames(n).forEach((function(r){if("constructor"!==r){var i=Object.getOwnPropertyDescriptor(n,r);i&&(i.get||i.set)?Object.defineProperty(e.prototype,r,i):e.prototype[r]=t.prototype[r]}}))}))}},4879:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=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])})(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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.charCodeToOptimizedIndex=t.minOptimizationVal=t.buildLineBreakIssueMessage=t.LineTerminatorOptimizedTester=t.isShortPattern=t.isCustomPattern=t.cloneEmptyGroups=t.performWarningRuntimeChecks=t.performRuntimeChecks=t.addStickyFlag=t.addStartOfInput=t.findUnreachablePatterns=t.findModesThatDoNotExist=t.findInvalidGroupType=t.findDuplicatePatterns=t.findUnsupportedFlags=t.findStartOfInputAnchor=t.findEmptyMatchRegExps=t.findEndOfInputAnchor=t.findInvalidPatterns=t.findMissingPatterns=t.validatePatterns=t.analyzeTokenTypes=t.enableSticky=t.disableSticky=t.SUPPORT_STICKY=t.MODES=t.DEFAULT_MODE=void 0;var o=n(4556),a=n(8200),s=n(8877),l=n(8759),u=n(4811),c="PATTERN";function h(e){var t=s.filter(e,(function(e){return!s.has(e,c)}));return{errors:s.map(t,(function(e){return{message:"Token Type: ->"+e.name+"<- missing static 'PATTERN' property",type:a.LexerDefinitionErrorType.MISSING_PATTERN,tokenTypes:[e]}})),valid:s.difference(e,t)}}function f(e){var t=s.filter(e,(function(e){var t=e.PATTERN;return!(s.isRegExp(t)||s.isFunction(t)||s.has(t,"exec")||s.isString(t))}));return{errors:s.map(t,(function(e){return{message:"Token Type: ->"+e.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:a.LexerDefinitionErrorType.INVALID_PATTERN,tokenTypes:[e]}})),valid:s.difference(e,t)}}t.DEFAULT_MODE="defaultMode",t.MODES="modes",t.SUPPORT_STICKY="boolean"==typeof new RegExp("(?:)").sticky,t.disableSticky=function(){t.SUPPORT_STICKY=!1},t.enableSticky=function(){t.SUPPORT_STICKY=!0},t.analyzeTokenTypes=function(e,n){var r,i=(n=s.defaults(n,{useSticky:t.SUPPORT_STICKY,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r","\n"],tracer:function(e,t){return t()}})).tracer;i("initCharCodeToOptimizedIndexMap",(function(){!function(){if(s.isEmpty(w)){w=new Array(65536);for(var e=0;e<65536;e++)w[e]=e>255?255+~~(e/255):e}}()})),i("Reject Lexer.NA",(function(){r=s.reject(e,(function(e){return e.PATTERN===a.Lexer.NA}))}));var o,u,c,h,f,p,d,m,g,v,y,T=!1;i("Transform Patterns",(function(){T=!1,o=s.map(r,(function(e){var t=e.PATTERN;if(s.isRegExp(t)){var r=t.source;return 1!==r.length||"^"===r||"$"===r||"."===r||t.ignoreCase?2!==r.length||"\\"!==r[0]||s.contains(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],r[1])?n.useSticky?C(t):O(t):r[1]:r}if(s.isFunction(t))return T=!0,{exec:t};if(s.has(t,"exec"))return T=!0,t;if("string"==typeof t){if(1===t.length)return t;var i=t.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),o=new RegExp(i);return n.useSticky?C(o):O(o)}throw Error("non exhaustive match")}))})),i("misc mapping",(function(){u=s.map(r,(function(e){return e.tokenTypeIdx})),c=s.map(r,(function(e){var t=e.GROUP;if(t!==a.Lexer.SKIPPED){if(s.isString(t))return t;if(s.isUndefined(t))return!1;throw Error("non exhaustive match")}})),h=s.map(r,(function(e){var t=e.LONGER_ALT;if(t)return s.indexOf(r,t)})),f=s.map(r,(function(e){return e.PUSH_MODE})),p=s.map(r,(function(e){return s.has(e,"POP_MODE")}))})),i("Line Terminator Handling",(function(){var e=A(n.lineTerminatorCharacters);d=s.map(r,(function(e){return!1})),"onlyOffset"!==n.positionTracking&&(d=s.map(r,(function(t){return s.has(t,"LINE_BREAKS")?t.LINE_BREAKS:!1===N(t,e)?l.canMatchCharCode(e,t.PATTERN):void 0})))})),i("Misc Mapping #2",(function(){m=s.map(r,b),g=s.map(o,k),v=s.reduce(r,(function(e,t){var n=t.GROUP;return s.isString(n)&&n!==a.Lexer.SKIPPED&&(e[n]=[]),e}),{}),y=s.map(o,(function(e,t){return{pattern:o[t],longerAlt:h[t],canLineTerminator:d[t],isCustom:m[t],short:g[t],group:c[t],push:f[t],pop:p[t],tokenTypeIdx:u[t],tokenType:r[t]}}))}));var E=!0,S=[];return n.safeMode||i("First Char Optimization",(function(){S=s.reduce(r,(function(e,t,r){if("string"==typeof t.PATTERN){var i=I(t.PATTERN.charCodeAt(0));R(e,i,y[r])}else if(s.isArray(t.START_CHARS_HINT)){var o;s.forEach(t.START_CHARS_HINT,(function(t){var n=I("string"==typeof t?t.charCodeAt(0):t);o!==n&&(o=n,R(e,n,y[r]))}))}else if(s.isRegExp(t.PATTERN))if(t.PATTERN.unicode)E=!1,n.ensureOptimizations&&s.PRINT_ERROR(l.failedOptimizationPrefixMsg+"\tUnable to analyze < "+t.PATTERN.toString()+" > pattern.\n\tThe regexp unicode flag is not currently supported by the regexp-to-ast library.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE");else{var a=l.getOptimizedStartCodesIndices(t.PATTERN,n.ensureOptimizations);s.isEmpty(a)&&(E=!1),s.forEach(a,(function(t){R(e,t,y[r])}))}else n.ensureOptimizations&&s.PRINT_ERROR(l.failedOptimizationPrefixMsg+"\tTokenType: <"+t.name+"> is using a custom token pattern without providing <start_chars_hint> parameter.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE"),E=!1;return e}),[])})),i("ArrayPacking",(function(){S=s.packArray(S)})),{emptyGroups:v,patternIdxToConfig:y,charCodeToPatternIdxToConfig:S,hasCustom:T,canBeOptimized:E}},t.validatePatterns=function(e,t){var n=[],r=h(e);n=n.concat(r.errors);var i=f(r.valid),o=i.valid;return n=(n=(n=(n=(n=n.concat(i.errors)).concat(function(e){var t=[],n=s.filter(e,(function(e){return s.isRegExp(e.PATTERN)}));return t=(t=(t=(t=(t=t.concat(d(n))).concat(v(n))).concat(y(n))).concat(T(n))).concat(m(n))}(o))).concat(E(o))).concat(S(o,t))).concat(x(o))},t.findMissingPatterns=h,t.findInvalidPatterns=f;var p=/[^\\][\$]/;function d(e){var t=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.found=!1,t}return i(t,e),t.prototype.visitEndAnchor=function(e){this.found=!0},t}(o.BaseRegExpVisitor),n=s.filter(e,(function(e){var n=e.PATTERN;try{var r=u.getRegExpAst(n),i=new t;return i.visit(r),i.found}catch(e){return p.test(n.source)}}));return s.map(n,(function(e){return{message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+e.name+"<- static 'PATTERN' cannot contain end of input anchor '$'\n\tSee chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:a.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenTypes:[e]}}))}function m(e){var t=s.filter(e,(function(e){return e.PATTERN.test("")}));return s.map(t,(function(e){return{message:"Token Type: ->"+e.name+"<- static 'PATTERN' must not match an empty string",type:a.LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,tokenTypes:[e]}}))}t.findEndOfInputAnchor=d,t.findEmptyMatchRegExps=m;var g=/[^\\[][\^]|^\^/;function v(e){var t=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.found=!1,t}return i(t,e),t.prototype.visitStartAnchor=function(e){this.found=!0},t}(o.BaseRegExpVisitor),n=s.filter(e,(function(e){var n=e.PATTERN;try{var r=u.getRegExpAst(n),i=new t;return i.visit(r),i.found}catch(e){return g.test(n.source)}}));return s.map(n,(function(e){return{message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+e.name+"<- static 'PATTERN' cannot contain start of input anchor '^'\n\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:a.LexerDefinitionErrorType.SOI_ANCHOR_FOUND,tokenTypes:[e]}}))}function y(e){var t=s.filter(e,(function(e){var t=e.PATTERN;return t instanceof RegExp&&(t.multiline||t.global)}));return s.map(t,(function(e){return{message:"Token Type: ->"+e.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:a.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]}}))}function T(e){var t=[],n=s.map(e,(function(n){return s.reduce(e,(function(e,r){return n.PATTERN.source!==r.PATTERN.source||s.contains(t,r)||r.PATTERN===a.Lexer.NA||(t.push(r),e.push(r)),e}),[])}));n=s.compact(n);var r=s.filter(n,(function(e){return e.length>1}));return s.map(r,(function(e){var t=s.map(e,(function(e){return e.name}));return{message:"The same RegExp pattern ->"+s.first(e).PATTERN+"<-has been used in all of the following Token Types: "+t.join(", ")+" <-",type:a.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}}))}function E(e){var t=s.filter(e,(function(e){if(!s.has(e,"GROUP"))return!1;var t=e.GROUP;return t!==a.Lexer.SKIPPED&&t!==a.Lexer.NA&&!s.isString(t)}));return s.map(t,(function(e){return{message:"Token Type: ->"+e.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:a.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]}}))}function S(e,t){var n=s.filter(e,(function(e){return void 0!==e.PUSH_MODE&&!s.contains(t,e.PUSH_MODE)}));return s.map(n,(function(e){return{message:"Token Type: ->"+e.name+"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->"+e.PUSH_MODE+"<-which does not exist",type:a.LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}}))}function x(e){var t=[],n=s.reduce(e,(function(e,t,n){var r,i,o=t.PATTERN;return o===a.Lexer.NA||(s.isString(o)?e.push({str:o,idx:n,tokenType:t}):s.isRegExp(o)&&(r=o,i=[".","\\","[","]","|","^","$","(",")","?","*","+","{"],void 0===s.find(i,(function(e){return-1!==r.source.indexOf(e)})))&&e.push({str:o.source,idx:n,tokenType:t})),e}),[]);return s.forEach(e,(function(e,r){s.forEach(n,(function(n){var i=n.str,o=n.idx,l=n.tokenType;if(r<o&&function(e,t){if(s.isRegExp(t)){var n=t.exec(e);return null!==n&&0===n.index}if(s.isFunction(t))return t(e,0,[],{});if(s.has(t,"exec"))return t.exec(e,0,[],{});if("string"==typeof t)return t===e;throw Error("non exhaustive match")}(i,e.PATTERN)){var u="Token: ->"+l.name+"<- can never be matched.\nBecause it appears AFTER the Token Type ->"+e.name+"<-in the lexer's definition.\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE";t.push({message:u,type:a.LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[e,l]})}}))})),t}function O(e){var t=e.ignoreCase?"i":"";return new RegExp("^(?:"+e.source+")",t)}function C(e){var t=e.ignoreCase?"iy":"y";return new RegExp(""+e.source,t)}function b(e){var t=e.PATTERN;if(s.isRegExp(t))return!1;if(s.isFunction(t))return!0;if(s.has(t,"exec"))return!0;if(s.isString(t))return!1;throw Error("non exhaustive match")}function k(e){return!(!s.isString(e)||1!==e.length)&&e.charCodeAt(0)}function N(e,t){if(s.has(e,"LINE_BREAKS"))return!1;if(s.isRegExp(e.PATTERN)){try{l.canMatchCharCode(t,e.PATTERN)}catch(e){return{issue:a.LexerDefinitionErrorType.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}if(s.isString(e.PATTERN))return!1;if(b(e))return{issue:a.LexerDefinitionErrorType.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function L(e,t){if(t.issue===a.LexerDefinitionErrorType.IDENTIFY_TERMINATOR)return"Warning: unable to identify line terminator usage in pattern.\n\tThe problem is in the <"+e.name+"> Token Type\n\t Root cause: "+t.errMsg+".\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR";if(t.issue===a.LexerDefinitionErrorType.CUSTOM_LINE_BREAK)return"Warning: A Custom Token Pattern should specify the <line_breaks> option.\n\tThe problem is in the <"+e.name+"> Token Type\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}function A(e){return s.map(e,(function(e){return s.isString(e)&&e.length>0?e.charCodeAt(0):e}))}function R(e,t,n){void 0===e[t]?e[t]=[n]:e[t].push(n)}t.findStartOfInputAnchor=v,t.findUnsupportedFlags=y,t.findDuplicatePatterns=T,t.findInvalidGroupType=E,t.findModesThatDoNotExist=S,t.findUnreachablePatterns=x,t.addStartOfInput=O,t.addStickyFlag=C,t.performRuntimeChecks=function(e,n,r){var i=[];return s.has(e,t.DEFAULT_MODE)||i.push({message:"A MultiMode Lexer cannot be initialized without a <"+t.DEFAULT_MODE+"> property in its definition\n",type:a.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),s.has(e,t.MODES)||i.push({message:"A MultiMode Lexer cannot be initialized without a <"+t.MODES+"> property in its definition\n",type:a.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),s.has(e,t.MODES)&&s.has(e,t.DEFAULT_MODE)&&!s.has(e.modes,e.defaultMode)&&i.push({message:"A MultiMode Lexer cannot be initialized with a "+t.DEFAULT_MODE+": <"+e.defaultMode+">which does not exist\n",type:a.LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),s.has(e,t.MODES)&&s.forEach(e.modes,(function(e,t){s.forEach(e,(function(e,n){s.isUndefined(e)&&i.push({message:"A Lexer cannot be initialized using an undefined Token Type. Mode:<"+t+"> at index: <"+n+">\n",type:a.LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED})}))})),i},t.performWarningRuntimeChecks=function(e,t,n){var r=[],i=!1,o=s.compact(s.flatten(s.mapValues(e.modes,(function(e){return e})))),u=s.reject(o,(function(e){return e.PATTERN===a.Lexer.NA})),c=A(n);return t&&s.forEach(u,(function(e){var t=N(e,c);if(!1!==t){var n={message:L(e,t),type:t.issue,tokenType:e};r.push(n)}else s.has(e,"LINE_BREAKS")?!0===e.LINE_BREAKS&&(i=!0):l.canMatchCharCode(c,e.PATTERN)&&(i=!0)})),t&&!i&&r.push({message:"Warning: No LINE_BREAKS Found.\n\tThis Lexer has been defined to track line and column information,\n\tBut none of the Token Types can be identified as matching a line terminator.\n\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \n\tfor details.",type:a.LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS}),r},t.cloneEmptyGroups=function(e){var t={},n=s.keys(e);return s.forEach(n,(function(n){var r=e[n];if(!s.isArray(r))throw Error("non exhaustive match");t[n]=[]})),t},t.isCustomPattern=b,t.isShortPattern=k,t.LineTerminatorOptimizedTester={test:function(e){for(var t=e.length,n=this.lastIndex;n<t;n++){var r=e.charCodeAt(n);if(10===r)return this.lastIndex=n+1,!0;if(13===r)return 10===e.charCodeAt(n+1)?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0},t.buildLineBreakIssueMessage=L,t.minOptimizationVal=256;var w=[];function I(e){return e<t.minOptimizationVal?e:w[e]}t.charCodeToOptimizedIndex=I},8232:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultLexerErrorProvider=void 0,t.defaultLexerErrorProvider={buildUnableToPopLexerModeMessage:function(e){return"Unable to pop Lexer Mode after encountering Token ->"+e.image+"<- The Mode Stack is empty"},buildUnexpectedCharactersMessage:function(e,t,n,r,i){return"unexpected character: ->"+e.charAt(t)+"<- at offset: "+t+", skipped "+n+" characters."}}},8200:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Lexer=t.LexerDefinitionErrorType=void 0;var r=n(4879),i=n(8877),o=n(6570),a=n(8232),s=n(4811);!function(e){e[e.MISSING_PATTERN=0]="MISSING_PATTERN",e[e.INVALID_PATTERN=1]="INVALID_PATTERN",e[e.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",e[e.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",e[e.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",e[e.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",e[e.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",e[e.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",e[e.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",e[e.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",e[e.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",e[e.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",e[e.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",e[e.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",e[e.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",e[e.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",e[e.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK"}(t.LexerDefinitionErrorType||(t.LexerDefinitionErrorType={}));var l={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:a.defaultLexerErrorProvider,traceInitPerf:!1,skipValidations:!1};Object.freeze(l);var u=function(){function e(e,t){var n=this;if(void 0===t&&(t=l),this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.config=void 0,this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},"boolean"==typeof t)throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");this.config=i.merge(l,t);var a=this.config.traceInitPerf;!0===a?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof a&&(this.traceInitMaxIdent=a,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",(function(){var a,u=!0;n.TRACE_INIT("Lexer Config handling",(function(){if(n.config.lineTerminatorsPattern===l.lineTerminatorsPattern)n.config.lineTerminatorsPattern=r.LineTerminatorOptimizedTester;else if(n.config.lineTerminatorCharacters===l.lineTerminatorCharacters)throw Error("Error: Missing <lineTerminatorCharacters> property on the Lexer config.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS");if(t.safeMode&&t.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');n.trackStartLines=/full|onlyStart/i.test(n.config.positionTracking),n.trackEndLines=/full/i.test(n.config.positionTracking),i.isArray(e)?((a={modes:{}}).modes[r.DEFAULT_MODE]=i.cloneArr(e),a[r.DEFAULT_MODE]=r.DEFAULT_MODE):(u=!1,a=i.cloneObj(e))})),!1===n.config.skipValidations&&(n.TRACE_INIT("performRuntimeChecks",(function(){n.lexerDefinitionErrors=n.lexerDefinitionErrors.concat(r.performRuntimeChecks(a,n.trackStartLines,n.config.lineTerminatorCharacters))})),n.TRACE_INIT("performWarningRuntimeChecks",(function(){n.lexerDefinitionWarning=n.lexerDefinitionWarning.concat(r.performWarningRuntimeChecks(a,n.trackStartLines,n.config.lineTerminatorCharacters))}))),a.modes=a.modes?a.modes:{},i.forEach(a.modes,(function(e,t){a.modes[t]=i.reject(e,(function(e){return i.isUndefined(e)}))}));var c=i.keys(a.modes);if(i.forEach(a.modes,(function(e,a){n.TRACE_INIT("Mode: <"+a+"> processing",(function(){var s;(n.modes.push(a),!1===n.config.skipValidations&&n.TRACE_INIT("validatePatterns",(function(){n.lexerDefinitionErrors=n.lexerDefinitionErrors.concat(r.validatePatterns(e,c))})),i.isEmpty(n.lexerDefinitionErrors))&&(o.augmentTokenTypes(e),n.TRACE_INIT("analyzeTokenTypes",(function(){s=r.analyzeTokenTypes(e,{lineTerminatorCharacters:n.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:n.TRACE_INIT.bind(n)})})),n.patternIdxToConfig[a]=s.patternIdxToConfig,n.charCodeToPatternIdxToConfig[a]=s.charCodeToPatternIdxToConfig,n.emptyGroups=i.merge(n.emptyGroups,s.emptyGroups),n.hasCustom=s.hasCustom||n.hasCustom,n.canModeBeOptimized[a]=s.canBeOptimized)}))})),n.defaultMode=a.defaultMode,!i.isEmpty(n.lexerDefinitionErrors)&&!n.config.deferDefinitionErrorsHandling){var h=i.map(n.lexerDefinitionErrors,(function(e){return e.message})).join("-----------------------\n");throw new Error("Errors detected in definition of Lexer:\n"+h)}i.forEach(n.lexerDefinitionWarning,(function(e){i.PRINT_WARNING(e.message)})),n.TRACE_INIT("Choosing sub-methods implementations",(function(){if(r.SUPPORT_STICKY?(n.chopInput=i.IDENTITY,n.match=n.matchWithTest):(n.updateLastIndex=i.NOOP,n.match=n.matchWithExec),u&&(n.handleModes=i.NOOP),!1===n.trackStartLines&&(n.computeNewColumn=i.IDENTITY),!1===n.trackEndLines&&(n.updateTokenEndLineColumnLocation=i.NOOP),/full/i.test(n.config.positionTracking))n.createTokenInstance=n.createFullToken;else if(/onlyStart/i.test(n.config.positionTracking))n.createTokenInstance=n.createStartOnlyToken;else{if(!/onlyOffset/i.test(n.config.positionTracking))throw Error('Invalid <positionTracking> config option: "'+n.config.positionTracking+'"');n.createTokenInstance=n.createOffsetOnlyToken}n.hasCustom?(n.addToken=n.addTokenUsingPush,n.handlePayload=n.handlePayloadWithCustom):(n.addToken=n.addTokenUsingMemberAccess,n.handlePayload=n.handlePayloadNoCustom)})),n.TRACE_INIT("Failed Optimization Warnings",(function(){var e=i.reduce(n.canModeBeOptimized,(function(e,t,n){return!1===t&&e.push(n),e}),[]);if(t.ensureOptimizations&&!i.isEmpty(e))throw Error("Lexer Modes: < "+e.join(", ")+' > cannot be optimized.\n\t Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\n\t Or inspect the console log for details on how to resolve these issues.')})),n.TRACE_INIT("clearRegExpParserCache",(function(){s.clearRegExpParserCache()})),n.TRACE_INIT("toFastProperties",(function(){i.toFastProperties(n)}))}))}return e.prototype.tokenize=function(e,t){if(void 0===t&&(t=this.defaultMode),!i.isEmpty(this.lexerDefinitionErrors)){var n=i.map(this.lexerDefinitionErrors,(function(e){return e.message})).join("-----------------------\n");throw new Error("Unable to Tokenize because Errors detected in definition of Lexer:\n"+n)}return this.tokenizeInternal(e,t)},e.prototype.tokenizeInternal=function(e,t){var n,o,a,s,l,u,c,h,f,p,d,m,g,v,y=this,T=e,E=T.length,S=0,x=0,O=this.hasCustom?0:Math.floor(e.length/10),C=new Array(O),b=[],k=this.trackStartLines?1:void 0,N=this.trackStartLines?1:void 0,L=r.cloneEmptyGroups(this.emptyGroups),A=this.trackStartLines,R=this.config.lineTerminatorsPattern,w=0,I=[],M=[],_=[],P=[];Object.freeze(P);var D=void 0;function F(){return I}function U(e){var t=r.charCodeToOptimizedIndex(e),n=M[t];return void 0===n?P:n}var W,B=function(e){if(1===_.length&&void 0===e.tokenType.PUSH_MODE){var t=y.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);b.push({offset:e.startOffset,line:void 0!==e.startLine?e.startLine:void 0,column:void 0!==e.startColumn?e.startColumn:void 0,length:e.image.length,message:t})}else{_.pop();var n=i.last(_);I=y.patternIdxToConfig[n],M=y.charCodeToPatternIdxToConfig[n],w=I.length;var r=y.canModeBeOptimized[n]&&!1===y.config.safeMode;D=M&&r?U:F}};function H(e){_.push(e),M=this.charCodeToPatternIdxToConfig[e],I=this.patternIdxToConfig[e],w=I.length,w=I.length;var t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;D=M&&t?U:F}for(H.call(this,t);S<E;){l=null;var G=T.charCodeAt(S),z=D(G),j=z.length;for(n=0;n<j;n++){var V=(W=z[n]).pattern;if(u=null,!1!==(te=W.short)?G===te&&(l=V):!0===W.isCustom?null!==(v=V.exec(T,S,C,L))?(l=v[0],void 0!==v.payload&&(u=v.payload)):l=null:(this.updateLastIndex(V,S),l=this.match(V,e,S)),null!==l){if(void 0!==(s=W.longerAlt)){var K=I[s],Y=K.pattern;c=null,!0===K.isCustom?null!==(v=Y.exec(T,S,C,L))?(a=v[0],void 0!==v.payload&&(c=v.payload)):a=null:(this.updateLastIndex(Y,S),a=this.match(Y,e,S)),a&&a.length>l.length&&(l=a,u=c,W=K)}break}}if(null!==l){if(h=l.length,void 0!==(f=W.group)&&(p=W.tokenTypeIdx,d=this.createTokenInstance(l,S,p,W.tokenType,k,N,h),this.handlePayload(d,u),!1===f?x=this.addToken(C,x,d):L[f].push(d)),e=this.chopInput(e,h),S+=h,N=this.computeNewColumn(N,h),!0===A&&!0===W.canLineTerminator){var X=0,$=void 0,q=void 0;R.lastIndex=0;do{!0===($=R.test(l))&&(q=R.lastIndex-1,X++)}while(!0===$);0!==X&&(k+=X,N=h-q,this.updateTokenEndLineColumnLocation(d,f,q,X,k,N,h))}this.handleModes(W,B,H,d)}else{for(var Z=S,J=k,Q=N,ee=!1;!ee&&S<E;)for(T.charCodeAt(S),e=this.chopInput(e,1),S++,o=0;o<w;o++){var te,ne=I[o];V=ne.pattern;if(!1!==(te=ne.short)?T.charCodeAt(S)===te&&(ee=!0):!0===ne.isCustom?ee=null!==V.exec(T,S,C,L):(this.updateLastIndex(V,S),ee=null!==V.exec(e)),!0===ee)break}m=S-Z,g=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(T,Z,m,J,Q),b.push({offset:Z,line:J,column:Q,length:m,message:g})}}return this.hasCustom||(C.length=x),{tokens:C,groups:L,errors:b}},e.prototype.handleModes=function(e,t,n,r){if(!0===e.pop){var i=e.push;t(r),void 0!==i&&n.call(this,i)}else void 0!==e.push&&n.call(this,e.push)},e.prototype.chopInput=function(e,t){return e.substring(t)},e.prototype.updateLastIndex=function(e,t){e.lastIndex=t},e.prototype.updateTokenEndLineColumnLocation=function(e,t,n,r,i,o,a){var s,l;void 0!==t&&(l=(s=n===a-1)?-1:0,1===r&&!0===s||(e.endLine=i+l,e.endColumn=o-1-l))},e.prototype.computeNewColumn=function(e,t){return e+t},e.prototype.createTokenInstance=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return null},e.prototype.createOffsetOnlyToken=function(e,t,n,r){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:r}},e.prototype.createStartOnlyToken=function(e,t,n,r,i,o){return{image:e,startOffset:t,startLine:i,startColumn:o,tokenTypeIdx:n,tokenType:r}},e.prototype.createFullToken=function(e,t,n,r,i,o,a){return{image:e,startOffset:t,endOffset:t+a-1,startLine:i,endLine:i,startColumn:o,endColumn:o+a-1,tokenTypeIdx:n,tokenType:r}},e.prototype.addToken=function(e,t,n){return 666},e.prototype.addTokenUsingPush=function(e,t,n){return e.push(n),t},e.prototype.addTokenUsingMemberAccess=function(e,t,n){return e[t]=n,++t},e.prototype.handlePayload=function(e,t){},e.prototype.handlePayloadNoCustom=function(e,t){},e.prototype.handlePayloadWithCustom=function(e,t){null!==t&&(e.payload=t)},e.prototype.match=function(e,t,n){return null},e.prototype.matchWithTest=function(e,t,n){return!0===e.test(t)?t.substring(n,e.lastIndex):null},e.prototype.matchWithExec=function(e,t){var n=e.exec(t);return null!==n?n[0]:n},e.prototype.TRACE_INIT=function(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;var n=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(n+"--\x3e <"+e+">");var r=i.timer(t),o=r.time,a=r.value,s=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(n+"<-- <"+e+"> time: "+o+"ms"),this.traceInitIndent--,a}return t()},e.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",e.NA=/NOT_APPLICABLE/,e}();t.Lexer=u},8759:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=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])})(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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.canMatchCharCode=t.firstCharOptimizedIndices=t.getOptimizedStartCodesIndices=t.failedOptimizationPrefixMsg=void 0;var o=n(4556),a=n(8877),s=n(4811),l=n(4879),u="Complement Sets are not supported for first char optimization";function c(e,t,n){switch(e.type){case"Disjunction":for(var r=0;r<e.value.length;r++)c(e.value[r],t,n);break;case"Alternative":var i=e.value;for(r=0;r<i.length;r++){var o=i[r];switch(o.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}var s=o;switch(s.type){case"Character":h(s.value,t,n);break;case"Set":if(!0===s.complement)throw Error(u);a.forEach(s.value,(function(e){if("number"==typeof e)h(e,t,n);else{var r=e;if(!0===n)for(var i=r.from;i<=r.to;i++)h(i,t,n);else{for(i=r.from;i<=r.to&&i<l.minOptimizationVal;i++)h(i,t,n);if(r.to>=l.minOptimizationVal)for(var o=r.from>=l.minOptimizationVal?r.from:l.minOptimizationVal,a=r.to,s=l.charCodeToOptimizedIndex(o),u=l.charCodeToOptimizedIndex(a),c=s;c<=u;c++)t[c]=c}}}));break;case"Group":c(s.value,t,n);break;default:throw Error("Non Exhaustive Match")}var f=void 0!==s.quantifier&&0===s.quantifier.atLeast;if("Group"===s.type&&!1===p(s)||"Group"!==s.type&&!1===f)break}break;default:throw Error("non exhaustive match!")}return a.values(t)}function h(e,t,n){var r=l.charCodeToOptimizedIndex(e);t[r]=r,!0===n&&function(e,t){var n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){t[i=l.charCodeToOptimizedIndex(r.charCodeAt(0))]=i}else{var i,o=n.toLowerCase();if(o!==n)t[i=l.charCodeToOptimizedIndex(o.charCodeAt(0))]=i}}(e,t)}function f(e,t){return a.find(e.value,(function(e){if("number"==typeof e)return a.contains(t,e);var n=e;return void 0!==a.find(t,(function(e){return n.from<=e&&e<=n.to}))}))}function p(e){return!(!e.quantifier||0!==e.quantifier.atLeast)||!!e.value&&(a.isArray(e.value)?a.every(e.value,p):p(e.value))}t.failedOptimizationPrefixMsg='Unable to use "first char" lexer optimizations:\n',t.getOptimizedStartCodesIndices=function(e,n){void 0===n&&(n=!1);try{var r=s.getRegExpAst(e);return c(r.value,{},r.flags.ignoreCase)}catch(r){if(r.message===u)n&&a.PRINT_WARNING(t.failedOptimizationPrefixMsg+"\tUnable to optimize: < "+e.toString()+" >\n\tComplement Sets cannot be automatically optimized.\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.");else{var i="";n&&(i="\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details."),a.PRINT_ERROR(t.failedOptimizationPrefixMsg+"\n\tFailed parsing: < "+e.toString()+" >\n\tUsing the regexp-to-ast library version: "+o.VERSION+"\n\tPlease open an issue at: https://github.com/bd82/regexp-to-ast/issues"+i)}}return[]},t.firstCharOptimizedIndices=c;var d=function(e){function t(t){var n=e.call(this)||this;return n.targetCharCodes=t,n.found=!1,n}return i(t,e),t.prototype.visitChildren=function(t){if(!0!==this.found){switch(t.type){case"Lookahead":return void this.visitLookahead(t);case"NegativeLookahead":return void this.visitNegativeLookahead(t)}e.prototype.visitChildren.call(this,t)}},t.prototype.visitCharacter=function(e){a.contains(this.targetCharCodes,e.value)&&(this.found=!0)},t.prototype.visitSet=function(e){e.complement?void 0===f(e,this.targetCharCodes)&&(this.found=!0):void 0!==f(e,this.targetCharCodes)&&(this.found=!0)},t}(o.BaseRegExpVisitor);t.canMatchCharCode=function(e,t){if(t instanceof RegExp){var n=s.getRegExpAst(t),r=new d(e);return r.visit(n),r.found}return void 0!==a.find(t,(function(t){return a.contains(e,t.charCodeAt(0))}))}},4811:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clearRegExpParserCache=t.getRegExpAst=void 0;var r=n(4556),i={},o=new r.RegExpParser;t.getRegExpAst=function(e){var t=e.toString();if(i.hasOwnProperty(t))return i[t];var n=o.pattern(t);return i[t]=n,n},t.clearRegExpParserCache=function(){i={}}},6570:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isTokenType=t.hasExtendingTokensTypesMapProperty=t.hasExtendingTokensTypesProperty=t.hasCategoriesProperty=t.hasShortKeyProperty=t.singleAssignCategoriesToksMap=t.assignCategoriesMapProp=t.assignCategoriesTokensProp=t.assignTokenDefaultProps=t.expandCategories=t.augmentTokenTypes=t.tokenIdxToClass=t.tokenShortNameIdx=t.tokenStructuredMatcherNoCategories=t.tokenStructuredMatcher=void 0;var r=n(8877);function i(e){for(var t=r.cloneArr(e),n=e,i=!0;i;){n=r.compact(r.flatten(r.map(n,(function(e){return e.CATEGORIES}))));var o=r.difference(n,t);t=t.concat(o),r.isEmpty(o)?i=!1:n=o}return t}function o(e){r.forEach(e,(function(e){u(e)||(t.tokenIdxToClass[t.tokenShortNameIdx]=e,e.tokenTypeIdx=t.tokenShortNameIdx++),c(e)&&!r.isArray(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),c(e)||(e.CATEGORIES=[]),h(e)||(e.categoryMatches=[]),f(e)||(e.categoryMatchesMap={})}))}function a(e){r.forEach(e,(function(e){e.categoryMatches=[],r.forEach(e.categoryMatchesMap,(function(n,r){e.categoryMatches.push(t.tokenIdxToClass[r].tokenTypeIdx)}))}))}function s(e){r.forEach(e,(function(e){l([],e)}))}function l(e,t){r.forEach(e,(function(e){t.categoryMatchesMap[e.tokenTypeIdx]=!0})),r.forEach(t.CATEGORIES,(function(n){var i=e.concat(t);r.contains(i,n)||l(i,n)}))}function u(e){return r.has(e,"tokenTypeIdx")}function c(e){return r.has(e,"CATEGORIES")}function h(e){return r.has(e,"categoryMatches")}function f(e){return r.has(e,"categoryMatchesMap")}t.tokenStructuredMatcher=function(e,t){var n=e.tokenTypeIdx;return n===t.tokenTypeIdx||!0===t.isParent&&!0===t.categoryMatchesMap[n]},t.tokenStructuredMatcherNoCategories=function(e,t){return e.tokenTypeIdx===t.tokenTypeIdx},t.tokenShortNameIdx=1,t.tokenIdxToClass={},t.augmentTokenTypes=function(e){var t=i(e);o(t),s(t),a(t),r.forEach(t,(function(e){e.isParent=e.categoryMatches.length>0}))},t.expandCategories=i,t.assignTokenDefaultProps=o,t.assignCategoriesTokensProp=a,t.assignCategoriesMapProp=s,t.singleAssignCategoriesToksMap=l,t.hasShortKeyProperty=u,t.hasCategoriesProperty=c,t.hasExtendingTokensTypesProperty=h,t.hasExtendingTokensTypesMapProperty=f,t.isTokenType=function(e){return r.has(e,"tokenTypeIdx")}},8980:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tokenMatcher=t.createTokenInstance=t.EOF=t.createToken=t.hasTokenLabel=t.tokenName=t.tokenLabel=void 0;var r=n(8877),i=n(8200),o=n(6570);function a(e){return r.isString(e.LABEL)&&""!==e.LABEL}t.tokenLabel=function(e){return a(e)?e.LABEL:e.name},t.tokenName=function(e){return e.name},t.hasTokenLabel=a;var s="parent",l="categories",u="label",c="group",h="push_mode",f="pop_mode",p="longer_alt",d="line_breaks",m="start_chars_hint";function g(e){return function(e){var t=e.pattern,n={};n.name=e.name,r.isUndefined(t)||(n.PATTERN=t);if(r.has(e,s))throw"The parent property is no longer supported.\nSee: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.";r.has(e,l)&&(n.CATEGORIES=e.categories);o.augmentTokenTypes([n]),r.has(e,u)&&(n.LABEL=e.label);r.has(e,c)&&(n.GROUP=e.group);r.has(e,f)&&(n.POP_MODE=e.pop_mode);r.has(e,h)&&(n.PUSH_MODE=e.push_mode);r.has(e,p)&&(n.LONGER_ALT=e.longer_alt);r.has(e,d)&&(n.LINE_BREAKS=e.line_breaks);r.has(e,m)&&(n.START_CHARS_HINT=e.start_chars_hint);return n}(e)}t.createToken=g,t.EOF=g({name:"EOF",pattern:i.Lexer.NA}),o.augmentTokenTypes([t.EOF]),t.createTokenInstance=function(e,t,n,r,i,o,a,s){return{image:t,startOffset:n,endOffset:r,startLine:i,endLine:o,startColumn:a,endColumn:s,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}},t.tokenMatcher=function(e,t){return o.tokenStructuredMatcher(e,t)}},7657:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VERSION=void 0,t.VERSION="9.0.2"},3256:(e,t,n)=>{!function(e){"use strict";var t="CodeMirror-lint-markers",n="CodeMirror-lint-line-";function r(t,n,r){var i=document.createElement("div");function o(t){if(!i.parentNode)return e.off(document,"mousemove",o);i.style.top=Math.max(0,t.clientY-i.offsetHeight-5)+"px",i.style.left=t.clientX+5+"px"}return i.className="CodeMirror-lint-tooltip cm-s-"+t.options.theme,i.appendChild(r.cloneNode(!0)),t.state.lint.options.selfContain?t.getWrapperElement().appendChild(i):document.body.appendChild(i),e.on(document,"mousemove",o),o(n),null!=i.style.opacity&&(i.style.opacity=1),i}function i(e){e.parentNode&&e.parentNode.removeChild(e)}function o(e){e.parentNode&&(null==e.style.opacity&&i(e),e.style.opacity=0,setTimeout((function(){i(e)}),600))}function a(t,n,i,a){var s=r(t,n,i);function l(){e.off(a,"mouseout",l),s&&(o(s),s=null)}var u=setInterval((function(){if(s)for(var e=a;;e=e.parentNode){if(e&&11==e.nodeType&&(e=e.host),e==document.body)return;if(!e){l();break}}if(!s)return clearInterval(u)}),400);e.on(a,"mouseout",l)}function s(e,t,n){this.marked=[],this.options=t,this.timeout=null,this.hasGutter=n,this.onMouseOver=function(t){S(e,t)},this.waitingFor=0}function l(e,t){return t instanceof Function?{getAnnotations:t}:(t&&!0!==t||(t={}),t)}function u(e){var n=e.state.lint;n.hasGutter&&e.clearGutter(t),h(n)&&c(e);for(var r=0;r<n.marked.length;++r)n.marked[r].clear();n.marked.length=0}function c(e){e.eachLine((function(t){var n=t.wrapClass&&/\bCodeMirror-lint-line-\w+\b/.exec(t.wrapClass);n&&e.removeLineClass(t,"wrap",n[0])}))}function h(e){return e.options.highlightLines}function f(t,n,r,i,o){var s=document.createElement("div"),l=s;return s.className="CodeMirror-lint-marker CodeMirror-lint-marker-"+r,i&&((l=s.appendChild(document.createElement("div"))).className="CodeMirror-lint-marker CodeMirror-lint-marker-multiple"),0!=o&&e.on(l,"mouseover",(function(e){a(t,e,n,l)})),s}function p(e,t){return"error"==e?e:t}function d(e){for(var t=[],n=0;n<e.length;++n){var r=e[n],i=r.from.line;(t[i]||(t[i]=[])).push(r)}return t}function m(e){var t=e.severity;t||(t="error");var n=document.createElement("div");return n.className="CodeMirror-lint-message CodeMirror-lint-message-"+t,void 0!==e.messageHTML?n.innerHTML=e.messageHTML:n.appendChild(document.createTextNode(e.message)),n}function g(t,n,r){var i=t.state.lint,o=++i.waitingFor;function a(){o=-1,t.off("change",a)}t.on("change",a),n(t.getValue(),(function(n,r){t.off("change",a),i.waitingFor==o&&(r&&n instanceof e&&(n=r),t.operation((function(){y(t,n)})))}),r,t)}function v(t){var n=t.state.lint;if(n){var r=n.options,i=r.options||r,o=r.getAnnotations||t.getHelper(e.Pos(0,0),"lint");if(o)if(r.async||o.async)g(t,o,i);else{var a=o(t.getValue(),i,t);if(!a)return;a.then?a.then((function(e){t.operation((function(){y(t,e)}))})):t.operation((function(){y(t,a)}))}}}function y(e,r){var i=e.state.lint;if(i){var o=i.options;u(e);for(var a=d(r),s=0;s<a.length;++s){var l=a[s];if(l){var c=[];l=l.filter((function(e){return!(c.indexOf(e.message)>-1)&&c.push(e.message)}));for(var g=null,v=i.hasGutter&&document.createDocumentFragment(),y=0;y<l.length;++y){var T=l[y],E=T.severity;E||(E="error"),g=p(g,E),o.formatAnnotation&&(T=o.formatAnnotation(T)),i.hasGutter&&v.appendChild(m(T)),T.to&&i.marked.push(e.markText(T.from,T.to,{className:"CodeMirror-lint-mark CodeMirror-lint-mark-"+E,__annotation:T}))}i.hasGutter&&e.setGutterMarker(s,t,f(e,v,g,a[s].length>1,i.options.tooltips)),h(i)&&e.addLineClass(s,"wrap",n+g)}}o.onUpdateLinting&&o.onUpdateLinting(r,a,e)}}function T(e){var t=e.state.lint;t&&(clearTimeout(t.timeout),t.timeout=setTimeout((function(){v(e)}),t.options.delay||500))}function E(e,t,n){for(var r=n.target||n.srcElement,i=document.createDocumentFragment(),o=0;o<t.length;o++){var s=t[o];i.appendChild(m(s))}a(e,n,i,r)}function S(e,t){var n=t.target||t.srcElement;if(/\bCodeMirror-lint-mark-/.test(n.className)){for(var r=n.getBoundingClientRect(),i=(r.left+r.right)/2,o=(r.top+r.bottom)/2,a=e.findMarksAt(e.coordsChar({left:i,top:o},"client")),s=[],l=0;l<a.length;++l){var u=a[l].__annotation;u&&s.push(u)}s.length&&E(e,s,t)}}e.defineOption("lint",!1,(function(n,r,i){if(i&&i!=e.Init&&(u(n),!1!==n.state.lint.options.lintOnChange&&n.off("change",T),e.off(n.getWrapperElement(),"mouseover",n.state.lint.onMouseOver),clearTimeout(n.state.lint.timeout),delete n.state.lint),r){for(var o=n.getOption("gutters"),a=!1,c=0;c<o.length;++c)o[c]==t&&(a=!0);var h=n.state.lint=new s(n,l(n,r),a);!1!==h.options.lintOnChange&&n.on("change",T),0!=h.options.tooltips&&"gutter"!=h.options.tooltips&&e.on(n.getWrapperElement(),"mouseover",h.onMouseOver),v(n)}})),e.defineExtension("performLint",(function(){v(this)}))}(n(4631))},790:(e,t,n)=>{!function(e){"use strict";function t(e,t){if(!e.hasOwnProperty(t))throw new Error("Undefined state "+t+" in simple mode")}function n(e,t){if(!e)return/(?:)/;var n="";return e instanceof RegExp?(e.ignoreCase&&(n="i"),e.unicode&&(n+="u"),e=e.source):e=String(e),new RegExp((!1===t?"":"^")+"(?:"+e+")",n)}function r(e){if(!e)return null;if(e.apply)return e;if("string"==typeof e)return e.replace(/\./g," ");for(var t=[],n=0;n<e.length;n++)t.push(e[n]&&e[n].replace(/\./g," "));return t}function i(e,i){(e.next||e.push)&&t(i,e.next||e.push),this.regex=n(e.regex),this.token=r(e.token),this.data=e}function o(e,t){return function(n,r){if(r.pending){var i=r.pending.shift();return 0==r.pending.length&&(r.pending=null),n.pos+=i.text.length,i.token}if(r.local){if(r.local.end&&n.match(r.local.end)){var o=r.local.endToken||null;return r.local=r.localState=null,o}var a;return o=r.local.mode.token(n,r.localState),r.local.endScan&&(a=r.local.endScan.exec(n.current()))&&(n.pos=n.start+a.index),o}for(var l=e[r.state],u=0;u<l.length;u++){var c=l[u],h=(!c.data.sol||n.sol())&&n.match(c.regex);if(h){c.data.next?r.state=c.data.next:c.data.push?((r.stack||(r.stack=[])).push(r.state),r.state=c.data.push):c.data.pop&&r.stack&&r.stack.length&&(r.state=r.stack.pop()),c.data.mode&&s(t,r,c.data.mode,c.token),c.data.indent&&r.indent.push(n.indentation()+t.indentUnit),c.data.dedent&&r.indent.pop();var f=c.token;if(f&&f.apply&&(f=f(h)),h.length>2&&c.token&&"string"!=typeof c.token){for(var p=2;p<h.length;p++)h[p]&&(r.pending||(r.pending=[])).push({text:h[p],token:c.token[p-1]});return n.backUp(h[0].length-(h[1]?h[1].length:0)),f[0]}return f&&f.join?f[0]:f}}return n.next(),null}}function a(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;var n=0;for(var r in e)if(e.hasOwnProperty(r)){if(!t.hasOwnProperty(r)||!a(e[r],t[r]))return!1;n++}for(var r in t)t.hasOwnProperty(r)&&n--;return 0==n}function s(t,r,i,o){var s;if(i.persistent)for(var l=r.persistentStates;l&&!s;l=l.next)(i.spec?a(i.spec,l.spec):i.mode==l.mode)&&(s=l);var u=s?s.mode:i.mode||e.getMode(t,i.spec),c=s?s.state:e.startState(u);i.persistent&&!s&&(r.persistentStates={mode:u,spec:i.spec,state:c,next:r.persistentStates}),r.localState=c,r.local={mode:u,end:i.end&&n(i.end),endScan:i.end&&!1!==i.forceEnd&&n(i.end,!1),endToken:o&&o.join?o[o.length-1]:o}}function l(e,t){for(var n=0;n<t.length;n++)if(t[n]===e)return!0}function u(t,n){return function(r,i,o){if(r.local&&r.local.mode.indent)return r.local.mode.indent(r.localState,i,o);if(null==r.indent||r.local||n.dontIndentStates&&l(r.state,n.dontIndentStates)>-1)return e.Pass;var a=r.indent.length-1,s=t[r.state];e:for(;;){for(var u=0;u<s.length;u++){var c=s[u];if(c.data.dedent&&!1!==c.data.dedentIfLineStart){var h=c.regex.exec(i);if(h&&h[0]){a--,(c.next||c.push)&&(s=t[c.next||c.push]),i=i.slice(h[0].length);continue e}}}break}return a<0?0:r.indent[a]}}e.defineSimpleMode=function(t,n){e.defineMode(t,(function(t){return e.simpleMode(t,n)}))},e.simpleMode=function(n,r){t(r,"start");var a={},s=r.meta||{},l=!1;for(var c in r)if(c!=s&&r.hasOwnProperty(c))for(var h=a[c]=[],f=r[c],p=0;p<f.length;p++){var d=f[p];h.push(new i(d,r)),(d.indent||d.dedent)&&(l=!0)}var m={startState:function(){return{state:"start",pending:null,local:null,localState:null,indent:l?[]:null}},copyState:function(t){var n={state:t.state,pending:t.pending,local:t.local,localState:null,indent:t.indent&&t.indent.slice(0)};t.localState&&(n.localState=e.copyState(t.local.mode,t.localState)),t.stack&&(n.stack=t.stack.slice(0));for(var r=t.persistentStates;r;r=r.next)n.persistentStates={mode:r.mode,spec:r.spec,state:r.state==t.localState?n.localState:e.copyState(r.mode,r.state),next:n.persistentStates};return n},token:o(a,n),innerMode:function(e){return e.local&&{mode:e.local.mode,state:e.localState}},indent:u(a,s)};if(s)for(var g in s)s.hasOwnProperty(g)&&(m[g]=s[g]);return m}}(n(4631))},7165:(e,t,n)=>{!function(e){"use strict";e.runMode=function(t,n,r,i){var o=e.getMode(e.defaults,n),a=i&&i.tabSize||e.defaults.tabSize;if(r.appendChild){var s=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<9),l=r,u=0;l.innerHTML="",r=function(e,t){if("\n"==e)return l.appendChild(document.createTextNode(s?"\r":e)),void(u=0);for(var n="",r=0;;){var i=e.indexOf("\t",r);if(-1==i){n+=e.slice(r),u+=e.length-r;break}u+=i-r,n+=e.slice(r,i);var o=a-u%a;u+=o;for(var c=0;c<o;++c)n+=" ";r=i+1}if(t){var h=l.appendChild(document.createElement("span"));h.className="cm-"+t.replace(/ +/g," cm-"),h.appendChild(document.createTextNode(n))}else l.appendChild(document.createTextNode(n))}}for(var c=e.splitLines(t),h=i&&i.state||e.startState(o),f=0,p=c.length;f<p;++f){f&&r("\n");var d=new e.StringStream(c[f],null,{lookAhead:function(e){return c[f+e]},baseToken:function(){}});for(!d.string&&o.blankLine&&o.blankLine(h);!d.eol();){var m=o.token(d,h);r(d.current(),m,f,d.start,h,o),d.start=d.pos}}}}(n(4631))},4631:function(e){e.exports=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,n=/gecko\/\d/i.test(e),r=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),a=r||i||o,s=a&&(r?document.documentMode||6:+(o||i)[1]),l=!o&&/WebKit\//.test(e),u=l&&/Qt\/\d+\.\d+/.test(e),c=!o&&/Chrome\//.test(e),h=/Opera\//.test(e),f=/Apple Computer/.test(navigator.vendor),p=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),d=/PhantomJS/.test(e),m=f&&(/Mobile\/\w+/.test(e)||navigator.maxTouchPoints>2),g=/Android/.test(e),v=m||g||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=m||/Mac/.test(t),T=/\bCrOS\b/.test(e),E=/win/i.test(t),S=h&&e.match(/Version\/(\d*\.\d*)/);S&&(S=Number(S[1])),S&&S>=15&&(h=!1,l=!0);var x=y&&(u||h&&(null==S||S<12.11)),O=n||a&&s>=9;function C(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var b,k=function(e,t){var n=e.className,r=C(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function N(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function L(e,t){return N(e).appendChild(t)}function A(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function R(e,t,n,r){var i=A(e,t,n,r);return i.setAttribute("role","presentation"),i}function w(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function I(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function M(e,t){var n=e.className;C(t).test(n)||(e.className+=(n?" ":"")+t)}function _(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!C(n[r]).test(t)&&(t+=" "+n[r]);return t}b=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(e){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};var P=function(e){e.select()};function D(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function F(e,t,n){for(var r in t||(t={}),e)!e.hasOwnProperty(r)||!1===n&&t.hasOwnProperty(r)||(t[r]=e[r]);return t}function U(e,t,n,r,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=r||0,a=i||0;;){var s=e.indexOf("\t",o);if(s<0||s>=t)return a+(t-o);a+=s-o,a+=n-a%n,o=s+1}}m?P=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:a&&(P=function(e){try{e.select()}catch(e){}});var W=function(){this.id=null,this.f=null,this.time=0,this.handler=D(this.onTimeout,this)};function B(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}W.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},W.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};var H=50,G={toString:function(){return"CodeMirror.Pass"}},z={scroll:!1},j={origin:"*mouse"},V={origin:"+move"};function K(e,t,n){for(var r=0,i=0;;){var o=e.indexOf("\t",r);-1==o&&(o=e.length);var a=o-r;if(o==e.length||i+a>=t)return r+Math.min(a,t-i);if(i+=o-r,r=o+1,(i+=n-i%n)>=t)return r}}var Y=[""];function X(e){for(;Y.length<=e;)Y.push($(Y)+" ");return Y[e]}function $(e){return e[e.length-1]}function q(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Z(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function J(){}function Q(e,t){var n;return Object.create?n=Object.create(e):(J.prototype=e,n=new J),t&&F(t,n),n}var ee=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function te(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||ee.test(e))}function ne(e,t){return t?!!(t.source.indexOf("\\w")>-1&&te(e))||t.test(e):te(e)}function re(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ie=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function oe(e){return e.charCodeAt(0)>=768&&ie.test(e)}function ae(e,t,n){for(;(n<0?t>0:t<e.length)&&oe(e.charAt(t));)t+=n;return t}function se(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function le(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<n&&a.to>t||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}var ue=null;function ce(e,t,n){var r;ue=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:ue=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:ue=i)}return null!=r?r:ue}var he=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(n){return n<=247?e.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1785?t.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":8204==n?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,a=/[Lb1n]/,s=/[1n]/;function l(e,t,n){this.level=e,this.from=t,this.to=n}return function(e,t){var u="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!r.test(e))return!1;for(var c=e.length,h=[],f=0;f<c;++f)h.push(n(e.charCodeAt(f)));for(var p=0,d=u;p<c;++p){var m=h[p];"m"==m?h[p]=d:d=m}for(var g=0,v=u;g<c;++g){var y=h[g];"1"==y&&"r"==v?h[g]="n":o.test(y)&&(v=y,"r"==y&&(h[g]="R"))}for(var T=1,E=h[0];T<c-1;++T){var S=h[T];"+"==S&&"1"==E&&"1"==h[T+1]?h[T]="1":","!=S||E!=h[T+1]||"1"!=E&&"n"!=E||(h[T]=E),E=S}for(var x=0;x<c;++x){var O=h[x];if(","==O)h[x]="N";else if("%"==O){var C=void 0;for(C=x+1;C<c&&"%"==h[C];++C);for(var b=x&&"!"==h[x-1]||C<c&&"1"==h[C]?"1":"N",k=x;k<C;++k)h[k]=b;x=C-1}}for(var N=0,L=u;N<c;++N){var A=h[N];"L"==L&&"1"==A?h[N]="L":o.test(A)&&(L=A)}for(var R=0;R<c;++R)if(i.test(h[R])){var w=void 0;for(w=R+1;w<c&&i.test(h[w]);++w);for(var I="L"==(R?h[R-1]:u),M=I==("L"==(w<c?h[w]:u))?I?"L":"R":u,_=R;_<w;++_)h[_]=M;R=w-1}for(var P,D=[],F=0;F<c;)if(a.test(h[F])){var U=F;for(++F;F<c&&a.test(h[F]);++F);D.push(new l(0,U,F))}else{var W=F,B=D.length,H="rtl"==t?1:0;for(++F;F<c&&"L"!=h[F];++F);for(var G=W;G<F;)if(s.test(h[G])){W<G&&(D.splice(B,0,new l(1,W,G)),B+=H);var z=G;for(++G;G<F&&s.test(h[G]);++G);D.splice(B,0,new l(2,z,G)),B+=H,W=G}else++G;W<F&&D.splice(B,0,new l(1,W,F))}return"ltr"==t&&(1==D[0].level&&(P=e.match(/^\s+/))&&(D[0].from=P[0].length,D.unshift(new l(0,0,P[0].length))),1==$(D).level&&(P=e.match(/\s+$/))&&($(D).to-=P[0].length,D.push(new l(0,c-P[0].length,c)))),"rtl"==t?D.reverse():D}}();function fe(e,t){var n=e.order;return null==n&&(n=e.order=he(e.text,t)),n}var pe=[],de=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||pe).concat(n)}};function me(e,t){return e._handlers&&e._handlers[t]||pe}function ge(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var o=B(i,n);o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function ve(e,t){var n=me(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function ye(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),ve(e,n||t.type,e,t),Ce(t)||t.codemirrorIgnore}function Te(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)-1==B(n,t[r])&&n.push(t[r])}function Ee(e,t){return me(e,t).length>0}function Se(e){e.prototype.on=function(e,t){de(this,e,t)},e.prototype.off=function(e,t){ge(this,e,t)}}function xe(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Oe(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Ce(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function be(e){xe(e),Oe(e)}function ke(e){return e.target||e.srcElement}function Ne(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var Le,Ae,Re=function(){if(a&&s<9)return!1;var e=A("div");return"draggable"in e||"dragDrop"in e}();function we(e){if(null==Le){var t=A("span","");L(e,A("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Le=t.offsetWidth<=1&&t.offsetHeight>2&&!(a&&s<8))}var n=Le?A("span",""):A("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Ie(e){if(null!=Ae)return Ae;var t=L(e,document.createTextNode("AخA")),n=b(t,0,1).getBoundingClientRect(),r=b(t,1,2).getBoundingClientRect();return N(e),!(!n||n.left==n.right)&&(Ae=r.right-n.right<3)}var Me,_e=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Pe=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},De="oncopy"in(Me=A("div"))||(Me.setAttribute("oncopy","return;"),"function"==typeof Me.oncopy),Fe=null;function Ue(e){if(null!=Fe)return Fe;var t=L(e,A("span","x")),n=t.getBoundingClientRect(),r=b(t,0,1).getBoundingClientRect();return Fe=Math.abs(n.left-r.left)>1}var We={},Be={};function He(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),We[e]=t}function Ge(e,t){Be[e]=t}function ze(e){if("string"==typeof e&&Be.hasOwnProperty(e))e=Be[e];else if(e&&"string"==typeof e.name&&Be.hasOwnProperty(e.name)){var t=Be[e.name];"string"==typeof t&&(t={name:t}),(e=Q(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ze("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ze("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function je(e,t){t=ze(t);var n=We[t.name];if(!n)return je(e,"text/plain");var r=n(e,t);if(Ve.hasOwnProperty(t.name)){var i=Ve[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var Ve={};function Ke(e,t){F(t,Ve.hasOwnProperty(e)?Ve[e]:Ve[e]={})}function Ye(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Xe(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode;return n||{mode:e,state:t}}function $e(e,t,n){return!e.startState||e.startState(t,n)}var qe=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function Ze(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t<o){n=i;break}t-=o}return n.lines[t]}function Je(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,(function(e){var o=e.text;i==n.line&&(o=o.slice(0,n.ch)),i==t.line&&(o=o.slice(t.ch)),r.push(o),++i})),r}function Qe(e,t,n){var r=[];return e.iter(t,n,(function(e){r.push(e.text)})),r}function et(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function tt(e){if(null==e.parent)return null;for(var t=e.parent,n=B(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function nt(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(t<o){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var a=0;a<e.lines.length;++a){var s=e.lines[a].height;if(t<s)break;t-=s}return n+a}function rt(e,t){return t>=e.first&&t<e.first+e.size}function it(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function ot(e,t,n){if(void 0===n&&(n=null),!(this instanceof ot))return new ot(e,t,n);this.line=e,this.ch=t,this.sticky=n}function at(e,t){return e.line-t.line||e.ch-t.ch}function st(e,t){return e.sticky==t.sticky&&0==at(e,t)}function lt(e){return ot(e.line,e.ch)}function ut(e,t){return at(e,t)<0?t:e}function ct(e,t){return at(e,t)<0?e:t}function ht(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ft(e,t){if(t.line<e.first)return ot(e.first,0);var n=e.first+e.size-1;return t.line>n?ot(n,Ze(e,n).text.length):pt(t,Ze(e,t.line).text.length)}function pt(e,t){var n=e.ch;return null==n||n>t?ot(e.line,t):n<0?ot(e.line,0):e}function dt(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ft(e,t[r]);return n}qe.prototype.eol=function(){return this.pos>=this.string.length},qe.prototype.sol=function(){return this.pos==this.lineStart},qe.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},qe.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},qe.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},qe.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},qe.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},qe.prototype.skipToEnd=function(){this.pos=this.string.length},qe.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},qe.prototype.backUp=function(e){this.pos-=e},qe.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=U(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?U(this.string,this.lineStart,this.tabSize):0)},qe.prototype.indentation=function(){return U(this.string,null,this.tabSize)-(this.lineStart?U(this.string,this.lineStart,this.tabSize):0)},qe.prototype.match=function(e,t,n){if("string"!=typeof e){var r=this.string.slice(this.pos).match(e);return r&&r.index>0?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},qe.prototype.current=function(){return this.string.slice(this.start,this.pos)},qe.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},qe.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},qe.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var mt=function(e,t){this.state=e,this.lookAhead=t},gt=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function vt(e,t,n,r){var i=[e.state.modeGen],o={};kt(e,t.text,e.doc.mode,n,(function(e,t){return i.push(e,t)}),o,r);for(var a=n.state,s=function(r){n.baseTokens=i;var s=e.state.overlays[r],l=1,u=0;n.state=!0,kt(e,t.text,s.mode,n,(function(e,t){for(var n=l;u<e;){var r=i[l];r>e&&i.splice(l,1,e,i[l+1],r),l+=2,u=Math.min(e,r)}if(t)if(s.opaque)i.splice(n,l-n,e,"overlay "+t),l=n+2;else for(;n<l;n+=2){var o=i[n+1];i[n+1]=(o?o+" ":"")+"overlay "+t}}),o),n.state=a,n.baseTokens=null,n.baseTokenPos=1},l=0;l<e.state.overlays.length;++l)s(l);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function yt(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Tt(e,tt(t)),i=t.text.length>e.options.maxHighlightLength&&Ye(e.doc.mode,r.state),o=vt(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Tt(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new gt(r,!0,t);var o=Nt(e,t,n),a=o>r.first&&Ze(r,o-1).stateAfter,s=a?gt.fromSaved(r,a,o):new gt(r,$e(r.mode),o);return r.iter(o,t,(function(n){Et(e,n.text,s);var r=s.line;n.stateAfter=r==t-1||r%5==0||r>=i.viewFrom&&r<i.viewTo?s.save():null,s.nextLine()})),n&&(r.modeFrontier=s.line),s}function Et(e,t,n,r){var i=e.doc.mode,o=new qe(t,e.options.tabSize,n);for(o.start=o.pos=r||0,""==t&&St(i,n.state);!o.eol();)xt(i,o,n.state),o.start=o.pos}function St(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=Xe(e,t);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function xt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Xe(e,n).mode);var o=e.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}gt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},gt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},gt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},gt.fromSaved=function(e,t,n){return t instanceof mt?new gt(e,Ye(e.mode,t.state),n,t.lookAhead):new gt(e,Ye(e.mode,t),n)},gt.prototype.save=function(e){var t=!1!==e?Ye(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new mt(t,this.maxLookAhead):t};var Ot=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Ct(e,t,n,r){var i,o,a=e.doc,s=a.mode,l=Ze(a,(t=ft(a,t)).line),u=Tt(e,t.line,n),c=new qe(l.text,e.options.tabSize,u);for(r&&(o=[]);(r||c.pos<t.ch)&&!c.eol();)c.start=c.pos,i=xt(s,c,u.state),r&&o.push(new Ot(c,i,Ye(a.mode,u.state)));return r?o:new Ot(c,i,u.state)}function bt(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";null==t[r]?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function kt(e,t,n,r,i,o,a){var s=n.flattenSpans;null==s&&(s=e.options.flattenSpans);var l,u=0,c=null,h=new qe(t,e.options.tabSize,r),f=e.options.addModeClass&&[null];for(""==t&&bt(St(n,r.state),o);!h.eol();){if(h.pos>e.options.maxHighlightLength?(s=!1,a&&Et(e,t,r,h.pos),h.pos=t.length,l=null):l=bt(xt(n,h,r.state,f),o),f){var p=f[0].name;p&&(l="m-"+(l?p+" "+l:p))}if(!s||c!=l){for(;u<h.start;)i(u=Math.min(h.start,u+5e3),c);c=l}h.start=h.pos}for(;u<h.pos;){var d=Math.min(h.pos,u+5e3);i(d,c),u=d}}function Nt(e,t,n){for(var r,i,o=e.doc,a=n?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;s>a;--s){if(s<=o.first)return o.first;var l=Ze(o,s-1),u=l.stateAfter;if(u&&(!n||s+(u instanceof mt?u.lookAhead:0)<=o.modeFrontier))return s;var c=U(l.text,null,e.options.tabSize);(null==i||r>c)&&(i=s-1,r=c)}return i}function Lt(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var n=e.first,r=t-1;r>n;r--){var i=Ze(e,r).stateAfter;if(i&&(!(i instanceof mt)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}}var At=!1,Rt=!1;function wt(){At=!0}function It(){Rt=!0}function Mt(e,t,n){this.marker=e,this.from=t,this.to=n}function _t(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Pt(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Dt(e,t,n){var r=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet));r&&r.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],r&&r.add(e.markedSpans)),t.marker.attachLine(e)}function Ft(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;if(null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==a.type&&(!n||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new Mt(a,o.from,s?null:o.to))}}return r}function Ut(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;if(null==o.to||(a.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new Mt(a,s?null:o.from-t,null==o.to?null:o.to-t))}}return r}function Wt(e,t){if(t.full)return null;var n=rt(e,t.from.line)&&Ze(e,t.from.line).markedSpans,r=rt(e,t.to.line)&&Ze(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,a=0==at(t.from,t.to),s=Ft(n,i,a),l=Ut(r,o,a),u=1==t.text.length,c=$(t.text).length+(u?i:0);if(s)for(var h=0;h<s.length;++h){var f=s[h];if(null==f.to){var p=_t(l,f.marker);p?u&&(f.to=null==p.to?null:p.to+c):f.to=i}}if(l)for(var d=0;d<l.length;++d){var m=l[d];null!=m.to&&(m.to+=c),null==m.from?_t(s,m.marker)||(m.from=c,u&&(s||(s=[])).push(m)):(m.from+=c,u&&(s||(s=[])).push(m))}s&&(s=Bt(s)),l&&l!=s&&(l=Bt(l));var g=[s];if(!u){var v,y=t.text.length-2;if(y>0&&s)for(var T=0;T<s.length;++T)null==s[T].to&&(v||(v=[])).push(new Mt(s[T].marker,null,null));for(var E=0;E<y;++E)g.push(v);g.push(l)}return g}function Bt(e){for(var t=0;t<e.length;++t){var n=e[t];null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Ht(e,t,n){var r=null;if(e.iter(t.line,n.line+1,(function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;!n.readOnly||r&&-1!=B(r,n)||(r||(r=[])).push(n)}})),!r)return null;for(var i=[{from:t,to:n}],o=0;o<r.length;++o)for(var a=r[o],s=a.find(0),l=0;l<i.length;++l){var u=i[l];if(!(at(u.to,s.from)<0||at(u.from,s.to)>0)){var c=[l,1],h=at(u.from,s.from),f=at(u.to,s.to);(h<0||!a.inclusiveLeft&&!h)&&c.push({from:u.from,to:s.from}),(f>0||!a.inclusiveRight&&!f)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),l+=c.length-3}}return i}function Gt(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function zt(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function jt(e){return e.inclusiveLeft?-1:0}function Vt(e){return e.inclusiveRight?1:0}function Kt(e,t){var n=e.lines.length-t.lines.length;if(0!=n)return n;var r=e.find(),i=t.find(),o=at(r.from,i.from)||jt(e)-jt(t);if(o)return-o;var a=at(r.to,i.to)||Vt(e)-Vt(t);return a||t.id-e.id}function Yt(e,t){var n,r=Rt&&e.markedSpans;if(r)for(var i=void 0,o=0;o<r.length;++o)(i=r[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!n||Kt(n,i.marker)<0)&&(n=i.marker);return n}function Xt(e){return Yt(e,!0)}function $t(e){return Yt(e,!1)}function qt(e,t){var n,r=Rt&&e.markedSpans;if(r)for(var i=0;i<r.length;++i){var o=r[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!n||Kt(n,o.marker)<0)&&(n=o.marker)}return n}function Zt(e,t,n,r,i){var o=Ze(e,t),a=Rt&&o.markedSpans;if(a)for(var s=0;s<a.length;++s){var l=a[s];if(l.marker.collapsed){var u=l.marker.find(0),c=at(u.from,n)||jt(l.marker)-jt(i),h=at(u.to,r)||Vt(l.marker)-Vt(i);if(!(c>=0&&h<=0||c<=0&&h>=0)&&(c<=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?at(u.to,n)>=0:at(u.to,n)>0)||c>=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?at(u.from,r)<=0:at(u.from,r)<0)))return!0}}}function Jt(e){for(var t;t=Xt(e);)e=t.find(-1,!0).line;return e}function Qt(e){for(var t;t=$t(e);)e=t.find(1,!0).line;return e}function en(e){for(var t,n;t=$t(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function tn(e,t){var n=Ze(e,t),r=Jt(n);return n==r?t:tt(r)}function nn(e,t){if(t>e.lastLine())return t;var n,r=Ze(e,t);if(!rn(e,r))return t;for(;n=$t(r);)r=n.find(1,!0).line;return tt(r)+1}function rn(e,t){var n=Rt&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i)if((r=n[i]).marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&on(e,t,r))return!0}}function on(e,t,n){if(null==n.to){var r=n.marker.find(1,!0);return on(e,r.line,_t(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(null==i.to||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&on(e,t,i))return!0}function an(e){for(var t=0,n=(e=Jt(e)).parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var o=n.parent;o;o=(n=o).parent)for(var a=0;a<o.children.length;++a){var s=o.children[a];if(s==n)break;t+=s.height}return t}function sn(e){if(0==e.height)return 0;for(var t,n=e.text.length,r=e;t=Xt(r);){var i=t.find(0,!0);r=i.from.line,n+=i.from.ch-i.to.ch}for(r=e;t=$t(r);){var o=t.find(0,!0);n-=r.text.length-o.from.ch,n+=(r=o.to.line).text.length-o.to.ch}return n}function ln(e){var t=e.display,n=e.doc;t.maxLine=Ze(n,n.first),t.maxLineLength=sn(t.maxLine),t.maxLineChanged=!0,n.iter((function(e){var n=sn(e);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)}))}var un=function(e,t,n){this.text=e,zt(this,t),this.height=n?n(this):1};function cn(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Gt(e),zt(e,n);var i=r?r(e):1;i!=e.height&&et(e,i)}function hn(e){e.parent=null,Gt(e)}un.prototype.lineNo=function(){return tt(this)},Se(un);var fn={},pn={};function dn(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?pn:fn;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function mn(e,t){var n=R("span",null,null,l?"padding-right: .1px":null),r={pre:R("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0;r.pos=0,r.addToken=vn,Ie(e.display.measure)&&(a=fe(o,e.doc.direction))&&(r.addToken=Tn(r.addToken,a)),r.map=[],Sn(o,r,yt(e,o,t!=e.display.externalMeasured&&tt(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=_(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=_(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(we(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(l){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return ve(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=_(r.pre.className,r.textClass||"")),r}function gn(e){var t=A("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function vn(e,t,n,r,i,o,l){if(t){var u,c=e.splitSpaces?yn(t,e.trailingSpace):t,h=e.cm.state.specialChars,f=!1;if(h.test(t)){u=document.createDocumentFragment();for(var p=0;;){h.lastIndex=p;var d=h.exec(t),m=d?d.index-p:t.length-p;if(m){var g=document.createTextNode(c.slice(p,p+m));a&&s<9?u.appendChild(A("span",[g])):u.appendChild(g),e.map.push(e.pos,e.pos+m,g),e.col+=m,e.pos+=m}if(!d)break;p+=m+1;var v=void 0;if("\t"==d[0]){var y=e.cm.options.tabSize,T=y-e.col%y;(v=u.appendChild(A("span",X(T),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),e.col+=T}else"\r"==d[0]||"\n"==d[0]?((v=u.appendChild(A("span","\r"==d[0]?"␍":"","cm-invalidchar"))).setAttribute("cm-text",d[0]),e.col+=1):((v=e.cm.options.specialCharPlaceholder(d[0])).setAttribute("cm-text",d[0]),a&&s<9?u.appendChild(A("span",[v])):u.appendChild(v),e.col+=1);e.map.push(e.pos,e.pos+1,v),e.pos++}}else e.col+=t.length,u=document.createTextNode(c),e.map.push(e.pos,e.pos+t.length,u),a&&s<9&&(f=!0),e.pos+=t.length;if(e.trailingSpace=32==c.charCodeAt(t.length-1),n||r||i||f||o||l){var E=n||"";r&&(E+=r),i&&(E+=i);var S=A("span",[u],E,o);if(l)for(var x in l)l.hasOwnProperty(x)&&"style"!=x&&"class"!=x&&S.setAttribute(x,l[x]);return e.content.appendChild(S)}e.content.appendChild(u)}}function yn(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!n||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),r+=o,n=" "==o}return r}function Tn(e,t){return function(n,r,i,o,a,s,l){i=i?i+" cm-force-border":"cm-force-border";for(var u=n.pos,c=u+r.length;;){for(var h=void 0,f=0;f<t.length&&!((h=t[f]).to>u&&h.from<=u);f++);if(h.to>=c)return e(n,r,i,o,a,s,l);e(n,r.slice(0,h.to-u),i,o,null,s,l),o=null,r=r.slice(h.to-u),u=h.to}}}function En(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Sn(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,s,l,u,c,h,f,p=i.length,d=0,m=1,g="",v=0;;){if(v==d){l=u=c=s="",f=null,h=null,v=1/0;for(var y=[],T=void 0,E=0;E<r.length;++E){var S=r[E],x=S.marker;if("bookmark"==x.type&&S.from==d&&x.widgetNode)y.push(x);else if(S.from<=d&&(null==S.to||S.to>d||x.collapsed&&S.to==d&&S.from==d)){if(null!=S.to&&S.to!=d&&v>S.to&&(v=S.to,u=""),x.className&&(l+=" "+x.className),x.css&&(s=(s?s+";":"")+x.css),x.startStyle&&S.from==d&&(c+=" "+x.startStyle),x.endStyle&&S.to==v&&(T||(T=[])).push(x.endStyle,S.to),x.title&&((f||(f={})).title=x.title),x.attributes)for(var O in x.attributes)(f||(f={}))[O]=x.attributes[O];x.collapsed&&(!h||Kt(h.marker,x)<0)&&(h=S)}else S.from>d&&v>S.from&&(v=S.from)}if(T)for(var C=0;C<T.length;C+=2)T[C+1]==v&&(u+=" "+T[C]);if(!h||h.from==d)for(var b=0;b<y.length;++b)En(t,0,y[b]);if(h&&(h.from||0)==d){if(En(t,(null==h.to?p+1:h.to)-d,h.marker,null==h.from),null==h.to)return;h.to==d&&(h=!1)}}if(d>=p)break;for(var k=Math.min(p,v);;){if(g){var N=d+g.length;if(!h){var L=N>k?g.slice(0,k-d):g;t.addToken(t,L,a?a+l:l,c,d+L.length==v?u:"",s,f)}if(N>=k){g=g.slice(k-d),d=k;break}d=N,c=""}g=i.slice(o,o=n[m++]),a=dn(n[m++],t.cm.options)}}else for(var A=1;A<n.length;A+=2)t.addToken(t,i.slice(o,o=n[A]),dn(n[A+1],t.cm.options))}function xn(e,t,n){this.line=t,this.rest=en(t),this.size=this.rest?tt($(this.rest))-n+1:1,this.node=this.text=null,this.hidden=rn(e,t)}function On(e,t,n){for(var r,i=[],o=t;o<n;o=r){var a=new xn(e.doc,Ze(e.doc,o),o);r=o+a.size,i.push(a)}return i}var Cn=null;function bn(e){Cn?Cn.ops.push(e):e.ownsGroup=Cn={ops:[e],delayedCallbacks:[]}}function kn(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Nn(e,t){var n=e.ownsGroup;if(n)try{kn(n)}finally{Cn=null,t(n)}}var Ln=null;function An(e,t){var n=me(e,t);if(n.length){var r,i=Array.prototype.slice.call(arguments,2);Cn?r=Cn.delayedCallbacks:Ln?r=Ln:(r=Ln=[],setTimeout(Rn,0));for(var o=function(e){r.push((function(){return n[e].apply(null,i)}))},a=0;a<n.length;++a)o(a)}}function Rn(){var e=Ln;Ln=null;for(var t=0;t<e.length;++t)e[t]()}function wn(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?Pn(e,t):"gutter"==o?Fn(e,t,n,r):"class"==o?Dn(e,t):"widget"==o&&Un(e,t,r)}t.changes=null}function In(e){return e.node==e.text&&(e.node=A("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),a&&s<8&&(e.node.style.zIndex=2)),e.node}function Mn(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=In(t);t.background=r.insertBefore(A("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function _n(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):mn(e,t)}function Pn(e,t){var n=t.text.className,r=_n(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,Dn(e,t)):n&&(t.text.className=n)}function Dn(e,t){Mn(e,t),t.line.wrapClass?In(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Fn(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=In(t);t.gutterBackground=A("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var a=In(t),s=t.gutter=A("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(s.setAttribute("aria-hidden","true"),e.display.input.setUneditable(s),a.insertBefore(s,t.text),t.line.gutterClass&&(s.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=s.appendChild(A("div",it(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var l=0;l<e.display.gutterSpecs.length;++l){var u=e.display.gutterSpecs[l].className,c=o.hasOwnProperty(u)&&o[u];c&&s.appendChild(A("div",[c],"CodeMirror-gutter-elt","left: "+r.gutterLeft[u]+"px; width: "+r.gutterWidth[u]+"px"))}}}function Un(e,t,n){t.alignable&&(t.alignable=null);for(var r=C("CodeMirror-linewidget"),i=t.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Bn(e,t,n)}function Wn(e,t,n,r){var i=_n(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),Dn(e,t),Fn(e,t,n,r),Bn(e,t,r),t.node}function Bn(e,t,n){if(Hn(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Hn(e,t.rest[r],t,n,!1)}function Hn(e,t,n,r,i){if(t.widgets)for(var o=In(n),a=0,s=t.widgets;a<s.length;++a){var l=s[a],u=A("div",[l.node],"CodeMirror-linewidget"+(l.className?" "+l.className:""));l.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),Gn(l,u,n,r),e.display.input.setUneditable(u),i&&l.above?o.insertBefore(u,n.gutter||n.text):o.appendChild(u),An(l,"redraw")}}function Gn(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function zn(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!w(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),L(t.display.measure,A("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function jn(e,t){for(var n=ke(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}function Vn(e){return e.lineSpace.offsetTop}function Kn(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Yn(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=L(e.measure,A("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return isNaN(r.left)||isNaN(r.right)||(e.cachedPaddingH=r),r}function Xn(e){return H-e.display.nativeBarWidth}function $n(e){return e.display.scroller.clientWidth-Xn(e)-e.display.barWidth}function qn(e){return e.display.scroller.clientHeight-Xn(e)-e.display.barHeight}function Zn(e,t,n){var r=e.options.lineWrapping,i=r&&$n(e);if(!t.measure.heights||r&&t.measure.width!=i){var o=t.measure.heights=[];if(r){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),s=0;s<a.length-1;s++){var l=a[s],u=a[s+1];Math.abs(l.bottom-u.bottom)>2&&o.push((l.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Jn(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(tt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Qn(e,t){var n=tt(t=Jt(t)),r=e.display.externalMeasured=new xn(e.doc,t,n);r.lineN=n;var i=r.built=mn(e,r);return r.text=i.pre,L(e.display.lineMeasure,i.pre),r}function er(e,t,n,r){return rr(e,nr(e,t),n,r)}function tr(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Dr(e,t)];var n=e.display.externalMeasured;return n&&t>=n.lineN&&t<n.lineN+n.size?n:void 0}function nr(e,t){var n=tt(t),r=tr(e,n);r&&!r.text?r=null:r&&r.changes&&(wn(e,r,n,wr(e)),e.curOp.forceUpdate=!0),r||(r=Qn(e,t));var i=Jn(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function rr(e,t,n,r,i){t.before&&(n=-1);var o,a=n+(r||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Zn(e,t.view,t.rect),t.hasHeights=!0),(o=lr(e,t,n,r)).bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var ir,or={left:0,right:0,top:0,bottom:0};function ar(e,t,n){for(var r,i,o,a,s,l,u=0;u<e.length;u+=3)if(s=e[u],l=e[u+1],t<s?(i=0,o=1,a="left"):t<l?o=1+(i=t-s):(u==e.length-3||t==l&&e[u+3]>t)&&(i=(o=l-s)-1,t>=l&&(a="right")),null!=i){if(r=e[u+2],s==l&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[2+(u-=3)],a="left";if("right"==n&&i==l-s)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)r=e[(u+=3)+2],a="right";break}return{node:r,start:i,end:o,collapse:a,coverStart:s,coverEnd:l}}function sr(e,t){var n=or;if("left"==t)for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var i=e.length-1;i>=0&&(n=e[i]).left==n.right;i--);return n}function lr(e,t,n,r){var i,o=ar(t.map,n,r),l=o.node,u=o.start,c=o.end,h=o.collapse;if(3==l.nodeType){for(var f=0;f<4;f++){for(;u&&oe(t.line.text.charAt(o.coverStart+u));)--u;for(;o.coverStart+c<o.coverEnd&&oe(t.line.text.charAt(o.coverStart+c));)++c;if((i=a&&s<9&&0==u&&c==o.coverEnd-o.coverStart?l.parentNode.getBoundingClientRect():sr(b(l,u,c).getClientRects(),r)).left||i.right||0==u)break;c=u,u-=1,h="right"}a&&s<11&&(i=ur(e.display.measure,i))}else{var p;u>0&&(h=r="right"),i=e.options.lineWrapping&&(p=l.getClientRects()).length>1?p["right"==r?p.length-1:0]:l.getBoundingClientRect()}if(a&&s<9&&!u&&(!i||!i.left&&!i.right)){var d=l.parentNode.getClientRects()[0];i=d?{left:d.left,right:d.left+Rr(e.display),top:d.top,bottom:d.bottom}:or}for(var m=i.top-t.rect.top,g=i.bottom-t.rect.top,v=(m+g)/2,y=t.view.measure.heights,T=0;T<y.length-1&&!(v<y[T]);T++);var E=T?y[T-1]:0,S=y[T],x={left:("right"==h?i.right:i.left)-t.rect.left,right:("left"==h?i.left:i.right)-t.rect.left,top:E,bottom:S};return i.left||i.right||(x.bogus=!0),e.options.singleCursorHeightPerLine||(x.rtop=m,x.rbottom=g),x}function ur(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Ue(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function cr(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function hr(e){e.display.externalMeasure=null,N(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)cr(e.display.view[t])}function fr(e){hr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function pr(){return c&&g?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function dr(){return c&&g?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function mr(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=zn(e.widgets[n]));return t}function gr(e,t,n,r,i){if(!i){var o=mr(t);n.top+=o,n.bottom+=o}if("line"==r)return n;r||(r="local");var a=an(t);if("local"==r?a+=Vn(e.display):a-=e.display.viewOffset,"page"==r||"window"==r){var s=e.display.lineSpace.getBoundingClientRect();a+=s.top+("window"==r?0:dr());var l=s.left+("window"==r?0:pr());n.left+=l,n.right+=l}return n.top+=a,n.bottom+=a,n}function vr(e,t,n){if("div"==n)return t;var r=t.left,i=t.top;if("page"==n)r-=pr(),i-=dr();else if("local"==n||!n){var o=e.display.sizer.getBoundingClientRect();r+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:r-a.left,top:i-a.top}}function yr(e,t,n,r,i){return r||(r=Ze(e.doc,t.line)),gr(e,r,er(e,r,t.ch,i),n)}function Tr(e,t,n,r,i,o){function a(t,a){var s=rr(e,i,t,a?"right":"left",o);return a?s.left=s.right:s.right=s.left,gr(e,r,s,n)}r=r||Ze(e.doc,t.line),i||(i=nr(e,r));var s=fe(r,e.doc.direction),l=t.ch,u=t.sticky;if(l>=r.text.length?(l=r.text.length,u="before"):l<=0&&(l=0,u="after"),!s)return a("before"==u?l-1:l,"before"==u);function c(e,t,n){return a(n?e-1:e,1==s[t].level!=n)}var h=ce(s,l,u),f=ue,p=c(l,h,"before"==u);return null!=f&&(p.other=c(l,f,"before"!=u)),p}function Er(e,t){var n=0;t=ft(e.doc,t),e.options.lineWrapping||(n=Rr(e.display)*t.ch);var r=Ze(e.doc,t.line),i=an(r)+Vn(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Sr(e,t,n,r,i){var o=ot(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function xr(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return Sr(r.first,0,null,-1,-1);var i=nt(r,n),o=r.first+r.size-1;if(i>o)return Sr(r.first+r.size-1,Ze(r,o).text.length,null,1,1);t<0&&(t=0);for(var a=Ze(r,i);;){var s=kr(e,a,i,t,n),l=qt(a,s.ch+(s.xRel>0||s.outside>0?1:0));if(!l)return s;var u=l.find(1);if(u.line==i)return u;a=Ze(r,i=u.line)}}function Or(e,t,n,r){r-=mr(t);var i=t.text.length,o=se((function(t){return rr(e,n,t-1).bottom<=r}),i,0);return{begin:o,end:i=se((function(t){return rr(e,n,t).top>r}),o,i)}}function Cr(e,t,n,r){return n||(n=nr(e,t)),Or(e,t,n,gr(e,t,rr(e,n,r),"line").top)}function br(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function kr(e,t,n,r,i){i-=an(t);var o=nr(e,t),a=mr(t),s=0,l=t.text.length,u=!0,c=fe(t,e.doc.direction);if(c){var h=(e.options.lineWrapping?Lr:Nr)(e,t,n,o,c,r,i);s=(u=1!=h.level)?h.from:h.to-1,l=u?h.to:h.from-1}var f,p,d=null,m=null,g=se((function(t){var n=rr(e,o,t);return n.top+=a,n.bottom+=a,!!br(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(d=t,m=n),!0)}),s,l),v=!1;if(m){var y=r-m.left<m.right-r,T=y==u;g=d+(T?0:1),p=T?"after":"before",f=y?m.left:m.right}else{u||g!=l&&g!=s||g++,p=0==g?"after":g==t.text.length?"before":rr(e,o,g-(u?1:0)).bottom+a<=i==u?"after":"before";var E=Tr(e,ot(n,g,p),"line",t,o);f=E.left,v=i<E.top?-1:i>=E.bottom?1:0}return Sr(n,g=ae(t.text,g,1),p,v,r-f)}function Nr(e,t,n,r,i,o,a){var s=se((function(s){var l=i[s],u=1!=l.level;return br(Tr(e,ot(n,u?l.to:l.from,u?"before":"after"),"line",t,r),o,a,!0)}),0,i.length-1),l=i[s];if(s>0){var u=1!=l.level,c=Tr(e,ot(n,u?l.from:l.to,u?"after":"before"),"line",t,r);br(c,o,a,!0)&&c.top>a&&(l=i[s-1])}return l}function Lr(e,t,n,r,i,o,a){var s=Or(e,t,r,a),l=s.begin,u=s.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,h=null,f=0;f<i.length;f++){var p=i[f];if(!(p.from>=u||p.to<=l)){var d=rr(e,r,1!=p.level?Math.min(u,p.to)-1:Math.max(l,p.from)).right,m=d<o?o-d+1e9:d-o;(!c||h>m)&&(c=p,h=m)}}return c||(c=i[i.length-1]),c.from<l&&(c={from:l,to:c.to,level:c.level}),c.to>u&&(c={from:c.from,to:u,level:c.level}),c}function Ar(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==ir){ir=A("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)ir.appendChild(document.createTextNode("x")),ir.appendChild(A("br"));ir.appendChild(document.createTextNode("x"))}L(e.measure,ir);var n=ir.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),N(e.measure),n||1}function Rr(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=A("span","xxxxxxxxxx"),n=A("pre",[t],"CodeMirror-line-like");L(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function wr(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var s=e.display.gutterSpecs[a].className;n[s]=o.offsetLeft+o.clientLeft+i,r[s]=o.clientWidth}return{fixedPos:Ir(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ir(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Mr(e){var t=Ar(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Rr(e.display)-3);return function(i){if(rn(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return n?o+(Math.ceil(i.text.length/r)||1)*t:o+t}}function _r(e){var t=e.doc,n=Mr(e);t.iter((function(e){var t=n(e);t!=e.height&&et(e,t)}))}function Pr(e,t,n,r){var i=e.display;if(!n&&"true"==ke(t).getAttribute("cm-not-content"))return null;var o,a,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,a=t.clientY-s.top}catch(e){return null}var l,u=xr(e,o,a);if(r&&u.xRel>0&&(l=Ze(e.doc,u.line).text).length==u.ch){var c=U(l,l.length,e.options.tabSize)-l.length;u=ot(u.line,Math.max(0,Math.round((o-Yn(e.display).left)/Rr(e.display))-c))}return u}function Dr(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if((t-=n[r].size)<0)return r}function Fr(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Rt&&tn(e.doc,t)<i.viewTo&&Wr(e);else if(n<=i.viewFrom)Rt&&nn(e.doc,n+r)>i.viewFrom?Wr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Wr(e);else if(t<=i.viewFrom){var o=Br(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):Wr(e)}else if(n>=i.viewTo){var a=Br(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):Wr(e)}else{var s=Br(e,t,t,-1),l=Br(e,n,n+r,1);s&&l?(i.view=i.view.slice(0,s.index).concat(On(e,s.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=r):Wr(e)}var u=i.externalMeasured;u&&(n<u.lineN?u.lineN+=r:t<u.lineN+u.size&&(i.externalMeasured=null))}function Ur(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var o=r.view[Dr(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==B(a,n)&&a.push(n)}}}function Wr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Br(e,t,n,r){var i,o=Dr(e,t),a=e.display.view;if(!Rt||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var s=e.display.viewFrom,l=0;l<o;l++)s+=a[l].size;if(s!=t){if(r>0){if(o==a.length-1)return null;i=s+a[o].size-t,o++}else i=s-t;t+=i,n+=i}for(;tn(e.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function Hr(e,t,n){var r=e.display;0==r.view.length||t>=r.viewTo||n<=r.viewFrom?(r.view=On(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=On(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Dr(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(On(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Dr(e,n)))),r.viewTo=n}function Gr(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];i.hidden||i.node&&!i.changes||++n}return n}function zr(e){e.display.input.showSelection(e.display.input.prepareSelection())}function jr(e,t){void 0===t&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),a=0;a<n.sel.ranges.length;a++)if(t||a!=n.sel.primIndex){var s=n.sel.ranges[a];if(!(s.from().line>=e.display.viewTo||s.to().line<e.display.viewFrom)){var l=s.empty();(l||e.options.showCursorWhenSelecting)&&Vr(e,s.head,i),l||Yr(e,s,o)}}return r}function Vr(e,t,n){var r=Tr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(A("div"," ","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var o=n.appendChild(A("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=r.other.left+"px",o.style.top=r.other.top+"px",o.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function Kr(e,t){return e.top-t.top||e.left-t.left}function Yr(e,t,n){var r=e.display,i=e.doc,o=document.createDocumentFragment(),a=Yn(e.display),s=a.left,l=Math.max(r.sizerWidth,$n(e)-r.sizer.offsetLeft)-a.right,u="ltr"==i.direction;function c(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),o.appendChild(A("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==n?l-e:n)+"px;\n height: "+(r-t)+"px"))}function h(t,n,r){var o,a,h=Ze(i,t),f=h.text.length;function p(n,r){return yr(e,ot(t,n),"div",h,r)}function d(t,n,r){var i=Cr(e,h,null,t),o="ltr"==n==("after"==r)?"left":"right";return p("after"==r?i.begin:i.end-(/\s/.test(h.text.charAt(i.end-1))?2:1),o)[o]}var m=fe(h,i.direction);return le(m,n||0,null==r?f:r,(function(e,t,i,h){var g="ltr"==i,v=p(e,g?"left":"right"),y=p(t-1,g?"right":"left"),T=null==n&&0==e,E=null==r&&t==f,S=0==h,x=!m||h==m.length-1;if(y.top-v.top<=3){var O=(u?E:T)&&x,C=(u?T:E)&&S?s:(g?v:y).left,b=O?l:(g?y:v).right;c(C,v.top,b-C,v.bottom)}else{var k,N,L,A;g?(k=u&&T&&S?s:v.left,N=u?l:d(e,i,"before"),L=u?s:d(t,i,"after"),A=u&&E&&x?l:y.right):(k=u?d(e,i,"before"):s,N=!u&&T&&S?l:v.right,L=!u&&E&&x?s:y.left,A=u?d(t,i,"after"):l),c(k,v.top,N-k,v.bottom),v.bottom<y.top&&c(s,v.bottom,null,y.top),c(L,y.top,A-L,y.bottom)}(!o||Kr(v,o)<0)&&(o=v),Kr(y,o)<0&&(o=y),(!a||Kr(v,a)<0)&&(a=v),Kr(y,a)<0&&(a=y)})),{start:o,end:a}}var f=t.from(),p=t.to();if(f.line==p.line)h(f.line,f.ch,p.ch);else{var d=Ze(i,f.line),m=Ze(i,p.line),g=Jt(d)==Jt(m),v=h(f.line,f.ch,g?d.text.length+1:null).end,y=h(p.line,g?0:null,p.ch).start;g&&(v.top<y.top-2?(c(v.right,v.top,null,v.bottom),c(s,y.top,y.left,y.bottom)):c(v.right,v.top,y.left-v.right,v.bottom)),v.bottom<y.top&&c(s,v.bottom,null,y.top)}n.appendChild(o)}function Xr(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval((function(){e.hasFocus()||Jr(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function $r(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Zr(e))}function qr(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Jr(e))}),100)}function Zr(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(ve(e,"focus",e,t),e.state.focused=!0,M(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),l&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),Xr(e))}function Jr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(ve(e,"blur",e,t),e.state.focused=!1,k(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function Qr(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],o=e.options.lineWrapping,l=void 0,u=0;if(!i.hidden){if(a&&s<8){var c=i.node.offsetTop+i.node.offsetHeight;l=c-n,n=c}else{var h=i.node.getBoundingClientRect();l=h.bottom-h.top,!o&&i.text.firstChild&&(u=i.text.firstChild.getBoundingClientRect().right-h.left-1)}var f=i.line.height-l;if((f>.005||f<-.005)&&(et(i.line,l),ei(i.line),i.rest))for(var p=0;p<i.rest.length;p++)ei(i.rest[p]);if(u>e.display.sizerWidth){var d=Math.ceil(u/Rr(e.display));d>e.display.maxLineLength&&(e.display.maxLineLength=d,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function ei(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function ti(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Vn(e));var i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=nt(t,r),a=nt(t,i);if(n&&n.ensure){var s=n.ensure.from.line,l=n.ensure.to.line;s<o?(o=s,a=nt(t,an(Ze(t,s))+e.wrapper.clientHeight)):Math.min(l,t.lastLine())>=a&&(o=nt(t,an(Ze(t,l))-e.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function ni(e,t){if(!ye(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!d){var o=A("div","",null,"position: absolute;\n top: "+(t.top-n.viewOffset-Vn(e.display))+"px;\n height: "+(t.bottom-t.top+Xn(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function ri(e,t,n,r){var i;null==r&&(r=0),e.options.lineWrapping||t!=n||(n="before"==t.sticky?ot(t.line,t.ch+1,"before"):t,t=t.ch?ot(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var a=!1,s=Tr(e,t),l=n&&n!=t?Tr(e,n):s,u=oi(e,i={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-r,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+r}),c=e.doc.scrollTop,h=e.doc.scrollLeft;if(null!=u.scrollTop&&(fi(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(a=!0)),null!=u.scrollLeft&&(di(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-h)>1&&(a=!0)),!a)break}return i}function ii(e,t){var n=oi(e,t);null!=n.scrollTop&&fi(e,n.scrollTop),null!=n.scrollLeft&&di(e,n.scrollLeft)}function oi(e,t){var n=e.display,r=Ar(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=qn(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+Kn(n),l=t.top<r,u=t.bottom>s-r;if(t.top<i)a.scrollTop=l?0:t.top;else if(t.bottom>i+o){var c=Math.min(t.top,(u?s:t.bottom)-o);c!=i&&(a.scrollTop=c)}var h=e.options.fixedGutter?0:n.gutters.offsetWidth,f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft-h,p=$n(e)-n.gutters.offsetWidth,d=t.right-t.left>p;return d&&(t.right=t.left+p),t.left<10?a.scrollLeft=0:t.left<f?a.scrollLeft=Math.max(0,t.left+h-(d?0:10)):t.right>p+f-3&&(a.scrollLeft=t.right+(d?0:10)-p),a}function ai(e,t){null!=t&&(ci(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function si(e){ci(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function li(e,t,n){null==t&&null==n||ci(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function ui(e,t){ci(e),e.curOp.scrollToPos=t}function ci(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,hi(e,Er(e,t.from),Er(e,t.to),t.margin))}function hi(e,t,n,r){var i=oi(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});li(e,i.scrollLeft,i.scrollTop)}function fi(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||zi(e,{top:t}),pi(e,t,!0),n&&zi(e),Pi(e,100))}function pi(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function di(e,t,n,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,Yi(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function mi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Kn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Xn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var gi=function(e,t,n){this.cm=n;var r=this.vert=A("div",[A("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=A("div",[A("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),de(r,"scroll",(function(){r.clientHeight&&t(r.scrollTop,"vertical")})),de(i,"scroll",(function(){i.clientWidth&&t(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,a&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};gi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},gi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},gi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},gi.prototype.zeroWidthHack=function(){var e=y&&!p?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new W,this.disableVert=new W},gi.prototype.enableZeroWidthBar=function(e,t,n){function r(){var i=e.getBoundingClientRect();("vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,r)}e.style.pointerEvents="auto",t.set(1e3,r)},gi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var vi=function(){};function yi(e,t){t||(t=mi(e));var n=e.display.barWidth,r=e.display.barHeight;Ti(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Qr(e),Ti(e,mi(e)),n=e.display.barWidth,r=e.display.barHeight}function Ti(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}vi.prototype.update=function(){return{bottom:0,right:0}},vi.prototype.setScrollLeft=function(){},vi.prototype.setScrollTop=function(){},vi.prototype.clear=function(){};var Ei={native:gi,null:vi};function Si(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&k(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ei[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),de(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,n){"horizontal"==n?di(e,t):fi(e,t)}),e),e.display.scrollbars.addClass&&M(e.display.wrapper,e.display.scrollbars.addClass)}var xi=0;function Oi(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++xi,markArrays:null},bn(e.curOp)}function Ci(e){var t=e.curOp;t&&Nn(t,(function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;bi(e)}))}function bi(e){for(var t=e.ops,n=0;n<t.length;n++)ki(t[n]);for(var r=0;r<t.length;r++)Ni(t[r]);for(var i=0;i<t.length;i++)Li(t[i]);for(var o=0;o<t.length;o++)Ai(t[o]);for(var a=0;a<t.length;a++)Ri(t[a])}function ki(e){var t=e.cm,n=t.display;Ui(t),e.updateMaxLine&&ln(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Fi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Ni(e){e.updatedDisplay=e.mustUpdate&&Hi(e.cm,e.update)}function Li(e){var t=e.cm,n=t.display;e.updatedDisplay&&Qr(t),e.barMeasure=mi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=er(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Xn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-$n(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Ai(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&di(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==I();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&yi(t,e.barMeasure),e.updatedDisplay&&Ki(t,e.barMeasure),e.selectionChanged&&Xr(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&$r(e.cm)}function Ri(e){var t=e.cm,n=t.display,r=t.doc;e.updatedDisplay&&Gi(t,e.update),null==n.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=e.scrollTop&&pi(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&di(t,e.scrollLeft,!0,!0),e.scrollToPos&&ni(t,ri(t,ft(r,e.scrollToPos.from),ft(r,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var a=0;a<i.length;++a)i[a].lines.length||ve(i[a],"hide");if(o)for(var s=0;s<o.length;++s)o[s].lines.length&&ve(o[s],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&ve(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function wi(e,t){if(e.curOp)return t();Oi(e);try{return t()}finally{Ci(e)}}function Ii(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Oi(e);try{return t.apply(e,arguments)}finally{Ci(e)}}}function Mi(e){return function(){if(this.curOp)return e.apply(this,arguments);Oi(this);try{return e.apply(this,arguments)}finally{Ci(this)}}}function _i(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Oi(t);try{return e.apply(this,arguments)}finally{Ci(t)}}}function Pi(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,D(Di,e))}function Di(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var n=+new Date+e.options.workTime,r=Tt(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(o){if(r.line>=e.display.viewFrom){var a=o.styles,s=o.text.length>e.options.maxHighlightLength?Ye(t.mode,r.state):null,l=vt(e,o,r,!0);s&&(r.state=s),o.styles=l.styles;var u=o.styleClasses,c=l.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var h=!a||a.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),f=0;!h&&f<a.length;++f)h=a[f]!=o.styles[f];h&&i.push(r.line),o.stateAfter=r.save(),r.nextLine()}else o.text.length<=e.options.maxHighlightLength&&Et(e,o.text,r),o.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return Pi(e,e.options.workDelay),!0})),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&wi(e,(function(){for(var t=0;t<i.length;t++)Ur(e,i[t],"text")}))}}var Fi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=ti(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=$n(e),this.force=n,this.dims=wr(e),this.events=[]};function Ui(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Xn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Xn(e)+"px",t.scrollbarsClipped=!0)}function Wi(e){if(e.hasFocus())return null;var t=I();if(!t||!w(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&w(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function Bi(e){if(e&&e.activeElt&&e.activeElt!=I()&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&w(document.body,e.anchorNode)&&w(document.body,e.focusNode))){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Hi(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Wr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==Gr(e))return!1;Xi(e)&&(Wr(e),t.dims=wr(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom)),n.viewTo>a&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Rt&&(o=tn(e.doc,o),a=nn(e.doc,a));var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Hr(e,o,a),n.viewOffset=an(Ze(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var l=Gr(e);if(!s&&0==l&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=Wi(e);return l>4&&(n.lineDiv.style.display="none"),ji(e,n.updateLineNumbers,t.dims),l>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,Bi(u),N(n.cursorDiv),N(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,s&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Pi(e,400)),n.updateLineNumbers=null,!0}function Gi(e,t){for(var n=t.viewport,r=!0;;r=!1){if(r&&e.options.lineWrapping&&t.oldDisplayWidth!=$n(e))r&&(t.visible=ti(e.display,e.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Kn(e.display)-qn(e),n.top)}),t.visible=ti(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!Hi(e,t))break;Qr(e);var i=mi(e);zr(e),yi(e,i),Ki(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function zi(e,t){var n=new Fi(e,t);if(Hi(e,n)){Qr(e),Gi(e,n);var r=mi(e);zr(e),yi(e,r),Ki(e,r),n.finish()}}function ji(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function s(t){var n=t.nextSibling;return l&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var u=r.view,c=r.viewFrom,h=0;h<u.length;h++){var f=u[h];if(f.hidden);else if(f.node&&f.node.parentNode==o){for(;a!=f.node;)a=s(a);var p=i&&null!=t&&t<=c&&f.lineNumber;f.changes&&(B(f.changes,"gutter")>-1&&(p=!1),wn(e,f,c,n)),p&&(N(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(it(e.options,c)))),a=f.node.nextSibling}else{var d=Wn(e,f,c,n);o.insertBefore(d,a)}c+=f.size}for(;a;)a=s(a)}function Vi(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",An(e,"gutterChanged",e)}function Ki(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Xn(e)+"px"}function Yi(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=Ir(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a<n.length;a++)if(!n[a].hidden){e.options.fixedGutter&&(n[a].gutter&&(n[a].gutter.style.left=o),n[a].gutterBackground&&(n[a].gutterBackground.style.left=o));var s=n[a].alignable;if(s)for(var l=0;l<s.length;l++)s[l].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function Xi(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=it(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(A("div",[A("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-a)+1,r.lineNumWidth=r.lineNumInnerWidth+a,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Vi(e.display),!0}return!1}function $i(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var o=e[i],a=null;if("string"!=typeof o&&(a=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue;r=!0}n.push({className:o,style:a})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function qi(e){var t=e.gutters,n=e.gutterSpecs;N(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],o=i.className,a=i.style,s=t.appendChild(A("div",null,"CodeMirror-gutter "+o));a&&(s.style.cssText=a),"CodeMirror-linenumbers"==o&&(e.lineGutter=s,s.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Vi(e)}function Zi(e){qi(e.display),Fr(e),Yi(e)}function Ji(e,t,r,i){var o=this;this.input=r,o.scrollbarFiller=A("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=A("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=R("div",null,"CodeMirror-code"),o.selectionDiv=A("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=A("div",null,"CodeMirror-cursors"),o.measure=A("div",null,"CodeMirror-measure"),o.lineMeasure=A("div",null,"CodeMirror-measure"),o.lineSpace=R("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var u=R("div",[o.lineSpace],"CodeMirror-lines");o.mover=A("div",[u],null,"position: relative"),o.sizer=A("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=A("div",null,null,"position: absolute; height: "+H+"px; width: 1px;"),o.gutters=A("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=A("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=A("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),a&&s<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),l||n&&v||(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=$i(i.gutters,i.lineNumbers),qi(o),r.init(o)}Fi.prototype.signal=function(e,t){Ee(e,t)&&this.events.push(arguments)},Fi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)ve.apply(null,this.events[e])};var Qi=0,eo=null;function to(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}}function no(e){var t=to(e);return t.x*=eo,t.y*=eo,t}function ro(e,t){var r=to(t),i=r.x,o=r.y,a=e.display,s=a.scroller,u=s.scrollWidth>s.clientWidth,c=s.scrollHeight>s.clientHeight;if(i&&u||o&&c){if(o&&y&&l)e:for(var f=t.target,p=a.view;f!=s;f=f.parentNode)for(var d=0;d<p.length;d++)if(p[d].node==f){e.display.currentWheelTarget=f;break e}if(i&&!n&&!h&&null!=eo)return o&&c&&fi(e,Math.max(0,s.scrollTop+o*eo)),di(e,Math.max(0,s.scrollLeft+i*eo)),(!o||o&&c)&&xe(t),void(a.wheelStartX=null);if(o&&null!=eo){var m=o*eo,g=e.doc.scrollTop,v=g+a.wrapper.clientHeight;m<0?g=Math.max(0,g+m-50):v=Math.min(e.doc.height,v+m+50),zi(e,{top:g,bottom:v})}Qi<20&&(null==a.wheelStartX?(a.wheelStartX=s.scrollLeft,a.wheelStartY=s.scrollTop,a.wheelDX=i,a.wheelDY=o,setTimeout((function(){if(null!=a.wheelStartX){var e=s.scrollLeft-a.wheelStartX,t=s.scrollTop-a.wheelStartY,n=t&&a.wheelDY&&t/a.wheelDY||e&&a.wheelDX&&e/a.wheelDX;a.wheelStartX=a.wheelStartY=null,n&&(eo=(eo*Qi+n)/(Qi+1),++Qi)}}),200)):(a.wheelDX+=i,a.wheelDY+=o))}}a?eo=-.53:n?eo=15:c?eo=-.7:f&&(eo=-1/3);var io=function(e,t){this.ranges=e,this.primIndex=t};io.prototype.primary=function(){return this.ranges[this.primIndex]},io.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!st(n.anchor,r.anchor)||!st(n.head,r.head))return!1}return!0},io.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new oo(lt(this.ranges[t].anchor),lt(this.ranges[t].head));return new io(e,this.primIndex)},io.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},io.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(at(t,r.from())>=0&&at(e,r.to())<=0)return n}return-1};var oo=function(e,t){this.anchor=e,this.head=t};function ao(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort((function(e,t){return at(e.from(),t.from())})),n=B(t,i);for(var o=1;o<t.length;o++){var a=t[o],s=t[o-1],l=at(s.to(),a.from());if(r&&!a.empty()?l>0:l>=0){var u=ct(s.from(),a.from()),c=ut(s.to(),a.to()),h=s.empty()?a.from()==a.head:s.from()==s.head;o<=n&&--n,t.splice(--o,2,new oo(h?c:u,h?u:c))}}return new io(t,n)}function so(e,t){return new io([new oo(e,t||e)],0)}function lo(e){return e.text?ot(e.from.line+e.text.length-1,$(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function uo(e,t){if(at(e,t.from)<0)return e;if(at(e,t.to)<=0)return lo(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=lo(t).ch-t.to.ch),ot(n,r)}function co(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new oo(uo(i.anchor,t),uo(i.head,t)))}return ao(e.cm,n,e.sel.primIndex)}function ho(e,t,n){return e.line==t.line?ot(n.line,e.ch-t.ch+n.ch):ot(n.line+(e.line-t.line),e.ch)}function fo(e,t,n){for(var r=[],i=ot(e.first,0),o=i,a=0;a<t.length;a++){var s=t[a],l=ho(s.from,i,o),u=ho(lo(s),i,o);if(i=s.to,o=u,"around"==n){var c=e.sel.ranges[a],h=at(c.head,c.anchor)<0;r[a]=new oo(h?u:l,h?l:u)}else r[a]=new oo(l,l)}return new io(r,e.sel.primIndex)}function po(e){e.doc.mode=je(e.options,e.doc.modeOption),mo(e)}function mo(e){e.doc.iter((function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)})),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Pi(e,100),e.state.modeGen++,e.curOp&&Fr(e)}function go(e,t){return 0==t.from.ch&&0==t.to.ch&&""==$(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function vo(e,t,n,r){function i(e){return n?n[e]:null}function o(e,n,i){cn(e,n,i,r),An(e,"change",e,t)}function a(e,t){for(var n=[],o=e;o<t;++o)n.push(new un(u[o],i(o),r));return n}var s=t.from,l=t.to,u=t.text,c=Ze(e,s.line),h=Ze(e,l.line),f=$(u),p=i(u.length-1),d=l.line-s.line;if(t.full)e.insert(0,a(0,u.length)),e.remove(u.length,e.size-u.length);else if(go(e,t)){var m=a(0,u.length-1);o(h,h.text,p),d&&e.remove(s.line,d),m.length&&e.insert(s.line,m)}else if(c==h)if(1==u.length)o(c,c.text.slice(0,s.ch)+f+c.text.slice(l.ch),p);else{var g=a(1,u.length-1);g.push(new un(f+c.text.slice(l.ch),p,r)),o(c,c.text.slice(0,s.ch)+u[0],i(0)),e.insert(s.line+1,g)}else if(1==u.length)o(c,c.text.slice(0,s.ch)+u[0]+h.text.slice(l.ch),i(0)),e.remove(s.line+1,d);else{o(c,c.text.slice(0,s.ch)+u[0],i(0)),o(h,f+h.text.slice(l.ch),p);var v=a(1,u.length-1);d>1&&e.remove(s.line+1,d-1),e.insert(s.line+1,v)}An(e,"change",e,t)}function yo(e,t,n){function r(e,i,o){if(e.linked)for(var a=0;a<e.linked.length;++a){var s=e.linked[a];if(s.doc!=i){var l=o&&s.sharedHist;n&&!l||(t(s.doc,l),r(s.doc,e,l))}}}r(e,null,!0)}function To(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,_r(e),po(e),Eo(e),e.options.direction=t.direction,e.options.lineWrapping||ln(e),e.options.mode=t.modeOption,Fr(e)}function Eo(e){("rtl"==e.doc.direction?M:k)(e.display.lineDiv,"CodeMirror-rtl")}function So(e){wi(e,(function(){Eo(e),Fr(e)}))}function xo(e){this.done=[],this.undone=[],this.undoDepth=e?e.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e?e.maxGeneration:1}function Oo(e,t){var n={from:lt(t.from),to:lo(t),text:Je(e,t.from,t.to)};return Ro(e,n,t.from.line,t.to.line+1),yo(e,(function(e){return Ro(e,n,t.from.line,t.to.line+1)}),!0),n}function Co(e){for(;e.length&&$(e).ranges;)e.pop()}function bo(e,t){return t?(Co(e.done),$(e.done)):e.done.length&&!$(e.done).ranges?$(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),$(e.done)):void 0}function ko(e,t,n,r){var i=e.history;i.undone.length=0;var o,a,s=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>s-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=bo(i,i.lastOp==r)))a=$(o.changes),0==at(t.from,t.to)&&0==at(t.from,a.to)?a.to=lo(t):o.changes.push(Oo(e,t));else{var l=$(i.done);for(l&&l.ranges||Ao(e.sel,i.done),o={changes:[Oo(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=s,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,a||ve(e,"historyAdded")}function No(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function Lo(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||No(e,o,$(i.done),t))?i.done[i.done.length-1]=t:Ao(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&Co(i.undone)}function Ao(e,t){var n=$(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Ro(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),(function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o}))}function wo(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function Io(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(wo(n[i]));return r}function Mo(e,t){var n=Io(e,t),r=Wt(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],a=r[i];if(o&&a)e:for(var s=0;s<a.length;++s){for(var l=a[s],u=0;u<o.length;++u)if(o[u].marker==l.marker)continue e;o.push(l)}else a&&(n[i]=a)}return n}function _o(e,t,n){for(var r=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)r.push(n?io.prototype.deepCopy.call(o):o);else{var a=o.changes,s=[];r.push({changes:s});for(var l=0;l<a.length;++l){var u=a[l],c=void 0;if(s.push({from:u.from,to:u.to,text:u.text}),t)for(var h in u)(c=h.match(/^spans_(\d+)$/))&&B(t,Number(c[1]))>-1&&($(s)[h]=u[h],delete u[h])}}}return r}function Po(e,t,n,r){if(r){var i=e.anchor;if(n){var o=at(t,i)<0;o!=at(n,i)<0?(i=t,t=n):o!=at(t,n)<0&&(t=n)}return new oo(i,t)}return new oo(n||t,t)}function Do(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Go(e,new io([Po(e.sel.primary(),t,n,i)],0),r)}function Fo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)r[o]=Po(e.sel.ranges[o],t[o],null,i);Go(e,ao(e.cm,r,e.sel.primIndex),n)}function Uo(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Go(e,ao(e.cm,i,e.sel.primIndex),r)}function Wo(e,t,n,r){Go(e,so(t,n),r)}function Bo(e,t,n){var r={ranges:t.ranges,update:function(t){this.ranges=[];for(var n=0;n<t.length;n++)this.ranges[n]=new oo(ft(e,t[n].anchor),ft(e,t[n].head))},origin:n&&n.origin};return ve(e,"beforeSelectionChange",e,r),e.cm&&ve(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?ao(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,n){var r=e.history.done,i=$(r);i&&i.ranges?(r[r.length-1]=t,zo(e,t,n)):Go(e,t,n)}function Go(e,t,n){zo(e,t,n),Lo(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function zo(e,t,n){(Ee(e,"beforeSelectionChange")||e.cm&&Ee(e.cm,"beforeSelectionChange"))&&(t=Bo(e,t,n));var r=n&&n.bias||(at(t.primary().head,e.sel.primary().head)<0?-1:1);jo(e,Ko(e,t,r,!0)),n&&!1===n.scroll||!e.cm||"nocursor"==e.cm.getOption("readOnly")||si(e.cm)}function jo(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Te(e.cm)),An(e,"cursorActivity",e))}function Vo(e){jo(e,Ko(e,e.sel,null,!1))}function Ko(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],s=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],l=Xo(e,a.anchor,s&&s.anchor,n,r),u=Xo(e,a.head,s&&s.head,n,r);(i||l!=a.anchor||u!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new oo(l,u))}return i?ao(e.cm,i,t.primIndex):t}function Yo(e,t,n,r,i){var o=Ze(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var s=o.markedSpans[a],l=s.marker,u="selectLeft"in l?!l.selectLeft:l.inclusiveLeft,c="selectRight"in l?!l.selectRight:l.inclusiveRight;if((null==s.from||(u?s.from<=t.ch:s.from<t.ch))&&(null==s.to||(c?s.to>=t.ch:s.to>t.ch))){if(i&&(ve(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!l.atomic)continue;if(n){var h=l.find(r<0?1:-1),f=void 0;if((r<0?c:u)&&(h=$o(e,h,-r,h&&h.line==t.line?o:null)),h&&h.line==t.line&&(f=at(h,n))&&(r<0?f<0:f>0))return Yo(e,h,t,r,i)}var p=l.find(r<0?-1:1);return(r<0?u:c)&&(p=$o(e,p,r,p.line==t.line?o:null)),p?Yo(e,p,t,r,i):null}}return t}function Xo(e,t,n,r,i){var o=r||1,a=Yo(e,t,n,o,i)||!i&&Yo(e,t,n,o,!0)||Yo(e,t,n,-o,i)||!i&&Yo(e,t,n,-o,!0);return a||(e.cantEdit=!0,ot(e.first,0))}function $o(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?ft(e,ot(t.line-1)):null:n>0&&t.ch==(r||Ze(e,t.line)).text.length?t.line<e.first+e.size-1?ot(t.line+1,0):null:new ot(t.line,t.ch+n)}function qo(e){e.setSelection(ot(e.firstLine(),0),ot(e.lastLine()),z)}function Zo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(t,n,i,o){t&&(r.from=ft(e,t)),n&&(r.to=ft(e,n)),i&&(r.text=i),void 0!==o&&(r.origin=o)}),ve(e,"beforeChange",e,r),e.cm&&ve(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Jo(e,t,n){if(e.cm){if(!e.cm.curOp)return Ii(e.cm,Jo)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(Ee(e,"beforeChange")||e.cm&&Ee(e.cm,"beforeChange"))||(t=Zo(e,t,!0))){var r=At&&!n&&Ht(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Qo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Qo(e,t)}}function Qo(e,t){if(1!=t.text.length||""!=t.text[0]||0!=at(t.from,t.to)){var n=co(e,t);ko(e,t,n,e.cm?e.cm.curOp.id:NaN),na(e,t,n,Wt(e,t));var r=[];yo(e,(function(e,n){n||-1!=B(r,e.history)||(sa(e.history,t),r.push(e.history)),na(e,t,null,Wt(e,t))}))}}function ea(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!r||n){for(var i,o=e.history,a=e.sel,s="undo"==t?o.done:o.undone,l="undo"==t?o.undone:o.done,u=0;u<s.length&&(i=s[u],n?!i.ranges||i.equals(e.sel):i.ranges);u++);if(u!=s.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(!(i=s.pop()).ranges){if(r)return void s.push(i);break}if(Ao(i,l),n&&!i.equals(e.sel))return void Go(e,i,{clearRedo:!1});a=i}var c=[];Ao(a,l),l.push({changes:c,generation:o.generation}),o.generation=i.generation||++o.maxGeneration;for(var h=Ee(e,"beforeChange")||e.cm&&Ee(e.cm,"beforeChange"),f=function(n){var r=i.changes[n];if(r.origin=t,h&&!Zo(e,r,!1))return s.length=0,{};c.push(Oo(e,r));var o=n?co(e,r):$(s);na(e,r,o,Mo(e,r)),!n&&e.cm&&e.cm.scrollIntoView({from:r.from,to:lo(r)});var a=[];yo(e,(function(e,t){t||-1!=B(a,e.history)||(sa(e.history,r),a.push(e.history)),na(e,r,null,Mo(e,r))}))},p=i.changes.length-1;p>=0;--p){var d=f(p);if(d)return d.v}}}}function ta(e,t){if(0!=t&&(e.first+=t,e.sel=new io(q(e.sel.ranges,(function(e){return new oo(ot(e.anchor.line+t,e.anchor.ch),ot(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){Fr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Ur(e.cm,r,"gutter")}}function na(e,t,n,r){if(e.cm&&!e.cm.curOp)return Ii(e.cm,na)(e,t,n,r);if(t.to.line<e.first)ta(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);ta(e,i),t={from:ot(e.first,0),to:ot(t.to.line+i,t.to.ch),text:[$(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:ot(o,Ze(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Je(e,t.from,t.to),n||(n=co(e,t)),e.cm?ra(e.cm,t,r):vo(e,t,r),zo(e,n,z),e.cantEdit&&Xo(e,ot(e.firstLine(),0))&&(e.cantEdit=!1)}}function ra(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,s=!1,l=o.line;e.options.lineWrapping||(l=tt(Jt(Ze(r,o.line))),r.iter(l,a.line+1,(function(e){if(e==i.maxLine)return s=!0,!0}))),r.sel.contains(t.from,t.to)>-1&&Te(e),vo(r,t,n,Mr(e)),e.options.lineWrapping||(r.iter(l,o.line+t.text.length,(function(e){var t=sn(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)})),s&&(e.curOp.updateMaxLine=!0)),Lt(r,o.line),Pi(e,400);var u=t.text.length-(a.line-o.line)-1;t.full?Fr(e):o.line!=a.line||1!=t.text.length||go(e.doc,t)?Fr(e,o.line,a.line+1,u):Ur(e,o.line,"text");var c=Ee(e,"changes"),h=Ee(e,"change");if(h||c){var f={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};h&&An(e,"change",e,f),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(f)}e.display.selForContextMenu=null}function ia(e,t,n,r,i){var o;r||(r=n),at(r,n)<0&&(n=(o=[r,n])[0],r=o[1]),"string"==typeof t&&(t=e.splitLines(t)),Jo(e,{from:n,to:r,text:t,origin:i})}function oa(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function aa(e,t,n,r){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0);for(var s=0;s<o.ranges.length;s++)oa(o.ranges[s].anchor,t,n,r),oa(o.ranges[s].head,t,n,r)}else{for(var l=0;l<o.changes.length;++l){var u=o.changes[l];if(n<u.from.line)u.from=ot(u.from.line+r,u.from.ch),u.to=ot(u.to.line+r,u.to.ch);else if(t<=u.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function sa(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;aa(e.done,n,r,i),aa(e.undone,n,r,i)}function la(e,t,n,r){var i=t,o=t;return"number"==typeof t?o=Ze(e,ht(e,t)):i=tt(t),null==i?null:(r(o,i)&&e.cm&&Ur(e.cm,i,n),o)}function ua(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}function ca(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}oo.prototype.from=function(){return ct(this.anchor,this.head)},oo.prototype.to=function(){return ut(this.anchor,this.head)},oo.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},ua.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,hn(i),An(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}},ca.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var o=Math.min(t,i-e),a=r.height;if(r.removeInner(e,o),this.height-=a-r.height,i==o&&(this.children.splice(n--,1),r.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof ua))){var s=[];this.collapse(s),this.children=[new ua(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var a=i.lines.length%25+25,s=a;s<i.lines.length;){var l=new ua(i.lines.slice(s,s+=25));i.height-=l.height,this.children.splice(++r,0,l),l.parent=this}i.lines=i.lines.slice(0,a),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=new ca(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var n=B(e.parent.children,e);e.parent.children.splice(n+1,0,t)}else{var r=new ca(e.children);r.parent=e,e.children=[r,t],e=r}t.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<o){var a=Math.min(t,o-e);if(i.iterN(e,a,n))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var ha=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};function fa(e,t,n){an(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&ai(e,n)}function pa(e,t,n,r){var i=new ha(e,n,r),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),la(e,t,"widget",(function(t){var n=t.widgets||(t.widgets=[]);if(null==i.insertAt?n.push(i):n.splice(Math.min(n.length,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!rn(e,t)){var r=an(t)<e.scrollTop;et(t,t.height+zn(i)),r&&ai(o,i.height),o.curOp.forceUpdate=!0}return!0})),o&&An(o,"lineWidgetAdded",o,i,"number"==typeof t?t:tt(t)),i}ha.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=tt(n);if(null!=r&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var o=zn(this);et(n,Math.max(0,n.height-o)),e&&(wi(e,(function(){fa(e,n,-o),Ur(e,r,"widget")})),An(e,"lineWidgetCleared",e,this,r))}},ha.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=zn(this)-t;i&&(rn(this.doc,r)||et(r,r.height+i),n&&wi(n,(function(){n.curOp.forceUpdate=!0,fa(n,r,i),An(n,"lineWidgetChanged",n,e,tt(r))})))},Se(ha);var da=0,ma=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++da};function ga(e,t,n,r,i){if(r&&r.shared)return ya(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Ii(e.cm,ga)(e,t,n,r,i);var o=new ma(e,i),a=at(t,n);if(r&&F(r,o,!1),a>0||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=R("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Zt(e,t.line,t,n,o)||t.line!=n.line&&Zt(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");It()}o.addToHistory&&ko(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var s,l=t.line,u=e.cm;if(e.iter(l,n.line+1,(function(r){u&&o.collapsed&&!u.options.lineWrapping&&Jt(r)==u.display.maxLine&&(s=!0),o.collapsed&&l!=t.line&&et(r,0),Dt(r,new Mt(o,l==t.line?t.ch:null,l==n.line?n.ch:null),e.cm&&e.cm.curOp),++l})),o.collapsed&&e.iter(t.line,n.line+1,(function(t){rn(e,t)&&et(t,0)})),o.clearOnEnter&&de(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(wt(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++da,o.atomic=!0),u){if(s&&(u.curOp.updateMaxLine=!0),o.collapsed)Fr(u,t.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=t.line;c<=n.line;c++)Ur(u,c,"text");o.atomic&&Vo(u.doc),An(u,"markerAdded",u,o)}return o}ma.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Oi(e),Ee(this,"clear")){var n=this.find();n&&An(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],s=_t(a.markedSpans,this);e&&!this.collapsed?Ur(e,tt(a),"text"):e&&(null!=s.to&&(i=tt(a)),null!=s.from&&(r=tt(a))),a.markedSpans=Pt(a.markedSpans,s),null==s.from&&this.collapsed&&!rn(this.doc,a)&&e&&et(a,Ar(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var l=0;l<this.lines.length;++l){var u=Jt(this.lines[l]),c=sn(u);c>e.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&Fr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Vo(e.doc)),e&&An(e,"markerCleared",e,this,r,i),t&&Ci(e),this.parent&&this.parent.clear()}},ma.prototype.find=function(e,t){var n,r;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],a=_t(o.markedSpans,this);if(null!=a.from&&(n=ot(t?o:tt(o),a.from),-1==e))return n;if(null!=a.to&&(r=ot(t?o:tt(o),a.to),1==e))return r}return n&&{from:n,to:r}},ma.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;t&&r&&wi(r,(function(){var i=t.line,o=tt(t.line),a=tr(r,o);if(a&&(cr(a),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!rn(n.doc,i)&&null!=n.height){var s=n.height;n.height=null;var l=zn(n)-s;l&&et(i,i.height+l)}An(r,"markerChanged",r,e)}))},ma.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=B(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ma.prototype.detachLine=function(e){if(this.lines.splice(B(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Se(ma);var va=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};function ya(e,t,n,r,i){(r=F(r)).shared=!1;var o=[ga(e,t,n,r,i)],a=o[0],s=r.widgetNode;return yo(e,(function(e){s&&(r.widgetNode=s.cloneNode(!0)),o.push(ga(e,ft(e,t),ft(e,n),r,i));for(var l=0;l<e.linked.length;++l)if(e.linked[l].isParent)return;a=$(o)})),new va(o,a)}function Ta(e){return e.findMarks(ot(e.first,0),e.clipPos(ot(e.lastLine())),(function(e){return e.parent}))}function Ea(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(at(o,a)){var s=ga(e,o,a,r.primary,r.primary.type);r.markers.push(s),s.parent=r}}}function Sa(e){for(var t=function(t){var n=e[t],r=[n.primary.doc];yo(n.primary.doc,(function(e){return r.push(e)}));for(var i=0;i<n.markers.length;i++){var o=n.markers[i];-1==B(r,o.doc)&&(o.parent=null,n.markers.splice(i--,1))}},n=0;n<e.length;n++)t(n)}va.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();An(this,"clear")}},va.prototype.find=function(e,t){return this.primary.find(e,t)},Se(va);var xa=0,Oa=function(e,t,n,r,i){if(!(this instanceof Oa))return new Oa(e,t,n,r,i);null==n&&(n=0),ca.call(this,[new ua([new un("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var o=ot(n,0);this.sel=so(o),this.history=new xo(null),this.id=++xa,this.modeOption=t,this.lineSep=r,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),vo(this,{from:o,to:o,text:e}),Go(this,so(o),z)};Oa.prototype=Q(ca.prototype,{constructor:Oa,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Qe(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:_i((function(e){var t=ot(this.first,0),n=this.first+this.size-1;Jo(this,{from:t,to:ot(n,Ze(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&li(this.cm,0,0),Go(this,so(t),z)})),replaceRange:function(e,t,n,r){ia(this,e,t=ft(this,t),n=n?ft(this,n):t,r)},getRange:function(e,t,n){var r=Je(this,ft(this,e),ft(this,t));return!1===n?r:""===n?r.join(""):r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(rt(this,e))return Ze(this,e)},getLineNumber:function(e){return tt(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Ze(this,e)),Jt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ft(this,e)},getCursor:function(e){var t=this.sel.primary();return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:_i((function(e,t,n){Wo(this,ft(this,"number"==typeof e?ot(e,t||0):e),null,n)})),setSelection:_i((function(e,t,n){Wo(this,ft(this,e),ft(this,t||e),n)})),extendSelection:_i((function(e,t,n){Do(this,ft(this,e),t&&ft(this,t),n)})),extendSelections:_i((function(e,t){Fo(this,dt(this,e),t)})),extendSelectionsBy:_i((function(e,t){Fo(this,dt(this,q(this.sel.ranges,e)),t)})),setSelections:_i((function(e,t,n){if(e.length){for(var r=[],i=0;i<e.length;i++)r[i]=new oo(ft(this,e[i].anchor),ft(this,e[i].head||e[i].anchor));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Go(this,ao(this.cm,r,t),n)}})),addSelection:_i((function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new oo(ft(this,e),ft(this,t||e))),Go(this,ao(this.cm,r,r.length-1),n)})),getSelection:function(e){for(var t,n=this.sel.ranges,r=0;r<n.length;r++){var i=Je(this,n[r].from(),n[r].to());t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Je(this,n[r].from(),n[r].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:_i((function(e,t,n){for(var r=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];r[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:n}}for(var s=t&&"end"!=t&&fo(this,r,t),l=r.length-1;l>=0;l--)Jo(this,r[l]);s?Ho(this,s):this.cm&&si(this.cm)})),undo:_i((function(){ea(this,"undo")})),redo:_i((function(){ea(this,"redo")})),undoSelection:_i((function(){ea(this,"undo",!0)})),redoSelection:_i((function(){ea(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new xo(this.history),yo(this,(function(t){return t.history=e.history}),!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:_o(this.history.done),undone:_o(this.history.undone)}},setHistory:function(e){var t=this.history=new xo(this.history);t.done=_o(e.done.slice(0),null,!0),t.undone=_o(e.undone.slice(0),null,!0)},setGutterMarker:_i((function(e,t,n){return la(this,e,"gutter",(function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&re(r)&&(e.gutterMarkers=null),!0}))})),clearGutter:_i((function(e){var t=this;this.iter((function(n){n.gutterMarkers&&n.gutterMarkers[e]&&la(t,n,"gutter",(function(){return n.gutterMarkers[e]=null,re(n.gutterMarkers)&&(n.gutterMarkers=null),!0}))}))})),lineInfo:function(e){var t;if("number"==typeof e){if(!rt(this,e))return null;if(t=e,!(e=Ze(this,e)))return null}else if(null==(t=tt(e)))return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:_i((function(e,t,n){return la(this,e,"gutter"==t?"gutter":"class",(function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[r]){if(C(n).test(e[r]))return!1;e[r]+=" "+n}else e[r]=n;return!0}))})),removeLineClass:_i((function(e,t,n){return la(this,e,"gutter"==t?"gutter":"class",(function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[r];if(!i)return!1;if(null==n)e[r]=null;else{var o=i.match(C(n));if(!o)return!1;var a=o.index+o[0].length;e[r]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0}))})),addLineWidget:_i((function(e,t,n){return pa(this,e,t,n)})),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return ga(this,ft(this,e),ft(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return ga(this,e=ft(this,e),e,n,"bookmark")},findMarksAt:function(e){var t=[],n=Ze(this,(e=ft(this,e)).line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ft(this,e),t=ft(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,(function(o){var a=o.markedSpans;if(a)for(var s=0;s<a.length;s++){var l=a[s];null!=l.to&&i==e.line&&e.ch>=l.to||null==l.from&&i!=e.line||null!=l.from&&i==t.line&&l.from>=t.ch||n&&!n(l.marker)||r.push(l.marker.parent||l.marker)}++i})),r},getAllMarks:function(){var e=[];return this.iter((function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)null!=n[r].from&&e.push(n[r].marker)})),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter((function(i){var o=i.text.length+r;if(o>e)return t=e,!0;e-=o,++n})),ft(this,ot(n,t))},indexFromPos:function(e){var t=(e=ft(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,(function(e){t+=e.text.length+n})),t},copy:function(e){var t=new Oa(Qe(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<n&&(n=e.to);var r=new Oa(Qe(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Ea(r,Ta(this)),r},unlinkDoc:function(e){if(e instanceof Fs&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t)if(this.linked[t].doc==e){this.linked.splice(t,1),e.unlinkDoc(this),Sa(Ta(this));break}if(e.history==this.history){var n=[e.id];yo(e,(function(e){return n.push(e.id)}),!0),e.history=new xo(null),e.history.done=_o(this.history.done,n),e.history.undone=_o(this.history.undone,n)}},iterLinkedDocs:function(e){yo(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):_e(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:_i((function(e){"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter((function(e){return e.order=null})),this.cm&&So(this.cm))}))}),Oa.prototype.eachLine=Oa.prototype.iter;var Ca=0;function ba(e){var t=this;if(La(t),!ye(t,e)&&!jn(t.display,e)){xe(e),a&&(Ca=+new Date);var n=Pr(t,e,!0),r=e.dataTransfer.files;if(n&&!t.isReadOnly())if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),s=0,l=function(){++s==i&&Ii(t,(function(){var e={from:n=ft(t.doc,n),to:n,text:t.doc.splitLines(o.filter((function(e){return null!=e})).join(t.doc.lineSeparator())),origin:"paste"};Jo(t.doc,e),Ho(t.doc,so(ft(t.doc,n),ft(t.doc,lo(e))))}))()},u=function(e,n){if(t.options.allowDropFileTypes&&-1==B(t.options.allowDropFileTypes,e.type))l();else{var r=new FileReader;r.onerror=function(){return l()},r.onload=function(){var e=r.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)||(o[n]=e),l()},r.readAsText(e)}},c=0;c<r.length;c++)u(r[c],c);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20);try{var h=e.dataTransfer.getData("Text");if(h){var f;if(t.state.draggingText&&!t.state.draggingText.copy&&(f=t.listSelections()),zo(t.doc,so(n,n)),f)for(var p=0;p<f.length;++p)ia(t.doc,"",f[p].anchor,f[p].head,"drag");t.replaceSelection(h,"around","paste"),t.display.input.focus()}}catch(e){}}}}function ka(e,t){if(a&&(!e.state.draggingText||+new Date-Ca<100))be(t);else if(!ye(e,t)&&!jn(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f)){var n=A("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",h&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),h&&n.parentNode.removeChild(n)}}function Na(e,t){var n=Pr(e,t);if(n){var r=document.createDocumentFragment();Vr(e,n,r),e.display.dragCursor||(e.display.dragCursor=A("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),L(e.display.dragCursor,r)}}function La(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Aa(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation((function(){for(var t=0;t<n.length;t++)e(n[t])}))}}var Ra=!1;function wa(){Ra||(Ia(),Ra=!0)}function Ia(){var e;de(window,"resize",(function(){null==e&&(e=setTimeout((function(){e=null,Aa(Ma)}),100))})),de(window,"blur",(function(){return Aa(Jr)}))}function Ma(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var _a={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Pa=0;Pa<10;Pa++)_a[Pa+48]=_a[Pa+96]=String(Pa);for(var Da=65;Da<=90;Da++)_a[Da]=String.fromCharCode(Da);for(var Fa=1;Fa<=12;Fa++)_a[Fa+111]=_a[Fa+63235]="F"+Fa;var Ua={};function Wa(e){var t,n,r,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var a=0;a<o.length-1;a++){var s=o[a];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else{if(!/^s(hift)?$/i.test(s))throw new Error("Unrecognized modifier name: "+s);r=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),r&&(e="Shift-"+e),e}function Ba(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==r){delete e[n];continue}for(var i=q(n.split(" "),Wa),o=0;o<i.length;o++){var a=void 0,s=void 0;o==i.length-1?(s=i.join(" "),a=r):(s=i.slice(0,o+1).join(" "),a="...");var l=t[s];if(l){if(l!=a)throw new Error("Inconsistent bindings for "+s)}else t[s]=a}delete e[n]}for(var u in t)e[u]=t[u];return e}function Ha(e,t,n,r){var i=(t=Va(t)).call?t.call(e,r):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&n(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Ha(e,t.fallthrough,n,r);for(var o=0;o<t.fallthrough.length;o++){var a=Ha(e,t.fallthrough[o],n,r);if(a)return a}}}function Ga(e){var t="string"==typeof e?e:_a[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function za(e,t,n){var r=e;return t.altKey&&"Alt"!=r&&(e="Alt-"+e),(x?t.metaKey:t.ctrlKey)&&"Ctrl"!=r&&(e="Ctrl-"+e),(x?t.ctrlKey:t.metaKey)&&"Mod"!=r&&(e="Cmd-"+e),!n&&t.shiftKey&&"Shift"!=r&&(e="Shift-"+e),e}function ja(e,t){if(h&&34==e.keyCode&&e.char)return!1;var n=_a[e.keyCode];return null!=n&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(n=e.code),za(n,e,t))}function Va(e){return"string"==typeof e?Ua[e]:e}function Ka(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=t(n[i]);r.length&&at(o.from,$(r).to)<=0;){var a=r.pop();if(at(a.from,o.from)<0){o.from=a.from;break}}r.push(o)}wi(e,(function(){for(var t=r.length-1;t>=0;t--)ia(e.doc,"",r[t].from,r[t].to,"+delete");si(e)}))}function Ya(e,t,n){var r=ae(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Xa(e,t,n){var r=Ya(e,t.ch,n);return null==r?null:new ot(t.line,r,n<0?"after":"before")}function $a(e,t,n,r,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o=fe(n,t.doc.direction);if(o){var a,s=i<0?$(o):o[0],l=i<0==(1==s.level)?"after":"before";if(s.level>0||"rtl"==t.doc.direction){var u=nr(t,n);a=i<0?n.text.length-1:0;var c=rr(t,u,a).top;a=se((function(e){return rr(t,u,e).top==c}),i<0==(1==s.level)?s.from:s.to-1,a),"before"==l&&(a=Ya(n,a,1))}else a=i<0?s.to:s.from;return new ot(r,a,l)}}return new ot(r,i<0?n.text.length:0,i<0?"before":"after")}function qa(e,t,n,r){var i=fe(t,e.doc.direction);if(!i)return Xa(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=ce(i,n.ch,n.sticky),a=i[o];if("ltr"==e.doc.direction&&a.level%2==0&&(r>0?a.to>n.ch:a.from<n.ch))return Xa(t,n,r);var s,l=function(e,n){return Ya(t,e instanceof ot?e.ch:e,n)},u=function(n){return e.options.lineWrapping?(s=s||nr(e,t),Cr(e,t,s,n)):{begin:0,end:t.text.length}},c=u("before"==n.sticky?l(n,-1):n.ch);if("rtl"==e.doc.direction||1==a.level){var h=1==a.level==r<0,f=l(n,h?1:-1);if(null!=f&&(h?f<=a.to&&f<=c.end:f>=a.from&&f>=c.begin)){var p=h?"before":"after";return new ot(n.line,f,p)}}var d=function(e,t,r){for(var o=function(e,t){return t?new ot(n.line,l(e,1),"before"):new ot(n.line,e,"after")};e>=0&&e<i.length;e+=t){var a=i[e],s=t>0==(1!=a.level),u=s?r.begin:l(r.end,-1);if(a.from<=u&&u<a.to)return o(u,s);if(u=s?a.from:l(a.to,-1),r.begin<=u&&u<r.end)return o(u,s)}},m=d(o+r,r,c);if(m)return m;var g=r>0?c.end:l(c.begin,-1);return null==g||r>0&&g==t.text.length||!(m=d(r>0?0:i.length-1,r,u(g)))?null:m}Ua.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ua.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ua.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ua.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ua.default=y?Ua.macDefault:Ua.pcDefault;var Za={selectAll:qo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),z)},killLine:function(e){return Ka(e,(function(t){if(t.empty()){var n=Ze(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:ot(t.head.line+1,0)}:{from:t.head,to:ot(t.head.line,n)}}return{from:t.from(),to:t.to()}}))},deleteLine:function(e){return Ka(e,(function(t){return{from:ot(t.from().line,0),to:ft(e.doc,ot(t.to().line+1,0))}}))},delLineLeft:function(e){return Ka(e,(function(e){return{from:ot(e.from().line,0),to:e.from()}}))},delWrappedLineLeft:function(e){return Ka(e,(function(t){var n=e.charCoords(t.head,"div").top+5;return{from:e.coordsChar({left:0,top:n},"div"),to:t.from()}}))},delWrappedLineRight:function(e){return Ka(e,(function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}}))},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(ot(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(ot(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy((function(t){return Ja(e,t.head.line)}),{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy((function(t){return es(e,t.head)}),{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy((function(t){return Qa(e,t.head.line)}),{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy((function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")}),V)},goLineLeft:function(e){return e.extendSelectionsBy((function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")}),V)},goLineLeftSmart:function(e){return e.extendSelectionsBy((function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?es(e,t.head):r}),V)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),a=U(e.getLine(o.line),o.ch,r);t.push(X(r-a%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return wi(e,(function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)if(t[r].empty()){var i=t[r].head,o=Ze(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new ot(i.line,i.ch-1)),i.ch>0)i=new ot(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),ot(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Ze(e.doc,i.line-1).text;a&&(i=new ot(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),ot(i.line-1,a.length-1),i,"+transpose"))}n.push(new oo(i,i))}e.setSelections(n)}))},newlineAndIndent:function(e){return wi(e,(function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);si(e)}))},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Ja(e,t){var n=Ze(e.doc,t),r=Jt(n);return r!=n&&(t=tt(r)),$a(!0,e,r,t,1)}function Qa(e,t){var n=Ze(e.doc,t),r=Qt(n);return r!=n&&(t=tt(r)),$a(!0,e,n,t,-1)}function es(e,t){var n=Ja(e,t.line),r=Ze(e.doc,n.line),i=fe(r,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(n.ch,r.text.search(/\S/)),a=t.line==n.line&&t.ch<=o&&t.ch;return ot(n.line,a?0:o,n.sticky)}return n}function ts(e,t,n){if("string"==typeof t&&!(t=Za[t]))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=G}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function ns(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Ha(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Ha(t,e.options.extraKeys,n,e)||Ha(t,e.options.keyMap,n,e)}var rs=new W;function is(e,t,n,r){var i=e.state.keySeq;if(i){if(Ga(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:rs.set(50,(function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())})),os(e,i+" "+t,n,r))return!0}return os(e,t,n,r)}function os(e,t,n,r){var i=ns(e,t,r);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&An(e,"keyHandled",e,t,n),"handled"!=i&&"multi"!=i||(xe(n),Xr(e)),!!i}function as(e,t){var n=ja(t,!0);return!!n&&(t.shiftKey&&!e.state.keySeq?is(e,"Shift-"+n,t,(function(t){return ts(e,t,!0)}))||is(e,n,t,(function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return ts(e,t)})):is(e,n,t,(function(t){return ts(e,t)})))}function ss(e,t,n){return is(e,"'"+n+"'",t,(function(t){return ts(e,t,!0)}))}var ls=null;function us(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField()||(t.curOp.focus=I(),ye(t,e)))){a&&s<11&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var i=as(t,e);h&&(ls=i?r:null,i||88!=r||De||!(y?e.metaKey:e.ctrlKey)||t.replaceSelection("",null,"cut")),n&&!y&&!i&&46==r&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||cs(t)}}function cs(e){var t=e.display.lineDiv;function n(e){18!=e.keyCode&&e.altKey||(k(t,"CodeMirror-crosshair"),ge(document,"keyup",n),ge(document,"mouseover",n))}M(t,"CodeMirror-crosshair"),de(document,"keyup",n),de(document,"mouseover",n)}function hs(e){16==e.keyCode&&(this.doc.sel.shift=!1),ye(this,e)}function fs(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField()||jn(t.display,e)||ye(t,e)||e.ctrlKey&&!e.altKey||y&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(h&&n==ls)return ls=null,void xe(e);if(!h||e.which&&!(e.which<10)||!as(t,e)){var i=String.fromCharCode(null==r?n:r);"\b"!=i&&(ss(t,e,i)||t.display.input.onKeyPress(e))}}}var ps,ds,ms=400,gs=function(e,t,n){this.time=e,this.pos=t,this.button=n};function vs(e,t){var n=+new Date;return ds&&ds.compare(n,e,t)?(ps=ds=null,"triple"):ps&&ps.compare(n,e,t)?(ds=new gs(n,e,t),ps=null,"double"):(ps=new gs(n,e,t),ds=null,"single")}function ys(e){var t=this,n=t.display;if(!(ye(t,e)||n.activeTouch&&n.input.supportsTouch()))if(n.input.ensurePolled(),n.shift=e.shiftKey,jn(n,e))l||(n.scroller.draggable=!1,setTimeout((function(){return n.scroller.draggable=!0}),100));else if(!Ns(t,e)){var r=Pr(t,e),i=Ne(e),o=r?vs(r,i):"single";window.focus(),1==i&&t.state.selectingText&&t.state.selectingText(e),r&&Ts(t,i,r,o,e)||(1==i?r?Ss(t,r,o,e):ke(e)==n.scroller&&xe(e):2==i?(r&&Do(t.doc,r),setTimeout((function(){return n.input.focus()}),20)):3==i&&(O?t.display.input.onContextMenu(e):qr(t)))}}function Ts(e,t,n,r,i){var o="Click";return"double"==r?o="Double"+o:"triple"==r&&(o="Triple"+o),is(e,za(o=(1==t?"Left":2==t?"Middle":"Right")+o,i),i,(function(t){if("string"==typeof t&&(t=Za[t]),!t)return!1;var r=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r=t(e,n)!=G}finally{e.state.suppressEdits=!1}return r}))}function Es(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(null==i.unit){var o=T?n.shiftKey&&n.metaKey:n.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}return(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),null==i.addNew&&(i.addNew=y?n.metaKey:n.ctrlKey),null==i.moveOnDrag&&(i.moveOnDrag=!(y?n.altKey:n.ctrlKey)),i}function Ss(e,t,n,r){a?setTimeout(D($r,e),0):e.curOp.focus=I();var i,o=Es(e,n,r),s=e.doc.sel;e.options.dragDrop&&Re&&!e.isReadOnly()&&"single"==n&&(i=s.contains(t))>-1&&(at((i=s.ranges[i]).from(),t)<0||t.xRel>0)&&(at(i.to(),t)>0||t.xRel<0)?xs(e,r,t,o):Cs(e,r,t,o)}function xs(e,t,n,r){var i=e.display,o=!1,u=Ii(e,(function(t){l&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:qr(e)),ge(i.wrapper.ownerDocument,"mouseup",u),ge(i.wrapper.ownerDocument,"mousemove",c),ge(i.scroller,"dragstart",h),ge(i.scroller,"drop",u),o||(xe(t),r.addNew||Do(e.doc,n,null,null,r.extend),l&&!f||a&&9==s?setTimeout((function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()}),20):i.input.focus())})),c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},h=function(){return o=!0};l&&(i.scroller.draggable=!0),e.state.draggingText=u,u.copy=!r.moveOnDrag,de(i.wrapper.ownerDocument,"mouseup",u),de(i.wrapper.ownerDocument,"mousemove",c),de(i.scroller,"dragstart",h),de(i.scroller,"drop",u),e.state.delayingBlurEvent=!0,setTimeout((function(){return i.input.focus()}),20),i.scroller.dragDrop&&i.scroller.dragDrop()}function Os(e,t,n){if("char"==n)return new oo(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new oo(ot(t.line,0),ft(e.doc,ot(t.line+1,0)));var r=n(e,t);return new oo(r.from,r.to)}function Cs(e,t,n,r){a&&qr(e);var i=e.display,o=e.doc;xe(t);var s,l,u=o.sel,c=u.ranges;if(r.addNew&&!r.extend?(l=o.sel.contains(n),s=l>-1?c[l]:new oo(n,n)):(s=o.sel.primary(),l=o.sel.primIndex),"rectangle"==r.unit)r.addNew||(s=new oo(n,n)),n=Pr(e,t,!0,!0),l=-1;else{var h=Os(e,n,r.unit);s=r.extend?Po(s,h.anchor,h.head,r.extend):h}r.addNew?-1==l?(l=c.length,Go(o,ao(e,c.concat([s]),l),{scroll:!1,origin:"*mouse"})):c.length>1&&c[l].empty()&&"char"==r.unit&&!r.extend?(Go(o,ao(e,c.slice(0,l).concat(c.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),u=o.sel):Uo(o,l,s,j):(l=0,Go(o,new io([s],0),j),u=o.sel);var f=n;function p(t){if(0!=at(f,t))if(f=t,"rectangle"==r.unit){for(var i=[],a=e.options.tabSize,c=U(Ze(o,n.line).text,n.ch,a),h=U(Ze(o,t.line).text,t.ch,a),p=Math.min(c,h),d=Math.max(c,h),m=Math.min(n.line,t.line),g=Math.min(e.lastLine(),Math.max(n.line,t.line));m<=g;m++){var v=Ze(o,m).text,y=K(v,p,a);p==d?i.push(new oo(ot(m,y),ot(m,y))):v.length>y&&i.push(new oo(ot(m,y),ot(m,K(v,d,a))))}i.length||i.push(new oo(n,n)),Go(o,ao(e,u.ranges.slice(0,l).concat(i),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var T,E=s,S=Os(e,t,r.unit),x=E.anchor;at(S.anchor,x)>0?(T=S.head,x=ct(E.from(),S.anchor)):(T=S.anchor,x=ut(E.to(),S.head));var O=u.ranges.slice(0);O[l]=bs(e,new oo(ft(o,x),T)),Go(o,ao(e,O,l),j)}}var d=i.wrapper.getBoundingClientRect(),m=0;function g(t){var n=++m,a=Pr(e,t,!0,"rectangle"==r.unit);if(a)if(0!=at(a,f)){e.curOp.focus=I(),p(a);var s=ti(i,o);(a.line>=s.to||a.line<s.from)&&setTimeout(Ii(e,(function(){m==n&&g(t)})),150)}else{var l=t.clientY<d.top?-20:t.clientY>d.bottom?20:0;l&&setTimeout(Ii(e,(function(){m==n&&(i.scroller.scrollTop+=l,g(t))})),50)}}function v(t){e.state.selectingText=!1,m=1/0,t&&(xe(t),i.input.focus()),ge(i.wrapper.ownerDocument,"mousemove",y),ge(i.wrapper.ownerDocument,"mouseup",T),o.history.lastSelOrigin=null}var y=Ii(e,(function(e){0!==e.buttons&&Ne(e)?g(e):v(e)})),T=Ii(e,v);e.state.selectingText=T,de(i.wrapper.ownerDocument,"mousemove",y),de(i.wrapper.ownerDocument,"mouseup",T)}function bs(e,t){var n=t.anchor,r=t.head,i=Ze(e.doc,n.line);if(0==at(n,r)&&n.sticky==r.sticky)return t;var o=fe(i);if(!o)return t;var a=ce(o,n.ch,n.sticky),s=o[a];if(s.from!=n.ch&&s.to!=n.ch)return t;var l,u=a+(s.from==n.ch==(1!=s.level)?0:1);if(0==u||u==o.length)return t;if(r.line!=n.line)l=(r.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=ce(o,r.ch,r.sticky),h=c-a||(r.ch-n.ch)*(1==s.level?-1:1);l=c==u-1||c==u?h<0:h>0}var f=o[u+(l?-1:0)],p=l==(1==f.level),d=p?f.from:f.to,m=p?"after":"before";return n.ch==d&&n.sticky==m?t:new oo(new ot(n.line,d,m),r)}function ks(e,t,n,r){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&xe(t);var a=e.display,s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!Ee(e,n))return Ce(t);o-=s.top-a.viewOffset;for(var l=0;l<e.display.gutterSpecs.length;++l){var u=a.gutters.childNodes[l];if(u&&u.getBoundingClientRect().right>=i)return ve(e,n,e,nt(e.doc,o),e.display.gutterSpecs[l].className,t),Ce(t)}}function Ns(e,t){return ks(e,t,"gutterClick",!0)}function Ls(e,t){jn(e.display,t)||As(e,t)||ye(e,t,"contextmenu")||O||e.display.input.onContextMenu(t)}function As(e,t){return!!Ee(e,"gutterContextMenu")&&ks(e,t,"gutterContextMenu",!1)}function Rs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),fr(e)}gs.prototype.compare=function(e,t,n){return this.time+ms>e&&0==at(t,this.pos)&&n==this.button};var ws={toString:function(){return"CodeMirror.Init"}},Is={},Ms={};function _s(e){var t=e.optionHandlers;function n(n,r,i,o){e.defaults[n]=r,i&&(t[n]=o?function(e,t,n){n!=ws&&i(e,t,n)}:i)}e.defineOption=n,e.Init=ws,n("value","",(function(e,t){return e.setValue(t)}),!0),n("mode",null,(function(e,t){e.doc.modeOption=t,po(e)}),!0),n("indentUnit",2,po,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(e){mo(e),fr(e),Fr(e)}),!0),n("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first;e.doc.iter((function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,n.push(ot(r,o))}r++}));for(var i=n.length-1;i>=0;i--)ia(e.doc,t,n[i],ot(n[i].line,n[i].ch+t.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=ws&&e.refresh()})),n("specialCharPlaceholder",gn,(function(e){return e.refresh()}),!0),n("electricChars",!0),n("inputStyle",v?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),n("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),n("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),n("rtlMoveVisually",!E),n("wholeLineUpdateBefore",!0),n("theme","default",(function(e){Rs(e),Zi(e)}),!0),n("keyMap","default",(function(e,t,n){var r=Va(t),i=n!=ws&&Va(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ds,!0),n("gutters",[],(function(e,t){e.display.gutterSpecs=$i(t,e.options.lineNumbers),Zi(e)}),!0),n("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?Ir(e.display)+"px":"0",e.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(e){return yi(e)}),!0),n("scrollbarStyle","native",(function(e){Si(e),yi(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=$i(e.options.gutters,t),Zi(e)}),!0),n("firstLineNumber",1,Zi,!0),n("lineNumberFormatter",(function(e){return e}),Zi,!0),n("showCursorWhenSelecting",!1,zr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(e,t){"nocursor"==t&&(Jr(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),n("screenReaderLabel",null,(function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)})),n("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),n("dragDrop",!0,Ps),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,zr,!0),n("singleCursorHeightPerLine",!0,zr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,mo,!0),n("addModeClass",!1,mo,!0),n("pollInterval",100),n("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),n("historyEventDelay",1250),n("viewportMargin",10,(function(e){return e.refresh()}),!0),n("maxHighlightLength",1e4,mo,!0),n("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),n("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),n("autofocus",null),n("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),n("phrases",null)}function Ps(e,t,n){if(!t!=!(n&&n!=ws)){var r=e.display.dragFunctions,i=t?de:ge;i(e.display.scroller,"dragstart",r.start),i(e.display.scroller,"dragenter",r.enter),i(e.display.scroller,"dragover",r.over),i(e.display.scroller,"dragleave",r.leave),i(e.display.scroller,"drop",r.drop)}}function Ds(e){e.options.lineWrapping?(M(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(k(e.display.wrapper,"CodeMirror-wrap"),ln(e)),_r(e),Fr(e),fr(e),setTimeout((function(){return yi(e)}),100)}function Fs(e,t){var n=this;if(!(this instanceof Fs))return new Fs(e,t);this.options=t=t?F(t):{},F(Is,t,!1);var r=t.value;"string"==typeof r?r=new Oa(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Fs.inputStyles[t.inputStyle](this),o=this.display=new Ji(e,r,i,t);for(var u in o.wrapper.CodeMirror=this,Rs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Si(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new W,keySeq:null,specialChars:null},t.autofocus&&!v&&o.input.focus(),a&&s<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),Us(this),wa(),Oi(this),this.curOp.forceUpdate=!0,To(this,r),t.autofocus&&!v||this.hasFocus()?setTimeout((function(){n.hasFocus()&&!n.state.focused&&Zr(n)}),20):Jr(this),Ms)Ms.hasOwnProperty(u)&&Ms[u](this,t[u],ws);Xi(this),t.finishInit&&t.finishInit(this);for(var c=0;c<Ws.length;++c)Ws[c](this);Ci(this),l&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}function Us(e){var t=e.display;de(t.scroller,"mousedown",Ii(e,ys)),de(t.scroller,"dblclick",a&&s<11?Ii(e,(function(t){if(!ye(e,t)){var n=Pr(e,t);if(n&&!Ns(e,t)&&!jn(e.display,t)){xe(t);var r=e.findWordAt(n);Do(e.doc,r.anchor,r.head)}}})):function(t){return ye(e,t)||xe(t)}),de(t.scroller,"contextmenu",(function(t){return Ls(e,t)})),de(t.input.getField(),"contextmenu",(function(n){t.scroller.contains(n.target)||Ls(e,n)}));var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout((function(){return t.activeTouch=null}),1e3),(r=t.activeTouch).end=+new Date)}function o(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function l(e,t){if(null==t.left)return!0;var n=t.left-e.left,r=t.top-e.top;return n*n+r*r>400}de(t.scroller,"touchstart",(function(i){if(!ye(e,i)&&!o(i)&&!Ns(e,i)){t.input.ensurePolled(),clearTimeout(n);var a=+new Date;t.activeTouch={start:a,moved:!1,prev:a-r.end<=300?r:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}})),de(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),de(t.scroller,"touchend",(function(n){var r=t.activeTouch;if(r&&!jn(t,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var o,a=e.coordsChar(t.activeTouch,"page");o=!r.prev||l(r,r.prev)?new oo(a,a):!r.prev.prev||l(r,r.prev.prev)?e.findWordAt(a):new oo(ot(a.line,0),ft(e.doc,ot(a.line+1,0))),e.setSelection(o.anchor,o.head),e.focus(),xe(n)}i()})),de(t.scroller,"touchcancel",i),de(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(fi(e,t.scroller.scrollTop),di(e,t.scroller.scrollLeft,!0),ve(e,"scroll",e))})),de(t.scroller,"mousewheel",(function(t){return ro(e,t)})),de(t.scroller,"DOMMouseScroll",(function(t){return ro(e,t)})),de(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){ye(e,t)||be(t)},over:function(t){ye(e,t)||(Na(e,t),be(t))},start:function(t){return ka(e,t)},drop:Ii(e,ba),leave:function(t){ye(e,t)||La(e)}};var u=t.input.getField();de(u,"keyup",(function(t){return hs.call(e,t)})),de(u,"keydown",Ii(e,us)),de(u,"keypress",Ii(e,fs)),de(u,"focus",(function(t){return Zr(e,t)})),de(u,"blur",(function(t){return Jr(e,t)}))}Fs.defaults=Is,Fs.optionHandlers=Ms;var Ws=[];function Bs(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=Tt(e,t).state:n="prev");var a=e.options.tabSize,s=Ze(o,t),l=U(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(r||/\S/.test(s.text)){if("smart"==n&&((u=o.mode.indent(i,s.text.slice(c.length),s.text))==G||u>150)){if(!r)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>o.first?U(Ze(o,t-1).text,null,a):0:"add"==n?u=l+e.options.indentUnit:"subtract"==n?u=l-e.options.indentUnit:"number"==typeof n&&(u=l+n),u=Math.max(0,u);var h="",f=0;if(e.options.indentWithTabs)for(var p=Math.floor(u/a);p;--p)f+=a,h+="\t";if(f<u&&(h+=X(u-f)),h!=c)return ia(o,h,ot(t,0),ot(t,c.length),"+input"),s.stateAfter=null,!0;for(var d=0;d<o.sel.ranges.length;d++){var m=o.sel.ranges[d];if(m.head.line==t&&m.head.ch<c.length){var g=ot(t,c.length);Uo(o,d,new oo(g,g));break}}}Fs.defineInitHook=function(e){return Ws.push(e)};var Hs=null;function Gs(e){Hs=e}function zs(e,t,n,r,i){var o=e.doc;e.display.shift=!1,r||(r=o.sel);var a=+new Date-200,s="paste"==i||e.state.pasteIncoming>a,l=_e(t),u=null;if(s&&r.ranges.length>1)if(Hs&&Hs.text.join("\n")==t){if(r.ranges.length%Hs.text.length==0){u=[];for(var c=0;c<Hs.text.length;c++)u.push(o.splitLines(Hs.text[c]))}}else l.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(u=q(l,(function(e){return[e]})));for(var h=e.curOp.updateInput,f=r.ranges.length-1;f>=0;f--){var p=r.ranges[f],d=p.from(),m=p.to();p.empty()&&(n&&n>0?d=ot(d.line,d.ch-n):e.state.overwrite&&!s?m=ot(m.line,Math.min(Ze(o,m.line).text.length,m.ch+$(l).length)):s&&Hs&&Hs.lineWise&&Hs.text.join("\n")==l.join("\n")&&(d=m=ot(d.line,0)));var g={from:d,to:m,text:u?u[f%u.length]:l,origin:i||(s?"paste":e.state.cutIncoming>a?"cut":"+input")};Jo(e.doc,g),An(e,"inputRead",e,g)}t&&!s&&Vs(e,t),si(e),e.curOp.updateInput<2&&(e.curOp.updateInput=h),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function js(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||wi(t,(function(){return zs(t,n,0,null,"paste")})),!0}function Vs(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var s=0;s<o.electricChars.length;s++)if(t.indexOf(o.electricChars.charAt(s))>-1){a=Bs(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Ze(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Bs(e,i.head.line,"smart"));a&&An(e,"electricInput",e,i.head.line)}}}function Ks(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,o={anchor:ot(i,0),head:ot(i+1,0)};n.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:n}}function Ys(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Xs(){var e=A("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=A("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return l?e.style.width="1000px":e.setAttribute("wrap","off"),m&&(e.style.border="1px solid black"),Ys(e),t}function $s(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var r=this.options,i=r[e];r[e]==n&&"mode"!=e||(r[e]=n,t.hasOwnProperty(e)&&Ii(this,t[e])(this,n,i),ve(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Va(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:Mi((function(t,n){var r=t.token?t:e.getMode(this.options,t);if(r.startState)throw new Error("Overlays may not be stateful.");Z(this.state.overlays,{mode:r,modeSpec:t,opaque:n&&n.opaque,priority:n&&n.priority||0},(function(e){return e.priority})),this.state.modeGen++,Fr(this)})),removeOverlay:Mi((function(e){for(var t=this.state.overlays,n=0;n<t.length;++n){var r=t[n].modeSpec;if(r==e||"string"==typeof e&&r.name==e)return t.splice(n,1),this.state.modeGen++,void Fr(this)}})),indentLine:Mi((function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),rt(this.doc,e)&&Bs(this,e,t,n)})),indentSelection:Mi((function(e){for(var t=this.doc.sel.ranges,n=-1,r=0;r<t.length;r++){var i=t[r];if(i.empty())i.head.line>n&&(Bs(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&si(this));else{var o=i.from(),a=i.to(),s=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;l<n;++l)Bs(this,l,e);var u=this.doc.sel.ranges;0==o.ch&&t.length==u.length&&u[r].from().ch>0&&Uo(this.doc,r,new oo(o,u[r].to()),z)}}})),getTokenAt:function(e,t){return Ct(this,e,t)},getLineTokens:function(e,t){return Ct(this,ot(e),t,!0)},getTokenTypeAt:function(e){e=ft(this.doc,e);var t,n=yt(this,Ze(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]<o)){t=n[2*a+2];break}r=a+1}}var s=t?t.indexOf("overlay "):-1;return s<0?t:0==s?null:t.slice(0,s-1)},getModeAt:function(t){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(t).state).mode:n},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!n.hasOwnProperty(t))return r;var i=n[t],o=this.getModeAt(e);if("string"==typeof o[t])i[o[t]]&&r.push(i[o[t]]);else if(o[t])for(var a=0;a<o[t].length;a++){var s=i[o[t][a]];s&&r.push(s)}else o.helperType&&i[o.helperType]?r.push(i[o.helperType]):i[o.name]&&r.push(i[o.name]);for(var l=0;l<i._global.length;l++){var u=i._global[l];u.pred(o,this)&&-1==B(r,u.val)&&r.push(u.val)}return r},getStateAfter:function(e,t){var n=this.doc;return Tt(this,(e=ht(n,null==e?n.first+n.size-1:e))+1,t).state},cursorCoords:function(e,t){var n=this.doc.sel.primary();return Tr(this,null==e?n.head:"object"==typeof e?ft(this.doc,e):e?n.from():n.to(),t||"page")},charCoords:function(e,t){return yr(this,ft(this.doc,e),t||"page")},coordsChar:function(e,t){return xr(this,(e=vr(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=vr(this,{top:e,left:0},t||"page").top,nt(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var r,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),r=Ze(this.doc,e)}else r=e;return gr(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-an(r):0)},defaultTextHeight:function(){return Ar(this.display)},defaultCharWidth:function(){return Rr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o=this.display,a=(e=Tr(this,ft(this.doc,e))).bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==r)a=e.top;else if("above"==r||"near"==r){var l=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>l)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=l&&(a=e.bottom),s+t.offsetWidth>u&&(s=u-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),n&&ii(this,{left:s,top:a,right:s+t.offsetWidth,bottom:a+t.offsetHeight})},triggerOnKeyDown:Mi(us),triggerOnKeyPress:Mi(fs),triggerOnKeyUp:hs,triggerOnMouseDown:Mi(ys),execCommand:function(e){if(Za.hasOwnProperty(e))return Za[e].call(null,this)},triggerElectric:Mi((function(e){Vs(this,e)})),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=ft(this.doc,e),a=0;a<t&&!(o=qs(this.doc,o,i,n,r)).hitSide;++a);return o},moveH:Mi((function(e,t){var n=this;this.extendSelectionsBy((function(r){return n.display.shift||n.doc.extend||r.empty()?qs(n.doc,r.head,e,t,n.options.rtlMoveVisually):e<0?r.from():r.to()}),V)})),deleteH:Mi((function(e,t){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):Ka(this,(function(n){var i=qs(r,n.head,e,t,!1);return e<0?{from:i,to:n.head}:{from:n.head,to:i}}))})),findPosV:function(e,t,n,r){var i=1,o=r;t<0&&(i=-1,t=-t);for(var a=ft(this.doc,e),s=0;s<t;++s){var l=Tr(this,a,"div");if(null==o?o=l.left:l.left=o,(a=Zs(this,l,i,n)).hitSide)break}return a},moveV:Mi((function(e,t){var n=this,r=this.doc,i=[],o=!this.display.shift&&!r.extend&&r.sel.somethingSelected();if(r.extendSelectionsBy((function(a){if(o)return e<0?a.from():a.to();var s=Tr(n,a.head,"div");null!=a.goalColumn&&(s.left=a.goalColumn),i.push(s.left);var l=Zs(n,s,e,t);return"page"==t&&a==r.sel.primary()&&ai(n,yr(n,l,"div").top-s.top),l}),V),i.length)for(var a=0;a<r.sel.ranges.length;a++)r.sel.ranges[a].goalColumn=i[a]})),findWordAt:function(e){var t=Ze(this.doc,e.line).text,n=e.ch,r=e.ch;if(t){var i=this.getHelper(e,"wordChars");"before"!=e.sticky&&r!=t.length||!n?++r:--n;for(var o=t.charAt(n),a=ne(o,i)?function(e){return ne(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!ne(e)};n>0&&a(t.charAt(n-1));)--n;for(;r<t.length&&a(t.charAt(r));)++r}return new oo(ot(e.line,n),ot(e.line,r))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?M(this.display.cursorDiv,"CodeMirror-overwrite"):k(this.display.cursorDiv,"CodeMirror-overwrite"),ve(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==I()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Mi((function(e,t){li(this,e,t)})),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Xn(this)-this.display.barHeight,width:e.scrollWidth-Xn(this)-this.display.barWidth,clientHeight:qn(this),clientWidth:$n(this)}},scrollIntoView:Mi((function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:ot(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?ui(this,e):hi(this,e.from,e.to,e.margin)})),setSize:Mi((function(e,t){var n=this,r=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=r(e)),null!=t&&(this.display.wrapper.style.height=r(t)),this.options.lineWrapping&&hr(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,(function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){Ur(n,i,"widget");break}++i})),this.curOp.forceUpdate=!0,ve(this,"refresh",this)})),operation:function(e){return wi(this,e)},startOperation:function(){return Oi(this)},endOperation:function(){return Ci(this)},refresh:Mi((function(){var e=this.display.cachedTextHeight;Fr(this),this.curOp.forceUpdate=!0,fr(this),li(this,this.doc.scrollLeft,this.doc.scrollTop),Vi(this.display),(null==e||Math.abs(e-Ar(this.display))>.5||this.options.lineWrapping)&&_r(this),ve(this,"refresh",this)})),swapDoc:Mi((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),To(this,e),fr(this),this.display.input.reset(),li(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,An(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Se(e),e.registerHelper=function(t,r,i){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][r]=i},e.registerGlobalHelper=function(t,r,i,o){e.registerHelper(t,r,o),n[t]._global.push({pred:i,val:o})}}function qs(e,t,n,r,i){var o=t,a=n,s=Ze(e,t.line),l=i&&"rtl"==e.direction?-n:n;function u(){var n=t.line+l;return!(n<e.first||n>=e.first+e.size)&&(t=new ot(n,t.ch,t.sticky),s=Ze(e,n))}function c(o){var a;if("codepoint"==r){var c=s.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(c))a=null;else{var h=n>0?c>=55296&&c<56320:c>=56320&&c<57343;a=new ot(t.line,Math.max(0,Math.min(s.text.length,t.ch+n*(h?2:1))),-n)}}else a=i?qa(e.cm,s,t,n):Xa(s,t,n);if(null==a){if(o||!u())return!1;t=$a(i,e.cm,s,t.line,l)}else t=a;return!0}if("char"==r||"codepoint"==r)c();else if("column"==r)c(!0);else if("word"==r||"group"==r)for(var h=null,f="group"==r,p=e.cm&&e.cm.getHelper(t,"wordChars"),d=!0;!(n<0)||c(!d);d=!1){var m=s.text.charAt(t.ch)||"\n",g=ne(m,p)?"w":f&&"\n"==m?"n":!f||/\s/.test(m)?null:"p";if(!f||d||g||(g="s"),h&&h!=g){n<0&&(n=1,c(),t.sticky="after");break}if(g&&(h=g),n>0&&!c(!d))break}var v=Xo(e,t,o,a,!0);return st(o,v)&&(v.hitSide=!0),v}function Zs(e,t,n,r){var i,o,a=e.doc,s=t.left;if("page"==r){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(l-.5*Ar(e.display),3);i=(n>0?t.bottom:t.top)+n*u}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;(o=xr(e,s,i)).outside;){if(n<0?i<=0:i>=a.height){o.hitSide=!0;break}i+=5*n}return o}var Js=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new W,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Qs(e,t){var n=tr(e,t.line);if(!n||n.hidden)return null;var r=Ze(e.doc,t.line),i=Jn(n,r,t.line),o=fe(r,e.doc.direction),a="left";o&&(a=ce(o,t.ch)%2?"right":"left");var s=ar(i.map,t.ch,a);return s.offset="right"==s.collapse?s.end:s.start,s}function el(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function tl(e,t){return t&&(e.bad=!0),e}function nl(e,t,n,r,i){var o="",a=!1,s=e.doc.lineSeparator(),l=!1;function u(e){return function(t){return t.id==e}}function c(){a&&(o+=s,l&&(o+=s),a=l=!1)}function h(e){e&&(c(),o+=e)}function f(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void h(n);var o,p=t.getAttribute("cm-marker");if(p){var d=e.findMarks(ot(r,0),ot(i+1,0),u(+p));return void(d.length&&(o=d[0].find(0))&&h(Je(e.doc,o.from,o.to).join(s)))}if("false"==t.getAttribute("contenteditable"))return;var m=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;m&&c();for(var g=0;g<t.childNodes.length;g++)f(t.childNodes[g]);/^(pre|p)$/i.test(t.nodeName)&&(l=!0),m&&(a=!0)}else 3==t.nodeType&&h(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;f(t),t!=n;)t=t.nextSibling,l=!1;return o}function rl(e,t,n){var r;if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[n]))return tl(e.clipPos(ot(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==r)return il(o,t,n)}}function il(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!w(r,t))return tl(ot(tt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var o=e.rest?$(e.rest):e.line;return tl(ot(tt(o),o.text.length),i)}var a=3==t.nodeType?t:null,s=t;for(a||1!=t.childNodes.length||3!=t.firstChild.nodeType||(a=t.firstChild,n&&(n=a.nodeValue.length));s.parentNode!=r;)s=s.parentNode;var l=e.measure,u=l.maps;function c(t,n,r){for(var i=-1;i<(u?u.length:0);i++)for(var o=i<0?l.map:u[i],a=0;a<o.length;a+=3){var s=o[a+2];if(s==t||s==n){var c=tt(i<0?e.line:e.rest[i]),h=o[a]+r;return(r<0||s!=t)&&(h=o[a+(r?1:0)]),ot(c,h)}}}var h=c(a,s,n);if(h)return tl(h,i);for(var f=s.nextSibling,p=a?a.nodeValue.length-n:0;f;f=f.nextSibling){if(h=c(f,f.firstChild,0))return tl(ot(h.line,h.ch-p),i);p+=f.textContent.length}for(var d=s.previousSibling,m=n;d;d=d.previousSibling){if(h=c(d,d.firstChild,-1))return tl(ot(h.line,h.ch+m),i);m+=d.textContent.length}}Js.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;function o(e){for(var t=e.target;t;t=t.parentNode){if(t==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(t.className))break}return!1}function a(e){if(o(e)&&!ye(r,e)){if(r.somethingSelected())Gs({lineWise:!1,text:r.getSelections()}),"cut"==e.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var t=Ks(r);Gs({lineWise:!0,text:t.text}),"cut"==e.type&&r.operation((function(){r.setSelections(t.ranges,0,z),r.replaceSelection("",null,"cut")}))}if(e.clipboardData){e.clipboardData.clearData();var a=Hs.text.join("\n");if(e.clipboardData.setData("Text",a),e.clipboardData.getData("Text")==a)return void e.preventDefault()}var s=Xs(),l=s.firstChild;r.display.lineSpace.insertBefore(s,r.display.lineSpace.firstChild),l.value=Hs.text.join("\n");var u=I();P(l),setTimeout((function(){r.display.lineSpace.removeChild(s),u.focus(),u==i&&n.showPrimarySelection()}),50)}}i.contentEditable=!0,Ys(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize),de(i,"paste",(function(e){!o(e)||ye(r,e)||js(e,r)||s<=11&&setTimeout(Ii(r,(function(){return t.updateFromDOM()})),20)})),de(i,"compositionstart",(function(e){t.composing={data:e.data,done:!1}})),de(i,"compositionupdate",(function(e){t.composing||(t.composing={data:e.data,done:!1})})),de(i,"compositionend",(function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)})),de(i,"touchstart",(function(){return n.forceCompositionEnd()})),de(i,"input",(function(){t.composing||t.readFromDOMSoon()})),de(i,"copy",a),de(i,"cut",a)},Js.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Js.prototype.prepareSelection=function(){var e=jr(this.cm,!1);return e.focus=I()==this.div,e},Js.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Js.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Js.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),i=r.from(),o=r.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||o.line<t.display.viewFrom)e.removeAllRanges();else{var a=rl(t,e.anchorNode,e.anchorOffset),s=rl(t,e.focusNode,e.focusOffset);if(!a||a.bad||!s||s.bad||0!=at(ct(a,s),i)||0!=at(ut(a,s),o)){var l=t.display.view,u=i.line>=t.display.viewFrom&&Qs(t,i)||{node:l[0].measure.map[2],offset:0},c=o.line<t.display.viewTo&&Qs(t,o);if(!c){var h=l[l.length-1].measure,f=h.maps?h.maps[h.maps.length-1]:h.map;c={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}if(u&&c){var p,d=e.rangeCount&&e.getRangeAt(0);try{p=b(u.node,u.offset,c.offset,c.node)}catch(e){}p&&(!n&&t.state.focused?(e.collapse(u.node,u.offset),p.collapsed||(e.removeAllRanges(),e.addRange(p))):(e.removeAllRanges(),e.addRange(p)),d&&null==e.anchorNode?e.addRange(d):n&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},Js.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation((function(){return e.cm.curOp.selectionChanged=!0}))}),20)},Js.prototype.showMultipleSelections=function(e){L(this.cm.display.cursorDiv,e.cursors),L(this.cm.display.selectionDiv,e.selection)},Js.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Js.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return w(this.div,t)},Js.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&I()==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Js.prototype.blur=function(){this.div.blur()},Js.prototype.getField=function(){return this.div},Js.prototype.supportsTouch=function(){return!0},Js.prototype.receivedFocus=function(){var e=this;function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.selectionInEditor()?this.pollSelection():wi(this.cm,(function(){return e.cm.curOp.selectionChanged=!0})),this.polling.set(this.cm.options.pollInterval,t)},Js.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Js.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(g&&c&&this.cm.display.gutterSpecs.length&&el(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var n=rl(t,e.anchorNode,e.anchorOffset),r=rl(t,e.focusNode,e.focusOffset);n&&r&&wi(t,(function(){Go(t.doc,so(n,r),z),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)}))}}},Js.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,n,r=this.cm,i=r.display,o=r.doc.sel.primary(),a=o.from(),s=o.to();if(0==a.ch&&a.line>r.firstLine()&&(a=ot(a.line-1,Ze(r.doc,a.line-1).length)),s.ch==Ze(r.doc,s.line).text.length&&s.line<r.lastLine()&&(s=ot(s.line+1,0)),a.line<i.viewFrom||s.line>i.viewTo-1)return!1;a.line==i.viewFrom||0==(e=Dr(r,a.line))?(t=tt(i.view[0].line),n=i.view[0].node):(t=tt(i.view[e].line),n=i.view[e-1].node.nextSibling);var l,u,c=Dr(r,s.line);if(c==i.view.length-1?(l=i.viewTo-1,u=i.lineDiv.lastChild):(l=tt(i.view[c+1].line)-1,u=i.view[c+1].node.previousSibling),!n)return!1;for(var h=r.doc.splitLines(nl(r,n,u,t,l)),f=Je(r.doc,ot(t,0),ot(l,Ze(r.doc,l).text.length));h.length>1&&f.length>1;)if($(h)==$(f))h.pop(),f.pop(),l--;else{if(h[0]!=f[0])break;h.shift(),f.shift(),t++}for(var p=0,d=0,m=h[0],g=f[0],v=Math.min(m.length,g.length);p<v&&m.charCodeAt(p)==g.charCodeAt(p);)++p;for(var y=$(h),T=$(f),E=Math.min(y.length-(1==h.length?p:0),T.length-(1==f.length?p:0));d<E&&y.charCodeAt(y.length-d-1)==T.charCodeAt(T.length-d-1);)++d;if(1==h.length&&1==f.length&&t==a.line)for(;p&&p>a.ch&&y.charCodeAt(y.length-d-1)==T.charCodeAt(T.length-d-1);)p--,d++;h[h.length-1]=y.slice(0,y.length-d).replace(/^\u200b+/,""),h[0]=h[0].slice(p).replace(/\u200b+$/,"");var S=ot(t,p),x=ot(l,f.length?$(f).length-d:0);return h.length>1||h[0]||at(S,x)?(ia(r.doc,h,S,x,"+input"),!0):void 0},Js.prototype.ensurePolled=function(){this.forceCompositionEnd()},Js.prototype.reset=function(){this.forceCompositionEnd()},Js.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Js.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()}),80))},Js.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||wi(this.cm,(function(){return Fr(e.cm)}))},Js.prototype.setUneditable=function(e){e.contentEditable="false"},Js.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Ii(this.cm,zs)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Js.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Js.prototype.onContextMenu=function(){},Js.prototype.resetPosition=function(){},Js.prototype.needsContentAttribute=!0;var ol=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new W,this.hasSelection=!1,this.composing=null};function al(e,t){if((t=t?F(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=I();t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}function r(){e.value=s.getValue()}var i;if(e.form&&(de(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch(e){}}t.finishInit=function(n){n.save=r,n.getTextArea=function(){return e},n.toTextArea=function(){n.toTextArea=isNaN,r(),e.parentNode.removeChild(n.getWrapperElement()),e.style.display="",e.form&&(ge(e.form,"submit",r),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=i))}},e.style.display="none";var s=Fs((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return s}function sl(e){e.off=ge,e.on=de,e.wheelEventPixels=no,e.Doc=Oa,e.splitLines=_e,e.countColumn=U,e.findColumn=K,e.isWordChar=te,e.Pass=G,e.signal=ve,e.Line=un,e.changeEnd=lo,e.scrollbarModel=Ei,e.Pos=ot,e.cmpPos=at,e.modes=We,e.mimeModes=Be,e.resolveMode=ze,e.getMode=je,e.modeExtensions=Ve,e.extendMode=Ke,e.copyState=Ye,e.startState=$e,e.innerMode=Xe,e.commands=Za,e.keyMap=Ua,e.keyName=ja,e.isModifierKey=Ga,e.lookupKey=Ha,e.normalizeKeyMap=Ba,e.StringStream=qe,e.SharedTextMarker=va,e.TextMarker=ma,e.LineWidget=ha,e.e_preventDefault=xe,e.e_stopPropagation=Oe,e.e_stop=be,e.addClass=M,e.contains=w,e.rmClass=k,e.keyNames=_a}ol.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;function o(e){if(!ye(r,e)){if(r.somethingSelected())Gs({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var t=Ks(r);Gs({lineWise:!0,text:t.text}),"cut"==e.type?r.setSelections(t.ranges,null,z):(n.prevInput="",i.value=t.text.join("\n"),P(i))}"cut"==e.type&&(r.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),m&&(i.style.width="0px"),de(i,"input",(function(){a&&s>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()})),de(i,"paste",(function(e){ye(r,e)||js(e,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())})),de(i,"cut",o),de(i,"copy",o),de(e.scroller,"paste",(function(t){if(!jn(e,t)&&!ye(r,t)){if(!i.dispatchEvent)return r.state.pasteIncoming=+new Date,void n.focus();var o=new Event("paste");o.clipboardData=t.clipboardData,i.dispatchEvent(o)}})),de(e.lineSpace,"selectstart",(function(t){jn(e,t)||xe(t)})),de(i,"compositionstart",(function(){var e=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}})),de(i,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},ol.prototype.createField=function(e){this.wrapper=Xs(),this.textarea=this.wrapper.firstChild},ol.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},ol.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=jr(e);if(e.options.moveInputWithCursor){var i=Tr(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},ol.prototype.showSelection=function(e){var t=this.cm.display;L(t.cursorDiv,e.cursors),L(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},ol.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&P(this.textarea),a&&s>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",a&&s>=9&&(this.hasSelection=null))}},ol.prototype.getField=function(){return this.textarea},ol.prototype.supportsTouch=function(){return!1},ol.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||I()!=this.textarea))try{this.textarea.focus()}catch(e){}},ol.prototype.blur=function(){this.textarea.blur()},ol.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ol.prototype.receivedFocus=function(){this.slowPoll()},ol.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},ol.prototype.fastPoll=function(){var e=!1,t=this;function n(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))}t.pollingFast=!0,t.polling.set(20,n)},ol.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Pe(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(a&&s>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r=""),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var l=0,u=Math.min(r.length,i.length);l<u&&r.charCodeAt(l)==i.charCodeAt(l);)++l;return wi(t,(function(){zs(t,i.slice(l),r.length-l,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},ol.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ol.prototype.onKeyPress=function(){a&&s>=9&&(this.hasSelection=null),this.fastPoll()},ol.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=Pr(n,e),u=r.scroller.scrollTop;if(o&&!h){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(o)&&Ii(n,Go)(n.doc,so(o),z);var c,f=i.style.cssText,p=t.wrapper.style.cssText,d=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-d.top-5)+"px; left: "+(e.clientX-d.left-5)+"px;\n z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",l&&(c=window.scrollY),r.input.focus(),l&&window.scrollTo(null,c),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=v,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll),a&&s>=9&&g(),O){be(e);var m=function(){ge(window,"mouseup",m),setTimeout(v,20)};de(window,"mouseup",m)}else setTimeout(v,50)}function g(){if(null!=i.selectionStart){var e=n.somethingSelected(),o=""+(e?i.value:"");i.value="⇚",i.value=o,t.prevInput=e?"":"",i.selectionStart=1,i.selectionEnd=o.length,r.selForContextMenu=n.doc.sel}}function v(){if(t.contextMenuPending==v&&(t.contextMenuPending=!1,t.wrapper.style.cssText=p,i.style.cssText=f,a&&s<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=u),null!=i.selectionStart)){(!a||a&&s<9)&&g();var e=0,o=function(){r.selForContextMenu==n.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&""==t.prevInput?Ii(n,qo)(n):e++<10?r.detectingSelectAll=setTimeout(o,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(o,200)}}},ol.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},ol.prototype.setUneditable=function(){},ol.prototype.needsContentAttribute=!1,_s(Fs),$s(Fs);var ll="iter insert remove copy getEditor constructor".split(" ");for(var ul in Oa.prototype)Oa.prototype.hasOwnProperty(ul)&&B(ll,ul)<0&&(Fs.prototype[ul]=function(e){return function(){return e.apply(this.doc,arguments)}}(Oa.prototype[ul]));return Se(Oa),Fs.inputStyles={textarea:ol,contenteditable:Js},Fs.defineMode=function(e){Fs.defaults.mode||"null"==e||(Fs.defaults.mode=e),He.apply(this,arguments)},Fs.defineMIME=Ge,Fs.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),Fs.defineMIME("text/plain","null"),Fs.defineExtension=function(e,t){Fs.prototype[e]=t},Fs.defineDocExtension=function(e,t){Oa.prototype[e]=t},Fs.fromTextArea=al,sl(Fs),Fs.version="5.62.0",Fs}()},4217:(e,t,n)=>{"use strict";n.r(t)},3977:(e,t,n)=>{"use strict";n.r(t)},6217:(e,t,n)=>{"use strict";n.r(t)},7521:(e,t,n)=>{"use strict";n.r(t)},4556:function(e,t){var n,r,i;"undefined"!=typeof self&&self,r=[],void 0===(i="function"==typeof(n=function(){function e(){}e.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},e.prototype.restoreState=function(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx},e.prototype.pattern=function(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");var t=this.disjunction();this.consumeChar("/");for(var n={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":s(n,"global");break;case"i":s(n,"ignoreCase");break;case"m":s(n,"multiLine");break;case"u":s(n,"unicode");break;case"y":s(n,"sticky")}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:t,loc:this.loc(0)}},e.prototype.disjunction=function(){var e=[],t=this.idx;for(e.push(this.alternative());"|"===this.peekChar();)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}},e.prototype.alternative=function(){for(var e=[],t=this.idx;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}},e.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},e.prototype.assertion=function(){var e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":var t;switch(this.consumeChar("?"),this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead"}l(t);var n=this.disjunction();return this.consumeChar(")"),{type:t,value:n,loc:this.loc(e)}}u()},e.prototype.quantifier=function(e){var t,n=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":var r=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:r,atMost:r};break;case",":t=this.isDigit()?{atLeast:r,atMost:this.integerIncludingZero()}:{atLeast:r,atMost:1/0},this.consumeChar("}")}if(!0===e&&void 0===t)return;l(t)}if(!0!==e||void 0!==t)return l(t),"?"===this.peekChar(0)?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(n),t},e.prototype.atom=function(){var e,t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group()}return void 0===e&&this.isPatternCharacter()&&(e=this.patternCharacter()),l(e),e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e},e.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[o("\n"),o("\r"),o("\u2028"),o("\u2029")]}},e.prototype.atomEscape=function(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},e.prototype.decimalEscapeAtom=function(){return{type:"GroupBackReference",value:this.positiveInteger()}},e.prototype.characterClassEscape=function(){var e,t=!1;switch(this.popChar()){case"d":e=c;break;case"D":e=c,t=!0;break;case"s":e=f;break;case"S":e=f,t=!0;break;case"w":e=h;break;case"W":e=h,t=!0}return l(e),{type:"Set",value:e,complement:t}},e.prototype.controlEscapeAtom=function(){var e;switch(this.popChar()){case"f":e=o("\f");break;case"n":e=o("\n");break;case"r":e=o("\r");break;case"t":e=o("\t");break;case"v":e=o("\v")}return l(e),{type:"Character",value:e}},e.prototype.controlLetterEscapeAtom=function(){this.consumeChar("c");var e=this.popChar();if(!1===/[a-zA-Z]/.test(e))throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}},e.prototype.nulCharacterAtom=function(){return this.consumeChar("0"),{type:"Character",value:o("\0")}},e.prototype.hexEscapeSequenceAtom=function(){return this.consumeChar("x"),this.parseHexDigits(2)},e.prototype.regExpUnicodeEscapeSequenceAtom=function(){return this.consumeChar("u"),this.parseHexDigits(4)},e.prototype.identityEscapeAtom=function(){return{type:"Character",value:o(this.popChar())}},e.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case"\n":case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:return{type:"Character",value:o(this.popChar())}}},e.prototype.characterClass=function(){var e=[],t=!1;for(this.consumeChar("["),"^"===this.peekChar(0)&&(this.consumeChar("^"),t=!0);this.isClassAtom();){var n=this.classAtom();if("Character"===n.type&&this.isRangeDash()){this.consumeChar("-");var r=this.classAtom();if("Character"===r.type){if(r.value<n.value)throw Error("Range out of order in character class");e.push({from:n.value,to:r.value})}else a(n.value,e),e.push(o("-")),a(r.value,e)}else a(n.value,e)}return this.consumeChar("]"),{type:"Set",complement:t,value:e}},e.prototype.classAtom=function(){switch(this.peekChar()){case"]":case"\n":case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}},e.prototype.classEscape=function(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:o("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},e.prototype.group=function(){var e=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),e=!1;break;default:this.groupIdx++}var t=this.disjunction();this.consumeChar(")");var n={type:"Group",capturing:e,value:t};return e&&(n.idx=this.groupIdx),n},e.prototype.positiveInteger=function(){var e=this.popChar();if(!1===i.test(e))throw Error("Expecting a positive integer");for(;r.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)},e.prototype.integerIncludingZero=function(){var e=this.popChar();if(!1===r.test(e))throw Error("Expecting an integer");for(;r.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)},e.prototype.patternCharacter=function(){var e=this.popChar();switch(e){case"\n":case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:o(e)}}},e.prototype.isRegExpFlag=function(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}},e.prototype.isRangeDash=function(){return"-"===this.peekChar()&&this.isClassAtom(1)},e.prototype.isDigit=function(){return r.test(this.peekChar(0))},e.prototype.isClassAtom=function(e){switch(void 0===e&&(e=0),this.peekChar(e)){case"]":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},e.prototype.isTerm=function(){return this.isAtom()||this.isAssertion()},e.prototype.isAtom=function(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}},e.prototype.isAssertion=function(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return"?"===this.peekChar(1)&&("="===this.peekChar(2)||"!"===this.peekChar(2));default:return!1}},e.prototype.isQuantifier=function(){var e=this.saveState();try{return void 0!==this.quantifier(!0)}catch(e){return!1}finally{this.restoreState(e)}},e.prototype.isPatternCharacter=function(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},e.prototype.parseHexDigits=function(e){for(var t="",r=0;r<e;r++){var i=this.popChar();if(!1===n.test(i))throw Error("Expecting a HexDecimal digits");t+=i}return{type:"Character",value:parseInt(t,16)}},e.prototype.peekChar=function(e){return void 0===e&&(e=0),this.input[this.idx+e]},e.prototype.popChar=function(){var e=this.peekChar(0);return this.consumeChar(),e},e.prototype.consumeChar=function(e){if(void 0!==e&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++},e.prototype.loc=function(e){return{begin:e,end:this.idx}};var t,n=/[0-9a-fA-F]/,r=/[0-9]/,i=/[1-9]/;function o(e){return e.charCodeAt(0)}function a(e,t){void 0!==e.length?e.forEach((function(e){t.push(e)})):t.push(e)}function s(e,t){if(!0===e[t])throw"duplicate flag "+t;e[t]=!0}function l(e){if(void 0===e)throw Error("Internal Error - Should never get here!")}function u(){throw Error("Internal Error - Should never get here!")}var c=[];for(t=o("0");t<=o("9");t++)c.push(t);var h=[o("_")].concat(c);for(t=o("a");t<=o("z");t++)h.push(t);for(t=o("A");t<=o("Z");t++)h.push(t);var f=[o(" "),o("\f"),o("\n"),o("\r"),o("\t"),o("\v"),o("\t"),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o("\u2028"),o("\u2029"),o(" "),o(" "),o(" "),o("\ufeff")];function p(){}return p.prototype.visitChildren=function(e){for(var t in e){var n=e[t];e.hasOwnProperty(t)&&(void 0!==n.type?this.visit(n):Array.isArray(n)&&n.forEach((function(e){this.visit(e)}),this))}},p.prototype.visit=function(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e)}this.visitChildren(e)},p.prototype.visitPattern=function(e){},p.prototype.visitFlags=function(e){},p.prototype.visitDisjunction=function(e){},p.prototype.visitAlternative=function(e){},p.prototype.visitStartAnchor=function(e){},p.prototype.visitEndAnchor=function(e){},p.prototype.visitWordBoundary=function(e){},p.prototype.visitNonWordBoundary=function(e){},p.prototype.visitLookahead=function(e){},p.prototype.visitNegativeLookahead=function(e){},p.prototype.visitCharacter=function(e){},p.prototype.visitSet=function(e){},p.prototype.visitGroup=function(e){},p.prototype.visitGroupBackReference=function(e){},p.prototype.visitQuantifier=function(e){},{RegExpParser:e,BaseRegExpVisitor:p,VERSION:"0.5.0"}})?n.apply(t,r):n)||(e.exports=i)},3236:(e,t,n)=>{"use strict";
|
||
/*! Copyright (c) 2021 Patrick Demian; Licensed under MIT */Object.defineProperty(t,"__esModule",{value:!0}),t.RegularExpressionCST=t.IfIdentStatementCST=t.IfPatternStatementCST=t.BackrefStatementCST=t.GroupStatementCST=t.RepeatStatementCST=t.MatchStatementCST=t.CountSubStatementCST=t.UsingStatementCST=t.MatchSubStatementCST=t.StatementCST=t.MatchStatementValue=t.MatchSubStatementValue=t.MatchSubStatementType=t.UsingFlags=t.H2RCST=t.GeneratorContext=t.RegexDialect=void 0;const r=n(9005),i=n(4953);var o;!function(e){e[e.JS=0]="JS",e[e.PCRE=1]="PCRE",e[e.DotNet=2]="DotNet",e[e.Java=3]="Java",e[e.Python=4]="Python",e[e.Boost=5]="Boost"}(o=t.RegexDialect||(t.RegexDialect={}));const a=["C","Cc","Cf","Cn","Co","Cs","L","Ll","Lm","Lo","Lt","Lu","M","Mc","Me","Mn","N","Nd","Nl","No","P","Pc","Pd","Pe","Pf","Pi","Po","Ps","S","Sc","Sk","Sm","So","Z","Zl","Zp","Zs"],s=["Arabic","Armenian","Avestan","Balinese","Bamum","Batak","Bengali","Bopomofo","Brahmi","Braille","Buginese","Buhid","Canadian_Aboriginal","Carian","Chakma","Cham","Cherokee","Common","Coptic","Cuneiform","Cypriot","Cyrillic","Deseret","Devanagari","Egyptian_Hieroglyphs","Ethiopic","Georgian","Glagolitic","Gothic","Greek","Gujarati","Gurmukhi","Han","Hangul","Hanunoo","Hebrew","Hiragana","Imperial_Aramaic","Inherited","Inscriptional_Pahlavi","Inscriptional_Parthian","Javanese","Kaithi","Kannada","Katakana","Kayah_Li","Kharoshthi","Khmer","Lao","Latin","Lepcha","Limbu","Linear_B","Lisu","Lycian","Lydian","Malayalam","Mandaic","Meetei_Mayek","Meroitic_Cursive","Meroitic_Hieroglyphs","Miao","Mongolian","Myanmar","New_Tai_Lue","Nko","Ogham","Old_Italic","Old_Persian","Old_South_Arabian","Old_Turkic","Ol_Chiki","Oriya","Osmanya","Phags_Pa","Phoenician","Rejang","Runic","Samaritan","Saurashtra","Sharada","Shavian","Sinhala","Sora_Sompeng","Sundanese","Syloti_Nagri","Syriac","Tagalog","Tagbanwa","Tai_Le","Tai_Tham","Tai_Viet","Takri","Tamil","Telugu","Thaana","Thai","Tibetan","Tifinagh","Ugaritic","Vai","Yi"];t.GeneratorContext=class{constructor(){this.groups={}}hasGroup(e){return Object.prototype.hasOwnProperty.call(this.groups,e)}addGroup(e,t){var n,i,o;const a=r.first(t),s=r.last(t);this.groups[e]={startLine:null!==(n=a.startLine)&&void 0!==n?n:NaN,startColumn:null!==(i=a.startColumn)&&void 0!==i?i:NaN,length:(null!==(o=s.endOffset)&&void 0!==o?o:s.startOffset)-a.startOffset}}};class l{constructor(e){this.tokens=e}error(e){var t,n,i;const o=r.first(this.tokens),a=r.last(this.tokens);return{startLine:null!==(t=o.startLine)&&void 0!==t?t:NaN,startColumn:null!==(n=o.startColumn)&&void 0!==n?n:NaN,length:(null!==(i=a.endOffset)&&void 0!==i?i:a.startOffset)-o.startOffset,message:e}}}var u,c;t.H2RCST=l,function(e){e[e.Multiline=r.makeFlag(0)]="Multiline",e[e.Global=r.makeFlag(1)]="Global",e[e.Sensitive=r.makeFlag(2)]="Sensitive",e[e.Insensitive=r.makeFlag(3)]="Insensitive",e[e.Exact=r.makeFlag(4)]="Exact"}(u=t.UsingFlags||(t.UsingFlags={})),function(e){e[e.SingleString=0]="SingleString",e[e.Between=1]="Between",e[e.Anything=2]="Anything",e[e.Word=3]="Word",e[e.Digit=4]="Digit",e[e.Character=5]="Character",e[e.Whitespace=6]="Whitespace",e[e.Number=7]="Number",e[e.Tab=8]="Tab",e[e.Linefeed=9]="Linefeed",e[e.Newline=10]="Newline",e[e.CarriageReturn=11]="CarriageReturn",e[e.Boundary=12]="Boundary",e[e.Unicode=13]="Unicode",e[e.Letter=14]="Letter",e[e.Decimal=15]="Decimal",e[e.Integer=16]="Integer"}(c=t.MatchSubStatementType||(t.MatchSubStatementType={}));t.MatchSubStatementValue=class{constructor(e,t=null,n=null){this.type=e,this.from=t,this.to=n}};t.MatchStatementValue=class{constructor(e,t){this.optional=e,this.statement=t}validate(e,t){return this.statement.validate(e,t)}toRegex(e,t){let n=this.statement.toRegex(e,t);return this.optional&&(n=i.groupIfRequired(n)+"?"),n}};class h extends l{}t.StatementCST=h;t.MatchSubStatementCST=class extends l{constructor(e,t,n=!1,r){super(e),this.count=t,this.invert=n,this.values=r}validate(e,t){const n=[];this.count&&r.append(n,this.count.validate(e,t));for(const t of this.values)if(t.type===c.Between){let e=r.removeQuotes(t.from),i=r.removeQuotes(t.to);r.isSingleRegexCharacter(e)?(e.startsWith("\\u")||e.startsWith("\\U")||e.startsWith("\\"))&&(e=JSON.parse(`"${e}"`)):n.push(this.error("Between statement must begin with a single character")),r.isSingleRegexCharacter(i)?(i.startsWith("\\u")||i.startsWith("\\U")||i.startsWith("\\"))&&(i=JSON.parse(`"${i}"`)):n.push(this.error("Between statement must end with a single character")),e.charCodeAt(0)>=i.charCodeAt(0)&&n.push(this.error("Between statement range invalid"))}else if(t.type===c.Unicode){let i=r.removeQuotes(t.from);if(!a.includes(i)){if(e===o.DotNet||e===o.Java){if(!i.startsWith("Is")){n.push(this.error("This dialect requires script names to begin with Is, such as IsCyrillic rather than Cyrillic"));continue}i=i.substr(2)}s.includes(i)||n.push(this.error(`Unknown unicode specifier ${t.from}`))}}return n}toRegex(e,t){const n=[];for(const t of this.values)switch(t.type){case c.SingleString:{const e=r.regexEscape(r.removeQuotes(t.from));r.isSingleRegexCharacter(e)?n.push(this.invert?`[^${e}]`:e):n.push(this.invert?`(?!${e})`:e);break}case c.Between:{const e=r.removeQuotes(t.from),i=r.removeQuotes(t.to);n.push(this.invert?`[^${e}-${i}]`:`[${e}-${i}]`);break}case c.Unicode:{const e=r.removeQuotes(t.from);n.push(this.invert?`\\P{${e}}`:`\\p{${e}}`);break}case c.Boundary:n.push(this.invert?"\\B":"\\b");break;case c.Word:n.push(this.invert?"\\W+":"\\w+");break;case c.Letter:e===o.PCRE?n.push(this.invert?"[^[:alpha:]]":"[[:alpha:]]"):n.push(this.invert?"[^a-zA-Z]":"[a-zA-Z]");break;case c.Integer:n.push(this.invert?"(?![+-]?\\d+)":"[+-]?\\d+");break;case c.Decimal:n.push(this.invert?"(?![+-]?(?:(?:\\d+[,.]?\\d*)|(?:[,.]\\d+)))":"[+-]?(?:(?:\\d+[,.]?\\d*)|(?:[,.]\\d+))");break;case c.Digit:n.push(this.invert?"\\D":"\\d");break;case c.Character:n.push(this.invert?"\\W":"\\w");break;case c.Whitespace:n.push(this.invert?"\\S":"\\s");break;case c.Number:n.push(this.invert?"\\D+":"\\d+");break;case c.Tab:n.push(this.invert?"[^\\t]":"\\t");break;case c.Newline:case c.Linefeed:n.push(this.invert?"[^\\n]":"\\n");break;case c.CarriageReturn:n.push(this.invert?"[^\\r]":"\\r");break;default:n.push(this.invert?"[^.]":".")}let a="";if(a=(null==t?void 0:t.has_neighbours)?i.minimizeMatchString(n,!0):i.minimizeMatchString(n),this.count)if(1===n.length)a=i.dontClobberRepetition(a,this.count.toRegex(e,null));else{const t=this.count.toRegex(e,{dont_loop_one:!0});""!==t&&(a=i.groupIfRequired(a)+t)}return a}};t.UsingStatementCST=class extends l{constructor(e,t){super(e),this.flags=t}validate(e,t){r.unusedParameter(e,"Count does not need checking"),r.unusedParameter(t,"Context is not needed");const n=[];let i=this.flags[0];for(let e=1;e<this.flags.length;e++)r.hasFlag(i,this.flags[e])&&n.push(this.error("Duplicate modifier: "+u[this.flags[e]])),i=r.combineFlags(i,this.flags[e]);return r.hasFlag(i,u.Sensitive)&&r.hasFlag(i,u.Insensitive)&&n.push(this.error("Cannot be both case sensitive and insensitive")),n}toRegex(e){r.unusedParameter(e,"Using Statement does not change based on language");let t="",n=!1;for(const e of this.flags)r.hasFlag(e,u.Multiline)?t+="m":r.hasFlag(e,u.Global)?t+="g":r.hasFlag(e,u.Insensitive)?t+="i":r.hasFlag(e,u.Exact)&&(n=!0);return n?"/^{regex}$/"+t:"/{regex}/"+t}};t.CountSubStatementCST=class extends l{constructor(e,t,n=null,r=null){super(e),this.from=t,this.to=n,this.opt=r}validate(e,t){r.unusedParameter(e,"Count does not need checking"),r.unusedParameter(t,"Context is not needed");const n=[];return null!==this.to&&("exclusive"===this.opt&&this.to-1<=this.from||this.to<=this.from)?n.push(this.error("Values must be in range of each other")):null===this.to&&0===this.from&&null===this.opt&&n.push(this.error("Count cannot be 0. This will match nothing. Use comments if you meant to ignore the next match.")),n}toRegex(e,t){r.unusedParameter(e,"Count does not change from language");const n=this.from;let i=this.to;if(null===i){if(1===n)return(null==t?void 0:t.dont_loop_one)?"+"===this.opt?"+":"":"+"===this.opt?"+":"*";if(0===n)return"*"}return null!==i?("exclusive"===this.opt&&i--,`{${n},${i}}`):"+"===this.opt?`{${n},}`:`{${n}}`}};t.MatchStatementCST=class extends h{constructor(e,t,n){super(e),this.completely_optional=t,this.matches=n}validate(e,t){const n=[];for(const i of this.matches)r.append(n,i.statement.validate(e,t));return n}toRegex(e){let t="";return t=1===this.matches.length?this.matches[0].toRegex(e,null):this.matches.map((t=>t.toRegex(e,{has_neighbours:!0}))).join(""),this.completely_optional&&(t=i.groupIfRequired(t)+"?"),t}};t.RepeatStatementCST=class extends h{constructor(e,t,n,r){super(e),this.optional=t,this.count=n,this.statements=r}validate(e,t){const n=[];null!==this.count&&r.append(n,this.count.validate(e,t));for(const i of this.statements)r.append(n,i.validate(e,t));return n}toRegex(e){let t=i.groupIfRequired(this.statements.map((t=>t.toRegex(e,null))).join(""));return this.count?(t+=this.count.toRegex(e,null),this.optional&&(t="(?:"+t+")?")):(t+="*",this.optional&&(t+="?")),t}};t.GroupStatementCST=class extends h{constructor(e,t,n,r){super(e),this.optional=t,this.name=n,this.statements=r}validate(e,t){const n=[];if(null!==this.name)if(t.hasGroup(this.name)){const e=t.groups[this.name];n.push(this.error(`Group with name "${this.name}" was already defined here: ${e.startLine}:${e.startLine}-${e.startLine}:${e.startLine+e.length}`))}else t.addGroup(this.name,this.tokens);for(const i of this.statements)r.append(n,i.validate(e,t));return n}toRegex(e){let t="(";return null!==this.name&&(t+="?",e!==o.Python&&e!==o.PCRE||(t+="P"),t+=`<${this.name}>`),t+=this.statements.map((t=>t.toRegex(e,null))).join(""),t+=this.optional?")?":")",t}};t.BackrefStatementCST=class extends h{constructor(e,t,n,r){super(e),this.optional=t,this.count=n,this.name=r}validate(e,t){const n=[];return t.hasGroup(this.name)||n.push(this.error(`Cannot call group with name "${this.name}" as it was never previously defined`)),null!==this.count&&r.append(n,this.count.validate(e,t)),n}toRegex(e){let t="";switch(e){case o.Python:t=`(?P=${this.name})`;break;case o.DotNet:case o.Java:t=`\\k<${this.name}>`;break;default:t=`\\g<${this.name}>`}return this.count?(t+=this.count.toRegex(e,null),this.optional&&(t="(?:"+t+")?")):this.optional&&(t+="?"),t}};t.IfPatternStatementCST=class extends h{constructor(e,t,n,r){super(e),this.matches=t,this.true_statements=n,this.false_statements=r}validate(e,t){const n=[];e!==o.Java&&e!==o.JS||n.push(this.error("This language does not support conditionals")),e===o.Python&&n.push(this.error("This language does not support pattern conditionals"));for(const i of this.matches)r.append(n,i.validate(e,t));for(const i of this.true_statements)r.append(n,i.validate(e,t));for(const i of this.false_statements)r.append(n,i.validate(e,t));return n}toRegex(e){const t=this.matches.map((t=>t.toRegex(e,null))).join(""),n=i.groupIfRequired(this.true_statements.map((t=>t.toRegex(e,null))).join(""));if(this.false_statements.length>0){return`(?(${t})${n}|${i.groupIfRequired(this.false_statements.map((t=>t.toRegex(e,null))).join(""))})`}return`(?(${t})${n})`}};t.IfIdentStatementCST=class extends h{constructor(e,t,n,r){super(e),this.identifier=t,this.true_statements=n,this.false_statements=r}validate(e,t){const n=[];e!==o.Java&&e!==o.JS||n.push(this.error("This language does not support conditionals")),t.hasGroup(this.identifier)||n.push(this.error(`Group with name "${this.identifier}" does not exist`));for(const i of this.true_statements)r.append(n,i.validate(e,t));for(const i of this.false_statements)r.append(n,i.validate(e,t));return n}toRegex(e){let t=this.identifier;e===o.Boost&&(t="<"+t+">");const n=i.groupIfRequired(this.true_statements.map((t=>t.toRegex(e,null))).join(""));if(this.false_statements.length>0){return`(?(${t})${n}|${i.groupIfRequired(this.false_statements.map((t=>t.toRegex(e,null))).join(""))})`}return`(?(${t})${n})`}};t.RegularExpressionCST=class extends l{constructor(e,t,n){super(e),this.usings=t,this.statements=n}validate(e,t){const n=this.usings.validate(e,t);for(const i of this.statements)r.append(n,i.validate(e,t));return n}toRegex(e){const t=this.usings.toRegex(e),n=this.statements.map((t=>t.toRegex(e,null))).join("");return t.replace("{regex}",n)}}},4953:(e,t,n)=>{"use strict";
|
||
/*! Copyright (c) 2021 Patrick Demian; Licensed under MIT */Object.defineProperty(t,"__esModule",{value:!0}),t.dontClobberRepetition=t.groupIfRequired=t.minimizeMatchString=void 0;const r=n(9005);function i(e,t=0){if(0===e.length)return"";if(1===e.length)return r.first(e)+"?";if(1===(e=[...new Set(e)]).length)return r.first(e);if(e.every((e=>r.isSingleRegexCharacter(e)||r.isRangeRegex(e))))return"["+e.map((e=>r.isSingleRegexCharacter(e)?e:e.substring(1,e.length-1))).join("")+"]";let n=r.first(e),o=r.first(e);for(let t=1;t<e.length;t++){for(let r=0;r<n.length;r++)if(e[t].length<r||n[r]!==e[t][r]){n=n.substr(0,r);break}for(let n=0;n<o.length;n++)if(e[t].length-n<0||o[o.length-n-1]!==e[t][e[t].length-n-1]){o=o.substr(o.length-n,o.length);break}if(0===n.length&&0===o.length)break}if(0===n.length&&0===o.length)return t>0?"(?:"+e.join("|")+")":e.join("|");{const r=n.length,a=o.length,s=[];for(const t of e){const e=t.substring(r,t.length-a);0!==e.length&&s.push(e)}return n+i(s,t+1)+o}}function o(e){if(r.isSingleRegexCharacter(e))return e;if(("*"===e[e.length-1]||"+"===e[e.length-1])&&r.isSingleRegexCharacter(e.substring(0,e.length-1)))return e;if("("===e[0]&&")"===e[e.length-1]){let t=0;for(let n=1;n<e.length-2;n++)if("\\"===e[n])n++;else if("("===e[n])t++;else if(")"===e[n]&&(t--,-1===t))break;return 0===t?e:"(?:"+e+")"}if("["===e[0]&&"]"===e[e.length-1]){let t=0;for(let n=1;n<e.length-2;n++)if("\\"===e[n])n++;else if("]"===e[n]&&(t--,-1===t))break;return 0===t?e:"(?:"+e+")"}return"(?:"+e+")"}t.minimizeMatchString=function(e,t=!1){return 1===e.length?r.first(e):i(e,t?1:0)},t.groupIfRequired=o,t.dontClobberRepetition=function(e,t){if(e.endsWith("+"))switch(t){case"*":break;case"?":e+=t;break;case"+":break;default:e=t.startsWith("{0")?"(?:"+e+")"+t:e.substring(0,e.length-1)+t}else if(e.endsWith("*"))switch(t){case"*":break;case"?":e+=t;break;default:e=e.substring(0,e.length-1)+t}else e=o(e)+t;return e}},5403:(e,t,n)=>{"use strict";
|
||
/*! Copyright (c) 2021 Patrick Demian; Licensed under MIT */Object.defineProperty(t,"__esModule",{value:!0}),t.Human2RegexLexer=t.TokenizeResult=t.Human2RegexLexerOptions=t.IndentType=void 0;const r=n(417),i=n(9005),o=n(9534);var a;!function(e){e[e.Tabs=0]="Tabs",e[e.Spaces=1]="Spaces",e[e.Both=2]="Both"}(a=t.IndentType||(t.IndentType={}));class s{constructor(e=!1,t=a.Both,n=4){this.skip_validations=e,this.type=t,this.spaces_per_tab=n}}t.Human2RegexLexerOptions=s;class l{constructor(e,t){this.tokens=e,this.errors=t}}t.TokenizeResult=l;class u{constructor(e=new s){if(u.already_init)throw new Error("Only 1 instance of Human2RegexLexer allowed");u.already_init=!0,this.setOptions(e)}setOptions(e){this.options=e;let t=null;if(this.options.type===a.Tabs)t=/\t/y;else{let e=` {${this.options.spaces_per_tab}}`;this.options.type===a.Both&&(e+="|\\t"),t=new RegExp(e,"y")}o.Indent.PATTERN=t,this.lexer=new r.Lexer(o.AllTokens,{ensureOptimizations:!0,skipValidations:e.skip_validations})}lexError(e){var t,n,r;return{offset:e.startOffset,line:null!==(t=e.startLine)&&void 0!==t?t:NaN,column:null!==(n=e.startColumn)&&void 0!==n?n:NaN,length:null!==(r=e.endOffset)&&void 0!==r?r:NaN-e.startOffset,message:"Unexpected indentation found"}}tokenize(e){var t,n,a,s,u,c,h,f,p,d,m,g,v,y;const T=this.lexer.tokenize(e);if(0===T.tokens.length)return new l(T.tokens,T.errors.map(i.CommonError.fromLexError));const E=[],S=[0];let x=0,O=!0,C=!1;for(let e=0;e<T.tokens.length;e++)if(T.tokens[e].tokenType===o.EndOfLine)0===E.length||E[E.length-1].tokenType===o.EndOfLine||(O=!0,E.push(T.tokens[e]));else if(T.tokens[e].tokenType===o.Indent){C=!0,x=1;const l=T.tokens[e];let u=T.tokens[e].image.length;for(;T.tokens.length>e+1&&T.tokens[e+1].tokenType===o.Indent;)x++,e++,u+=T.tokens[e].image.length;if(l.endOffset=l.startOffset+u,l.endColumn=T.tokens[e].endColumn,T.tokens.length>e+1&&T.tokens[e+1].tokenType===o.EndOfLine);else if(!O||x>i.last(S)+1)T.errors.push(this.lexError(l));else if(x>i.last(S))S.push(x),E.push(l);else if(x<i.last(S)){const e=i.findLastIndex(S,x),c=S.length-e-1;for(let e=0;e<c;e++)S.pop(),E.push(r.createTokenInstance(o.Outdent,"",l.startOffset,l.startOffset+u,null!==(t=l.startLine)&&void 0!==t?t:NaN,null!==(n=l.endLine)&&void 0!==n?n:NaN,null!==(a=l.startColumn)&&void 0!==a?a:NaN,(null!==(s=l.startColumn)&&void 0!==s?s:NaN)+u))}}else{if(O&&!C){const t=T.tokens[e];for(;S.length>1;)S.pop(),E.push(r.createTokenInstance(o.Outdent,"",t.startOffset,t.startOffset,null!==(u=t.startLine)&&void 0!==u?u:NaN,NaN,null!==(c=t.startColumn)&&void 0!==c?c:NaN,NaN))}O=!1,C=!1,E.push(T.tokens[e])}const b=i.last(E);for(E.length>0&&b.tokenType!==o.EndOfLine&&E.push(r.createTokenInstance(o.EndOfLine,"\n",null!==(h=b.endOffset)&&void 0!==h?h:NaN,null!==(f=b.endOffset)&&void 0!==f?f:NaN,null!==(p=b.startLine)&&void 0!==p?p:NaN,NaN,null!==(d=b.startColumn)&&void 0!==d?d:NaN,NaN));S.length>1;)S.pop(),E.push(r.createTokenInstance(o.Outdent,"",null!==(m=b.endOffset)&&void 0!==m?m:NaN,null!==(g=b.endOffset)&&void 0!==g?g:NaN,null!==(v=b.startLine)&&void 0!==v?v:NaN,NaN,null!==(y=b.startColumn)&&void 0!==y?y:NaN,NaN));return new l(E,T.errors.map(i.CommonError.fromLexError))}}t.Human2RegexLexer=u,u.already_init=!1},215:function(e,t,n){"use strict";
|
||
/*! Copyright (c) 2021 Patrick Demian; Licensed under MIT */var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Human2RegexParser=t.ParseResult=t.Human2RegexParserOptions=void 0;const a=n(417),s=o(n(9534)),l=n(3236),u=n(9005);class c{constructor(e=!1){this.skip_validations=e}}t.Human2RegexParserOptions=c;class h{constructor(e,t){this.token=e,this.value=t}}class f{constructor(e,t){this.tokens=e,this.value=t}}class p{constructor(e,t){this.regexp_cst=e,this.errors=t}validate(e){return this.regexp_cst.validate(e,new l.GeneratorContext).map(u.CommonError.fromSemanticError)}toRegex(e){return this.regexp_cst.toRegex(e)}toRegExp(e){return new RegExp(this.regexp_cst.toRegex(e))}}t.ParseResult=p;class d extends a.EmbeddedActionsParser{constructor(e=new c){if(super(s.AllTokens,{recoveryEnabled:!1,maxLookahead:2,skipValidations:e.skip_validations}),this.options=e,d.already_init)throw new Error("Only 1 instance of Human2RegexParser allowed");d.already_init=!0;const t=this;let n=null;const r=t.RULE("NumberSubStatement",(()=>t.OR(n||(n=[{ALT:()=>new h(t.CONSUME(s.Zero),0)},{ALT:()=>new h(t.CONSUME(s.One),1)},{ALT:()=>new h(t.CONSUME(s.Two),2)},{ALT:()=>new h(t.CONSUME(s.Three),3)},{ALT:()=>new h(t.CONSUME(s.Four),4)},{ALT:()=>new h(t.CONSUME(s.Five),5)},{ALT:()=>new h(t.CONSUME(s.Six),6)},{ALT:()=>new h(t.CONSUME(s.Seven),7)},{ALT:()=>new h(t.CONSUME(s.Eight),8)},{ALT:()=>new h(t.CONSUME(s.Nine),9)},{ALT:()=>new h(t.CONSUME(s.Ten),10)},{ALT:()=>{const e=t.CONSUME(s.NumberLiteral);return new h(e,parseInt(e.image))}}])))),i=t.RULE("CountSubStatement",(()=>t.OR([{ALT:()=>{const e=[];e.push(t.CONSUME(s.Between));const n=t.SUBRULE4(r);t.OR3([{ALT:()=>t.CONSUME2(s.To)},{ALT:()=>t.CONSUME(s.And)}]);const i=t.SUBRULE5(r);e.push(i.token),t.OPTION4((()=>e.push(t.CONSUME3(s.Times))));const o=t.OPTION5((()=>t.OR4([{ALT:()=>(e.push(t.CONSUME(s.Inclusive)),"inclusive")},{ALT:()=>(e.push(t.CONSUME(s.Exclusive)),"exclusive")}])));return new l.CountSubStatementCST(e,n.value,i.value,o)}},{ALT:()=>{const e=[];t.OPTION2((()=>e.push(t.CONSUME(s.From))));const n=t.SUBRULE2(r),i=t.OR2([{ALT:()=>new h(t.CONSUME(s.OrMore),[null,"+"])},{ALT:()=>{t.CONSUME(s.To);const e=t.SUBRULE3(r);let n=e.token;const i=t.OPTION7((()=>t.OR5([{ALT:()=>(n=t.CONSUME2(s.Inclusive),"inclusive")},{ALT:()=>(n=t.CONSUME2(s.Exclusive),"exclusive")}])));return new h(n,[e.value,i])}}]);return e.push(i.token),t.OPTION3((()=>e.push(t.CONSUME2(s.Times)))),new l.CountSubStatementCST(e,n.value,i.value?i.value[0]:null,i.value?i.value[1]:null)}},{ALT:()=>{const e=[];t.OPTION((()=>e.push(t.CONSUME(s.Exactly))));const n=t.SUBRULE(r);return e.push(n.token),t.OPTION6((()=>e.push(t.CONSUME(s.Times)))),new l.CountSubStatementCST(e,n.value)}}])));let o=null;const a=t.RULE("MatchSubStatement",(()=>{let e=null,n=!1;const r=[];let a=null,c=null,h=null,f=l.MatchSubStatementType.Anything,p=[];return e=t.OPTION((()=>{const e=t.SUBRULE(i);return u.usefulConditional(e.tokens,"due to how chevrotain works, the first run produces a null value")&&p.push(u.first(e.tokens)),e})),n=t.OPTION2((()=>(p.push(t.CONSUME(s.Not)),!0))),t.AT_LEAST_ONE_SEP({SEP:s.Or,DEF:()=>{t.OPTION3((()=>t.CONSUME(s.A)));const e=t.OR(o||(o=[{ALT:()=>{const e=t.OPTION4((()=>t.CONSUME(s.From))),n=t.CONSUME2(s.StringLiteral);a=n.image,t.CONSUME(s.To);const r=t.CONSUME3(s.StringLiteral);return h=r.image,f=l.MatchSubStatementType.Between,u.usefulConditional(e,"Bug in type definition. Option should return <T|undefined>, but it doesn't")?{tokens:[e,r],statement:new l.MatchSubStatementValue(f,a,h)}:{tokens:[n,r],statement:new l.MatchSubStatementValue(f,a,h)}}},{ALT:()=>{const e=t.CONSUME(s.Between);a=t.CONSUME4(s.StringLiteral).image,t.CONSUME(s.And);const n=t.CONSUME5(s.StringLiteral);return h=n.image,f=l.MatchSubStatementType.Between,{tokens:[e,n],statement:new l.MatchSubStatementValue(f,a,h)}}},{ALT:()=>{const e=t.CONSUME(s.StringLiteral);return c=e.image,f=l.MatchSubStatementType.SingleString,{tokens:[e],statement:new l.MatchSubStatementValue(f,c)}}},{ALT:()=>{const e=t.CONSUME(s.Unicode),n=t.CONSUME6(s.StringLiteral);return c=n.image,f=l.MatchSubStatementType.Unicode,{tokens:[e,n],statement:new l.MatchSubStatementValue(f,c)}}},{ALT:()=>{const e=t.CONSUME(s.Anything);return f=l.MatchSubStatementType.Anything,{tokens:[e],statement:new l.MatchSubStatementValue(f)}}},{ALT:()=>{const e=t.CONSUME(s.Boundary);return f=l.MatchSubStatementType.Boundary,{tokens:[e],statement:new l.MatchSubStatementValue(f)}}},{ALT:()=>{const e=t.CONSUME(s.Word);return f=l.MatchSubStatementType.Word,{tokens:[e],statement:new l.MatchSubStatementValue(f)}}},{ALT:()=>{const e=t.CONSUME(s.Digit);return f=l.MatchSubStatementType.Digit,{tokens:[e],statement:new l.MatchSubStatementValue(f)}}},{ALT:()=>{const e=t.CONSUME(s.Character);return f=l.MatchSubStatementType.Character,{tokens:[e],statement:new l.MatchSubStatementValue(f)}}},{ALT:()=>{const e=t.CONSUME(s.Letter);return f=l.MatchSubStatementType.Letter,{tokens:[e],statement:new l.MatchSubStatementValue(f)}}},{ALT:()=>{const e=t.CONSUME(s.Decimal);return f=l.MatchSubStatementType.Decimal,{tokens:[e],statement:new l.MatchSubStatementValue(f)}}},{ALT:()=>{const e=t.CONSUME(s.Integer);return f=l.MatchSubStatementType.Integer,{tokens:[e],statement:new l.MatchSubStatementValue(f)}}},{ALT:()=>{const e=t.CONSUME(s.Whitespace);return f=l.MatchSubStatementType.Whitespace,{tokens:[e],statement:new l.MatchSubStatementValue(f)}}},{ALT:()=>{const e=t.CONSUME(s.Number);return f=l.MatchSubStatementType.Number,{tokens:[e],statement:new l.MatchSubStatementValue(f)}}},{ALT:()=>{const e=t.CONSUME(s.Tab);return f=l.MatchSubStatementType.Tab,{tokens:[e],statement:new l.MatchSubStatementValue(f)}}},{ALT:()=>{const e=t.CONSUME(s.Linefeed);return f=l.MatchSubStatementType.Linefeed,{tokens:[e],statement:new l.MatchSubStatementValue(f)}}},{ALT:()=>{const e=t.CONSUME(s.Newline);return f=l.MatchSubStatementType.Newline,{tokens:[e],statement:new l.MatchSubStatementValue(f)}}},{ALT:()=>{const e=t.CONSUME(s.CarriageReturn);return f=l.MatchSubStatementType.CarriageReturn,{tokens:[e],statement:new l.MatchSubStatementValue(f)}}}]));p=p.concat(e.tokens),r.push(e.statement)}}),new l.MatchSubStatementCST(p,e,n,r)})),p=t.RULE("MatchStatement",(()=>{let e=!1,n=!1;const r=[],i=[];return t.OPTION((()=>{i.push(t.CONSUME(s.Optional)),n=!0})),i.push(t.CONSUME(s.Match)),t.OPTION4((()=>{t.CONSUME3(s.Optional),e=!0})),r.push(new l.MatchStatementValue(e,t.SUBRULE(a))),t.MANY((()=>{t.OR([{ALT:()=>{t.OPTION2((()=>t.CONSUME2(s.And))),t.CONSUME(s.Then)}},{ALT:()=>t.CONSUME(s.And)}]),e=!1,t.OPTION3((()=>{t.CONSUME2(s.Optional),e=!0})),r.push(new l.MatchStatementValue(e,t.SUBRULE2(a)))})),i.push(t.CONSUME(s.EndOfLine)),new l.MatchStatementCST(i,n,r)}));let m=null;const g=t.RULE("UsingStatement",(()=>{const e=[],n=[t.CONSUME(s.Using)];return t.AT_LEAST_ONE_SEP({SEP:s.And,DEF:()=>{e.push(t.OR(m||(m=[{ALT:()=>(t.CONSUME(s.Multiline),l.UsingFlags.Multiline)},{ALT:()=>(t.CONSUME(s.Global),l.UsingFlags.Global)},{ALT:()=>(t.CONSUME(s.CaseInsensitive),l.UsingFlags.Insensitive)},{ALT:()=>(t.CONSUME(s.CaseSensitive),l.UsingFlags.Sensitive)},{ALT:()=>(t.CONSUME(s.Exact),l.UsingFlags.Exact)}]))),t.OPTION((()=>t.CONSUME(s.Matching)))}}),n.push(t.CONSUME(s.EndOfLine)),new f(n,e)})),v=t.RULE("GroupStatement",(()=>{const e=[];let n=!1,r=null;const i=[];return t.OPTION4((()=>{e.push(t.OR3([{ALT:()=>{n=!0;const e=t.CONSUME(s.Optional);return t.CONSUME(s.Create),t.CONSUME(s.A),e}},{ALT:()=>{const e=t.CONSUME2(s.Create);return t.CONSUME2(s.A),t.OPTION2((()=>{t.CONSUME2(s.Optional),n=!0})),e}},{ALT:()=>(n=!0,t.CONSUME3(s.Optional))}]))})),e.push(t.CONSUME(s.Group)),t.OPTION5((()=>{r=t.OR([{ALT:()=>{t.CONSUME(s.Called);const e=t.CONSUME(s.Identifier).image;return t.OPTION((()=>t.CONSUME(s.Is))),e}},{ALT:()=>{const e=t.CONSUME2(s.Identifier).image;return t.CONSUME2(s.Is),e}}])})),e.push(t.CONSUME2(s.EndOfLine)),t.CONSUME(s.Indent),t.AT_LEAST_ONE((()=>{i.push(t.SUBRULE(S))})),t.CONSUME(s.Outdent),new l.GroupStatementCST(e,n,r,i)})),y=t.RULE("RepeatStatement",(()=>{const e=[];let n=!1,r=null;const o=[];return t.OPTION3((()=>{e.push(t.CONSUME(s.Optional)),n=!0})),e.push(t.CONSUME(s.Repeat)),t.OPTION((()=>r=t.SUBRULE(i))),t.CONSUME3(s.EndOfLine),t.CONSUME(s.Indent),t.AT_LEAST_ONE((()=>{o.push(t.SUBRULE(S))})),e.push(t.CONSUME(s.Outdent)),new l.RepeatStatementCST(e,n,r,o)})),T=t.RULE("BackrefStatement",(()=>{const e=[];let n=!1,r=null;t.OPTION5((()=>{e.push(t.CONSUME(s.Optional)),n=!0})),e.push(t.CONSUME(s.Rerun)),t.OPTION6((()=>r=t.SUBRULE(i))),t.OPTION7((()=>{t.OPTION((()=>t.CONSUME(s.The))),t.CONSUME(s.Group),t.OPTION2((()=>t.CONSUME(s.Called)))}));const o=t.CONSUME(s.Identifier).image;return e.push(t.CONSUME4(s.EndOfLine)),new l.BackrefStatementCST(e,n,r,o)})),E=t.RULE("IfStatement",(()=>{const e=[],n=[];let r=!1;const i=[],o=[];let u="";return e.push(t.CONSUME(s.If)),t.OR2([{ALT:()=>{u=t.CONSUME(s.Identifier).image}},{ALT:()=>{t.CONSUME(s.Match),t.OPTION4((()=>{t.CONSUME3(s.Optional),r=!0})),n.push(new l.MatchStatementValue(r,t.SUBRULE(a))),t.MANY((()=>{t.OR([{ALT:()=>{t.OPTION2((()=>t.CONSUME2(s.And))),t.CONSUME(s.Then)}},{ALT:()=>t.CONSUME(s.And)}]),r=!1,t.OPTION3((()=>{t.CONSUME2(s.Optional),r=!0})),n.push(new l.MatchStatementValue(r,t.SUBRULE2(a)))}))}}]),e.push(t.CONSUME3(s.EndOfLine)),t.CONSUME2(s.Indent),t.AT_LEAST_ONE2((()=>{i.push(t.SUBRULE(S))})),t.CONSUME2(s.Outdent),t.OPTION((()=>{t.CONSUME(s.Else),t.CONSUME4(s.EndOfLine),t.CONSUME3(s.Indent),t.AT_LEAST_ONE3((()=>{o.push(t.SUBRULE2(S))})),t.CONSUME3(s.Outdent)})),""===u?new l.IfPatternStatementCST(e,n,i,o):new l.IfIdentStatementCST(e,u,i,o)})),S=t.RULE("Statement",(()=>t.OR([{ALT:()=>t.SUBRULE(p)},{ALT:()=>t.SUBRULE(v)},{ALT:()=>t.SUBRULE(y)},{ALT:()=>t.SUBRULE(T)},{ALT:()=>t.SUBRULE(E)}]))),x=t.RULE("Regex",(()=>{let e=[],n=[];const r=[];return t.MANY((()=>{const r=t.SUBRULE(g);e=e.concat(r.tokens),n=n.concat(r.value)})),t.MANY2((()=>r.push(t.SUBRULE(S)))),new l.RegularExpressionCST([],new l.UsingStatementCST(e,n),r)}));this.performSelfAnalysis(),this.regexp=x}parse(e){return this.input=e,new p(this.regexp(),this.errors.map(u.CommonError.fromParseError))}setOptions(e){throw new Error("skip_validations is not valid to change once we've already initialized")}}t.Human2RegexParser=d,d.already_init=!1},2550:function(e,t,n){"use strict";
|
||
/*! Copyright (c) 2021 Patrick Demian; Licensed under MIT */var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(5403),o=n(215),a=n(3236),s=n(9005),l=r(n(4631));n(790),n(7165),n(3256),n(4217),n(3977),n(6217),n(7521);const u=l.default;document.addEventListener("DOMContentLoaded",(function(){u.defineSimpleMode("human2regex",{start:[{token:"number",regex:/zero|one|two|three|four|five|six|seven|eight|nine|ten/i},{token:"qualifier",regex:/(optional(ly)?|possibl[ye]|maybe)/i},{token:"builtin",regex:/matching/i},{token:"keyword",regex:/match(es)?/i},{token:"operator",regex:/then/i},{token:"operator",regex:/not|anything but|any thing but|everything but|every thing but/i},{token:"builtin",regex:/(any thing|any|anything)(s)?/i},{token:"operator",regex:/or/i},{token:"operator",regex:/and|,/i},{token:"builtin",regex:/unicode( class)?/i},{token:"builtin",regex:/(word )?boundary/i},{token:"builtin",regex:/word(s)?/i},{token:"builtin",regex:/digit(s)?/i},{token:"builtin",regex:/character(s)?/i},{token:"builtin",regex:/letter(s)?/i},{token:"builtin",regex:/decimal(s)?/i},{token:"builtin",regex:/integer(s)?/i},{token:"builtin",regex:/(white space|whitespace)(s)?/i},{token:"builtin",regex:/number(s)?/i},{token:"keyword",regex:/using/i},{token:"builtin",regex:/global/i},{token:"builtin",regex:/(multi line|multiline)/i},{token:"builtin",regex:/exact/i},{token:"keyword",regex:/between/i},{token:"builtin",regex:/tab/i},{token:"builtin",regex:/(line feed|linefeed)/i},{token:"keyword",regex:/group/i},{token:"keyword",regex:/a(n)?\b/i},{token:"keyword",regex:/times/i},{token:"keyword",regex:/exact(ly)?/i},{token:"keyword",regex:/inclusive(ly)?/i},{token:"keyword",regex:/exclusive(ly)?/i},{token:"keyword",regex:/from/i},{token:"keyword",regex:/(to|through|thru|\-|\.\.\.?)/i},{token:"keyword",regex:/create(s)?/i},{token:"keyword",regex:/name(d)?|call(ed)?/i},{token:"keyword",regex:/repeat(s|ing)?/i},{token:"builtin",regex:/(new line|newline)/i},{token:"builtin",regex:/carriage return/i},{token:"builtin",regex:/case insensitive/i},{token:"builtin",regex:/case sensitive/i},{token:"operator",regex:/\+|or more/i},{token:"keyword",regex:/re( |-)?(run|capture)/i},{token:"operator",regex:/the/i},{token:"keyword",regex:/if/i},{token:"keyword",regex:/else|otherwise/i},{token:"keyword",regex:/is|:/i},{token:"variable",regex:/[a-z]\w*/i},{token:"number",regex:/\d+/},{token:"string",regex:/"(?:[^\\"]|\\(?:[bfnrtv"\\/]|u[0-9a-f]{4}|U[0-9a-f]{8}))*"/i},{token:"comment",regex:/(#|\/\/).*/},{token:"comment",regex:/\/\*/,next:"comment"}],comment:[{regex:/.*?\*\//,token:"comment",next:"start"},{regex:/.*/,token:"comment"}],meta:{dontIndentStates:["comment"],lineComment:"//",blockComment:["/*","*/"]}});const e=document.getElementById("regex"),t=document.getElementById("dialect"),n=document.getElementById("clip"),r=document.getElementById("human"),l=document.getElementById("errors"),c=document.getElementsByTagName("code");for(let e=0;e<c.length;e++)u.runMode(c[e].innerText,"human2regex",c[e]);if(!(e&&t&&n&&r&&l))return;const h=new i.Human2RegexLexer(new i.Human2RegexLexerOptions(!0)),f=new o.Human2RegexParser(new o.Human2RegexParserOptions(!0));let p=[],d="",m=a.RegexDialect.JS;function g(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function v(t){if(!l||!e)return;g(l),l.appendChild(document.createTextNode("Compiling...")),p=[];const n=h.tokenize(t);if(n.errors.forEach((e=>p.push(e))),0===p.length){const t=f.parse(n.tokens);if(f.errors.map(s.CommonError.fromParseError).forEach((e=>p.push(e))),0===p.length){t.validate(m).forEach((e=>p.push(e))),0===p.length&&(d=t.toRegex(m),e.setAttribute("value",d))}}g(l);for(const e of p)l.appendChild(document.createTextNode(`${e.toString()}\n`))}u.registerHelper("lint","human2regex",(function(e){s.unusedParameter(e,"Text is not needed in this instance as we do no parsing");const t=[];for(const e of p){const n=u.Pos(e.start_line-1,e.start_column-1),r=u.Pos(e.start_line-1,e.start_column-1+e.length);t.push({from:n,to:r,message:e.message})}return t}));const y=u.fromTextArea(r,{mode:"human2regex",lineNumbers:!1,indentUnit:4,viewportMargin:1/0,theme:"idea",lint:!0});y.on("change",(()=>{v(y.getValue())})),t.addEventListener("change",(()=>{const e=t.selectedIndex,n=t.options[e].value;m=function(e){switch(e){case"dotnet":return a.RegexDialect.DotNet;case"java":return a.RegexDialect.Java;case"pcre":return a.RegexDialect.PCRE;case"python":return a.RegexDialect.Python;case"boost":return a.RegexDialect.Boost;default:return a.RegexDialect.JS}}(n),v(y.getValue())})),n.addEventListener("click",(()=>{e.select(),window.isSecureContext&&s.usefulConditional(navigator.clipboard,"clipboard may be undefined")&&s.usefulConditional(navigator.clipboard.writeText,"writeText may be undefined")?navigator.clipboard.writeText(d):document.execCommand("copy")})),v(y.getValue())}))},9534:(e,t,n)=>{"use strict";
|
||
/*! Copyright (c) 2021 Patrick Demian; Licensed under MIT */Object.defineProperty(t,"__esModule",{value:!0}),t.CaseInsensitive=t.CarriageReturn=t.Newline=t.Repeat=t.Called=t.Create=t.To=t.From=t.Exclusive=t.Inclusive=t.Exactly=t.Times=t.A=t.Group=t.Linefeed=t.Tab=t.Between=t.Anything=t.Not=t.Matching=t.Exact=t.Multiline=t.Global=t.Using=t.Unicode=t.Number=t.Boundary=t.Whitespace=t.Integer=t.Decimal=t.Letter=t.Character=t.Digit=t.Word=t.And=t.Or=t.Then=t.Match=t.Optional=t.Ten=t.Nine=t.Eight=t.Seven=t.Six=t.Five=t.Four=t.Three=t.Two=t.One=t.Zero=void 0,t.AllTokens=t.Outdent=t.Indent=t.StringLiteral=t.NumberLiteral=t.Identifier=t.MultilineComment=t.SingleLineComment=t.WS=t.EndOfLine=t.Is=t.Else=t.If=t.The=t.Rerun=t.OrMore=t.CaseSensitive=void 0;const r=n(417);t.Zero=r.createToken({name:"Zero",pattern:/zero/i}),t.One=r.createToken({name:"One",pattern:/one/i}),t.Two=r.createToken({name:"Two",pattern:/two/i}),t.Three=r.createToken({name:"Three",pattern:/three/i}),t.Four=r.createToken({name:"Four",pattern:/four/i}),t.Five=r.createToken({name:"Five",pattern:/five/i}),t.Six=r.createToken({name:"Six",pattern:/six/i}),t.Seven=r.createToken({name:"Seven",pattern:/seven/i}),t.Eight=r.createToken({name:"Eight",pattern:/eight/i}),t.Nine=r.createToken({name:"Nine",pattern:/nine/i}),t.Ten=r.createToken({name:"Ten",pattern:/ten/i}),t.Optional=r.createToken({name:"Optional",pattern:/(optional(ly)?|possibl[ye]|maybe)/i}),t.Match=r.createToken({name:"Match",pattern:/match(es)?/i}),t.Then=r.createToken({name:"Then",pattern:/then/i}),t.Or=r.createToken({name:"Or",pattern:/or/i}),t.And=r.createToken({name:"And",pattern:/and|,/i}),t.Word=r.createToken({name:"WordSpecifier",pattern:/word(s)?/i}),t.Digit=r.createToken({name:"DigitSpecifier",pattern:/digit(s)?/i}),t.Character=r.createToken({name:"CharacterSpecifier",pattern:/character(s)?/i}),t.Letter=r.createToken({name:"LetterSpecifier",pattern:/letter(s)?/i}),t.Decimal=r.createToken({name:"DecimalSpecifier",pattern:/decimal(s)?/i}),t.Integer=r.createToken({name:"IntegerSpecifier",pattern:/integer(s)?/i}),t.Whitespace=r.createToken({name:"WhitespaceSpecifier",pattern:/(white space|whitespace)s?/i}),t.Boundary=r.createToken({name:"BoundarySpecifier",pattern:/(word )?boundary/i}),t.Number=r.createToken({name:"NumberSpecifier",pattern:/number(s)?/i}),t.Unicode=r.createToken({name:"UnicodeSpecifier",pattern:/unicode( class)?/i}),t.Using=r.createToken({name:"Using",pattern:/using/i}),t.Global=r.createToken({name:"Global",pattern:/global/i}),t.Multiline=r.createToken({name:"Multiline",pattern:/(multi line|multiline)/i}),t.Exact=r.createToken({name:"Exact",pattern:/exact/i}),t.Matching=r.createToken({name:"Matching",pattern:/matching/i}),t.Not=r.createToken({name:"Not",pattern:/not|anything but|any thing but|everything but|every thing but/i}),t.Anything=r.createToken({name:"Anything",pattern:/(anything|any thing|any|everything|every thing)(s)?/i,longer_alt:t.Not}),t.Between=r.createToken({name:"Between",pattern:/between/i}),t.Tab=r.createToken({name:"Tab",pattern:/tab/i}),t.Linefeed=r.createToken({name:"Linefeed",pattern:/(line feed|linefeed)/i}),t.Group=r.createToken({name:"Group",pattern:/group/i}),t.A=r.createToken({name:"A",pattern:/a(n)?\b/i}),t.Times=r.createToken({name:"Times",pattern:/times/i}),t.Exactly=r.createToken({name:"Exactly",pattern:/exact(ly)?/i}),t.Inclusive=r.createToken({name:"Inclusive",pattern:/inclusive(ly)?/i}),t.Exclusive=r.createToken({name:"Exclusive",pattern:/exclusive(ly)?/i}),t.From=r.createToken({name:"From",pattern:/from/i}),t.To=r.createToken({name:"To",pattern:/(to|through|thru|\-|\.\.\.?)/i}),t.Create=r.createToken({name:"Create",pattern:/create(s)?/i}),t.Called=r.createToken({name:"Called",pattern:/named|called/i}),t.Repeat=r.createToken({name:"Repeat",pattern:/repeat(s|ing)?/i}),t.Newline=r.createToken({name:"Newline",pattern:/(new line|newline)/i}),t.CarriageReturn=r.createToken({name:"CarriageReturn",pattern:/carriage return/i}),t.CaseInsensitive=r.createToken({name:"CaseInsensitive",pattern:/case insensitive/i}),t.CaseSensitive=r.createToken({name:"CaseSensitive",pattern:/case sensitive/i}),t.OrMore=r.createToken({name:"OrMore",pattern:/\+|or more/i}),t.Rerun=r.createToken({name:"Rerun",pattern:/re( |-)?(run|capture)/i}),t.The=r.createToken({name:"The",pattern:/the/i}),t.If=r.createToken({name:"If",pattern:/if/i}),t.Else=r.createToken({name:"Else",pattern:/else|otherwise/i}),t.Is=r.createToken({name:"Is",pattern:/is|:/i}),t.EndOfLine=r.createToken({name:"EOL",pattern:/\n/}),t.WS=r.createToken({name:"Whitespace",pattern:/[^\S\n]+/,start_chars_hint:[" ","\r"],group:r.Lexer.SKIPPED}),t.SingleLineComment=r.createToken({name:"SingleLineComment",pattern:/(#|\/\/).*/,group:r.Lexer.SKIPPED}),t.MultilineComment=r.createToken({name:"MultiLineComment",pattern:/\/\*(.|\n|\r)*\*\//,line_breaks:!0,group:r.Lexer.SKIPPED}),t.Identifier=r.createToken({name:"Identifier",pattern:/[a-z]\w*/i}),t.NumberLiteral=r.createToken({name:"NumberLiteral",pattern:/\d+/}),t.StringLiteral=r.createToken({name:"StringLiteral",pattern:/"(?:[^\\"]|\\(?:[bfnrtv"\\/]|u[0-9a-f]{4}|U[0-9a-f]{8}))*"/i}),t.Indent=r.createToken({name:"Indent"}),t.Outdent=r.createToken({name:"Outdent"}),t.AllTokens=[t.Zero,t.One,t.Two,t.Three,t.Four,t.Five,t.Six,t.Seven,t.Eight,t.Nine,t.Ten,t.Optional,t.Matching,t.Match,t.Then,t.Anything,t.Not,t.And,t.Boundary,t.Word,t.Digit,t.Letter,t.Decimal,t.Integer,t.Character,t.Whitespace,t.Number,t.Unicode,t.Called,t.Rerun,t.If,t.Else,t.Is,t.The,t.Using,t.Global,t.Multiline,t.Exact,t.Between,t.Tab,t.Linefeed,t.Group,t.A,t.Times,t.Exactly,t.Inclusive,t.Exclusive,t.From,t.Create,t.Repeat,t.Newline,t.CarriageReturn,t.CaseInsensitive,t.CaseSensitive,t.OrMore,t.Or,t.To,t.EndOfLine,t.Indent,t.WS,t.SingleLineComment,t.MultilineComment,t.Identifier,t.NumberLiteral,t.StringLiteral]},9005:(e,t)=>{"use strict";
|
||
/*! Copyright (c) 2021 Patrick Demian; Licensed under MIT */function n(e){return e.startsWith("\\u")&&6===e.length||e.startsWith("\\U")&&8===e.length||e.startsWith("\\")&&2===e.length||1===e.length}Object.defineProperty(t,"__esModule",{value:!0}),t.CommonError=t.append=t.regexEscape=t.removeQuotes=t.findLastIndex=t.last=t.first=t.isRangeRegex=t.isSingleRegexCharacter=t.combineFlags=t.hasFlag=t.makeFlag=t.usefulConditional=t.unusedParameter=void 0,t.unusedParameter=function(e,t){},t.usefulConditional=function(e,t){return Boolean(e)},t.makeFlag=function(e){return 1<<e},t.hasFlag=function(e,t){return 0!=(e&t)},t.combineFlags=function(e,t){return e|t},t.isSingleRegexCharacter=n,t.isRangeRegex=function(e){if(!e.startsWith("[")&&!e.endsWith("]"))return!1;const t=e.substring(1,e.length-1).split("-");return 2===t.length&&((!t[0].endsWith("\\")||"\\\\"===t[0])&&(n(t[0])&&n(t[1])))},t.first=function(e){return e[0]},t.last=function(e){return e[e.length-1]},t.findLastIndex=function(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t)return n;return-1},t.removeQuotes=function(e){return e.substring(1,e.length-1)},t.regexEscape=function(e){return e.replace('\\"','"').replace(/([:\\\-\.\[\]\^\|\(\)\*\+\?\{\}\$\/])/g,"\\$1")},t.append=function(e,...t){for(const n of t)for(const t of n)e.push(t)};class r{constructor(e,t,n,r,i){this.type=e,this.start_line=t,this.start_column=n,this.length=r,this.message=i}static fromLexError(e){const t=e.message.replace(/(--?>|<--?)/g,"");return new r("Lexer Error",e.line,e.column,e.length,t)}static fromParseError(e){var t,n,i;const o=e.name+" - "+e.message.replace(/(--?>|<--?)/g,"");return new r("Parser Error",null!==(t=e.token.startLine)&&void 0!==t?t:NaN,null!==(n=e.token.startColumn)&&void 0!==n?n:NaN,null!==(i=e.token.endOffset)&&void 0!==i?i:NaN-e.token.startOffset,o)}static fromSemanticError(e){return new r("Semantic Error",e.startLine,e.startColumn,e.length,e.message)}toString(){return`${this.type} @ (${this.start_line}, ${this.start_column}): ${this.message}`}}t.CommonError=r}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r=n(2550)})(); |