UNPKG

82.4 kBJavaScriptView Raw
1var Ze=Object.defineProperty;var Wt=s=>Ze(s,"__esModule",{value:!0});var Ut=(s,e)=>{for(var t in e)Ze(s,t,{get:e[t],enumerable:!0})};Wt(exports);Ut(exports,{CompletionTypes:()=>N,Group:()=>M,ImbaDocument:()=>ie,KeywordTypes:()=>g,Keywords:()=>ee,M:()=>z,Monarch:()=>we,Node:()=>ne,Position:()=>Z,Range:()=>V,Scope:()=>j,SemanticTokenModifiers:()=>Ne,SemanticTokenTypes:()=>Q,Sym:()=>K,SymbolFlags:()=>d,SymbolKind:()=>L,Token:()=>P,grammar:()=>oe,highlight:()=>Ge,lexer:()=>W});var me=Symbol.for("#__init__"),yr=Symbol.for("#__initor__"),_r=Symbol.for("#__inited__"),kr=Symbol.for("#source"),br=Symbol.for("#lineText"),Jt=Symbol.for("#version"),xr=new WeakMap,Z=class{[me](e=null){this.line=e?e.line:void 0,this.character=e?e.character:void 0,this.offset=e?e.offset:void 0}constructor(e,t,r,n=null){this[me](),this.line=e,this.character=t,this.offset=r,this[Jt]=n}toString(){return""+this.line+":"+this.character}valueOf(){return this.offset}},V=class{[me](e=null){this.start=e?e.start:void 0,this.end=e?e.end:void 0}constructor(e,t){this[me](),this.start=e,this.end=t}get offset(){return this.start.offset}get length(){return this.end.offset-this.start.offset}get["0"](){return this.start.offset}get["1"](){return this.end.offset}getText(e){return e.slice(this.start,this.end)}equals(e){return e.offset==this.offset&&e.length==this.length}};function Xt(s){let e;return s?(e=s.toIterable)?e.call(s):s:[]}var Sr=Symbol.for("#__initor__"),Tr=Symbol.for("#__inited__");function de(s,e,t=1e5){let r=s;for(;r&&t>0;){if(r.match(e))return r;t--,r=r.prev}return null}function Se(s,e,t){t===void 0&&(t=0);for(var r=e?[t]:[],n=0;n<s.length;){var i=s.charCodeAt(n);(i===13||i===10)&&(i===13&&n+1<s.length&&s.charCodeAt(n+1)===10&&n++,r.push(t+n+1)),n++}return r}function He(s){var e=s.start,t=s.end;return e.line>t.line||e.line===t.line&&e.character>t.character?new V(t,e):s instanceof V?s:new V(e,t)}function We(s){return s!=null&&typeof s.text=="string"&&s.range===void 0}function Ue(s){let e=s.split(/\n/),t=[],r={indent:-1,children:[]},n=r,i,a=Date.now();for(let o=0,f=Xt(e),c=f.length;o<c;o++){let l=f[o];if(l.match(/^\s*$/))continue;let p=l.match(/^\t*/)[0].length;for(;r.indent>=p;)r=r.parent||n;if(i=l.match(/^(\t*((?:export )?(?:static )?(?:extend )?)(class|tag|def|get|set|prop|attr) )(\@?[\w\-\$\:]+(?:\.[\w\-\$]+)?)/),i){let u=i[3],h=i[4],S=r.name?r.name+".":"",v=i[2].trim().split(/\s+/),A="",_={start:{line:o,character:i[1].length},end:{line:o,character:i[0].length}},m={kind:u,ownName:h,name:S+h,span:_,indent:p,modifiers:v,children:[],parent:r==n?null:r,type:u,data:{},static:v.indexOf("static")>=0,extends:v.indexOf("extend")>=0};m.static&&(m.containerName="static"),m.containerName=i[2]+i[3],u=="tag"&&(i=l.match(/\<\s+([\w\-\$\:]+(?:\.[\w\-\$]+)?)/))&&(m.superclass=i[1]),r.type=="tag"&&(A="```html\n<"+r.name+" "+h+">\n```\n",m.description={kind:"markdown",value:A}),r.children.push(m),r=m,t.push(m)}}return n.all=t,console.log("fast outline",s.length,Date.now()-a),n}function Te(s){let e;return s?(e=s.toIterable)?e.call(s):s:[]}var Ce=[/^/,{token:"@rematch",next:"@pop"}],Je={token:"@rematch",next:"@pop"},Xe={token:"white.indent",next:"@>illegal_indent"};function Qt(s,e="#"){typeof s=="string"&&(s=s.split(" "));let t=s.slice().sort(function(r,n){return n.length-r.length});return t=t.map(function(r){let n=r.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&");return e.replace("#",n)}),new RegExp("(?:"+t.join("|")+")")}function I(s,e,t,r={}){var n;s==null?s=Xe:s==1?s={next:"@>"}:s==2?s={next:"@>_indent&-_indent"}:typeof s=="string"&&(s={next:s}),e==-1&&(e=Je),t==-1?t=Je:t==0&&(r.comment==null?r.comment=!0:r.comment,t={}),s=Object.assign({token:"white.tabs"},s||{}),t=Object.assign({token:"white.tabs"},t||{}),e=Object.assign({token:"@rematch",next:"@pop"},e||{});let i={"$1==$S2 ":s,"$1==$S2":{cases:{"$1==$S6":t,"@default":{token:"@rematch",switchTo:"@*$1"}}},"@default":e};n=0;for(let o of["next","switchTo"]){let f=n++;s[o]&&s[o].indexOf("*")==-1&&(s[o]+="*$1")}let a=[/^(\t*)(?=[^ \t\n])/,{cases:i}];if(r.comment){let o={};for(let f=0,c=Object.keys(i),l=c.length,p,u;f<l;f++){p=c[f],u=i[p];let h=Object.assign({},u);!h.next&&!h.switchTo&&(h.next="@>_comment"),o[p]=h}return[[/^(\t*)(?=#\s|#$)/,{cases:o}],a]}return a}var $e={root:[[/^@comment/,"comment","@>_comment"],[/^(\t+)(?=[^\t\n])/,{cases:{"$1==$S2 ":{token:"white.indent",next:"@>_indent*$1"},"@default":"white.indent"}}],"block_"],_comment:[[/^([\t\s\n]*)$/,"comment"],[/^(\t*)([\S\s]*)/,{cases:{"$1~$S2 *":{token:"comment"},"@default":{token:"@rematch",next:"@pop"}}}],[/[\S\s]+/,"comment"]],illegal_indent:[I()],identifier_:[[/\$\w+\$/,"identifier.env"],[/\$\d+/,"identifier.special"],[/\#+@id/,"identifier.symbol"],[/\¶@id/,"ivar"],[/@id\!?/,{cases:{this:"this",self:"self","@keywords":"keyword.$#","$0~[A-Z].*":"identifier.uppercase.$F","@default":"identifier.$F"}}]],block_:[[/^(\t+)(?=[\r\n]|$)/,"white.tabs"],"class_","tagclass_","var_","func_","import_","export_","flow_","for_","try_","catch_","while_","css_","tag_","do_","block_comment_","expr_",[/[ ]+/,"white"],"common_"],indentable_:[[/^[ ]+/,"white"],I("@>_paren_indent&-_indent",null,null),[/^(\t+)(?=[\r\n]|$)/,"white.tabs"],"whitespace"],_indent:[I(2,-1,0),"block_"],_paren_indent:[I(2,-1,0),"block_",[/\)|\}|\]/,"@rematch","@pop"]],block:[I("@>",-1,0),"block_"],bool_:[[/(true|false|yes|no|undefined|null)(?![\:\-\w\.\_])/,"boolean"]],op_:[[/\s+\:\s+/,"operator.ternary"],[/(@unspaced_ops)/,{cases:{"@spread":"operator.spread","@access":"operator.access","@default":"operator"}}],[/\/(?!\/)/,"operator.math"],[/\&(?=[,\)])/,"operator.special.blockparam"],[/(\s*)(@symbols)(\s*)/,{cases:{"$2@assignments":"operator.assign","$2@math":"operator.math","$2@operators":"operator","$2@logic":"operator.logic","$2@access":"operator.access","@default":"delimiter"}}],[/\&\b/,"operator"]],keyword_:[[/new@B/,"keyword.new"],[/isa@B/,"keyword.isa"],[/is@B/,"keyword.is"],[/(switch|when|throw|continue|break|then|await|typeof|by)@B/,"keyword.$1"],[/delete@B/,"keyword.delete"],[/and@B|or@B/,"operator.flow"]],return_:[[/return@B/,"keyword.new"]],primitive_:["string_","number_","regexp_","bool_"],value_:["primitive_","keyword_","implicit_call_","parens_","key_","access_","identifier_","array_","object_"],expr_:["comment_","inline_var_","return_","value_","tag_","op_","type_","spread_"],attr_expr_:["primitive_","parens_","access_","identifier_","array_","object_","tag_","op_"],access_:[[/(\.\.?)(@propid\!?)/,{cases:{"$2~[A-Z].*":["operator.access","accessor.uppercase"],"$2~#.*":["operator.access","accessor.symbol"],"@default":["operator.access","accessor"]}}]],call_:[[/\(/,"(","@call_body"]],key_:[[/(\#+@id)(\:\s*)/,["key.symbol","operator.assign.key-value"]],[/(@propid)(\:\s*)/,{cases:{"@default":["key","operator.assign.key-value"]}}]],implicit_call_:[[/(\.\.?)(@propid)@implicitCall/,{cases:{"$2~[A-Z].*":["operator.access","accessor.uppercase","@implicit_call_body"],"@default":["operator.access","accessor","@implicit_call_body"]}}],[/(@propid)@implicitCall/,{cases:{"$2~[A-Z].*":["identifier.uppercase","@implicit_call_body"],"@default":["identifier","@implicit_call_body"]}}]],implicit_call_body:[Ce,[/\)|\}|\]|\>/,"@rematch","@pop"],"arglist_","whitespace"],arglist_:["do_","expr_",[/\s*\,\s*/,"delimiter.comma"]],params_:[[/\[/,"array.[","@array_var_body=decl-param"],[/\{/,"object.{","@object_body=decl-param"],[/(@variable)/,"identifier.decl-param"],"spread_","type_",[/\s*\=\s*/,"operator","@var_value="],[/\s*\,\s*/,"separator"]],object_:[[/\{/,"object.{","@object_body"]],parens_:[[/\(/,"parens.(","@parens_body"]],parens_body:[[/\)/,")","@pop"],"indentable_","arglist_"],array_:[[/\[/,"array.[","@array_body"]],array_body:[[/\]@implicitCall/,{token:"]",switchTo:"@implicit_call_body="}],[/\]/,"]","@pop"],[/\)|\}/,"invalid"],"indentable_","expr_",[",","delimiter"]],object_body:[[/\}/,"}","@pop"],[/(@id)(\s*:\s*)/,["key","operator.assign.key-value","@object_value"]],[/(@id)/,"identifier.$F"],[/\[/,"[","@object_dynamic_key="],[/\s*=\s*/,"operator.assign","@object_value="],[/:/,"operator.assign.key-value","@object_value="],[/\,/,"delimiter.comma"],"indentable_","expr_"],object_value:[Ce,[/,|\}|\]|\)/,"@rematch","@pop"],"expr_"],object_dynamic_key:[["]","]","@pop"],"expr_"],comment_:[[/#(\s.*)?(\n|$)/,"comment"]],block_comment_:[[/###/,"comment.start","@_block_comment"]],_block_comment:[[/###/,"comment.end","@pop"],[/[^#]+/,"comment"],[/#(?!##)/,"comment"]],try_:[[/try@B/,"keyword.try","@>_try&try"]],catch_:[[/(catch\s+)(?=@id(\s|$))/,"keyword.catch","@catch_start&catch"],[/catch@B/,"keyword.catch","@catch_start&catch"]],catch_start:[[/@id/,"identifier.decl-const",{switchTo:"@>_catch"}],[/.?/,"@rematch",{switchTo:"@>_catch"}]],_catch:[I("@>block",-1,0),"block_"],_try:[I("@>block",-1,0),"block_"],do_:[[/do(?=\()/,"keyword.do","@>do_start&do"],[/do(?=\s*\|)/,"keyword.do","@>do_piped&do"],[/do@B/,"keyword.do","@>_do&do"]],do_start:[I(null,-1,-1),[/\(/,"(",{switchTo:"@_do_params"}],[/./,"@rematch",{switchTo:"@_do"}]],do_piped:[I(null,-1,-1),[/\s*\|/,"args.open",{switchTo:"@_do_piped_params"}],[/./,"@rematch",{switchTo:"@_do"}]],_do_piped_params:[[/\|/,"args.close",{switchTo:"@_do"}],"params_"],_do_params:[[/\)/,")",{switchTo:"@_do"}],"params_"],_do:[I(2,-1,0),[/(\}|\)|\])/,"@rematch","@pop"],"block_"],class_:[[/(extend)(?=\s+class )/,"keyword.$1"],[/(global)(?=\s+class )/,"keyword.$1"],[/(class)(\s)(@id)/,["keyword.$1","white.$1name","entity.name.class.decl-const","@class_start="]],[/(class)(?=\n)/,"keyword.$1","@>_class&class="]],class_start:[[/(\s+\<\s+)(@id)/,["keyword.extends","identifier.superclass"]],[/@comment/,"comment"],[/^/,"@rematch",{switchTo:"@>_class&class="}]],tagclass_:[[/(extend)(?=\s+tag )/,"keyword.$1"],[/(global)(?=\s+tag )/,"keyword.$1"],[/(tag)(\s)(@constant)/,["keyword.tag","white.tagname","entity.name.component.local","@tagclass_start="]],[/(tag)(\s)(@id)/,["keyword.tag","white.tagname","entity.name.component.global","@tagclass_start="]]],tagclass_start:[[/(\s+\<\s+)(@id)/,["keyword.extends","identifier.superclass"]],[/@comment/,"comment"],[/^/,"@rematch",{switchTo:"@>_tagclass&component="}]],import_:[[/(import)(?=\s+['"])/,"keyword.import","@>import_source"],[/(import)(\s+type)(?=\s[\w\$\@\{])/,["keyword.import","keyword.type","@>import_body&-_imports=decl-import/part"]],[/(import)@B/,"keyword.import","@>import_body&-_imports=decl-import/part"]],import_body:[I(null,-1,0),[/(@esmIdentifier)( +from)/,["identifier.$F.default","keyword.from",{switchTo:"@import_source"}]],[/(\*)(\s+as\s+)(@esmIdentifier)(\s+from)/,["keyword.star","keyword.as","identifier.$F.ns","keyword.from",{switchTo:"@import_source"}]],[/(@esmIdentifier)(\s*,\s*)(\*)(\s+as\s+)(@esmIdentifier)(from)/,["identifier.$F.default","delimiter.comma","keyword.star","keyword.as","identifier.$F.ns","keyword.from",{switchTo:"@import_source"}]],[/\ *from/,"keyword.from",{switchTo:"@import_source"}],[/\{/,"specifiers.{","@esm_specifiers/part"],[/(@esmIdentifier)/,"identifier.$F",{switchTo:"@/delim"}],[/\s*\,\s*/,"delimiter.comma",{switchTo:"@/part"}],"comma_","common_"],import_source:[I(null,-1,0),[/["']/,"path.open","@_path=$#"],Ce],export_:[[/(export)( +)(default)@B/,["keyword.export","white","keyword.default"]],[/(export)(?= +(let|const|var|class|tag)@B)/,"keyword.export"],[/(export)( +)(global)@B/,["keyword.export","white","keyword.global"]],[/(export)(\s+\*\s+)(from)@B/,["keyword.export","operator.star","keyword.from","@>import_source"]],[/(export)@B/,"keyword.export","@>export_body"]],export_body:[I(null,-1,0),[/(\*)(\s+as\s+)(@esmIdentifier)/,["keyword.star","keyword.as","identifier.const.export"]],[/(@esmIdentifier)(\s+as\s+)(default)/,["alias","keyword.as","alias.default"]],[/(@esmIdentifier)(\s+as\s+)(@esmIdentifier)/,["alias","keyword.as","identifier.const.export"]],[/from/,"keyword.from",{switchTo:"@import_source"}],[/\{/,"{","@esm_specifiers=export/part"],[/(@esmIdentifier)/,"identifier.const.export"],[/\*/,"operator.star"],"comma_","common_"],esm_specifiers:[[/\}/,"}","@pop"],[/(@esmIdentifier)(\s+as\s+)(@esmIdentifier)/,["alias","keyword.as","identifier.const.$F",{switchTo:"@/delim"}]],[/@esmIdentifier/,{cases:{"$/==part":{token:"identifier.const.$S4",switchTo:"@/delim"},"@default":{token:"invalid"}}}],[/\s*\,\s*/,"delimiter.comma",{switchTo:"@/part"}],"whitespace"],_path:[[/[^"'\`\{\\]+/,"path"],[/@escapes/,"path.escape"],[/\./,"path.escape.invalid"],[/\{/,"invalid"],[/["'`]/,{cases:{"$#==$F":{token:"path.close",next:"@pop"},"@default":"path"}}]],member_:[[/(constructor)@B/,"entity.name.constructor","@>def_params&def/def"],[/(def|get|set)(\s)(@defid)/,["keyword.$1","white.entity","entity.name.$1","@>def_params&$1/$1"]],[/(def|get|set)(\s)(\[)/,["keyword.$1","white.entity","$$","@>def_dynamic_name/$1"]]],func_:[[/export(?=\s+(get|set|def|global) )/,"keyword.export"],[/global(?=\s+(get|set|def) )/,"keyword.global"],[/(def)(\s)(@id)(\.)(@defid)/,["keyword.$1","white.entity","identifier.target","operator","entity.name.def","@>def_params&$1/$1"]],[/(def)(\s)(@defid)/,["keyword.$1","white.entity","entity.name.function.decl-const-func","@>def_params&$1/$1"]]],flow_:[[/(if|else|elif|unless)(?=\s|$)/,["keyword.$1","@flow_start=$1"]]],flow_start:[I({switchTo:"@>_flow&$F"},-1,-1),[/[ \t]+/,"white"],"expr_"],for_:[[/for(?: own)?@B/,"keyword.$#","@for_start&forscope=decl-for"]],while_:[[/(while|until)@B/,"keyword.$#","@>while_body"]],while_body:[I(2,-1,0),"block_"],for_start:[I({switchTo:"@>for_body"},-1,-1),[/\[/,"array.[","@array_var_body"],[/\{/,"object.{","@object_body"],[/(@variable)/,"identifier.$F"],[/(\s*\,\s*)/,"separator","@=decl-for-index"],[/\s(in|of)@B/,"keyword.$1",{switchTo:"@>for_source="}],[/[ \t]+/,"white"],"type_"],for_source:[I({switchTo:"@>for_body"},-1,{switchTo:"@for_body"}),"expr_",[/[ \t]+/,"white"]],for_body:[I(2,-1,0),"block_"],decorator_:[[/(@decid)(\()/,["decorator","$2","@_decorator_params"]],[/(@decid)/,"decorator"]],_decorator_params:[[/\)/,")","@pop"],"params_"],field_:[[/((?:lazy )?)((?:static )?)(const|let|attr)(?=\s|$)/,["keyword.lazy","keyword.static","keyword.$1","@_vardecl=field-$3"]],[/(static\s+)(?=@fieldid)/,"keyword.static"],[/(@fieldid)(?=$)/,"entity.name.field"],[/(@fieldid)/,["entity.name.field","@_field_1"]]],_field_1:[I(null,-1,-1),"type_",[/(\s*=)(?!\=)/,["operator.assign","@>_field_value&field"]],[/(\s*(?:\@)set\s*)/,["keyword.spy","@>_def&spy"]]],_field_value:[I(2,-1,0),"block_",[/(\s*(?:\@)set\s*)/,["@rematch","@pop"]]],var_:[[/((?:export )?)(const|let)(?=\s[\[\{\$a-zA-Z]|\s*$)/,["keyword.export","keyword.$1","@_vardecl=decl-$2"]],[/((?:export )?)(const|let)(?=\s|$)/,["keyword.export","keyword.$1"]]],inline_var_:[[/(const|let)(?=\s[\[\{\$a-zA-Z]|\s*$)/,["keyword.$1","@inline_var_body=decl-$1"]]],string_:[[/"""/,"string",'@_herestring="""'],[/'''/,"string","@_herestring='''"],[/["'`]/,"string.open","@_string=$#"]],number_:[[/0[xX][0-9a-fA-F_]+/,"number.hex"],[/0[b][01_]+/,"number.binary"],[/0[o][0-9_]+/,"number.octal"],[/(\d+)([a-z]+|\%)/,["number","unit"]],[/(\d*\.\d+(?:[eE][\-+]?\d+)?)([a-z]+|\%)/,["number.float","unit"]],[/\d+[eE]([\-+]?\d+)?/,"number.float"],[/\d[\d_]*\.\d[\d_]*([eE][\-+]?\d+)?/,"number.float"],[/\d[\d_]*/,"number.integer"],[/0[0-7]+(?!\d)/,"number.octal"],[/\d+/,"number"]],_string:[[/[^"'\`\{\\]+/,"string"],[/@escapes/,"string.escape"],[/\./,"string.escape.invalid"],[/\{/,{cases:{"$F=='":"string","@default":{token:"string.bracket.open",next:"@interpolation_body"}}}],[/["'`]/,{cases:{"$#==$F":{token:"string.close",next:"@pop"},"@default":"string"}}],[/#/,"string"]],_herestring:[[/("""|''')/,{cases:{"$1==$F":{token:"string",next:"@pop"},"@default":"string"}}],[/[^#\\'"\{]+/,"string"],[/['"]+/,"string"],[/@escapes/,"string.escape"],[/\./,"string.escape.invalid"],[/\{/,{cases:{'$F=="""':{token:"string",next:"@interpolation_body"},"@default":"string"}}],[/#/,"string"]],interpolation_body:[[/\}/,"string.bracket.close","@pop"],"expr_"],_class:[I(Xe,-1,0),"css_","member_","comment_","decorator_",[/(get|set|def|static|prop|attr)@B/,"keyword.$0"],"field_","common_"],_tagclass:["_class",[/(?=\<self)/,"entity.name.def.render","@_render&def"]],def_params:[[/\(/,"(","@def_parens"],[/^/,"@rematch",{switchTo:"@_def"}],[/do@B/,"keyword.do",{switchTo:"@_def"}],"params_",[/@comment/,"comment"]],def_parens:[[/\)/,")","@pop"],"params_"],def_dynamic_name:[["]",{token:"square.close",switchTo:"@def_params&$/"}],"expr_"],_render:[I(2,-1,-1),"block_"],_def:[I(2,-1,0),"block_"],_flow:[I(2,-1,0),"block_"],_varblock:[I(1,-1,-1),[/\[/,"array.[","@array_var_body"],[/\{/,"object.{","@object_body"],[/(@variable)/,"identifier.$F"],[/\s*\,\s*/,"separator"],[/(\s*\=\s*)(?=(for|while|until|if|unless|try)\s)/,"operator","@pop"],[/(\s*\=\s*)/,"operator","@var_value="],"type_",[/#(\s.*)?\n?$/,"comment"]],_vardecl:[I(null,-1,-1),[/\[/,"array.[","@array_var_body"],[/\{/,"object.{","@object_body"],[/(@variable)(?=\n|,|$)/,"identifier.$F","@pop"],[/(@variable)/,"identifier.$F"],[/(\s*\=\s*)/,"operator.declval",{switchTo:"@var_value&value="}],"type_"],array_var_body:[[/\]/,"]","@pop"],[/\{/,"object.{","@object_body"],[/\[/,"array.[","@array_var_body"],"spread_",[/(@variable)/,"identifier.$F"],[/(\s*\=\s*)/,"operator.assign","@array_var_body_value="],[",","delimiter"]],array_var_body_value:[[/(?=,|\)|]|})/,"delimiter","@pop"],"expr_"],inline_var_body:[[/\[/,"array.[","@array_var_body"],[/\{/,"object.{","@object_body"],[/(@variable)/,"identifier.$F"],[/(\s*\=\s*)/,"operator","@pop"],"type_"],var_value:[[/(?=,|\)|]|})/,"delimiter","@pop"],I({switchTo:"@>block"},-1,-1),"block_"],common_:[[/^(\t+)(?=\n|$)/,"white.tabs"],"whitespace"],comma_:[[/\s*,\s*/,"delimiter.comma"]],spread_:[[/\.\.\./,"operator.spread"]],type_:[[/\\/,"@rematch","@_type&-_type/0"]],_type:[I(-1,-1,-1),[/\\/,"delimiter.type.prefix"],[/\[/,"delimiter.type","@/]"],[/\(/,"delimiter.type","@/)"],[/\{/,"delimiter.type","@/}"],[/\</,"delimiter.type","@/>"],[/\|/,"delimiter.type.union"],[/\,|\s|\=|\./,{cases:{"$/==0":{token:"@rematch",next:"@pop"},"@default":"type"}}],[/[\]\}\)\>]/,{cases:{"$#==$/":{token:"delimiter.type",next:"@pop"},"@default":{token:"@rematch",next:"@pop"}}}],[/[\w\-\$]+/,"type"]],css_:[[/global(?=\s+css@B)/,"keyword.$#"],[/css(?:\s+)?/,"keyword.css","@>css_selector&rule-_sel"]],sel_:[[/(\%)((?:@id)?)/,["style.selector.mixin.prefix","style.selector.mixin"]],[/(\@)(\.{0,2}[\w\-\<\>\!]*\+?)/,"style.selector.modifier"],[/(\@)(\.{0,2}[\w\-\<\>\!]*)/,"style.selector.modifier"],[/\.([\w\-]+)/,"style.selector.class-name"],[/\#([\w\-]+)/,"style.selector.id"],[/([\w\-]+)/,"style.selector.element"],[/(>+|~|\+)/,"style.selector.operator"],[/(\*+)/,"style.selector.element.any"],[/(\$)((?:@id)?)/,["style.selector.reference.prefix","style.selector.reference"]],[/\&/,"style.selector.context"],[/\(/,"delimiter.selector.parens.open","@css_selector_parens"],[/\[/,"delimiter.selector.attr.open","@css_selector_attr"],[/\s+/,"white"],[/,/,"style.selector.delimiter"],[/#(\s.*)?\n?$/,"comment"]],css_props:[I(null,-1,0),[/(?=@cssPropertyKey2)/,"","@css_property&-_styleprop-_stylepropkey"],[/#(\s.*)?\n?$/,"comment"],[/(?=[\%\*\w\&\$\>\.\[\@\!]|\#[\w\-])/,"","@>css_selector&rule-_sel"],[/\s+/,"white"]],css_selector:[I({switchTo:"@css_props"},-1,{token:"@rematch",switchTo:"@css_props&_props"}),[/(\}|\)|\])/,"@rematch","@pop"],[/(?=\s*@cssPropertyKey2)/,"",{switchTo:"@css_props&_props"}],[/\s*#\s/,"@rematch",{switchTo:"@css_props&_props"}],"sel_"],css_inline:[[/\]/,"style.close","@pop"],[/(?=@cssPropertyKey2)/,"","@css_property&-_styleprop-_stylepropkey"],[/(?=@cssPropertyPath\])/,"","@css_property&-_styleprop-_stylepropkey"]],css_selector_parens:[[/\)/,"delimiter.selector.parens.close","@pop"],"sel_"],css_selector_attr:[[/\]/,"delimiter.selector.parens.close","@pop"],"sel_"],css_property:[I(null,-1,-1),[/\]/,"@rematch","@pop"],[/(\d+)(@id)/,["style.property.unit.number","style.property.unit.name"]],[/((--|\$)@id)/,"style.property.var"],[/(-*@id)/,"style.property.name"],[/@cssModifier/,"style.property.modifier"],[/(\@+|\.+)(@id\-?)/,["style.property.modifier.start","style.property.modifier"]],[/\+(@id)/,"style.property.scope"],[/\s*([\:]\s*)(?=@br|$)/,"style.property.operator",{switchTo:"@>css_multiline_value&_stylevalue"}],[/\s*([\:]\s*)/,"style.property.operator",{switchTo:"@>css_value&_stylevalue"}]],css_value_:[[/(x?xs|sm\-?|md\-?|lg\-?|xx*l|\dxl|hg|x+h)\b/,"style.value.size"],[/\#[0-9a-fA-F]+/,"style.value.color.hex"],[/((--|\$)@id)/,"style.value.var"],[/(@optid)(\@+|\.+)(@optid)/,["style.property.name","style.property.modifier.prefix","style.property.modifier"]],"op_","string_","number_","comment_",[/\s+/,"style.value.white"],[/\(/,"delimiter.style.parens.open","@css_expressions"],[/\{/,"delimiter.style.curly.open","@css_interpolation&-_styleinterpolation"],[/(@id)/,"style.value"]],css_value:[I({switchTo:"@>css_multiline_value"},-1,-1),[/@cssPropertyKey2/,"@rematch","@pop"],[/;/,"style.delimiter","@pop"],[/(\}|\)|\])/,"@rematch","@pop"],"css_value_"],css_multiline_value:[I(null,-1,0),[/@cssPropertyKey2/,"invalid"],"css_value_"],css_expressions:[[/\)/,"delimiter.style.parens.close","@pop"],[/\(/,"delimiter.style.parens.open","@css_expressions"],"css_value"],css_interpolation:[[/\}/,"delimiter.style.curly.close","@pop"],"expr_"],expressions:[[/\,/,"delimiter.comma"]],whitespace:[[/[\r\n]+/,"br"],[/[ \t\r\n]+/,"white"]],space:[[/[ \t]+/,"white"]],tag_:[[/(\s*)(<)(?=\.)/,["white","tag.open","@_tag/flag"]],[/(\s*)(<)(?=\w|\{|\[|\%|\#|>)/,["white","tag.open","@_tag/name"]]],tag_content:[I(2,-1,0),[/\)|\}|\]/,"@rematch","@pop"],"common_","flow_","var_","for_","css_","expr_","do_"],tag_children:[],_tag:[[/\/>/,"tag.close","@pop"],[/>/,"tag.close",{switchTo:"@>tag_content=&-_tagcontent"}],[/>/,"tag.close","@pop"],[/(\-?\d+)/,"tag.$S3"],[/(\%)(@id)/,["tag.mixin.prefix","tag.mixin"]],[/\#@id/,"tag.id"],[/\./,{cases:{"$/==event":{token:"tag.event-modifier.start",switchTo:"@/event-modifier"},"$/==event-modifier":{token:"tag.event-modifier.start",switchTo:"@/event-modifier"},"$/==modifier":{token:"tag.modifier.start",switchTo:"@/modifier"},"$/==rule":{token:"tag.rule-modifier.start",switchTo:"@/rule-modifier"},"$/==rule-modifier":{token:"tag.rule-modifier.start",switchTo:"@/rule-modifier"},"@default":{token:"tag.flag.start",switchTo:"@/flag"}}}],[/(\$@id)/,{cases:{"$/==name":"tag.reference","@default":"tag.$/"}}],[/\{/,"tag.$/.interpolation.open","@_tag_interpolation"],[/\[/,"style.open","@css_inline"],[/(\s*\=\s*)/,"operator.equals.tagop.tag-$/","@_tag_value&-value"],[/\:/,{token:"tag.event.start",switchTo:"@/event"}],"tag_event_",[/(\-?@tagIdentifier)(\:@id)?/,{cases:{"$/==attr":{token:"@rematch",next:"@_tag_attr&-_tagattr"},"@default":{token:"tag.$/"}}}],[/\(/,{token:"tag.$/.parens.open",next:"@_tag_parens/0"}],[/\s+/,{token:"tag.white",switchTo:"@/attr"}],"comment_"],tag_event_:[[/(?=\@@optid)/,"","@_tag_event&-_listener"]],_tag_part:[[/\)|\}|\]|\>/,"@rematch","@pop"]],_tag_event:["_tag_part",[/(\@)(@optid)/,["tag.event.start","tag.event.name"]],[/(\.)(@optid)/,["tag.event-modifier.start","tag.event-modifier.name"]],[/\(/,{token:"tag.$/.parens.open",next:"@_tag_parens/0"}],[/(\s*\=\s*)/,"operator.equals.tagop.tag-$/","@_tag_value&handler"],[/\s+/,"@rematch","@pop"]],tag_attr_:[[/(?=@tagIdentifier(\:@id)?)/,"","@_tag_attr&-_attribute"]],_tag_attr:["_tag_part",[/(\-?@tagIdentifier)(\:@id)?/,"tag.attr"],[/\.(@optid)/,"tag.event-modifierzz"],[/\(/,{token:"tag.parens.open.$/",next:"@_tag_parens/0"}],[/(\s*\=\s*)/,"operator.equals.tagop.tag-$/","@_tag_value&-tagattrvalue"],[/\s+/,"@rematch","@pop"]],_tag_interpolation:[[/\}/,"tag.$/.interpolation.close","@pop"],"expr_",[/\)|\]/,"invalid"]],_tag_parens:[[/\)/,"tag.$/.parens.close","@pop"],"arglist_",[/\]|\}/,"invalid"]],_tag_value:[[/(?=(\/?\>|\s))/,"","@pop"],"attr_expr_"],regexp_:[[/\/(?!\ )(?=([^\\\/]|\\.)+\/)/,{token:"regexp.slash.open",bracket:"@open",next:"@_regexp"}],[/\/\/\//,{token:"regexp.slash.open",bracket:"@open",next:"@_hereregexp"}],[/(\/)(\/)/,["regexp.slash.open","regexp.slash.close"]]],_regexp:[[/(\{)(\d+(?:,\d*)?)(\})/,["regexp.escape.control","regexp.escape.control","regexp.escape.control"]],[/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,["regexp.escape.control",{token:"regexp.escape.control",next:"@_regexrange"}]],[/(\()(\?:|\?=|\?!)/,["regexp.escape.control","regexp.escape.control"]],[/[()]/,"regexp.escape.control"],[/@regexpctl/,"regexp.escape.control"],[/[^\\\/]/,"regexp"],[/@regexpesc/,"regexp.escape"],[/\\:/,"regexp.escape"],[/\\\./,"regexp.invalid"],[/(\/)(\w+)/,[{token:"regexp.slash.close"},{token:"regexp.flags",next:"@pop"}]],["/",{token:"regexp.slash.close",next:"@pop"}],[/./,"regexp.invalid"]],_regexrange:[[/-/,"regexp.escape.control"],[/\^/,"regexp.invalid"],[/@regexpesc/,"regexp.escape"],[/[^\]]/,"regexp"],[/\]/,"regexp.escape.control","@pop"]],_hereregexp:[[/[^\\\/#]/,"regexp"],[/\\./,"regexp"],[/#.*$/,"comment"],["///[igm]*","regexp","@pop"],[/\//,"regexp"],"comment_"]};function ye(s){let e=["$S1","$S2","$S3","$S4","$S5","$S6"];if(s.match(/\@(pop|push|popall)/)||(s[0]=="@"&&(s=s.slice(1)),s.indexOf(".")>=0))return s;s=ge(s),s[0]==">"&&(e[1]="$S6 ",s=s.slice(1));for(let t=0,r=Te(s.split(/(?=[\/\&\=\*])/)),n=r.length;t<n;t++){let i=r[t];i[0]=="&"?i[1]=="-"||i[1]=="_"?e[2]="$S3"+i.slice(1):e[2]="$S3-"+i.slice(1):i[0]=="+"?e[3]="$S4-"+i.slice(1):i[0]=="="?e[3]=i.slice(1):i[0]=="/"?e[4]=i.slice(1):i[0]=="*"?e[5]=i.slice(1):e[0]=i}return e.join(".")}function ge(s){let e=s;return s=s.replace("$/","$S5"),s=s.replace("$F","$S4"),s=s.replace("$&","$S3"),s=s.replace("$I","$S2"),s=s.replace("$T","$S2"),s}function Ie(s,e){if(typeof s=="string"&&(s={token:s}),s&&s.token!=null)s.token=ge(s.token),typeof e=="string"?s.next=e:e&&Object.assign(s,e),s.next&&(s.next=ye(s.next)),s.switchTo&&(s.switchTo=ye(s.switchTo));else if(s&&s.cases){let t={};for(let r=s.cases,n=0,i=Object.keys(r),a=i.length,o,f;n<a;n++){o=i[n],f=r[o];let c=ge(o);t[c]=Ie(f)}s.cases=t}else if(s instanceof Array){let t=[],r=null;for(let n=0,i=Te(s),a=i.length;n<a;n++){let o=i[n];o[0]=="@"&&n==s.length-1&&r&&(o={next:o}),typeof o=="object"?o.token!=null||o.cases?t.push(r=Object.assign({},o)):Object.assign(r,o):typeof o=="string"&&t.push(r={token:ge(o)})}s=t}if(s instanceof Array)for(let t=0,r=Te(s),n=r.length;t<n;t++){let i=r[t];i.token&&i.token.indexOf("$$")>=0&&(i.token=i.token.replace("$$","$"+(t+1))),i.next&&(i.next=ye(i.next)),i.switchTo&&(i.switchTo=ye(i.switchTo))}return s}for(let s=0,e=Object.keys($e),t=e.length,r,n;s<t;s++){r=e[s],n=$e[r];let i=0;for(;i<n.length;){let a=n[i];if(a[0]instanceof Array){n.splice(i,1,...a);continue}else typeof a=="string"?n[i]={include:a}:a[1]instanceof Array?a[1]=Ie(a[1]):a instanceof Array&&a.splice(1,2,Ie(a[1],a[2]));i++}}var oe={defaultToken:"invalid",ignoreCase:!1,tokenPostfix:"",brackets:[{open:"{",close:"}",token:"bracket.curly"},{open:"[",close:"]",token:"bracket.square"},{open:"(",close:")",token:"bracket.parenthesis"}],keywords:["def","and","or","is","isnt","not","on","yes","@","no","off","true","false","null","this","self","as","new","delete","typeof","in","instanceof","return","throw","break","continue","debugger","if","elif","else","switch","for","while","do","try","catch","finally","class","extends","super","undefined","then","unless","until","loop","of","by","when","tag","prop","attr","export","import","extend","var","let","const","require","isa","await"],boolean:["true","false","yes","no","undefined","null"],operators:["=","!","~","?",":","!!","??","&","|","^","%","<<","!&",">>",">>>","+=","-=","*=","/=","&=","|=","?=","??=","^=","%=","~=","<<=",">>=",">>>=","..","...","||=","&&=","**=","**","|=?","~=?","^=?","=?","and","or"],assignments:["=","|=?","~=?","^=?","=?","^=","%=","~=","<<=",">>=",">>>=","||=","&&=","?=","??=","+=","-=","*=","/=","&=","|=","**="],logic:[">","<","==","<=",">=","!=","&&","||","===","!=="],ranges:["..","..."],spread:["..."],dot:["."],access:[".",".."],math:["+","-","*","/","++","--"],unspaced_ops:Qt("... . .. + * ++ --"),comment:/#(\s.*)?(\n|$)/,symbols:/[=><!~?&%|+\-*\^,]+/,escapes:/\\(?:[abfnrtv\\"'$]|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,postaccess:/(:(?=\w))?/,ivar:/\@[a-zA-Z_]\w*/,B:/(?=\s|$)/,br:/[\r\n]+/,constant:/[A-Z][\w\$]*(?:\-+[\w\$]+)*/,id:/[A-Za-z_\$][\w\$]*(?:\-+[\w\$]+)*\??/,plainid:/[A-Za-z_\$][\w\$]*(?:\-+[\w\$]+)*\??/,fieldid:/[\@\#]*@plainid/,propid:/[\@\#]*@plainid/,defid:/[\@\#]*@plainid/,decid:/\@@plainid/,symid:/\#+@plainid/,symref:/\#\#@plainid/,optid:/(?:@id)?/,esmIdentifier:/[A-Za-z_\$\@][\w\$]*(?:\-+[\w\$]+)*\??/,propertyPath:/(?:[A-Za-z_\$][A-Za-z\d\-\_\$]*\.)?(?:[A-Za-z_\$][A-Za-z\d\-\_\$]*)/,tagNameIdentifier:/(?:[\w\-]+\:)?\w+(?:\-\w+)*/,variable:/[\w\$]+(?:-[\w\$]*)*\??/,varKeyword:/var|let|const/,tagIdentifier:/-*[a-zA-Z][\w\-]*/,implicitCall:/(?!\s(?:and|or|is|isa)\s)(?=\s[\w\'\"\/\[\{])/,cssModifier:/(?:\@+[\<\>\!]?[\w\-]+\+?|\.+@id\-?)/,cssPropertyPath:/[\@\.]*[\w\-\$]+(?:[\@\.]+[\w\-\$]+)*/,cssPropertyKey:/[\@\.]*[\w\-\$]+(?:[\@\.]+[\w\-\$]+)*(?:\s*\:)/,cssVariable:/(?:--|\$)[\w\-\$]+/,cssPropertyName:/[\w\-\$]+/,cssPropertyKey2:/(?:@cssPropertyName(?:@cssModifier)*|@cssModifier+)(?:\s*\:)/,cssUpModifier:/\.\.[\w\-\$]+/,cssIsModifier:/\.[\w\-\$]+/,regEx:/\/(?!\/\/)(?:[^\/\\]|\\.)*\/[igm]*/,regexpctl:/[(){}\[\]\$\^|\-*+?\.]/,regexpesc:/\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,tokenizer:$e};var H;(function(s){s[s.None=0]="None",s[s.Open=1]="Open",s[s.Close=-1]="Close"})(H||(H={}));function Yt(s){return Array.isArray(s)}function Qe(s){return!Yt(s)}function Ae(s){return typeof s=="string"}function Ye(s){return!Ae(s)}function et(s){return!s}function J(s,e){return s.ignoreCase&&e?e.toLowerCase():e}function Oe(s){return s.replace(/[&<>'"_]/g,"-")}function tt(s,e){console.log(`${s.languageId}: ${e}`)}function O(s,e){return new Error(`${s.languageId}: ${e}`)}var rt={};function er(s){let e=[],t=0,r=s.length,n="",i=0;for(;t<r;){let a=s[t++];if(a=="$"){let o=s[t++];if(o=="$"){n+="$";continue}n&&e.push(n),n="",o=="#"?e.push(0):o=="S"?e.push(parseInt(s[t++])+100):e.push(parseInt(o)+1)}else n+=a}return n&&e.push(n),rt[s]=e,e}function q(s,e,t,r,n){let i=null,a=rt[e]||er(e),o="";for(let f=0;f<a.length;f++){let c=a[f];typeof c=="string"?o+=c:c>100?(i===null&&(i=n.split(".")),o+=i[c-101]||""):c===100?o+=n:c===0?o+=t:c>0&&(o+=r[c-1])}return o}var Me={};function _e(s,e){let t=e;if(Me[t])return s.tokenizer[Me[t]];for(;t&&t.length>0;){let r=s.tokenizer[t];if(r)return Me[e]=t,r;let n=t.lastIndexOf(".");n<0?t=null:t=t.substr(0,n)}return null}function nt(s,e){let t=e;for(;t&&t.length>0;){if(s.stateNames[t])return!0;let n=t.lastIndexOf(".");n<0?t=null:t=t.substr(0,n)}return!1}function tr(s,e){if(!e||!Array.isArray(e))return!1;for(let t of e)if(!s(t))return!1;return!0}function st(s,e){return typeof s=="boolean"?s:e}function it(s,e){return typeof s=="string"?s:e}function rr(s){let e={};for(let t of s)e[t]=!0;return e}function ot(s,e=!1){e&&(s=s.map(function(r){return r.toLowerCase()}));let t=rr(s);return e?function(r){return t[r.toLowerCase()]!==void 0&&t.hasOwnProperty(r.toLowerCase())}:function(r){return t[r]!==void 0&&t.hasOwnProperty(r)}}function Ee(s,e){let t=0;for(;e.indexOf("@")>=0&&t<5;)t++,e=e.replace(/@(\w+)/g,function(r,n){let i="";if(typeof s[n]=="string")i=s[n];else if(s[n]&&s[n]instanceof RegExp)i=s[n].source;else throw s[n]===void 0?O(s,"language definition does not contain attribute '"+n+"', used at: "+e):O(s,"attribute reference '"+n+"' must be a string, used at: "+e);return et(i)?"":"(?:"+i+")"});return new RegExp(e,s.ignoreCase?"i":"")}function nr(s,e,t,r){if(r<0)return s;if(r<e.length)return e[r];if(r>=100){r=r-100;let n=t.split(".");if(n.unshift(t),r<n.length)return n[r]}return null}function sr(s,e,t,r){let n=-1,i=t,a=t.match(/^\$(([sS]?)(\d\d?)|#)(.*)$/);a&&(a[3]&&(n=parseInt(a[3]),a[2]&&(n=n+100)),i=a[4]);let o="~",f=i;!i||i.length===0?(o="!=",f=""):/^\w*$/.test(f)?o="==":(a=i.match(/^(@|!@|~|!~|==|!=)(.*)$/),a&&(o=a[1],f=a[2]));let c;if((o==="~"||o==="!~")&&/^(\w|\|)*$/.test(f)){let l=ot(f.split("|"),s.ignoreCase);c=function(p){return o==="~"?l(p):!l(p)}}else if(o==="@"||o==="!@"){let l=s[f];if(!l)throw O(s,"the @ match target '"+f+"' is not defined, in rule: "+e);if(!tr(function(u){return typeof u=="string"},l))throw O(s,"the @ match target '"+f+"' must be an array of strings, in rule: "+e);let p=ot(l,s.ignoreCase);c=function(u){return o==="@"?p(u):!p(u)}}else if(o==="~"||o==="!~")if(f.indexOf("$")<0){let l=Ee(s,"^"+f+"$");c=function(p){return o==="~"?l.test(p):!l.test(p)}}else c=function(l,p,u,h){return Ee(s,"^"+q(s,f,p,u,h)+"$").test(l)};else if(f.indexOf("$")<0){let l=J(s,f);c=function(p){return o==="=="?p===l:p!==l}}else{let l=J(s,f);c=function(p,u,h,S,v){let A=q(s,l,u,h,S);return o==="=="?p===A:p!==A}}return n===-1?{name:t,value:r,test:function(l,p,u,h){return c(l,l,p,u,h)}}:{name:t,value:r,test:function(l,p,u,h){let S=nr(l,p,u,n);return c(S||"",l,p,u,h)}}}function ze(s,e,t){if(t){if(typeof t=="string")return t;if(t.token||t.token===""){if(typeof t.token!="string")throw O(s,"a 'token' attribute must be of type string, in rule: "+e);{let r={token:t.token};if(t.token.indexOf("$")>=0&&(r.tokenSubst=!0),typeof t.bracket=="string")if(t.bracket==="@open")r.bracket=H.Open;else if(t.bracket==="@close")r.bracket=H.Close;else throw O(s,"a 'bracket' attribute must be either '@open' or '@close', in rule: "+e);if(t.next){if(typeof t.next!="string")throw O(s,"the next state must be a string value in rule: "+e);{let n=t.next;if(!/^(@pop|@push|@popall)$/.test(n)&&(n[0]==="@"&&(n=n.substr(1)),n.indexOf("$")<0&&!nt(s,q(s,n,"",[],""))))throw O(s,"the next state '"+t.next+"' is not defined in rule: "+e);r.next=n}}return typeof t.goBack=="number"&&(r.goBack=t.goBack),typeof t.switchTo=="string"&&(r.switchTo=t.switchTo),typeof t.log=="string"&&(r.log=t.log),typeof t._push=="string"&&(r._push=t._push),typeof t._pop=="string"&&(r._pop=t._pop),typeof t.mark=="string"&&(r.mark=t.mark),typeof t.fn=="string"&&(r.fn=t.fn),typeof t.nextEmbedded=="string"&&(r.nextEmbedded=t.nextEmbedded,s.usesEmbedded=!0),r}}else if(Array.isArray(t)){let r=[];for(let n=0,i=t.length;n<i;n++)r[n]=ze(s,e,t[n]);return{group:r}}else if(t.cases){let r=[];for(let i in t.cases)if(t.cases.hasOwnProperty(i)){let a=ze(s,e,t.cases[i]);i==="@default"||i==="@"||i===""?r.push({test:void 0,value:a,name:i}):i==="@eos"?r.push({test:function(o,f,c,l){return l},value:a,name:i}):r.push(sr(s,e,i,a))}let n=s.defaultToken;return{test:function(i,a,o,f){for(let c of r)if(!c.test||c.test(i,a,o,f))return c.value;return n}}}else throw O(s,"an action must be a string, an object with a 'token' or 'cases' attribute, or an array of actions; in rule: "+e)}else return{token:""}}var at=class{constructor(e){this.regex=new RegExp("");this.action={token:""};this.matchOnlyAtLineStart=!1;this.name="";this.name=e,this.stats={time:0,count:0,hits:0}}setRegex(e,t){let r;if(typeof t=="string")r=t;else if(t instanceof RegExp)r=t.source;else throw O(e,"rules must start with a match string or regular expression: "+this.name);r.length==2&&r[0]=="\\"&&/[\{\}\(\)\[\]]/.test(r[1])&&(this.string=r[1]),this.matchOnlyAtLineStart=r.length>0&&r[0]==="^",this.name=this.name+": "+r,this.regex=Ee(e,"^(?:"+(this.matchOnlyAtLineStart?r.substr(1):r)+")")}setAction(e,t){this.action=ze(e,this.name,t)}};function ke(s,e){if(!e||typeof e!="object")throw new Error("Monarch: expecting a language definition object");let t={};t.languageId=s,t.noThrow=!1,t.maxStack=100,t.start=typeof e.start=="string"?e.start:null,t.ignoreCase=st(e.ignoreCase,!1),t.tokenPostfix=it(e.tokenPostfix,"."+t.languageId),t.defaultToken=it(e.defaultToken,"source"),t.usesEmbedded=!1;let r=e;r.languageId=s,r.ignoreCase=t.ignoreCase,r.noThrow=t.noThrow,r.usesEmbedded=t.usesEmbedded,r.stateNames=e.tokenizer,r.defaultToken=t.defaultToken;function n(a,o,f){for(let c of f){let l=c.include;if(l){if(typeof l!="string")throw O(t,"an 'include' attribute must be a string at: "+a);if(l[0]==="@"&&(l=l.substr(1)),!e.tokenizer[l])throw O(t,"include target '"+l+"' is not defined at: "+a);n(a+"."+l,o,e.tokenizer[l])}else{let p=new at(a);if(Array.isArray(c)&&c.length>=1&&c.length<=3)if(p.setRegex(r,c[0]),c.length>=3)if(typeof c[1]=="string")p.setAction(r,{token:c[1],next:c[2]});else if(typeof c[1]=="object"){let u=c[1];u.next=c[2],p.setAction(r,u)}else throw O(t,"a next state as the last element of a rule can only be given if the action is either an object or a string, at: "+a);else p.setAction(r,c[1]);else{if(!c.regex)throw O(t,"a rule must either be an array, or an object with a 'regex' or 'include' field at: "+a);c.name&&typeof c.name=="string"&&(p.name=c.name),c.matchOnlyAtStart&&(p.matchOnlyAtLineStart=st(c.matchOnlyAtLineStart,!1)),p.setRegex(r,c.regex),p.setAction(r,c.action)}o.push(p)}}}if(!e.tokenizer||typeof e.tokenizer!="object")throw O(t,"a language definition must define the 'tokenizer' attribute as an object");t.tokenizer=[];for(let a in e.tokenizer)if(e.tokenizer.hasOwnProperty(a)){t.start||(t.start=a);let o=e.tokenizer[a];t.tokenizer[a]=new Array,n("tokenizer."+a,t.tokenizer[a],o)}if(t.usesEmbedded=r.usesEmbedded,e.brackets){if(!Array.isArray(e.brackets))throw O(t,"the 'brackets' attribute must be defined as an array")}else e.brackets=[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"},{open:"<",close:">",token:"delimiter.angle"}];let i=[];for(let a of e.brackets){let o=a;if(o&&Array.isArray(o)&&o.length===3&&(o={token:o[2],open:o[0],close:o[1]}),o.open===o.close)throw O(t,"open and close brackets in a 'brackets' attribute must be different: "+o.open+`
2 hint: use the 'bracket' attribute if matching on equal brackets is required.`);if(typeof o.open=="string"&&typeof o.token=="string"&&typeof o.close=="string")i.push({token:o.token+t.tokenPostfix,open:J(t,o.open),close:J(t,o.close)});else throw O(t,"every element in the 'brackets' array must be a '{open,close,token}' object or array")}return t.brackets=i,t.noThrow=!0,t}var P=class{constructor(e,t,r){this.offset=e|0,this.type=t,this.language=r,this.kind=0,this.mods=0,this.value=null,this.stack=null}toString(){return this.value||""}get span(){return{offset:this.offset,length:this.value?this.value.length:0}}get indent(){return 0}get startOffset(){return this.offset}get endOffset(){return this.offset+(this.value?this.value.length:0)}clone(){let e=new P(this.offset,this.type,this.language);return e.value=this.value,e.stack=this.stack,e}match(e){if(typeof e=="string")if(e.indexOf(" ")>0)e=e.split(" ");else{let t=this.type.indexOf(e);return e[0]=="."?t>=0:t==0}if(e instanceof Array)for(let t of e){let r=this.type.indexOf(t);if(t[0]=="."?r>=0:r==0)return!0}return e instanceof RegExp?e.test(this.type):!1}},Be=class{constructor(e,t){this.tokens=e,this.endState=t}};var lt=10;function ae(s,e){return s.split(".")[e]}var Le=class{static create(e,t){return this._INSTANCE.create(e,t)}constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}create(e,t){if(e!==null&&e.depth>=this._maxCacheDepth)return new X(e,t);let r=X.getStackElementId(e);r.length>0&&(r+="|"),r+=t;let n=this._entries[r];return n||(n=new X(e,t),this._entries[r]=n,n)}},le=Le;le._INSTANCE=new Le(lt);var X=class{constructor(e,t){this.parent=e,this.state=t,this.depth=(this.parent?this.parent.depth:0)+1}static getStackElementId(e){let t="";for(;e!==null;)t.length>0&&(t+="|"),t+=e.state,e=e.parent;return t}static _equals(e,t){for(;e!==null&&t!==null;){if(e===t)return!0;if(e.state!==t.state)return!1;e=e.parent,t=t.parent}return e===null&&t===null}get indent(){return this.state.lastIndexOf(" ")-this.state.indexOf(" ")}get scope(){return this.part(2)}get detail(){return this.part(2)}part(e){return this.state.split(".")[e]}equals(e){return X._equals(this,e)}push(e){return le.create(this,e)}pop(){return this.parent}popall(){let e=this;for(;e.parent;)e=e.parent;return e}switchTo(e){return le.create(this.parent,e)}},Fe=class{static create(e){return this._INSTANCE.create(e)}constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}create(e){if(e!==null&&e.depth>=this._maxCacheDepth)return new pe(e);let t=X.getStackElementId(e),r=this._entries[t];return r||(r=new pe(e),this._entries[t]=r,r)}},ce=Fe;ce._INSTANCE=new Fe(lt);var pe=class{constructor(e){this.stack=e}clone(){return ce.create(this.stack)}equals(e){return!(!(e instanceof pe)||!this.stack.equals(e.stack))}},ct=class{constructor(){this._tokens=[],this._language=null,this._lastToken=new P(0,"start","imba"),this._lastTokenType=null}enterMode(e,t){this._language=t}emit(e,t,r){this._lastTokenType;let n=new P(e,t,this._language);return this._lastTokenType=t,this._lastToken=n,this._tokens.push(n),n}finalize(e){return new Be(this._tokens,e)}},fe=class{constructor(e,t){this._modeId=e,this._lexer=t,this._profile=!1}dispose(){}getLoadStatus(){return{loaded:!0}}getInitialState(){let e=le.create(null,this._lexer.start);return ce.create(e)}tokenize(e,t,r){let n=new ct,i=this._tokenize(e,t,r,n);return n.finalize(i)}_tokenize(e,t,r,n){return this._myTokenize(e,t,r,n)}_safeRuleName(e){return e?e.name:"(unknown)"}_rescope(e,t,r,n){let i=(e||"").split("-"),a=(t||"").split("-");if(e==t)return;let o=1;for(;i[o]&&i[o]==a[o];)o++;let f=i.length;for(;f>o;)r.push("pop."+i[--f]+"."+f);for(;a.length>o;){let c="push."+a[o++]+"."+(o-1);if(n){let l=ae(n,1);c+="."+l}r.push(c)}}_myTokenize(e,t,r,n){n.enterMode(r,this._modeId);let i=e.length,a=t.stack,o=null,f=0,c=this._profile,l=null,p=!0,u=[],h=0,S=[],v=null,A=-1;for(;p||f<i;){if(h++,h>1e3){if(f==A)throw console.log("infinite recursion",f,i,a,n),"infinite recursion in tokenizer?";A=f,h=0}let _=f,m=a.depth,k=l?l.groups.length:0,w=a.state,b=null,x=null,y=null,E=null;if(l){b=l.matches;let T=l.groups.shift();x=T.matched,y=T.action,E=l.rule,l.groups.length===0&&(l=null)}else{if(!p&&f>=i)break;if(p=!1,S=this._lexer.tokenizer[w],!S&&(S=_e(this._lexer,w),!S))throw O(this._lexer,"tokenizer state is not defined: "+w);let T=e.substr(f);for(let C of S)if(C.string!==void 0){if(T[0]===C.string){b=[C.string],x=C.string,y=C.action;break}}else if(f===0||!C.matchOnlyAtLineStart){if(c){C.stats.count++;let R=performance.now();b=T.match(C.regex),C.stats.time+=performance.now()-R,b&&C.stats.hits++}else b=T.match(C.regex);if(b){x=b[0],y=C.action;break}}}if(b||(b=[""],x=""),y||(f<i&&(b=[e.charAt(f)],x=b[0]),y=this._lexer.defaultToken),x===null)break;for(f+=x.length;Qe(y)&&Ye(y)&&y.test;)y=y.test(x,b,w,f===i);let $=null;if(typeof y=="string"||Array.isArray(y))$=y;else if(y.group)$=y.group;else if(y.token!==null&&y.token!==void 0){if(y.tokenSubst?$=q(this._lexer,y.token,x,b,w):$=y.token,y.goBack&&(f=Math.max(0,f-y.goBack)),y.switchTo&&typeof y.switchTo=="string"){let T=q(this._lexer,y.switchTo,x,b,w);if(T[0]==="@"&&(T=T.substr(1)),_e(this._lexer,T)){let C=a.scope,R=ae(T,2);C!==R&&this._rescope(C,R,u,T),a=a.switchTo(T)}else throw O(this._lexer,"trying to switch to a state '"+T+"' that is undefined in rule: "+this._safeRuleName(E))}else{if(y.transform&&typeof y.transform=="function")throw O(this._lexer,"action.transform not supported");if(y.next)if(y.next==="@push"){if(a.depth>=this._lexer.maxStack)throw O(this._lexer,"maximum tokenizer stack size reached: ["+a.state+","+a.parent.state+",...]");a=a.push(w)}else if(y.next==="@pop"){if(a.depth<=1)throw O(this._lexer,"trying to pop an empty stack in rule: "+this._safeRuleName(E));{let T=a;a=a.pop();let C=ae(T.state,2),R=ae(a.state,2);C!==R&&this._rescope(C,R,u,a.state)}}else if(y.next==="@popall")a=a.popall();else{let T=q(this._lexer,y.next,x,b,w);T[0]==="@"&&(T=T.substr(1));let C=ae(T,2);if(_e(this._lexer,T))C!=a.scope&&this._rescope(a.scope||"",C,u,T),a=a.push(T);else throw O(this._lexer,"trying to set a next state '"+T+"' that is undefined in rule: "+this._safeRuleName(E))}}y.log&&typeof y.log=="string"&&tt(this._lexer,this._lexer.languageId+": "+q(this._lexer,y.log,x,b,w)),y.mark&&n.emit(_+r,y.mark,a)}if($===null)throw O(this._lexer,"lexer rule has no well-defined action in rule: "+this._safeRuleName(E));if(Array.isArray($)){if(l&&l.groups.length>0)throw O(this._lexer,"groups cannot be nested: "+this._safeRuleName(E));if(b.length!==$.length+1)throw O(this._lexer,"matched number of groups does not match the number of actions in rule: "+this._safeRuleName(E));let T=0;for(let C=1;C<b.length;C++)T+=b[C].length;if(T!==x.length)throw O(this._lexer,"with groups, all characters should be matched in consecutive groups in rule: "+this._safeRuleName(E));l={rule:E,matches:b,groups:[]};for(let C=0;C<$.length;C++)l.groups[C]={action:$[C],matched:b[C+1]};f-=x.length;continue}else{if($==="@rematch"&&(f-=x.length,x="",b=null,$=""),x.length===0)if(i===0||m!==a.depth||w!==a.state||(l?l.groups.length:0)!==k){for(typeof $=="string"&&$&&n.emit(f+r,$,a);u.length>0;)n.emit(f+r,u.shift(),a);continue}else throw O(this._lexer,"no progress in tokenizer in rule: "+this._safeRuleName(E));let T=null;if(Ae($)&&$.indexOf("@brackets")===0){let R=$.substr("@brackets".length),B=ir(this._lexer,x);if(!B)throw O(this._lexer,"@brackets token returned but no bracket defined as: "+x);T=Oe(B.token+R)}else{let R=$===""?"":$+this._lexer.tokenPostfix;T=Oe(R)}let C=n.emit(_+r,T,a);for(C.stack=a,o&&o!=C&&(o.value=e.slice(o.offset-r,_)),o=C;u.length>0;)n.emit(f+r,u.shift(),a)}}return o&&!o.value&&(o.value=e.slice(o.offset-r)),ce.create(a)}};function ir(s,e){if(!e)return null;e=J(s,e);let t=s.brackets;for(let r of t){if(r.open===e)return{token:r.token,bracketType:H.Open};if(r.close===e)return{token:r.token,bracketType:H.Close}}return null}function or(s){let e;return s?(e=s.toIterable)?e.call(s):s:[]}var pt=Symbol.for("#__init__"),Rr=Symbol.for("#__initor__"),jr=Symbol.for("#__inited__"),ue=class{constructor(e=null){this[pt](e)}[pt](e=null){this.offset=e?e.offset:void 0,this.text=e?e.text:void 0,this.tokens=e?e.tokens:void 0,this.startState=e?e.startState:void 0,this.endState=e?e.endState:void 0}clone(e=this.offset){let t=[],r=e-this.offset;for(let n=0,i=or(this.tokens),a=i.length;n<a;n++){let o=i[n],f=o.clone();f.offset=o.offset+r,t.push(f)}return new ue({offset:e,startState:this.startState,endState:this.endState,text:this.text,tokens:t})}},ar=ke("imba",oe),W=new fe("imba",ar);function ft(s){let e;return s?(e=s.toIterable)?e.call(s):s:[]}var Q=["comment","string","keyword","number","regexp","operator","namespace","type","struct","class","interface","enum","typeParameter","function","member","macro","variable","parameter","property","label"];for(let s=0,e=ft(Q),t=e.length;s<t;s++){let r=e[s];Q[r]=s}var z={Declaration:1<<0,Import:1<<1,Export:1<<2,Global:1<<3,ReadOnly:1<<4,Static:1<<5,Modification:1<<6,Deprecated:1<<7,Access:1<<8,Root:1<<9,Special:1<<10,Class:1<<11,Member:1<<12,Function:1<<13,Def:1<<14,Var:1<<15,Let:1<<16,Const:1<<17,Get:1<<18,Set:1<<19},Ne=Object.keys(z).map(function(s){return s.toLowerCase()});for(let s=0,e=ft(Object.keys(z)),t=e.length;s<t;s++){let r=e[s];z[r.toLowerCase()]=z[r]}var N={Keyword:1<<0,Access:1<<1,Key:1<<2,TagName:1<<3,TagEvent:1<<4,TagFlag:1<<5,TagProp:1<<6,TagEventModifier:1<<7,Value:1<<8,Path:1<<9,StyleProp:1<<10,StyleValue:1<<11,Type:1<<12,StyleModifier:1<<13,StyleSelector:1<<14,VarName:1<<15,ImportName:1<<16},g={Keyword:1<<0,Root:1<<1,Class:1<<2,Block:1<<3},ee={and:g.Block,await:g.Block,begin:g.Block,break:g.Block,by:g.Block,case:g.Block,catch:g.Block,class:g.Block,const:g.Block,continue:g.Block,css:g.Class|g.Root,debugger:g.Block,def:g.Class|g.Block,get:g.Class,set:g.Class,delete:g.Block,do:g.Block,elif:g.Block,else:g.Block,export:g.Root,extends:g.Block,false:g.Block,finally:g.Block,for:g.Block,if:g.Block,import:g.Root,in:g.Block,instanceof:g.Block,is:g.Block,isa:g.Block,isnt:g.Block,let:g.Block,loop:g.Block,module:g.Block,nil:g.Block,no:g.Block,not:g.Block,null:g.Block,of:g.Block,or:g.Block,require:g.Block,return:g.Block,self:g.Block,static:g.Block|g.Class,super:g.Block,switch:g.Block,tag:g.Root,then:g.Block,this:g.Block,throw:g.Block,true:g.Block,try:g.Block,typeof:g.Block,undefined:g.Block,unless:g.Block,until:g.Block,var:g.Block,when:g.Block,while:g.Block,yes:g.Block},L={File:1,Module:2,Namespace:3,Package:4,Class:5,Method:6,Property:7,Field:8,Constructor:9,Enum:10,Interface:11,Function:12,Variable:13,Constant:14,String:15,Number:16,Boolean:17,Array:18,Object:19,Key:20,Null:21,EnumMember:22,Struct:23,Event:24,Operator:25,TypeParameter:26};for(let s=0,e=Object.keys(L),t=e.length,r,n;s<t;s++)r=e[s],n=L[r],L[n]=r;function lr(s){let e;return s?(e=s.toIterable)?e.call(s):s:[]}var ut=Symbol.for("#__init__"),Hr=Symbol.for("#__initor__"),Wr=Symbol.for("#__inited__"),be=Symbol.for("#datatype"),d={None:0,ConstVariable:1<<0,LetVariable:1<<1,Property:1<<2,EnumMember:1<<3,Function:1<<4,Class:1<<5,LocalComponent:1<<6,GlobalComponent:1<<7,RegularEnum:1<<8,ValueModule:1<<9,Parameter:1<<10,TypeLiteral:1<<11,ObjectLiteral:1<<12,Method:1<<13,Constructor:1<<14,GetAccessor:1<<15,SetAccessor:1<<16,Signature:1<<17,TypeParameter:1<<18,TypeAlias:1<<19,ExportValue:1<<20,Alias:1<<21,Prototype:1<<22,ExportStar:1<<23,Optional:1<<24,IsSpecial:1<<27,IsImport:1<<28,IsStatic:1<<29,IsGlobal:1<<30,IsRoot:1<<31};d.Component=d.LocalComponent|d.GlobalComponent;d.Variable=d.LetVariable|d.ConstVariable|d.Parameter;d.Accessor=d.GetAccessor|d.SetAccessor;d.ClassMember=d.Method|d.Accessor|d.Property;d.Scoped=d.Function|d.Variable|d.Class|d.Enum|d.LocalComponent;d.Type=d.Component|d.Class;d.GlobalVar=d.ConstVariable|d.IsGlobal;d.SpecialVar=d.ConstVariable|d.IsSpecial;var ht=[["entity.name.component.local",0,d.LocalComponent],["entity.name.component.global",0,d.GlobalComponent],["entity.name.function",0,d.Function],["entity.name.class",0,d.Class],["entity.name.constructor",0,d.Method],["entity.name.def",0,d.Method],["entity.name.get",0,d.GetAccessor],["entity.name.set",0,d.SetAccessor],["field",0,d.Property],["decl-let",0,d.LetVariable],["decl-for-index",0,d.LetVariable,{datatype:"\\number"}],["decl-for",0,d.LetVariable,{kind:"for"}],["decl-var",0,d.LetVariable],["decl-param",0,d.Parameter],["decl-const",0,d.ConstVariable],["decl-import",0,d.ConstVariable|d.IsImport]],Pe={},K=class{[ut](e=null){var t;this.value=e?e.value:void 0,this.body=e&&(t=e.body)!==void 0?t:null}static typeMatch(e){if(Pe[e]!=null)return Pe[e];for(let t=0,r=lr(ht),n=r.length;t<n;t++){let[i,a,o,f]=r[t];if(e.indexOf(i)>=0)return Pe[e]=ht[t]}return null}static forToken(e,t,r=0){let n=this.typeMatch(t);return n?new this(n[2],e.value,e,n[3]):null}constructor(e,t,r,n=null){this[ut](),this.flags=e,this.name=t,this.node=r,this.desc=n}get importSource(){return this.importedΦ?this.node.context.closest("imports").sourcePath:null}get exportName(){return this.node.prev.match("keyword.as")?this.node.prev.prev.value:this.node.match(".default")?"default":this.node.value}get importInfo(){if(!this.importedΦ)return null;let e=this.node.context.closest("imports");return{exportName:this.exportName,name:this.node.value,isTypeOnly:e.isTypeOnly,path:e.sourcePath}}get datatype(){var i;let e,t=this.desc&&this.desc.datatype;if(t)return t;if(this[be])return this[be];let r=this.node&&this.node.nextNode;if(r&&r.type=="type")return r;let n=this.scope;if(n&&((i=this.desc)==null?void 0:i.kind)=="for"){let a=n.doc.getDestructuredPath(this.node,[[n.expression,"__@iterable"]]);return this[be]||(this[be]=a)}return(e=this.importInfo)?e:null}get staticΦ(){return this.node&&this.node.mods&z.Static}get itervarΦ(){return this.node&&this.node.match(".decl-for")}get variableΦ(){return this.flags&d.Variable}get parameterΦ(){return this.flags&d.Parameter}get memberΦ(){return this.flags&d.ClassMember}get scopedΦ(){return this.flags&d.Scoped}get typeΦ(){return this.flags&d.Type}get globalΦ(){return this.flags&d.IsGlobal}get importedΦ(){return this.flags&d.IsImport}get componentΦ(){return this.flags&d.Component}get escapedName(){return this.name}get scope(){var e,t;return(t=(e=this.node)==null?void 0:e.context)==null?void 0:t.scope}addReference(e){return this.references||(this.references=[]),this.references.push(e),e.symbol=this,this}dereference(e){let t=this.references.indexOf(e);return t>=0&&(e.symbol=null,this.references.splice(t,1)),this}get kind(){return this.variableΦ?L.Variable:this.flags&d.Class?L.Class:this.flags&d.Component?L.Class:this.flags&d.Property?L.Field:this.flags&d.Method?this.escapedName=="constructor"?L.Constructor:L.Method:this.flags&d.Function?L.Function:L.Method}get semanticKind(){return this.flags&d.Parameter?"parameter":this.variableΦ?"variable":this.typeΦ?"type":this.flags&d.Function?"function":this.memberΦ?"member":this.componentΦ?"component":"variable"}get semanticFlags(){let e=0;return this.flags&d.ConstVariable&&(e|=z.ReadOnly),this.staticΦ&&(e|=z.Static),this.flags&d.IsImport&&(e|=z.Import),this.flags&d.IsGlobal&&(e|=z.Global),this.flags&d.IsRoot&&(e|=z.Root),this.flags&d.IsSpecial&&(e|=z.Special),e}};function cr(s){let e;return s?(e=s.toIterable)?e.call(s):s:[]}var U=Symbol.for("#__init__"),te=Symbol.for("#__initor__"),re=Symbol.for("#__inited__"),mt=Symbol(),dt=Symbol(),gt=Symbol(),yt={global:{datatype:"globalThis"},imba:{datatype:"globalThis.imba"},module:{},window:{datatype:"globalThis.window"},document:{datatype:"globalThis.document"},exports:{},console:{datatype:"globalThis.console"},process:{datatype:"globalThis.process"},parseInt:{datatype:"globalThis.parseInt"},parseFloat:{datatype:"globalThis.parseFloat"},setTimeout:{datatype:"globalThis.setTimeout"},setInterval:{datatype:"globalThis.setInterval"},setImmediate:{datatype:"globalThis.setImmediate"},clearTimeout:{datatype:"globalThis.clearTimeout"},clearInterval:{datatype:"globalThis.clearInterval"},clearImmediate:{datatype:"globalThis.clearImmediate"},globalThis:{datatype:"globalThis"},isNaN:{datatype:"globalThis.isNaN"},isFinite:{datatype:"globalThis.isFinite"},__dirname:{datatype:"\\string"},__filename:{datatype:"\\string"},__realname:{datatype:"\\string"}},ne=class{[U](e=null){var t;this.type=e&&(t=e.type)!==void 0?t:"",this.start=e?e.start:void 0,this.end=e?e.end:void 0,this.parent=e?e.parent:void 0}static build(e,t,r,n,i){return new this(e,t,r,n,i)}constructor(e,t,r,n){this[U](),this.doc=e,this.start=t,this.end=null,this.type=n,this.parent=r,this.$name=null,t.scope=this}pop(e){return this.end=e,e.start=this.start,e.pops=this,this.start.end=e,this.visit(),this.parent}find(e){return this.findChildren(e,!0)[0]}get childNodes(){return this.doc.getNodesInScope(this)}findChildren(e,t=!1){let r=[],n=this.start;for(;n;){if(t&&r.length)return r;if(n.scope&&n.scope!=this){n.scope.match(e)&&r.push(n.scope),n=n.scope.next;continue}if(n.match(e)&&r.push(n),n==this.end)break;n=n.next}return r}closest(e){return this.match(e)?this:this.parent?this.parent.closest(e):null}visit(){return this}get memberΦ(){return!1}get topΦ(){return!1}get selfScope(){return this.memberΦ||this.topΦ?this:this.parent.selfScope}get name(){return this.$name||""}get value(){return this.doc.content.slice(this.start.offset,this.next?this.next.offset:-1)}get next(){return this.end?this.end.next:null}get prev(){return this.start?this.start.prev:null}match(e){return typeof e=="string"?this.type==e:e instanceof RegExp?e.test(this.type):e instanceof Function?e(this):!0}},M=class extends ne{static[U](){return this.prototype[te]=mt,this}constructor(e,t,r,n,i=[]){super(e,t,r,n);this[te]===mt&&this[re]&&this[re]()}get scope(){return this.parent.scope}get varmap(){return this.parent.varmap}register(e){return this.parent.register(e)}lookup(...e){return this.parent.lookup(...e)}};M[U]();var _t=class extends M{},kt=class extends M{},bt=class extends M{get properties(){return this.findChildren("styleprop")}},xt=class extends M{},j=class extends ne{static[U](){return this.prototype[te]=dt,this}constructor(e,t,r,n,i=[]){super(e,t,r,n);if(this.children=[],this.entities=[],this.refs=[],this.varmap=Object.create(r?r.varmap:{}),this instanceof se)for(let a=0,o=Object.keys(yt),f=o.length,c,l;a<f;a++){c=o[a],l=yt[c];let p={value:c,offset:-1,mods:0};this.varmap[c]=new K(d.GlobalVar,c,p,l)}return this.indent=i[3]&&i[3][0]==" "?i[3].length:0,this.setup(),this;this[te]===dt&&this[re]&&this[re]()}setup(){if(this.handlerΦ&&(this.varmap.e=new K(d.SpecialVar,"e",null,"eventReference")),(this.classΦ||this.propertyΦ)&&(this.ident=this.token=de(this.start,"entity."),this.ident&&(this.ident.body=this),this.ident&&this.ident.type=="entity.name.def.render"&&(this.$name="render",this.ident.symbol)))return this.ident.symbol.name="render"}get selfPath(){let e=this.path;return this.propertyΦ?e.slice(0,e.lastIndexOf(".")):e}get path(){let e=this.parent?this.parent.path:"";if(this.propertyΦ){let t=this.staticΦ?".":".prototype.";return this.parent?""+this.parent.path+t+this.name:this.name}return this.componentΦ?this.name[0]==this.name[0].toLowerCase()?this.name.replace(/\-/g,"_")+"$$TAG$$":this.name:this.classΦ?this.name:e}get allowedKeywordTypes(){return this.classΦ?g.Class:this.rootΦ?g.Root|g.Block:g.Block}get componentΦ(){return!!this.type.match(/^component/)}get rootΦ(){return this instanceof se}get topΦ(){return this instanceof se}get classΦ(){return!!this.type.match(/^class/)||this.componentΦ}get defΦ(){return!!this.type.match(/def|get|set/)}get staticΦ(){return!!(this.ident&&this.ident.mods&z.Static)}get handlerΦ(){return!!this.type.match(/handler|spy/)}get memberΦ(){return!!this.type.match(/def|get|set/)}get propertyΦ(){return!!this.type.match(/def|get|set|field/)}get flowΦ(){return!!this.type.match(/if|else|elif|unless|for|while|until/)}get closureΦ(){return!!this.type.match(/class|component|def|get|set|do/)}get scope(){return this}get name(){return this.$name||(this.ident?this.ident.value:"")}visit(){return this}register(e){return e.scopedΦ&&(this.varmap[e.name]=e,this.rootΦ&&(e.flags|=d.IsRoot)),e}lookup(e,t=d.Scoped){let r,n=e.value;return n[n.length-1]=="!"&&(n=n.slice(0,-1)),(r=this.varmap[n])?r:null}toOutline(){return{kind:this.type,name:this.name,children:[],span:this.ident?this.ident.span:this.start.span}}};j[U]();var se=class extends j{};var wt=class extends j{get expression(){return this.find("keyword.in keyword.of").next.next}get forvars(){return Object.values(this.varmap).filter(function(e){return e.itervarΦ})}},vt=class extends j{register(e){return this.parent.register(e)}lookup(...e){return this.parent.lookup(...e)}},St=class extends j{get selfScope(){return this}},Tt=class extends M{},Ct=class extends M{get propertyName(){var e;return this.start.next.match("style.property.name")?this.start.next.value:(e=this.parent.prevProperty)==null?void 0:e.propertyName}get modifier(){if(this.start.next.match("style.property.modifier"))return this.start.next.value}get styleValue(){return!0}},$t=class extends M{get key(){return this.parent.key}get propertyName(){return this.parent.propertyName}get modifier(){return this.parent.modifier}},It=class extends M{get key(){return this.find("stylepropkey")}get prevProperty(){return this.start.prev.pops?this.start.prev.pops:null}get propertyName(){var e;return(e=this.key)==null?void 0:e.propertyName}get modifier(){var e;return(e=this.key)==null?void 0:e.modifier}},At=class extends M{},Ot=class extends M{get innerText(){return this.value.slice(1,-1)}},Mt=class extends M{get name(){let e=this.findChildren("tag.name").join("");return e=="self"?this.closest("component").name:e}get localΦ(){return this.name[0]==this.name[0].toUpperCase()}get tagName(){return this.name}get parentTag(){var e;return(e=this.closest("tagcontent"))==null?void 0:e.ownerTag}get ancestorTags(){var e;return(e=this.closest("tagcontent"))==null?void 0:e.ownerTags}get ancestorPath(){return this.ancestorTags.map(function(e){return e.tagName}).join(".")}get pathName(){return"<"+this.name+">"}get outline(){return this.findChildren(/tag\.(reference|name|id|white|flag|event(?!\-))/).join("")}},Et=class extends M{get propertyName(){return this.start.next.match("tag.attr")?this.start.next.value:""}get tagName(){return this.parent.name}},zt=class extends M{get propertyName(){return this.parent.propertyName}get tagName(){return this.parent.tagName}},Bt=class extends vt{get ownerTag(){return this.start.prev.pops}get ownerTags(){let e=[this.ownerTag],t;for(;t=e[0].parentTag;)e.unshift(t);return e}},Lt=class extends M{get name(){return this.findChildren("tag.event.name").join("").replace("@","")}},Re=class extends M{},he=class extends M{static build(e,t,r,n,i){let a=this,o=e.content[t.offset-1];return!o||` [{(|=&-;
3 :/*%+-`.indexOf(o)>=0?(n="array",a=Ft):(n="index",a=Nt),new a(e,t,r,n,i)}},xe=class extends M{},Pt=class extends xe{},Ft=class extends he{get delimiters(){return this.childNodes.filter(function(e){return e.match("delimiter")})}indexOfNode(e){var t;let r=this.delimiters,n=0;t=0;for(let i of cr(r)){let a=t++;e.offset>i.offset&&n++}return n}},Nt=class extends he{},je=class extends M{static[U](){return this.prototype[te]=gt,this}constructor(){super(...arguments);this.prev.datatype=this,this[te]===gt&&this[re]&&this[re]()}toString(){return this.value}};je[U]();var Rt=class extends M{},jt=class extends xe{},Vt=class extends M{get isTypeOnly(){return this.start.prev.match("keyword.type")}get sourcePath(){let e=this.childNodes.find(function(t){return t.match("path")});return e==null?void 0:e.innerText}get specifiers(){return this.childNodes.find(function(e){return e.match("specifiers")})}get default(){return this.childNodes.find(function(e){return e.match(".default")})}get namespace(){return this.childNodes.find(function(e){return e.match(".ns")})}},D={style:bt,array:he,stylerule:xt,sel:Tt,path:Ot,value:_t,tag:Mt,forscope:wt,field:St,type:je,parens:Re,brackets:he,object:jt,braces:xe,specifiers:Pt,string:kt,tagattr:Et,imports:Vt,interpolation:Rt,tagattrvalue:zt,tagcontent:Bt,listener:Lt,styleinterpolation:At,styleprop:It,stylepropkey:Ct,stylevalue:$t,args:Re};function pr(s,e){let t=Object.getOwnPropertyDescriptors(e);return delete t.constructor,Object.defineProperties(s,t),s}function F(s){let e;return s?(e=s.toIterable)?e.call(s):s:[]}var mn=Symbol.for("#__initor__"),dn=Symbol.for("#__inited__"),Ve=Symbol.for("#ins"),Ke=Symbol.for("#del"),Kt=Symbol.for("#version"),qt=Symbol.for("#multiline"),Dt=Symbol.for("#significant"),qe=Symbol.for("#body"),Y=Symbol.for("#lexed"),Gt=class{get node(){return this.scope&&this.scope.start==this?this.scope:this.pops?this.pops:this}get nextNode(){var e;return(e=this.next)==null?void 0:e.node}get prevNode(){var e;return(e=this.prev)==null?void 0:e.node}};pr(P.prototype,Gt.prototype);var ie=class{static tmp(e){return new this("file://temporary.imba","imba",0,e)}static from(e,t,r,n){return new this(e,t,r,n)}constructor(e,t,r,n){this.uri=e,this.languageId=t,this.version=r,this.content=n,this.connection=null,this.lineTokens=[],this.isLegacy=t=="imba1"||e&&e.match(/\.imba1$/),this.head=this.seed=new P(0,"eol","imba"),this.initialState=W.getInitialState(),this.seed.stack=W.getInitialState(),this.history=[],this.lexer=W,this.versionToHistoryMap={},this.versionToHistoryMap[r]=-1,n&&n.match(/^\#[^\n]+imba1/m)&&(this.isLegacy=!0)}log(...e){return console.log(...e)}get lineCount(){return this.lineOffsets.length}get lineOffsets(){return this._lineOffsets||(this._lineOffsets=Se(this.content,!0))}getText(e=null){if(e){let t=this.offsetAt(e.start),r=this.offsetAt(e.end);return this.content.substring(t,r)}return this.content}getLineText(e){let t=this.lineOffsets[e],r=this.lineOffsets[e+1];return this.content.substring(t,r).replace(/[\r\n]/g,"")}positionAt(e){if(e instanceof Z)return e;typeof e=="object"&&(e=e.offset),e=Math.max(Math.min(e,this.content.length),0);let t=this.lineOffsets,r=0,n=t.length;if(n===0)return new Z(0,e,e,this.version);for(;r<n;){let a=Math.floor((r+n)/2);t[a]>e?n=a:r=a+1}let i=r-1;return new Z(i,e-t[i],e,this.version)}offsetAt(e){if(e.offset)return e.offset;let t=this.lineOffsets;if(e.line>=t.length)return this.content.length;if(e.line<0)return 0;let r=t[e.line],n=e.line+1<t.length?t[e.line+1]:this.content.length;return e.offset=Math.max(Math.min(r+e.character,n),r)}rangeAt(e,t=e){return new V(this.positionAt(e),this.positionAt(t))}overwrite(e,t){return this.version=t||this.version+1,this.content=e,this._lineOffsets=null,this.invalidateFromLine(0),this}update(e,t){t==null&&(t=this.version+1);let r=[],n=!1;r[Ve]="",r[Ke]="";for(let o=0,f=F(e),c=f.length;o<c;o++){let l=f[o];if(We(l)){this.overwrite(l.text,t),r.push([0,this.content.length,l.text]),n=!0;continue}let p=He(l.range),u=this.offsetAt(p.start),h=this.offsetAt(p.end);l.range=p,l.offset=u,l.length=h-u,p.start.offset=u,p.end.offset=h;let v=h-u?this.content.slice(u,h):"";r[Ke]+=v,r[Ve]+=l.text||"",this.applyEdit(l,t,e),r.push([u,h-u,l.text||"",v]);let A=Math.max(p.start.line,0),_=Math.max(p.end.line,0),m=this.lineOffsets,k=Se(l.text,!1,u);if(_-A===k.length)for(let b=0,x=F(k),y=x.length;b<y;b++){let E=x[b];m[b+A+1]=k[o]}else k.length<1e4?m.splice.apply(m,[A+1,_-A].concat(k)):this._lineOffsets=m=m.slice(0,A+1).concat(k,m.slice(_+1));let w=l.text.length-(h-u);if(w!==0){let b=A+1+k.length;for(;b<m.length;)m[b]=m[b]+w,b++}}this.history.push(r),r[Kt]=t;let i=this.history[this.history.length-2];return(r[Ve]+r[Ke]).indexOf(`
4`)>=0&&(r[qt]=!0,i&&!i[qt]&&(r[Dt]=!0,r[qe]=this.content)),this.versionToHistoryMap[t]=this.history.length-1,this.updated(e,t)}get lastSignificantVersion(){let e=this.history.length;for(;e>0;){let t=this.history[--e];if(t&&t[Dt])return t[Kt]}return null}editsSinceVersion(e){let t=this.versionToHistoryMap[e],r=[];for(let n=0,i=F(this.history.slice(t+1)),a=i.length;n<a;n++){let o=i[n];r.push(...o)}return r}contentAtVersion(e){let t=this.versionToHistoryMap[e],r=this.history[t];return r[qe]!=null?r[qe]:null}offsetAtVersion(e,t,r=this.version,n=!1){let i=this.versionToHistoryMap[t],a=this.versionToHistoryMap[r],o=e,f=!1;if(i<a)for(;i<a;){let c=this.history[++i];for(let l=0,p=F(c),u=p.length;l<u;l++){let[h,S,v]=p[l];h>o||(n&&(h-=1),o>h&&o>h+S&&(o+=v.length-S))}}else if(a<i)for(;a<i;){let c=this.history[i--];for(let l=0,p=F(c),u=p.length;l<u;l++){let[h,S,v]=p[l];h>o||o>h&&o>h+S&&(o-=v.length-S)}}return o}historicalOffset(e,t){return this.offsetAtVersion(e,this.version,t,!0)}applyEdit(e,t,r){this.content=this.content.substring(0,e.range.start.offset)+e.text+this.content.substring(e.range.end.offset,this.content.length);let n=e.range.start.line;this.invalidateFromLine(n)}updated(e,t){return this.version=t,this}invalidateFromLine(e){return this.head=this.seed,this}after(e,t){let r=this.tokens.indexOf(e);if(t){for(;r<this.tokens.length;){let n=this.tokens[++r];if(n&&this.matchToken(n,t))return n}return null}return this.tokens[r+1]}matchToken(e,t){return t instanceof RegExp?e.type.match(t):typeof t=="string"?e.type==t:!1}before(e,t,r=0){let n=this.tokens.indexOf(e)+r;if(t){for(;n>0;){let i=this.tokens[--n];if(this.matchToken(i,t))return i}return null}return this.tokens[n-1]}getTokenRange(e){return{start:this.positionAt(e.offset),end:this.positionAt(e.offset+e.value.length)}}getTokensInScope(e){let t=this.tokens.indexOf(e.start),r=e.end?this.tokens.indexOf(e.end):this.tokens.length,n=t,i=[];for(;n<r;){let a=this.tokens[n++];a.scope&&a.scope!=e?(i.push(a.scope),n=a.scope.endIndex+1):i.push(a)}return i}getSymbols(){var e;return this.astify(),(e=this[Y]).symbols||(e.symbols=this.tokens.map(function(t){return t.symbol}).filter(function(t){return t}).filter(function(t,r,n){return n.indexOf(t)==r}))}getImportedSymbols(){return this.getSymbols().filter(function(e){return e.importedΦ})}getImportNodes(){return this.tokens.filter(function(t){return t.match("push._imports")}).map(function(t){return t.scope})}getNodesInScope(e,t=!1){let r=e.start,n=e.end;t?n=n.next:r=r.next;let i=[];for(;r&&r!=n;){if(r.scope&&r.scope!=e){i.push(r.scope),r=r.scope.end.next;continue}else r.type!="white"&&i.push(r);r=r.next}return i}getTokenAtOffset(e,t=!1){return this.tokenAtOffset(e)}getSemanticTokens(e=d.Scoped){let t=this.parse(),r=[];for(let n=0,i=F(t),a=i.length;n<a;n++){let o=i[n],f=o.symbol;if(!(f&&(!e||f.flags&e)))continue;let c=Q[f.semanticKind],l=o.mods|f.semanticFlags;r.push([o.offset,o.value.length,c,l])}return r}getEncodedSemanticTokens(){let e=this.getSemanticTokens(),t=[],r=0,n=0;for(let i=0,a=F(e),o=a.length;i<o;i++){let f=a[i],c=this.positionAt(f[0]),l=c.line-r,p=l?c.character:c.character-n;t.push(l,p,f[1],f[2],f[3]),r=c.line,n=c.character}return t}getDestructuredPath(e,t=[],r=null){if(e.context.type=="array")return this.getDestructuredPath(e.context.start,t,r),t.push(e.context.indexOfNode(e)),t;let n=e.value;return e.prev.match("operator.assign.key-value")&&(n=e.prev.prev.value),e.context.type=="object"&&(this.getDestructuredPath(e.context.start,t,r),t.push(n)),t}tokenAtOffset(e){let t=this.tokens[0];for(;t;){let r=t.next;if(t.offset>=e)return t.prev;if(t.end&&t.end.offset<e)t=t.end;else if(r)t=r;else return t}return t}patternAtOffset(e,t=/[\w\-\.\%]/){let r=e,n=e,i=this.content;for(;r>0&&t.test(this.content[r-1]);)r--;for(;t.test(this.content[n+1]||"");)n++;return[i.slice(r,n+1),r,n]}adjustmentAtOffset(e,t=1){let[r,n,i]=this.patternAtOffset(e),[a,o=""]=r.split(/[\d\.]+/),f=parseFloat(r.slice(a.length).slice(0,o.length?-o.length:1e3));return Number.isNaN(f)?null:(f+=t,[n+a.length,r.length-a.length-o.length,String(f)])}contextAtOffset(e){var t;this.ensureParsed();let r=this.positionAt(e),n=this.tokenAtOffset(e),i=this.lineOffsets[r.line],a=e-n.offset,o=n.context,f={character:this.content[e-1],line:this.content.slice(i,e),token:n.value.slice(0,a)},c={character:this.content[e],token:n.value.slice(a),line:this.content.slice(e,this.lineOffsets[r.line+1]).replace(/[\r\n]+/,"")};n.scope&&!c.token&&(o=n.scope),n.next&&n.next.value==null&&n.next.scope&&!c.token&&n.match("operator.assign")&&(o=n.next.scope);let l=de(n,"white.tabs"),p=l?l.value.length:0,u=o,h=o.scope,S={},v=n,A=n.stack.state||"",_=N;u&&(u.start&&(f.group=this.content.slice(u.start.offset,e)),u.end&&(c.group=this.content.slice(e,u.end.offset)));let m={keywords:[]},k=0;if(n==l&&(p=a),n.match("br white.tabs"))for(;h.indent>p;)h=h.parent;if(u.type=="tag",n.match("entity string regexp comment style.")&&(k=0),n.match("tag.event.name tag.event-modifier.name")&&(v=n.prev),(n.type=="path"||n.type=="path.open")&&(k|=N.Path,m.paths=1),n.match("identifier tag.operator.equals br white delimiter array operator ( self")&&(k|=N.Value,v=null),n.match("operator.access")&&(k|=N.Access,v=n),n.match("accessor")&&(k|=N.Access,v=n.prev),n.match("delimiter.type.prefix type")&&(k|=N.Type),n.match("tag.name tag.open")?k|=N.TagName:n.match("tag.attr tag.white")?k|=N.TagProp:n.match("tag.flag")?k|=N.TagFlag:n.match("tag.event.modifier")?k|=N.TagEventModifier:n.match("tag.event")?k|=N.TagEvent:n.match("operator.equals.tagop")&&(k|=N.Value),n.match("style.property.operator")||u.closest("stylevalue")){k|=_.StyleValue;try{m.styleProperty=u.closest("styleprop").propertyName}catch(x){}}n.match("style.open style.property.name")&&(k|=_.StyleProp),(n.match("style.value.white")||n.prev&&n.prev.match("style.value.white"))&&(k|=_.StyleProp),n.match("style.selector.element")&&c.line.match(/^\s*$/)&&(k|=_.StyleProp),h.closest("rule")&&(k|=_.StyleProp,k&=~_.Value),n.match("style.property.operator")&&(k&=~_.StyleProp),u.match("stylevalue")&&f.group.indexOf(" ")==-1&&(k=_.StyleValue),n.match("style.selector.modifier style.property.modifier")&&(k=_.StyleModifier),n.match("style.selector.element")&&(k|=_.StyleSelector),h.closest("rule")&&f.line.match(/^\s*$/)&&(k|=_.StyleSelector,k&=~_.StyleValue),n.match("operator.access accessor white.classname white.tagname")&&(k&=~_.Value),u.closest("imports")&&(k&=~_.Value,k|=_.ImportName),(A.match(/\.decl-(let|var|const|param|for)/)||n.match(/\.decl-(for|let|var|const|param)/))&&(k&=~_.Value,k|=_.VarName);let w=h.allowedKeywordTypes;t=[];for(let x=0,y=Object.keys(ee),E=y.length,$,T;x<E;x++)$=y[x],T=ee[$],!!(T&w)&&t.push($);m.keywords=t,m.flags=k;for(let x=0,y=Object.keys(_),E=y.length,$,T;x<E;x++)$=y[x],T=_[$],k&T&&(m[$]||(m[$]=!0));return{token:n,offset:e,position:r,linePos:i,scope:h,indent:p,group:o,mode:"",target:v,path:h.path,suggest:m,before:f,after:c}}textBefore(e){let t=this.content.slice(0,e),r=t.lastIndexOf(`
5`);return t.slice(r+1)}varsAtOffset(e,t=!1){let r=this.tokenAtOffset(e),n=[],i=r.context.scope,a={};for(;i;){for(let o=0,f=F(Object.values(i.varmap)),c=f.length;o<c;o++){let l=f[o];l.globalΦ&&!t||a[l.name]||(!l.node||l.node.offset<e)&&(n.push(l),a[l.name]=l)}i=i.parent}return n}getOutline(e=null){var t,r,n,i;if(this.isLegacy){let _=Ue(this.content);for(let m=0,k=F(_.all),w=k.length;m<w;m++){let b=k[m];t=b.parent,delete b.parent,b.path=b.name,b.name=b.ownName,e&&e(b,_.all)}return _}this.ensureParsed();let a=Date.now(),o=[],f={children:[]},c=f,l=null,p={},u=new Set,h=null;function S(_,m){return _ instanceof K&&(u.add(_),_={name:_.name,kind:_.kind}),p=_,_.token=m,_.children||(_.children=[]),_.span||(_.span=m.span),_.name||(_.name=m.value),o.push(_),c.children.push(_)}function v(_){return p.children||(p.children=[]),p.parent||(p.parent=c),c=p,c.end=_}function A(_){return c=c.parent}for(let _=0,m=F(this.tokens),k=m.length;_<k;_++){let w=m[_],b=w.symbol,x=w.scope;if(w.type=="key")S({kind:L.Key},w);else if(b){if(b.parameterΦ)continue;u.has(b)||S(b,w),b.body&&(h=b.body.start)}else if(x&&x.type=="do"){let y=this.textBefore(w.offset-3).replace(/^\s*(return\s*)?/,"");y+=" callback",S({kind:L.Function,name:y},w.prev),h=w}else x&&x.type=="tag"&&S({kind:L.Field,name:x.outline},w);w==h&&v(w.end),w==c.end&&A()}for(let _=0,m=F(o),k=m.length;_<k;_++){let w=m[_];if(w.span){let b=w.span.length;w.span.start=this.positionAt(w.span.offset),w.span.end=b?this.positionAt(w.span.offset+b):w.span.start}e&&e(w,o),r=w.parent,delete w.parent,n=w.end,delete w.end,i=w.token,delete w.token}return f}getContextAtOffset(e,t=!1){return this.contextAtOffset(e)}ensureParsed(){return this.parse(),this}reparse(){return this.invalidateFromLine(0),this.parse()}profileReparse(){let e=Date.now(),t=this.reparse();return console.log("took",Date.now()-e),t}tokenize(e=!1){var t;let r=this[Y]||{lines:[],version:-1};if(r.version==this.version&&!e)return r;let n=this.content;this.isLegacy&&(n=n.replace(/\@\w/g,function(u){return"¶"+u.slice(1)}),n=n.replace(/\w\:(?=\w)/g,function(u){return u[0]+"."}),n=n.replace(/(do)(\s?)\|([^\|]*)\|/g,function(u,h,S,v){return h+"("+(S||"")+v+")"}));let i=this.lineOffsets,a=[],f=this.seed,c=Date.now(),l=this.initialState;this[Y]={version:this.version,lines:[],tokens:a};let p={};this[Y].cache=p;for(let u=0,h=F(r.lines),S=h.length;u<S;u++){let v=h[u];(p[t=v.text]||(p[t]=[])).push(v)}for(let u=0,h=F(i),S=h.length;u<S;u++){let v=h[u],_=i[u+1]||n.length,m=n.slice(v,_),k=l,w=p[m],b=w&&w.filter(function(E){return E.startState==k}),x=b&&(b.find(function(E){return E.offset==v})||b[0]),y=null;if(x&&(x.offset==v,y=x.clone(v)),!y){let E=W.tokenize(m,k,v);y=new ue({offset:v,text:m,startState:k,endState:E.endState,tokens:E.tokens})}for(let E=0,$=F(y.tokens),T=$.length;E<T;E++){let C=$[E];a.push(C)}this[Y].lines.push(y),l=y.endState}return this[Y]}get tokens(){return this.astify(),this[Y].tokens}getTokens(e=null){return this.tokens}astify(){let e=this.tokenize();if(e.root)return this;let t={"]":"[",")":"(","}":"{",">":"<"},r={"[":"]","(":")","{":"}","<":">"},n=/[\w\$\)\]\?]/,i=Date.now(),a=null,o=e.root=new se(this,this.seed,null,"root"),f=this.content,c=console.log.bind(console),l=null,p=null,u=null,h=null,S=0;for(let v=0,A=F(e.tokens),_=A.length;v<_;v++){let m=A[v],k=m.type.split("."),w=m.value,b=e.tokens[v+1],[x,y,E]=k,$=k[k.length-1],T=k[k.length-2],C=null,R=0;if(x=="ivar"&&(w=m.value="@"+w.slice(1)),h&&(h.next=m),m.prev=h,m.context=o,x=="("&&h){let B=f[m.offset-1]||"";n.test(B)&&(o=m.scope=D.args.build(this,m,o,"args",k))}if(x=="operator"&&(m.op=m.value.trim()),x=="keyword"&&(z[y]&&(S|=z[y]),(w=="let"||w=="const")&&(p=m,u=null)),x=="entity"&&(m.mods|=S,S=0),x=="push"){let B=y,G=y.lastIndexOf("_"),ve=G>=0?M:j;G>=0?(B=B.slice(G+1),ve=D[B]||M):D[B]&&(ve=D[B]),o=m.scope=new ve(this,m,o,B,k),l&&(l.body=o,o.symbol=l,l=null),o==o.scope&&(p=null,u=null)}else x=="pop"?(y=="value"&&(u=null),o=o.pop(m)):(y=="open"||r[y])&&D[x]?o=m.scope=D[x].build(this,m,o,x,k):$=="open"&&(C=D[T])?o=m.scope=C.build(this,m,o,T,k):($=="close"&&o.type==T||y=="close"&&D[x]||t[x]&&o&&o.start.value==t[x])&&(o=o.pop(m));if(m.match(/entity\.name|decl-/)){let B=K.forToken(m,m.type,m.mods);B&&(l=m.symbol=B,m.symbol.keyword=p,o.register(m.symbol)),m.mods|=z.Declaration}if(y=="declval"&&(u=m),m.match("identifier")&&!m.symbol){let B=o.lookup(m,p);if(B&&B.scopedΦ&&(u&&B.keyword==p||B.addReference(m)),h&&h.op=="="&&B){let G=h.prev;G&&G.symbol==B&&(G.mods&z.Declaration?B.dereference(m):(!b||b.match("br"))&&B.dereference(G))}}h=m}return this}parse(){return this.tokens}getMatchingTokens(e){let t=this.getTokens();return t=t.slice(0).filter(function(r){return r.match(e)}),t}migrateToImba2(){let e=this.content;e=e.replace(/\bdef self\./g,"static def "),e=e.replace(/\b(var|let|const) def /g,"def "),e=e.replace(/\?\./g,".."),e=e.replace(/def ([\w\-]+)\=/g,"set $1"),e=e.replace(/do\s?\|([^\|]+)\|/g,"do($1)"),e=e.replace(/(prop) ([\w\-]+) (.+)$/gm,function(i,a,o,f){var c,l;let p={};f.split(/,\s*/).map(function(h){return h.split(/\:\s*/)}).map(function(h){return p[h[0]]=h[1]});let u=""+a+" "+o;return p.watch&&p.watch[0].match(/[\'\"\:]/)?u="@watch("+p.watch+") "+u:p.watch&&(u="@watch "+u),c=p.watch,delete p.watch,p.default&&(u=""+u+" = "+p.default,l=p.default,delete p.default),Object.keys(p).length&&console.log("more prop values",i,p),u});let r=ie.tmp(e).getTokens(),n="";for(let i=0,a=F(r),o=a.length;i<o;i++){let f=a[i],c=r[i+1],{value:l,type:p,offset:u}=f,h=u+l.length;p=="operator.dot.legacy"&&(l=".",c&&(c.access=!0)),p=="operator.spread.legacy"&&(l="..."),p=="identifier.tagname"&&l.indexOf(":")>=0&&(l=l.replace(":","-")),p=="identifier.def.propname"&&l=="initialize"&&(l="constructor"),p=="decorator"&&!e.slice(h).match(/^\s(prop|def|get|set)/)&&(l=n+l.slice(1)),p=="property"&&(l[0]=="@"?(l=l.replace(/^\@/,n),f.access=!0):l=="len"?l="length":/^(\n|\s\:|\)|\,|\.)/.test(e.slice(h))&&!f.access&&l[0]==l[0].toLowerCase()&&(l=l+"!")),p=="identifier"&&!f.access&&l[0]==l[0].toLowerCase()&&l[0]!="_"&&!f.variable&&/^(\n|\s\:|\)|\,|\.)/.test(e.slice(h))&&l!="new"&&(l=l+"!"),f.value=l}return r.map(function(i){return i.value}).join("")}createImportEdit(e,t,r=t){e=e.replace(/\.imba$/,"");let n=this.getImportNodes().filter(function(c){return c.sourcePath==e}),i="",a=0,o=[],f={changes:o};if(this.getImportedSymbols().map(function(p){return p.importInfo}).find(function(p){return p.path==e&&p.name==r&&p.exportName==t}))return f;t!="default"&&t!="*"&&(n=n.filter(function(c){return c.specifiers||!c.ns}));for(let c=0,l=F(n),p=l.length;c<p;c++){let u=l[c],h=u.default,S=u.specifiers,v=u.namespace;if(t=="default")if(a=u.start.offset+1,h){if(h.value==r)return f;f.alias=h.value,a=0;continue}else i=r,(v||S)&&(i+=", ");else if(t=="*"){if(S)continue;h?(a=h.endOffset,i=", * as "+r):(a=u.start.offset+1,i="* as "+r+" ")}else if(v){f.alias=""+v.value+"."+t;continue}else{let A=t;r!=t&&(A+=" as "+r),S?(a=S.start.offset+1,i=" "+A+","):h?(a=h.endOffset,i=", { "+A+" }"):(i="{ "+A+" }",a=u.start.offset+1)}if(i)break}return i||(t=="default"?i="import "+r+" from '"+e+"'":t=="*"?i="import * as "+r+" from '"+e+"'":r!=t?i="import { "+t+" as "+r+" } from '"+e+"'":i="import { "+t+" } from '"+e+"'",i+=`
6`),o.push({newText:i,range:this.rangeAt(a,a)}),f}};var Zt={defaultToken:"",tokenPostfix:".xml",ignoreCase:!0,qualifiedName:/(?:[\w\.\-]+:)?[\w\.\-]+/,tokenizer:{root:[[/[^<&]+/,""],{include:"@whitespace"},[/(<)(@qualifiedName)/,[{token:"delimiter"},{token:"tag",next:"@tag"}]],[/(<\/)(@qualifiedName)(\s*)(>)/,[{token:"delimiter"},{token:"tag"},"",{token:"delimiter"}]],[/(<\?)(@qualifiedName)/,[{token:"delimiter"},{token:"metatag",next:"@tag"}]],[/(<\!)(@qualifiedName)/,[{token:"delimiter"},{token:"metatag",next:"@tag"}]],[/<\!\[CDATA\[/,{token:"delimiter.cdata",next:"@cdata"}],[/&\w+;/,"string.escape"]],cdata:[[/[^\]]+/,""],[/\]\]>/,{token:"delimiter.cdata",next:"@pop"}],[/\]/,""]],tag:[[/[ \t\r\n]+/,""],[/(@qualifiedName)(\s*=\s*)("[^"]*"|'[^']*')/,["attribute.name","","attribute.value"]],[/(@qualifiedName)(\s*=\s*)("[^">?\/]*|'[^'>?\/]*)(?=[\?\/]\>)/,["attribute.name","","attribute.value"]],[/(@qualifiedName)(\s*=\s*)("[^">]*|'[^'>]*)/,["attribute.name","","attribute.value"]],[/@qualifiedName/,"attribute.name"],[/\?>/,{token:"delimiter",next:"@pop"}],[/(\/)(>)/,[{token:"tag"},{token:"delimiter",next:"@pop"}]],[/>/,{token:"delimiter",next:"@pop"}]],whitespace:[[/[ \t\r\n]+/,""],[/<!--/,{token:"comment",next:"@comment"}]],comment:[[/[^<\-]+/,"comment.content"],[/-->/,{token:"comment",next:"@pop"}],[/<!--/,"comment.content.invalid"],[/[<\-]/,"comment.content"]]}};var De={},we=class{static getTokenizer(e){return e=="xml"&&!De[e]?this.createTokenizer("xml",Zt):De[e]}static createTokenizer(e,t){let r=ke(e,t);return De[e]=new fe(e,r)}};function fr(s){let e;return s?(e=s.toIterable)?e.call(s):s:[]}var ur={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},hr={"[":"square open","]":"square close","{":"curly open","}":"curly close","(":"paren open",")":"paren close"};function Ht(s){return s.replace(/[\&\<\>]/g,function(e){return ur[e]})}function mr(s){return s.join(" ").replace(/[\[\]\{\}\(\)]/g,function(e){return hr[e]})}function Ge(s,{verbose:e=!1}){let t=[],r=0,n=0,i=[];for(let a=0,o=fr(s),f=o.length;a<f;a++){let c=o[a],l=c.value,p=c.type.split("."),[u,h]=p,S=c.mods;if(c.var){let v=i.indexOf(c.var);v==-1&&(v=i.push(c.var)-1),p.push("vref"),p.push("var"+v),p.push(c.var.type+"-ref"),S|=c.var.mods}if(S&z.Declaration&&p.push("decl"),S&z.Root&&p.push("root"),S&z.Local&&p.push("local"),c.end&&c.end.start==c&&t.push("<b>"),!((h=="start"||h=="open")&&(t.push("<b class='"+u+"'>"),!l))){if((h=="end"||h=="close")&&!l){t.push("</b>");continue}if(u=="push"){l=String(++r);let v=h.indexOf("_")>=0?"group":"scope",A=c.scope&&c.scope.end;t.push("<div class='"+v+"-"+h.split("_").pop()+" _"+h+" l"+r+" o"+c.offset+" e"+(A&&A.offset)+"'>");continue}else if(u=="pop"){l=String(--r),t.push("</div>");continue}u!="white"&&u!="line"?l="<i class='"+mr(p)+" o"+c.offset+"'>"+Ht(l||"")+"</i>":u=="white"&&l!=`
7`&&(l="<i raw='"+JSON.stringify(l)+"'>"+Ht(l||"")+"</i>"),t.push(l),(h=="end"||h=="close"||c.start)&&t.push("</b>")}}return t.join("")}0&&(module.exports={CompletionTypes,Group,ImbaDocument,KeywordTypes,Keywords,M,Monarch,Node,Position,Range,Scope,SemanticTokenModifiers,SemanticTokenTypes,Sym,SymbolFlags,SymbolKind,Token,grammar,highlight,lexer});