loreline 0.8.1 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/js/loreline.d.ts +71 -0
- package/js/loreline.js +31420 -27657
- package/js/loreline.min.js +82 -45
- package/package.json +1 -1
package/js/loreline.min.js
CHANGED
|
@@ -1,52 +1,89 @@
|
|
|
1
|
-
"use strict";let Xl={},Bn={};(function(Yi,Zl){"use strict";Yi.loreline=Yi.loreline||{};var j={},S=function(){return te.__string_rec(this,"")},Qe=Qe||{},d;class p{static cca(e,t){let i=e.charCodeAt(t);if(i==i)return i}static substr(e,t,i){if(i==null)i=e.length;else if(i<0)if(t==0)i=e.length+i;else return"";return e.substr(t,i)}static remove(e,t){let i=e.indexOf(t);return i==-1?!1:(e.splice(i,1),!0)}static now(){return Date.now()}}j.HxOverrides=p,p.__name__="HxOverrides";class Ol{constructor(e,t){this.min=e,this.max=t}hasNext(){return this.min<this.max}next(){return this.min++}}j.IntIterator=Ol,Ol.__name__="IntIterator",Object.assign(Ol.prototype,{__class__:Ol});class tn{static exists(e,t){let i=fn(e);for(;i.hasNext();){let l=i.next();if(t(l))return!0}return!1}}j.Lambda=tn,tn.__name__="Lambda",Math.__name__="Math";class We{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let i;if(e==null)return null;{let l;return e.__properties__?(i=e.__properties__["get_"+t],l=i):l=!1,l?e[i]():e[t]}}static setProperty(e,t,i){let l,n;e.__properties__?(l=e.__properties__["set_"+t],n=l):n=!1,n?e[l](i):e[t]=i}static fields(e){let t=[];if(e!=null){let l=Object.prototype.hasOwnProperty;for(var i in e)i!="__id__"&&i!="hx__closures__"&&l.call(e,i)&&t.push(i)}return t}static isFunction(e){return typeof e=="function"?!(e.__name__||e.__ename__):!1}static compare(e,t){return e==t?0:e>t?1:-1}static isObject(e){if(e==null)return!1;let t=typeof e;return t=="string"||t=="object"&&e.__enum__==null?!0:t=="function"?(e.__name__||e.__ename__)!=null:!1}static isEnumValue(e){return e!=null?e.__enum__!=null:!1}static deleteField(e,t){return Object.prototype.hasOwnProperty.call(e,t)?(delete e[t],!0):!1}static makeVarArgs(e){return function(){let t=Array.prototype.slice,i=arguments,l=t.call(i);return e(l)}}}j.Reflect=We,We.__name__="Reflect";class le{static string(e){return te.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}}j.Std=le,le.__name__="Std";class Xt{constructor(){this.b=""}}j.StringBuf=Xt,Xt.__name__="StringBuf",Object.assign(Xt.prototype,{__class__:Xt});class Ae{static htmlEscape(e,t){let i="",l=0,n=e;for(;l<n.length;){let s=n,r=l++,h=s.charCodeAt(r);h>=55296&&h<=56319&&(h=h-55232<<10|s.charCodeAt(r+1)&1023);let a=h;a>=65536&&++l;let o=a;switch(o){case 34:t?i+=""":i+=String.fromCodePoint(o);break;case 38:i+="&";break;case 39:t?i+="'":i+=String.fromCodePoint(o);break;case 60:i+="<";break;case 62:i+=">";break;default:i+=String.fromCodePoint(o)}}return i}static isSpace(e,t){let i=p.cca(e,t);return i>8&&i<14?!0:i==32}static ltrim(e){let t=e.length,i=0;for(;i<t&&Ae.isSpace(e,i);)++i;return i>0?p.substr(e,i,t-i):e}static rtrim(e){let t=e.length,i=0;for(;i<t&&Ae.isSpace(e,t-i-1);)++i;return i>0?p.substr(e,0,t-i):e}static trim(e){return Ae.ltrim(Ae.rtrim(e))}static replace(e,t,i){return e.split(t).join(i)}}j.StringTools=Ae,Ae.__name__="StringTools";var vt=Qe.ValueType={__ename__:"ValueType",__constructs__:null,TNull:{_hx_name:"TNull",_hx_index:0,__enum__:"ValueType",toString:S},TInt:{_hx_name:"TInt",_hx_index:1,__enum__:"ValueType",toString:S},TFloat:{_hx_name:"TFloat",_hx_index:2,__enum__:"ValueType",toString:S},TBool:{_hx_name:"TBool",_hx_index:3,__enum__:"ValueType",toString:S},TObject:{_hx_name:"TObject",_hx_index:4,__enum__:"ValueType",toString:S},TFunction:{_hx_name:"TFunction",_hx_index:5,__enum__:"ValueType",toString:S},TClass:(d=function(k){return{_hx_index:6,c:k,__enum__:"ValueType",toString:S}},d._hx_name="TClass",d.__params__=["c"],d),TEnum:(d=function(k){return{_hx_index:7,e:k,__enum__:"ValueType",toString:S}},d._hx_name="TEnum",d.__params__=["e"],d),TUnknown:{_hx_name:"TUnknown",_hx_index:8,__enum__:"ValueType",toString:S}};vt.__constructs__=[vt.TNull,vt.TInt,vt.TFloat,vt.TBool,vt.TObject,vt.TFunction,vt.TClass,vt.TEnum,vt.TUnknown];class pe{static createInstance(e,t){let i=Function.prototype.bind.apply(e,[null].concat(t));return new i}static typeof(e){switch(typeof e){case"boolean":return vt.TBool;case"function":return e.__name__||e.__ename__?vt.TObject:vt.TFunction;case"number":return Math.ceil(e)==e%2147483648?vt.TInt:vt.TFloat;case"object":if(e==null)return vt.TNull;let t=e.__enum__;if(t!=null)return vt.TEnum(Qe[t]);let i=te.getClass(e);return i!=null?vt.TClass(i):vt.TObject;case"string":return vt.TClass(String);case"undefined":return vt.TNull;default:return vt.TUnknown}}static enumEq(e,t){if(e==t)return!0;try{let i=e.__enum__;if(i==null||i!=t.__enum__||e._hx_index!=t._hx_index)return!1;let n=Qe[i].__constructs__[e._hx_index].__params__,s=0;for(;s<n.length;){let r=n[s];if(++s,!pe.enumEq(e[r],t[r]))return!1}}catch{return!1}return!0}static enumParameters(e){let i=Qe[e.__enum__].__constructs__[e._hx_index].__params__;if(i!=null){let l=[],n=0;for(;n<i.length;){let s=i[n];++n,l.push(e[s])}return l}else return[]}}j.Type=pe,pe.__name__="Type";class Ie{static toString(e){switch(e){case 0:return"Element";case 1:return"PCData";case 2:return"CData";case 3:return"Comment";case 4:return"DocType";case 5:return"ProcessingInstruction";case 6:return"Document"}}}class Z{constructor(e){this.nodeType=e,this.children=[],this.attributeMap=new Ee}get(e){if(this.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":Ie.toString(this.nodeType)));return this.attributeMap.h[e]}exists(e){if(this.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":Ie.toString(this.nodeType)));return Object.prototype.hasOwnProperty.call(this.attributeMap.h,e)}attributes(){if(this.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":Ie.toString(this.nodeType)));return new dl(this.attributeMap.h)}elements(){if(this.nodeType!=Z.Document&&this.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":Ie.toString(this.nodeType)));let e=[],t=0,i=this.children;for(;t<i.length;){let n=i[t];++t,n.nodeType==Z.Element&&e.push(n)}let l=e;return new Ti(l)}elementsNamed(e){if(this.nodeType!=Z.Document&&this.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":Ie.toString(this.nodeType)));let t=[],i=0,l=this.children;for(;i<l.length;){let s=l[i];++i;let r;if(s.nodeType==Z.Element){if(s.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":Ie.toString(s.nodeType)));r=s.nodeName==e}else r=!1;r&&t.push(s)}let n=t;return new Ti(n)}firstElement(){if(this.nodeType!=Z.Document&&this.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":Ie.toString(this.nodeType)));let e=0,t=this.children;for(;e<t.length;){let i=t[e];if(++e,i.nodeType==Z.Element)return i}return null}toString(){return el.print(this)}}j.Xml=Z,Z.__name__="Xml",Object.assign(Z.prototype,{__class__:Z});var bi=Qe["haxe.StackItem"]={__ename__:"haxe.StackItem",__constructs__:null,CFunction:{_hx_name:"CFunction",_hx_index:0,__enum__:"haxe.StackItem",toString:S},Module:(d=function(k){return{_hx_index:1,m:k,__enum__:"haxe.StackItem",toString:S}},d._hx_name="Module",d.__params__=["m"],d),FilePos:(d=function(k,e,t,i){return{_hx_index:2,s:k,file:e,line:t,column:i,__enum__:"haxe.StackItem",toString:S}},d._hx_name="FilePos",d.__params__=["s","file","line","column"],d),Method:(d=function(k,e){return{_hx_index:3,classname:k,method:e,__enum__:"haxe.StackItem",toString:S}},d._hx_name="Method",d.__params__=["classname","method"],d),LocalFunction:(d=function(k){return{_hx_index:4,v:k,__enum__:"haxe.StackItem",toString:S}},d._hx_name="LocalFunction",d.__params__=["v"],d)};bi.__constructs__=[bi.CFunction,bi.Module,bi.FilePos,bi.Method,bi.LocalFunction];class gn{static callStack(){return Ci.toHaxe(Ci.callStack())}}class kt{}j["haxe.IMap"]=kt,kt.__name__="haxe.IMap",kt.__isInterface__=!0,Object.assign(kt.prototype,{__class__:kt});class b extends Error{constructor(e,t,i){super(e),this.message=e,this.__previousException=t,this.__nativeException=i??this}unwrap(){return this.__nativeException}get_native(){return this.__nativeException}static caught(e){return e instanceof b?e:e instanceof Error?new b(e.message,null,e):new hl(e,null,e)}static thrown(e){return e instanceof b?e.get_native():e instanceof Error?e:new hl(e)}}j["haxe.Exception"]=b,b.__name__="haxe.Exception",b.__super__=Error,Object.assign(b.prototype,{__class__:b,__properties__:{get_native:"get_native"}});class Di{constructor(e,t){this.high=e,this.low=t}}j["haxe._Int64.___Int64"]=Di,Di.__name__="haxe._Int64.___Int64",Object.assign(Di.prototype,{__class__:Di});class Il{static formatOutput(e,t){let i=le.string(e);if(t==null)return i;let l=t.fileName+":"+t.lineNumber;if(t.customParams!=null){let n=0,s=t.customParams;for(;n<s.length;){let r=s[n];++n,i+=", "+le.string(r)}}return l+": "+i}static trace(e,t){let i=Il.formatOutput(e,t);typeof console<"u"&&console.log!=null&&console.log(i)}}j["haxe.Log"]=Il,Il.__name__="haxe.Log";class Ci{static callStack(){let e=new Error(""),t=Ci.tryHaxeStack(e);if(typeof t>"u"){try{throw e}catch{}t=e.stack}return Ci.normalize(t,2)}static toHaxe(e,t){if(t==null&&(t=0),e==null)return[];if(typeof e=="string"){let i=e.split(`
|
|
2
|
-
`);
|
|
3
|
-
`:case"Error:":++t;break;default:}return
|
|
4
|
-
`,i),i<0?"":Ci.skipLines(e,--t,i+1)):e.substring(i)}}j["haxe.NativeStackTrace"]=Ci,Ci.__name__="haxe.NativeStackTrace";class rl{constructor(e){let t=this;this.id=setInterval(function(){t.run()},e)}stop(){this.id!=null&&(clearInterval(this.id),this.id=null)}run(){}static delay(e,t){let i=new rl(t);return i.run=function(){i.stop(),e()},i}}j["haxe.Timer"]=rl,rl.__name__="haxe.Timer",Object.assign(rl.prototype,{__class__:rl});class hl extends b{constructor(e,t,i){super(String(e),t,i),this.value=e}unwrap(){return this.value}}j["haxe.ValueException"]=hl,hl.__name__="haxe.ValueException",hl.__super__=b,Object.assign(hl.prototype,{__class__:hl});class al{constructor(){}set(e,t){this.root=this.setLoop(e,t,this.root)}get(e){let t=this.root;for(;t!=null;){let i=this.compare(e,t.key);if(i==0)return t.value;i<0?t=t.left:t=t.right}return null}keys(){let e=[];return this.keysLoop(this.root,e),new Ti(e)}setLoop(e,t,i){if(i==null)return new Zt(null,e,t,null);let l=this.compare(e,i.key);if(l==0)return new Zt(i.left,e,t,i.right,i==null?0:i._height);if(l<0){let n=this.setLoop(e,t,i.left);return this.balance(n,i.key,i.value,i.right)}else{let n=this.setLoop(e,t,i.right);return this.balance(i.left,i.key,i.value,n)}}keysLoop(e,t){e!=null&&(this.keysLoop(e.left,t),t.push(e.key),this.keysLoop(e.right,t))}balance(e,t,i,l){let n=e==null?0:e._height,s=l==null?0:l._height;if(n>s+2){let r=e.left,h=e.right;return(r==null?0:r._height)>=(h==null?0:h._height)?new Zt(e.left,e.key,e.value,new Zt(e.right,t,i,l)):new Zt(new Zt(e.left,e.key,e.value,e.right.left),e.right.key,e.right.value,new Zt(e.right.right,t,i,l))}else if(s>n+2){let r=l.right,h=l.left;return(r==null?0:r._height)>(h==null?0:h._height)?new Zt(new Zt(e,t,i,l.left),l.key,l.value,l.right):new Zt(new Zt(e,t,i,l.left.left),l.left.key,l.left.value,new Zt(l.left.right,l.key,l.value,l.right))}else return new Zt(e,t,i,l,(n>s?n:s)+1)}compare(e,t){return We.compare(e,t)}}j["haxe.ds.BalancedTree"]=al,al.__name__="haxe.ds.BalancedTree",al.__interfaces__=[kt],Object.assign(al.prototype,{__class__:al});class Zt{constructor(e,t,i,l,n){if(n==null&&(n=-1),this.left=e,this.key=t,this.value=i,this.right=l,n==-1){let s,r=this.left,h=this.right;if((r==null?0:r._height)>(h==null?0:h._height)){let a=this.left;s=a==null?0:a._height}else{let a=this.right;s=a==null?0:a._height}this._height=s+1}else this._height=n}}j["haxe.ds.TreeNode"]=Zt,Zt.__name__="haxe.ds.TreeNode",Object.assign(Zt.prototype,{__class__:Zt});class Xi extends al{constructor(){super()}compare(e,t){let i=e._hx_index-t._hx_index;if(i!=0)return i;let l=pe.enumParameters(e),n=pe.enumParameters(t);return l.length==0&&n.length==0?0:this.compareArgs(l,n)}compareArgs(e,t){let i=e.length-t.length;if(i!=0)return i;let l=0,n=e.length;for(;l<n;){let s=l++,r=this.compareArg(e[s],t[s]);if(r!=0)return r}return 0}compareArg(e,t){return We.isEnumValue(e)&&We.isEnumValue(t)?this.compare(e,t):e instanceof Array&&t instanceof Array?this.compareArgs(e,t):We.compare(e,t)}}j["haxe.ds.EnumValueMap"]=Xi,Xi.__name__="haxe.ds.EnumValueMap",Xi.__interfaces__=[kt],Xi.__super__=al,Object.assign(Xi.prototype,{__class__:Xi});class Ri{constructor(){this.h={}}set(e,t){this.h[e]=t}get(e){return this.h[e]}keys(){let e=[];for(var t in this.h)this.h.hasOwnProperty(t)&&e.push(+t);return new Ti(e)}}j["haxe.ds.IntMap"]=Ri,Ri.__name__="haxe.ds.IntMap",Ri.__interfaces__=[kt],Object.assign(Ri.prototype,{__class__:Ri});class Pl{constructor(){this.length=0}add(e){let t=new ml(e,null);this.h==null?this.h=t:this.q.next=t,this.q=t,this.length++}push(e){let t=new ml(e,this.h);this.h=t,this.q==null&&(this.q=t),this.length++}pop(){if(this.h==null)return null;let e=this.h.item;return this.h=this.h.next,this.h==null&&(this.q=null),this.length--,e}}j["haxe.ds.List"]=Pl,Pl.__name__="haxe.ds.List",Object.assign(Pl.prototype,{__class__:Pl});class ml{constructor(e,t){this.item=e,this.next=t}}j["haxe.ds._List.ListNode"]=ml,ml.__name__="haxe.ds._List.ListNode",Object.assign(ml.prototype,{__class__:ml});class gl{constructor(){this.h={__keys__:{}}}set(e,t){let i=e.__id__;i==null&&(i=e.__id__=Zl.$haxeUID++),this.h[i]=t,this.h.__keys__[i]=e}get(e){return this.h[e.__id__]}keys(){let e=[];for(var t in this.h.__keys__)this.h.hasOwnProperty(t)&&e.push(this.h.__keys__[t]);return new Ti(e)}}j["haxe.ds.ObjectMap"]=gl,gl.__name__="haxe.ds.ObjectMap",gl.__interfaces__=[kt],Object.assign(gl.prototype,{__class__:gl});class Ee{constructor(){this.h=Object.create(null)}get(e){return this.h[e]}set(e,t){this.h[e]=t}keys(){return new dl(this.h)}}j["haxe.ds.StringMap"]=Ee,Ee.__name__="haxe.ds.StringMap",Ee.__interfaces__=[kt],Object.assign(Ee.prototype,{__class__:Ee});class dl{constructor(e){this.h=e,this.keys=Object.keys(e),this.length=this.keys.length,this.current=0}hasNext(){return this.current<this.length}next(){return this.keys[this.current++]}}j["haxe.ds._StringMap.StringMapKeyIterator"]=dl,dl.__name__="haxe.ds._StringMap.StringMapKeyIterator",Object.assign(dl.prototype,{__class__:dl});class ln{static blit(e,t,i,l,n){if(e==i){if(t<l){let s=t+n,r=l+n,h=0,a=n;for(;h<a;){let o=h++;--s,--r,e[r]=e[s]}}else if(t>l){let s=t,r=l,h=0,a=n;for(;h<a;){let o=h++;e[r]=e[s],++s,++r}}}else{let s=0,r=n;for(;s<r;){let h=s++;i[l+h]=e[t+h]}}}}class Nt{constructor(e){switch(e){case".":case"..":this.dir=e,this.file="";return}let t=e.lastIndexOf("/"),i=e.lastIndexOf("\\");t<i?(this.dir=p.substr(e,0,i),e=p.substr(e,i+1,null),this.backslash=!0):i<t?(this.dir=p.substr(e,0,t),e=p.substr(e,t+1,null)):this.dir=null;let l=e.lastIndexOf(".");l!=-1?(this.ext=p.substr(e,l+1,null),this.file=p.substr(e,0,l)):(this.ext=null,this.file=e)}static directory(e){let t=new Nt(e);return t.dir==null?"":t.dir}static join(e){let t=[],i=0,l=e;for(;i<l.length;){let a=l[i];++i,a!=null&&a!=""&&t.push(a)}let n=t;if(n.length==0)return"";let s=n[0],r=1,h=n.length;for(;r<h;){let a=r++;s=Nt.addTrailingSlash(s),s+=n[a]}return Nt.normalize(s)}static normalize(e){let t="/";if(e=e.split("\\").join(t),e==t)return t;let i=[],l=0,n=e.split(t);for(;l<n.length;){let c=n[l];++l,c==".."&&i.length>0&&i[i.length-1]!=".."?i.pop():c==""?(i.length>0||p.cca(e,0)==47)&&i.push(c):c!="."&&i.push(c)}let s=i.join(t),r="",h=!1,a=!1,o=0,u=s;for(;o<u.length;){let c=u,_=o++,f=c.charCodeAt(_);f>=55296&&f<=56319&&(f=f-55232<<10|c.charCodeAt(_+1)&1023);let m=f;m>=65536&&++o;let g=m;switch(g){case 47:if(!h)a=!0;else{let y=g;h=!1,a&&(r+="/",a=!1),r+=String.fromCodePoint(y)}break;case 58:r+=":",h=!0;break;default:let w=g;h=!1,a&&(r+="/",a=!1),r+=String.fromCodePoint(w)}}return r}static addTrailingSlash(e){if(e.length==0)return"/";let t=e.lastIndexOf("/"),i=e.lastIndexOf("\\");return t<i?i!=e.length-1?e+"\\":e:t!=e.length-1?e+"/":e}static isAbsolute(e){return!!(e.startsWith("/")||e.charAt(1)==":"||e.startsWith("\\\\"))}}j["haxe.io.Path"]=Nt,Nt.__name__="haxe.io.Path",Object.assign(Nt.prototype,{__class__:Nt});class Ti{constructor(e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}}j["haxe.iterators.ArrayIterator"]=Ti,Ti.__name__="haxe.iterators.ArrayIterator",Object.assign(Ti.prototype,{__class__:Ti});var Gt=Qe["haxe.rtti.CType"]={__ename__:"haxe.rtti.CType",__constructs__:null,CUnknown:{_hx_name:"CUnknown",_hx_index:0,__enum__:"haxe.rtti.CType",toString:S},CEnum:(d=function(k,e){return{_hx_index:1,name:k,params:e,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CEnum",d.__params__=["name","params"],d),CClass:(d=function(k,e){return{_hx_index:2,name:k,params:e,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CClass",d.__params__=["name","params"],d),CTypedef:(d=function(k,e){return{_hx_index:3,name:k,params:e,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CTypedef",d.__params__=["name","params"],d),CFunction:(d=function(k,e){return{_hx_index:4,args:k,ret:e,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CFunction",d.__params__=["args","ret"],d),CAnonymous:(d=function(k){return{_hx_index:5,fields:k,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CAnonymous",d.__params__=["fields"],d),CDynamic:(d=function(k){return{_hx_index:6,t:k,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CDynamic",d.__params__=["t"],d),CAbstract:(d=function(k,e){return{_hx_index:7,name:k,params:e,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CAbstract",d.__params__=["name","params"],d)};Gt.__constructs__=[Gt.CUnknown,Gt.CEnum,Gt.CClass,Gt.CTypedef,Gt.CFunction,Gt.CAnonymous,Gt.CDynamic,Gt.CAbstract];var Dt=Qe["haxe.rtti.Rights"]={__ename__:"haxe.rtti.Rights",__constructs__:null,RNormal:{_hx_name:"RNormal",_hx_index:0,__enum__:"haxe.rtti.Rights",toString:S},RNo:{_hx_name:"RNo",_hx_index:1,__enum__:"haxe.rtti.Rights",toString:S},RCall:(d=function(k){return{_hx_index:2,m:k,__enum__:"haxe.rtti.Rights",toString:S}},d._hx_name="RCall",d.__params__=["m"],d),RMethod:{_hx_name:"RMethod",_hx_index:3,__enum__:"haxe.rtti.Rights",toString:S},RDynamic:{_hx_name:"RDynamic",_hx_index:4,__enum__:"haxe.rtti.Rights",toString:S},RInline:{_hx_name:"RInline",_hx_index:5,__enum__:"haxe.rtti.Rights",toString:S}};Dt.__constructs__=[Dt.RNormal,Dt.RNo,Dt.RCall,Dt.RMethod,Dt.RDynamic,Dt.RInline];var Vi=Qe["haxe.rtti.TypeTree"]={__ename__:"haxe.rtti.TypeTree",__constructs__:null,TPackage:(d=function(k,e,t){return{_hx_index:0,name:k,full:e,subs:t,__enum__:"haxe.rtti.TypeTree",toString:S}},d._hx_name="TPackage",d.__params__=["name","full","subs"],d),TClassdecl:(d=function(k){return{_hx_index:1,c:k,__enum__:"haxe.rtti.TypeTree",toString:S}},d._hx_name="TClassdecl",d.__params__=["c"],d),TEnumdecl:(d=function(k){return{_hx_index:2,e:k,__enum__:"haxe.rtti.TypeTree",toString:S}},d._hx_name="TEnumdecl",d.__params__=["e"],d),TTypedecl:(d=function(k){return{_hx_index:3,t:k,__enum__:"haxe.rtti.TypeTree",toString:S}},d._hx_name="TTypedecl",d.__params__=["t"],d),TAbstractdecl:(d=function(k){return{_hx_index:4,a:k,__enum__:"haxe.rtti.TypeTree",toString:S}},d._hx_name="TAbstractdecl",d.__params__=["a"],d)};Vi.__constructs__=[Vi.TPackage,Vi.TClassdecl,Vi.TEnumdecl,Vi.TTypedecl,Vi.TAbstractdecl];class st{static typeInfos(e){let t;switch(e._hx_index){case 0:let i=e.name,l=e.full,n=e.subs;throw b.thrown("Unexpected Package");case 1:t=e.c;break;case 2:t=e.e;break;case 3:t=e.t;break;case 4:t=e.a;break}return t}static leq(e,t,i){let l=0,n=i,s=0;for(;s<t.length;){let r=t[s];if(++s,l>=n.length)return!1;let h=n[l++];if(!e(r,h))return!1}return!(l<n.length)}static rightsEq(e,t){if(e==t)return!0;if(e._hx_index==2){let i=e.m;if(t._hx_index==2){let l=t.m;return i==l}}return!1}static typeEq(e,t){switch(e._hx_index){case 0:return t==Gt.CUnknown;case 1:let i=e.name,l=e.params;if(t._hx_index==1){let m=t.name,g=t.params;return i==m?st.leq(st.typeEq,l,g):!1}break;case 2:let n=e.name,s=e.params;if(t._hx_index==2){let m=t.name,g=t.params;return n==m?st.leq(st.typeEq,s,g):!1}break;case 3:let r=e.name,h=e.params;if(t._hx_index==3){let m=t.name,g=t.params;return r==m?st.leq(st.typeEq,h,g):!1}break;case 4:let a=e.args,o=e.ret;if(t._hx_index==4){let m=t.args,g=t.ret;return st.leq(function(w,y){return w.name==y.name&&w.opt==y.opt?st.typeEq(w.t,y.t):!1},a,m)?st.typeEq(o,g):!1}break;case 5:let u=e.fields;if(t._hx_index==5){let m=t.fields;return st.leq(function(g,w){return st.fieldEq(g,w)},u,m)}break;case 6:let c=e.t;if(t._hx_index==6){let m=t.t;return c==null!=(m==null)?!1:c!=null?st.typeEq(c,m):!0}break;case 7:let _=e.name,f=e.params;if(t._hx_index==7){let m=t.name,g=t.params;return _==m?st.leq(st.typeEq,f,g):!1}break}return!1}static fieldEq(e,t){return!(e.name!=t.name||!st.typeEq(e.type,t.type)||e.isPublic!=t.isPublic||e.doc!=t.doc||!st.rightsEq(e.get,t.get)||!st.rightsEq(e.set,t.set)||e.params==null!=(t.params==null)||e.params!=null&&e.params.join(":")!=t.params.join(":"))}static constructorEq(e,t){return!(e.name!=t.name||e.doc!=t.doc||e.args==null!=(t.args==null)||e.args!=null&&!st.leq(function(i,l){return i.name==l.name&&i.opt==l.opt?st.typeEq(i.t,l.t):!1},e.args,t.args))}}j["haxe.rtti.TypeApi"]=st,st.__name__="haxe.rtti.TypeApi";class Nl{constructor(){this.root=[]}process(e,t){if(this.curplatform=t,e.nodeType!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));this.xroot(e)}mergeRights(e,t){return e.get==Dt.RInline&&e.set==Dt.RNo&&t.get==Dt.RNormal&&t.set==Dt.RMethod?(e.get=Dt.RNormal,e.set=Dt.RMethod,!0):pe.enumEq(e.get,t.get)?pe.enumEq(e.set,t.set):!1}mergeDoc(e,t){return e.doc==null?e.doc=t.doc:t.doc==null&&(t.doc=e.doc),!0}mergeFields(e,t){return st.fieldEq(e,t)?!0:e.name==t.name&&(this.mergeRights(e,t)||this.mergeRights(t,e))&&this.mergeDoc(e,t)?st.fieldEq(e,t):!1}newField(e,t){}mergeClasses(e,t){if(e.isInterface!=t.isInterface)return!1;this.curplatform!=null&&e.platforms.push(this.curplatform),e.isExtern!=t.isExtern&&(e.isExtern=!1);let i=0,l=t.fields;for(;i<l.length;){let r=l[i];++i;let h=null,a=0,o=e.fields;for(;a<o.length;){let u=o[a];if(++a,this.mergeFields(u,r)){h=u;break}}h==null?(this.newField(e,r),e.fields.push(r)):this.curplatform!=null&&h.platforms.push(this.curplatform)}let n=0,s=t.statics;for(;n<s.length;){let r=s[n];++n;let h=null,a=0,o=e.statics;for(;a<o.length;){let u=o[a];if(++a,this.mergeFields(u,r)){h=u;break}}h==null?(this.newField(e,r),e.statics.push(r)):this.curplatform!=null&&h.platforms.push(this.curplatform)}return!0}mergeEnums(e,t){if(e.isExtern!=t.isExtern)return!1;this.curplatform!=null&&e.platforms.push(this.curplatform);let i=0,l=t.constructors;for(;i<l.length;){let n=l[i];++i;let s=null,r=0,h=e.constructors;for(;r<h.length;){let a=h[r];if(++r,st.constructorEq(a,n)){s=a;break}}s==null?e.constructors.push(n):this.curplatform!=null&&s.platforms.push(this.curplatform)}return!0}mergeTypedefs(e,t){return this.curplatform==null?!1:(e.platforms.push(this.curplatform),e.types.h[this.curplatform]=t.type,!0)}mergeAbstracts(e,t){if(this.curplatform==null||e.to.length!=t.to.length||e.from.length!=t.from.length)return!1;let i=0,l=e.to.length;for(;i<l;){let r=i++;if(!st.typeEq(e.to[r].t,t.to[r].t))return!1}let n=0,s=e.from.length;for(;n<s;){let r=n++;if(!st.typeEq(e.from[r].t,t.from[r].t))return!1}return t.impl!=null&&this.mergeClasses(e.impl,t.impl),e.platforms.push(this.curplatform),!0}merge(e){let t=st.typeInfos(e),i=t.path.split("."),l=this.root,n=[];i.pop();let s=0;for(;s<i.length;){let h=i[s];++s;let a=!1,o=0;for(;o<l.length;){let u=l[o];if(++o,u._hx_index==0){let c=u.full,_=u.name,f=u.subs;if(_==h){a=!0,l=f;break}}}if(n.push(h),!a){let u=[];l.push(Vi.TPackage(h,n.join("."),u)),l=u}}let r=0;for(;r<l.length;){let h=l[r];++r;let a;if(h._hx_index==0){let u=h.name,c=h.full,_=h.subs;a=!0}else a=!1;if(a)continue;let o=st.typeInfos(h);if(o.path==t.path){let u=!0;if(o.doc==null!=(t.doc==null)&&(t.doc==null?t.doc=o.doc:o.doc=t.doc),o.path=="haxe._Int64.NativeInt64")continue;if(o.module==t.module&&o.doc==t.doc&&o.isPrivate==t.isPrivate)switch(h._hx_index){case 0:let _=h.name,f=h.full,m=h.subs;u=!1;break;case 1:let g=h.c;if(e._hx_index==1){let E=e.c;if(this.mergeClasses(g,E))return}else u=!1;break;case 2:let w=h.e;if(e._hx_index==2){let E=e.e;if(this.mergeEnums(w,E))return}else u=!1;break;case 3:let y=h.t;if(e._hx_index==3){let E=e.t;if(this.mergeTypedefs(y,E))return}break;case 4:let T=h.a;if(e._hx_index==4){let E=e.a;if(this.mergeAbstracts(T,E))return}else u=!1;break}let c=o.module!=t.module?"module "+t.module+" should be "+o.module:o.doc!=t.doc?"documentation is different":o.isPrivate!=t.isPrivate?"private flag is different":u?"could not merge definition":"type kind is different";throw b.thrown("Incompatibilities between "+o.path+" in "+o.platforms.join(",")+" and "+this.curplatform+" ("+c+")")}}l.push(e)}mkPath(e){return e}mkTypeParams(e){let t=e.split(":");return t[0]==""?[]:t}mkRights(e){switch(e){case"dynamic":return Dt.RDynamic;case"inline":return Dt.RInline;case"method":return Dt.RMethod;case"null":return Dt.RNo;default:return Dt.RCall(e)}}xerror(e){let t;if(e.nodeType==Z.Document)t="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));t=e.nodeName}throw b.thrown("Invalid "+t)}xroot(e){let t=e.elements();for(;t.hasNext();){let i=t.next();this.merge(this.processElement(i))}}processElement(e){if(e.nodeType!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));let t=e,i;if(t.nodeType==Z.Document)i="Document";else{if(t.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(t.nodeType==null?"null":Ie.toString(t.nodeType)));i=t.nodeName}switch(i){case"abstract":return Vi.TAbstractdecl(this.xabstract(t));case"class":return Vi.TClassdecl(this.xclass(t));case"enum":return Vi.TEnumdecl(this.xenum(t));case"typedef":return Vi.TTypedecl(this.xtypedef(t));default:return this.xerror(t)}}xmeta(e){let t=[],i=0,l=un.resolve(e,"m");for(;i<l.length;){let n=l[i];++i;let s=[],r=0,h=un.resolve(n,"e");for(;r<h.length;){let a=h[r];++r,s.push(Zi.get_innerHTML(a))}t.push({name:Xe.resolve(n,"n"),params:s})}return t}xoverloads(e){let t=[],i=e.elements();for(;i.hasNext();){let l=i.next();t.push(this.xclassfield(l))}return t}xpath(e){let t=this.mkPath(Xe.resolve(e,"path")),i=[],l=e.elements();for(;l.hasNext();){let n=l.next();i.push(this.xtype(n))}return{path:t,params:i}}xclass(e){let t=null,i=null,l=null,n=[],s=[],r=[],h=[],a=e.exists("interface"),o=e.elements();for(;o.hasNext();){let u=o.next(),c;if(u.nodeType==Z.Document)c="Document";else{if(u.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(u.nodeType==null?"null":Ie.toString(u.nodeType)));c=u.nodeName}switch(c){case"extends":a?n.push(this.xpath(u)):t=this.xpath(u);break;case"haxe_doc":i=Zi.get_innerData(u);break;case"haxe_dynamic":let _=u.firstElement();if(_.nodeType!=Z.Document&&_.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(_.nodeType==null?"null":Ie.toString(_.nodeType)));l=this.xtype(_);break;case"implements":n.push(this.xpath(u));break;case"meta":h=this.xmeta(u);break;default:u.exists("static")?r.push(this.xclassfield(u)):s.push(this.xclassfield(u))}}return{file:ei.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:ei.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:i,isPrivate:e.exists("private"),isExtern:e.exists("extern"),isFinal:e.exists("final"),isInterface:a,params:this.mkTypeParams(Xe.resolve(e,"params")),superClass:t,interfaces:n,fields:s,statics:r,tdynamic:l,platforms:this.defplat(),meta:h}}xclassfield(e,t){t==null&&(t=!1);let i=e.elements(),l=this.xtype(i.next()),n=null,s=[],r=null,h=i;for(;h.hasNext();){let o=h.next(),u;if(o.nodeType==Z.Document)u="Document";else{if(o.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(o.nodeType==null?"null":Ie.toString(o.nodeType)));u=o.nodeName}switch(u){case"haxe_doc":n=Zi.get_innerData(o);break;case"meta":s=this.xmeta(o);break;case"overloads":r=this.xoverloads(o);break;default:this.xerror(o)}}let a;if(e.nodeType==Z.Document)a="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));a=e.nodeName}return{name:a,type:l,isPublic:e.exists("public")||t,isFinal:e.exists("final"),isOverride:e.exists("override"),line:ei.resolve(e,"line")?le.parseInt(Xe.resolve(e,"line")):null,doc:n,get:ei.resolve(e,"get")?this.mkRights(Xe.resolve(e,"get")):Dt.RNormal,set:ei.resolve(e,"set")?this.mkRights(Xe.resolve(e,"set")):Dt.RNormal,params:ei.resolve(e,"params")?this.mkTypeParams(Xe.resolve(e,"params")):[],platforms:this.defplat(),meta:s,overloads:r,expr:ei.resolve(e,"expr")?Xe.resolve(e,"expr"):null}}xenum(e){let t=[],i=null,l=[],n=e.elements();for(;n.hasNext();){let s=n.next(),r;if(s.nodeType==Z.Document)r="Document";else{if(s.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":Ie.toString(s.nodeType)));r=s.nodeName}if(r=="haxe_doc")i=Zi.get_innerData(s);else{let h;if(s.nodeType==Z.Document)h="Document";else{if(s.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":Ie.toString(s.nodeType)));h=s.nodeName}h=="meta"?l=this.xmeta(s):t.push(this.xenumfield(s))}}return{file:ei.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:ei.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:i,isPrivate:e.exists("private"),isExtern:e.exists("extern"),params:this.mkTypeParams(Xe.resolve(e,"params")),constructors:t,platforms:this.defplat(),meta:l}}xenumfield(e){let t=null,i=e.elementsNamed("haxe_doc"),l=i.hasNext()?i.next():null,n=dn.resolve(e,"meta")?this.xmeta(on.resolve(e,"meta")):[];if(ei.resolve(e,"a")){let h=Xe.resolve(e,"a").split(":"),a=e.elements();t=[];let o=0;for(;o<h.length;){let u=h[o];++o;let c=!1;u.charAt(0)=="?"&&(c=!0,u=p.substr(u,1,null)),t.push({name:u,opt:c,t:this.xtype(a.next())})}}let s;if(e.nodeType==Z.Document)s="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));s=e.nodeName}let r;if(l==null)r=null;else{if(l.nodeType!=Z.Document&&l.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(l.nodeType==null?"null":Ie.toString(l.nodeType)));r=Zi.get_innerData(l)}return{name:s,args:t,doc:r,meta:n,platforms:this.defplat()}}xabstract(e){let t=null,i=null,l=null,n=[],s=[],r=[],h=e.elements();for(;h.hasNext();){let a=h.next(),o;if(a.nodeType==Z.Document)o="Document";else{if(a.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(a.nodeType==null?"null":Ie.toString(a.nodeType)));o=a.nodeName}switch(o){case"from":let u=a.elements();for(;u.hasNext();){let f=u.next(),m=f.firstElement();if(m.nodeType!=Z.Document&&m.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(m.nodeType==null?"null":Ie.toString(m.nodeType)));r.push({t:this.xtype(m),field:ei.resolve(f,"field")?Xe.resolve(f,"field"):null})}break;case"haxe_doc":t=Zi.get_innerData(a);break;case"impl":i=this.xclass(on.resolve(a,"class"));break;case"meta":n=this.xmeta(a);break;case"this":let c=a.firstElement();if(c.nodeType!=Z.Document&&c.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(c.nodeType==null?"null":Ie.toString(c.nodeType)));l=this.xtype(c);break;case"to":let _=a.elements();for(;_.hasNext();){let f=_.next(),m=f.firstElement();if(m.nodeType!=Z.Document&&m.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(m.nodeType==null?"null":Ie.toString(m.nodeType)));s.push({t:this.xtype(m),field:ei.resolve(f,"field")?Xe.resolve(f,"field"):null})}break;default:this.xerror(a)}}return{file:ei.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:ei.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:t,isPrivate:e.exists("private"),params:this.mkTypeParams(Xe.resolve(e,"params")),platforms:this.defplat(),meta:n,athis:l,to:s,from:r,impl:i}}xtypedef(e){let t=null,i=null,l=[],n=e.elements();for(;n.hasNext();){let r=n.next(),h;if(r.nodeType==Z.Document)h="Document";else{if(r.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":Ie.toString(r.nodeType)));h=r.nodeName}if(h=="haxe_doc")t=Zi.get_innerData(r);else{let a;if(r.nodeType==Z.Document)a="Document";else{if(r.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":Ie.toString(r.nodeType)));a=r.nodeName}a=="meta"?l=this.xmeta(r):i=this.xtype(r)}}let s=new Ee;return this.curplatform!=null&&(s.h[this.curplatform]=i),{file:ei.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:ei.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:t,isPrivate:e.exists("private"),params:this.mkTypeParams(Xe.resolve(e,"params")),type:i,types:s,platforms:this.defplat(),meta:l}}xtype(e){let t;if(e.nodeType==Z.Document)t="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));t=e.nodeName}switch(t){case"a":let i=[],l=e.elements();for(;l.hasNext();){let f=l.next(),m=this.xclassfield(f,!0);m.platforms=[],i.push(m)}return Gt.CAnonymous(i);case"c":return Gt.CClass(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"d":let n=null,s=e.firstElement();if(s!=null){if(s.nodeType!=Z.Document&&s.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(s.nodeType==null?"null":Ie.toString(s.nodeType)));n=this.xtype(s)}return Gt.CDynamic(n);case"e":return Gt.CEnum(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"f":let r=[],h=Xe.resolve(e,"a").split(":"),a=0,o=h,u=ei.resolve(e,"v")?new Ti(Xe.resolve(e,"v").split(":")):null,c=e.elements();for(;c.hasNext();){let f=c.next(),m=!1,g=a<o.length?o[a++]:null;g==null&&(g=""),g.charAt(0)=="?"&&(m=!0,g=p.substr(g,1,null));let w=u==null||u.current>=u.array.length?null:u.array[u.current++];r.push({name:g,opt:m,t:this.xtype(f),value:w==""?null:w})}let _=r[r.length-1];return p.remove(r,_),Gt.CFunction(r,_.t);case"t":return Gt.CTypedef(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"unknown":return Gt.CUnknown;case"x":return Gt.CAbstract(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));default:return this.xerror(e)}}xtypeparams(e){let t=[],i=e.elements();for(;i.hasNext();){let l=i.next();t.push(this.xtype(l))}return t}defplat(){let e=[];return this.curplatform!=null&&e.push(this.curplatform),e}}j["haxe.rtti.XmlParser"]=Nl,Nl.__name__="haxe.rtti.XmlParser",Object.assign(Nl.prototype,{__class__:Nl});class on{static resolve(e,t){let i=e.elementsNamed(t).next();if(i==null){let l;if(e.nodeType==Z.Document)l="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));l=e.nodeName}throw b.thrown(l+" is missing element "+t)}if(i.nodeType!=Z.Document&&i.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(i.nodeType==null?"null":Ie.toString(i.nodeType)));return i}}class Xe{static resolve(e,t){if(e.nodeType==Z.Document)throw b.thrown("Cannot access document attribute "+t);let i=e.get(t);if(i==null)throw e.nodeType!=Z.Element?b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType))):b.thrown(e.nodeName+" is missing attribute "+t);return i}}class ei{static resolve(e,t){if(e.nodeType==Z.Document)throw b.thrown("Cannot access document attribute "+t);return e.exists(t)}}class dn{static resolve(e,t){return e.elementsNamed(t).hasNext()}}class un{static resolve(e,t){let i=[],l=e.elementsNamed(t);for(;l.hasNext();){let n=l.next();if(n.nodeType!=Z.Document&&n.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(n.nodeType==null?"null":Ie.toString(n.nodeType)));i.push(n)}return i}}class Zi{static get_innerData(e){if(e.nodeType!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));let t=0,i=e.children;if(t>=i.length){let n;if(e.nodeType==Z.Document)n="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));n=e.nodeName}throw b.thrown(n+" does not have data")}let l=i[t++];if(t<i.length){let n=i[t++],s;if(l.nodeType==Z.PCData&&n.nodeType==Z.CData){if(l.nodeType==Z.Document||l.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(l.nodeType==null?"null":Ie.toString(l.nodeType)));s=Ae.trim(l.nodeValue)==""}else s=!1;if(s){if(t>=i.length){if(n.nodeType==Z.Document||n.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":Ie.toString(n.nodeType)));return n.nodeValue}let h=i[t++],a;if(h.nodeType==Z.PCData){if(h.nodeType==Z.Document||h.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(h.nodeType==null?"null":Ie.toString(h.nodeType)));a=Ae.trim(h.nodeValue)==""}else a=!1;if(a&&t>=i.length){if(n.nodeType==Z.Document||n.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":Ie.toString(n.nodeType)));return n.nodeValue}}let r;if(e.nodeType==Z.Document)r="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));r=e.nodeName}throw b.thrown(r+" does not only have data")}if(l.nodeType!=Z.PCData&&l.nodeType!=Z.CData){let n;if(e.nodeType==Z.Document)n="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));n=e.nodeName}throw b.thrown(n+" does not have data")}if(l.nodeType==Z.Document||l.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(l.nodeType==null?"null":Ie.toString(l.nodeType)));return l.nodeValue}static get_innerHTML(e){let t="";if(e.nodeType!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));let i=0,l=e.children;for(;i<l.length;){let n=l[i++];t+=le.string(el.print(n))}return t}}Zi.__properties__={get_innerHTML:"get_innerHTML",get_innerData:"get_innerData"};class el{constructor(e){this.output=new Xt,this.pretty=e}writeNode(e,t){switch(e.nodeType){case 0:if(this.output.b+=le.string(t+"<"),e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));this.output.b+=le.string(e.nodeName);let i=e.attributes();for(;i.hasNext();){let o=i.next();this.output.b+=le.string(" "+o+'="');let u=Ae.htmlEscape(e.get(o),!0);this.output.b+=le.string(u),this.output.b+='"'}if(this.hasChildren(e)){if(this.output.b+=">",this.pretty&&(this.output.b+=`
|
|
5
|
-
`),e.nodeType!=
|
|
1
|
+
"use strict";let hn={},Wn={};(function(Xl,on){"use strict";Xl.loreline=Xl.loreline||{};var Q={},F=function(){return te.__string_rec(this,"")},Ye=Ye||{},x;class c{static cca(e,t){let l=e.charCodeAt(t);if(l==l)return l}static substr(e,t,l){if(l==null)l=e.length;else if(l<0)if(t==0)l=e.length+l;else return"";return e.substr(t,l)}static remove(e,t){let l=e.indexOf(t);return l==-1?!1:(e.splice(l,1),!0)}static now(){return Date.now()}}Q.HxOverrides=c,c.__name__="HxOverrides";class bi{constructor(e,t){this.min=e,this.max=t}hasNext(){return this.min<this.max}next(){return this.min++}}Q.IntIterator=bi,bi.__name__="IntIterator",Object.assign(bi.prototype,{__class__:bi});class cn{static exists(e,t){let l=bn(e);for(;l.hasNext();){let i=l.next();if(t(i))return!0}return!1}}Q.Lambda=cn,cn.__name__="Lambda",Math.__name__="Math";class qe{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let l;if(e==null)return null;{let i;return e.__properties__?(l=e.__properties__["get_"+t],i=l):i=!1,i?e[l]():e[t]}}static setProperty(e,t,l){let i,n;e.__properties__?(i=e.__properties__["set_"+t],n=i):n=!1,n?e[i](l):e[t]=l}static fields(e){let t=[];if(e!=null){let i=Object.prototype.hasOwnProperty;for(var l in e)l!="__id__"&&l!="hx__closures__"&&i.call(e,l)&&t.push(l)}return t}static isFunction(e){return typeof e=="function"?!(e.__name__||e.__ename__):!1}static compare(e,t){return e==t?0:e>t?1:-1}static isObject(e){if(e==null)return!1;let t=typeof e;return t=="string"||t=="object"&&e.__enum__==null?!0:t=="function"?(e.__name__||e.__ename__)!=null:!1}static isEnumValue(e){return e!=null?e.__enum__!=null:!1}static deleteField(e,t){return Object.prototype.hasOwnProperty.call(e,t)?(delete e[t],!0):!1}static makeVarArgs(e){return function(){let t=Array.prototype.slice,l=arguments,i=t.call(l);return e(i)}}}Q.Reflect=qe,qe.__name__="Reflect";class Y{static string(e){return te.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}}Q.Std=Y,Y.__name__="Std";class gt{constructor(){this.b=""}}Q.StringBuf=gt,gt.__name__="StringBuf",Object.assign(gt.prototype,{__class__:gt});class He{static htmlEscape(e,t){let l="",i=0,n=e;for(;i<n.length;){let s=n,r=i++,a=s.charCodeAt(r);a>=55296&&a<=56319&&(a=a-55232<<10|s.charCodeAt(r+1)&1023);let h=a;h>=65536&&++i;let o=h;switch(o){case 34:t?l+=""":l+=String.fromCodePoint(o);break;case 38:l+="&";break;case 39:t?l+="'":l+=String.fromCodePoint(o);break;case 60:l+="<";break;case 62:l+=">";break;default:l+=String.fromCodePoint(o)}}return l}static isSpace(e,t){let l=c.cca(e,t);return l>8&&l<14?!0:l==32}static ltrim(e){let t=e.length,l=0;for(;l<t&&He.isSpace(e,l);)++l;return l>0?c.substr(e,l,t-l):e}static rtrim(e){let t=e.length,l=0;for(;l<t&&He.isSpace(e,t-l-1);)++l;return l>0?c.substr(e,0,t-l):e}static trim(e){return He.ltrim(He.rtrim(e))}static replace(e,t,l){return e.split(t).join(l)}}Q.StringTools=He,He.__name__="StringTools";var Lt=Ye.ValueType={__ename__:"ValueType",__constructs__:null,TNull:{_hx_name:"TNull",_hx_index:0,__enum__:"ValueType",toString:F},TInt:{_hx_name:"TInt",_hx_index:1,__enum__:"ValueType",toString:F},TFloat:{_hx_name:"TFloat",_hx_index:2,__enum__:"ValueType",toString:F},TBool:{_hx_name:"TBool",_hx_index:3,__enum__:"ValueType",toString:F},TObject:{_hx_name:"TObject",_hx_index:4,__enum__:"ValueType",toString:F},TFunction:{_hx_name:"TFunction",_hx_index:5,__enum__:"ValueType",toString:F},TClass:(x=function(b){return{_hx_index:6,c:b,__enum__:"ValueType",toString:F}},x._hx_name="TClass",x.__params__=["c"],x),TEnum:(x=function(b){return{_hx_index:7,e:b,__enum__:"ValueType",toString:F}},x._hx_name="TEnum",x.__params__=["e"],x),TUnknown:{_hx_name:"TUnknown",_hx_index:8,__enum__:"ValueType",toString:F}};Lt.__constructs__=[Lt.TNull,Lt.TInt,Lt.TFloat,Lt.TBool,Lt.TObject,Lt.TFunction,Lt.TClass,Lt.TEnum,Lt.TUnknown];class _e{static createInstance(e,t){let l=Function.prototype.bind.apply(e,[null].concat(t));return new l}static typeof(e){switch(typeof e){case"boolean":return Lt.TBool;case"function":return e.__name__||e.__ename__?Lt.TObject:Lt.TFunction;case"number":return Math.ceil(e)==e%2147483648?Lt.TInt:Lt.TFloat;case"object":if(e==null)return Lt.TNull;let t=e.__enum__;if(t!=null)return Lt.TEnum(Ye[t]);let l=te.getClass(e);return l!=null?Lt.TClass(l):Lt.TObject;case"string":return Lt.TClass(String);case"undefined":return Lt.TNull;default:return Lt.TUnknown}}static enumEq(e,t){if(e==t)return!0;try{let l=e.__enum__;if(l==null||l!=t.__enum__||e._hx_index!=t._hx_index)return!1;let n=Ye[l].__constructs__[e._hx_index].__params__,s=0;for(;s<n.length;){let r=n[s];if(++s,!_e.enumEq(e[r],t[r]))return!1}}catch{return!1}return!0}static enumParameters(e){let l=Ye[e.__enum__].__constructs__[e._hx_index].__params__;if(l!=null){let i=[],n=0;for(;n<l.length;){let s=l[n];++n,i.push(e[s])}return i}else return[]}}Q.Type=_e,_e.__name__="Type";class de{static toString(e){switch(e){case 0:return"Element";case 1:return"PCData";case 2:return"CData";case 3:return"Comment";case 4:return"DocType";case 5:return"ProcessingInstruction";case 6:return"Document"}}}class V{constructor(e){this.nodeType=e,this.children=[],this.attributeMap=new Ee}get(e){if(this.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));return this.attributeMap.h[e]}set(e,t){if(this.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));this.attributeMap.h[e]=t}exists(e){if(this.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));return Object.prototype.hasOwnProperty.call(this.attributeMap.h,e)}attributes(){if(this.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));return new Ei(this.attributeMap.h)}elements(){if(this.nodeType!=V.Document&&this.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));let e=[],t=0,l=this.children;for(;t<l.length;){let n=l[t];++t,n.nodeType==V.Element&&e.push(n)}let i=e;return new Il(i)}elementsNamed(e){if(this.nodeType!=V.Document&&this.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));let t=[],l=0,i=this.children;for(;l<i.length;){let s=i[l];++l;let r;if(s.nodeType==V.Element){if(s.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":de.toString(s.nodeType)));r=s.nodeName==e}else r=!1;r&&t.push(s)}let n=t;return new Il(n)}firstElement(){if(this.nodeType!=V.Document&&this.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));let e=0,t=this.children;for(;e<t.length;){let l=t[e];if(++e,l.nodeType==V.Element)return l}return null}addChild(e){if(this.nodeType!=V.Document&&this.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));e.parent!=null&&e.parent.removeChild(e),this.children.push(e),e.parent=this}removeChild(e){if(this.nodeType!=V.Document&&this.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));return c.remove(this.children,e)?(e.parent=null,!0):!1}toString(){return hi.print(this)}static createElement(e){let t=new V(V.Element);if(t.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeName=e,t}static createPCData(e){let t=new V(V.PCData);if(t.nodeType==V.Document||t.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createCData(e){let t=new V(V.CData);if(t.nodeType==V.Document||t.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createComment(e){let t=new V(V.Comment);if(t.nodeType==V.Document||t.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createDocType(e){let t=new V(V.DocType);if(t.nodeType==V.Document||t.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createProcessingInstruction(e){let t=new V(V.ProcessingInstruction);if(t.nodeType==V.Document||t.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createDocument(){return new V(V.Document)}}Q.Xml=V,V.__name__="Xml",Object.assign(V.prototype,{__class__:V});var Ol=Ye["haxe.StackItem"]={__ename__:"haxe.StackItem",__constructs__:null,CFunction:{_hx_name:"CFunction",_hx_index:0,__enum__:"haxe.StackItem",toString:F},Module:(x=function(b){return{_hx_index:1,m:b,__enum__:"haxe.StackItem",toString:F}},x._hx_name="Module",x.__params__=["m"],x),FilePos:(x=function(b,e,t,l){return{_hx_index:2,s:b,file:e,line:t,column:l,__enum__:"haxe.StackItem",toString:F}},x._hx_name="FilePos",x.__params__=["s","file","line","column"],x),Method:(x=function(b,e){return{_hx_index:3,classname:b,method:e,__enum__:"haxe.StackItem",toString:F}},x._hx_name="Method",x.__params__=["classname","method"],x),LocalFunction:(x=function(b){return{_hx_index:4,v:b,__enum__:"haxe.StackItem",toString:F}},x._hx_name="LocalFunction",x.__params__=["v"],x)};Ol.__constructs__=[Ol.CFunction,Ol.Module,Ol.FilePos,Ol.Method,Ol.LocalFunction];class Tn{static callStack(){return Pl.toHaxe(Pl.callStack())}}class Et{}Q["haxe.IMap"]=Et,Et.__name__="haxe.IMap",Et.__isInterface__=!0,Object.assign(Et.prototype,{__class__:Et});class C extends Error{constructor(e,t,l){super(e),this.message=e,this.__previousException=t,this.__nativeException=l??this}unwrap(){return this.__nativeException}toString(){return this.get_message()}get_message(){return this.message}get_native(){return this.__nativeException}static caught(e){return e instanceof C?e:e instanceof Error?new C(e.message,null,e):new _i(e,null,e)}static thrown(e){return e instanceof C?e.get_native():e instanceof Error?e:new _i(e)}}Q["haxe.Exception"]=C,C.__name__="haxe.Exception",C.__super__=Error,Object.assign(C.prototype,{__class__:C,__properties__:{get_native:"get_native",get_message:"get_message"}});class jl{constructor(e,t){this.high=e,this.low=t}}Q["haxe._Int64.___Int64"]=jl,jl.__name__="haxe._Int64.___Int64",Object.assign(jl.prototype,{__class__:jl});class Ri{static formatOutput(e,t){let l=Y.string(e);if(t==null)return l;let i=t.fileName+":"+t.lineNumber;if(t.customParams!=null){let n=0,s=t.customParams;for(;n<s.length;){let r=s[n];++n,l+=", "+Y.string(r)}}return i+": "+l}static trace(e,t){let l=Ri.formatOutput(e,t);typeof console<"u"&&console.log!=null&&console.log(l)}}Q["haxe.Log"]=Ri,Ri.__name__="haxe.Log";class Pl{static callStack(){let e=new Error(""),t=Pl.tryHaxeStack(e);if(typeof t>"u"){try{throw e}catch{}t=e.stack}return Pl.normalize(t,2)}static toHaxe(e,t){if(t==null&&(t=0),e==null)return[];if(typeof e=="string"){let l=e.split(`
|
|
2
|
+
`);l[0]=="Error"&&l.shift();let i=[],n=0,s=l.length;for(;n<s;){let r=n++;if(t>r)continue;let a=l[r],h=a.match(/^ at ([$A-Za-z0-9_. ]+) \(([^)]+):([0-9]+):([0-9]+)\)$/);if(h!=null){let o=h[1].split(".");o[0]=="$hxClasses"&&o.shift();let u=o.pop(),p=h[2],_=Y.parseInt(h[3]),m=Y.parseInt(h[4]);i.push(Ol.FilePos(u=="Anonymous function"?Ol.LocalFunction():u=="Global code"?null:Ol.Method(o.join("."),u),p,_,m))}else i.push(Ol.Module(He.trim(a)))}return i}else return t>0&&Array.isArray(e)?e.slice(t):e}static tryHaxeStack(e){if(e==null)return[];let t=Error.prepareStackTrace;Error.prepareStackTrace=Pl.prepareHxStackTrace;let l=e.stack;return Error.prepareStackTrace=t,l}static prepareHxStackTrace(e,t){let l=[],i=0;for(;i<t.length;){let n=t[i];++i,Pl.wrapCallSite!=null&&(n=Pl.wrapCallSite(n));let s=null,r=n.getFunctionName();if(r!=null){let o=r.lastIndexOf(".");if(o>=0){let u=r.substring(0,o),p=r.substring(o+1);s=Ol.Method(u,p)}else s=Ol.Method(null,r)}let a=n.getFileName(),h=a==null?-1:a.indexOf("file:");Pl.wrapCallSite!=null&&h>0&&(a=a.substring(h+6)),l.push(Ol.FilePos(s,a,n.getLineNumber(),n.getColumnNumber()))}return l}static normalize(e,t){if(t==null&&(t=0),Array.isArray(e)&&t>0)return e.slice(t);if(typeof e=="string"){switch(e.substring(0,6)){case`Error
|
|
3
|
+
`:case"Error:":++t;break;default:}return Pl.skipLines(e,t)}else return e}static skipLines(e,t,l){return l==null&&(l=0),t>0?(l=e.indexOf(`
|
|
4
|
+
`,l),l<0?"":Pl.skipLines(e,--t,l+1)):e.substring(l)}}Q["haxe.NativeStackTrace"]=Pl,Pl.__name__="haxe.NativeStackTrace";class fi{constructor(e){let t=this;this.id=setInterval(function(){t.run()},e)}stop(){this.id!=null&&(clearInterval(this.id),this.id=null)}run(){}static delay(e,t){let l=new fi(t);return l.run=function(){l.stop(),e()},l}}Q["haxe.Timer"]=fi,fi.__name__="haxe.Timer",Object.assign(fi.prototype,{__class__:fi});class _i extends C{constructor(e,t,l){super(String(e),t,l),this.value=e}unwrap(){return this.value}}Q["haxe.ValueException"]=_i,_i.__name__="haxe.ValueException",_i.__super__=C,Object.assign(_i.prototype,{__class__:_i});class mi{constructor(){}set(e,t){this.root=this.setLoop(e,t,this.root)}get(e){let t=this.root;for(;t!=null;){let l=this.compare(e,t.key);if(l==0)return t.value;l<0?t=t.left:t=t.right}return null}keys(){let e=[];return this.keysLoop(this.root,e),new Il(e)}setLoop(e,t,l){if(l==null)return new rl(null,e,t,null);let i=this.compare(e,l.key);if(i==0)return new rl(l.left,e,t,l.right,l==null?0:l._height);if(i<0){let n=this.setLoop(e,t,l.left);return this.balance(n,l.key,l.value,l.right)}else{let n=this.setLoop(e,t,l.right);return this.balance(l.left,l.key,l.value,n)}}keysLoop(e,t){e!=null&&(this.keysLoop(e.left,t),t.push(e.key),this.keysLoop(e.right,t))}balance(e,t,l,i){let n=e==null?0:e._height,s=i==null?0:i._height;if(n>s+2){let r=e.left,a=e.right;return(r==null?0:r._height)>=(a==null?0:a._height)?new rl(e.left,e.key,e.value,new rl(e.right,t,l,i)):new rl(new rl(e.left,e.key,e.value,e.right.left),e.right.key,e.right.value,new rl(e.right.right,t,l,i))}else if(s>n+2){let r=i.right,a=i.left;return(r==null?0:r._height)>(a==null?0:a._height)?new rl(new rl(e,t,l,i.left),i.key,i.value,i.right):new rl(new rl(e,t,l,i.left.left),i.left.key,i.left.value,new rl(i.left.right,i.key,i.value,i.right))}else return new rl(e,t,l,i,(n>s?n:s)+1)}compare(e,t){return qe.compare(e,t)}}Q["haxe.ds.BalancedTree"]=mi,mi.__name__="haxe.ds.BalancedTree",mi.__interfaces__=[Et],Object.assign(mi.prototype,{__class__:mi});class rl{constructor(e,t,l,i,n){if(n==null&&(n=-1),this.left=e,this.key=t,this.value=l,this.right=i,n==-1){let s,r=this.left,a=this.right;if((r==null?0:r._height)>(a==null?0:a._height)){let h=this.left;s=h==null?0:h._height}else{let h=this.right;s=h==null?0:h._height}this._height=s+1}else this._height=n}}Q["haxe.ds.TreeNode"]=rl,rl.__name__="haxe.ds.TreeNode",Object.assign(rl.prototype,{__class__:rl});class ri extends mi{constructor(){super()}compare(e,t){let l=e._hx_index-t._hx_index;if(l!=0)return l;let i=_e.enumParameters(e),n=_e.enumParameters(t);return i.length==0&&n.length==0?0:this.compareArgs(i,n)}compareArgs(e,t){let l=e.length-t.length;if(l!=0)return l;let i=0,n=e.length;for(;i<n;){let s=i++,r=this.compareArg(e[s],t[s]);if(r!=0)return r}return 0}compareArg(e,t){return qe.isEnumValue(e)&&qe.isEnumValue(t)?this.compare(e,t):e instanceof Array&&t instanceof Array?this.compareArgs(e,t):qe.compare(e,t)}}Q["haxe.ds.EnumValueMap"]=ri,ri.__name__="haxe.ds.EnumValueMap",ri.__interfaces__=[Et],ri.__super__=mi,Object.assign(ri.prototype,{__class__:ri});class Kl{constructor(){this.h={}}set(e,t){this.h[e]=t}get(e){return this.h[e]}keys(){let e=[];for(var t in this.h)this.h.hasOwnProperty(t)&&e.push(+t);return new Il(e)}}Q["haxe.ds.IntMap"]=Kl,Kl.__name__="haxe.ds.IntMap",Kl.__interfaces__=[Et],Object.assign(Kl.prototype,{__class__:Kl});class Ui{constructor(){this.length=0}add(e){let t=new Ci(e,null);this.h==null?this.h=t:this.q.next=t,this.q=t,this.length++}push(e){let t=new Ci(e,this.h);this.h=t,this.q==null&&(this.q=t),this.length++}pop(){if(this.h==null)return null;let e=this.h.item;return this.h=this.h.next,this.h==null&&(this.q=null),this.length--,e}}Q["haxe.ds.List"]=Ui,Ui.__name__="haxe.ds.List",Object.assign(Ui.prototype,{__class__:Ui});class Ci{constructor(e,t){this.item=e,this.next=t}}Q["haxe.ds._List.ListNode"]=Ci,Ci.__name__="haxe.ds._List.ListNode",Object.assign(Ci.prototype,{__class__:Ci});class Ti{constructor(){this.h={__keys__:{}}}set(e,t){let l=e.__id__;l==null&&(l=e.__id__=on.$haxeUID++),this.h[l]=t,this.h.__keys__[l]=e}get(e){return this.h[e.__id__]}keys(){let e=[];for(var t in this.h.__keys__)this.h.hasOwnProperty(t)&&e.push(this.h.__keys__[t]);return new Il(e)}}Q["haxe.ds.ObjectMap"]=Ti,Ti.__name__="haxe.ds.ObjectMap",Ti.__interfaces__=[Et],Object.assign(Ti.prototype,{__class__:Ti});class Ee{constructor(){this.h=Object.create(null)}get(e){return this.h[e]}set(e,t){this.h[e]=t}keys(){return new Ei(this.h)}}Q["haxe.ds.StringMap"]=Ee,Ee.__name__="haxe.ds.StringMap",Ee.__interfaces__=[Et],Object.assign(Ee.prototype,{__class__:Ee});class Ei{constructor(e){this.h=e,this.keys=Object.keys(e),this.length=this.keys.length,this.current=0}hasNext(){return this.current<this.length}next(){return this.keys[this.current++]}}Q["haxe.ds._StringMap.StringMapKeyIterator"]=Ei,Ei.__name__="haxe.ds._StringMap.StringMapKeyIterator",Object.assign(Ei.prototype,{__class__:Ei});class pn{static blit(e,t,l,i,n){if(e==l){if(t<i){let s=t+n,r=i+n,a=0,h=n;for(;a<h;){let o=a++;--s,--r,e[r]=e[s]}}else if(t>i){let s=t,r=i,a=0,h=n;for(;a<h;){let o=a++;e[r]=e[s],++s,++r}}}else{let s=0,r=n;for(;s<r;){let a=s++;l[i+a]=e[t+a]}}}}class De{constructor(e){switch(e){case".":case"..":this.dir=e,this.file="";return}let t=e.lastIndexOf("/"),l=e.lastIndexOf("\\");t<l?(this.dir=c.substr(e,0,l),e=c.substr(e,l+1,null),this.backslash=!0):l<t?(this.dir=c.substr(e,0,t),e=c.substr(e,t+1,null)):this.dir=null;let i=e.lastIndexOf(".");i!=-1?(this.ext=c.substr(e,i+1,null),this.file=c.substr(e,0,i)):(this.ext=null,this.file=e)}toString(){return(this.dir==null?"":this.dir+(this.backslash?"\\":"/"))+this.file+(this.ext==null?"":"."+this.ext)}static withoutDirectory(e){let t=new De(e);return t.dir=null,t.toString()}static directory(e){let t=new De(e);return t.dir==null?"":t.dir}static join(e){let t=[],l=0,i=e;for(;l<i.length;){let h=i[l];++l,h!=null&&h!=""&&t.push(h)}let n=t;if(n.length==0)return"";let s=n[0],r=1,a=n.length;for(;r<a;){let h=r++;s=De.addTrailingSlash(s),s+=n[h]}return De.normalize(s)}static normalize(e){let t="/";if(e=e.split("\\").join(t),e==t)return t;let l=[],i=0,n=e.split(t);for(;i<n.length;){let p=n[i];++i,p==".."&&l.length>0&&l[l.length-1]!=".."?l.pop():p==""?(l.length>0||c.cca(e,0)==47)&&l.push(p):p!="."&&l.push(p)}let s=l.join(t),r="",a=!1,h=!1,o=0,u=s;for(;o<u.length;){let p=u,_=o++,m=p.charCodeAt(_);m>=55296&&m<=56319&&(m=m-55232<<10|p.charCodeAt(_+1)&1023);let f=m;f>=65536&&++o;let g=f;switch(g){case 47:if(!a)h=!0;else{let w=g;a=!1,h&&(r+="/",h=!1),r+=String.fromCodePoint(w)}break;case 58:r+=":",a=!0;break;default:let d=g;a=!1,h&&(r+="/",h=!1),r+=String.fromCodePoint(d)}}return r}static addTrailingSlash(e){if(e.length==0)return"/";let t=e.lastIndexOf("/"),l=e.lastIndexOf("\\");return t<l?l!=e.length-1?e+"\\":e:t!=e.length-1?e+"/":e}static isAbsolute(e){return!!(e.startsWith("/")||e.charAt(1)==":"||e.startsWith("\\\\"))}}Q["haxe.io.Path"]=De,De.__name__="haxe.io.Path",Object.assign(De.prototype,{__class__:De});class Il{constructor(e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}}Q["haxe.iterators.ArrayIterator"]=Il,Il.__name__="haxe.iterators.ArrayIterator",Object.assign(Il.prototype,{__class__:Il});var tl=Ye["haxe.rtti.CType"]={__ename__:"haxe.rtti.CType",__constructs__:null,CUnknown:{_hx_name:"CUnknown",_hx_index:0,__enum__:"haxe.rtti.CType",toString:F},CEnum:(x=function(b,e){return{_hx_index:1,name:b,params:e,__enum__:"haxe.rtti.CType",toString:F}},x._hx_name="CEnum",x.__params__=["name","params"],x),CClass:(x=function(b,e){return{_hx_index:2,name:b,params:e,__enum__:"haxe.rtti.CType",toString:F}},x._hx_name="CClass",x.__params__=["name","params"],x),CTypedef:(x=function(b,e){return{_hx_index:3,name:b,params:e,__enum__:"haxe.rtti.CType",toString:F}},x._hx_name="CTypedef",x.__params__=["name","params"],x),CFunction:(x=function(b,e){return{_hx_index:4,args:b,ret:e,__enum__:"haxe.rtti.CType",toString:F}},x._hx_name="CFunction",x.__params__=["args","ret"],x),CAnonymous:(x=function(b){return{_hx_index:5,fields:b,__enum__:"haxe.rtti.CType",toString:F}},x._hx_name="CAnonymous",x.__params__=["fields"],x),CDynamic:(x=function(b){return{_hx_index:6,t:b,__enum__:"haxe.rtti.CType",toString:F}},x._hx_name="CDynamic",x.__params__=["t"],x),CAbstract:(x=function(b,e){return{_hx_index:7,name:b,params:e,__enum__:"haxe.rtti.CType",toString:F}},x._hx_name="CAbstract",x.__params__=["name","params"],x)};tl.__constructs__=[tl.CUnknown,tl.CEnum,tl.CClass,tl.CTypedef,tl.CFunction,tl.CAnonymous,tl.CDynamic,tl.CAbstract];var zt=Ye["haxe.rtti.Rights"]={__ename__:"haxe.rtti.Rights",__constructs__:null,RNormal:{_hx_name:"RNormal",_hx_index:0,__enum__:"haxe.rtti.Rights",toString:F},RNo:{_hx_name:"RNo",_hx_index:1,__enum__:"haxe.rtti.Rights",toString:F},RCall:(x=function(b){return{_hx_index:2,m:b,__enum__:"haxe.rtti.Rights",toString:F}},x._hx_name="RCall",x.__params__=["m"],x),RMethod:{_hx_name:"RMethod",_hx_index:3,__enum__:"haxe.rtti.Rights",toString:F},RDynamic:{_hx_name:"RDynamic",_hx_index:4,__enum__:"haxe.rtti.Rights",toString:F},RInline:{_hx_name:"RInline",_hx_index:5,__enum__:"haxe.rtti.Rights",toString:F}};zt.__constructs__=[zt.RNormal,zt.RNo,zt.RCall,zt.RMethod,zt.RDynamic,zt.RInline];var Jl=Ye["haxe.rtti.TypeTree"]={__ename__:"haxe.rtti.TypeTree",__constructs__:null,TPackage:(x=function(b,e,t){return{_hx_index:0,name:b,full:e,subs:t,__enum__:"haxe.rtti.TypeTree",toString:F}},x._hx_name="TPackage",x.__params__=["name","full","subs"],x),TClassdecl:(x=function(b){return{_hx_index:1,c:b,__enum__:"haxe.rtti.TypeTree",toString:F}},x._hx_name="TClassdecl",x.__params__=["c"],x),TEnumdecl:(x=function(b){return{_hx_index:2,e:b,__enum__:"haxe.rtti.TypeTree",toString:F}},x._hx_name="TEnumdecl",x.__params__=["e"],x),TTypedecl:(x=function(b){return{_hx_index:3,t:b,__enum__:"haxe.rtti.TypeTree",toString:F}},x._hx_name="TTypedecl",x.__params__=["t"],x),TAbstractdecl:(x=function(b){return{_hx_index:4,a:b,__enum__:"haxe.rtti.TypeTree",toString:F}},x._hx_name="TAbstractdecl",x.__params__=["a"],x)};Jl.__constructs__=[Jl.TPackage,Jl.TClassdecl,Jl.TEnumdecl,Jl.TTypedecl,Jl.TAbstractdecl];class ht{static typeInfos(e){let t;switch(e._hx_index){case 0:let l=e.name,i=e.full,n=e.subs;throw C.thrown("Unexpected Package");case 1:t=e.c;break;case 2:t=e.e;break;case 3:t=e.t;break;case 4:t=e.a;break}return t}static leq(e,t,l){let i=0,n=l,s=0;for(;s<t.length;){let r=t[s];if(++s,i>=n.length)return!1;let a=n[i++];if(!e(r,a))return!1}return!(i<n.length)}static rightsEq(e,t){if(e==t)return!0;if(e._hx_index==2){let l=e.m;if(t._hx_index==2){let i=t.m;return l==i}}return!1}static typeEq(e,t){switch(e._hx_index){case 0:return t==tl.CUnknown;case 1:let l=e.name,i=e.params;if(t._hx_index==1){let f=t.name,g=t.params;return l==f?ht.leq(ht.typeEq,i,g):!1}break;case 2:let n=e.name,s=e.params;if(t._hx_index==2){let f=t.name,g=t.params;return n==f?ht.leq(ht.typeEq,s,g):!1}break;case 3:let r=e.name,a=e.params;if(t._hx_index==3){let f=t.name,g=t.params;return r==f?ht.leq(ht.typeEq,a,g):!1}break;case 4:let h=e.args,o=e.ret;if(t._hx_index==4){let f=t.args,g=t.ret;return ht.leq(function(d,w){return d.name==w.name&&d.opt==w.opt?ht.typeEq(d.t,w.t):!1},h,f)?ht.typeEq(o,g):!1}break;case 5:let u=e.fields;if(t._hx_index==5){let f=t.fields;return ht.leq(function(g,d){return ht.fieldEq(g,d)},u,f)}break;case 6:let p=e.t;if(t._hx_index==6){let f=t.t;return p==null!=(f==null)?!1:p!=null?ht.typeEq(p,f):!0}break;case 7:let _=e.name,m=e.params;if(t._hx_index==7){let f=t.name,g=t.params;return _==f?ht.leq(ht.typeEq,m,g):!1}break}return!1}static fieldEq(e,t){return!(e.name!=t.name||!ht.typeEq(e.type,t.type)||e.isPublic!=t.isPublic||e.doc!=t.doc||!ht.rightsEq(e.get,t.get)||!ht.rightsEq(e.set,t.set)||e.params==null!=(t.params==null)||e.params!=null&&e.params.join(":")!=t.params.join(":"))}static constructorEq(e,t){return!(e.name!=t.name||e.doc!=t.doc||e.args==null!=(t.args==null)||e.args!=null&&!ht.leq(function(l,i){return l.name==i.name&&l.opt==i.opt?ht.typeEq(l.t,i.t):!1},e.args,t.args))}}Q["haxe.rtti.TypeApi"]=ht,ht.__name__="haxe.rtti.TypeApi";class Vi{constructor(){this.root=[]}process(e,t){if(this.curplatform=t,e.nodeType!=V.Document&&e.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.xroot(e)}mergeRights(e,t){return e.get==zt.RInline&&e.set==zt.RNo&&t.get==zt.RNormal&&t.set==zt.RMethod?(e.get=zt.RNormal,e.set=zt.RMethod,!0):_e.enumEq(e.get,t.get)?_e.enumEq(e.set,t.set):!1}mergeDoc(e,t){return e.doc==null?e.doc=t.doc:t.doc==null&&(t.doc=e.doc),!0}mergeFields(e,t){return ht.fieldEq(e,t)?!0:e.name==t.name&&(this.mergeRights(e,t)||this.mergeRights(t,e))&&this.mergeDoc(e,t)?ht.fieldEq(e,t):!1}newField(e,t){}mergeClasses(e,t){if(e.isInterface!=t.isInterface)return!1;this.curplatform!=null&&e.platforms.push(this.curplatform),e.isExtern!=t.isExtern&&(e.isExtern=!1);let l=0,i=t.fields;for(;l<i.length;){let r=i[l];++l;let a=null,h=0,o=e.fields;for(;h<o.length;){let u=o[h];if(++h,this.mergeFields(u,r)){a=u;break}}a==null?(this.newField(e,r),e.fields.push(r)):this.curplatform!=null&&a.platforms.push(this.curplatform)}let n=0,s=t.statics;for(;n<s.length;){let r=s[n];++n;let a=null,h=0,o=e.statics;for(;h<o.length;){let u=o[h];if(++h,this.mergeFields(u,r)){a=u;break}}a==null?(this.newField(e,r),e.statics.push(r)):this.curplatform!=null&&a.platforms.push(this.curplatform)}return!0}mergeEnums(e,t){if(e.isExtern!=t.isExtern)return!1;this.curplatform!=null&&e.platforms.push(this.curplatform);let l=0,i=t.constructors;for(;l<i.length;){let n=i[l];++l;let s=null,r=0,a=e.constructors;for(;r<a.length;){let h=a[r];if(++r,ht.constructorEq(h,n)){s=h;break}}s==null?e.constructors.push(n):this.curplatform!=null&&s.platforms.push(this.curplatform)}return!0}mergeTypedefs(e,t){return this.curplatform==null?!1:(e.platforms.push(this.curplatform),e.types.h[this.curplatform]=t.type,!0)}mergeAbstracts(e,t){if(this.curplatform==null||e.to.length!=t.to.length||e.from.length!=t.from.length)return!1;let l=0,i=e.to.length;for(;l<i;){let r=l++;if(!ht.typeEq(e.to[r].t,t.to[r].t))return!1}let n=0,s=e.from.length;for(;n<s;){let r=n++;if(!ht.typeEq(e.from[r].t,t.from[r].t))return!1}return t.impl!=null&&this.mergeClasses(e.impl,t.impl),e.platforms.push(this.curplatform),!0}merge(e){let t=ht.typeInfos(e),l=t.path.split("."),i=this.root,n=[];l.pop();let s=0;for(;s<l.length;){let a=l[s];++s;let h=!1,o=0;for(;o<i.length;){let u=i[o];if(++o,u._hx_index==0){let p=u.full,_=u.name,m=u.subs;if(_==a){h=!0,i=m;break}}}if(n.push(a),!h){let u=[];i.push(Jl.TPackage(a,n.join("."),u)),i=u}}let r=0;for(;r<i.length;){let a=i[r];++r;let h;if(a._hx_index==0){let u=a.name,p=a.full,_=a.subs;h=!0}else h=!1;if(h)continue;let o=ht.typeInfos(a);if(o.path==t.path){let u=!0;if(o.doc==null!=(t.doc==null)&&(t.doc==null?t.doc=o.doc:o.doc=t.doc),o.path=="haxe._Int64.NativeInt64")continue;if(o.module==t.module&&o.doc==t.doc&&o.isPrivate==t.isPrivate)switch(a._hx_index){case 0:let _=a.name,m=a.full,f=a.subs;u=!1;break;case 1:let g=a.c;if(e._hx_index==1){let S=e.c;if(this.mergeClasses(g,S))return}else u=!1;break;case 2:let d=a.e;if(e._hx_index==2){let S=e.e;if(this.mergeEnums(d,S))return}else u=!1;break;case 3:let w=a.t;if(e._hx_index==3){let S=e.t;if(this.mergeTypedefs(w,S))return}break;case 4:let y=a.a;if(e._hx_index==4){let S=e.a;if(this.mergeAbstracts(y,S))return}else u=!1;break}let p=o.module!=t.module?"module "+t.module+" should be "+o.module:o.doc!=t.doc?"documentation is different":o.isPrivate!=t.isPrivate?"private flag is different":u?"could not merge definition":"type kind is different";throw C.thrown("Incompatibilities between "+o.path+" in "+o.platforms.join(",")+" and "+this.curplatform+" ("+p+")")}}i.push(e)}mkPath(e){return e}mkTypeParams(e){let t=e.split(":");return t[0]==""?[]:t}mkRights(e){switch(e){case"dynamic":return zt.RDynamic;case"inline":return zt.RInline;case"method":return zt.RMethod;case"null":return zt.RNo;default:return zt.RCall(e)}}xerror(e){let t;if(e.nodeType==V.Document)t="Document";else{if(e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));t=e.nodeName}throw C.thrown("Invalid "+t)}xroot(e){let t=e.elements();for(;t.hasNext();){let l=t.next();this.merge(this.processElement(l))}}processElement(e){if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(e.nodeType==null?"null":de.toString(e.nodeType)));let t=e,l;if(t.nodeType==V.Document)l="Document";else{if(t.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(t.nodeType==null?"null":de.toString(t.nodeType)));l=t.nodeName}switch(l){case"abstract":return Jl.TAbstractdecl(this.xabstract(t));case"class":return Jl.TClassdecl(this.xclass(t));case"enum":return Jl.TEnumdecl(this.xenum(t));case"typedef":return Jl.TTypedecl(this.xtypedef(t));default:return this.xerror(t)}}xmeta(e){let t=[],l=0,i=wn.resolve(e,"m");for(;l<i.length;){let n=i[l];++l;let s=[],r=0,a=wn.resolve(n,"e");for(;r<a.length;){let h=a[r];++r,s.push(ai.get_innerHTML(h))}t.push({name:Xe.resolve(n,"n"),params:s})}return t}xoverloads(e){let t=[],l=e.elements();for(;l.hasNext();){let i=l.next();t.push(this.xclassfield(i))}return t}xpath(e){let t=this.mkPath(Xe.resolve(e,"path")),l=[],i=e.elements();for(;i.hasNext();){let n=i.next();l.push(this.xtype(n))}return{path:t,params:l}}xclass(e){let t=null,l=null,i=null,n=[],s=[],r=[],a=[],h=e.exists("interface"),o=e.elements();for(;o.hasNext();){let u=o.next(),p;if(u.nodeType==V.Document)p="Document";else{if(u.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(u.nodeType==null?"null":de.toString(u.nodeType)));p=u.nodeName}switch(p){case"extends":h?n.push(this.xpath(u)):t=this.xpath(u);break;case"haxe_doc":l=ai.get_innerData(u);break;case"haxe_dynamic":let _=u.firstElement();if(_.nodeType!=V.Document&&_.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(_.nodeType==null?"null":de.toString(_.nodeType)));i=this.xtype(_);break;case"implements":n.push(this.xpath(u));break;case"meta":a=this.xmeta(u);break;default:u.exists("static")?r.push(this.xclassfield(u)):s.push(this.xclassfield(u))}}return{file:al.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:al.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:l,isPrivate:e.exists("private"),isExtern:e.exists("extern"),isFinal:e.exists("final"),isInterface:h,params:this.mkTypeParams(Xe.resolve(e,"params")),superClass:t,interfaces:n,fields:s,statics:r,tdynamic:i,platforms:this.defplat(),meta:a}}xclassfield(e,t){t==null&&(t=!1);let l=e.elements(),i=this.xtype(l.next()),n=null,s=[],r=null,a=l;for(;a.hasNext();){let o=a.next(),u;if(o.nodeType==V.Document)u="Document";else{if(o.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(o.nodeType==null?"null":de.toString(o.nodeType)));u=o.nodeName}switch(u){case"haxe_doc":n=ai.get_innerData(o);break;case"meta":s=this.xmeta(o);break;case"overloads":r=this.xoverloads(o);break;default:this.xerror(o)}}let h;if(e.nodeType==V.Document)h="Document";else{if(e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));h=e.nodeName}return{name:h,type:i,isPublic:e.exists("public")||t,isFinal:e.exists("final"),isOverride:e.exists("override"),line:al.resolve(e,"line")?Y.parseInt(Xe.resolve(e,"line")):null,doc:n,get:al.resolve(e,"get")?this.mkRights(Xe.resolve(e,"get")):zt.RNormal,set:al.resolve(e,"set")?this.mkRights(Xe.resolve(e,"set")):zt.RNormal,params:al.resolve(e,"params")?this.mkTypeParams(Xe.resolve(e,"params")):[],platforms:this.defplat(),meta:s,overloads:r,expr:al.resolve(e,"expr")?Xe.resolve(e,"expr"):null}}xenum(e){let t=[],l=null,i=[],n=e.elements();for(;n.hasNext();){let s=n.next(),r;if(s.nodeType==V.Document)r="Document";else{if(s.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":de.toString(s.nodeType)));r=s.nodeName}if(r=="haxe_doc")l=ai.get_innerData(s);else{let a;if(s.nodeType==V.Document)a="Document";else{if(s.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":de.toString(s.nodeType)));a=s.nodeName}a=="meta"?i=this.xmeta(s):t.push(this.xenumfield(s))}}return{file:al.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:al.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:l,isPrivate:e.exists("private"),isExtern:e.exists("extern"),params:this.mkTypeParams(Xe.resolve(e,"params")),constructors:t,platforms:this.defplat(),meta:i}}xenumfield(e){let t=null,l=e.elementsNamed("haxe_doc"),i=l.hasNext()?l.next():null,n=En.resolve(e,"meta")?this.xmeta(xn.resolve(e,"meta")):[];if(al.resolve(e,"a")){let a=Xe.resolve(e,"a").split(":"),h=e.elements();t=[];let o=0;for(;o<a.length;){let u=a[o];++o;let p=!1;u.charAt(0)=="?"&&(p=!0,u=c.substr(u,1,null)),t.push({name:u,opt:p,t:this.xtype(h.next())})}}let s;if(e.nodeType==V.Document)s="Document";else{if(e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));s=e.nodeName}let r;if(i==null)r=null;else{if(i.nodeType!=V.Document&&i.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(i.nodeType==null?"null":de.toString(i.nodeType)));r=ai.get_innerData(i)}return{name:s,args:t,doc:r,meta:n,platforms:this.defplat()}}xabstract(e){let t=null,l=null,i=null,n=[],s=[],r=[],a=e.elements();for(;a.hasNext();){let h=a.next(),o;if(h.nodeType==V.Document)o="Document";else{if(h.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(h.nodeType==null?"null":de.toString(h.nodeType)));o=h.nodeName}switch(o){case"from":let u=h.elements();for(;u.hasNext();){let m=u.next(),f=m.firstElement();if(f.nodeType!=V.Document&&f.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(f.nodeType==null?"null":de.toString(f.nodeType)));r.push({t:this.xtype(f),field:al.resolve(m,"field")?Xe.resolve(m,"field"):null})}break;case"haxe_doc":t=ai.get_innerData(h);break;case"impl":l=this.xclass(xn.resolve(h,"class"));break;case"meta":n=this.xmeta(h);break;case"this":let p=h.firstElement();if(p.nodeType!=V.Document&&p.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(p.nodeType==null?"null":de.toString(p.nodeType)));i=this.xtype(p);break;case"to":let _=h.elements();for(;_.hasNext();){let m=_.next(),f=m.firstElement();if(f.nodeType!=V.Document&&f.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(f.nodeType==null?"null":de.toString(f.nodeType)));s.push({t:this.xtype(f),field:al.resolve(m,"field")?Xe.resolve(m,"field"):null})}break;default:this.xerror(h)}}return{file:al.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:al.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:t,isPrivate:e.exists("private"),params:this.mkTypeParams(Xe.resolve(e,"params")),platforms:this.defplat(),meta:n,athis:i,to:s,from:r,impl:l}}xtypedef(e){let t=null,l=null,i=[],n=e.elements();for(;n.hasNext();){let r=n.next(),a;if(r.nodeType==V.Document)a="Document";else{if(r.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":de.toString(r.nodeType)));a=r.nodeName}if(a=="haxe_doc")t=ai.get_innerData(r);else{let h;if(r.nodeType==V.Document)h="Document";else{if(r.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":de.toString(r.nodeType)));h=r.nodeName}h=="meta"?i=this.xmeta(r):l=this.xtype(r)}}let s=new Ee;return this.curplatform!=null&&(s.h[this.curplatform]=l),{file:al.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:al.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:t,isPrivate:e.exists("private"),params:this.mkTypeParams(Xe.resolve(e,"params")),type:l,types:s,platforms:this.defplat(),meta:i}}xtype(e){let t;if(e.nodeType==V.Document)t="Document";else{if(e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));t=e.nodeName}switch(t){case"a":let l=[],i=e.elements();for(;i.hasNext();){let m=i.next(),f=this.xclassfield(m,!0);f.platforms=[],l.push(f)}return tl.CAnonymous(l);case"c":return tl.CClass(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"d":let n=null,s=e.firstElement();if(s!=null){if(s.nodeType!=V.Document&&s.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(s.nodeType==null?"null":de.toString(s.nodeType)));n=this.xtype(s)}return tl.CDynamic(n);case"e":return tl.CEnum(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"f":let r=[],a=Xe.resolve(e,"a").split(":"),h=0,o=a,u=al.resolve(e,"v")?new Il(Xe.resolve(e,"v").split(":")):null,p=e.elements();for(;p.hasNext();){let m=p.next(),f=!1,g=h<o.length?o[h++]:null;g==null&&(g=""),g.charAt(0)=="?"&&(f=!0,g=c.substr(g,1,null));let d=u==null||u.current>=u.array.length?null:u.array[u.current++];r.push({name:g,opt:f,t:this.xtype(m),value:d==""?null:d})}let _=r[r.length-1];return c.remove(r,_),tl.CFunction(r,_.t);case"t":return tl.CTypedef(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"unknown":return tl.CUnknown;case"x":return tl.CAbstract(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));default:return this.xerror(e)}}xtypeparams(e){let t=[],l=e.elements();for(;l.hasNext();){let i=l.next();t.push(this.xtype(i))}return t}defplat(){let e=[];return this.curplatform!=null&&e.push(this.curplatform),e}}Q["haxe.rtti.XmlParser"]=Vi,Vi.__name__="haxe.rtti.XmlParser",Object.assign(Vi.prototype,{__class__:Vi});class xn{static resolve(e,t){let l=e.elementsNamed(t).next();if(l==null){let i;if(e.nodeType==V.Document)i="Document";else{if(e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));i=e.nodeName}throw C.thrown(i+" is missing element "+t)}if(l.nodeType!=V.Document&&l.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(l.nodeType==null?"null":de.toString(l.nodeType)));return l}}class Xe{static resolve(e,t){if(e.nodeType==V.Document)throw C.thrown("Cannot access document attribute "+t);let l=e.get(t);if(l==null)throw e.nodeType!=V.Element?C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType))):C.thrown(e.nodeName+" is missing attribute "+t);return l}}class al{static resolve(e,t){if(e.nodeType==V.Document)throw C.thrown("Cannot access document attribute "+t);return e.exists(t)}}class En{static resolve(e,t){return e.elementsNamed(t).hasNext()}}class wn{static resolve(e,t){let l=[],i=e.elementsNamed(t);for(;i.hasNext();){let n=i.next();if(n.nodeType!=V.Document&&n.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(n.nodeType==null?"null":de.toString(n.nodeType)));l.push(n)}return l}}class ai{static get_innerData(e){if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let t=0,l=e.children;if(t>=l.length){let n;if(e.nodeType==V.Document)n="Document";else{if(e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));n=e.nodeName}throw C.thrown(n+" does not have data")}let i=l[t++];if(t<l.length){let n=l[t++],s;if(i.nodeType==V.PCData&&n.nodeType==V.CData){if(i.nodeType==V.Document||i.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(i.nodeType==null?"null":de.toString(i.nodeType)));s=He.trim(i.nodeValue)==""}else s=!1;if(s){if(t>=l.length){if(n.nodeType==V.Document||n.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":de.toString(n.nodeType)));return n.nodeValue}let a=l[t++],h;if(a.nodeType==V.PCData){if(a.nodeType==V.Document||a.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(a.nodeType==null?"null":de.toString(a.nodeType)));h=He.trim(a.nodeValue)==""}else h=!1;if(h&&t>=l.length){if(n.nodeType==V.Document||n.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":de.toString(n.nodeType)));return n.nodeValue}}let r;if(e.nodeType==V.Document)r="Document";else{if(e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));r=e.nodeName}throw C.thrown(r+" does not only have data")}if(i.nodeType!=V.PCData&&i.nodeType!=V.CData){let n;if(e.nodeType==V.Document)n="Document";else{if(e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));n=e.nodeName}throw C.thrown(n+" does not have data")}if(i.nodeType==V.Document||i.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(i.nodeType==null?"null":de.toString(i.nodeType)));return i.nodeValue}static get_innerHTML(e){let t="";if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let l=0,i=e.children;for(;l<i.length;){let n=i[l++];t+=Y.string(hi.print(n))}return t}}ai.__properties__={get_innerHTML:"get_innerHTML",get_innerData:"get_innerData"};class It{constructor(e,t,l){this.xml=t,this.message=e,this.position=l,this.lineNumber=1,this.positionAtLine=0;let i=0,n=l;for(;i<n;){let s=i++,r=t.charCodeAt(s);r==10?(this.lineNumber++,this.positionAtLine=0):r!=13&&this.positionAtLine++}}toString(){return te.getClass(this).__name__+": "+this.message+" at line "+this.lineNumber+" char "+this.positionAtLine}}Q["haxe.xml.XmlParserException"]=It,It.__name__="haxe.xml.XmlParserException",Object.assign(It.prototype,{__class__:It});class ei{static parse(e,t){t==null&&(t=!1);let l=V.createDocument();return ei.doParse(e,t,0,l),l}static doParse(e,t,l,i){l==null&&(l=0);let n=null,s=1,r=1,a=null,h=0,o=0,u=0,p=new gt,_=1,m=-1;for(;l<e.length;){let f=e.charCodeAt(l);switch(s){case 0:switch(f){case 9:case 10:case 13:case 32:break;default:s=r;continue}break;case 1:if(f==60)s=0,r=2;else{h=l,s=13;continue}break;case 2:switch(f){case 33:if(e.charCodeAt(l+1)==91){if(l+=2,c.substr(e,l,6).toUpperCase()!="CDATA[")throw C.thrown(new It("Expected <![CDATA[",e,l));l+=5,s=17,h=l+1}else if(e.charCodeAt(l+1)==68||e.charCodeAt(l+1)==100){if(c.substr(e,l+2,6).toUpperCase()!="OCTYPE")throw C.thrown(new It("Expected <!DOCTYPE",e,l));l+=8,s=16,h=l+1}else{if(e.charCodeAt(l+1)!=45||e.charCodeAt(l+2)!=45)throw C.thrown(new It("Expected <!--",e,l));l+=2,s=15,h=l+1}break;case 47:if(i==null)throw C.thrown(new It("Expected node name",e,l));h=l+1,s=0,r=10;break;case 63:s=14,h=l;break;default:s=3,h=l;continue}break;case 3:if(!(f>=97&&f<=122||f>=65&&f<=90||f>=48&&f<=57||f==58||f==46||f==95||f==45)){if(l==h)throw C.thrown(new It("Expected node name",e,l));n=V.createElement(c.substr(e,h,l-h)),i.addChild(n),++o,s=0,r=4;continue}break;case 4:switch(f){case 47:s=11;break;case 62:s=9;break;default:s=5,h=l;continue}break;case 5:if(!(f>=97&&f<=122||f>=65&&f<=90||f>=48&&f<=57||f==58||f==46||f==95||f==45)){if(h==l)throw C.thrown(new It("Expected attribute name",e,l));if(a=c.substr(e,h,l-h),n.exists(a))throw C.thrown(new It("Duplicate attribute ["+a+"]",e,l));s=0,r=6;continue}break;case 6:if(f==61)s=0,r=7;else throw C.thrown(new It("Expected =",e,l));break;case 7:switch(f){case 34:case 39:p=new gt,s=8,h=l+1,m=f;break;default:throw C.thrown(new It('Expected "',e,l))}break;case 8:switch(f){case 38:let g=l-h;p.b+=g==null?c.substr(e,h,null):c.substr(e,h,g),s=18,_=8,h=l+1;break;case 60:case 62:if(t)throw C.thrown(new It("Invalid unescaped "+String.fromCodePoint(f)+" in attribute value",e,l));if(f==m){let d=l-h;p.b+=d==null?c.substr(e,h,null):c.substr(e,h,d);let w=p.b;p=new gt,n.set(a,w),s=0,r=4}break;default:if(f==m){let d=l-h;p.b+=d==null?c.substr(e,h,null):c.substr(e,h,d);let w=p.b;p=new gt,n.set(a,w),s=0,r=4}}break;case 9:l=ei.doParse(e,t,l,n),h=l,s=1;break;case 10:if(!(f>=97&&f<=122||f>=65&&f<=90||f>=48&&f<=57||f==58||f==46||f==95||f==45)){if(h==l)throw C.thrown(new It("Expected node name",e,l));let g=c.substr(e,h,l-h);if(i==null||i.nodeType!=0)throw C.thrown(new It("Unexpected </"+g+">, tag is not open",e,l));if(i.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(i.nodeType==null?"null":de.toString(i.nodeType)));if(g!=i.nodeName)throw i.nodeType!=V.Element?C.thrown("Bad node type, expected Element but found "+(i.nodeType==null?"null":de.toString(i.nodeType))):C.thrown(new It("Expected </"+i.nodeName+">",e,l));s=0,r=12;continue}break;case 11:if(f==62)s=1;else throw C.thrown(new It("Expected >",e,l));break;case 12:if(f==62)return o==0&&i.addChild(V.createPCData("")),l;throw C.thrown(new It("Expected >",e,l));case 13:if(f==60){let g=l-h;p.b+=g==null?c.substr(e,h,null):c.substr(e,h,g);let d=V.createPCData(p.b);p=new gt,i.addChild(d),++o,s=0,r=2}else if(f==38){let g=l-h;p.b+=g==null?c.substr(e,h,null):c.substr(e,h,g),s=18,_=13,h=l+1}break;case 14:if(f==63&&e.charCodeAt(l+1)==62){++l;let g=c.substr(e,h+1,l-h-2);i.addChild(V.createProcessingInstruction(g)),++o,s=1}break;case 15:f==45&&e.charCodeAt(l+1)==45&&e.charCodeAt(l+2)==62&&(i.addChild(V.createComment(c.substr(e,h,l-h))),++o,l+=2,s=1);break;case 16:f==91?++u:f==93?--u:f==62&&u==0&&(i.addChild(V.createDocType(c.substr(e,h,l-h))),++o,s=1);break;case 17:if(f==93&&e.charCodeAt(l+1)==93&&e.charCodeAt(l+2)==62){let g=V.createCData(c.substr(e,h,l-h));i.addChild(g),++o,l+=2,s=1}break;case 18:if(f==59){let g=c.substr(e,h,l-h);if(g.charCodeAt(0)==35){let d=g.charCodeAt(1)==120?Y.parseInt("0"+c.substr(g,1,g.length-1)):Y.parseInt(c.substr(g,1,g.length-1));p.b+=String.fromCodePoint(d)}else if(Object.prototype.hasOwnProperty.call(ei.escapes.h,g))p.b+=Y.string(ei.escapes.h[g]);else{if(t)throw C.thrown(new It("Undefined entity: "+g,e,l));p.b+=Y.string("&"+g+";")}h=l+1,s=_}else if(!(f>=97&&f<=122||f>=65&&f<=90||f>=48&&f<=57||f==58||f==46||f==95||f==45)&&f!=35){if(t)throw C.thrown(new It("Invalid character in entity: "+String.fromCodePoint(f),e,l));p.b+=String.fromCodePoint(38);let g=l-h;p.b+=g==null?c.substr(e,h,null):c.substr(e,h,g),--l,h=l+1,s=_}break}++l}if(s==1&&(h=l,s=13),s==13){if(i.nodeType==0)throw i.nodeType!=V.Element?C.thrown("Bad node type, expected Element but found "+(i.nodeType==null?"null":de.toString(i.nodeType))):C.thrown(new It("Unclosed node <"+i.nodeName+">",e,l));if(l!=h||o==0){let f=l-h;p.b+=f==null?c.substr(e,h,null):c.substr(e,h,f),i.addChild(V.createPCData(p.b)),++o}return l}if(!t&&s==18&&_==13){p.b+=String.fromCodePoint(38);let f=l-h;return p.b+=f==null?c.substr(e,h,null):c.substr(e,h,f),i.addChild(V.createPCData(p.b)),++o,l}throw C.thrown(new It("Unexpected end",e,l))}}Q["haxe.xml.Parser"]=ei,ei.__name__="haxe.xml.Parser";class hi{constructor(e){this.output=new gt,this.pretty=e}writeNode(e,t){switch(e.nodeType){case 0:if(this.output.b+=Y.string(t+"<"),e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.output.b+=Y.string(e.nodeName);let l=e.attributes();for(;l.hasNext();){let o=l.next();this.output.b+=Y.string(" "+o+'="');let u=He.htmlEscape(e.get(o),!0);this.output.b+=Y.string(u),this.output.b+='"'}if(this.hasChildren(e)){if(this.output.b+=">",this.pretty&&(this.output.b+=`
|
|
5
|
+
`),e.nodeType!=V.Document&&e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let o=0,u=e.children;for(;o<u.length;){let p=u[o++];this.writeNode(p,this.pretty?t+" ":t)}if(this.output.b+=Y.string(t+"</"),e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.output.b+=Y.string(e.nodeName),this.output.b+=">",this.pretty&&(this.output.b+=`
|
|
6
6
|
`)}else this.output.b+="/>",this.pretty&&(this.output.b+=`
|
|
7
|
-
`);break;case 1:if(e.nodeType==
|
|
8
|
-
`)}break;case 2:if(this.output.b+=
|
|
9
|
-
`);break;case 3:if(e.nodeType==
|
|
10
|
-
\r ]+`,"g".split("u").join(""));n=n.replace(s,""),n="<!--"+n+"-->",this.output.b+=t==null?"null":""+t;let r=
|
|
11
|
-
`);break;case 4:if(e.nodeType==
|
|
12
|
-
`);break;case 5:if(e.nodeType==
|
|
13
|
-
`);break;case 6:if(e.nodeType!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));let h=0,a=e.children;for(;h<a.length;){let o=a[h++];this.writeNode(o,t)}break}}hasChildren(e){if(e.nodeType!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));let t=0,i=e.children;for(;t<i.length;){let l=i[t++];switch(l.nodeType){case 0:case 1:return!0;case 2:case 3:if(l.nodeType==Z.Document||l.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(l.nodeType==null?"null":Ie.toString(l.nodeType)));if(Ae.ltrim(l.nodeValue).length!=0)return!0;break;default:}}return!1}static print(e,t){t==null&&(t=!1);let i=new el(t);return i.writeNode(e,""),i.output.b}}j["haxe.xml.Printer"]=el,el.__name__="haxe.xml.Printer",Object.assign(el.prototype,{__class__:el});var W=Qe["hscript.TType"]={__ename__:"hscript.TType",__constructs__:null,TMono:(d=function(k){return{_hx_index:0,r:k,__enum__:"hscript.TType",toString:S}},d._hx_name="TMono",d.__params__=["r"],d),TVoid:{_hx_name:"TVoid",_hx_index:1,__enum__:"hscript.TType",toString:S},TInt:{_hx_name:"TInt",_hx_index:2,__enum__:"hscript.TType",toString:S},TFloat:{_hx_name:"TFloat",_hx_index:3,__enum__:"hscript.TType",toString:S},TBool:{_hx_name:"TBool",_hx_index:4,__enum__:"hscript.TType",toString:S},TDynamic:{_hx_name:"TDynamic",_hx_index:5,__enum__:"hscript.TType",toString:S},TParam:(d=function(k){return{_hx_index:6,name:k,__enum__:"hscript.TType",toString:S}},d._hx_name="TParam",d.__params__=["name"],d),TUnresolved:(d=function(k){return{_hx_index:7,name:k,__enum__:"hscript.TType",toString:S}},d._hx_name="TUnresolved",d.__params__=["name"],d),TNull:(d=function(k){return{_hx_index:8,t:k,__enum__:"hscript.TType",toString:S}},d._hx_name="TNull",d.__params__=["t"],d),TInst:(d=function(k,e){return{_hx_index:9,c:k,args:e,__enum__:"hscript.TType",toString:S}},d._hx_name="TInst",d.__params__=["c","args"],d),TEnum:(d=function(k,e){return{_hx_index:10,e:k,args:e,__enum__:"hscript.TType",toString:S}},d._hx_name="TEnum",d.__params__=["e","args"],d),TType:(d=function(k,e){return{_hx_index:11,t:k,args:e,__enum__:"hscript.TType",toString:S}},d._hx_name="TType",d.__params__=["t","args"],d),TAbstract:(d=function(k,e){return{_hx_index:12,a:k,args:e,__enum__:"hscript.TType",toString:S}},d._hx_name="TAbstract",d.__params__=["a","args"],d),TFun:(d=function(k,e){return{_hx_index:13,args:k,ret:e,__enum__:"hscript.TType",toString:S}},d._hx_name="TFun",d.__params__=["args","ret"],d),TAnon:(d=function(k){return{_hx_index:14,fields:k,__enum__:"hscript.TType",toString:S}},d._hx_name="TAnon",d.__params__=["fields"],d),TLazy:(d=function(k){return{_hx_index:15,f:k,__enum__:"hscript.TType",toString:S}},d._hx_name="TLazy",d.__params__=["f"],d)};W.__constructs__=[W.TMono,W.TVoid,W.TInt,W.TFloat,W.TBool,W.TDynamic,W.TParam,W.TUnresolved,W.TNull,W.TInst,W.TEnum,W.TType,W.TAbstract,W.TFun,W.TAnon,W.TLazy];var Se=Qe["hscript._Checker.WithType"]={__ename__:"hscript._Checker.WithType",__constructs__:null,NoValue:{_hx_name:"NoValue",_hx_index:0,__enum__:"hscript._Checker.WithType",toString:S},Value:{_hx_name:"Value",_hx_index:1,__enum__:"hscript._Checker.WithType",toString:S},WithType:(d=function(k){return{_hx_index:2,t:k,__enum__:"hscript._Checker.WithType",toString:S}},d._hx_name="WithType",d.__params__=["t"],d)};Se.__constructs__=[Se.NoValue,Se.Value,Se.WithType];var hi=Qe["hscript.CTypedecl"]={__ename__:"hscript.CTypedecl",__constructs__:null,CTClass:(d=function(k){return{_hx_index:0,c:k,__enum__:"hscript.CTypedecl",toString:S}},d._hx_name="CTClass",d.__params__=["c"],d),CTEnum:(d=function(k){return{_hx_index:1,e:k,__enum__:"hscript.CTypedecl",toString:S}},d._hx_name="CTEnum",d.__params__=["e"],d),CTTypedef:(d=function(k){return{_hx_index:2,t:k,__enum__:"hscript.CTypedecl",toString:S}},d._hx_name="CTTypedef",d.__params__=["t"],d),CTAlias:(d=function(k){return{_hx_index:3,t:k,__enum__:"hscript.CTypedecl",toString:S}},d._hx_name="CTAlias",d.__params__=["t"],d),CTAbstract:(d=function(k){return{_hx_index:4,a:k,__enum__:"hscript.CTypedecl",toString:S}},d._hx_name="CTAbstract",d.__params__=["a"],d)};hi.__constructs__=[hi.CTClass,hi.CTEnum,hi.CTTypedef,hi.CTAlias,hi.CTAbstract];class xl{constructor(e,t){this.expr=e,this.t=t}}j["hscript.Completion"]=xl,xl.__name__="hscript.Completion",Object.assign(xl.prototype,{__class__:xl});class Ml{constructor(){this.types=new Ee,this.types=new Ee,this.types.h.Void=hi.CTAlias(W.TVoid),this.types.h.Int=hi.CTAlias(W.TInt),this.types.h.Float=hi.CTAlias(W.TFloat),this.types.h.Bool=hi.CTAlias(W.TBool),this.types.h.Dynamic=hi.CTAlias(W.TDynamic),this.parser=new tl}addXmlApi(e){let t=new Nl;t.process(e,"");let i=[],l=0,n=t.root;for(;l<n.length;){let r=n[l];++l,this.addXmlType(r,i)}let s=0;for(;s<i.length;){let r=i[s];++s,r()}this.t_string=this.getType("String")}defineClass(e,t){return t==null&&(t={name:e,fields:new Ee,statics:new Ee,params:[]}),this.types.h[e]=hi.CTClass(t),t}addXmlType(e,t){let i=this;switch(e._hx_index){case 0:let l=e.name,n=e.full,s=e.subs,r=0;for(;r<s.length;){let v=s[r];++r,this.addXmlType(v,t)}break;case 1:let h=e.c;if(Object.prototype.hasOwnProperty.call(this.types.h,h.path))return;let a={name:h.path,params:[],fields:new Ee,statics:new Ee};this.addMeta(h,a),h.isInterface&&(a.isInterface=!0);let o=0,u=h.params;for(;o<u.length;){let v=u[o];++o,a.params.push(W.TParam(v))}t.push(function(){let v=new Ee,F=0,B=a.params;for(;F<B.length;){let M=B[F];++F;let U=h.path+"."+Ze.typeStr(M);v.h[U]=M}if(i.localParams=v,h.superClass!=null){let M=i,U=h.superClass.path,K=[],G=0,Y=h.superClass.params;for(;G<Y.length;){let $=Y[G];++G,K.push(i.makeXmlType($))}a.superClass=M.getType(U,K)}if(h.interfaces!=null){a.interfaces=[];let M=0,U=h.interfaces;for(;M<U.length;){let K=U[M];++M;let G=a.interfaces,Y=i,$=K.path,se=[],ue=0,oe=K.params;for(;ue<oe.length;){let ge=oe[ue];++ue,se.push(i.makeXmlType(ge))}G.push(Y.getType($,se))}}let A=[],L=function(M,U){if(M.isOverride||p.substr(M.name,0,4)=="get_"||p.substr(M.name,0,4)=="set_")return;let K=!M.name.startsWith("__"),G=0,Y=M.meta;for(;G<Y.length;){let me=Y[G];if(++G,me.name==":noScript")return;me.name==":noCompletion"&&(K=!1)}let $=M.set,se;switch($._hx_index){case 2:let me=$.m;se=!0;break;case 0:case 4:se=!0;break;default:se=!1}let ue={isPublic:M.isPublic,canWrite:se,complete:K,params:[],name:M.name,t:null},oe=0,ge=M.params;for(;oe<ge.length;){let me=ge[oe];++oe;let de=W.TParam(me),Oe=M.name+"."+me;A.push(Oe),ue.params.push(de),i.localParams.h[Oe]=de}if(ue.t=i.makeXmlType(M.type),M.meta!=null&&M.meta.length>0){ue.meta=[];let me=0,de=M.meta;for(;me<de.length;){let Oe=de[me];++me;let Ve=ue.meta,je=Oe.name,et=[],Ue=0,Ge=Oe.params;for(;Ue<Ge.length;){let nt=Ge[Ue];++Ue;let De;try{De=i.parser.parseString(nt)}catch(H){if(b.caught(H).unwrap()instanceof Ce)De=null;else throw H}et.push(De)}Ve.push({name:je,params:et})}}for(;A.length>0;){let me=i.localParams,de=A.pop(),Oe=me;Object.prototype.hasOwnProperty.call(Oe.h,de)&&delete Oe.h[de]}ue.name=="new"?a.constructor=ue:U.set(M.name,ue)},z=0,D=h.fields;for(;z<D.length;){let M=D[z];++z,L(M,a.fields)}let O=0,q=h.statics;for(;O<q.length;){let M=q[O];++O,L(M,a.statics)}i.localParams=null}),this.types.h[a.name]=hi.CTClass(a);break;case 2:let c=e.e;if(Object.prototype.hasOwnProperty.call(this.types.h,c.path))return;let _={name:c.path,params:[],constructors:[]};this.addMeta(c,_);let f=0,m=c.params;for(;f<m.length;){let v=m[f];++f,_.params.push(W.TParam(v))}t.push(function(){let v=new Ee,F=0,B=_.params;for(;F<B.length;){let z=B[F];++F;let D=c.path+"."+Ze.typeStr(z);v.h[D]=z}i.localParams=v;let A=0,L=c.constructors;for(;A<L.length;){let z=L[A];++A;let D=_.constructors,O=z.name,q;if(z.args==null)q=null;else{let M=[],U=0,K=z.args;for(;U<K.length;){let G=K[U];++U,M.push({name:G.name,opt:G.opt,t:i.makeXmlType(G.t)})}q=M}D.push({name:O,args:q})}i.localParams=null}),this.types.h[_.name]=hi.CTEnum(_);break;case 3:let g=e.t;if(Object.prototype.hasOwnProperty.call(this.types.h,g.path))return;let w={name:g.path,params:[],t:null},y=0,T=g.params;for(;y<T.length;){let v=T[y];++y,w.params.push(W.TParam(v))}g.path=="hscript.TypeCheck"&&w.params.reverse(),t.push(function(){let v=new Ee,F=0,B=w.params;for(;F<B.length;){let A=B[F];++F;let L=g.path+"."+Ze.typeStr(A);v.h[L]=A}i.localParams=v,w.t=i.makeXmlType(g.type),i.localParams=null}),this.types.h[g.path]=hi.CTTypedef(w);break;case 4:let E=e.a;if(Object.prototype.hasOwnProperty.call(this.types.h,E.path))return;let C={name:E.path,params:[],t:null};this.addMeta(E,C);let P=0,I=E.params;for(;P<I.length;){let v=I[P];++P,C.params.push(W.TParam(v))}t.push(function(){let v=new Ee,F=0,B=C.params;for(;F<B.length;){let A=B[F];++F;let L=E.path+"."+Ze.typeStr(A);v.h[L]=A}i.localParams=v,C.t=i.makeXmlType(E.athis),i.localParams=null}),this.types.h[E.path]=hi.CTAbstract(C);break}}addMeta(e,t){if(e.meta==null||e.meta.length==0)return;t.meta=[];let i=0,l=e.meta;for(;i<l.length;){let n=l[i];++i;let s=t.meta,r=n.name,h=[],a=0,o=n.params;for(;a<o.length;){let u=o[a];++a;let c;try{c=this.parser.parseString(u)}catch(_){if(b.caught(_).unwrap()instanceof Ce)c=null;else throw _}h.push(c)}s.push({name:r,params:h})}}makeXmlType(e){switch(e._hx_index){case 0:return W.TUnresolved("Unknown");case 1:let t=e.name,i=e.params,l=[],n=0;for(;n<i.length;){let B=i[n];++n,l.push(this.makeXmlType(B))}return this.getType(t,l);case 2:let s=e.name,r=e.params,h=[],a=0;for(;a<r.length;){let B=r[a];++a,h.push(this.makeXmlType(B))}return this.getType(s,h);case 3:let o=e.name,u=e.params,c=[],_=0;for(;_<u.length;){let B=u[_];++_,c.push(this.makeXmlType(B))}return this.getType(o,c);case 4:let f=e.args,m=e.ret,g=[],w=0;for(;w<f.length;){let B=f[w];++w,g.push({name:B.name,opt:B.opt,t:this.makeXmlType(B.t)})}return W.TFun(g,this.makeXmlType(m));case 5:let y=e.fields,T=[],E=0;for(;E<y.length;){let B=y[E];++E;let A=B.name,L=this.makeXmlType(B.type),z=B.meta,D;if(z==null)D=!1;else{let O=!1,q=0;for(;q<z.length;){let M=z[q];if(++q,M.name==":optional"){O=!0;break}}D=O}T.push({name:A,t:L,opt:D})}return W.TAnon(T);case 6:let C=e.t;return W.TDynamic;case 7:let P=e.name,I=e.params,v=[],F=0;for(;F<I.length;){let B=I[F];++F,v.push(this.makeXmlType(B))}return this.getType(P,v)}}getType(e,t){if(this.localParams!=null){let l=this.localParams.h[e];if(l!=null)return l}let i=this.resolve(e,t);if(i==null){let l=e.split(".");if(l.length>1){let n=l[l.length-2];if(p.cca(n,0)==95)return p.remove(l,n),this.getType(l.join("."),t)}return W.TUnresolved(e)}return i}resolve(e,t){if(e=="Null"){if(t==null||t.length!=1)throw b.thrown("Missing Null<T> parameter");return W.TNull(t[0])}let i=this.types.h[e];if(i==null)return null;switch(t==null&&(t=[]),i._hx_index){case 0:let l=i.c;return W.TInst(l,t);case 1:let n=i.e;return W.TEnum(n,t);case 2:let s=i.t;return W.TType(s,t);case 3:return i.t;case 4:let h=i.a;return W.TAbstract(h,t)}}}j["hscript.CheckerTypes"]=Ml,Ml.__name__="hscript.CheckerTypes",Object.assign(Ml.prototype,{__class__:Ml});class Ze{constructor(e){this.events=new Ee,this.globals=new Ee,e==null&&(e=new Ml),this.types=e}setGlobals(e,t){t==null&&(t=!1);let i=this;for(;;){let l=e.fields.h,n=l,s=Object.keys(l),r=s.length,h=0;for(;h<r;){let o=n[s[h++]];if(o.isPublic||t){let u=o.params.length==0?o.t:W.TLazy(function(){let c=i,_=o.t,f=o.params,m=[],g=0,w=o.params.length;for(;g<w;){let y=g++;m.push(i.makeMono())}return c.apply(_,f,m)});this.setGlobal(o.name,u)}}if(e.superClass==null)break;let a=e.superClass;if(a==null)throw b.thrown("assert");if(a._hx_index==9){let o=a.args;e=a.c}else throw b.thrown("assert")}}removeGlobal(e){let t=this.globals;Object.prototype.hasOwnProperty.call(t.h,e)&&delete t.h[e]}setGlobal(e,t){this.globals.h[e]=t}setEvent(e,t){this.events.h[e]=t}getGlobals(){return this.globals}onTopDownEnum(e,t){return!1}typeArgs(e,t){let i=[],l=0,n=e.length;for(;l<n;){let s=l++,r=e[s],h=r.t==null?this.makeMono():this.makeType(r.t,t);i.push({name:r.name,opt:r.opt,t:h})}return i}check(e,t,i){i==null&&(i=!1),t==null&&(t=Se.NoValue),this.locals=new Ee,this.types.t_string==null&&(this.types.t_string=this.types.getType("String")),this.allowDefine=this.allowGlobalsDefine,this.isCompletion=i;let l=e.e,n;if(l._hx_index==14){let h=l.args,a=l.e,o=l.name,u=l.ret;n=!0}else n=!1;n&&(e=this.mk(V.EBlock([e]),e));let s=this,r=e.e;if(r._hx_index==4){let h=r.e,a=[],o=W.TVoid,u=0;for(;u<h.length;){let _=h[u];for(++u;;){let m=_.e;if(m._hx_index==25){let g=m.name,w=m.args;_=m.e}else break}let f=_.e;if(f._hx_index==14){let m=f.e,g=f.args,w=f.name,y=f.ret;if(w!=null){let T=y==null?this.makeMono():this.makeType(y,_),E=W.TFun(this.typeArgs(g,_),T);this.locals.h[w]=E,a.push(function(){return s.currentFunType=E,s.typeExpr(_,Se.NoValue),E})}else{let T=0;for(;T<a.length;){let E=a[T];++T,E()}a=[],h[h.length-1]==_?o=this.typeExpr(_,t):this.typeExpr(_,Se.NoValue)}}else{let m=0;for(;m<a.length;){let g=a[m];++m,g()}a=[],h[h.length-1]==_?o=this.typeExpr(_,t):this.typeExpr(_,Se.NoValue)}}let c=0;for(;c<a.length;){let _=a[c];++c,o=_()}return o}return this.typeExpr(e,t)}edef(e){return e.e}error(e,t){let i=be.ECustom(e),l=new Ce(i,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw b.thrown(l)}saveLocals(){let e=new Ee,t=this.locals.h,i=t,l=Object.keys(t),n=l.length,s=0;for(;s<n;){let r=l[s++];e.h[r]=this.locals.h[r]}return e}makeType(e,t){switch(e._hx_index){case 0:let i=e.path,l=e.params,n=this.types,s=i.join("."),r;if(l==null)r=[];else{let C=[],P=0;for(;P<l.length;){let I=l[P];++P,C.push(this.makeType(I,t))}r=C}let h=n.resolve(s,r);if(h==null){let C=be.ECustom("Unknown type "+le.string(i)),P=new Ce(C,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw b.thrown(P);h=W.TDynamic}return h;case 1:let a=e.args,o=e.ret,u=0,c=[],_=0;for(;_<a.length;){let C=a[_];++_,c.push({name:"p"+u++,opt:!1,t:this.makeType(C,t)})}return W.TFun(c,this.makeType(o,t));case 2:let f=e.fields,m=[],g=0;for(;g<f.length;){let C=f[g];++g,m.push({name:C.name,opt:!1,t:this.makeType(C.t,t)})}return W.TAnon(m);case 3:let w=e.t;return this.makeType(w,t);case 4:let y=e.t;return this.makeType(y,t);case 5:let T=e.n,E=e.t;return this.makeType(E,t)}}linkLoop(e,t){if(t==e)return!0;switch(t._hx_index){case 0:let i=t.r;return i.r==null?!1:this.linkLoop(e,i.r);case 5:return t==W.TDynamic?!1:this.linkLoop(e,W.TDynamic);case 9:let l=t.c,n=t.args,s=0;for(;s<n.length;){let C=n[s];if(++s,this.linkLoop(e,C))return!0}return!1;case 10:let r=t.e,h=t.args,a=0;for(;a<h.length;){let C=h[a];if(++a,this.linkLoop(e,C))return!0}return!1;case 11:let o=t.t,u=t.args,c=0;for(;c<u.length;){let C=u[c];if(++c,this.linkLoop(e,C))return!0}return!1;case 12:let _=t.a,f=t.args,m=0;for(;m<f.length;){let C=f[m];if(++m,this.linkLoop(e,C))return!0}return!1;case 13:let g=t.args,w=t.ret,y=0;for(;y<g.length;){let C=g[y];if(++y,this.linkLoop(e,C.t))return!0}return this.linkLoop(e,w);case 14:let T=t.fields,E=0;for(;E<T.length;){let C=T[E];if(++E,this.linkLoop(e,C.t))return!0}return!1;default:return!1}}link(e,t,i){return this.linkLoop(e,t)?this.follow(t)==e:(t==W.TDynamic||(i.r=t),!0)}typeEq(e,t){if(e==t)return!0;switch(e._hx_index){case 0:let i=e.r;return i.r==null?this.link(e,t,i)?(i.r=t,!0):!1:this.typeEq(i.r,t);case 8:let l=e.t;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t,y=l;return this.typeEq(y,w);case 11:let T=t.t,E=t.args;return this.typeEq(e,this.apply(T.t,T.params,E));default:let C=l;return this.typeEq(C,t)}break;case 9:let n=e.c,s=e.args;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t;return this.typeEq(e,w);case 9:let y=t.c,T=t.args,E=s;if(n==y){let v=0,F=E.length;for(;v<F;){let B=v++;if(!this.typeEq(E[B],T[B]))return!1}return!0}break;case 11:let P=t.t,I=t.args;return this.typeEq(e,this.apply(P.t,P.params,I));default:}break;case 10:let r=e.e,h=e.args;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t;return this.typeEq(e,w);case 10:let y=t.e,T=t.args,E=h;if(r==y){let v=0,F=E.length;for(;v<F;){let B=v++;if(!this.typeEq(E[B],T[B]))return!1}return!0}break;case 11:let P=t.t,I=t.args;return this.typeEq(e,this.apply(P.t,P.params,I));default:}break;case 11:let a=e.t,o=e.args;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t,y=o,T=a;return this.typeEq(this.apply(T.t,T.params,y),t);case 11:let E=t.t,C=t.args,P=o;if(a==E){let B=0,A=P.length;for(;B<A;){let L=B++;if(!this.typeEq(P[L],C[L]))return!1}return!0}else{let B=o,A=a;return this.typeEq(this.apply(A.t,A.params,B),t)}break;default:let v=o,F=a;return this.typeEq(this.apply(F.t,F.params,v),t)}break;case 12:let u=e.a,c=e.args;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t;return this.typeEq(e,w);case 11:let y=t.t,T=t.args;return this.typeEq(e,this.apply(y.t,y.params,T));case 12:let E=t.a,C=t.args,P=c;if(u==E){let v=0,F=P.length;for(;v<F;){let B=v++;if(!this.typeEq(P[B],C[B]))return!1}return!0}break;default:}break;case 13:let _=e.args,f=e.ret;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t;return this.typeEq(e,w);case 11:let y=t.t,T=t.args;return this.typeEq(e,this.apply(y.t,y.params,T));case 13:let E=t.args,C=t.ret,P=f,I=_;if(I.length==E.length){let v=0,F=I.length;for(;v<F;){let B=v++;if(!this.typeEq(I[B].t,E[B].t))return!1}return this.typeEq(P,C)}break;default:}break;case 14:let m=e.fields;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t;return this.typeEq(e,w);case 11:let y=t.t,T=t.args;return this.typeEq(e,this.apply(y.t,y.params,T));case 14:let E=t.fields,C=m;if(C.length==E.length){let P=Object.create(null),I=0;for(;I<E.length;){let F=E[I];++I,P[F.name]=F}let v=0;for(;v<C.length;){let F=C[v];++v;let B=P[F.name];if(B==null||!this.typeEq(F.t,B.t))return!1}return!0}break;default:}break;default:switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t;return this.typeEq(e,w);case 11:let y=t.t,T=t.args;return this.typeEq(e,this.apply(y.t,y.params,T));default:}}return!1}tryUnify(e,t){if(e==t)return!0;switch(e._hx_index){case 0:let i=e.r;return i.r==null?this.link(e,t,i)?(i.r=t,!0):!1:this.tryUnify(i.r,t);case 2:switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 3:return!0;case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let f=t.t,m=t.args;return this.tryUnify(e,this.apply(f.t,f.params,m));default:}break;case 5:switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let f=t.t,m=t.args;return this.tryUnify(e,this.apply(f.t,f.params,m));default:return!0}break;case 8:let l=e.t;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:let _=l;return this.tryUnify(_,t);case 8:let f=t.t,m=l;return this.tryUnify(m,t);case 11:let g=t.t,w=t.args;return this.tryUnify(e,this.apply(g.t,g.params,w));default:let y=l;return this.tryUnify(y,t)}break;case 9:let n=e.c,s=e.args;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 9:let f=t.c,m=t.args,g=s,w=n;for(;w!=f;){if(w.interfaces!=null){let L=0,z=w.interfaces;for(;L<z.length;){let D=z[L];if(++L,D._hx_index==9){let O=D.c,q=D.args,M=[],U=0;for(;U<q.length;){let G=q[U];++U,M.push(this.apply(G,w.params,g))}let K=W.TInst(O,M);if(this.tryUnify(K,t))return!0}else throw b.thrown("assert")}}let A=w.superClass;if(A==null)return!1;if(A._hx_index==9){let L=A.c,z=A.args,D=[],O=0;for(;O<z.length;){let q=z[O];++O,D.push(this.apply(q,w.params,g))}g=D,w=L}else throw b.thrown("assert")}let y=0,T=g.length;for(;y<T;){let A=y++;if(!this.typeEq(g[A],m[A]))return!1}return!0;case 11:let E=t.t,C=t.args;return this.tryUnify(e,this.apply(E.t,E.params,C));case 14:let P=t.fields,I=s,v=n,F=0,B=P.length;for(;F<B;){let A=F++,L=P[A],z=null,D=v;for(;z=D.fields.h[L.name],z==null;){if(D.superClass==null)return!1;let O=D.superClass;if(O==null)throw b.thrown("assert");if(O._hx_index==9){let q=O.args;D=O.c}else throw b.thrown("assert")}if(!this.typeEq(this.apply(z.t,v.params,I),L.t))return!1}return!0;default:}break;case 11:let r=e.t,h=e.args;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:let _=h,f=r;return this.tryUnify(this.apply(f.t,f.params,_),t);case 8:let m=t.t,g=h,w=r;return this.tryUnify(this.apply(w.t,w.params,g),t);case 11:let y=t.t,T=t.args,E=h,C=r;return this.tryUnify(this.apply(C.t,C.params,E),t);default:let P=h,I=r;return this.tryUnify(this.apply(I.t,I.params,P),t)}break;case 13:let a=e.args,o=e.ret;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let f=t.t,m=t.args;return this.tryUnify(e,this.apply(f.t,f.params,m));case 12:let g=t.a,w=t.args,y=g.meta,T=g.params,E=g.t;if(g.name=="haxe.Function")return!0;break;case 13:let C=t.args,P=t.ret,I=o,v=a;if(v.length==C.length){let F=0,B=v.length;for(;F<B;){let A=F++,L=v[A],z=C[A];if(z.opt&&!L.opt||!this.tryUnify(z.t,L.t))return!1}return this.tryUnify(I,P)}break;default:}break;case 14:let u=e.fields;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let f=t.t,m=t.args;return this.tryUnify(e,this.apply(f.t,f.params,m));case 14:let g=t.fields,w=u;if(g.length==0)return!0;let y=Object.create(null),T=0;for(;T<w.length;){let C=w[T];++T,y[C.name]=C}let E=0;for(;E<g.length;){let C=g[E];++E;let P=y[C.name];if(P==null){if(C.opt)continue;return!1}if(!this.typeEq(P.t,C.t))return!1}return!0;default:}break;default:switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let f=t.t,m=t.args;return this.tryUnify(e,this.apply(f.t,f.params,m));default:}}return this.typeEq(e,t)}unify(e,t,i){if(!this.tryUnify(e,t)){let l=be.ECustom(Ze.typeStr(e)+" should be "+Ze.typeStr(t)),n=new Ce(l,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw b.thrown(n)}}apply(e,t,i){if(i.length!=t.length)throw b.thrown("Invalid number of type parameters");if(i.length==0)return e;let l=new Xi,n=0,s=t.length;for(;n<s;){let a=n++;l.set(t[a],i[a])}let r=null,h=this;return r=function(a){let o=l.get(a);return o??h.mapType(a,r)},r(e)}mapType(e,t){switch(e._hx_index){case 0:return e.r.r==null?e:t(e);case 1:case 2:case 3:case 4:case 5:return e;case 6:let l=e.name;return e;case 7:let n=e.name;return e;case 8:let s=e.t;return W.TNull(t(s));case 9:let r=e.args;if(r.length==0)return e;{let T=r,E=e.c,C=[],P=0;for(;P<T.length;){let I=T[P];++P,C.push(t(I))}return W.TInst(E,C)}break;case 10:let h=e.args;if(h.length==0)return e;{let T=h,E=e.e,C=[],P=0;for(;P<T.length;){let I=T[P];++P,C.push(t(I))}return W.TEnum(E,C)}break;case 11:let a=e.args;if(a.length==0)return e;{let T=a,E=e.t,C=[],P=0;for(;P<T.length;){let I=T[P];++P,C.push(t(I))}return W.TType(E,C)}break;case 12:let o=e.args;if(o.length==0)return e;{let T=o,E=e.a,C=[],P=0;for(;P<T.length;){let I=T[P];++P,C.push(t(I))}return W.TAbstract(E,C)}break;case 13:let u=e.args,c=e.ret,_=[],f=0;for(;f<u.length;){let T=u[f];++f,_.push({name:T.name,opt:T.opt,t:t(T.t)})}return W.TFun(_,t(c));case 14:let m=e.fields,g=[],w=0;for(;w<m.length;){let T=m[w];++w,g.push({name:T.name,opt:T.opt,t:t(T.t)})}return W.TAnon(g);case 15:let y=e.f;return t(y())}}follow(e){switch(e._hx_index){case 0:let t=e.r;return t.r!=null?this.follow(t.r):e;case 8:let i=e.t;return this.follow(i);case 11:let l=e.t,n=e.args;return this.follow(this.apply(l.t,l.params,n));case 15:let s=e.f;return this.follow(s());default:return e}}getFields(e){let t=[],i=this,l=this.follow(e);switch(l._hx_index){case 9:let n=l.c,s=l.args,r=function(c){return i.apply(c,n.params,s)};for(;n!=null;){let c=n.fields.h,_=c,f=Object.keys(c),m=f.length,g=0;for(;g<m;){let y=f[g++],T=n.fields.h[y];if(!T.isPublic||!T.complete)continue;let E=T.name,C=r(T.t);this.allowAsync&&E.startsWith("a_")&&(C=this.unasync(C),E=p.substr(E,2,null)),t.push({name:E,t:C})}if(n.isInterface&&n.interfaces!=null){let y=0,T=n.interfaces;for(;y<T.length;){let E=T[y];++y;let C=0,P=this.getFields(E);for(;C<P.length;){let I=P[C];++C,t.push({name:I.name,t:r(I.t)})}}}if(n.superClass==null)break;let w=n.superClass;if(w==null)break;if(w._hx_index==9){let y=w.c,T=w.args,E=r;r=function(C){return E(i.apply(C,y.params,T))},n=y}else break}break;case 13:let h=l.args,a=l.ret;this.isCompletion&&t.push({name:"bind",t:W.TFun(h,W.TVoid)});break;case 14:let o=l.fields,u=0;for(;u<o.length;){let c=o[u];++u,t.push({name:c.name,t:c.t})}break;default:}return t}getField(e,t,i,l){l==null&&(l=!1);let n=this.follow(e);switch(n._hx_index){case 5:return this.makeMono();case 9:let s=n.c,r=n.args,h=s.fields.h[t];if(h==null&&this.allowAsync&&(h=s.fields.h["a_"+t],h!=null&&(h={isPublic:!0,canWrite:!1,params:h.params,name:h.name,t:this.unasync(h.t),complete:h.complete},h.t==null&&(h=null))),h==null&&s.isInterface&&s.interfaces!=null){let c=0,_=s.interfaces;for(;c<_.length;){let f=_[c];++c;let m=this.getField(f,t,i,l);if(m!=null)return this.apply(m,s.params,r)}}if(h==null){if(s.superClass==null)return null;let c=this.getField(s.superClass,t,i,l);return c!=null&&(c=this.apply(c,s.params,r)),c}if(!h.isPublic){let c=be.ECustom("Can't access private field "+t+" on "+s.name),_=new Ce(c,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw b.thrown(_)}if(l&&!h.canWrite){let c=be.ECustom("Can't write readonly field "+t+" on "+s.name),_=new Ce(c,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw b.thrown(_)}let a=h.t;if(h.params!=null){let c=h.params,_=[],f=0,m=h.params.length;for(;f<m;){let g=f++;_.push(this.makeMono())}a=this.apply(a,c,_)}return this.apply(a,s.params,r);case 14:let o=n.fields,u=0;for(;u<o.length;){let c=o[u];if(++u,c.name==t)return c.t}return null;default:return null}}unasync(e){let t=this.follow(e);if(t._hx_index==13){let i=t.args,l=t.ret;if(i.length>0){let n=i.slice(),s=this.follow(n.shift().t);if(s._hx_index==13){let r=s.args,h=s.ret;if(r.length==1){let a=r[0];return W.TFun(n,a.t)}}}}return null}typeExprWith(e,t){let i=this.typeExpr(e,Se.WithType(t));return this.unify(i,t,e),t}makeMono(){return W.TMono({r:null})}makeIterator(e){return W.TAnon([{name:"next",opt:!1,t:W.TFun([],e)},{name:"hasNext",opt:!1,t:W.TFun([],W.TBool)}])}mk(e,t){return{e,pmin:t.pmin,pmax:t.pmax,origin:t.origin,line:t.line}}isString(e){if(e=this.follow(e),e._hx_index==9){let t=e.c,i=e.args,l=t.constructor,n=t.fields,s=t.interfaces,r=t.isInterface,h=t.meta,a=t.params,o=t.statics,u=t.superClass;return t.name=="String"}else return!1}onCompletion(e,t){if(this.isCompletion)throw b.thrown(new xl(e,t))}typeField(e,t,i,l){let n=this.typeExpr(e,Se.Value);t==null&&this.onCompletion(i,n);let s=this.getField(n,t,i,l);if(s==null){let r=be.ECustom(Ze.typeStr(n)+" has no field "+t),h=new Ce(r,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw b.thrown(h);s=W.TDynamic}return s}typeExpr(e,t){if(e==null&&this.isCompletion)return t._hx_index==2?t.t:W.TDynamic;let i=this,l=e.e;switch(l._hx_index){case 0:let h=l.c;switch(h._hx_index){case 0:let ce=h.v;return W.TInt;case 1:let we=h.f;return W.TFloat;case 2:let Fe=h.s;return this.types.t_string}break;case 1:let a=l.v,o=this.locals.h[a];if(o!=null)return o;let u=this.globals.h[a];if(u!=null){if(u==null)return u;if(u._hx_index==15){let ce=u.f;return ce()}else return u}if(this.allowAsync&&(u=this.globals.h["a_"+a],u!=null&&(u=this.unasync(u)),u!=null))return u;switch(a){case"false":case"true":return W.TBool;case"null":return this.makeMono();case"trace":return W.TDynamic;default:if(t._hx_index==2){let Fe=t.t;if(Fe._hx_index==10){let qe=Fe,At=Fe.e,Pt=Fe.args,ht=0,yi=At.constructors;for(;ht<yi.length;){let ri=yi[ht];if(++ht,ri.name==a){if(this.onTopDownEnum(At,a)){let pt=ri.args==null?qe:W.TFun(ri.args,qe);return this.apply(pt,At.params,Pt)}break}}}}if(this.isCompletion)return W.TDynamic;let ce=be.ECustom("Unknown identifier "+a),we=new Ce(ce,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(we)}break;case 2:let c=l.n,_=l.t,f=l.e,m=_==null?this.makeMono():this.makeType(_,e);if(f!=null){let ce=this.typeExpr(f,_==null?Se.Value:Se.WithType(m));_==null?m=ce:this.unify(ce,m,f)}return this.locals.h[c]=m,W.TVoid;case 3:let g=l.e;return this.typeExpr(g,t);case 4:let w=l.e,y=W.TVoid,T=this.saveLocals(),E=0;for(;E<w.length;){let ce=w[E];++E,y=this.typeExpr(ce,ce==w[w.length-1]?t:Se.NoValue)}return this.locals=T,y;case 5:let C=l.e,P=l.f;return this.typeField(C,P,e,!1);case 6:let I=l.op,v=l.e1,F=l.e2;switch(I){case"!=":case"==":let ce=this.typeExpr(v,Se.Value),we=this.typeExpr(F,Se.WithType(ce));return this.tryUnify(ce,we)||this.unify(we,ce,F),W.TBool;case"%":case"*":case"-":case"/":let Fe=this.typeExpr(v,Se.WithType(W.TInt)),qe=this.typeExpr(F,Se.WithType(Fe));this.tryUnify(Fe,qe)||this.unify(qe,Fe,F);let At=this.follow(Fe),Pt=this.follow(qe);switch(At._hx_index){case 2:switch(Pt._hx_index){case 2:return I=="/"?W.TFloat:W.TInt;case 3:case 5:return W.TFloat;default:this.unify(Fe,W.TFloat,v),this.unify(qe,W.TFloat,F)}break;case 3:switch(Pt._hx_index){case 2:case 3:case 5:return W.TFloat;default:this.unify(Fe,W.TFloat,v),this.unify(qe,W.TFloat,F)}break;case 5:switch(Pt._hx_index){case 2:case 3:case 5:return W.TFloat;default:this.unify(Fe,W.TFloat,v),this.unify(qe,W.TFloat,F)}break;default:this.unify(Fe,W.TFloat,v),this.unify(qe,W.TFloat,F)}break;case"+":let ht=this.typeExpr(v,Se.WithType(W.TInt)),yi=this.typeExpr(F,Se.WithType(ht));this.tryUnify(ht,yi);let ri=this.follow(ht),pt=this.follow(yi);switch(ri._hx_index){case 2:switch(pt._hx_index){case 2:return W.TInt;case 3:return W.TFloat;case 5:return W.TDynamic;default:let Ct=ri,xi=pt;if(this.isString(Ct)||this.isString(xi))return this.types.t_string;this.unify(Ct,W.TFloat,v),this.unify(xi,W.TFloat,F)}break;case 3:switch(pt._hx_index){case 2:case 3:return W.TFloat;case 5:return W.TDynamic;default:let Ct=ri,xi=pt;if(this.isString(Ct)||this.isString(xi))return this.types.t_string;this.unify(Ct,W.TFloat,v),this.unify(xi,W.TFloat,F)}break;case 5:return W.TDynamic;default:if(pt._hx_index==5)return W.TDynamic;{let Ct=ri,xi=pt;if(this.isString(Ct)||this.isString(xi))return this.types.t_string;this.unify(Ct,W.TFloat,v),this.unify(xi,W.TFloat,F)}}break;case"...":return this.typeExprWith(v,W.TInt),this.typeExprWith(F,W.TInt),this.makeIterator(W.TInt);case"&":case"<<":case">>":case">>>":case"^":case"|":return this.typeExprWith(v,W.TInt),this.typeExprWith(F,W.TInt),W.TInt;case"<":case"<=":case">":case">=":let qt=this.typeExpr(v,Se.Value),Ai=this.typeExpr(F,Se.WithType(qt));this.tryUnify(qt,Ai)||this.unify(Ai,qt,F);let sl=this.follow(qt);switch(sl._hx_index){case 2:case 3:case 4:break;case 9:let Ct=sl.c,xi=sl.args,an=Ct.constructor,An=Ct.fields,Dn=Ct.interfaces,Rn=Ct.isInterface,Vn=Ct.meta,Un=Ct.params,qn=Ct.statics,Wn=Ct.superClass;if(Ct.name!="String"){let Mn=be.ECustom("Cannot compare "+Ze.typeStr(qt)),Fn=new Ce(Mn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(Fn)}break;default:let Pn=be.ECustom("Cannot compare "+Ze.typeStr(qt)),Nn=new Ce(Pn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(Nn)}return W.TBool;case"=":if(this.allowDefine){let Ct=v.e;if(Ct._hx_index==1){let xi=Ct.v;if(!Object.prototype.hasOwnProperty.call(this.locals.h,xi)&&!Object.prototype.hasOwnProperty.call(this.globals.h,xi)){let an=this.typeExpr(F,Se.Value);return this.locals.h[xi]=an,an}}}let vl,Yl=v.e;if(Yl._hx_index==5){let Ct=Yl.e,xi=Yl.f;vl=this.typeField(Ct,xi,v,!0)}else vl=this.typeExpr(v,Se.Value);return this.typeExprWith(F,vl),vl;case"&&":case"||":return this.typeExprWith(v,W.TBool),this.typeExprWith(F,W.TBool),W.TBool;default:if(p.cca(I,I.length-1)==61){let Ct=this.typeExpr(this.mk(V.EBinop(p.substr(I,0,I.length-1),v,F),e),t);return this.typeExpr(this.mk(V.EBinop("=",v,F),e),t)}let On=be.ECustom("Unsupported operation "+I),In=new Ce(On,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(In)}break;case 7:let B=l.prefix,A=l.op,L=l.e,z=this.typeExpr(L,Se.Value);switch(A){case"!":return this.unify(z,W.TBool,L),z;case"++":case"-":case"--":return this.unify(z,W.TInt,L),z;default:}break;case 8:let D=l.e,O=l.params,q=D.e;if(q._hx_index==5&&q.f=="bind"){let ce=q.e,we=this.typeExpr(ce,Se.Value);if(we._hx_index==13){let Fe=we.args,qe=we.ret,At=Fe.slice(),Pt=0;for(;Pt<O.length;){let ht=O[Pt];++Pt;let yi=At.shift();if(yi==null){let ri=be.ECustom("Too many arguments"),pt=new Ce(ri,ht.pmin,ht.pmax,ht.origin,ht.line);if(!this.isCompletion)throw b.thrown(pt);return W.TFun([],qe)}this.typeExprWith(ht,yi.t)}return W.TFun(At,qe)}}let M=D.e,U;if(M._hx_index==1){let ce=M.v;if(t._hx_index==2){let we=t.t;if(we._hx_index==10){let Fe=we.e,qe=we.args;U=t}else U=Se.Value}else U=Se.Value}else U=Se.Value;let K=this.typeExpr(D,U),G=this.follow(K);switch(G._hx_index){case 5:let ce=0;for(;ce<O.length;){let pt=O[ce];++ce,this.typeExpr(pt,Se.Value)}return this.makeMono();case 13:let we=G.args,Fe=G.ret,qe=0,At=O.length;for(;qe<At;){let pt=qe++,qt=we[pt];if(qt==null){let sl=O[pt],vl=be.ECustom("Too many arguments"),Yl=new Ce(vl,sl.pmin,sl.pmax,sl.origin,sl.line);if(!this.isCompletion)throw b.thrown(Yl);break}let Ai=this.typeExpr(O[pt],qt==null?Se.Value:Se.WithType(qt.t));this.unify(Ai,qt.t,O[pt])}let Pt=O.length,ht=we.length;for(;Pt<ht;){let pt=Pt++;if(!we[pt].opt){let qt=be.ECustom("Missing argument "+we[pt].name+":"+Ze.typeStr(we[pt].t)),Ai=new Ce(qt,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(Ai)}}return Fe;default:let yi=be.ECustom(Ze.typeStr(K)+" cannot be called"),ri=new Ce(yi,D.pmin,D.pmax,D.origin,D.line);if(!this.isCompletion)throw b.thrown(ri);return this.makeMono()}break;case 9:let Y=l.cond,$=l.e1,se=l.e2;this.typeExprWith(Y,W.TBool);let ue=this.typeExpr($,t);if(se==null)return ue;let oe=this.typeExpr(se,t);if(t==Se.NoValue)return W.TVoid;if(this.tryUnify(oe,ue))return ue;if(this.tryUnify(ue,oe))return oe;this.unify(oe,ue,se);break;case 10:let ge=l.cond,me=l.e;return this.typeExprWith(ge,W.TBool),this.typeExpr(me,Se.NoValue),W.TVoid;case 11:let de=l.v,Oe=l.it,Ve=l.e,je=this.saveLocals(),et=this.typeExpr(Oe,Se.Value),Ue=this.getIteratorType(Oe,et);return this.locals.h[de]=Ue,this.typeExpr(Ve,Se.NoValue),this.locals=je,W.TVoid;case 12:case 13:return W.TVoid;case 14:let Ge=l.args,nt=l.e,De=l.name,H=l.ret,ie=null,R=null,ee=null;if(this.currentFunType!=null){let ce=this.currentFunType;if(ce._hx_index==13){let we=ce.args,Fe=ce.ret;ie=this.currentFunType,R=Fe,ee=we}else throw b.thrown("assert");this.currentFunType=null}else R=H==null?this.makeMono():this.makeType(H,e);let X=this.saveLocals(),Q=this.allowReturn,ae=this.allowDefine,_e=this.hasReturn;this.allowReturn=R,this.allowDefine=!1,this.hasReturn=!1;let xe=null,Ye;if(De!=null){let ce;if(t._hx_index==2){let we=this.follow(t.t);if(we._hx_index==13){let Fe=we.args,qe=we.ret;ce=!0}else ce=!1}else ce=!1;Ye=!ce}else Ye=!1;if(Ye){let ce=this.events.h[De];ce!=null&&(t=Se.WithType(ce))}if(t._hx_index==2){let ce=this.follow(t.t);if(ce._hx_index==13){let we=ce.args,Fe=ce.ret;xe=we,this.unify(R,Fe,e)}}ee==null&&(ee=this.typeArgs(Ge,e));let gt=0,Be=ee.length;for(;gt<Be;){let ce=gt++,we=ee[ce];if(xe!=null)if(ce<xe.length)this.unify(xe[ce].t,we.t,e);else{let Fe=be.ECustom("Extra argument "+we.name),qe=new Ce(Fe,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(qe)}this.locals.h[we.name]=we.t}if(xe!=null&&ee.length<xe.length){let ce="Missing "+(xe.length-ee.length)+" arguments (",we=[],Fe=ee.length,qe=xe.length;for(;Fe<qe;){let ht=Fe++;we.push(Ze.typeStr(xe[ht].t))}let At=be.ECustom(ce+we.join(",")+")"),Pt=new Ce(At,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(Pt)}if(this.typeExpr(nt,Se.NoValue),!this.hasReturn&&!this.tryUnify(R,W.TVoid)){let ce=be.ECustom("Missing return "+Ze.typeStr(R)),we=new Ce(ce,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(we)}return this.allowDefine=ae,this.allowReturn=Q,this.hasReturn=_e,this.locals=X,ie==null&&(ie=W.TFun(ee,R),De!=null&&(X.h[De]=ie)),ie;case 15:let _t=l.e,ve=_t==null?W.TVoid:this.typeExpr(_t,this.allowReturn==null?Se.Value:Se.WithType(this.allowReturn));if(this.hasReturn=!0,this.allowReturn==null){let ce=be.ECustom("Return not allowed here"),we=new Ce(ce,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(we)}else this.unify(ve,this.allowReturn,_t??e);return this.makeMono();case 16:let Pe=l.e,ot=l.index;this.typeExprWith(ot,W.TInt);let tt=this.typeExpr(Pe,Se.Value),bt=this.follow(tt);if(bt._hx_index==9){let ce=bt.c,we=bt.args,Fe=ce.constructor,qe=ce.fields,At=ce.interfaces,Pt=ce.isInterface,ht=ce.meta,yi=ce.params,ri=ce.statics,pt=ce.superClass;if(ce.name=="Array"){if(we.length==1)return we[0];{let qt=be.ECustom(Ze.typeStr(tt)+" is not an Array"),Ai=new Ce(qt,Pe.pmin,Pe.pmax,Pe.origin,Pe.line);if(!this.isCompletion)throw b.thrown(Ai)}}else{let qt=be.ECustom(Ze.typeStr(tt)+" is not an Array"),Ai=new Ce(qt,Pe.pmin,Pe.pmax,Pe.origin,Pe.line);if(!this.isCompletion)throw b.thrown(Ai)}}else{let ce=be.ECustom(Ze.typeStr(tt)+" is not an Array"),we=new Ce(ce,Pe.pmin,Pe.pmax,Pe.origin,Pe.line);if(!this.isCompletion)throw b.thrown(we)}break;case 17:let Kt=l.e,ft=null,li=0;for(;li<Kt.length;){let ce=Kt[li];++li;let we=this.typeExpr(ce,ft==null?Se.Value:Se.WithType(ft));ft==null?ft=we:this.tryUnify(we,ft)||(this.tryUnify(ft,we)?ft=we:this.unify(we,ft,ce))}return ft==null&&(ft=this.makeMono()),this.types.getType("Array",[ft]);case 18:let $e=l.cl,Bt=l.params;break;case 19:let It=l.e;return this.typeExpr(It,Se.Value),this.makeMono();case 20:let Lt=l.e,mt=l.v,Vt=l.t,Ht=l.ecatch,Ut=this.typeExpr(Lt,t),ni=this.locals.h[mt],si=this.locals,jt=this.makeType(Vt,Ht);si.h[mt]=jt;let it=this.typeExpr(Ht,t);if(ni!=null)this.locals.h[mt]=ni;else{let ce=this.locals;Object.prototype.hasOwnProperty.call(ce.h,mt)&&delete ce.h[mt]}return t==Se.NoValue?W.TVoid:this.tryUnify(Ut,it)?it:(this.unify(it,Ut,Ht),Ut);case 21:let ki=l.fl;if(t._hx_index==2){let ce=this.follow(t.t);if(ce._hx_index==14){let we=ce.fields;if(we.length>0){let Fe=Object.create(null),qe=0;for(;qe<we.length;){let ht=we[qe];++qe,Fe[ht.name]=ht}let At=[],Pt=0;for(;Pt<ki.length;){let ht=ki[Pt];++Pt;let yi=Fe[ht.name],ri;if(yi==null){let pt=ht.e,qt=be.ECustom("Extra field "+ht.name),Ai=new Ce(qt,pt.pmin,pt.pmax,pt.origin,pt.line);if(!this.isCompletion)throw b.thrown(Ai);ri=W.TDynamic}else ri=yi.t;At.push({t:this.typeExprWith(ht.e,ri),opt:!1,name:ht.name})}return W.TAnon(At)}else{let Fe=[],qe=0;for(;qe<ki.length;){let At=ki[qe];++qe,Fe.push({t:this.typeExpr(At.e,Se.Value),opt:!1,name:At.name})}return W.TAnon(Fe)}}else{let we=[],Fe=0;for(;Fe<ki.length;){let qe=ki[Fe];++Fe,we.push({t:this.typeExpr(qe.e,Se.Value),opt:!1,name:qe.name})}return W.TAnon(we)}}else{let ce=[],we=0;for(;we<ki.length;){let Fe=ki[we];++we,ce.push({t:this.typeExpr(Fe.e,Se.Value),opt:!1,name:Fe.name})}return W.TAnon(ce)}break;case 22:let ye=l.cond,lt=l.e1,ct=l.e2;this.typeExprWith(ye,W.TBool);let rt=this.typeExpr(lt,t);if(ct==null)return rt;let dt=this.typeExpr(ct,t);if(t==Se.NoValue)return W.TVoid;if(this.tryUnify(dt,rt))return rt;if(this.tryUnify(rt,dt))return dt;this.unify(dt,rt,ct);break;case 23:let xt=l.e,St=l.cases,Jt=l.defaultExpr,wt=null,Ql=this.typeExpr(xt,Se.Value),fl=0;for(;fl<St.length;){let ce=St[fl];++fl;let we=0,Fe=ce.values;for(;we<Fe.length;){let Pt=Fe[we];++we;let ht=this.typeExpr(Pt,Se.WithType(Ql));this.unify(ht,Ql,Pt)}let qe=this.typeExpr(ce.expr,t),At=ce.expr;t!=Se.NoValue&&(wt==null?wt=qe:i.tryUnify(qe,wt)||(i.unify(wt,qe,At),wt=qe))}if(Jt!=null){let ce=this.typeExpr(Jt,t);t!=Se.NoValue&&(wt==null?wt=ce:i.tryUnify(ce,wt)||(i.unify(wt,ce,Jt),wt=ce))}return t==Se.NoValue?W.TVoid:wt??this.makeMono();case 24:let Qi=l.cond,rn=l.e;return this.typeExprWith(Qi,W.TBool),this.typeExpr(rn,Se.NoValue),W.TVoid;case 25:let Ln=l.args,Tn=l.name,En=l.e;return Tn==":untyped"&&this.allowUntypedMeta?this.makeMono():this.typeExpr(En,t);case 26:let mn=l.e,Sn=l.t,hn=this.makeType(Sn,e),vn=this.typeExpr(mn,Se.WithType(hn));return this.unify(vn,hn,mn),hn}let n=e.e,s=be.ECustom("Don't know how to type "+Qe[n.__enum__].__constructs__[n._hx_index]._hx_name),r=new Ce(s,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(r);return W.TDynamic}getIteratorType(e,t){let i=this.follow(t);if(i._hx_index==9){let r=i.c,h=i.args,a=r.constructor,o=r.fields,u=r.interfaces,c=r.isInterface,_=r.meta,f=r.params,m=r.statics,g=r.superClass;if(r.name=="Array"&&h.length==1)return h[0]}let l=this.getField(t,"iterator",e);if(l==null&&t._hx_index==12){let r=t.a,h=t.args,a=this.apply(r.t,r.params,h);return this.getIteratorType(e,a)}l!=null&&(l==null?l=null:l._hx_index==13&&l.args.length==0?l=l.ret:l=null);let n=this.makeMono(),s=this.makeIterator(n);return this.unify(l??t,s,e),n}static typeStr(e){switch(e._hx_index){case 0:let t=e.r;return t.r==null?"Unknown":Ze.typeStr(t.r);case 6:return e.name;case 7:return"?"+e.name;case 8:let n=e.t;return"Null<"+Ze.typeStr(n)+">";case 9:let s=e.c,r=e.args,h=s.name,a;if(r.length==0)a="";else{let A=[],L=0;for(;L<r.length;){let z=r[L];++L,A.push(Ze.typeStr(z))}a="<"+A.join(",")+">"}return h+a;case 10:let o=e.e,u=e.args,c=o.name,_;if(u.length==0)_="";else{let A=[],L=0;for(;L<u.length;){let z=u[L];++L,A.push(Ze.typeStr(z))}_="<"+A.join(",")+">"}return c+_;case 11:let f=e.t,m=e.args;if(f.name=="hscript.TypeCheck")return Ze.typeStr(m[1]);{let A=f.name,L;if(m.length==0)L="";else{let z=[],D=0;for(;D<m.length;){let O=m[D];++D,z.push(Ze.typeStr(O))}L="<"+z.join(",")+">"}return A+L}break;case 12:let g=e.a,w=e.args,y=g.name,T;if(w.length==0)T="";else{let A=[],L=0;for(;L<w.length;){let z=w[L];++L,A.push(Ze.typeStr(z))}T="<"+A.join(",")+">"}return y+T;case 13:let E=e.args,C=e.ret,P=[],I=0;for(;I<E.length;){let A=E[I];++I,P.push((A.opt?"?":"")+(A.name==""?"":A.name+":")+Ze.typeStr(A.t))}return"("+P.join(", ")+") -> "+Ze.typeStr(C);case 14:let v=e.fields,F=[],B=0;for(;B<v.length;){let A=v[B];++B,F.push((A.opt?"?":"")+A.name+":"+Ze.typeStr(A.t))}return"{"+F.join(", ")+"}";default:return p.substr(Qe[e.__enum__].__constructs__[e._hx_index]._hx_name,1,null)}}static typeIter(e,t){switch(e._hx_index){case 0:let i=e.r;i.r!=null&&t(i.r);break;case 8:let l=e.t;t(l);break;case 9:let n=e.c,s=e.args,r=0;for(;r<s.length;){let I=s[r];++r,t(I)}break;case 10:let h=e.e,a=e.args,o=0;for(;o<a.length;){let I=a[o];++o,t(I)}break;case 11:let u=e.t,c=e.args,_=0;for(;_<c.length;){let I=c[_];++_,t(I)}break;case 12:let f=e.a,m=e.args,g=0;for(;g<m.length;){let I=m[g];++g,t(I)}break;case 13:let w=e.args,y=e.ret,T=0;for(;T<w.length;){let I=w[T];++T,t(I.t)}t(y);break;case 14:let E=e.fields,C=0;for(;C<E.length;){let I=E[C];++C,t(I.t)}break;case 15:let P=e.f;t(P());break;default:}}}j["hscript.Checker"]=Ze,Ze.__name__="hscript.Checker",Object.assign(Ze.prototype,{__class__:Ze});var fi=Qe["hscript.Const"]={__ename__:"hscript.Const",__constructs__:null,CInt:(d=function(k){return{_hx_index:0,v:k,__enum__:"hscript.Const",toString:S}},d._hx_name="CInt",d.__params__=["v"],d),CFloat:(d=function(k){return{_hx_index:1,f:k,__enum__:"hscript.Const",toString:S}},d._hx_name="CFloat",d.__params__=["f"],d),CString:(d=function(k){return{_hx_index:2,s:k,__enum__:"hscript.Const",toString:S}},d._hx_name="CString",d.__params__=["s"],d)};fi.__constructs__=[fi.CInt,fi.CFloat,fi.CString];var V=Qe["hscript.ExprDef"]={__ename__:"hscript.ExprDef",__constructs__:null,EConst:(d=function(k){return{_hx_index:0,c:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EConst",d.__params__=["c"],d),EIdent:(d=function(k){return{_hx_index:1,v:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EIdent",d.__params__=["v"],d),EVar:(d=function(k,e,t){return{_hx_index:2,n:k,t:e,e:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EVar",d.__params__=["n","t","e"],d),EParent:(d=function(k){return{_hx_index:3,e:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EParent",d.__params__=["e"],d),EBlock:(d=function(k){return{_hx_index:4,e:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EBlock",d.__params__=["e"],d),EField:(d=function(k,e){return{_hx_index:5,e:k,f:e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EField",d.__params__=["e","f"],d),EBinop:(d=function(k,e,t){return{_hx_index:6,op:k,e1:e,e2:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EBinop",d.__params__=["op","e1","e2"],d),EUnop:(d=function(k,e,t){return{_hx_index:7,op:k,prefix:e,e:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EUnop",d.__params__=["op","prefix","e"],d),ECall:(d=function(k,e){return{_hx_index:8,e:k,params:e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="ECall",d.__params__=["e","params"],d),EIf:(d=function(k,e,t){return{_hx_index:9,cond:k,e1:e,e2:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EIf",d.__params__=["cond","e1","e2"],d),EWhile:(d=function(k,e){return{_hx_index:10,cond:k,e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EWhile",d.__params__=["cond","e"],d),EFor:(d=function(k,e,t){return{_hx_index:11,v:k,it:e,e:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EFor",d.__params__=["v","it","e"],d),EBreak:{_hx_name:"EBreak",_hx_index:12,__enum__:"hscript.ExprDef",toString:S},EContinue:{_hx_name:"EContinue",_hx_index:13,__enum__:"hscript.ExprDef",toString:S},EFunction:(d=function(k,e,t,i){return{_hx_index:14,args:k,e,name:t,ret:i,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EFunction",d.__params__=["args","e","name","ret"],d),EReturn:(d=function(k){return{_hx_index:15,e:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EReturn",d.__params__=["e"],d),EArray:(d=function(k,e){return{_hx_index:16,e:k,index:e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EArray",d.__params__=["e","index"],d),EArrayDecl:(d=function(k){return{_hx_index:17,e:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EArrayDecl",d.__params__=["e"],d),ENew:(d=function(k,e){return{_hx_index:18,cl:k,params:e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="ENew",d.__params__=["cl","params"],d),EThrow:(d=function(k){return{_hx_index:19,e:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EThrow",d.__params__=["e"],d),ETry:(d=function(k,e,t,i){return{_hx_index:20,e:k,v:e,t,ecatch:i,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="ETry",d.__params__=["e","v","t","ecatch"],d),EObject:(d=function(k){return{_hx_index:21,fl:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EObject",d.__params__=["fl"],d),ETernary:(d=function(k,e,t){return{_hx_index:22,cond:k,e1:e,e2:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="ETernary",d.__params__=["cond","e1","e2"],d),ESwitch:(d=function(k,e,t){return{_hx_index:23,e:k,cases:e,defaultExpr:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="ESwitch",d.__params__=["e","cases","defaultExpr"],d),EDoWhile:(d=function(k,e){return{_hx_index:24,cond:k,e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EDoWhile",d.__params__=["cond","e"],d),EMeta:(d=function(k,e,t){return{_hx_index:25,name:k,args:e,e:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EMeta",d.__params__=["name","args","e"],d),ECheckType:(d=function(k,e){return{_hx_index:26,e:k,t:e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="ECheckType",d.__params__=["e","t"],d)};V.__constructs__=[V.EConst,V.EIdent,V.EVar,V.EParent,V.EBlock,V.EField,V.EBinop,V.EUnop,V.ECall,V.EIf,V.EWhile,V.EFor,V.EBreak,V.EContinue,V.EFunction,V.EReturn,V.EArray,V.EArrayDecl,V.ENew,V.EThrow,V.ETry,V.EObject,V.ETernary,V.ESwitch,V.EDoWhile,V.EMeta,V.ECheckType];var $t=Qe["hscript.CType"]={__ename__:"hscript.CType",__constructs__:null,CTPath:(d=function(k,e){return{_hx_index:0,path:k,params:e,__enum__:"hscript.CType",toString:S}},d._hx_name="CTPath",d.__params__=["path","params"],d),CTFun:(d=function(k,e){return{_hx_index:1,args:k,ret:e,__enum__:"hscript.CType",toString:S}},d._hx_name="CTFun",d.__params__=["args","ret"],d),CTAnon:(d=function(k){return{_hx_index:2,fields:k,__enum__:"hscript.CType",toString:S}},d._hx_name="CTAnon",d.__params__=["fields"],d),CTParent:(d=function(k){return{_hx_index:3,t:k,__enum__:"hscript.CType",toString:S}},d._hx_name="CTParent",d.__params__=["t"],d),CTOpt:(d=function(k){return{_hx_index:4,t:k,__enum__:"hscript.CType",toString:S}},d._hx_name="CTOpt",d.__params__=["t"],d),CTNamed:(d=function(k,e){return{_hx_index:5,n:k,t:e,__enum__:"hscript.CType",toString:S}},d._hx_name="CTNamed",d.__params__=["n","t"],d)};$t.__constructs__=[$t.CTPath,$t.CTFun,$t.CTAnon,$t.CTParent,$t.CTOpt,$t.CTNamed];class Ce{constructor(e,t,i,l,n){this.e=e,this.pmin=t,this.pmax=i,this.origin=l,this.line=n}toString(){return ol.errorToString(this)}}j["hscript.Error"]=Ce,Ce.__name__="hscript.Error",Object.assign(Ce.prototype,{__class__:Ce});var be=Qe["hscript.ErrorDef"]={__ename__:"hscript.ErrorDef",__constructs__:null,EInvalidChar:(d=function(k){return{_hx_index:0,c:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EInvalidChar",d.__params__=["c"],d),EUnexpected:(d=function(k){return{_hx_index:1,s:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EUnexpected",d.__params__=["s"],d),EUnterminatedString:{_hx_name:"EUnterminatedString",_hx_index:2,__enum__:"hscript.ErrorDef",toString:S},EUnterminatedComment:{_hx_name:"EUnterminatedComment",_hx_index:3,__enum__:"hscript.ErrorDef",toString:S},EInvalidPreprocessor:(d=function(k){return{_hx_index:4,msg:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EInvalidPreprocessor",d.__params__=["msg"],d),EUnknownVariable:(d=function(k){return{_hx_index:5,v:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EUnknownVariable",d.__params__=["v"],d),EInvalidIterator:(d=function(k){return{_hx_index:6,v:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EInvalidIterator",d.__params__=["v"],d),EInvalidOp:(d=function(k){return{_hx_index:7,op:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EInvalidOp",d.__params__=["op"],d),EInvalidAccess:(d=function(k){return{_hx_index:8,f:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EInvalidAccess",d.__params__=["f"],d),ECustom:(d=function(k){return{_hx_index:9,msg:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="ECustom",d.__params__=["msg"],d)};be.__constructs__=[be.EInvalidChar,be.EUnexpected,be.EUnterminatedString,be.EUnterminatedComment,be.EInvalidPreprocessor,be.EUnknownVariable,be.EInvalidIterator,be.EInvalidOp,be.EInvalidAccess,be.ECustom];var ji=Qe["hscript.ModuleDecl"]={__ename__:"hscript.ModuleDecl",__constructs__:null,DPackage:(d=function(k){return{_hx_index:0,path:k,__enum__:"hscript.ModuleDecl",toString:S}},d._hx_name="DPackage",d.__params__=["path"],d),DImport:(d=function(k,e){return{_hx_index:1,path:k,everything:e,__enum__:"hscript.ModuleDecl",toString:S}},d._hx_name="DImport",d.__params__=["path","everything"],d),DClass:(d=function(k){return{_hx_index:2,c:k,__enum__:"hscript.ModuleDecl",toString:S}},d._hx_name="DClass",d.__params__=["c"],d),DTypedef:(d=function(k){return{_hx_index:3,c:k,__enum__:"hscript.ModuleDecl",toString:S}},d._hx_name="DTypedef",d.__params__=["c"],d)};ji.__constructs__=[ji.DPackage,ji.DImport,ji.DClass,ji.DTypedef];var Ei=Qe["hscript.FieldAccess"]={__ename__:"hscript.FieldAccess",__constructs__:null,APublic:{_hx_name:"APublic",_hx_index:0,__enum__:"hscript.FieldAccess",toString:S},APrivate:{_hx_name:"APrivate",_hx_index:1,__enum__:"hscript.FieldAccess",toString:S},AInline:{_hx_name:"AInline",_hx_index:2,__enum__:"hscript.FieldAccess",toString:S},AOverride:{_hx_name:"AOverride",_hx_index:3,__enum__:"hscript.FieldAccess",toString:S},AStatic:{_hx_name:"AStatic",_hx_index:4,__enum__:"hscript.FieldAccess",toString:S},AMacro:{_hx_name:"AMacro",_hx_index:5,__enum__:"hscript.FieldAccess",toString:S}};Ei.__constructs__=[Ei.APublic,Ei.APrivate,Ei.AInline,Ei.AOverride,Ei.AStatic,Ei.AMacro];var Fl=Qe["hscript.FieldKind"]={__ename__:"hscript.FieldKind",__constructs__:null,KFunction:(d=function(k){return{_hx_index:0,f:k,__enum__:"hscript.FieldKind",toString:S}},d._hx_name="KFunction",d.__params__=["f"],d),KVar:(d=function(k){return{_hx_index:1,v:k,__enum__:"hscript.FieldKind",toString:S}},d._hx_name="KVar",d.__params__=["v"],d)};Fl.__constructs__=[Fl.KFunction,Fl.KVar];var J=Qe["hscript.Token"]={__ename__:"hscript.Token",__constructs__:null,TEof:{_hx_name:"TEof",_hx_index:0,__enum__:"hscript.Token",toString:S},TConst:(d=function(k){return{_hx_index:1,c:k,__enum__:"hscript.Token",toString:S}},d._hx_name="TConst",d.__params__=["c"],d),TId:(d=function(k){return{_hx_index:2,s:k,__enum__:"hscript.Token",toString:S}},d._hx_name="TId",d.__params__=["s"],d),TOp:(d=function(k){return{_hx_index:3,s:k,__enum__:"hscript.Token",toString:S}},d._hx_name="TOp",d.__params__=["s"],d),TPOpen:{_hx_name:"TPOpen",_hx_index:4,__enum__:"hscript.Token",toString:S},TPClose:{_hx_name:"TPClose",_hx_index:5,__enum__:"hscript.Token",toString:S},TBrOpen:{_hx_name:"TBrOpen",_hx_index:6,__enum__:"hscript.Token",toString:S},TBrClose:{_hx_name:"TBrClose",_hx_index:7,__enum__:"hscript.Token",toString:S},TDot:{_hx_name:"TDot",_hx_index:8,__enum__:"hscript.Token",toString:S},TQuestionDot:{_hx_name:"TQuestionDot",_hx_index:9,__enum__:"hscript.Token",toString:S},TComma:{_hx_name:"TComma",_hx_index:10,__enum__:"hscript.Token",toString:S},TSemicolon:{_hx_name:"TSemicolon",_hx_index:11,__enum__:"hscript.Token",toString:S},TBkOpen:{_hx_name:"TBkOpen",_hx_index:12,__enum__:"hscript.Token",toString:S},TBkClose:{_hx_name:"TBkClose",_hx_index:13,__enum__:"hscript.Token",toString:S},TQuestion:{_hx_name:"TQuestion",_hx_index:14,__enum__:"hscript.Token",toString:S},TDoubleDot:{_hx_name:"TDoubleDot",_hx_index:15,__enum__:"hscript.Token",toString:S},TMeta:(d=function(k){return{_hx_index:16,s:k,__enum__:"hscript.Token",toString:S}},d._hx_name="TMeta",d.__params__=["s"],d),TPrepro:(d=function(k){return{_hx_index:17,s:k,__enum__:"hscript.Token",toString:S}},d._hx_name="TPrepro",d.__params__=["s"],d)};J.__constructs__=[J.TEof,J.TConst,J.TId,J.TOp,J.TPOpen,J.TPClose,J.TBrOpen,J.TBrClose,J.TDot,J.TQuestionDot,J.TComma,J.TSemicolon,J.TBkOpen,J.TBkClose,J.TQuestion,J.TDoubleDot,J.TMeta,J.TPrepro];class tl{constructor(){this.uid=0,this.preprocesorValues=new Ee,this.line=1,this.opChars="+*/-=!><&|^%~",this.identChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";let e=[["%"],["*","/"],["+","-"],["<<",">>",">>>"],["|","&","^"],["==","!=",">","<",">=","<="],["..."],["&&"],["||"],["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","&=","^=","=>"],["->"]];this.opPriority=new Ee,this.opRightAssoc=new Ee;let t=0,i=e.length;for(;t<i;){let h=t++,a=0,o=e[h];for(;a<o.length;){let u=o[a];++a,this.opPriority.h[u]=h,h==9&&(this.opRightAssoc.h[u]=!0)}}let l="!";this.opPriority.h[l]=l=="++"||l=="--"?-1:-2;let n="++";this.opPriority.h[n]=n=="++"||n=="--"?-1:-2;let s="--";this.opPriority.h[s]=s=="++"||s=="--"?-1:-2;let r="~";this.opPriority.h[r]=r=="++"||r=="--"?-1:-2}get_currentPos(){return this.readPos+this.offset}error(e,t,i){if(!this.resumeErrors)throw b.thrown(new Ce(e,t,i,this.origin,this.line))}invalidChar(e){if(!this.resumeErrors)throw b.thrown(new Ce(be.EInvalidChar(e),this.readPos-1,this.readPos-1,this.origin,this.line))}initParser(e,t){this.preprocStack=[],this.origin=e,this.readPos=0,this.tokenMin=this.oldTokenMin=t,this.tokenMax=this.oldTokenMax=t,this.tokens=new Pl,this.offset=t,this.char=-1,this.ops=[],this.idents=[],this.uid=0;let i=0,l=this.opChars.length;for(;i<l;){let r=i++;this.ops[p.cca(this.opChars,r)]=!0}let n=0,s=this.identChars.length;for(;n<s;){let r=n++;this.idents[p.cca(this.identChars,r)]=!0}}parseString(e,t,i){i==null&&(i=0),t==null&&(t="hscript"),this.initParser(t,i),this.input=e,this.readPos=0;let l=[];for(;;){let n=this.token();if(n==J.TEof)break;this.tokens.push({t:n,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.parseFullExpr(l)}if(l.length==1)return l[0];{let n=V.EBlock(l),s=0,r=null;return n==null?null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),{e:n,pmin:s,pmax:r,origin:this.origin,line:this.line})}}unexpected(e){let t=be.EUnexpected(this.tokenString(e));if(!this.resumeErrors)throw b.thrown(new Ce(t,this.tokenMin,this.tokenMax,this.origin,this.line));return null}push(e){this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}ensure(e){let t=this.token();t!=e&&this.unexpected(t)}ensureToken(e){let t=this.token();pe.enumEq(t,e)||this.unexpected(t)}maybe(e){let t=this.token();return pe.enumEq(t,e)?!0:(this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,!1)}getIdent(){let e=this.token();return e._hx_index==2?e.s:(this.unexpected(e),null)}expr(e){return e.e}pmin(e){return e==null?0:e.pmin}pmax(e){return e==null?0:e.pmax}mk(e,t,i){return e==null?null:(t==null&&(t=this.tokenMin),i==null&&(i=this.tokenMax),{e,pmin:t,pmax:i,origin:this.origin,line:this.line})}isBlock(e){if(e==null)return!1;let t=e.e;switch(t._hx_index){case 2:let i=t.n,l=t.t,n=t.e;if(n!=null)return this.isBlock(n);if(l!=null){if(l==null)return!1;if(l._hx_index==2){let se=l.fields;return!0}else return!1}else return!1;break;case 4:let s=t.e;return!0;case 6:let r=t.op,h=t.e1,a=t.e2;return this.isBlock(a);case 7:let o=t.op,u=t.prefix,c=t.e;return u?!1:this.isBlock(c);case 9:let _=t.cond,f=t.e1,m=t.e2;return m!=null?this.isBlock(m):this.isBlock(f);case 10:let g=t.cond,w=t.e;return this.isBlock(w);case 11:let y=t.v,T=t.it,E=t.e;return this.isBlock(E);case 14:let C=t.args,P=t.name,I=t.ret,v=t.e;return this.isBlock(v);case 15:let F=t.e;return F!=null?this.isBlock(F):!1;case 20:let B=t.e,A=t.v,L=t.t,z=t.ecatch;return this.isBlock(z);case 21:let D=t.fl;return!0;case 23:let O=t.e,q=t.cases,M=t.defaultExpr;return!0;case 24:let U=t.cond,K=t.e;return this.isBlock(K);case 25:let G=t.name,Y=t.args,$=t.e;return this.isBlock($);default:return!1}}parseFullExpr(e){let t=this.parseExpr();e.push(t);let i=this.token();for(;;){let l;if(i==J.TComma&&t!=null){let n=t.e;if(n._hx_index==2){let s=n.n,r=n.t,h=n.e;l=!0}else l=!1}else l=!1;if(!l)break;t=this.parseStructure("var"),e.push(t),i=this.token()}i!=J.TSemicolon&&i!=J.TEof&&(this.isBlock(t)?(this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):this.unexpected(i))}parseObject(e){let t=[];e:for(;;){let r=this.token(),h=null;switch(r._hx_index){case 1:let o=r.c;this.allowJSON||this.unexpected(r),o._hx_index==2?h=o.s:this.unexpected(r);break;case 2:h=r.s;break;case 7:break e;default:this.unexpected(r);break e}let a=this.token();switch(a!=J.TDoubleDot&&this.unexpected(a),t.push({name:h,e:this.parseExpr()}),r=this.token(),r._hx_index){case 7:break e;case 10:break;default:this.unexpected(r)}}let i=V.EObject(t),l=e,n=null,s;return i==null?s=null:(l==null&&(l=this.tokenMin),n==null&&(n=this.tokenMax),s={e:i,pmin:l,pmax:n,origin:this.origin,line:this.line}),this.parseExprNext(s)}parseExpr(){let e=this.token(),t=this.tokenMin;switch(e._hx_index){case 1:let i=e.c,l=V.EConst(i),n=null,s=null,r;return l==null?r=null:(n==null&&(n=this.tokenMin),s==null&&(s=this.tokenMax),r={e:l,pmin:n,pmax:s,origin:this.origin,line:this.line}),this.parseExprNext(r);case 2:let h=e.s,a=this.parseStructure(h);if(a==null){let I=V.EIdent(h),v=null,F=null;I==null?a=null:(v==null&&(v=this.tokenMin),F==null&&(F=this.tokenMax),a={e:I,pmin:v,pmax:F,origin:this.origin,line:this.line})}return this.parseExprNext(a);case 3:let o=e.s;if(o=="-"){let I=this.tokenMin,v=this.parseExpr();if(v==null)return this.makeUnop(o,v);let F=v.e;if(F._hx_index==0){let B=F.c;switch(B._hx_index){case 0:let A=B.v,L=V.EConst(fi.CInt(-A)),z=I,D=v==null?0:v.pmax;return L==null?null:(z==null&&(z=this.tokenMin),D==null&&(D=this.tokenMax),{e:L,pmin:z,pmax:D,origin:this.origin,line:this.line});case 1:let O=B.f,q=V.EConst(fi.CFloat(-O)),M=I,U=v==null?0:v.pmax;return q==null?null:(M==null&&(M=this.tokenMin),U==null&&(U=this.tokenMax),{e:q,pmin:M,pmax:U,origin:this.origin,line:this.line});default:return this.makeUnop(o,v)}}else return this.makeUnop(o,v)}return this.opPriority.h[o]<0?this.makeUnop(o,this.parseExpr()):this.unexpected(e);case 4:if(e=this.token(),e==J.TPClose){let I=this.token();pe.enumEq(I,J.TOp("->"))||this.unexpected(I);let v=this.parseExpr(),F=V.EReturn(v),B=t,A=null,L;F==null?L=null:(B==null&&(B=this.tokenMin),A==null&&(A=this.tokenMax),L={e:F,pmin:B,pmax:A,origin:this.origin,line:this.line});let z=V.EFunction([],L),D=t,O=null;return z==null?null:(D==null&&(D=this.tokenMin),O==null&&(O=this.tokenMax),{e:z,pmin:D,pmax:O,origin:this.origin,line:this.line})}this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let u=this.parseExpr();switch(e=this.token(),e._hx_index){case 5:let I=V.EParent(u),v=t,F=this.tokenMax,B;return I==null?B=null:(v==null&&(v=this.tokenMin),F==null&&(F=this.tokenMax),B={e:I,pmin:v,pmax:F,origin:this.origin,line:this.line}),this.parseExprNext(B);case 10:let A=u.e;if(A._hx_index==1){let z=A.v;return this.parseLambda([{name:z}],u==null?0:u.pmin)}break;case 15:let L=this.parseType();switch(e=this.token(),e._hx_index){case 5:let z=V.ECheckType(u,L),D=t,O=this.tokenMax,q;return z==null?q=null:(D==null&&(D=this.tokenMin),O==null&&(O=this.tokenMax),q={e:z,pmin:D,pmax:O,origin:this.origin,line:this.line}),this.parseExprNext(q);case 10:let M=u.e;if(M._hx_index==1){let U=M.v;return this.parseLambda([{name:U,t:L}],u==null?0:u.pmin)}break;default:}break;default:}return this.unexpected(e);case 6:switch(e=this.token(),e._hx_index){case 1:let I=e.c;if(this.allowJSON)if(I._hx_index==2){let D=I.s,O=this.token();if(this.tokens.push({t:O,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,O._hx_index==15)return this.parseExprNext(this.parseObject(t))}else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;case 2:let v=e.s,F=this.token();if(this.tokens.push({t:F,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,F._hx_index==15)return this.parseExprNext(this.parseObject(t));break;case 7:let B=V.EObject([]),A=t,L=null,z;return B==null?z=null:(A==null&&(A=this.tokenMin),L==null&&(L=this.tokenMax),z={e:B,pmin:A,pmax:L,origin:this.origin,line:this.line}),this.parseExprNext(z);default:this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}let c=[];for(;this.parseFullExpr(c),e=this.token(),!(e==J.TBrClose||this.resumeErrors&&e==J.TEof);)this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let _=V.EBlock(c),f=t,m=null;return _==null?null:(f==null&&(f=this.tokenMin),m==null&&(m=this.tokenMax),{e:_,pmin:f,pmax:m,origin:this.origin,line:this.line});case 12:let g=[];e=this.token();let w=!0;for(;e!=J.TBkClose&&(!this.resumeErrors||e!=J.TEof);)w||(e!=J.TComma?this.unexpected(e):e=this.token()),w=!1,this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,g.push(this.parseExpr()),e=this.token();if(g.length==1&&g[0]!=null){let I=g[0].e;switch(I._hx_index){case 10:let v=I.cond,F=I.e,B="__a_"+this.uid++,A=V.EArrayDecl([]),L=t,z=null,D;A==null?D=null:(L==null&&(L=this.tokenMin),z==null&&(z=this.tokenMax),D={e:A,pmin:L,pmax:z,origin:this.origin,line:this.line});let O=V.EVar(B,null,D),q=t,M=null,U;O==null?U=null:(q==null&&(q=this.tokenMin),M==null&&(M=this.tokenMax),U={e:O,pmin:q,pmax:M,origin:this.origin,line:this.line});let K=this.mapCompr(B,g[0]),G=V.EIdent(B),Y=t,$=null,se;G==null?se=null:(Y==null&&(Y=this.tokenMin),$==null&&($=this.tokenMax),se={e:G,pmin:Y,pmax:$,origin:this.origin,line:this.line});let ue=V.EBlock([U,K,se]),oe=t,ge=null,me;return ue==null?me=null:(oe==null&&(oe=this.tokenMin),ge==null&&(ge=this.tokenMax),me={e:ue,pmin:oe,pmax:ge,origin:this.origin,line:this.line}),this.parseExprNext(me);case 11:let de=I.v,Oe=I.it,Ve=I.e,je="__a_"+this.uid++,et=V.EArrayDecl([]),Ue=t,Ge=null,nt;et==null?nt=null:(Ue==null&&(Ue=this.tokenMin),Ge==null&&(Ge=this.tokenMax),nt={e:et,pmin:Ue,pmax:Ge,origin:this.origin,line:this.line});let De=V.EVar(je,null,nt),H=t,ie=null,R;De==null?R=null:(H==null&&(H=this.tokenMin),ie==null&&(ie=this.tokenMax),R={e:De,pmin:H,pmax:ie,origin:this.origin,line:this.line});let ee=this.mapCompr(je,g[0]),X=V.EIdent(je),Q=t,ae=null,_e;X==null?_e=null:(Q==null&&(Q=this.tokenMin),ae==null&&(ae=this.tokenMax),_e={e:X,pmin:Q,pmax:ae,origin:this.origin,line:this.line});let xe=V.EBlock([R,ee,_e]),Ye=t,gt=null,Be;return xe==null?Be=null:(Ye==null&&(Ye=this.tokenMin),gt==null&&(gt=this.tokenMax),Be={e:xe,pmin:Ye,pmax:gt,origin:this.origin,line:this.line}),this.parseExprNext(Be);case 24:let _t=I.cond,ve=I.e,Pe="__a_"+this.uid++,ot=V.EArrayDecl([]),tt=t,bt=null,Kt;ot==null?Kt=null:(tt==null&&(tt=this.tokenMin),bt==null&&(bt=this.tokenMax),Kt={e:ot,pmin:tt,pmax:bt,origin:this.origin,line:this.line});let ft=V.EVar(Pe,null,Kt),li=t,$e=null,Bt;ft==null?Bt=null:(li==null&&(li=this.tokenMin),$e==null&&($e=this.tokenMax),Bt={e:ft,pmin:li,pmax:$e,origin:this.origin,line:this.line});let It=this.mapCompr(Pe,g[0]),Lt=V.EIdent(Pe),mt=t,Vt=null,Ht;Lt==null?Ht=null:(mt==null&&(mt=this.tokenMin),Vt==null&&(Vt=this.tokenMax),Ht={e:Lt,pmin:mt,pmax:Vt,origin:this.origin,line:this.line});let Ut=V.EBlock([Bt,It,Ht]),ni=t,si=null,jt;return Ut==null?jt=null:(ni==null&&(ni=this.tokenMin),si==null&&(si=this.tokenMax),jt={e:Ut,pmin:ni,pmax:si,origin:this.origin,line:this.line}),this.parseExprNext(jt);default:}}let y=V.EArrayDecl(g),T=t,E=null,C;return y==null?C=null:(T==null&&(T=this.tokenMin),E==null&&(E=this.tokenMax),C={e:y,pmin:T,pmax:E,origin:this.origin,line:this.line}),this.parseExprNext(C);case 16:let P=e.s;if(this.allowMetadata){let I=this.parseMetaArgs(),v=V.EMeta(P,I,this.parseExpr()),F=t,B=null;return v==null?null:(F==null&&(F=this.tokenMin),B==null&&(B=this.tokenMax),{e:v,pmin:F,pmax:B,origin:this.origin,line:this.line})}else return this.unexpected(e);break;default:return this.unexpected(e)}}parseLambda(e,t){e:for(;;){let c=this.getIdent(),_=this.maybe(J.TDoubleDot)?this.parseType():null;e.push({name:c,t:_});let f=this.token();switch(f._hx_index){case 5:break e;case 10:break;default:this.unexpected(f);break e}}let i=this.token();pe.enumEq(i,J.TOp("->"))||this.unexpected(i);let l=this.parseExpr(),n=V.EReturn(l),s=t,r=null,h;n==null?h=null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),h={e:n,pmin:s,pmax:r,origin:this.origin,line:this.line});let a=V.EFunction(e,h),o=t,u=null;return a==null?null:(o==null&&(o=this.tokenMin),u==null&&(u=this.tokenMax),{e:a,pmin:o,pmax:u,origin:this.origin,line:this.line})}parseMetaArgs(){let e=this.token();if(e!=J.TPOpen)return this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,null;let t=[];if(e=this.token(),e!=J.TPClose){this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;e:for(;;){t.push(this.parseExpr());let i=this.token();switch(i._hx_index){case 5:break e;case 10:break;default:let l=i;this.unexpected(l)}}}return t}mapCompr(e,t){if(t==null)return null;let i,l=t.e;switch(l._hx_index){case 3:let r=l.e;i=V.EParent(this.mapCompr(e,r));break;case 4:let h=l.e;if(h.length==1){let A=h[0];i=V.EBlock([this.mapCompr(e,A)])}else{let A=V.EIdent(e),L=t==null?0:t.pmin,z=t==null?0:t.pmax,D;A==null?D=null:(L==null&&(L=this.tokenMin),z==null&&(z=this.tokenMax),D={e:A,pmin:L,pmax:z,origin:this.origin,line:this.line});let O=V.EField(D,"push"),q=t==null?0:t.pmin,M=t==null?0:t.pmax,U;O==null?U=null:(q==null&&(q=this.tokenMin),M==null&&(M=this.tokenMax),U={e:O,pmin:q,pmax:M,origin:this.origin,line:this.line}),i=V.ECall(U,[t])}break;case 9:let a=l.cond,o=l.e1;if(l.e2==null)i=V.EIf(a,this.mapCompr(e,o),null);else{let A=V.EIdent(e),L=t==null?0:t.pmin,z=t==null?0:t.pmax,D;A==null?D=null:(L==null&&(L=this.tokenMin),z==null&&(z=this.tokenMax),D={e:A,pmin:L,pmax:z,origin:this.origin,line:this.line});let O=V.EField(D,"push"),q=t==null?0:t.pmin,M=t==null?0:t.pmax,U;O==null?U=null:(q==null&&(q=this.tokenMin),M==null&&(M=this.tokenMax),U={e:O,pmin:q,pmax:M,origin:this.origin,line:this.line}),i=V.ECall(U,[t])}break;case 10:let c=l.cond,_=l.e;i=V.EWhile(c,this.mapCompr(e,_));break;case 11:let f=l.v,m=l.it,g=l.e;i=V.EFor(f,m,this.mapCompr(e,g));break;case 24:let w=l.cond,y=l.e;i=V.EDoWhile(w,this.mapCompr(e,y));break;default:let T=V.EIdent(e),E=t==null?0:t.pmin,C=t==null?0:t.pmax,P;T==null?P=null:(E==null&&(E=this.tokenMin),C==null&&(C=this.tokenMax),P={e:T,pmin:E,pmax:C,origin:this.origin,line:this.line});let I=V.EField(P,"push"),v=t==null?0:t.pmin,F=t==null?0:t.pmax,B;I==null?B=null:(v==null&&(v=this.tokenMin),F==null&&(F=this.tokenMax),B={e:I,pmin:v,pmax:F,origin:this.origin,line:this.line}),i=V.ECall(B,[t])}let n=t==null?0:t.pmin,s=t==null?0:t.pmax;return i==null?null:(n==null&&(n=this.tokenMin),s==null&&(s=this.tokenMax),{e:i,pmin:n,pmax:s,origin:this.origin,line:this.line})}makeUnop(e,t){if(t==null&&this.resumeErrors)return null;let i=t.e;switch(i._hx_index){case 6:let l=i.op,n=i.e1,s=i.e2,r=V.EBinop(l,this.makeUnop(e,n),s),h=n==null?0:n.pmin,a=s==null?0:s.pmax;return r==null?null:(h==null&&(h=this.tokenMin),a==null&&(a=this.tokenMax),{e:r,pmin:h,pmax:a,origin:this.origin,line:this.line});case 22:let o=i.cond,u=i.e1,c=i.e2,_=V.ETernary(this.makeUnop(e,o),u,c),f=o==null?0:o.pmin,m=c==null?0:c.pmax;return _==null?null:(f==null&&(f=this.tokenMin),m==null&&(m=this.tokenMax),{e:_,pmin:f,pmax:m,origin:this.origin,line:this.line});default:let g=V.EUnop(e,!0,t),w=t==null?0:t.pmin,y=t==null?0:t.pmax;return g==null?null:(w==null&&(w=this.tokenMin),y==null&&(y=this.tokenMax),{e:g,pmin:w,pmax:y,origin:this.origin,line:this.line})}}makeBinop(e,t,i){if(i==null&&this.resumeErrors){let n=V.EBinop(e,t,i),s=t==null?0:t.pmin,r=t==null?0:t.pmax;return n==null?null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),{e:n,pmin:s,pmax:r,origin:this.origin,line:this.line})}let l=i.e;switch(l._hx_index){case 6:let n=l.op,s=l.e1,r=l.e2;if(this.opPriority.h[e]<=this.opPriority.h[n]&&!Object.prototype.hasOwnProperty.call(this.opRightAssoc.h,e)){let f=V.EBinop(n,this.makeBinop(e,t,s),r),m=t==null?0:t.pmin,g=r==null?0:r.pmax;return f==null?null:(m==null&&(m=this.tokenMin),g==null&&(g=this.tokenMax),{e:f,pmin:m,pmax:g,origin:this.origin,line:this.line})}else{let f=V.EBinop(e,t,i),m=t==null?0:t.pmin,g=i==null?0:i.pmax;return f==null?null:(m==null&&(m=this.tokenMin),g==null&&(g=this.tokenMax),{e:f,pmin:m,pmax:g,origin:this.origin,line:this.line})}break;case 22:let h=l.cond,a=l.e1,o=l.e2;if(Object.prototype.hasOwnProperty.call(this.opRightAssoc.h,e)){let f=V.EBinop(e,t,i),m=t==null?0:t.pmin,g=i==null?0:i.pmax;return f==null?null:(m==null&&(m=this.tokenMin),g==null&&(g=this.tokenMax),{e:f,pmin:m,pmax:g,origin:this.origin,line:this.line})}else{let f=V.ETernary(this.makeBinop(e,t,h),a,o),m=t==null?0:t.pmin,g=i==null?0:i.pmax;return f==null?null:(m==null&&(m=this.tokenMin),g==null&&(g=this.tokenMax),{e:f,pmin:m,pmax:g,origin:this.origin,line:this.line})}break;default:let u=V.EBinop(e,t,i),c=t==null?0:t.pmin,_=i==null?0:i.pmax;return u==null?null:(c==null&&(c=this.tokenMin),_==null&&(_=this.tokenMax),{e:u,pmin:c,pmax:_,origin:this.origin,line:this.line})}}parseStructure(e){let t=this.tokenMin;switch(e){case"break":let i=V.EBreak,l=null,n=null;return i==null?null:(l==null&&(l=this.tokenMin),n==null&&(n=this.tokenMax),{e:i,pmin:l,pmax:n,origin:this.origin,line:this.line});case"continue":let s=V.EContinue,r=null,h=null;return s==null?null:(r==null&&(r=this.tokenMin),h==null&&(h=this.tokenMax),{e:s,pmin:r,pmax:h,origin:this.origin,line:this.line});case"do":let a=this.parseExpr(),o=this.token();o._hx_index==2?o.s!="while"&&this.unexpected(o):this.unexpected(o);let u=this.parseExpr(),c=V.EDoWhile(u,a),_=t,f=u==null?0:u.pmax;return c==null?null:(_==null&&(_=this.tokenMin),f==null&&(f=this.tokenMax),{e:c,pmin:_,pmax:f,origin:this.origin,line:this.line});case"else":return this.unexpected(J.TId(e));case"for":let m=this.token();m!=J.TPOpen&&this.unexpected(m);let g=this.getIdent(),w=this.token();pe.enumEq(w,J.TId("in"))||this.unexpected(w);let y=this.parseExpr(),T=this.token();T!=J.TPClose&&this.unexpected(T);let E=this.parseExpr(),C=V.EFor(g,y,E),P=t,I=E==null?0:E.pmax;return C==null?null:(P==null&&(P=this.tokenMin),I==null&&(I=this.tokenMax),{e:C,pmin:P,pmax:I,origin:this.origin,line:this.line});case"function":let v=this.token(),F=null;v._hx_index==2?F=v.s:(this.tokens.push({t:v,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax);let B=this.parseFunctionDecl(),A=V.EFunction(B.args,B.body,F,B.ret),L=t,z=B.body,D=z==null?0:z.pmax;return A==null?null:(L==null&&(L=this.tokenMin),D==null&&(D=this.tokenMax),{e:A,pmin:L,pmax:D,origin:this.origin,line:this.line});case"if":let O=this.token();O!=J.TPOpen&&this.unexpected(O);let q=this.parseExpr(),M=this.token();M!=J.TPClose&&this.unexpected(M);let U=this.parseExpr(),K=null,G=!1,Y=this.token();Y==J.TSemicolon&&(G=!0,Y=this.token()),pe.enumEq(Y,J.TId("else"))?K=this.parseExpr():(this.tokens.push({t:Y,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,G&&(this.tokens.push({t:J.TSemicolon,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax));let $=V.EIf(q,U,K),se=t,ue=K==null?this.tokenMax:K==null?0:K.pmax;return $==null?null:(se==null&&(se=this.tokenMin),ue==null&&(ue=this.tokenMax),{e:$,pmin:se,pmax:ue,origin:this.origin,line:this.line});case"inline":return this.maybe(J.TId("function"))||this.unexpected(J.TId("inline")),this.parseStructure("function");case"new":let oe=[];oe.push(this.getIdent());e:for(;;){let it=this.token();switch(it._hx_index){case 4:break e;case 8:oe.push(this.getIdent());break;default:this.unexpected(it);break e}}let ge=this.parseExprList(J.TPClose),me=V.ENew(oe.join("."),ge),de=t,Oe=null;return me==null?null:(de==null&&(de=this.tokenMin),Oe==null&&(Oe=this.tokenMax),{e:me,pmin:de,pmax:Oe,origin:this.origin,line:this.line});case"return":let Ve=this.token();this.tokens.push({t:Ve,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let je=Ve==J.TSemicolon?null:this.parseExpr(),et=V.EReturn(je),Ue=t,Ge=je==null?this.tokenMax:je==null?0:je.pmax;return et==null?null:(Ue==null&&(Ue=this.tokenMin),Ge==null&&(Ge=this.tokenMax),{e:et,pmin:Ue,pmax:Ge,origin:this.origin,line:this.line});case"switch":let nt=this.parseExpr(),De=null,H=[],ie=this.token();ie!=J.TBrOpen&&this.unexpected(ie);e:for(;;){let it=this.token();switch(it._hx_index){case 2:switch(it.s){case"case":let ki={values:[],expr:null};H.push(ki);t:for(;;){let dt=this.parseExpr();switch(ki.values.push(dt),it=this.token(),it._hx_index){case 10:break;case 15:break t;default:this.unexpected(it);break t}}let ye=[];t:for(;;)switch(it=this.token(),this.tokens.push({t:it,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,it._hx_index){case 0:if(this.resumeErrors)break t;this.parseFullExpr(ye);break;case 2:switch(it.s){case"case":case"default":break t;default:this.parseFullExpr(ye)}break;case 7:break t;default:this.parseFullExpr(ye)}let lt;if(ye.length==1)lt=ye[0];else if(ye.length==0){let dt=V.EBlock([]),xt=this.tokenMin,St=this.tokenMin;dt==null?lt=null:(xt==null&&(xt=this.tokenMin),St==null&&(St=this.tokenMax),lt={e:dt,pmin:xt,pmax:St,origin:this.origin,line:this.line})}else{let dt=V.EBlock(ye),xt=ye[0],St=xt==null?0:xt.pmin,Jt=ye[ye.length-1],wt=Jt==null?0:Jt.pmax;dt==null?lt=null:(St==null&&(St=this.tokenMin),wt==null&&(wt=this.tokenMax),lt={e:dt,pmin:St,pmax:wt,origin:this.origin,line:this.line})}ki.expr=lt;break;case"default":De!=null&&this.unexpected(it);let ct=this.token();ct!=J.TDoubleDot&&this.unexpected(ct);let rt=[];t:for(;;)switch(it=this.token(),this.tokens.push({t:it,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,it._hx_index){case 0:if(this.resumeErrors)break t;this.parseFullExpr(rt);break;case 2:switch(it.s){case"case":case"default":break t;default:this.parseFullExpr(rt)}break;case 7:break t;default:this.parseFullExpr(rt)}if(rt.length==1)De=rt[0];else if(rt.length==0){let dt=V.EBlock([]),xt=this.tokenMin,St=this.tokenMin;dt==null?De=null:(xt==null&&(xt=this.tokenMin),St==null&&(St=this.tokenMax),De={e:dt,pmin:xt,pmax:St,origin:this.origin,line:this.line})}else{let dt=V.EBlock(rt),xt=rt[0],St=xt==null?0:xt.pmin,Jt=rt[rt.length-1],wt=Jt==null?0:Jt.pmax;dt==null?De=null:(St==null&&(St=this.tokenMin),wt==null&&(wt=this.tokenMax),De={e:dt,pmin:St,pmax:wt,origin:this.origin,line:this.line})}break;default:this.unexpected(it);break e}break;case 7:break e;default:this.unexpected(it);break e}}let R=V.ESwitch(nt,H,De),ee=t,X=this.tokenMax;return R==null?null:(ee==null&&(ee=this.tokenMin),X==null&&(X=this.tokenMax),{e:R,pmin:ee,pmax:X,origin:this.origin,line:this.line});case"throw":let Q=this.parseExpr(),ae=V.EThrow(Q),_e=t,xe=Q==null?0:Q.pmax;return ae==null?null:(_e==null&&(_e=this.tokenMin),xe==null&&(xe=this.tokenMax),{e:ae,pmin:_e,pmax:xe,origin:this.origin,line:this.line});case"try":let Ye=this.parseExpr(),gt=this.token();pe.enumEq(gt,J.TId("catch"))||this.unexpected(gt);let Be=this.token();Be!=J.TPOpen&&this.unexpected(Be);let _t=this.getIdent(),ve=this.token();ve!=J.TDoubleDot&&this.unexpected(ve);let Pe=null;if(this.allowTypes)Pe=this.parseType();else{let it=this.token();pe.enumEq(it,J.TId("Dynamic"))||this.unexpected(it)}let ot=this.token();ot!=J.TPClose&&this.unexpected(ot);let tt=this.parseExpr(),bt=V.ETry(Ye,_t,Pe,tt),Kt=t,ft=tt==null?0:tt.pmax;return bt==null?null:(Kt==null&&(Kt=this.tokenMin),ft==null&&(ft=this.tokenMax),{e:bt,pmin:Kt,pmax:ft,origin:this.origin,line:this.line});case"var":let li=this.getIdent(),$e=this.token(),Bt=null;$e==J.TDoubleDot&&this.allowTypes&&(Bt=this.parseType(),$e=this.token());let It=null;switch($e._hx_index){case 3:$e.s=="="?It=this.parseExpr():this.unexpected($e);break;case 10:case 11:this.tokens.push({t:$e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;default:Bt!=null?(this.tokens.push({t:$e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):this.unexpected($e)}let Lt=V.EVar(li,Bt,It),mt=t,Vt=It==null?this.tokenMax:It==null?0:It.pmax;return Lt==null?null:(mt==null&&(mt=this.tokenMin),Vt==null&&(Vt=this.tokenMax),{e:Lt,pmin:mt,pmax:Vt,origin:this.origin,line:this.line});case"while":let Ht=this.parseExpr(),Ut=this.parseExpr(),ni=V.EWhile(Ht,Ut),si=t,jt=Ut==null?0:Ut.pmax;return ni==null?null:(si==null&&(si=this.tokenMin),jt==null&&(jt=this.tokenMax),{e:ni,pmin:si,pmax:jt,origin:this.origin,line:this.line});default:return null}}parseExprNext(e){let t=this.token();switch(t._hx_index){case 2:let i=t.s;return i=="is"?this.makeBinop(i,e,this.parseExpr()):(this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e);case 3:let l=t.s;if(l=="->"){let Be=e.e;switch(Be._hx_index){case 1:let _t=Be.v,ve=this.parseExpr(),Pe=V.EReturn(ve),ot=ve==null?0:ve.pmin,tt=null,bt;Pe==null?bt=null:(ot==null&&(ot=this.tokenMin),tt==null&&(tt=this.tokenMax),bt={e:Pe,pmin:ot,pmax:tt,origin:this.origin,line:this.line});let Kt=V.EFunction([{name:_t}],bt),ft=e==null?0:e.pmin,li=null;return Kt==null?null:(ft==null&&(ft=this.tokenMin),li==null&&(li=this.tokenMax),{e:Kt,pmin:ft,pmax:li,origin:this.origin,line:this.line});case 3:let $e=Be.e.e;if($e._hx_index==1){let It=$e.v,Lt=this.parseExpr(),mt=V.EReturn(Lt),Vt=Lt==null?0:Lt.pmin,Ht=null,Ut;mt==null?Ut=null:(Vt==null&&(Vt=this.tokenMin),Ht==null&&(Ht=this.tokenMax),Ut={e:mt,pmin:Vt,pmax:Ht,origin:this.origin,line:this.line});let ni=V.EFunction([{name:It}],Ut),si=e==null?0:e.pmin,jt=null;return ni==null?null:(si==null&&(si=this.tokenMin),jt==null&&(jt=this.tokenMax),{e:ni,pmin:si,pmax:jt,origin:this.origin,line:this.line})}break;case 26:let Bt=Be.e.e;if(Bt._hx_index==1){let It=Bt.v,Lt=Be.t,mt=this.parseExpr(),Vt=V.EReturn(mt),Ht=mt==null?0:mt.pmin,Ut=null,ni;Vt==null?ni=null:(Ht==null&&(Ht=this.tokenMin),Ut==null&&(Ut=this.tokenMax),ni={e:Vt,pmin:Ht,pmax:Ut,origin:this.origin,line:this.line});let si=V.EFunction([{name:It,t:Lt}],ni),jt=e==null?0:e.pmin,it=null;return si==null?null:(jt==null&&(jt=this.tokenMin),it==null&&(it=this.tokenMax),{e:si,pmin:jt,pmax:it,origin:this.origin,line:this.line})}break;default:}this.unexpected(t)}if(this.opPriority.h[l]==-1){let Be;if(this.isBlock(e))Be=!0;else{let tt=e.e;if(tt._hx_index==3){let bt=tt.e;Be=!0}else Be=!1}if(Be)return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e;let _t=V.EUnop(l,!1,e),ve=e==null?0:e.pmin,Pe=null,ot;return _t==null?ot=null:(ve==null&&(ve=this.tokenMin),Pe==null&&(Pe=this.tokenMax),ot={e:_t,pmin:ve,pmax:Pe,origin:this.origin,line:this.line}),this.parseExprNext(ot)}return this.makeBinop(l,e,this.parseExpr());case 4:let n=V.ECall(e,this.parseExprList(J.TPClose)),s=e==null?0:e.pmin,r=null,h;return n==null?h=null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),h={e:n,pmin:s,pmax:r,origin:this.origin,line:this.line}),this.parseExprNext(h);case 8:let a=this.getIdent(),o=V.EField(e,a),u=e==null?0:e.pmin,c=null,_;return o==null?_=null:(u==null&&(u=this.tokenMin),c==null&&(c=this.tokenMax),_={e:o,pmin:u,pmax:c,origin:this.origin,line:this.line}),this.parseExprNext(_);case 9:let f=this.getIdent(),m="__a_"+this.uid++,g=V.EVar(m,null,e),w=e==null?0:e.pmin,y=e==null?0:e.pmax,T;g==null?T=null:(w==null&&(w=this.tokenMin),y==null&&(y=this.tokenMax),T={e:g,pmin:w,pmax:y,origin:this.origin,line:this.line});let E=V.EIdent(m),C=e==null?0:e.pmin,P=e==null?0:e.pmax,I;E==null?I=null:(C==null&&(C=this.tokenMin),P==null&&(P=this.tokenMax),I={e:E,pmin:C,pmax:P,origin:this.origin,line:this.line});let v=V.EIdent("null"),F=e==null?0:e.pmin,B=e==null?0:e.pmax,A;v==null?A=null:(F==null&&(F=this.tokenMin),B==null&&(B=this.tokenMax),A={e:v,pmin:F,pmax:B,origin:this.origin,line:this.line});let L=V.EBinop("==",I,A),z=null,D=null,O;L==null?O=null:(z==null&&(z=this.tokenMin),D==null&&(D=this.tokenMax),O={e:L,pmin:z,pmax:D,origin:this.origin,line:this.line});let q=V.EIdent("null"),M=e==null?0:e.pmin,U=e==null?0:e.pmax,K;q==null?K=null:(M==null&&(M=this.tokenMin),U==null&&(U=this.tokenMax),K={e:q,pmin:M,pmax:U,origin:this.origin,line:this.line});let G=V.EIdent(m),Y=e==null?0:e.pmin,$=e==null?0:e.pmax,se;G==null?se=null:(Y==null&&(Y=this.tokenMin),$==null&&($=this.tokenMax),se={e:G,pmin:Y,pmax:$,origin:this.origin,line:this.line});let ue=V.EField(se,f),oe=e==null?0:e.pmin,ge=null,me;ue==null?me=null:(oe==null&&(oe=this.tokenMin),ge==null&&(ge=this.tokenMax),me={e:ue,pmin:oe,pmax:ge,origin:this.origin,line:this.line});let de=V.ETernary(O,K,me),Oe=null,Ve=null,je;de==null?je=null:(Oe==null&&(Oe=this.tokenMin),Ve==null&&(Ve=this.tokenMax),je={e:de,pmin:Oe,pmax:Ve,origin:this.origin,line:this.line});let et=V.EBlock([T,je]),Ue=e==null?0:e.pmin,Ge=null,nt;return et==null?nt=null:(Ue==null&&(Ue=this.tokenMin),Ge==null&&(Ge=this.tokenMax),nt={e:et,pmin:Ue,pmax:Ge,origin:this.origin,line:this.line}),this.parseExprNext(nt);case 12:let De=this.parseExpr(),H=this.token();H!=J.TBkClose&&this.unexpected(H);let ie=V.EArray(e,De),R=e==null?0:e.pmin,ee=null,X;return ie==null?X=null:(R==null&&(R=this.tokenMin),ee==null&&(ee=this.tokenMax),X={e:ie,pmin:R,pmax:ee,origin:this.origin,line:this.line}),this.parseExprNext(X);case 14:let Q=this.parseExpr(),ae=this.token();ae!=J.TDoubleDot&&this.unexpected(ae);let _e=this.parseExpr(),xe=V.ETernary(e,Q,_e),Ye=e==null?0:e.pmin,gt=_e==null?0:_e.pmax;return xe==null?null:(Ye==null&&(Ye=this.tokenMin),gt==null&&(gt=this.tokenMax),{e:xe,pmin:Ye,pmax:gt,origin:this.origin,line:this.line});default:return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e}}parseFunctionArgs(){let e=[],t=this.token();if(t!=J.TPClose){let i=!1;for(;!i;){let l=null,n=!1;if(t._hx_index==14&&(n=!0,t=this.token()),t._hx_index==2)l=t.s;else{this.unexpected(t);break}let s={name:l};switch(e.push(s),n&&(s.opt=!0),this.allowTypes&&(this.maybe(J.TDoubleDot)&&(s.t=this.parseType()),this.maybe(J.TOp("="))&&(s.value=this.parseExpr())),t=this.token(),t._hx_index){case 5:i=!0;break;case 10:t=this.token();break;default:this.unexpected(t)}}}return e}parseFunctionDecl(){let e=this.token();e!=J.TPOpen&&this.unexpected(e);let t=this.parseFunctionArgs(),i=null;if(this.allowTypes){let l=this.token();l!=J.TDoubleDot?(this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):i=this.parseType()}return{args:t,ret:i,body:this.parseExpr()}}parsePath(){let e=[this.getIdent()];for(;;){let t=this.token();if(t!=J.TDot){this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}e.push(this.getIdent())}return e}parseType(){let e=this.token(),t=this;switch(e._hx_index){case 2:let i=e.s;this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let l=this.parsePath(),n=null;if(e=this.token(),e._hx_index==3)if(e.s=="<"){n=[];e:for(;;){switch(n.push(this.parseType()),e=this.token(),e._hx_index){case 3:let c=e.s;if(c==">")break e;if(p.cca(c,0)==62){this.tokens.add({t:J.TOp(p.substr(c,1,null)),min:this.tokenMax-c.length-1,max:this.tokenMax});break e}break;case 10:continue;default:}this.unexpected(e);break}}else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;return this.parseTypeNext($t.CTPath(l,n));case 4:let s=this.token(),r=this.token();this.tokens.push({t:r,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.tokens.push({t:s,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let h=function(u){let c=t.token();if(c._hx_index==3){if(c.s!="->"){let _=c;t.unexpected(_)}}else{let _=c;t.unexpected(_)}return $t.CTFun(u,t.parseType())};switch(s._hx_index){case 2:let u=s.s;if(r._hx_index==15){let y=[],T=0,E=this.parseFunctionArgs();for(;T<E.length;){let P=E[T];++T;let I=P.value;if(I!=null){let v=I;if(!this.resumeErrors)throw b.thrown(new Ce(be.ECustom("Default values not allowed in function types"),v.pmin,v.pmax,this.origin,this.line))}y.push($t.CTNamed(P.name,P.opt?$t.CTOpt(P.t):P.t))}return h(y)}else{let y=this.parseType(),T=this.token();switch(T._hx_index){case 5:return this.parseTypeNext($t.CTParent(y));case 10:let E=[y];do E.push(this.parseType());while(this.maybe(J.TComma));let C=this.token();return C!=J.TPClose&&this.unexpected(C),h(E);default:let P=T;return this.unexpected(P)}}break;case 5:let c=[],_=0,f=this.parseFunctionArgs();for(;_<f.length;){let y=f[_];++_;let T=y.value;if(T!=null){let E=T;if(!this.resumeErrors)throw b.thrown(new Ce(be.ECustom("Default values not allowed in function types"),E.pmin,E.pmax,this.origin,this.line))}c.push($t.CTNamed(y.name,y.opt?$t.CTOpt(y.t):y.t))}return h(c);default:let g=this.parseType(),w=this.token();switch(w._hx_index){case 5:return this.parseTypeNext($t.CTParent(g));case 10:let y=[g];do y.push(this.parseType());while(this.maybe(J.TComma));let T=this.token();return T!=J.TPClose&&this.unexpected(T),h(y);default:let E=w;return this.unexpected(E)}}break;case 6:let a=[],o=null;e:for(;;)switch(e=this.token(),e._hx_index){case 2:let u=e.s;if(u=="var"){let _=this.getIdent(),f=this.token();f!=J.TDoubleDot&&this.unexpected(f),a.push({name:_,t:this.parseType(),meta:o}),o=null;let m=this.token();m!=J.TSemicolon&&this.unexpected(m)}else{let _=u,f=this.token();switch(f!=J.TDoubleDot&&this.unexpected(f),a.push({name:_,t:this.parseType(),meta:o}),e=this.token(),e._hx_index){case 7:break e;case 10:break;default:this.unexpected(e)}}break;case 7:break e;case 16:let c=e.s;o==null&&(o=[]),o.push({name:c,params:this.parseMetaArgs()});break;default:this.unexpected(e);break e}return this.parseTypeNext($t.CTAnon(a));default:return this.unexpected(e)}}parseTypeNext(e){let t=this.token();if(t._hx_index==3){if(t.s!="->")return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e}else return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e;let i=this.parseType();if(i._hx_index==1){let l=i.ret;return i.args.unshift(e),i}else return $t.CTFun([e],i)}parseExprList(e){let t=[],i=this.token();if(i==e)return t;for(this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;;)if(t.push(this.parseExpr()),i=this.token(),i._hx_index!=10){if(i==e)break;this.unexpected(i);break}return t}parseModule(e,t,i){i==null&&(i=0),t==null&&(t="hscript"),this.initParser(t,i),this.input=e,this.readPos=0,this.allowTypes=!0,this.allowMetadata=!0;let l=[];for(;;){let n=this.token();if(n==J.TEof)break;this.tokens.push({t:n,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,l.push(this.parseModuleDecl())}return l}parseMetadata(){let e=[];for(;;){let t=this.token();if(t._hx_index==16){let i=t.s;e.push({name:i,params:this.parseMetaArgs()})}else{this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}return e}parseParams(){if(this.maybe(J.TOp("<"))&&!this.resumeErrors)throw b.thrown(new Ce(be.EInvalidOp("Unsupported class type parameters"),this.readPos+this.offset,this.readPos+this.offset,this.origin,this.line));return{}}parseModuleDecl(){let e=this.parseMetadata(),t=this.getIdent(),i=!1,l=!1;e:for(;;){switch(t){case"extern":l=!0;break;case"private":i=!0;break;default:break e}t=this.getIdent()}switch(t){case"class":let n=this.getIdent(),s=this.parseParams(),r=null,h=[];e:for(;;){let E=this.token();if(E._hx_index==2)switch(E.s){case"extends":r=this.parseType();break;case"implements":h.push(this.parseType());break;default:this.tokens.push({t:E,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break e}else{this.tokens.push({t:E,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}let a=[],o=this.token();for(o!=J.TBrOpen&&this.unexpected(o);!this.maybe(J.TBrClose);)a.push(this.parseField());return ji.DClass({name:n,meta:e,params:s,extend:r,implement:h,fields:a,isPrivate:i,isExtern:l});case"import":let u=[this.getIdent()],c=!1;for(;;){let E=this.token();if(E!=J.TDot){this.tokens.push({t:E,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}switch(E=this.token(),E._hx_index){case 2:let C=E.s;u.push(C);break;case 3:E.s=="*"?c=!0:this.unexpected(E);break;default:this.unexpected(E)}}let _=this.token();return _!=J.TSemicolon&&this.unexpected(_),ji.DImport(u,c);case"package":let f=this.parsePath(),m=this.token();return m!=J.TSemicolon&&this.unexpected(m),ji.DPackage(f);case"typedef":let g=this.getIdent(),w=this.parseParams(),y=this.token();pe.enumEq(y,J.TOp("="))||this.unexpected(y);let T=this.parseType();return ji.DTypedef({name:g,meta:e,params:w,isPrivate:i,t:T});default:this.unexpected(J.TId(t))}return null}parseField(){let e=this.parseMetadata(),t=[];e:for(;;){let i=this.getIdent();switch(i){case"function":let l=this.getIdent(),n=this.parseFunctionDecl();return{name:l,meta:e,access:t,kind:Fl.KFunction({args:n.args,expr:n.body,ret:n.ret})};case"inline":t.push(Ei.AInline);break;case"macro":t.push(Ei.AMacro);break;case"override":t.push(Ei.AOverride);break;case"private":t.push(Ei.APrivate);break;case"public":t.push(Ei.APublic);break;case"static":t.push(Ei.AStatic);break;case"var":let s=this.getIdent(),r=null,h=null;if(this.maybe(J.TPOpen)){r=this.getIdent();let u=this.token();u!=J.TComma&&this.unexpected(u),h=this.getIdent();let c=this.token();c!=J.TPClose&&this.unexpected(c)}let a=this.maybe(J.TDoubleDot)?this.parseType():null,o=this.maybe(J.TOp("="))?this.parseExpr():null;if(o!=null)if(this.isBlock(o))this.maybe(J.TSemicolon);else{let u=this.token();u!=J.TSemicolon&&this.unexpected(u)}else{let u;if(a!=null)if(a==null)u=!1;else if(a._hx_index==2){let c=a.fields;u=!0}else u=!1;else u=!1;if(u)this.maybe(J.TSemicolon);else{let c=this.token();c!=J.TSemicolon&&this.unexpected(c)}}return{name:s,meta:e,access:t,kind:Fl.KVar({get:r,set:h,type:a,expr:o})};default:this.unexpected(J.TId(i));break e}}return null}readChar(){return this.input.charCodeAt(this.readPos++)}readString(e){let t=0,i="",l=!1,n=this.line,s=this.input,r=this.readPos+this.offset-1;for(;;){let h=this.input.charCodeAt(this.readPos++);if(h!=h){if(this.line=n,!this.resumeErrors)throw b.thrown(new Ce(be.EUnterminatedString,r,r,this.origin,this.line));break}if(l)switch(l=!1,h){case 47:this.allowJSON?i+=String.fromCodePoint(h):this.invalidChar(h);break;case 34:case 39:case 92:i+=String.fromCodePoint(h);break;case 110:i+=String.fromCodePoint(10);break;case 114:i+=String.fromCodePoint(13);break;case 116:i+=String.fromCodePoint(9);break;case 117:this.allowJSON||this.invalidChar(h);let a=0,o=0;for(;o<4;){let u=o++;a<<=4;let c=this.input.charCodeAt(this.readPos++);switch(c){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a+=c-48;break;case 65:case 66:case 67:case 68:case 69:case 70:a+=c-55;break;case 97:case 98:case 99:case 100:case 101:case 102:a+=c-87;break;default:if(c!=c&&(this.line=n,!this.resumeErrors))throw b.thrown(new Ce(be.EUnterminatedString,r,r,this.origin,this.line));this.invalidChar(c)}}i+=String.fromCodePoint(a);break;default:this.invalidChar(h)}else if(h==92)l=!0;else{if(h==e)break;h==10&&this.line++,i+=String.fromCodePoint(h)}}return i}token(){let e=this.tokens.pop();if(e!=null)return this.tokenMin=e.min,this.tokenMax=e.max,e.t;this.oldTokenMin=this.tokenMin,this.oldTokenMax=this.tokenMax,this.tokenMin=this.char<0?this.readPos+this.offset:this.readPos+this.offset-1;let t=this._token();return this.tokenMax=this.char<0?this.readPos+this.offset-1:this.readPos+this.offset-2,t}_token(){let e;for(this.char<0?e=this.input.charCodeAt(this.readPos++):(e=this.char,this.char=-1);;){if(e!=e)return this.char=e,J.TEof;switch(e){case 0:return J.TEof;case 10:this.line++,this.tokenMin++;break;case 9:case 13:case 32:this.tokenMin++;break;case 34:case 39:return J.TConst(fi.CString(this.readString(e)));case 35:if(e=this.input.charCodeAt(this.readPos++),this.idents[e]){let l=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),!this.idents[e])return this.char=e,this.preprocess(l);l+=String.fromCodePoint(e)}}this.invalidChar(e);break;case 40:return J.TPOpen;case 41:return J.TPClose;case 44:return J.TComma;case 46:switch(e=this.input.charCodeAt(this.readPos++),e){case 46:return e=this.input.charCodeAt(this.readPos++),e!=46&&this.invalidChar(e),J.TOp("...");case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:let l=e-48,n=1;for(;;)switch(e=this.input.charCodeAt(this.readPos++),n*=10,e){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:l=l*10+(e-48);break;default:return this.char=e,J.TConst(fi.CFloat(l/n))}break;default:return this.char=e,J.TDot}break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:let t=(e-48)*1,i=0;for(;;)switch(e=this.input.charCodeAt(this.readPos++),i*=10,e){case 46:if(i>0){if(i==10&&this.input.charCodeAt(this.readPos++)==46){this.tokens.push({t:J.TOp("..."),min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let h=t|0;return J.TConst(h==t?fi.CInt(h):fi.CFloat(t))}this.invalidChar(e)}i=1;break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:t=t*10+(e-48);break;case 69:case 101:let l=this.token(),n=null;switch(l._hx_index){case 1:let h=l.c;h._hx_index==0?n=h.v:(this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax);break;case 3:if(l.s=="-")if(l=this.token(),l._hx_index==1){let a=l.c;a._hx_index==0?n=-a.v:(this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax)}else this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;else this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;default:this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}return n==null&&this.invalidChar(e),i==0&&(i=10),J.TConst(fi.CFloat(Math.pow(10,n)/i*t*10));case 120:(t>0||i>0)&&this.invalidChar(e);let s=0;for(;;)switch(e=this.input.charCodeAt(this.readPos++),e){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:s=(s<<4)+e-48;break;case 65:case 66:case 67:case 68:case 69:case 70:s=(s<<4)+(e-55);break;case 97:case 98:case 99:case 100:case 101:case 102:s=(s<<4)+(e-87);break;default:return this.char=e,J.TConst(fi.CInt(s))}break;default:this.char=e;let r=t|0;return J.TConst(i>0?fi.CFloat(t*10/i):r==t?fi.CInt(r):fi.CFloat(t))}break;case 58:return J.TDoubleDot;case 59:return J.TSemicolon;case 61:return e=this.input.charCodeAt(this.readPos++),e==61?J.TOp("=="):e==62?J.TOp("=>"):(this.char=e,J.TOp("="));case 63:return e=this.input.charCodeAt(this.readPos++),e==46?J.TQuestionDot:(this.char=e,J.TQuestion);case 64:if(e=this.input.charCodeAt(this.readPos++),this.idents[e]||e==58){let l=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),!this.idents[e])return this.char=e,J.TMeta(l);l+=String.fromCodePoint(e)}}this.invalidChar(e);break;case 91:return J.TBkOpen;case 93:return J.TBkClose;case 123:return J.TBrOpen;case 125:return J.TBrClose;default:if(this.ops[e]){let l=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),e!=e&&(e=0),!this.ops[e])return this.char=e,J.TOp(l);let n=l;if(l+=String.fromCodePoint(e),!Object.prototype.hasOwnProperty.call(this.opPriority.h,l)&&Object.prototype.hasOwnProperty.call(this.opPriority.h,n))return l=="//"||l=="/*"?this.tokenComment(l,e):(this.char=e,J.TOp(n))}}if(this.idents[e]){let l=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),e!=e&&(e=0),!this.idents[e])return this.char=e,J.TId(l);l+=String.fromCodePoint(e)}}this.invalidChar(e)}e=this.input.charCodeAt(this.readPos++)}}preprocValue(e){return this.preprocesorValues.h[e]}parsePreproCond(){let e=this.token();switch(e._hx_index){case 2:let t=e.s,i=V.EIdent(t),l=this.tokenMin,n=this.tokenMax;return i==null?null:(l==null&&(l=this.tokenMin),n==null&&(n=this.tokenMax),{e:i,pmin:l,pmax:n,origin:this.origin,line:this.line});case 3:if(e.s=="!"){let s=V.EUnop("!",!0,this.parsePreproCond()),r=this.tokenMin,h=this.tokenMax;return s==null?null:(r==null&&(r=this.tokenMin),h==null&&(h=this.tokenMax),{e:s,pmin:r,pmax:h,origin:this.origin,line:this.line})}else return this.unexpected(e);break;case 4:return this.tokens.push({t:J.TPOpen,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.parseExpr();default:return this.unexpected(e)}}evalPreproCond(e){let t=e.e;switch(t._hx_index){case 1:let i=t.v;return this.preprocValue(i)!=null;case 3:let l=t.e;return this.evalPreproCond(l);case 6:let n=t.e1,s=t.e2;switch(t.op){case"&&":let a=n,o=s;return this.evalPreproCond(a)?this.evalPreproCond(o):!1;case"||":let u=n,c=s;return this.evalPreproCond(u)?!0:this.evalPreproCond(c);default:let _=e.e;if(!this.resumeErrors)throw b.thrown(new Ce(be.EInvalidPreprocessor("Can't eval "+Qe[_.__enum__].__constructs__[_._hx_index]._hx_name),this.readPos+this.offset,this.readPos+this.offset,this.origin,this.line));return!1}break;case 7:let r=t.prefix;if(t.op=="!"){let a=t.e;return!this.evalPreproCond(a)}else{let a=e.e;if(!this.resumeErrors)throw b.thrown(new Ce(be.EInvalidPreprocessor("Can't eval "+Qe[a.__enum__].__constructs__[a._hx_index]._hx_name),this.readPos+this.offset,this.readPos+this.offset,this.origin,this.line));return!1}break;default:let h=e.e;if(!this.resumeErrors)throw b.thrown(new Ce(be.EInvalidPreprocessor("Can't eval "+Qe[h.__enum__].__constructs__[h._hx_index]._hx_name),this.readPos+this.offset,this.readPos+this.offset,this.origin,this.line));return!1}}preprocess(e){switch(e){case"else":case"elseif":return this.preprocStack.length>0?this.preprocStack[this.preprocStack.length-1].r?(this.preprocStack[this.preprocStack.length-1].r=!1,this.skipTokens(),this.token()):e=="else"?(this.preprocStack.pop(),this.preprocStack.push({r:!0}),this.token()):(this.preprocStack.pop(),this.preprocess("if")):J.TPrepro(e);case"end":return this.preprocStack.length>0?(this.preprocStack.pop(),this.token()):J.TPrepro(e);case"if":let t=this.parsePreproCond();return this.evalPreproCond(t)?(this.preprocStack.push({r:!0}),this.token()):(this.preprocStack.push({r:!1}),this.skipTokens(),this.token());default:return J.TPrepro(e)}}skipTokens(){let e=this.preprocStack.length-1,t=this.preprocStack[e],i=this.readPos+this.offset;for(;;){let l=this.token();if(l==J.TEof&&!this.resumeErrors)throw b.thrown(new Ce(be.EInvalidPreprocessor("Unclosed"),i,i,this.origin,this.line));if(this.preprocStack[e]!=t){this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}}tokenComment(e,t){let i=p.cca(e,1),l=this.input;if(i==47){for(;t!=13&&t!=10&&(t=this.input.charCodeAt(this.readPos++),t==t););return this.char=t,this.token()}if(i==42){let n=this.line;if(e=="/**/")return this.char=t,this.token();do{for(;t!=42;)if(t==10&&this.line++,t=this.input.charCodeAt(this.readPos++),t!=t){if(this.line=n,!this.resumeErrors)throw b.thrown(new Ce(be.EUnterminatedComment,this.tokenMin,this.tokenMin,this.origin,this.line));break}if(t=this.input.charCodeAt(this.readPos++),t!=t){if(this.line=n,!this.resumeErrors)throw b.thrown(new Ce(be.EUnterminatedComment,this.tokenMin,this.tokenMin,this.origin,this.line));break}}while(t!=47);return this.token()}return this.char=t,J.TOp(e)}constString(e){switch(e._hx_index){case 0:let t=e.v;return t==null?"null":""+t;case 1:let i=e.f;return i==null?"null":""+i;case 2:return e.s}}tokenString(e){switch(e._hx_index){case 0:return"<eof>";case 1:let t=e.c;return this.constString(t);case 2:return e.s;case 3:return e.s;case 4:return"(";case 5:return")";case 6:return"{";case 7:return"}";case 8:return".";case 9:return"?.";case 10:return",";case 11:return";";case 12:return"[";case 13:return"]";case 14:return"?";case 15:return":";case 16:return"@"+e.s;case 17:return"#"+e.s}}}j["hscript.Parser"]=tl,tl.__name__="hscript.Parser",Object.assign(tl.prototype,{__class__:tl,__properties__:{get_currentPos:"get_currentPos"}});class ol{constructor(){}exprToString(e){return this.buf=new Xt,this.tabs="",this.expr(e),this.buf.b}typeToString(e){return this.buf=new Xt,this.tabs="",this.type(e),this.buf.b}add(e){this.buf.b+=le.string(e)}type(e){switch(e._hx_index){case 0:let t=e.path,i=e.params,l=t.join(".");if(this.buf.b+=le.string(l),i!=null){this.buf.b+="<";let g=!0,w=0;for(;w<i.length;){let y=i[w];++w,g?g=!1:this.buf.b+=", ",this.type(y)}this.buf.b+=">"}break;case 1:let n=e.args,s=e.ret,r=n,h=s;if(tn.exists(r,function(g){if(g._hx_index==5){let w=g.n,y=g.t;return!0}else return!1})){this.buf.b+="(";let g=0;for(;g<r.length;){let w=r[g];if(++g,w._hx_index==5){let y=w.n,T=w.t;this.type(w)}else this.type($t.CTNamed("_",w))}this.buf.b+=")->",this.type(h)}else{let g=n,w=s;if(g.length==0)this.buf.b+="Void -> ";else{let y=0;for(;y<g.length;){let T=g[y];++y,this.type(T),this.buf.b+=" -> "}}this.type(w)}break;case 2:let a=e.fields;this.buf.b+="{";let o=!0,u=0;for(;u<a.length;){let g=a[u];++u,o?(o=!1,this.buf.b+=" "):this.buf.b+=", ",this.buf.b+=le.string(g.name+" : "),this.type(g.t)}this.buf.b+=o?"}":" }";break;case 3:let c=e.t;this.buf.b+="(",this.type(c),this.buf.b+=")";break;case 4:let _=e.t;this.buf.b+="?",this.type(_);break;case 5:let f=e.n,m=e.t;this.buf.b+=f==null?"null":""+f,this.buf.b+=":",this.type(m);break}}addType(e){e!=null&&(this.buf.b+=" : ",this.type(e))}expr(e){if(e==null){this.buf.b+="??NULL??";return}let t=e.e;switch(t._hx_index){case 0:let i=t.c;switch(i._hx_index){case 0:let ve=i.v;this.buf.b+=ve==null?"null":""+ve;break;case 1:let Pe=i.f;this.buf.b+=Pe==null?"null":""+Pe;break;case 2:let ot=i.s;this.buf.b+='"';let tt=ot.split('"').join('\\"').split(`
|
|
14
|
-
`).join("\\n").split("\r").join("\\r").split(" ").join("\\t");this.buf.b+=le.string(tt),this.buf.b+='"';break}break;case 1:let l=t.v;this.buf.b+=l==null?"null":""+l;break;case 2:let n=t.n,s=t.t,r=t.e;this.buf.b+=le.string("var "+n),this.addType(s),r!=null&&(this.buf.b+=" = ",this.expr(r));break;case 3:let h=t.e;this.buf.b+="(",this.expr(h),this.buf.b+=")";break;case 4:let a=t.e;if(a.length==0)this.buf.b+="{}";else{this.tabs+=" ",this.buf.b+=`{
|
|
15
|
-
`;let ve=0;for(;ve<a.length;){let Pe=a[ve];++ve,this.buf.b+=le.string(this.tabs),this.expr(Pe),this.buf.b+=`;
|
|
16
|
-
`}this.tabs=p.substr(this.tabs,1,null),this.buf.b+="}"}break;case 5:let o=t.e,u=t.f;this.expr(o),this.buf.b+=le.string("."+u);break;case 6:let c=t.op,_=t.e1,f=t.e2;this.expr(_),this.buf.b+=le.string(" "+c+" "),this.expr(f);break;case 7:let m=t.op,g=t.prefix,w=t.e;g?(this.buf.b+=m==null?"null":""+m,this.expr(w)):(this.expr(w),this.buf.b+=m==null?"null":""+m);break;case 8:let y=t.e,T=t.params;if(y==null)this.expr(y);else{let ve=y.e;switch(ve._hx_index){case 0:let Pe=ve.c;this.expr(y);break;case 1:let ot=ve.v;this.expr(y);break;case 5:let tt=ve.e,bt=ve.f;this.expr(y);break;default:this.buf.b+="(",this.expr(y),this.buf.b+=")"}}this.buf.b+="(";let E=!0,C=0;for(;C<T.length;){let ve=T[C];++C,E?E=!1:this.buf.b+=", ",this.expr(ve)}this.buf.b+=")";break;case 9:let P=t.cond,I=t.e1,v=t.e2;this.buf.b+="if( ",this.expr(P),this.buf.b+=" ) ",this.expr(I),v!=null&&(this.buf.b+=" else ",this.expr(v));break;case 10:let F=t.cond,B=t.e;this.buf.b+="while( ",this.expr(F),this.buf.b+=" ) ",this.expr(B);break;case 11:let A=t.v,L=t.it,z=t.e;this.buf.b+=le.string("for( "+A+" in "),this.expr(L),this.buf.b+=" ) ",this.expr(z);break;case 12:this.buf.b+="break";break;case 13:this.buf.b+="continue";break;case 14:let D=t.args,O=t.e,q=t.name,M=t.ret;this.buf.b+="function",q!=null&&(this.buf.b+=le.string(" "+q)),this.buf.b+="(";let U=!0,K=0;for(;K<D.length;){let ve=D[K];++K,U?U=!1:this.buf.b+=", ",ve.opt&&(this.buf.b+="?"),this.buf.b+=le.string(ve.name),this.addType(ve.t)}this.buf.b+=")",this.addType(M),this.buf.b+=" ",this.expr(O);break;case 15:let G=t.e;this.buf.b+="return",G!=null&&(this.buf.b+=" ",this.expr(G));break;case 16:let Y=t.e,$=t.index;this.expr(Y),this.buf.b+="[",this.expr($),this.buf.b+="]";break;case 17:let se=t.e;this.buf.b+="[";let ue=!0,oe=0;for(;oe<se.length;){let ve=se[oe];++oe,ue?ue=!1:this.buf.b+=", ",this.expr(ve)}this.buf.b+="]";break;case 18:let ge=t.cl,me=t.params;this.buf.b+=le.string("new "+ge+"(");let de=!0,Oe=0;for(;Oe<me.length;){let ve=me[Oe];++Oe,de?de=!1:this.buf.b+=", ",this.expr(ve)}this.buf.b+=")";break;case 19:let Ve=t.e;this.buf.b+="throw ",this.expr(Ve);break;case 20:let je=t.e,et=t.v,Ue=t.t,Ge=t.ecatch;this.buf.b+="try ",this.expr(je),this.buf.b+=le.string(" catch( "+et),this.addType(Ue),this.buf.b+=") ",this.expr(Ge);break;case 21:let nt=t.fl;if(nt.length==0)this.buf.b+="{}";else{this.tabs+=" ",this.buf.b+=`{
|
|
17
|
-
`;let ve=0;for(;ve<nt.length;){let Pe=nt[ve];++ve,this.buf.b+=le.string(this.tabs),this.buf.b+=le.string(Pe.name+" : "),this.expr(Pe.e),this.buf.b+=`,
|
|
18
|
-
`}this.tabs=p.substr(this.tabs,1,null),this.buf.b+="}"}break;case 22:let De=t.cond,H=t.e1,ie=t.e2;this.expr(De),this.buf.b+=" ? ",this.expr(H),this.buf.b+=" : ",this.expr(ie);break;case 23:let R=t.e,ee=t.cases,X=t.defaultExpr;this.buf.b+="switch( ",this.expr(R),this.buf.b+=") {";let Q=0;for(;Q<ee.length;){let ve=ee[Q];++Q,this.buf.b+="case ";let Pe=!0,ot=0,tt=ve.values;for(;ot<tt.length;){let bt=tt[ot];++ot,Pe?Pe=!1:this.buf.b+=", ",this.expr(bt)}this.buf.b+=": ",this.expr(ve.expr),this.buf.b+=`;
|
|
19
|
-
`}X!=null&&(this.buf.b+="default: ",this.expr(X),this.buf.b+=`;
|
|
20
|
-
`),this.buf.b+="}";break;case 24:let ae=t.cond,_e=t.e;this.buf.b+="do ",this.expr(_e),this.buf.b+=" while ( ",this.expr(ae),this.buf.b+=" )";break;case 25:let xe=t.name,Ye=t.args,gt=t.e;if(this.buf.b+="@",this.buf.b+=xe==null?"null":""+xe,Ye!=null&&Ye.length>0){this.buf.b+="(";let ve=!0,Pe=0;for(;Pe<Ye.length;){let ot=Ye[Pe];++Pe,ve?ve=!1:this.buf.b+=", ",this.expr(gt)}this.buf.b+=")"}this.buf.b+=" ",this.expr(gt);break;case 26:let Be=t.e,_t=t.t;this.buf.b+="(",this.expr(Be),this.buf.b+=" : ",this.addType(_t),this.buf.b+=")";break}}static toString(e){return new ol().exprToString(e)}static errorToString(e){let t,i=e.e;switch(i._hx_index){case 0:let l=i.c;t="Invalid character: '"+(l!=l?"EOF":String.fromCodePoint(l))+"' ("+l+")";break;case 1:t='Unexpected token: "'+i.s+'"';break;case 2:t="Unterminated string";break;case 3:t="Unterminated comment";break;case 4:t="Invalid preprocessor ("+i.msg+")";break;case 5:t="Unknown variable: "+i.v;break;case 6:t="Invalid iterator: "+i.v;break;case 7:t="Invalid operator: "+i.op;break;case 8:t="Invalid access to field "+i.f;break;case 9:t=i.msg;break}return e.origin+":"+e.line+": "+t}}j["hscript.Printer"]=ol,ol.__name__="hscript.Printer",Object.assign(ol.prototype,{__class__:ol});class en{static iter(e,t){let i=e.e;switch(i._hx_index){case 0:let l=i.c;break;case 1:let n=i.v;break;case 2:let s=i.n,r=i.t,h=i.e;h!=null&&t(h);break;case 3:let a=i.e;t(a);break;case 4:let o=i.e,u=0;for(;u<o.length;){let Be=o[u];++u,t(Be)}break;case 5:let c=i.f,_=i.e;t(_);break;case 6:let f=i.op,m=i.e1,g=i.e2;t(m),t(g);break;case 7:let w=i.op,y=i.prefix,T=i.e;t(T);break;case 8:let E=i.e,C=i.params;t(E);let P=0;for(;P<C.length;){let Be=C[P];++P,t(Be)}break;case 9:let I=i.cond,v=i.e1,F=i.e2;t(I),t(v),F!=null&&t(F);break;case 10:let B=i.cond,A=i.e;t(B),t(A);break;case 11:let L=i.v,z=i.it,D=i.e;t(z),t(D);break;case 12:case 13:break;case 14:let O=i.args,q=i.name,M=i.ret,U=i.e;t(U);break;case 15:let K=i.e;K!=null&&t(K);break;case 16:let G=i.e,Y=i.index;t(G),t(Y);break;case 17:let $=i.e,se=0;for(;se<$.length;){let Be=$[se];++se,t(Be)}break;case 18:let ue=i.cl,oe=i.params,ge=0;for(;ge<oe.length;){let Be=oe[ge];++ge,t(Be)}break;case 19:let me=i.e;t(me);break;case 20:let de=i.v,Oe=i.t,Ve=i.e,je=i.ecatch;t(Ve),t(je);break;case 21:let et=i.fl,Ue=0;for(;Ue<et.length;){let Be=et[Ue];++Ue,t(Be.e)}break;case 22:let Ge=i.cond,nt=i.e1,De=i.e2;t(Ge),t(nt),t(De);break;case 23:let H=i.e,ie=i.cases,R=i.defaultExpr;t(H);let ee=0;for(;ee<ie.length;){let Be=ie[ee];++ee;let _t=0,ve=Be.values;for(;_t<ve.length;){let Pe=ve[_t];++_t,t(Pe)}t(Be.expr)}R!=null&&t(R);break;case 24:let X=i.cond,Q=i.e;t(X),t(Q);break;case 25:let ae=i.name,_e=i.args,xe=i.e;if(_e!=null){let Be=0;for(;Be<_e.length;){let _t=_e[Be];++Be,t(_t)}}t(xe);break;case 26:let Ye=i.t,gt=i.e;t(gt);break}}static map(e,t){let i,l=e.e;switch(l._hx_index){case 0:let n=l.c;i=e.e;break;case 1:let s=l.v;i=e.e;break;case 2:let r=l.n,h=l.t,a=l.e;i=V.EVar(r,h,a!=null?t(a):null);break;case 3:let o=l.e;i=V.EParent(t(o));break;case 4:let u=l.e,c=[],_=0;for(;_<u.length;){let $e=u[_];++_,c.push(t($e))}i=V.EBlock(c);break;case 5:let f=l.e,m=l.f;i=V.EField(t(f),m);break;case 6:let g=l.op,w=l.e1,y=l.e2;i=V.EBinop(g,t(w),t(y));break;case 7:let T=l.op,E=l.prefix,C=l.e;i=V.EUnop(T,E,t(C));break;case 8:let P=l.e,I=l.params,v=t(P),F=[],B=0;for(;B<I.length;){let $e=I[B];++B,F.push(t($e))}i=V.ECall(v,F);break;case 9:let A=l.cond,L=l.e1,z=l.e2;i=V.EIf(t(A),t(L),z!=null?t(z):null);break;case 10:let D=l.cond,O=l.e;i=V.EWhile(t(D),t(O));break;case 11:let q=l.v,M=l.it,U=l.e;i=V.EFor(q,t(M),t(U));break;case 12:case 13:i=e.e;break;case 14:let K=l.args,G=l.e,Y=l.name,$=l.ret;i=V.EFunction(K,t(G),Y,$);break;case 15:let se=l.e;i=V.EReturn(se!=null?t(se):null);break;case 16:let ue=l.e,oe=l.index;i=V.EArray(t(ue),t(oe));break;case 17:let ge=l.e,me=[],de=0;for(;de<ge.length;){let $e=ge[de];++de,me.push(t($e))}i=V.EArrayDecl(me);break;case 18:let Oe=l.cl,Ve=l.params,je=[],et=0;for(;et<Ve.length;){let $e=Ve[et];++et,je.push(t($e))}i=V.ENew(Oe,je);break;case 19:let Ue=l.e;i=V.EThrow(t(Ue));break;case 20:let Ge=l.e,nt=l.v,De=l.t,H=l.ecatch;i=V.ETry(t(Ge),nt,De,t(H));break;case 21:let ie=l.fl,R=[],ee=0;for(;ee<ie.length;){let $e=ie[ee];++ee,R.push({name:$e.name,e:t($e.e)})}i=V.EObject(R);break;case 22:let X=l.cond,Q=l.e1,ae=l.e2;i=V.ETernary(t(X),t(Q),t(ae));break;case 23:let _e=l.e,xe=l.cases,Ye=l.defaultExpr,gt=t(_e),Be=[],_t=0;for(;_t<xe.length;){let $e=xe[_t];++_t;let Bt=[],It=0,Lt=$e.values;for(;It<Lt.length;){let mt=Lt[It];++It,Bt.push(t(mt))}Be.push({values:Bt,expr:t($e.expr)})}i=V.ESwitch(gt,Be,Ye==null?null:t(Ye));break;case 24:let ve=l.cond,Pe=l.e;i=V.EDoWhile(t(ve),t(Pe));break;case 25:let ot=l.name,tt=l.args,bt=l.e,Kt;if(tt==null)Kt=null;else{let $e=[],Bt=0;for(;Bt<tt.length;){let It=tt[Bt];++Bt,$e.push(t(It))}Kt=$e}i=V.EMeta(ot,Kt,t(bt));break;case 26:let ft=l.e,li=l.t;i=V.ECheckType(t(ft),li);break}return{e:i,pmin:e.pmin,pmax:e.pmax,origin:e.origin,line:e.line}}static expr(e){return e.e}static mk(e,t){return{e,pmin:t.pmin,pmax:t.pmax,origin:t.origin,line:t.line}}}j["hscript.Tools"]=en,en.__name__="hscript.Tools";class te{static getClass(e){if(e==null)return null;if(e instanceof Array)return Array;{let t=e.__class__;if(t!=null)return t;let i=te.__nativeClassName(e);return i!=null?te.__resolveNativeClass(i):null}}static __string_rec(e,t){if(e==null)return"null";if(t.length>=5)return"<...>";let i=typeof e;switch(i=="function"&&(e.__name__||e.__ename__)&&(i="object"),i){case"function":return"<function>";case"object":if(e.__enum__){let a=Qe[e.__enum__].__constructs__[e._hx_index],o=a._hx_name;return a.__params__?(t=t+" ",o+"("+(function(u){var c;let _=[];{let f=0,m=a.__params__;for(;f<m.length;){let g=m[f];f=f+1,_.push(te.__string_rec(e[g],t))}}return c=_,c})(this).join(",")+")"):o}if(e instanceof Array){let h="[";t+=" ";let a=0,o=e.length;for(;a<o;){let u=a++;h+=(u>0?",":"")+te.__string_rec(e[u],t)}return h+="]",h}let l;try{l=e.toString}catch{return"???"}if(l!=null&&l!=Object.toString&&typeof l=="function"){let h=e.toString();if(h!="[object Object]")return h}let n=`{
|
|
7
|
+
`);break;case 1:if(e.nodeType==V.Document||e.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":de.toString(e.nodeType)));let i=e.nodeValue;if(i.length!=0){let o=t+He.htmlEscape(i);this.output.b+=Y.string(o),this.pretty&&(this.output.b+=`
|
|
8
|
+
`)}break;case 2:if(this.output.b+=Y.string(t+"<![CDATA["),e.nodeType==V.Document||e.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.output.b+=Y.string(e.nodeValue),this.output.b+="]]>",this.pretty&&(this.output.b+=`
|
|
9
|
+
`);break;case 3:if(e.nodeType==V.Document||e.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":de.toString(e.nodeType)));let n=e.nodeValue,s=new RegExp(`[
|
|
10
|
+
\r ]+`,"g".split("u").join(""));n=n.replace(s,""),n="<!--"+n+"-->",this.output.b+=t==null?"null":""+t;let r=He.trim(n);this.output.b+=Y.string(r),this.pretty&&(this.output.b+=`
|
|
11
|
+
`);break;case 4:if(e.nodeType==V.Document||e.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.output.b+=Y.string("<!DOCTYPE "+e.nodeValue+">"),this.pretty&&(this.output.b+=`
|
|
12
|
+
`);break;case 5:if(e.nodeType==V.Document||e.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.output.b+=Y.string("<?"+e.nodeValue+"?>"),this.pretty&&(this.output.b+=`
|
|
13
|
+
`);break;case 6:if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let a=0,h=e.children;for(;a<h.length;){let o=h[a++];this.writeNode(o,t)}break}}hasChildren(e){if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let t=0,l=e.children;for(;t<l.length;){let i=l[t++];switch(i.nodeType){case 0:case 1:return!0;case 2:case 3:if(i.nodeType==V.Document||i.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(i.nodeType==null?"null":de.toString(i.nodeType)));if(He.ltrim(i.nodeValue).length!=0)return!0;break;default:}}return!1}static print(e,t){t==null&&(t=!1);let l=new hi(t);return l.writeNode(e,""),l.output.b}}Q["haxe.xml.Printer"]=hi,hi.__name__="haxe.xml.Printer",Object.assign(hi.prototype,{__class__:hi});class te{static getClass(e){if(e==null)return null;if(e instanceof Array)return Array;{let t=e.__class__;if(t!=null)return t;let l=te.__nativeClassName(e);return l!=null?te.__resolveNativeClass(l):null}}static __string_rec(e,t){if(e==null)return"null";if(t.length>=5)return"<...>";let l=typeof e;switch(l=="function"&&(e.__name__||e.__ename__)&&(l="object"),l){case"function":return"<function>";case"object":if(e.__enum__){let h=Ye[e.__enum__].__constructs__[e._hx_index],o=h._hx_name;return h.__params__?(t=t+" ",o+"("+(function(u){var p;let _=[];{let m=0,f=h.__params__;for(;m<f.length;){let g=f[m];m=m+1,_.push(te.__string_rec(e[g],t))}}return p=_,p})(this).join(",")+")"):o}if(e instanceof Array){let a="[";t+=" ";let h=0,o=e.length;for(;h<o;){let u=h++;a+=(u>0?",":"")+te.__string_rec(e[u],t)}return a+="]",a}let i;try{i=e.toString}catch{return"???"}if(i!=null&&i!=Object.toString&&typeof i=="function"){let a=e.toString();if(a!="[object Object]")return a}let n=`{
|
|
21
14
|
`;t+=" ";let s=e.hasOwnProperty!=null,r=null;for(r in e)s&&!e.hasOwnProperty(r)||r=="prototype"||r=="__class__"||r=="__super__"||r=="__interfaces__"||r=="__properties__"||(n.length!=2&&(n+=`,
|
|
22
15
|
`),n+=t+r+" : "+te.__string_rec(e[r],t));return t=t.substring(1),n+=`
|
|
23
|
-
`+t+"}",n;case"string":return e;default:return String(e)}}static __interfLoop(e,t){if(e==null)return!1;if(e==t)return!0;let
|
|
24
|
-
`),
|
|
25
|
-
`;let r=0;for(;r<
|
|
26
|
-
`),s=!1;let
|
|
27
|
-
`,t!=null&&Object.prototype.hasOwnProperty.call(t.h,
|
|
28
|
-
`}return n}static unquotedRawToQuotedRaw(e){let t="",
|
|
29
|
-
`)!=-1||e.indexOf("{")!=-1)return!1;let t=
|
|
30
|
-
`),n="",s=0,r=
|
|
31
|
-
`);let
|
|
32
|
-
//<END>`,this.input=e,this.index=0,this.output=new
|
|
33
|
-
`}toLorelinePos(e,t,
|
|
34
|
-
`,t);s==-1&&(s=this.length);let r=this.input,h=s!=null?r.substring(t,s):r.substring(t),a=Ae.ltrim(h);if(a.length>0&&(!a.startsWith("//")||a.startsWith("//<END>"))&&!a.startsWith("/*")){let o=h.length-a.length;return a.startsWith("//<END>")&&l==0&&n>0?n-l:o-l}a.length>0&&n==-1&&(n=h.length-a.length),t=s+1}return l==0&&n>0?n-l:0}followsWithIf(e){let t=e;for(;t<this.length;){let i=p.cca(this.input,t),l=i??-1;if(l==32||l==9||l==10||l==13){++t;continue}if(l==47&&t+1<this.length){let r=p.cca(this.input,t+1),h=r??-1;if(h==47){for(t+=2;;){let a,o;if(t<this.length){let u=p.cca(this.input,t);o=(u??-1)!=13}else o=!1;if(o){let u=p.cca(this.input,t);a=(u??-1)!=10}else a=!1;if(!a)break;++t}continue}if(h==42){for(t+=2;t+1<this.length;){let a,o=p.cca(this.input,t);if((o??-1)==42){let u=p.cca(this.input,t+1);a=(u??-1)==47}else a=!1;if(a){t+=2;break}++t}continue}}let n,s;if(t+1<this.length){let r=p.cca(this.input,t);s=(r??-1)==105}else s=!1;if(s){let r=p.cca(this.input,t+1);n=(r??-1)==102}else n=!1;if(n){let r;if(t+2<this.length){let h=p.cca(this.input,t+2);r=!this.isAlphaNumeric(h??-1)}else r=!0;if(r)return!0}return!1}return!1}endsWithControlKeyword(e,t){let i=Ae.rtrim(e);if(i.length==0)return!1;let l=0,n=Ji.CONTROL_KEYWORDS;for(;l<n.length;){let s=n[l];if(++l,i.endsWith(s)){let r=e.length-i.length,h=i.length-s.length,a;if(h!=0){let c=p.cca(i,h-1);a=!this.isAlphaNumeric(c??-1)}else a=!0;let o=t,u;if(o<this.length)if(r<=0){let c=p.cca(this.input,o);u=!this.isAlphaNumeric(c??-1)}else u=!0;else u=!1;if(a&&u&&(s!="else"||!this.followsWithIf(t)))return!0}}return!1}endsWithArrayIndexable(e){let t=e.length;if(t==0)return!1;let i=t-1;for(;i>=0;){let s=p.cca(e,i),r=s??-1;if(!this.isWhitespace(r))break;--i}if(i<0)return!1;let l=p.cca(e,i),n=l??-1;return n==41||n==125||n==93?!0:this.isAlphaNumeric(n)}isWhitespace(e){return e==32||e==10||e==9?!0:e==13}isAlphaNumeric(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57?!0:e==95}inStatementsBlock(){let e=this.stack.length-1;return e>=0?this.stack[e]==2||this.stack[e]==3?!0:this.stack[e]==4:!0}inObjectBlock(){let e=this.stack.length-1;for(;e>=0;){if(this.stack[e]!=3&&this.stack[e]!=4)return this.stack[e]==0;--e}return!1}inArrayBlock(){let e=this.stack.length-1;for(;e>=0;){if(this.stack[e]!=3&&this.stack[e]!=4)return this.stack[e]==1;--e}return!1}isLabelStart(e){e=this.skipWhitespaceAndComments(e);let t=p.cca(this.input,e),i=t??-1;if(!(i>=97&&i<=122||i>=65&&i<=90||i==95))return!1;let l=e;for(++e;;){let a;if(e<this.length){let o=p.cca(this.input,e),u=o??-1;a=u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57}else a=!1;if(!a)break;++e}for(;;){let a;if(e<this.length){let o=p.cca(this.input,e);a=this.isWhitespace(o??-1)}else a=!1;if(!a)break;++e}let n;if(e<this.length){let a=p.cca(this.input,e);n=(a??-1)!=58}else n=!0;if(n)return!1;let s=this.input,r=e-l;return(r!=null?p.substr(s,l,r):p.substr(s,l,null))!="case"}skipWhitespaceAndComments(e){let t=e,i=!1;for(;e<this.length;){for(;;){let l;if(e<this.length){let n,s,r=p.cca(this.input,e);if((r??-1)!=32){let h=p.cca(this.input,e);s=(h??-1)==9}else s=!0;if(s)n=!0;else{let h=p.cca(this.input,e);n=(h??-1)==10}if(n)l=!0;else{let h=p.cca(this.input,e);l=(h??-1)==13}}else l=!1;if(!l)break;++e,i=!0}if(e<this.length-1){let l=p.cca(this.input,e);if((l??-1)==47){let n=p.cca(this.input,e+1);if((n??-1)==47)return e=t,e;{let s=p.cca(this.input,e+1);if((s??-1)==42){e+=2,i=!0;let r=!1;for(;e<this.length-1;){let h,a=p.cca(this.input,e);if((a??-1)==42){let o=p.cca(this.input,e+1);h=(o??-1)==47}else h=!1;if(h){e+=2,r=!0;break}++e}if(!r)return e=t,e;continue}}}}break}return i?e:t}stackPush(e){this.stack.push(e)}stackPop(){return this.stack.pop()}_add(e,t){if(t?this.index++:this.currentPosOffset++,this.inString)this.lineOutput.b+=String.fromCodePoint(e==34?e:32),this.output.b+=String.fromCodePoint(e),this.posOffsets.push(this.currentPosOffset);else if(e==13||e==10){this.inControlWithoutParens&&(this.inControlWithoutParens=!1,this.stack.pop()!=6&&this.error("Unexpected end of line"),this.currentPosOffset++,this.lineOutput.b+=String.fromCodePoint(41),this.output.b+=String.fromCodePoint(41),this.posOffsets.push(this.currentPosOffset)),this.inControl=!1;let i=this.lineOutput.b;if(this.lineOutput=new Xt,this.inStatementsBlock()||this.inObjectBlock()||this.inArrayBlock()){let l=this.nextLineIndentOffset(i,this.index);if(Ae.trim(i).length!=0)if(l>0&&!this.endsOrFollowsWithChar(i,123,this.index,{fileName:"src/loreline/CodeToHscript.hx",lineNumber:1061,className:"loreline.CodeToHscript",methodName:"_add"})&&!this.endsOrFollowsWithChar(i,91,this.index,{fileName:"src/loreline/CodeToHscript.hx",lineNumber:1061,className:"loreline.CodeToHscript",methodName:"_add"})){let n=Ae.ltrim(i);n.startsWith("case ")||n.startsWith("case ")||n=="default"||n.startsWith("default ")||n.startsWith("default ")?(this.stack.push(4),this.indentLevel+=l,this.indentStack.push(this.indentLevel),this.currentPosOffset++,this.output.b+=String.fromCodePoint(58),this.posOffsets.push(this.currentPosOffset)):(this.stack.push(3),this.indentLevel+=l,this.indentStack.push(this.indentLevel),this.currentPosOffset++,this.output.b+=String.fromCodePoint(32),this.posOffsets.push(this.currentPosOffset),this.currentPosOffset++,this.output.b+=String.fromCodePoint(123),this.posOffsets.push(this.currentPosOffset))}else if(l<0&&this.stack.length>0&&(this.stack[this.stack.length-1]==3||this.stack[this.stack.length-1]==4)){!this.inObjectBlock()&&!this.endsOrFollowsWithChar(i,59,this.index,{fileName:"src/loreline/CodeToHscript.hx",lineNumber:1090,className:"loreline.CodeToHscript",methodName:"_add"})&&(this.currentPosOffset++,this.output.b+=String.fromCodePoint(59),this.posOffsets.push(this.currentPosOffset)),this.indentLevel+=l;let n=!0;for(;this.indentStack.length>0&&this.indentStack[this.indentStack.length-1]>this.indentLevel&&this.stack.length>0&&(this.stack[this.stack.length-1]==3||this.stack[this.stack.length-1]==4);){let s=this.stack.pop();this.indentStack.pop(),s==3&&(n&&(n=!1,this.currentPosOffset++,this.output.b+=String.fromCodePoint(32),this.posOffsets.push(this.currentPosOffset)),this.currentPosOffset++,this.output.b+=String.fromCodePoint(125),this.posOffsets.push(this.currentPosOffset))}}else l==0&&!this.endsOrFollowsWithChar(i,59,this.index,{fileName:"src/loreline/CodeToHscript.hx",lineNumber:1115,className:"loreline.CodeToHscript",methodName:"_add"})&&!this.endsOrFollowsWithChar(i,44,this.index,{fileName:"src/loreline/CodeToHscript.hx",lineNumber:1115,className:"loreline.CodeToHscript",methodName:"_add"})&&(this.inObjectBlock()?(this.currentPosOffset++,this.output.b+=String.fromCodePoint(44),this.posOffsets.push(this.currentPosOffset)):this.inArrayBlock()?(this.currentPosOffset++,this.output.b+=String.fromCodePoint(44),this.posOffsets.push(this.currentPosOffset)):(this.currentPosOffset++,this.output.b+=String.fromCodePoint(59),this.posOffsets.push(this.currentPosOffset)))}this.output.b+=String.fromCodePoint(e),this.posOffsets.push(this.currentPosOffset)}else if(!this.inControl&&!this.isWhitespace(e)&&this.endsWithControlKeyword(this.lineOutput.b,this.index-1))this.inControl=!0,this.followsWithChar(40,this.index-1)?e==40&&this.stack.push(6):(this.inControlWithoutParens=!0,this.stack.push(6),this.currentPosOffset++,this.lineOutput.b+=String.fromCodePoint(e),this.output.b+=String.fromCodePoint(40),this.posOffsets.push(this.currentPosOffset)),this.lineOutput.b+=String.fromCodePoint(e),this.output.b+=String.fromCodePoint(e),this.posOffsets.push(this.currentPosOffset);else{if(e==40)this.stack.push(6);else if(e==41)this.stack.pop()!=6&&this.error("Unexpected: )");else if(e==91)this.endsWithArrayIndexable(this.lineOutput.b)?this.stack.push(5):this.stack.push(1);else if(e==93){let i=this.stack.pop();i!=5&&i!=1&&this.error("Unexpected: ]")}else if(e==123)this.isLabelStart(this.index)?this.stack.push(0):this.stack.push(2);else if(e==125){let i=this.stack.pop();i!=2&&i!=0&&this.error("Unexpected: }")}this.lineOutput.b+=String.fromCodePoint(e),this.output.b+=String.fromCodePoint(e),this.posOffsets.push(this.currentPosOffset)}}error(e){throw b.thrown(new ai(e,he.fromContentAndIndex(this.input,this.index)))}}j["loreline.CodeToHscript"]=Ji,Ji.__name__="loreline.CodeToHscript",Object.assign(Ji.prototype,{__class__:Ji});class Si{static equal(e,t,i){return t==i?!0:re.isArray(t)?re.isArray(i)?Si.arrayEqual(e,t,i):!1:t instanceof Ee?i instanceof Ee?Si.stringMapEqual(e,t,i):!1:t instanceof Ri?i instanceof Ri?Si.intMapEqual(e,t,i):!1:ne.isFields(t)&&ne.isFields(i)?Si.objectFieldsEqual(e,t,i):!1}static objectFieldsEqual(e,t,i){let l=0,n=ne.getFields(e,t);for(;l<n.length;){let h=n[l];if(++l,!ne.fieldExists(e,i,h)||!Si.equal(e,ne.getField(e,t,h),ne.getField(e,i,h)))return!1}let s=0,r=ne.getFields(e,i);for(;s<r.length;){let h=r[s];if(++s,!ne.fieldExists(e,t,h))return!1}return!0}static arrayEqual(e,t,i){let l=re.arrayLength(t),n=re.arrayLength(i);if(l!=n)return!1;let s=0,r=l;for(;s<r;){let h=s++;if(!Si.equal(e,re.arrayGet(t,h),re.arrayGet(i,h)))return!1}return!0}static stringMapEqual(e,t,i){let l=t.h,n=l,s=Object.keys(l),r=s.length,h=0;for(;h<r;){let f=s[h++],m=f,g=n[f],w=m,y=g;if(!Object.prototype.hasOwnProperty.call(i.h,w)||!Si.equal(e,i.h[w],y))return!1}let a=i.h,o=a,u=Object.keys(a),c=u.length,_=0;for(;_<c;){let f=u[_++];if(!Object.prototype.hasOwnProperty.call(t.h,f))return!1}return!0}static intMapEqual(e,t,i){let l=t,n=l,s=l.keys();for(;s.hasNext();){let h=s.next(),a=n.get(h),u=h,c=a;if(!i.h.hasOwnProperty(u)||!Si.equal(e,i.h[u],c))return!1}let r=i.keys();for(;r.hasNext();){let h=r.next();if(!t.h.hasOwnProperty(h))return!1}return!0}}j["loreline.Equal"]=Si,Si.__name__="loreline.Equal";class ai{constructor(e,t){this.message=e,this.pos=t,this.stack=gn.callStack()}toString(){return this.pos!=null?""+this.message+" at "+this.pos.toString():this.message}}j["loreline.Error"]=ai,ai.__name__="loreline.Error",Object.assign(ai.prototype,{__class__:ai});class vi{}j["loreline.Fields"]=Yi.loreline.Fields=vi,vi.__name__="loreline.Fields",vi.__isInterface__=!0,Object.assign(vi.prototype,{__class__:vi});class Bl{constructor(e){this._random=null,this.interpreter=e}bindAll(e){e.h.floor=Te(this,this.floor),e.h.ceil=Te(this,this.ceil),e.h.round=Te(this,this.round),e.h.abs=Te(this,this.abs),e.h.min=Te(this,this.min),e.h.max=Te(this,this.max),e.h.clamp=Te(this,this.clamp),e.h.pow=Te(this,this.pow),e.h.random=Te(this,this.random),e.h.chance=Te(this,this.chance),e.h.seed_random=Te(this,this.seed_random),e.h.random_float=Te(this,this.random_float),e.h.wait=Te(this,this.wait),e.h.float=Te(this,this.float_),e.h.string=Te(this,this.string_),e.h.bool=Te(this,this.bool),e.h.string_length=Te(this,this.string_length),e.h.string_upper=Te(this,this.string_upper),e.h.string_lower=Te(this,this.string_lower),e.h.string_contains=Te(this,this.string_contains),e.h.string_replace=Te(this,this.string_replace),e.h.string_split=Te(this,this.string_split),e.h.string_trim=Te(this,this.string_trim),e.h.string_index=Te(this,this.string_index),e.h.string_sub=Te(this,this.string_sub),e.h.string_starts=Te(this,this.string_starts),e.h.string_ends=Te(this,this.string_ends),e.h.string_repeat=Te(this,this.string_repeat),e.h.plural=Te(this,this.plural),e.h.array_length=Te(this,this.array_length),e.h.array_add=Te(this,this.array_add),e.h.array_pop=Te(this,this.array_pop),e.h.array_prepend=Te(this,this.array_prepend),e.h.array_shift=Te(this,this.array_shift),e.h.array_remove=Te(this,this.array_remove),e.h.array_index=Te(this,this.array_index),e.h.array_has=Te(this,this.array_has),e.h.array_sort=Te(this,this.array_sort),e.h.array_reverse=Te(this,this.array_reverse),e.h.array_join=Te(this,this.array_join),e.h.array_pick=Te(this,this.array_pick),e.h.array_shuffle=Te(this,this.array_shuffle),e.h.array_copy=Te(this,this.array_copy),e.h.map_length=Te(this,this.map_length),e.h.map_keys=Te(this,this.map_keys),e.h.map_has=Te(this,this.map_has),e.h.map_get=Te(this,this.map_get),e.h.map_set=Te(this,this.map_set),e.h.map_remove=Te(this,this.map_remove),e.h.map_copy=Te(this,this.map_copy),e.h.current_beat=Te(this,this.current_beat),e.h.has_beat=Te(this,this.has_beat),e.h.beat_visits=Te(this,this.beat_visits),e.h.choices=Te(this,this.choices),e.h.choices_disabled=Te(this,this.choices_disabled),e.h.choices_all=Te(this,this.choices_all)}rng(){this._random==null&&(this._random=new _l);let e=this._random;return(e.seed=e.seed*16807%2147483647)/2147483647+233e-12}floor(e){return Math.floor(e)}ceil(e){return Math.ceil(e)}round(e){return Math.round(e)}abs(e){return Math.abs(e)}min(e,t){return Math.min(e,t)}max(e,t){return Math.max(e,t)}clamp(e,t,i){return Math.max(t,Math.min(i,e))}pow(e,t){return Math.pow(e,t)}random(e,t){return Math.floor(e+this.rng()*(t+1-e))}chance(e){return Math.floor(this.rng()*e)==0}seed_random(e){return this._random=new _l(e),null}random_float(e,t){return e+this.rng()*(t-e)}wait(e){return new il(function(t){rl.delay(t,e*1e3|0)})}float_(e){return typeof e=="number"?e:typeof e=="number"&&(e|0)===e?e*1:typeof e=="string"?parseFloat(e):typeof e=="boolean"&&e?1:0}string_(e){return e==null?"null":typeof e=="string"?e:e==null?"null":le.string(e)}bool(e){return typeof e=="boolean"?e:typeof e=="string"||e instanceof Array?e.length>0:typeof e=="number"&&(e|0)===e||typeof e=="number"?e!=0:e!=null}string_length(e){return e.length}string_upper(e){return e.toUpperCase()}string_lower(e){return e.toLowerCase()}string_contains(e,t){return e.includes(t)}string_replace(e,t,i){return Ae.replace(e,t,i)}string_split(e,t){return e.split(t)}string_trim(e){return Ae.trim(e)}string_index(e,t){return e.indexOf(t)}string_sub(e,t,i){return p.substr(e,t|0,i|0)}string_starts(e,t){return e.startsWith(t)}string_ends(e,t){return e.endsWith(t)}string_repeat(e,t){let i="",l=0;for(;l<t;)i+=e==null?"null":""+e,++l;return i}plural(e,t,i){let l=0;return typeof e=="number"&&(e|0)===e?l=e*1:typeof e=="number"&&(l=e),l==1?t:i}array_length(e){return re.isArray(e)?re.arrayLength(e):0}array_add(e,t){return re.arrayPush(e,t),null}array_pop(e){return re.isArray(e)?re.arrayPop(e):null}array_prepend(e,t){return re.isArray(e)&&re.arrayInsert(e,0,t),null}array_shift(e){return re.isArray(e)?re.arrayShift(e):null}array_remove(e,t){if(re.isArray(e)){let i=re.arrayLength(e),l=0,n=i;for(;l<n;){let s=l++;if(re.arrayGet(e,s)==t)return re.arrayRemoveAt(e,s),!0}}return!1}array_index(e,t){if(re.isArray(e)){let i=re.arrayLength(e),l=0,n=i;for(;l<n;){let s=l++;if(re.arrayGet(e,s)==t)return s}}return-1}array_has(e,t){if(re.isArray(e)){let i=re.arrayLength(e),l=0,n=i;for(;l<n;){let s=l++;if(re.arrayGet(e,s)==t)return!0}}return!1}array_sort(e){return re.isArray(e)&&re.arraySort(e,function(t,i){return typeof t=="number"&&typeof i=="number"||typeof t=="number"&&(t|0)===t&&typeof i=="number"&&(i|0)===i?t<i?-1:t>i?1:0:(t==null?"null":le.string(t))<(i==null?"null":le.string(i))?-1:(t==null?"null":le.string(t))>(i==null?"null":le.string(i))?1:0}),e}array_reverse(e){return re.isArray(e)&&re.arrayReverse(e),e}array_join(e,t){return re.isArray(e)?re.arrayJoin(e,t):""}array_pick(e){if(re.isArray(e)){let t=re.arrayLength(e);if(t==0)return null;let i=Math.floor(this.rng()*t);return re.arrayGet(e,i)}return null}array_shuffle(e){if(re.isArray(e)){let t=re.arrayLength(e)-1;for(;t>0;){let i=Math.floor(this.rng()*(t+1)),l=re.arrayGet(e,t);re.arraySet(e,t,re.arrayGet(e,i)),re.arraySet(e,i,l),--t}}return e}array_copy(e){return re.isArray(e)?re.arrayCopy(e):e}map_length(e){return ne.getFields(this.interpreter,e).length}map_keys(e){let t=ne.getFields(this.interpreter,e);return t.sort(function(i,l){return i<l?-1:i>l?1:0}),t}map_has(e,t){return ne.fieldExists(this.interpreter,e,t)}map_get(e,t){return ne.getField(this.interpreter,e,t)}map_set(e,t,i){return ne.setField(this.interpreter,e,t,i),null}map_remove(e,t){return ne.fieldExists(this.interpreter,e,t)?ne.removeField(this.interpreter,e,t):!1}map_copy(e){let t=ne.getFields(this.interpreter,e),i=ne.createFields(this.interpreter),l=0;for(;l<t.length;){let n=t[l];++l,ne.setField(this.interpreter,i,n,ne.getField(this.interpreter,e,n))}return i}current_beat(){let e=this.interpreter.stack.length-1;for(;e>=0;){let t=this.interpreter.stack[e];if(t.beat!=null)return t.beat;--e}return null}has_beat(e){if(e instanceof Me)return!0;let t=e,i=this.interpreter.stack.length-1;for(;i>=0;){let l=this.interpreter.stack[i];if(l.beat!=null&&l.beat.body!=null){let n=0,s=l.beat.body;for(;n<s.length;){let r=s[n];if(++n,r instanceof Me&&r.name==t)return!0}}--i}return Object.prototype.hasOwnProperty.call(this.interpreter.topLevelBeats.h,t)}beat_visits(e){if(e==null){let t=this.interpreter.stack.length-1;for(;t>=0;){let i=this.interpreter.stack[t];if(i.beat!=null)return this.interpreter.getBeatVisitCount(i.beat);--t}return 0}else{if(e instanceof Me)return this.interpreter.getBeatVisitCount(e);{let t=this.interpreter.resolveBeatByName(e);return t==null?0:this.interpreter.getBeatVisitCount(t)}}}choices(){let e=this.interpreter._choiceEvalTexts,t=this.interpreter._choiceEvalEnabled,i=[],l=0,n=e.length;for(;l<n;){let s=l++;t[s]&&i.push(e[s])}return i}choices_disabled(){let e=this.interpreter._choiceEvalTexts,t=this.interpreter._choiceEvalEnabled,i=[],l=0,n=e.length;for(;l<n;){let s=l++;t[s]||i.push(e[s])}return i}choices_all(){let e=this.interpreter._choiceEvalTexts,t=[],i=0,l=e.length;for(;i<l;){let n=i++;t.push(e[n])}return t}}j["loreline.Functions"]=Bl,Bl.__name__="loreline.Functions",Object.assign(Bl.prototype,{__class__:Bl});var Oi=Qe["loreline._HscriptInterp.Stop"]={__ename__:"loreline._HscriptInterp.Stop",__constructs__:null,SBreak:{_hx_name:"SBreak",_hx_index:0,__enum__:"loreline._HscriptInterp.Stop",toString:S},SContinue:{_hx_name:"SContinue",_hx_index:1,__enum__:"loreline._HscriptInterp.Stop",toString:S},SReturn:{_hx_name:"SReturn",_hx_index:2,__enum__:"loreline._HscriptInterp.Stop",toString:S}};Oi.__constructs__=[Oi.SBreak,Oi.SContinue,Oi.SReturn];class Ll{constructor(e){this.interpreter=e,this.locals=new Ee,this.declared=[],this.resetVariables(),this.initOps()}resetVariables(){this.variables=new Ee,this.variables.h.null=null,this.variables.h.true=!0,this.variables.h.false=!1;let e=this,t=this.variables,i=We.makeVarArgs(function(l){let n=e.posInfos(),s=l.shift();l.length>0&&(n.customParams=l),Il.trace(le.string(s),n)});t.h.trace=i}posInfos(){return this.curExpr!=null?{fileName:this.curExpr.origin,lineNumber:this.curExpr.line}:{fileName:"hscript",lineNumber:0}}initOps(){let e=this;this.binops=new Ee,this.binops.h["+"]=function(t,i){return e.expr(t)+e.expr(i)},this.binops.h["-"]=function(t,i){return e.expr(t)-e.expr(i)},this.binops.h["*"]=function(t,i){return e.expr(t)*e.expr(i)},this.binops.h["/"]=function(t,i){return e.expr(t)/e.expr(i)},this.binops.h["%"]=function(t,i){return e.expr(t)%e.expr(i)},this.binops.h["&"]=function(t,i){return e.expr(t)&e.expr(i)},this.binops.h["|"]=function(t,i){return e.expr(t)|e.expr(i)},this.binops.h["^"]=function(t,i){return e.expr(t)^e.expr(i)},this.binops.h["<<"]=function(t,i){return e.expr(t)<<e.expr(i)},this.binops.h[">>"]=function(t,i){return e.expr(t)>>e.expr(i)},this.binops.h[">>>"]=function(t,i){return e.expr(t)>>>e.expr(i)},this.binops.h["=="]=function(t,i){return e.expr(t)==e.expr(i)},this.binops.h["!="]=function(t,i){return e.expr(t)!=e.expr(i)},this.binops.h[">="]=function(t,i){let l=e.expr(t),n=e.expr(i);return l>=n},this.binops.h["<="]=function(t,i){let l=e.expr(t),n=e.expr(i);return l<=n},this.binops.h[">"]=function(t,i){let l=e.expr(t),n=e.expr(i);return l>n},this.binops.h["<"]=function(t,i){let l=e.expr(t),n=e.expr(i);return l<n},this.binops.h["||"]=function(t,i){return e.expr(t)!=!0?e.expr(i)==!0:!0},this.binops.h["&&"]=function(t,i){return e.expr(t)==!0?e.expr(i)==!0:!1},this.binops.h["="]=Te(this,this.assign),this.binops.h["..."]=function(t,i){return new Ol(e.expr(t),e.expr(i))},this.binops.h.is=function(t,i){return te.__instanceof(e.expr(t),e.expr(i))},this.assignOp("+=",function(t,i){return t+i}),this.assignOp("-=",function(t,i){return t-i}),this.assignOp("*=",function(t,i){return t*i}),this.assignOp("/=",function(t,i){return t/i}),this.assignOp("%=",function(t,i){return t%i}),this.assignOp("&=",function(t,i){return t&i}),this.assignOp("|=",function(t,i){return t|i}),this.assignOp("^=",function(t,i){return t^i}),this.assignOp("<<=",function(t,i){return t<<i}),this.assignOp(">>=",function(t,i){return t>>i}),this.assignOp(">>>=",function(t,i){return t>>>i})}setVar(e,t){if(!Object.prototype.hasOwnProperty.call(this.variables.h,e))ne.setField(this.interpreter,this.interpreter.topLevelState.fields,e,t);else throw b.thrown("Invalid assign");return t}assign(e,t){let i=this.expr(t),l=e.e;switch(l._hx_index){case 1:let n=l.v,s=this.locals.h[n];s==null?this.setVar(n,i):s.r=i;break;case 5:let r=l.e,h=l.f;i=this.set(this.expr(r),h,i);break;case 16:let a=l.e,o=l.index,u=this.expr(a),c=this.expr(o);re.isArray(u)?re.arraySet(u,c,i):ne.isFields(u)?ne.setField(this.interpreter,u,c,i):te.__implements(u,kt)?te.__cast(u,kt).set(c,i):u[c]=i;break;default:let _=new Ce(be.EInvalidOp("="),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(_)}return i}assignOp(e,t){let i=this;this.binops.h[e]=function(l,n){return i.evalAssignOp(e,t,l,n)}}evalAssignOp(e,t,i,l){let n,s=i.e;switch(s._hx_index){case 1:let r=s.v,h=this.locals.h[r];n=t(this.expr(i),this.expr(l)),h==null?this.setVar(r,n):h.r=n;break;case 5:let a=s.e,o=s.f,u=this.expr(a);n=t(this.get(u,o),this.expr(l)),n=this.set(u,o,n);break;case 16:let c=s.e,_=s.index,f=this.expr(c),m=this.expr(_);re.isArray(f)?(n=t(re.arrayGet(f,m),this.expr(l)),re.arraySet(f,m,n)):ne.isFields(f)?(n=t(ne.getField(this.interpreter,f,m),this.expr(l)),ne.setField(this.interpreter,f,m,n)):te.__implements(f,kt)?(n=t(te.__cast(f,kt).get(m),this.expr(l)),te.__cast(f,kt).set(m,n)):(n=t(f[m],this.expr(l)),f[m]=n);break;default:let g=new Ce(be.EInvalidOp(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(g)}return n}increment(e,t,i){this.curExpr=e;let l=e.e;switch(l._hx_index){case 1:let n=l.v,s=this.locals.h[n],r=s==null?this.resolve(n):s.r;return t?(r+=i,s==null?this.setVar(n,r):s.r=r):s==null?this.setVar(n,r+i):s.r=r+i,r;case 5:let h=l.e,a=l.f,o=this.expr(h),u=this.get(o,a);return t?(u+=i,this.set(o,a,u)):this.set(o,a,u+i),u;case 16:let c=l.e,_=l.index,f=this.expr(c),m=this.expr(_);if(re.isArray(f)){let w=re.arrayGet(f,m);return t?(w+=i,re.arraySet(f,m,w)):re.arraySet(f,m,w+i),w}else if(ne.isFields(f)){let w=ne.getField(this.interpreter,f,m);return t?(w+=i,ne.setField(this.interpreter,f,m,w)):ne.setField(this.interpreter,f,m,w+i),w}else if(te.__implements(f,kt)){let w=te.__cast(f,kt).get(m);return t?(w+=i,te.__cast(f,kt).set(m,w)):te.__cast(f,kt).set(m,w+i),w}else{let w=f[m];return t?(w+=i,f[m]=w):f[m]=w+i,w}break;default:let g=new Ce(be.EInvalidOp(i>0?"++":"--"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(g)}}execute(e){return this.depth=0,this.locals=new Ee,this.declared=[],this.exprReturn(e)}exprReturn(e){try{return this.expr(e)}catch(t){let i=b.caught(t).unwrap();if(te.__instanceof(i,Oi))switch(i._hx_index){case 0:throw b.thrown("Invalid break");case 1:throw b.thrown("Invalid continue");case 2:let n=this.returnValue;return this.returnValue=null,n}else throw t}}duplicate(e){let t=new Ee,i=e.h,l=i,n=Object.keys(i),s=n.length,r=0;for(;r<s;){let h=n[r++];t.h[h]=e.h[h]}return t}restore(e){for(;this.declared.length>e;){let t=this.declared.pop();this.locals.h[t.n]=t.old}}error(e,t){t==null&&(t=!1);let i=new Ce(e,this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(i)}rethrow(e){throw b.thrown(e)}resolve(e){let t=this.variables.h[e];if(t==null&&!Object.prototype.hasOwnProperty.call(this.variables.h,e)){if(ne.fieldExists(this.interpreter,this.interpreter.topLevelState.fields,e))return ne.getField(this.interpreter,this.interpreter.topLevelState.fields,e);if(Object.prototype.hasOwnProperty.call(this.interpreter.topLevelCharacters.h,e))return this.interpreter.topLevelCharacters.h[e].fields;if(Object.prototype.hasOwnProperty.call(this.interpreter.topLevelFunctions.h,e))return this.interpreter.topLevelFunctions.h[e];let i=this.interpreter.resolveBeatByName(e);if(i!=null)return i;let l=new Ce(be.EUnknownVariable(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(l)}return t}expr(e){this.curExpr=e;let t=e.e,i=this;switch(t._hx_index){case 0:let l=t.c;switch(l._hx_index){case 0:return l.v;case 1:return l.f;case 2:return l.s}break;case 1:let n=t.v,s=this.locals.h[n];return s!=null?s.r:this.resolve(n);case 2:let r=t.t,h=t.n,a=t.e;this.declared.push({n:h,old:this.locals.h[h]});let o=this.locals,u=a==null?null:this.expr(a);return o.h[h]={r:u},null;case 3:let c=t.e;return this.expr(c);case 4:let _=t.e,f=this.declared.length,m=null,g=0;for(;g<_.length;){let ye=_[g];++g,m=this.expr(ye)}return this.restore(f),m;case 5:let w=t.e,y=t.f;return this.get(this.expr(w),y);case 6:let T=t.op,E=t.e1,C=t.e2,P=this.binops.h[T];if(P==null){let ye=new Ce(be.EInvalidOp(T),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(ye)}return P(E,C);case 7:let I=t.op,v=t.prefix,F=t.e;switch(I){case"!":return this.expr(F)!=!0;case"++":return this.increment(F,v,1);case"-":return-this.expr(F);case"--":return this.increment(F,v,-1);case"~":return~this.expr(F);default:let ye=new Ce(be.EInvalidOp(I),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(ye)}break;case 8:let B=t.e,A=t.params,L=[],z=0;for(;z<A.length;){let ye=A[z];++z,L.push(this.expr(ye))}let D=B.e;if(D._hx_index==5){let ye=D.e,lt=D.f,ct=this.expr(ye);if(ct==null){let rt=new Ce(be.EInvalidAccess(lt),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(rt)}return this.fcall(ct,lt,L)}else return this.call(null,this.expr(B),L);break;case 9:let O=t.cond,q=t.e1,M=t.e2;return this.expr(O)==!0?this.expr(q):M==null?null:this.expr(M);case 10:let U=t.cond,K=t.e;return this.whileLoop(U,K),null;case 11:let G=t.v,Y=t.it,$=t.e;return this.forLoop(G,Y,$),null;case 12:throw b.thrown(Oi.SBreak);case 13:throw b.thrown(Oi.SContinue);case 14:let se=t.ret,ue=t.args,oe=t.e,ge=t.name,me=this.duplicate(this.locals),de=this,Oe=!1,Ve=0,je=0;for(;je<ue.length;){let ye=ue[je];++je,ye.opt||ye.value!=null?Oe=!0:Ve+=1}let et=function(ye){if((ye==null?0:ye.length)!=ue.length){if(ye.length<Ve){let Qi="Invalid number of parameters. Got "+ye.length+", required "+Ve;ge!=null&&(Qi+=" for function '"+ge+"'");let rn=new Ce(be.ECustom(Qi),i.curExpr.pmin,i.curExpr.pmax,i.curExpr.origin,i.curExpr.line);throw b.thrown(rn)}let Jt=[],wt=ye.length-Ve,Ql=0,fl=0;for(;fl<ue.length;){let Qi=ue[fl];++fl,Qi.opt||Qi.value!=null?wt>0?(Jt.push(ye[Ql++]),--wt):Jt.push(Qi.value!=null?de.expr(Qi.value):null):Jt.push(ye[Ql++])}ye=Jt}let lt=de.locals,ct=de.depth;de.depth++,de.locals=de.duplicate(me);let rt=0,dt=ue.length;for(;rt<dt;){let Jt=rt++;de.locals.h[ue[Jt].name]={r:ye[Jt]}}let xt=null,St=i.declared.length;if(i.inTry)try{xt=de.exprReturn(oe)}catch(Jt){let wt=b.caught(Jt).unwrap();throw i.restore(St),de.locals=lt,de.depth=ct,b.thrown(wt)}else xt=de.exprReturn(oe);return i.restore(St),de.locals=lt,de.depth=ct,xt},Ue=We.makeVarArgs(et);if(ge!=null)if(this.depth==0)this.variables.h[ge]=Ue;else{this.declared.push({n:ge,old:this.locals.h[ge]});let ye={r:Ue};this.locals.h[ge]=ye,me.h[ge]=ye}return Ue;case 15:let Ge=t.e;throw this.returnValue=Ge==null?null:this.expr(Ge),b.thrown(Oi.SReturn);case 16:let nt=t.e,De=t.index,H=this.expr(nt),ie=this.expr(De);return re.isArray(H)?re.arrayGet(H,ie):ne.isFields(H)?ne.getField(this.interpreter,H,ie):te.__implements(H,kt)?te.__cast(H,kt).get(ie):H[ie];case 17:let R=t.e,ee;if(R.length>0){let ye=R[0].e;if(ye._hx_index==6){let lt=ye.e1,ct=ye.e2;ee=ye.op=="=>"}else ee=!1}else ee=!1;if(ee){let ye=[],lt=[],ct=0;for(;ct<R.length;){let rt=R[ct];++ct;let dt=rt.e;if(dt._hx_index==6)if(dt.op=="=>"){let xt=dt.e1,St=dt.e2;ye.push(this.expr(xt)),lt.push(this.expr(St))}else{this.curExpr=rt;let xt=new Ce(be.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(xt)}else{this.curExpr=rt;let xt=new Ce(be.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(xt)}}return this.makeMap(ye,lt)}else{let ye=[],lt=0;for(;lt<R.length;){let ct=R[lt];++lt,ye.push(this.expr(ct))}return ye}break;case 18:let X=t.cl,Q=t.params,ae=[],_e=0;for(;_e<Q.length;){let ye=Q[_e];++_e,ae.push(this.expr(ye))}return this.cnew(X,ae);case 19:let xe=t.e;throw b.thrown(this.expr(xe));case 20:let Ye=t.t,gt=t.e,Be=t.v,_t=t.ecatch,ve=this.declared.length,Pe=this.inTry;try{this.inTry=!0;let ye=this.expr(gt);return this.restore(ve),this.inTry=Pe,ye}catch(ye){let lt=b.caught(ye).unwrap();if(te.__instanceof(lt,Oi)){let ct=lt;throw this.inTry=Pe,b.thrown(ct)}else{let ct=lt;this.restore(ve),this.inTry=Pe,this.declared.push({n:Be,old:this.locals.h[Be]}),this.locals.h[Be]={r:ct};let rt=this.expr(_t);return this.restore(ve),rt}}break;case 21:let ot=t.fl,tt=ne.createFields(this.interpreter),bt=0;for(;bt<ot.length;){let ye=ot[bt];++bt,ne.setField(this.interpreter,tt,ye.name,this.expr(ye.e))}return tt;case 22:let Kt=t.cond,ft=t.e1,li=t.e2;return this.expr(Kt)==!0?this.expr(ft):this.expr(li);case 23:let $e=t.e,Bt=t.cases,It=t.defaultExpr,Lt=this.expr($e),mt=!1,Vt=0;for(;Vt<Bt.length;){let ye=Bt[Vt];++Vt;let lt=0,ct=ye.values;for(;lt<ct.length;){let rt=ct[lt];if(++lt,this.expr(rt)==Lt){mt=!0;break}}if(mt){Lt=this.expr(ye.expr);break}}return mt||(Lt=It==null?null:this.expr(It)),Lt;case 24:let Ht=t.cond,Ut=t.e;return this.doWhileLoop(Ht,Ut),null;case 25:let ni=t.name,si=t.args,jt=t.e;return this.expr(jt);case 26:let it=t.t,ki=t.e;return this.expr(ki)}}doWhileLoop(e,t){let i=this.declared.length,l=this;do{let n=!0;try{l.expr(t)}catch(s){let r=b.caught(s).unwrap();if(te.__instanceof(r,Oi)){let h=r;switch(h._hx_index){case 0:n=!1;break;case 1:break;case 2:throw b.thrown(h)}}else throw s}if(!n)break}while(this.expr(e)==!0);this.restore(i)}whileLoop(e,t){let i=this.declared.length,l=this;for(;this.expr(e)==!0;){let n=!0;try{l.expr(t)}catch(s){let r=b.caught(s).unwrap();if(te.__instanceof(r,Oi)){let h=r;switch(h._hx_index){case 0:n=!1;break;case 1:break;case 2:throw b.thrown(h)}}else throw s}if(!n)break}this.restore(i)}makeIterator(e){if(e instanceof Array)return new Ti(e);if(re.isArray(e))return re.getIterator(e);if(e.iterator!=null&&(e=fn(e)),e.hasNext==null||e.next==null){let t=new Ce(be.EInvalidIterator(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(t)}return e}forLoop(e,t,i){let l=this.declared.length;this.declared.push({n:e,old:this.locals.h[e]});let n=this.makeIterator(this.expr(t)),s=this;for(;n.hasNext();){let r=this.locals,h={r:n.next()};r.h[e]=h;let a=!0;try{s.expr(i)}catch(o){let u=b.caught(o).unwrap();if(te.__instanceof(u,Oi)){let c=u;switch(c._hx_index){case 0:a=!1;break;case 1:break;case 2:throw b.thrown(c)}}else throw o}if(!a)break}this.restore(l)}loopRun(e){let t=!0;try{e()}catch(i){let l=b.caught(i).unwrap();if(te.__instanceof(l,Oi)){let n=l;switch(n._hx_index){case 0:t=!1;break;case 1:break;case 2:throw b.thrown(n)}}else throw i}return t}isMap(e){return te.__implements(e,kt)}getMapValue(e,t){return te.__cast(e,kt).get(t)}setMapValue(e,t,i){te.__cast(e,kt).set(t,i)}makeMap(e,t){let i=!0,l=!0,n=!0,s=!0,r=0;for(;r<e.length;){let a=e[r];++r,i=i&&typeof a=="string",l=l&&typeof a=="number"&&(a|0)===a,n=n&&We.isObject(a),s=s&&We.isEnumValue(a)}if(l){let a=new Ri,o=0,u=e;for(;o<u.length;){let c=u[o],f=o++,m=c;a.h[m]=t[f]}return a}if(i){let a=new Ee,o=0,u=e;for(;o<u.length;){let c=u[o],f=o++,m=c;a.h[m]=t[f]}return a}if(s){let a=new Xi,o=0,u=e;for(;o<u.length;){let c=u[o],f=o++,m=c;a.set(m,t[f])}return a}if(n){let a=new gl,o=0,u=e;for(;o<u.length;){let c=u[o],f=o++,m=c;a.set(m,t[f])}return a}let h=new Ce(be.ECustom("Invalid map keys "+le.string(e)),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(h)}get(e,t){if(e==null){let i=new Ce(be.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(i)}return ne.isFields(e)?ne.getField(this.interpreter,e,t):We.getProperty(e,t)}set(e,t,i){if(e==null){let l=new Ce(be.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(l)}return ne.isFields(e)?(ne.setField(this.interpreter,e,t,i),i):(We.setProperty(e,t,i),i)}fcall(e,t,i){let l=null;return typeof e=="string"?l=ne.getStringHelper(this.interpreter,t):re.isArray(e)?l=ne.getArrayHelper(this.interpreter,t):e instanceof Me?l=ne.getBeatHelper(this.interpreter,t):ne.isFields(e)&&(l=ne.getMapHelper(this.interpreter,t)),l!=null&&We.isFunction(l)?(i.splice(0,0,e),this.call(null,l,i)):this.call(e,this.get(e,t),i)}call(e,t,i){return t.apply(e,i)}cnew(e,t){let i=j[e];return i==null&&(i=this.resolve(e)),pe.createInstance(i,t)}}j["loreline.HscriptInterp"]=Ll,Ll.__name__="loreline.HscriptInterp",Object.assign(Ll.prototype,{__class__:Ll});class Al{constructor(e){this.finished=e}}j["loreline._Imports.ImportsLoopInfo"]=Al,Al.__name__="loreline._Imports.ImportsLoopInfo",Object.assign(Al.prototype,{__class__:Al});class Dl{constructor(){this.ext=".lor",this.pendingImports=0,this.hasErrors=!1,this.done=null,this.resolvedImports=null,this.autoAddExtension=!0}resolve(e,t,i,l,n){this.rootPath=e,this.tokens=t,this.handleFile=i,this.handleError=l,this.done=n,this.hasErrors=!1,this.pendingImports=0,e!=null&&e.endsWith(".lor.txt")&&(this.ext=".lor.txt");let s=new Ee,r=[],h=new Ee,a=Nt.directory(e);this.extractImports(a,t,r,h),this.processImports(r,h,s)}processImports(e,t,i){let l=new Al(!1);for(;e.length>0;){let n=e.shift();this.handleItemInLoop(n,l,e,t,i)}l.finished=!0,this.pendingImports==0&&this.done!=null&&(this.resolvedImports=i,this.done(this.hasErrors,i),this.done=null)}handleItemInLoop(e,t,i,l,n){let s=this;this.handleFile(e,function(r){if(s.pendingImports--,r!=null)try{let h=new yt(r),a=h.tokenize(),o=h.getErrors();o!=null&&o.length>0&&s.handleError(o[0]),n.h[e]=a,s.extractImports(Nt.directory(e),a,i,l),t.finished&&s.processImports(i,l,n)}catch(h){let a=b.caught(h).unwrap();if(s.hasErrors=!0,a instanceof ai)s.handleError(a);else throw b.thrown(a)}else s.hasErrors=!0;t.finished&&s.pendingImports==0&&s.done!=null&&(s.resolvedImports=n,s.done(s.hasErrors,n),s.done=null)})}extractImports(e,t,i,l){let n=0,s=t.length;for(;n<s-1;){if(t[n].type==x.KwImport){let r=t[n+1].type;if(r._hx_index==15){let h=r.quotes,a=r.attachments,o=r.s,u=o;Nt.isAbsolute(o)||(u=Nt.join([e,u])),u=Nt.normalize(u),u.toLowerCase().endsWith(this.ext)||(u+=this.ext),Object.prototype.hasOwnProperty.call(l.h,u)||(this.pendingImports++,l.h[u]=!0,i.push(u))}}++n}}}j["loreline.Imports"]=Dl,Dl.__name__="loreline.Imports",Object.assign(Dl.prototype,{__class__:Dl});class wi{constructor(){this.mask=0,this.size=0,this._values=null,this._keys2=null,this._keys1=null;let e=this._keys1,t=this._keys2,i=this._values;if(this._keys1=new Array(16),this._keys2=new Array(16),this._values=new Array(16),this.mask=15,e!=null){this.size=0;let l=0,n=e.length;for(;l<n;){let s=l++;i[s]!=null&&this._set(e[s],t[s],i[s])}}}resize(e){let t=this._keys1,i=this._keys2,l=this._values;if(this._keys1=new Array(e),this._keys2=new Array(e),this._values=new Array(e),this.mask=e-1,t!=null){this.size=0;let n=0,s=t.length;for(;n<s;){let r=n++;l[r]!=null&&this._set(t[r],i[r],l[r])}}}hashCoords(e,t){let i=e+(t<<16);return i=(i^i>>>16)*-2048144789,i=(i^i>>>13)*-1028477387,i^i>>>16}clear(){this._keys1=null,this._keys2=null,this._values=null;let e=this._keys1,t=this._keys2,i=this._values;if(this._keys1=new Array(16),this._keys2=new Array(16),this._values=new Array(16),this.mask=15,e!=null){this.size=0;let l=0,n=e.length;for(;l<n;){let s=l++;i[s]!=null&&this._set(e[s],t[s],i[s])}}this.size=0}copy(){let e=new wi,t=this._keys1,i=new Array(t.length);ln.blit(t,0,i,0,t.length),e._keys1=i;let l=this._keys2,n=new Array(l.length);ln.blit(l,0,n,0,l.length),e._keys2=n;let s=this._values,r=new Array(s.length);return ln.blit(s,0,r,0,s.length),e._values=r,e.size=this.size,e.mask=this.mask,e}_set(e,t,i){if(this.size>=(this.mask+1)*.75){let r=this.mask+1<<1,h=this._keys1,a=this._keys2,o=this._values;if(this._keys1=new Array(r),this._keys2=new Array(r),this._values=new Array(r),this.mask=r-1,h!=null){this.size=0;let u=0,c=h.length;for(;u<c;){let _=u++;o[_]!=null&&this._set(h[_],a[_],o[_])}}}let l=e+(t<<16);l=(l^l>>>16)*-2048144789,l=(l^l>>>13)*-1028477387;let s=(l^l>>>16)&this.mask;for(;;){if(this._values[s]==null){this._keys1[s]=e,this._keys2[s]=t,this._values[s]=i,this.size++;return}if(this._keys1[s]==e&&this._keys2[s]==t){this._values[s]=i;return}s=s+1&this.mask}}_get(e,t){let i=e+(t<<16);i=(i^i>>>16)*-2048144789,i=(i^i>>>13)*-1028477387;let n=(i^i>>>16)&this.mask;for(;;){if(this._values[n]==null)return null;if(this._keys1[n]==e&&this._keys2[n]==t)return this._values[n];n=n+1&this.mask}}_exists(e,t){let i=e+(t<<16);i=(i^i>>>16)*-2048144789,i=(i^i>>>13)*-1028477387;let n=(i^i>>>16)&this.mask;for(;;){if(this._values[n]==null)return!1;if(this._keys1[n]==e&&this._keys2[n]==t)return!0;n=n+1&this.mask}}_remove(e,t){let i=e+(t<<16);i=(i^i>>>16)*-2048144789,i=(i^i>>>13)*-1028477387;let n=(i^i>>>16)&this.mask;for(;;){if(this._values[n]==null)return!1;if(this._keys1[n]==e&&this._keys2[n]==t){for(this._values[n]=null,this.size--,n=n+1&this.mask;this._values[n]!=null;){let s=this._keys1[n],r=this._keys2[n],h=this._values[n];this._values[n]=null,this.size--,this._set(s,r,h),n=n+1&this.mask}return!0}n=n+1&this.mask}}iterator(){return new Rl(this)}keyIterator(){return new Vl(this)}keyValueIterator(){return new Ul(this)}length(){return this.size}}j["loreline.Int64Map"]=wi,wi.__name__="loreline.Int64Map",Object.assign(wi.prototype,{__class__:wi});class Rl{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._values[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return e}}j["loreline._Int64Map.Int64MapIterator"]=Rl,Rl.__name__="loreline._Int64Map.Int64MapIterator",Object.assign(Rl.prototype,{__class__:Rl});class Vl{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._keys1[this.index],t=this.map._keys2[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return{high:e,low:t}}}j["loreline._Int64Map.Int64MapKeyIterator"]=Vl,Vl.__name__="loreline._Int64Map.Int64MapKeyIterator",Object.assign(Vl.prototype,{__class__:Vl});class Ul{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._keys1[this.index],t=this.map._keys2[this.index],i=this.map._values[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return{key:{high:e,low:t},value:i}}}j["loreline._Int64Map.Int64MapKeyValueIterator"]=Ul,Ul.__name__="loreline._Int64Map.Int64MapKeyValueIterator",Object.assign(Ul.prototype,{__class__:Ul});class Ii{constructor(e,t,i,l){this.scope=-1,i!=null?this.fields=i:this.clear(e,t),l!=null?this.originalFields=l:this.createOriginalFields()}clear(e,t){this.fields=ne.createFields(e,null,t)}createOriginalFields(){this.originalFields=ne.createFields()}}j["loreline.RuntimeState"]=Ii,Ii.__name__="loreline.RuntimeState",Object.assign(Ii.prototype,{__class__:Ii});class cl extends Ii{constructor(e,t,i,l){super(e,t,i,l)}}j["loreline.RuntimeCharacter"]=cl,cl.__name__="loreline.RuntimeCharacter",cl.__super__=Ii,Object.assign(cl.prototype,{__class__:cl});var oi=Qe["loreline.RuntimeAccess"]={__ename__:"loreline.RuntimeAccess",__constructs__:null,FieldAccess:(d=function(k,e,t){return{_hx_index:0,pos:k,obj:e,name:t,__enum__:"loreline.RuntimeAccess",toString:S}},d._hx_name="FieldAccess",d.__params__=["pos","obj","name"],d),ArrayAccess:(d=function(k,e,t){return{_hx_index:1,pos:k,array:e,index:t,__enum__:"loreline.RuntimeAccess",toString:S}},d._hx_name="ArrayAccess",d.__params__=["pos","array","index"],d),CharacterAccess:(d=function(k,e){return{_hx_index:2,pos:k,name:e,__enum__:"loreline.RuntimeAccess",toString:S}},d._hx_name="CharacterAccess",d.__params__=["pos","name"],d),FunctionAccess:(d=function(k,e){return{_hx_index:3,pos:k,name:e,__enum__:"loreline.RuntimeAccess",toString:S}},d._hx_name="FunctionAccess",d.__params__=["pos","name"],d),BeatAccess:(d=function(k,e){return{_hx_index:4,pos:k,beat:e,__enum__:"loreline.RuntimeAccess",toString:S}},d._hx_name="BeatAccess",d.__params__=["pos","beat"],d)};oi.__constructs__=[oi.FieldAccess,oi.ArrayAccess,oi.CharacterAccess,oi.FunctionAccess,oi.BeatAccess];class pl{constructor(e,t,i,l,n,s,r){this.insertion=null,this.head=null,this.state=null,this.beats=null,this.id=-1,e!=null&&(this.id=e),this.beat=t,this.node=i,l!=null&&(this.beats=l),n!=null&&(this.state=n),s!=null&&(this.head=s),r!=null&&(this.insertion=r)}beatByName(e){if(this.beats==null)return null;let t=0,i=this.beats.length;for(;t<i;){let l=t++,n=this.beats[l];if(n.name==e)return n}return null}}j["loreline.RuntimeScope"]=pl,pl.__name__="loreline.RuntimeScope",Object.assign(pl.prototype,{__class__:pl});class wl{constructor(e,t){this.parentNextOptionIndex=0,this.parentPartialOptions=null,this.stack=[],this.options=null,this.id=e,this.origin=t}}j["loreline.RuntimeInsertion"]=wl,wl.__name__="loreline.RuntimeInsertion",Object.assign(wl.prototype,{__class__:wl});class kl{constructor(e,t,i){this.closing=e,this.value=t,this.offset=i}}j["loreline.TextTag"]=kl,kl.__name__="loreline.TextTag",Object.assign(kl.prototype,{__class__:kl});class yl{constructor(e,t,i,l,n){this.text=e,this.tags=t,this.enabled=i,this.node=l,this.insertion=n}}j["loreline.ChoiceOption"]=yl,yl.__name__="loreline.ChoiceOption",Object.assign(yl.prototype,{__class__:yl});class fe extends ai{constructor(e,t){super(e,t)}}j["loreline.RuntimeError"]=fe,fe.__name__="loreline.RuntimeError",fe.__super__=ai,Object.assign(fe.prototype,{__class__:fe});class ql{constructor(){this.cb=null,this.sync=!0}}j["loreline.EvalNext"]=ql,ql.__name__="loreline.EvalNext",Object.assign(ql.prototype,{__class__:ql});class bl{constructor(e,t,i,l,n){this._choiceEvalEnabled=[],this._choiceEvalTexts=[],this.pendingChoiceOptions=null,this.beatToResume=null,this.finishTrigger=null,this.flushing=!1,this.syncCallbacks=[],this.nextInsertionId=1,this.nextScopeId=1,this.stack=[],this.stringLiteralProcessors=[],this.beatHelpers=new Ee,this.mapHelpers=new Ee,this.arrayHelpers=new Ee,this.stringHelpers=new Ee,this.topLevelFunctions=new Ee,this.nodeStates=new Gi,this.topLevelBeats=new Ee,this.topLevelCharacters=new Ee,this.script=e,this.handleDialogue=t,this.handleChoice=i,this.handleFinish=l,this.lens=new Kl(e);let s=n!=null?n.strictAccess:null;this.strictAccess=s!=null&&s,this.translations=n!=null?n.translations:null,this.topLevelState=new Ii(this,e,null,null),this.initializeTopLevelFunctions(n!=null?n.functions:null),this.initializeStringLiteralProcessors(n!=null?n.stringLiteralProcessors:null);let r=e.iterator();for(;r.hasNext();){let h=r.next();switch(te.getClass(h)){case Me:this.initializeTopLevelBeat(h);break;case zt:this.initializeTopLevelCharacter(h);break;case Li:this.initializeTopLevelFunction(h);break;case Wt:this.initializeTopLevelState(h);break;default:}}}get_currentScope(){return this.stack.length>0?this.stack[this.stack.length-1]:null}get_currentInsertion(){let e=this.stack.length-1;for(;e>=0;){let t=this.stack[e];if(t.insertion!=null)return t.insertion;--e}return null}removeCurrentInsertion(){let e=this.stack.length-1;for(;e>=0;){let t=this.stack[e];if(t.insertion!=null){t.insertion=null;break}--e}}start(e){let t=null;if(e!=null){if(t=this.topLevelBeats.h[e],t==null)throw b.thrown(new fe("Beat "+e+" not found",this.script.pos))}else{let i=0,l=this.script.body;for(;i<l.length;){let n=l[i];if(++i,n instanceof Me){let s=n;if(s.name=="_"){t=s;break}t==null&&(t=s)}}if(t==null){let n=this.script.iterator();for(;n.hasNext();){let s=n.next();if(s instanceof Me){let r=s;if(r.name=="_"){t=r;break}t==null&&(t=r)}}}if(t==null)throw b.thrown(new fe("No beats found in script",this.script.pos))}this.transitionToBeat(t),this.flush()}save(){let e={},t=[],i=0,l=this.stack;for(;i<l.length;){let s=l[i];++i,t.push(this.serializeScope(s,e))}let n={version:1,stack:t,state:this.serializeState(this.topLevelState),characters:this.serializeCharacters(),nodeStates:this.serializeNodeStates()};if(this.pendingChoiceOptions!=null){let s=[],r=0,h=this.pendingChoiceOptions;for(;r<h.length;){let a=h[r];++r,s.push(this.serializeChoiceOption(a,e))}n.pendingChoiceOptions=s}if(this._choiceEvalTexts.length>0){let s=[],r=0,h=this._choiceEvalTexts.length;for(;r<h;){let a=r++,o={text:this._choiceEvalTexts[a]};this._choiceEvalEnabled[a]||(o.disabled=!0),s.push(o)}n.choiceEvalContext=s}return We.fields(e).length>0&&(n.insertions=e),n}restore(e){if(e.version!=1)throw b.thrown(new fe("Unsupported save version: "+e.version,this.script.pos));this.stack.length=0,this.nodeStates.map.clear(),this.nextScopeId=1,this.nextInsertionId=1,this.pendingChoiceOptions=null,this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0,this.restoreState(this.topLevelState,e.state),this.restoreCharacters(e.characters),this.restoreNodeStates(e.nodeStates);let t=new Ri;if(this.restoreStack(e.stack,e.insertions,t)||(this.beatToResume=this.restoreBeatToResume(e.stack)),e.pendingChoiceOptions!=null){this.pendingChoiceOptions=[];let i=0,l=e.pendingChoiceOptions;for(;i<l.length;){let n=l[i];++i;let s=this.restoreChoiceOption(n,e.insertions,t);s!=null&&this.pendingChoiceOptions.push(s)}}if(e.choiceEvalContext!=null){this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let i=0,l=e.choiceEvalContext;for(;i<l.length;){let n=l[i];++i,this._choiceEvalTexts.push(n.text),this._choiceEvalEnabled.push(n.disabled!=!0)}}}resume(){if(this.stack.length==0){this.start();return}let e=this.wrapNext(Te(this,this.finish));this.finishTrigger=e,this.resumeNode(this.stack[0].node,0,e.cb),e.sync=!1,this.flush()}resumeFromLevel(e,t){let i=this.wrapNext(t);this.resumeNode(this.stack[e].node,e,i.cb),i.sync=!1}getCharacter(e){let t=this.topLevelCharacters.h[e];return t!=null?t.fields:null}getCharacterField(e,t){let i=this.topLevelCharacters.h[e],l=i!=null?i.fields:null;return l!=null?ne.getField(this,l,t):null}setCharacterField(e,t,i){let l=this.topLevelCharacters.h[e].fields;ne.setField(this,l,t,i)}getStateField(e){let t=this.stack.length-1;for(;t>=0;){let i=this.stack[t];if(i.state!=null&&ne.fieldExists(this,i.state.fields,e))return ne.getField(this,i.state.fields,e);if(i.node!=null){let l=i.node.id.thisVal,n=this.nodeStates.map._get(l.high,l.low);if(n!=null&&ne.fieldExists(this,n.fields,e))return ne.getField(this,n.fields,e)}--t}return ne.fieldExists(this,this.topLevelState.fields,e)?ne.getField(this,this.topLevelState.fields,e):null}setStateField(e,t){let i=this.stack.length-1;for(;i>=0;){let l=this.stack[i];if(l.state!=null&&ne.fieldExists(this,l.state.fields,e)){ne.setField(this,l.state.fields,e,t);return}if(l.node!=null){let n=l.node.id.thisVal,s=this.nodeStates.map._get(n.high,n.low);if(s!=null&&ne.fieldExists(this,s.fields,e)){ne.setField(this,s.fields,e,t);return}}--i}ne.setField(this,this.topLevelState.fields,e,t)}getTopLevelStateField(e){return ne.getField(this,this.topLevelState.fields,e)}setTopLevelStateField(e,t){ne.setField(this,this.topLevelState.fields,e,t)}currentNode(){let e=this.get_currentScope();return e==null?null:e.head!=null?e.head:e.node}serializeScope(e,t){let i={id:e.id};if(e.beat!=null&&(i.beat=this.serializeBeatReference(e.beat)),e.node!=null&&(i.node=this.serializeNodeReference(e.node)),e.state!=null&&(i.state=this.serializeState(e.state)),e.beats!=null){let l=[],n=0,s=e.beats;for(;n<s.length;){let r=s[n];++n,l.push(this.serializeBeatReference(r))}i.beats=l}return e.head!=null&&(i.head=this.serializeNodeReference(e.head)),e.insertion!=null&&(i.insertion=this.serializeInsertion(e.insertion,t)),i}serializeInsertion(e,t){let i=e.id==null?"null":""+e.id,l=We.field(t,i);if(l==null){if(l={},t[i]=l,e.options!=null){let n=[],s=0,r=e.options;for(;s<r.length;){let h=r[s];++s,n.push(this.serializeChoiceOption(h,t))}l.options=n}if(e.origin!=null&&(l.origin=this.serializeNodeReference(e.origin)),e.stack!=null){let n=[],s=0,r=e.stack;for(;s<r.length;){let h=r[s];++s,n.push(this.serializeScope(h,t))}l.stack=n}if(e.parentPartialOptions!=null){let n=[],s=0,r=e.parentPartialOptions;for(;s<r.length;){let h=r[s];++s,n.push(this.serializeChoiceOption(h,t))}l.parentPartialOptions=n,l.parentNextOptionIndex=e.parentNextOptionIndex}}return e.id}serializeChoiceOption(e,t){let i={text:e.text};if(e.enabled||(i.disabled=!0),e.tags!=null){let l=[],n=0,s=e.tags;for(;n<s.length;){let r=s[n];++n,l.push(this.serializeTextTag(r))}i.tags=l}return e.node!=null&&(i.node=this.serializeNodeReference(e.node)),e.insertion!=null&&(i.insertion=this.serializeInsertion(e.insertion,t)),i}serializeTextTag(e){let t={value:e.value,offset:e.offset};return e.closing&&(t.closing=!0),t}serializeState(e){return this.serializeFields(e.fields,e.originalFields)}serializeCharacters(){let e={},t=this.topLevelCharacters.h,i=t,l=Object.keys(t),n=l.length,s=0;for(;s<n;){let r=l[s++],h=r,a=i[r],o=h,u=a,c=this.serializeCharacter(u);We.fields(c.fields).length>0&&(e[o]=c)}return e}serializeNodeStates(){let e={},t=this.nodeStates.map,i=0;for(;i<t._values.length&&t._values[i]==null;)++i;for(;i<t._values.length;){let l=t._keys1[i],n=t._keys2[i],s=t._values[i];for(++i;i<t._values.length&&t._values[i]==null;)++i;let r=Re.fromTwoInt32(l,n),h=s,a=r,o=h,u=this.serializeState(o);We.fields(u.fields).length>0&&(e[a.toString()]=u)}return e}serializeBeatReference(e){let t=e.name,i=e;do i=this.lens.getFirstParentOfType(i,Me),i!=null&&(t=i.name+"."+t);while(i!=null);return{id:e.id.toString(),path:t}}serializeNodeReference(e){return{id:e.id.toString(),type:e.type()}}serializeCharacter(e){return this.serializeFields(e.fields,e.originalFields)}serializeFields(e,t){let i=null,l={};if(te.__implements(e,vi)){let n=te.getClass(e);n!=null&&(i=n.__name__);let s=e,r=0,h=s.lorelineFields(this);for(;r<h.length;){let a=h[r];++r,l[a]=this.serializeValue(s.lorelineGet(this,a))}}else if(e instanceof Ee){let n=e,s=n.h,r=s,h=Object.keys(s),a=h.length,o=0;for(;o<a;){let u=h[o++],c=n.h[u];(t==null||!ne.fieldExists(this,t,u)||!Si.equal(this,ne.getField(this,t,u),c))&&(l[u]=this.serializeValue(c))}}else{let n=te.getClass(e);n!=null&&(i=n.__name__);let s=0,r=We.fields(e);for(;s<r.length;){let h=r[s];++s;let a=We.getProperty(e,h);(t==null||!ne.fieldExists(this,t,h)||!Si.equal(this,ne.getField(this,t,h),a))&&(l[h]=this.serializeValue(a))}}return i!=null?{type:i,fields:l}:{fields:l}}serializeValue(e){if(e==null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="number"&&(e|0)===e||typeof e=="boolean")return e;if(re.isArray(e)){let t=[],i=re.arrayLength(e),l=0,n=i;for(;l<n;){let s=l++;t.push(this.serializeValue(re.arrayGet(e,s)))}return t}return this.serializeFields(e)}resumeNode(e,t,i){let l=this.stack.length-1;if(t>=this.stack.length)switch(te.getClass(e)){case Ui:this.evalAlternative(e,i);break;case Rt:if(!this.isBeatCall(e))this.evalCall(e,i);else{let r=te.getClass(e);throw b.thrown(new fe("Resume execution not supported from last node: "+r.__name__,e.pos))}break;case mi:this.evalChoice(e,i);break;case ti:this.evalDialogue(e,i);break;case ci:this.evalText(e,i);break;default:let s=te.getClass(e);throw b.thrown(new fe("Resume execution not supported from last node: "+s.__name__,e.pos))}else switch(te.getClass(e)){case Ui:this.resumeAlternative(e,t,i);break;case Me:this.resumeBeatRun(e,t,i);break;case Rt:if(this.isBeatCall(e,t))this.resumeCall(e,t,i);else{let r=te.getClass(e);throw b.thrown(new fe("Resume execution not supported from node within stack: "+r.__name__,e.pos))}break;case Et:this.resumeChoiceOption(e,t,i);break;case mi:this.resumeChoice(e,t,i);break;case gi:this.resumeIf(e,t,i);break;default:let s=te.getClass(e);throw b.thrown(new fe("Resume execution not supported from node within stack: "+s.__name__,e.pos))}}resumeNodeBody(e,t,i,l){let n=this.stack[t],s=0,r=-1;if(n.head==null&&t<this.stack.length-1)throw b.thrown(new fe("Cannot resume through a body with a no-headed scope that is not at the bottom of the stack",e.pos));if(n.head!=null&&(s=i.indexOf(n.head),r=s,s==-1))throw b.thrown(new fe("Failed to resolve head in scope when resuming through body",e.pos));let h=this.get_currentInsertion(),a=null,o=this;a=function(){if((h!=null?h.options:null)!=null)o.pop(),l();else if(s!=-1&&s==r){let u=i[s];s+=1;let c=o.wrapNext(a);o.resumeNode(u,t+1,c.cb),c.sync=!1}else if(s<i.length){let u=i[s];n.head=u,s+=1;let c=o.wrapNext(a);o.evalNode(u,c.cb),c.sync=!1}else o.pop(),l()},a()}resumeBeatRun(e,t,i){this.resumeNodeBody(e,t,e.body,i)}resumeChoiceOption(e,t,i){this.resumeNodeBody(e,t,e.body,i)}resumeChoice(e,t,i){let l=this.stack[t],n=this;if(l.head==null)this.evalChoice(e,i);else if(l.head instanceof Et){let s=l.head;t+1<this.stack.length?this.resumeNodeBody(s,t+1,s.body,i):this.evalNodeBody(l.beat,s,s.body,null,i)}else if(l.insertion!=null){let s=l.node,r=l.insertion;if(s instanceof Me){let h=s;this.resumeNodeBody(h,t,h.body,function(){let a=r.parentPartialOptions!=null?r.parentPartialOptions:[];if(r.options!=null){let _=0,f=r.options;for(;_<f.length;){let m=f[_];++_,a.push(m)}}let o=r.parentNextOptionIndex,u=l.beat,c=n.wrapNext(function(){n.presentChoice(e,a,i)});n.evalChoiceOptionsAndInsertions(u,e,a,c.cb,o),c.sync=!1})}else{for(;this.stack.length>t;)this.pop();this.evalChoice(e,i)}}else if(l.node instanceof Et){let s=l.node;this.resumeNodeBody(s,t,s.body,i)}else if(l.node instanceof Me){let s=l.node;this.resumeNodeBody(s,t,s.body,i)}else throw b.thrown(new fe("Choice head is not a choice option",l.head.pos))}resumeIf(e,t,i){let l=this.stack[t];if(l.head==null)throw b.thrown(new fe("Failed to resolve head in scope when resuming through condition",e.pos));let s=e.thenBranch.body.indexOf(l.head)!=-1?e.thenBranch:e.elseBranch;if(s!=null&&s.body.length>0)this.resumeNodeBody(s,t,s.body,i);else throw b.thrown(new fe("Failed to resume condition: invalid scope",e.pos))}resumeAlternative(e,t,i){let l=this.stack[t];if(l.head==null)throw b.thrown(new fe("Failed to resolve head when resuming alternative",e.pos));let n=0,s=e.items;for(;n<s.length;){let r=s[n];if(++n,r.body.indexOf(l.head)!=-1){this.resumeNodeBody(r,t,r.body,i);return}}throw b.thrown(new fe("Failed to resume alternative: head not found in any item",e.pos))}resumeCall(e,t,i){if(e.target instanceof ut){let l=e.target;if(l.target==null){let n=l.name,s=null,r=this.stack.length-1;for(;r>=0;){let a=this.stack[r].beatByName(n);if(a!=null){s=a;break}--r}if(s==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,n)&&(s=this.topLevelBeats.h[n]),s!=null){this.resumeBeatRun(s,t,i);return}}}throw b.thrown(new fe("Cannot resume through a function call that is not at the bottom of the stack",e.pos))}restoreStack(e,t,i){let l=[];i==null&&(i=new Ri);let n=e.length-1;for(;n>=0;){let s=this.restoreScopeItem(e[n],t,i);if(s==null)return!1;l.push(s),--n}for(n=l.length-1;n>=0;)this.push(l[n]),--n;return!0}restoreScopeItem(e,t,i){let l=this.restoreBeat(e.beat);if(l==null)return null;let n=Re.fromString(e.beat.id),s=e.node,r=s!=null?this.restoreNode(s,n,l):null;if(s!=null&&r==null)return null;let h=[];if(e.beats!=null){let f=0,m=e.beats;for(;f<m.length;){let g=m[f];++f;let w=this.restoreBeat(g);if(w==null)return null;h.push(w)}}let o=e.state!=null?this.restoreState(null,e.state):null,u=e.head,c=u!=null?this.restoreNode(u,n,l):null;if(u!=null&&c==null)return null;let _=null;return e.insertion!=null&&t!=null&&(_=this.restoreInsertion(e.insertion,t,i)),new pl(null,l,r,h,o,c,_)}restoreInsertion(e,t,i){if(i.h.hasOwnProperty(e))return i.h[e];let l=e==null?"null":""+e,n=We.field(t,l);if(n==null)return null;let s=null;if(n.origin!=null){let h=Re.fromString(n.origin.id),a=this.lens.getNodeById(h);a!=null&&a.type()==n.origin.type&&(s=a)}let r=new wl(e,s);if(i.h[e]=r,e>=this.nextInsertionId&&(this.nextInsertionId=e+1),n.options!=null){r.options=[];let h=0,a=n.options;for(;h<a.length;){let o=a[h];++h;let u=this.restoreChoiceOption(o,t,i);u!=null&&r.options.push(u)}}if(n.stack!=null){r.stack=[];let h=0,a=n.stack;for(;h<a.length;){let o=a[h];++h;let u=this.restoreScopeItem(o,t,i);u!=null&&r.stack.push(u)}}if(n.parentPartialOptions!=null){r.parentPartialOptions=[];let h=0,a=n.parentPartialOptions;for(;h<a.length;){let o=a[h];++h;let u=this.restoreChoiceOption(o,t,i);u!=null&&r.parentPartialOptions.push(u)}r.parentNextOptionIndex=n.parentNextOptionIndex!=null?n.parentNextOptionIndex:0}return r}restoreChoiceOption(e,t,i){let l=null;if(e.node!=null){let r=Re.fromString(e.node.id),h=this.lens.getNodeById(r);h!=null&&h.type()==e.node.type&&(l=h)}let n=null;if(e.tags!=null){let r=[],h=0,a=e.tags;for(;h<a.length;){let o=a[h];++h,r.push(new kl(o.closing==!0,o.value,o.offset))}n=r}let s=null;return e.insertion!=null&&t!=null&&(s=this.restoreInsertion(e.insertion,t,i)),new yl(e.text,n,e.disabled!=!0,l,s)}restoreBeatToResume(e){let t=null;if(e.length>0){let i=e[0];if(t=this.restoreBeat(i.beat),t!=null){let l=t;do l=this.lens.getFirstParentOfType(l,Me),l!=null&&(t=l);while(l!=null)}}return t}restoreNode(e,t,i){let l=i.id.thisVal.high>>16&65535,n=t.thisVal.high>>16&65535,s=(l>=32768?l-65536:l)+32768-((n>=32768?n-65536:n)+32768),r=Re.fromString(e.id);if(r==t)return i;let h=r.thisVal.high>>16&65535,o=(h>=32768?h-65536:h)+32768+s-32768;o<0&&(o=o+65536&65535),r.thisVal=new Di(r.thisVal.high&65535|o<<16,r.thisVal.low);let u=this.lens.getNodeById(r);return u!=null&&u.type()==e.type?u:null}restoreBeat(e){return this.lens.findBeatByPathFromNode(e.path,this.script)}restoreState(e,t){let i=e!=null?e.fields:null,l=this.restoreFields(i??null,t);return e==null&&(e=new Ii(this,null,l,null)),e}restoreCharacters(e){let t=0,i=We.fields(e);for(;t<i.length;){let l=i[t];++t;let n=We.field(e,l);if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,l))this.restoreCharacter(this.topLevelCharacters.h[l],n);else{let s=this.restoreCharacter(null,n);this.topLevelCharacters.h[l]=s}}}restoreNodeStates(e){let t=0,i=We.fields(e);for(;t<i.length;){let l=i[t];++t;let n=Re.fromString(l),s=We.field(e,l),r=this.restoreState(null,s),h=n.thisVal;this.nodeStates.map._set(h.high,h.low,r)}}restoreCharacter(e,t){let i=e!=null?e.fields:null,l=this.restoreFields(i??null,t);return e==null&&(e=new cl(this,null,l,null)),e}restoreFields(e,t){if(t==null||t.fields==null)return e;e==null&&(e=ne.createFields(this,t.type));let i=t.fields;if(ne.isFields(e)){let l=0,n=We.fields(i);for(;l<n.length;){let s=n[l];++l,ne.setField(this,e,s,this.restoreValue(We.field(i,s)))}}else{let l=0,n=We.fields(i);for(;l<n.length;){let s=n[l];++l,e[s]=this.restoreValue(We.field(i,s))}}return e}restoreValue(e){if(e==null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="number"&&(e|0)===e||typeof e=="boolean")return e;if(re.isArray(e)){let t=re.arrayLength(e),i=re.createArray(),l=0,n=t;for(;l<n;){let s=l++;re.arrayPush(i,this.restoreValue(re.arrayGet(e,s)))}return i}return this.restoreFields(null,e)}initializeTopLevelFunctions(e){if(this.builtins=new Bl(this),this.builtins.bindAll(this.topLevelFunctions),e!=null){let r=e,h=r,a=We.fields(r),o=0;for(;o<a.length;){let u=a[o++],c=h[u],f=u,m=c;this.topLevelFunctions.h[f]=m}}let t=this.topLevelFunctions.h,i=t,l=Object.keys(t),n=l.length,s=0;for(;s<n;){let r=l[s++],h=r,a=i[r],o=h,u=a;o.startsWith("string_")?this.stringHelpers.h[p.substr(o,7,null)]=u:o.startsWith("array_")?this.arrayHelpers.h[p.substr(o,6,null)]=u:o.startsWith("map_")?this.mapHelpers.h[p.substr(o,4,null)]=u:o.startsWith("beat_")&&(this.beatHelpers.h[p.substr(o,5,null)]=u)}}initializeStringLiteralProcessors(e){let t=this;if(this.stringLiteralProcessors.push(function(i){return t.pluralPipeProcess(i)}),e!=null){let i=0;for(;i<e.length;){let l=e[i];++i,this.stringLiteralProcessors.push(l)}}}initializeTopLevelFunction(e){if(e.name!=null){if(!e.external||!Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,e.name)){let t=new Ji;try{let i=t.process(e.code+(e.external?" {}":"")),l=new tl;l.allowJSON=!0,l.allowTypes=!0;let n=l.parseString(i),r=new Ll(this).execute(n);this.topLevelFunctions.h[e.name]=r}catch(i){let l=b.caught(i).unwrap();throw b.thrown(new fe("Failed to parse function code: "+(l==null?"null":le.string(l)),e.pos))}}}else throw b.thrown(new fe("Top level function must have a name",e.pos))}wrapNext(e){let t=new ql;t.sync=!0;let i=this;return t.cb=function(){t.sync?(i.syncCallbacks==null&&(i.syncCallbacks=[]),i.syncCallbacks.push(t.cb)):(e(),i.flush(),t.cb=null,i.finishTrigger==t&&i.finish())},t}flush(){if(!this.flushing){this.flushing=!0;try{if(this.syncCallbacks!=null)for(;this.syncCallbacks.length>0;){let e=this.syncCallbacks.shift(),t=this.syncCallbacks;if(this.syncCallbacks=null,e(),this.syncCallbacks!=null){let i=this.syncCallbacks.length-1;for(;i>=0;)t.unshift(this.syncCallbacks[i]),--i}this.syncCallbacks=t}}catch(e){let t=b.caught(e).unwrap();throw this.flushing=!1,b.thrown(t)}this.flushing=!1}}pop(){return this.stack.length>0?(this.stack.pop(),!0):!1}push(e){e.id=this.nextScopeId++,this.stack.push(e)}initializeTopLevelState(e){if(e.temporary)throw b.thrown(new fe("Top level temporary states are not allowed",e.pos));let t=0,i=e.fields;for(;t<i.length;){let l=i[t];++t;let n=this.evaluateExpression(l.value);ne.setField(this,this.topLevelState.fields,l.name,n),this.isOriginalScriptExpression(l.value)&&ne.setField(this,this.topLevelState.originalFields,l.name,n)}}initializeTopLevelBeat(e){if(Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,e.name))throw b.thrown(new fe("Duplicate top level beat: "+e.name,e.pos));this.topLevelBeats.h[e.name]=e}initializeTopLevelCharacter(e){if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,e.name))throw b.thrown(new fe("Duplicate top level character: "+e.name,e.pos));let t=new cl(this,e,null,null);this.topLevelCharacters.h[e.name]=t;let i=0,l=e.fields;for(;i<l.length;){let n=l[i];++i;let s=this.evaluateExpression(n.value);ne.setField(this,t.fields,n.name,s),this.isOriginalScriptExpression(n.value)&&ne.setField(this,t.originalFields,n.name,s)}}initializeState(e,t){let i=null;if(e.temporary)t.state==null&&(t.state=new Ii(this,e,null,null)),i=t.state;else{let s=t.node.id.thisVal;if(i=this.nodeStates.map._get(s.high,s.low),i==null){i=new Ii(this,e,null,null);let r=t.node.id.thisVal;this.nodeStates.map._set(r.high,r.low,i)}}let l=0,n=e.fields;for(;l<n.length;){let s=n[l];if(++l,!ne.fieldExists(this,i.fields,s.name)){let r=this.evaluateExpression(s.value);ne.setField(this,i.fields,s.name,r),!e.temporary&&this.isOriginalScriptExpression(s.value)&&ne.setField(this,i.originalFields,s.name,r)}}}finish(){this.finishTrigger=null,this.handleFinish!=null&&this.handleFinish(this)}transitionToBeat(e){for(;this.pop(););this.nextScopeId=1,this.nextInsertionId=1,this.pendingChoiceOptions=null,this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let t=this.wrapNext(Te(this,this.finish));this.finishTrigger=t,this.evalBeatRun(e,t.cb),t.sync=!1}evalNode(e,t){switch(te.getClass(e)){case Ui:this.evalAlternative(e,t);break;case di:this.evalAssignment(e,t);break;case Me:this.evalBeatDecl(e,t);break;case Rt:this.evalCall(e,t);break;case Et:this.evalChoiceOption(e,t);break;case mi:this.evalChoice(e,t);break;case ti:this.evalDialogue(e,t);break;case gi:this.evalIf(e,t);break;case Wt:this.evalStateDecl(e,t);break;case ci:this.evalText(e,t);break;case Mi:this.evalTransition(e);break;default:let i=te.getClass(e);throw b.thrown(new fe("Unsupported node type: "+i.__name__,e.pos))}}evalBeatDecl(e,t){if(this.get_currentScope().beats==null)this.get_currentScope().beats=[];else if(this.get_currentScope().beatByName(e.name)!=null)throw b.thrown(new fe("Duplicate beat with name: "+e.name,e.pos));this.get_currentScope().beats.push(e),t()}evalNodeBody(e,t,i,l,n){this.push(new pl(null,e,t,null,null,null,l));let s=0,r=null,h=this.get_currentInsertion(),a=this;r=function(){if((h!=null?h.options:null)!=null)a.pop(),n();else if(s<i.length){let o=i[s];a.get_currentScope().head=o,s+=1;let u=a.wrapNext(r);a.evalNode(o,u.cb),u.sync=!1}else a.pop(),n()},r()}evalBeatRun(e,t){this.incrementBeatVisitCount(e),this.evalNodeBody(e,e,e.body,null,t)}evalStateDecl(e,t){this.initializeState(e,this.get_currentScope()),t()}evalText(e,t){if(e.condition!=null&&!this.evaluateCondition(e.condition)){t();return}let i=this.getTranslatedString(e,e.content),l=this.evaluateString(i);this.handleDialogue(this,null,l.text,l.tags,t)}evalDialogue(e,t){if(e.condition!=null&&!this.evaluateCondition(e.condition)){t();return}let i=this.getTranslatedString(e,e.content),l=this.evaluateString(i);this.handleDialogue(this,e.character,l.text,l.tags,t)}evalChoice(e,t){let i=this.pendingChoiceOptions;if(i!=null){this.pendingChoiceOptions=null,this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let r=0;for(;r<i.length;){let h=i[r];++r,this._choiceEvalTexts.push(h.text),this._choiceEvalEnabled.push(h.enabled)}this.presentChoice(e,i,t);return}let l=[],n=this,s=this.wrapNext(function(){n.presentChoice(e,l,t)});this.evalChoiceOptionsAndInsertions(this.get_currentScope().beat,e,l,s.cb),s.sync=!1}presentChoice(e,t,i){let l=this.get_currentInsertion();if(l!=null&&l.options==null){l.stack=[].concat(this.stack),l.options=t,i();return}let n=0,s=e.options;for(;n<s.length;){let u=s[n];if(++n,u.insertion!=null){this.pendingChoiceOptions=t;break}}let r=-1,h=this,a=function(){h._choiceEvalTexts.length=0,h._choiceEvalEnabled.length=0},o=this.wrapNext(function(){if(h.pendingChoiceOptions=null,r>=0&&r<t.length){let u=t[r];u.node.once&&h.setChoiceOptionChosen(u.node);let c=function(){a(),i()};if(u.insertion!=null){let _=h.stack.length;for(;h.stack.length>0;)h.stack.pop();let f=0,m=u.insertion.stack;for(;f<m.length;){let w=m[f];++f,w.insertion!=null&&(w.insertion=null),h.stack.push(w)}let g=h.stack[h.stack.length-1];h.push(new pl(null,g.beat,h.lens.getParentNode(u.node),null,null,u.node,null)),h.resumeFromLevel(_,c)}else h.evalChoiceOption(u.node,c)}else a(),i()});this.handleChoice(this,t,function(u){r=u,o.cb()}),o.sync=!1}evalChoiceOptionsAndInsertions(e,t,i,l,n){let s=t.options;this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let r=n??0,h=null,a=null,o=this;h=function(){if(a!=null&&a.options!=null){let u=0,c=a.options.length;for(;u<c;){let _=u++,f=a.options[_];i.push(f),o._choiceEvalTexts.push(f.text),o._choiceEvalEnabled.push(f.enabled)}a=null}if(r<s.length){let u=s[r];r+=1;let _=!(u.once&&o.isChoiceOptionChosen(u))&&(u.condition==null||o.evaluateCondition(u.condition));if(u.text!=null){let f=o.wrapNext(h),m=o.getTranslatedString(u,u.text),g=o.evaluateString(m);i.push(new yl(g.text,g.tags,_,u,o.get_currentInsertion())),o._choiceEvalTexts.push(g.text),o._choiceEvalEnabled.push(_),f.cb(),f.sync=!1}else if(u.insertion!=null){let f=o.wrapNext(h);_?(a=new wl(o.nextInsertionId++,u.insertion),a.parentPartialOptions=[].concat(i),a.parentNextOptionIndex=r,o.evalInsertion(a,f.cb)):f.cb(),f.sync=!1}else throw b.thrown(new fe("Invalid choice option",u.pos))}else l()},h()}evalInsertion(e,t){let i=e.origin.target,l=null,n=this.stack.length-1;for(;n>=0;){let r=this.stack[n].beatByName(i);if(r!=null){l=r;break}--n}if(l==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,i)&&(l=this.topLevelBeats.h[i]),l==null)throw b.thrown(new fe("Beat "+i+" not found",this.script.pos));this.evalNodeBody(l,l,l.body,e,t)}evalChoiceOption(e,t){this.evalNodeBody(this.get_currentScope().beat,e,e.body,null,t)}evalIf(e,t){let l=this.evaluateCondition(e.condition)?e.thenBranch:e.elseBranch;l!=null&&l.body.length>0?this.evalNodeBody(this.get_currentScope().beat,l,l.body,null,t):t()}evalAlternative(e,t){if(e.items.length==0){t();return}switch(e.mode){case 0:let i=this.getAlternativeVisitCount(e),l=i<e.items.length?i:e.items.length-1;this.setAlternativeVisitCount(e,i+1);let n=e.items[l];this.evalNodeBody(this.get_currentScope().beat,n,n.body,null,t);break;case 1:let s=this.getAlternativeVisitCount(e),r=s%e.items.length;this.setAlternativeVisitCount(e,s+1);let h=e.items[r];this.evalNodeBody(this.get_currentScope().beat,h,h.body,null,t);break;case 2:let a=this.getAlternativeVisitCount(e);if(a>=e.items.length){t();return}this.setAlternativeVisitCount(e,a+1);let o=e.items[a];this.evalNodeBody(this.get_currentScope().beat,o,o.body,null,t);break;case 3:let u=this.builtins.random(0,e.items.length-1),c=e.items[u];this.evalNodeBody(this.get_currentScope().beat,c,c.body,null,t);break;case 4:let _=[],f=0,m=e.items.length;for(;f<m;){let y=f++;_.push(y)}let g=_,w=g.length-1;for(;w>0;){let y=this.builtins.random(0,w),T=g[w];g[w]=g[y],g[y]=T,--w}this.evalShuffledItems(e,g,0,t);break}}evalShuffledItems(e,t,i,l){if(i>=t.length){l();return}let n=e.items[t[i]],s=this;this.evalNodeBody(this.get_currentScope().beat,n,n.body,null,function(){s.evalShuffledItems(e,t,i+1,l)})}getBeatVisitCount(e){let t=e.id.thisVal,i=this.nodeStates.map._get(t.high,t.low);if(i==null)return 0;let l=ne.getField(this,i.fields,"_visitCount");return l??0}incrementBeatVisitCount(e){let t=e.id.thisVal,i=this.nodeStates.map._get(t.high,t.low);if(i==null){i=new Ii(this,e,null,null);let s=e.id.thisVal;this.nodeStates.map._set(s.high,s.low,i)}let l=ne.getField(this,i.fields,"_visitCount"),n=l??0;ne.setField(this,i.fields,"_visitCount",n+1)}getAlternativeVisitCount(e){let t=e.id.thisVal,i=this.nodeStates.map._get(t.high,t.low);if(i==null)return 0;let l=ne.getField(this,i.fields,"_visitCount");return l??0}setAlternativeVisitCount(e,t){let i=e.id.thisVal,l=this.nodeStates.map._get(i.high,i.low);if(l==null){l=new Ii(this,e,null,null);let n=e.id.thisVal;this.nodeStates.map._set(n.high,n.low,l)}ne.setField(this,l.fields,"_visitCount",t)}isChoiceOptionChosen(e){let t=e.id.thisVal,i=this.nodeStates.map._get(t.high,t.low);if(i==null)return!1;let l=ne.getField(this,i.fields,"_chosen");return l??!1}setChoiceOptionChosen(e){let t=e.id.thisVal,i=this.nodeStates.map._get(t.high,t.low);if(i==null){i=new Ii(this,e,null,null);let l=e.id.thisVal;this.nodeStates.map._set(l.high,l.low,i)}ne.setField(this,i.fields,"_chosen",!0)}evalAssignment(e,t){let i=this.resolveAssignmentTarget(e.target),l=this.evaluateExpression(e.value),n;switch(e.op._hx_index){case 21:n=this.performOperation(x.OpPlus,this.readAccess(i),l,e.pos);break;case 22:n=this.performOperation(x.OpMinus,this.readAccess(i),l,e.pos);break;case 23:n=this.performOperation(x.OpMultiply,this.readAccess(i),l,e.pos);break;case 24:n=this.performOperation(x.OpDivide,this.readAccess(i),l,e.pos);break;case 20:case 25:n=l;break;default:throw b.thrown(new fe("Invalid assignment operator",e.pos))}this.writeAccess(i,n),t()}isOriginalScriptExpression(e){switch(te.getClass(e)){case Qt:let t=e;return this.isOriginalScriptExpression(t.left)?this.isOriginalScriptExpression(t.right):!1;case ut:case pi:case Rt:return!1;case Ke:let i=e,l=i.literalType;switch(l._hx_index){case 0:case 1:case 2:return!0;case 3:let a=i.value,o=0;for(;o<a.length;){let f=a[o];if(++o,f instanceof at&&!this.isOriginalScriptExpression(f))return!1}return!0;case 4:let u=l.style,c=i.value,_=0;for(;_<c.length;){let f=c[_];if(++_,!this.isOriginalScriptExpression(f.value))return!1}return!0}break;case Tt:let n=e,s=0,r=n.parts;for(;s<r.length;){let a=r[s];++s;let o=a.partType;switch(o._hx_index){case 0:let u=o.text;continue;case 1:let c=o.expr;return!1;case 2:let _=o.closing,f=o.expr;if(!this.isOriginalScriptExpression(f))return!1;break}}return!0;case Ki:let h=e;return this.isOriginalScriptExpression(h.operand)}return!1}isBeatCall(e,t){return t==null&&(t=-1),e instanceof Rt?this.resolveBeatFromCall(e,t)!=null:!1}resolveBeatByName(e,t){t==null&&(t=-1);let i=t==-1?this.stack.length-1:t;for(;i>=0;){let l=this.stack[i].beatByName(e);if(l!=null)return l;--i}return this.topLevelBeats.h[e]}resolveBeatFromCall(e,t){if(t==null&&(t=-1),e.target instanceof ut){let i=e.target;if(i.target==null){let l=this.resolveBeatByName(i.name,t);if(l!=null)return l}}return null}evalCall(e,t){let i=this.resolveBeatFromCall(e);if(i!=null){this.evalBeatRun(i,t);return}this.evaluateFunctionCall(e,t)}evalTransition(e){let t=e.target;if(t=="."){this.finish();return}let i=null,l=this.stack.length-1;for(;l>=0;){let s=this.stack[l].beatByName(t);if(s!=null){i=s;break}--l}if(i==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,t)&&(i=this.topLevelBeats.h[t]),i==null)throw b.thrown(new fe("Beat "+t+" not found",this.script.pos));this.transitionToBeat(i)}getTranslatedString(e,t){if(this.translations!=null){let i=this.findHashCommentId(e,t);if(i!=null){let l=this.translations.h[i];if(l!=null)return l}}return t}findHashCommentId(e,t){return Mt.findHashComment(e,t)}evaluateString(e){let t=0,i=this.stringLiteralProcessors.length;for(;t<i;){let f=t++;e=this.stringLiteralProcessors[f](e)}let l="",n=[],s=0,r=e.parts.length,h=e.quotes!=0,a=e.quotes!=0,o=e.quotes!=0,u=-1;if(!h){let f=r-1;e:for(;f>=0;){let g=e.parts[f].partType;switch(g._hx_index){case 0:let w=g.text;u=f;break e;case 1:let y=g.expr;break e;case 2:let T=g.closing,E=g.expr;--f;break}}}let c=0,_=r;for(;c<_;){let f=c++,g=e.parts[f].partType;switch(g._hx_index){case 0:let w=g.text;h||(w=Ae.ltrim(w)),f==u&&(w=Ae.rtrim(w)),o||(w=this.stripStringComments(w)),a||(w=this.stripStringIndent(w));let y=w.length;y>0&&(h=!0);let T=!1,E=!1,C=!1,P=0,I=y;for(;P<I;){let L=P++,z=p.cca(w,L),D=z??-1;C?(D==110?l+=String.fromCodePoint(10):D==114?l+=String.fromCodePoint(13):D==116?l+=String.fromCodePoint(9):l+=String.fromCodePoint(D),C=!1,T=!1,E=!1):D==92?(C=!0,T=!1,E=!1):D==36?(T?(l+=String.fromCodePoint(D),T=!1):T=!0,E=!1):D==35?(E?(l+=String.fromCodePoint(D),E=!1):E=!0,T=!1):(E&&(l+=String.fromCodePoint(35),E=!1),l+=String.fromCodePoint(D))}E&&(l+=String.fromCodePoint(35)),s+=y;break;case 1:let v=g.expr;if(h=!0,v instanceof ut){let L=v,z=this.resolveAccess(L,L.target,L.name);if(z._hx_index==2){let D=z.pos,O=z.name,q=this.evaluateExpression(v),M=ne.getField(this,q,"name"),U=M??O,K=this.valueToString(U);s+=K.length,l+=K==null?"null":""+K}else{let D=this.evaluateExpression(v),O=this.valueToString(D);s+=O.length,l+=O==null?"null":""+O}}else{let L=this.evaluateExpression(v),z=this.valueToString(L);s+=z.length,l+=z==null?"null":""+z}break;case 2:let F=g.closing,B=g.expr,A=this.evaluateString(B).text;n.push(new kl(F,A,s));break}}return{text:l,tags:n}}pluralPipeProcess(e){let t=-1,i=!1,l=null,n=0,s=e.parts.length;for(;n<s;){let r=n++,h=e.parts[r],a=h.partType;switch(a._hx_index){case 0:let o=a.text;if(t>=0&&this.rawTextHasUnescapedPipe(o)){let f,m=e.parts[t].partType;if(m._hx_index==1?f=m.expr:f=null,f!=null){if(!i){let g=[],w=0,y=r;for(;w<y;){let T=w++;g.push(e.parts[T])}l=g,i=!0}this.transformPipeRaw(o,f,h.pos,l);continue}}break;case 1:let u=a.expr;t=r;break;case 2:let c=a.closing,_=a.expr;break}i&&l.push(h)}return i?new Tt(e.id,e.pos,e.quotes,l):e}rawTextHasUnescapedPipe(e){let t=e.length,i=0;for(;i<t;){let l=p.cca(e,i),n=l??-1;if(n==92){i+=2;continue}if(n==124)return!0;++i}return!1}transformPipeRaw(e,t,i,l){let n=e.length,s=0,r=0;for(;s<n;){let h=p.cca(e,s),a=h??-1;if(a==92&&s+1<n){s+=2;continue}if(a==40){let o=-1,u=-1,c=s+1;for(;c<n;){let _=p.cca(e,c),f=_??-1;if(f==92&&c+1<n){c+=2;continue}if(f==124&&o==-1)o=c;else if(f==41){u=c;break}++c}if(o!=-1&&u!=-1&&o>s+1&&u>o+1){let _=s+1,f=o-s-1,m=f!=null?p.substr(e,_,f):p.substr(e,_,null),g=o+1,w=u-o-1,y=w!=null?p.substr(e,g,w):p.substr(e,g,null);if(s>r){let T=s-r;l.push(new Je(Re.UNDEFINED,i,ze.Raw(T!=null?p.substr(e,r,T):p.substr(e,r,null))))}l.push(new Je(Re.UNDEFINED,i,ze.Expr(this.makePluralCall(t,m,y,i)))),s=u+1,r=s;continue}}if(a==124){let o=s;for(;o>r;){let w=p.cca(e,o-1),y=w??-1;if(y==32||y==9||y==10||y==124||y==40||y==41)break;--o}let u=s+1;for(;u<n;){let w=p.cca(e,u),y=w??-1;if(y==32||y==9||y==10||y==124||y==40||y==41)break;++u}let c=s-o,_=c!=null?p.substr(e,o,c):p.substr(e,o,null),f=s+1,m=u-s-1,g=m!=null?p.substr(e,f,m):p.substr(e,f,null);if(_.length>0&&g.length>0){if(o>r){let w=o-r;l.push(new Je(Re.UNDEFINED,i,ze.Raw(w!=null?p.substr(e,r,w):p.substr(e,r,null))))}l.push(new Je(Re.UNDEFINED,i,ze.Expr(this.makePluralCall(t,_,g,i)))),s=u,r=s;continue}}++s}if(r<n){let h=n-r;l.push(new Je(Re.UNDEFINED,i,ze.Raw(h!=null?p.substr(e,r,h):p.substr(e,r,null))))}}makePluralCall(e,t,i,l){let n=new ut(Re.UNDEFINED,l,null,"plural"),s=new Tt(Re.UNDEFINED,l,1,[new Je(Re.UNDEFINED,l,ze.Raw(t))]),r=new Tt(Re.UNDEFINED,l,1,[new Je(Re.UNDEFINED,l,ze.Raw(i))]);return new Rt(Re.UNDEFINED,l,n,[e,s,r])}stripStringIndent(e){if(e.indexOf(`
|
|
16
|
+
`+t+"}",n;case"string":return e;default:return String(e)}}static __interfLoop(e,t){if(e==null)return!1;if(e==t)return!0;let l=e.__interfaces__;if(l!=null&&(e.__super__==null||e.__super__.__interfaces__!=l)){let i=0,n=l.length;for(;i<n;){let s=i++,r=l[s];if(r==t||te.__interfLoop(r,t))return!0}}return te.__interfLoop(e.__super__,t)}static __instanceof(e,t){if(t==null)return!1;switch(t){case Array:return e instanceof Array;case Pn:return typeof e=="boolean";case vn:return e!=null;case On:return typeof e=="number";case Sn:return typeof e=="number"?(e|0)===e:!1;case String:return typeof e=="string";default:if(e!=null){if(typeof t=="function"){if(te.__downcastCheck(e,t))return!0}else if(typeof t=="object"&&te.__isNativeObj(t)&&e instanceof t)return!0}else return!1;return t==In&&e.__name__!=null||t==Nn&&e.__ename__!=null?!0:e.__enum__!=null?Ye[e.__enum__]==t:!1}}static __downcastCheck(e,t){return e instanceof t?!0:t.__isInterface__?te.__interfLoop(te.getClass(e),t):!1}static __implements(e,t){return te.__interfLoop(te.getClass(e),t)}static __cast(e,t){if(e==null||te.__instanceof(e,t))return e;throw C.thrown("Cannot cast "+Y.string(e)+" to "+Y.string(t))}static __nativeClassName(e){let t=te.__toStr.call(e).slice(8,-1);return t=="Object"||t=="Function"||t=="Math"||t=="JSON"?null:t}static __isNativeObj(e){return te.__nativeClassName(e)!=null}static __resolveNativeClass(e){return on[e]}}Q["js.Boot"]=te,te.__name__="js.Boot";class he{static isArray(e){return e instanceof Array}static arrayLength(e){return e.length}static arrayGet(e,t){let l=t|0,i=e;return l>=0&&l<i.length?i[l]:null}static arraySet(e,t,l){let i=t|0,n=e;n[i]=l}static createArray(){return[]}static arrayPush(e,t){e.push(t)}static arrayPop(e){return e.pop()}static arrayShift(e){return e.shift()}static arrayInsert(e,t,l){e.splice(t,0,l)}static arrayRemoveAt(e,t){e.splice(t,1)}static getIterator(e){return new Il(e)}static arrayCopy(e){let t=he.arrayLength(e),l=he.createArray(),i=0,n=t;for(;i<n;){let s=i++;he.arrayPush(l,he.arrayGet(e,s))}return l}static arraySort(e,t){let l=he.arrayLength(e),i=1,n=l;for(;i<n;){let s=i++,r=he.arrayGet(e,s),a=s-1;for(;a>=0&&t(he.arrayGet(e,a),r)>0;)he.arraySet(e,a+1,he.arrayGet(e,a)),--a;he.arraySet(e,a+1,r)}}static arrayReverse(e){let t=0,l=he.arrayLength(e)-1;for(;t<l;){let i=he.arrayGet(e,t);he.arraySet(e,t,he.arrayGet(e,l)),he.arraySet(e,l,i),++t,--l}}static arrayJoin(e,t){let l=he.arrayLength(e),i="",n=0,s=l;for(;n<s;){let r=n++;r>0&&(i+=t==null?"null":""+t),i+=Y.string(he.arrayGet(e,r)==null?"null":Y.string(he.arrayGet(e,r)))}return i}}Q["loreline.Arrays"]=he,he.__name__="loreline.Arrays";class et{static addQuotes(e){e.each(function(t,l){if(t instanceof Mt){let i=t;if(i.quotes==0){i.quotes=1;let n=0,s=i.parts.length;for(;n<s;){let r=n++,a=i.parts[r].partType;if(a._hx_index==0){let h=a.text,o=et.unquotedRawToQuotedRaw(h);i.parts[r].partType=ze.Raw(o)}}}}})}static removeQuotes(e){e.each(function(t,l){if(t instanceof Mt){let i=t;if(i.quotes==1){let n="",s=0,r=i.parts;for(;s<r.length;){let a=r[s];++s;let h=a.partType;if(h._hx_index==0){let o=h.text;n+=o}}if(et.canSafelyRemoveQuotes(n)){i.quotes=0;let a=0,h=i.parts.length;for(;a<h;){let o=a++,u=i.parts[o].partType;if(u._hx_index==0){let p=u.text,_=et.quotedRawToUnquotedRaw(p);i.parts[o].partType=ze.Raw(_)}}}}}})}static toBraceStyle(e){e.each(function(t,l){if(t instanceof $t)te.__cast(t,$t).style=1;else if(t instanceof jt)te.__cast(t,jt).style=1;else if(t instanceof Me)te.__cast(t,Me).style=1;else if(t instanceof xl)te.__cast(t,xl).style=1;else if(t instanceof St)te.__cast(t,St).style=1;else if(t instanceof hl)te.__cast(t,hl).style=1;else if(t instanceof je){let i=t,n=i.literalType;if(n._hx_index==4){let s=n.style;i.literalType=Ke.Object(1)}}})}static toPlainStyle(e){e.each(function(t,l){if(t instanceof $t)te.__cast(t,$t).style=0;else if(t instanceof jt)te.__cast(t,jt).style=0;else if(t instanceof Me)te.__cast(t,Me).style=0;else if(t instanceof xl)te.__cast(t,xl).style=0;else if(t instanceof St)te.__cast(t,St).style=0;else if(t instanceof hl)te.__cast(t,hl).style=0;else if(t instanceof je){let i=t,n=i.literalType;if(n._hx_index==4){let s=n.style;i.literalType=Ke.Object(0)}}})}static useWordOperators(e){e.each(function(t,l){if(t instanceof il){let i=t,n=i.op;switch(n._hx_index){case 37:let s=n.word;i.op=k.OpAnd(!0);break;case 38:let r=n.word;i.op=k.OpOr(!0);break;default:}}})}static useSymbolOperators(e){e.each(function(t,l){if(t instanceof il){let i=t,n=i.op;switch(n._hx_index){case 37:let s=n.word;i.op=k.OpAnd(!1);break;case 38:let r=n.word;i.op=k.OpOr(!1);break;default:}}})}static useParenConditions(e){e.each(function(t,l){t instanceof wl?te.__cast(t,wl).conditionStyle=2:t instanceof St&&(te.__cast(t,St).conditionStyle=2)})}static usePlainConditions(e){e.each(function(t,l){t instanceof wl?te.__cast(t,wl).conditionStyle=0:t instanceof St&&(te.__cast(t,St).conditionStyle=0)})}static reindentFunctions(e,t,l){e.each(function(i,n){if(i instanceof ql){let s=i;s.code!=null&&s.code.length>0&&!s.external&&(s.code=et.reindentCode(s.code,t,l))}})}static insertLocalizationKeys(e,t,l,i,n){l==null&&(l=!0),n==null&&(n=new wi);let s=e.split(`
|
|
17
|
+
`),r=!l&&t instanceof nl?(x=te.__cast(t,nl),be(x,x.eachExcludingImported)):be(t,t.each),a=i??new Ee;r(function(p,_){if(p instanceof Be){let m=p;if(m.trailingComments!=null){let f=0,g=m.trailingComments;for(;f<g.length;){let d=g[f];++f,d.isHash&&(a.h[d.content]=!0)}}if(m.leadingComments!=null){let f=0,g=m.leadingComments;for(;f<g.length;){let d=g[f];++f,d.isHash&&(a.h[d.content]=!0)}}}});let h=[];if(r(function(p,_){let m=null;if(p instanceof ll?m=te.__cast(p,ll).content:p instanceof Kt?m=te.__cast(p,Kt).content:p instanceof St&&(m=te.__cast(p,St).text),m!=null){let g=et.getStringEndLine(m)-1;if(g>=0&&g<s.length&&et.lineHasHashComment(s[g]))return;let d,w=0;do d=et.randomId(n,7+(w*.01|0)),++w;while(Object.prototype.hasOwnProperty.call(a.h,d));a.h[d]=!0,h.push({offset:m.pos.offset+m.pos.length,text:" #"+d})}}),h.length==0)return e;h.sort(function(p,_){return _.offset-p.offset});let o=e,u=0;for(;u<h.length;){let p=h[u];++u;let _=p.offset,m=p.offset,f=null;o=(_!=null?c.substr(o,0,_):c.substr(o,0,null))+p.text+(f!=null?c.substr(o,m,f):c.substr(o,m,null))}return o}static removeLocalizationKeys(e,t){let l=[];if(t.each(function(s,r){if(s instanceof Be){let a=s,h=a.trailingComments;if(h!=null){let u=0;for(;u<h.length;){let p=h[u];if(++u,p.isHash){let _=p.pos.offset,m=p.pos.offset+p.pos.length;for(;_>0;){let f=c.cca(e,_-1),g=f??-1;if(g==32||g==9)--_;else break}l.push({start:_,end:m})}}}let o=a.leadingComments;if(o!=null){let u=0;for(;u<o.length;){let p=o[u];if(++u,p.isHash){let _=p.pos.offset,m=p.pos.offset+p.pos.length;for(;_>0;){let f=c.cca(e,_-1),g=f??-1;if(g==32||g==9)--_;else break}l.push({start:_,end:m})}}}}}),l.length==0)return e;l.sort(function(s,r){return r.start-s.start});let i=e,n=0;for(;n<l.length;){let s=l[n];++n;let r=s.start,a=s.end,h=null;i=(r!=null?c.substr(i,0,r):c.substr(i,0,null))+(h!=null?c.substr(i,a,h):c.substr(i,a,null))}return i}static lineHasHashComment(e){let t=0;for(;t<e.length;){if(c.cca(e,t)==35){if(t+1<e.length&&c.cca(e,t+1)==35){t+=2;continue}if(t>0&&c.cca(e,t-1)==92){++t;continue}let l=t+1;for(;l<e.length;){let i=c.cca(e,l);if(i>=97&&i<=122||i>=65&&i<=90||i>=48&&i<=57||i==95||i==45)++l;else break}if(l>t+1)return!0}++t}return!1}static extractTranslations(e){let t=new Ee;return e.each(function(l,i){let n=null,s=null;if(l instanceof ll?(s=l,n=te.__cast(l,ll).content):l instanceof Kt&&(s=l,n=te.__cast(l,Kt).content),n!=null&&s!=null){let r=et.findHashComment(s,n);r!=null&&(t.h[r]=n)}}),t}static extractTranslatableEntries(e){let t=[];return e.each(function(l,i){let n=null,s=null;if(l instanceof ll)n=l,s=te.__cast(l,ll).content;else if(l instanceof Kt)n=l,s=te.__cast(l,Kt).content;else if(l instanceof St){let r=l;r.text!=null&&(n=l,s=r.text)}if(s!=null&&n!=null){let r=et.findHashComment(n,s);r!=null&&t.push({id:r,str:s})}}),t}static hasUntaggedTranslatableStrings(e){let t=!1;return e.each(function(l,i){if(t)return;let n=null,s=null;if(l instanceof ll)n=l,s=te.__cast(l,ll).content;else if(l instanceof Kt)n=l,s=te.__cast(l,Kt).content;else if(l instanceof St){let r=l;r.text!=null&&(n=l,s=r.text)}s!=null&&n!=null&&et.findHashComment(n,s)==null&&(t=!0)}),t}static collectHashIds(e,t){if(t==null&&(t=new Ee),e==null)return t;let i=new kt(e).tokenize(),n=0;for(;n<i.length;){let s=i[n];++n;let r=s.type;if(r._hx_index==53){let a=r.content;t.h[a]=!0}}return t}static generateTranslationFile(e,t,l){let i=et.extractTranslatableEntries(e),n="",s=!0;n+=`
|
|
18
|
+
`;let r=0;for(;r<i.length;){let a=i[r];++r,s||(n+=`
|
|
19
|
+
`),s=!1;let h=l.printStringLiteralAsReference(a.str),o=l.printStringLiteralAsText(a.str);n+="#",n+=Y.string(a.id),n+=" // ",n+=h==null?"null":""+h,n+=`
|
|
20
|
+
`,t!=null&&Object.prototype.hasOwnProperty.call(t.h,a.id)?n+=Y.string(l.printStringLiteralAsText(t.h[a.id])):n+=o==null?"null":""+o,n+=`
|
|
21
|
+
`}return n}static unquotedRawToQuotedRaw(e){let t="",l=0;for(;l<e.length;){let i=c.cca(e,l);if(i==92&&l+1<e.length){let n=c.cca(e,l+1);n==110||n==116||n==114||n==92||n==60?(t+=String.fromCodePoint(i),t+=String.fromCodePoint(n),l+=2):(t+=String.fromCodePoint(n),l+=2)}else i==34?(t+='\\"',++l):(t+=String.fromCodePoint(i),++l)}return t}static quotedRawToUnquotedRaw(e){let t="",l=0;for(;l<e.length;){let i=c.cca(e,l);if(i==92&&l+1<e.length){let n=c.cca(e,l+1);n==34?(t+=String.fromCodePoint(n),l+=2):(t+=String.fromCodePoint(i),t+=String.fromCodePoint(n),l+=2)}else t+=String.fromCodePoint(i),++l}return t}static canSafelyRemoveQuotes(e){if(e.length==0||e.indexOf(`
|
|
22
|
+
`)!=-1||e.indexOf("{")!=-1)return!1;let t=c.cca(e,0);if(t==40||t==91||t==123||t==125||t==93||t==58||t==61)return!1;if(e.length>=2&&t==47){let s=c.cca(e,1);if(s==47||s==42)return!1}if(e.length>=2&&t==45&&c.cca(e,1)==62||t==43&&e.length>=3&&c.cca(e,1)==32)return!1;let l=["beat ","state ","character ","choice ","import ","new ","function ","if ","else "],i=0;for(;i<l.length;){let s=l[i];if(++i,e.startsWith(s))return!1}let n=e.indexOf(":");if(n>0){let s=!0,r=0,a=n;for(;r<a;){let h=r++,o=c.cca(e,h);if(!(o>=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57||o==95)){s=!1;break}}if(s)return!1}return!(e=="null"||e=="true"||e=="false"||et.isNumberLiteral(e)||e.length>=2&&c.cca(e,1)==61&&(t==43||t==45||t==42||t==47))}static isNumberLiteral(e){if(e.length==0)return!1;let t=0;if(c.cca(e,0)==45&&++t,t>=e.length)return!1;let l=!1,i=!1;for(;t<e.length;){let n=c.cca(e,t);if(n>=48&&n<=57)l=!0;else if(n==46&&!i)i=!0;else return!1;++t}return l}static reindentCode(e,t,l){if(t==l)return e;let i=e.split(`
|
|
23
|
+
`),n="",s=0,r=i.length;for(;s<r;){let a=s++;a>0&&(n+=`
|
|
24
|
+
`);let h=i[a],o=0,u=0;for(;c.substr(h,u,null).startsWith(t);)++o,u+=t.length;let p=0,_=o;for(;p<_;){let m=p++;n+=l==null?"null":""+l}n+=Y.string(c.substr(h,u,null))}return n}static getStringEndLine(e){let t=e.pos.line,l=0,i=e.parts;for(;l<i.length;){let n=i[l];if(++l,n.pos!=null){let s=n.pos.line,r=n.partType;if(r._hx_index==0){let a=r.text,h=0;for(;h<a.length;)c.cca(a,h)==10&&++s,++h}s>t&&(t=s)}}return t}static findHashComment(e,t){if(e.trailingComments!=null){let l=0,i=e.trailingComments;for(;l<i.length;){let n=i[l];if(++l,n.isHash)return n.content}}if(e.leadingComments!=null){let l=0,i=e.leadingComments;for(;l<i.length;){let n=i[l];if(++l,n.isHash)return n.content}}if(t!=null){if(t.trailingComments!=null){let l=0,i=t.trailingComments;for(;l<i.length;){let n=i[l];if(++l,n.isHash)return n.content}}if(t.leadingComments!=null){let l=0,i=t.leadingComments;for(;l<i.length;){let n=i[l];if(++l,n.isHash)return n.content}}}return null}static randomId(e,t){let l="",i=0,n=t;for(;i<n;){let o=i++,u=c.cca(et.randomId_chars,Math.floor(36*((e.seed=e.seed*16807%2147483647)/2147483647+233e-12)));l+=String.fromCodePoint(u)}let s=l,r=!0,a=0,h=s.length;for(;a<h;){let o=a++,u=c.cca(s,o);if(!(u>=48&&u<=57||u>=97&&u<=102)){r=!1;break}}if(r){let o=Math.floor(t*((e.seed=e.seed*16807%2147483647)/2147483647+233e-12)),u=c.cca(et.randomId_nonHexChars,Math.floor(et.randomId_nonHexChars.length*((e.seed=e.seed*16807%2147483647)/2147483647+233e-12)));s=c.substr(s,0,o)+String.fromCodePoint(u)+c.substr(s,o+1,null)}return s}}Q["loreline.AstUtils"]=Xl.loreline.AstUtils=et,et.__name__="loreline.AstUtils";class oi{constructor(e){this.func=e}}Q["loreline.Async"]=Xl.loreline.Async=oi,oi.__name__="loreline.Async",Object.assign(oi.prototype,{__class__:oi});class gi{static toString(e){switch(e){case 0:return"ObjectBrace";case 1:return"ArrayBracket";case 2:return"Brace";case 3:return"Indent";case 4:return"CaseIndent";case 5:return"Bracket";case 6:return"Paren"}}}class ti{constructor(){this.indentStack=null,this.indentLevel=0,this.inControlWithoutParens=!1,this.inControl=!1,this.currentPosOffset=0,this.posOffsets=null,this.inString=!1,this.inComment=!1,this.indent=0,this.length=0,this.lineOutput=null,this.output=null,this.input=null,this.index=0}process(e){return e=He.rtrim(e)+`
|
|
25
|
+
//<END>`,this.input=e,this.index=0,this.output=new gt,this.lineOutput=new gt,this.length=e.length,this.indent=0,this.inComment=!1,this.inString=!1,this.posOffsets=[],this.currentPosOffset=0,this.inControl=!1,this.inControlWithoutParens=!1,this.indentStack=[],this.indentLevel=0,this.stack=[],this.processInput(),He.rtrim(this.output.b)+`
|
|
26
|
+
`}toLorelinePos(e,t,l){let i=this.inputPosFromProcessedPos(t),s=this.inputPosFromProcessedPos(l)+1-i;return e.withOffset(this.input,i,s,e.offset)}inputPosFromProcessedPos(e){return e<0?0:e>=this.posOffsets.length?this.input.length-1-this.posOffsets[this.input.length-1]:e-this.posOffsets[e]}processedPosFromInputPos(e){if(e<0)return 0;if(e>=this.input.length)return this.output.b.length-1;let t=0,l=0,i=this.posOffsets.length;for(;l<i;){let n=l++;if(n-this.posOffsets[n]>e)return n-1;if(n-this.posOffsets[n]==e)return n;t=n}return t}processInput(e){e==null&&(e=-1);let t=0,l=0,i=0;for(;this.index<this.length;){let n=c.cca(this.input,this.index),s=n??-1;if(s==34)this.processString();else if(s==39)this.error("Unexpected single quote");else if(s==47){let r=c.cca(this.input,this.index+1),a=r??-1;a==47||a==42?this.processComment():this._add(s,!0)}else if(s==13)this._add(s,!0);else if(s==10)this._add(s,!0);else if(s==123)++t,this._add(s,!0);else if(s==125){if(--t,s==e&&t<0)return;this._add(s,!0)}else if(s==91)++l,this._add(s,!0);else if(s==93){if(--l,s==e&&l<0)return;this._add(s,!0)}else if(s==40)++i,this._add(s,!0);else if(s==41){if(--i,s==e&&i<0)return;this._add(s,!0)}else{let r;if(this.isAlphaNumeric(s)&&this.index>0){let a=c.cca(this.input,this.index-1);r=!this.isAlphaNumeric(a??-1)}else r=!1;if(r)if(s==97){let a,h,o=c.cca(this.input,this.index+1);if((o??-1)==110){let u=c.cca(this.input,this.index+2);h=(u??-1)==100}else h=!1;if(h){let u=c.cca(this.input,this.index+3);a=!this.isAlphaNumeric(u??-1)}else a=!1;a?(this._add(38,!0),this._add(38,!0),this._add(32,!0)):this._add(s,!0)}else if(s==111){let a,h=c.cca(this.input,this.index+1);if((h??-1)==114){let o=c.cca(this.input,this.index+2);a=!this.isAlphaNumeric(o??-1)}else a=!1;a?(this._add(124,!0),this._add(124,!0),this._add(32,!0)):this._add(s,!0)}else this._add(s,!0);else this._add(s,!0)}}if(e==-1)for(;this.stack.length>0&&(this.stack[this.stack.length-1]==3||this.stack[this.stack.length-1]==4);){let n=this.stack.pop();this.indentStack.pop(),n==3&&(this.currentPosOffset++,this.output.b+=String.fromCodePoint(32),this.posOffsets.push(this.currentPosOffset),this.currentPosOffset++,this.output.b+=String.fromCodePoint(125),this.posOffsets.push(this.currentPosOffset))}}processString(){this.inString=!0,this._add(34,!0);let e=!1;for(;this.index<this.length;){let t=c.cca(this.input,this.index),l=t??-1;if(e)this._add(l,!0),e=!1;else if(l==92)e=!0,this._add(92,!0);else if(l==34){this._add(l,!0),this.inString=!1;return}else if(l==36&&!e){this.index++;let i=c.cca(this.input,this.index);l=i??-1,l==123?(this.currentPosOffset--,this._add(34,!1),this._add(43,!1),this._add(40,!0),this.inString=!1,this.processComplexInterpolation(),this.inString=!0,this._add(41,!0),this.currentPosOffset--,this._add(43,!1),this._add(34,!1),this.currentPosOffset++):l>=97&&l<=122||l>=65&&l<=90||l==95?(this.currentPosOffset--,this._add(34,!1),this._add(43,!1),this.processFieldAccessInterpolation(),this.currentPosOffset--,this._add(43,!1),this._add(34,!1),this.currentPosOffset++):l==36?this._add(36,!0):this.error("Expected identifier or { after $")}else this._add(l,!0)}this.error("Unterminated string")}processComplexInterpolation(){this.processInput(125)}processFieldAccessInterpolation(){let e=c.cca(this.input,this.index),t=e??-1;t>=97&&t<=122||t>=65&&t<=90||t==95||this.error("Expected identifier in field access"),this.processIdentifier();e:for(;this.index<this.length;){let l=c.cca(this.input,this.index);switch(l??-1){case 40:this._add(40,!0),this.processInput(41),this._add(41,!0);break;case 46:let i;if(this.index+1<this.length){let n=c.cca(this.input,this.index+1),s=n??-1;i=s>=97&&s<=122||s>=65&&s<=90||s==95}else i=!1;if(i)this._add(46,!0),this.processIdentifier();else break e;break;case 91:this._add(91,!0),this.processInput(93);break;default:break e}}}processIdentifier(){for(;this.index<this.length;){let e=c.cca(this.input,this.index),t=e??-1;if(!(t>=97&&t<=122||t>=65&&t<=90||t==95||t>=48&&t<=57))break;this._add(t,!0)}}isDigit(e){return e>=48?e<=57:!1}isIdentifierStart(e){return e>=97&&e<=122||e>=65&&e<=90?!0:e==95}isIdentifierPart(e){return e>=97&&e<=122||e>=65&&e<=90||e==95?!0:e>=48?e<=57:!1}processComment(){this.inComment=!0;let e=c.cca(this.input,this.index+1),t=e??-1;if(t==47)for(this._add(32,!0),this._add(32,!0);this.index<this.length;){let l=c.cca(this.input,this.index),i=l??-1;if(i==13||i==10)break;this._add(32,!0)}else if(t==42)for(this._add(32,!0),this._add(32,!0);this.index<this.length;){let l=c.cca(this.input,this.index),i=l??-1,n;if(i==42&&this.index+1<this.length){let s=c.cca(this.input,this.index+1);n=(s??-1)==47}else n=!1;if(n){this._add(32,!0),this._add(32,!0);break}else i==13||i==10?this._add(i,!0):this._add(32,!0)}this.inComment=!1}endsWithChar(e,t){if(e.length==0)return!1;let l=He.rtrim(e),i=l.length,n;if(i>0){let s=c.cca(l,i-1);n=(s??-1)==t}else n=!1;return n}followsWithChar(e,t){let l=t,i=!1;for(;l<this.length;){let n=c.cca(this.input,l),s=n??-1;if(s==32||s==9||s==10||s==13){++l;continue}if(s==47&&l+1<this.length){let r=c.cca(this.input,l+1),a=r??-1;if(a==47){for(l+=2;;){let h,o;if(l<this.length){let u=c.cca(this.input,l);o=(u??-1)!=13}else o=!1;if(o){let u=c.cca(this.input,l);h=(u??-1)!=10}else h=!1;if(!h)break;++l}l<this.length&&++l;continue}if(a==42){for(l+=2;l+1<this.length;){let h,o=c.cca(this.input,l);if((o??-1)==42){let u=c.cca(this.input,l+1);h=(u??-1)==47}else h=!1;if(h){l+=2;break}++l}continue}}i=s==e;break}return i}endsOrFollowsWithChar(e,t,l,i){return this.endsWithChar(e,t)?!0:this.followsWithChar(t,l)}nextLineIndentOffset(e,t){let l=He.ltrim(e);if(l.length==0)return 0;let i=e.length-l.length,n=-1;for(;t<this.length;){let s=this.input.indexOf(`
|
|
27
|
+
`,t);s==-1&&(s=this.length);let r=this.input,a=s!=null?r.substring(t,s):r.substring(t),h=He.ltrim(a);if(h.length>0&&(!h.startsWith("//")||h.startsWith("//<END>"))&&!h.startsWith("/*")){let o=a.length-h.length;return h.startsWith("//<END>")&&i==0&&n>0?n-i:o-i}h.length>0&&n==-1&&(n=a.length-h.length),t=s+1}return i==0&&n>0?n-i:0}followsWithIf(e){let t=e;for(;t<this.length;){let l=c.cca(this.input,t),i=l??-1;if(i==32||i==9||i==10||i==13){++t;continue}if(i==47&&t+1<this.length){let r=c.cca(this.input,t+1),a=r??-1;if(a==47){for(t+=2;;){let h,o;if(t<this.length){let u=c.cca(this.input,t);o=(u??-1)!=13}else o=!1;if(o){let u=c.cca(this.input,t);h=(u??-1)!=10}else h=!1;if(!h)break;++t}continue}if(a==42){for(t+=2;t+1<this.length;){let h,o=c.cca(this.input,t);if((o??-1)==42){let u=c.cca(this.input,t+1);h=(u??-1)==47}else h=!1;if(h){t+=2;break}++t}continue}}let n,s;if(t+1<this.length){let r=c.cca(this.input,t);s=(r??-1)==105}else s=!1;if(s){let r=c.cca(this.input,t+1);n=(r??-1)==102}else n=!1;if(n){let r;if(t+2<this.length){let a=c.cca(this.input,t+2);r=!this.isAlphaNumeric(a??-1)}else r=!0;if(r)return!0}return!1}return!1}endsWithControlKeyword(e,t){let l=He.rtrim(e);if(l.length==0)return!1;let i=0,n=ti.CONTROL_KEYWORDS;for(;i<n.length;){let s=n[i];if(++i,l.endsWith(s)){let r=e.length-l.length,a=l.length-s.length,h;if(a!=0){let p=c.cca(l,a-1);h=!this.isAlphaNumeric(p??-1)}else h=!0;let o=t,u;if(o<this.length)if(r<=0){let p=c.cca(this.input,o);u=!this.isAlphaNumeric(p??-1)}else u=!0;else u=!1;if(h&&u&&(s!="else"||!this.followsWithIf(t)))return!0}}return!1}endsWithArrayIndexable(e){let t=e.length;if(t==0)return!1;let l=t-1;for(;l>=0;){let s=c.cca(e,l),r=s??-1;if(!this.isWhitespace(r))break;--l}if(l<0)return!1;let i=c.cca(e,l),n=i??-1;return n==41||n==125||n==93?!0:this.isAlphaNumeric(n)}isWhitespace(e){return e==32||e==10||e==9?!0:e==13}isAlphaNumeric(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57?!0:e==95}inStatementsBlock(){let e=this.stack.length-1;return e>=0?this.stack[e]==2||this.stack[e]==3?!0:this.stack[e]==4:!0}inObjectBlock(){let e=this.stack.length-1;for(;e>=0;){if(this.stack[e]!=3&&this.stack[e]!=4)return this.stack[e]==0;--e}return!1}inArrayBlock(){let e=this.stack.length-1;for(;e>=0;){if(this.stack[e]!=3&&this.stack[e]!=4)return this.stack[e]==1;--e}return!1}isLabelStart(e){e=this.skipWhitespaceAndComments(e);let t=c.cca(this.input,e),l=t??-1;if(!(l>=97&&l<=122||l>=65&&l<=90||l==95))return!1;let i=e;for(++e;;){let h;if(e<this.length){let o=c.cca(this.input,e),u=o??-1;h=u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57}else h=!1;if(!h)break;++e}for(;;){let h;if(e<this.length){let o=c.cca(this.input,e);h=this.isWhitespace(o??-1)}else h=!1;if(!h)break;++e}let n;if(e<this.length){let h=c.cca(this.input,e);n=(h??-1)!=58}else n=!0;if(n)return!1;let s=this.input,r=e-i;return(r!=null?c.substr(s,i,r):c.substr(s,i,null))!="case"}skipWhitespaceAndComments(e){let t=e,l=!1;for(;e<this.length;){for(;;){let i;if(e<this.length){let n,s,r=c.cca(this.input,e);if((r??-1)!=32){let a=c.cca(this.input,e);s=(a??-1)==9}else s=!0;if(s)n=!0;else{let a=c.cca(this.input,e);n=(a??-1)==10}if(n)i=!0;else{let a=c.cca(this.input,e);i=(a??-1)==13}}else i=!1;if(!i)break;++e,l=!0}if(e<this.length-1){let i=c.cca(this.input,e);if((i??-1)==47){let n=c.cca(this.input,e+1);if((n??-1)==47)return e=t,e;{let s=c.cca(this.input,e+1);if((s??-1)==42){e+=2,l=!0;let r=!1;for(;e<this.length-1;){let a,h=c.cca(this.input,e);if((h??-1)==42){let o=c.cca(this.input,e+1);a=(o??-1)==47}else a=!1;if(a){e+=2,r=!0;break}++e}if(!r)return e=t,e;continue}}}}break}return l?e:t}stackPush(e){this.stack.push(e)}stackPop(){return this.stack.pop()}_add(e,t){if(t?this.index++:this.currentPosOffset++,this.inString)this.lineOutput.b+=String.fromCodePoint(e==34?e:32),this.output.b+=String.fromCodePoint(e),this.posOffsets.push(this.currentPosOffset);else if(e==13||e==10){this.inControlWithoutParens&&(this.inControlWithoutParens=!1,this.stack.pop()!=6&&this.error("Unexpected end of line"),this.currentPosOffset++,this.lineOutput.b+=String.fromCodePoint(41),this.output.b+=String.fromCodePoint(41),this.posOffsets.push(this.currentPosOffset)),this.inControl=!1;let l=this.lineOutput.b;if(this.lineOutput=new gt,this.inStatementsBlock()||this.inObjectBlock()||this.inArrayBlock()){let i=this.nextLineIndentOffset(l,this.index);if(He.trim(l).length!=0)if(i>0&&!this.endsOrFollowsWithChar(l,123,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1061,className:"loreline.CodeToLorscript",methodName:"_add"})&&!this.endsOrFollowsWithChar(l,91,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1061,className:"loreline.CodeToLorscript",methodName:"_add"})){let n=He.ltrim(l);n.startsWith("case ")||n.startsWith("case ")||n=="default"||n.startsWith("default ")||n.startsWith("default ")?(this.stack.push(4),this.indentLevel+=i,this.indentStack.push(this.indentLevel),this.currentPosOffset++,this.output.b+=String.fromCodePoint(58),this.posOffsets.push(this.currentPosOffset)):(this.stack.push(3),this.indentLevel+=i,this.indentStack.push(this.indentLevel),this.currentPosOffset++,this.output.b+=String.fromCodePoint(32),this.posOffsets.push(this.currentPosOffset),this.currentPosOffset++,this.output.b+=String.fromCodePoint(123),this.posOffsets.push(this.currentPosOffset))}else if(i<0&&this.stack.length>0&&(this.stack[this.stack.length-1]==3||this.stack[this.stack.length-1]==4)){!this.inObjectBlock()&&!this.endsOrFollowsWithChar(l,59,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1090,className:"loreline.CodeToLorscript",methodName:"_add"})&&(this.currentPosOffset++,this.output.b+=String.fromCodePoint(59),this.posOffsets.push(this.currentPosOffset)),this.indentLevel+=i;let n=!0;for(;this.indentStack.length>0&&this.indentStack[this.indentStack.length-1]>this.indentLevel&&this.stack.length>0&&(this.stack[this.stack.length-1]==3||this.stack[this.stack.length-1]==4);){let s=this.stack.pop();this.indentStack.pop(),s==3&&(n&&(n=!1,this.currentPosOffset++,this.output.b+=String.fromCodePoint(32),this.posOffsets.push(this.currentPosOffset)),this.currentPosOffset++,this.output.b+=String.fromCodePoint(125),this.posOffsets.push(this.currentPosOffset))}}else i==0&&!this.endsOrFollowsWithChar(l,59,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1115,className:"loreline.CodeToLorscript",methodName:"_add"})&&!this.endsOrFollowsWithChar(l,44,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1115,className:"loreline.CodeToLorscript",methodName:"_add"})&&(this.inObjectBlock()?(this.currentPosOffset++,this.output.b+=String.fromCodePoint(44),this.posOffsets.push(this.currentPosOffset)):this.inArrayBlock()?(this.currentPosOffset++,this.output.b+=String.fromCodePoint(44),this.posOffsets.push(this.currentPosOffset)):(this.currentPosOffset++,this.output.b+=String.fromCodePoint(59),this.posOffsets.push(this.currentPosOffset)))}this.output.b+=String.fromCodePoint(e),this.posOffsets.push(this.currentPosOffset)}else if(!this.inControl&&!this.isWhitespace(e)&&this.endsWithControlKeyword(this.lineOutput.b,this.index-1))this.inControl=!0,this.followsWithChar(40,this.index-1)?e==40&&this.stack.push(6):(this.inControlWithoutParens=!0,this.stack.push(6),this.currentPosOffset++,this.lineOutput.b+=String.fromCodePoint(e),this.output.b+=String.fromCodePoint(40),this.posOffsets.push(this.currentPosOffset)),this.lineOutput.b+=String.fromCodePoint(e),this.output.b+=String.fromCodePoint(e),this.posOffsets.push(this.currentPosOffset);else{if(e==40)this.stack.push(6);else if(e==41)this.stack.pop()!=6&&this.error("Unexpected: )");else if(e==91)this.endsWithArrayIndexable(this.lineOutput.b)?this.stack.push(5):this.stack.push(1);else if(e==93){let l=this.stack.pop();l!=5&&l!=1&&this.error("Unexpected: ]")}else if(e==123)this.isLabelStart(this.index)?this.stack.push(0):this.stack.push(2);else if(e==125){let l=this.stack.pop();l!=2&&l!=0&&this.error("Unexpected: }")}this.lineOutput.b+=String.fromCodePoint(e),this.output.b+=String.fromCodePoint(e),this.posOffsets.push(this.currentPosOffset)}}error(e){throw C.thrown(new st(e,ue.fromContentAndIndex(this.input,this.index)))}}Q["loreline.CodeToLorscript"]=ti,ti.__name__="loreline.CodeToLorscript",Object.assign(ti.prototype,{__class__:ti});class Nl{static equal(e,t,l){return t==l?!0:he.isArray(t)?he.isArray(l)?Nl.arrayEqual(e,t,l):!1:t instanceof Ee?l instanceof Ee?Nl.stringMapEqual(e,t,l):!1:t instanceof Kl?l instanceof Kl?Nl.intMapEqual(e,t,l):!1:oe.isFields(t)&&oe.isFields(l)?Nl.objectFieldsEqual(e,t,l):!1}static objectFieldsEqual(e,t,l){let i=0,n=oe.getFields(e,t);for(;i<n.length;){let a=n[i];if(++i,!oe.fieldExists(e,l,a)||!Nl.equal(e,oe.getField(e,t,a),oe.getField(e,l,a)))return!1}let s=0,r=oe.getFields(e,l);for(;s<r.length;){let a=r[s];if(++s,!oe.fieldExists(e,t,a))return!1}return!0}static arrayEqual(e,t,l){let i=he.arrayLength(t),n=he.arrayLength(l);if(i!=n)return!1;let s=0,r=i;for(;s<r;){let a=s++;if(!Nl.equal(e,he.arrayGet(t,a),he.arrayGet(l,a)))return!1}return!0}static stringMapEqual(e,t,l){let i=t.h,n=i,s=Object.keys(i),r=s.length,a=0;for(;a<r;){let m=s[a++],f=m,g=n[m],d=f,w=g;if(!Object.prototype.hasOwnProperty.call(l.h,d)||!Nl.equal(e,l.h[d],w))return!1}let h=l.h,o=h,u=Object.keys(h),p=u.length,_=0;for(;_<p;){let m=u[_++];if(!Object.prototype.hasOwnProperty.call(t.h,m))return!1}return!0}static intMapEqual(e,t,l){let i=t,n=i,s=i.keys();for(;s.hasNext();){let a=s.next(),h=n.get(a),u=a,p=h;if(!l.h.hasOwnProperty(u)||!Nl.equal(e,l.h[u],p))return!1}let r=l.keys();for(;r.hasNext();){let a=r.next();if(!t.h.hasOwnProperty(a))return!1}return!0}}Q["loreline.Equal"]=Nl,Nl.__name__="loreline.Equal";class st{constructor(e,t){this.message=e,this.pos=t,this.stack=Tn.callStack()}toString(){return this.pos!=null?""+this.message+" at "+this.pos.toString():this.message}}Q["loreline.Error"]=st,st.__name__="loreline.Error",Object.assign(st.prototype,{__class__:st});class Ml{}Q["loreline.Fields"]=Xl.loreline.Fields=Ml,Ml.__name__="loreline.Fields",Ml.__isInterface__=!0,Object.assign(Ml.prototype,{__class__:Ml});class qi{constructor(e){this._random=null,this.interpreter=e}bindAll(e){e.h.floor=be(this,this.floor),e.h.ceil=be(this,this.ceil),e.h.round=be(this,this.round),e.h.abs=be(this,this.abs),e.h.min=be(this,this.min),e.h.max=be(this,this.max),e.h.clamp=be(this,this.clamp),e.h.pow=be(this,this.pow),e.h.random=be(this,this.random),e.h.chance=be(this,this.chance),e.h.seed_random=be(this,this.seed_random),e.h.random_float=be(this,this.random_float),e.h.wait=be(this,this.wait),e.h.float=be(this,this.float_),e.h.string=be(this,this.string_),e.h.bool=be(this,this.bool),e.h.string_length=be(this,this.string_length),e.h.string_upper=be(this,this.string_upper),e.h.string_lower=be(this,this.string_lower),e.h.string_contains=be(this,this.string_contains),e.h.string_replace=be(this,this.string_replace),e.h.string_split=be(this,this.string_split),e.h.string_trim=be(this,this.string_trim),e.h.string_index=be(this,this.string_index),e.h.string_sub=be(this,this.string_sub),e.h.string_starts=be(this,this.string_starts),e.h.string_ends=be(this,this.string_ends),e.h.string_repeat=be(this,this.string_repeat),e.h.plural=be(this,this.plural),e.h.array_length=be(this,this.array_length),e.h.array_add=be(this,this.array_add),e.h.array_pop=be(this,this.array_pop),e.h.array_prepend=be(this,this.array_prepend),e.h.array_shift=be(this,this.array_shift),e.h.array_remove=be(this,this.array_remove),e.h.array_index=be(this,this.array_index),e.h.array_has=be(this,this.array_has),e.h.array_sort=be(this,this.array_sort),e.h.array_reverse=be(this,this.array_reverse),e.h.array_join=be(this,this.array_join),e.h.array_pick=be(this,this.array_pick),e.h.array_shuffle=be(this,this.array_shuffle),e.h.array_copy=be(this,this.array_copy),e.h.map_length=be(this,this.map_length),e.h.map_keys=be(this,this.map_keys),e.h.map_has=be(this,this.map_has),e.h.map_get=be(this,this.map_get),e.h.map_set=be(this,this.map_set),e.h.map_remove=be(this,this.map_remove),e.h.map_copy=be(this,this.map_copy),e.h.current_beat=be(this,this.current_beat),e.h.has_beat=be(this,this.has_beat),e.h.beat_visits=be(this,this.beat_visits),e.h.choices=be(this,this.choices),e.h.choices_disabled=be(this,this.choices_disabled),e.h.choices_all=be(this,this.choices_all)}rng(){this._random==null&&(this._random=new wi);let e=this._random;return(e.seed=e.seed*16807%2147483647)/2147483647+233e-12}floor(e){return Math.floor(e)}ceil(e){return Math.ceil(e)}round(e){return Math.round(e)}abs(e){return Math.abs(e)}min(e,t){return Math.min(e,t)}max(e,t){return Math.max(e,t)}clamp(e,t,l){return Math.max(t,Math.min(l,e))}pow(e,t){return Math.pow(e,t)}random(e,t){return Math.floor(e+this.rng()*(t+1-e))}chance(e){return Math.floor(this.rng()*e)==0}seed_random(e){return this._random=new wi(e),null}random_float(e,t){return e+this.rng()*(t-e)}wait(e){return new oi(function(t){fi.delay(t,e*1e3|0)})}float_(e){return typeof e=="number"?e:typeof e=="number"&&(e|0)===e?e*1:typeof e=="string"?parseFloat(e):typeof e=="boolean"&&e?1:0}string_(e){return e==null?"null":typeof e=="string"?e:e==null?"null":Y.string(e)}bool(e){return typeof e=="boolean"?e:typeof e=="string"?e.length>0:he.isArray(e)?he.arrayLength(e)>0:typeof e=="number"&&(e|0)===e||typeof e=="number"?e!=0:e!=null}string_length(e){return e.length}string_upper(e){return e.toUpperCase()}string_lower(e){return e.toLowerCase()}string_contains(e,t){return e.includes(t)}string_replace(e,t,l){return He.replace(e,t,l)}string_split(e,t){return e.split(t)}string_trim(e){return He.trim(e)}string_index(e,t){return e.indexOf(t)}string_sub(e,t,l){return c.substr(e,t|0,l|0)}string_starts(e,t){return e.startsWith(t)}string_ends(e,t){return e.endsWith(t)}string_repeat(e,t){let l="",i=0;for(;i<t;)l+=e==null?"null":""+e,++i;return l}plural(e,t,l){let i=0;return typeof e=="number"&&(e|0)===e?i=e*1:typeof e=="number"&&(i=e),i==1?t:l}array_length(e){return he.isArray(e)?he.arrayLength(e):0}array_add(e,t){return he.arrayPush(e,t),null}array_pop(e){return he.isArray(e)?he.arrayPop(e):null}array_prepend(e,t){return he.isArray(e)&&he.arrayInsert(e,0,t),null}array_shift(e){return he.isArray(e)?he.arrayShift(e):null}array_remove(e,t){if(he.isArray(e)){let l=he.arrayLength(e),i=0,n=l;for(;i<n;){let s=i++;if(he.arrayGet(e,s)==t)return he.arrayRemoveAt(e,s),!0}}return!1}array_index(e,t){if(he.isArray(e)){let l=he.arrayLength(e),i=0,n=l;for(;i<n;){let s=i++;if(he.arrayGet(e,s)==t)return s}}return-1}array_has(e,t){if(he.isArray(e)){let l=he.arrayLength(e),i=0,n=l;for(;i<n;){let s=i++;if(he.arrayGet(e,s)==t)return!0}}return!1}array_sort(e){return he.isArray(e)&&he.arraySort(e,function(t,l){return typeof t=="number"&&typeof l=="number"||typeof t=="number"&&(t|0)===t&&typeof l=="number"&&(l|0)===l?t<l?-1:t>l?1:0:(t==null?"null":Y.string(t))<(l==null?"null":Y.string(l))?-1:(t==null?"null":Y.string(t))>(l==null?"null":Y.string(l))?1:0}),e}array_reverse(e){return he.isArray(e)&&he.arrayReverse(e),e}array_join(e,t){return he.isArray(e)?he.arrayJoin(e,t):""}array_pick(e){if(he.isArray(e)){let t=he.arrayLength(e);if(t==0)return null;let l=Math.floor(this.rng()*t);return he.arrayGet(e,l)}return null}array_shuffle(e){if(he.isArray(e)){let t=he.arrayLength(e)-1;for(;t>0;){let l=Math.floor(this.rng()*(t+1)),i=he.arrayGet(e,t);he.arraySet(e,t,he.arrayGet(e,l)),he.arraySet(e,l,i),--t}}return e}array_copy(e){return he.isArray(e)?he.arrayCopy(e):e}map_length(e){return oe.getFields(this.interpreter,e).length}map_keys(e){let t=oe.getFields(this.interpreter,e);return t.sort(function(l,i){return l<i?-1:l>i?1:0}),t}map_has(e,t){return oe.fieldExists(this.interpreter,e,t)}map_get(e,t){return oe.getField(this.interpreter,e,t)}map_set(e,t,l){return oe.setField(this.interpreter,e,t,l),null}map_remove(e,t){return oe.fieldExists(this.interpreter,e,t)?oe.removeField(this.interpreter,e,t):!1}map_copy(e){let t=oe.getFields(this.interpreter,e),l=oe.createFields(this.interpreter),i=0;for(;i<t.length;){let n=t[i];++i,oe.setField(this.interpreter,l,n,oe.getField(this.interpreter,e,n))}return l}current_beat(){let e=this.interpreter.stack.length-1;for(;e>=0;){let t=this.interpreter.stack[e];if(t.beat!=null)return t.beat;--e}return null}has_beat(e){if(e instanceof Me)return!0;let t=e,l=this.interpreter.stack.length-1;for(;l>=0;){let i=this.interpreter.stack[l];if(i.beat!=null&&i.beat.body!=null){let n=0,s=i.beat.body;for(;n<s.length;){let r=s[n];if(++n,r instanceof Me&&r.name==t)return!0}}--l}return Object.prototype.hasOwnProperty.call(this.interpreter.topLevelBeats.h,t)}beat_visits(e){if(e==null){let t=this.interpreter.stack.length-1;for(;t>=0;){let l=this.interpreter.stack[t];if(l.beat!=null)return this.interpreter.getBeatVisitCount(l.beat);--t}return 0}else{if(e instanceof Me)return this.interpreter.getBeatVisitCount(e);{let t=this.interpreter.resolveBeatByName(e);return t==null?0:this.interpreter.getBeatVisitCount(t)}}}choices(){let e=this.interpreter._choiceEvalTexts,t=this.interpreter._choiceEvalEnabled,l=[],i=0,n=e.length;for(;i<n;){let s=i++;t[s]&&l.push(e[s])}return l}choices_disabled(){let e=this.interpreter._choiceEvalTexts,t=this.interpreter._choiceEvalEnabled,l=[],i=0,n=e.length;for(;i<n;){let s=i++;t[s]||l.push(e[s])}return l}choices_all(){let e=this.interpreter._choiceEvalTexts,t=[],l=0,i=e.length;for(;l<i;){let n=l++;t.push(e[n])}return t}}Q["loreline.Functions"]=qi,qi.__name__="loreline.Functions",Object.assign(qi.prototype,{__class__:qi});class Wi{constructor(e){this.finished=e}}Q["loreline._Imports.ImportsLoopInfo"]=Wi,Wi.__name__="loreline._Imports.ImportsLoopInfo",Object.assign(Wi.prototype,{__class__:Wi});class zi{constructor(){this.ext=".lor",this.pendingImports=0,this.hasErrors=!1,this.done=null,this.resolvedImports=null,this.autoAddExtension=!0}resolve(e,t,l,i,n){this.rootPath=e,this.tokens=t,this.handleFile=l,this.handleError=i,this.done=n,this.hasErrors=!1,this.pendingImports=0;let s;if(e==null)s=!1;else{let u=e.length;if(u<8)s=!1;else{let p,_,m,f,g,d,w=c.cca(e,u-8);if((w??-1)==46){let y=c.cca(e,u-7),S=y??-1;d=S==108||S==76}else d=!1;if(d){let y=c.cca(e,u-6),S=y??-1;g=S==111||S==79}else g=!1;if(g){let y=c.cca(e,u-5),S=y??-1;f=S==114||S==82}else f=!1;if(f){let y=c.cca(e,u-4);m=(y??-1)==46}else m=!1;if(m){let y=c.cca(e,u-3),S=y??-1;_=S==116||S==84}else _=!1;if(_){let y=c.cca(e,u-2),S=y??-1;p=S==120||S==88}else p=!1;if(p){let y=c.cca(e,u-1),S=y??-1;s=S==116||S==84}else s=!1}}this.ext=s?".lor.txt":".lor";let r=new Ee,a=[],h=new Ee,o=De.directory(e);this.extractImports(o,t,a,h),this.processImports(a,h,r)}processImports(e,t,l){let i=new Wi(!1);for(;e.length>0;){let n=e.shift();this.handleItemInLoop(n,i,e,t,l)}i.finished=!0,this.pendingImports==0&&this.done!=null&&(this.resolvedImports=l,this.done(this.hasErrors,l),this.done=null)}handleItemInLoop(e,t,l,i,n){let s=this;this.handleFile(e,function(r){if(s.pendingImports--,r!=null)try{let a=new kt(r),h=a.tokenize(),o=a.getErrors();o!=null&&o.length>0&&s.handleError(o[0]),n.h[e]=h,s.extractImports(De.directory(e),h,l,i),t.finished&&s.processImports(l,i,n)}catch(a){let h=C.caught(a).unwrap();if(s.hasErrors=!0,h instanceof st)s.handleError(h);else throw C.thrown(h)}else s.hasErrors=!0;t.finished&&s.pendingImports==0&&s.done!=null&&(s.resolvedImports=n,s.done(s.hasErrors,n),s.done=null)})}extractImports(e,t,l,i){let n=0,s=t.length;for(;n<s-1;){if(t[n].type==k.KwImport){let r=t[n+1].type;if(r._hx_index==15){let a=r.quotes,h=r.attachments,o=r.s,u=o;De.isAbsolute(o)||(u=De.join([e,u])),u=De.normalize(u);let p,_;if(u==null)_=!1;else{let m=u.length;if(m<8)_=!1;else{let f,g,d,w,y,S,T=c.cca(u,m-8);if((T??-1)==46){let O=c.cca(u,m-7),E=O??-1;S=E==108||E==76}else S=!1;if(S){let O=c.cca(u,m-6),E=O??-1;y=E==111||E==79}else y=!1;if(y){let O=c.cca(u,m-5),E=O??-1;w=E==114||E==82}else w=!1;if(w){let O=c.cca(u,m-4);d=(O??-1)==46}else d=!1;if(d){let O=c.cca(u,m-3),E=O??-1;g=E==116||E==84}else g=!1;if(g){let O=c.cca(u,m-2),E=O??-1;f=E==120||E==88}else f=!1;if(f){let O=c.cca(u,m-1),E=O??-1;_=E==116||E==84}else _=!1}}if(_)p=!0;else if(u==null)p=!1;else{let m=u.length;if(m<4)p=!1;else{let f,g,d=c.cca(u,m-4);if((d??-1)==46){let w=c.cca(u,m-3),y=w??-1;g=y==108||y==76}else g=!1;if(g){let w=c.cca(u,m-2),y=w??-1;f=y==111||y==79}else f=!1;if(f){let w=c.cca(u,m-1),y=w??-1;p=y==114||y==82}else p=!1}}p||(u+=this.ext),Object.prototype.hasOwnProperty.call(i.h,u)||(this.pendingImports++,i.h[u]=!0,l.push(u))}}++n}}static sameLetterCi(e,t){return e!=t?e==t-32:!0}static endsWithLorTxt(e){if(e==null)return!1;let t=e.length;if(t<8)return!1;let l,i,n,s,r,a,h=c.cca(e,t-8);if((h??-1)==46){let o=c.cca(e,t-7),u=o??-1;a=u==108||u==76}else a=!1;if(a){let o=c.cca(e,t-6),u=o??-1;r=u==111||u==79}else r=!1;if(r){let o=c.cca(e,t-5),u=o??-1;s=u==114||u==82}else s=!1;if(s){let o=c.cca(e,t-4);n=(o??-1)==46}else n=!1;if(n){let o=c.cca(e,t-3),u=o??-1;i=u==116||u==84}else i=!1;if(i){let o=c.cca(e,t-2),u=o??-1;l=u==120||u==88}else l=!1;if(l){let o=c.cca(e,t-1),u=o??-1;return u!=116?u==84:!0}else return!1}static endsWithLor(e){if(e==null)return!1;let t=e.length;if(t<4)return!1;let l,i,n=c.cca(e,t-4);if((n??-1)==46){let s=c.cca(e,t-3),r=s??-1;i=r==108||r==76}else i=!1;if(i){let s=c.cca(e,t-2),r=s??-1;l=r==111||r==79}else l=!1;if(l){let s=c.cca(e,t-1),r=s??-1;return r!=114?r==82:!0}else return!1}static lorExtension(e){let t;if(e==null)t=!1;else{let l=e.length;if(l<8)t=!1;else{let i,n,s,r,a,h,o=c.cca(e,l-8);if((o??-1)==46){let u=c.cca(e,l-7),p=u??-1;h=p==108||p==76}else h=!1;if(h){let u=c.cca(e,l-6),p=u??-1;a=p==111||p==79}else a=!1;if(a){let u=c.cca(e,l-5),p=u??-1;r=p==114||p==82}else r=!1;if(r){let u=c.cca(e,l-4);s=(u??-1)==46}else s=!1;if(s){let u=c.cca(e,l-3),p=u??-1;n=p==116||p==84}else n=!1;if(n){let u=c.cca(e,l-2),p=u??-1;i=p==120||p==88}else i=!1;if(i){let u=c.cca(e,l-1),p=u??-1;t=p==116||p==84}else t=!1}}return t?".lor.txt":".lor"}static isLorFilePath(e){let t;if(e==null)t=!1;else{let l=e.length;if(l<8)t=!1;else{let i,n,s,r,a,h,o=c.cca(e,l-8);if((o??-1)==46){let u=c.cca(e,l-7),p=u??-1;h=p==108||p==76}else h=!1;if(h){let u=c.cca(e,l-6),p=u??-1;a=p==111||p==79}else a=!1;if(a){let u=c.cca(e,l-5),p=u??-1;r=p==114||p==82}else r=!1;if(r){let u=c.cca(e,l-4);s=(u??-1)==46}else s=!1;if(s){let u=c.cca(e,l-3),p=u??-1;n=p==116||p==84}else n=!1;if(n){let u=c.cca(e,l-2),p=u??-1;i=p==120||p==88}else i=!1;if(i){let u=c.cca(e,l-1),p=u??-1;t=p==116||p==84}else t=!1}}if(t)return!0;if(e==null)return!1;{let l=e.length;if(l<4)return!1;{let i,n,s=c.cca(e,l-4);if((s??-1)==46){let r=c.cca(e,l-3),a=r??-1;n=a==108||a==76}else n=!1;if(n){let r=c.cca(e,l-2),a=r??-1;i=a==111||a==79}else i=!1;if(i){let r=c.cca(e,l-1),a=r??-1;return a!=114?a==82:!0}else return!1}}}static stripLorExtension(e){if(e==null)return null;let t;if(e==null)t=!1;else{let i=e.length;if(i<8)t=!1;else{let n,s,r,a,h,o,u=c.cca(e,i-8);if((u??-1)==46){let p=c.cca(e,i-7),_=p??-1;o=_==108||_==76}else o=!1;if(o){let p=c.cca(e,i-6),_=p??-1;h=_==111||_==79}else h=!1;if(h){let p=c.cca(e,i-5),_=p??-1;a=_==114||_==82}else a=!1;if(a){let p=c.cca(e,i-4);r=(p??-1)==46}else r=!1;if(r){let p=c.cca(e,i-3),_=p??-1;s=_==116||_==84}else s=!1;if(s){let p=c.cca(e,i-2),_=p??-1;n=_==120||_==88}else n=!1;if(n){let p=c.cca(e,i-1),_=p??-1;t=_==116||_==84}else t=!1}}if(t){let i=e.length-8;return i!=null?c.substr(e,0,i):c.substr(e,0,null)}let l;if(e==null)l=!1;else{let i=e.length;if(i<4)l=!1;else{let n,s,r=c.cca(e,i-4);if((r??-1)==46){let a=c.cca(e,i-3),h=a??-1;s=h==108||h==76}else s=!1;if(s){let a=c.cca(e,i-2),h=a??-1;n=h==111||h==79}else n=!1;if(n){let a=c.cca(e,i-1),h=a??-1;l=h==114||h==82}else l=!1}}if(l){let i=e.length-4;return i!=null?c.substr(e,0,i):c.substr(e,0,null)}return e}}Q["loreline.Imports"]=zi,zi.__name__="loreline.Imports",Object.assign(zi.prototype,{__class__:zi});class El{constructor(){this.mask=0,this.size=0,this._values=null,this._keys2=null,this._keys1=null;let e=this._keys1,t=this._keys2,l=this._values;if(this._keys1=new Array(16),this._keys2=new Array(16),this._values=new Array(16),this.mask=15,e!=null){this.size=0;let i=0,n=e.length;for(;i<n;){let s=i++;l[s]!=null&&this._set(e[s],t[s],l[s])}}}resize(e){let t=this._keys1,l=this._keys2,i=this._values;if(this._keys1=new Array(e),this._keys2=new Array(e),this._values=new Array(e),this.mask=e-1,t!=null){this.size=0;let n=0,s=t.length;for(;n<s;){let r=n++;i[r]!=null&&this._set(t[r],l[r],i[r])}}}hashCoords(e,t){let l=e+(t<<16);return l=(l^l>>>16)*-2048144789,l=(l^l>>>13)*-1028477387,l^l>>>16}clear(){this._keys1=null,this._keys2=null,this._values=null;let e=this._keys1,t=this._keys2,l=this._values;if(this._keys1=new Array(16),this._keys2=new Array(16),this._values=new Array(16),this.mask=15,e!=null){this.size=0;let i=0,n=e.length;for(;i<n;){let s=i++;l[s]!=null&&this._set(e[s],t[s],l[s])}}this.size=0}copy(){let e=new El,t=this._keys1,l=new Array(t.length);pn.blit(t,0,l,0,t.length),e._keys1=l;let i=this._keys2,n=new Array(i.length);pn.blit(i,0,n,0,i.length),e._keys2=n;let s=this._values,r=new Array(s.length);return pn.blit(s,0,r,0,s.length),e._values=r,e.size=this.size,e.mask=this.mask,e}_set(e,t,l){if(this.size>=(this.mask+1)*.75){let r=this.mask+1<<1,a=this._keys1,h=this._keys2,o=this._values;if(this._keys1=new Array(r),this._keys2=new Array(r),this._values=new Array(r),this.mask=r-1,a!=null){this.size=0;let u=0,p=a.length;for(;u<p;){let _=u++;o[_]!=null&&this._set(a[_],h[_],o[_])}}}let i=e+(t<<16);i=(i^i>>>16)*-2048144789,i=(i^i>>>13)*-1028477387;let s=(i^i>>>16)&this.mask;for(;;){if(this._values[s]==null){this._keys1[s]=e,this._keys2[s]=t,this._values[s]=l,this.size++;return}if(this._keys1[s]==e&&this._keys2[s]==t){this._values[s]=l;return}s=s+1&this.mask}}_get(e,t){let l=e+(t<<16);l=(l^l>>>16)*-2048144789,l=(l^l>>>13)*-1028477387;let n=(l^l>>>16)&this.mask;for(;;){if(this._values[n]==null)return null;if(this._keys1[n]==e&&this._keys2[n]==t)return this._values[n];n=n+1&this.mask}}_exists(e,t){let l=e+(t<<16);l=(l^l>>>16)*-2048144789,l=(l^l>>>13)*-1028477387;let n=(l^l>>>16)&this.mask;for(;;){if(this._values[n]==null)return!1;if(this._keys1[n]==e&&this._keys2[n]==t)return!0;n=n+1&this.mask}}_remove(e,t){let l=e+(t<<16);l=(l^l>>>16)*-2048144789,l=(l^l>>>13)*-1028477387;let n=(l^l>>>16)&this.mask;for(;;){if(this._values[n]==null)return!1;if(this._keys1[n]==e&&this._keys2[n]==t){for(this._values[n]=null,this.size--,n=n+1&this.mask;this._values[n]!=null;){let s=this._keys1[n],r=this._keys2[n],a=this._values[n];this._values[n]=null,this.size--,this._set(s,r,a),n=n+1&this.mask}return!0}n=n+1&this.mask}}iterator(){return new ji(this)}keyIterator(){return new Ki(this)}keyValueIterator(){return new Ji(this)}length(){return this.size}}Q["loreline.Int64Map"]=El,El.__name__="loreline.Int64Map",Object.assign(El.prototype,{__class__:El});class ji{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._values[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return e}}Q["loreline._Int64Map.Int64MapIterator"]=ji,ji.__name__="loreline._Int64Map.Int64MapIterator",Object.assign(ji.prototype,{__class__:ji});class Ki{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._keys1[this.index],t=this.map._keys2[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return{high:e,low:t}}}Q["loreline._Int64Map.Int64MapKeyIterator"]=Ki,Ki.__name__="loreline._Int64Map.Int64MapKeyIterator",Object.assign(Ki.prototype,{__class__:Ki});class Ji{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._keys1[this.index],t=this.map._keys2[this.index],l=this.map._values[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return{key:{high:e,low:t},value:l}}}Q["loreline._Int64Map.Int64MapKeyValueIterator"]=Ji,Ji.__name__="loreline._Int64Map.Int64MapKeyValueIterator",Object.assign(Ji.prototype,{__class__:Ji});class Fl{constructor(e,t,l,i){this.scope=-1,l!=null?this.fields=l:this.clear(e,t),i!=null?this.originalFields=i:this.createOriginalFields()}clear(e,t){this.fields=oe.createFields(e,null,t)}createOriginalFields(){this.originalFields=oe.createFields()}}Q["loreline.RuntimeState"]=Fl,Fl.__name__="loreline.RuntimeState",Object.assign(Fl.prototype,{__class__:Fl});class di extends Fl{constructor(e,t,l,i){super(e,t,l,i)}}Q["loreline.RuntimeCharacter"]=di,di.__name__="loreline.RuntimeCharacter",di.__super__=Fl,Object.assign(di.prototype,{__class__:di});var fl=Ye["loreline.RuntimeAccess"]={__ename__:"loreline.RuntimeAccess",__constructs__:null,FieldAccess:(x=function(b,e,t){return{_hx_index:0,pos:b,obj:e,name:t,__enum__:"loreline.RuntimeAccess",toString:F}},x._hx_name="FieldAccess",x.__params__=["pos","obj","name"],x),ArrayAccess:(x=function(b,e,t){return{_hx_index:1,pos:b,array:e,index:t,__enum__:"loreline.RuntimeAccess",toString:F}},x._hx_name="ArrayAccess",x.__params__=["pos","array","index"],x),CharacterAccess:(x=function(b,e){return{_hx_index:2,pos:b,name:e,__enum__:"loreline.RuntimeAccess",toString:F}},x._hx_name="CharacterAccess",x.__params__=["pos","name"],x),FunctionAccess:(x=function(b,e){return{_hx_index:3,pos:b,name:e,__enum__:"loreline.RuntimeAccess",toString:F}},x._hx_name="FunctionAccess",x.__params__=["pos","name"],x),BeatAccess:(x=function(b,e){return{_hx_index:4,pos:b,beat:e,__enum__:"loreline.RuntimeAccess",toString:F}},x._hx_name="BeatAccess",x.__params__=["pos","beat"],x)};fl.__constructs__=[fl.FieldAccess,fl.ArrayAccess,fl.CharacterAccess,fl.FunctionAccess,fl.BeatAccess];class xi{constructor(e,t,l,i,n,s,r){this.insertion=null,this.head=null,this.state=null,this.beats=null,this.id=-1,e!=null&&(this.id=e),this.beat=t,this.node=l,i!=null&&(this.beats=i),n!=null&&(this.state=n),s!=null&&(this.head=s),r!=null&&(this.insertion=r)}beatByName(e){if(this.beats==null)return null;let t=0,l=this.beats.length;for(;t<l;){let i=t++,n=this.beats[i];if(n.name==e)return n}return null}}Q["loreline.RuntimeScope"]=xi,xi.__name__="loreline.RuntimeScope",Object.assign(xi.prototype,{__class__:xi});class Si{constructor(e,t){this.parentNextOptionIndex=0,this.parentPartialOptions=null,this.stack=[],this.options=null,this.id=e,this.origin=t}}Q["loreline.RuntimeInsertion"]=Si,Si.__name__="loreline.RuntimeInsertion",Object.assign(Si.prototype,{__class__:Si});class vi{constructor(e,t,l){this.closing=e,this.value=t,this.offset=l}}Q["loreline.TextTag"]=vi,vi.__name__="loreline.TextTag",Object.assign(vi.prototype,{__class__:vi});class Oi{constructor(e,t,l,i,n){this.text=e,this.tags=t,this.enabled=l,this.node=i,this.insertion=n}}Q["loreline.ChoiceOption"]=Oi,Oi.__name__="loreline.ChoiceOption",Object.assign(Oi.prototype,{__class__:Oi});class ge extends st{constructor(e,t){super(e,t)}}Q["loreline.RuntimeError"]=ge,ge.__name__="loreline.RuntimeError",ge.__super__=st,Object.assign(ge.prototype,{__class__:ge});class Hi{constructor(){this.cb=null,this.sync=!0}}Q["loreline.EvalNext"]=Hi,Hi.__name__="loreline.EvalNext",Object.assign(Hi.prototype,{__class__:Hi});class Pi{constructor(e,t,l,i,n){this._choiceEvalEnabled=[],this._choiceEvalTexts=[],this.pendingChoiceOptions=null,this.beatToResume=null,this.finishTrigger=null,this.flushing=!1,this.syncCallbacks=[],this.nextInsertionId=1,this.nextScopeId=1,this.stack=[],this.stringLiteralProcessors=[],this.beatHelpers=new Ee,this.mapHelpers=new Ee,this.arrayHelpers=new Ee,this.stringHelpers=new Ee,this.topLevelFunctions=new Ee,this.nodeStates=new li,this.topLevelBeats=new Ee,this.topLevelCharacters=new Ee,this.script=e,this.handleDialogue=t,this.handleChoice=l,this.handleFinish=i,this.lens=new Ii(e);let s=n!=null?n.strictAccess:null;this.strictAccess=s!=null&&s,this.translations=n!=null?n.translations:null,this.topLevelState=new Fl(this,e,null,null),this.initializeTopLevelFunctions(n!=null?n.functions:null),this.initializeStringLiteralProcessors(n!=null?n.stringLiteralProcessors:null);let r=e.iterator();for(;r.hasNext();){let a=r.next();switch(te.getClass(a)){case Me:this.initializeTopLevelBeat(a);break;case jt:this.initializeTopLevelCharacter(a);break;case ql:this.initializeTopLevelFunction(a);break;case $t:this.initializeTopLevelState(a);break;default:}}this.inferImplicitCharactersFromRootBeat()}get_currentScope(){return this.stack.length>0?this.stack[this.stack.length-1]:null}get_currentInsertion(){let e=this.stack.length-1;for(;e>=0;){let t=this.stack[e];if(t.insertion!=null)return t.insertion;--e}return null}removeCurrentInsertion(){let e=this.stack.length-1;for(;e>=0;){let t=this.stack[e];if(t.insertion!=null){t.insertion=null;break}--e}}inferImplicitCharactersFromRootBeat(){let e=0,t=this.lens.getNodesOfType(Me);for(;e<t.length;){let l=t[e];if(++e,l.name!="_")continue;let i=0,n=this.lens.getDialogueSpeakers(l);for(;i<n.length;){let s=n[i];++i,!Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,s)&&(oe.fieldExists(this,this.topLevelState.fields,s)||this.initializeTopLevelCharacter(new jt(Ae.UNDEFINED,l.pos,s,l.pos,[])))}}}start(e){let t=null;if(e!=null){if(t=this.topLevelBeats.h[e],t==null)throw C.thrown(new ge("Beat "+e+" not found",this.script.pos))}else{let l=0,i=this.script.body;for(;l<i.length;){let n=i[l];if(++l,n instanceof Me){let s=n;if(s.name=="_"){t=s;break}t==null&&(t=s)}}if(t==null){let n=this.script.iterator();for(;n.hasNext();){let s=n.next();if(s instanceof Me){let r=s;if(r.name=="_"){t=r;break}t==null&&(t=r)}}}if(t==null)throw C.thrown(new ge("No beats found in script",this.script.pos))}this.transitionToBeat(t),this.flush()}save(){let e={},t=[],l=0,i=this.stack;for(;l<i.length;){let s=i[l];++l,t.push(this.serializeScope(s,e))}let n={version:1,stack:t,state:this.serializeState(this.topLevelState),characters:this.serializeCharacters(),nodeStates:this.serializeNodeStates()};if(this.pendingChoiceOptions!=null){let s=[],r=0,a=this.pendingChoiceOptions;for(;r<a.length;){let h=a[r];++r,s.push(this.serializeChoiceOption(h,e))}n.pendingChoiceOptions=s}if(this._choiceEvalTexts.length>0){let s=[],r=0,a=this._choiceEvalTexts.length;for(;r<a;){let h=r++,o={text:this._choiceEvalTexts[h]};this._choiceEvalEnabled[h]||(o.disabled=!0),s.push(o)}n.choiceEvalContext=s}return qe.fields(e).length>0&&(n.insertions=e),n}restore(e){if(e.version!=1)throw C.thrown(new ge("Unsupported save version: "+e.version,this.script.pos));this.stack.length=0,this.nodeStates.map.clear(),this.nextScopeId=1,this.nextInsertionId=1,this.pendingChoiceOptions=null,this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0,this.restoreState(this.topLevelState,e.state),this.restoreCharacters(e.characters),this.restoreNodeStates(e.nodeStates);let t=new Kl;if(this.restoreStack(e.stack,e.insertions,t)||(this.beatToResume=this.restoreBeatToResume(e.stack)),e.pendingChoiceOptions!=null){this.pendingChoiceOptions=[];let l=0,i=e.pendingChoiceOptions;for(;l<i.length;){let n=i[l];++l;let s=this.restoreChoiceOption(n,e.insertions,t);s!=null&&this.pendingChoiceOptions.push(s)}}if(e.choiceEvalContext!=null){this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let l=0,i=e.choiceEvalContext;for(;l<i.length;){let n=i[l];++l,this._choiceEvalTexts.push(n.text),this._choiceEvalEnabled.push(n.disabled!=!0)}}}resume(){if(this.stack.length==0){this.start();return}let e=this.wrapNext(be(this,this.finish));this.finishTrigger=e,this.resumeNode(this.stack[0].node,0,e.cb),e.sync=!1,this.flush()}resumeFromLevel(e,t){let l=this.wrapNext(t);this.resumeNode(this.stack[e].node,e,l.cb),l.sync=!1}getCharacter(e){let t=this.topLevelCharacters.h[e];return t!=null?t.fields:null}getCharacterField(e,t){let l=this.topLevelCharacters.h[e],i=l!=null?l.fields:null;return i!=null?oe.getField(this,i,t):null}setCharacterField(e,t,l){let i=this.topLevelCharacters.h[e].fields;oe.setField(this,i,t,l)}getStateField(e){let t=this.stack.length-1;for(;t>=0;){let l=this.stack[t];if(l.state!=null&&oe.fieldExists(this,l.state.fields,e))return oe.getField(this,l.state.fields,e);if(l.node!=null){let i=l.node.id.thisVal,n=this.nodeStates.map._get(i.high,i.low);if(n!=null&&oe.fieldExists(this,n.fields,e))return oe.getField(this,n.fields,e)}--t}return oe.fieldExists(this,this.topLevelState.fields,e)?oe.getField(this,this.topLevelState.fields,e):null}setStateField(e,t){let l=this.stack.length-1;for(;l>=0;){let i=this.stack[l];if(i.state!=null&&oe.fieldExists(this,i.state.fields,e)){oe.setField(this,i.state.fields,e,t);return}if(i.node!=null){let n=i.node.id.thisVal,s=this.nodeStates.map._get(n.high,n.low);if(s!=null&&oe.fieldExists(this,s.fields,e)){oe.setField(this,s.fields,e,t);return}}--l}oe.setField(this,this.topLevelState.fields,e,t)}getTopLevelStateField(e){return oe.getField(this,this.topLevelState.fields,e)}setTopLevelStateField(e,t){oe.setField(this,this.topLevelState.fields,e,t)}currentNode(){let e=this.get_currentScope();return e==null?null:e.head!=null?e.head:e.node}currentNodeFilePath(e){let t=this.currentNode();return t==null||e==null?e:this.lens.getNodeFilePath(t,e)}serializeScope(e,t){let l={id:e.id};if(e.beat!=null&&(l.beat=this.serializeBeatReference(e.beat)),e.node!=null&&(l.node=this.serializeNodeReference(e.node)),e.state!=null&&(l.state=this.serializeState(e.state)),e.beats!=null){let i=[],n=0,s=e.beats;for(;n<s.length;){let r=s[n];++n,i.push(this.serializeBeatReference(r))}l.beats=i}return e.head!=null&&(l.head=this.serializeNodeReference(e.head)),e.insertion!=null&&(l.insertion=this.serializeInsertion(e.insertion,t)),l}serializeInsertion(e,t){let l=e.id==null?"null":""+e.id,i=qe.field(t,l);if(i==null){if(i={},t[l]=i,e.options!=null){let n=[],s=0,r=e.options;for(;s<r.length;){let a=r[s];++s,n.push(this.serializeChoiceOption(a,t))}i.options=n}if(e.origin!=null&&(i.origin=this.serializeNodeReference(e.origin)),e.stack!=null){let n=[],s=0,r=e.stack;for(;s<r.length;){let a=r[s];++s,n.push(this.serializeScope(a,t))}i.stack=n}if(e.parentPartialOptions!=null){let n=[],s=0,r=e.parentPartialOptions;for(;s<r.length;){let a=r[s];++s,n.push(this.serializeChoiceOption(a,t))}i.parentPartialOptions=n,i.parentNextOptionIndex=e.parentNextOptionIndex}}return e.id}serializeChoiceOption(e,t){let l={text:e.text};if(e.enabled||(l.disabled=!0),e.tags!=null){let i=[],n=0,s=e.tags;for(;n<s.length;){let r=s[n];++n,i.push(this.serializeTextTag(r))}l.tags=i}return e.node!=null&&(l.node=this.serializeNodeReference(e.node)),e.insertion!=null&&(l.insertion=this.serializeInsertion(e.insertion,t)),l}serializeTextTag(e){let t={value:e.value,offset:e.offset};return e.closing&&(t.closing=!0),t}serializeState(e){return this.serializeFields(e.fields,e.originalFields)}serializeCharacters(){let e={},t=this.topLevelCharacters.h,l=t,i=Object.keys(t),n=i.length,s=0;for(;s<n;){let r=i[s++],a=r,h=l[r],o=a,u=h,p=this.serializeCharacter(u);qe.fields(p.fields).length>0&&(e[o]=p)}return e}serializeNodeStates(){let e={},t=this.nodeStates.map,l=0;for(;l<t._values.length&&t._values[l]==null;)++l;for(;l<t._values.length;){let i=t._keys1[l],n=t._keys2[l],s=t._values[l];for(++l;l<t._values.length&&t._values[l]==null;)++l;let r=Ae.fromTwoInt32(i,n),a=s,h=r,o=a,u=this.serializeState(o);qe.fields(u.fields).length>0&&(e[h.toString()]=u)}return e}serializeBeatReference(e){let t=e.name,l=e;do l=this.lens.getFirstParentOfType(l,Me),l!=null&&(t=l.name+"."+t);while(l!=null);return{id:e.id.toString(),path:t}}serializeNodeReference(e){return{id:e.id.toString(),type:e.type()}}serializeCharacter(e){return this.serializeFields(e.fields,e.originalFields)}serializeFields(e,t){let l=null,i={};if(te.__implements(e,Ml)){let n=te.getClass(e);n!=null&&(l=n.__name__);let s=e,r=0,a=s.lorelineFields(this);for(;r<a.length;){let h=a[r];++r,i[h]=this.serializeValue(s.lorelineGet(this,h))}}else if(e instanceof Ee){let n=e,s=n.h,r=s,a=Object.keys(s),h=a.length,o=0;for(;o<h;){let u=a[o++],p=n.h[u];(t==null||!oe.fieldExists(this,t,u)||!Nl.equal(this,oe.getField(this,t,u),p))&&(i[u]=this.serializeValue(p))}}else{let n=te.getClass(e);n!=null&&(l=n.__name__);let s=0,r=qe.fields(e);for(;s<r.length;){let a=r[s];++s;let h=qe.getProperty(e,a);(t==null||!oe.fieldExists(this,t,a)||!Nl.equal(this,oe.getField(this,t,a),h))&&(i[a]=this.serializeValue(h))}}return l!=null?{type:l,fields:i}:{fields:i}}serializeValue(e){if(e==null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="number"&&(e|0)===e||typeof e=="boolean")return e;if(he.isArray(e)){let t=[],l=he.arrayLength(e),i=0,n=l;for(;i<n;){let s=i++;t.push(this.serializeValue(he.arrayGet(e,s)))}return t}return this.serializeFields(e)}resumeNode(e,t,l){let i=this.stack.length-1;if(t>=this.stack.length)switch(te.getClass(e)){case Hl:this.evalAlternative(e,l);break;case Jt:if(!this.isBeatCall(e))this.evalCall(e,l);else{let r=te.getClass(e);throw C.thrown(new ge("Resume execution not supported from last node: "+r.__name__,e.pos))}break;case xl:this.evalChoice(e,l);break;case Kt:this.evalDialogue(e,l);break;case ll:this.evalText(e,l);break;default:let s=te.getClass(e);throw C.thrown(new ge("Resume execution not supported from last node: "+s.__name__,e.pos))}else switch(te.getClass(e)){case Hl:this.resumeAlternative(e,t,l);break;case Me:this.resumeBeatRun(e,t,l);break;case Jt:if(this.isBeatCall(e,t))this.resumeCall(e,t,l);else{let r=te.getClass(e);throw C.thrown(new ge("Resume execution not supported from node within stack: "+r.__name__,e.pos))}break;case St:this.resumeChoiceOption(e,t,l);break;case xl:this.resumeChoice(e,t,l);break;case wl:this.resumeIf(e,t,l);break;default:let s=te.getClass(e);throw C.thrown(new ge("Resume execution not supported from node within stack: "+s.__name__,e.pos))}}resumeNodeBody(e,t,l,i){let n=this.stack[t],s=0,r=-1;if(n.head==null&&t<this.stack.length-1)throw C.thrown(new ge("Cannot resume through a body with a no-headed scope that is not at the bottom of the stack",e.pos));if(n.head!=null&&(s=l.indexOf(n.head),r=s,s==-1))throw C.thrown(new ge("Failed to resolve head in scope when resuming through body",e.pos));let a=this.get_currentInsertion(),h=null,o=this;h=function(){if((a!=null?a.options:null)!=null)o.pop(),i();else if(s!=-1&&s==r){let u=l[s];s+=1;let p=o.wrapNext(h);o.resumeNode(u,t+1,p.cb),p.sync=!1}else if(s<l.length){let u=l[s];n.head=u,s+=1;let p=o.wrapNext(h);o.evalNode(u,p.cb),p.sync=!1}else o.pop(),i()},h()}resumeBeatRun(e,t,l){this.resumeNodeBody(e,t,e.body,l)}resumeChoiceOption(e,t,l){this.resumeNodeBody(e,t,e.body,l)}resumeChoice(e,t,l){let i=this.stack[t],n=this;if(i.head==null)this.evalChoice(e,l);else if(i.head instanceof St){let s=i.head;t+1<this.stack.length?this.resumeNodeBody(s,t+1,s.body,l):this.evalNodeBody(i.beat,s,s.body,null,l)}else if(i.insertion!=null){let s=i.node,r=i.insertion;if(s instanceof Me){let a=s;this.resumeNodeBody(a,t,a.body,function(){let h=r.parentPartialOptions!=null?r.parentPartialOptions:[];if(r.options!=null){let _=0,m=r.options;for(;_<m.length;){let f=m[_];++_,h.push(f)}}let o=r.parentNextOptionIndex,u=i.beat,p=n.wrapNext(function(){n.presentChoice(e,h,l)});n.evalChoiceOptionsAndInsertions(u,e,h,p.cb,o,!0),p.sync=!1})}else{for(;this.stack.length>t;)this.pop();this.evalChoice(e,l)}}else if(i.node instanceof St){let s=i.node;this.resumeNodeBody(s,t,s.body,l)}else if(i.node instanceof Me){let s=i.node;this.resumeNodeBody(s,t,s.body,l)}else throw C.thrown(new ge("Choice head is not a choice option",i.head.pos))}resumeIf(e,t,l){let i=this.stack[t];if(i.head==null)throw C.thrown(new ge("Failed to resolve head in scope when resuming through condition",e.pos));let s=e.thenBranch.body.indexOf(i.head)!=-1?e.thenBranch:e.elseBranch;if(s!=null&&s.body.length>0)this.resumeNodeBody(s,t,s.body,l);else throw C.thrown(new ge("Failed to resume condition: invalid scope",e.pos))}resumeAlternative(e,t,l){let i=this.stack[t];if(i.head==null)throw C.thrown(new ge("Failed to resolve head when resuming alternative",e.pos));let n=0,s=e.items;for(;n<s.length;){let r=s[n];if(++n,r.body.indexOf(i.head)!=-1){this.resumeNodeBody(r,t,r.body,l);return}}throw C.thrown(new ge("Failed to resume alternative: head not found in any item",e.pos))}resumeCall(e,t,l){if(e.target instanceof ft){let i=e.target;if(i.target==null){let n=i.name,s=null,r=this.stack.length-1;for(;r>=0;){let h=this.stack[r].beatByName(n);if(h!=null){s=h;break}--r}if(s==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,n)&&(s=this.topLevelBeats.h[n]),s!=null){this.resumeBeatRun(s,t,l);return}}}throw C.thrown(new ge("Cannot resume through a function call that is not at the bottom of the stack",e.pos))}restoreStack(e,t,l){let i=[];l==null&&(l=new Kl);let n=e.length-1;for(;n>=0;){let s=this.restoreScopeItem(e[n],t,l);if(s==null)return!1;i.push(s),--n}for(n=i.length-1;n>=0;)this.push(i[n]),--n;return!0}restoreScopeItem(e,t,l){let i=this.restoreBeat(e.beat);if(i==null)return null;let n=Ae.fromString(e.beat.id),s=e.node,r=s!=null?this.restoreNode(s,n,i):null;if(s!=null&&r==null)return null;let a=[];if(e.beats!=null){let m=0,f=e.beats;for(;m<f.length;){let g=f[m];++m;let d=this.restoreBeat(g);if(d==null)return null;a.push(d)}}let o=e.state!=null?this.restoreState(null,e.state):null,u=e.head,p=u!=null?this.restoreNode(u,n,i):null;if(u!=null&&p==null)return null;let _=null;return e.insertion!=null&&t!=null&&(_=this.restoreInsertion(e.insertion,t,l)),new xi(null,i,r,a,o,p,_)}restoreInsertion(e,t,l){if(l.h.hasOwnProperty(e))return l.h[e];let i=e==null?"null":""+e,n=qe.field(t,i);if(n==null)return null;let s=null;if(n.origin!=null){let a=Ae.fromString(n.origin.id),h=this.lens.getNodeById(a);h!=null&&h.type()==n.origin.type&&(s=h)}let r=new Si(e,s);if(l.h[e]=r,e>=this.nextInsertionId&&(this.nextInsertionId=e+1),n.options!=null){r.options=[];let a=0,h=n.options;for(;a<h.length;){let o=h[a];++a;let u=this.restoreChoiceOption(o,t,l);u!=null&&r.options.push(u)}}if(n.stack!=null){r.stack=[];let a=0,h=n.stack;for(;a<h.length;){let o=h[a];++a;let u=this.restoreScopeItem(o,t,l);u!=null&&r.stack.push(u)}}if(n.parentPartialOptions!=null){r.parentPartialOptions=[];let a=0,h=n.parentPartialOptions;for(;a<h.length;){let o=h[a];++a;let u=this.restoreChoiceOption(o,t,l);u!=null&&r.parentPartialOptions.push(u)}r.parentNextOptionIndex=n.parentNextOptionIndex!=null?n.parentNextOptionIndex:0}return r}restoreChoiceOption(e,t,l){let i=null;if(e.node!=null){let r=Ae.fromString(e.node.id),a=this.lens.getNodeById(r);a!=null&&a.type()==e.node.type&&(i=a)}let n=null;if(e.tags!=null){let r=[],a=0,h=e.tags;for(;a<h.length;){let o=h[a];++a,r.push(new vi(o.closing==!0,o.value,o.offset))}n=r}let s=null;return e.insertion!=null&&t!=null&&(s=this.restoreInsertion(e.insertion,t,l)),new Oi(e.text,n,e.disabled!=!0,i,s)}restoreBeatToResume(e){let t=null;if(e.length>0){let l=e[0];if(t=this.restoreBeat(l.beat),t!=null){let i=t;do i=this.lens.getFirstParentOfType(i,Me),i!=null&&(t=i);while(i!=null)}}return t}restoreNode(e,t,l){let i=l.id.thisVal.high>>16&65535,n=t.thisVal.high>>16&65535,s=(i>=32768?i-65536:i)+32768-((n>=32768?n-65536:n)+32768),r=Ae.fromString(e.id);if(r==t)return l;let a=r.thisVal.high>>16&65535,o=(a>=32768?a-65536:a)+32768+s-32768;o<0&&(o=o+65536&65535),r.thisVal=new jl(r.thisVal.high&65535|o<<16,r.thisVal.low);let u=this.lens.getNodeById(r);return u!=null&&u.type()==e.type?u:null}restoreBeat(e){return this.lens.findBeatByPathFromNode(e.path,this.script)}restoreState(e,t){let l=e!=null?e.fields:null,i=this.restoreFields(l??null,t);return e==null&&(e=new Fl(this,null,i,null)),e}restoreCharacters(e){let t=0,l=qe.fields(e);for(;t<l.length;){let i=l[t];++t;let n=qe.field(e,i);if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,i))this.restoreCharacter(this.topLevelCharacters.h[i],n);else{let s=this.restoreCharacter(null,n);this.topLevelCharacters.h[i]=s}}}restoreNodeStates(e){let t=0,l=qe.fields(e);for(;t<l.length;){let i=l[t];++t;let n=Ae.fromString(i),s=qe.field(e,i),r=this.restoreState(null,s),a=n.thisVal;this.nodeStates.map._set(a.high,a.low,r)}}restoreCharacter(e,t){let l=e!=null?e.fields:null,i=this.restoreFields(l??null,t);return e==null&&(e=new di(this,null,i,null)),e}restoreFields(e,t){if(t==null||t.fields==null)return e;e==null&&(e=oe.createFields(this,t.type));let l=t.fields;if(oe.isFields(e)){let i=0,n=qe.fields(l);for(;i<n.length;){let s=n[i];++i,oe.setField(this,e,s,this.restoreValue(qe.field(l,s)))}}else{let i=0,n=qe.fields(l);for(;i<n.length;){let s=n[i];++i,e[s]=this.restoreValue(qe.field(l,s))}}return e}restoreValue(e){if(e==null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="number"&&(e|0)===e||typeof e=="boolean")return e;if(he.isArray(e)){let t=he.arrayLength(e),l=he.createArray(),i=0,n=t;for(;i<n;){let s=i++;he.arrayPush(l,this.restoreValue(he.arrayGet(e,s)))}return l}return this.restoreFields(null,e)}initializeTopLevelFunctions(e){if(this.builtins=new qi(this),this.builtins.bindAll(this.topLevelFunctions),e!=null){let r=e,a=r,h=qe.fields(r),o=0;for(;o<h.length;){let u=h[o++],p=a[u],m=u,f=p;this.registerTopLevelFunction(m,f)}}let t=this.topLevelFunctions.h,l=t,i=Object.keys(t),n=i.length,s=0;for(;s<n;){let r=i[s++],a=r,h=l[r],o=a,u=h;o.startsWith("string_")?this.stringHelpers.h[c.substr(o,7,null)]=u:o.startsWith("array_")?this.arrayHelpers.h[c.substr(o,6,null)]=u:o.startsWith("map_")?this.mapHelpers.h[c.substr(o,4,null)]=u:o.startsWith("beat_")&&(this.beatHelpers.h[c.substr(o,5,null)]=u)}}registerTopLevelFunction(e,t){let l=t,i=this,n=this.topLevelFunctions,s=qe.makeVarArgs(function(r){return l.apply(null,[i,r])});n.h[e]=s}initializeStringLiteralProcessors(e){let t=this;if(this.stringLiteralProcessors.push(function(l){return t.pluralPipeProcess(l)}),e!=null){let l=0;for(;l<e.length;){let i=e[l];++l,this.stringLiteralProcessors.push(i)}}}initializeTopLevelFunction(e){if(e.name!=null){if(!e.external||!Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,e.name)){let t=new ti;try{let l=t.process(e.code+(e.external?" {}":"")),i=new ci;i.allowJSON=!0,i.allowTypes=!0;let n=i.parseString(l),r=new nn(this).execute(n);this.topLevelFunctions.h[e.name]=r}catch(l){let i=C.caught(l).unwrap();throw C.thrown(new ge("Failed to parse function code: "+(i==null?"null":Y.string(i)),e.pos))}}}else throw C.thrown(new ge("Top level function must have a name",e.pos))}wrapNext(e){let t=new Hi;t.sync=!0;let l=this;return t.cb=function(){t.sync?(l.syncCallbacks==null&&(l.syncCallbacks=[]),l.syncCallbacks.push(t.cb)):(e(),l.flush(),t.cb=null,l.finishTrigger==t&&l.finish())},t}flush(){if(!this.flushing){this.flushing=!0;try{if(this.syncCallbacks!=null)for(;this.syncCallbacks.length>0;){let e=this.syncCallbacks.shift(),t=this.syncCallbacks;if(this.syncCallbacks=null,e(),this.syncCallbacks!=null){let l=this.syncCallbacks.length-1;for(;l>=0;)t.unshift(this.syncCallbacks[l]),--l}this.syncCallbacks=t}}catch(e){let t=C.caught(e).unwrap();throw this.flushing=!1,C.thrown(t)}this.flushing=!1}}pop(){return this.stack.length>0?(this.stack.pop(),!0):!1}push(e){e.id=this.nextScopeId++,this.stack.push(e)}initializeTopLevelState(e){if(e.temporary)throw C.thrown(new ge("Top level temporary states are not allowed",e.pos));let t=0,l=e.fields;for(;t<l.length;){let i=l[t];++t;let n=this.evaluateExpression(i.value);oe.setField(this,this.topLevelState.fields,i.name,n),this.isOriginalScriptExpression(i.value)&&oe.setField(this,this.topLevelState.originalFields,i.name,n)}}initializeTopLevelBeat(e){if(Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,e.name))throw C.thrown(new ge("Duplicate top level beat: "+e.name,e.pos));this.topLevelBeats.h[e.name]=e}initializeTopLevelCharacter(e){if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,e.name))throw C.thrown(new ge("Duplicate top level character: "+e.name,e.pos));let t=new di(this,e,null,null);this.topLevelCharacters.h[e.name]=t;let l=0,i=e.fields;for(;l<i.length;){let n=i[l];++l;let s=this.evaluateExpression(n.value);oe.setField(this,t.fields,n.name,s),this.isOriginalScriptExpression(n.value)&&oe.setField(this,t.originalFields,n.name,s)}}initializeState(e,t){let l=null;if(e.temporary)t.state==null&&(t.state=new Fl(this,e,null,null)),l=t.state;else{let s=t.node.id.thisVal;if(l=this.nodeStates.map._get(s.high,s.low),l==null){l=new Fl(this,e,null,null);let r=t.node.id.thisVal;this.nodeStates.map._set(r.high,r.low,l)}}let i=0,n=e.fields;for(;i<n.length;){let s=n[i];if(++i,!oe.fieldExists(this,l.fields,s.name)){let r=this.evaluateExpression(s.value);oe.setField(this,l.fields,s.name,r),!e.temporary&&this.isOriginalScriptExpression(s.value)&&oe.setField(this,l.originalFields,s.name,r)}}}finish(){this.finishTrigger=null,this.handleFinish!=null&&this.handleFinish(this)}transitionToBeat(e){for(;this.pop(););this.nextScopeId=1,this.nextInsertionId=1,this.pendingChoiceOptions=null,this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let t=this.wrapNext(be(this,this.finish));this.finishTrigger=t,this.evalBeatRun(e,t.cb),t.sync=!1}evalNode(e,t){switch(te.getClass(e)){case Hl:this.evalAlternative(e,t);break;case kl:this.evalAssignment(e,t);break;case Me:this.evalBeatDecl(e,t);break;case Jt:this.evalCall(e,t);break;case St:this.evalChoiceOption(e,t);break;case xl:this.evalChoice(e,t);break;case Kt:this.evalDialogue(e,t);break;case wl:this.evalIf(e,t);break;case $t:this.evalStateDecl(e,t);break;case ll:this.evalText(e,t);break;case Dl:this.evalTransition(e);break;default:let l=te.getClass(e);throw C.thrown(new ge("Unsupported node type: "+l.__name__,e.pos))}}evalBeatDecl(e,t){if(this.get_currentScope().beats==null)this.get_currentScope().beats=[];else if(this.get_currentScope().beatByName(e.name)!=null)throw C.thrown(new ge("Duplicate beat with name: "+e.name,e.pos));this.get_currentScope().beats.push(e),t()}evalNodeBody(e,t,l,i,n){this.push(new xi(null,e,t,null,null,null,i));let s=0,r=null,a=this.get_currentInsertion(),h=this;r=function(){if((a!=null?a.options:null)!=null)h.pop(),n();else if(s<l.length){let o=l[s];h.get_currentScope().head=o,s+=1;let u=h.wrapNext(r);h.evalNode(o,u.cb),u.sync=!1}else h.pop(),n()},r()}evalBeatRun(e,t){this.incrementBeatVisitCount(e),this.evalNodeBody(e,e,e.body,null,t)}evalStateDecl(e,t){this.initializeState(e,this.get_currentScope()),t()}evalText(e,t){if(e.condition!=null&&!this.evaluateCondition(e.condition)){t();return}let l=this.getTranslatedString(e,e.content),i=this.evaluateString(l);this.handleDialogue(this,null,i.text,i.tags,t)}evalDialogue(e,t){if(e.condition!=null&&!this.evaluateCondition(e.condition)){t();return}let l=this.getTranslatedString(e,e.content),i=this.evaluateString(l);this.handleDialogue(this,e.character,i.text,i.tags,t)}evalChoice(e,t){let l=this.pendingChoiceOptions;if(l!=null){this.pendingChoiceOptions=null,this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let r=0;for(;r<l.length;){let a=l[r];++r,this._choiceEvalTexts.push(a.text),this._choiceEvalEnabled.push(a.enabled)}this.presentChoice(e,l,t);return}let i=[],n=this,s=this.wrapNext(function(){n.presentChoice(e,i,t)});this.evalChoiceOptionsAndInsertions(this.get_currentScope().beat,e,i,s.cb,null,this.get_currentInsertion()==null),s.sync=!1}presentChoice(e,t,l){let i=this.get_currentInsertion();if(i!=null&&i.options==null){i.stack=[].concat(this.stack),i.options=t,l();return}let n=0,s=e.options;for(;n<s.length;){let u=s[n];if(++n,u.insertion!=null){this.pendingChoiceOptions=t;break}}let r=-1,a=this,h=function(){a._choiceEvalTexts.length=0,a._choiceEvalEnabled.length=0},o=this.wrapNext(function(){if(a.pendingChoiceOptions=null,r>=0&&r<t.length){let u=t[r];u.node.once&&a.setChoiceOptionChosen(u.node);let p=function(){h(),l()};if(u.insertion!=null){let _=a.stack.length;for(;a.stack.length>0;)a.stack.pop();let m=0,f=u.insertion.stack;for(;m<f.length;){let d=f[m];++m,d.insertion!=null&&(d.insertion=null),a.stack.push(d)}let g=a.stack[a.stack.length-1];a.push(new xi(null,g.beat,a.lens.getParentNode(u.node),null,null,u.node,null)),a.resumeFromLevel(_,p)}else a.evalChoiceOption(u.node,p)}else h(),l()});this.handleChoice(this,t,function(u){r=u,o.cb()}),o.sync=!1}evalChoiceOptionsAndInsertions(e,t,l,i,n,s){s==null&&(s=!0);let r=t.options;if(s){this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let p=0;for(;p<l.length;){let _=l[p];++p,this._choiceEvalTexts.push(_.text),this._choiceEvalEnabled.push(_.enabled)}}let a=n??0,h=null,o=null,u=this;h=function(){if(o!=null&&o.options!=null){let p=0,_=o.options.length;for(;p<_;){let m=p++,f=o.options[m];l.push(f),s&&(u._choiceEvalTexts.push(f.text),u._choiceEvalEnabled.push(f.enabled))}o=null}if(a<r.length){let p=r[a];a+=1;let m=!(p.once&&u.isChoiceOptionChosen(p))&&(p.condition==null||u.evaluateCondition(p.condition));if(p.text!=null){let f=u.wrapNext(h),g=u.getTranslatedString(p,p.text),d=u.evaluateString(g);l.push(new Oi(d.text,d.tags,m,p,u.get_currentInsertion())),s&&(u._choiceEvalTexts.push(d.text),u._choiceEvalEnabled.push(m)),f.cb(),f.sync=!1}else if(p.insertion!=null){let f=u.wrapNext(h);m?(o=new Si(u.nextInsertionId++,p.insertion),o.parentPartialOptions=[].concat(l),o.parentNextOptionIndex=a,u.evalInsertion(o,f.cb)):f.cb(),f.sync=!1}else throw C.thrown(new ge("Invalid choice option",p.pos))}else i()},h()}evalInsertion(e,t){let l=e.origin.target,i=null,n=this.stack.length-1;for(;n>=0;){let r=this.stack[n].beatByName(l);if(r!=null){i=r;break}--n}if(i==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,l)&&(i=this.topLevelBeats.h[l]),i==null)throw C.thrown(new ge("Beat "+l+" not found",this.script.pos));this.evalNodeBody(i,i,i.body,e,t)}evalChoiceOption(e,t){this.evalNodeBody(this.get_currentScope().beat,e,e.body,null,t)}evalIf(e,t){let i=this.evaluateCondition(e.condition)?e.thenBranch:e.elseBranch;i!=null&&i.body.length>0?this.evalNodeBody(this.get_currentScope().beat,i,i.body,null,t):t()}evalAlternative(e,t){if(e.items.length==0){t();return}switch(e.mode){case 0:let l=this.getAlternativeVisitCount(e),i=l<e.items.length?l:e.items.length-1;this.setAlternativeVisitCount(e,l+1);let n=e.items[i];this.evalNodeBody(this.get_currentScope().beat,n,n.body,null,t);break;case 1:let s=this.getAlternativeVisitCount(e),r=s%e.items.length;this.setAlternativeVisitCount(e,s+1);let a=e.items[r];this.evalNodeBody(this.get_currentScope().beat,a,a.body,null,t);break;case 2:let h=this.getAlternativeVisitCount(e);if(h>=e.items.length){t();return}this.setAlternativeVisitCount(e,h+1);let o=e.items[h];this.evalNodeBody(this.get_currentScope().beat,o,o.body,null,t);break;case 3:let u=this.builtins.random(0,e.items.length-1),p=e.items[u];this.evalNodeBody(this.get_currentScope().beat,p,p.body,null,t);break;case 4:let _=[],m=0,f=e.items.length;for(;m<f;){let w=m++;_.push(w)}let g=_,d=g.length-1;for(;d>0;){let w=this.builtins.random(0,d),y=g[d];g[d]=g[w],g[w]=y,--d}this.evalShuffledItems(e,g,0,t);break}}evalShuffledItems(e,t,l,i){if(l>=t.length){i();return}let n=e.items[t[l]],s=this;this.evalNodeBody(this.get_currentScope().beat,n,n.body,null,function(){s.evalShuffledItems(e,t,l+1,i)})}getBeatVisitCount(e){let t=e.id.thisVal,l=this.nodeStates.map._get(t.high,t.low);if(l==null)return 0;let i=oe.getField(this,l.fields,"_visitCount");return i??0}incrementBeatVisitCount(e){let t=e.id.thisVal,l=this.nodeStates.map._get(t.high,t.low);if(l==null){l=new Fl(this,e,null,null);let s=e.id.thisVal;this.nodeStates.map._set(s.high,s.low,l)}let i=oe.getField(this,l.fields,"_visitCount"),n=i??0;oe.setField(this,l.fields,"_visitCount",n+1)}getAlternativeVisitCount(e){let t=e.id.thisVal,l=this.nodeStates.map._get(t.high,t.low);if(l==null)return 0;let i=oe.getField(this,l.fields,"_visitCount");return i??0}setAlternativeVisitCount(e,t){let l=e.id.thisVal,i=this.nodeStates.map._get(l.high,l.low);if(i==null){i=new Fl(this,e,null,null);let n=e.id.thisVal;this.nodeStates.map._set(n.high,n.low,i)}oe.setField(this,i.fields,"_visitCount",t)}isChoiceOptionChosen(e){let t=e.id.thisVal,l=this.nodeStates.map._get(t.high,t.low);if(l==null)return!1;let i=oe.getField(this,l.fields,"_chosen");return i??!1}setChoiceOptionChosen(e){let t=e.id.thisVal,l=this.nodeStates.map._get(t.high,t.low);if(l==null){l=new Fl(this,e,null,null);let i=e.id.thisVal;this.nodeStates.map._set(i.high,i.low,l)}oe.setField(this,l.fields,"_chosen",!0)}evalAssignment(e,t){let l=this.resolveAssignmentTarget(e.target),i=this.evaluateExpression(e.value),n;switch(e.op._hx_index){case 21:n=this.performOperation(k.OpPlus,this.readAccess(l),i,e.pos);break;case 22:n=this.performOperation(k.OpMinus,this.readAccess(l),i,e.pos);break;case 23:n=this.performOperation(k.OpMultiply,this.readAccess(l),i,e.pos);break;case 24:n=this.performOperation(k.OpDivide,this.readAccess(l),i,e.pos);break;case 20:case 25:n=i;break;default:throw C.thrown(new ge("Invalid assignment operator",e.pos))}this.writeAccess(l,n),t()}isOriginalScriptExpression(e){switch(te.getClass(e)){case il:let t=e;return this.isOriginalScriptExpression(t.left)?this.isOriginalScriptExpression(t.right):!1;case ft:case gl:case Jt:return!1;case je:let l=e,i=l.literalType;switch(i._hx_index){case 0:case 1:case 2:return!0;case 3:let h=l.value,o=0;for(;o<h.length;){let m=h[o];if(++o,m instanceof ct&&!this.isOriginalScriptExpression(m))return!1}return!0;case 4:let u=i.style,p=l.value,_=0;for(;_<p.length;){let m=p[_];if(++_,!this.isOriginalScriptExpression(m.value))return!1}return!0}break;case Mt:let n=e,s=0,r=n.parts;for(;s<r.length;){let h=r[s];++s;let o=h.partType;switch(o._hx_index){case 0:let u=o.text;continue;case 1:let p=o.expr;return!1;case 2:let _=o.closing,m=o.expr;if(!this.isOriginalScriptExpression(m))return!1;break}}return!0;case Yl:let a=e;return this.isOriginalScriptExpression(a.operand)}return!1}isBeatCall(e,t){return t==null&&(t=-1),e instanceof Jt?this.resolveBeatFromCall(e,t)!=null:!1}resolveBeatByName(e,t){t==null&&(t=-1);let l=t==-1?this.stack.length-1:t;for(;l>=0;){let i=this.stack[l].beatByName(e);if(i!=null)return i;--l}return this.topLevelBeats.h[e]}resolveBeatFromCall(e,t){if(t==null&&(t=-1),e.target instanceof ft){let l=e.target;if(l.target==null){let i=this.resolveBeatByName(l.name,t);if(i!=null)return i}}return null}evalCall(e,t){let l=this.resolveBeatFromCall(e);if(l!=null){this.evalBeatRun(l,t);return}this.evaluateFunctionCall(e,t)}evalTransition(e){let t=e.target;if(t=="."){this.finish();return}let l=null,i=this.stack.length-1;for(;i>=0;){let s=this.stack[i].beatByName(t);if(s!=null){l=s;break}--i}if(l==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,t)&&(l=this.topLevelBeats.h[t]),l==null)throw C.thrown(new ge("Beat "+t+" not found",this.script.pos));this.transitionToBeat(l)}getTranslatedString(e,t){if(this.translations!=null){let l=this.findHashCommentId(e,t);if(l!=null&&this.script.filePath!=null){let i=0,n=this.lens.getNodeAncestorFilePaths(e);for(;i<n.length;){let s=n[i];++i;let r=this.translations.h[s+"#"+l];if(r!=null)return r}}}return t}findHashCommentId(e,t){return et.findHashComment(e,t)}evaluateString(e){let t=0,l=this.stringLiteralProcessors.length;for(;t<l;){let m=t++;e=this.stringLiteralProcessors[m](e)}let i="",n=[],s=0,r=e.parts.length,a=e.quotes!=0,h=e.quotes!=0,o=e.quotes!=0,u=-1;if(!a){let m=r-1;e:for(;m>=0;){let g=e.parts[m].partType;switch(g._hx_index){case 0:let d=g.text;u=m;break e;case 1:let w=g.expr;break e;case 2:let y=g.closing,S=g.expr;--m;break}}}let p=0,_=r;for(;p<_;){let m=p++,g=e.parts[m].partType;switch(g._hx_index){case 0:let d=g.text;a||(d=He.ltrim(d)),m==u&&(d=He.rtrim(d)),o||(d=this.stripStringComments(d)),h||(d=this.stripStringIndent(d));let w=d.length;w>0&&(a=!0);let y=!1,S=!1,T=!1,O=0,E=w;for(;O<E;){let I=O++,q=c.cca(d,I),z=q??-1;T?(z==110?i+=String.fromCodePoint(10):z==114?i+=String.fromCodePoint(13):z==116?i+=String.fromCodePoint(9):i+=String.fromCodePoint(z),T=!1,y=!1,S=!1):z==92?(T=!0,y=!1,S=!1):z==36?(y?(i+=String.fromCodePoint(z),y=!1):y=!0,S=!1):z==35?(S?(i+=String.fromCodePoint(z),S=!1):S=!0,y=!1):(S&&(i+=String.fromCodePoint(35),S=!1),i+=String.fromCodePoint(z))}S&&(i+=String.fromCodePoint(35)),s+=w;break;case 1:let v=g.expr;if(a=!0,v instanceof ft){let I=v,q=this.resolveAccess(I,I.target,I.name);if(q._hx_index==2){let z=q.pos,P=q.name,B=this.evaluateExpression(v),N=oe.getField(this,B,"name"),D=N??P,U=this.valueToString(D);s+=U.length,i+=U==null?"null":""+U}else{let z=this.evaluateExpression(v),P=this.valueToString(z);s+=P.length,i+=P==null?"null":""+P}}else{let I=this.evaluateExpression(v),q=this.valueToString(I);s+=q.length,i+=q==null?"null":""+q}break;case 2:let M=g.closing,A=g.expr,L=this.evaluateString(A).text;n.push(new vi(M,L,s));break}}return{text:i,tags:n}}pluralPipeProcess(e){let t=-1,l=!1,i=null,n=0,s=e.parts.length;for(;n<s;){let r=n++,a=e.parts[r],h=a.partType;switch(h._hx_index){case 0:let o=h.text;if(t>=0&&this.rawTextHasUnescapedPipe(o)){let m,f=e.parts[t].partType;if(f._hx_index==1?m=f.expr:m=null,m!=null){if(!l){let g=[],d=0,w=r;for(;d<w;){let y=d++;g.push(e.parts[y])}i=g,l=!0}this.transformPipeRaw(o,m,a.pos,i);continue}}break;case 1:let u=h.expr;t=r;break;case 2:let p=h.closing,_=h.expr;break}l&&i.push(a)}return l?new Mt(e.id,e.pos,e.quotes,i):e}rawTextHasUnescapedPipe(e){let t=e.length,l=0;for(;l<t;){let i=c.cca(e,l),n=i??-1;if(n==92){l+=2;continue}if(n==124)return!0;++l}return!1}transformPipeRaw(e,t,l,i){let n=e.length,s=0,r=0;for(;s<n;){let a=c.cca(e,s),h=a??-1;if(h==92&&s+1<n){s+=2;continue}if(h==40){let o=-1,u=-1,p=s+1;for(;p<n;){let _=c.cca(e,p),m=_??-1;if(m==92&&p+1<n){p+=2;continue}if(m==124&&o==-1)o=p;else if(m==41){u=p;break}++p}if(o!=-1&&u!=-1&&o>s+1&&u>o+1){let _=s+1,m=o-s-1,f=m!=null?c.substr(e,_,m):c.substr(e,_,null),g=o+1,d=u-o-1,w=d!=null?c.substr(e,g,d):c.substr(e,g,null);if(s>r){let y=s-r;i.push(new Ge(Ae.UNDEFINED,l,ze.Raw(y!=null?c.substr(e,r,y):c.substr(e,r,null))))}i.push(new Ge(Ae.UNDEFINED,l,ze.Expr(this.makePluralCall(t,f,w,l)))),s=u+1,r=s;continue}}if(h==124){let o=s;for(;o>r;){let d=c.cca(e,o-1),w=d??-1;if(w==32||w==9||w==10||w==124||w==40||w==41)break;--o}let u=s+1;for(;u<n;){let d=c.cca(e,u),w=d??-1;if(w==32||w==9||w==10||w==124||w==40||w==41)break;++u}let p=s-o,_=p!=null?c.substr(e,o,p):c.substr(e,o,null),m=s+1,f=u-s-1,g=f!=null?c.substr(e,m,f):c.substr(e,m,null);if(_.length>0&&g.length>0){if(o>r){let d=o-r;i.push(new Ge(Ae.UNDEFINED,l,ze.Raw(d!=null?c.substr(e,r,d):c.substr(e,r,null))))}i.push(new Ge(Ae.UNDEFINED,l,ze.Expr(this.makePluralCall(t,_,g,l)))),s=u,r=s;continue}}++s}if(r<n){let a=n-r;i.push(new Ge(Ae.UNDEFINED,l,ze.Raw(a!=null?c.substr(e,r,a):c.substr(e,r,null))))}}makePluralCall(e,t,l,i){let n=new ft(Ae.UNDEFINED,i,null,"plural"),s=new Mt(Ae.UNDEFINED,i,1,[new Ge(Ae.UNDEFINED,i,ze.Raw(t))]),r=new Mt(Ae.UNDEFINED,i,1,[new Ge(Ae.UNDEFINED,i,ze.Raw(l))]);return new Jt(Ae.UNDEFINED,i,n,[e,s,r])}stripStringIndent(e){if(e.indexOf(`
|
|
35
28
|
`)==-1)return e;let t=e.split(`
|
|
36
|
-
`),
|
|
37
|
-
`)}return e}stripStringComments(e){let t="",i=e.length,l=0;for(;l<i;){let n=p.cca(e,l),s=n??-1,r;if(s==47&&l+1<i){let a=p.cca(e,l+1);r=(a??-1)==47}else r=!1;if(r){for(;;){let a;if(l<i){let o=p.cca(e,l);a=(o??-1)!=10}else a=!1;if(!a)break;++l}continue}let h;if(s==47&&l+1<i){let a=p.cca(e,l+1);h=(a??-1)==42}else h=!1;if(h){let a;if(l>0){let u=p.cca(e,l-1);a=(u??-1)==32}else a=!1;for(l+=2;;){let u;if(l+1<i){let c,_=p.cca(e,l);if((_??-1)==42){let f=p.cca(e,l+1);c=(f??-1)==47}else c=!1;u=!c}else u=!1;if(!u)break;++l}l+=2;let o;if(l<i){let u=p.cca(e,l);o=(u??-1)==32}else o=!1;a&&o&&++l,!a&&!o&&l<i&&(t+=String.fromCodePoint(32));continue}t+=String.fromCodePoint(s),++l}return t}evaluateCondition(e){let t=this.evaluateExpression(e);return typeof t=="boolean"?t==!0:typeof t=="string"||t instanceof Array?t.length>0:typeof t=="number"&&(t|0)===t||typeof t=="number"?t!=0:t!=null}evaluateFunctionCall(e,t){if(e.target instanceof ut){let n=e.target;if(n.target==null){let s=this.evaluateExpression(e.target);if(s!=null&&We.isFunction(s)){let r=[],h=0,a=e.args;for(;h<a.length;){let u=a[h];++h,r.push(this.evaluateExpression(u))}let o=r;try{let u=s.apply(null,o);if(u!=null&&u instanceof il){if(t==null)throw b.thrown(new fe("Cannot call async function in expression",e.pos));u.func(t)}else t?.();return u}catch(u){let c=b.caught(u).unwrap();if(c instanceof Ce){let _=c;throw b.thrown(new fe("Error when evaluating function ("+_.pmin+"-"+_.pmax+"): "+le.string(_.e),e.pos))}throw b.thrown(new fe("Error when calling function: "+le.string(c),e.pos))}}}else{let s=this.evaluateExpression(n.target),r=null;if(typeof s=="string"?r=ne.getStringHelper(this,n.name):re.isArray(s)?r=ne.getArrayHelper(this,n.name):s instanceof Me?r=ne.getBeatHelper(this,n.name):ne.isFields(s)&&(r=ne.getMapHelper(this,n.name)),r!=null&&We.isFunction(r)){let h=[],a=0,o=e.args;for(;a<o.length;){let _=o[a];++a,h.push(this.evaluateExpression(_))}let u=h;u.splice(0,0,s);let c=r.apply(null,u);if(c!=null&&c instanceof il){if(t==null)throw b.thrown(new fe("Cannot call async function in expression",e.pos));c.func(t)}else t?.();return c}else if(r==null&&!(typeof s=="string"||re.isArray(s)||ne.isFields(s))){let h=We.getProperty(s,n.name);if(We.isFunction(h)){let a=[],o=0,u=e.args;for(;o<u.length;){let f=u[o];++o,a.push(this.evaluateExpression(f))}let c=a,_=h.apply(s,c);if(_!=null&&_ instanceof il){if(t==null)throw b.thrown(new fe("Cannot call async function in expression",e.pos));_.func(t)}else t?.();return _}}}}let i=this.printLoreline(e.target),l;throw i!=null?l=i:l=te.getClass(e.target).__name__,b.thrown(new fe("Invalid call target: "+l,e.pos))}evaluateArrayLiteral(e){let t=[],i=0;for(;i<e.length;){let l=e[i];++i,t.push(this.evaluateExpression(l))}return t}evaluateObjectLiteral(e){let t=new Ee,i=0;for(;i<e.length;){let l=e[i];++i;let n=l.name,s=this.evaluateExpression(l.value);t.h[n]=s}return t}evaluateExpression(e){switch(te.getClass(e)){case ut:let t=e,i=this.resolveAccess(t,t.target,t.name);return this.readAccess(i);case pi:let l=e,n=this.evaluateExpression(l.target),s=this.evaluateExpression(l.index);if(re.isArray(n)&&(typeof s=="number"&&(s|0)===s||typeof s=="number")){let y=s|0;if(y<0||y>=re.arrayLength(n))throw b.thrown(new fe("Array index out of bounds: "+y,l.pos));return re.arrayGet(n,y)}else if(typeof s=="string"){if(n==null)throw b.thrown(new fe("Cannot access field '"+(s==null?"null":le.string(s))+"' of null",l.pos));return ne.getField(this,n,s)}else throw b.thrown(new fe("Invalid array access",l.pos));break;case Qt:let r=e,h=this.evaluateExpression(r.left),a=this.evaluateExpression(r.right);return this.performOperation(r.op,h,a,r.pos);case Rt:return this.evaluateFunctionCall(e,null);case Ke:let o=e,u=o.literalType;switch(u._hx_index){case 0:case 1:case 2:return o.value;case 3:return this.evaluateArrayLiteral(o.value);case 4:let y=u.style;return this.evaluateObjectLiteral(o.value)}break;case Tt:let c=e;if(c.parts.length==1&&c.quotes==0){let y=c.parts[0].partType;if(y._hx_index==1){let T=y.expr;return this.evaluateExpression(T)}else return this.evaluateString(c).text}else return this.evaluateString(c).text;break;case $i:let _=e;return this.evaluateCondition(_.condition)?this.evaluateExpression(_.trueExpr):this.evaluateExpression(_.falseExpr);case Ki:let m=e,g=this.evaluateExpression(m.operand);switch(m.op._hx_index){case 27:if(typeof g=="number"&&(g|0)===g)return-g;if(typeof g=="number")return-g;throw b.thrown(new fe("Invalid unary operation",m.pos));break;case 39:if(typeof g=="boolean")return!g;if(typeof g=="string"){let y=g;return y!=null?y.length==0:!0}else if(g instanceof Array){let y=g;return y!=null?y.length==0:!0}else return typeof g=="number"&&(g|0)===g||typeof g=="number"?g==0:g==null;break;default:throw b.thrown(new fe("Invalid unary operation",m.pos))}break;default:let w=te.getClass(e);throw b.thrown(new fe("Unsupported expression type: "+w.__name__,e.pos))}}readAccess(e){switch(e._hx_index){case 0:let t=e.pos,i=e.obj,l=e.name;if(i==null)throw b.thrown(new fe("Cannot read field '"+l+"' of null",t));return ne.getField(this,i,l);case 1:let n=e.pos,s=e.array,r=e.index;return re.arrayGet(s,r);case 2:let h=e.pos,a=e.name;if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,a))return this.topLevelCharacters.h[a].fields;throw b.thrown(new fe("Character not found: "+a,h));case 3:let o=e.pos,u=e.name;if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,u))return this.topLevelFunctions.h[u];throw b.thrown(new fe("Function not found: "+u,o));case 4:let c=e.pos;return e.beat}}writeAccess(e,t){switch(e._hx_index){case 0:let i=e.pos,l=e.obj,n=e.name;if(l==null)throw b.thrown(new fe("Cannot set field '"+n+"' of null",i));ne.setField(this,l,n,t);break;case 1:let s=e.pos,r=e.array,h=e.index;re.arraySet(r,h,t);break;case 2:let a=e.pos,o=e.name;throw b.thrown(new fe("Cannot overwrite character: "+o,a));case 3:let u=e.pos,c=e.name;throw b.thrown(new fe("Cannot overwrite function: "+c,u));case 4:let _=e.pos,f=e.beat;throw b.thrown(new fe("Cannot overwrite beat: "+f.name,_))}}resolveAssignmentTarget(e){switch(te.getClass(e)){case ut:let t=e;return this.resolveAccess(t,t.target,t.name);case pi:let i=e,l=this.evaluateExpression(i.target),n=this.evaluateExpression(i.index);if(re.isArray(l)&&(typeof n=="number"&&(n|0)===n||typeof n=="number")){let s=n|0;return oi.ArrayAccess(i.pos,l,s)}else if(typeof n=="string"){if(l==null)throw b.thrown(new fe("Cannot access field '"+(n==null?"null":le.string(n))+"' of null",i.pos));return oi.FieldAccess(i.pos,l,n)}else throw b.thrown(new fe("Invalid array access target",i.pos));break;default:throw b.thrown(new fe("Invalid assignment target",e.pos))}}resolveAccess(e,t,i){if(t!=null){let h=this.evaluateExpression(t);if(h==null){let a=te.getClass(t)==ut?t.name:null;throw b.thrown(new fe(a!=null?"Cannot access field '"+i+"' of undefined variable '"+a+"'":"Cannot access field '"+i+"' of null value",t.pos))}return oi.FieldAccess(t.pos,h,i)}let l=this.stack.length-1;for(;l>=0;){let h=this.stack[l];if(h.state!=null&&ne.fieldExists(this,h.state.fields,i)){let a=e!=null?e.pos:null,o;if(a!=null)o=a;else{let u=this.get_currentScope(),c=u!=null?u.node:null;o=c!=null?c.pos:null}return oi.FieldAccess(o??this.script.pos,h.state.fields,i)}if(h.node!=null){let a=h.node.id.thisVal,o=this.nodeStates.map._get(a.high,a.low);if(o!=null&&ne.fieldExists(this,o.fields,i)){let u=e!=null?e.pos:null,c;if(u!=null)c=u;else{let _=this.get_currentScope(),f=_!=null?_.node:null;c=f!=null?f.pos:null}return oi.FieldAccess(c??this.script.pos,o.fields,i)}}--l}if(ne.fieldExists(this,this.topLevelState.fields,i)){let h=e!=null?e.pos:null,a;if(h!=null)a=h;else{let o=this.get_currentScope(),u=o!=null?o.node:null;a=u!=null?u.pos:null}return oi.FieldAccess(a??this.script.pos,this.topLevelState.fields,i)}if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,i)){let h=e!=null?e.pos:null,a;if(h!=null)a=h;else{let o=this.get_currentScope(),u=o!=null?o.node:null;a=u!=null?u.pos:null}return oi.CharacterAccess(a??this.script.pos,i)}if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,i)){let h=e!=null?e.pos:null,a;if(h!=null)a=h;else{let o=this.get_currentScope(),u=o!=null?o.node:null;a=u!=null?u.pos:null}return oi.FunctionAccess(a??this.script.pos,i)}let n=this.resolveBeatByName(i);if(n!=null){let h=e!=null?e.pos:null,a;if(h!=null)a=h;else{let o=this.get_currentScope(),u=o!=null?o.node:null;a=u!=null?u.pos:null}return oi.BeatAccess(a??this.script.pos,n)}if(!this.strictAccess){let h=e!=null?e.pos:null,a;if(h!=null)a=h;else{let o=this.get_currentScope(),u=o!=null?o.node:null;a=u!=null?u.pos:null}return oi.FieldAccess(a??this.script.pos,this.topLevelState.fields,i)}let s=e!=null?e.pos:null,r;if(s!=null)r=s;else{let h=this.get_currentScope(),a=h!=null?h.node:null;r=a!=null?a.pos:null}throw b.thrown(new fe("Undefined variable: "+i,r??this.script.pos))}getTypeName(e){switch(e._hx_index){case 0:return"Null";case 1:return"Int";case 2:return"Float";case 3:return"Bool";case 4:return"Object";case 5:return"Function";case 6:return e.c.__name__;case 7:return e.e.__ename__;case 8:return"Unknown"}}performOperation(e,t,i,l){let n=pe.typeof(t),s=pe.typeof(i);switch(e._hx_index){case 26:switch(n._hx_index){case 1:switch(s._hx_index){case 1:case 2:return parseFloat(le.string(t))+parseFloat(le.string(i));case 6:if(s.c==String)return le.string(t)+le.string(i);{let g="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),w=l,y;if(w!=null)y=w;else{let T=this.get_currentScope(),E=T!=null?T.node:null;y=E!=null?E.pos:null}throw b.thrown(new fe(g,y??this.script.pos))}break;default:let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}break;case 2:switch(s._hx_index){case 1:case 2:return parseFloat(le.string(t))+parseFloat(le.string(i));case 6:if(s.c==String)return le.string(t)+le.string(i);{let g="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),w=l,y;if(w!=null)y=w;else{let T=this.get_currentScope(),E=T!=null?T.node:null;y=E!=null?E.pos:null}throw b.thrown(new fe(g,y??this.script.pos))}break;default:let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}break;case 6:if(n.c==String)return le.string(t)+le.string(i);if(s._hx_index==6){if(s.c==String)return le.string(t)+le.string(i);{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}}else{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}break;default:if(s._hx_index==6){if(s.c==String)return le.string(t)+le.string(i);{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}}else{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}}break;case 27:case 28:case 29:case 30:switch(n._hx_index){case 1:case 2:switch(s._hx_index){case 1:case 2:let w=parseFloat(le.string(t)),y=parseFloat(le.string(i));switch(e._hx_index){case 27:return w-y;case 28:return w*y;case 29:if(y==0){let I=l,v;if(I!=null)v=I;else{let F=this.get_currentScope(),B=F!=null?F.node:null;v=B!=null?B.pos:null}throw b.thrown(new fe("Division by zero",v??this.script.pos))}return w/y;case 30:if(y==0){let I=l,v;if(I!=null)v=I;else{let F=this.get_currentScope(),B=F!=null?F.node:null;v=B!=null?B.pos:null}throw b.thrown(new fe("Modulo by zero",v??this.script.pos))}return w%y;default:throw b.thrown("Unreachable")}break;default:let T;switch(e._hx_index){case 27:T="subtract";break;case 28:T="multiply";break;case 29:T="divide";break;case 30:T="modulo";break;default:T="perform operation on"}let E="Cannot "+T+" "+this.getTypeName(n)+" and "+this.getTypeName(s),C=l,P;if(C!=null)P=C;else{let I=this.get_currentScope(),v=I!=null?I.node:null;P=v!=null?v.pos:null}throw b.thrown(new fe(E,P??this.script.pos))}break;default:let _;switch(e._hx_index){case 27:_="subtract";break;case 28:_="multiply";break;case 29:_="divide";break;case 30:_="modulo";break;default:_="perform operation on"}let f="Cannot "+_+" "+this.getTypeName(n)+" and "+this.getTypeName(s),m=l,g;if(m!=null)g=m;else{let w=this.get_currentScope(),y=w!=null?w.node:null;g=y!=null?y.pos:null}throw b.thrown(new fe(f,g??this.script.pos))}break;case 31:case 32:let r=t instanceof Me&&typeof i=="string"?t.name==i:typeof t=="string"&&i instanceof Me?t==i.name:t instanceof Me&&i instanceof Me?t.name==i.name:t==i;switch(e._hx_index){case 31:return r;case 32:return!r;default:throw b.thrown("Unreachable")}break;case 33:case 34:case 35:case 36:switch(n._hx_index){case 1:case 2:switch(s._hx_index){case 1:case 2:let g=parseFloat(le.string(t)),w=parseFloat(le.string(i));switch(e._hx_index){case 33:return g>w;case 34:return g<w;case 35:return g>=w;case 36:return g<=w;default:throw b.thrown("Unreachable")}break;default:let y="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(s),T=l,E;if(T!=null)E=T;else{let C=this.get_currentScope(),P=C!=null?C.node:null;E=P!=null?P.pos:null}throw b.thrown(new fe(y,E??this.script.pos))}break;default:let _="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}break;case 37:let h=e.word;if(n._hx_index==3)if(s._hx_index==3)switch(e._hx_index){case 37:let _=e.word;return t?i:!1;case 38:let f=e.word;return t?!0:i;default:throw b.thrown("Unreachable")}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}break;case 38:let a=e.word;if(n._hx_index==3)if(s._hx_index==3)switch(e._hx_index){case 37:let _=e.word;return t?i:!1;case 38:let f=e.word;return t?!0:i;default:throw b.thrown("Unreachable")}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}break;default:let o="Invalid operation: "+le.string(e),u=l,c;if(u!=null)c=u;else{let _=this.get_currentScope(),f=_!=null?_.node:null;c=f!=null?f.pos:null}throw b.thrown(new fe(o,c??this.script.pos))}}valueToString(e){return this.valueToStringImpl(e,null)}valueToStringImpl(e,t){if(e==null)return"null";if(typeof e=="string")return e;if(typeof e=="boolean"||typeof e=="number"&&(e|0)===e||typeof e=="number")return e==null?"null":le.string(e);t==null&&(t=[]);let i=0;for(;i<t.length;){let l=t[i];if(++i,l==e)return"..."}if(t.push(e),re.isArray(e)){let l=re.arrayLength(e),n="";n+="[";let s=0,r=l;for(;s<r;){let h=s++;h>0&&(n+=", "),n+=le.string(this.valueToStringImpl(re.arrayGet(e,h),t))}return n+="]",t.pop(),n}if(e instanceof Me)return t.pop(),e.name;if(ne.isFields(e)){let l=ne.getFields(this,e);l.sort(function(h,a){return h<a?-1:h>a?1:0});let n="";n+="{";let s=0,r=l.length;for(;s<r;){let h=s++;h>0&&(n+=", "),n+=le.string(l[h]),n+=": ",n+=le.string(this.valueToStringImpl(ne.getField(this,e,l[h]),t))}return n+="}",t.pop(),n}return t.pop(),e==null?"null":le.string(e)}printLoreline(e){try{let t=new nl;return t.enableComments=!1,Ae.trim(t.print(e))}catch{return null}}}j["loreline.Interpreter"]=Yi.loreline.Interpreter=bl,bl.__name__="loreline.Interpreter",Object.assign(bl.prototype,{__class__:bl,__properties__:{get_currentInsertion:"get_currentInsertion",get_currentScope:"get_currentScope"}});class cn{static stringify(e,t){return t==null&&(t=!1),JSON.stringify(e,null,t?" ":null)}static parse(e){return JSON.parse(e)}}j["loreline.Json"]=cn,cn.__name__="loreline.Json";class N{static scriptFromJson(e){if(e==null)throw b.thrown("Cannot create Script from null JSON");let t=e.type;if(t!="Script")throw b.thrown("Expected Script node, got: "+t);let i=N.idFromJson(e),l=N.positionFromJson(e.pos),n=e.body,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(N.nodeFromJson(o))}let h=s,a=new _i(i,l,h);return a.indentSize=e.indentSize!=null?e.indentSize:2,N.applyComments(a,e),a}static nodeFromJson(e){if(e==null)return null;let t=e.type;switch(t){case"Access":return N.accessFromJson(e);case"Alternative":return N.alternativeFromJson(e);case"ArrayAccess":return N.arrayAccessFromJson(e);case"Assign":return N.assignFromJson(e);case"Beat":return N.beatFromJson(e);case"Binary":return N.binaryFromJson(e);case"Block":return N.blockFromJson(e);case"Call":return N.callFromJson(e);case"Character":return N.characterFromJson(e);case"Choice":return N.choiceStatementFromJson(e);case"Comment":return N.commentFromJson(e);case"Dialogue":return N.dialogueStatementFromJson(e);case"Field":return N.objectFieldFromJson(e);case"Function":return N.functionDeclFromJson(e);case"If":return N.ifStatementFromJson(e);case"Import":return N.importStatementFromJson(e);case"Insertion":return N.insertionFromJson(e);case"Literal":return N.literalFromJson(e);case"Option":return N.choiceOptionFromJson(e);case"Part":return N.stringPartFromJson(e);case"Script":return N.scriptFromJson(e);case"State":return N.stateFromJson(e);case"String":return N.stringLiteralFromJson(e);case"Ternary":return N.ternaryFromJson(e);case"Text":return N.textStatementFromJson(e);case"Transition":return N.transitionFromJson(e);case"Unary":return N.unaryFromJson(e);default:throw b.thrown("Unknown node type: "+t)}}static commentFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.isHash!=null&&e.isHash;return new Wi(t,i,e.content,e.multiline,l)}static stateFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.fields,n=[],s=0;for(;s<l.length;){let o=l[s];++s,n.push(N.nodeFromJson(o))}let r=n,h=N.extractComments(e),a=new Wt(t,i,e.temporary,r,h.leading,h.trailing);return a.style=N.blockStyleFromString(e.style),a}static objectFieldFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.extractComments(e);return new Fi(t,i,e.name,N.nodeFromJson(e.value),l.leading,l.trailing)}static characterFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.positionFromJson(e.namePos),n=e.fields,s=[],r=0;for(;r<n.length;){let u=n[r];++r,s.push(N.nodeFromJson(u))}let h=s,a=N.extractComments(e),o=new zt(t,i,e.name,l,h,a.leading,a.trailing);return o.style=N.blockStyleFromString(e.style),o}static beatFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.body,n=[],s=0;for(;s<l.length;){let o=l[s];++s,n.push(N.nodeFromJson(o))}let r=n,h=N.extractComments(e),a=new Me(t,i,e.name,r,h.leading,h.trailing);return a.style=N.blockStyleFromString(e.style),a}static stringPartFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.part,n;switch(l){case"Expr":n=ze.Expr(N.nodeFromJson(e.expression));break;case"Raw":n=ze.Raw(e.text);break;case"Tag":n=ze.Tag(e.closing,N.nodeFromJson(e.content));break;default:throw b.thrown("Unknown string part type: "+l)}let s=N.extractComments(e);return new Je(t,i,n,s.leading,s.trailing)}static stringLiteralFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.quotesFromString(e.quotes),n=e.parts,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(N.nodeFromJson(o))}let h=s,a=N.extractComments(e);return new Tt(t,i,l,h,a.leading,a.trailing)}static textStatementFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.content),n=N.extractComments(e),s=new ci(t,i,l,n.leading,n.trailing);return e.condition!=null&&(s.condition=N.nodeFromJson(e.condition),s.conditionStyle=N.conditionStyleFromString(e.conditionStyle),s.conditionPos=N.positionFromJson(e.conditionPos)),s}static dialogueStatementFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.positionFromJson(e.characterPos),n=N.nodeFromJson(e.content),s=N.extractComments(e),r=new ti(t,i,e.character,l,n,s.leading,s.trailing);return e.condition!=null&&(r.condition=N.nodeFromJson(e.condition),r.conditionStyle=N.conditionStyleFromString(e.conditionStyle),r.conditionPos=N.positionFromJson(e.conditionPos)),r}static choiceStatementFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.options,n=[],s=0;for(;s<l.length;){let o=l[s];++s,n.push(N.nodeFromJson(o))}let r=n,h=N.extractComments(e),a=new mi(t,i,r,h.leading,h.trailing);return a.style=N.blockStyleFromString(e.style),a}static choiceOptionFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.text!=null?N.nodeFromJson(e.text):null,n=e.insertion!=null?N.nodeFromJson(e.insertion):null,s=e.condition!=null?N.nodeFromJson(e.condition):null,r=e.conditionStyle!=null?N.conditionStyleFromString(e.conditionStyle):0,h=e.body,a=[],o=0;for(;o<h.length;){let f=h[o];++o,a.push(N.nodeFromJson(f))}let u=a,c=N.extractComments(e),_=new Et(t,i,l,n,s,r,u,c.leading,c.trailing);return _.style=N.blockStyleFromString(e.style),e.once!=null&&e.once&&(_.once=!0),e.conditionPos!=null&&(_.conditionPos=N.positionFromJson(e.conditionPos)),_}static blockFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.body,n=[],s=0;for(;s<l.length;){let o=l[s];++s,n.push(N.nodeFromJson(o))}let r=n,h=N.extractComments(e),a=new ii(t,i,r,h.leading,h.trailing);return a.style=N.blockStyleFromString(e.style),a}static ifStatementFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.condition),n=N.conditionStyleFromString(e.conditionStyle),s=e.thenBranch,r=[],h=0;for(;h<s.length;){let m=s[h];++h,r.push(N.nodeFromJson(m))}let a=r,o=new ii(Re.UNDEFINED,i,a);o.style=N.blockStyleFromString(e.thenStyle);let u=null;if(e.elseBranch!=null){let m=e.elseBranch,g=[],w=0;for(;w<m.length;){let T=m[w];++w,g.push(N.nodeFromJson(T))}let y=g;u=new ii(Re.UNDEFINED,i,y),u.style=N.blockStyleFromString(e.elseStyle)}let c=N.extractComments(e),_=null,f=null;if(e.comments!=null){if(e.comments.elseLeading!=null){let m=e.comments.elseLeading,g=[],w=0;for(;w<m.length;){let y=m[w];++w,g.push(N.commentFromJson(y))}_=g}if(e.comments.elseTrailing!=null){let m=e.comments.elseTrailing,g=[],w=0;for(;w<m.length;){let y=m[w];++w,g.push(N.commentFromJson(y))}f=g}}return new gi(t,i,l,n,o,u,c.leading,c.trailing,_,f)}static alternativeFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.alternativeModeFromString(e.mode),n=e.items,s=[],r=0;for(;r<n.length;){let u=n[r];++r,s.push(N.nodeFromJson(u))}let h=s,a=N.extractComments(e),o=new Ui(t,i,l,h,a.leading,a.trailing);if(o.style=N.blockStyleFromString(e.style),e.separatorComments!=null){let u=e.separatorComments,c=[],_=0;for(;_<u.length;){let f=u[_];if(++_,f!=null){let m=f,g=[],w=0;for(;w<m.length;){let y=m[w];++w,g.push(N.commentFromJson(y))}c.push(g)}else c.push(null)}o.separatorComments=c}return o}static callFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.target),n=e.args,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(N.nodeFromJson(o))}let h=s,a=N.extractComments(e);return new Rt(t,i,l,h,a.leading,a.trailing)}static transitionFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.positionFromJson(e.targetPos),n=N.extractComments(e);return new Mi(t,i,e.target,l,n.leading,n.trailing)}static insertionFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.positionFromJson(e.targetPos),n=N.extractComments(e);return new zi(t,i,e.target,l,n.leading,n.trailing)}static functionDeclFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.name,n=e.args,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(o)}let h=s,a=N.extractComments(e);return new Li(t,i,l,h,e.code,e.external,a.leading,a.trailing)}static literalFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.literal,n=N.extractComments(e),s,r;switch(l){case"Array":if(s=He.Array,e.value!=null){let a=e.value,o=[],u=0;for(;u<a.length;){let c=a[u];++u,Object.prototype.hasOwnProperty.call(c,"type")?o.push(N.nodeFromJson(c)):o.push(c)}r=o}else r=null;break;case"Boolean":s=He.Boolean,r=e.value;break;case"Null":s=He.Null,r=null;break;case"Number":s=He.Number,r=e.value;break;case"Object":let h=N.blockStyleFromString(e.style);if(s=He.Object(h),e.value!=null){let a=e.value,o=[],u=0;for(;u<a.length;){let c=a[u];++u,o.push(N.nodeFromJson(c))}r=o}else r=[];break;default:throw b.thrown("Unknown literal type: "+l)}return new Ke(t,i,r,s,n.leading,n.trailing)}static accessFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.target!=null?N.nodeFromJson(e.target):null,n=N.extractComments(e);return new ut(t,i,l,e.name,n.leading,n.trailing)}static assignFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.target),n=N.tokenTypeFromString(e.op),s=N.nodeFromJson(e.value),r=N.extractComments(e);return new di(t,i,l,n,s,r.leading,r.trailing)}static arrayAccessFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.target),n=N.nodeFromJson(e.index),s=N.extractComments(e);return new pi(t,i,l,n,s.leading,s.trailing)}static binaryFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.left),n=N.tokenTypeFromString(e.op),s=N.nodeFromJson(e.right),r=N.extractComments(e);return new Qt(t,i,l,n,s,r.leading,r.trailing)}static unaryFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.tokenTypeFromString(e.op),n=N.nodeFromJson(e.operand),s=N.extractComments(e);return new Ki(t,i,l,n,s.leading,s.trailing)}static ternaryFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.condition),n=N.nodeFromJson(e.trueExpr),s=N.nodeFromJson(e.falseExpr),r=N.extractComments(e);return new $i(t,i,l,n,s,r.leading,r.trailing)}static importStatementFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.path),n=e.script!=null?N.scriptFromJson(e.script):null,s=N.extractComments(e);return new Yt(t,i,l,n,s.leading,s.trailing)}static idFromJson(e){let t=e.id;return t!=null?Re.fromString(t):Re.UNDEFINED}static positionFromJson(e){if(e==null)return new he(0,0,0,0);let t=e.length!=null?e.length:0;return new he(e.line,e.column,e.offset,t)}static extractComments(e){if(e.comments==null)return{leading:null,trailing:null};let t=null,i=null;if(e.comments.leading!=null){let l=e.comments.leading,n=[],s=0;for(;s<l.length;){let r=l[s];++s,n.push(N.commentFromJson(r))}t=n}if(e.comments.trailing!=null){let l=e.comments.trailing,n=[],s=0;for(;s<l.length;){let r=l[s];++s,n.push(N.commentFromJson(r))}i=n}return{leading:t,trailing:i}}static applyComments(e,t){let i=N.extractComments(t);e.leadingComments=i.leading,e.trailingComments=i.trailing}static blockStyleFromString(e){return e=="Braces"?1:0}static conditionStyleFromString(e){return e=="Parens"?2:0}static alternativeModeFromString(e){switch(e){case"Cycle":return 1;case"Once":return 2;case"Pick":return 3;case"Shuffle":return 4;default:return 0}}static quotesFromString(e){return e=="DoubleQuotes"?1:0}static tokenTypeFromString(e){switch(e){case"OpAssign":return x.OpAssign;case"OpDivide":return x.OpDivide;case"OpDivideAssign":return x.OpDivideAssign;case"OpEquals":return x.OpEquals;case"OpGreater":return x.OpGreater;case"OpGreaterEq":return x.OpGreaterEq;case"OpLess":return x.OpLess;case"OpLessEq":return x.OpLessEq;case"OpMinus":return x.OpMinus;case"OpMinusAssign":return x.OpMinusAssign;case"OpModulo":return x.OpModulo;case"OpMultiply":return x.OpMultiply;case"OpMultiplyAssign":return x.OpMultiplyAssign;case"OpNot":return x.OpNot;case"OpNotEquals":return x.OpNotEquals;case"OpPlus":return x.OpPlus;case"OpPlusAssign":return x.OpPlusAssign;case"OpUnquotedAssign":return x.OpUnquotedAssign;default:if(e.startsWith("OpAnd"))return x.OpAnd(e.indexOf("true")!=-1);if(e.startsWith("OpOr"))return x.OpOr(e.indexOf("true")!=-1);throw b.thrown("Unknown operator: "+e)}}}j["loreline.JsonToAst"]=N,N.__name__="loreline.JsonToAst";class ui{constructor(e,t){this.target=e,this.origin=t}}j["loreline.Reference"]=ui,ui.__name__="loreline.Reference",Object.assign(ui.prototype,{__class__:ui});class Wl{constructor(e){this.error=null,this.expr=null,this.hscript=null,this.func=e,this.codeToHscript=new Ji;try{this.hscript=this.codeToHscript.process(e.code)}catch(t){let i=b.caught(t).unwrap();i instanceof ai&&(this.error=i,this.error.pos=e.pos.withOffset(this.codeToHscript.input,this.error.pos.offset,this.error.pos.length,e.pos.offset)),this.hscript=this.codeToHscript.output.b}try{let t=new tl;t.resumeErrors=!1,t.allowJSON=!0,t.allowTypes=!0;let i=e.name;this.expr=t.parseString(this.hscript,i??"?")}catch(t){let i=b.caught(t).unwrap();if(this.error==null)if(i instanceof Ce){let l=i,n,s=l.e;switch(s._hx_index){case 0:n="Invalid character: "+s.c;break;case 1:n="Unexpected: "+s.s;break;case 2:n="Unterminated string";break;case 3:n="Unterminated comment";break;case 4:n="Invalid preprocessor: "+s.msg;break;case 5:n="Unknown variable: "+s.v;break;case 6:n="Invalid iterator: "+s.v;break;case 7:n="Invalid operator: "+s.op;break;case 8:n="Invalid access: "+s.f;break;case 9:n=s.msg;break}this.error=new Sl(l,n,this.codeToHscript.toLorelinePos(e.pos,l.pmin,l.pmax))}else i instanceof ai&&(this.error=i,this.error.pos=e.pos.withOffset(this.codeToHscript.input,this.error.pos.offset,this.error.pos.length,e.pos.offset));try{let l=new tl;l.resumeErrors=!0,l.allowJSON=!0,l.allowTypes=!0;let n=e.name;this.expr=l.parseString(this.hscript,n??"?")}catch{}}}}j["loreline.FuncHscript"]=Wl,Wl.__name__="loreline.FuncHscript",Object.assign(Wl.prototype,{__class__:Wl});class zl{constructor(e,t){this.completion=null,this.locals=null,e!=null&&(this.locals=e),t!=null&&(this.completion=t)}}j["loreline.HscriptCompletion"]=zl,zl.__name__="loreline.HscriptCompletion",Object.assign(zl.prototype,{__class__:zl});class Kl{constructor(e){this.hscriptFunctions=new Gi,this.childNodes=new Gi,this.parentNodes=new Gi,this.nodesById=new Gi,this.script=e,this.initialize()}initialize(){let e=this;this.script.each(function(t,i){let l=t.id.thisVal;if(e.nodesById.map._set(l.high,l.low,t),i!=null){let n=t.id.thisVal;e.parentNodes.map._set(n.high,n.low,i);let s=i.id.thisVal,r=e.childNodes.map._get(s.high,s.low);if(r==null){r=[];let h=i.id.thisVal;e.childNodes.map._set(h.high,h.low,r)}r.push(t)}})}getNodeById(e){let t=e.thisVal;return this.nodesById.map._get(t.high,t.low)}getNodeAtPosition(e){let t=null;return this.script.eachExcludingImported(function(i,l){let n=i.pos;n.length>0&&n.offset<=e.offset&&n.offset+n.length>=e.offset&&(t=i)}),t}getClosestNodeAtOrBeforePosition(e){let t=null,i=999999999;return this.script.eachExcludingImported(function(l,n){let s=l.pos,r=e.offset-s.offset;r>=0&&r<i&&(i=r,t=l)}),t}getNodesOfType(e,t){t==null&&(t=!1);let i=[],l=this;return this.traverse(this.script,function(n,s){return te.__instanceof(n,e)&&i.push(n),t||n==l.script?!0:!(n instanceof Yt||n instanceof _i)}),i}getParentNode(e){let t=e.id.thisVal;return this.parentNodes.map._get(t.high,t.low)}getFirstParentOfType(e,t){let i=e;for(;i!=null;)if(i=this.getParentNode(i),i!=null&&te.getClass(i)==t)return i;return null}getImportedPaths(e){let t=[];return this._getImportedPaths(e,this.script,t,new Ee),t}_getImportedPaths(e,t,i,l){let n=Nt.directory(e);t==null&&(t=this.script);let s=".lor";e!=null&&e.endsWith(".lor.txt")&&(s=".lor.txt");let r=0,h=t.body;for(;r<h.length;){let a=h[r];if(++r,a instanceof Yt){let o=a,u,c=o.path.parts[0].partType;c._hx_index==0?u=c.text:u="",Nt.isAbsolute(u)||(u=Nt.join([n,u])),u=Nt.normalize(u),u.toLowerCase().endsWith(s)||(u+=s),Object.prototype.hasOwnProperty.call(l.h,u)||(l.h[u]=!0,i.push(u),o.script!=null&&this._getImportedPaths(u,o.script,i,l))}}return i}resolveArrayAccess(e){let t=null;if(e.target instanceof ut?t=this.resolveAccess(e.target):e.target instanceof pi&&(t=this.resolveArrayAccess(e.target)),t==null)return null;switch(te.getClass(t)){case Ke:let i=t;if(i.literalType==He.Array){let n=i.value;if(e.index instanceof Ke){let s=e.index;if(s.literalType==He.Number){let r=s.value|0;if(r>=0&&r<n.length){let h=n[r];if(h instanceof Ft)return h}}}}break;case Fi:let l=t;if(l.value instanceof Ke){let n=l.value;if(n.literalType==He.Array){let s=n.value;if(e.index instanceof Ke){let r=e.index;if(r.literalType==He.Number){let h=r.value|0;if(h>=0&&h<s.length){let a=s[h];if(a instanceof Ft)return a}}}}}break;default:}return null}resolveAccess(e){if(e.target!=null){let h=e.target instanceof ut?this.resolveAccess(e.target):e.target instanceof pi?this.resolveArrayAccess(e.target):null;if(h!=null)switch(h instanceof Fi&&(h=h.value),te.getClass(h)){case zt:let a=h,o=0,u=a.fields;for(;o<u.length;){let f=u[o];if(++o,f.name==e.name)return f}break;case Ke:let c=h,_=c.literalType;if(_._hx_index==4){let f=_.style,m=c.value,g=0;for(;g<m.length;){let w=m[g];if(++g,w.name==e.name)return w}}break;default:}return null}let t=e.name;if(t==null)return null;let i=this.getFirstParentOfType(e,Me);for(;i!=null;){let h=null;if(this.traverse(i,function(a,o){if(h!=null)return!1;if(a instanceof Wt){let u=a,c=0,_=u.fields;for(;c<_.length;){let f=_[c];if(++c,f.name==t)return h=f,!1}}return!0}),h!=null)return h;i=this.getFirstParentOfType(i,Me)}let l=null;if(this.traverse(this.script,function(h,a){if(l!=null)return!1;if(h instanceof Wt){let o=h,u=0,c=o.fields;for(;u<c.length;){let _=c[u];if(++u,_.name==t)return l=_,!1}}return h instanceof Yt?!0:h instanceof _i}),l!=null)return l;let n=this.findCharacterByNameFromNode(t,e);if(n!=null)return n;let s=this.findBeatByNameFromNode(t,e);if(s!=null)return s;let r=this.findFunctionByNameFromNode(t,e);return r??null}findBeatFromAccess(e){return e.target==null&&e.name!=null?this.findBeatByNameFromNode(e.name,e):null}findBeatFromTransition(e){return this.findBeatByNameFromNode(e.target,e)}findBeatFromInsertion(e){return this.findBeatByNameFromNode(e.target,e)}findBeatByPathFromNode(e,t){let i=e.split("."),l=this.findBeatByNameFromNode(i[0],t),n=1;for(;l!=null&&n<i.length;){let s=i[n],r=null;this.traverse(l,function(h,a){if(h instanceof Me){let o=h;return o.name==s&&(r=o),!1}else return r==null}),l=r,++n}return l}isTopLevelNode(e){if(e instanceof Le){let t=e;return this.script.body.indexOf(t)!=-1}return!1}findTopLevelBeatFromNode(e){if(this.isTopLevelNode(e))return e instanceof Me?e:null;{let t=this.getFirstParentOfType(e,Me);for(;t!=null&&!this.isTopLevelNode(t);)t=this.getFirstParentOfType(t,Me);if(t!=null&&t instanceof Me)return t}return null}findBeatByNameFromNode(e,t){let i=null,l=this.getFirstParentOfType(t,Me);for(;l!=null;)this.traverse(l,function(n,s){if(i!=null||n==t)return!1;if(n instanceof Me){let r=n;return r.name==e&&(i=r),!1}return!0}),l=this.getFirstParentOfType(l,Me);return i==null&&this.traverse(this.script,function(n,s){if(i==null&&n instanceof Me){let r=n;r.name==e&&(i=r)}return n instanceof Yt?!0:n instanceof _i}),i}findCharacterFromDialogue(e){return this.findCharacterByNameFromNode(e.character,e)}findCharacterByNameFromNode(e,t){let i=null;return this.traverse(this.script,function(l,n){if(i==null&&l instanceof zt){let s=l;s.name==e&&(i=s)}return l instanceof Yt?!0:l instanceof _i}),i}findFunctionByNameFromNode(e,t){let i=null;return this.traverse(this.script,function(l,n){if(i==null&&l instanceof Li){let s=l;s.name==e&&(i=s)}return l instanceof Yt?!0:l instanceof _i}),i}getVisibleCharacters(){let e=[],t=this.script.iterator();for(;t.hasNext();){let i=t.next();i instanceof zt&&e.push(i)}return e}getVisibleFunctions(){let e=[],t=this.script.iterator();for(;t.hasNext();){let i=t.next();i instanceof Li&&e.push(i)}return e}getVisibleStateFields(e){let t=[],i=new wi,l=e;for(;l!=null;){if(te.getClass(l)==Wt){let s=l,r=0,h=s.fields;for(;r<h.length;){let a=h[r];++r;let o=a.id.thisVal;if(!i._exists(o.high,o.low)){let u=a.id.thisVal;i._set(u.high,u.low,!0),t.push(a)}}}let n=l.id.thisVal;l=this.parentNodes.map._get(n.high,n.low)}return this.script.each(function(n,s){if(te.getClass(n)==Wt){let r=n;if(s instanceof _i){let h=0,a=r.fields;for(;h<a.length;){let o=a[h];++h;let u=o.id.thisVal;if(!i._exists(u.high,u.low)){let c=o.id.thisVal;i._set(c.high,c.low,!0),t.push(o)}}}}}),t}getVisibleBeats(e){let t=[],i=Object.create(null),l=this.getParentNode(e);for(;l!=null;){if(te.getClass(l)==Me&&this.getParentNode(l)!=null){let s=0,r=this.getNodesOfType(Me);for(;s<r.length;){let h=r[s];++s,Object.prototype.hasOwnProperty.call(i,h.name)||(i[h.name]=!0,t.push(h))}}l=this.getParentNode(l)}return this.script.each(function(n,s){if(te.getClass(n)==Me&&s instanceof _i){let r=n;Object.prototype.hasOwnProperty.call(i,r.name)||(i[r.name]=!0,t.push(r))}}),t}getAllTags(){let e=Object.create(null);this.script.each(function(h,a){let o=h instanceof Le?h:null;if(o!=null&&o.trailingComments!=null){let u=0,c=o.trailingComments;for(;u<c.length;){let _=c[u];if(++u,_.isHash){let f=Ae.trim(_.content);e[f]=!0}}}});let t=[],i=e,l=i,n=Object.keys(i),s=n.length,r=0;for(;r<s;){let h=n[r++];t.push(h)}return t}countTags(){let e=new Ee;return this.script.each(function(t,i){let l=t instanceof Le?t:null;if(l!=null&&l.trailingComments!=null){let n=0,s=l.trailingComments;for(;n<s.length;){let r=s[n];if(++n,r.isHash){let h=Ae.trim(r.content),a=e.h[h],o=a??0;e.h[h]=o+1}}}}),e}findStateField(e){if(e.target!=null)return null;let t=this.getVisibleStateFields(e),i=0;for(;i<t.length;){let l=t[i];if(++i,l.name==e.name)return l}return null}findOutboundBeats(e){let t=new wi,i=this;this.traverse(e,function(r,h){switch(te.getClass(r)){case Rt:let a=r;if(a.target instanceof ut){let f=a.target;if(f.target==null){let m=i.findBeatFromAccess(f);if(m!=null){let g=m.id,w=new ui(m,a),y=g.thisVal;t._set(y.high,y.low,w)}}}break;case zi:let o=r,u=i.findBeatByNameFromNode(o.target,o);if(u!=null){let f=u.id,m=new ui(u,o),g=f.thisVal;t._set(g.high,g.low,m)}break;case Mi:let c=r,_=i.findBeatByNameFromNode(c.target,c);if(_!=null){let f=_.id,m=new ui(_,c),g=f.thisVal;t._set(g.high,g.low,m)}break;default:}return!0});let l=[],n=t,s=0;for(;s<n._values.length&&n._values[s]==null;)++s;for(;s<n._values.length;){let r=n._values[s];for(++s;s<n._values.length&&n._values[s]==null;)++s;let h=r;l.push(h)}return l}findReferencesToBeat(e){let t=[],i=this;return this.script.each(function(l,n){switch(te.getClass(l)){case Rt:let s=l;if(s.target instanceof ut){let a=s.target;if(a.target==null&&a.name==e.name){let o=i.findBeatFromAccess(a);o!=null&&o.id==e.id&&t.push(new ui(e,s))}}break;case zi:let r=l;r.target==e.name&&t.push(new ui(e,r));break;case Mi:let h=l;h.target==e.name&&t.push(new ui(e,h));break;default:}}),t}findModifiedStateFields(e){let t=Object.create(null),i=this;this.traverse(e,function(u,c){if(te.getClass(u)==di){let _=u;if(_.target instanceof ut){let f=_.target,m=i.findStateField(f);if(m!=null){let g=m.name,w=new ui(m,_);t[g]=w}}}return!0});let l=[],n=t,s=n,r=Object.keys(n),h=r.length,a=0;for(;a<h;){let u=s[r[a++]];l.push(u)}let o=l;return o.sort(function(u,c){let _=u.target.name.toLowerCase(),f=c.target.name.toLowerCase();return _<f?-1:_>f?1:0}),o}findReadStateFields(e){let t=Object.create(null),i=this;this.traverse(e,function(u,c){if(te.getClass(u)==ut){let _=u;if(c instanceof di&&c.target==u)return!0;let f=i.findStateField(_);if(f!=null){let m=f.name,g=new ui(f,_);t[m]=g}}return!0});let l=[],n=t,s=n,r=Object.keys(n),h=r.length,a=0;for(;a<h;){let u=s[r[a++]];l.push(u)}let o=l;return o.sort(function(u,c){let _=u.target.name.toLowerCase(),f=c.target.name.toLowerCase();return _<f?-1:_>f?1:0}),o}findBeatCharacters(e){let t=new wi,i=this;this.traverse(e,function(h,a){switch(te.getClass(h)){case ut:let o=h;if(o.target==null){let _=i.findCharacterByNameFromNode(o.name,o);if(_!=null){let f=_.id,m=new ui(_,o),g=f.thisVal;t._set(g.high,g.low,m)}}break;case ti:let u=h,c=i.findCharacterFromDialogue(u);if(c!=null){let _=c.id,f=new ui(c,u),m=_.thisVal;t._set(m.high,m.low,f)}break;default:}return!0});let l=[],n=t,s=0;for(;s<n._values.length&&n._values[s]==null;)++s;for(;s<n._values.length;){let h=n._values[s];for(++s;s<n._values.length&&n._values[s]==null;)++s;let a=h;l.push(a)}let r=l;return r.sort(function(h,a){let o=h.target.name.toLowerCase(),u=a.target.name.toLowerCase();return o<u?-1:o>u?1:0}),r}findModifiedCharacterFields(e){let t=new wi,i=[],l=this;return this.traverse(e,function(n,s){if(te.getClass(n)==di){let r=n;if(r.target instanceof ut){let h=r.target,a=l.resolveAccess(h);if(a instanceof Fi){let o=a.id.thisVal;if(!t._exists(o.high,o.low)&&l.getParentNode(a)instanceof zt){let c=a.id.thisVal;t._set(c.high,c.low,!0),i.push(new ui(a,n))}}}}return!0}),i}findReadCharacterFields(e){let t=new wi,i=[],l=this;return this.traverse(e,function(n,s){if(te.getClass(n)==ut){let r=n,h=l.getParentNode(r);if(h instanceof di&&h.target==r)return!0;let a=l.resolveAccess(r);if(a instanceof Fi){let o=a.id.thisVal;if(!t._exists(o.high,o.low)&&l.getParentNode(a)instanceof zt){let c=a.id.thisVal;t._set(c.high,c.low,!0),i.push(new ui(a,n))}}}return!0}),i}traverse(e,t){let i=e.id.thisVal,l=this.childNodes.map._get(i.high,i.low);if(l!=null){let n=0,s=l.length;for(;n<s;){let r=n++,h=l[r];t(h,e)&&this.traverse(h,t)}}}getFuncHscript(e){let t=e.id,i=t.thisVal,l=this.hscriptFunctions.map._get(i.high,i.low);if(l==null){l=new Wl(e);let n=t.thisVal;this.hscriptFunctions.map._set(n.high,n.low,l)}return l}getHscriptExpr(e,t){let i=this.getFuncHscript(e);if(i.expr==null)return null;let l=t.offset-e.pos.offset,n=null,s=null;return s=function(r){if(r!=null){let h=i.codeToHscript.inputPosFromProcessedPos(r.pmin),a=i.codeToHscript.inputPosFromProcessedPos(r.pmax);l>=h&&l<=a&&(n=r),en.iter(r,s)}},en.iter(i.expr,s),n}resolveHscriptAccess(e,t){let i=t.e;switch(i._hx_index){case 1:let l=i.v,n=null;if(this.traverse(this.script,function(_,f){if(n!=null)return!1;if(_ instanceof Wt){let m=_,g=0,w=m.fields;for(;g<w.length;){let y=w[g];if(++g,y.name==l)return n=y,!1}}return _ instanceof Yt?!0:_ instanceof _i}),n!=null)return n;let s=this.findCharacterByNameFromNode(l,e);if(s!=null)return s;let r=this.findBeatByNameFromNode(l,e);if(r!=null)return r;break;case 5:let h=i.e,a=i.f,o=h!=null?this.resolveHscriptAccess(e,h):null;if(o!=null)switch(o instanceof Fi&&(o=o.value),te.getClass(o)){case zt:let _=o,f=0,m=_.fields;for(;f<m.length;){let y=m[f];if(++f,y.name==a)return y}break;case Ke:let g=o,w=g.literalType;if(w._hx_index==4){let y=w.style,T=g.value,E=0;for(;E<T.length;){let C=T[E];if(++E,C.name==a)return C}}break;default:}break;case 16:let u=i.e,c=i.index;break;default:}return null}isHscriptExpr(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"e")?te.__instanceof(We.field(e,"e"),V):!1}getHscriptCompletion(e,t){let i=this.getFuncHscript(e),l=t.offset-e.pos.offset+t.length,n=i.codeToHscript.processedPosFromInputPos(l),s=i.hscript,r=Math.min(n,i.hscript.length)|0,h=r!=null?s.substring(0,r):s.substring(0),a=h.length,o=h.indexOf("{",null)+1;h=a!=null?h.substring(o,a):h.substring(o);let u=h.length,c="",_=0,f=a-u;for(;_<f;){let y=_++;c+=String.fromCodePoint(32)}h=c+h;let m=null,g=new Ze;try{g.types.parser.allowJSON=!0,g.types.parser.allowTypes=!0,g.types.parser.resumeErrors=!0;let y=g.types.parser.parseString(h);g.check(y,null,!0)}catch(y){let T=b.caught(y).unwrap();T instanceof xl&&(m=T)}let w=g.locals;return new zl(w,m)}resolveAccessInFunction(e,t){if(this.getFuncHscript(e).expr==null)return null;let l=this.getHscriptExpr(e,t);return l!=null?this.resolveHscriptAccess(e,l):null}}j["loreline.Lens"]=Kl,Kl.__name__="loreline.Lens",Object.assign(Kl.prototype,{__class__:Kl});class ll extends ai{constructor(e,t){super(e,t)}}j["loreline.LexerError"]=ll,ll.__name__="loreline.LexerError",ll.__super__=ai,Object.assign(ll.prototype,{__class__:ll});var Pi=Qe["loreline.LStringAttachment"]={__ename__:"loreline.LStringAttachment",__constructs__:null,Interpolation:(d=function(k,e,t,i,l){return{_hx_index:0,braces:k,inTag:e,expr:t,start:i,length:l,__enum__:"loreline.LStringAttachment",toString:S}},d._hx_name="Interpolation",d.__params__=["braces","inTag","expr","start","length"],d),Tag:(d=function(k,e,t){return{_hx_index:1,closing:k,start:e,length:t,__enum__:"loreline.LStringAttachment",toString:S}},d._hx_name="Tag",d.__params__=["closing","start","length"],d)};Pi.__constructs__=[Pi.Interpolation,Pi.Tag];class Ni{static toString(e){switch(e){case 0:return"ChoiceBrace";case 1:return"ChoiceIndent";case 2:return"StateBrace";case 3:return"StateIndent";case 4:return"CharacterBrace";case 5:return"CharacterIndent";case 6:return"BeatBrace";case 7:return"BeatIndent";case 8:return"AlternativeBrace";case 9:return"AlternativeIndent";case 10:return"Brace";case 11:return"Indent";case 12:return"Bracket"}}}var x=Qe["loreline.TokenType"]={__ename__:"loreline.TokenType",__constructs__:null,KwImport:{_hx_name:"KwImport",_hx_index:0,__enum__:"loreline.TokenType",toString:S},KwState:{_hx_name:"KwState",_hx_index:1,__enum__:"loreline.TokenType",toString:S},KwBeat:{_hx_name:"KwBeat",_hx_index:2,__enum__:"loreline.TokenType",toString:S},KwCharacter:{_hx_name:"KwCharacter",_hx_index:3,__enum__:"loreline.TokenType",toString:S},KwChoice:{_hx_name:"KwChoice",_hx_index:4,__enum__:"loreline.TokenType",toString:S},KwIf:{_hx_name:"KwIf",_hx_index:5,__enum__:"loreline.TokenType",toString:S},KwElse:{_hx_name:"KwElse",_hx_index:6,__enum__:"loreline.TokenType",toString:S},KwNew:{_hx_name:"KwNew",_hx_index:7,__enum__:"loreline.TokenType",toString:S},KwSequence:{_hx_name:"KwSequence",_hx_index:8,__enum__:"loreline.TokenType",toString:S},KwCycle:{_hx_name:"KwCycle",_hx_index:9,__enum__:"loreline.TokenType",toString:S},KwOnce:{_hx_name:"KwOnce",_hx_index:10,__enum__:"loreline.TokenType",toString:S},KwPick:{_hx_name:"KwPick",_hx_index:11,__enum__:"loreline.TokenType",toString:S},KwShuffle:{_hx_name:"KwShuffle",_hx_index:12,__enum__:"loreline.TokenType",toString:S},Separator:{_hx_name:"Separator",_hx_index:13,__enum__:"loreline.TokenType",toString:S},Function:(d=function(k,e,t,i){return{_hx_index:14,name:k,args:e,code:t,external:i,__enum__:"loreline.TokenType",toString:S}},d._hx_name="Function",d.__params__=["name","args","code","external"],d),LString:(d=function(k,e,t){return{_hx_index:15,quotes:k,s:e,attachments:t,__enum__:"loreline.TokenType",toString:S}},d._hx_name="LString",d.__params__=["quotes","s","attachments"],d),LNumber:(d=function(k){return{_hx_index:16,n:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="LNumber",d.__params__=["n"],d),LBoolean:(d=function(k){return{_hx_index:17,b:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="LBoolean",d.__params__=["b"],d),LNull:{_hx_name:"LNull",_hx_index:18,__enum__:"loreline.TokenType",toString:S},Identifier:(d=function(k){return{_hx_index:19,name:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="Identifier",d.__params__=["name"],d),OpAssign:{_hx_name:"OpAssign",_hx_index:20,__enum__:"loreline.TokenType",toString:S},OpPlusAssign:{_hx_name:"OpPlusAssign",_hx_index:21,__enum__:"loreline.TokenType",toString:S},OpMinusAssign:{_hx_name:"OpMinusAssign",_hx_index:22,__enum__:"loreline.TokenType",toString:S},OpMultiplyAssign:{_hx_name:"OpMultiplyAssign",_hx_index:23,__enum__:"loreline.TokenType",toString:S},OpDivideAssign:{_hx_name:"OpDivideAssign",_hx_index:24,__enum__:"loreline.TokenType",toString:S},OpUnquotedAssign:{_hx_name:"OpUnquotedAssign",_hx_index:25,__enum__:"loreline.TokenType",toString:S},OpPlus:{_hx_name:"OpPlus",_hx_index:26,__enum__:"loreline.TokenType",toString:S},OpMinus:{_hx_name:"OpMinus",_hx_index:27,__enum__:"loreline.TokenType",toString:S},OpMultiply:{_hx_name:"OpMultiply",_hx_index:28,__enum__:"loreline.TokenType",toString:S},OpDivide:{_hx_name:"OpDivide",_hx_index:29,__enum__:"loreline.TokenType",toString:S},OpModulo:{_hx_name:"OpModulo",_hx_index:30,__enum__:"loreline.TokenType",toString:S},OpEquals:{_hx_name:"OpEquals",_hx_index:31,__enum__:"loreline.TokenType",toString:S},OpNotEquals:{_hx_name:"OpNotEquals",_hx_index:32,__enum__:"loreline.TokenType",toString:S},OpGreater:{_hx_name:"OpGreater",_hx_index:33,__enum__:"loreline.TokenType",toString:S},OpLess:{_hx_name:"OpLess",_hx_index:34,__enum__:"loreline.TokenType",toString:S},OpGreaterEq:{_hx_name:"OpGreaterEq",_hx_index:35,__enum__:"loreline.TokenType",toString:S},OpLessEq:{_hx_name:"OpLessEq",_hx_index:36,__enum__:"loreline.TokenType",toString:S},OpAnd:(d=function(k){return{_hx_index:37,word:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="OpAnd",d.__params__=["word"],d),OpOr:(d=function(k){return{_hx_index:38,word:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="OpOr",d.__params__=["word"],d),OpNot:{_hx_name:"OpNot",_hx_index:39,__enum__:"loreline.TokenType",toString:S},Arrow:{_hx_name:"Arrow",_hx_index:40,__enum__:"loreline.TokenType",toString:S},Colon:{_hx_name:"Colon",_hx_index:41,__enum__:"loreline.TokenType",toString:S},Question:{_hx_name:"Question",_hx_index:42,__enum__:"loreline.TokenType",toString:S},Comma:{_hx_name:"Comma",_hx_index:43,__enum__:"loreline.TokenType",toString:S},Dot:{_hx_name:"Dot",_hx_index:44,__enum__:"loreline.TokenType",toString:S},LBrace:{_hx_name:"LBrace",_hx_index:45,__enum__:"loreline.TokenType",toString:S},RBrace:{_hx_name:"RBrace",_hx_index:46,__enum__:"loreline.TokenType",toString:S},LParen:{_hx_name:"LParen",_hx_index:47,__enum__:"loreline.TokenType",toString:S},RParen:{_hx_name:"RParen",_hx_index:48,__enum__:"loreline.TokenType",toString:S},LBracket:{_hx_name:"LBracket",_hx_index:49,__enum__:"loreline.TokenType",toString:S},RBracket:{_hx_name:"RBracket",_hx_index:50,__enum__:"loreline.TokenType",toString:S},CommentLine:(d=function(k){return{_hx_index:51,content:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="CommentLine",d.__params__=["content"],d),CommentMultiLine:(d=function(k){return{_hx_index:52,content:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="CommentMultiLine",d.__params__=["content"],d),CommentHash:(d=function(k){return{_hx_index:53,content:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="CommentHash",d.__params__=["content"],d),Indent:{_hx_name:"Indent",_hx_index:54,__enum__:"loreline.TokenType",toString:S},Unindent:{_hx_name:"Unindent",_hx_index:55,__enum__:"loreline.TokenType",toString:S},LineBreak:{_hx_name:"LineBreak",_hx_index:56,__enum__:"loreline.TokenType",toString:S},Eof:{_hx_name:"Eof",_hx_index:57,__enum__:"loreline.TokenType",toString:S}};x.__constructs__=[x.KwImport,x.KwState,x.KwBeat,x.KwCharacter,x.KwChoice,x.KwIf,x.KwElse,x.KwNew,x.KwSequence,x.KwCycle,x.KwOnce,x.KwPick,x.KwShuffle,x.Separator,x.Function,x.LString,x.LNumber,x.LBoolean,x.LNull,x.Identifier,x.OpAssign,x.OpPlusAssign,x.OpMinusAssign,x.OpMultiplyAssign,x.OpDivideAssign,x.OpUnquotedAssign,x.OpPlus,x.OpMinus,x.OpMultiply,x.OpDivide,x.OpModulo,x.OpEquals,x.OpNotEquals,x.OpGreater,x.OpLess,x.OpGreaterEq,x.OpLessEq,x.OpAnd,x.OpOr,x.OpNot,x.Arrow,x.Colon,x.Question,x.Comma,x.Dot,x.LBrace,x.RBrace,x.LParen,x.RParen,x.LBracket,x.RBracket,x.CommentLine,x.CommentMultiLine,x.CommentHash,x.Indent,x.Unindent,x.LineBreak,x.Eof];class Ot{static equals(e,t){switch(e._hx_index){case 1:return t._hx_index==1?!0:pe.enumEq(e,t);case 2:return t._hx_index==2?!0:pe.enumEq(e,t);case 3:return t._hx_index==3?!0:pe.enumEq(e,t);case 4:return t._hx_index==4?!0:pe.enumEq(e,t);case 5:return t._hx_index==5?!0:pe.enumEq(e,t);case 6:return t._hx_index==6?!0:pe.enumEq(e,t);case 7:return t._hx_index==7?!0:pe.enumEq(e,t);case 8:return t._hx_index==8?!0:pe.enumEq(e,t);case 9:return t._hx_index==9?!0:pe.enumEq(e,t);case 10:return t._hx_index==10?!0:pe.enumEq(e,t);case 11:return t._hx_index==11?!0:pe.enumEq(e,t);case 12:return t._hx_index==12?!0:pe.enumEq(e,t);case 13:return t._hx_index==13?!0:pe.enumEq(e,t);case 15:let i=e.s,l=e.attachments;if(t._hx_index==15){let r=t.s,h=t.attachments,a=t.quotes;return e.quotes==a}else return pe.enumEq(e,t);break;case 16:if(t._hx_index==16){let r=t.n;return e.n==r}else return pe.enumEq(e,t);break;case 17:if(t._hx_index==17){let r=t.b;return e.b==r}else return pe.enumEq(e,t);break;case 18:return t._hx_index==18?!0:pe.enumEq(e,t);case 19:if(t._hx_index==19){let r=t.name;return e.name==r}else return pe.enumEq(e,t);break;case 20:return t._hx_index==20?!0:pe.enumEq(e,t);case 21:return t._hx_index==21?!0:pe.enumEq(e,t);case 22:return t._hx_index==22?!0:pe.enumEq(e,t);case 23:return t._hx_index==23?!0:pe.enumEq(e,t);case 24:return t._hx_index==24?!0:pe.enumEq(e,t);case 25:return t._hx_index==25?!0:pe.enumEq(e,t);case 26:return t._hx_index==26?!0:pe.enumEq(e,t);case 27:return t._hx_index==27?!0:pe.enumEq(e,t);case 28:return t._hx_index==28?!0:pe.enumEq(e,t);case 29:return t._hx_index==29?!0:pe.enumEq(e,t);case 30:return t._hx_index==30?!0:pe.enumEq(e,t);case 31:return t._hx_index==31?!0:pe.enumEq(e,t);case 32:return t._hx_index==32?!0:pe.enumEq(e,t);case 33:return t._hx_index==33?!0:pe.enumEq(e,t);case 34:return t._hx_index==34?!0:pe.enumEq(e,t);case 35:return t._hx_index==35?!0:pe.enumEq(e,t);case 36:return t._hx_index==36?!0:pe.enumEq(e,t);case 37:let n=e.word;if(t._hx_index==37){let r=t.word;return!0}else return pe.enumEq(e,t);break;case 38:let s=e.word;if(t._hx_index==38){let r=t.word;return!0}else return pe.enumEq(e,t);break;case 39:return t._hx_index==39?!0:pe.enumEq(e,t);case 40:return t._hx_index==40?!0:pe.enumEq(e,t);case 41:return t._hx_index==41?!0:pe.enumEq(e,t);case 42:return t._hx_index==42?!0:pe.enumEq(e,t);case 44:return t._hx_index==44?!0:pe.enumEq(e,t);case 45:return t._hx_index==45?!0:pe.enumEq(e,t);case 46:return t._hx_index==46?!0:pe.enumEq(e,t);case 47:return t._hx_index==47?!0:pe.enumEq(e,t);case 48:return t._hx_index==48?!0:pe.enumEq(e,t);case 49:return t._hx_index==49?!0:pe.enumEq(e,t);case 50:return t._hx_index==50?!0:pe.enumEq(e,t);case 51:if(t._hx_index==51){let r=t.content;return e.content==r}else return pe.enumEq(e,t);break;case 52:if(t._hx_index==52){let r=t.content;return e.content==r}else return pe.enumEq(e,t);break;case 53:if(t._hx_index==53){let r=t.content;return e.content==r}else return pe.enumEq(e,t);break;case 54:return t._hx_index==54?!0:pe.enumEq(e,t);case 55:return t._hx_index==55?!0:pe.enumEq(e,t);case 56:return t._hx_index==56?!0:pe.enumEq(e,t);case 57:return t._hx_index==57?!0:pe.enumEq(e,t);default:return pe.enumEq(e,t)}}static isComment(e){switch(e._hx_index){case 51:let t=e.content;return!0;case 52:let i=e.content;return!0;case 53:let l=e.content;return!0;default:return!1}}static isAssignOp(e){switch(e._hx_index){case 20:case 21:case 22:case 23:case 24:case 25:return!0;default:return!1}}static isIdentifier(e){if(e._hx_index==19){let t=e.name;return!0}else return!1}static isBlockStart(e){switch(e._hx_index){case 1:case 2:case 3:case 4:case 5:return!0;case 8:case 9:case 10:case 11:case 12:case 13:return!0;default:return!1}}static toCodeString(e){switch(e._hx_index){case 0:return"import";case 1:return"state";case 2:return"beat";case 3:return"character";case 4:return"choice";case 5:return"if";case 6:return"else";case 7:return"new";case 8:return"sequence";case 9:return"cycle";case 10:return"once";case 11:return"pick";case 12:return"shuffle";case 13:return"--";case 14:let t=e.name,i=e.args,l=e.code,n=e.external;return"function";case 15:let s=e.quotes,r=e.s,h=e.attachments;return"string";case 16:let a=e.n;return"number";case 17:let o=e.b;return"boolean";case 18:return"null";case 19:let u=e.name;return"identifier";case 20:return"=";case 21:return"+=";case 22:return"-=";case 23:return"*=";case 24:return"/=";case 25:return":=";case 26:return"+";case 27:return"-";case 28:return"*";case 29:return"/";case 30:return"%";case 31:return"==";case 32:return"!=";case 33:return">";case 34:return"<";case 35:return">=";case 36:return"<=";case 37:return e.word?"and":"&&";case 38:return e.word?"or":"||";case 39:return"!";case 40:return"->";case 41:return":";case 42:return"?";case 43:return",";case 44:return".";case 45:return"{";case 46:return"}";case 47:return"(";case 48:return")";case 49:return"[";case 50:return"]";case 51:let f=e.content;return"comment";case 52:let m=e.content;return"multiline comment";case 53:let g=e.content;return"hash comment";case 54:return"indent";case 55:return"unindent";case 56:return"line break";case 57:return"end of file"}}}j["loreline.TokenTypeHelpers"]=Ot,Ot.__name__="loreline.TokenTypeHelpers";class ke{constructor(e,t){this.type=e,this.pos=t}toString(){return""+le.string(this.type)+" at "+this.pos.toString()}}j["loreline.Token"]=ke,ke.__name__="loreline.Token",Object.assign(ke.prototype,{__class__:ke});class yt{constructor(e){this.keepOrphanExpressions=!1,this.errors=null,this.allowTabs=!0,this.detectedIndentSize=2,this.indentSize=4,this.indentTokens=[],this.indentStack=[],this.indentLevel=0,this.input=e,this.length=e.length,this.reset()}reset(){this.pos=0,this.line=1,this.column=1,this.startLine=1,this.startColumn=1,this.previous=null,this.stack=[],this.nextBlock=10,this.tokenized=null,this.strictExprs=[],this.indentLevel=0,this.indentStack=[0],this.indentTokens=[]}tokenize(){let e=[];for(this.tokenized=e;;){let t=this.nextToken();if(t.type==x.Eof){if(this.indentStack.length>1){let i=this.indentStack.length-1,l=0,n=i;for(;l<n;){let s=l++,r=null;r==null&&(r=new he(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ke(x.Unindent,r);this.previous=h,e.push(h)}}break}switch(e.push(t),t.type._hx_index){case 1:this.nextBlock=3;break;case 2:this.nextBlock=7;break;case 3:this.nextBlock=5;break;case 4:this.nextBlock=1;break;case 8:case 9:case 10:case 11:case 12:case 13:this.nextBlock=9;break;case 45:let i;switch(this.nextBlock){case 0:case 1:i=0;break;case 2:case 3:i=2;break;case 4:case 5:i=4;break;case 6:case 7:i=7;break;case 8:case 9:i=8;break;case 10:case 11:case 12:i=10;break}this.stack.push(i),this.nextBlock=10;break;case 49:this.stack.push(12),this.nextBlock=10;break;case 46:case 50:case 55:this.stack.pop(),this.nextBlock=10;break;case 54:let l;switch(this.nextBlock){case 0:case 1:l=1;break;case 2:case 3:l=3;break;case 4:case 5:l=5;break;case 6:case 7:l=7;break;case 8:case 9:l=9;break;case 10:case 11:case 12:l=11;break}this.stack.push(l),this.nextBlock=10;break;default:}}return e}nextToken(){if(this.indentTokens.length>0)return this.indentTokens.shift();if(this.skipWhitespace(),this.pos>=this.length){let l=null;l==null&&(l=new he(this.startLine,this.startColumn,this.pos)),l.length=this.pos-l.offset;let n=new ke(x.Eof,l);return this.previous=n,n}this.startLine=this.line,this.startColumn=this.column;let e=p.cca(this.input,this.pos),t=e??-1;if(t==10||t==13){let l=this.readLineBreak(),n=this.countIndentation();if(n>this.indentStack[this.indentStack.length-1]){this.indentStack.length==1&&(this.detectedIndentSize=n-this.indentStack[0]),this.indentStack.push(n);let s=this.indentTokens,r=null;r==null&&(r=new he(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ke(x.Indent,r);this.previous=h,s.push(h)}else if(n<this.indentStack[this.indentStack.length-1])for(;this.indentStack.length>0&&n<this.indentStack[this.indentStack.length-1];){this.indentStack.pop();let s=this.indentTokens,r=null;r==null&&(r=new he(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ke(x.Unindent,r);this.previous=h,s.push(h)}return l}let i=new he(this.startLine,this.startColumn,this.pos);if(this.tokenized.length>0&&this.tokenized[this.tokenized.length-1].type==x.KwImport)return this.readImportValue(t,i);switch(t){case 34:let l=this.tryReadUnquotedString();return l??this.readString(i);case 91:let n=0,s=1;for(;n<s;){let y=n++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.makeLooseOrStrictAfterBracket();let r=i;r==null&&(r=new he(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ke(x.LBracket,r);return this.previous=h,h;case 123:let a=0,o=1;for(;a<o;){let y=a++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let u=i;u==null&&(u=new he(this.startLine,this.startColumn,this.pos)),u.length=this.pos-u.offset;let c=new ke(x.LBrace,u);return this.previous=c,c;case 125:let _=0,f=1;for(;_<f;){let y=_++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let m=i;m==null&&(m=new he(this.startLine,this.startColumn,this.pos)),m.length=this.pos-m.offset;let g=new ke(x.RBrace,m);return this.previous=g,g;default:let w=this.tryReadUnquotedString();if(w!=null)return w;switch(t){case 33:let y=t;if(y>=48&&y<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpNotEquals,Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpNot,X);return this.previous=Q,Q}}}break;case 35:let T=t;if(T>=48&&T<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;return ie>=97&&ie<=122||ie>=65&&ie<=90||ie==95||ie>=48&&ie<=57||ie==45?this.readHashComment():(this.error("Unexpected character: #",!0),null)}}break;case 37:let E=t;if(E>=48&&E<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie=0,R=1;for(;ie<R;){let Q=ie++;if(this.pos>=this.length)break;let ae=p.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=i;ee==null&&(ee=new he(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let X=new ke(x.OpModulo,ee);return this.previous=X,X}}break;case 38:let C=t;if(C>=48&&C<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==38){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpAnd(!1),Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error("Expected &",!1);let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpAnd(!1),X);return this.previous=Q,Q}}}break;case 40:let P=0,I=1;for(;P<I;){let H=P++;if(this.pos>=this.length)break;let ie=p.cca(this.input,this.pos);(ie??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.makeStrictIfFollowingCallable();let v=i;v==null&&(v=new he(this.startLine,this.startColumn,this.pos)),v.length=this.pos-v.offset;let F=new ke(x.LParen,v);return this.previous=F,F;case 41:let B=0,A=1;for(;B<A;){let H=B++;if(this.pos>=this.length)break;let ie=p.cca(this.input,this.pos);(ie??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.strictExprs.pop();let L=i;L==null&&(L=new he(this.startLine,this.startColumn,this.pos)),L.length=this.pos-L.offset;let z=new ke(x.RParen,L);return this.previous=z,z;case 42:let D=t;if(D>=48&&D<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpMultiplyAssign,Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpMultiply,X);return this.previous=Q,Q}}}break;case 43:let O=t;if(O>=48&&O<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpPlusAssign,Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpPlus,X);return this.previous=Q,Q}}}break;case 44:let q=0,M=1;for(;q<M;){let H=q++;if(this.pos>=this.length)break;let ie=p.cca(this.input,this.pos);(ie??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let U=i;U==null&&(U=new he(this.startLine,this.startColumn,this.pos)),U.length=this.pos-U.offset;let K=new ke(x.Comma,U);return this.previous=K,K;case 45:let G=t;if(G>=48&&G<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==62){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.Arrow,Q);return this.previous=ae,ae}else{let R;if(this.pos+1<this.length){let ee=p.cca(this.input,this.pos+1);R=ee??-1}else R=0;if(R==45&&this.strictExprs.length==0){let ee=2;ee==null&&(ee=1);let X=0,Q=ee;for(;X<Q;){let xe=X++;if(this.pos>=this.length)break;let Ye=p.cca(this.input,this.pos);(Ye??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ae=i;ae==null&&(ae=new he(this.startLine,this.startColumn,this.pos)),ae.length=this.pos-ae.offset;let _e=new ke(x.Separator,ae);return this.previous=_e,_e}else{let ee;if(this.pos+1<this.length){let X=p.cca(this.input,this.pos+1);ee=X??-1}else ee=0;if(ee==61){let X=2;X==null&&(X=1);let Q=0,ae=X;for(;Q<ae;){let Ye=Q++;if(this.pos>=this.length)break;let gt=p.cca(this.input,this.pos);(gt??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let _e=i;_e==null&&(_e=new he(this.startLine,this.startColumn,this.pos)),_e.length=this.pos-_e.offset;let xe=new ke(x.OpMinusAssign,_e);return this.previous=xe,xe}else{let X=0,Q=1;for(;X<Q;){let xe=X++;if(this.pos>=this.length)break;let Ye=p.cca(this.input,this.pos);(Ye??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ae=i;ae==null&&(ae=new he(this.startLine,this.startColumn,this.pos)),ae.length=this.pos-ae.offset;let _e=new ke(x.OpMinus,ae);return this.previous=_e,_e}}}}}break;case 46:let Y=0,$=1;for(;Y<$;){let H=Y++;if(this.pos>=this.length)break;let ie=p.cca(this.input,this.pos);(ie??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let se=i;se==null&&(se=new he(this.startLine,this.startColumn,this.pos)),se.length=this.pos-se.offset;let ue=new ke(x.Dot,se);return this.previous=ue,ue;case 47:let oe=t;if(oe>=48&&oe<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpDivideAssign,Q);return this.previous=ae,ae}else{let R;if(this.pos+1<this.length){let ee=p.cca(this.input,this.pos+1);R=ee??-1}else R=0;if(R==47)return this.readLineComment();{let ee;if(this.pos+1<this.length){let X=p.cca(this.input,this.pos+1);ee=X??-1}else ee=0;if(ee==42)return this.readMultiLineComment();{let X=0,Q=1;for(;X<Q;){let xe=X++;if(this.pos>=this.length)break;let Ye=p.cca(this.input,this.pos);(Ye??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ae=i;ae==null&&(ae=new he(this.startLine,this.startColumn,this.pos)),ae.length=this.pos-ae.offset;let _e=new ke(x.OpDivide,ae);return this.previous=_e,_e}}}}}break;case 58:let ge;if(this.pos+1<this.length){let H=p.cca(this.input,this.pos+1);ge=H??-1}else ge=0;if(ge==61){let H=2;H==null&&(H=1);let ie=0,R=H;for(;ie<R;){let Q=ie++;if(this.pos>=this.length)break;let ae=p.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=i;ee==null&&(ee=new he(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let X=new ke(x.OpUnquotedAssign,ee);return this.previous=X,X}else{let H=0,ie=1;for(;H<ie;){let X=H++;if(this.pos>=this.length)break;let Q=p.cca(this.input,this.pos);(Q??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let R=i;R==null&&(R=new he(this.startLine,this.startColumn,this.pos)),R.length=this.pos-R.offset;let ee=new ke(x.Colon,R);return this.previous=ee,ee}break;case 60:let me=t;if(me>=48&&me<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpLessEq,Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpLess,X);return this.previous=Q,Q}}}break;case 61:let de=t;if(de>=48&&de<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpEquals,Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpAssign,X);return this.previous=Q,Q}}}break;case 62:let Oe=t;if(Oe>=48&&Oe<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpGreaterEq,Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpGreater,X);return this.previous=Q,Q}}}break;case 63:let Ve=t;if(Ve>=48&&Ve<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{this.pos++;let ie=null;ie==null&&(ie=new he(this.startLine,this.startColumn,this.pos)),ie.length=this.pos-ie.offset;let R=new ke(x.Question,ie);return this.previous=R,R}}break;case 93:let je=0,et=1;for(;je<et;){let H=je++;if(this.pos>=this.length)break;let ie=p.cca(this.input,this.pos);(ie??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.strictExprs.pop();let Ue=i;Ue==null&&(Ue=new he(this.startLine,this.startColumn,this.pos)),Ue.length=this.pos-Ue.offset;let Ge=new ke(x.RBracket,Ue);return this.previous=Ge,Ge;case 124:let nt=t;if(nt>=48&&nt<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==124){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpOr(!1),Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error("Expected |",!1);let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpOr(!1),X);return this.previous=Q,Q}}}break;default:let De=t;if(De>=48&&De<=57)return this.readNumber();{let H=t;return H>=97&&H<=122||H>=65&&H<=90||H==95?this.readIdentifier():(this.error("Unexpected character: "+String.fromCodePoint(t),!0),null)}}}}countIndentation(){let e=this.pos,t=0;for(;e<this.length;){let n=p.cca(this.input,e),s=n??-1;if(s==32)++t;else if(s==9)++t;else break;++e}let i,l;if(e<this.length){let n=p.cca(this.input,e);l=(n??-1)==10}else l=!0;if(l)i=!0;else{let n=p.cca(this.input,e);i=(n??-1)==13}return i?this.indentStack[this.indentStack.length-1]:t}parentBlockType(){let e=this.stack.length-1;for(;e>=0;){if(this.stack[e]!=10&&this.stack[e]!=11&&this.stack[e]!=12)switch(this.stack[e]){case 0:case 1:return x.KwBeat;case 2:case 3:return x.KwState;case 4:case 5:return x.KwCharacter;case 6:case 7:return x.KwBeat;case 8:case 9:return x.KwBeat;case 10:return x.LBrace;case 11:return x.Indent;case 12:return x.LBracket}--e}return x.KwBeat}inBeat(){return this.parentBlockType()==x.KwBeat}inChoiceRoot(){return this.stack.length>0?this.stack[this.stack.length-1]!=1?this.stack[this.stack.length-1]==0:!0:!1}inStateOrCharacter(){let e=this.parentBlockType();return e!=x.KwState?e==x.KwCharacter:!0}readLineBreak(){let e=new he(this.startLine,this.startColumn,this.pos),t=p.cca(this.input,this.pos);if((t??-1)==13){let n=0,s=1;for(;n<s;){let h=n++;if(this.pos>=this.length)break;let a=p.cca(this.input,this.pos);(a??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let r;if(this.pos<this.length){let h=p.cca(this.input,this.pos);r=(h??-1)==10}else r=!1;if(r){let h=0,a=1;for(;h<a;){let o=h++;if(this.pos>=this.length)break;let u=p.cca(this.input,this.pos);(u??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else{let n=0,s=1;for(;n<s;){let r=n++;if(this.pos>=this.length)break;let h=p.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let i=e;i==null&&(i=new he(this.startLine,this.startColumn,this.pos)),i.length=this.pos-i.offset;let l=new ke(x.LineBreak,i);return this.previous=l,l}isWhitespace(e){return e!=32?e==9:!0}matchIdentifier(e){if(this.length==0)return null;let t=p.cca(this.input,e),i=t??-1;if(!(i>=97&&i<=122||i>=65&&i<=90||i==95))return null;let l=1;for(;l<this.length;){let s=p.cca(this.input,e+l),r=s??-1;if(!(r>=97&&r<=122||r>=65&&r<=90||r==95||r>=48&&r<=57))break;++l}let n=this.input;return l!=null?p.substr(n,e,l):p.substr(n,e,null)}_skipWhitespaceAndComments(e,t){if(t==null&&(t=!1),t)return this._skipWhitespaceAndCommentsStopNextLine(e);{let i=e,l=!1;for(;e<this.length;){for(;;){let n;if(e<this.length){let s=p.cca(this.input,e);if((s??-1)!=32){let r=p.cca(this.input,e);n=(r??-1)==9}else n=!0}else n=!1;if(!n)break;++e,l=!0}if(e<this.length-1){let n=p.cca(this.input,e);if((n??-1)==47){let s=p.cca(this.input,e+1);if((s??-1)==47)return e=i,e;{let r=p.cca(this.input,e+1);if((r??-1)==42){e+=2,l=!0;let h=!1;for(;e<this.length-1;){let a,o=p.cca(this.input,e);if((o??-1)==42){let u=p.cca(this.input,e+1);a=(u??-1)==47}else a=!1;if(a){e+=2,h=!0;break}++e}if(!h)return e=i,e;continue}}}}break}return l?e:i}}_skipWhitespaceAndCommentsStopNextLine(e){let t=e,i=!1,l=!1;for(;e<this.length;){for(;e<this.length;){let n=p.cca(this.input,e),s=n??-1;if(s==32||s==9||s==13||!l&&s==10)s==10&&(l=!0),++e,i=!0;else break}if(e<this.length-1&&!l){let n=p.cca(this.input,e);if((n??-1)==47){let s=p.cca(this.input,e+1);if((s??-1)==47){for(e+=2,i=!0;;){let r,h;if(e<this.length){let a=p.cca(this.input,e);h=(a??-1)!=10}else h=!1;if(h){let a=p.cca(this.input,e);r=(a??-1)!=13}else r=!1;if(!r)break;++e}continue}else{let r=p.cca(this.input,e+1);if((r??-1)==42){e+=2,i=!0;let h=!1;for(;e<this.length-1;){let a,o=p.cca(this.input,e);if((o??-1)==42){let u=p.cca(this.input,e+1);a=(u??-1)==47}else a=!1;if(a){e+=2,h=!0;break}++e}if(!h)return e=t,e;continue}}}}break}return i?e:t}isIfStart(e){e=this._skipWhitespaceAndComments(e,!1);let t=p.cca(this.input,e);if((t??-1)!=105)return!1;++e;let i=p.cca(this.input,e);if((i??-1)!=102)return!1;let l=++e;e=this._skipWhitespaceAndComments(e,!1);let n;if(e<this.length){let o=p.cca(this.input,e);n=(o??-1)==33}else n=!1;n&&(++e,e=this._skipWhitespaceAndComments(e,!1));let s=p.cca(this.input,e);if((s??-1)==40)return!0;let r;if(e==l&&l<this.length){let o=p.cca(this.input,l),u=o??-1;r=u>=97&&u<=122||u>=65&&u<=90||u==95}else r=!1;if(r)return!1;let h;if(e<this.length){let o=p.cca(this.input,e),u=o??-1;h=!(u>=97&&u<=122||u>=65&&u<=90||u==95)}else h=!0;if(h)return!1;let a=this;for(;e<this.length;){let o=p.cca(this.input,e);if((o??-1)==40)return!0;{let C=!0,P=a.length;if(e>=P)C=!1;else{let I,v,F;if(e+1<P){let B=p.cca(a.input,e);F=(B??-1)==111}else F=!1;if(F){let B=p.cca(a.input,e+1);v=(B??-1)==114}else v=!1;if(v)if(e+2<P){let B=p.cca(a.input,e+2),A=B??-1;I=!(A>=97&&A<=122||A>=65&&A<=90||A==95)}else I=!0;else I=!1;if(I)C=!1;else{let B,A,L,z;if(e+2<P){let D=p.cca(a.input,e);z=(D??-1)==97}else z=!1;if(z){let D=p.cca(a.input,e+1);L=(D??-1)==110}else L=!1;if(L){let D=p.cca(a.input,e+2);A=(D??-1)==100}else A=!1;if(A)if(e+3<P){let D=p.cca(a.input,e+3),O=D??-1;B=!(O>=97&&O<=122||O>=65&&O<=90||O==95)}else B=!0;else B=!1;if(B)C=!1;else{let D=p.cca(a.input,e),O=D??-1;if(!(O>=97&&O<=122||O>=65&&O<=90||O==95))C=!1;else for(++e;e<a.length;){let q=p.cca(a.input,e);if(O=q??-1,!(O>=97&&O<=122||O>=65&&O<=90||O==95||O>=48&&O<=57))break;++e}}}}if(!C)return!1}if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let u=p.cca(this.input,e),c=u??-1;if(c==46){++e,e=this._skipWhitespaceAndComments(e,!1);let C=!0,P=a.length;if(e>=P)C=!1;else{let v,F,B;if(e+1<P){let A=p.cca(a.input,e);B=(A??-1)==111}else B=!1;if(B){let A=p.cca(a.input,e+1);F=(A??-1)==114}else F=!1;if(F)if(e+2<P){let A=p.cca(a.input,e+2),L=A??-1;v=!(L>=97&&L<=122||L>=65&&L<=90||L==95)}else v=!0;else v=!1;if(v)C=!1;else{let A,L,z,D;if(e+2<P){let O=p.cca(a.input,e);D=(O??-1)==97}else D=!1;if(D){let O=p.cca(a.input,e+1);z=(O??-1)==110}else z=!1;if(z){let O=p.cca(a.input,e+2);L=(O??-1)==100}else L=!1;if(L)if(e+3<P){let O=p.cca(a.input,e+3),q=O??-1;A=!(q>=97&&q<=122||q>=65&&q<=90||q==95)}else A=!0;else A=!1;if(A)C=!1;else{let O=p.cca(a.input,e),q=O??-1;if(!(q>=97&&q<=122||q>=65&&q<=90||q==95))C=!1;else for(++e;e<a.length;){let M=p.cca(a.input,e);if(q=M??-1,!(q>=97&&q<=122||q>=65&&q<=90||q==95||q>=48&&q<=57))break;++e}}}}if(!C||(e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!0;let I=p.cca(this.input,e);c=I??-1}if(c==91){++e;let C=1;for(;e<this.length&&C>0;){let I=p.cca(this.input,e);c=I??-1,c==91&&++C,c==93&&--C,++e}if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let P=p.cca(this.input,e);c=P??-1}let _,f,m;if(c==97){let C=p.cca(this.input,e+1);m=(C??-1)==110}else m=!1;if(m){let C=p.cca(this.input,e+2);f=(C??-1)==100}else f=!1;if(f)if(e+3<this.length){let C=p.cca(this.input,e+3),P=C??-1;_=!(P>=97&&P<=122||P>=65&&P<=90||P==95)}else _=!0;else _=!1;if(_)return!0;let g,w;if(c==111){let C=p.cca(this.input,e+1);w=(C??-1)==114}else w=!1;if(w)if(e+2<this.length){let C=p.cca(this.input,e+2),P=C??-1;g=!(P>=97&&P<=122||P>=65&&P<=90||P==95)}else g=!0;else g=!1;if(g)return!0;let y,T,E;if(c==40||c==38||c==124)E=!0;else{let C=p.cca(this.input,e+1);E=(C??-1)==61&&c==61}if(E||c==62||c==60)T=!0;else if(c==33){let C=p.cca(this.input,e+1);T=(C??-1)==61}else T=!1;if(T)y=!0;else{let C=p.cca(this.input,e+1);y=(C??-1)!=61&&(c==43||c==45||c==42||c==47||c==123)}if(y)return!0;if(c==10||c==13||e>=this.length)return e=l,!0;if(c==32||c==9){let C=e;for(;;){let v;if(C<this.length){let F=p.cca(this.input,C),B=F??-1;v=B==32||B==9}else v=!1;if(!v)break;++C}let P,I;if(C+1<this.length){let v=p.cca(this.input,C);I=(v??-1)==47}else I=!1;if(I){let v=p.cca(this.input,C+1);P=(v??-1)==47}else P=!1;if(P)return!0}return!1}return!0}isIdentifierExpressionStart(e,t){if(e=this._skipWhitespaceAndComments(e,!1),e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!1;let i=p.cca(this.input,e);if((i??-1)==40)return!0;let l=this,n=t;n==null&&(n=!1);let s=!0;if(e>=l.length)s=!1;else{let r=!1,h=p.cca(l.input,e),a=h??-1;if(r=a==95,!(a>=97&&a<=122||a>=65&&a<=90||a==95)||n&&!r&&!(a>=97&&a<=122))s=!1;else for(++e;e<l.length;){let o=r,u=p.cca(l.input,e);if(a=u??-1,r=a==95,!(a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57))break;if(n&&o&&!r&&!(a>=97&&a<=122)){s=!1;break}++e}}if(!s)return!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let r=p.cca(this.input,e),h=r??-1;if(!(h==32||h==9)&&h!=46&&h!=91&&h!=10&&h!=13&&h!=47)return!1;let a;if(h==10||h==13)a=!0;else if(h==47&&e+1<this.length){let o=p.cca(this.input,e+1);if((o??-1)!=47){let u=p.cca(this.input,e+1);a=(u??-1)==42}else a=!0}else a=!1;if(a)return!0;if(h==46){if(++e,e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let o=!0;if(e>=l.length)o=!1;else{let u=!1,c=p.cca(l.input,e),_=c??-1;if(u=_==95,!(_>=97&&_<=122||_>=65&&_<=90||_==95))o=!1;else for(++e;e<l.length;){let f=u,m=p.cca(l.input,e);if(_=m??-1,u=_==95,!(_>=97&&_<=122||_>=65&&_<=90||_==95||_>=48&&_<=57))break;++e}}if(!o)return!0;continue}if(h==91){++e;let o=1;for(;e<this.length&&o>0;){let u=p.cca(this.input,e);if(h=u??-1,h==34){if(e=this.scanStringEnd(e,!1),e==-1)return!1;continue}h==91&&++o,h==93&&--o,++e}continue}if(h==32||h==9){++e;continue}break}return!0}isTransitionStart(e){let t,i=p.cca(this.input,e);if((i??-1)!=45||e>=this.length-1)t=!0;else{let s=p.cca(this.input,e+1);t=(s??-1)!=62}if(t||(e+=2,e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!1;let l=p.cca(this.input,e);if((l??-1)==46)++e;else{let s=p.cca(this.input,e),r=s??-1;if(r>=97&&r<=122||r>=65&&r<=90||r==95||r>=48&&r<=57)for(++e;;){let h;if(e<this.length){let a=p.cca(this.input,e),o=a??-1;h=o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57}else h=!1;if(!h)break;++e}else return!1}if(e=this._skipWhitespaceAndComments(e,!1),e<this.length){let s=p.cca(this.input,e),r=s??-1;if(r!=10&&r!=13&&r!=32&&r!=9&&r!=47&&r!=35)return!1}return!0}isInsertionStart(e){let t=p.cca(this.input,e);if((t??-1)!=43||(++e,e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!1;let i=p.cca(this.input,e);if((i??-1)==46)++e;else{let n=p.cca(this.input,e),s=n??-1;if(s>=97&&s<=122||s>=65&&s<=90||s==95||s>=48&&s<=57)for(++e;;){let r;if(e<this.length){let h=p.cca(this.input,e),a=h??-1;r=a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57}else r=!1;if(!r)break;++e}else return!1}if(e=this._skipWhitespaceAndComments(e,!1),e<this.length){let n=p.cca(this.input,e),s=n??-1,r;if(s==105&&e+1<this.length){let h=p.cca(this.input,e+1);r=(h??-1)==102}else r=!1;if(r){let h;if(e+2<this.length){let a=p.cca(this.input,e+2),o=a??-1;h=!(o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57)}else h=!0;if(h)return!0}if(s!=10&&s!=13&&s!=32&&s!=9&&s!=47)return!1}return!0}isChoiceOnceStart(e){if(!this.inChoiceRoot())return!1;let t=p.cca(this.input,e);if((t??-1)!=45||(++e,e>=this.length))return!1;let i=p.cca(this.input,e);return(i??-1)==32}isLabelStart(e){e=this._skipWhitespaceAndComments(e,!1);let t=p.cca(this.input,e),i=t??-1;if(!(i>=97&&i<=122||i>=65&&i<=90||i==95))return!1;let l=e;for(++e;;){let a;if(e<this.length){let o=p.cca(this.input,e),u=o??-1;a=u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57}else a=!1;if(!a)break;++e}for(;;){let a;if(e<this.length){let o=p.cca(this.input,e),u=o??-1;a=u==32||u==9}else a=!1;if(!a)break;++e}let n;if(e<this.length){let a=p.cca(this.input,e);n=(a??-1)!=58}else n=!0;if(n)return!1;let s=this.input,r=e-l,h=r!=null?p.substr(s,l,r):p.substr(s,l,null);return!Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,h)}isCallStart(e){let t=e,i=this,l=!0;if(e>=i.length)l=!1;else{let n=p.cca(i.input,e),s=n??-1;if(!(s>=97&&s<=122||s>=65&&s<=90||s==95))l=!1;else for(++e;e<i.length;){let r=p.cca(i.input,e);if(s=r??-1,!(s>=97&&s<=122||s>=65&&s<=90||s==95||s>=48&&s<=57))break;++e}}if(!l)return e=t,!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return e=t,!1;let n=p.cca(this.input,e),s=n??-1;if(s==40)return e=t,!0;if(s==46){++e,e=this._skipWhitespaceAndComments(e,!1);let r=!0;if(e>=i.length)r=!1;else{let h=p.cca(i.input,e),a=h??-1;if(!(a>=97&&a<=122||a>=65&&a<=90||a==95))r=!1;else for(++e;e<i.length;){let o=p.cca(i.input,e);if(a=o??-1,!(a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57))break;++e}}if(!r)return e=t,!1;continue}if(s==91){for(++e;e<this.length;){let r=p.cca(this.input,e),h=r??-1;if(h==34){if(e=this.scanStringEnd(e,!1),e==-1)return e=t,!1;continue}if(h==93){++e;break}++e}continue}return e=t,!1}return e=t,!1}isAssignStart(e,t){let i=this,l;if(t){let s=!0,r=e;if(e>=i.length)s=!1;else{let o=p.cca(i.input,e),u=o??-1;if(!(u>=97&&u<=122||u>=65&&u<=90||u==95))s=!1;else for(++e;e<i.length;){let c=p.cca(i.input,e);if(u=c??-1,!(u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57))break;++e}}let h,a;if(e==r+2){let o=p.cca(i.input,r);a=(o??-1)==105}else a=!1;if(a){let o=p.cca(i.input,r+1);h=(o??-1)==102}else h=!1;l=!(!h&&s)}else l=!1;if(l)return!1;let n=!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!1;let s=p.cca(this.input,e),r=s??-1,h;if(n)h=!1;else{let a;if(r==61)if(e+1<this.length){let o=p.cca(this.input,e+1);a=(o??-1)!=61}else a=!0;else a=!1;if(a)h=!0;else{let o=p.cca(this.input,e+1);h=(o??-1)==61&&(r==43||r==45||r==42||r==47||r==58)}}if(h)return!0;if(t){if(r==46){++e,e=this._skipWhitespaceAndComments(e,!1);let a=!0,o=e;if(e>=i.length)a=!1;else{let _=p.cca(i.input,e),f=_??-1;if(!(f>=97&&f<=122||f>=65&&f<=90||f==95))a=!1;else for(++e;e<i.length;){let m=p.cca(i.input,e);if(f=m??-1,!(f>=97&&f<=122||f>=65&&f<=90||f==95||f>=48&&f<=57))break;++e}}let u,c;if(e==o+2){let _=p.cca(i.input,o);c=(_??-1)==105}else c=!1;if(c){let _=p.cca(i.input,o+1);u=(_??-1)==102}else u=!1;if(!(!u&&a))return!1;continue}if(r==91){for(++e;e<this.length;){let a=p.cca(this.input,e),o=a??-1;if(o==34){if(e=this.scanStringEnd(e,!1),e==-1)return!1;continue}if(o==93){++e;break}++e}continue}return!1}else if(r==92)n=!0,++e;else{if(r==13||r==10)return!1;if(r==34){if(e=this.scanStringEnd(e,!1),e==-1)return!1}else if(r>=97&&r<=122||r>=65&&r<=90||r==95){let a=!0,o=e;if(e>=i.length)a=!1;else{let _=p.cca(i.input,e),f=_??-1;if(!(f>=97&&f<=122||f>=65&&f<=90||f==95))a=!1;else for(++e;e<i.length;){let m=p.cca(i.input,e);if(f=m??-1,!(f>=97&&f<=122||f>=65&&f<=90||f==95||f>=48&&f<=57))break;++e}}let u,c;if(e==o+2){let _=p.cca(i.input,o);c=(_??-1)==105}else c=!1;if(c){let _=p.cca(i.input,o+1);u=(_??-1)==102}else u=!1;if(!(!u&&a))return!1}else{let a;if((r==61||r==33||r==60||r==62)&&e+1<this.length){let o=p.cca(this.input,e+1);a=(o??-1)==61}else a=!1;a?e+=2:++e}}}return!1}isColon(e,t){if(t==null&&(t=!0),t)for(;;){let i;if(e<this.length){let l=p.cca(this.input,e);if((l??-1)!=32){let n=p.cca(this.input,e);i=(n??-1)==9}else i=!0}else i=!1;if(!i)break;++e}if(e<this.length){let i=p.cca(this.input,e);return(i??-1)==58}else return!1}afterLabelIdentifierToken(e){e==null&&(e=!0);let t=this.tokenized.length-1;for(;t>=0;){let i=this.tokenized[t];if(!Ot.isComment(i.type)&&(e||i.type!=x.LineBreak&&i.type!=x.Indent&&i.type!=x.Unindent))return i.type==x.Colon&&t>0&&Ot.isIdentifier(this.tokenized[t-1].type)?t-1:-1;--t}return-1}isStartingMultilineDialogue(e){let t=this.tokenized[e],i=e+1;for(;this.tokenized[i].type!=x.Colon;)++i;let l=this.tokenized[i].pos.offset+1,n=t.pos.column,s=!0,r=!1;for(;l<this.length;){let g=p.cca(this.input,l),w=g??-1;if(w==32||w==9)++l;else break}for(;l<this.length;){let g=p.cca(this.input,l),w=g??-1;if(w==10||w==13)break;if(w==47&&l+1<this.length){let y=p.cca(this.input,l+1),T=y??-1;if(T==47)break;if(T==42){for(l+=2;l<this.length;){let E,C=p.cca(this.input,l);if((C??-1)==42&&l+1<this.length){let P=p.cca(this.input,l+1);E=(P??-1)==47}else E=!1;if(E){l+=2;break}++l}continue}}if(w==60)r=!0;else if(w==62)r=!1;else if(!r&&!(w==32||w==9)){s=!1;break}++l}if(!s)for(;;){let g,w;if(l<this.length){let y=p.cca(this.input,l);w=(y??-1)!=10}else w=!1;if(w){let y=p.cca(this.input,l);g=(y??-1)!=13}else g=!1;if(!g)break;++l}let h=l,a=!0;if(a==null&&(a=!1),l=this._skipWhitespaceAndComments(l,a),l<=h)return-1;let o=0,u=l;for(;;){let g;if(u>0){let w=p.cca(this.input,u-1);if((w??-1)!=32){let y=p.cca(this.input,u-1);g=(y??-1)==9}else g=!0}else g=!1;if(!g)break;++o,--u}if(o<=n-1)return-1;let c=!1;c==null&&(c=!1),l=this._skipWhitespaceAndComments(l,c);let _,f=p.cca(this.input,l),m=f??-1;if(m==32||m==9)_=!0;else{let g=p.cca(this.input,l);if((g??-1)==47){let w=p.cca(this.input,l+1);_=(w??-1)==47}else _=!1}return _?-1:o}isContinuingMultilineText(e,t){let i,l=p.cca(this.input,e);if((l??-1)==47){let f=p.cca(this.input,e+1);i=(f??-1)==47}else i=!1;if(i)for(;;){let f,m;if(e<this.length){let g=p.cca(this.input,e);m=(g??-1)!=13}else m=!1;if(m){let g=p.cca(this.input,e);f=(g??-1)!=10}else f=!1;if(!f)break;++e}let n=p.cca(this.input,e);(n??-1)==13&&++e;let s=p.cca(this.input,e);if((s??-1)==10)++e;else return!1;let r=0;for(;;){let f,m=p.cca(this.input,e);if((m??-1)!=32){let g=p.cca(this.input,e);f=(g??-1)==9}else f=!0;if(!f)break;++r,++e}if(r!=t)return!1;let h=!1;h==null&&(h=!1),e=this._skipWhitespaceAndComments(e,h);let a,o,u,c=p.cca(this.input,e),_=c??-1;if(_==32||_==9)u=!0;else{let f=p.cca(this.input,e);u=(f??-1)==13}if(u)o=!0;else{let f=p.cca(this.input,e);o=(f??-1)==10}if(o)a=!0;else{let f=p.cca(this.input,e);if((f??-1)==47){let m=p.cca(this.input,e+1);a=(m??-1)==47}else a=!1}return!a}isAfterComma(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(!Ot.isComment(t.type)&&t.type!=x.LineBreak&&t.type!=x.Indent&&t.type!=x.Unindent)return t.type==x.Comma;--e}return!1}isAfterLBracket(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(!Ot.isComment(t.type)&&t.type!=x.LineBreak&&t.type!=x.Indent&&t.type!=x.Unindent)return t.type==x.LBracket;--e}return!1}isInsideBrackets(){let e=this.stack.length-1;for(;e>=0&&this.stack[e]==11;)--e;return e>=0?this.stack[e]==12:!1}followsAssignStart(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Ot.isComment(t.type)||t.type==x.Indent||t.type==x.Unindent)--e;else return!!Ot.isAssignOp(t.type)}return!1}followsUnquotedAssign(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Ot.isComment(t.type)||t.type==x.Indent||t.type==x.Unindent)--e;else return t.type==x.OpUnquotedAssign}return!1}followsOnlyLabelOrCommentsInLine(){let e=!1,t=this.tokenized.length-1;for(;t>=0;){let i=this.tokenized[t];if(Ot.isComment(i.type)||i.type==x.Indent||i.type==x.Unindent)--t;else if(!e&&i.type==x.Colon)if(--t,t>=0)Ot.isIdentifier(this.tokenized[t].type)&&(e=!0,--t);else return!1;else return i.type==x.LineBreak}return!0}followsOnlyWhitespacesOrCommentsInLine(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Ot.isComment(t.type)||t.type==x.Indent||t.type==x.Unindent)--e;else return t.type==x.LineBreak}return!0}followsChoiceOncePrefix(){if(!this.inChoiceRoot())return!1;let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Ot.isComment(t.type)||t.type==x.Indent||t.type==x.Unindent)--e;else return t.type==x.OpMinus}return!1}hasNonSpecialChar(e){let t=0,i=e.length;for(;t<i;){let l=t++,n=!1,s=p.cca(e,l),r=s??-1,h=0,a=yt.hasNonSpecialChar_specialChars.length;for(;h<a;){let o=h++,u=p.cca(yt.hasNonSpecialChar_specialChars,o);if(r==(u??-1)){n=!0;break}}if(!n)return!0}return!1}isNumber(e){let t=0,i=e.length,l;if(t<i){let h=p.cca(e,t);l=(h??-1)==45}else l=!1;l&&++t;let n=t;for(;;){let h;if(t<i){let a=p.cca(e,t),o=a??-1;h=o>=48&&o<=57}else h=!1;if(!h)break;++t}if(t==n)return!1;let s,r;if(t<i){let h=p.cca(e,t);r=(h??-1)==46}else r=!1;if(r&&t+1<i){let h=p.cca(e,t+1),a=h??-1;s=a>=48&&a<=57}else s=!1;if(s)for(++t;;){let h;if(t<i){let a=p.cca(e,t),o=a??-1;h=o>=48&&o<=57}else h=!1;if(!h)break;++t}return t==i}makeLooseOrStrictAfterBracket(){if(this.isStrict()){this.strictExprs.push(1);return}let e=this.tokenized.length-1;for(;e>=0;){let i=this.tokenized[e].type;switch(i._hx_index){case 19:let l=i.name;this.strictExprs.push(1);return;case 48:case 50:this.strictExprs.push(1);return;case 51:let n=i.content;break;case 52:let s=i.content;break;case 53:let r=i.content;break;case 54:case 55:case 56:break;default:this.strictExprs.push(0);return}--e}this.strictExprs.push(2)}makeStrictIfFollowingCallable(){this.followsCallableOrIndexable()?this.strictExprs.push(1):this.strictExprs.push(2)}followsCallableOrIndexable(){let e=this.tokenized.length-1;for(;e>=0;){let i=this.tokenized[e].type;switch(i._hx_index){case 19:let l=i.name;return!0;case 48:case 50:return!0;case 51:let n=i.content;break;case 52:let s=i.content;break;case 53:let r=i.content;break;case 54:case 55:case 56:break;default:return!1}--e}return!1}isStrict(){let e=this.strictExprs.length-1;for(;e>=0&&this.strictExprs[e]==2;)--e;return e>=0?this.strictExprs[e]==1:!1}readImportValue(e,t){if(e==34)return this.readString(t);{let i="";for(;this.pos<this.length;){let r=p.cca(this.input,this.pos),h=r??-1;if(h==10)break;if(h==47&&this.pos+1<this.length){let a=p.cca(this.input,this.pos+1),o=a??-1;if(o==47||o==42)break}if(h==35&&this.pos+1<this.length){let a=p.cca(this.input,this.pos+1),o=a??-1;if(o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57||o==45)break}i+=String.fromCodePoint(h),this.pos++}let l=Ae.rtrim(i),n=new he(t.line,t.column,t.offset,l.length);n==null&&(n=new he(this.startLine,this.startColumn,this.pos)),n.length=this.pos-n.offset;let s=new ke(x.LString(0,l,[]),n);return this.previous=s,s}}scanStringEnd(e,t){let i=e+1,l=!1;for(;i<this.length;){let n=p.cca(this.input,i),s=n??-1;if(s==92){i+=2;continue}if(s==10)return-1;if(s==34&&!l)return i+1;if(t&&s==60&&!l){let r;if(i+1<this.length){let o=p.cca(this.input,i+1);r=o??-1}else r=0;let h=r==47,a=i+(h?2:1);if(a<this.length){let o=p.cca(this.input,a),u=o??-1;(u>=97&&u<=122||u>=65&&u<=90||u==95||u==95||u==36||h&&u==62)&&(l=!0)}}if(s==62&&l&&(l=!1),s==36&&i+1<this.length){let r=p.cca(this.input,i+1),h=r??-1;if(h==123){i+=2;let a=1;for(;i<this.length&&a>0;){let o=p.cca(this.input,i),u=o??-1;if(u==92){i+=2;continue}if(u==10)return-1;let c;if(u==47&&i+1<this.length){let f=p.cca(this.input,i+1);c=(f??-1)==47}else c=!1;if(c)return-1;let _;if(u==47&&i+1<this.length){let f=p.cca(this.input,i+1);_=(f??-1)==42}else _=!1;if(_){for(i+=2;;){if(i>=this.length)return-1;let f=p.cca(this.input,i);if((f??-1)==10)return-1;let m,g;if(i+1<this.length){let w=p.cca(this.input,i);g=(w??-1)==42}else g=!1;if(g){let w=p.cca(this.input,i+1);m=(w??-1)==47}else m=!1;if(m){i+=2;break}++i}continue}if(u==34){if(i=this.scanStringEnd(i,t),i==-1)return-1;continue}u==123?++a:u==125&&--a,++i}if(a!=0)return-1;continue}if(h==36){i+=2;continue}if(h>=97&&h<=122||h>=65&&h<=90||h==95){for(++i;;){let a;if(i<this.length){let o=p.cca(this.input,i),u=o??-1;a=u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57}else a=!1;if(!a)break;++i}if(i=this.scanAccessorChain(i,t),i==-1)return-1;continue}}++i}return-1}scanAccessorChain(e,t){for(;e<this.length;){let i=p.cca(this.input,e),l=i??-1,n;if(l==46&&e+1<this.length){let s=p.cca(this.input,e+1),r=s??-1;n=r>=97&&r<=122||r>=65&&r<=90||r==95}else n=!1;if(n)for(++e;;){let s;if(e<this.length){let r=p.cca(this.input,e),h=r??-1;s=h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57}else s=!1;if(!s)break;++e}else if(l==91||l==40){let s=l==91?93:41;++e;let r=1;for(;e<this.length&&r>0;){let h=p.cca(this.input,e),a=h??-1;if(a==92){e+=2;continue}if(a==10)return-1;let o;if(a==47&&e+1<this.length){let c=p.cca(this.input,e+1);o=(c??-1)==47}else o=!1;if(o)return-1;let u;if(a==47&&e+1<this.length){let c=p.cca(this.input,e+1);u=(c??-1)==42}else u=!1;if(u){for(e+=2;;){if(e>=this.length)return-1;let c=p.cca(this.input,e);if((c??-1)==10)return-1;let _,f;if(e+1<this.length){let m=p.cca(this.input,e);f=(m??-1)==42}else f=!1;if(f){let m=p.cca(this.input,e+1);_=(m??-1)==47}else _=!1;if(_){e+=2;break}++e}continue}if(a==34){if(e=this.scanStringEnd(e,t),e==-1)return-1;continue}a==l?++r:a==s&&--r,++e}if(r!=0)return-1}else break}return e}tryReadUnquotedString(){if(this.isStrict())return null;let e=p.cca(this.input,this.pos),t=e??-1,i;if(this.pos+1<this.length){let A=p.cca(this.input,this.pos+1);i=A??-1}else i=0;if(t==47&&this.pos<this.length-1){let A=p.cca(this.input,this.pos+1),L=A??-1;if(L==47||L==42)return null}if(t==123||t==125||t==91||t==93||t==58||t==35||t==32||t==9)return null;let l=this.parentBlockType();if(l!=x.KwBeat&&l!=x.KwState&&l!=x.KwCharacter)return null;let n=this.isInsideBrackets(),s=this.followsUnquotedAssign(),r=this.afterLabelIdentifierToken(!1);if(r!=-1&&this.tokenized[r].pos.line<this.line&&(this.tokenized[r].pos.column>=this.column||this.line-this.tokenized[r].pos.line>1))return null;let h=r!=-1?this.isStartingMultilineDialogue(r):-1,a=r!=-1,o=l==x.KwState||l==x.KwCharacter||n||s,u=this.matchIdentifier(this.pos);if(o){if(this.isCallStart(this.pos)||this.isLabelStart(this.pos))return null}else if(!a&&u!="true"&&u!="false"&&u!="null"&&(this.keepOrphanExpressions&&this.isIdentifierExpressionStart(this.pos,!0)||this.isIfStart(this.pos)||this.isCallStart(this.pos)||this.isAssignStart(this.pos,!1)))return null;if(!o&&(t==61||i==61&&(t==43||t==45||t==42||t==47))||!o&&!a&&(this.isInsertionStart(this.pos)||this.isChoiceOnceStart(this.pos))||u!=null&&(u=="function"||!o&&(u!="if"&&u!="null"&&u!="true"&&u!="false"&&u!="and"&&u!="or"&&Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,u)||this.isColon(this.pos+u.length))))return null;let c=!o,_=!1;if(o){if(n){if(!a&&!this.followsOnlyWhitespacesOrCommentsInLine()&&!this.isAfterComma()&&!this.isAfterLBracket())return null}else if(!s&&!a)return null}else if(_=this.followsOnlyLabelOrCommentsInLine(),!_&&!this.followsOnlyWhitespacesOrCommentsInLine()&&!this.followsChoiceOncePrefix()||!_&&i==62&&t==45)return null;if(t==34){let A=this.scanStringEnd(this.pos,l==x.KwBeat);if(A==-1)return null;let L=!1,z=A;for(;z<this.length;){let D=p.cca(this.input,z),O=D??-1;if(O==32||O==9){++z;continue}if(O==10||O==13)break;let q;if(O==47&&z+1<this.length){let M=p.cca(this.input,z+1);if((M??-1)!=47){let U=p.cca(this.input,z+1);q=(U??-1)==42}else q=!0}else q=!1;if(q||O==93||O==125||O==41||O==44||O==35)break;L=!0;break}if(!L&&!o){let D=!0;D==null&&(D=!1);let O=this._skipWhitespaceAndComments(z,D);if(O<=z||O>=this.length)return null;let q=p.cca(this.input,O),M=q??-1,U;if(M==10||M==13||M==34)U=!0;else if(M==47&&O+1<this.length){let se=p.cca(this.input,O+1);if((se??-1)!=47){let ue=p.cca(this.input,O+1);U=(ue??-1)==42}else U=!0}else U=!1;if(U)return null;let K=0,G=O;for(;;){let se;if(G>0){let ue=p.cca(this.input,G-1);if((ue??-1)!=32){let oe=p.cca(this.input,G-1);se=(oe??-1)==9}else se=!0}else se=!1;if(!se)break;++K,--G}let Y=h!=-1?h:this.column-1;if(K!=Y)return null;let $;if(M==45&&O+1<this.length){let se=p.cca(this.input,O+1);$=(se??-1)==62}else $=!1;if($||M==43||this.isAssignStart(O,!1)||this.isCallStart(O)||this.isLabelStart(O)||this.isIfStart(O)||this.isIdentifierExpressionStart(O,!0))return null;if(M>=97&&M<=122||M>=65&&M<=90||M==95){let se=O;for(;;){let me;if(se<this.length){let de=p.cca(this.input,se),Oe=de??-1;me=Oe>=97&&Oe<=122||Oe>=65&&Oe<=90||Oe==95||Oe>=48&&Oe<=57}else me=!1;if(!me)break;++se}let ue=this.input,oe=se-O,ge=oe!=null?p.substr(ue,O,oe):p.substr(ue,O,null);if(ge!="null"&&ge!="true"&&ge!="false"&&Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,ge))return null}}else if(!L)return null}let f=new he(this.startLine,this.startColumn,this.pos),m="",g=[],w=this.line,y=this.column,T=this.pos,E=!1,C=-1,P=!1,I=this.column,v=this.line,F=!0,B=!1;for(;this.pos<this.length;){let A=p.cca(this.input,this.pos),L=A??-1,z=L==32||L==9;if(B||!z&&C==-1&&(L!=60||!c)&&(B=!0),E){m+=String.fromCodePoint(92),m+=String.fromCodePoint(L),E=!1;let D=0,O=1;for(;D<O;){let q=D++;if(this.pos>=this.length)break;let M=p.cca(this.input,this.pos);(M??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}I+=2}else if(L==92){E=!0;let D=0,O=1;for(;D<O;){let q=D++;if(this.pos>=this.length)break;let M=p.cca(this.input,this.pos);(M??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(C==-1&&z&&!B&&g.length==0){let D=0,O=1;for(;D<O;){let q=D++;if(this.pos>=this.length)break;let M=p.cca(this.input,this.pos);(M??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{if(C==-1&&L==123)break;{let D;if(C==-1)if(L==10||L==13)D=!0;else if(L==47&&this.pos<this.length-1){let O=p.cca(this.input,this.pos+1);D=(O??-1)==47}else D=!1;else D=!1;if(D)if(h!=-1)if(this.isContinuingMultilineText(this.pos,h)){m+=String.fromCodePoint(L);let O=0,q=1;for(;O<q;){let U=O++;if(this.pos>=this.length)break;let K=p.cca(this.input,this.pos);(K??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let M;if(L==13){let U=p.cca(this.input,this.pos);M=(U??-1)==10}else M=!1;if(M){m+=String.fromCodePoint(10);let U=0,K=1;for(;U<K;){let G=U++;if(this.pos>=this.length)break;let Y=p.cca(this.input,this.pos);(Y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}I=this.column,v=this.line}else break;else break;else{let O;if(C==-1)if(L==47&&this.pos<this.length-1){let q=p.cca(this.input,this.pos+1);O=(q??-1)==42}else O=!1;else O=!1;if(O){m+=String.fromCodePoint(47),m+=String.fromCodePoint(42);let q=2;q==null&&(q=1);let M=0,U=q;for(;M<U;){let G=M++;if(this.pos>=this.length)break;let Y=p.cca(this.input,this.pos);(Y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let K=!1;for(;this.pos<this.length;){let G,Y=p.cca(this.input,this.pos);if((Y??-1)==42&&this.pos+1<this.length){let ge=p.cca(this.input,this.pos+1);G=(ge??-1)==47}else G=!1;if(G){m+=String.fromCodePoint(42),m+=String.fromCodePoint(47);let ge=2;ge==null&&(ge=1);let me=0,de=ge;for(;me<de;){let Oe=me++;if(this.pos>=this.length)break;let Ve=p.cca(this.input,this.pos);(Ve??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}K=!0;break}let $=p.cca(this.input,this.pos),se=$??-1;m+=String.fromCodePoint(se);let ue=0,oe=1;for(;ue<oe;){let ge=ue++;if(this.pos>=this.length)break;let me=p.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}I=this.column,v=this.line,K||this.error("Unterminated multiline comment",!1)}else{if(C==-1&&!o&&this.isIfStart(this.pos))break;{let q;if(C==-1&&L==45&&this.pos<this.length-1){let M=p.cca(this.input,this.pos+1);q=(M??-1)==62}else q=!1;if(q&&this.isTransitionStart(this.pos))break;if(C==-1&&o&&(L==44||L==93||L==125))break;if(c&&L==60){C!=-1&&this.error("Unexpected < inside tag",!0);let M;if(this.pos+1<this.length){let Y=p.cca(this.input,this.pos+1);M=Y??-1}else M=0;P=M==47;let U=this.pos+(P?2:1);if(U<this.length){let Y=p.cca(this.input,U),$=Y??-1;($>=97&&$<=122||$>=65&&$<=90||$==95||$==95||$==36||P&&$==62)&&(C=m.length)}m+=String.fromCodePoint(L);let K=0,G=1;for(;K<G;){let Y=K++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I}else if(c&&L==62){m+=String.fromCodePoint(L);let M=0,U=1;for(;M<U;){let K=M++;if(this.pos>=this.length)break;let G=p.cca(this.input,this.pos);(G??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I,C!=-1&&(g.push(Pi.Tag(P,C,m.length-C)),C=-1)}else if(C==-1&&L==35&&!E){let M;if(this.pos+1<this.length){let U=p.cca(this.input,this.pos+1);M=U??-1}else M=0;if(M==35){m+=String.fromCodePoint(35),m+=String.fromCodePoint(35);let U=0,K=1;for(;U<K;){let $=U++;if(this.pos>=this.length)break;let se=p.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let G=0,Y=1;for(;G<Y;){let $=G++;if(this.pos>=this.length)break;let se=p.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}I+=2}else{if(M>=97&&M<=122||M>=65&&M<=90||M==95||M>=48&&M<=57||M==45)break;{m+=String.fromCodePoint(L);let U=0,K=1;for(;U<K;){let G=U++;if(this.pos>=this.length)break;let Y=p.cca(this.input,this.pos);(Y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I}}}else if(L==36&&!E){let M=m.length,U=v,K=I,G=this.pos;try{let Y=0,$=1;for(;Y<$;){let ue=Y++;if(this.pos>=this.length)break;let oe=p.cca(this.input,this.pos);(oe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I;let se=p.cca(this.input,this.pos);if((se??-1)==123){let ue=0,oe=1;for(;ue<oe;){let Ve=ue++;if(this.pos>=this.length)break;let je=p.cca(this.input,this.pos);(je??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I;let ge=new he(U,K+2,this.pos),me=this.readComplexInterpolation(ge),de=this.pos-G;g.push(Pi.Interpolation(!0,C!=-1,me,M,de));let Oe=this.input;m+=le.string(de!=null?p.substr(Oe,G,de):p.substr(Oe,G,null))}else{let ue=p.cca(this.input,this.pos),oe=ue??-1;if(oe>=97&&oe<=122||oe>=65&&oe<=90||oe==95){let ge=new he(U,K+1,this.pos),me=this.readFieldAccessInterpolation(ge),de=this.pos-G;g.push(Pi.Interpolation(!1,C!=-1,me,M,de));let Oe=this.input;m+=le.string(de!=null?p.substr(Oe,G,de):p.substr(Oe,G,null))}else{let ge=p.cca(this.input,this.pos);if((ge??-1)==36){m+=String.fromCodePoint(36),m+=String.fromCodePoint(36);let me=0,de=1;for(;me<de;){let Oe=me++;if(this.pos>=this.length)break;let Ve=p.cca(this.input,this.pos);(Ve??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I}else{this.error("Expected identifier or { after $",!1);let me=this.pos-G;g.push(Pi.Interpolation(!1,C!=-1,[],M,me));let de=this.input;m+=le.string(me!=null?p.substr(de,G,me):p.substr(de,G,null))}}}}catch(Y){let $=b.caught(Y).unwrap();if($ instanceof ll){let se=$;throw se.pos==null&&(se.pos=new he(U,K,this.pos)),b.thrown(se)}else throw Y}I=K+(this.pos-G)}else{L==10?(++v,I=1):++I,m+=String.fromCodePoint(L);let M=0,U=1;for(;M<U;){let K=M++;if(this.pos>=this.length)break;let G=p.cca(this.input,this.pos);(G??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}}}}}if(F){let A=m,L=A.length;A=Ae.rtrim(A);let z=A.length,D=L-z;if(z>0&&this.hasNonSpecialChar(A)&&(!o||!this.isNumber(A)&&A!="null"&&A!="true"&&A!="false")){if(h==-1&&!a&&!this.inChoiceRoot()){let K=this.line,G=this.column,Y=this.pos,$=!0;$==null&&($=!1);let se=$;se==null&&(se=!1);let ue=this._skipWhitespaceAndComments(this.pos,se);for(;this.pos<ue;){let ge=0,me=1;for(;ge<me;){let de=ge++;if(this.pos>=this.length)break;let Oe=p.cca(this.input,this.pos);(Oe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let oe=this.pos;if(this.column==y){let ge=this.tryReadUnquotedString();if(ge!=null){let me=this.input,de=Y-D,Oe=oe!=null?me.substring(de,oe):me.substring(de),Ve=ge.type;if(Ve._hx_index==15){let et=Ve.quotes,Ue=Ve.s,Ge=Ve.attachments;if(Ge!=null){let nt=0;for(;nt<Ge.length;){let De=Ge[nt];switch(++nt,De._hx_index){case 0:let H=De.braces,ie=De.inTag,R=De.expr,ee=De.start,X=De.length;g.push(Pi.Interpolation(H,ie,R,ee+oe-T,X));break;case 1:let Q=De.closing,ae=De.start,_e=De.length;g.push(Pi.Tag(Q,ae+oe-T,_e));break}}}A+=Oe,A+=Ue}D=0;let je=this.pos-1;for(;;){let et;if(je>=0){let Ue=p.cca(this.input,je);if((Ue??-1)!=32){let Ge=p.cca(this.input,je);et=(Ge??-1)==9}else et=!0}else et=!1;if(!et)break;++D,--je}}else this.line=K,this.column=G,this.pos=Y}else this.line=K,this.column=G,this.pos=Y}g.sort(function(K,G){return yt.compareAttachments(K,G)});let O=g.length>0?g:null,q=f;q==null&&(q=new he(this.startLine,this.startColumn,this.pos)),q.length=this.pos-q.offset;let M=new ke(x.LString(0,A,O),q);this.previous=M;let U=M;return U.pos.length-=D,U}}return this.line=w,this.column=y,this.pos=T,null}readString(e){let t=0,i=1;for(;t<i;){let c=t++;if(this.pos>=this.length)break;let _=p.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let l="",n=[],s=!1,r=-1,h=!1,a=e.column+1,o=e.line,u=this.parentBlockType()==x.KwBeat;for(;this.pos<this.length;){let c=p.cca(this.input,this.pos),_=c??-1;if(s){l+=String.fromCodePoint(92),l+=String.fromCodePoint(_),s=!1;let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}a+=2}else if(_==92){s=!0;let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(_==34&&r==-1){let f=0,m=1;for(;f<m;){let T=f++;if(this.pos>=this.length)break;let E=p.cca(this.input,this.pos);(E??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}n.sort(function(T,E){return yt.compareAttachments(T,E)});let g=n.length>0?n:null,w=e;w==null&&(w=new he(this.startLine,this.startColumn,this.pos)),w.length=this.pos-w.offset;let y=new ke(x.LString(1,l,g),w);return this.previous=y,y}else if(u&&_==60){r!=-1&&this.error("Unexpected < inside tag",!0);let f;if(this.pos+1<this.length){let y=p.cca(this.input,this.pos+1);f=y??-1}else f=0;h=f==47;let m=this.pos+(h?2:1);if(m<this.length){let y=p.cca(this.input,m),T=y??-1;(T>=97&&T<=122||T>=65&&T<=90||T==95||T==95||T==36||h&&T==62)&&(r=l.length)}l+=String.fromCodePoint(_);let g=0,w=1;for(;g<w;){let y=g++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++a}else if(_==62){l+=String.fromCodePoint(_);let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++a,r!=-1&&(n.push(Pi.Tag(h,r,l.length-r)),r=-1)}else if(_==36&&!s){let f=l.length,m=o,g=a,w=this.pos;try{let y=0,T=1;for(;y<T;){let C=y++;if(this.pos>=this.length)break;let P=p.cca(this.input,this.pos);(P??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++a;let E=p.cca(this.input,this.pos);if((E??-1)==123){let C=0,P=1;for(;C<P;){let A=C++;if(this.pos>=this.length)break;let L=p.cca(this.input,this.pos);(L??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++a;let I=new he(m,g+2,this.pos),v=this.readComplexInterpolation(I),F=this.pos-w;n.push(Pi.Interpolation(!0,r!=-1,v,f,F));let B=this.input;l+=le.string(F!=null?p.substr(B,w,F):p.substr(B,w,null))}else{let C=p.cca(this.input,this.pos),P=C??-1;if(P>=97&&P<=122||P>=65&&P<=90||P==95){let I=new he(m,g+1,this.pos),v=this.readFieldAccessInterpolation(I),F=this.pos-w;n.push(Pi.Interpolation(!1,r!=-1,v,f,F));let B=this.input;l+=le.string(F!=null?p.substr(B,w,F):p.substr(B,w,null))}else{let I=p.cca(this.input,this.pos);if((I??-1)==36){l+=String.fromCodePoint(36),l+=String.fromCodePoint(36);let v=0,F=1;for(;v<F;){let B=v++;if(this.pos>=this.length)break;let A=p.cca(this.input,this.pos);(A??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++a}else{this.error("Expected identifier or { after $",!1);let v=this.pos-w;n.push(Pi.Interpolation(!1,r!=-1,[],f,v));let F=this.input;l+=le.string(v!=null?p.substr(F,w,v):p.substr(F,w,null))}}}}catch(y){let T=b.caught(y).unwrap();if(T instanceof ll){let E=T;throw E.pos==null&&(E.pos=new he(m,g,this.pos)),b.thrown(E)}else throw y}a=g+(this.pos-w)}else{_==10?(++o,a=1):++a,l+=String.fromCodePoint(_);let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}return this.error("Unterminated string",!0),null}readComplexInterpolation(e){this.strictExprs.push(1);let t=[],i=1,l=e.column,n=e.line;for(;this.pos<this.length&&i>0;){let s=p.cca(this.input,this.pos);if((s??-1)==34){let h=new he(n,l,this.pos);t.push(this.readString(h)),l+=this.pos-h.offset;continue}let r=this.nextToken();if(t.push(r),r.type==x.LineBreak)++n,l=1;else if(!(r.type==x.Indent||r.type==x.Unindent)){let h,a=r.type;switch(a._hx_index){case 15:let o=a.attachments,u=a.quotes;h=a.s.length+(u!=0?2:0);break;case 16:let _=a.n;h=(_==null?"null":""+_).length;break;case 19:h=a.name.length;break;default:h=1}l+=h}switch(r.type._hx_index){case 45:++i;break;case 46:--i;break;default:}r.type==x.Eof&&this.error("Unterminated interpolation expression",!0)}return t.pop(),this.strictExprs.pop(),t}nextTokenWithPosition(e){let t=this.line,i=this.column,l=this.pos,n=this.nextToken(),s=n.pos.length,r=this.pos-l;return n.pos=new he(e.line,e.column+r,e.offset+r,s),this.line=t,this.column=i,n}readFieldAccessInterpolation(e){this.strictExprs.push(1);let t=[],i=p.cca(this.input,this.pos),l=i??-1;l>=97&&l<=122||l>=65&&l<=90||l==95||this.error("Expected identifier in field access",!0);let n=this.pos;for(;this.pos<this.length;){let o=p.cca(this.input,this.pos),u=o??-1;if(!(u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57))break;let c=0,_=1;for(;c<_;){let f=c++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let s=this.input,r=this.pos-n,h=r!=null?p.substr(s,n,r):p.substr(s,n,null),a=Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,h)?yt.KEYWORDS.h[h]:x.Identifier(h);t.push(new ke(a,new he(e.line,e.column,n,this.pos-n)));e:for(;this.pos<this.length;){let o=p.cca(this.input,this.pos);switch(o??-1){case 40:t.push(new ke(x.LParen,new he(this.line,this.column,this.pos,1)));let u=0,c=1;for(;u<c;){let y=u++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.push(10),this.strictExprs.push(1);let _=1;for(;this.pos<this.length&&_>0;){let y=p.cca(this.input,this.pos);if((y??-1)==41){if(--_,_==0){t.push(new ke(x.RParen,new he(this.line,this.column,this.pos,1)));let E=0,C=1;for(;E<C;){let P=E++;if(this.pos>=this.length)break;let I=p.cca(this.input,this.pos);(I??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.pop(),this.strictExprs.pop();break}}else{let E=p.cca(this.input,this.pos);(E??-1)==40&&++_}let T=p.cca(this.input,this.pos);if((T??-1)==44){t.push(new ke(x.Comma,new he(this.line,this.column,this.pos,1)));let E=0,C=1;for(;E<C;){let P=E++;if(this.pos>=this.length)break;let I=p.cca(this.input,this.pos);(I??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else t.push(this.nextToken())}_>0&&this.error("Unterminated function call in interpolation",!0);break;case 46:let f;if(this.pos+1<this.length){let y=p.cca(this.input,this.pos+1),T=y??-1;f=T>=97&&T<=122||T>=65&&T<=90||T==95}else f=!1;if(f){t.push(new ke(x.Dot,new he(this.line,this.column,this.pos,1)));let y=0,T=1;for(;y<T;){let F=y++;if(this.pos>=this.length)break;let B=p.cca(this.input,this.pos);(B??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let E=this.pos;for(;this.pos<this.length;){let F=p.cca(this.input,this.pos),B=F??-1;if(!(B>=97&&B<=122||B>=65&&B<=90||B==95||B>=48&&B<=57))break;let A=0,L=1;for(;A<L;){let z=A++;if(this.pos>=this.length)break;let D=p.cca(this.input,this.pos);(D??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let C=this.input,P=this.pos-E,I=P!=null?p.substr(C,E,P):p.substr(C,E,null),v=Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,I)?yt.KEYWORDS.h[I]:x.Identifier(I);t.push(new ke(v,new he(this.line,this.column-(this.pos-E),E)))}else break e;break;case 91:t.push(new ke(x.LBracket,new he(this.line,this.column,this.pos,1)));let m=0,g=1;for(;m<g;){let y=m++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.push(12),this.strictExprs.push(1);let w=1;for(;this.pos<this.length&&w>0;){let y=p.cca(this.input,this.pos);if((y??-1)==93){if(--w,w==0){t.push(new ke(x.RBracket,new he(this.line,this.column,this.pos,1)));let T=0,E=1;for(;T<E;){let C=T++;if(this.pos>=this.length)break;let P=p.cca(this.input,this.pos);(P??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.pop(),this.strictExprs.pop();break}}else{let T=p.cca(this.input,this.pos);(T??-1)==91&&++w}t.push(this.nextToken())}w>0&&this.error("Unterminated array access in interpolation",!0);break;default:break e}}return this.strictExprs.pop(),t}readIdentifierTokenInInterpolation(e){let t=this.makePositionRelativeTo(e),i=this.pos;for(;this.pos<this.length;){let h=p.cca(this.input,this.pos),a=h??-1;if(!(a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57))break;let o=0,u=1;for(;o<u;){let c=o++;if(this.pos>=this.length)break;let _=p.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let l=this.input,n=this.pos-i,s=n!=null?p.substr(l,i,n):p.substr(l,i,null),r=Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,s)?yt.KEYWORDS.h[s]:x.Identifier(s);return new ke(r,t)}makePositionRelativeTo(e){let t=e.line,i=e.column,l=e.offset;for(;l<this.pos;){let n=p.cca(this.input,l);(n??-1)==10?(++t,i=1):++i,++l}return new he(t,i,this.pos,e.length)}readLineComment(){let e=new he(this.startLine,this.startColumn,this.pos),t=2;t==null&&(t=1);let i=0,l=t;for(;i<l;){let u=i++;if(this.pos>=this.length)break;let c=p.cca(this.input,this.pos);(c??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let n=this.pos;for(;this.pos<this.length;){let u=p.cca(this.input,this.pos),c=u??-1;if(c==10||c==13)break;let _=0,f=1;for(;_<f;){let m=_++;if(this.pos>=this.length)break;let g=p.cca(this.input,this.pos);(g??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let s=this.input,r=this.pos-n,h=r!=null?p.substr(s,n,r):p.substr(s,n,null),a=e;a==null&&(a=new he(this.startLine,this.startColumn,this.pos)),a.length=this.pos-a.offset;let o=new ke(x.CommentLine(h),a);return this.previous=o,o}readMultiLineComment(){let e=new he(this.startLine,this.startColumn,this.pos),t=2;t==null&&(t=1);let i=0,l=t;for(;i<l;){let r=i++;if(this.pos>=this.length)break;let h=p.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let n=this.pos,s=1;for(;this.pos<this.length&&s>0;){let r,h=p.cca(this.input,this.pos);if((h??-1)==42){let a;if(this.pos+1<this.length){let o=p.cca(this.input,this.pos+1);a=o??-1}else a=0;r=a==47}else r=!1;if(r){if(--s,s==0){let c=this.input,_=this.pos-n,f=_!=null?p.substr(c,n,_):p.substr(c,n,null),m=2;m==null&&(m=1);let g=0,w=m;for(;g<w;){let E=g++;if(this.pos>=this.length)break;let C=p.cca(this.input,this.pos);(C??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let y=e;y==null&&(y=new he(this.startLine,this.startColumn,this.pos)),y.length=this.pos-y.offset;let T=new ke(x.CommentMultiLine(f),y);return this.previous=T,T}let a=2;a==null&&(a=1);let o=0,u=a;for(;o<u;){let c=o++;if(this.pos>=this.length)break;let _=p.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let a,o=p.cca(this.input,this.pos);if((o??-1)==47){let u;if(this.pos+1<this.length){let c=p.cca(this.input,this.pos+1);u=c??-1}else u=0;a=u==42}else a=!1;if(a){++s;let u=2;u==null&&(u=1);let c=0,_=u;for(;c<_;){let f=c++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let u=0,c=1;for(;u<c;){let _=u++;if(this.pos>=this.length)break;let f=p.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}return this.error("Unterminated multi-line comment",!0),null}readHashComment(){let e=new he(this.startLine,this.startColumn,this.pos),t=0,i=1;for(;t<i;){let o=t++;if(this.pos>=this.length)break;let u=p.cca(this.input,this.pos);(u??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let l=this.pos;for(;this.pos<this.length;){let o=p.cca(this.input,this.pos),u=o??-1;if(u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57||u==45){let c=0,_=1;for(;c<_;){let f=c++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else break}let n=this.input,s=this.pos-l,r=s!=null?p.substr(n,l,s):p.substr(n,l,null),h=e;h==null&&(h=new he(this.startLine,this.startColumn,this.pos)),h.length=this.pos-h.offset;let a=new ke(x.CommentHash(r),h);return this.previous=a,a}readNumber(){let e=new he(this.startLine,this.startColumn,this.pos),t=this.pos;for(;;){let u;if(this.pos<this.length){let f=p.cca(this.input,this.pos),m=f??-1;u=m>=48&&m<=57}else u=!1;if(!u)break;let c=0,_=1;for(;c<_;){let f=c++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let i,l;if(this.pos<this.length){let u=p.cca(this.input,this.pos);l=(u??-1)==46}else l=!1;if(l&&this.pos+1<this.length){let u=p.cca(this.input,this.pos+1),c=u??-1;i=c>=48&&c<=57}else i=!1;if(i){let u=0,c=1;for(;u<c;){let _=u++;if(this.pos>=this.length)break;let f=p.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}for(;;){let _;if(this.pos<this.length){let g=p.cca(this.input,this.pos),w=g??-1;_=w>=48&&w<=57}else _=!1;if(!_)break;let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}let n=this.input,s=this.pos-t,r=x.LNumber(parseFloat(s!=null?p.substr(n,t,s):p.substr(n,t,null))),h=e;h==null&&(h=new he(this.startLine,this.startColumn,this.pos)),h.length=this.pos-h.offset;let a=new ke(r,h);return this.previous=a,a}readIdentifier(){let e=new he(this.startLine,this.startColumn,this.pos),t=this.pos;for(;this.pos<this.length;){let a=p.cca(this.input,this.pos),o=a??-1;if(!(o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57))break;let u=0,c=1;for(;u<c;){let _=u++;if(this.pos>=this.length)break;let f=p.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let i=this.input,l=this.pos-t,n=l!=null?p.substr(i,t,l):p.substr(i,t,null);if(n=="function")return this.readFunction(e);let s=Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,n)?yt.KEYWORDS.h[n]:x.Identifier(n);if(this.previous!=null&&this.previous.type==x.Dot&&s!=null)switch(s._hx_index){case 8:case 9:case 10:case 11:case 12:s=x.Identifier(n);break;default:}let r=e;r==null&&(r=new he(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ke(s,r);return this.previous=h,h}readFunction(e){let t=!1;t==null&&(t=!1);let i=this._skipWhitespaceAndComments(this.pos,t);for(;this.pos<i;){let O=0,q=1;for(;O<q;){let M=O++;if(this.pos>=this.length)break;let U=p.cca(this.input,this.pos);(U??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let l=e.column,n=null,s=p.cca(this.input,this.pos),r=s??-1;if(r>=97&&r<=122||r>=65&&r<=90||r==95){let O=this.pos;for(;;){let U;if(this.pos<this.length){let Y=p.cca(this.input,this.pos),$=Y??-1;U=$>=97&&$<=122||$>=65&&$<=90||$==95||$>=48&&$<=57}else U=!1;if(!U)break;let K=0,G=1;for(;K<G;){let Y=K++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let q=this.input,M=this.pos-O;n=M!=null?p.substr(q,O,M):p.substr(q,O,null)}let h=!1;h==null&&(h=!1);let a=this._skipWhitespaceAndComments(this.pos,h);for(;this.pos<a;){let O=0,q=1;for(;O<q;){let M=O++;if(this.pos>=this.length)break;let U=p.cca(this.input,this.pos);(U??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let o;if(this.pos<this.length){let O=p.cca(this.input,this.pos);o=(O??-1)!=40}else o=!0;o&&this.error("Expected opening parenthesis after function name",!0);let u=0,c=[],_=0,f=1;for(;_<f;){let O=_++;if(this.pos>=this.length)break;let q=p.cca(this.input,this.pos);(q??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}u=1;let m=new Xt;for(;this.pos<this.length&&u>0;){let O=p.cca(this.input,this.pos),q=O??-1;if(q==47){let M=this.pos,U=!1;U==null&&(U=!1);let K=this._skipWhitespaceAndComments(this.pos,U);for(;this.pos<K;){let G=0,Y=1;for(;G<Y;){let $=G++;if(this.pos>=this.length)break;let se=p.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}if(this.pos==M){let G=0,Y=1;for(;G<Y;){let $=G++;if(this.pos>=this.length)break;let se=p.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error('Invalid character "/"',!1)}}else if(q==40){++u,m.b+=String.fromCodePoint(q);let M=0,U=1;for(;M<U;){let Y=M++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let K=!1;K==null&&(K=!1);let G=this._skipWhitespaceAndComments(this.pos,K);for(;this.pos<G;){let Y=0,$=1;for(;Y<$;){let se=Y++;if(this.pos>=this.length)break;let ue=p.cca(this.input,this.pos);(ue??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else if(q==41){if(--u,u>0)m.b+=String.fromCodePoint(q);else{let Y=Ae.trim(m.b);Y.length>0&&c.push(Y)}let M=0,U=1;for(;M<U;){let Y=M++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let K=!1;K==null&&(K=!1);let G=this._skipWhitespaceAndComments(this.pos,K);for(;this.pos<G;){let Y=0,$=1;for(;Y<$;){let se=Y++;if(this.pos>=this.length)break;let ue=p.cca(this.input,this.pos);(ue??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else if(q==44&&u==1){let M=Ae.trim(m.b);M.length>0&&c.push(M),m=new Xt;let U=0,K=1;for(;U<K;){let $=U++;if(this.pos>=this.length)break;let se=p.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let G=!1;G==null&&(G=!1);let Y=this._skipWhitespaceAndComments(this.pos,G);for(;this.pos<Y;){let $=0,se=1;for(;$<se;){let ue=$++;if(this.pos>=this.length)break;let oe=p.cca(this.input,this.pos);(oe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else{m.b+=String.fromCodePoint(q);let M=0,U=1;for(;M<U;){let K=M++;if(this.pos>=this.length)break;let G=p.cca(this.input,this.pos);(G??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}u>0&&this.error("Unclosed parentheses in function declaration",!1);let g=!1;g==null&&(g=!1);let w=this._skipWhitespaceAndComments(this.pos,g);for(;this.pos<w;){let O=0,q=1;for(;O<q;){let M=O++;if(this.pos>=this.length)break;let U=p.cca(this.input,this.pos);(U??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let y;if(this.pos<this.length){let O=p.cca(this.input,this.pos);y=(O??-1)==123}else y=!1;let T=this.pos,E=this.line,C=this.column;if(y){let O=0,q=1;for(;O<q;){let U=O++;if(this.pos>=this.length)break;let K=p.cca(this.input,this.pos);(K??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let M=1;for(;this.pos<this.length&&M>0;){let U=p.cca(this.input,this.pos),K=U??-1;if(K==34){let $=0,se=1;for(;$<se;){let ue=$++;if(this.pos>=this.length)break;let oe=p.cca(this.input,this.pos);(oe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.skipQuotedString();continue}K==123?++M:K==125&&--M;let G=0,Y=1;for(;G<Y;){let $=G++;if(this.pos>=this.length)break;let se=p.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}M>0&&this.error("Unclosed braces in function body",!1)}else{let O=-1,q=!0;for(;this.pos<this.length;){let M=p.cca(this.input,this.pos),U=M??-1;if(U==10||U==13){T=this.pos,E=this.line,C=this.column;let Y=0,$=1;for(;Y<$;){let se=Y++;if(this.pos>=this.length)break;let ue=p.cca(this.input,this.pos);(ue??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}q=!0;break}let K=0,G=1;for(;K<G;){let Y=K++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}for(;this.pos<this.length;){if(q){let Y=0,$=this.pos;for(;this.pos<this.length;){let oe=p.cca(this.input,this.pos),ge=oe??-1;if(ge==32)++Y;else if(ge==9)++Y;else break;let me=0,de=1;for(;me<de;){let Oe=me++;if(this.pos>=this.length)break;let Ve=p.cca(this.input,this.pos);(Ve??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let se,ue;if(O==-1&&this.pos<this.length){let oe=p.cca(this.input,this.pos);ue=(oe??-1)!=10}else ue=!1;if(ue){let oe=p.cca(this.input,this.pos);se=(oe??-1)!=13}else se=!1;if(se){if(O=Y,O<l){this.pos=$;break}}else{let oe;if(O!=-1&&Y<O)if(this.pos<this.length){let ge=p.cca(this.input,this.pos);if((ge??-1)!=10){let me=p.cca(this.input,this.pos);oe=(me??-1)!=13}else oe=!1}else oe=!0;else oe=!1;if(oe){this.pos=$;break}}q=!1}let M=p.cca(this.input,this.pos),U=M??-1;if(U==34){this.skipQuotedString();continue}(U==10||U==13)&&(T=this.pos,E=this.line,C=this.column,q=!0);let K=0,G=1;for(;K<G;){let Y=K++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}this.pos=T,this.line=E,this.column=C;let P=this.pos,I=this.input,v=e.offset,F=P-e.offset,B=Ae.rtrim(F!=null?p.substr(I,v,F):p.substr(I,v,null)),A=B.indexOf(`
|
|
38
|
-
`,null)==-1;
|
|
39
|
-
`);let L=e;L==null&&(L=new he(this.startLine,this.startColumn,this.pos)),L.length=this.pos-L.offset;let z=new ke(x.Function(n,c,B,A),L);this.previous=z;let D=z;return D.pos.length=B.length,D}skipQuotedString(){let e=!1,t=0,i=1;for(;t<i;){let l=t++;if(this.pos>=this.length)break;let n=p.cca(this.input,this.pos);(n??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}for(;this.pos<this.length;){let l=p.cca(this.input,this.pos),n=l??-1;if(e){e=!1;let s=0,r=1;for(;s<r;){let h=s++;if(this.pos>=this.length)break;let a=p.cca(this.input,this.pos);(a??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(n==92){e=!0;let s=0,r=1;for(;s<r;){let h=s++;if(this.pos>=this.length)break;let a=p.cca(this.input,this.pos);(a??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(n==34){let s=0,r=1;for(;s<r;){let h=s++;if(this.pos>=this.length)break;let a=p.cca(this.input,this.pos);(a??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}break}else if(n==36&&this.pos+1<this.length){let s=0,r=1;for(;s<r;){let a=s++;if(this.pos>=this.length)break;let o=p.cca(this.input,this.pos);(o??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let h;if(this.pos<this.length){let a=p.cca(this.input,this.pos);h=(a??-1)==123}else h=!1;if(h){let a=0,o=1;for(;a<o;){let c=a++;if(this.pos>=this.length)break;let _=p.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let u=1;for(;this.pos<this.length&&u>0;){let c=p.cca(this.input,this.pos),_=c??-1;if(_==34){this.skipQuotedString();continue}else _==123?++u:_==125&&--u;if(u>0||_!=125){let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}break}}}else{let a=p.cca(this.input,this.pos),o=a??-1;if(o>=97&&o<=122||o>=65&&o<=90||o==95)for(;;){let u;if(this.pos<this.length){let f=p.cca(this.input,this.pos),m=f??-1;u=m>=97&&m<=122||m>=65&&m<=90||m==95||m>=48&&m<=57}else u=!1;if(!u)break;let c=0,_=1;for(;c<_;){let f=c++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}else{let s=0,r=1;for(;s<r;){let h=s++;if(this.pos>=this.length)break;let a=p.cca(this.input,this.pos);(a??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}makePosition(){return new he(this.startLine,this.startColumn,this.pos)}makeToken(e,t){t==null&&(t=new he(this.startLine,this.startColumn,this.pos)),t.length=this.pos-t.offset;let i=new ke(e,t);return this.previous=i,i}advance(e){e==null&&(e=1);let t=0,i=e;for(;t<i;){let l=t++;if(this.pos>=this.length)break;let n=p.cca(this.input,this.pos);(n??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}peek(e){if(e==null&&(e=1),this.pos+e<this.length){let t=p.cca(this.input,this.pos+e);return t??-1}else return 0}error(e,t){let i=new ll(e,new he(this.startLine,this.startColumn,this.pos));if(this.errors==null&&(this.errors=[]),this.errors.push(i),t)throw b.thrown(i);return i}getErrors(){return this.errors==null&&(this.errors=[]),this.errors}skipWhitespace(){for(;this.pos<this.length;){let e=p.cca(this.input,this.pos);switch(e??-1){case 9:case 32:let t=0,i=1;for(;t<i;){let l=t++;if(this.pos>=this.length)break;let n=p.cca(this.input,this.pos);(n??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}break;default:return}}}isDigit(e){return e>=48?e<=57:!1}isIdentifierStart(e){return e>=97&&e<=122||e>=65&&e<=90?!0:e==95}isLowerCase(e){return e>=97?e<=122:!1}isIdentifierPart(e){return e>=97&&e<=122||e>=65&&e<=90||e==95?!0:e>=48?e<=57:!1}static compareAttachments(e,t){let i;switch(e._hx_index){case 0:let n=e.braces,s=e.inTag,r=e.expr,h=e.length;i=e.start;break;case 1:let o=e.closing,u=e.length;i=e.start;break}let l;switch(t._hx_index){case 0:let n=t.braces,s=t.inTag,r=t.expr,h=t.length;l=t.start;break;case 1:let o=t.closing,u=t.length;l=t.start;break}return i-l}}j["loreline.Lexer"]=yt,yt.__name__="loreline.Lexer",Object.assign(yt.prototype,{__class__:yt});class pn{static parse(e,t,i,l){let n=new yt(e),s=n.tokenize(),r=n.getErrors();if(r!=null&&r.length>0)throw b.thrown(r[0]);let h=null;if(t!=null&&i!=null)return new Dl().resolve(t,s,i,function(c){throw b.thrown(c)},function(c,_){let f=new qi(s,new El(t,t,_,null));h=f.parse(),h.indentSize=n.detectedIndentSize;let m=f.getErrors();if(m!=null&&m.length>0)throw b.thrown(m[0]);l?.(h)}),h;let a=new qi(s);h=a.parse(),h.indentSize=n.detectedIndentSize;let o=a.getErrors();if(o!=null&&o.length>0)throw b.thrown(o[0]);return l?.(h),h}static play(e,t,i,l,n,s){let r=new bl(e,t,i,l,s);return r.start(n),r}static resume(e,t,i,l,n,s,r){let h=new bl(e,t,i,l,r);return h.restore(n),s!=null?h.start(s):h.resume(),h}static extractTranslations(e){return Mt.extractTranslations(e)}static print(e,t,i){let l=t,n=i;return new nl(l??" ",n??`
|
|
40
|
-
`).print(e)}static update(e){Hi.update(e)}}j["loreline.Loreline"]=Yi.loreline.Loreline=pn,pn.__name__="loreline.Loreline";class Re{constructor(e,t,i,l){if(e<0||e>65535)throw b.thrown("Section value ("+e+") should be between 0 and 65535");if(t<0||t>65535)throw b.thrown("Branch value ("+t+") should be between 0 and 65535");if(i<0||i>65535)throw b.thrown("Block value ("+i+") should be between 0 and 65535");if(l<0||l>65535)throw b.thrown("Node value ("+l+") should be between 0 and 65535");let n=e-32768,s=t-32768;n<0&&(n=n+65536&65535),s<0&&(s=s+65536&65535);let r=i-32768,h=l-32768;r<0&&(r=r+65536&65535),h<0&&(h=h+65536&65535),this.thisVal=new Di(n<<16|s&65535,r<<16|h&65535)}get_section(){let e=this.thisVal.high>>16&65535;return(e>=32768?e-65536:e)+32768}set_section(e){let t=e-32768;return t<0&&(t=t+65536&65535),this.thisVal=new Di(this.thisVal.high&65535|t<<16,this.thisVal.low),e}get_branch(){let e=this.thisVal.high&65535;return(e>=32768?e-65536:e)+32768}set_branch(e){let t=e-32768;return t<0&&(t=t+65536&65535),this.thisVal=new Di(this.thisVal.high&-65536|t,this.thisVal.low),e}get_block(){let e=this.thisVal.low>>16&65535;return(e>=32768?e-65536:e)+32768}set_block(e){let t=e-32768;return t<0&&(t=t+65536&65535),this.thisVal=new Di(this.thisVal.high,this.thisVal.low&65535|t<<16),e}get_node(){let e=this.thisVal.low&65535;return(e>=32768?e-65536:e)+32768}set_node(e){let t=e-32768;return t<0&&(t=t+65536&65535),this.thisVal=new Di(this.thisVal.high,this.thisVal.low&-65536|t),e}nextSection(){let e=this.thisVal.high>>16&65535,t=(e>=32768?e-65536:e)+32768;if(t==65535)throw b.thrown("Node id section overflow");return new Re(t+1,0,0,0)}nextBranch(){let e=this.thisVal.high&65535,t=(e>=32768?e-65536:e)+32768;if(t==65535)return this.nextSection();let i=this.thisVal.high>>16&65535;return new Re((i>=32768?i-65536:i)+32768,t+1,0,0)}nextBlock(){let e=this.thisVal.low>>16&65535,t=(e>=32768?e-65536:e)+32768;if(t==65535)return this.nextBranch();let i=this.thisVal.high>>16&65535,l=this.thisVal.high&65535;return new Re((i>=32768?i-65536:i)+32768,(l>=32768?l-65536:l)+32768,t+1,0)}nextNode(){let e=this.thisVal.low&65535,t=(e>=32768?e-65536:e)+32768;if(t==65535)return this.nextBlock();let i=this.thisVal.high>>16&65535,l=this.thisVal.high&65535,n=this.thisVal.low>>16&65535;return new Re((i>=32768?i-65536:i)+32768,(l>=32768?l-65536:l)+32768,(n>=32768?n-65536:n)+32768,t+1)}toInt64(){return this.thisVal}toString(){let e=this.thisVal.high>>16&65535,t=this.thisVal.high&65535,i=this.thisVal.low>>16&65535,l=this.thisVal.low&65535;return""+((e>=32768?e-65536:e)+32768)+"."+((t>=32768?t-65536:t)+32768)+"."+((i>=32768?i-65536:i)+32768)+"."+((l>=32768?l-65536:l)+32768)}static fromInt64(e){let t=new Re(32768,32768,32768,32768);return t.thisVal=e,t}static fromString(e){let t=e.split(".");return new Re(le.parseInt(t[0]),le.parseInt(t[1]),le.parseInt(t[2]),le.parseInt(t[3]))}static fromTwoInt32(e,t){return Re.fromInt64(new Di(e,t))}static packInt32(e,t){return e<0&&(e=e+65536&65535),t<0&&(t=t+65536&65535),e<<16|t&65535}static int32GetLow(e){let t=e&65535;return t>=32768?t-65536:t}static int32SetLow(e,t){return t<0&&(t=t+65536&65535),e&-65536|t}static int32GetHigh(e){let t=e>>16&65535;return t>=32768?t-65536:t}static int32SetHigh(e,t){return t<0&&(t=t+65536&65535),e&65535|t<<16}static equals(e,t){let i=e.thisVal,l=t.thisVal;return i.high==l.high?i.low==l.low:!1}}j["loreline.NodeId"]=Re,Re.__name__="loreline.NodeId",Object.assign(Re.prototype,{__class__:Re,__properties__:{set_node:"set_node",get_node:"get_node",set_block:"set_block",get_block:"get_block",set_branch:"set_branch",get_branch:"get_branch",set_section:"set_section",get_section:"get_section"}});class Gi{constructor(){this.map=new wi}get(e){let t=e.thisVal;return this.map._get(t.high,t.low)}set(e,t){let i=e.thisVal;this.map._set(i.high,i.low,t)}remove(e){let t=e.thisVal;this.map._remove(t.high,t.low)}exists(e){let t=e.thisVal;return this.map._exists(t.high,t.low)}clear(){this.map.clear()}iterator(){return new Hl(this.map)}keys(){return new jl(this.map)}keyValueIterator(){return new Jl(this.map)}}j["loreline.NodeIdMap"]=Gi,Gi.__name__="loreline.NodeIdMap",Object.assign(Gi.prototype,{__class__:Gi});class Hl{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._values[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return e}}j["loreline._Node.NodeIdMapIterator"]=Hl,Hl.__name__="loreline._Node.NodeIdMapIterator",Object.assign(Hl.prototype,{__class__:Hl});class jl{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._keys1[this.index],t=this.map._keys2[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return Re.fromTwoInt32(e,t)}}j["loreline._Node.NodeIdMapKeyIterator"]=jl,jl.__name__="loreline._Node.NodeIdMapKeyIterator",Object.assign(jl.prototype,{__class__:jl});class Jl{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._keys1[this.index],t=this.map._keys2[this.index],i=this.map._values[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return{key:Re.fromTwoInt32(e,t),value:i}}}j["loreline._Node.NodeIdMapKeyValueIterator"]=Jl,Jl.__name__="loreline._Node.NodeIdMapKeyValueIterator",Object.assign(Jl.prototype,{__class__:Jl});class Ft{constructor(e,t){Ft._hx_skip_constructor||this._hx_constructor(e,t)}_hx_constructor(e,t){this.id=Re.UNDEFINED,this.id=e,this.pos=t}type(){return"Node"}toJson(){return{id:this.id.toString(),type:this.type(),pos:this.pos.toJson()}}each(e){}static fromJson(e){return N.nodeFromJson(e)}}j["loreline.Node"]=Yi.loreline.Node=Ft,Ft.__name__="loreline.Node",Object.assign(Ft.prototype,{__class__:Ft});class Wi extends Ft{constructor(e,t,i,l,n){n==null&&(n=!1),super(e,t),this.content=i,this.multiline=l,this.isHash=n}type(){return"Comment"}toJson(){let e=super.toJson();return e.content=this.content,e.multiline=this.multiline,this.isHash&&(e.isHash=!0),e}}j["loreline.Comment"]=Wi,Wi.__name__="loreline.Comment",Wi.__super__=Ft,Object.assign(Wi.prototype,{__class__:Wi});class Le extends Ft{constructor(e,t,i,l){if(Ft._hx_skip_constructor){super();return}Ft._hx_skip_constructor=!0,super(),Ft._hx_skip_constructor=!1,this._hx_constructor(e,t,i,l)}_hx_constructor(e,t,i,l){super._hx_constructor(e,t),this.leadingComments=i,this.trailingComments=l}type(){return"AstNode"}eachComment(e){if(this.leadingComments!=null){let i=0,l=this.leadingComments;for(;i<l.length;){let n=l[i];++i,e(this,n)}}if(this.trailingComments!=null){let i=0,l=this.trailingComments;for(;i<l.length;){let n=l[i];++i,e(this,n)}}let t=this;this.each(function(i,l){if(i instanceof Le){let n=i;if(n.leadingComments!=null){let s=0,r=n.leadingComments;for(;s<r.length;){let h=r[s];++s,e(t,h)}}if(n.trailingComments!=null){let s=0,r=n.trailingComments;for(;s<r.length;){let h=r[s];++s,e(t,h)}}}})}each(e){if(super.each(e),this.leadingComments!=null){let t=0,i=this.leadingComments;for(;t<i.length;){let l=i[t];++t,e(l,this),l.each(e)}}if(this.trailingComments!=null){let t=0,i=this.trailingComments;for(;t<i.length;){let l=i[t];++t,e(l,this),l.each(e)}}}toJson(){let e=super.toJson();if(this.leadingComments!=null&&this.leadingComments.length>0||this.trailingComments!=null&&this.trailingComments.length>0){let t={};if(this.leadingComments!=null&&this.leadingComments.length>0){let i=[],l=0,n=this.leadingComments;for(;l<n.length;){let s=n[l];++l,i.push(s.toJson())}t.leading=i}if(this.trailingComments!=null&&this.trailingComments.length>0){let i=[],l=0,n=this.trailingComments;for(;l<n.length;){let s=n[l];++l,i.push(s.toJson())}t.trailing=i}e.comments=t}return e}}j["loreline.AstNode"]=Le,Le.__name__="loreline.AstNode",Le.__super__=Ft,Object.assign(Le.prototype,{__class__:Le});class at extends Le{constructor(e,t,i,l){super(e,t,i,l)}toJson(){return super.toJson()}type(){return"Expr"}}j["loreline.NExpr"]=at,at.__name__="loreline.NExpr",at.__super__=Le,Object.assign(at.prototype,{__class__:at});class Wt extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.temporary=i,this.fields=l,this.style=0}type(){return"State"}get(e){let t=0,i=this.fields;for(;t<i.length;){let l=i[t];if(++t,l.name==e)return l.value}return null}each(e){if(super.each(e),this.fields!=null){let t=0,i=this.fields.length;for(;t<i;){let l=t++,n=this.fields[l];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.temporary=this.temporary;let t=[],i=0,l=this.fields;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.fields=t,e.style=Bi.toString(this.style),e}}j["loreline.NStateDecl"]=Wt,Wt.__name__="loreline.NStateDecl",Wt.__super__=Le,Object.assign(Wt.prototype,{__class__:Wt});class Fi extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.name=i,this.value=l}type(){return"Field"}each(e){super.each(e),this.value!=null&&(e(this.value,this),this.value.each(e))}toJson(){let e=super.toJson();return e.name=this.name,e.value=this.value.toJson(),e}}j["loreline.NObjectField"]=Fi,Fi.__name__="loreline.NObjectField",Fi.__super__=Le,Object.assign(Fi.prototype,{__class__:Fi});class zt extends Le{constructor(e,t,i,l,n,s,r){super(e,t,s,r),this.name=i,this.namePos=l,this.fields=n,this.style=0}type(){return"Character"}get(e){let t=0,i=this.fields;for(;t<i.length;){let l=i[t];if(++t,l.name==e)return l.value}return null}each(e){if(super.each(e),this.fields!=null){let t=0,i=this.fields.length;for(;t<i;){let l=t++,n=this.fields[l];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.name=this.name,e.namePos=this.namePos.toJson();let t=[],i=0,l=this.fields;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.fields=t,e.style=Bi.toString(this.style),e}}j["loreline.NCharacterDecl"]=zt,zt.__name__="loreline.NCharacterDecl",zt.__super__=Le,Object.assign(zt.prototype,{__class__:zt});class Me extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.name=i,this.body=l,this.style=0}type(){return"Beat"}each(e){if(super.each(e),this.body!=null){let t=0,i=this.body.length;for(;t<i;){let l=t++,n=this.body[l];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.name=this.name;let t=[],i=0,l=this.body;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.body=t,e.style=Bi.toString(this.style),e}}j["loreline.NBeatDecl"]=Me,Me.__name__="loreline.NBeatDecl",Me.__super__=Le,Object.assign(Me.prototype,{__class__:Me});var ze=Qe["loreline.StringPartType"]={__ename__:"loreline.StringPartType",__constructs__:null,Raw:(d=function(k){return{_hx_index:0,text:k,__enum__:"loreline.StringPartType",toString:S}},d._hx_name="Raw",d.__params__=["text"],d),Expr:(d=function(k){return{_hx_index:1,expr:k,__enum__:"loreline.StringPartType",toString:S}},d._hx_name="Expr",d.__params__=["expr"],d),Tag:(d=function(k,e){return{_hx_index:2,closing:k,expr:e,__enum__:"loreline.StringPartType",toString:S}},d._hx_name="Tag",d.__params__=["closing","expr"],d)};ze.__constructs__=[ze.Raw,ze.Expr,ze.Tag];class Bi{static toString(e){switch(e){case 0:return"Plain";case 1:return"Braces"}}}class Cl{static toString(e){switch(e){case 0:return"Plain";case 2:return"Parens"}}}class Tl{static toString(e){switch(e){case 0:return"Sequence";case 1:return"Cycle";case 2:return"Once";case 3:return"Pick";case 4:return"Shuffle"}}}class Je extends at{constructor(e,t,i,l,n){super(e,t,l,n),this.partType=i}type(){return"Part"}each(e){super.each(e);let t=this.partType;switch(t._hx_index){case 0:let i=t.text;break;case 1:let l=t.expr;e(l,this),l.each(e);break;case 2:let n=t.closing,s=t.expr;e(s,this),s.each(e);break}}toJson(){let e=super.toJson(),t=this.partType;switch(t._hx_index){case 0:let i=t.text;e.part="Raw",e.text=i;break;case 1:let l=t.expr;e.part="Expr",e.expression=l.toJson();break;case 2:let n=t.closing,s=t.expr;e.part="Tag",e.closing=n,e.content=s.toJson();break}return e}}j["loreline.NStringPart"]=Je,Je.__name__="loreline.NStringPart",Je.__super__=at,Object.assign(Je.prototype,{__class__:Je});class Tt extends at{constructor(e,t,i,l,n,s){super(e,t,n,s),this.parts=l,this.quotes=i}type(){return"String"}each(e){if(super.each(e),this.parts!=null){let t=0,i=this.parts.length;for(;t<i;){let l=t++,n=this.parts[l];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],i=0,l=this.parts;for(;i<l.length;){let s=l[i];++i,t.push(s.toJson())}let n=t;return e.parts=n,e.quotes=nn.toString(this.quotes),e}}j["loreline.NStringLiteral"]=Tt,Tt.__name__="loreline.NStringLiteral",Tt.__super__=at,Object.assign(Tt.prototype,{__class__:Tt});class ci extends Le{constructor(e,t,i,l,n){super(e,t,l,n),this.content=i,this.conditionStyle=0}type(){return"Text"}each(e){super.each(e),this.content!=null&&(e(this.content,this),this.content.each(e)),this.condition!=null&&(e(this.condition,this),this.condition.each(e))}toJson(){let e=super.toJson();return e.content=this.content.toJson(),this.condition!=null&&(e.condition=this.condition.toJson(),e.conditionStyle=Cl.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}j["loreline.NTextStatement"]=ci,ci.__name__="loreline.NTextStatement",ci.__super__=Le,Object.assign(ci.prototype,{__class__:ci});class ti extends Le{constructor(e,t,i,l,n,s,r){super(e,t,s,r),this.character=i,this.characterPos=l,this.content=n,this.conditionStyle=0}type(){return"Dialogue"}each(e){super.each(e),this.content!=null&&(e(this.content,this),this.content.each(e)),this.condition!=null&&(e(this.condition,this),this.condition.each(e))}toJson(){let e=super.toJson();return e.character=this.character,e.characterPos=this.characterPos.toJson(),e.content=this.content.toJson(),this.condition!=null&&(e.condition=this.condition.toJson(),e.conditionStyle=Cl.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}j["loreline.NDialogueStatement"]=ti,ti.__name__="loreline.NDialogueStatement",ti.__super__=Le,Object.assign(ti.prototype,{__class__:ti});class mi extends Le{constructor(e,t,i,l,n){super(e,t,l,n),this.options=i,this.style=0}type(){return"Choice"}each(e){if(super.each(e),this.options!=null){let t=0,i=this.options.length;for(;t<i;){let l=t++,n=this.options[l];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],i=0,l=this.options;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.options=t,e.style=Bi.toString(this.style),e}}j["loreline.NChoiceStatement"]=mi,mi.__name__="loreline.NChoiceStatement",mi.__super__=Le,Object.assign(mi.prototype,{__class__:mi});class Et extends Le{constructor(e,t,i,l,n,s,r,h,a){super(e,t,h,a),this.text=i,this.insertion=l,this.condition=n,this.conditionStyle=s,this.body=r,this.style=0,this.once=!1}type(){return"Option"}each(e){if(super.each(e),this.body!=null){let t=0,i=this.body.length;for(;t<i;){let l=t++,n=this.body[l];e(n,this),n.each(e)}}this.text!=null&&(e(this.text,this),this.text.each(e)),this.insertion!=null&&(e(this.insertion,this),this.insertion.each(e)),this.condition!=null&&(e(this.condition,this),this.condition.each(e))}toJson(){let e=super.toJson();this.text!=null&&(e.text=this.text.toJson()),this.insertion!=null&&(e.insertion=this.insertion.toJson()),this.condition!=null&&(e.condition=this.condition.toJson(),e.conditionStyle=Cl.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson());let t=[],i=0,l=this.body;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.body=t,e.style=Bi.toString(this.style),this.once&&(e.once=!0),e}}j["loreline.NChoiceOption"]=Et,Et.__name__="loreline.NChoiceOption",Et.__super__=Le,Object.assign(Et.prototype,{__class__:Et});class ii extends Le{constructor(e,t,i,l,n){super(e,t,l,n),this.body=i,this.style=0}type(){return"Block"}each(e){if(super.each(e),this.body!=null){let t=0,i=this.body.length;for(;t<i;){let l=t++,n=this.body[l];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],i=0,l=this.body;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.body=t,e.style=Bi.toString(this.style),e}}j["loreline.NBlock"]=ii,ii.__name__="loreline.NBlock",ii.__super__=Le,Object.assign(ii.prototype,{__class__:ii});class gi extends Le{constructor(e,t,i,l,n,s,r,h,a,o){super(e,t,r,h),this.condition=i,this.conditionStyle=l,this.thenBranch=n,this.elseBranch=s,this.elseLeadingComments=a,this.elseTrailingComments=o}type(){return"If"}each(e){if(super.each(e),this.condition!=null&&(e(this.condition,this),this.condition.each(e)),this.thenBranch!=null&&(e(this.thenBranch,this),this.thenBranch.each(e)),this.elseBranch!=null&&(e(this.elseBranch,this),this.elseBranch.each(e)),this.elseLeadingComments!=null){let t=0,i=this.elseLeadingComments;for(;t<i.length;){let l=i[t];++t,e(l,this),l.each(e)}}if(this.elseTrailingComments!=null){let t=0,i=this.elseTrailingComments;for(;t<i.length;){let l=i[t];++t,e(l,this),l.each(e)}}}toJson(){let e=super.toJson();e.condition=this.condition.toJson(),e.conditionStyle=Cl.toString(this.conditionStyle);let t=[],i=0,l=this.thenBranch.body;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}if(e.thenBranch=t,e.thenStyle=Bi.toString(this.thenBranch.style),this.elseBranch!=null){let n=[],s=0,r=this.elseBranch.body;for(;s<r.length;){let h=r[s];++s,n.push(h.toJson())}if(e.elseBranch=n,e.elseStyle=Bi.toString(this.elseBranch.style),this.elseLeadingComments!=null&&this.elseLeadingComments.length>0||this.elseTrailingComments!=null&&this.elseTrailingComments.length>0){let h=e.comments,a=h??{};if(this.elseLeadingComments!=null&&this.elseLeadingComments.length>0){let o=[],u=0,c=this.elseLeadingComments;for(;u<c.length;){let _=c[u];++u,o.push(_.toJson())}a.elseLeading=o}if(this.elseTrailingComments!=null&&this.elseTrailingComments.length>0){let o=[],u=0,c=this.elseTrailingComments;for(;u<c.length;){let _=c[u];++u,o.push(_.toJson())}a.elseTrailing=o}e.comments=a}}return e}}j["loreline.NIfStatement"]=gi,gi.__name__="loreline.NIfStatement",gi.__super__=Le,Object.assign(gi.prototype,{__class__:gi});class Ui extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.mode=i,this.items=l,this.style=0}type(){return"Alternative"}each(e){if(super.each(e),this.items!=null){let t=0,i=this.items.length;for(;t<i;){let l=t++,n=this.items[l];e(n,this),n.each(e)}}if(this.separatorComments!=null){let t=0,i=this.separatorComments;for(;t<i.length;){let l=i[t];if(++t,l!=null){let n=0;for(;n<l.length;){let s=l[n];++n,e(s,this),s.each(e)}}}}}toJson(){let e=super.toJson();e.mode=Tl.toString(this.mode);let t=[],i=0,l=this.items;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}if(e.items=t,e.style=Bi.toString(this.style),this.separatorComments!=null){let n=[],s=0,r=this.separatorComments;for(;s<r.length;){let h=r[s];++s;let a;if(h!=null){let o=[],u=0;for(;u<h.length;){let c=h[u];++u,o.push(c.toJson())}a=o}else a=null;n.push(a)}e.separatorComments=n}return e}}j["loreline.NAlternative"]=Ui,Ui.__name__="loreline.NAlternative",Ui.__super__=Le,Object.assign(Ui.prototype,{__class__:Ui});class Rt extends at{constructor(e,t,i,l,n,s){super(e,t,n,s),this.target=i,this.args=l}type(){return"Call"}each(e){if(super.each(e),this.target!=null&&(e(this.target,this),this.target.each(e)),this.args!=null){let t=0,i=this.args;for(;t<i.length;){let l=i[t];++t,e(l,this),l.each(e)}}}toJson(){let e=super.toJson();e.target=this.target.toJson();let t=[],i=0,l=this.args;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.args=t,e}}j["loreline.NCall"]=Rt,Rt.__name__="loreline.NCall",Rt.__super__=at,Object.assign(Rt.prototype,{__class__:Rt});class Mi extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.target=i,this.targetPos=l}type(){return"Transition"}toJson(){let e=super.toJson();return e.target=this.target,e.targetPos=this.targetPos.toJson(),e}}j["loreline.NTransition"]=Mi,Mi.__name__="loreline.NTransition",Mi.__super__=Le,Object.assign(Mi.prototype,{__class__:Mi});class zi extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.target=i,this.targetPos=l}type(){return"Insertion"}toJson(){let e=super.toJson();return e.target=this.target,e.targetPos=this.targetPos.toJson(),e}}j["loreline.NInsertion"]=zi,zi.__name__="loreline.NInsertion",zi.__super__=Le,Object.assign(zi.prototype,{__class__:zi});class Li extends at{constructor(e,t,i,l,n,s,r,h){super(e,t,r,h),this.name=i,this.args=l,this.code=n,this.external=s}type(){return"Function"}toJson(){let e=super.toJson();return this.name!=null&&(e.name=this.name),e.args=[].concat(this.args),e.code=this.code,e.external=this.external,e}}j["loreline.NFunctionDecl"]=Li,Li.__name__="loreline.NFunctionDecl",Li.__super__=at,Object.assign(Li.prototype,{__class__:Li});class Ke extends at{constructor(e,t,i,l,n,s){super(e,t,n,s),this.value=i,this.literalType=l}type(){return"Literal"}each(e){super.each(e);let t=this.literalType;switch(t._hx_index){case 0:case 1:case 2:break;case 3:if(this.value!=null){let l=0,n=this.value;for(;l<n.length;){let s=n[l];if(++l,s instanceof Ft){let r=s;e(r,this),r.each(e)}}}break;case 4:let i=t.style;if(this.value!=null){let l=0,n=this.value;for(;l<n.length;){let s=n[l];if(++l,s.value instanceof Ft){let r=s.value;e(r,this),r.each(e)}}}break}}toJson(){let e=super.toJson(),t=this.literalType;e.literal=Qe[t.__enum__].__constructs__[t._hx_index]._hx_name;let i=this.literalType;switch(i._hx_index){case 0:case 1:case 2:e.value=this.value;break;case 3:if(this.value!=null){let n=[],s=0,r=this.value;for(;s<r.length;){let h=r[s];++s,h instanceof Ft?n.push(h.toJson()):n.push(h)}e.value=n}break;case 4:let l=i.style;if(this.value!=null){let n=[],s=0,r=this.value;for(;s<r.length;){let h=r[s];++s,n.push(h.toJson())}e.value=n}else e.value=[];e.style=Bi.toString(l);break}return e}}j["loreline.NLiteral"]=Ke,Ke.__name__="loreline.NLiteral",Ke.__super__=at,Object.assign(Ke.prototype,{__class__:Ke});var He=Qe["loreline.LiteralType"]={__ename__:"loreline.LiteralType",__constructs__:null,Number:{_hx_name:"Number",_hx_index:0,__enum__:"loreline.LiteralType",toString:S},Boolean:{_hx_name:"Boolean",_hx_index:1,__enum__:"loreline.LiteralType",toString:S},Null:{_hx_name:"Null",_hx_index:2,__enum__:"loreline.LiteralType",toString:S},Array:{_hx_name:"Array",_hx_index:3,__enum__:"loreline.LiteralType",toString:S},Object:(d=function(k){return{_hx_index:4,style:k,__enum__:"loreline.LiteralType",toString:S}},d._hx_name="Object",d.__params__=["style"],d)};He.__constructs__=[He.Number,He.Boolean,He.Null,He.Array,He.Object];class ut extends at{constructor(e,t,i,l,n,s){super(e,t,n,s),this.target=i,this.name=l}type(){return"Access"}each(e){super.each(e),this.target!=null&&(e(this.target,this),this.target.each(e))}toJson(){let e=super.toJson();return this.target!=null&&(e.target=this.target.toJson()),e.name=this.name,e}}j["loreline.NAccess"]=ut,ut.__name__="loreline.NAccess",ut.__super__=at,Object.assign(ut.prototype,{__class__:ut});class di extends at{constructor(e,t,i,l,n,s,r){super(e,t,s,r),this.target=i,this.op=l,this.value=n}type(){return"Assign"}each(e){super.each(e),this.target!=null&&(e(this.target,this),this.target.each(e)),this.value!=null&&(e(this.value,this),this.value.each(e))}toJson(){let e=super.toJson();return e.target=this.target.toJson(),e.op=le.string(this.op),e.value=this.value.toJson(),e}}j["loreline.NAssign"]=di,di.__name__="loreline.NAssign",di.__super__=at,Object.assign(di.prototype,{__class__:di});class pi extends at{constructor(e,t,i,l,n,s){super(e,t,n,s),this.target=i,this.index=l}type(){return"ArrayAccess"}each(e){super.each(e),this.target!=null&&(e(this.target,this),this.target.each(e)),this.index!=null&&(e(this.index,this),this.index.each(e))}toJson(){let e=super.toJson();return e.target=this.target.toJson(),e.index=this.index.toJson(),e}}j["loreline.NArrayAccess"]=pi,pi.__name__="loreline.NArrayAccess",pi.__super__=at,Object.assign(pi.prototype,{__class__:pi});class Qt extends at{constructor(e,t,i,l,n,s,r){super(e,t,s,r),this.left=i,this.op=l,this.right=n}type(){return"Binary"}each(e){super.each(e),this.left!=null&&(e(this.left,this),this.left.each(e)),this.right!=null&&(e(this.right,this),this.right.each(e))}toJson(){let e=super.toJson();return e.left=this.left.toJson(),e.op=le.string(this.op),e.right=this.right.toJson(),e}}j["loreline.NBinary"]=Qt,Qt.__name__="loreline.NBinary",Qt.__super__=at,Object.assign(Qt.prototype,{__class__:Qt});class Ki extends at{constructor(e,t,i,l,n,s){super(e,t,n,s),this.op=i,this.operand=l}type(){return"Unary"}each(e){super.each(e),this.operand!=null&&(e(this.operand,this),this.operand.each(e))}toJson(){let e=super.toJson();return e.op=le.string(this.op),e.operand=this.operand.toJson(),e}}j["loreline.NUnary"]=Ki,Ki.__name__="loreline.NUnary",Ki.__super__=at,Object.assign(Ki.prototype,{__class__:Ki});class $i extends at{constructor(e,t,i,l,n,s,r){super(e,t,s,r),this.condition=i,this.trueExpr=l,this.falseExpr=n}type(){return"Ternary"}each(e){super.each(e),this.condition!=null&&(e(this.condition,this),this.condition.each(e)),this.trueExpr!=null&&(e(this.trueExpr,this),this.trueExpr.each(e)),this.falseExpr!=null&&(e(this.falseExpr,this),this.falseExpr.each(e))}toJson(){let e=super.toJson();return e.condition=this.condition.toJson(),e.trueExpr=this.trueExpr.toJson(),e.falseExpr=this.falseExpr.toJson(),e}}j["loreline.NTernary"]=$i,$i.__name__="loreline.NTernary",$i.__super__=at,Object.assign($i.prototype,{__class__:$i});class Yt extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.path=i,this.script=l}each(e){super.each(e),this.script!=null&&(e(this.script,this),this.script.each(e))}type(){return"Import"}toJson(){let e=super.toJson();return e.path=this.path.toJson(),this.script!=null&&(e.script=this.script.toJson()),e}}j["loreline.NImportStatement"]=Yt,Yt.__name__="loreline.NImportStatement",Yt.__super__=Le,Object.assign(Yt.prototype,{__class__:Yt});class ne{static isFields(e){return te.__implements(e,vi)||e instanceof Ee?!0:e instanceof Ri||typeof e=="number"&&(e|0)===e||typeof e=="number"||typeof e=="boolean"||typeof e=="string"?!1:!re.isArray(e)}static getField(e,t,i){return te.__implements(t,vi)?t.lorelineGet(e,i):t instanceof Ee?t.h[i]:We.getProperty(t,i)}static getFields(e,t){if(te.__implements(t,vi))return t.lorelineFields(e);if(t instanceof Ee){let i=[],l=t.h,n=l,s=Object.keys(l),r=s.length,h=0;for(;h<r;){let a=s[h++];i.push(a)}return i}else return We.fields(t)}static setField(e,t,i,l){te.__implements(t,vi)?t.lorelineSet(e,i,l):t instanceof Ee?t.h[i]=l:We.setProperty(t,i,l)}static removeField(e,t,i){if(te.__implements(t,vi))return t.lorelineRemove(e,i);if(t instanceof Ee){let l=t;return Object.prototype.hasOwnProperty.call(l.h,i)?(delete l.h[i],!0):!1}else return We.deleteField(t,i)}static fieldExists(e,t,i){return te.__implements(t,vi)?t.lorelineExists(e,i):t instanceof Ee?Object.prototype.hasOwnProperty.call(t.h,i):Object.prototype.hasOwnProperty.call(t,i)}static getStringHelper(e,t){return e.stringHelpers.h[t]}static getArrayHelper(e,t){return e.arrayHelpers.h[t]}static getMapHelper(e,t){return e.mapHelpers.h[t]}static getBeatHelper(e,t){return e.beatHelpers.h[t]}static createFields(e,t,i){if(e!=null&&e.customCreateFields!=null){let l=e.customCreateFields(e,t,i);if(l!=null)return l}if(t!=null){let l=Object.create(j[t].prototype);return te.__implements(l,vi)&&l.lorelineCreate(e),l}return new Ee}}j["loreline.Objects"]=ne,ne.__name__="loreline.Objects";class Ne extends ai{constructor(e,t){super(e,t)}}j["loreline.ParseError"]=Ne,Ne.__name__="loreline.ParseError",Ne.__super__=ai,Object.assign(Ne.prototype,{__class__:Ne});class El{constructor(e,t,i,l){this.imported=new Ee,this.rootPath=e,this.path=t,this.imports=i,l!=null&&(this.imported=l)}}j["loreline.ParserContext"]=El,El.__name__="loreline.ParserContext",Object.assign(El.prototype,{__class__:El});class qi{constructor(e,t){this.tokens=e,this.current=0,this.errors=null,this.pendingComments=null,this.lastTokenEnd=new he(1,1,0),this.lastLineBreak=null,this.lineBreakAfterToken=!1,this.currentNodeId=Re.UNDEFINED,this.rootBeat=null,this.context=t}parse(){let e=this.currentPos(),t=[],i=new _i(this.nextNodeId(4),e,t);for(;!this.isAtEnd();)try{let l=this.parseNode(!0);for(l!=null&&t.push(l);this.match(x.LineBreak););}catch(l){let n=b.caught(l).unwrap();if(n instanceof Ne){let s=n;this.addError(s),this.synchronize()}else throw l}return this.attachComments(i),i}getErrors(){return this.errors==null&&(this.errors=[]),this.errors}nextNodeId(e){let t;switch(e){case 1:t=this.currentNodeId.nextSection();break;case 2:t=this.currentNodeId.nextBranch();break;case 3:t=this.currentNodeId.nextBlock();break;case 4:t=this.currentNodeId.nextNode();break}return this.currentNodeId=t,this.currentNodeId}peek(){let e=this.current+1;for(;e<this.tokens.length;){let t=this.tokens[e].type;switch(t._hx_index){case 51:let i=t.content;++e;break;case 52:let l=t.content;++e;break;case 53:let n=t.content;++e;break;case 56:++e;break;default:return this.tokens[e]}}return this.tokens[this.tokens.length-1]}advance(e){e==null&&(e=!0);let t=this.tokens[this.current];if(!this.isAtEnd()){for(this.lastTokenEnd=t.pos,this.lineBreakAfterToken=!1;!this.isAtEnd()&&this.tokens[this.current+1]!=null&&(this.isComment(this.tokens[this.current+1].type)||e&&this.tokens[this.current+1].type==x.LineBreak);){this.current++;let i=this.tokens[this.current].type;switch(i._hx_index){case 51:let l=i.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Wi(this.nextNodeId(4),this.currentPos(),l,!1));break;case 52:let n=i.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Wi(this.nextNodeId(4),this.currentPos(),n,!0));break;case 53:let s=i.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Wi(this.nextNodeId(4),this.currentPos(),s,!1,!0));break;case 56:this.lastLineBreak=this.currentPos(),this.lineBreakAfterToken=!0;break;default:}}this.current++}return t}previous(){return this.tokens[this.current-1]}prevWithType(e){let t=this.current-1;for(;t>=0;){if(Ot.equals(this.tokens[t].type,e))return this.tokens[t];--t}return null}prevIdentifier(){let e=this.current-1;for(;e>=0;){let t=this.tokens[e].type;if(t._hx_index==19){let i=t.name;return this.tokens[e]}--e}return null}prevNonWhitespaceOrComment(){let e=this.current-1;for(;e>=0;){let t=this.tokens[e].type;switch(t._hx_index){case 51:let i=t.content;break;case 52:let l=t.content;break;case 53:let n=t.content;break;case 54:case 55:case 56:break;default:return this.tokens[e]}--e}return null}nextNonWhitespaceOrComment(){let e=this.current;for(;e<this.tokens.length;){let t=this.tokens[e].type;switch(t._hx_index){case 51:let i=t.content;break;case 52:let l=t.content;break;case 53:let n=t.content;break;case 54:case 55:case 56:break;default:return this.tokens[e]}++e}return null}nextNonLineBreakOrComment(){let e=this.current;for(;e<this.tokens.length;){let t=this.tokens[e].type;switch(t._hx_index){case 51:let i=t.content;break;case 52:let l=t.content;break;case 53:let n=t.content;break;case 56:break;default:return this.tokens[e]}++e}return null}currentPos(){let e=this.tokens[this.current],t=e!=null?e.pos:null;return t??new he(1,1,0,0)}currentTokenTypeToString(){if(this.tokens!=null&&this.current>=0){let e=this.tokens[this.current],t=e!=null?e.type:null;return t!=null?Ot.toCodeString(t):null}return null}check(e){return this.isAtEnd()?!1:e._hx_index==41?this.tokens[this.current].type==x.Colon:Ot.equals(this.tokens[this.current].type,e)}checkString(){let e=this.tokens[this.current].type;if(e._hx_index==15){let t=e.attachments,i=e.quotes,l=e.s;return!0}else return!1}isAtEnd(){return this.current<this.tokens.length?this.tokens[this.current].type==x.Eof:!0}isComment(e){switch(e._hx_index){case 51:let t=e.content;return!0;case 52:let i=e.content;return!0;case 53:let l=e.content;return!0;default:return!1}}parseNode(e){for(e==null&&(e=!1);this.isComment(this.tokens[this.current].type)||this.tokens[this.current].type==x.LineBreak;){if(this.isComment(this.tokens[this.current].type)){this.pendingComments==null&&(this.pendingComments=[]);let l=this.pendingComments,n=this.nextNodeId(4),s=this.currentPos(),r=this.tokens[this.current].type,h;switch(r._hx_index){case 51:h=r.content;break;case 52:h=r.content;break;case 53:h=r.content;break;default:h=""}let a=this.tokens[this.current].type,o;if(a._hx_index==52){let _=a.content;o=!0}else o=!1;let u=this.tokens[this.current].type,c;if(u._hx_index==53){let _=u.content;c=!0}else c=!1;l.push(new Wi(n,s,h,o,c))}if(this.advance(),this.isAtEnd())throw b.thrown(new Ne("Unexpected end of file",this.currentPos()))}if(this.isAtEnd())throw b.thrown(new Ne("Unexpected end of file",this.currentPos()));let t=this,i=this.tokens[this.current].type;switch(i._hx_index){case 0:return this.parseImport();case 1:return this.parseStateDecl(!1);case 2:return this.parseBeatDecl();case 3:return e?this.parseCharacterDecl():(this.addError(new Ne("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null));case 4:let l=this.parseChoiceStatement();return e?t.wrapInRootBeat(l):l;case 5:let n=this.parseIfStatement();return e?t.wrapInRootBeat(n):n;case 7:if(this.advance(),!this.check(x.KwState))throw b.thrown(new Ne("Expected 'state' after 'new'",this.currentPos()));let s=this.parseStateDecl(!0);return e?t.wrapInRootBeat(s):s;case 8:case 9:case 10:case 11:case 12:let r=this.parseAlternative();return e?t.wrapInRootBeat(r):r;case 14:let h=i.name,a=i.args,o=i.code,u=i.external;return e?this.parseFunction():(this.addError(new Ne("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null));case 15:let c=i.quotes,_=i.s,f=i.attachments,m=this.parseTextStatement();return e?t.wrapInRootBeat(m):m;case 16:let g=i.n,w=this.parseExpressionStatement();return e?t.wrapInRootBeat(w):w;case 17:let y=i.b,T=this.parseExpressionStatement();return e?t.wrapInRootBeat(T):T;case 19:let E=i.name;if(this.peek().type==x.Colon){let v=this.parseDialogueStatement();return e?t.wrapInRootBeat(v):v}else{let v=this.parseExpressionStatement();return e?t.wrapInRootBeat(v):v}break;case 26:let C=this.parseInsertion();return e?t.wrapInRootBeat(C):C;case 18:case 27:case 39:case 45:case 47:case 49:let P=this.parseExpressionStatement();return e?t.wrapInRootBeat(P):P;case 40:let I=this.parseTransition();return e?t.wrapInRootBeat(I):I;default:return this.addError(new Ne("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null)}}wrapInRootBeat(e){let t,i=null;if(this.rootBeat==null){let l=this.currentPos();t=[],this.rootBeat=new Me(this.nextNodeId(1),l,"_",t),i=this.rootBeat}else t=this.rootBeat.body;return t.push(e),i}parseImport(){let e=this.currentPos();if(this.expect(x.KwImport),this.context==null)throw b.thrown(new Ne("Cannot import without a context",this.currentPos()));let t=0,i=this.tokens[this.current],l,n=i.type;if(n._hx_index==15){let c=n.attachments,_=n.quotes,f=n.s;t=_,l=f}else throw b.thrown(new Ne("Expected string literal for import path",this.currentPos()));let s=l;Nt.isAbsolute(s)||(s=Nt.join([Nt.directory(this.context.rootPath),s])),s=Nt.normalize(s);let r=".lor";if(this.context.rootPath.endsWith(".lor.txt")&&(r=".lor.txt"),s.toLowerCase().endsWith(r)||(s+=r),Object.prototype.hasOwnProperty.call(this.context.imported.h,s)){this.advance();let c=new Yt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,null);return c.path=new Tt(this.nextNodeId(4),i.pos,t,[new Je(this.nextNodeId(4),i.pos,ze.Raw(l))]),this.attachComments(c)}let h=this.context.imports.h[s];if(h==null)throw b.thrown(new Ne("Failed to import file at path "+s+" ("+l+")",this.currentPos()));let a=new qi(h,new El(this.context.rootPath,s,this.context.imports,this.context.imported));a.currentNodeId=this.currentNodeId;let o=a.parse();this.currentNodeId=a.currentNodeId,this.advance();let u=new Yt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,o);return u.path=new Tt(this.nextNodeId(4),i.pos,t,[new Je(this.nextNodeId(4),i.pos,ze.Raw(l))]),this.attachComments(u)}parseDialogueStatement(){let e=this.currentPos(),t=new ti(this.nextNodeId(4),e,null,null,null),i=this.tokens[this.current].type,l;if(i._hx_index==19)l=i.name;else throw b.thrown(new Ne("Expected character name",this.currentPos()));t.character=l,t.characterPos=this.tokens[this.current].pos,this.advance(),this.expect(x.Colon),this.attachComments(t);let n=!1;if(this.checkBlockStart()){let s=this.parseBlockStart();if(s.type!=x.Indent)throw b.thrown(new Ne("Expected indent, got "+Ot.toCodeString(s.type),s.pos));n=!0}try{t.content=this.parseStringLiteral()}catch(s){let r=b.caught(s).unwrap();if(r instanceof Ne){let h=r;this.addError(h),t.content=new Tt(this.nextNodeId(4),this.currentPos(),0,[new Je(this.nextNodeId(4),this.currentPos(),ze.Raw("?"))])}else throw s}if(!this.lineBreakAfterToken&&this.match(x.KwIf)){let s=this.previous().pos;this.check(x.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression(),t.conditionPos=s.extendedTo(this.prevNonWhitespaceOrComment().pos)}if(n){for(;this.match(x.LineBreak););this.expect(x.Unindent)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseStatementBlock(e){let t=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(;!this.check(t)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||t!=x.Unindent&&this.match(x.Unindent););if(this.check(t))break;try{e.push(this.parseNode())}catch(i){let l=b.caught(i).unwrap();if(l instanceof Ne){let n=l;if(this.errors==null&&(this.errors=[]),this.errors.push(n),this.synchronize(),this.check(t))break}else throw i}for(;this.match(x.LineBreak)||t!=x.Unindent&&this.match(x.Unindent););}return this.expect(t),t==x.RBrace?1:0}parseStateDecl(e){let t=this.currentPos(),i=new Wt(this.nextNodeId(3),t,e,[]);this.expect(x.KwState);let l=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(i.style=l==x.RBrace?1:0,this.attachComments(i);!this.check(l)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););for(i.fields.push(this.parseObjectField());this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););}for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););return this.expect(l),i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),i}parseObjectField(){let e=this.currentPos(),t=this.expectIdentifier(),i=new Fi(this.nextNodeId(3),e,t,null);return this.expect(x.Colon),this.attachComments(i),this.checkBlockStart()?i.value=this.parseObjectLiteral():i.value=this.parseExpression(),i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),i}parseBeatDecl(){let e=this.currentPos(),t=new Me(this.nextNodeId(1),e,null,[],[]);this.expect(x.KwBeat),t.pos=e.extendedTo(this.currentPos()),t.name=this.expectIdentifier();let l=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(t.style=l==x.RBrace?1:0,this.attachComments(t);!this.check(l)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););for(t.body.push(this.parseNode());this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););}for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););return this.expect(l),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}checkBlockStart(){let e=null,t=null,i=0,l=0;for(;this.current+l<this.tokens.length;){let n=this.tokens[this.current+l];if(++l,n.type!=x.LineBreak){if(n.type==x.Indent){++i,e=n;continue}if(n.type==x.LBrace){t==null&&(t=n);continue}break}}if(t!=null)return!0;if(e!=null){if(i>1)throw b.thrown(new Ne("Invalid indentation level",e.pos));return!0}else return!1}parseBlockStart(){let e=null,t=null,i=0;for(;!this.isAtEnd();)if(!this.match(x.LineBreak)){if(this.match(x.Indent)){++i,e=this.prevWithType(x.Indent);continue}if(this.match(x.LBrace)){t==null&&(t=this.prevWithType(x.LBrace));continue}break}if(t!=null)return t;if(e!=null){if(i>1)throw b.thrown(new Ne("Invalid indentation level",e.pos));return e}else return this.addError(new Ne("Expected "+Ot.toCodeString(x.LBrace)+" or "+Ot.toCodeString(x.Indent)+", got "+this.currentTokenTypeToString(),this.currentPos())),new ke(x.Indent,this.currentPos())}parseCharacterDecl(){let e=this.currentPos(),t=new zt(this.nextNodeId(3),e,null,null,[]);this.expect(x.KwCharacter),t.name=this.expectIdentifier(),t.namePos=this.prevNonWhitespaceOrComment().pos;let i=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(t.style=i==x.RBrace?1:0,this.attachComments(t);!this.check(i)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););for(t.fields.push(this.parseObjectField());this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););}for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););return this.expect(i),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseTextStatement(){let e=this.currentPos(),t=this.attachComments(new ci(this.nextNodeId(4),e,null));if(t.content=this.parseStringLiteral(),!this.lineBreakAfterToken&&this.match(x.KwIf)){let i=this.previous().pos;this.check(x.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression(),t.conditionPos=i.extendedTo(this.prevNonWhitespaceOrComment().pos)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseChoiceStatement(){let e=this.currentPos(),t=new mi(this.nextNodeId(2),e,[]);this.expect(x.KwChoice);let i=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(t.style=i==x.RBrace?1:0,this.attachComments(t);!this.check(i)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););for(t.options.push(this.parseChoiceOption(i));this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););}return this.expect(i),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseChoiceOption(e){let t=this.currentPos(),i=this.attachComments(new Et(this.nextNodeId(3),t,null,null,null,0,[])),l=null,n=!1;try{this.check(x.OpPlus)?(n=!0,i.insertion=this.parseInsertion()):(this.match(x.OpMinus)&&(i.once=!0),i.text=this.parseStringLiteral())}catch(s){let r=b.caught(s).unwrap();if(r instanceof Ne){let h=r;this.addError(h),l=this.currentPos(),this.currentPos().offset==t.offset&&this.advance(),i.text=new Tt(this.nextNodeId(4),this.currentPos(),0,[new Je(this.nextNodeId(4),this.currentPos(),ze.Raw("?"))])}else throw s}if(this.match(x.KwIf)){let s=this.previous().pos,r=this.currentPos().offset;try{this.check(x.LParen)&&(i.conditionStyle=2),i.condition=this.parseConditionExpression(),i.conditionPos=s.extendedTo(this.prevNonWhitespaceOrComment().pos)}catch(h){let a=b.caught(h).unwrap();if(a instanceof Ne){let o=a;this.addError(o),l=this.currentPos(),this.currentPos().offset==r&&this.advance()}else throw h}}if(!n){if(this.checkBlockStart()){i.body=[];let s=this.currentPos().offset;try{i.style=this.parseStatementBlock(i.body)}catch(r){let h=b.caught(r).unwrap();if(h instanceof Ne){let a=h;this.addError(a),l=this.currentPos(),this.currentPos().offset==s&&this.advance(),i.body.length==0&&(i.body=[new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null)])}else throw r}}else if(this.check(x.Arrow)){let s=this.currentPos().offset;try{i.body=[],i.body.push(this.parseNode())}catch(r){let h=b.caught(r).unwrap();if(h instanceof Ne){let a=h;this.addError(a),l=this.currentPos(),this.currentPos().offset==s&&this.advance(),i.body.length==0&&(i.body=[new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null)])}else throw r}i.style=0}}if(i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l!=null)for(;!this.isAtEnd()&&this.currentPos().line<=l.line+1;)this.advance();return i}isExpressionStart(){let e=this.tokens[this.current].type;switch(e._hx_index){case 15:let t=e.quotes,i=e.s,l=e.attachments;return!0;case 16:let n=e.n;return!0;case 17:let s=e.b;return!0;case 19:let r=e.name;return this.peek().type!=x.Colon;case 18:case 27:case 39:case 45:case 47:case 49:return!0;default:return!1}}parseExpressionStatement(){let e=this.parseExpression();if(this.match(x.OpAssign)||this.match(x.OpPlusAssign)||this.match(x.OpMinusAssign)||this.match(x.OpMultiplyAssign)||this.match(x.OpDivideAssign)||this.match(x.OpUnquotedAssign)){let t=this.previous().type,i=this.attachComments(new di(this.nextNodeId(4),e.pos,e,t,null));return i.value=this.parseExpression(),i.pos=i.pos.extendedTo(i.value.pos),i}return this.attachComments(e)}isKnownNodeStart(){let e=this.tokens[this.current].type;switch(e._hx_index){case 15:let t=e.quotes,i=e.s,l=e.attachments;return!0;case 19:let n=e.name;return this.peek().type==x.Colon?!0:this.peek().type==x.Arrow;case 1:case 2:case 3:case 4:case 5:case 40:return!0;default:return!1}}parseIfStatement(){let e=this.currentPos(),t=new gi(this.nextNodeId(4),e,null,0,null,null);for(this.expect(x.KwIf),this.check(x.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression();this.match(x.LineBreak););this.attachComments(t),t.thenBranch=new ii(this.nextNodeId(3),this.currentPos(),null),t.thenBranch.body=[],t.thenBranch.style=this.parseStatementBlock(t.thenBranch.body);let i=this.tokens[this.current];if(i!=null&&i.type==x.KwElse){for(this.advance();this.match(x.LineBreak););if(this.attachElseComments(t,i),this.check(x.KwIf)){t.elseBranch=new ii(this.nextNodeId(3),this.currentPos(),null);let l=this.parseIfStatement();t.elseBranch.body=[l],t.elseBranch.style=0}else t.elseBranch=new ii(this.nextNodeId(3),this.currentPos(),null),t.elseBranch.body=[],t.elseBranch.style=this.parseStatementBlock(t.elseBranch.body)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseAlternative(){let e=this.currentPos(),t;switch(this.tokens[this.current].type._hx_index){case 8:t=0;break;case 9:t=1;break;case 10:t=2;break;case 11:t=3;break;case 12:t=4;break;default:throw b.thrown(new Ne("Expected alternative keyword",this.currentPos()))}let i=new Ui(this.nextNodeId(2),e,t,[]);for(this.advance();this.match(x.LineBreak););this.attachComments(i);let l=new ii(this.nextNodeId(3),this.currentPos(),null);for(l.body=[],l.style=this.parseStatementBlock(l.body),i.items.push(l),i.style=l.style;this.check(x.Separator);){let n=this.tokens[this.current];for(this.advance();this.match(x.LineBreak););if(this.pendingComments!=null&&this.pendingComments.length>0){i.separatorComments==null&&(i.separatorComments=[]);let r=[],h=[],a=0,o=this.pendingComments;for(;a<o.length;){let u=o[a];++a,u.pos.line<=n.pos.line?r.push(u):h.push(u)}i.separatorComments.push(r),this.pendingComments=h}let s=new ii(this.nextNodeId(3),this.currentPos(),null);s.body=[],s.style=this.parseStatementBlock(s.body),i.items.push(s)}return i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),i}parseTransition(){let e=this.currentPos();if(this.expect(x.Arrow),this.match(x.Dot))return this.attachComments(new Mi(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),".",this.prevNonWhitespaceOrComment().pos));let t=this.expectIdentifier();return this.attachComments(new Mi(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),t,this.prevNonWhitespaceOrComment().pos))}parseInsertion(){let e=this.currentPos();this.expect(x.OpPlus);let t=this.expectIdentifier();return this.attachComments(new zi(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),t,this.prevNonWhitespaceOrComment().pos))}parseFunction(){let e=this.currentPos(),t=this.tokens[this.current].type;if(t._hx_index==14){let i=t.name,l=t.args,n=t.code,s=t.external;return this.advance(),this.attachComments(new Li(this.nextNodeId(3),e,i,[].concat(l),n,s))}else throw b.thrown(new Ne("Unexpected token in expression",this.currentPos()))}parseExpression(){try{let e=this.parseTernary();if(this.check(x.OpAssign)||this.check(x.OpPlusAssign)||this.check(x.OpMinusAssign)||this.check(x.OpMultiplyAssign)||this.check(x.OpDivideAssign)||this.check(x.OpUnquotedAssign)){let t=this.tokens[this.current].type;this.advance();let i=this.attachComments(new di(this.nextNodeId(4),e.pos,e,t,null));return i.value=this.parseExpression(),i.pos=i.pos.extendedTo(i.value.pos),i}return e}catch(e){let t=b.caught(e).unwrap();return t instanceof Ne&&this.addError(t),new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null)}}parseTernary(){let e=this.parseLogicalOr();if(this.match(x.Question)){let t=this.parseTernary();this.expect(x.Colon);let i=this.parseTernary();e=this.attachComments(new $i(this.nextNodeId(4),e.pos,e,t,i)),e.pos=e.pos.extendedTo(i.pos)}return e}parseLogicalOr(){let e=this.parseLogicalAnd();for(;this.match(x.OpOr(!1));){let t=this.previous().type,i=this.attachComments(new Qt(this.nextNodeId(4),e.pos,e,t,null));i.right=this.parseLogicalAnd(),i.pos=i.pos.extendedTo(i.right.pos),e=i}return e}parseLogicalAnd(){let e=this.parseEquality();for(;this.match(x.OpAnd(!1));){let t=this.previous().type,i=this.attachComments(new Qt(this.nextNodeId(4),e.pos,e,t,null));i.right=this.parseEquality(),i.pos=i.pos.extendedTo(i.right.pos),e=i}return e}parseEquality(){let e=this.parseComparison();for(;this.match(x.OpEquals)||this.match(x.OpNotEquals);){let t=this.previous().type,i=this.attachComments(new Qt(this.nextNodeId(4),e.pos,e,t,null));i.right=this.parseComparison(),i.pos=i.pos.extendedTo(i.right.pos),e=i}return e}parseComparison(){let e=this.parseAdditive();for(;this.match(x.OpGreater)||this.match(x.OpGreaterEq)||this.match(x.OpLess)||this.match(x.OpLessEq);){let t=this.previous().type,i=this.attachComments(new Qt(this.nextNodeId(4),e.pos,e,t,null));i.right=this.parseAdditive(),i.pos=i.pos.extendedTo(i.right.pos),e=i}return e}parseAdditive(){let e=this.parseMultiplicative();for(;this.match(x.OpPlus)||this.match(x.OpMinus);){let t=this.previous().type,i=this.attachComments(new Qt(this.nextNodeId(4),e.pos,e,t,null));i.right=this.parseMultiplicative(),i.pos=i.pos.extendedTo(i.right.pos),e=i}return e}parseMultiplicative(){let e=this.parseUnary();for(;this.match(x.OpMultiply)||this.match(x.OpDivide)||this.match(x.OpModulo);){let t=this.previous().type,i=this.attachComments(new Qt(this.nextNodeId(4),e.pos,e,t,null));i.right=this.parseUnary(),i.pos=i.pos.extendedTo(i.right.pos),e=i}return e}parseUnary(){if(this.match(x.OpNot)||this.match(x.OpMinus)){let e=this.previous().type,t=this.attachComments(new Ki(this.nextNodeId(4),this.previous().pos,e,null));return t.operand=this.parseUnary(),t.pos=t.pos.extendedTo(t.operand.pos),t}return this.parsePrimary()}parsePrimary(){let e=this.currentPos(),t=this.tokens[this.current].type;switch(t._hx_index){case 15:let i=t.quotes,l=t.s,n=t.attachments;return this.parsePostfix(e,this.parseStringLiteral());case 16:let s=t.n;return this.advance(),this.attachComments(new Ke(this.nextNodeId(4),e,s,He.Number));case 17:let r=t.b;return this.advance(),this.attachComments(new Ke(this.nextNodeId(4),e,r,He.Boolean));case 18:return this.advance(),this.attachComments(new Ke(this.nextNodeId(4),e,null,He.Null));case 19:let h=t.name;if(this.peek().type==x.Colon){let o=[this.parseObjectField()];return new Ke(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),o,He.Object(0))}else return this.advance(),this.parseIdentifierExpression(e,h);break;case 45:return this.parsePostfix(e,this.parseObjectLiteral());case 47:this.advance();let a=this.parseExpression();return this.expect(x.RParen),this.parsePostfix(e,a);case 49:return this.parsePostfix(e,this.parseArrayLiteral());default:throw b.thrown(new Ne("Unexpected token in expression",this.currentPos()))}}parseStringLiteral(){let e=this.currentPos(),t=[],i=this.tokens[this.current].type;if(i._hx_index==15){let l=i.quotes,n=i.s,s=i.attachments,r=l!=0?e.withOffset(n,1,e.length-2):e,h=0;if(s==null||s.length==0){let c=this.makeStringPartPosition(r,n,0);c.length=r.length;let _=this.nextNodeId(4),f=this.nextNodeId(4);return t.push(new Je(f,c,ze.Raw(n))),this.advance(),this.attachComments(new Tt(_,e,l,t))}let a=this.attachComments(new Tt(this.nextNodeId(4),e,l,t)),o=0,u=s.length;for(;o<u;){let c=o++,_=s[c];switch(_._hx_index){case 0:let f=_.braces,m=_.inTag,g=_.expr,w=_.start,y=_.length;if(h>=w+y)continue;if(w>h){let P=this.makeStringPartPosition(r,n,h);P.length=w-h;let I=w-h;t.push(new Je(this.nextNodeId(4),P,ze.Raw(I!=null?p.substr(n,h,I):p.substr(n,h,null))))}t.push(this.parseStringInterpolation(f,m,g,w,y,n)),h=w+y;break;case 1:let T=_.closing,E=_.start,C=_.length;if(h>=E+C)continue;if(E>h){let P=this.makeStringPartPosition(r,n,h);P.length=E-h;let I=E-h;t.push(new Je(this.nextNodeId(4),P,ze.Raw(I!=null?p.substr(n,h,I):p.substr(n,h,null))))}t.push(this.parseStringTag(T,E,C,n,l,s)),h=E+C;break}}if(h<n.length){let c=this.makeStringPartPosition(r,n,h);c.length=n.length-h;let _=null;t.push(new Je(this.nextNodeId(4),c,ze.Raw(_!=null?p.substr(n,h,_):p.substr(n,h,null))))}if(this.advance(),this.pendingComments!=null){let c=null,_=0,f=this.pendingComments;for(;_<f.length;){let m=f[_];++_,m.pos.line==e.line?(a.trailingComments==null&&(a.trailingComments=[]),a.trailingComments.push(m)):(c==null&&(c=[]),c.push(m))}this.pendingComments=c}return a}else throw b.thrown(new Ne("Expected text, got "+this.currentTokenTypeToString(),this.currentPos()))}makeStringPartPosition(e,t,i){let l=e.line,n=e.column,s=0,r=i;for(;s<r;){let h=s++,a=p.cca(t,h);(a??-1)==10?(++l,n=1):++n}return new he(l,n,e.offset+i)}makeAccess(e,t,i,l){if(i!=null){if(i.length==0&&(this.errors==null||this.errors.length==0)&&this.addError(new Ne("Invalid access: "+(i!=null?"'"+i+"'":"null"),e)),t!=null)if(l!=null)e=new he(t.pos.line,t.pos.column,t.pos.offset,l.offset+i.length-t.pos.offset);else throw b.thrown(new Ne("Invalid access (missing name position)",e));else if(e.length==0){let n=l!=null?l.length:null;e=new he(e.line,e.column,e.offset,n??i.length)}}return new ut(this.nextNodeId(4),e,t,i)}parseStringInterpolation(e,t,i,l,n,s){let r=i[0],h=r!=null?r.pos:null,a=this.makeStringPartPosition(h??this.currentPos(),s,l);if(a.length=n,i.length==0){let c=i[0],_=c!=null?c.pos:null;this.addError(new Ne("Empty interpolation",_??this.currentPos()));let f=this.nextNodeId(4),m=this.nextNodeId(4),g=i[0],w=g!=null?g.pos:null;return new Je(f,a,ze.Expr(new Ke(m,w??this.currentPos(),null,He.Null)))}let o=null;if(!e&&i.length>0){let c=null,_=0,f=!1;for(;_<i.length;){let m=i[_];++_;let g=m.type;switch(g._hx_index){case 19:let w=g.name;if(c==null)c=this.attachComments(this.makeAccess(m.pos,null,w,null));else if(f)c=this.attachComments(this.makeAccess(m.pos,c,w,m.pos));else{this.addError(new Ne("Missing dot in field access",m.pos));let K=this.nextNodeId(4),G=this.nextNodeId(4),Y=i[0],$=Y!=null?Y.pos:null;return new Je(K,a,ze.Expr(new Ke(G,$??this.currentPos(),null,He.Null)))}f=!1;break;case 44:if(c==null){this.addError(new Ne("Leading dot in field access",m.pos));let K=this.nextNodeId(4),G=this.nextNodeId(4),Y=i[0],$=Y!=null?Y.pos:null;return new Je(K,a,ze.Expr(new Ke(G,$??this.currentPos(),null,He.Null)))}f=!0;break;case 47:if(c==null){this.addError(new Ne("Function call without target",m.pos));let K=this.nextNodeId(4),G=this.nextNodeId(4),Y=i[0],$=Y!=null?Y.pos:null;return new Je(K,a,ze.Expr(new Ke(G,$??this.currentPos(),null,He.Null)))}let y=m.pos,T=[],E=[],C=1;for(;_<i.length&&C>0;){let K=i[_];switch(++_,K.type._hx_index){case 43:C==1?E.length>0&&(T.push(E),E=[]):E.push(K);break;case 47:++C,E.push(K);break;case 48:--C,C>0?E.push(K):E.length>0&&T.push(E);break;default:E.push(K)}}if(C>0){this.addError(new Ne("Unterminated function call",y));let K=this.nextNodeId(4),G=this.nextNodeId(4),Y=i[0],$=Y!=null?Y.pos:null;return new Je(K,a,ze.Expr(new Ke(G,$??this.currentPos(),null,He.Null)))}let P=[],I=0;for(;I<T.length;){let K=T[I];++I;let G=new qi(K);G.currentNodeId=this.currentNodeId;let Y=G.parseExpression();P.push(Y),this.currentNodeId=G.currentNodeId}c=this.attachComments(new Rt(this.nextNodeId(4),y.extendedTo(i[_-1].pos),c,P)),f=!1;break;case 49:if(c==null){this.addError(new Ne("Array access without target",m.pos));let K=this.nextNodeId(4),G=this.nextNodeId(4),Y=i[0],$=Y!=null?Y.pos:null;return new Je(K,a,ze.Expr(new Ke(G,$??this.currentPos(),null,He.Null)))}let v=m.pos,F=[],B=1,A=null;for(;_<i.length&&B>0;){let K=i[_];switch(++_,K.type._hx_index){case 49:++B,F.push(K);break;case 50:--B,B>0&&F.push(K),A=K;break;default:F.push(K)}}if(B>0){this.addError(new Ne("Unterminated array access",v));let K=this.nextNodeId(4),G=this.nextNodeId(4),Y=i[0],$=Y!=null?Y.pos:null;return new Je(K,a,ze.Expr(new Ke(G,$??this.currentPos(),null,He.Null)))}let L=new qi(F);L.currentNodeId=this.currentNodeId;let z=L.parseExpression();this.currentNodeId=L.currentNodeId;let D=a.extendedTo(i[_-1].pos);D.length+=1,c=this.attachComments(new pi(this.nextNodeId(4),D,c,z)),f=!1;break;default:this.addError(new Ne("Unexpected token in field access: "+Ot.toCodeString(m.type),m.pos));let O=this.nextNodeId(4),q=this.nextNodeId(4),M=i[0],U=M!=null?M.pos:null;return new Je(O,a,ze.Expr(new Ke(q,U??this.currentPos(),null,He.Null)))}}f&&this.addError(new Ne("Trailing dot in field access",i[i.length-1].pos)),o=c}else{let c=new qi(i);c.currentNodeId=this.currentNodeId,o=c.parseExpression(),this.currentNodeId=c.currentNodeId,c.isAtEnd()||this.addError(new Ne("Unexpected tokens after interpolation expression",c.tokens[c.current].pos))}let u=new he(a.line,a.column+(e?1:0),a.offset-(e?2:0),n);return new Je(this.nextNodeId(4),u,ze.Expr(o))}parseStringTag(e,t,i,l,n,s){let r=this.currentPos();n!=0&&(r=r.withOffset(l,1,r.length-2));let h=this.makeStringPartPosition(r,l,t);h.length=i;let a=e?2:1,o=t+a,u=i-(e?3:2),c=o+u,_=this.nextNodeId(4),f=!1;if(s!=null){let y=0,T=s.length;e:for(;y<T;){let E=y++,C=s[E];switch(C._hx_index){case 0:let P=C.braces,I=C.inTag,v=C.expr,F=C.start,B=C.length,A=F+B;if(F>=o&&A<=c){f=!0;break e}break;case 1:let L=C.closing,z=C.start,D=C.length;continue}}}if(!f){let y=this.makeStringPartPosition(r,l,o);y.length=u;let T=this.nextNodeId(4),E=this.nextNodeId(4);return new Je(_,h,ze.Tag(e,this.attachComments(new Tt(T,y,0,[new Je(E,y,ze.Raw(u!=null?p.substr(l,o,u):p.substr(l,o,null)))]))))}let m=[],g=this.attachComments(new Tt(this.nextNodeId(4),h,0,m)),w=o;if(s!=null){let y=0,T=s.length;for(;y<T;){let E=y++,C=s[E];switch(C._hx_index){case 0:let P=C.inTag,I=C.braces,v=C.expr,F=C.start,B=C.length,A=F+B;if(F>=o&&A<=c){if(F>w){let q=this.makeStringPartPosition(r,l,o);q.length=F-o;let M=F-w;m.push(new Je(this.nextNodeId(4),q,ze.Raw(M!=null?p.substr(l,w,M):p.substr(l,w,null))))}let O=this.parseStringInterpolation(I,!0,v,F,B,l);O.pos=this.makeStringPartPosition(r,l,F),O.pos.length=B,m.push(O),w=A}break;case 1:let L=C.closing,z=C.start,D=C.length;continue}}}if(w<c){let y=null,T=this.makeStringPartPosition(h,y!=null?p.substr(l,t,y):p.substr(l,t,null),w-t+a);T.length=o+c-w;let E=c-w;m.push(new Je(this.nextNodeId(4),T,ze.Raw(E!=null?p.substr(l,w,E):p.substr(l,w,null))))}return new Je(_,h,ze.Tag(e,g))}parseIdentifierExpression(e,t){let i=this.attachComments(this.makeAccess(e,null,t,null));return this.parsePostfix(e,i)}parsePostfix(e,t){for(;;)if(this.match(x.Dot,!1)){let i=null,l=this.currentPos();this.checkIdentifier()?i=this.expectIdentifier():(this.addError(new Ne("Expected identifier after '.'",this.currentPos())),i=""),t=this.attachComments(this.makeAccess(e,t,i,l))}else if(this.match(x.LBracket)){let i=this.parseExpression();this.expect(x.RBracket);let l=e.extendedTo(this.previous().pos);t=this.attachComments(new pi(this.nextNodeId(4),l,t,i))}else if(this.match(x.LParen)){let i=this.parseCallArguments();t=this.attachComments(new Rt(this.nextNodeId(4),e.extendedTo(this.previous().pos),t,i))}else break;return t}parseArrayLiteral(){let e=this.currentPos(),t=[],i=new Ke(this.nextNodeId(4),e,t,He.Array);this.expect(x.LBracket),this.attachComments(i);let l=!1;for(;!this.check(x.RBracket)&&!this.isAtEnd();){if(l){for(;this.match(x.LineBreak);)l=!1;this.match(x.Comma)&&(l=!1)}for(;this.match(x.LineBreak)||this.match(x.Indent)||this.match(x.Unindent);)l=!1;if(!this.check(x.RBracket)&&l)throw b.thrown(new Ne("Expected comma or line break between elements",this.currentPos()));for(;this.match(x.LineBreak)||this.match(x.Indent)||this.match(x.Unindent););this.check(x.RBracket)||t.push(this.parseExpression());let n=this.previous();l=n.type!=x.Colon&&n.type!=x.LineBreak}for(;this.match(x.LineBreak)||this.match(x.Indent)||this.match(x.Unindent););return this.expect(x.RBracket),i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),i}parseObjectLiteral(){let e=this.currentPos(),t=[],i=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace,l=i==x.RBrace?1:0,n=new Ke(this.nextNodeId(4),i!=x.RBrace?this.nextNonWhitespaceOrComment().pos:e,t,He.Object(l));this.attachComments(n);let s=!1;for(;!this.check(i)&&!this.isAtEnd();){if(s){for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent);)s=!1;this.match(x.Comma)&&(s=!1)}for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent);)s=!1;if(!this.check(i)&&s)throw b.thrown(new Ne("Expected comma or line break between fields",this.currentPos()));for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););this.check(i)||t.push(this.parseObjectField());let r=this.previous();s=r.type!=x.Colon&&r.type!=x.LineBreak}for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););return this.expect(i),n.pos=n.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),n}parseCallArguments(){let e=[];if(!this.check(x.RParen))do{for(;this.match(x.LineBreak););for(e.push(this.parseExpression());this.match(x.LineBreak););}while(this.match(x.Comma));return this.expect(x.RParen),e}parseConditionExpression(){let e=this.match(x.LParen),t=null;try{t=this.parseExpression(),t!=null&&te.getClass(t)==di&&this.addError(new Ne("Invalid condition expression: can't assign a variable here. Did you want to use '==' instead?",t.pos))}catch(i){let l=b.caught(i).unwrap();if(l instanceof Ne){let n=l;this.addError(n),t=new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null)}else throw i}return e&&this.expect(x.RParen),t}match(e,t){return t==null&&(t=!0),this.check(e)?(this.advance(t),!0):!1}isAtLineBreak(){return this.lineBreakAfterToken?!0:this.tokens[this.current].type==x.LineBreak}expect(e){if(this.check(e))return this.advance();{let t=new Ne("Expected "+Ot.toCodeString(e)+", got "+(this.isAtEnd()?"end of file":this.currentTokenTypeToString()),this.tokens[Math.min(this.current,this.tokens.length-1)|0].pos);switch(e._hx_index){case 46:case 48:case 55:return this.addError(t),new ke(e,this.currentPos());default:}throw b.thrown(t)}}checkIdentifier(){let e=this.tokens[this.current].type;if(e._hx_index==19){let t=e.name;return!0}else return!1}expectIdentifier(){let e=this.tokens[this.current].type;if(e._hx_index==19){let t=e.name;return this.advance(),t}else throw b.thrown(new Ne("Expected identifier, got "+this.currentTokenTypeToString(),this.currentPos()))}attachComments(e){if(this.pendingComments==null||this.pendingComments.length==0)return e;let t=e.pos,i=null,l=0,n=this.pendingComments.length;for(;l<n;){let s=l++,r=this.pendingComments[s];r.pos.line<t.line?(e.leadingComments==null&&(e.leadingComments=[]),e.leadingComments.push(r)):r.pos.line==t.line||this.isAtEnd()?(e.trailingComments==null&&(e.trailingComments=[]),e.trailingComments.push(r)):(i==null&&(i=[]),i.push(r))}return this.pendingComments=i,e}attachElseComments(e,t){if(this.pendingComments!=null){let i=t.pos,l=[],n=0,s=this.pendingComments;for(;n<s.length;){let r=s[n];++n,r.pos.line<i.line?(e.elseLeadingComments==null&&(e.elseLeadingComments=[]),e.elseLeadingComments.push(r)):r.pos.line==i.line?(e.elseTrailingComments==null&&(e.elseTrailingComments=[]),e.elseTrailingComments.push(r)):l.push(r)}this.pendingComments=l}return e}synchronize(){for(this.advance();!this.isAtEnd();){let e=this.tokens[this.current].type;switch(e._hx_index){case 15:let t=e.quotes,i=e.s,l=e.attachments;if(this.previous().type==x.RBrace)return;this.advance();break;case 40:this.advance(),(this.check(x.Dot)||Ot.isIdentifier(this.tokens[this.current].type))&&this.advance();return;case 1:case 2:case 3:case 4:case 5:case 46:case 54:return;default:this.advance()}}}requiresNewLine(){switch(this.tokens[this.current].type._hx_index){case 6:case 40:case 46:return!1;default:return!0}}addError(e){return this.errors==null&&(this.errors=[]),this.errors.includes(e)||this.errors.push(e),e}}j["loreline.Parser"]=qi,qi.__name__="loreline.Parser",Object.assign(qi.prototype,{__class__:qi});class he{constructor(e,t,i,l){l==null&&(l=0),this.line=e,this.column=t,this.offset=i,this.length=l}toString(){return"("+this.line+":"+this.column+":"+this.offset+":"+this.length+")"}toJson(){let e={line:this.line,column:this.column,offset:this.offset};return this.length!=0&&(e.length=this.length),e}withOffset(e,t,i,l){if(l==null&&(l=0),i==null&&(i=0),t==0)return new he(this.line,this.column,this.offset,i);let n=this.line,s=this.column,r=this.offset;if(t>0){let h=0;for(;h<t;){let a;if(r<l+e.length){let o=p.cca(e,r-l);a=(o??-1)==10}else a=!1;a?(++n,s=1):++s,++h,++r}}else{let h=0;for(;h>t;){--r;let a;if(r>=0){let o=p.cca(e,r-l);a=(o??-1)==10}else a=!1;if(a){--n;let o=1,u=r-1;for(;u>=0;){let c=p.cca(e,u-l);if((c??-1)==10)break;++o,--u}s=o}else--s;--h}}return r<0&&(r=0,n=1,s=1),new he(n,s,r,i)}extendedTo(e){return new he(this.line,this.column,this.offset,e.offset+e.length-this.offset)}static fromContentAndIndex(e,t,i){i==null&&(i=0);let l=1,n=1,s=0,r=e.length;for(t>r&&(t=r),t<0&&(t=0);s<t;){let h=p.cca(e,s);(h??-1)==10?(++l,n=1):++n,++s}return new he(l,n,t,i)}}j["loreline.Position"]=he,he.__name__="loreline.Position",Object.assign(he.prototype,{__class__:he});class nl{constructor(e,t){t==null&&(t=`
|
|
41
|
-
`),e==null&&(e=" "),this.enableComments=!0,this._indent=e,this._newline=t,this._beginLine=0,this._lastChar=-1,this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new
|
|
42
|
-
`).join("\\n"),
|
|
43
|
-
`).join("\\n"),n}print(e){return this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new
|
|
29
|
+
`),l=-1;if(t[0].length>0){let s=0;for(;s<t[0].length;){let r=c.cca(t[0],s),a=r??-1;if(a!=32&&a!=9)break;++s}s>0&&s<t[0].length&&(l=s)}let i=1,n=t.length;for(;i<n;){let s=i++,r=t[s];if(r.length==0)continue;let a=0;for(;a<r.length;){let h=c.cca(r,a),o=h??-1;if(o!=32&&o!=9)break;++a}a>0&&(l==-1||a<l)&&(l=a)}if(l>0){let s=1,r=t.length;for(;s<r;){let a=s++;if(t[a].length>0){let h=t[a],o=null;t[a]=o!=null?h.substring(l,o):h.substring(l)}}e=t.join(`
|
|
30
|
+
`)}return e}stripStringComments(e){let t="",l=e.length,i=0;for(;i<l;){let n=c.cca(e,i),s=n??-1,r;if(s==47&&i+1<l){let h=c.cca(e,i+1);r=(h??-1)==47}else r=!1;if(r){for(;;){let h;if(i<l){let o=c.cca(e,i);h=(o??-1)!=10}else h=!1;if(!h)break;++i}continue}let a;if(s==47&&i+1<l){let h=c.cca(e,i+1);a=(h??-1)==42}else a=!1;if(a){let h;if(i>0){let u=c.cca(e,i-1);h=(u??-1)==32}else h=!1;for(i+=2;;){let u;if(i+1<l){let p,_=c.cca(e,i);if((_??-1)==42){let m=c.cca(e,i+1);p=(m??-1)==47}else p=!1;u=!p}else u=!1;if(!u)break;++i}i+=2;let o;if(i<l){let u=c.cca(e,i);o=(u??-1)==32}else o=!1;h&&o&&++i,!h&&!o&&i<l&&(t+=String.fromCodePoint(32));continue}t+=String.fromCodePoint(s),++i}return t}evaluateCondition(e){let t=this.evaluateExpression(e);return typeof t=="boolean"?t==!0:typeof t=="string"?t.length>0:he.isArray(t)?he.arrayLength(t)>0:typeof t=="number"&&(t|0)===t||typeof t=="number"?t!=0:t!=null}evaluateFunctionCall(e,t){if(e.target instanceof ft){let n=e.target;if(n.target==null){let s=this.evaluateExpression(e.target);if(s!=null&&qe.isFunction(s)){let r=[],a=0,h=e.args;for(;a<h.length;){let u=h[a];++a,r.push(this.evaluateExpression(u))}let o=r;try{let u=s.apply(null,o);if(u!=null&&u instanceof oi){if(t==null)throw C.thrown(new ge("Cannot call async function in expression",e.pos));u.func(t)}else t?.();return u}catch(u){let p=C.caught(u).unwrap();if(p instanceof Se){let _=p;throw C.thrown(new ge("Error when evaluating function ("+_.pmin+"-"+_.pmax+"): "+Y.string(_.e),e.pos))}throw C.thrown(new ge("Error when calling function: "+Y.string(p),e.pos))}}}else{let s=this.evaluateExpression(n.target),r=null;if(typeof s=="string"?r=oe.getStringHelper(this,n.name):he.isArray(s)?r=oe.getArrayHelper(this,n.name):s instanceof Me?r=oe.getBeatHelper(this,n.name):oe.isFields(s)&&(r=oe.getMapHelper(this,n.name)),r!=null&&qe.isFunction(r)){let a=[],h=0,o=e.args;for(;h<o.length;){let _=o[h];++h,a.push(this.evaluateExpression(_))}let u=a;u.splice(0,0,s);let p=r.apply(null,u);if(p!=null&&p instanceof oi){if(t==null)throw C.thrown(new ge("Cannot call async function in expression",e.pos));p.func(t)}else t?.();return p}else if(r==null&&!(typeof s=="string"||he.isArray(s)||oe.isFields(s))){let a=qe.getProperty(s,n.name);if(qe.isFunction(a)){let h=[],o=0,u=e.args;for(;o<u.length;){let m=u[o];++o,h.push(this.evaluateExpression(m))}let p=h,_=a.apply(s,p);if(_!=null&&_ instanceof oi){if(t==null)throw C.thrown(new ge("Cannot call async function in expression",e.pos));_.func(t)}else t?.();return _}}}}let l=this.printLoreline(e.target),i;throw l!=null?i=l:i=te.getClass(e.target).__name__,C.thrown(new ge("Invalid call target: "+i,e.pos))}evaluateArrayLiteral(e){let t=[],l=0;for(;l<e.length;){let i=e[l];++l,t.push(this.evaluateExpression(i))}return t}evaluateObjectLiteral(e){let t=new Ee,l=0;for(;l<e.length;){let i=e[l];++l;let n=i.name,s=this.evaluateExpression(i.value);t.h[n]=s}return t}evaluateExpression(e){switch(te.getClass(e)){case ft:let t=e,l=this.resolveAccess(t,t.target,t.name);return this.readAccess(l);case gl:let i=e,n=this.evaluateExpression(i.target),s=this.evaluateExpression(i.index);if(he.isArray(n)&&(typeof s=="number"&&(s|0)===s||typeof s=="number")){let w=s|0;if(w<0||w>=he.arrayLength(n))throw C.thrown(new ge("Array index out of bounds: "+w,i.pos));return he.arrayGet(n,w)}else if(typeof s=="string"){if(n==null)throw C.thrown(new ge("Cannot access field '"+(s==null?"null":Y.string(s))+"' of null",i.pos));return oe.getField(this,n,s)}else throw C.thrown(new ge("Invalid array access",i.pos));break;case il:let r=e,a=this.evaluateExpression(r.left),h=this.evaluateExpression(r.right);return this.performOperation(r.op,a,h,r.pos);case Jt:return this.evaluateFunctionCall(e,null);case je:let o=e,u=o.literalType;switch(u._hx_index){case 0:case 1:case 2:return o.value;case 3:return this.evaluateArrayLiteral(o.value);case 4:let w=u.style;return this.evaluateObjectLiteral(o.value)}break;case Mt:let p=e;if(p.parts.length==1&&p.quotes==0){let w=p.parts[0].partType;if(w._hx_index==1){let y=w.expr;return this.evaluateExpression(y)}else return this.evaluateString(p).text}else return this.evaluateString(p).text;break;case ii:let _=e;return this.evaluateCondition(_.condition)?this.evaluateExpression(_.trueExpr):this.evaluateExpression(_.falseExpr);case Yl:let f=e,g=this.evaluateExpression(f.operand);switch(f.op._hx_index){case 27:if(typeof g=="number"&&(g|0)===g)return-g;if(typeof g=="number")return-g;throw C.thrown(new ge("Invalid unary operation",f.pos));break;case 39:if(typeof g=="boolean")return!g;if(typeof g=="string"){let w=g;return w!=null?w.length==0:!0}else return he.isArray(g)?he.arrayLength(g)==0:typeof g=="number"&&(g|0)===g||typeof g=="number"?g==0:g==null;break;default:throw C.thrown(new ge("Invalid unary operation",f.pos))}break;default:let d=te.getClass(e);throw C.thrown(new ge("Unsupported expression type: "+d.__name__,e.pos))}}readAccess(e){switch(e._hx_index){case 0:let t=e.pos,l=e.obj,i=e.name;if(l==null)throw C.thrown(new ge("Cannot read field '"+i+"' of null",t));return oe.getField(this,l,i);case 1:let n=e.pos,s=e.array,r=e.index;return he.arrayGet(s,r);case 2:let a=e.pos,h=e.name;if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,h))return this.topLevelCharacters.h[h].fields;throw C.thrown(new ge("Character not found: "+h,a));case 3:let o=e.pos,u=e.name;if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,u))return this.topLevelFunctions.h[u];throw C.thrown(new ge("Function not found: "+u,o));case 4:let p=e.pos;return e.beat}}writeAccess(e,t){switch(e._hx_index){case 0:let l=e.pos,i=e.obj,n=e.name;if(i==null)throw C.thrown(new ge("Cannot set field '"+n+"' of null",l));oe.setField(this,i,n,t);break;case 1:let s=e.pos,r=e.array,a=e.index;he.arraySet(r,a,t);break;case 2:let h=e.pos,o=e.name;throw C.thrown(new ge("Cannot overwrite character: "+o,h));case 3:let u=e.pos,p=e.name;throw C.thrown(new ge("Cannot overwrite function: "+p,u));case 4:let _=e.pos,m=e.beat;throw C.thrown(new ge("Cannot overwrite beat: "+m.name,_))}}resolveAssignmentTarget(e){switch(te.getClass(e)){case ft:let t=e;return this.resolveAccess(t,t.target,t.name);case gl:let l=e,i=this.evaluateExpression(l.target),n=this.evaluateExpression(l.index);if(he.isArray(i)&&(typeof n=="number"&&(n|0)===n||typeof n=="number")){let s=n|0;return fl.ArrayAccess(l.pos,i,s)}else if(typeof n=="string"){if(i==null)throw C.thrown(new ge("Cannot access field '"+(n==null?"null":Y.string(n))+"' of null",l.pos));return fl.FieldAccess(l.pos,i,n)}else throw C.thrown(new ge("Invalid array access target",l.pos));break;default:throw C.thrown(new ge("Invalid assignment target",e.pos))}}resolveAccess(e,t,l){if(t!=null){let a=this.evaluateExpression(t);if(a==null){let h=te.getClass(t)==ft?t.name:null;throw C.thrown(new ge(h!=null?"Cannot access field '"+l+"' of undefined variable '"+h+"'":"Cannot access field '"+l+"' of null value",t.pos))}return fl.FieldAccess(t.pos,a,l)}let i=this.stack.length-1;for(;i>=0;){let a=this.stack[i];if(a.state!=null&&oe.fieldExists(this,a.state.fields,l)){let h=e!=null?e.pos:null,o;if(h!=null)o=h;else{let u=this.get_currentScope(),p=u!=null?u.node:null;o=p!=null?p.pos:null}return fl.FieldAccess(o??this.script.pos,a.state.fields,l)}if(a.node!=null){let h=a.node.id.thisVal,o=this.nodeStates.map._get(h.high,h.low);if(o!=null&&oe.fieldExists(this,o.fields,l)){let u=e!=null?e.pos:null,p;if(u!=null)p=u;else{let _=this.get_currentScope(),m=_!=null?_.node:null;p=m!=null?m.pos:null}return fl.FieldAccess(p??this.script.pos,o.fields,l)}}--i}if(oe.fieldExists(this,this.topLevelState.fields,l)){let a=e!=null?e.pos:null,h;if(a!=null)h=a;else{let o=this.get_currentScope(),u=o!=null?o.node:null;h=u!=null?u.pos:null}return fl.FieldAccess(h??this.script.pos,this.topLevelState.fields,l)}if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,l)){let a=e!=null?e.pos:null,h;if(a!=null)h=a;else{let o=this.get_currentScope(),u=o!=null?o.node:null;h=u!=null?u.pos:null}return fl.CharacterAccess(h??this.script.pos,l)}if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,l)){let a=e!=null?e.pos:null,h;if(a!=null)h=a;else{let o=this.get_currentScope(),u=o!=null?o.node:null;h=u!=null?u.pos:null}return fl.FunctionAccess(h??this.script.pos,l)}let n=this.resolveBeatByName(l);if(n!=null){let a=e!=null?e.pos:null,h;if(a!=null)h=a;else{let o=this.get_currentScope(),u=o!=null?o.node:null;h=u!=null?u.pos:null}return fl.BeatAccess(h??this.script.pos,n)}if(!this.strictAccess){let a=e!=null?e.pos:null,h;if(a!=null)h=a;else{let o=this.get_currentScope(),u=o!=null?o.node:null;h=u!=null?u.pos:null}return fl.FieldAccess(h??this.script.pos,this.topLevelState.fields,l)}let s=e!=null?e.pos:null,r;if(s!=null)r=s;else{let a=this.get_currentScope(),h=a!=null?a.node:null;r=h!=null?h.pos:null}throw C.thrown(new ge("Undefined variable: "+l,r??this.script.pos))}getTypeName(e){switch(e._hx_index){case 0:return"Null";case 1:return"Int";case 2:return"Float";case 3:return"Bool";case 4:return"Object";case 5:return"Function";case 6:return e.c.__name__;case 7:return e.e.__ename__;case 8:return"Unknown"}}performOperation(e,t,l,i){let n=_e.typeof(t),s=_e.typeof(l);switch(e._hx_index){case 26:switch(n._hx_index){case 1:switch(s._hx_index){case 1:case 2:return parseFloat(Y.string(t))+parseFloat(Y.string(l));case 6:if(s.c==String)return Y.string(t)+Y.string(l);{let g="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),d=i,w;if(d!=null)w=d;else{let y=this.get_currentScope(),S=y!=null?y.node:null;w=S!=null?S.pos:null}throw C.thrown(new ge(g,w??this.script.pos))}break;default:let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}break;case 2:switch(s._hx_index){case 1:case 2:return parseFloat(Y.string(t))+parseFloat(Y.string(l));case 6:if(s.c==String)return Y.string(t)+Y.string(l);{let g="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),d=i,w;if(d!=null)w=d;else{let y=this.get_currentScope(),S=y!=null?y.node:null;w=S!=null?S.pos:null}throw C.thrown(new ge(g,w??this.script.pos))}break;default:let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}break;case 6:if(n.c==String)return Y.string(t)+Y.string(l);if(s._hx_index==6){if(s.c==String)return Y.string(t)+Y.string(l);{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}}else{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}break;default:if(s._hx_index==6){if(s.c==String)return Y.string(t)+Y.string(l);{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}}else{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}}break;case 27:case 28:case 29:case 30:switch(n._hx_index){case 1:case 2:switch(s._hx_index){case 1:case 2:let d=parseFloat(Y.string(t)),w=parseFloat(Y.string(l));switch(e._hx_index){case 27:return d-w;case 28:return d*w;case 29:if(w==0){let E=i,v;if(E!=null)v=E;else{let M=this.get_currentScope(),A=M!=null?M.node:null;v=A!=null?A.pos:null}throw C.thrown(new ge("Division by zero",v??this.script.pos))}return d/w;case 30:if(w==0){let E=i,v;if(E!=null)v=E;else{let M=this.get_currentScope(),A=M!=null?M.node:null;v=A!=null?A.pos:null}throw C.thrown(new ge("Modulo by zero",v??this.script.pos))}return d%w;default:throw C.thrown("Unreachable")}break;default:let y;switch(e._hx_index){case 27:y="subtract";break;case 28:y="multiply";break;case 29:y="divide";break;case 30:y="modulo";break;default:y="perform operation on"}let S="Cannot "+y+" "+this.getTypeName(n)+" and "+this.getTypeName(s),T=i,O;if(T!=null)O=T;else{let E=this.get_currentScope(),v=E!=null?E.node:null;O=v!=null?v.pos:null}throw C.thrown(new ge(S,O??this.script.pos))}break;default:let _;switch(e._hx_index){case 27:_="subtract";break;case 28:_="multiply";break;case 29:_="divide";break;case 30:_="modulo";break;default:_="perform operation on"}let m="Cannot "+_+" "+this.getTypeName(n)+" and "+this.getTypeName(s),f=i,g;if(f!=null)g=f;else{let d=this.get_currentScope(),w=d!=null?d.node:null;g=w!=null?w.pos:null}throw C.thrown(new ge(m,g??this.script.pos))}break;case 31:case 32:let r=t instanceof Me&&typeof l=="string"?t.name==l:typeof t=="string"&&l instanceof Me?t==l.name:t instanceof Me&&l instanceof Me?t.name==l.name:t==l;switch(e._hx_index){case 31:return r;case 32:return!r;default:throw C.thrown("Unreachable")}break;case 33:case 34:case 35:case 36:switch(n._hx_index){case 1:case 2:switch(s._hx_index){case 1:case 2:let g=parseFloat(Y.string(t)),d=parseFloat(Y.string(l));switch(e._hx_index){case 33:return g>d;case 34:return g<d;case 35:return g>=d;case 36:return g<=d;default:throw C.thrown("Unreachable")}break;default:let w="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(s),y=i,S;if(y!=null)S=y;else{let T=this.get_currentScope(),O=T!=null?T.node:null;S=O!=null?O.pos:null}throw C.thrown(new ge(w,S??this.script.pos))}break;default:let _="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}break;case 37:let a=e.word;if(n._hx_index==3)if(s._hx_index==3)switch(e._hx_index){case 37:let _=e.word;return t?l:!1;case 38:let m=e.word;return t?!0:l;default:throw C.thrown("Unreachable")}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}break;case 38:let h=e.word;if(n._hx_index==3)if(s._hx_index==3)switch(e._hx_index){case 37:let _=e.word;return t?l:!1;case 38:let m=e.word;return t?!0:l;default:throw C.thrown("Unreachable")}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}break;default:let o="Invalid operation: "+Y.string(e),u=i,p;if(u!=null)p=u;else{let _=this.get_currentScope(),m=_!=null?_.node:null;p=m!=null?m.pos:null}throw C.thrown(new ge(o,p??this.script.pos))}}valueToString(e){return this.valueToStringImpl(e,null)}valueToStringImpl(e,t){if(e==null)return"null";if(typeof e=="string")return e;if(typeof e=="boolean"||typeof e=="number"&&(e|0)===e||typeof e=="number")return e==null?"null":Y.string(e);t==null&&(t=[]);let l=0;for(;l<t.length;){let i=t[l];if(++l,i==e)return"..."}if(t.push(e),he.isArray(e)){let i=he.arrayLength(e),n="";n+="[";let s=0,r=i;for(;s<r;){let a=s++;a>0&&(n+=", "),n+=Y.string(this.valueToStringImpl(he.arrayGet(e,a),t))}return n+="]",t.pop(),n}if(e instanceof Me)return t.pop(),e.name;if(oe.isFields(e)){let i=oe.getFields(this,e);i.sort(function(a,h){return a<h?-1:a>h?1:0});let n="";n+="{";let s=0,r=i.length;for(;s<r;){let a=s++;a>0&&(n+=", "),n+=Y.string(i[a]),n+=": ",n+=Y.string(this.valueToStringImpl(oe.getField(this,e,i[a]),t))}return n+="}",t.pop(),n}return t.pop(),e==null?"null":Y.string(e)}printLoreline(e){try{let t=new Wl;return t.enableComments=!1,He.trim(t.print(e))}catch{return null}}}Q["loreline.Interpreter"]=Xl.loreline.Interpreter=Pi,Pi.__name__="loreline.Interpreter",Object.assign(Pi.prototype,{__class__:Pi,__properties__:{get_currentInsertion:"get_currentInsertion",get_currentScope:"get_currentScope"}});class kn{static stringify(e,t){return t==null&&(t=!1),JSON.stringify(e,null,t?" ":null)}static parse(e){return JSON.parse(e)}}Q["loreline.Json"]=kn,kn.__name__="loreline.Json";class R{static scriptFromJson(e){if(e==null)throw C.thrown("Cannot create Script from null JSON");let t=e.type;if(t!="Script")throw C.thrown("Expected Script node, got: "+t);let l=R.idFromJson(e),i=R.positionFromJson(e.pos),n=e.body,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(R.nodeFromJson(o))}let a=s,h=new nl(l,i,a);return h.indentSize=e.indentSize!=null?e.indentSize:2,e.filePath!=null&&(h.filePath=e.filePath),R.applyComments(h,e),h}static nodeFromJson(e){if(e==null)return null;let t=e.type;switch(t){case"Access":return R.accessFromJson(e);case"Alternative":return R.alternativeFromJson(e);case"ArrayAccess":return R.arrayAccessFromJson(e);case"Assign":return R.assignFromJson(e);case"Beat":return R.beatFromJson(e);case"Binary":return R.binaryFromJson(e);case"Block":return R.blockFromJson(e);case"Call":return R.callFromJson(e);case"Character":return R.characterFromJson(e);case"Choice":return R.choiceStatementFromJson(e);case"Comment":return R.commentFromJson(e);case"Dialogue":return R.dialogueStatementFromJson(e);case"Field":return R.objectFieldFromJson(e);case"Function":return R.functionDeclFromJson(e);case"If":return R.ifStatementFromJson(e);case"Import":return R.importStatementFromJson(e);case"Insertion":return R.insertionFromJson(e);case"Literal":return R.literalFromJson(e);case"Option":return R.choiceOptionFromJson(e);case"Part":return R.stringPartFromJson(e);case"Script":return R.scriptFromJson(e);case"State":return R.stateFromJson(e);case"String":return R.stringLiteralFromJson(e);case"Ternary":return R.ternaryFromJson(e);case"Text":return R.textStatementFromJson(e);case"Transition":return R.transitionFromJson(e);case"Unary":return R.unaryFromJson(e);default:throw C.thrown("Unknown node type: "+t)}}static commentFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.isHash!=null&&e.isHash;return new Ql(t,l,e.content,e.multiline,i)}static stateFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.fields,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(R.nodeFromJson(o))}let r=n,a=R.extractComments(e),h=new $t(t,l,e.temporary,r,a.leading,a.trailing);return h.style=R.blockStyleFromString(e.style),h}static objectFieldFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.extractComments(e);return new Ul(t,l,e.name,R.nodeFromJson(e.value),i.leading,i.trailing)}static characterFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.positionFromJson(e.namePos),n=e.fields,s=[],r=0;for(;r<n.length;){let u=n[r];++r,s.push(R.nodeFromJson(u))}let a=s,h=R.extractComments(e),o=new jt(t,l,e.name,i,a,h.leading,h.trailing);return o.style=R.blockStyleFromString(e.style),o}static beatFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.body,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(R.nodeFromJson(o))}let r=n,a=R.extractComments(e),h=new Me(t,l,e.name,r,a.leading,a.trailing);return h.style=R.blockStyleFromString(e.style),h}static stringPartFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.part,n;switch(i){case"Expr":n=ze.Expr(R.nodeFromJson(e.expression));break;case"Raw":n=ze.Raw(e.text);break;case"Tag":n=ze.Tag(e.closing,R.nodeFromJson(e.content));break;default:throw C.thrown("Unknown string part type: "+i)}let s=R.extractComments(e);return new Ge(t,l,n,s.leading,s.trailing)}static stringLiteralFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.quotesFromString(e.quotes),n=e.parts,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(R.nodeFromJson(o))}let a=s,h=R.extractComments(e);return new Mt(t,l,i,a,h.leading,h.trailing)}static textStatementFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.nodeFromJson(e.content),n=R.extractComments(e),s=new ll(t,l,i,n.leading,n.trailing);return e.condition!=null&&(s.condition=R.nodeFromJson(e.condition),s.conditionStyle=R.conditionStyleFromString(e.conditionStyle),s.conditionPos=R.positionFromJson(e.conditionPos)),s}static dialogueStatementFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.positionFromJson(e.characterPos),n=R.nodeFromJson(e.content),s=R.extractComments(e),r=new Kt(t,l,e.character,i,n,s.leading,s.trailing);return e.condition!=null&&(r.condition=R.nodeFromJson(e.condition),r.conditionStyle=R.conditionStyleFromString(e.conditionStyle),r.conditionPos=R.positionFromJson(e.conditionPos)),r}static choiceStatementFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.options,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(R.nodeFromJson(o))}let r=n,a=R.extractComments(e),h=new xl(t,l,r,a.leading,a.trailing);return h.style=R.blockStyleFromString(e.style),h}static choiceOptionFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.text!=null?R.nodeFromJson(e.text):null,n=e.insertion!=null?R.nodeFromJson(e.insertion):null,s=e.condition!=null?R.nodeFromJson(e.condition):null,r=e.conditionStyle!=null?R.conditionStyleFromString(e.conditionStyle):0,a=e.body,h=[],o=0;for(;o<a.length;){let m=a[o];++o,h.push(R.nodeFromJson(m))}let u=h,p=R.extractComments(e),_=new St(t,l,i,n,s,r,u,p.leading,p.trailing);return _.style=R.blockStyleFromString(e.style),e.once!=null&&e.once&&(_.once=!0),e.conditionPos!=null&&(_.conditionPos=R.positionFromJson(e.conditionPos)),_}static blockFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.body,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(R.nodeFromJson(o))}let r=n,a=R.extractComments(e),h=new hl(t,l,r,a.leading,a.trailing);return h.style=R.blockStyleFromString(e.style),h}static ifStatementFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.nodeFromJson(e.condition),n=R.conditionStyleFromString(e.conditionStyle),s=e.thenBranch,r=[],a=0;for(;a<s.length;){let f=s[a];++a,r.push(R.nodeFromJson(f))}let h=r,o=new hl(Ae.UNDEFINED,l,h);o.style=R.blockStyleFromString(e.thenStyle);let u=null;if(e.elseBranch!=null){let f=e.elseBranch,g=[],d=0;for(;d<f.length;){let y=f[d];++d,g.push(R.nodeFromJson(y))}let w=g;u=new hl(Ae.UNDEFINED,l,w),u.style=R.blockStyleFromString(e.elseStyle)}let p=R.extractComments(e),_=null,m=null;if(e.comments!=null){if(e.comments.elseLeading!=null){let f=e.comments.elseLeading,g=[],d=0;for(;d<f.length;){let w=f[d];++d,g.push(R.commentFromJson(w))}_=g}if(e.comments.elseTrailing!=null){let f=e.comments.elseTrailing,g=[],d=0;for(;d<f.length;){let w=f[d];++d,g.push(R.commentFromJson(w))}m=g}}return new wl(t,l,i,n,o,u,p.leading,p.trailing,_,m)}static alternativeFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.alternativeModeFromString(e.mode),n=e.items,s=[],r=0;for(;r<n.length;){let u=n[r];++r,s.push(R.nodeFromJson(u))}let a=s,h=R.extractComments(e),o=new Hl(t,l,i,a,h.leading,h.trailing);if(o.style=R.blockStyleFromString(e.style),e.separatorComments!=null){let u=e.separatorComments,p=[],_=0;for(;_<u.length;){let m=u[_];if(++_,m!=null){let f=m,g=[],d=0;for(;d<f.length;){let w=f[d];++d,g.push(R.commentFromJson(w))}p.push(g)}else p.push(null)}o.separatorComments=p}return o}static callFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.nodeFromJson(e.target),n=e.args,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(R.nodeFromJson(o))}let a=s,h=R.extractComments(e);return new Jt(t,l,i,a,h.leading,h.trailing)}static transitionFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.positionFromJson(e.targetPos),n=R.extractComments(e);return new Dl(t,l,e.target,i,n.leading,n.trailing)}static insertionFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.positionFromJson(e.targetPos),n=R.extractComments(e);return new $l(t,l,e.target,i,n.leading,n.trailing)}static functionDeclFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.name,n=e.args,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(o)}let a=s,h=R.extractComments(e);return new ql(t,l,i,a,e.code,e.external,h.leading,h.trailing)}static literalFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.literal,n=R.extractComments(e),s,r;switch(i){case"Array":if(s=Ke.Array,e.value!=null){let h=e.value,o=[],u=0;for(;u<h.length;){let p=h[u];++u,Object.prototype.hasOwnProperty.call(p,"type")?o.push(R.nodeFromJson(p)):o.push(p)}r=o}else r=null;break;case"Boolean":s=Ke.Boolean,r=e.value;break;case"Null":s=Ke.Null,r=null;break;case"Number":s=Ke.Number,r=e.value;break;case"Object":let a=R.blockStyleFromString(e.style);if(s=Ke.Object(a),e.value!=null){let h=e.value,o=[],u=0;for(;u<h.length;){let p=h[u];++u,o.push(R.nodeFromJson(p))}r=o}else r=[];break;default:throw C.thrown("Unknown literal type: "+i)}return new je(t,l,r,s,n.leading,n.trailing)}static accessFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.target!=null?R.nodeFromJson(e.target):null,n=R.extractComments(e);return new ft(t,l,i,e.name,n.leading,n.trailing)}static assignFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.nodeFromJson(e.target),n=R.tokenTypeFromString(e.op),s=R.nodeFromJson(e.value),r=R.extractComments(e);return new kl(t,l,i,n,s,r.leading,r.trailing)}static arrayAccessFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.nodeFromJson(e.target),n=R.nodeFromJson(e.index),s=R.extractComments(e);return new gl(t,l,i,n,s.leading,s.trailing)}static binaryFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.nodeFromJson(e.left),n=R.tokenTypeFromString(e.op),s=R.nodeFromJson(e.right),r=R.extractComments(e);return new il(t,l,i,n,s,r.leading,r.trailing)}static unaryFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.tokenTypeFromString(e.op),n=R.nodeFromJson(e.operand),s=R.extractComments(e);return new Yl(t,l,i,n,s.leading,s.trailing)}static ternaryFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.nodeFromJson(e.condition),n=R.nodeFromJson(e.trueExpr),s=R.nodeFromJson(e.falseExpr),r=R.extractComments(e);return new ii(t,l,i,n,s,r.leading,r.trailing)}static importStatementFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.nodeFromJson(e.path),n=e.script!=null?R.scriptFromJson(e.script):null,s=R.extractComments(e);return new Rt(t,l,i,n,s.leading,s.trailing)}static idFromJson(e){let t=e.id;return t!=null?Ae.fromString(t):Ae.UNDEFINED}static positionFromJson(e){if(e==null)return new ue(0,0,0,0);let t=e.length!=null?e.length:0;return new ue(e.line,e.column,e.offset,t)}static extractComments(e){if(e.comments==null)return{leading:null,trailing:null};let t=null,l=null;if(e.comments.leading!=null){let i=e.comments.leading,n=[],s=0;for(;s<i.length;){let r=i[s];++s,n.push(R.commentFromJson(r))}t=n}if(e.comments.trailing!=null){let i=e.comments.trailing,n=[],s=0;for(;s<i.length;){let r=i[s];++s,n.push(R.commentFromJson(r))}l=n}return{leading:t,trailing:l}}static applyComments(e,t){let l=R.extractComments(t);e.leadingComments=l.leading,e.trailingComments=l.trailing}static blockStyleFromString(e){return e=="Braces"?1:0}static conditionStyleFromString(e){return e=="Parens"?2:0}static alternativeModeFromString(e){switch(e){case"Cycle":return 1;case"Once":return 2;case"Pick":return 3;case"Shuffle":return 4;default:return 0}}static quotesFromString(e){return e=="DoubleQuotes"?1:0}static tokenTypeFromString(e){switch(e){case"OpAssign":return k.OpAssign;case"OpDivide":return k.OpDivide;case"OpDivideAssign":return k.OpDivideAssign;case"OpEquals":return k.OpEquals;case"OpGreater":return k.OpGreater;case"OpGreaterEq":return k.OpGreaterEq;case"OpLess":return k.OpLess;case"OpLessEq":return k.OpLessEq;case"OpMinus":return k.OpMinus;case"OpMinusAssign":return k.OpMinusAssign;case"OpModulo":return k.OpModulo;case"OpMultiply":return k.OpMultiply;case"OpMultiplyAssign":return k.OpMultiplyAssign;case"OpNot":return k.OpNot;case"OpNotEquals":return k.OpNotEquals;case"OpPlus":return k.OpPlus;case"OpPlusAssign":return k.OpPlusAssign;case"OpUnquotedAssign":return k.OpUnquotedAssign;default:if(e.startsWith("OpAnd"))return k.OpAnd(e.indexOf("true")!=-1);if(e.startsWith("OpOr"))return k.OpOr(e.indexOf("true")!=-1);throw C.thrown("Unknown operator: "+e)}}}Q["loreline.JsonToAst"]=R,R.__name__="loreline.JsonToAst";class _l{constructor(e,t){this.target=e,this.origin=t}}Q["loreline.Reference"]=_l,_l.__name__="loreline.Reference",Object.assign(_l.prototype,{__class__:_l});class Gi{constructor(e){this.error=null,this.expr=null,this.lorscript=null,this.func=e,this.codeToLorscript=new ti;try{this.lorscript=this.codeToLorscript.process(e.code)}catch(t){let l=C.caught(t).unwrap();l instanceof st&&(this.error=l,this.error.pos=e.pos.withOffset(this.codeToLorscript.input,this.error.pos.offset,this.error.pos.length,e.pos.offset)),this.lorscript=this.codeToLorscript.output.b}try{let t=new ci;t.resumeErrors=!1,t.allowJSON=!0,t.allowTypes=!0;let l=e.name;this.expr=t.parseString(this.lorscript,l??"?")}catch(t){let l=C.caught(t).unwrap();if(this.error==null)if(l instanceof Se){let i=l,n,s=i.e;switch(s._hx_index){case 0:n="Invalid character: "+s.c;break;case 1:n="Unexpected: "+s.s;break;case 2:n="Unterminated string";break;case 3:n="Unterminated comment";break;case 4:n="Invalid preprocessor: "+s.msg;break;case 5:n="Unknown variable: "+s.v;break;case 6:n="Invalid iterator: "+s.v;break;case 7:n="Invalid operator: "+s.op;break;case 8:n="Invalid access: "+s.f;break;case 9:n=s.msg;break}this.error=new Li(i,n,this.codeToLorscript.toLorelinePos(e.pos,i.pmin,i.pmax))}else l instanceof st&&(this.error=l,this.error.pos=e.pos.withOffset(this.codeToLorscript.input,this.error.pos.offset,this.error.pos.length,e.pos.offset));try{let i=new ci;i.resumeErrors=!0,i.allowJSON=!0,i.allowTypes=!0;let n=e.name;this.expr=i.parseString(this.lorscript,n??"?")}catch{}}}}Q["loreline.FuncLorscript"]=Gi,Gi.__name__="loreline.FuncLorscript",Object.assign(Gi.prototype,{__class__:Gi});class Qi{constructor(e,t){this.completion=null,this.locals=null,e!=null&&(this.locals=e),t!=null&&(this.completion=t)}}Q["loreline.LorscriptCompletion"]=Qi,Qi.__name__="loreline.LorscriptCompletion",Object.assign(Qi.prototype,{__class__:Qi});class Ii{constructor(e){this.lorscriptFunctions=new li,this.childNodes=new li,this.parentNodes=new li,this.nodesById=new li,this.script=e,this.initialize()}initialize(){let e=this;this.script.each(function(t,l){let i=t.id.thisVal;if(e.nodesById.map._set(i.high,i.low,t),l!=null){let n=t.id.thisVal;e.parentNodes.map._set(n.high,n.low,l);let s=l.id.thisVal,r=e.childNodes.map._get(s.high,s.low);if(r==null){r=[];let a=l.id.thisVal;e.childNodes.map._set(a.high,a.low,r)}r.push(t)}})}getNodeById(e){let t=e.thisVal;return this.nodesById.map._get(t.high,t.low)}getNodeAtPosition(e){let t=null;return this.script.eachExcludingImported(function(l,i){let n=l.pos;n.length>0&&n.offset<=e.offset&&n.offset+n.length>=e.offset&&(t=l)}),t}getClosestNodeAtOrBeforePosition(e){let t=null,l=999999999;return this.script.eachExcludingImported(function(i,n){let s=i.pos,r=e.offset-s.offset;r>=0&&r<l&&(l=r,t=i)}),t}getNodesOfType(e,t){t==null&&(t=!1);let l=[],i=this;return this.traverse(this.script,function(n,s){return te.__instanceof(n,e)&&l.push(n),t||n==i.script?!0:!(n instanceof Rt||n instanceof nl)}),l}getDialogueSpeakers(e){let t=[],l=Object.create(null);return this.traverse(e,function(i,n){if(i instanceof Kt){let s=i;s.character!=null&&!Object.prototype.hasOwnProperty.call(l,s.character)&&(l[s.character]=!0,t.push(s.character))}return!0}),t}getParentNode(e){let t=e.id.thisVal;return this.parentNodes.map._get(t.high,t.low)}getFirstParentOfType(e,t){let l=e;for(;l!=null;)if(l=this.getParentNode(l),l!=null&&te.getClass(l)==t)return l;return null}getNodeFilePath(e,t){let l=[],i=e;for(;i!=null;){let o=this.getFirstParentOfType(i,Rt);if(o!=null)l.push(o),i=o;else break}if(l.length==0)return t;let n=De.directory(t),s;if(t==null)s=!1;else{let o=t.length;if(o<8)s=!1;else{let u,p,_,m,f,g,d=c.cca(t,o-8);if((d??-1)==46){let w=c.cca(t,o-7),y=w??-1;g=y==108||y==76}else g=!1;if(g){let w=c.cca(t,o-6),y=w??-1;f=y==111||y==79}else f=!1;if(f){let w=c.cca(t,o-5),y=w??-1;m=y==114||y==82}else m=!1;if(m){let w=c.cca(t,o-4);_=(w??-1)==46}else _=!1;if(_){let w=c.cca(t,o-3),y=w??-1;p=y==116||y==84}else p=!1;if(p){let w=c.cca(t,o-2),y=w??-1;u=y==120||y==88}else u=!1;if(u){let w=c.cca(t,o-1),y=w??-1;s=y==116||y==84}else s=!1}}let r=s?".lor.txt":".lor",a=t,h=l.length-1;for(;h>=0;){let o=l[h],u,p=o.path.parts[0].partType;p._hx_index==0?u=p.text:u="",De.isAbsolute(u)||(u=De.join([n,u])),u=De.normalize(u);let _,m;if(u==null)m=!1;else{let f=u.length;if(f<8)m=!1;else{let g,d,w,y,S,T,O=c.cca(u,f-8);if((O??-1)==46){let E=c.cca(u,f-7),v=E??-1;T=v==108||v==76}else T=!1;if(T){let E=c.cca(u,f-6),v=E??-1;S=v==111||v==79}else S=!1;if(S){let E=c.cca(u,f-5),v=E??-1;y=v==114||v==82}else y=!1;if(y){let E=c.cca(u,f-4);w=(E??-1)==46}else w=!1;if(w){let E=c.cca(u,f-3),v=E??-1;d=v==116||v==84}else d=!1;if(d){let E=c.cca(u,f-2),v=E??-1;g=v==120||v==88}else g=!1;if(g){let E=c.cca(u,f-1),v=E??-1;m=v==116||v==84}else m=!1}}if(m)_=!0;else if(u==null)_=!1;else{let f=u.length;if(f<4)_=!1;else{let g,d,w=c.cca(u,f-4);if((w??-1)==46){let y=c.cca(u,f-3),S=y??-1;d=S==108||S==76}else d=!1;if(d){let y=c.cca(u,f-2),S=y??-1;g=S==111||S==79}else g=!1;if(g){let y=c.cca(u,f-1),S=y??-1;_=S==114||S==82}else _=!1}}_||(u+=r),a=u,n=De.directory(a),--h}return a}getNodeAncestorFilePaths(e){let t=[],l=e;for(;l!=null;){let r=this.getFirstParentOfType(l,Rt);if(r!=null)t.push(r),l=r;else break}let i=[],n=null,s=t.length-1;for(;s>=0;){let r=t[s],a,h=r.path.parts[0].partType;h._hx_index==0?a=h.text:a="",n==null?n=a:n=De.join([De.directory(n),a]);let o=De.normalize(n),u;if(o==null)u=null;else{let p;if(o==null)p=!1;else{let _=o.length;if(_<8)p=!1;else{let m,f,g,d,w,y,S=c.cca(o,_-8);if((S??-1)==46){let T=c.cca(o,_-7),O=T??-1;y=O==108||O==76}else y=!1;if(y){let T=c.cca(o,_-6),O=T??-1;w=O==111||O==79}else w=!1;if(w){let T=c.cca(o,_-5),O=T??-1;d=O==114||O==82}else d=!1;if(d){let T=c.cca(o,_-4);g=(T??-1)==46}else g=!1;if(g){let T=c.cca(o,_-3),O=T??-1;f=O==116||O==84}else f=!1;if(f){let T=c.cca(o,_-2),O=T??-1;m=O==120||O==88}else m=!1;if(m){let T=c.cca(o,_-1),O=T??-1;p=O==116||O==84}else p=!1}}if(p){let _=o.length-8;u=_!=null?c.substr(o,0,_):c.substr(o,0,null)}else{let _;if(o==null)_=!1;else{let m=o.length;if(m<4)_=!1;else{let f,g,d=c.cca(o,m-4);if((d??-1)==46){let w=c.cca(o,m-3),y=w??-1;g=y==108||y==76}else g=!1;if(g){let w=c.cca(o,m-2),y=w??-1;f=y==111||y==79}else f=!1;if(f){let w=c.cca(o,m-1),y=w??-1;_=y==114||y==82}else _=!1}}if(_){let m=o.length-4;u=m!=null?c.substr(o,0,m):c.substr(o,0,null)}else u=o}}i.push(u),--s}return i.reverse(),i.push("."),i}getNodeRelativeFilePath(e){let t=null,l=e;for(;l!=null;){let r=this.getFirstParentOfType(l,Rt);if(r!=null)t==null&&(t=[]),t.push(r),l=r;else break}if(t==null||t.length==0)return".";let i=null,n=t.length-1;for(;n>=0;){let r=t[n],a,h=r.path.parts[0].partType;h._hx_index==0?a=h.text:a="",i==null?i=a:i=De.join([De.directory(i),a]),--n}let s=De.normalize(i);if(s==null)return null;{let r;if(s==null)r=!1;else{let a=s.length;if(a<8)r=!1;else{let h,o,u,p,_,m,f=c.cca(s,a-8);if((f??-1)==46){let g=c.cca(s,a-7),d=g??-1;m=d==108||d==76}else m=!1;if(m){let g=c.cca(s,a-6),d=g??-1;_=d==111||d==79}else _=!1;if(_){let g=c.cca(s,a-5),d=g??-1;p=d==114||d==82}else p=!1;if(p){let g=c.cca(s,a-4);u=(g??-1)==46}else u=!1;if(u){let g=c.cca(s,a-3),d=g??-1;o=d==116||d==84}else o=!1;if(o){let g=c.cca(s,a-2),d=g??-1;h=d==120||d==88}else h=!1;if(h){let g=c.cca(s,a-1),d=g??-1;r=d==116||d==84}else r=!1}}if(r){let a=s.length-8;return a!=null?c.substr(s,0,a):c.substr(s,0,null)}else{let a;if(s==null)a=!1;else{let h=s.length;if(h<4)a=!1;else{let o,u,p=c.cca(s,h-4);if((p??-1)==46){let _=c.cca(s,h-3),m=_??-1;u=m==108||m==76}else u=!1;if(u){let _=c.cca(s,h-2),m=_??-1;o=m==111||m==79}else o=!1;if(o){let _=c.cca(s,h-1),m=_??-1;a=m==114||m==82}else a=!1}}if(a){let h=s.length-4;return h!=null?c.substr(s,0,h):c.substr(s,0,null)}else return s}}}getImportedPaths(e){let t=[];return this._getImportedPaths(e,this.script,t,new Ee),t}_getImportedPaths(e,t,l,i){let n=De.directory(e);t==null&&(t=this.script);let s;if(e==null)s=!1;else{let o=e.length;if(o<8)s=!1;else{let u,p,_,m,f,g,d=c.cca(e,o-8);if((d??-1)==46){let w=c.cca(e,o-7),y=w??-1;g=y==108||y==76}else g=!1;if(g){let w=c.cca(e,o-6),y=w??-1;f=y==111||y==79}else f=!1;if(f){let w=c.cca(e,o-5),y=w??-1;m=y==114||y==82}else m=!1;if(m){let w=c.cca(e,o-4);_=(w??-1)==46}else _=!1;if(_){let w=c.cca(e,o-3),y=w??-1;p=y==116||y==84}else p=!1;if(p){let w=c.cca(e,o-2),y=w??-1;u=y==120||y==88}else u=!1;if(u){let w=c.cca(e,o-1),y=w??-1;s=y==116||y==84}else s=!1}}let r=s?".lor.txt":".lor",a=0,h=t.body;for(;a<h.length;){let o=h[a];if(++a,o instanceof Rt){let u=o,p,_=u.path.parts[0].partType;_._hx_index==0?p=_.text:p="",De.isAbsolute(p)||(p=De.join([n,p])),p=De.normalize(p);let m,f;if(p==null)f=!1;else{let g=p.length;if(g<8)f=!1;else{let d,w,y,S,T,O,E=c.cca(p,g-8);if((E??-1)==46){let v=c.cca(p,g-7),M=v??-1;O=M==108||M==76}else O=!1;if(O){let v=c.cca(p,g-6),M=v??-1;T=M==111||M==79}else T=!1;if(T){let v=c.cca(p,g-5),M=v??-1;S=M==114||M==82}else S=!1;if(S){let v=c.cca(p,g-4);y=(v??-1)==46}else y=!1;if(y){let v=c.cca(p,g-3),M=v??-1;w=M==116||M==84}else w=!1;if(w){let v=c.cca(p,g-2),M=v??-1;d=M==120||M==88}else d=!1;if(d){let v=c.cca(p,g-1),M=v??-1;f=M==116||M==84}else f=!1}}if(f)m=!0;else if(p==null)m=!1;else{let g=p.length;if(g<4)m=!1;else{let d,w,y=c.cca(p,g-4);if((y??-1)==46){let S=c.cca(p,g-3),T=S??-1;w=T==108||T==76}else w=!1;if(w){let S=c.cca(p,g-2),T=S??-1;d=T==111||T==79}else d=!1;if(d){let S=c.cca(p,g-1),T=S??-1;m=T==114||T==82}else m=!1}}m||(p+=r),Object.prototype.hasOwnProperty.call(i.h,p)||(i.h[p]=!0,l.push(p),u.script!=null&&this._getImportedPaths(p,u.script,l,i))}}return l}resolveArrayAccess(e){let t=null;if(e.target instanceof ft?t=this.resolveAccess(e.target):e.target instanceof gl&&(t=this.resolveArrayAccess(e.target)),t==null)return null;switch(te.getClass(t)){case je:let l=t;if(l.literalType==Ke.Array){let n=l.value;if(e.index instanceof je){let s=e.index;if(s.literalType==Ke.Number){let r=s.value|0;if(r>=0&&r<n.length){let a=n[r];if(a instanceof At)return a}}}}break;case Ul:let i=t;if(i.value instanceof je){let n=i.value;if(n.literalType==Ke.Array){let s=n.value;if(e.index instanceof je){let r=e.index;if(r.literalType==Ke.Number){let a=r.value|0;if(a>=0&&a<s.length){let h=s[a];if(h instanceof At)return h}}}}}break;default:}return null}resolveAccess(e){if(e.target!=null){let a=e.target instanceof ft?this.resolveAccess(e.target):e.target instanceof gl?this.resolveArrayAccess(e.target):null;if(a!=null)switch(a instanceof Ul&&(a=a.value),te.getClass(a)){case jt:let h=a,o=0,u=h.fields;for(;o<u.length;){let m=u[o];if(++o,m.name==e.name)return m}break;case je:let p=a,_=p.literalType;if(_._hx_index==4){let m=_.style,f=p.value,g=0;for(;g<f.length;){let d=f[g];if(++g,d.name==e.name)return d}}break;default:}return null}let t=e.name;if(t==null)return null;let l=this.getFirstParentOfType(e,Me);for(;l!=null;){let a=null;if(this.traverse(l,function(h,o){if(a!=null)return!1;if(h instanceof $t){let u=h,p=0,_=u.fields;for(;p<_.length;){let m=_[p];if(++p,m.name==t)return a=m,!1}}return!0}),a!=null)return a;l=this.getFirstParentOfType(l,Me)}let i=null;if(this.traverse(this.script,function(a,h){if(i!=null)return!1;if(a instanceof $t){let o=a,u=0,p=o.fields;for(;u<p.length;){let _=p[u];if(++u,_.name==t)return i=_,!1}}return a instanceof Rt?!0:a instanceof nl}),i!=null)return i;let n=this.findCharacterByNameFromNode(t,e);if(n!=null)return n;let s=this.findBeatByNameFromNode(t,e);if(s!=null)return s;let r=this.findFunctionByNameFromNode(t,e);return r??null}findBeatFromAccess(e){return e.target==null&&e.name!=null?this.findBeatByNameFromNode(e.name,e):null}findBeatFromTransition(e){return this.findBeatByNameFromNode(e.target,e)}findBeatFromInsertion(e){return this.findBeatByNameFromNode(e.target,e)}findBeatByPathFromNode(e,t){let l=e.split("."),i=this.findBeatByNameFromNode(l[0],t),n=1;for(;i!=null&&n<l.length;){let s=l[n],r=null;this.traverse(i,function(a,h){if(a instanceof Me){let o=a;return o.name==s&&(r=o),!1}else return r==null}),i=r,++n}return i}isTopLevelNode(e){if(e instanceof Be){let t=e;return this.script.body.indexOf(t)!=-1}return!1}findTopLevelBeatFromNode(e){if(this.isTopLevelNode(e))return e instanceof Me?e:null;{let t=this.getFirstParentOfType(e,Me);for(;t!=null&&!this.isTopLevelNode(t);)t=this.getFirstParentOfType(t,Me);if(t!=null&&t instanceof Me)return t}return null}findBeatByNameFromNode(e,t){let l=null,i=this.getFirstParentOfType(t,Me);for(;i!=null;)this.traverse(i,function(n,s){if(l!=null||n==t)return!1;if(n instanceof Me){let r=n;return r.name==e&&(l=r),!1}return!0}),i=this.getFirstParentOfType(i,Me);return l==null&&this.traverse(this.script,function(n,s){if(l==null&&n instanceof Me){let r=n;r.name==e&&(l=r)}return n instanceof Rt?!0:n instanceof nl}),l}findCharacterFromDialogue(e){return this.findCharacterByNameFromNode(e.character,e)}findCharacterByNameFromNode(e,t){let l=null;return this.traverse(this.script,function(i,n){if(l==null&&i instanceof jt){let s=i;s.name==e&&(l=s)}return i instanceof Rt?!0:i instanceof nl}),l}findFunctionByNameFromNode(e,t){let l=null;return this.traverse(this.script,function(i,n){if(l==null&&i instanceof ql){let s=i;s.name==e&&(l=s)}return i instanceof Rt?!0:i instanceof nl}),l}getVisibleCharacters(){let e=[],t=this.script.iterator();for(;t.hasNext();){let l=t.next();l instanceof jt&&e.push(l)}return e}getVisibleFunctions(){let e=[],t=this.script.iterator();for(;t.hasNext();){let l=t.next();l instanceof ql&&e.push(l)}return e}getVisibleStateFields(e){let t=[],l=new El,i=e;for(;i!=null;){if(te.getClass(i)==$t){let s=i,r=0,a=s.fields;for(;r<a.length;){let h=a[r];++r;let o=h.id.thisVal;if(!l._exists(o.high,o.low)){let u=h.id.thisVal;l._set(u.high,u.low,!0),t.push(h)}}}let n=i.id.thisVal;i=this.parentNodes.map._get(n.high,n.low)}return this.script.each(function(n,s){if(te.getClass(n)==$t){let r=n;if(s instanceof nl){let a=0,h=r.fields;for(;a<h.length;){let o=h[a];++a;let u=o.id.thisVal;if(!l._exists(u.high,u.low)){let p=o.id.thisVal;l._set(p.high,p.low,!0),t.push(o)}}}}}),t}getVisibleBeats(e){let t=[],l=Object.create(null),i=this.getParentNode(e);for(;i!=null;){if(te.getClass(i)==Me&&this.getParentNode(i)!=null){let s=0,r=this.getNodesOfType(Me);for(;s<r.length;){let a=r[s];++s,Object.prototype.hasOwnProperty.call(l,a.name)||(l[a.name]=!0,t.push(a))}}i=this.getParentNode(i)}return this.script.each(function(n,s){if(te.getClass(n)==Me&&s instanceof nl){let r=n;Object.prototype.hasOwnProperty.call(l,r.name)||(l[r.name]=!0,t.push(r))}}),t}getAllTags(){let e=Object.create(null);this.script.each(function(a,h){let o=a instanceof Be?a:null;if(o!=null&&o.trailingComments!=null){let u=0,p=o.trailingComments;for(;u<p.length;){let _=p[u];if(++u,_.isHash){let m=He.trim(_.content);e[m]=!0}}}});let t=[],l=e,i=l,n=Object.keys(l),s=n.length,r=0;for(;r<s;){let a=n[r++];t.push(a)}return t}countTags(){let e=new Ee;return this.script.each(function(t,l){let i=t instanceof Be?t:null;if(i!=null&&i.trailingComments!=null){let n=0,s=i.trailingComments;for(;n<s.length;){let r=s[n];if(++n,r.isHash){let a=He.trim(r.content),h=e.h[a],o=h??0;e.h[a]=o+1}}}}),e}findStateField(e){if(e.target!=null)return null;let t=this.getVisibleStateFields(e),l=0;for(;l<t.length;){let i=t[l];if(++l,i.name==e.name)return i}return null}findOutboundBeats(e){let t=new El,l=this;this.traverse(e,function(r,a){switch(te.getClass(r)){case Jt:let h=r;if(h.target instanceof ft){let m=h.target;if(m.target==null){let f=l.findBeatFromAccess(m);if(f!=null){let g=f.id,d=new _l(f,h),w=g.thisVal;t._set(w.high,w.low,d)}}}break;case $l:let o=r,u=l.findBeatByNameFromNode(o.target,o);if(u!=null){let m=u.id,f=new _l(u,o),g=m.thisVal;t._set(g.high,g.low,f)}break;case Dl:let p=r,_=l.findBeatByNameFromNode(p.target,p);if(_!=null){let m=_.id,f=new _l(_,p),g=m.thisVal;t._set(g.high,g.low,f)}break;default:}return!0});let i=[],n=t,s=0;for(;s<n._values.length&&n._values[s]==null;)++s;for(;s<n._values.length;){let r=n._values[s];for(++s;s<n._values.length&&n._values[s]==null;)++s;let a=r;i.push(a)}return i}findReferencesToBeat(e){let t=[],l=this;return this.script.each(function(i,n){switch(te.getClass(i)){case Jt:let s=i;if(s.target instanceof ft){let h=s.target;if(h.target==null&&h.name==e.name){let o=l.findBeatFromAccess(h);o!=null&&o.id==e.id&&t.push(new _l(e,s))}}break;case $l:let r=i;r.target==e.name&&t.push(new _l(e,r));break;case Dl:let a=i;a.target==e.name&&t.push(new _l(e,a));break;default:}}),t}findModifiedStateFields(e){let t=Object.create(null),l=this;this.traverse(e,function(u,p){if(te.getClass(u)==kl){let _=u;if(_.target instanceof ft){let m=_.target,f=l.findStateField(m);if(f!=null){let g=f.name,d=new _l(f,_);t[g]=d}}}return!0});let i=[],n=t,s=n,r=Object.keys(n),a=r.length,h=0;for(;h<a;){let u=s[r[h++]];i.push(u)}let o=i;return o.sort(function(u,p){let _=u.target.name.toLowerCase(),m=p.target.name.toLowerCase();return _<m?-1:_>m?1:0}),o}findReadStateFields(e){let t=Object.create(null),l=this;this.traverse(e,function(u,p){if(te.getClass(u)==ft){let _=u;if(p instanceof kl&&p.target==u)return!0;let m=l.findStateField(_);if(m!=null){let f=m.name,g=new _l(m,_);t[f]=g}}return!0});let i=[],n=t,s=n,r=Object.keys(n),a=r.length,h=0;for(;h<a;){let u=s[r[h++]];i.push(u)}let o=i;return o.sort(function(u,p){let _=u.target.name.toLowerCase(),m=p.target.name.toLowerCase();return _<m?-1:_>m?1:0}),o}findBeatCharacters(e){let t=new El,l=this;this.traverse(e,function(a,h){switch(te.getClass(a)){case ft:let o=a;if(o.target==null){let _=l.findCharacterByNameFromNode(o.name,o);if(_!=null){let m=_.id,f=new _l(_,o),g=m.thisVal;t._set(g.high,g.low,f)}}break;case Kt:let u=a,p=l.findCharacterFromDialogue(u);if(p!=null){let _=p.id,m=new _l(p,u),f=_.thisVal;t._set(f.high,f.low,m)}break;default:}return!0});let i=[],n=t,s=0;for(;s<n._values.length&&n._values[s]==null;)++s;for(;s<n._values.length;){let a=n._values[s];for(++s;s<n._values.length&&n._values[s]==null;)++s;let h=a;i.push(h)}let r=i;return r.sort(function(a,h){let o=a.target.name.toLowerCase(),u=h.target.name.toLowerCase();return o<u?-1:o>u?1:0}),r}findModifiedCharacterFields(e){let t=new El,l=[],i=this;return this.traverse(e,function(n,s){if(te.getClass(n)==kl){let r=n;if(r.target instanceof ft){let a=r.target,h=i.resolveAccess(a);if(h instanceof Ul){let o=h.id.thisVal;if(!t._exists(o.high,o.low)&&i.getParentNode(h)instanceof jt){let p=h.id.thisVal;t._set(p.high,p.low,!0),l.push(new _l(h,n))}}}}return!0}),l}findReadCharacterFields(e){let t=new El,l=[],i=this;return this.traverse(e,function(n,s){if(te.getClass(n)==ft){let r=n,a=i.getParentNode(r);if(a instanceof kl&&a.target==r)return!0;let h=i.resolveAccess(r);if(h instanceof Ul){let o=h.id.thisVal;if(!t._exists(o.high,o.low)&&i.getParentNode(h)instanceof jt){let p=h.id.thisVal;t._set(p.high,p.low,!0),l.push(new _l(h,n))}}}return!0}),l}traverse(e,t){let l=e.id.thisVal,i=this.childNodes.map._get(l.high,l.low);if(i!=null){let n=0,s=i.length;for(;n<s;){let r=n++,a=i[r];t(a,e)&&this.traverse(a,t)}}}getFuncLorscript(e){let t=e.id,l=t.thisVal,i=this.lorscriptFunctions.map._get(l.high,l.low);if(i==null){i=new Gi(e);let n=t.thisVal;this.lorscriptFunctions.map._set(n.high,n.low,i)}return i}getLorscriptExpr(e,t){let l=this.getFuncLorscript(e);if(l.expr==null)return null;let i=t.offset-e.pos.offset,n=null,s=null;return s=function(r){if(r!=null){let a=l.codeToLorscript.inputPosFromProcessedPos(r.pmin),h=l.codeToLorscript.inputPosFromProcessedPos(r.pmax);i>=a&&i<=h&&(n=r),un.iter(r,s)}},un.iter(l.expr,s),n}resolveLorscriptAccess(e,t){let l=t.e;switch(l._hx_index){case 1:let i=l.v,n=null;if(this.traverse(this.script,function(_,m){if(n!=null)return!1;if(_ instanceof $t){let f=_,g=0,d=f.fields;for(;g<d.length;){let w=d[g];if(++g,w.name==i)return n=w,!1}}return _ instanceof Rt?!0:_ instanceof nl}),n!=null)return n;let s=this.findCharacterByNameFromNode(i,e);if(s!=null)return s;let r=this.findBeatByNameFromNode(i,e);if(r!=null)return r;break;case 5:let a=l.e,h=l.f,o=a!=null?this.resolveLorscriptAccess(e,a):null;if(o!=null)switch(o instanceof Ul&&(o=o.value),te.getClass(o)){case jt:let _=o,m=0,f=_.fields;for(;m<f.length;){let w=f[m];if(++m,w.name==h)return w}break;case je:let g=o,d=g.literalType;if(d._hx_index==4){let w=d.style,y=g.value,S=0;for(;S<y.length;){let T=y[S];if(++S,T.name==h)return T}}break;default:}break;case 16:let u=l.e,p=l.index;break;default:}return null}isLorscriptExpr(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"e")?te.__instanceof(qe.field(e,"e"),K):!1}getLorscriptCompletion(e,t){let l=this.getFuncLorscript(e),i=t.offset-e.pos.offset+t.length,n=l.codeToLorscript.processedPosFromInputPos(i),s=l.lorscript,r=Math.min(n,l.lorscript.length)|0,a=r!=null?s.substring(0,r):s.substring(0),h=a.length,o=a.indexOf("{",null)+1;a=h!=null?a.substring(o,h):a.substring(o);let u=a.length,p="",_=0,m=h-u;for(;_<m;){let w=_++;p+=String.fromCodePoint(32)}a=p+a;let f=null,g=new tt;try{g.types.parser.allowJSON=!0,g.types.parser.allowTypes=!0,g.types.parser.resumeErrors=!0;let w=g.types.parser.parseString(a);g.check(w,null,!0)}catch(w){let y=C.caught(w).unwrap();y instanceof Bi&&(f=y)}let d=g.locals;return new Qi(d,f)}resolveAccessInFunction(e,t){if(this.getFuncLorscript(e).expr==null)return null;let i=this.getLorscriptExpr(e,t);return i!=null?this.resolveLorscriptAccess(e,i):null}}Q["loreline.Lens"]=Ii,Ii.__name__="loreline.Lens",Object.assign(Ii.prototype,{__class__:Ii});class ui extends st{constructor(e,t){super(e,t)}}Q["loreline.LexerError"]=ui,ui.__name__="loreline.LexerError",ui.__super__=st,Object.assign(ui.prototype,{__class__:ui});var Ll=Ye["loreline.LStringAttachment"]={__ename__:"loreline.LStringAttachment",__constructs__:null,Interpolation:(x=function(b,e,t,l,i){return{_hx_index:0,braces:b,inTag:e,expr:t,start:l,length:i,__enum__:"loreline.LStringAttachment",toString:F}},x._hx_name="Interpolation",x.__params__=["braces","inTag","expr","start","length"],x),Tag:(x=function(b,e,t){return{_hx_index:1,closing:b,start:e,length:t,__enum__:"loreline.LStringAttachment",toString:F}},x._hx_name="Tag",x.__params__=["closing","start","length"],x)};Ll.__constructs__=[Ll.Interpolation,Ll.Tag];class Bl{static toString(e){switch(e){case 0:return"ChoiceBrace";case 1:return"ChoiceIndent";case 2:return"StateBrace";case 3:return"StateIndent";case 4:return"CharacterBrace";case 5:return"CharacterIndent";case 6:return"BeatBrace";case 7:return"BeatIndent";case 8:return"AlternativeBrace";case 9:return"AlternativeIndent";case 10:return"Brace";case 11:return"Indent";case 12:return"Bracket"}}}var k=Ye["loreline.TokenType"]={__ename__:"loreline.TokenType",__constructs__:null,KwImport:{_hx_name:"KwImport",_hx_index:0,__enum__:"loreline.TokenType",toString:F},KwState:{_hx_name:"KwState",_hx_index:1,__enum__:"loreline.TokenType",toString:F},KwBeat:{_hx_name:"KwBeat",_hx_index:2,__enum__:"loreline.TokenType",toString:F},KwCharacter:{_hx_name:"KwCharacter",_hx_index:3,__enum__:"loreline.TokenType",toString:F},KwChoice:{_hx_name:"KwChoice",_hx_index:4,__enum__:"loreline.TokenType",toString:F},KwIf:{_hx_name:"KwIf",_hx_index:5,__enum__:"loreline.TokenType",toString:F},KwElse:{_hx_name:"KwElse",_hx_index:6,__enum__:"loreline.TokenType",toString:F},KwNew:{_hx_name:"KwNew",_hx_index:7,__enum__:"loreline.TokenType",toString:F},KwSequence:{_hx_name:"KwSequence",_hx_index:8,__enum__:"loreline.TokenType",toString:F},KwCycle:{_hx_name:"KwCycle",_hx_index:9,__enum__:"loreline.TokenType",toString:F},KwOnce:{_hx_name:"KwOnce",_hx_index:10,__enum__:"loreline.TokenType",toString:F},KwPick:{_hx_name:"KwPick",_hx_index:11,__enum__:"loreline.TokenType",toString:F},KwShuffle:{_hx_name:"KwShuffle",_hx_index:12,__enum__:"loreline.TokenType",toString:F},Separator:{_hx_name:"Separator",_hx_index:13,__enum__:"loreline.TokenType",toString:F},Function:(x=function(b,e,t,l){return{_hx_index:14,name:b,args:e,code:t,external:l,__enum__:"loreline.TokenType",toString:F}},x._hx_name="Function",x.__params__=["name","args","code","external"],x),LString:(x=function(b,e,t){return{_hx_index:15,quotes:b,s:e,attachments:t,__enum__:"loreline.TokenType",toString:F}},x._hx_name="LString",x.__params__=["quotes","s","attachments"],x),LNumber:(x=function(b){return{_hx_index:16,n:b,__enum__:"loreline.TokenType",toString:F}},x._hx_name="LNumber",x.__params__=["n"],x),LBoolean:(x=function(b){return{_hx_index:17,b,__enum__:"loreline.TokenType",toString:F}},x._hx_name="LBoolean",x.__params__=["b"],x),LNull:{_hx_name:"LNull",_hx_index:18,__enum__:"loreline.TokenType",toString:F},Identifier:(x=function(b){return{_hx_index:19,name:b,__enum__:"loreline.TokenType",toString:F}},x._hx_name="Identifier",x.__params__=["name"],x),OpAssign:{_hx_name:"OpAssign",_hx_index:20,__enum__:"loreline.TokenType",toString:F},OpPlusAssign:{_hx_name:"OpPlusAssign",_hx_index:21,__enum__:"loreline.TokenType",toString:F},OpMinusAssign:{_hx_name:"OpMinusAssign",_hx_index:22,__enum__:"loreline.TokenType",toString:F},OpMultiplyAssign:{_hx_name:"OpMultiplyAssign",_hx_index:23,__enum__:"loreline.TokenType",toString:F},OpDivideAssign:{_hx_name:"OpDivideAssign",_hx_index:24,__enum__:"loreline.TokenType",toString:F},OpUnquotedAssign:{_hx_name:"OpUnquotedAssign",_hx_index:25,__enum__:"loreline.TokenType",toString:F},OpPlus:{_hx_name:"OpPlus",_hx_index:26,__enum__:"loreline.TokenType",toString:F},OpMinus:{_hx_name:"OpMinus",_hx_index:27,__enum__:"loreline.TokenType",toString:F},OpMultiply:{_hx_name:"OpMultiply",_hx_index:28,__enum__:"loreline.TokenType",toString:F},OpDivide:{_hx_name:"OpDivide",_hx_index:29,__enum__:"loreline.TokenType",toString:F},OpModulo:{_hx_name:"OpModulo",_hx_index:30,__enum__:"loreline.TokenType",toString:F},OpEquals:{_hx_name:"OpEquals",_hx_index:31,__enum__:"loreline.TokenType",toString:F},OpNotEquals:{_hx_name:"OpNotEquals",_hx_index:32,__enum__:"loreline.TokenType",toString:F},OpGreater:{_hx_name:"OpGreater",_hx_index:33,__enum__:"loreline.TokenType",toString:F},OpLess:{_hx_name:"OpLess",_hx_index:34,__enum__:"loreline.TokenType",toString:F},OpGreaterEq:{_hx_name:"OpGreaterEq",_hx_index:35,__enum__:"loreline.TokenType",toString:F},OpLessEq:{_hx_name:"OpLessEq",_hx_index:36,__enum__:"loreline.TokenType",toString:F},OpAnd:(x=function(b){return{_hx_index:37,word:b,__enum__:"loreline.TokenType",toString:F}},x._hx_name="OpAnd",x.__params__=["word"],x),OpOr:(x=function(b){return{_hx_index:38,word:b,__enum__:"loreline.TokenType",toString:F}},x._hx_name="OpOr",x.__params__=["word"],x),OpNot:{_hx_name:"OpNot",_hx_index:39,__enum__:"loreline.TokenType",toString:F},Arrow:{_hx_name:"Arrow",_hx_index:40,__enum__:"loreline.TokenType",toString:F},Colon:{_hx_name:"Colon",_hx_index:41,__enum__:"loreline.TokenType",toString:F},Question:{_hx_name:"Question",_hx_index:42,__enum__:"loreline.TokenType",toString:F},Comma:{_hx_name:"Comma",_hx_index:43,__enum__:"loreline.TokenType",toString:F},Dot:{_hx_name:"Dot",_hx_index:44,__enum__:"loreline.TokenType",toString:F},LBrace:{_hx_name:"LBrace",_hx_index:45,__enum__:"loreline.TokenType",toString:F},RBrace:{_hx_name:"RBrace",_hx_index:46,__enum__:"loreline.TokenType",toString:F},LParen:{_hx_name:"LParen",_hx_index:47,__enum__:"loreline.TokenType",toString:F},RParen:{_hx_name:"RParen",_hx_index:48,__enum__:"loreline.TokenType",toString:F},LBracket:{_hx_name:"LBracket",_hx_index:49,__enum__:"loreline.TokenType",toString:F},RBracket:{_hx_name:"RBracket",_hx_index:50,__enum__:"loreline.TokenType",toString:F},CommentLine:(x=function(b){return{_hx_index:51,content:b,__enum__:"loreline.TokenType",toString:F}},x._hx_name="CommentLine",x.__params__=["content"],x),CommentMultiLine:(x=function(b){return{_hx_index:52,content:b,__enum__:"loreline.TokenType",toString:F}},x._hx_name="CommentMultiLine",x.__params__=["content"],x),CommentHash:(x=function(b){return{_hx_index:53,content:b,__enum__:"loreline.TokenType",toString:F}},x._hx_name="CommentHash",x.__params__=["content"],x),Indent:{_hx_name:"Indent",_hx_index:54,__enum__:"loreline.TokenType",toString:F},Unindent:{_hx_name:"Unindent",_hx_index:55,__enum__:"loreline.TokenType",toString:F},LineBreak:{_hx_name:"LineBreak",_hx_index:56,__enum__:"loreline.TokenType",toString:F},Eof:{_hx_name:"Eof",_hx_index:57,__enum__:"loreline.TokenType",toString:F}};k.__constructs__=[k.KwImport,k.KwState,k.KwBeat,k.KwCharacter,k.KwChoice,k.KwIf,k.KwElse,k.KwNew,k.KwSequence,k.KwCycle,k.KwOnce,k.KwPick,k.KwShuffle,k.Separator,k.Function,k.LString,k.LNumber,k.LBoolean,k.LNull,k.Identifier,k.OpAssign,k.OpPlusAssign,k.OpMinusAssign,k.OpMultiplyAssign,k.OpDivideAssign,k.OpUnquotedAssign,k.OpPlus,k.OpMinus,k.OpMultiply,k.OpDivide,k.OpModulo,k.OpEquals,k.OpNotEquals,k.OpGreater,k.OpLess,k.OpGreaterEq,k.OpLessEq,k.OpAnd,k.OpOr,k.OpNot,k.Arrow,k.Colon,k.Question,k.Comma,k.Dot,k.LBrace,k.RBrace,k.LParen,k.RParen,k.LBracket,k.RBracket,k.CommentLine,k.CommentMultiLine,k.CommentHash,k.Indent,k.Unindent,k.LineBreak,k.Eof];class Nt{static equals(e,t){switch(e._hx_index){case 1:return t._hx_index==1?!0:_e.enumEq(e,t);case 2:return t._hx_index==2?!0:_e.enumEq(e,t);case 3:return t._hx_index==3?!0:_e.enumEq(e,t);case 4:return t._hx_index==4?!0:_e.enumEq(e,t);case 5:return t._hx_index==5?!0:_e.enumEq(e,t);case 6:return t._hx_index==6?!0:_e.enumEq(e,t);case 7:return t._hx_index==7?!0:_e.enumEq(e,t);case 8:return t._hx_index==8?!0:_e.enumEq(e,t);case 9:return t._hx_index==9?!0:_e.enumEq(e,t);case 10:return t._hx_index==10?!0:_e.enumEq(e,t);case 11:return t._hx_index==11?!0:_e.enumEq(e,t);case 12:return t._hx_index==12?!0:_e.enumEq(e,t);case 13:return t._hx_index==13?!0:_e.enumEq(e,t);case 15:let l=e.s,i=e.attachments;if(t._hx_index==15){let r=t.s,a=t.attachments,h=t.quotes;return e.quotes==h}else return _e.enumEq(e,t);break;case 16:if(t._hx_index==16){let r=t.n;return e.n==r}else return _e.enumEq(e,t);break;case 17:if(t._hx_index==17){let r=t.b;return e.b==r}else return _e.enumEq(e,t);break;case 18:return t._hx_index==18?!0:_e.enumEq(e,t);case 19:if(t._hx_index==19){let r=t.name;return e.name==r}else return _e.enumEq(e,t);break;case 20:return t._hx_index==20?!0:_e.enumEq(e,t);case 21:return t._hx_index==21?!0:_e.enumEq(e,t);case 22:return t._hx_index==22?!0:_e.enumEq(e,t);case 23:return t._hx_index==23?!0:_e.enumEq(e,t);case 24:return t._hx_index==24?!0:_e.enumEq(e,t);case 25:return t._hx_index==25?!0:_e.enumEq(e,t);case 26:return t._hx_index==26?!0:_e.enumEq(e,t);case 27:return t._hx_index==27?!0:_e.enumEq(e,t);case 28:return t._hx_index==28?!0:_e.enumEq(e,t);case 29:return t._hx_index==29?!0:_e.enumEq(e,t);case 30:return t._hx_index==30?!0:_e.enumEq(e,t);case 31:return t._hx_index==31?!0:_e.enumEq(e,t);case 32:return t._hx_index==32?!0:_e.enumEq(e,t);case 33:return t._hx_index==33?!0:_e.enumEq(e,t);case 34:return t._hx_index==34?!0:_e.enumEq(e,t);case 35:return t._hx_index==35?!0:_e.enumEq(e,t);case 36:return t._hx_index==36?!0:_e.enumEq(e,t);case 37:let n=e.word;if(t._hx_index==37){let r=t.word;return!0}else return _e.enumEq(e,t);break;case 38:let s=e.word;if(t._hx_index==38){let r=t.word;return!0}else return _e.enumEq(e,t);break;case 39:return t._hx_index==39?!0:_e.enumEq(e,t);case 40:return t._hx_index==40?!0:_e.enumEq(e,t);case 41:return t._hx_index==41?!0:_e.enumEq(e,t);case 42:return t._hx_index==42?!0:_e.enumEq(e,t);case 44:return t._hx_index==44?!0:_e.enumEq(e,t);case 45:return t._hx_index==45?!0:_e.enumEq(e,t);case 46:return t._hx_index==46?!0:_e.enumEq(e,t);case 47:return t._hx_index==47?!0:_e.enumEq(e,t);case 48:return t._hx_index==48?!0:_e.enumEq(e,t);case 49:return t._hx_index==49?!0:_e.enumEq(e,t);case 50:return t._hx_index==50?!0:_e.enumEq(e,t);case 51:if(t._hx_index==51){let r=t.content;return e.content==r}else return _e.enumEq(e,t);break;case 52:if(t._hx_index==52){let r=t.content;return e.content==r}else return _e.enumEq(e,t);break;case 53:if(t._hx_index==53){let r=t.content;return e.content==r}else return _e.enumEq(e,t);break;case 54:return t._hx_index==54?!0:_e.enumEq(e,t);case 55:return t._hx_index==55?!0:_e.enumEq(e,t);case 56:return t._hx_index==56?!0:_e.enumEq(e,t);case 57:return t._hx_index==57?!0:_e.enumEq(e,t);default:return _e.enumEq(e,t)}}static isComment(e){switch(e._hx_index){case 51:let t=e.content;return!0;case 52:let l=e.content;return!0;case 53:let i=e.content;return!0;default:return!1}}static isAssignOp(e){switch(e._hx_index){case 20:case 21:case 22:case 23:case 24:case 25:return!0;default:return!1}}static isIdentifier(e){if(e._hx_index==19){let t=e.name;return!0}else return!1}static isBlockStart(e){switch(e._hx_index){case 1:case 2:case 3:case 4:case 5:return!0;case 8:case 9:case 10:case 11:case 12:case 13:return!0;default:return!1}}static toCodeString(e){switch(e._hx_index){case 0:return"import";case 1:return"state";case 2:return"beat";case 3:return"character";case 4:return"choice";case 5:return"if";case 6:return"else";case 7:return"new";case 8:return"sequence";case 9:return"cycle";case 10:return"once";case 11:return"pick";case 12:return"shuffle";case 13:return"--";case 14:let t=e.name,l=e.args,i=e.code,n=e.external;return"function";case 15:let s=e.quotes,r=e.s,a=e.attachments;return"string";case 16:let h=e.n;return"number";case 17:let o=e.b;return"boolean";case 18:return"null";case 19:let u=e.name;return"identifier";case 20:return"=";case 21:return"+=";case 22:return"-=";case 23:return"*=";case 24:return"/=";case 25:return":=";case 26:return"+";case 27:return"-";case 28:return"*";case 29:return"/";case 30:return"%";case 31:return"==";case 32:return"!=";case 33:return">";case 34:return"<";case 35:return">=";case 36:return"<=";case 37:return e.word?"and":"&&";case 38:return e.word?"or":"||";case 39:return"!";case 40:return"->";case 41:return":";case 42:return"?";case 43:return",";case 44:return".";case 45:return"{";case 46:return"}";case 47:return"(";case 48:return")";case 49:return"[";case 50:return"]";case 51:let m=e.content;return"comment";case 52:let f=e.content;return"multiline comment";case 53:let g=e.content;return"hash comment";case 54:return"indent";case 55:return"unindent";case 56:return"line break";case 57:return"end of file"}}}Q["loreline.TokenTypeHelpers"]=Nt,Nt.__name__="loreline.TokenTypeHelpers";class ye{constructor(e,t){this.type=e,this.pos=t}toString(){return""+Y.string(this.type)+" at "+this.pos.toString()}}Q["loreline.Token"]=ye,ye.__name__="loreline.Token",Object.assign(ye.prototype,{__class__:ye});class kt{constructor(e){this.keepOrphanExpressions=!1,this.errors=null,this.allowTabs=!0,this.detectedIndentSize=2,this.indentSize=4,this.indentTokens=[],this.indentStack=[],this.indentLevel=0,this.input=e,this.length=e.length,this.reset()}reset(){this.pos=0,this.line=1,this.column=1,this.startLine=1,this.startColumn=1,this.previous=null,this.stack=[],this.nextBlock=10,this.tokenized=null,this.strictExprs=[],this.indentLevel=0,this.indentStack=[0],this.indentTokens=[]}tokenize(){let e=[];for(this.tokenized=e;;){let t=this.nextToken();if(t.type==k.Eof){if(this.indentStack.length>1){let l=this.indentStack.length-1,i=0,n=l;for(;i<n;){let s=i++,r=null;r==null&&(r=new ue(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let a=new ye(k.Unindent,r);this.previous=a,e.push(a)}}break}switch(e.push(t),t.type._hx_index){case 1:this.nextBlock=3;break;case 2:this.nextBlock=7;break;case 3:this.nextBlock=5;break;case 4:this.nextBlock=1;break;case 8:case 9:case 10:case 11:case 12:case 13:this.nextBlock=9;break;case 45:let l;switch(this.nextBlock){case 0:case 1:l=0;break;case 2:case 3:l=2;break;case 4:case 5:l=4;break;case 6:case 7:l=7;break;case 8:case 9:l=8;break;case 10:case 11:case 12:l=10;break}this.stack.push(l),this.nextBlock=10;break;case 49:this.stack.push(12),this.nextBlock=10;break;case 46:case 50:case 55:this.stack.pop(),this.nextBlock=10;break;case 54:let i;switch(this.nextBlock){case 0:case 1:i=1;break;case 2:case 3:i=3;break;case 4:case 5:i=5;break;case 6:case 7:i=7;break;case 8:case 9:i=9;break;case 10:case 11:case 12:i=11;break}this.stack.push(i),this.nextBlock=10;break;default:}}return e}nextToken(){if(this.indentTokens.length>0)return this.indentTokens.shift();if(this.skipWhitespace(),this.pos>=this.length){let i=null;i==null&&(i=new ue(this.startLine,this.startColumn,this.pos)),i.length=this.pos-i.offset;let n=new ye(k.Eof,i);return this.previous=n,n}this.startLine=this.line,this.startColumn=this.column;let e=c.cca(this.input,this.pos),t=e??-1;if(t==10||t==13){let i=this.readLineBreak(),n=this.countIndentation();if(n>this.indentStack[this.indentStack.length-1]){this.indentStack.length==1&&(this.detectedIndentSize=n-this.indentStack[0]),this.indentStack.push(n);let s=this.indentTokens,r=null;r==null&&(r=new ue(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let a=new ye(k.Indent,r);this.previous=a,s.push(a)}else if(n<this.indentStack[this.indentStack.length-1])for(;this.indentStack.length>0&&n<this.indentStack[this.indentStack.length-1];){this.indentStack.pop();let s=this.indentTokens,r=null;r==null&&(r=new ue(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let a=new ye(k.Unindent,r);this.previous=a,s.push(a)}return i}let l=new ue(this.startLine,this.startColumn,this.pos);if(this.tokenized.length>0&&this.tokenized[this.tokenized.length-1].type==k.KwImport)return this.readImportValue(t,l);switch(t){case 34:let i=this.tryReadUnquotedString();return i??this.readString(l);case 91:let n=0,s=1;for(;n<s;){let w=n++;if(this.pos>=this.length)break;let y=c.cca(this.input,this.pos);(y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.makeLooseOrStrictAfterBracket();let r=l;r==null&&(r=new ue(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let a=new ye(k.LBracket,r);return this.previous=a,a;case 123:let h=0,o=1;for(;h<o;){let w=h++;if(this.pos>=this.length)break;let y=c.cca(this.input,this.pos);(y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let u=l;u==null&&(u=new ue(this.startLine,this.startColumn,this.pos)),u.length=this.pos-u.offset;let p=new ye(k.LBrace,u);return this.previous=p,p;case 125:let _=0,m=1;for(;_<m;){let w=_++;if(this.pos>=this.length)break;let y=c.cca(this.input,this.pos);(y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let f=l;f==null&&(f=new ue(this.startLine,this.startColumn,this.pos)),f.length=this.pos-f.offset;let g=new ye(k.RBrace,f);return this.previous=g,g;default:let d=this.tryReadUnquotedString();if(d!=null)return d;switch(t){case 33:let w=t;if(w>=48&&w<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpNotEquals,ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpNot,le);return this.previous=ee,ee}}}break;case 35:let y=t;if(y>=48&&y<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;return se>=97&&se<=122||se>=65&&se<=90||se==95||se>=48&&se<=57||se==45?this.readHashComment():(this.error("Unexpected character: #",!0),null)}}break;case 37:let S=t;if(S>=48&&S<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se=0,j=1;for(;se<j;){let ee=se++;if(this.pos>=this.length)break;let pe=c.cca(this.input,this.pos);(pe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ie=l;ie==null&&(ie=new ue(this.startLine,this.startColumn,this.pos)),ie.length=this.pos-ie.offset;let le=new ye(k.OpModulo,ie);return this.previous=le,le}}break;case 38:let T=t;if(T>=48&&T<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==38){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpAnd(!1),ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error("Expected &",!1);let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpAnd(!1),le);return this.previous=ee,ee}}}break;case 40:let O=0,E=1;for(;O<E;){let $=O++;if(this.pos>=this.length)break;let se=c.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.makeStrictIfFollowingCallable();let v=l;v==null&&(v=new ue(this.startLine,this.startColumn,this.pos)),v.length=this.pos-v.offset;let M=new ye(k.LParen,v);return this.previous=M,M;case 41:let A=0,L=1;for(;A<L;){let $=A++;if(this.pos>=this.length)break;let se=c.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.strictExprs.pop();let I=l;I==null&&(I=new ue(this.startLine,this.startColumn,this.pos)),I.length=this.pos-I.offset;let q=new ye(k.RParen,I);return this.previous=q,q;case 42:let z=t;if(z>=48&&z<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpMultiplyAssign,ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpMultiply,le);return this.previous=ee,ee}}}break;case 43:let P=t;if(P>=48&&P<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpPlusAssign,ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpPlus,le);return this.previous=ee,ee}}}break;case 44:let B=0,N=1;for(;B<N;){let $=B++;if(this.pos>=this.length)break;let se=c.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let D=l;D==null&&(D=new ue(this.startLine,this.startColumn,this.pos)),D.length=this.pos-D.offset;let U=new ye(k.Comma,D);return this.previous=U,U;case 45:let W=t;if(W>=48&&W<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==62){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.Arrow,ee);return this.previous=pe,pe}else{let j;if(this.pos+1<this.length){let ie=c.cca(this.input,this.pos+1);j=ie??-1}else j=0;if(j==45&&this.strictExprs.length==0){let ie=2;ie==null&&(ie=1);let le=0,ee=ie;for(;le<ee;){let we=le++;if(this.pos>=this.length)break;let Ze=c.cca(this.input,this.pos);(Ze??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let pe=l;pe==null&&(pe=new ue(this.startLine,this.startColumn,this.pos)),pe.length=this.pos-pe.offset;let me=new ye(k.Separator,pe);return this.previous=me,me}else{let ie;if(this.pos+1<this.length){let le=c.cca(this.input,this.pos+1);ie=le??-1}else ie=0;if(ie==61){let le=2;le==null&&(le=1);let ee=0,pe=le;for(;ee<pe;){let Ze=ee++;if(this.pos>=this.length)break;let yt=c.cca(this.input,this.pos);(yt??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let me=l;me==null&&(me=new ue(this.startLine,this.startColumn,this.pos)),me.length=this.pos-me.offset;let we=new ye(k.OpMinusAssign,me);return this.previous=we,we}else{let le=0,ee=1;for(;le<ee;){let we=le++;if(this.pos>=this.length)break;let Ze=c.cca(this.input,this.pos);(Ze??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let pe=l;pe==null&&(pe=new ue(this.startLine,this.startColumn,this.pos)),pe.length=this.pos-pe.offset;let me=new ye(k.OpMinus,pe);return this.previous=me,me}}}}}break;case 46:let J=0,H=1;for(;J<H;){let $=J++;if(this.pos>=this.length)break;let se=c.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=l;X==null&&(X=new ue(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let ae=new ye(k.Dot,X);return this.previous=ae,ae;case 47:let ce=t;if(ce>=48&&ce<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpDivideAssign,ee);return this.previous=pe,pe}else{let j;if(this.pos+1<this.length){let ie=c.cca(this.input,this.pos+1);j=ie??-1}else j=0;if(j==47)return this.readLineComment();{let ie;if(this.pos+1<this.length){let le=c.cca(this.input,this.pos+1);ie=le??-1}else ie=0;if(ie==42)return this.readMultiLineComment();{let le=0,ee=1;for(;le<ee;){let we=le++;if(this.pos>=this.length)break;let Ze=c.cca(this.input,this.pos);(Ze??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let pe=l;pe==null&&(pe=new ue(this.startLine,this.startColumn,this.pos)),pe.length=this.pos-pe.offset;let me=new ye(k.OpDivide,pe);return this.previous=me,me}}}}}break;case 58:let ne;if(this.pos+1<this.length){let $=c.cca(this.input,this.pos+1);ne=$??-1}else ne=0;if(ne==61){let $=2;$==null&&($=1);let se=0,j=$;for(;se<j;){let ee=se++;if(this.pos>=this.length)break;let pe=c.cca(this.input,this.pos);(pe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ie=l;ie==null&&(ie=new ue(this.startLine,this.startColumn,this.pos)),ie.length=this.pos-ie.offset;let le=new ye(k.OpUnquotedAssign,ie);return this.previous=le,le}else{let $=0,se=1;for(;$<se;){let le=$++;if(this.pos>=this.length)break;let ee=c.cca(this.input,this.pos);(ee??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let j=l;j==null&&(j=new ue(this.startLine,this.startColumn,this.pos)),j.length=this.pos-j.offset;let ie=new ye(k.Colon,j);return this.previous=ie,ie}break;case 60:let re=t;if(re>=48&&re<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpLessEq,ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpLess,le);return this.previous=ee,ee}}}break;case 61:let xe=t;if(xe>=48&&xe<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpEquals,ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpAssign,le);return this.previous=ee,ee}}}break;case 62:let Pe=t;if(Pe>=48&&Pe<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpGreaterEq,ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpGreater,le);return this.previous=ee,ee}}}break;case 63:let Ue=t;if(Ue>=48&&Ue<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{this.pos++;let se=null;se==null&&(se=new ue(this.startLine,this.startColumn,this.pos)),se.length=this.pos-se.offset;let j=new ye(k.Question,se);return this.previous=j,j}}break;case 93:let Je=0,lt=1;for(;Je<lt;){let $=Je++;if(this.pos>=this.length)break;let se=c.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.strictExprs.pop();let Ve=l;Ve==null&&(Ve=new ue(this.startLine,this.startColumn,this.pos)),Ve.length=this.pos-Ve.offset;let Qe=new ye(k.RBracket,Ve);return this.previous=Qe,Qe;case 124:let at=t;if(at>=48&&at<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==124){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpOr(!1),ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error("Expected |",!1);let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpOr(!1),le);return this.previous=ee,ee}}}break;default:let Re=t;if(Re>=48&&Re<=57)return this.readNumber();{let $=t;return $>=97&&$<=122||$>=65&&$<=90||$==95?this.readIdentifier():(this.error("Unexpected character: "+String.fromCodePoint(t),!0),null)}}}}countIndentation(){let e=this.pos,t=0;for(;e<this.length;){let n=c.cca(this.input,e),s=n??-1;if(s==32)++t;else if(s==9)++t;else break;++e}let l,i;if(e<this.length){let n=c.cca(this.input,e);i=(n??-1)==10}else i=!0;if(i)l=!0;else{let n=c.cca(this.input,e);l=(n??-1)==13}return l?this.indentStack[this.indentStack.length-1]:t}parentBlockType(){let e=this.stack.length-1;for(;e>=0;){if(this.stack[e]!=10&&this.stack[e]!=11&&this.stack[e]!=12)switch(this.stack[e]){case 0:case 1:return k.KwBeat;case 2:case 3:return k.KwState;case 4:case 5:return k.KwCharacter;case 6:case 7:return k.KwBeat;case 8:case 9:return k.KwBeat;case 10:return k.LBrace;case 11:return k.Indent;case 12:return k.LBracket}--e}return k.KwBeat}inBeat(){return this.parentBlockType()==k.KwBeat}inChoiceRoot(){return this.stack.length>0?this.stack[this.stack.length-1]!=1?this.stack[this.stack.length-1]==0:!0:!1}inStateOrCharacter(){let e=this.parentBlockType();return e!=k.KwState?e==k.KwCharacter:!0}readLineBreak(){let e=new ue(this.startLine,this.startColumn,this.pos),t=c.cca(this.input,this.pos);if((t??-1)==13){let n=0,s=1;for(;n<s;){let a=n++;if(this.pos>=this.length)break;let h=c.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let r;if(this.pos<this.length){let a=c.cca(this.input,this.pos);r=(a??-1)==10}else r=!1;if(r){let a=0,h=1;for(;a<h;){let o=a++;if(this.pos>=this.length)break;let u=c.cca(this.input,this.pos);(u??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else{let n=0,s=1;for(;n<s;){let r=n++;if(this.pos>=this.length)break;let a=c.cca(this.input,this.pos);(a??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let l=e;l==null&&(l=new ue(this.startLine,this.startColumn,this.pos)),l.length=this.pos-l.offset;let i=new ye(k.LineBreak,l);return this.previous=i,i}isWhitespace(e){return e!=32?e==9:!0}matchIdentifier(e){if(this.length==0)return null;let t=c.cca(this.input,e),l=t??-1;if(!(l>=97&&l<=122||l>=65&&l<=90||l==95))return null;let i=1;for(;i<this.length;){let s=c.cca(this.input,e+i),r=s??-1;if(!(r>=97&&r<=122||r>=65&&r<=90||r==95||r>=48&&r<=57))break;++i}let n=this.input;return i!=null?c.substr(n,e,i):c.substr(n,e,null)}_skipWhitespaceAndComments(e,t){if(t==null&&(t=!1),t)return this._skipWhitespaceAndCommentsStopNextLine(e);{let l=e,i=!1;for(;e<this.length;){for(;;){let n;if(e<this.length){let s=c.cca(this.input,e);if((s??-1)!=32){let r=c.cca(this.input,e);n=(r??-1)==9}else n=!0}else n=!1;if(!n)break;++e,i=!0}if(e<this.length-1){let n=c.cca(this.input,e);if((n??-1)==47){let s=c.cca(this.input,e+1);if((s??-1)==47)return e=l,e;{let r=c.cca(this.input,e+1);if((r??-1)==42){e+=2,i=!0;let a=!1;for(;e<this.length-1;){let h,o=c.cca(this.input,e);if((o??-1)==42){let u=c.cca(this.input,e+1);h=(u??-1)==47}else h=!1;if(h){e+=2,a=!0;break}++e}if(!a)return e=l,e;continue}}}}break}return i?e:l}}_skipWhitespaceAndCommentsStopNextLine(e){let t=e,l=!1,i=!1;for(;e<this.length;){for(;e<this.length;){let n=c.cca(this.input,e),s=n??-1;if(s==32||s==9||s==13||!i&&s==10)s==10&&(i=!0),++e,l=!0;else break}if(e<this.length-1&&!i){let n=c.cca(this.input,e);if((n??-1)==47){let s=c.cca(this.input,e+1);if((s??-1)==47){for(e+=2,l=!0;;){let r,a;if(e<this.length){let h=c.cca(this.input,e);a=(h??-1)!=10}else a=!1;if(a){let h=c.cca(this.input,e);r=(h??-1)!=13}else r=!1;if(!r)break;++e}continue}else{let r=c.cca(this.input,e+1);if((r??-1)==42){e+=2,l=!0;let a=!1;for(;e<this.length-1;){let h,o=c.cca(this.input,e);if((o??-1)==42){let u=c.cca(this.input,e+1);h=(u??-1)==47}else h=!1;if(h){e+=2,a=!0;break}++e}if(!a)return e=t,e;continue}}}}break}return l?e:t}isIfStart(e){e=this._skipWhitespaceAndComments(e,!1);let t=c.cca(this.input,e);if((t??-1)!=105)return!1;++e;let l=c.cca(this.input,e);if((l??-1)!=102)return!1;let i=++e;e=this._skipWhitespaceAndComments(e,!1);let n;if(e<this.length){let o=c.cca(this.input,e);n=(o??-1)==33}else n=!1;n&&(++e,e=this._skipWhitespaceAndComments(e,!1));let s=c.cca(this.input,e);if((s??-1)==40)return!0;let r;if(e==i&&i<this.length){let o=c.cca(this.input,i),u=o??-1;if(u>=97&&u<=122||u>=65&&u<=90||u==95)r=!0;else{let p=c.cca(this.input,i),_=p??-1;r=_>=48&&_<=57}}else r=!1;if(r)return!1;let a;if(e<this.length){let o=c.cca(this.input,e),u=o??-1;if(u>=97&&u<=122||u>=65&&u<=90||u==95)a=!1;else{let p=c.cca(this.input,e),_=p??-1;a=!(_>=48&&_<=57)}}else a=!0;if(a)return!1;let h=this;for(;e<this.length;){let o=c.cca(this.input,e);if((o??-1)==40)return!0;{let T=c.cca(this.input,e),O=T??-1;if(O>=48&&O<=57)for(;;){let E;if(e<this.length){let v=c.cca(this.input,e),M=v??-1;if(M>=48&&M<=57)E=!0;else{let A=c.cca(this.input,e);E=(A??-1)==46}}else E=!1;if(!E)break;++e}else{let E=!0,v=h.length;if(e>=v)E=!1;else{let M,A,L;if(e+1<v){let I=c.cca(h.input,e);L=(I??-1)==111}else L=!1;if(L){let I=c.cca(h.input,e+1);A=(I??-1)==114}else A=!1;if(A)if(e+2<v){let I=c.cca(h.input,e+2),q=I??-1;M=!(q>=97&&q<=122||q>=65&&q<=90||q==95)}else M=!0;else M=!1;if(M)E=!1;else{let I,q,z,P;if(e+2<v){let B=c.cca(h.input,e);P=(B??-1)==97}else P=!1;if(P){let B=c.cca(h.input,e+1);z=(B??-1)==110}else z=!1;if(z){let B=c.cca(h.input,e+2);q=(B??-1)==100}else q=!1;if(q)if(e+3<v){let B=c.cca(h.input,e+3),N=B??-1;I=!(N>=97&&N<=122||N>=65&&N<=90||N==95)}else I=!0;else I=!1;if(I)E=!1;else{let B=c.cca(h.input,e),N=B??-1;if(!(N>=97&&N<=122||N>=65&&N<=90||N==95))E=!1;else for(++e;e<h.length;){let D=c.cca(h.input,e);if(N=D??-1,!(N>=97&&N<=122||N>=65&&N<=90||N==95||N>=48&&N<=57))break;++e}}}}if(!E)return!1}}if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let u=c.cca(this.input,e),p=u??-1;if(p==46){++e,e=this._skipWhitespaceAndComments(e,!1);let T=!0,O=h.length;if(e>=O)T=!1;else{let v,M,A;if(e+1<O){let L=c.cca(h.input,e);A=(L??-1)==111}else A=!1;if(A){let L=c.cca(h.input,e+1);M=(L??-1)==114}else M=!1;if(M)if(e+2<O){let L=c.cca(h.input,e+2),I=L??-1;v=!(I>=97&&I<=122||I>=65&&I<=90||I==95)}else v=!0;else v=!1;if(v)T=!1;else{let L,I,q,z;if(e+2<O){let P=c.cca(h.input,e);z=(P??-1)==97}else z=!1;if(z){let P=c.cca(h.input,e+1);q=(P??-1)==110}else q=!1;if(q){let P=c.cca(h.input,e+2);I=(P??-1)==100}else I=!1;if(I)if(e+3<O){let P=c.cca(h.input,e+3),B=P??-1;L=!(B>=97&&B<=122||B>=65&&B<=90||B==95)}else L=!0;else L=!1;if(L)T=!1;else{let P=c.cca(h.input,e),B=P??-1;if(!(B>=97&&B<=122||B>=65&&B<=90||B==95))T=!1;else for(++e;e<h.length;){let N=c.cca(h.input,e);if(B=N??-1,!(B>=97&&B<=122||B>=65&&B<=90||B==95||B>=48&&B<=57))break;++e}}}}if(!T||(e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!0;let E=c.cca(this.input,e);p=E??-1}if(p==91){++e;let T=1;for(;e<this.length&&T>0;){let E=c.cca(this.input,e);p=E??-1,p==91&&++T,p==93&&--T,++e}if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let O=c.cca(this.input,e);p=O??-1}let _,m,f;if(p==97){let T=c.cca(this.input,e+1);f=(T??-1)==110}else f=!1;if(f){let T=c.cca(this.input,e+2);m=(T??-1)==100}else m=!1;if(m)if(e+3<this.length){let T=c.cca(this.input,e+3),O=T??-1;_=!(O>=97&&O<=122||O>=65&&O<=90||O==95)}else _=!0;else _=!1;if(_)return!0;let g,d;if(p==111){let T=c.cca(this.input,e+1);d=(T??-1)==114}else d=!1;if(d)if(e+2<this.length){let T=c.cca(this.input,e+2),O=T??-1;g=!(O>=97&&O<=122||O>=65&&O<=90||O==95)}else g=!0;else g=!1;if(g)return!0;let w,y,S;if(p==40||p==38||p==124)S=!0;else{let T=c.cca(this.input,e+1);S=(T??-1)==61&&p==61}if(S||p==62||p==60)y=!0;else if(p==33){let T=c.cca(this.input,e+1);y=(T??-1)==61}else y=!1;if(y)w=!0;else{let T=c.cca(this.input,e+1);w=(T??-1)!=61&&(p==43||p==45||p==42||p==47||p==123)}if(w)return!0;if(p==10||p==13||e>=this.length)return e=i,!0;if(p==32||p==9){let T=e;for(;;){let v;if(T<this.length){let M=c.cca(this.input,T),A=M??-1;v=A==32||A==9}else v=!1;if(!v)break;++T}let O,E;if(T+1<this.length){let v=c.cca(this.input,T);E=(v??-1)==47}else E=!1;if(E){let v=c.cca(this.input,T+1);O=(v??-1)==47}else O=!1;if(O)return!0}return!1}return!0}isIdentifierExpressionStart(e,t){if(e=this._skipWhitespaceAndComments(e,!1),e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!1;let l=c.cca(this.input,e);if((l??-1)==40)return!0;let i=this,n=t;n==null&&(n=!1);let s=!0;if(e>=i.length)s=!1;else{let r=!1,a=c.cca(i.input,e),h=a??-1;if(r=h==95,!(h>=97&&h<=122||h>=65&&h<=90||h==95)||n&&!r&&!(h>=97&&h<=122))s=!1;else for(++e;e<i.length;){let o=r,u=c.cca(i.input,e);if(h=u??-1,r=h==95,!(h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57))break;if(n&&o&&!r&&!(h>=97&&h<=122)){s=!1;break}++e}}if(!s)return!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let r=c.cca(this.input,e),a=r??-1;if(!(a==32||a==9)&&a!=46&&a!=91&&a!=10&&a!=13&&a!=47)return!1;let h;if(a==10||a==13)h=!0;else if(a==47&&e+1<this.length){let o=c.cca(this.input,e+1);if((o??-1)!=47){let u=c.cca(this.input,e+1);h=(u??-1)==42}else h=!0}else h=!1;if(h)return!0;if(a==46){if(++e,e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let o=!0;if(e>=i.length)o=!1;else{let u=!1,p=c.cca(i.input,e),_=p??-1;if(u=_==95,!(_>=97&&_<=122||_>=65&&_<=90||_==95))o=!1;else for(++e;e<i.length;){let m=u,f=c.cca(i.input,e);if(_=f??-1,u=_==95,!(_>=97&&_<=122||_>=65&&_<=90||_==95||_>=48&&_<=57))break;++e}}if(!o)return!0;continue}if(a==91){++e;let o=1;for(;e<this.length&&o>0;){let u=c.cca(this.input,e);if(a=u??-1,a==34){if(e=this.scanStringEnd(e,!1),e==-1)return!1;continue}a==91&&++o,a==93&&--o,++e}continue}if(a==32||a==9){++e;continue}break}return!0}isTransitionStart(e){let t,l=c.cca(this.input,e);if((l??-1)!=45||e>=this.length-1)t=!0;else{let s=c.cca(this.input,e+1);t=(s??-1)!=62}if(t||(e+=2,e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!1;let i=c.cca(this.input,e);if((i??-1)==46)++e;else{let s=c.cca(this.input,e),r=s??-1;if(r>=97&&r<=122||r>=65&&r<=90||r==95||r>=48&&r<=57)for(++e;;){let a;if(e<this.length){let h=c.cca(this.input,e),o=h??-1;a=o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57}else a=!1;if(!a)break;++e}else return!1}if(e=this._skipWhitespaceAndComments(e,!1),e<this.length){let s=c.cca(this.input,e),r=s??-1;if(r!=10&&r!=13&&r!=32&&r!=9&&r!=47&&r!=35)return!1}return!0}isInsertionStart(e){let t=c.cca(this.input,e);if((t??-1)!=43||(++e,e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!1;let l=c.cca(this.input,e);if((l??-1)==46)++e;else{let n=c.cca(this.input,e),s=n??-1;if(s>=97&&s<=122||s>=65&&s<=90||s==95||s>=48&&s<=57)for(++e;;){let r;if(e<this.length){let a=c.cca(this.input,e),h=a??-1;r=h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57}else r=!1;if(!r)break;++e}else return!1}if(e=this._skipWhitespaceAndComments(e,!1),e<this.length){let n=c.cca(this.input,e),s=n??-1,r;if(s==105&&e+1<this.length){let a=c.cca(this.input,e+1);r=(a??-1)==102}else r=!1;if(r){let a;if(e+2<this.length){let h=c.cca(this.input,e+2),o=h??-1;a=!(o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57)}else a=!0;if(a)return!0}if(s!=10&&s!=13&&s!=32&&s!=9&&s!=47)return!1}return!0}isChoiceOnceStart(e){if(!this.inChoiceRoot())return!1;let t=c.cca(this.input,e);if((t??-1)!=45||(++e,e>=this.length))return!1;let l=c.cca(this.input,e);return(l??-1)==32}isLabelStart(e){e=this._skipWhitespaceAndComments(e,!1);let t=c.cca(this.input,e),l=t??-1;if(!(l>=97&&l<=122||l>=65&&l<=90||l==95))return!1;let i=e;for(++e;;){let h;if(e<this.length){let o=c.cca(this.input,e),u=o??-1;h=u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57}else h=!1;if(!h)break;++e}for(;;){let h;if(e<this.length){let o=c.cca(this.input,e),u=o??-1;h=u==32||u==9}else h=!1;if(!h)break;++e}let n;if(e<this.length){let h=c.cca(this.input,e);n=(h??-1)!=58}else n=!0;if(n)return!1;let s=this.input,r=e-i,a=r!=null?c.substr(s,i,r):c.substr(s,i,null);return!Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,a)}isCallStart(e){let t=e,l=this,i=!0;if(e>=l.length)i=!1;else{let n=c.cca(l.input,e),s=n??-1;if(!(s>=97&&s<=122||s>=65&&s<=90||s==95))i=!1;else for(++e;e<l.length;){let r=c.cca(l.input,e);if(s=r??-1,!(s>=97&&s<=122||s>=65&&s<=90||s==95||s>=48&&s<=57))break;++e}}if(!i)return e=t,!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return e=t,!1;let n=c.cca(this.input,e),s=n??-1;if(s==40)return e=t,!0;if(s==46){++e,e=this._skipWhitespaceAndComments(e,!1);let r=!0;if(e>=l.length)r=!1;else{let a=c.cca(l.input,e),h=a??-1;if(!(h>=97&&h<=122||h>=65&&h<=90||h==95))r=!1;else for(++e;e<l.length;){let o=c.cca(l.input,e);if(h=o??-1,!(h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57))break;++e}}if(!r)return e=t,!1;continue}if(s==91){for(++e;e<this.length;){let r=c.cca(this.input,e),a=r??-1;if(a==34){if(e=this.scanStringEnd(e,!1),e==-1)return e=t,!1;continue}if(a==93){++e;break}++e}continue}return e=t,!1}return e=t,!1}isAssignStart(e,t){let l=this,i;if(t){let s=!0,r=e;if(e>=l.length)s=!1;else{let o=c.cca(l.input,e),u=o??-1;if(!(u>=97&&u<=122||u>=65&&u<=90||u==95))s=!1;else for(++e;e<l.length;){let p=c.cca(l.input,e);if(u=p??-1,!(u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57))break;++e}}let a,h;if(e==r+2){let o=c.cca(l.input,r);h=(o??-1)==105}else h=!1;if(h){let o=c.cca(l.input,r+1);a=(o??-1)==102}else a=!1;i=!(!a&&s)}else i=!1;if(i)return!1;let n=!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!1;let s=c.cca(this.input,e),r=s??-1,a;if(n)a=!1;else{let h;if(r==61)if(e+1<this.length){let o=c.cca(this.input,e+1);h=(o??-1)!=61}else h=!0;else h=!1;if(h)a=!0;else{let o=c.cca(this.input,e+1);a=(o??-1)==61&&(r==43||r==45||r==42||r==47||r==58)}}if(a)return!0;if(t){if(r==46){++e,e=this._skipWhitespaceAndComments(e,!1);let h=!0,o=e;if(e>=l.length)h=!1;else{let _=c.cca(l.input,e),m=_??-1;if(!(m>=97&&m<=122||m>=65&&m<=90||m==95))h=!1;else for(++e;e<l.length;){let f=c.cca(l.input,e);if(m=f??-1,!(m>=97&&m<=122||m>=65&&m<=90||m==95||m>=48&&m<=57))break;++e}}let u,p;if(e==o+2){let _=c.cca(l.input,o);p=(_??-1)==105}else p=!1;if(p){let _=c.cca(l.input,o+1);u=(_??-1)==102}else u=!1;if(!(!u&&h))return!1;continue}if(r==91){for(++e;e<this.length;){let h=c.cca(this.input,e),o=h??-1;if(o==34){if(e=this.scanStringEnd(e,!1),e==-1)return!1;continue}if(o==93){++e;break}++e}continue}return!1}else if(r==92)n=!0,++e;else{if(r==13||r==10)return!1;if(r==34){if(e=this.scanStringEnd(e,!1),e==-1)return!1}else if(r>=97&&r<=122||r>=65&&r<=90||r==95){let h=!0,o=e;if(e>=l.length)h=!1;else{let _=c.cca(l.input,e),m=_??-1;if(!(m>=97&&m<=122||m>=65&&m<=90||m==95))h=!1;else for(++e;e<l.length;){let f=c.cca(l.input,e);if(m=f??-1,!(m>=97&&m<=122||m>=65&&m<=90||m==95||m>=48&&m<=57))break;++e}}let u,p;if(e==o+2){let _=c.cca(l.input,o);p=(_??-1)==105}else p=!1;if(p){let _=c.cca(l.input,o+1);u=(_??-1)==102}else u=!1;if(!(!u&&h))return!1}else{let h;if((r==61||r==33||r==60||r==62)&&e+1<this.length){let o=c.cca(this.input,e+1);h=(o??-1)==61}else h=!1;h?e+=2:++e}}}return!1}isColon(e,t){if(t==null&&(t=!0),t)for(;;){let l;if(e<this.length){let i=c.cca(this.input,e);if((i??-1)!=32){let n=c.cca(this.input,e);l=(n??-1)==9}else l=!0}else l=!1;if(!l)break;++e}if(e<this.length){let l=c.cca(this.input,e);return(l??-1)==58}else return!1}afterLabelIdentifierToken(e){e==null&&(e=!0);let t=this.tokenized.length-1;for(;t>=0;){let l=this.tokenized[t];if(!Nt.isComment(l.type)&&(e||l.type!=k.LineBreak&&l.type!=k.Indent&&l.type!=k.Unindent))return l.type==k.Colon&&t>0&&Nt.isIdentifier(this.tokenized[t-1].type)?t-1:-1;--t}return-1}isStartingMultilineDialogue(e){let t=this.tokenized[e],l=e+1;for(;this.tokenized[l].type!=k.Colon;)++l;let i=this.tokenized[l].pos.offset+1,n=t.pos.column,s=!0,r=!1;for(;i<this.length;){let g=c.cca(this.input,i),d=g??-1;if(d==32||d==9)++i;else break}for(;i<this.length;){let g=c.cca(this.input,i),d=g??-1;if(d==10||d==13)break;if(d==47&&i+1<this.length){let w=c.cca(this.input,i+1),y=w??-1;if(y==47)break;if(y==42){for(i+=2;i<this.length;){let S,T=c.cca(this.input,i);if((T??-1)==42&&i+1<this.length){let O=c.cca(this.input,i+1);S=(O??-1)==47}else S=!1;if(S){i+=2;break}++i}continue}}if(d==60)r=!0;else if(d==62)r=!1;else if(!r&&!(d==32||d==9)){s=!1;break}++i}if(!s)for(;;){let g,d;if(i<this.length){let w=c.cca(this.input,i);d=(w??-1)!=10}else d=!1;if(d){let w=c.cca(this.input,i);g=(w??-1)!=13}else g=!1;if(!g)break;++i}let a=i,h=!0;if(h==null&&(h=!1),i=this._skipWhitespaceAndComments(i,h),i<=a)return-1;let o=0,u=i;for(;;){let g;if(u>0){let d=c.cca(this.input,u-1);if((d??-1)!=32){let w=c.cca(this.input,u-1);g=(w??-1)==9}else g=!0}else g=!1;if(!g)break;++o,--u}if(o<=n-1)return-1;let p=!1;p==null&&(p=!1),i=this._skipWhitespaceAndComments(i,p);let _,m=c.cca(this.input,i),f=m??-1;if(f==32||f==9)_=!0;else{let g=c.cca(this.input,i);if((g??-1)==47){let d=c.cca(this.input,i+1);_=(d??-1)==47}else _=!1}return _?-1:o}isContinuingMultilineText(e,t){let l,i=c.cca(this.input,e);if((i??-1)==47){let m=c.cca(this.input,e+1);l=(m??-1)==47}else l=!1;if(l)for(;;){let m,f;if(e<this.length){let g=c.cca(this.input,e);f=(g??-1)!=13}else f=!1;if(f){let g=c.cca(this.input,e);m=(g??-1)!=10}else m=!1;if(!m)break;++e}let n=c.cca(this.input,e);(n??-1)==13&&++e;let s=c.cca(this.input,e);if((s??-1)==10)++e;else return!1;let r=0;for(;;){let m,f=c.cca(this.input,e);if((f??-1)!=32){let g=c.cca(this.input,e);m=(g??-1)==9}else m=!0;if(!m)break;++r,++e}if(r!=t)return!1;let a=!1;a==null&&(a=!1),e=this._skipWhitespaceAndComments(e,a);let h,o,u,p=c.cca(this.input,e),_=p??-1;if(_==32||_==9)u=!0;else{let m=c.cca(this.input,e);u=(m??-1)==13}if(u)o=!0;else{let m=c.cca(this.input,e);o=(m??-1)==10}if(o)h=!0;else{let m=c.cca(this.input,e);if((m??-1)==47){let f=c.cca(this.input,e+1);h=(f??-1)==47}else h=!1}return!h}isAfterComma(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(!Nt.isComment(t.type)&&t.type!=k.LineBreak&&t.type!=k.Indent&&t.type!=k.Unindent)return t.type==k.Comma;--e}return!1}isAfterLBracket(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(!Nt.isComment(t.type)&&t.type!=k.LineBreak&&t.type!=k.Indent&&t.type!=k.Unindent)return t.type==k.LBracket;--e}return!1}isInsideBrackets(){let e=this.stack.length-1;for(;e>=0&&this.stack[e]==11;)--e;return e>=0?this.stack[e]==12:!1}followsAssignStart(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Nt.isComment(t.type)||t.type==k.Indent||t.type==k.Unindent)--e;else return!!Nt.isAssignOp(t.type)}return!1}followsUnquotedAssign(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Nt.isComment(t.type)||t.type==k.Indent||t.type==k.Unindent)--e;else return t.type==k.OpUnquotedAssign}return!1}followsOnlyLabelOrCommentsInLine(){let e=!1,t=this.tokenized.length-1;for(;t>=0;){let l=this.tokenized[t];if(Nt.isComment(l.type)||l.type==k.Indent||l.type==k.Unindent)--t;else if(!e&&l.type==k.Colon)if(--t,t>=0)Nt.isIdentifier(this.tokenized[t].type)&&(e=!0,--t);else return!1;else return l.type==k.LineBreak}return!0}followsOnlyWhitespacesOrCommentsInLine(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Nt.isComment(t.type)||t.type==k.Indent||t.type==k.Unindent)--e;else return t.type==k.LineBreak}return!0}followsChoiceOncePrefix(){if(!this.inChoiceRoot())return!1;let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Nt.isComment(t.type)||t.type==k.Indent||t.type==k.Unindent)--e;else if(t.type==k.OpMinus){for(--e;e>=0&&(Nt.isComment(this.tokenized[e].type)||this.tokenized[e].type==k.Indent||this.tokenized[e].type==k.Unindent);)--e;return e>=0?this.tokenized[e].type==k.LineBreak:!0}else return!1}return!1}hasNonSpecialChar(e){let t=0,l=e.length;for(;t<l;){let i=t++,n=!1,s=c.cca(e,i),r=s??-1,a=0,h=kt.hasNonSpecialChar_specialChars.length;for(;a<h;){let o=a++,u=c.cca(kt.hasNonSpecialChar_specialChars,o);if(r==(u??-1)){n=!0;break}}if(!n)return!0}return!1}isNumber(e){let t=0,l=e.length,i;if(t<l){let a=c.cca(e,t);i=(a??-1)==45}else i=!1;i&&++t;let n=t;for(;;){let a;if(t<l){let h=c.cca(e,t),o=h??-1;a=o>=48&&o<=57}else a=!1;if(!a)break;++t}if(t==n)return!1;let s,r;if(t<l){let a=c.cca(e,t);r=(a??-1)==46}else r=!1;if(r&&t+1<l){let a=c.cca(e,t+1),h=a??-1;s=h>=48&&h<=57}else s=!1;if(s)for(++t;;){let a;if(t<l){let h=c.cca(e,t),o=h??-1;a=o>=48&&o<=57}else a=!1;if(!a)break;++t}return t==l}makeLooseOrStrictAfterBracket(){if(this.isStrict()){this.strictExprs.push(1);return}let e=this.tokenized.length-1;for(;e>=0;){let l=this.tokenized[e].type;switch(l._hx_index){case 19:let i=l.name;this.strictExprs.push(1);return;case 48:case 50:this.strictExprs.push(1);return;case 51:let n=l.content;break;case 52:let s=l.content;break;case 53:let r=l.content;break;case 54:case 55:case 56:break;default:this.strictExprs.push(0);return}--e}this.strictExprs.push(2)}makeStrictIfFollowingCallable(){this.followsCallableOrIndexable()?this.strictExprs.push(1):this.strictExprs.push(2)}followsCallableOrIndexable(){let e=this.tokenized.length-1;for(;e>=0;){let l=this.tokenized[e].type;switch(l._hx_index){case 19:let i=l.name;return!0;case 48:case 50:return!0;case 51:let n=l.content;break;case 52:let s=l.content;break;case 53:let r=l.content;break;case 54:case 55:case 56:break;default:return!1}--e}return!1}isStrict(){let e=this.strictExprs.length-1;for(;e>=0&&this.strictExprs[e]==2;)--e;return e>=0?this.strictExprs[e]==1:!1}readImportValue(e,t){if(e==34)return this.readString(t);{let l="";for(;this.pos<this.length;){let r=c.cca(this.input,this.pos),a=r??-1;if(a==10)break;if(a==47&&this.pos+1<this.length){let h=c.cca(this.input,this.pos+1),o=h??-1;if(o==47||o==42)break}if(a==35&&this.pos+1<this.length){let h=c.cca(this.input,this.pos+1),o=h??-1;if(o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57||o==45)break}l+=String.fromCodePoint(a),this.pos++}let i=He.rtrim(l),n=new ue(t.line,t.column,t.offset,i.length);n==null&&(n=new ue(this.startLine,this.startColumn,this.pos)),n.length=this.pos-n.offset;let s=new ye(k.LString(0,i,[]),n);return this.previous=s,s}}scanStringEnd(e,t){let l=e+1,i=!1;for(;l<this.length;){let n=c.cca(this.input,l),s=n??-1;if(s==92){l+=2;continue}if(s==10)return-1;if(s==34&&!i)return l+1;if(t&&s==60&&!i){let r;if(l+1<this.length){let o=c.cca(this.input,l+1);r=o??-1}else r=0;let a=r==47,h=l+(a?2:1);if(h<this.length){let o=c.cca(this.input,h),u=o??-1;(u>=97&&u<=122||u>=65&&u<=90||u==95||u==95||u==36||a&&u==62)&&(i=!0)}}if(s==62&&i&&(i=!1),s==36&&l+1<this.length){let r=c.cca(this.input,l+1),a=r??-1;if(a==123){l+=2;let h=1;for(;l<this.length&&h>0;){let o=c.cca(this.input,l),u=o??-1;if(u==92){l+=2;continue}if(u==10)return-1;let p;if(u==47&&l+1<this.length){let m=c.cca(this.input,l+1);p=(m??-1)==47}else p=!1;if(p)return-1;let _;if(u==47&&l+1<this.length){let m=c.cca(this.input,l+1);_=(m??-1)==42}else _=!1;if(_){for(l+=2;;){if(l>=this.length)return-1;let m=c.cca(this.input,l);if((m??-1)==10)return-1;let f,g;if(l+1<this.length){let d=c.cca(this.input,l);g=(d??-1)==42}else g=!1;if(g){let d=c.cca(this.input,l+1);f=(d??-1)==47}else f=!1;if(f){l+=2;break}++l}continue}if(u==34){if(l=this.scanStringEnd(l,t),l==-1)return-1;continue}u==123?++h:u==125&&--h,++l}if(h!=0)return-1;continue}if(a==36){l+=2;continue}if(a>=97&&a<=122||a>=65&&a<=90||a==95){for(++l;;){let h;if(l<this.length){let o=c.cca(this.input,l),u=o??-1;h=u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57}else h=!1;if(!h)break;++l}if(l=this.scanAccessorChain(l,t),l==-1)return-1;continue}}++l}return-1}scanAccessorChain(e,t){for(;e<this.length;){let l=c.cca(this.input,e),i=l??-1,n;if(i==46&&e+1<this.length){let s=c.cca(this.input,e+1),r=s??-1;n=r>=97&&r<=122||r>=65&&r<=90||r==95}else n=!1;if(n)for(++e;;){let s;if(e<this.length){let r=c.cca(this.input,e),a=r??-1;s=a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57}else s=!1;if(!s)break;++e}else if(i==91||i==40){let s=i==91?93:41;++e;let r=1;for(;e<this.length&&r>0;){let a=c.cca(this.input,e),h=a??-1;if(h==92){e+=2;continue}if(h==10)return-1;let o;if(h==47&&e+1<this.length){let p=c.cca(this.input,e+1);o=(p??-1)==47}else o=!1;if(o)return-1;let u;if(h==47&&e+1<this.length){let p=c.cca(this.input,e+1);u=(p??-1)==42}else u=!1;if(u){for(e+=2;;){if(e>=this.length)return-1;let p=c.cca(this.input,e);if((p??-1)==10)return-1;let _,m;if(e+1<this.length){let f=c.cca(this.input,e);m=(f??-1)==42}else m=!1;if(m){let f=c.cca(this.input,e+1);_=(f??-1)==47}else _=!1;if(_){e+=2;break}++e}continue}if(h==34){if(e=this.scanStringEnd(e,t),e==-1)return-1;continue}h==i?++r:h==s&&--r,++e}if(r!=0)return-1}else break}return e}tryReadUnquotedString(){if(this.isStrict())return null;let e=c.cca(this.input,this.pos),t=e??-1,l;if(this.pos+1<this.length){let L=c.cca(this.input,this.pos+1);l=L??-1}else l=0;if(t==47&&this.pos<this.length-1){let L=c.cca(this.input,this.pos+1),I=L??-1;if(I==47||I==42)return null}if(t==123||t==125||t==91||t==93||t==58||t==35||t==32||t==9)return null;let i=this.parentBlockType();if(i!=k.KwBeat&&i!=k.KwState&&i!=k.KwCharacter)return null;let n=this.isInsideBrackets(),s=this.followsUnquotedAssign(),r=this.afterLabelIdentifierToken(!1);if(r!=-1&&this.tokenized[r].pos.line<this.line&&(this.tokenized[r].pos.column>=this.column||this.line-this.tokenized[r].pos.line>1))return null;let a=r!=-1?this.isStartingMultilineDialogue(r):-1,h=r!=-1,o=i==k.KwState||i==k.KwCharacter||n||s,u=this.matchIdentifier(this.pos);if(o){if(this.isCallStart(this.pos)||this.isLabelStart(this.pos))return null}else if(!h&&u!="true"&&u!="false"&&u!="null"&&(this.keepOrphanExpressions&&this.isIdentifierExpressionStart(this.pos,!0)||this.isIfStart(this.pos)||this.isCallStart(this.pos)||this.isAssignStart(this.pos,!1)))return null;if(!o&&(t==61||l==61&&(t==43||t==45||t==42||t==47))||!o&&!h&&(this.isInsertionStart(this.pos)||this.isChoiceOnceStart(this.pos))||u!=null&&(u=="function"||!o&&(u!="if"&&u!="null"&&u!="true"&&u!="false"&&u!="and"&&u!="or"&&Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,u)||this.isColon(this.pos+u.length))))return null;let p=!o,_=!1;if(o){if(n){if(!h&&!this.followsOnlyWhitespacesOrCommentsInLine()&&!this.isAfterComma()&&!this.isAfterLBracket())return null}else if(!s&&!h)return null}else if(_=this.followsOnlyLabelOrCommentsInLine(),!_&&!this.followsOnlyWhitespacesOrCommentsInLine()&&!this.followsChoiceOncePrefix()||!_&&l==62&&t==45)return null;if(t==34){let L=this.scanStringEnd(this.pos,i==k.KwBeat);if(L==-1)return null;let I=!1,q=L;for(;q<this.length;){let z=c.cca(this.input,q),P=z??-1;if(P==32||P==9){++q;continue}if(P==10||P==13)break;let B;if(P==47&&q+1<this.length){let N=c.cca(this.input,q+1);if((N??-1)!=47){let D=c.cca(this.input,q+1);B=(D??-1)==42}else B=!0}else B=!1;if(B||P==93||P==125||P==41||P==44||P==35)break;I=!0;break}if(!I&&!o){let z=!0;z==null&&(z=!1);let P=this._skipWhitespaceAndComments(q,z);if(P<=q||P>=this.length)return null;let B=c.cca(this.input,P),N=B??-1,D;if(N==10||N==13||N==34)D=!0;else if(N==47&&P+1<this.length){let X=c.cca(this.input,P+1);if((X??-1)!=47){let ae=c.cca(this.input,P+1);D=(ae??-1)==42}else D=!0}else D=!1;if(D)return null;let U=0,W=P;for(;;){let X;if(W>0){let ae=c.cca(this.input,W-1);if((ae??-1)!=32){let ce=c.cca(this.input,W-1);X=(ce??-1)==9}else X=!0}else X=!1;if(!X)break;++U,--W}let J=a!=-1?a:this.column-1;if(U!=J)return null;let H;if(N==45&&P+1<this.length){let X=c.cca(this.input,P+1);H=(X??-1)==62}else H=!1;if(H||N==43||this.isAssignStart(P,!1)||this.isCallStart(P)||this.isLabelStart(P)||this.isIfStart(P)||this.isIdentifierExpressionStart(P,!0))return null;if(N>=97&&N<=122||N>=65&&N<=90||N==95){let X=P;for(;;){let re;if(X<this.length){let xe=c.cca(this.input,X),Pe=xe??-1;re=Pe>=97&&Pe<=122||Pe>=65&&Pe<=90||Pe==95||Pe>=48&&Pe<=57}else re=!1;if(!re)break;++X}let ae=this.input,ce=X-P,ne=ce!=null?c.substr(ae,P,ce):c.substr(ae,P,null);if(ne!="null"&&ne!="true"&&ne!="false"&&Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,ne))return null}}else if(!I)return null}let m=new ue(this.startLine,this.startColumn,this.pos),f="",g=[],d=this.line,w=this.column,y=this.pos,S=!1,T=-1,O=!1,E=this.column,v=this.line,M=!0,A=!1;for(;this.pos<this.length;){let L=c.cca(this.input,this.pos),I=L??-1,q=I==32||I==9;if(A||!q&&T==-1&&(I!=60||!p)&&(A=!0),S){f+=String.fromCodePoint(92),f+=String.fromCodePoint(I),S=!1;let z=0,P=1;for(;z<P;){let B=z++;if(this.pos>=this.length)break;let N=c.cca(this.input,this.pos);(N??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}E+=2}else if(I==92){S=!0;let z=0,P=1;for(;z<P;){let B=z++;if(this.pos>=this.length)break;let N=c.cca(this.input,this.pos);(N??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(T==-1&&q&&!A&&g.length==0){let z=0,P=1;for(;z<P;){let B=z++;if(this.pos>=this.length)break;let N=c.cca(this.input,this.pos);(N??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{if(T==-1&&I==123)break;{let z;if(T==-1)if(I==10||I==13)z=!0;else if(I==47&&this.pos<this.length-1){let P=c.cca(this.input,this.pos+1);z=(P??-1)==47}else z=!1;else z=!1;if(z)if(a!=-1)if(this.isContinuingMultilineText(this.pos,a)){f+=String.fromCodePoint(I);let P=0,B=1;for(;P<B;){let D=P++;if(this.pos>=this.length)break;let U=c.cca(this.input,this.pos);(U??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let N;if(I==13){let D=c.cca(this.input,this.pos);N=(D??-1)==10}else N=!1;if(N){f+=String.fromCodePoint(10);let D=0,U=1;for(;D<U;){let W=D++;if(this.pos>=this.length)break;let J=c.cca(this.input,this.pos);(J??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}E=this.column,v=this.line}else break;else break;else{let P;if(T==-1)if(I==47&&this.pos<this.length-1){let B=c.cca(this.input,this.pos+1);P=(B??-1)==42}else P=!1;else P=!1;if(P){f+=String.fromCodePoint(47),f+=String.fromCodePoint(42);let B=2;B==null&&(B=1);let N=0,D=B;for(;N<D;){let W=N++;if(this.pos>=this.length)break;let J=c.cca(this.input,this.pos);(J??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let U=!1;for(;this.pos<this.length;){let W,J=c.cca(this.input,this.pos);if((J??-1)==42&&this.pos+1<this.length){let ne=c.cca(this.input,this.pos+1);W=(ne??-1)==47}else W=!1;if(W){f+=String.fromCodePoint(42),f+=String.fromCodePoint(47);let ne=2;ne==null&&(ne=1);let re=0,xe=ne;for(;re<xe;){let Pe=re++;if(this.pos>=this.length)break;let Ue=c.cca(this.input,this.pos);(Ue??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}U=!0;break}let H=c.cca(this.input,this.pos),X=H??-1;f+=String.fromCodePoint(X);let ae=0,ce=1;for(;ae<ce;){let ne=ae++;if(this.pos>=this.length)break;let re=c.cca(this.input,this.pos);(re??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}E=this.column,v=this.line,U||this.error("Unterminated multiline comment",!1)}else{if(T==-1&&!o&&this.isIfStart(this.pos))break;{let B;if(T==-1&&I==45&&this.pos<this.length-1){let N=c.cca(this.input,this.pos+1);B=(N??-1)==62}else B=!1;if(B&&this.isTransitionStart(this.pos))break;if(T==-1&&o&&(I==44||I==93||I==125))break;if(p&&I==60){T!=-1&&this.error("Unexpected < inside tag",!0);let N;if(this.pos+1<this.length){let J=c.cca(this.input,this.pos+1);N=J??-1}else N=0;O=N==47;let D=this.pos+(O?2:1);if(D<this.length){let J=c.cca(this.input,D),H=J??-1;(H>=97&&H<=122||H>=65&&H<=90||H==95||H==95||H==36||O&&H==62)&&(T=f.length)}f+=String.fromCodePoint(I);let U=0,W=1;for(;U<W;){let J=U++;if(this.pos>=this.length)break;let H=c.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++E}else if(p&&I==62){f+=String.fromCodePoint(I);let N=0,D=1;for(;N<D;){let U=N++;if(this.pos>=this.length)break;let W=c.cca(this.input,this.pos);(W??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++E,T!=-1&&(g.push(Ll.Tag(O,T,f.length-T)),T=-1)}else if(T==-1&&I==35&&!S){let N;if(this.pos+1<this.length){let D=c.cca(this.input,this.pos+1);N=D??-1}else N=0;if(N==35){f+=String.fromCodePoint(35),f+=String.fromCodePoint(35);let D=0,U=1;for(;D<U;){let H=D++;if(this.pos>=this.length)break;let X=c.cca(this.input,this.pos);(X??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let W=0,J=1;for(;W<J;){let H=W++;if(this.pos>=this.length)break;let X=c.cca(this.input,this.pos);(X??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}E+=2}else{if(N>=97&&N<=122||N>=65&&N<=90||N==95||N>=48&&N<=57||N==45)break;{f+=String.fromCodePoint(I);let D=0,U=1;for(;D<U;){let W=D++;if(this.pos>=this.length)break;let J=c.cca(this.input,this.pos);(J??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++E}}}else if(I==36&&!S){let N=f.length,D=v,U=E,W=this.pos;try{let J=0,H=1;for(;J<H;){let ae=J++;if(this.pos>=this.length)break;let ce=c.cca(this.input,this.pos);(ce??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++E;let X=c.cca(this.input,this.pos);if((X??-1)==123){let ae=0,ce=1;for(;ae<ce;){let Ue=ae++;if(this.pos>=this.length)break;let Je=c.cca(this.input,this.pos);(Je??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++E;let ne=new ue(D,U+2,this.pos),re=this.readComplexInterpolation(ne),xe=this.pos-W;g.push(Ll.Interpolation(!0,T!=-1,re,N,xe));let Pe=this.input;f+=Y.string(xe!=null?c.substr(Pe,W,xe):c.substr(Pe,W,null))}else{let ae=c.cca(this.input,this.pos),ce=ae??-1;if(ce>=97&&ce<=122||ce>=65&&ce<=90||ce==95){let ne=new ue(D,U+1,this.pos),re=this.readFieldAccessInterpolation(ne),xe=this.pos-W;g.push(Ll.Interpolation(!1,T!=-1,re,N,xe));let Pe=this.input;f+=Y.string(xe!=null?c.substr(Pe,W,xe):c.substr(Pe,W,null))}else{let ne=c.cca(this.input,this.pos);if((ne??-1)==36){f+=String.fromCodePoint(36),f+=String.fromCodePoint(36);let re=0,xe=1;for(;re<xe;){let Pe=re++;if(this.pos>=this.length)break;let Ue=c.cca(this.input,this.pos);(Ue??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++E}else{this.error("Expected identifier or { after $",!1);let re=this.pos-W;g.push(Ll.Interpolation(!1,T!=-1,[],N,re));let xe=this.input;f+=Y.string(re!=null?c.substr(xe,W,re):c.substr(xe,W,null))}}}}catch(J){let H=C.caught(J).unwrap();if(H instanceof ui){let X=H;throw X.pos==null&&(X.pos=new ue(D,U,this.pos)),C.thrown(X)}else throw J}E=U+(this.pos-W)}else{I==10?(++v,E=1):++E,f+=String.fromCodePoint(I);let N=0,D=1;for(;N<D;){let U=N++;if(this.pos>=this.length)break;let W=c.cca(this.input,this.pos);(W??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}}}}}if(M){let L=f,I=L.length;L=He.rtrim(L);let q=L.length,z=I-q;if(q>0&&this.hasNonSpecialChar(L)&&(!o||!this.isNumber(L)&&L!="null"&&L!="true"&&L!="false")){if(a==-1&&!h&&!this.inChoiceRoot()){let U=this.line,W=this.column,J=this.pos,H=!0;H==null&&(H=!1);let X=H;X==null&&(X=!1);let ae=this._skipWhitespaceAndComments(this.pos,X);for(;this.pos<ae;){let ne=0,re=1;for(;ne<re;){let xe=ne++;if(this.pos>=this.length)break;let Pe=c.cca(this.input,this.pos);(Pe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let ce=this.pos;if(this.column==w){let ne=this.tryReadUnquotedString();if(ne!=null){let re=this.input,xe=J-z,Pe=ce!=null?re.substring(xe,ce):re.substring(xe),Ue=ne.type;if(Ue._hx_index==15){let lt=Ue.quotes,Ve=Ue.s,Qe=Ue.attachments;if(Qe!=null){let at=0;for(;at<Qe.length;){let Re=Qe[at];switch(++at,Re._hx_index){case 0:let $=Re.braces,se=Re.inTag,j=Re.expr,ie=Re.start,le=Re.length;g.push(Ll.Interpolation($,se,j,ie+ce-y,le));break;case 1:let ee=Re.closing,pe=Re.start,me=Re.length;g.push(Ll.Tag(ee,pe+ce-y,me));break}}}L+=Pe,L+=Ve}z=0;let Je=this.pos-1;for(;;){let lt;if(Je>=0){let Ve=c.cca(this.input,Je);if((Ve??-1)!=32){let Qe=c.cca(this.input,Je);lt=(Qe??-1)==9}else lt=!0}else lt=!1;if(!lt)break;++z,--Je}}else this.line=U,this.column=W,this.pos=J}else this.line=U,this.column=W,this.pos=J}g.sort(function(U,W){return kt.compareAttachments(U,W)});let P=g.length>0?g:null,B=m;B==null&&(B=new ue(this.startLine,this.startColumn,this.pos)),B.length=this.pos-B.offset;let N=new ye(k.LString(0,L,P),B);this.previous=N;let D=N;return D.pos.length-=z,D}}return this.line=d,this.column=w,this.pos=y,null}readString(e){let t=0,l=1;for(;t<l;){let p=t++;if(this.pos>=this.length)break;let _=c.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let i="",n=[],s=!1,r=-1,a=!1,h=e.column+1,o=e.line,u=this.parentBlockType()==k.KwBeat;for(;this.pos<this.length;){let p=c.cca(this.input,this.pos),_=p??-1;if(s){i+=String.fromCodePoint(92),i+=String.fromCodePoint(_),s=!1;let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}h+=2}else if(_==92){s=!0;let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(_==34&&r==-1){let m=0,f=1;for(;m<f;){let y=m++;if(this.pos>=this.length)break;let S=c.cca(this.input,this.pos);(S??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}n.sort(function(y,S){return kt.compareAttachments(y,S)});let g=n.length>0?n:null,d=e;d==null&&(d=new ue(this.startLine,this.startColumn,this.pos)),d.length=this.pos-d.offset;let w=new ye(k.LString(1,i,g),d);return this.previous=w,w}else if(u&&_==60){r!=-1&&this.error("Unexpected < inside tag",!0);let m;if(this.pos+1<this.length){let w=c.cca(this.input,this.pos+1);m=w??-1}else m=0;a=m==47;let f=this.pos+(a?2:1);if(f<this.length){let w=c.cca(this.input,f),y=w??-1;(y>=97&&y<=122||y>=65&&y<=90||y==95||y==95||y==36||a&&y==62)&&(r=i.length)}i+=String.fromCodePoint(_);let g=0,d=1;for(;g<d;){let w=g++;if(this.pos>=this.length)break;let y=c.cca(this.input,this.pos);(y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h}else if(_==62){i+=String.fromCodePoint(_);let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h,r!=-1&&(n.push(Ll.Tag(a,r,i.length-r)),r=-1)}else if(_==36&&!s){let m=i.length,f=o,g=h,d=this.pos;try{let w=0,y=1;for(;w<y;){let T=w++;if(this.pos>=this.length)break;let O=c.cca(this.input,this.pos);(O??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h;let S=c.cca(this.input,this.pos);if((S??-1)==123){let T=0,O=1;for(;T<O;){let L=T++;if(this.pos>=this.length)break;let I=c.cca(this.input,this.pos);(I??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h;let E=new ue(f,g+2,this.pos),v=this.readComplexInterpolation(E),M=this.pos-d;n.push(Ll.Interpolation(!0,r!=-1,v,m,M));let A=this.input;i+=Y.string(M!=null?c.substr(A,d,M):c.substr(A,d,null))}else{let T=c.cca(this.input,this.pos),O=T??-1;if(O>=97&&O<=122||O>=65&&O<=90||O==95){let E=new ue(f,g+1,this.pos),v=this.readFieldAccessInterpolation(E),M=this.pos-d;n.push(Ll.Interpolation(!1,r!=-1,v,m,M));let A=this.input;i+=Y.string(M!=null?c.substr(A,d,M):c.substr(A,d,null))}else{let E=c.cca(this.input,this.pos);if((E??-1)==36){i+=String.fromCodePoint(36),i+=String.fromCodePoint(36);let v=0,M=1;for(;v<M;){let A=v++;if(this.pos>=this.length)break;let L=c.cca(this.input,this.pos);(L??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h}else{this.error("Expected identifier or { after $",!1);let v=this.pos-d;n.push(Ll.Interpolation(!1,r!=-1,[],m,v));let M=this.input;i+=Y.string(v!=null?c.substr(M,d,v):c.substr(M,d,null))}}}}catch(w){let y=C.caught(w).unwrap();if(y instanceof ui){let S=y;throw S.pos==null&&(S.pos=new ue(f,g,this.pos)),C.thrown(S)}else throw w}h=g+(this.pos-d)}else{_==10?(++o,h=1):++h,i+=String.fromCodePoint(_);let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}return this.error("Unterminated string",!0),null}readComplexInterpolation(e){this.strictExprs.push(1);let t=[],l=1,i=e.column,n=e.line;for(;this.pos<this.length&&l>0;){let s=c.cca(this.input,this.pos);if((s??-1)==34){let a=new ue(n,i,this.pos);t.push(this.readString(a)),i+=this.pos-a.offset;continue}let r=this.nextToken();if(t.push(r),r.type==k.LineBreak)++n,i=1;else if(!(r.type==k.Indent||r.type==k.Unindent)){let a,h=r.type;switch(h._hx_index){case 15:let o=h.attachments,u=h.quotes;a=h.s.length+(u!=0?2:0);break;case 16:let _=h.n;a=(_==null?"null":""+_).length;break;case 19:a=h.name.length;break;default:a=1}i+=a}switch(r.type._hx_index){case 45:++l;break;case 46:--l;break;default:}r.type==k.Eof&&this.error("Unterminated interpolation expression",!0)}return t.pop(),this.strictExprs.pop(),t}nextTokenWithPosition(e){let t=this.line,l=this.column,i=this.pos,n=this.nextToken(),s=n.pos.length,r=this.pos-i;return n.pos=new ue(e.line,e.column+r,e.offset+r,s),this.line=t,this.column=l,n}readFieldAccessInterpolation(e){this.strictExprs.push(1);let t=[],l=c.cca(this.input,this.pos),i=l??-1;i>=97&&i<=122||i>=65&&i<=90||i==95||this.error("Expected identifier in field access",!0);let n=this.pos;for(;this.pos<this.length;){let o=c.cca(this.input,this.pos),u=o??-1;if(!(u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57))break;let p=0,_=1;for(;p<_;){let m=p++;if(this.pos>=this.length)break;let f=c.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let s=this.input,r=this.pos-n,a=r!=null?c.substr(s,n,r):c.substr(s,n,null),h=Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,a)?kt.KEYWORDS.h[a]:k.Identifier(a);t.push(new ye(h,new ue(e.line,e.column,n,this.pos-n)));e:for(;this.pos<this.length;){let o=c.cca(this.input,this.pos);switch(o??-1){case 40:t.push(new ye(k.LParen,new ue(this.line,this.column,this.pos,1)));let u=0,p=1;for(;u<p;){let w=u++;if(this.pos>=this.length)break;let y=c.cca(this.input,this.pos);(y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.push(10),this.strictExprs.push(1);let _=1;for(;this.pos<this.length&&_>0;){let w=c.cca(this.input,this.pos);if((w??-1)==41){if(--_,_==0){t.push(new ye(k.RParen,new ue(this.line,this.column,this.pos,1)));let S=0,T=1;for(;S<T;){let O=S++;if(this.pos>=this.length)break;let E=c.cca(this.input,this.pos);(E??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.pop(),this.strictExprs.pop();break}}else{let S=c.cca(this.input,this.pos);(S??-1)==40&&++_}let y=c.cca(this.input,this.pos);if((y??-1)==44){t.push(new ye(k.Comma,new ue(this.line,this.column,this.pos,1)));let S=0,T=1;for(;S<T;){let O=S++;if(this.pos>=this.length)break;let E=c.cca(this.input,this.pos);(E??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else t.push(this.nextToken())}_>0&&this.error("Unterminated function call in interpolation",!0);break;case 46:let m;if(this.pos+1<this.length){let w=c.cca(this.input,this.pos+1),y=w??-1;m=y>=97&&y<=122||y>=65&&y<=90||y==95}else m=!1;if(m){t.push(new ye(k.Dot,new ue(this.line,this.column,this.pos,1)));let w=0,y=1;for(;w<y;){let M=w++;if(this.pos>=this.length)break;let A=c.cca(this.input,this.pos);(A??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let S=this.pos;for(;this.pos<this.length;){let M=c.cca(this.input,this.pos),A=M??-1;if(!(A>=97&&A<=122||A>=65&&A<=90||A==95||A>=48&&A<=57))break;let L=0,I=1;for(;L<I;){let q=L++;if(this.pos>=this.length)break;let z=c.cca(this.input,this.pos);(z??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let T=this.input,O=this.pos-S,E=O!=null?c.substr(T,S,O):c.substr(T,S,null),v=Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,E)?kt.KEYWORDS.h[E]:k.Identifier(E);t.push(new ye(v,new ue(this.line,this.column-(this.pos-S),S)))}else break e;break;case 91:t.push(new ye(k.LBracket,new ue(this.line,this.column,this.pos,1)));let f=0,g=1;for(;f<g;){let w=f++;if(this.pos>=this.length)break;let y=c.cca(this.input,this.pos);(y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.push(12),this.strictExprs.push(1);let d=1;for(;this.pos<this.length&&d>0;){let w=c.cca(this.input,this.pos);if((w??-1)==93){if(--d,d==0){t.push(new ye(k.RBracket,new ue(this.line,this.column,this.pos,1)));let y=0,S=1;for(;y<S;){let T=y++;if(this.pos>=this.length)break;let O=c.cca(this.input,this.pos);(O??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.pop(),this.strictExprs.pop();break}}else{let y=c.cca(this.input,this.pos);(y??-1)==91&&++d}t.push(this.nextToken())}d>0&&this.error("Unterminated array access in interpolation",!0);break;default:break e}}return this.strictExprs.pop(),t}readIdentifierTokenInInterpolation(e){let t=this.makePositionRelativeTo(e),l=this.pos;for(;this.pos<this.length;){let a=c.cca(this.input,this.pos),h=a??-1;if(!(h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57))break;let o=0,u=1;for(;o<u;){let p=o++;if(this.pos>=this.length)break;let _=c.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let i=this.input,n=this.pos-l,s=n!=null?c.substr(i,l,n):c.substr(i,l,null),r=Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,s)?kt.KEYWORDS.h[s]:k.Identifier(s);return new ye(r,t)}makePositionRelativeTo(e){let t=e.line,l=e.column,i=e.offset;for(;i<this.pos;){let n=c.cca(this.input,i);(n??-1)==10?(++t,l=1):++l,++i}return new ue(t,l,this.pos,e.length)}readLineComment(){let e=new ue(this.startLine,this.startColumn,this.pos),t=2;t==null&&(t=1);let l=0,i=t;for(;l<i;){let u=l++;if(this.pos>=this.length)break;let p=c.cca(this.input,this.pos);(p??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let n=this.pos;for(;this.pos<this.length;){let u=c.cca(this.input,this.pos),p=u??-1;if(p==10||p==13)break;let _=0,m=1;for(;_<m;){let f=_++;if(this.pos>=this.length)break;let g=c.cca(this.input,this.pos);(g??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let s=this.input,r=this.pos-n,a=r!=null?c.substr(s,n,r):c.substr(s,n,null),h=e;h==null&&(h=new ue(this.startLine,this.startColumn,this.pos)),h.length=this.pos-h.offset;let o=new ye(k.CommentLine(a),h);return this.previous=o,o}readMultiLineComment(){let e=new ue(this.startLine,this.startColumn,this.pos),t=2;t==null&&(t=1);let l=0,i=t;for(;l<i;){let r=l++;if(this.pos>=this.length)break;let a=c.cca(this.input,this.pos);(a??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let n=this.pos,s=1;for(;this.pos<this.length&&s>0;){let r,a=c.cca(this.input,this.pos);if((a??-1)==42){let h;if(this.pos+1<this.length){let o=c.cca(this.input,this.pos+1);h=o??-1}else h=0;r=h==47}else r=!1;if(r){if(--s,s==0){let p=this.input,_=this.pos-n,m=_!=null?c.substr(p,n,_):c.substr(p,n,null),f=2;f==null&&(f=1);let g=0,d=f;for(;g<d;){let S=g++;if(this.pos>=this.length)break;let T=c.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let w=e;w==null&&(w=new ue(this.startLine,this.startColumn,this.pos)),w.length=this.pos-w.offset;let y=new ye(k.CommentMultiLine(m),w);return this.previous=y,y}let h=2;h==null&&(h=1);let o=0,u=h;for(;o<u;){let p=o++;if(this.pos>=this.length)break;let _=c.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let h,o=c.cca(this.input,this.pos);if((o??-1)==47){let u;if(this.pos+1<this.length){let p=c.cca(this.input,this.pos+1);u=p??-1}else u=0;h=u==42}else h=!1;if(h){++s;let u=2;u==null&&(u=1);let p=0,_=u;for(;p<_;){let m=p++;if(this.pos>=this.length)break;let f=c.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let u=0,p=1;for(;u<p;){let _=u++;if(this.pos>=this.length)break;let m=c.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}return this.error("Unterminated multi-line comment",!0),null}readHashComment(){let e=new ue(this.startLine,this.startColumn,this.pos),t=0,l=1;for(;t<l;){let o=t++;if(this.pos>=this.length)break;let u=c.cca(this.input,this.pos);(u??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let i=this.pos;for(;this.pos<this.length;){let o=c.cca(this.input,this.pos),u=o??-1;if(u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57||u==45){let p=0,_=1;for(;p<_;){let m=p++;if(this.pos>=this.length)break;let f=c.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else break}let n=this.input,s=this.pos-i,r=s!=null?c.substr(n,i,s):c.substr(n,i,null),a=e;a==null&&(a=new ue(this.startLine,this.startColumn,this.pos)),a.length=this.pos-a.offset;let h=new ye(k.CommentHash(r),a);return this.previous=h,h}readNumber(){let e=new ue(this.startLine,this.startColumn,this.pos),t=this.pos;for(;;){let u;if(this.pos<this.length){let m=c.cca(this.input,this.pos),f=m??-1;u=f>=48&&f<=57}else u=!1;if(!u)break;let p=0,_=1;for(;p<_;){let m=p++;if(this.pos>=this.length)break;let f=c.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let l,i;if(this.pos<this.length){let u=c.cca(this.input,this.pos);i=(u??-1)==46}else i=!1;if(i&&this.pos+1<this.length){let u=c.cca(this.input,this.pos+1),p=u??-1;l=p>=48&&p<=57}else l=!1;if(l){let u=0,p=1;for(;u<p;){let _=u++;if(this.pos>=this.length)break;let m=c.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}for(;;){let _;if(this.pos<this.length){let g=c.cca(this.input,this.pos),d=g??-1;_=d>=48&&d<=57}else _=!1;if(!_)break;let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}let n=this.input,s=this.pos-t,r=k.LNumber(parseFloat(s!=null?c.substr(n,t,s):c.substr(n,t,null))),a=e;a==null&&(a=new ue(this.startLine,this.startColumn,this.pos)),a.length=this.pos-a.offset;let h=new ye(r,a);return this.previous=h,h}readIdentifier(){let e=new ue(this.startLine,this.startColumn,this.pos),t=this.pos;for(;this.pos<this.length;){let h=c.cca(this.input,this.pos),o=h??-1;if(!(o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57))break;let u=0,p=1;for(;u<p;){let _=u++;if(this.pos>=this.length)break;let m=c.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let l=this.input,i=this.pos-t,n=i!=null?c.substr(l,t,i):c.substr(l,t,null);if(n=="function")return this.readFunction(e);let s=Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,n)?kt.KEYWORDS.h[n]:k.Identifier(n);if(this.previous!=null&&this.previous.type==k.Dot&&s!=null)switch(s._hx_index){case 8:case 9:case 10:case 11:case 12:s=k.Identifier(n);break;default:}let r=e;r==null&&(r=new ue(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let a=new ye(s,r);return this.previous=a,a}readFunction(e){let t=!1;t==null&&(t=!1);let l=this._skipWhitespaceAndComments(this.pos,t);for(;this.pos<l;){let P=0,B=1;for(;P<B;){let N=P++;if(this.pos>=this.length)break;let D=c.cca(this.input,this.pos);(D??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let i=e.column,n=null,s=c.cca(this.input,this.pos),r=s??-1;if(r>=97&&r<=122||r>=65&&r<=90||r==95){let P=this.pos;for(;;){let D;if(this.pos<this.length){let J=c.cca(this.input,this.pos),H=J??-1;D=H>=97&&H<=122||H>=65&&H<=90||H==95||H>=48&&H<=57}else D=!1;if(!D)break;let U=0,W=1;for(;U<W;){let J=U++;if(this.pos>=this.length)break;let H=c.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let B=this.input,N=this.pos-P;n=N!=null?c.substr(B,P,N):c.substr(B,P,null)}let a=!1;a==null&&(a=!1);let h=this._skipWhitespaceAndComments(this.pos,a);for(;this.pos<h;){let P=0,B=1;for(;P<B;){let N=P++;if(this.pos>=this.length)break;let D=c.cca(this.input,this.pos);(D??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let o;if(this.pos<this.length){let P=c.cca(this.input,this.pos);o=(P??-1)!=40}else o=!0;o&&this.error("Expected opening parenthesis after function name",!0);let u=0,p=[],_=0,m=1;for(;_<m;){let P=_++;if(this.pos>=this.length)break;let B=c.cca(this.input,this.pos);(B??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}u=1;let f=new gt;for(;this.pos<this.length&&u>0;){let P=c.cca(this.input,this.pos),B=P??-1;if(B==47){let N=this.pos,D=!1;D==null&&(D=!1);let U=this._skipWhitespaceAndComments(this.pos,D);for(;this.pos<U;){let W=0,J=1;for(;W<J;){let H=W++;if(this.pos>=this.length)break;let X=c.cca(this.input,this.pos);(X??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}if(this.pos==N){let W=0,J=1;for(;W<J;){let H=W++;if(this.pos>=this.length)break;let X=c.cca(this.input,this.pos);(X??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error('Invalid character "/"',!1)}}else if(B==40){++u,f.b+=String.fromCodePoint(B);let N=0,D=1;for(;N<D;){let J=N++;if(this.pos>=this.length)break;let H=c.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let U=!1;U==null&&(U=!1);let W=this._skipWhitespaceAndComments(this.pos,U);for(;this.pos<W;){let J=0,H=1;for(;J<H;){let X=J++;if(this.pos>=this.length)break;let ae=c.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else if(B==41){if(--u,u>0)f.b+=String.fromCodePoint(B);else{let J=He.trim(f.b);J.length>0&&p.push(J)}let N=0,D=1;for(;N<D;){let J=N++;if(this.pos>=this.length)break;let H=c.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let U=!1;U==null&&(U=!1);let W=this._skipWhitespaceAndComments(this.pos,U);for(;this.pos<W;){let J=0,H=1;for(;J<H;){let X=J++;if(this.pos>=this.length)break;let ae=c.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else if(B==44&&u==1){let N=He.trim(f.b);N.length>0&&p.push(N),f=new gt;let D=0,U=1;for(;D<U;){let H=D++;if(this.pos>=this.length)break;let X=c.cca(this.input,this.pos);(X??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let W=!1;W==null&&(W=!1);let J=this._skipWhitespaceAndComments(this.pos,W);for(;this.pos<J;){let H=0,X=1;for(;H<X;){let ae=H++;if(this.pos>=this.length)break;let ce=c.cca(this.input,this.pos);(ce??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else{f.b+=String.fromCodePoint(B);let N=0,D=1;for(;N<D;){let U=N++;if(this.pos>=this.length)break;let W=c.cca(this.input,this.pos);(W??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}u>0&&this.error("Unclosed parentheses in function declaration",!1);let g=!1;g==null&&(g=!1);let d=this._skipWhitespaceAndComments(this.pos,g);for(;this.pos<d;){let P=0,B=1;for(;P<B;){let N=P++;if(this.pos>=this.length)break;let D=c.cca(this.input,this.pos);(D??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let w;if(this.pos<this.length){let P=c.cca(this.input,this.pos);w=(P??-1)==123}else w=!1;let y=this.pos,S=this.line,T=this.column;if(w){let P=0,B=1;for(;P<B;){let D=P++;if(this.pos>=this.length)break;let U=c.cca(this.input,this.pos);(U??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let N=1;for(;this.pos<this.length&&N>0;){let D=c.cca(this.input,this.pos),U=D??-1;if(U==34){let H=0,X=1;for(;H<X;){let ae=H++;if(this.pos>=this.length)break;let ce=c.cca(this.input,this.pos);(ce??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.skipQuotedString();continue}U==123?++N:U==125&&--N;let W=0,J=1;for(;W<J;){let H=W++;if(this.pos>=this.length)break;let X=c.cca(this.input,this.pos);(X??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}N>0&&this.error("Unclosed braces in function body",!1)}else{let P=-1,B=!0;for(;this.pos<this.length;){let N=c.cca(this.input,this.pos),D=N??-1;if(D==10||D==13){y=this.pos,S=this.line,T=this.column;let J=0,H=1;for(;J<H;){let X=J++;if(this.pos>=this.length)break;let ae=c.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}B=!0;break}let U=0,W=1;for(;U<W;){let J=U++;if(this.pos>=this.length)break;let H=c.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}for(;this.pos<this.length;){if(B){let J=0,H=this.pos;for(;this.pos<this.length;){let ce=c.cca(this.input,this.pos),ne=ce??-1;if(ne==32)++J;else if(ne==9)++J;else break;let re=0,xe=1;for(;re<xe;){let Pe=re++;if(this.pos>=this.length)break;let Ue=c.cca(this.input,this.pos);(Ue??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let X,ae;if(P==-1&&this.pos<this.length){let ce=c.cca(this.input,this.pos);ae=(ce??-1)!=10}else ae=!1;if(ae){let ce=c.cca(this.input,this.pos);X=(ce??-1)!=13}else X=!1;if(X){if(P=J,P<i){this.pos=H;break}}else{let ce;if(P!=-1&&J<P)if(this.pos<this.length){let ne=c.cca(this.input,this.pos);if((ne??-1)!=10){let re=c.cca(this.input,this.pos);ce=(re??-1)!=13}else ce=!1}else ce=!0;else ce=!1;if(ce){this.pos=H;break}}B=!1}let N=c.cca(this.input,this.pos),D=N??-1;if(D==34){this.skipQuotedString();continue}(D==10||D==13)&&(y=this.pos,S=this.line,T=this.column,B=!0);let U=0,W=1;for(;U<W;){let J=U++;if(this.pos>=this.length)break;let H=c.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}this.pos=y,this.line=S,this.column=T;let O=this.pos,E=this.input,v=e.offset,M=O-e.offset,A=He.rtrim(M!=null?c.substr(E,v,M):c.substr(E,v,null)),L=A.indexOf(`
|
|
31
|
+
`,null)==-1;L||(A+=`
|
|
32
|
+
`);let I=e;I==null&&(I=new ue(this.startLine,this.startColumn,this.pos)),I.length=this.pos-I.offset;let q=new ye(k.Function(n,p,A,L),I);this.previous=q;let z=q;return z.pos.length=A.length,z}skipQuotedString(){let e=!1,t=0,l=1;for(;t<l;){let i=t++;if(this.pos>=this.length)break;let n=c.cca(this.input,this.pos);(n??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}for(;this.pos<this.length;){let i=c.cca(this.input,this.pos),n=i??-1;if(e){e=!1;let s=0,r=1;for(;s<r;){let a=s++;if(this.pos>=this.length)break;let h=c.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(n==92){e=!0;let s=0,r=1;for(;s<r;){let a=s++;if(this.pos>=this.length)break;let h=c.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(n==34){let s=0,r=1;for(;s<r;){let a=s++;if(this.pos>=this.length)break;let h=c.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}break}else if(n==36&&this.pos+1<this.length){let s=0,r=1;for(;s<r;){let h=s++;if(this.pos>=this.length)break;let o=c.cca(this.input,this.pos);(o??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let a;if(this.pos<this.length){let h=c.cca(this.input,this.pos);a=(h??-1)==123}else a=!1;if(a){let h=0,o=1;for(;h<o;){let p=h++;if(this.pos>=this.length)break;let _=c.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let u=1;for(;this.pos<this.length&&u>0;){let p=c.cca(this.input,this.pos),_=p??-1;if(_==34){this.skipQuotedString();continue}else _==123?++u:_==125&&--u;if(u>0||_!=125){let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}break}}}else{let h=c.cca(this.input,this.pos),o=h??-1;if(o>=97&&o<=122||o>=65&&o<=90||o==95)for(;;){let u;if(this.pos<this.length){let m=c.cca(this.input,this.pos),f=m??-1;u=f>=97&&f<=122||f>=65&&f<=90||f==95||f>=48&&f<=57}else u=!1;if(!u)break;let p=0,_=1;for(;p<_;){let m=p++;if(this.pos>=this.length)break;let f=c.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}else{let s=0,r=1;for(;s<r;){let a=s++;if(this.pos>=this.length)break;let h=c.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}makePosition(){return new ue(this.startLine,this.startColumn,this.pos)}makeToken(e,t){t==null&&(t=new ue(this.startLine,this.startColumn,this.pos)),t.length=this.pos-t.offset;let l=new ye(e,t);return this.previous=l,l}advance(e){e==null&&(e=1);let t=0,l=e;for(;t<l;){let i=t++;if(this.pos>=this.length)break;let n=c.cca(this.input,this.pos);(n??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}peek(e){if(e==null&&(e=1),this.pos+e<this.length){let t=c.cca(this.input,this.pos+e);return t??-1}else return 0}error(e,t){let l=new ui(e,new ue(this.startLine,this.startColumn,this.pos));if(this.errors==null&&(this.errors=[]),this.errors.push(l),t)throw C.thrown(l);return l}getErrors(){return this.errors==null&&(this.errors=[]),this.errors}skipWhitespace(){for(;this.pos<this.length;){let e=c.cca(this.input,this.pos);switch(e??-1){case 9:case 32:let t=0,l=1;for(;t<l;){let i=t++;if(this.pos>=this.length)break;let n=c.cca(this.input,this.pos);(n??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}break;default:return}}}isDigit(e){return e>=48?e<=57:!1}isIdentifierStart(e){return e>=97&&e<=122||e>=65&&e<=90?!0:e==95}isLowerCase(e){return e>=97?e<=122:!1}isIdentifierPart(e){return e>=97&&e<=122||e>=65&&e<=90||e==95?!0:e>=48?e<=57:!1}static compareAttachments(e,t){let l;switch(e._hx_index){case 0:let n=e.braces,s=e.inTag,r=e.expr,a=e.length;l=e.start;break;case 1:let o=e.closing,u=e.length;l=e.start;break}let i;switch(t._hx_index){case 0:let n=t.braces,s=t.inTag,r=t.expr,a=t.length;i=t.start;break;case 1:let o=t.closing,u=t.length;i=t.start;break}return l-i}}Q["loreline.Lexer"]=kt,kt.__name__="loreline.Lexer",Object.assign(kt.prototype,{__class__:kt});class ml{static lastError(){return ml._lastError}static parse(e,t,l,i){ml._lastError=null;let n=new kt(e),s=n.tokenize(),r=n.getErrors();if(r!=null&&r.length>0)return ml._reportParseError(r[0],i);let a=null;if(t!=null&&l!=null)return new zi().resolve(t,s,l,function(p){ml._reportParseError(p,i)},function(p,_){if(ml._lastError!=null)return;let m=new Gl(s,new Fi(t,t,_,null));a=m.parse(),a.indentSize=n.detectedIndentSize;let f=m.getErrors();if(f!=null&&f.length>0){a=null,ml._reportParseError(f[0],i);return}i?.(a)}),a;let h=new Gl(s);a=h.parse(),a.indentSize=n.detectedIndentSize;let o=h.getErrors();return o!=null&&o.length>0?ml._reportParseError(o[0],i):(i?.(a),a)}static _reportParseError(e,t){if(ml._lastError=e,t!=null)return t(null),null;throw C.thrown(e)}static loadLocale(e,t,l,i,n){if(ml._lastError=null,l==null&&(l=t.filePath),l==null)throw C.thrown(new st("Cannot load locale: no filePath provided and script.filePath is null"));if(i==null)throw C.thrown(new st("Cannot load locale: handleFile is required"));let s=Cl.wrap(i,e);i=s.handler;let r=s.lastError,a=".lor",h,o,u;if(l==null)u=!1;else{let E=l.length;if(E<8)u=!1;else{let v,M,A,L,I,q,z=c.cca(l,E-8);if((z??-1)==46){let P=c.cca(l,E-7),B=P??-1;q=B==108||B==76}else q=!1;if(q){let P=c.cca(l,E-6),B=P??-1;I=B==111||B==79}else I=!1;if(I){let P=c.cca(l,E-5),B=P??-1;L=B==114||B==82}else L=!1;if(L){let P=c.cca(l,E-4);A=(P??-1)==46}else A=!1;if(A){let P=c.cca(l,E-3),B=P??-1;M=B==116||B==84}else M=!1;if(M){let P=c.cca(l,E-2),B=P??-1;v=B==120||B==88}else v=!1;if(v){let P=c.cca(l,E-1),B=P??-1;u=B==116||B==84}else u=!1}}if(u)o=!0;else if(l==null)o=!1;else{let E=l.length;if(E<4)o=!1;else{let v,M,A=c.cca(l,E-4);if((A??-1)==46){let L=c.cca(l,E-3),I=L??-1;M=I==108||I==76}else M=!1;if(M){let L=c.cca(l,E-2),I=L??-1;v=I==111||I==79}else v=!1;if(v){let L=c.cca(l,E-1),I=L??-1;o=I==114||I==82}else o=!1}}if(o)h=De.directory(l);else{let E=l.length,v;if(E>0){let M=c.cca(l,E-1);v=M??-1}else v=0;if(v==47||v==92){let M=E-1;h=M!=null?c.substr(l,0,M):c.substr(l,0,null)}else h=l}let p=t.filePath,_=[],m=[];if(p!=null){let E=De.withoutDirectory(p),v;if(E==null)v=null;else{let A;if(E==null)A=!1;else{let L=E.length;if(L<8)A=!1;else{let I,q,z,P,B,N,D=c.cca(E,L-8);if((D??-1)==46){let U=c.cca(E,L-7),W=U??-1;N=W==108||W==76}else N=!1;if(N){let U=c.cca(E,L-6),W=U??-1;B=W==111||W==79}else B=!1;if(B){let U=c.cca(E,L-5),W=U??-1;P=W==114||W==82}else P=!1;if(P){let U=c.cca(E,L-4);z=(U??-1)==46}else z=!1;if(z){let U=c.cca(E,L-3),W=U??-1;q=W==116||W==84}else q=!1;if(q){let U=c.cca(E,L-2),W=U??-1;I=W==120||W==88}else I=!1;if(I){let U=c.cca(E,L-1),W=U??-1;A=W==116||W==84}else A=!1}}if(A){let L=E.length-8;v=L!=null?c.substr(E,0,L):c.substr(E,0,null)}else{let L;if(E==null)L=!1;else{let I=E.length;if(I<4)L=!1;else{let q,z,P=c.cca(E,I-4);if((P??-1)==46){let B=c.cca(E,I-3),N=B??-1;z=N==108||N==76}else z=!1;if(z){let B=c.cca(E,I-2),N=B??-1;q=N==111||N==79}else q=!1;if(q){let B=c.cca(E,I-1),N=B??-1;L=N==114||N==82}else L=!1}}if(L){let I=E.length-4;v=I!=null?c.substr(E,0,I):c.substr(E,0,null)}else v=E}}let M=v+"."+e+a;_.push("."),m.push(De.normalize(De.join([h,M])))}if(p!=null){let E=new Ii(t),v=De.directory(p),M=E.getImportedPaths(p),A=0;for(;A<M.length;){let L=M[A];++A;let I=ml.relativePath(v,L),q;if(I==null)q=null;else{let N;if(I==null)N=!1;else{let D=I.length;if(D<8)N=!1;else{let U,W,J,H,X,ae,ce=c.cca(I,D-8);if((ce??-1)==46){let ne=c.cca(I,D-7),re=ne??-1;ae=re==108||re==76}else ae=!1;if(ae){let ne=c.cca(I,D-6),re=ne??-1;X=re==111||re==79}else X=!1;if(X){let ne=c.cca(I,D-5),re=ne??-1;H=re==114||re==82}else H=!1;if(H){let ne=c.cca(I,D-4);J=(ne??-1)==46}else J=!1;if(J){let ne=c.cca(I,D-3),re=ne??-1;W=re==116||re==84}else W=!1;if(W){let ne=c.cca(I,D-2),re=ne??-1;U=re==120||re==88}else U=!1;if(U){let ne=c.cca(I,D-1),re=ne??-1;N=re==116||re==84}else N=!1}}if(N){let D=I.length-8;q=D!=null?c.substr(I,0,D):c.substr(I,0,null)}else{let D;if(I==null)D=!1;else{let U=I.length;if(U<4)D=!1;else{let W,J,H=c.cca(I,U-4);if((H??-1)==46){let X=c.cca(I,U-3),ae=X??-1;J=ae==108||ae==76}else J=!1;if(J){let X=c.cca(I,U-2),ae=X??-1;W=ae==111||ae==79}else W=!1;if(W){let X=c.cca(I,U-1),ae=X??-1;D=ae==114||ae==82}else D=!1}}if(D){let U=I.length-4;q=U!=null?c.substr(I,0,U):c.substr(I,0,null)}else q=I}}let z=q+"."+e+a,P=De.normalize(I),B;if(P==null)B=null;else{let N;if(P==null)N=!1;else{let D=P.length;if(D<8)N=!1;else{let U,W,J,H,X,ae,ce=c.cca(P,D-8);if((ce??-1)==46){let ne=c.cca(P,D-7),re=ne??-1;ae=re==108||re==76}else ae=!1;if(ae){let ne=c.cca(P,D-6),re=ne??-1;X=re==111||re==79}else X=!1;if(X){let ne=c.cca(P,D-5),re=ne??-1;H=re==114||re==82}else H=!1;if(H){let ne=c.cca(P,D-4);J=(ne??-1)==46}else J=!1;if(J){let ne=c.cca(P,D-3),re=ne??-1;W=re==116||re==84}else W=!1;if(W){let ne=c.cca(P,D-2),re=ne??-1;U=re==120||re==88}else U=!1;if(U){let ne=c.cca(P,D-1),re=ne??-1;N=re==116||re==84}else N=!1}}if(N){let D=P.length-8;B=D!=null?c.substr(P,0,D):c.substr(P,0,null)}else{let D;if(P==null)D=!1;else{let U=P.length;if(U<4)D=!1;else{let W,J,H=c.cca(P,U-4);if((H??-1)==46){let X=c.cca(P,U-3),ae=X??-1;J=ae==108||ae==76}else J=!1;if(J){let X=c.cca(P,U-2),ae=X??-1;W=ae==111||ae==79}else W=!1;if(W){let X=c.cca(P,U-1),ae=X??-1;D=ae==114||ae==82}else D=!1}}if(D){let U=P.length-4;B=U!=null?c.substr(P,0,U):c.substr(P,0,null)}else B=P}}_.push(B),m.push(De.normalize(De.join([h,z])))}}let f=new Ee,g=_.length,d=!1,w=null,y=function(E,v){v(null)},S=function(){let E=w??r();if(E!=null){if(ml._lastError=E,n!=null){n(null);return}throw C.thrown(E)}n?.(f)},T=0,O=_.length;for(;T<O;){let E=T++,v=_[E],M=m[E];i(M,function(A){if(g-=1,A!=null)try{let L=ml.parse(A,M,y);if(L!=null){let q=et.extractTranslations(L).h,z=q,P=Object.keys(q),B=P.length,N=0;for(;N<B;){let D=P[N++],U=D,W=z[D],J=U,H=W;f.h[v+"#"+J]=H}}}catch(L){let I=C.caught(L).unwrap();if(I instanceof st){let q=I;w==null&&(w=new st('Failed to load translation file "'+M+'": '+q.message))}else{let q=I;w==null&&(w=new st('Failed to load translation file "'+M+'": '+(q==null?"null":Y.string(q))))}}g==0&&d&&S()})}return d=!0,g==0&&S(),ml._lastError!=null?null:f}static relativePath(e,t){let l=De.normalize(e),i=De.normalize(t),n=l.split("/"),s=i.split("/"),r=0;for(;r<n.length&&r<s.length&&n[r]==s[r];)++r;let a=n.length-r,h=[],o=0,u=a;for(;o<u;){let m=o++;h.push("..")}let p=r,_=s.length;for(;p<_;){let m=p++;h.push(s[m])}return h.length==0?".":h.join("/")}static play(e,t,l,i,n,s){let r=new Pi(e,t,l,i,s);return r.start(n),r}static resume(e,t,l,i,n,s,r){let a=new Pi(e,t,l,i,r);return a.restore(n),s!=null?a.start(s):a.resume(),a}static extractTranslations(e){return et.extractTranslations(e)}static translationFormat(e,t){Cl.translationFormat(e,t)}static generateTranslationFile(e,t,l,i){if(l==null||l=="lor")return et.generateTranslationFile(e,t,new Wl);if(i==null||i=="")throw C.thrown(new st("A locale is required when generating a translation file in format '"+l+"'"));if(l==null)throw C.thrown(new st("Unknown translation file format: '"+l+"'"));switch(l){case"csv":return Ut.fromScript(e,t,i);case"po":return bl.fromScript(e,t,i);case"tsv":return Ut.tsvFromScript(e,t,i);case"xliff":return vt.fromScript(e,t,i);default:throw C.thrown(new st("Unknown translation file format: '"+l+"'"))}}static insertLocalizationKeys(e,t,l,i){return l==null&&(l=!0),et.insertLocalizationKeys(e,t,l,i)}static collectHashIds(e,t){return et.collectHashIds(e,t)}static removeLocalizationKeys(e,t){return et.removeLocalizationKeys(e,t)}static extractTranslatableEntries(e){return et.extractTranslatableEntries(e)}static hasUntaggedTranslatableStrings(e){return et.hasUntaggedTranslatableStrings(e)}static print(e,t,l){let i=t,n=l;return new Wl(i??" ",n??`
|
|
33
|
+
`).print(e)}static update(e){Zl.update(e)}}Q["loreline.Loreline"]=Xl.loreline.Loreline=ml,ml.__name__="loreline.Loreline";class Ae{constructor(e,t,l,i){if(e<0||e>65535)throw C.thrown("Section value ("+e+") should be between 0 and 65535");if(t<0||t>65535)throw C.thrown("Branch value ("+t+") should be between 0 and 65535");if(l<0||l>65535)throw C.thrown("Block value ("+l+") should be between 0 and 65535");if(i<0||i>65535)throw C.thrown("Node value ("+i+") should be between 0 and 65535");let n=e-32768,s=t-32768;n<0&&(n=n+65536&65535),s<0&&(s=s+65536&65535);let r=l-32768,a=i-32768;r<0&&(r=r+65536&65535),a<0&&(a=a+65536&65535),this.thisVal=new jl(n<<16|s&65535,r<<16|a&65535)}get_section(){let e=this.thisVal.high>>16&65535;return(e>=32768?e-65536:e)+32768}set_section(e){let t=e-32768;return t<0&&(t=t+65536&65535),this.thisVal=new jl(this.thisVal.high&65535|t<<16,this.thisVal.low),e}get_branch(){let e=this.thisVal.high&65535;return(e>=32768?e-65536:e)+32768}set_branch(e){let t=e-32768;return t<0&&(t=t+65536&65535),this.thisVal=new jl(this.thisVal.high&-65536|t,this.thisVal.low),e}get_block(){let e=this.thisVal.low>>16&65535;return(e>=32768?e-65536:e)+32768}set_block(e){let t=e-32768;return t<0&&(t=t+65536&65535),this.thisVal=new jl(this.thisVal.high,this.thisVal.low&65535|t<<16),e}get_node(){let e=this.thisVal.low&65535;return(e>=32768?e-65536:e)+32768}set_node(e){let t=e-32768;return t<0&&(t=t+65536&65535),this.thisVal=new jl(this.thisVal.high,this.thisVal.low&-65536|t),e}nextSection(){let e=this.thisVal.high>>16&65535,t=(e>=32768?e-65536:e)+32768;if(t==65535)throw C.thrown("Node id section overflow");return new Ae(t+1,0,0,0)}nextBranch(){let e=this.thisVal.high&65535,t=(e>=32768?e-65536:e)+32768;if(t==65535)return this.nextSection();let l=this.thisVal.high>>16&65535;return new Ae((l>=32768?l-65536:l)+32768,t+1,0,0)}nextBlock(){let e=this.thisVal.low>>16&65535,t=(e>=32768?e-65536:e)+32768;if(t==65535)return this.nextBranch();let l=this.thisVal.high>>16&65535,i=this.thisVal.high&65535;return new Ae((l>=32768?l-65536:l)+32768,(i>=32768?i-65536:i)+32768,t+1,0)}nextNode(){let e=this.thisVal.low&65535,t=(e>=32768?e-65536:e)+32768;if(t==65535)return this.nextBlock();let l=this.thisVal.high>>16&65535,i=this.thisVal.high&65535,n=this.thisVal.low>>16&65535;return new Ae((l>=32768?l-65536:l)+32768,(i>=32768?i-65536:i)+32768,(n>=32768?n-65536:n)+32768,t+1)}toInt64(){return this.thisVal}toString(){let e=this.thisVal.high>>16&65535,t=this.thisVal.high&65535,l=this.thisVal.low>>16&65535,i=this.thisVal.low&65535;return""+((e>=32768?e-65536:e)+32768)+"."+((t>=32768?t-65536:t)+32768)+"."+((l>=32768?l-65536:l)+32768)+"."+((i>=32768?i-65536:i)+32768)}static fromInt64(e){let t=new Ae(32768,32768,32768,32768);return t.thisVal=e,t}static fromString(e){let t=e.split(".");return new Ae(Y.parseInt(t[0]),Y.parseInt(t[1]),Y.parseInt(t[2]),Y.parseInt(t[3]))}static fromTwoInt32(e,t){return Ae.fromInt64(new jl(e,t))}static packInt32(e,t){return e<0&&(e=e+65536&65535),t<0&&(t=t+65536&65535),e<<16|t&65535}static int32GetLow(e){let t=e&65535;return t>=32768?t-65536:t}static int32SetLow(e,t){return t<0&&(t=t+65536&65535),e&-65536|t}static int32GetHigh(e){let t=e>>16&65535;return t>=32768?t-65536:t}static int32SetHigh(e,t){return t<0&&(t=t+65536&65535),e&65535|t<<16}static equals(e,t){let l=e.thisVal,i=t.thisVal;return l.high==i.high?l.low==i.low:!1}}Q["loreline.NodeId"]=Ae,Ae.__name__="loreline.NodeId",Object.assign(Ae.prototype,{__class__:Ae,__properties__:{set_node:"set_node",get_node:"get_node",set_block:"set_block",get_block:"get_block",set_branch:"set_branch",get_branch:"get_branch",set_section:"set_section",get_section:"get_section"}});class li{constructor(){this.map=new El}get(e){let t=e.thisVal;return this.map._get(t.high,t.low)}set(e,t){let l=e.thisVal;this.map._set(l.high,l.low,t)}remove(e){let t=e.thisVal;this.map._remove(t.high,t.low)}exists(e){let t=e.thisVal;return this.map._exists(t.high,t.low)}clear(){this.map.clear()}iterator(){return new $i(this.map)}keys(){return new Yi(this.map)}keyValueIterator(){return new Zi(this.map)}}Q["loreline.NodeIdMap"]=li,li.__name__="loreline.NodeIdMap",Object.assign(li.prototype,{__class__:li});class $i{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._values[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return e}}Q["loreline._Node.NodeIdMapIterator"]=$i,$i.__name__="loreline._Node.NodeIdMapIterator",Object.assign($i.prototype,{__class__:$i});class Yi{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._keys1[this.index],t=this.map._keys2[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return Ae.fromTwoInt32(e,t)}}Q["loreline._Node.NodeIdMapKeyIterator"]=Yi,Yi.__name__="loreline._Node.NodeIdMapKeyIterator",Object.assign(Yi.prototype,{__class__:Yi});class Zi{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._keys1[this.index],t=this.map._keys2[this.index],l=this.map._values[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return{key:Ae.fromTwoInt32(e,t),value:l}}}Q["loreline._Node.NodeIdMapKeyValueIterator"]=Zi,Zi.__name__="loreline._Node.NodeIdMapKeyValueIterator",Object.assign(Zi.prototype,{__class__:Zi});class At{constructor(e,t){At._hx_skip_constructor||this._hx_constructor(e,t)}_hx_constructor(e,t){this.id=Ae.UNDEFINED,this.id=e,this.pos=t}type(){return"Node"}toJson(){return{id:this.id.toString(),type:this.type(),pos:this.pos.toJson()}}each(e){}static fromJson(e){return R.nodeFromJson(e)}}Q["loreline.Node"]=Xl.loreline.Node=At,At.__name__="loreline.Node",Object.assign(At.prototype,{__class__:At});class Ql extends At{constructor(e,t,l,i,n){n==null&&(n=!1),super(e,t),this.content=l,this.multiline=i,this.isHash=n}type(){return"Comment"}toJson(){let e=super.toJson();return e.content=this.content,e.multiline=this.multiline,this.isHash&&(e.isHash=!0),e}}Q["loreline.Comment"]=Ql,Ql.__name__="loreline.Comment",Ql.__super__=At,Object.assign(Ql.prototype,{__class__:Ql});class Be extends At{constructor(e,t,l,i){if(At._hx_skip_constructor){super();return}At._hx_skip_constructor=!0,super(),At._hx_skip_constructor=!1,this._hx_constructor(e,t,l,i)}_hx_constructor(e,t,l,i){super._hx_constructor(e,t),this.leadingComments=l,this.trailingComments=i}type(){return"AstNode"}eachComment(e){if(this.leadingComments!=null){let l=0,i=this.leadingComments;for(;l<i.length;){let n=i[l];++l,e(this,n)}}if(this.trailingComments!=null){let l=0,i=this.trailingComments;for(;l<i.length;){let n=i[l];++l,e(this,n)}}let t=this;this.each(function(l,i){if(l instanceof Be){let n=l;if(n.leadingComments!=null){let s=0,r=n.leadingComments;for(;s<r.length;){let a=r[s];++s,e(t,a)}}if(n.trailingComments!=null){let s=0,r=n.trailingComments;for(;s<r.length;){let a=r[s];++s,e(t,a)}}}})}each(e){if(super.each(e),this.leadingComments!=null){let t=0,l=this.leadingComments;for(;t<l.length;){let i=l[t];++t,e(i,this),i.each(e)}}if(this.trailingComments!=null){let t=0,l=this.trailingComments;for(;t<l.length;){let i=l[t];++t,e(i,this),i.each(e)}}}toJson(){let e=super.toJson();if(this.leadingComments!=null&&this.leadingComments.length>0||this.trailingComments!=null&&this.trailingComments.length>0){let t={};if(this.leadingComments!=null&&this.leadingComments.length>0){let l=[],i=0,n=this.leadingComments;for(;i<n.length;){let s=n[i];++i,l.push(s.toJson())}t.leading=l}if(this.trailingComments!=null&&this.trailingComments.length>0){let l=[],i=0,n=this.trailingComments;for(;i<n.length;){let s=n[i];++i,l.push(s.toJson())}t.trailing=l}e.comments=t}return e}}Q["loreline.AstNode"]=Be,Be.__name__="loreline.AstNode",Be.__super__=At,Object.assign(Be.prototype,{__class__:Be});class ct extends Be{constructor(e,t,l,i){super(e,t,l,i)}toJson(){return super.toJson()}type(){return"Expr"}}Q["loreline.NExpr"]=ct,ct.__name__="loreline.NExpr",ct.__super__=Be,Object.assign(ct.prototype,{__class__:ct});class $t extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.temporary=l,this.fields=i,this.style=0}type(){return"State"}get(e){let t=0,l=this.fields;for(;t<l.length;){let i=l[t];if(++t,i.name==e)return i.value}return null}each(e){if(super.each(e),this.fields!=null){let t=0,l=this.fields.length;for(;t<l;){let i=t++,n=this.fields[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.temporary=this.temporary;let t=[],l=0,i=this.fields;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.fields=t,e.style=Vl.toString(this.style),e}}Q["loreline.NStateDecl"]=$t,$t.__name__="loreline.NStateDecl",$t.__super__=Be,Object.assign($t.prototype,{__class__:$t});class Ul extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.name=l,this.value=i}type(){return"Field"}each(e){super.each(e),this.value!=null&&(e(this.value,this),this.value.each(e))}toJson(){let e=super.toJson();return e.name=this.name,e.value=this.value.toJson(),e}}Q["loreline.NObjectField"]=Ul,Ul.__name__="loreline.NObjectField",Ul.__super__=Be,Object.assign(Ul.prototype,{__class__:Ul});class jt extends Be{constructor(e,t,l,i,n,s,r){super(e,t,s,r),this.name=l,this.namePos=i,this.fields=n,this.style=0}type(){return"Character"}get(e){let t=0,l=this.fields;for(;t<l.length;){let i=l[t];if(++t,i.name==e)return i.value}return null}each(e){if(super.each(e),this.fields!=null){let t=0,l=this.fields.length;for(;t<l;){let i=t++,n=this.fields[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.name=this.name,e.namePos=this.namePos.toJson();let t=[],l=0,i=this.fields;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.fields=t,e.style=Vl.toString(this.style),e}}Q["loreline.NCharacterDecl"]=jt,jt.__name__="loreline.NCharacterDecl",jt.__super__=Be,Object.assign(jt.prototype,{__class__:jt});class Me extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.name=l,this.body=i,this.style=0}type(){return"Beat"}each(e){if(super.each(e),this.body!=null){let t=0,l=this.body.length;for(;t<l;){let i=t++,n=this.body[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.name=this.name;let t=[],l=0,i=this.body;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.body=t,e.style=Vl.toString(this.style),e}}Q["loreline.NBeatDecl"]=Me,Me.__name__="loreline.NBeatDecl",Me.__super__=Be,Object.assign(Me.prototype,{__class__:Me});var ze=Ye["loreline.StringPartType"]={__ename__:"loreline.StringPartType",__constructs__:null,Raw:(x=function(b){return{_hx_index:0,text:b,__enum__:"loreline.StringPartType",toString:F}},x._hx_name="Raw",x.__params__=["text"],x),Expr:(x=function(b){return{_hx_index:1,expr:b,__enum__:"loreline.StringPartType",toString:F}},x._hx_name="Expr",x.__params__=["expr"],x),Tag:(x=function(b,e){return{_hx_index:2,closing:b,expr:e,__enum__:"loreline.StringPartType",toString:F}},x._hx_name="Tag",x.__params__=["closing","expr"],x)};ze.__constructs__=[ze.Raw,ze.Expr,ze.Tag];class Vl{static toString(e){switch(e){case 0:return"Plain";case 1:return"Braces"}}}class Ni{static toString(e){switch(e){case 0:return"Plain";case 2:return"Parens"}}}class Mi{static toString(e){switch(e){case 0:return"Sequence";case 1:return"Cycle";case 2:return"Once";case 3:return"Pick";case 4:return"Shuffle"}}}class Ge extends ct{constructor(e,t,l,i,n){super(e,t,i,n),this.partType=l}type(){return"Part"}each(e){super.each(e);let t=this.partType;switch(t._hx_index){case 0:let l=t.text;break;case 1:let i=t.expr;e(i,this),i.each(e);break;case 2:let n=t.closing,s=t.expr;e(s,this),s.each(e);break}}toJson(){let e=super.toJson(),t=this.partType;switch(t._hx_index){case 0:let l=t.text;e.part="Raw",e.text=l;break;case 1:let i=t.expr;e.part="Expr",e.expression=i.toJson();break;case 2:let n=t.closing,s=t.expr;e.part="Tag",e.closing=n,e.content=s.toJson();break}return e}}Q["loreline.NStringPart"]=Ge,Ge.__name__="loreline.NStringPart",Ge.__super__=ct,Object.assign(Ge.prototype,{__class__:Ge});class Mt extends ct{constructor(e,t,l,i,n,s){super(e,t,n,s),this.parts=i,this.quotes=l}type(){return"String"}each(e){if(super.each(e),this.parts!=null){let t=0,l=this.parts.length;for(;t<l;){let i=t++,n=this.parts[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],l=0,i=this.parts;for(;l<i.length;){let s=i[l];++l,t.push(s.toJson())}let n=t;return e.parts=n,e.quotes=fn.toString(this.quotes),e}}Q["loreline.NStringLiteral"]=Mt,Mt.__name__="loreline.NStringLiteral",Mt.__super__=ct,Object.assign(Mt.prototype,{__class__:Mt});class ll extends Be{constructor(e,t,l,i,n){super(e,t,i,n),this.content=l,this.conditionStyle=0}type(){return"Text"}each(e){super.each(e),this.content!=null&&(e(this.content,this),this.content.each(e)),this.condition!=null&&(e(this.condition,this),this.condition.each(e))}toJson(){let e=super.toJson();return e.content=this.content.toJson(),this.condition!=null&&(e.condition=this.condition.toJson(),e.conditionStyle=Ni.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}Q["loreline.NTextStatement"]=ll,ll.__name__="loreline.NTextStatement",ll.__super__=Be,Object.assign(ll.prototype,{__class__:ll});class Kt extends Be{constructor(e,t,l,i,n,s,r){super(e,t,s,r),this.character=l,this.characterPos=i,this.content=n,this.conditionStyle=0}type(){return"Dialogue"}each(e){super.each(e),this.content!=null&&(e(this.content,this),this.content.each(e)),this.condition!=null&&(e(this.condition,this),this.condition.each(e))}toJson(){let e=super.toJson();return e.character=this.character,e.characterPos=this.characterPos.toJson(),e.content=this.content.toJson(),this.condition!=null&&(e.condition=this.condition.toJson(),e.conditionStyle=Ni.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}Q["loreline.NDialogueStatement"]=Kt,Kt.__name__="loreline.NDialogueStatement",Kt.__super__=Be,Object.assign(Kt.prototype,{__class__:Kt});class xl extends Be{constructor(e,t,l,i,n){super(e,t,i,n),this.options=l,this.style=0}type(){return"Choice"}each(e){if(super.each(e),this.options!=null){let t=0,l=this.options.length;for(;t<l;){let i=t++,n=this.options[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],l=0,i=this.options;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.options=t,e.style=Vl.toString(this.style),e}}Q["loreline.NChoiceStatement"]=xl,xl.__name__="loreline.NChoiceStatement",xl.__super__=Be,Object.assign(xl.prototype,{__class__:xl});class St extends Be{constructor(e,t,l,i,n,s,r,a,h){super(e,t,a,h),this.text=l,this.insertion=i,this.condition=n,this.conditionStyle=s,this.body=r,this.style=0,this.once=!1}type(){return"Option"}each(e){if(super.each(e),this.body!=null){let t=0,l=this.body.length;for(;t<l;){let i=t++,n=this.body[i];e(n,this),n.each(e)}}this.text!=null&&(e(this.text,this),this.text.each(e)),this.insertion!=null&&(e(this.insertion,this),this.insertion.each(e)),this.condition!=null&&(e(this.condition,this),this.condition.each(e))}toJson(){let e=super.toJson();this.text!=null&&(e.text=this.text.toJson()),this.insertion!=null&&(e.insertion=this.insertion.toJson()),this.condition!=null&&(e.condition=this.condition.toJson(),e.conditionStyle=Ni.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson());let t=[],l=0,i=this.body;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.body=t,e.style=Vl.toString(this.style),this.once&&(e.once=!0),e}}Q["loreline.NChoiceOption"]=St,St.__name__="loreline.NChoiceOption",St.__super__=Be,Object.assign(St.prototype,{__class__:St});class hl extends Be{constructor(e,t,l,i,n){super(e,t,i,n),this.body=l,this.style=0}type(){return"Block"}each(e){if(super.each(e),this.body!=null){let t=0,l=this.body.length;for(;t<l;){let i=t++,n=this.body[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],l=0,i=this.body;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.body=t,e.style=Vl.toString(this.style),e}}Q["loreline.NBlock"]=hl,hl.__name__="loreline.NBlock",hl.__super__=Be,Object.assign(hl.prototype,{__class__:hl});class wl extends Be{constructor(e,t,l,i,n,s,r,a,h,o){super(e,t,r,a),this.condition=l,this.conditionStyle=i,this.thenBranch=n,this.elseBranch=s,this.elseLeadingComments=h,this.elseTrailingComments=o}type(){return"If"}each(e){if(super.each(e),this.condition!=null&&(e(this.condition,this),this.condition.each(e)),this.thenBranch!=null&&(e(this.thenBranch,this),this.thenBranch.each(e)),this.elseBranch!=null&&(e(this.elseBranch,this),this.elseBranch.each(e)),this.elseLeadingComments!=null){let t=0,l=this.elseLeadingComments;for(;t<l.length;){let i=l[t];++t,e(i,this),i.each(e)}}if(this.elseTrailingComments!=null){let t=0,l=this.elseTrailingComments;for(;t<l.length;){let i=l[t];++t,e(i,this),i.each(e)}}}toJson(){let e=super.toJson();e.condition=this.condition.toJson(),e.conditionStyle=Ni.toString(this.conditionStyle);let t=[],l=0,i=this.thenBranch.body;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}if(e.thenBranch=t,e.thenStyle=Vl.toString(this.thenBranch.style),this.elseBranch!=null){let n=[],s=0,r=this.elseBranch.body;for(;s<r.length;){let a=r[s];++s,n.push(a.toJson())}if(e.elseBranch=n,e.elseStyle=Vl.toString(this.elseBranch.style),this.elseLeadingComments!=null&&this.elseLeadingComments.length>0||this.elseTrailingComments!=null&&this.elseTrailingComments.length>0){let a=e.comments,h=a??{};if(this.elseLeadingComments!=null&&this.elseLeadingComments.length>0){let o=[],u=0,p=this.elseLeadingComments;for(;u<p.length;){let _=p[u];++u,o.push(_.toJson())}h.elseLeading=o}if(this.elseTrailingComments!=null&&this.elseTrailingComments.length>0){let o=[],u=0,p=this.elseTrailingComments;for(;u<p.length;){let _=p[u];++u,o.push(_.toJson())}h.elseTrailing=o}e.comments=h}}return e}}Q["loreline.NIfStatement"]=wl,wl.__name__="loreline.NIfStatement",wl.__super__=Be,Object.assign(wl.prototype,{__class__:wl});class Hl extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.mode=l,this.items=i,this.style=0}type(){return"Alternative"}each(e){if(super.each(e),this.items!=null){let t=0,l=this.items.length;for(;t<l;){let i=t++,n=this.items[i];e(n,this),n.each(e)}}if(this.separatorComments!=null){let t=0,l=this.separatorComments;for(;t<l.length;){let i=l[t];if(++t,i!=null){let n=0;for(;n<i.length;){let s=i[n];++n,e(s,this),s.each(e)}}}}}toJson(){let e=super.toJson();e.mode=Mi.toString(this.mode);let t=[],l=0,i=this.items;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}if(e.items=t,e.style=Vl.toString(this.style),this.separatorComments!=null){let n=[],s=0,r=this.separatorComments;for(;s<r.length;){let a=r[s];++s;let h;if(a!=null){let o=[],u=0;for(;u<a.length;){let p=a[u];++u,o.push(p.toJson())}h=o}else h=null;n.push(h)}e.separatorComments=n}return e}}Q["loreline.NAlternative"]=Hl,Hl.__name__="loreline.NAlternative",Hl.__super__=Be,Object.assign(Hl.prototype,{__class__:Hl});class Jt extends ct{constructor(e,t,l,i,n,s){super(e,t,n,s),this.target=l,this.args=i}type(){return"Call"}each(e){if(super.each(e),this.target!=null&&(e(this.target,this),this.target.each(e)),this.args!=null){let t=0,l=this.args;for(;t<l.length;){let i=l[t];++t,e(i,this),i.each(e)}}}toJson(){let e=super.toJson();e.target=this.target.toJson();let t=[],l=0,i=this.args;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.args=t,e}}Q["loreline.NCall"]=Jt,Jt.__name__="loreline.NCall",Jt.__super__=ct,Object.assign(Jt.prototype,{__class__:Jt});class Dl extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.target=l,this.targetPos=i}type(){return"Transition"}toJson(){let e=super.toJson();return e.target=this.target,e.targetPos=this.targetPos.toJson(),e}}Q["loreline.NTransition"]=Dl,Dl.__name__="loreline.NTransition",Dl.__super__=Be,Object.assign(Dl.prototype,{__class__:Dl});class $l extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.target=l,this.targetPos=i}type(){return"Insertion"}toJson(){let e=super.toJson();return e.target=this.target,e.targetPos=this.targetPos.toJson(),e}}Q["loreline.NInsertion"]=$l,$l.__name__="loreline.NInsertion",$l.__super__=Be,Object.assign($l.prototype,{__class__:$l});class ql extends ct{constructor(e,t,l,i,n,s,r,a){super(e,t,r,a),this.name=l,this.args=i,this.code=n,this.external=s}type(){return"Function"}toJson(){let e=super.toJson();return this.name!=null&&(e.name=this.name),e.args=[].concat(this.args),e.code=this.code,e.external=this.external,e}}Q["loreline.NFunctionDecl"]=ql,ql.__name__="loreline.NFunctionDecl",ql.__super__=ct,Object.assign(ql.prototype,{__class__:ql});class je extends ct{constructor(e,t,l,i,n,s){super(e,t,n,s),this.value=l,this.literalType=i}type(){return"Literal"}each(e){super.each(e);let t=this.literalType;switch(t._hx_index){case 0:case 1:case 2:break;case 3:if(this.value!=null){let i=0,n=this.value;for(;i<n.length;){let s=n[i];if(++i,s instanceof At){let r=s;e(r,this),r.each(e)}}}break;case 4:let l=t.style;if(this.value!=null){let i=0,n=this.value;for(;i<n.length;){let s=n[i];if(++i,s.value instanceof At){let r=s.value;e(r,this),r.each(e)}}}break}}toJson(){let e=super.toJson(),t=this.literalType;e.literal=Ye[t.__enum__].__constructs__[t._hx_index]._hx_name;let l=this.literalType;switch(l._hx_index){case 0:case 1:case 2:e.value=this.value;break;case 3:if(this.value!=null){let n=[],s=0,r=this.value;for(;s<r.length;){let a=r[s];++s,a instanceof At?n.push(a.toJson()):n.push(a)}e.value=n}break;case 4:let i=l.style;if(this.value!=null){let n=[],s=0,r=this.value;for(;s<r.length;){let a=r[s];++s,n.push(a.toJson())}e.value=n}else e.value=[];e.style=Vl.toString(i);break}return e}}Q["loreline.NLiteral"]=je,je.__name__="loreline.NLiteral",je.__super__=ct,Object.assign(je.prototype,{__class__:je});var Ke=Ye["loreline.LiteralType"]={__ename__:"loreline.LiteralType",__constructs__:null,Number:{_hx_name:"Number",_hx_index:0,__enum__:"loreline.LiteralType",toString:F},Boolean:{_hx_name:"Boolean",_hx_index:1,__enum__:"loreline.LiteralType",toString:F},Null:{_hx_name:"Null",_hx_index:2,__enum__:"loreline.LiteralType",toString:F},Array:{_hx_name:"Array",_hx_index:3,__enum__:"loreline.LiteralType",toString:F},Object:(x=function(b){return{_hx_index:4,style:b,__enum__:"loreline.LiteralType",toString:F}},x._hx_name="Object",x.__params__=["style"],x)};Ke.__constructs__=[Ke.Number,Ke.Boolean,Ke.Null,Ke.Array,Ke.Object];class ft extends ct{constructor(e,t,l,i,n,s){super(e,t,n,s),this.target=l,this.name=i}type(){return"Access"}each(e){super.each(e),this.target!=null&&(e(this.target,this),this.target.each(e))}toJson(){let e=super.toJson();return this.target!=null&&(e.target=this.target.toJson()),e.name=this.name,e}}Q["loreline.NAccess"]=ft,ft.__name__="loreline.NAccess",ft.__super__=ct,Object.assign(ft.prototype,{__class__:ft});class kl extends ct{constructor(e,t,l,i,n,s,r){super(e,t,s,r),this.target=l,this.op=i,this.value=n}type(){return"Assign"}each(e){super.each(e),this.target!=null&&(e(this.target,this),this.target.each(e)),this.value!=null&&(e(this.value,this),this.value.each(e))}toJson(){let e=super.toJson();return e.target=this.target.toJson(),e.op=Y.string(this.op),e.value=this.value.toJson(),e}}Q["loreline.NAssign"]=kl,kl.__name__="loreline.NAssign",kl.__super__=ct,Object.assign(kl.prototype,{__class__:kl});class gl extends ct{constructor(e,t,l,i,n,s){super(e,t,n,s),this.target=l,this.index=i}type(){return"ArrayAccess"}each(e){super.each(e),this.target!=null&&(e(this.target,this),this.target.each(e)),this.index!=null&&(e(this.index,this),this.index.each(e))}toJson(){let e=super.toJson();return e.target=this.target.toJson(),e.index=this.index.toJson(),e}}Q["loreline.NArrayAccess"]=gl,gl.__name__="loreline.NArrayAccess",gl.__super__=ct,Object.assign(gl.prototype,{__class__:gl});class il extends ct{constructor(e,t,l,i,n,s,r){super(e,t,s,r),this.left=l,this.op=i,this.right=n}type(){return"Binary"}each(e){super.each(e),this.left!=null&&(e(this.left,this),this.left.each(e)),this.right!=null&&(e(this.right,this),this.right.each(e))}toJson(){let e=super.toJson();return e.left=this.left.toJson(),e.op=Y.string(this.op),e.right=this.right.toJson(),e}}Q["loreline.NBinary"]=il,il.__name__="loreline.NBinary",il.__super__=ct,Object.assign(il.prototype,{__class__:il});class Yl extends ct{constructor(e,t,l,i,n,s){super(e,t,n,s),this.op=l,this.operand=i}type(){return"Unary"}each(e){super.each(e),this.operand!=null&&(e(this.operand,this),this.operand.each(e))}toJson(){let e=super.toJson();return e.op=Y.string(this.op),e.operand=this.operand.toJson(),e}}Q["loreline.NUnary"]=Yl,Yl.__name__="loreline.NUnary",Yl.__super__=ct,Object.assign(Yl.prototype,{__class__:Yl});class ii extends ct{constructor(e,t,l,i,n,s,r){super(e,t,s,r),this.condition=l,this.trueExpr=i,this.falseExpr=n}type(){return"Ternary"}each(e){super.each(e),this.condition!=null&&(e(this.condition,this),this.condition.each(e)),this.trueExpr!=null&&(e(this.trueExpr,this),this.trueExpr.each(e)),this.falseExpr!=null&&(e(this.falseExpr,this),this.falseExpr.each(e))}toJson(){let e=super.toJson();return e.condition=this.condition.toJson(),e.trueExpr=this.trueExpr.toJson(),e.falseExpr=this.falseExpr.toJson(),e}}Q["loreline.NTernary"]=ii,ii.__name__="loreline.NTernary",ii.__super__=ct,Object.assign(ii.prototype,{__class__:ii});class Rt extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.path=l,this.script=i}each(e){super.each(e),this.script!=null&&(e(this.script,this),this.script.each(e))}type(){return"Import"}toJson(){let e=super.toJson();return e.path=this.path.toJson(),this.script!=null&&(e.script=this.script.toJson()),e}}Q["loreline.NImportStatement"]=Rt,Rt.__name__="loreline.NImportStatement",Rt.__super__=Be,Object.assign(Rt.prototype,{__class__:Rt});class oe{static isFields(e){return te.__implements(e,Ml)||e instanceof Ee?!0:e instanceof Kl||typeof e=="number"&&(e|0)===e||typeof e=="number"||typeof e=="boolean"||typeof e=="string"?!1:!he.isArray(e)}static getField(e,t,l){return te.__implements(t,Ml)?t.lorelineGet(e,l):t instanceof Ee?t.h[l]:qe.getProperty(t,l)}static getFields(e,t){if(te.__implements(t,Ml))return t.lorelineFields(e);if(t instanceof Ee){let l=[],i=t.h,n=i,s=Object.keys(i),r=s.length,a=0;for(;a<r;){let h=s[a++];l.push(h)}return l}else return qe.fields(t)}static setField(e,t,l,i){te.__implements(t,Ml)?t.lorelineSet(e,l,i):t instanceof Ee?t.h[l]=i:qe.setProperty(t,l,i)}static removeField(e,t,l){if(te.__implements(t,Ml))return t.lorelineRemove(e,l);if(t instanceof Ee){let i=t;return Object.prototype.hasOwnProperty.call(i.h,l)?(delete i.h[l],!0):!1}else return qe.deleteField(t,l)}static fieldExists(e,t,l){return te.__implements(t,Ml)?t.lorelineExists(e,l):t instanceof Ee?Object.prototype.hasOwnProperty.call(t.h,l):Object.prototype.hasOwnProperty.call(t,l)}static getStringHelper(e,t){return e.stringHelpers.h[t]}static getArrayHelper(e,t){return e.arrayHelpers.h[t]}static getMapHelper(e,t){return e.mapHelpers.h[t]}static getBeatHelper(e,t){return e.beatHelpers.h[t]}static createFields(e,t,l){if(e!=null&&e.customCreateFields!=null){let i=e.customCreateFields(e,t,l);if(i!=null)return i}if(t!=null){let i=Object.create(Q[t].prototype);return te.__implements(i,Ml)&&i.lorelineCreate(e),i}return new Ee}}Q["loreline.Objects"]=oe,oe.__name__="loreline.Objects";class Ne extends st{constructor(e,t){super(e,t)}}Q["loreline.ParseError"]=Ne,Ne.__name__="loreline.ParseError",Ne.__super__=st,Object.assign(Ne.prototype,{__class__:Ne});class Fi{constructor(e,t,l,i){this.imported=new Ee,this.rootPath=e,this.path=t,this.imports=l,i!=null&&(this.imported=i)}}Q["loreline.ParserContext"]=Fi,Fi.__name__="loreline.ParserContext",Object.assign(Fi.prototype,{__class__:Fi});class Gl{constructor(e,t){this.parsingCondition=!1,this.tokens=e,this.current=0,this.errors=null,this.pendingComments=null,this.lastTokenEnd=new ue(1,1,0),this.lastLineBreak=null,this.lineBreakAfterToken=!1,this.currentNodeId=Ae.UNDEFINED,this.rootBeat=null,this.context=t}parse(){let e=this.currentPos(),t=[],l=new nl(this.nextNodeId(4),e,t);for(this.context!=null&&(l.filePath=this.context.path);!this.isAtEnd();)try{let i=this.parseNode(!0);for(i!=null&&t.push(i);this.match(k.LineBreak););}catch(i){let n=C.caught(i).unwrap();if(n instanceof Ne){let s=n;this.addError(s),this.synchronize()}else throw i}return this.attachComments(l),l}getErrors(){return this.errors==null&&(this.errors=[]),this.errors}nextNodeId(e){let t;switch(e){case 1:t=this.currentNodeId.nextSection();break;case 2:t=this.currentNodeId.nextBranch();break;case 3:t=this.currentNodeId.nextBlock();break;case 4:t=this.currentNodeId.nextNode();break}return this.currentNodeId=t,this.currentNodeId}peek(){let e=this.current+1;for(;e<this.tokens.length;){let t=this.tokens[e].type;switch(t._hx_index){case 51:let l=t.content;++e;break;case 52:let i=t.content;++e;break;case 53:let n=t.content;++e;break;case 56:++e;break;default:return this.tokens[e]}}return this.tokens[this.tokens.length-1]}advance(e){e==null&&(e=!0),this.parsingCondition&&(e=!1);let t=this.tokens[this.current];if(!this.isAtEnd()){for(this.lastTokenEnd=t.pos,this.lineBreakAfterToken=!1;!this.isAtEnd()&&this.tokens[this.current+1]!=null&&(this.isComment(this.tokens[this.current+1].type)||e&&this.tokens[this.current+1].type==k.LineBreak);){this.current++;let l=this.tokens[this.current].type;switch(l._hx_index){case 51:let i=l.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Ql(this.nextNodeId(4),this.currentPos(),i,!1));break;case 52:let n=l.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Ql(this.nextNodeId(4),this.currentPos(),n,!0));break;case 53:let s=l.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Ql(this.nextNodeId(4),this.currentPos(),s,!1,!0));break;case 56:this.lastLineBreak=this.currentPos(),this.lineBreakAfterToken=!0;break;default:}}this.current++}return t}previous(){return this.tokens[this.current-1]}prevWithType(e){let t=this.current-1;for(;t>=0;){if(Nt.equals(this.tokens[t].type,e))return this.tokens[t];--t}return null}prevIdentifier(){let e=this.current-1;for(;e>=0;){let t=this.tokens[e].type;if(t._hx_index==19){let l=t.name;return this.tokens[e]}--e}return null}prevNonWhitespaceOrComment(){let e=this.current-1;for(;e>=0;){let t=this.tokens[e].type;switch(t._hx_index){case 51:let l=t.content;break;case 52:let i=t.content;break;case 53:let n=t.content;break;case 54:case 55:case 56:break;default:return this.tokens[e]}--e}return null}nextNonWhitespaceOrComment(){let e=this.current;for(;e<this.tokens.length;){let t=this.tokens[e].type;switch(t._hx_index){case 51:let l=t.content;break;case 52:let i=t.content;break;case 53:let n=t.content;break;case 54:case 55:case 56:break;default:return this.tokens[e]}++e}return null}nextNonLineBreakOrComment(){let e=this.current;for(;e<this.tokens.length;){let t=this.tokens[e].type;switch(t._hx_index){case 51:let l=t.content;break;case 52:let i=t.content;break;case 53:let n=t.content;break;case 56:break;default:return this.tokens[e]}++e}return null}currentPos(){let e=this.tokens[this.current],t=e!=null?e.pos:null;return t??new ue(1,1,0,0)}currentTokenTypeToString(){if(this.tokens!=null&&this.current>=0){let e=this.tokens[this.current],t=e!=null?e.type:null;return t!=null?Nt.toCodeString(t):null}return null}check(e){return this.isAtEnd()?!1:e._hx_index==41?this.tokens[this.current].type==k.Colon:Nt.equals(this.tokens[this.current].type,e)}checkString(){let e=this.tokens[this.current].type;if(e._hx_index==15){let t=e.attachments,l=e.quotes,i=e.s;return!0}else return!1}isAtEnd(){return this.current<this.tokens.length?this.tokens[this.current].type==k.Eof:!0}isComment(e){switch(e._hx_index){case 51:let t=e.content;return!0;case 52:let l=e.content;return!0;case 53:let i=e.content;return!0;default:return!1}}parseNode(e){for(e==null&&(e=!1);this.isComment(this.tokens[this.current].type)||this.tokens[this.current].type==k.LineBreak;){if(this.isComment(this.tokens[this.current].type)){this.pendingComments==null&&(this.pendingComments=[]);let i=this.pendingComments,n=this.nextNodeId(4),s=this.currentPos(),r=this.tokens[this.current].type,a;switch(r._hx_index){case 51:a=r.content;break;case 52:a=r.content;break;case 53:a=r.content;break;default:a=""}let h=this.tokens[this.current].type,o;if(h._hx_index==52){let _=h.content;o=!0}else o=!1;let u=this.tokens[this.current].type,p;if(u._hx_index==53){let _=u.content;p=!0}else p=!1;i.push(new Ql(n,s,a,o,p))}if(this.advance(),this.isAtEnd())throw C.thrown(new Ne("Unexpected end of file",this.currentPos()))}if(this.isAtEnd())throw C.thrown(new Ne("Unexpected end of file",this.currentPos()));let t=this,l=this.tokens[this.current].type;switch(l._hx_index){case 0:return this.parseImport();case 1:return this.parseStateDecl(!1);case 2:return this.parseBeatDecl();case 3:return e?this.parseCharacterDecl():(this.addError(new Ne("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null));case 4:let i=this.parseChoiceStatement();return e?t.wrapInRootBeat(i):i;case 5:let n=this.parseIfStatement();return e?t.wrapInRootBeat(n):n;case 7:if(this.advance(),!this.check(k.KwState))throw C.thrown(new Ne("Expected 'state' after 'new'",this.currentPos()));let s=this.parseStateDecl(!0);return e?t.wrapInRootBeat(s):s;case 8:case 9:case 10:case 11:case 12:let r=this.parseAlternative();return e?t.wrapInRootBeat(r):r;case 14:let a=l.name,h=l.args,o=l.code,u=l.external;return e?this.parseFunction():(this.addError(new Ne("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null));case 15:let p=l.quotes,_=l.s,m=l.attachments,f=this.parseTextStatement();return e?t.wrapInRootBeat(f):f;case 16:let g=l.n,d=this.parseExpressionStatement();return e?t.wrapInRootBeat(d):d;case 17:let w=l.b,y=this.parseExpressionStatement();return e?t.wrapInRootBeat(y):y;case 19:let S=l.name;if(this.peek().type==k.Colon){let v=this.parseDialogueStatement();return e?t.wrapInRootBeat(v):v}else{let v=this.parseExpressionStatement();return e?t.wrapInRootBeat(v):v}break;case 26:let T=this.parseInsertion();return e?t.wrapInRootBeat(T):T;case 18:case 27:case 39:case 45:case 47:case 49:let O=this.parseExpressionStatement();return e?t.wrapInRootBeat(O):O;case 40:let E=this.parseTransition();return e?t.wrapInRootBeat(E):E;default:return this.addError(new Ne("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null)}}wrapInRootBeat(e){let t,l=null;if(this.rootBeat==null){let i=this.currentPos();t=[],this.rootBeat=new Me(this.nextNodeId(1),i,"_",t),l=this.rootBeat}else t=this.rootBeat.body;return t.push(e),l}parseImport(){let e=this.currentPos();if(this.expect(k.KwImport),this.context==null)throw C.thrown(new Ne("Cannot import without a context",this.currentPos()));let t=0,l=this.tokens[this.current],i,n=l.type;if(n._hx_index==15){let _=n.attachments,m=n.quotes,f=n.s;t=m,i=f}else throw C.thrown(new Ne("Expected string literal for import path",this.currentPos()));let s=i;De.isAbsolute(s)||(s=De.join([De.directory(this.context.path),s])),s=De.normalize(s);let r,a;if(s==null)a=!1;else{let _=s.length;if(_<8)a=!1;else{let m,f,g,d,w,y,S=c.cca(s,_-8);if((S??-1)==46){let T=c.cca(s,_-7),O=T??-1;y=O==108||O==76}else y=!1;if(y){let T=c.cca(s,_-6),O=T??-1;w=O==111||O==79}else w=!1;if(w){let T=c.cca(s,_-5),O=T??-1;d=O==114||O==82}else d=!1;if(d){let T=c.cca(s,_-4);g=(T??-1)==46}else g=!1;if(g){let T=c.cca(s,_-3),O=T??-1;f=O==116||O==84}else f=!1;if(f){let T=c.cca(s,_-2),O=T??-1;m=O==120||O==88}else m=!1;if(m){let T=c.cca(s,_-1),O=T??-1;a=O==116||O==84}else a=!1}}if(a)r=!0;else if(s==null)r=!1;else{let _=s.length;if(_<4)r=!1;else{let m,f,g=c.cca(s,_-4);if((g??-1)==46){let d=c.cca(s,_-3),w=d??-1;f=w==108||w==76}else f=!1;if(f){let d=c.cca(s,_-2),w=d??-1;m=w==111||w==79}else m=!1;if(m){let d=c.cca(s,_-1),w=d??-1;r=w==114||w==82}else r=!1}}if(!r){let _=this.context.rootPath,m;if(_==null)m=!1;else{let f=_.length;if(f<8)m=!1;else{let g,d,w,y,S,T,O=c.cca(_,f-8);if((O??-1)==46){let E=c.cca(_,f-7),v=E??-1;T=v==108||v==76}else T=!1;if(T){let E=c.cca(_,f-6),v=E??-1;S=v==111||v==79}else S=!1;if(S){let E=c.cca(_,f-5),v=E??-1;y=v==114||v==82}else y=!1;if(y){let E=c.cca(_,f-4);w=(E??-1)==46}else w=!1;if(w){let E=c.cca(_,f-3),v=E??-1;d=v==116||v==84}else d=!1;if(d){let E=c.cca(_,f-2),v=E??-1;g=v==120||v==88}else g=!1;if(g){let E=c.cca(_,f-1),v=E??-1;m=v==116||v==84}else m=!1}}s+=m?".lor.txt":".lor"}if(Object.prototype.hasOwnProperty.call(this.context.imported.h,s)){this.advance();let _=new Rt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,null);return _.path=new Mt(this.nextNodeId(4),l.pos,t,[new Ge(this.nextNodeId(4),l.pos,ze.Raw(i))]),this.attachComments(_)}let h=this.context.imports.h[s];if(h==null)throw C.thrown(new Ne("Failed to import file at path "+s+" ("+i+")",this.currentPos()));this.context.imported.h[s]=!0;let o=new Gl(h,new Fi(this.context.rootPath,s,this.context.imports,this.context.imported));o.currentNodeId=this.currentNodeId;let u=o.parse();this.currentNodeId=o.currentNodeId,this.advance();let p=new Rt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,u);return p.path=new Mt(this.nextNodeId(4),l.pos,t,[new Ge(this.nextNodeId(4),l.pos,ze.Raw(i))]),this.attachComments(p)}parseDialogueStatement(){let e=this.currentPos(),t=new Kt(this.nextNodeId(4),e,null,null,null),l=this.tokens[this.current].type,i;if(l._hx_index==19)i=l.name;else throw C.thrown(new Ne("Expected character name",this.currentPos()));t.character=i,t.characterPos=this.tokens[this.current].pos,this.advance(),this.expect(k.Colon),this.attachComments(t);let n=!1;if(this.checkBlockStart()){let s=this.parseBlockStart();if(s.type!=k.Indent)throw C.thrown(new Ne("Expected indent, got "+Nt.toCodeString(s.type),s.pos));n=!0}try{t.content=this.parseStringLiteral()}catch(s){let r=C.caught(s).unwrap();if(r instanceof Ne){let a=r;this.addError(a),t.content=new Mt(this.nextNodeId(4),this.currentPos(),0,[new Ge(this.nextNodeId(4),this.currentPos(),ze.Raw("?"))])}else throw s}if(!this.lineBreakAfterToken&&this.match(k.KwIf)){let s=this.previous().pos;this.check(k.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression(),t.conditionPos=s.extendedTo(this.prevNonWhitespaceOrComment().pos)}if(n){for(;this.match(k.LineBreak););this.expect(k.Unindent)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseStatementBlock(e){let t=this.parseBlockStart().type==k.Indent?k.Unindent:k.RBrace;for(;!this.check(t)&&!this.isAtEnd();){for(;this.match(k.LineBreak)||t!=k.Unindent&&this.match(k.Unindent););if(this.check(t))break;try{e.push(this.parseNode())}catch(l){let i=C.caught(l).unwrap();if(i instanceof Ne){let n=i;if(this.errors==null&&(this.errors=[]),this.errors.push(n),this.synchronize(),this.check(t))break}else throw l}for(;this.match(k.LineBreak)||t!=k.Unindent&&this.match(k.Unindent););}return this.expect(t),t==k.RBrace?1:0}parseStateDecl(e){let t=this.currentPos(),l=new $t(this.nextNodeId(3),t,e,[]);this.expect(k.KwState);let i=this.parseBlockStart().type==k.Indent?k.Unindent:k.RBrace;for(l.style=i==k.RBrace?1:0,this.attachComments(l);!this.check(i)&&!this.isAtEnd();){for(;this.match(k.LineBreak)||i!=k.Unindent&&this.match(k.Unindent););for(l.fields.push(this.parseObjectField());this.match(k.LineBreak)||i!=k.Unindent&&this.match(k.Unindent););}for(;this.match(k.LineBreak)||i!=k.Unindent&&this.match(k.Unindent););return this.expect(i),l.pos=l.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l}parseObjectField(){let e=this.currentPos(),t=this.expectIdentifier(),l=new Ul(this.nextNodeId(3),e,t,null);return this.expect(k.Colon),this.attachComments(l),this.checkBlockStart()?l.value=this.parseObjectLiteral():l.value=this.parseExpression(),l.pos=l.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l}parseBeatDecl(){let e=this.currentPos(),t=new Me(this.nextNodeId(1),e,null,[],[]);this.expect(k.KwBeat),t.pos=e.extendedTo(this.currentPos()),t.name=this.expectIdentifier();let i=this.parseBlockStart().type==k.Indent?k.Unindent:k.RBrace;for(t.style=i==k.RBrace?1:0,this.attachComments(t);!this.check(i)&&!this.isAtEnd();){for(;this.match(k.LineBreak)||i!=k.Unindent&&this.match(k.Unindent););for(t.body.push(this.parseNode());this.match(k.LineBreak)||i!=k.Unindent&&this.match(k.Unindent););}for(;this.match(k.LineBreak)||i!=k.Unindent&&this.match(k.Unindent););return this.expect(i),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}checkBlockStart(){let e=null,t=null,l=0,i=0;for(;this.current+i<this.tokens.length;){let n=this.tokens[this.current+i];if(++i,n.type!=k.LineBreak){if(n.type==k.Indent){++l,e=n;continue}if(n.type==k.LBrace){t==null&&(t=n);continue}break}}if(t!=null)return!0;if(e!=null){if(l>1)throw C.thrown(new Ne("Invalid indentation level",e.pos));return!0}else return!1}parseBlockStart(){let e=null,t=null,l=0;for(;!this.isAtEnd();)if(!this.match(k.LineBreak)){if(this.match(k.Indent)){++l,e=this.prevWithType(k.Indent);continue}if(this.match(k.LBrace)){t==null&&(t=this.prevWithType(k.LBrace));continue}break}if(t!=null)return t;if(e!=null){if(l>1)throw C.thrown(new Ne("Invalid indentation level",e.pos));return e}else return this.addError(new Ne("Expected "+Nt.toCodeString(k.LBrace)+" or "+Nt.toCodeString(k.Indent)+", got "+this.currentTokenTypeToString(),this.currentPos())),new ye(k.Indent,this.currentPos())}parseCharacterDecl(){let e=this.currentPos(),t=new jt(this.nextNodeId(3),e,null,null,[]);this.expect(k.KwCharacter),t.name=this.expectIdentifier(),t.namePos=this.prevNonWhitespaceOrComment().pos;let l=this.parseBlockStart().type==k.Indent?k.Unindent:k.RBrace;for(t.style=l==k.RBrace?1:0,this.attachComments(t);!this.check(l)&&!this.isAtEnd();){for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););for(t.fields.push(this.parseObjectField());this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););}for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););return this.expect(l),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseTextStatement(){let e=this.currentPos(),t=this.attachComments(new ll(this.nextNodeId(4),e,null));if(t.content=this.parseStringLiteral(),!this.lineBreakAfterToken&&this.match(k.KwIf)){let l=this.previous().pos;this.check(k.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression(),t.conditionPos=l.extendedTo(this.prevNonWhitespaceOrComment().pos)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseChoiceStatement(){let e=this.currentPos(),t=new xl(this.nextNodeId(2),e,[]);this.expect(k.KwChoice);let l=this.parseBlockStart().type==k.Indent?k.Unindent:k.RBrace;for(t.style=l==k.RBrace?1:0,this.attachComments(t);!this.check(l)&&!this.isAtEnd();){for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););for(t.options.push(this.parseChoiceOption(l));this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););}return this.expect(l),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseChoiceOption(e){let t=this.currentPos(),l=this.attachComments(new St(this.nextNodeId(3),t,null,null,null,0,[])),i=null,n=!1;try{this.check(k.OpPlus)?(n=!0,l.insertion=this.parseInsertion()):(this.match(k.OpMinus)&&(l.once=!0),l.text=this.parseStringLiteral())}catch(s){let r=C.caught(s).unwrap();if(r instanceof Ne){let a=r;this.addError(a),i=this.currentPos(),this.currentPos().offset==t.offset&&this.advance(),l.text=new Mt(this.nextNodeId(4),this.currentPos(),0,[new Ge(this.nextNodeId(4),this.currentPos(),ze.Raw("?"))])}else throw s}if(this.match(k.KwIf)){let s=this.previous().pos,r=this.currentPos().offset;try{this.check(k.LParen)&&(l.conditionStyle=2),l.condition=this.parseConditionExpression(),l.conditionPos=s.extendedTo(this.prevNonWhitespaceOrComment().pos)}catch(a){let h=C.caught(a).unwrap();if(h instanceof Ne){let o=h;this.addError(o),i=this.currentPos(),this.currentPos().offset==r&&this.advance()}else throw a}}if(!n){if(this.checkBlockStart()){l.body=[];let s=this.currentPos().offset;try{l.style=this.parseStatementBlock(l.body)}catch(r){let a=C.caught(r).unwrap();if(a instanceof Ne){let h=a;this.addError(h),i=this.currentPos(),this.currentPos().offset==s&&this.advance(),l.body.length==0&&(l.body=[new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null)])}else throw r}}else if(this.check(k.Arrow)){let s=this.currentPos().offset;try{l.body=[],l.body.push(this.parseNode())}catch(r){let a=C.caught(r).unwrap();if(a instanceof Ne){let h=a;this.addError(h),i=this.currentPos(),this.currentPos().offset==s&&this.advance(),l.body.length==0&&(l.body=[new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null)])}else throw r}l.style=0}}if(l.pos=l.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),i!=null)for(;!this.isAtEnd()&&this.currentPos().line<=i.line+1;)this.advance();return l}isExpressionStart(){let e=this.tokens[this.current].type;switch(e._hx_index){case 15:let t=e.quotes,l=e.s,i=e.attachments;return!0;case 16:let n=e.n;return!0;case 17:let s=e.b;return!0;case 19:let r=e.name;return this.peek().type!=k.Colon;case 18:case 27:case 39:case 45:case 47:case 49:return!0;default:return!1}}parseExpressionStatement(){let e=this.parseExpression();if(this.match(k.OpAssign)||this.match(k.OpPlusAssign)||this.match(k.OpMinusAssign)||this.match(k.OpMultiplyAssign)||this.match(k.OpDivideAssign)||this.match(k.OpUnquotedAssign)){let t=this.previous().type,l=this.attachComments(new kl(this.nextNodeId(4),e.pos,e,t,null));return l.value=this.parseExpression(),l.pos=l.pos.extendedTo(l.value.pos),l}return this.attachComments(e)}isKnownNodeStart(){let e=this.tokens[this.current].type;switch(e._hx_index){case 15:let t=e.quotes,l=e.s,i=e.attachments;return!0;case 19:let n=e.name;return this.peek().type==k.Colon?!0:this.peek().type==k.Arrow;case 1:case 2:case 3:case 4:case 5:case 40:return!0;default:return!1}}parseIfStatement(){let e=this.currentPos(),t=new wl(this.nextNodeId(4),e,null,0,null,null);for(this.expect(k.KwIf),this.check(k.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression();this.match(k.LineBreak););this.attachComments(t),t.thenBranch=new hl(this.nextNodeId(3),this.currentPos(),null),t.thenBranch.body=[],t.thenBranch.style=this.parseStatementBlock(t.thenBranch.body);let l=this.tokens[this.current];if(l!=null&&l.type==k.KwElse){for(this.advance();this.match(k.LineBreak););if(this.attachElseComments(t,l),this.check(k.KwIf)){t.elseBranch=new hl(this.nextNodeId(3),this.currentPos(),null);let i=this.parseIfStatement();t.elseBranch.body=[i],t.elseBranch.style=0}else t.elseBranch=new hl(this.nextNodeId(3),this.currentPos(),null),t.elseBranch.body=[],t.elseBranch.style=this.parseStatementBlock(t.elseBranch.body)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseAlternative(){let e=this.currentPos(),t;switch(this.tokens[this.current].type._hx_index){case 8:t=0;break;case 9:t=1;break;case 10:t=2;break;case 11:t=3;break;case 12:t=4;break;default:throw C.thrown(new Ne("Expected alternative keyword",this.currentPos()))}let l=new Hl(this.nextNodeId(2),e,t,[]);for(this.advance();this.match(k.LineBreak););this.attachComments(l);let i=new hl(this.nextNodeId(3),this.currentPos(),null);for(i.body=[],i.style=this.parseStatementBlock(i.body),l.items.push(i),l.style=i.style;this.check(k.Separator);){let n=this.tokens[this.current];for(this.advance();this.match(k.LineBreak););if(this.pendingComments!=null&&this.pendingComments.length>0){l.separatorComments==null&&(l.separatorComments=[]);let r=[],a=[],h=0,o=this.pendingComments;for(;h<o.length;){let u=o[h];++h,u.pos.line<=n.pos.line?r.push(u):a.push(u)}l.separatorComments.push(r),this.pendingComments=a}let s=new hl(this.nextNodeId(3),this.currentPos(),null);s.body=[],s.style=this.parseStatementBlock(s.body),l.items.push(s)}return l.pos=l.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l}parseTransition(){let e=this.currentPos();if(this.expect(k.Arrow),this.match(k.Dot))return this.attachComments(new Dl(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),".",this.prevNonWhitespaceOrComment().pos));let t=this.expectIdentifier();return this.attachComments(new Dl(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),t,this.prevNonWhitespaceOrComment().pos))}parseInsertion(){let e=this.currentPos();this.expect(k.OpPlus);let t=this.expectIdentifier();return this.attachComments(new $l(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),t,this.prevNonWhitespaceOrComment().pos))}parseFunction(){let e=this.currentPos(),t=this.tokens[this.current].type;if(t._hx_index==14){let l=t.name,i=t.args,n=t.code,s=t.external;return this.advance(),this.attachComments(new ql(this.nextNodeId(3),e,l,[].concat(i),n,s))}else throw C.thrown(new Ne("Unexpected token in expression",this.currentPos()))}parseExpression(){try{let e=this.parseTernary();if(this.check(k.OpAssign)||this.check(k.OpPlusAssign)||this.check(k.OpMinusAssign)||this.check(k.OpMultiplyAssign)||this.check(k.OpDivideAssign)||this.check(k.OpUnquotedAssign)){let t=this.tokens[this.current].type;this.advance();let l=this.attachComments(new kl(this.nextNodeId(4),e.pos,e,t,null));return l.value=this.parseExpression(),l.pos=l.pos.extendedTo(l.value.pos),l}return e}catch(e){let t=C.caught(e).unwrap();return t instanceof Ne&&this.addError(t),new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null)}}parseTernary(){let e=this.parseLogicalOr();if(this.match(k.Question)){let t=this.parseTernary();this.expect(k.Colon);let l=this.parseTernary();e=this.attachComments(new ii(this.nextNodeId(4),e.pos,e,t,l)),e.pos=e.pos.extendedTo(l.pos)}return e}parseLogicalOr(){let e=this.parseLogicalAnd();for(;this.match(k.OpOr(!1));){let t=this.previous().type,l=this.attachComments(new il(this.nextNodeId(4),e.pos,e,t,null));l.right=this.parseLogicalAnd(),l.pos=l.pos.extendedTo(l.right.pos),e=l}return e}parseLogicalAnd(){let e=this.parseEquality();for(;this.match(k.OpAnd(!1));){let t=this.previous().type,l=this.attachComments(new il(this.nextNodeId(4),e.pos,e,t,null));l.right=this.parseEquality(),l.pos=l.pos.extendedTo(l.right.pos),e=l}return e}parseEquality(){let e=this.parseComparison();for(;this.match(k.OpEquals)||this.match(k.OpNotEquals);){let t=this.previous().type,l=this.attachComments(new il(this.nextNodeId(4),e.pos,e,t,null));l.right=this.parseComparison(),l.pos=l.pos.extendedTo(l.right.pos),e=l}return e}parseComparison(){let e=this.parseAdditive();for(;this.match(k.OpGreater)||this.match(k.OpGreaterEq)||this.match(k.OpLess)||this.match(k.OpLessEq);){let t=this.previous().type,l=this.attachComments(new il(this.nextNodeId(4),e.pos,e,t,null));l.right=this.parseAdditive(),l.pos=l.pos.extendedTo(l.right.pos),e=l}return e}parseAdditive(){let e=this.parseMultiplicative();for(;this.match(k.OpPlus)||this.match(k.OpMinus);){let t=this.previous().type,l=this.attachComments(new il(this.nextNodeId(4),e.pos,e,t,null));l.right=this.parseMultiplicative(),l.pos=l.pos.extendedTo(l.right.pos),e=l}return e}parseMultiplicative(){let e=this.parseUnary();for(;this.match(k.OpMultiply)||this.match(k.OpDivide)||this.match(k.OpModulo);){let t=this.previous().type,l=this.attachComments(new il(this.nextNodeId(4),e.pos,e,t,null));l.right=this.parseUnary(),l.pos=l.pos.extendedTo(l.right.pos),e=l}return e}parseUnary(){if(this.match(k.OpNot)||this.match(k.OpMinus)){let e=this.previous().type,t=this.attachComments(new Yl(this.nextNodeId(4),this.previous().pos,e,null));return t.operand=this.parseUnary(),t.pos=t.pos.extendedTo(t.operand.pos),t}return this.parsePrimary()}parsePrimary(){let e=this.currentPos(),t=this.tokens[this.current].type;switch(t._hx_index){case 15:let l=t.quotes,i=t.s,n=t.attachments;return this.parsePostfix(e,this.parseStringLiteral());case 16:let s=t.n;return this.advance(),this.attachComments(new je(this.nextNodeId(4),e,s,Ke.Number));case 17:let r=t.b;return this.advance(),this.attachComments(new je(this.nextNodeId(4),e,r,Ke.Boolean));case 18:return this.advance(),this.attachComments(new je(this.nextNodeId(4),e,null,Ke.Null));case 19:let a=t.name;if(this.peek().type==k.Colon){let o=[this.parseObjectField()];return new je(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),o,Ke.Object(0))}else return this.advance(),this.parseIdentifierExpression(e,a);break;case 45:return this.parsePostfix(e,this.parseObjectLiteral());case 47:this.advance();let h=this.parseExpression();return this.expect(k.RParen),this.parsePostfix(e,h);case 49:return this.parsePostfix(e,this.parseArrayLiteral());default:throw C.thrown(new Ne("Unexpected token in expression",this.currentPos()))}}parseStringLiteral(){let e=this.currentPos(),t=[],l=this.tokens[this.current].type;if(l._hx_index==15){let i=l.quotes,n=l.s,s=l.attachments,r=i!=0?e.withOffset(n,1,e.length-2):e,a=0;if(s==null||s.length==0){let p=this.makeStringPartPosition(r,n,0);p.length=r.length;let _=this.nextNodeId(4),m=this.nextNodeId(4);return t.push(new Ge(m,p,ze.Raw(n))),this.advance(),this.attachComments(new Mt(_,e,i,t))}let h=this.attachComments(new Mt(this.nextNodeId(4),e,i,t)),o=0,u=s.length;for(;o<u;){let p=o++,_=s[p];switch(_._hx_index){case 0:let m=_.braces,f=_.inTag,g=_.expr,d=_.start,w=_.length;if(a>=d+w)continue;if(d>a){let O=this.makeStringPartPosition(r,n,a);O.length=d-a;let E=d-a;t.push(new Ge(this.nextNodeId(4),O,ze.Raw(E!=null?c.substr(n,a,E):c.substr(n,a,null))))}t.push(this.parseStringInterpolation(m,f,g,d,w,n)),a=d+w;break;case 1:let y=_.closing,S=_.start,T=_.length;if(a>=S+T)continue;if(S>a){let O=this.makeStringPartPosition(r,n,a);O.length=S-a;let E=S-a;t.push(new Ge(this.nextNodeId(4),O,ze.Raw(E!=null?c.substr(n,a,E):c.substr(n,a,null))))}t.push(this.parseStringTag(y,S,T,n,i,s)),a=S+T;break}}if(a<n.length){let p=this.makeStringPartPosition(r,n,a);p.length=n.length-a;let _=null;t.push(new Ge(this.nextNodeId(4),p,ze.Raw(_!=null?c.substr(n,a,_):c.substr(n,a,null))))}if(this.advance(),this.pendingComments!=null){let p=null,_=0,m=this.pendingComments;for(;_<m.length;){let f=m[_];++_,f.pos.line==e.line?(h.trailingComments==null&&(h.trailingComments=[]),h.trailingComments.push(f)):(p==null&&(p=[]),p.push(f))}this.pendingComments=p}return h}else throw C.thrown(new Ne("Expected text, got "+this.currentTokenTypeToString(),this.currentPos()))}makeStringPartPosition(e,t,l){let i=e.line,n=e.column,s=0,r=l;for(;s<r;){let a=s++,h=c.cca(t,a);(h??-1)==10?(++i,n=1):++n}return new ue(i,n,e.offset+l)}makeAccess(e,t,l,i){if(l!=null){if(l.length==0&&(this.errors==null||this.errors.length==0)&&this.addError(new Ne("Invalid access: "+(l!=null?"'"+l+"'":"null"),e)),t!=null)if(i!=null)e=new ue(t.pos.line,t.pos.column,t.pos.offset,i.offset+l.length-t.pos.offset);else throw C.thrown(new Ne("Invalid access (missing name position)",e));else if(e.length==0){let n=i!=null?i.length:null;e=new ue(e.line,e.column,e.offset,n??l.length)}}return new ft(this.nextNodeId(4),e,t,l)}parseStringInterpolation(e,t,l,i,n,s){let r=l[0],a=r!=null?r.pos:null,h=this.makeStringPartPosition(a??this.currentPos(),s,i);if(h.length=n,l.length==0){let p=l[0],_=p!=null?p.pos:null;this.addError(new Ne("Empty interpolation",_??this.currentPos()));let m=this.nextNodeId(4),f=this.nextNodeId(4),g=l[0],d=g!=null?g.pos:null;return new Ge(m,h,ze.Expr(new je(f,d??this.currentPos(),null,Ke.Null)))}let o=null;if(!e&&l.length>0){let p=null,_=0,m=!1;for(;_<l.length;){let f=l[_];++_;let g=f.type;switch(g._hx_index){case 19:let d=g.name;if(p==null)p=this.attachComments(this.makeAccess(f.pos,null,d,null));else if(m)p=this.attachComments(this.makeAccess(f.pos,p,d,f.pos));else{this.addError(new Ne("Missing dot in field access",f.pos));let U=this.nextNodeId(4),W=this.nextNodeId(4),J=l[0],H=J!=null?J.pos:null;return new Ge(U,h,ze.Expr(new je(W,H??this.currentPos(),null,Ke.Null)))}m=!1;break;case 44:if(p==null){this.addError(new Ne("Leading dot in field access",f.pos));let U=this.nextNodeId(4),W=this.nextNodeId(4),J=l[0],H=J!=null?J.pos:null;return new Ge(U,h,ze.Expr(new je(W,H??this.currentPos(),null,Ke.Null)))}m=!0;break;case 47:if(p==null){this.addError(new Ne("Function call without target",f.pos));let U=this.nextNodeId(4),W=this.nextNodeId(4),J=l[0],H=J!=null?J.pos:null;return new Ge(U,h,ze.Expr(new je(W,H??this.currentPos(),null,Ke.Null)))}let w=f.pos,y=[],S=[],T=1;for(;_<l.length&&T>0;){let U=l[_];switch(++_,U.type._hx_index){case 43:T==1?S.length>0&&(y.push(S),S=[]):S.push(U);break;case 47:++T,S.push(U);break;case 48:--T,T>0?S.push(U):S.length>0&&y.push(S);break;default:S.push(U)}}if(T>0){this.addError(new Ne("Unterminated function call",w));let U=this.nextNodeId(4),W=this.nextNodeId(4),J=l[0],H=J!=null?J.pos:null;return new Ge(U,h,ze.Expr(new je(W,H??this.currentPos(),null,Ke.Null)))}let O=[],E=0;for(;E<y.length;){let U=y[E];++E;let W=new Gl(U);W.currentNodeId=this.currentNodeId;let J=W.parseExpression();O.push(J),this.currentNodeId=W.currentNodeId}p=this.attachComments(new Jt(this.nextNodeId(4),w.extendedTo(l[_-1].pos),p,O)),m=!1;break;case 49:if(p==null){this.addError(new Ne("Array access without target",f.pos));let U=this.nextNodeId(4),W=this.nextNodeId(4),J=l[0],H=J!=null?J.pos:null;return new Ge(U,h,ze.Expr(new je(W,H??this.currentPos(),null,Ke.Null)))}let v=f.pos,M=[],A=1,L=null;for(;_<l.length&&A>0;){let U=l[_];switch(++_,U.type._hx_index){case 49:++A,M.push(U);break;case 50:--A,A>0&&M.push(U),L=U;break;default:M.push(U)}}if(A>0){this.addError(new Ne("Unterminated array access",v));let U=this.nextNodeId(4),W=this.nextNodeId(4),J=l[0],H=J!=null?J.pos:null;return new Ge(U,h,ze.Expr(new je(W,H??this.currentPos(),null,Ke.Null)))}let I=new Gl(M);I.currentNodeId=this.currentNodeId;let q=I.parseExpression();this.currentNodeId=I.currentNodeId;let z=h.extendedTo(l[_-1].pos);z.length+=1,p=this.attachComments(new gl(this.nextNodeId(4),z,p,q)),m=!1;break;default:this.addError(new Ne("Unexpected token in field access: "+Nt.toCodeString(f.type),f.pos));let P=this.nextNodeId(4),B=this.nextNodeId(4),N=l[0],D=N!=null?N.pos:null;return new Ge(P,h,ze.Expr(new je(B,D??this.currentPos(),null,Ke.Null)))}}m&&this.addError(new Ne("Trailing dot in field access",l[l.length-1].pos)),o=p}else{let p=new Gl(l);p.currentNodeId=this.currentNodeId,o=p.parseExpression(),this.currentNodeId=p.currentNodeId,p.isAtEnd()||this.addError(new Ne("Unexpected tokens after interpolation expression",p.tokens[p.current].pos))}let u=new ue(h.line,h.column+(e?1:0),h.offset-(e?2:0),n);return new Ge(this.nextNodeId(4),u,ze.Expr(o))}parseStringTag(e,t,l,i,n,s){let r=this.currentPos();n!=0&&(r=r.withOffset(i,1,r.length-2));let a=this.makeStringPartPosition(r,i,t);a.length=l;let h=e?2:1,o=t+h,u=l-(e?3:2),p=o+u,_=this.nextNodeId(4),m=!1;if(s!=null){let w=0,y=s.length;e:for(;w<y;){let S=w++,T=s[S];switch(T._hx_index){case 0:let O=T.braces,E=T.inTag,v=T.expr,M=T.start,A=T.length,L=M+A;if(M>=o&&L<=p){m=!0;break e}break;case 1:let I=T.closing,q=T.start,z=T.length;continue}}}if(!m){let w=this.makeStringPartPosition(r,i,o);w.length=u;let y=this.nextNodeId(4),S=this.nextNodeId(4);return new Ge(_,a,ze.Tag(e,this.attachComments(new Mt(y,w,0,[new Ge(S,w,ze.Raw(u!=null?c.substr(i,o,u):c.substr(i,o,null)))]))))}let f=[],g=this.attachComments(new Mt(this.nextNodeId(4),a,0,f)),d=o;if(s!=null){let w=0,y=s.length;for(;w<y;){let S=w++,T=s[S];switch(T._hx_index){case 0:let O=T.inTag,E=T.braces,v=T.expr,M=T.start,A=T.length,L=M+A;if(M>=o&&L<=p){if(M>d){let B=this.makeStringPartPosition(r,i,o);B.length=M-o;let N=M-d;f.push(new Ge(this.nextNodeId(4),B,ze.Raw(N!=null?c.substr(i,d,N):c.substr(i,d,null))))}let P=this.parseStringInterpolation(E,!0,v,M,A,i);P.pos=this.makeStringPartPosition(r,i,M),P.pos.length=A,f.push(P),d=L}break;case 1:let I=T.closing,q=T.start,z=T.length;continue}}}if(d<p){let w=null,y=this.makeStringPartPosition(a,w!=null?c.substr(i,t,w):c.substr(i,t,null),d-t+h);y.length=o+p-d;let S=p-d;f.push(new Ge(this.nextNodeId(4),y,ze.Raw(S!=null?c.substr(i,d,S):c.substr(i,d,null))))}return new Ge(_,a,ze.Tag(e,g))}parseIdentifierExpression(e,t){let l=this.attachComments(this.makeAccess(e,null,t,null));return this.parsePostfix(e,l)}parsePostfix(e,t){for(;;)if(this.match(k.Dot,!1)){let l=null,i=this.currentPos();this.checkIdentifier()?l=this.expectIdentifier():(this.addError(new Ne("Expected identifier after '.'",this.currentPos())),l=""),t=this.attachComments(this.makeAccess(e,t,l,i))}else if(this.match(k.LBracket)){let l=this.parseExpression();this.expect(k.RBracket);let i=e.extendedTo(this.previous().pos);t=this.attachComments(new gl(this.nextNodeId(4),i,t,l))}else if(this.match(k.LParen)){let l=this.parseCallArguments();t=this.attachComments(new Jt(this.nextNodeId(4),e.extendedTo(this.previous().pos),t,l))}else break;return t}parseArrayLiteral(){let e=this.currentPos(),t=[],l=new je(this.nextNodeId(4),e,t,Ke.Array);this.expect(k.LBracket),this.attachComments(l);let i=!1;for(;!this.check(k.RBracket)&&!this.isAtEnd();){if(i){for(;this.match(k.LineBreak);)i=!1;this.match(k.Comma)&&(i=!1)}for(;this.match(k.LineBreak)||this.match(k.Indent)||this.match(k.Unindent);)i=!1;if(!this.check(k.RBracket)&&i)throw C.thrown(new Ne("Expected comma or line break between elements",this.currentPos()));for(;this.match(k.LineBreak)||this.match(k.Indent)||this.match(k.Unindent););this.check(k.RBracket)||t.push(this.parseExpression());let n=this.previous();i=n.type!=k.Colon&&n.type!=k.LineBreak&&n.type!=k.Unindent}for(;this.match(k.LineBreak)||this.match(k.Indent)||this.match(k.Unindent););return this.expect(k.RBracket),l.pos=l.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l}parseObjectLiteral(){let e=this.currentPos(),t=[],l=this.parseBlockStart().type==k.Indent?k.Unindent:k.RBrace,i=l==k.RBrace?1:0,n=new je(this.nextNodeId(4),l!=k.RBrace?this.nextNonWhitespaceOrComment().pos:e,t,Ke.Object(i));this.attachComments(n);let s=!1;for(;!this.check(l)&&!this.isAtEnd();){if(s){for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent);)s=!1;this.match(k.Comma)&&(s=!1)}for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent);)s=!1;if(!this.check(l)&&s)throw C.thrown(new Ne("Expected comma or line break between fields",this.currentPos()));for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););this.check(l)||t.push(this.parseObjectField());let r=this.previous();s=r.type!=k.Colon&&r.type!=k.LineBreak&&r.type!=k.Unindent}for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););return this.expect(l),n.pos=n.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),n}parseCallArguments(){let e=[];if(!this.check(k.RParen))do{for(;this.match(k.LineBreak););for(e.push(this.parseExpression());this.match(k.LineBreak););}while(this.match(k.Comma));return this.expect(k.RParen),e}parseConditionExpression(){let e=this.parsingCondition;this.parsingCondition=!0;let t=this.match(k.LParen),l=null;try{l=this.parseExpression(),l!=null&&te.getClass(l)==kl&&this.addError(new Ne("Invalid condition expression: can't assign a variable here. Did you want to use '==' instead?",l.pos))}catch(i){let n=C.caught(i).unwrap();if(n instanceof Ne){let s=n;this.addError(s),l=new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null)}else throw i}return this.parsingCondition=e,t&&this.expect(k.RParen),l}match(e,t){return t==null&&(t=!0),this.check(e)?(this.advance(t),!0):!1}isAtLineBreak(){return this.lineBreakAfterToken?!0:this.tokens[this.current].type==k.LineBreak}expect(e){if(this.check(e))return this.advance();{let t=new Ne("Expected "+Nt.toCodeString(e)+", got "+(this.isAtEnd()?"end of file":this.currentTokenTypeToString()),this.tokens[Math.min(this.current,this.tokens.length-1)|0].pos);switch(e._hx_index){case 46:case 48:case 55:return this.addError(t),new ye(e,this.currentPos());default:}throw C.thrown(t)}}checkIdentifier(){let e=this.tokens[this.current].type;if(e._hx_index==19){let t=e.name;return!0}else return!1}expectIdentifier(){let e=this.tokens[this.current].type;if(e._hx_index==19){let t=e.name;return this.advance(),t}else throw C.thrown(new Ne("Expected identifier, got "+this.currentTokenTypeToString(),this.currentPos()))}attachComments(e){if(this.pendingComments==null||this.pendingComments.length==0)return e;let t=e.pos,l=null,i=0,n=this.pendingComments.length;for(;i<n;){let s=i++,r=this.pendingComments[s];r.pos.line<t.line?(e.leadingComments==null&&(e.leadingComments=[]),e.leadingComments.push(r)):r.pos.line==t.line||this.isAtEnd()?(e.trailingComments==null&&(e.trailingComments=[]),e.trailingComments.push(r)):(l==null&&(l=[]),l.push(r))}return this.pendingComments=l,e}attachElseComments(e,t){if(this.pendingComments!=null){let l=t.pos,i=[],n=0,s=this.pendingComments;for(;n<s.length;){let r=s[n];++n,r.pos.line<l.line?(e.elseLeadingComments==null&&(e.elseLeadingComments=[]),e.elseLeadingComments.push(r)):r.pos.line==l.line?(e.elseTrailingComments==null&&(e.elseTrailingComments=[]),e.elseTrailingComments.push(r)):i.push(r)}this.pendingComments=i}return e}synchronize(){for(this.advance();!this.isAtEnd();){let e=this.tokens[this.current].type;switch(e._hx_index){case 15:let t=e.quotes,l=e.s,i=e.attachments;if(this.previous().type==k.RBrace)return;this.advance();break;case 40:this.advance(),(this.check(k.Dot)||Nt.isIdentifier(this.tokens[this.current].type))&&this.advance();return;case 1:case 2:case 3:case 4:case 5:case 46:case 54:return;default:this.advance()}}}requiresNewLine(){switch(this.tokens[this.current].type._hx_index){case 6:case 40:case 46:return!1;default:return!0}}addError(e){return this.errors==null&&(this.errors=[]),this.errors.includes(e)||this.errors.push(e),e}}Q["loreline.Parser"]=Gl,Gl.__name__="loreline.Parser",Object.assign(Gl.prototype,{__class__:Gl});class ue{constructor(e,t,l,i){i==null&&(i=0),this.line=e,this.column=t,this.offset=l,this.length=i}toString(){return"("+this.line+":"+this.column+":"+this.offset+":"+this.length+")"}toJson(){let e={line:this.line,column:this.column,offset:this.offset};return this.length!=0&&(e.length=this.length),e}withOffset(e,t,l,i){if(i==null&&(i=0),l==null&&(l=0),t==0)return new ue(this.line,this.column,this.offset,l);let n=this.line,s=this.column,r=this.offset;if(t>0){let a=0;for(;a<t;){let h;if(r<i+e.length){let o=c.cca(e,r-i);h=(o??-1)==10}else h=!1;h?(++n,s=1):++s,++a,++r}}else{let a=0;for(;a>t;){--r;let h;if(r>=0){let o=c.cca(e,r-i);h=(o??-1)==10}else h=!1;if(h){--n;let o=1,u=r-1;for(;u>=0;){let p=c.cca(e,u-i);if((p??-1)==10)break;++o,--u}s=o}else--s;--a}}return r<0&&(r=0,n=1,s=1),new ue(n,s,r,l)}extendedTo(e){return new ue(this.line,this.column,this.offset,e.offset+e.length-this.offset)}static fromContentAndIndex(e,t,l){l==null&&(l=0);let i=1,n=1,s=0,r=e.length;for(t>r&&(t=r),t<0&&(t=0);s<t;){let a=c.cca(e,s);(a??-1)==10?(++i,n=1):++n,++s}return new ue(i,n,t,l)}}Q["loreline.Position"]=ue,ue.__name__="loreline.Position",Object.assign(ue.prototype,{__class__:ue});class Wl{constructor(e,t){t==null&&(t=`
|
|
34
|
+
`),e==null&&(e=" "),this.enableComments=!0,this._indent=e,this._newline=t,this._beginLine=0,this._lastChar=-1,this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new gt}clear(){this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new gt}indent(){this._level++}unindent(){this._level--}write(e){if(e.length>0){this._beginLine>0&&(this.tab(),this._beginLine=0),this._buf.b+=e==null?"null":""+e;let t=c.cca(e,e.length-1);this._lastChar=t??-1;let l=e.length-1;for(;l>=0;){let i=c.cca(e,l),n=i??-1;if(n!=32&&n!=10&&n!=13&&n!=9){this._lastVisibleChar=n;break}--l}}return this}_writeln(e){return e==null&&(e=""),this.write(e),this.newline()}newline(){return this._beginLine<2&&this._noLn==0&&(this._beginLine==1&&this._numEmptyLines++,this._buf.b+=Y.string(this._newline),this._beginLine++),this}tab(){let e=0,t=this._level;for(;e<t;){let l=e++;this._buf.b+=Y.string(this._indent)}return this}_line(e){return this.tab(),this._buf.b+=e==null?"null":""+e,this.newline()}toString(){return this._buf.b}printStringLiteralAsReference(e){let t=this.enableComments;this.enableComments=!1,this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new gt,this._beginLine=1,this.printStringLiteral(e),this.enableComments=t;let l=He.trim(this.toString());return l=l.split(`
|
|
35
|
+
`).join("\\n"),l}printStringLiteralAsText(e){let t=this.enableComments;this.enableComments=!1,this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new gt,this._beginLine=1;let l=0,i=e.parts;for(;l<i.length;){let s=i[l];++l;let r=s.partType;switch(r._hx_index){case 0:let a=r.text;e.quotes==1?this.writeQuotedRaw(a):this.writeUnquotedRaw(a);break;case 1:let h=r.expr,o=this.isSimpleInterpolationExpr(h);this.write("$"),o||this.write("{"),this.printNode(h),o||this.write("}");break;case 2:let u=r.closing,p=r.expr;this.write(u?"</":"<"),this.printStringLiteral(p),this.write(">");break}}this.enableComments=t;let n=He.trim(this.toString());return n=n.split(`
|
|
36
|
+
`).join("\\n"),n}print(e){return this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new gt,this._beginLine=1,this.printNode(e),this.toString()}printNode(e,t){if(t==null&&(t=!1),e!=null)switch(te.getClass(e)){case ft:this.printAccess(e);break;case Hl:this.printAlternative(e);break;case gl:this.printArrayAccess(e);break;case kl:this.printAssignment(e);break;case Me:this.printBeatDecl(e);break;case il:this.printBinary(e);break;case Jt:this.printCall(e);break;case jt:this.printCharacterDecl(e);break;case St:this.printChoiceOption(e);break;case xl:this.printChoiceStatement(e);break;case Kt:this.printDialogueStatement(e);break;case ql:this.printFunctionDecl(e);break;case wl:this.printIfStatement(e);break;case Rt:this.printImportStatement(e);break;case $l:this.printInsertion(e);break;case je:this.printLiteral(e);break;case $t:this.printStateDecl(e);break;case Mt:this.printStringLiteral(e);break;case ii:this.printTernary(e);break;case ll:this.printTextStatement(e);break;case Dl:this.printTransition(e,t);break;case Yl:this.printUnary(e);break;case nl:this.printScript(e);break;default:let l=te.getClass(e);throw C.thrown("Unsupported node type: "+l.__name__)}}printLeadingComments(e){if(this.enableComments&&e.leadingComments!=null){let t=0,l=e.leadingComments;for(;t<l.length;){let i=l[t];++t,i.multiline?(this.write("/*"+i.content+"*/"),this.newline()):i.isHash?(this.write("#"+i.content),this.newline()):(this.write("//"+i.content),this.newline())}}}printHashTrailingComments(e){if(this.enableComments&&e.trailingComments!=null){let t=0,l=e.trailingComments;for(;t<l.length;){let i=l[t];++t,i.isHash&&(this._lastChar!=32&&this._beginLine==0&&this.write(" "),this.write("#"+i.content),this.newline())}}}printTrailingComments(e){if(this.enableComments&&e.trailingComments!=null){let t=0,l=e.trailingComments;for(;t<l.length;){let i=l[t];++t,this._lastChar!=32&&this._beginLine==0&&this.write(" "),i.multiline?this.write("/*"+i.content+"*/ "):i.isHash?(this.write("#"+i.content),this.newline()):(this.write("//"+i.content),this.newline())}}}printImport(e){this.printLeadingComments(e),this.write('import "'+Y.string(e.path)+'"'),this.newline(),this.printTrailingComments(e)}printScript(e){let t=0,l=e.body;for(;t<l.length;){let i=l[t];++t,this._prevLevel=this._level,this.printNode(i)}}printStateDecl(e){this.newline(),this.newline(),this.printLeadingComments(e),e.temporary&&this.write("new "),this.write("state "),this.printTrailingComments(e),e.style==1?(this.write("{"),this.newline()):this.newline(),this._level++;let t=!0,l=0,i=e.fields;for(;l<i.length;){let n=i[l];++l,t||this._beginLine==0&&this.newline(),t=!1,this.printLeadingComments(n),this.write(""+n.name+": "),this.printTrailingComments(n),this.printNode(n.value)}this.newline(),this._level--,e.style==1&&(this.write("}"),this.newline())}printCharacterDecl(e){this.newline(),this.newline(),this.printLeadingComments(e),this.write("character "+e.name+" "),this.printTrailingComments(e),e.style==1?(this.write("{"),this.newline()):this.newline(),this._level++;let t=0,l=e.fields;for(;t<l.length;){let i=l[t];++t,this.printLeadingComments(i),this.write(""+i.name+": "),this.printTrailingComments(i),this.printNode(i.value),this._beginLine==0&&this.newline()}this._level--,e.style==1&&(this.write("}"),this.newline())}printBeatDecl(e){this.newline(),this.newline(),this.printLeadingComments(e),this.write("beat "+e.name+" "),this.printTrailingComments(e),e.style==1&&(this.write("{"),this.newline()),this.newline(),this.newline(),this._level++;let t=0,l=e.body.length;for(;t<l;){let i=t++;this._prevLevel=this._level,this.printNode(e.body[i]),i<e.body.length-1&&this.newline()}this._level--,this._beginLine==0&&this.newline(),this._lastVisibleChar!=125&&this.newline(),e.style==1&&(this.write("}"),this.newline())}printFunctionDecl(e){this.newline(),this.newline(),this.printLeadingComments(e),this.write(e.code),this.printTrailingComments(e)}printTextStatement(e){this._level==this._prevLevel&&this.newline(),this.printLeadingComments(e),this.printNode(e.content),e.condition!=null&&(this.write(" if "),this.printInLineExpression(e.condition,e.conditionStyle==2)),this.printTrailingComments(e)}printDialogueStatement(e){this._level==this._prevLevel&&this.newline(),this.printLeadingComments(e),e.content!=null&&this.hasRealNewlines(e.content)?(this.write(""+e.character+":"),this.printTrailingComments(e),this.newline(),this._level++,this.printNode(e.content),this._level--):(this.write(""+e.character+": "),this.printTrailingComments(e),this.printNode(e.content)),e.condition!=null&&(this.write(" if "),this.printInLineExpression(e.condition,e.conditionStyle==2))}printChoiceStatement(e){if(this.newline(),this.newline(),this.printLeadingComments(e),this.write("choice "),this.printTrailingComments(e),e.style==1?(this.write("{"),this.newline()):this.newline(),this._level++,e.options.length>0){this._noLn++;let t=0,l=e.options;for(;t<l.length;){let i=l[t];++t,this.printNode(i),this.newline()}}this._level--,e.style==1&&(this.write("}"),this.newline())}printImportStatement(e){this.newline(),this.newline(),this.printLeadingComments(e),this.write("import "),this.printStringLiteral(e.path),this.printTrailingComments(e)}printChoiceOption(e){if(this.newline(),this.newline(),this._noLn=0,this.printLeadingComments(e),e.once&&this.write("- "),e.insertion!=null?this.printNode(e.insertion):this.printNode(e.text),this.printTrailingComments(e),e.condition!=null&&(this.write(" if "),this.printInLineExpression(e.condition,e.conditionStyle==2)),e.body.length>0)if(e.condition==null&&e.body.length==1&&e.body[0]instanceof Dl)this._prevLevel=this._level,this.write(" "),this.printNode(e.body[0],!0),this._beginLine==0&&this.newline();else{e.style==1?(this.write(" {"),this.newline()):this.newline(),this._prevLevel=this._level,this._level++;let t=0,l=e.body;for(;t<l.length;){let i=l[t];++t,this.printNode(i),this._beginLine==0&&i!=e.body[e.body.length-1]&&this.newline(),this._prevLevel=this._level}this._level--,this.newline(),e.style==1&&(this.write("}"),this.newline())}else this.newline()}printIfStatement(e,t){t==null&&(t=!1),this._level==this._prevLevel&&this.newline(),this.printLeadingComments(e),this.write("if "),this.printInLineExpression(e.condition,e.conditionStyle==2),this.printTrailingComments(e),e.thenBranch.style==1&&this.write(" {"),this.newline(),this._prevLevel=this._level,this._level++;let l=this._numEmptyLines,i=0,n=e.thenBranch.body;for(;i<n.length;){let s=n[i];++i,this.printNode(s),this.newline(),this._prevLevel=this._level}if(this._level--,e.thenBranch.style==1&&this.write("}"),e.elseBranch!=null)if(e.elseBranch.body.length==1&&e.elseBranch.body[0]instanceof wl){let s=e.elseBranch.body[0];(this._numEmptyLines-l>0||this.needsEmptyLines(s))&&this.newline(),this.write("else "),this.printIfStatement(e.elseBranch.body[0],!0)}else{this._numEmptyLines-l>0&&this.newline(),e.elseBranch.style==1?(this.write("else {"),this.newline()):(this.write("else"),this.newline()),this._prevLevel=this._level,this._level++;let s=0,r=e.elseBranch.body;for(;s<r.length;){let a=r[s];++s,this.printNode(a),this.newline(),this._prevLevel=this._level}this._level--,e.elseBranch.style==1&&(this.write("}"),this.newline())}}printAlternative(e){this._level==this._prevLevel&&this.newline(),this.printLeadingComments(e);let t;switch(e.mode){case 0:t="sequence";break;case 1:t="cycle";break;case 2:t="once";break;case 3:t="pick";break;case 4:t="shuffle";break}this.write(t),this.printTrailingComments(e),e.style==1&&this.write(" {"),this.newline(),this._prevLevel=this._level;let l=0,i=e.items.length;for(;l<i;){let n=l++,s=e.items[n];this._level++;let r=0,a=s.body;for(;r<a.length;){let h=a[r];++r,this.printNode(h),this.newline(),this._prevLevel=this._level}this._level--,e.style==1&&this.write("}"),n<e.items.length-1&&(this.write("--"),this.newline(),e.style==1&&this.write(" {"),this.newline(),this._prevLevel=this._level)}}needsEmptyLines(e){return new Wl(this._indent,`
|
|
44
37
|
`).print(e).indexOf(`
|
|
45
38
|
|
|
46
|
-
`)!=-1}printTransition(e,t){!t&&this._prevLevel==this._level&&this.newline(),this.printLeadingComments(e),this.write("-> "+e.target),this.printTrailingComments(e)}printInsertion(e){this._prevLevel==this._level&&this.newline(),this.printLeadingComments(e),this.write("+ "+e.target),this.printTrailingComments(e)}printStringLiteral(e){let t=e.quotes==1;t&&(this.printLeadingComments(e),this.write('"'));let
|
|
39
|
+
`)!=-1}printTransition(e,t){!t&&this._prevLevel==this._level&&this.newline(),this.printLeadingComments(e),this.write("-> "+e.target),this.printTrailingComments(e)}printInsertion(e){this._prevLevel==this._level&&this.newline(),this.printLeadingComments(e),this.write("+ "+e.target),this.printTrailingComments(e)}printStringLiteral(e){let t=e.quotes==1;t&&(this.printLeadingComments(e),this.write('"'));let l=0,i=e.parts;for(;l<i.length;){let n=i[l];++l;let s=n.partType;switch(s._hx_index){case 0:let r=s.text;t?this.writeQuotedRaw(r):this.writeUnquotedRaw(r);break;case 1:let a=s.expr,h=this.isSimpleInterpolationExpr(a);this.write("$"),h||this.write("{"),this.printNode(a),h||this.write("}");break;case 2:let o=s.closing,u=s.expr;this.write(o?"</":"<"),this.printStringLiteral(u),this.write(">");break}}t?(this.write('"'),this.printTrailingComments(e)):this.printHashTrailingComments(e)}writeUnquotedRaw(e){this.writeRawWithContinuation(e,!0)}writeQuotedRaw(e){if(e.indexOf(`
|
|
47
40
|
`)==-1){this.write(e);return}let t=e.split(`
|
|
48
|
-
`),
|
|
49
|
-
`)==-1){this.write(e);return}let
|
|
50
|
-
`),
|
|
51
|
-
`)!=-1)return!0}}return!1}getOperator(e){switch(e._hx_index){case 20:return"=";case 21:return"+=";case 22:return"-=";case 23:return"*=";case 24:return"/=";case 25:return":=";case 26:return"+";case 27:return"-";case 28:return"*";case 29:return"/";case 30:return"%";case 31:return"==";case 32:return"!=";case 33:return">";case 34:return"<";case 35:return">=";case 36:return"<=";case 37:return e.word?"and":"&&";case 38:return e.word?"or":"||";case 39:return"!";default:throw b.thrown("Unsupported operator: "+le.string(e))}}}j["loreline.Printer"]=nl,nl.__name__="loreline.Printer",Object.assign(nl.prototype,{__class__:nl});class nn{static toString(e){switch(e){case 0:return"Unquoted";case 1:return"DoubleQuotes"}}}class _l{constructor(e){e==null&&(e=-1),e<0&&(e=new Date().getTime()/1e3*1e6,e+=Math.random()*1e5,e%=2147483647),this.seed=e,this.initialSeed=this.seed}next(){return(this.seed=this.seed*16807%2147483647)/2147483647+233e-12}between(e,t){return Math.floor(e+(t-e)*((this.seed=this.seed*16807%2147483647)/2147483647+233e-12))}reset(e){e!=null&&(this.initialSeed=e),this.seed=this.initialSeed}}j["loreline.Random"]=_l,_l.__name__="loreline.Random",Object.assign(_l.prototype,{__class__:_l});class _i extends Le{constructor(e,t,i){Ft._hx_skip_constructor=!0,super(),Ft._hx_skip_constructor=!1,this._hx_constructor(e,t,i)}_hx_constructor(e,t,i){this.indentSize=2,super._hx_constructor(e,t),this.body=i}toJson(){let e=super.toJson(),t=[],i=0,l=this.body;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.body=t,e.indentSize=this.indentSize,e}type(){return"Script"}eachExcludingImported(e){if(super.each(e),this.body!=null){let t=0,i=this.body;for(;t<i.length;){let l=i[t];++t,e(l,this),l instanceof Yt||l.each(e)}}}each(e){if(super.each(e),this.body!=null){let t=0,i=this.body;for(;t<i.length;){let l=i[t];++t,e(l,this),l.each(e)}}}iterator(){return new Gl(this.body)}static fromJson(e){return N.scriptFromJson(e)}}j["loreline.Script"]=Yi.loreline.Script=_i,_i.__name__="loreline.Script",_i.__super__=Le,Object.assign(_i.prototype,{__class__:_i});class Gl{constructor(e){this.body=e,this.index=0,this.flatBody=[],this.fillBody(e)}fillBody(e){let t=0,i=e.length;for(;t<i;){let l=t++,n=e[l];if(n instanceof Yt){let s=n;s.script!=null&&this.fillBody(s.script.body)}this.flatBody.push(e[l])}}hasNext(){return this.index<this.flatBody.length}next(){let e=this.flatBody[this.index];return this.index++,e}}j["loreline._Script.ScriptBodyIterator"]=Gl,Gl.__name__="loreline._Script.ScriptBodyIterator",Object.assign(Gl.prototype,{__class__:Gl});class $l{constructor(e,t){this.remaining=e,this.done=t}}j["loreline._Timer.PendingTimer"]=$l,$l.__name__="loreline._Timer.PendingTimer",Object.assign($l.prototype,{__class__:$l});class Hi{static register(e,t){Hi.timers.push(new $l(e,t))}static update(e){if(Hi.timers.length==0)return;let t=Hi.timers.length;for(;--t>=0;){let i=Hi.timers[t];i.remaining-=e,i.remaining<=0&&(Hi.timers.splice(t,1),i.done())}}}j["loreline.Timer"]=Hi,Hi.__name__="loreline.Timer";class _n{static uLength(e){return e.length}static uSubstr(e,t,i){return i!=null?p.substr(e,t,i):p.substr(e,t,null)}static uSubstring(e,t,i){return i!=null?e.substring(t,i):e.substring(t)}static uCharCodeAt(e,t){let i=p.cca(e,t);return i??-1}static uIndexOf(e,t,i){return e.indexOf(t,i)}static uLastIndexOf(e,t,i){return e.lastIndexOf(t,i)}static uToChars(e){return e.split("")}static uCharAt(e,t){return e.charAt(t)}}j["loreline.Utf8"]=_n,_n.__name__="loreline.Utf8";class Sl extends ai{constructor(e,t,i){super(t,i),this.wrapped=e}}j["loreline.WrappedError"]=Sl,Sl.__name__="loreline.WrappedError",Sl.__super__=ai,Object.assign(Sl.prototype,{__class__:Sl});class sn{static main(){}}j["loreline.lib.Library"]=sn,sn.__name__="loreline.lib.Library";function fn(k){return k instanceof Array?new Ti(k):k.iterator()}function Te(k,e){if(e==null)return null;e.__id__==null&&(e.__id__=Zl.$haxeUID++);var t;return k.hx__closures__==null?k.hx__closures__={}:t=k.hx__closures__[e.__id__],t==null&&(t=e.bind(k),k.hx__closures__[e.__id__]=t),t}Zl.$haxeUID|=0,typeof performance<"u"&&typeof performance.now=="function"&&(p.now=performance.now.bind(performance)),j.Math=Math,String.fromCodePoint==null&&(String.fromCodePoint=function(k){return k<65536?String.fromCharCode(k):String.fromCharCode((k>>10)+55232)+String.fromCharCode((k&1023)+56320)});{Object.defineProperty(String.prototype,"__class__",{value:j.String=String,enumerable:!1,writable:!0}),String.__name__="String",j.Array=Array,Array.__name__="Array",Date.prototype.__class__=j.Date=Date,Date.__name__="Date";var xn={},wn={},kn=Number,yn=Boolean,bn={},Cn={}}te.__toStr={}.toString,Z.Element=0,Z.PCData=1,Z.CData=2,Z.Document=6,Mt.randomId_nonHexChars="ghijklmnopqrstuvwxyz",Mt.randomId_chars="0123456789abcdefghijklmnopqrstuvwxyz",ul.ObjectBrace=0,ul.ArrayBracket=1,ul.Brace=2,ul.Indent=3,ul.CaseIndent=4,ul.Bracket=5,ul.Paren=6,Ji.CONTROL_KEYWORDS=["for","while","if","else","switch","catch"],wi.INITIAL_SIZE=16,wi.LOAD_FACTOR=.75,Ni.ChoiceBrace=0,Ni.ChoiceIndent=1,Ni.StateBrace=2,Ni.StateIndent=3,Ni.CharacterBrace=4,Ni.CharacterIndent=5,Ni.BeatBrace=6,Ni.BeatIndent=7,Ni.AlternativeBrace=8,Ni.AlternativeIndent=9,Ni.Brace=10,Ni.Indent=11,Ni.Bracket=12,yt.hasNonSpecialChar_specialChars=` "+=*/-(){}[]:
|
|
52
|
-
\r
|
|
41
|
+
`),l=0,i=t.length;for(;l<i;){let n=l++;n>0&&(this._buf.b+=Y.string(this._newline));let s=t[n],r;if(s.length>0){let a=c.cca(s,s.length-1);r=(a??-1)==13}else r=!1;if(r){let a=s.length-1;s=a!=null?s.substring(0,a):s.substring(0)}if(s.length>0){this._buf.b+=s==null?"null":""+s;let a=c.cca(s,s.length-1);this._lastChar=a??-1}}}writeRawWithContinuation(e,t){if(e.indexOf(`
|
|
42
|
+
`)==-1){this.write(e);return}let l=e.split(`
|
|
43
|
+
`),i=0,n=l.length;for(;i<n;){let s=i++;s>0&&(this._buf.b+=Y.string(this._newline),this._beginLine=1);let r=l[s],a;if(r.length>0){let h=c.cca(r,r.length-1);a=(h??-1)==13}else a=!1;if(a){let h=r.length-1;r=h!=null?r.substring(0,h):r.substring(0)}if(t&&s>0){let h=0;for(;;){let o;if(h<r.length){let u=c.cca(r,h);if((u??-1)!=32){let p=c.cca(r,h);o=(p??-1)==9}else o=!0}else o=!1;if(!o)break;++h}if(h>0){let o=null;r=o!=null?r.substring(h,o):r.substring(h)}}r.length>0&&this.write(r)}}printLiteral(e){this.printLeadingComments(e);let t=e.literalType;switch(t._hx_index){case 0:this.write(e.value==null?"null":Y.string(e.value));break;case 1:this.write(e.value?"true":"false");break;case 2:this.write("null");break;case 3:let l=!1,i=0,n=e.value;for(;i<n.length;){let o=n[i];if(++i,this.hasRealNewlines(o)){l=!0;break}}if(l){this.write("["),this.newline(),this._level++;let o=!0,u=0,p=e.value;for(;u<p.length;){let _=p[u];++u,o||(this.write(","),this.newline()),o=!1,this.printNode(_)}this.newline(),this._level--,this.write("]")}else{let o=!0;this.write("[");let u=0,p=e.value;for(;u<p.length;){let _=p[u];++u,o||this.write(", "),o=!1,this.printNode(_)}this.write("]")}break;case 4:let s=t.style;s==1?(this.write("{"),this.newline()):this.newline(),this._level++;let r=!0,a=0,h=e.value;for(;a<h.length;){let o=h[a];++a,r||this._beginLine==0&&this.newline(),r=!1,this.printLeadingComments(o),this.write(""+o.name+": "),this.printTrailingComments(o),this.printNode(o.value)}this.newline(),this._level--,s==1&&this.write("}");break}this.printTrailingComments(e)}printAccess(e){this.printLeadingComments(e),e.target!=null&&(this.printNode(e.target),this.write(".")),this.write(e.name),this.printTrailingComments(e)}printArrayAccess(e){this.printLeadingComments(e),this.printNode(e.target),this.write("["),this.printNode(e.index),this.write("]"),this.printTrailingComments(e)}printCall(e){this.printLeadingComments(e),this.printNode(e.target),this.write("(");let t=!0,l=0,i=e.args;for(;l<i.length;){let n=i[l];++l,t||this.write(", "),t=!1,this.printNode(n)}this.write(")"),this.printTrailingComments(e)}printBinary(e,t){t==null&&(t=!1),this.printLeadingComments(e);let l;if(t)l=!1;else{let i=e.op;switch(i._hx_index){case 37:let n=i.word;l=!0;break;case 38:let s=i.word;l=!0;break;default:l=!1}}l&&this.write("("),this.printNode(e.left),this.write(" "+this.getOperator(e.op)+" "),this.printNode(e.right),l&&this.write(")"),this.printTrailingComments(e)}printUnary(e){this.printLeadingComments(e),this.write(this.getOperator(e.op)),this.printTrailingComments(e),this.printNode(e.operand)}printTernary(e){this.printLeadingComments(e),this.printNode(e.condition),this.write(" ? "),this.printNode(e.trueExpr),this.write(" : "),this.printNode(e.falseExpr),this.printTrailingComments(e)}printAssignment(e){this.printLeadingComments(e),this.printNode(e.target),this.printTrailingComments(e),this.write(" "+this.getOperator(e.op)+" "),this.printNode(e.value)}printInLineExpression(e,t){let l=this.enableComments;this.enableComments=!1,t&&this.write("("),e instanceof il?this.printBinary(e,!0):this.printNode(e),t&&this.write(")"),this.enableComments=l}isSimpleInterpolationExpr(e){if(e instanceof ft){let t=e;return t.target==null?!0:this.isSimpleInterpolationExpr(t.target)}return e instanceof gl?this.isSimpleInterpolationExpr(te.__cast(e,gl).target):e instanceof Jt?this.isSimpleInterpolationExpr(te.__cast(e,Jt).target):!1}hasRealNewlines(e){if(e instanceof Mt){let t=e;if(t.quotes==1)return!1;let l=0,i=t.parts;for(;l<i.length;){let n=i[l];++l;let s=n.partType;if(s._hx_index==0&&s.text.indexOf(`
|
|
44
|
+
`)!=-1)return!0}}return!1}getOperator(e){switch(e._hx_index){case 20:return"=";case 21:return"+=";case 22:return"-=";case 23:return"*=";case 24:return"/=";case 25:return":=";case 26:return"+";case 27:return"-";case 28:return"*";case 29:return"/";case 30:return"%";case 31:return"==";case 32:return"!=";case 33:return">";case 34:return"<";case 35:return">=";case 36:return"<=";case 37:return e.word?"and":"&&";case 38:return e.word?"or":"||";case 39:return"!";default:throw C.thrown("Unsupported operator: "+Y.string(e))}}}Q["loreline.Printer"]=Wl,Wl.__name__="loreline.Printer",Object.assign(Wl.prototype,{__class__:Wl});class fn{static toString(e){switch(e){case 0:return"Unquoted";case 1:return"DoubleQuotes"}}}class wi{constructor(e){e==null&&(e=-1),e<0&&(e=new Date().getTime()/1e3*1e6,e+=Math.random()*1e5,e%=2147483647),this.seed=e,this.initialSeed=this.seed}next(){return(this.seed=this.seed*16807%2147483647)/2147483647+233e-12}between(e,t){return Math.floor(e+(t-e)*((this.seed=this.seed*16807%2147483647)/2147483647+233e-12))}reset(e){e!=null&&(this.initialSeed=e),this.seed=this.initialSeed}}Q["loreline.Random"]=wi,wi.__name__="loreline.Random",Object.assign(wi.prototype,{__class__:wi});class nl extends Be{constructor(e,t,l){At._hx_skip_constructor=!0,super(),At._hx_skip_constructor=!1,this._hx_constructor(e,t,l)}_hx_constructor(e,t,l){this.filePath=null,this.indentSize=2,super._hx_constructor(e,t),this.body=l}toJson(){let e=super.toJson(),t=[],l=0,i=this.body;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.body=t,e.indentSize=this.indentSize,this.filePath!=null&&(e.filePath=this.filePath),e}type(){return"Script"}eachExcludingImported(e){if(super.each(e),this.body!=null){let t=0,l=this.body;for(;t<l.length;){let i=l[t];++t,e(i,this),i instanceof Rt||i.each(e)}}}each(e){if(super.each(e),this.body!=null){let t=0,l=this.body;for(;t<l.length;){let i=l[t];++t,e(i,this),i.each(e)}}}iterator(){return new Xi(this.body)}static fromJson(e){return R.scriptFromJson(e)}}Q["loreline.Script"]=Xl.loreline.Script=nl,nl.__name__="loreline.Script",nl.__super__=Be,Object.assign(nl.prototype,{__class__:nl});class Xi{constructor(e){this.body=e,this.index=0,this.flatBody=[],this.fillBody(e)}fillBody(e){let t=0,l=e.length;for(;t<l;){let i=t++,n=e[i];if(n instanceof Rt){let s=n;s.script!=null&&this.fillBody(s.script.body)}this.flatBody.push(e[i])}}hasNext(){return this.index<this.flatBody.length}next(){let e=this.flatBody[this.index];return this.index++,e}}Q["loreline._Script.ScriptBodyIterator"]=Xi,Xi.__name__="loreline._Script.ScriptBodyIterator",Object.assign(Xi.prototype,{__class__:Xi});class en{constructor(e,t){this.remaining=e,this.done=t}}Q["loreline._Timer.PendingTimer"]=en,en.__name__="loreline._Timer.PendingTimer",Object.assign(en.prototype,{__class__:en});class Zl{static register(e,t){Zl.timers.push(new en(e,t))}static update(e){if(Zl.timers.length==0)return;let t=Zl.timers.length;for(;--t>=0;){let l=Zl.timers[t];l.remaining-=e,l.remaining<=0&&(Zl.timers.splice(t,1),l.done())}}}Q["loreline.Timer"]=Zl,Zl.__name__="loreline.Timer";class yn{static uLength(e){return e.length}static uSubstr(e,t,l){return l!=null?c.substr(e,t,l):c.substr(e,t,null)}static uSubstring(e,t,l){return l!=null?e.substring(t,l):e.substring(t)}static uCharCodeAt(e,t){let l=c.cca(e,t);return l??-1}static uIndexOf(e,t,l){return e.indexOf(t,l)}static uLastIndexOf(e,t,l){return e.lastIndexOf(t,l)}static uToChars(e){return e.split("")}static uCharAt(e,t){return e.charAt(t)}}Q["loreline.Utf8"]=yn,yn.__name__="loreline.Utf8";class Li extends st{constructor(e,t,l){super(t,l),this.wrapped=e}}Q["loreline.WrappedError"]=Li,Li.__name__="loreline.WrappedError",Li.__super__=st,Object.assign(Li.prototype,{__class__:Li});class _n{static main(){}}Q["loreline.lib.Library"]=_n,_n.__name__="loreline.lib.Library";var G=Ye["loreline.lorscript.TType"]={__ename__:"loreline.lorscript.TType",__constructs__:null,TMono:(x=function(b){return{_hx_index:0,r:b,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TMono",x.__params__=["r"],x),TVoid:{_hx_name:"TVoid",_hx_index:1,__enum__:"loreline.lorscript.TType",toString:F},TInt:{_hx_name:"TInt",_hx_index:2,__enum__:"loreline.lorscript.TType",toString:F},TFloat:{_hx_name:"TFloat",_hx_index:3,__enum__:"loreline.lorscript.TType",toString:F},TBool:{_hx_name:"TBool",_hx_index:4,__enum__:"loreline.lorscript.TType",toString:F},TDynamic:{_hx_name:"TDynamic",_hx_index:5,__enum__:"loreline.lorscript.TType",toString:F},TParam:(x=function(b){return{_hx_index:6,name:b,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TParam",x.__params__=["name"],x),TUnresolved:(x=function(b){return{_hx_index:7,name:b,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TUnresolved",x.__params__=["name"],x),TNull:(x=function(b){return{_hx_index:8,t:b,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TNull",x.__params__=["t"],x),TInst:(x=function(b,e){return{_hx_index:9,c:b,args:e,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TInst",x.__params__=["c","args"],x),TEnum:(x=function(b,e){return{_hx_index:10,e:b,args:e,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TEnum",x.__params__=["e","args"],x),TType:(x=function(b,e){return{_hx_index:11,t:b,args:e,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TType",x.__params__=["t","args"],x),TAbstract:(x=function(b,e){return{_hx_index:12,a:b,args:e,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TAbstract",x.__params__=["a","args"],x),TFun:(x=function(b,e){return{_hx_index:13,args:b,ret:e,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TFun",x.__params__=["args","ret"],x),TAnon:(x=function(b){return{_hx_index:14,fields:b,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TAnon",x.__params__=["fields"],x),TLazy:(x=function(b){return{_hx_index:15,f:b,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TLazy",x.__params__=["f"],x)};G.__constructs__=[G.TMono,G.TVoid,G.TInt,G.TFloat,G.TBool,G.TDynamic,G.TParam,G.TUnresolved,G.TNull,G.TInst,G.TEnum,G.TType,G.TAbstract,G.TFun,G.TAnon,G.TLazy];var ve=Ye["loreline.lorscript._Checker.WithType"]={__ename__:"loreline.lorscript._Checker.WithType",__constructs__:null,NoValue:{_hx_name:"NoValue",_hx_index:0,__enum__:"loreline.lorscript._Checker.WithType",toString:F},Value:{_hx_name:"Value",_hx_index:1,__enum__:"loreline.lorscript._Checker.WithType",toString:F},WithType:(x=function(b){return{_hx_index:2,t:b,__enum__:"loreline.lorscript._Checker.WithType",toString:F}},x._hx_name="WithType",x.__params__=["t"],x)};ve.__constructs__=[ve.NoValue,ve.Value,ve.WithType];var dl=Ye["loreline.lorscript.CTypedecl"]={__ename__:"loreline.lorscript.CTypedecl",__constructs__:null,CTClass:(x=function(b){return{_hx_index:0,c:b,__enum__:"loreline.lorscript.CTypedecl",toString:F}},x._hx_name="CTClass",x.__params__=["c"],x),CTEnum:(x=function(b){return{_hx_index:1,e:b,__enum__:"loreline.lorscript.CTypedecl",toString:F}},x._hx_name="CTEnum",x.__params__=["e"],x),CTTypedef:(x=function(b){return{_hx_index:2,t:b,__enum__:"loreline.lorscript.CTypedecl",toString:F}},x._hx_name="CTTypedef",x.__params__=["t"],x),CTAlias:(x=function(b){return{_hx_index:3,t:b,__enum__:"loreline.lorscript.CTypedecl",toString:F}},x._hx_name="CTAlias",x.__params__=["t"],x),CTAbstract:(x=function(b){return{_hx_index:4,a:b,__enum__:"loreline.lorscript.CTypedecl",toString:F}},x._hx_name="CTAbstract",x.__params__=["a"],x)};dl.__constructs__=[dl.CTClass,dl.CTEnum,dl.CTTypedef,dl.CTAlias,dl.CTAbstract];class Bi{constructor(e,t){this.expr=e,this.t=t}}Q["loreline.lorscript.Completion"]=Bi,Bi.__name__="loreline.lorscript.Completion",Object.assign(Bi.prototype,{__class__:Bi});class tn{constructor(){this.types=new Ee,this.types=new Ee,this.types.h.Void=dl.CTAlias(G.TVoid),this.types.h.Int=dl.CTAlias(G.TInt),this.types.h.Float=dl.CTAlias(G.TFloat),this.types.h.Bool=dl.CTAlias(G.TBool),this.types.h.Dynamic=dl.CTAlias(G.TDynamic),this.parser=new ci}addXmlApi(e){let t=new Vi;t.process(e,"");let l=[],i=0,n=t.root;for(;i<n.length;){let r=n[i];++i,this.addXmlType(r,l)}let s=0;for(;s<l.length;){let r=l[s];++s,r()}this.t_string=this.getType("String")}defineClass(e,t){return t==null&&(t={name:e,fields:new Ee,statics:new Ee,params:[]}),this.types.h[e]=dl.CTClass(t),t}addXmlType(e,t){let l=this;switch(e._hx_index){case 0:let i=e.name,n=e.full,s=e.subs,r=0;for(;r<s.length;){let v=s[r];++r,this.addXmlType(v,t)}break;case 1:let a=e.c;if(Object.prototype.hasOwnProperty.call(this.types.h,a.path))return;let h={name:a.path,params:[],fields:new Ee,statics:new Ee};this.addMeta(a,h),a.isInterface&&(h.isInterface=!0);let o=0,u=a.params;for(;o<u.length;){let v=u[o];++o,h.params.push(G.TParam(v))}t.push(function(){let v=new Ee,M=0,A=h.params;for(;M<A.length;){let N=A[M];++M;let D=a.path+"."+tt.typeStr(N);v.h[D]=N}if(l.localParams=v,a.superClass!=null){let N=l,D=a.superClass.path,U=[],W=0,J=a.superClass.params;for(;W<J.length;){let H=J[W];++W,U.push(l.makeXmlType(H))}h.superClass=N.getType(D,U)}if(a.interfaces!=null){h.interfaces=[];let N=0,D=a.interfaces;for(;N<D.length;){let U=D[N];++N;let W=h.interfaces,J=l,H=U.path,X=[],ae=0,ce=U.params;for(;ae<ce.length;){let ne=ce[ae];++ae,X.push(l.makeXmlType(ne))}W.push(J.getType(H,X))}}let L=[],I=function(N,D){if(N.isOverride||c.substr(N.name,0,4)=="get_"||c.substr(N.name,0,4)=="set_")return;let U=!N.name.startsWith("__"),W=0,J=N.meta;for(;W<J.length;){let re=J[W];if(++W,re.name==":noScript")return;re.name==":noCompletion"&&(U=!1)}let H=N.set,X;switch(H._hx_index){case 2:let re=H.m;X=!0;break;case 0:case 4:X=!0;break;default:X=!1}let ae={isPublic:N.isPublic,canWrite:X,complete:U,params:[],name:N.name,t:null},ce=0,ne=N.params;for(;ce<ne.length;){let re=ne[ce];++ce;let xe=G.TParam(re),Pe=N.name+"."+re;L.push(Pe),ae.params.push(xe),l.localParams.h[Pe]=xe}if(ae.t=l.makeXmlType(N.type),N.meta!=null&&N.meta.length>0){ae.meta=[];let re=0,xe=N.meta;for(;re<xe.length;){let Pe=xe[re];++re;let Ue=ae.meta,Je=Pe.name,lt=[],Ve=0,Qe=Pe.params;for(;Ve<Qe.length;){let at=Qe[Ve];++Ve;let Re;try{Re=l.parser.parseString(at)}catch($){if(C.caught($).unwrap()instanceof Se)Re=null;else throw $}lt.push(Re)}Ue.push({name:Je,params:lt})}}for(;L.length>0;){let re=l.localParams,xe=L.pop(),Pe=re;Object.prototype.hasOwnProperty.call(Pe.h,xe)&&delete Pe.h[xe]}ae.name=="new"?h.constructor=ae:D.set(N.name,ae)},q=0,z=a.fields;for(;q<z.length;){let N=z[q];++q,I(N,h.fields)}let P=0,B=a.statics;for(;P<B.length;){let N=B[P];++P,I(N,h.statics)}l.localParams=null}),this.types.h[h.name]=dl.CTClass(h);break;case 2:let p=e.e;if(Object.prototype.hasOwnProperty.call(this.types.h,p.path))return;let _={name:p.path,params:[],constructors:[]};this.addMeta(p,_);let m=0,f=p.params;for(;m<f.length;){let v=f[m];++m,_.params.push(G.TParam(v))}t.push(function(){let v=new Ee,M=0,A=_.params;for(;M<A.length;){let q=A[M];++M;let z=p.path+"."+tt.typeStr(q);v.h[z]=q}l.localParams=v;let L=0,I=p.constructors;for(;L<I.length;){let q=I[L];++L;let z=_.constructors,P=q.name,B;if(q.args==null)B=null;else{let N=[],D=0,U=q.args;for(;D<U.length;){let W=U[D];++D,N.push({name:W.name,opt:W.opt,t:l.makeXmlType(W.t)})}B=N}z.push({name:P,args:B})}l.localParams=null}),this.types.h[_.name]=dl.CTEnum(_);break;case 3:let g=e.t;if(Object.prototype.hasOwnProperty.call(this.types.h,g.path))return;let d={name:g.path,params:[],t:null},w=0,y=g.params;for(;w<y.length;){let v=y[w];++w,d.params.push(G.TParam(v))}g.path=="loreline.lorscript.TypeCheck"&&d.params.reverse(),t.push(function(){let v=new Ee,M=0,A=d.params;for(;M<A.length;){let L=A[M];++M;let I=g.path+"."+tt.typeStr(L);v.h[I]=L}l.localParams=v,d.t=l.makeXmlType(g.type),l.localParams=null}),this.types.h[g.path]=dl.CTTypedef(d);break;case 4:let S=e.a;if(Object.prototype.hasOwnProperty.call(this.types.h,S.path))return;let T={name:S.path,params:[],t:null};this.addMeta(S,T);let O=0,E=S.params;for(;O<E.length;){let v=E[O];++O,T.params.push(G.TParam(v))}t.push(function(){let v=new Ee,M=0,A=T.params;for(;M<A.length;){let L=A[M];++M;let I=S.path+"."+tt.typeStr(L);v.h[I]=L}l.localParams=v,T.t=l.makeXmlType(S.athis),l.localParams=null}),this.types.h[S.path]=dl.CTAbstract(T);break}}addMeta(e,t){if(e.meta==null||e.meta.length==0)return;t.meta=[];let l=0,i=e.meta;for(;l<i.length;){let n=i[l];++l;let s=t.meta,r=n.name,a=[],h=0,o=n.params;for(;h<o.length;){let u=o[h];++h;let p;try{p=this.parser.parseString(u)}catch(_){if(C.caught(_).unwrap()instanceof Se)p=null;else throw _}a.push(p)}s.push({name:r,params:a})}}makeXmlType(e){switch(e._hx_index){case 0:return G.TUnresolved("Unknown");case 1:let t=e.name,l=e.params,i=[],n=0;for(;n<l.length;){let A=l[n];++n,i.push(this.makeXmlType(A))}return this.getType(t,i);case 2:let s=e.name,r=e.params,a=[],h=0;for(;h<r.length;){let A=r[h];++h,a.push(this.makeXmlType(A))}return this.getType(s,a);case 3:let o=e.name,u=e.params,p=[],_=0;for(;_<u.length;){let A=u[_];++_,p.push(this.makeXmlType(A))}return this.getType(o,p);case 4:let m=e.args,f=e.ret,g=[],d=0;for(;d<m.length;){let A=m[d];++d,g.push({name:A.name,opt:A.opt,t:this.makeXmlType(A.t)})}return G.TFun(g,this.makeXmlType(f));case 5:let w=e.fields,y=[],S=0;for(;S<w.length;){let A=w[S];++S;let L=A.name,I=this.makeXmlType(A.type),q=A.meta,z;if(q==null)z=!1;else{let P=!1,B=0;for(;B<q.length;){let N=q[B];if(++B,N.name==":optional"){P=!0;break}}z=P}y.push({name:L,t:I,opt:z})}return G.TAnon(y);case 6:let T=e.t;return G.TDynamic;case 7:let O=e.name,E=e.params,v=[],M=0;for(;M<E.length;){let A=E[M];++M,v.push(this.makeXmlType(A))}return this.getType(O,v)}}getType(e,t){if(this.localParams!=null){let i=this.localParams.h[e];if(i!=null)return i}let l=this.resolve(e,t);if(l==null){let i=e.split(".");if(i.length>1){let n=i[i.length-2];if(c.cca(n,0)==95)return c.remove(i,n),this.getType(i.join("."),t)}return G.TUnresolved(e)}return l}resolve(e,t){if(e=="Null"){if(t==null||t.length!=1)throw C.thrown("Missing Null<T> parameter");return G.TNull(t[0])}let l=this.types.h[e];if(l==null)return null;switch(t==null&&(t=[]),l._hx_index){case 0:let i=l.c;return G.TInst(i,t);case 1:let n=l.e;return G.TEnum(n,t);case 2:let s=l.t;return G.TType(s,t);case 3:return l.t;case 4:let a=l.a;return G.TAbstract(a,t)}}}Q["loreline.lorscript.CheckerTypes"]=tn,tn.__name__="loreline.lorscript.CheckerTypes",Object.assign(tn.prototype,{__class__:tn});class tt{constructor(e){this.events=new Ee,this.globals=new Ee,e==null&&(e=new tn),this.types=e}setGlobals(e,t){t==null&&(t=!1);let l=this;for(;;){let i=e.fields.h,n=i,s=Object.keys(i),r=s.length,a=0;for(;a<r;){let o=n[s[a++]];if(o.isPublic||t){let u=o.params.length==0?o.t:G.TLazy(function(){let p=l,_=o.t,m=o.params,f=[],g=0,d=o.params.length;for(;g<d;){let w=g++;f.push(l.makeMono())}return p.apply(_,m,f)});this.setGlobal(o.name,u)}}if(e.superClass==null)break;let h=e.superClass;if(h==null)throw C.thrown("assert");if(h._hx_index==9){let o=h.args;e=h.c}else throw C.thrown("assert")}}removeGlobal(e){let t=this.globals;Object.prototype.hasOwnProperty.call(t.h,e)&&delete t.h[e]}setGlobal(e,t){this.globals.h[e]=t}setEvent(e,t){this.events.h[e]=t}getGlobals(){return this.globals}onTopDownEnum(e,t){return!1}typeArgs(e,t){let l=[],i=0,n=e.length;for(;i<n;){let s=i++,r=e[s],a=r.t==null?this.makeMono():this.makeType(r.t,t);l.push({name:r.name,opt:r.opt,t:a})}return l}check(e,t,l){l==null&&(l=!1),t==null&&(t=ve.NoValue),this.locals=new Ee,this.types.t_string==null&&(this.types.t_string=this.types.getType("String")),this.allowDefine=this.allowGlobalsDefine,this.isCompletion=l;let i=e.e,n;if(i._hx_index==14){let a=i.args,h=i.e,o=i.name,u=i.ret;n=!0}else n=!1;n&&(e=this.mk(K.EBlock([e]),e));let s=this,r=e.e;if(r._hx_index==4){let a=r.e,h=[],o=G.TVoid,u=0;for(;u<a.length;){let _=a[u];for(++u;;){let f=_.e;if(f._hx_index==25){let g=f.name,d=f.args;_=f.e}else break}let m=_.e;if(m._hx_index==14){let f=m.e,g=m.args,d=m.name,w=m.ret;if(d!=null){let y=w==null?this.makeMono():this.makeType(w,_),S=G.TFun(this.typeArgs(g,_),y);this.locals.h[d]=S,h.push(function(){return s.currentFunType=S,s.typeExpr(_,ve.NoValue),S})}else{let y=0;for(;y<h.length;){let S=h[y];++y,S()}h=[],a[a.length-1]==_?o=this.typeExpr(_,t):this.typeExpr(_,ve.NoValue)}}else{let f=0;for(;f<h.length;){let g=h[f];++f,g()}h=[],a[a.length-1]==_?o=this.typeExpr(_,t):this.typeExpr(_,ve.NoValue)}}let p=0;for(;p<h.length;){let _=h[p];++p,o=_()}return o}return this.typeExpr(e,t)}edef(e){return e.e}error(e,t){let l=Te.ECustom(e),i=new Se(l,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw C.thrown(i)}saveLocals(){let e=new Ee,t=this.locals.h,l=t,i=Object.keys(t),n=i.length,s=0;for(;s<n;){let r=i[s++];e.h[r]=this.locals.h[r]}return e}makeType(e,t){switch(e._hx_index){case 0:let l=e.path,i=e.params,n=this.types,s=l.join("."),r;if(i==null)r=[];else{let T=[],O=0;for(;O<i.length;){let E=i[O];++O,T.push(this.makeType(E,t))}r=T}let a=n.resolve(s,r);if(a==null){let T=Te.ECustom("Unknown type "+Y.string(l)),O=new Se(T,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw C.thrown(O);a=G.TDynamic}return a;case 1:let h=e.args,o=e.ret,u=0,p=[],_=0;for(;_<h.length;){let T=h[_];++_,p.push({name:"p"+u++,opt:!1,t:this.makeType(T,t)})}return G.TFun(p,this.makeType(o,t));case 2:let m=e.fields,f=[],g=0;for(;g<m.length;){let T=m[g];++g,f.push({name:T.name,opt:!1,t:this.makeType(T.t,t)})}return G.TAnon(f);case 3:let d=e.t;return this.makeType(d,t);case 4:let w=e.t;return this.makeType(w,t);case 5:let y=e.n,S=e.t;return this.makeType(S,t)}}linkLoop(e,t){if(t==e)return!0;switch(t._hx_index){case 0:let l=t.r;return l.r==null?!1:this.linkLoop(e,l.r);case 5:return t==G.TDynamic?!1:this.linkLoop(e,G.TDynamic);case 9:let i=t.c,n=t.args,s=0;for(;s<n.length;){let T=n[s];if(++s,this.linkLoop(e,T))return!0}return!1;case 10:let r=t.e,a=t.args,h=0;for(;h<a.length;){let T=a[h];if(++h,this.linkLoop(e,T))return!0}return!1;case 11:let o=t.t,u=t.args,p=0;for(;p<u.length;){let T=u[p];if(++p,this.linkLoop(e,T))return!0}return!1;case 12:let _=t.a,m=t.args,f=0;for(;f<m.length;){let T=m[f];if(++f,this.linkLoop(e,T))return!0}return!1;case 13:let g=t.args,d=t.ret,w=0;for(;w<g.length;){let T=g[w];if(++w,this.linkLoop(e,T.t))return!0}return this.linkLoop(e,d);case 14:let y=t.fields,S=0;for(;S<y.length;){let T=y[S];if(++S,this.linkLoop(e,T.t))return!0}return!1;default:return!1}}link(e,t,l){return this.linkLoop(e,t)?this.follow(t)==e:(t==G.TDynamic||(l.r=t),!0)}typeEq(e,t){if(e==t)return!0;switch(e._hx_index){case 0:let l=e.r;return l.r==null?this.link(e,t,l)?(l.r=t,!0):!1:this.typeEq(l.r,t);case 8:let i=e.t;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let d=t.t,w=i;return this.typeEq(w,d);case 11:let y=t.t,S=t.args;return this.typeEq(e,this.apply(y.t,y.params,S));default:let T=i;return this.typeEq(T,t)}break;case 9:let n=e.c,s=e.args;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let d=t.t;return this.typeEq(e,d);case 9:let w=t.c,y=t.args,S=s;if(n==w){let v=0,M=S.length;for(;v<M;){let A=v++;if(!this.typeEq(S[A],y[A]))return!1}return!0}break;case 11:let O=t.t,E=t.args;return this.typeEq(e,this.apply(O.t,O.params,E));default:}break;case 10:let r=e.e,a=e.args;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let d=t.t;return this.typeEq(e,d);case 10:let w=t.e,y=t.args,S=a;if(r==w){let v=0,M=S.length;for(;v<M;){let A=v++;if(!this.typeEq(S[A],y[A]))return!1}return!0}break;case 11:let O=t.t,E=t.args;return this.typeEq(e,this.apply(O.t,O.params,E));default:}break;case 11:let h=e.t,o=e.args;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let d=t.t,w=o,y=h;return this.typeEq(this.apply(y.t,y.params,w),t);case 11:let S=t.t,T=t.args,O=o;if(h==S){let A=0,L=O.length;for(;A<L;){let I=A++;if(!this.typeEq(O[I],T[I]))return!1}return!0}else{let A=o,L=h;return this.typeEq(this.apply(L.t,L.params,A),t)}break;default:let v=o,M=h;return this.typeEq(this.apply(M.t,M.params,v),t)}break;case 12:let u=e.a,p=e.args;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let d=t.t;return this.typeEq(e,d);case 11:let w=t.t,y=t.args;return this.typeEq(e,this.apply(w.t,w.params,y));case 12:let S=t.a,T=t.args,O=p;if(u==S){let v=0,M=O.length;for(;v<M;){let A=v++;if(!this.typeEq(O[A],T[A]))return!1}return!0}break;default:}break;case 13:let _=e.args,m=e.ret;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let d=t.t;return this.typeEq(e,d);case 11:let w=t.t,y=t.args;return this.typeEq(e,this.apply(w.t,w.params,y));case 13:let S=t.args,T=t.ret,O=m,E=_;if(E.length==S.length){let v=0,M=E.length;for(;v<M;){let A=v++;if(!this.typeEq(E[A].t,S[A].t))return!1}return this.typeEq(O,T)}break;default:}break;case 14:let f=e.fields;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let d=t.t;return this.typeEq(e,d);case 11:let w=t.t,y=t.args;return this.typeEq(e,this.apply(w.t,w.params,y));case 14:let S=t.fields,T=f;if(T.length==S.length){let O=Object.create(null),E=0;for(;E<S.length;){let M=S[E];++E,O[M.name]=M}let v=0;for(;v<T.length;){let M=T[v];++v;let A=O[M.name];if(A==null||!this.typeEq(M.t,A.t))return!1}return!0}break;default:}break;default:switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let d=t.t;return this.typeEq(e,d);case 11:let w=t.t,y=t.args;return this.typeEq(e,this.apply(w.t,w.params,y));default:}}return!1}tryUnify(e,t){if(e==t)return!0;switch(e._hx_index){case 0:let l=e.r;return l.r==null?this.link(e,t,l)?(l.r=t,!0):!1:this.tryUnify(l.r,t);case 2:switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 3:return!0;case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let m=t.t,f=t.args;return this.tryUnify(e,this.apply(m.t,m.params,f));default:}break;case 5:switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let m=t.t,f=t.args;return this.tryUnify(e,this.apply(m.t,m.params,f));default:return!0}break;case 8:let i=e.t;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:let _=i;return this.tryUnify(_,t);case 8:let m=t.t,f=i;return this.tryUnify(f,t);case 11:let g=t.t,d=t.args;return this.tryUnify(e,this.apply(g.t,g.params,d));default:let w=i;return this.tryUnify(w,t)}break;case 9:let n=e.c,s=e.args;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 9:let m=t.c,f=t.args,g=s,d=n;for(;d!=m;){if(d.interfaces!=null){let I=0,q=d.interfaces;for(;I<q.length;){let z=q[I];if(++I,z._hx_index==9){let P=z.c,B=z.args,N=[],D=0;for(;D<B.length;){let W=B[D];++D,N.push(this.apply(W,d.params,g))}let U=G.TInst(P,N);if(this.tryUnify(U,t))return!0}else throw C.thrown("assert")}}let L=d.superClass;if(L==null)return!1;if(L._hx_index==9){let I=L.c,q=L.args,z=[],P=0;for(;P<q.length;){let B=q[P];++P,z.push(this.apply(B,d.params,g))}g=z,d=I}else throw C.thrown("assert")}let w=0,y=g.length;for(;w<y;){let L=w++;if(!this.typeEq(g[L],f[L]))return!1}return!0;case 11:let S=t.t,T=t.args;return this.tryUnify(e,this.apply(S.t,S.params,T));case 14:let O=t.fields,E=s,v=n,M=0,A=O.length;for(;M<A;){let L=M++,I=O[L],q=null,z=v;for(;q=z.fields.h[I.name],q==null;){if(z.superClass==null)return!1;let P=z.superClass;if(P==null)throw C.thrown("assert");if(P._hx_index==9){let B=P.args;z=P.c}else throw C.thrown("assert")}if(!this.typeEq(this.apply(q.t,v.params,E),I.t))return!1}return!0;default:}break;case 11:let r=e.t,a=e.args;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:let _=a,m=r;return this.tryUnify(this.apply(m.t,m.params,_),t);case 8:let f=t.t,g=a,d=r;return this.tryUnify(this.apply(d.t,d.params,g),t);case 11:let w=t.t,y=t.args,S=a,T=r;return this.tryUnify(this.apply(T.t,T.params,S),t);default:let O=a,E=r;return this.tryUnify(this.apply(E.t,E.params,O),t)}break;case 13:let h=e.args,o=e.ret;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let m=t.t,f=t.args;return this.tryUnify(e,this.apply(m.t,m.params,f));case 12:let g=t.a,d=t.args,w=g.meta,y=g.params,S=g.t;if(g.name=="haxe.Function")return!0;break;case 13:let T=t.args,O=t.ret,E=o,v=h;if(v.length==T.length){let M=0,A=v.length;for(;M<A;){let L=M++,I=v[L],q=T[L];if(q.opt&&!I.opt||!this.tryUnify(q.t,I.t))return!1}return this.tryUnify(E,O)}break;default:}break;case 14:let u=e.fields;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let m=t.t,f=t.args;return this.tryUnify(e,this.apply(m.t,m.params,f));case 14:let g=t.fields,d=u;if(g.length==0)return!0;let w=Object.create(null),y=0;for(;y<d.length;){let T=d[y];++y,w[T.name]=T}let S=0;for(;S<g.length;){let T=g[S];++S;let O=w[T.name];if(O==null){if(T.opt)continue;return!1}if(!this.typeEq(O.t,T.t))return!1}return!0;default:}break;default:switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let m=t.t,f=t.args;return this.tryUnify(e,this.apply(m.t,m.params,f));default:}}return this.typeEq(e,t)}unify(e,t,l){if(!this.tryUnify(e,t)){let i=Te.ECustom(tt.typeStr(e)+" should be "+tt.typeStr(t)),n=new Se(i,l.pmin,l.pmax,l.origin,l.line);if(!this.isCompletion)throw C.thrown(n)}}apply(e,t,l){if(l.length!=t.length)throw C.thrown("Invalid number of type parameters");if(l.length==0)return e;let i=new ri,n=0,s=t.length;for(;n<s;){let h=n++;i.set(t[h],l[h])}let r=null,a=this;return r=function(h){let o=i.get(h);return o??a.mapType(h,r)},r(e)}mapType(e,t){switch(e._hx_index){case 0:return e.r.r==null?e:t(e);case 1:case 2:case 3:case 4:case 5:return e;case 6:let i=e.name;return e;case 7:let n=e.name;return e;case 8:let s=e.t;return G.TNull(t(s));case 9:let r=e.args;if(r.length==0)return e;{let y=r,S=e.c,T=[],O=0;for(;O<y.length;){let E=y[O];++O,T.push(t(E))}return G.TInst(S,T)}break;case 10:let a=e.args;if(a.length==0)return e;{let y=a,S=e.e,T=[],O=0;for(;O<y.length;){let E=y[O];++O,T.push(t(E))}return G.TEnum(S,T)}break;case 11:let h=e.args;if(h.length==0)return e;{let y=h,S=e.t,T=[],O=0;for(;O<y.length;){let E=y[O];++O,T.push(t(E))}return G.TType(S,T)}break;case 12:let o=e.args;if(o.length==0)return e;{let y=o,S=e.a,T=[],O=0;for(;O<y.length;){let E=y[O];++O,T.push(t(E))}return G.TAbstract(S,T)}break;case 13:let u=e.args,p=e.ret,_=[],m=0;for(;m<u.length;){let y=u[m];++m,_.push({name:y.name,opt:y.opt,t:t(y.t)})}return G.TFun(_,t(p));case 14:let f=e.fields,g=[],d=0;for(;d<f.length;){let y=f[d];++d,g.push({name:y.name,opt:y.opt,t:t(y.t)})}return G.TAnon(g);case 15:let w=e.f;return t(w())}}follow(e){switch(e._hx_index){case 0:let t=e.r;return t.r!=null?this.follow(t.r):e;case 8:let l=e.t;return this.follow(l);case 11:let i=e.t,n=e.args;return this.follow(this.apply(i.t,i.params,n));case 15:let s=e.f;return this.follow(s());default:return e}}getFields(e){let t=[],l=this,i=this.follow(e);switch(i._hx_index){case 9:let n=i.c,s=i.args,r=function(p){return l.apply(p,n.params,s)};for(;n!=null;){let p=n.fields.h,_=p,m=Object.keys(p),f=m.length,g=0;for(;g<f;){let w=m[g++],y=n.fields.h[w];if(!y.isPublic||!y.complete)continue;let S=y.name,T=r(y.t);this.allowAsync&&S.startsWith("a_")&&(T=this.unasync(T),S=c.substr(S,2,null)),t.push({name:S,t:T})}if(n.isInterface&&n.interfaces!=null){let w=0,y=n.interfaces;for(;w<y.length;){let S=y[w];++w;let T=0,O=this.getFields(S);for(;T<O.length;){let E=O[T];++T,t.push({name:E.name,t:r(E.t)})}}}if(n.superClass==null)break;let d=n.superClass;if(d==null)break;if(d._hx_index==9){let w=d.c,y=d.args,S=r;r=function(T){return S(l.apply(T,w.params,y))},n=w}else break}break;case 13:let a=i.args,h=i.ret;this.isCompletion&&t.push({name:"bind",t:G.TFun(a,G.TVoid)});break;case 14:let o=i.fields,u=0;for(;u<o.length;){let p=o[u];++u,t.push({name:p.name,t:p.t})}break;default:}return t}getField(e,t,l,i){i==null&&(i=!1);let n=this.follow(e);switch(n._hx_index){case 5:return this.makeMono();case 9:let s=n.c,r=n.args,a=s.fields.h[t];if(a==null&&this.allowAsync&&(a=s.fields.h["a_"+t],a!=null&&(a={isPublic:!0,canWrite:!1,params:a.params,name:a.name,t:this.unasync(a.t),complete:a.complete},a.t==null&&(a=null))),a==null&&s.isInterface&&s.interfaces!=null){let p=0,_=s.interfaces;for(;p<_.length;){let m=_[p];++p;let f=this.getField(m,t,l,i);if(f!=null)return this.apply(f,s.params,r)}}if(a==null){if(s.superClass==null)return null;let p=this.getField(s.superClass,t,l,i);return p!=null&&(p=this.apply(p,s.params,r)),p}if(!a.isPublic){let p=Te.ECustom("Can't access private field "+t+" on "+s.name),_=new Se(p,l.pmin,l.pmax,l.origin,l.line);if(!this.isCompletion)throw C.thrown(_)}if(i&&!a.canWrite){let p=Te.ECustom("Can't write readonly field "+t+" on "+s.name),_=new Se(p,l.pmin,l.pmax,l.origin,l.line);if(!this.isCompletion)throw C.thrown(_)}let h=a.t;if(a.params!=null){let p=a.params,_=[],m=0,f=a.params.length;for(;m<f;){let g=m++;_.push(this.makeMono())}h=this.apply(h,p,_)}return this.apply(h,s.params,r);case 14:let o=n.fields,u=0;for(;u<o.length;){let p=o[u];if(++u,p.name==t)return p.t}return null;default:return null}}unasync(e){let t=this.follow(e);if(t._hx_index==13){let l=t.args,i=t.ret;if(l.length>0){let n=l.slice(),s=this.follow(n.shift().t);if(s._hx_index==13){let r=s.args,a=s.ret;if(r.length==1){let h=r[0];return G.TFun(n,h.t)}}}}return null}typeExprWith(e,t){let l=this.typeExpr(e,ve.WithType(t));return this.unify(l,t,e),t}makeMono(){return G.TMono({r:null})}makeIterator(e){return G.TAnon([{name:"next",opt:!1,t:G.TFun([],e)},{name:"hasNext",opt:!1,t:G.TFun([],G.TBool)}])}mk(e,t){return{e,pmin:t.pmin,pmax:t.pmax,origin:t.origin,line:t.line}}isString(e){if(e=this.follow(e),e._hx_index==9){let t=e.c,l=e.args,i=t.constructor,n=t.fields,s=t.interfaces,r=t.isInterface,a=t.meta,h=t.params,o=t.statics,u=t.superClass;return t.name=="String"}else return!1}onCompletion(e,t){if(this.isCompletion)throw C.thrown(new Bi(e,t))}typeField(e,t,l,i){let n=this.typeExpr(e,ve.Value);t==null&&this.onCompletion(l,n);let s=this.getField(n,t,l,i);if(s==null){let r=Te.ECustom(tt.typeStr(n)+" has no field "+t),a=new Se(r,l.pmin,l.pmax,l.origin,l.line);if(!this.isCompletion)throw C.thrown(a);s=G.TDynamic}return s}typeExpr(e,t){if(e==null&&this.isCompletion)return t._hx_index==2?t.t:G.TDynamic;let l=this,i=e.e;switch(i._hx_index){case 0:let a=i.c;switch(a._hx_index){case 0:let fe=a.v;return G.TInt;case 1:let ke=a.f;return G.TFloat;case 2:let Fe=a.s;return this.types.t_string}break;case 1:let h=i.v,o=this.locals.h[h];if(o!=null)return o;let u=this.globals.h[h];if(u!=null){if(u==null)return u;if(u._hx_index==15){let fe=u.f;return fe()}else return u}if(this.allowAsync&&(u=this.globals.h["a_"+h],u!=null&&(u=this.unasync(u)),u!=null))return u;switch(h){case"false":case"true":return G.TBool;case"null":return this.makeMono();case"trace":return G.TDynamic;default:if(t._hx_index==2){let Fe=t.t;if(Fe._hx_index==10){let We=Fe,Wt=Fe.e,Dt=Fe.args,ut=0,vl=Wt.constructors;for(;ut<vl.length;){let pl=vl[ut];if(++ut,pl.name==h){if(this.onTopDownEnum(Wt,h)){let mt=pl.args==null?We:G.TFun(pl.args,We);return this.apply(mt,Wt.params,Dt)}break}}}}if(this.isCompletion)return G.TDynamic;let fe=Te.ECustom("Unknown identifier "+h),ke=new Se(fe,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(ke)}break;case 2:let p=i.n,_=i.t,m=i.e,f=_==null?this.makeMono():this.makeType(_,e);if(m!=null){let fe=this.typeExpr(m,_==null?ve.Value:ve.WithType(f));_==null?f=fe:this.unify(fe,f,m)}return this.locals.h[p]=f,G.TVoid;case 3:let g=i.e;return this.typeExpr(g,t);case 4:let d=i.e,w=G.TVoid,y=this.saveLocals(),S=0;for(;S<d.length;){let fe=d[S];++S,w=this.typeExpr(fe,fe==d[d.length-1]?t:ve.NoValue)}return this.locals=y,w;case 5:let T=i.e,O=i.f;return this.typeField(T,O,e,!1);case 6:let E=i.op,v=i.e1,M=i.e2;switch(E){case"!=":case"==":let fe=this.typeExpr(v,ve.Value),ke=this.typeExpr(M,ve.WithType(fe));return this.tryUnify(fe,ke)||this.unify(ke,fe,M),G.TBool;case"%":case"*":case"-":case"/":let Fe=this.typeExpr(v,ve.WithType(G.TInt)),We=this.typeExpr(M,ve.WithType(Fe));this.tryUnify(Fe,We)||this.unify(We,Fe,M);let Wt=this.follow(Fe),Dt=this.follow(We);switch(Wt._hx_index){case 2:switch(Dt._hx_index){case 2:return E=="/"?G.TFloat:G.TInt;case 3:case 5:return G.TFloat;default:this.unify(Fe,G.TFloat,v),this.unify(We,G.TFloat,M)}break;case 3:switch(Dt._hx_index){case 2:case 3:case 5:return G.TFloat;default:this.unify(Fe,G.TFloat,v),this.unify(We,G.TFloat,M)}break;case 5:switch(Dt._hx_index){case 2:case 3:case 5:return G.TFloat;default:this.unify(Fe,G.TFloat,v),this.unify(We,G.TFloat,M)}break;default:this.unify(Fe,G.TFloat,v),this.unify(We,G.TFloat,M)}break;case"+":let ut=this.typeExpr(v,ve.WithType(G.TInt)),vl=this.typeExpr(M,ve.WithType(ut));this.tryUnify(ut,vl);let pl=this.follow(ut),mt=this.follow(vl);switch(pl._hx_index){case 2:switch(mt._hx_index){case 2:return G.TInt;case 3:return G.TFloat;case 5:return G.TDynamic;default:let Pt=pl,Tl=mt;if(this.isString(Pt)||this.isString(Tl))return this.types.t_string;this.unify(Pt,G.TFloat,v),this.unify(Tl,G.TFloat,M)}break;case 3:switch(mt._hx_index){case 2:case 3:return G.TFloat;case 5:return G.TDynamic;default:let Pt=pl,Tl=mt;if(this.isString(Pt)||this.isString(Tl))return this.types.t_string;this.unify(Pt,G.TFloat,v),this.unify(Tl,G.TFloat,M)}break;case 5:return G.TDynamic;default:if(mt._hx_index==5)return G.TDynamic;{let Pt=pl,Tl=mt;if(this.isString(Pt)||this.isString(Tl))return this.types.t_string;this.unify(Pt,G.TFloat,v),this.unify(Tl,G.TFloat,M)}}break;case"...":return this.typeExprWith(v,G.TInt),this.typeExprWith(M,G.TInt),this.makeIterator(G.TInt);case"&":case"<<":case">>":case">>>":case"^":case"|":return this.typeExprWith(v,G.TInt),this.typeExprWith(M,G.TInt),G.TInt;case"<":case"<=":case">":case">=":let Qt=this.typeExpr(v,ve.Value),zl=this.typeExpr(M,ve.WithType(Qt));this.tryUnify(Qt,zl)||this.unify(zl,Qt,M);let pi=this.follow(Qt);switch(pi._hx_index){case 2:case 3:case 4:break;case 9:let Pt=pi.c,Tl=pi.args,dn=Pt.constructor,jn=Pt.fields,Kn=Pt.interfaces,Jn=Pt.isInterface,Hn=Pt.meta,Gn=Pt.params,Qn=Pt.statics,$n=Pt.superClass;if(Pt.name!="String"){let Vn=Te.ECustom("Cannot compare "+tt.typeStr(Qt)),qn=new Se(Vn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(qn)}break;default:let Rn=Te.ECustom("Cannot compare "+tt.typeStr(Qt)),Un=new Se(Rn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(Un)}return G.TBool;case"=":if(this.allowDefine){let Pt=v.e;if(Pt._hx_index==1){let Tl=Pt.v;if(!Object.prototype.hasOwnProperty.call(this.locals.h,Tl)&&!Object.prototype.hasOwnProperty.call(this.globals.h,Tl)){let dn=this.typeExpr(M,ve.Value);return this.locals.h[Tl]=dn,dn}}}let Ai,an=v.e;if(an._hx_index==5){let Pt=an.e,Tl=an.f;Ai=this.typeField(Pt,Tl,v,!0)}else Ai=this.typeExpr(v,ve.Value);return this.typeExprWith(M,Ai),Ai;case"&&":case"||":return this.typeExprWith(v,G.TBool),this.typeExprWith(M,G.TBool),G.TBool;default:if(c.cca(E,E.length-1)==61){let Pt=this.typeExpr(this.mk(K.EBinop(c.substr(E,0,E.length-1),v,M),e),t);return this.typeExpr(this.mk(K.EBinop("=",v,M),e),t)}let Dn=Te.ECustom("Unsupported operation "+E),An=new Se(Dn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(An)}break;case 7:let A=i.prefix,L=i.op,I=i.e,q=this.typeExpr(I,ve.Value);switch(L){case"!":return this.unify(q,G.TBool,I),q;case"++":case"-":case"--":return this.unify(q,G.TInt,I),q;default:}break;case 8:let z=i.e,P=i.params,B=z.e;if(B._hx_index==5&&B.f=="bind"){let fe=B.e,ke=this.typeExpr(fe,ve.Value);if(ke._hx_index==13){let Fe=ke.args,We=ke.ret,Wt=Fe.slice(),Dt=0;for(;Dt<P.length;){let ut=P[Dt];++Dt;let vl=Wt.shift();if(vl==null){let pl=Te.ECustom("Too many arguments"),mt=new Se(pl,ut.pmin,ut.pmax,ut.origin,ut.line);if(!this.isCompletion)throw C.thrown(mt);return G.TFun([],We)}this.typeExprWith(ut,vl.t)}return G.TFun(Wt,We)}}let N=z.e,D;if(N._hx_index==1){let fe=N.v;if(t._hx_index==2){let ke=t.t;if(ke._hx_index==10){let Fe=ke.e,We=ke.args;D=t}else D=ve.Value}else D=ve.Value}else D=ve.Value;let U=this.typeExpr(z,D),W=this.follow(U);switch(W._hx_index){case 5:let fe=0;for(;fe<P.length;){let mt=P[fe];++fe,this.typeExpr(mt,ve.Value)}return this.makeMono();case 13:let ke=W.args,Fe=W.ret,We=0,Wt=P.length;for(;We<Wt;){let mt=We++,Qt=ke[mt];if(Qt==null){let pi=P[mt],Ai=Te.ECustom("Too many arguments"),an=new Se(Ai,pi.pmin,pi.pmax,pi.origin,pi.line);if(!this.isCompletion)throw C.thrown(an);break}let zl=this.typeExpr(P[mt],Qt==null?ve.Value:ve.WithType(Qt.t));this.unify(zl,Qt.t,P[mt])}let Dt=P.length,ut=ke.length;for(;Dt<ut;){let mt=Dt++;if(!ke[mt].opt){let Qt=Te.ECustom("Missing argument "+ke[mt].name+":"+tt.typeStr(ke[mt].t)),zl=new Se(Qt,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(zl)}}return Fe;default:let vl=Te.ECustom(tt.typeStr(U)+" cannot be called"),pl=new Se(vl,z.pmin,z.pmax,z.origin,z.line);if(!this.isCompletion)throw C.thrown(pl);return this.makeMono()}break;case 9:let J=i.cond,H=i.e1,X=i.e2;this.typeExprWith(J,G.TBool);let ae=this.typeExpr(H,t);if(X==null)return ae;let ce=this.typeExpr(X,t);if(t==ve.NoValue)return G.TVoid;if(this.tryUnify(ce,ae))return ae;if(this.tryUnify(ae,ce))return ce;this.unify(ce,ae,X);break;case 10:let ne=i.cond,re=i.e;return this.typeExprWith(ne,G.TBool),this.typeExpr(re,ve.NoValue),G.TVoid;case 11:let xe=i.v,Pe=i.it,Ue=i.e,Je=this.saveLocals(),lt=this.typeExpr(Pe,ve.Value),Ve=this.getIteratorType(Pe,lt);return this.locals.h[xe]=Ve,this.typeExpr(Ue,ve.NoValue),this.locals=Je,G.TVoid;case 12:case 13:return G.TVoid;case 14:let Qe=i.args,at=i.e,Re=i.name,$=i.ret,se=null,j=null,ie=null;if(this.currentFunType!=null){let fe=this.currentFunType;if(fe._hx_index==13){let ke=fe.args,Fe=fe.ret;se=this.currentFunType,j=Fe,ie=ke}else throw C.thrown("assert");this.currentFunType=null}else j=$==null?this.makeMono():this.makeType($,e);let le=this.saveLocals(),ee=this.allowReturn,pe=this.allowDefine,me=this.hasReturn;this.allowReturn=j,this.allowDefine=!1,this.hasReturn=!1;let we=null,Ze;if(Re!=null){let fe;if(t._hx_index==2){let ke=this.follow(t.t);if(ke._hx_index==13){let Fe=ke.args,We=ke.ret;fe=!0}else fe=!1}else fe=!1;Ze=!fe}else Ze=!1;if(Ze){let fe=this.events.h[Re];fe!=null&&(t=ve.WithType(fe))}if(t._hx_index==2){let fe=this.follow(t.t);if(fe._hx_index==13){let ke=fe.args,Fe=fe.ret;we=ke,this.unify(j,Fe,e)}}ie==null&&(ie=this.typeArgs(Qe,e));let yt=0,Le=ie.length;for(;yt<Le;){let fe=yt++,ke=ie[fe];if(we!=null)if(fe<we.length)this.unify(we[fe].t,ke.t,e);else{let Fe=Te.ECustom("Extra argument "+ke.name),We=new Se(Fe,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(We)}this.locals.h[ke.name]=ke.t}if(we!=null&&ie.length<we.length){let fe="Missing "+(we.length-ie.length)+" arguments (",ke=[],Fe=ie.length,We=we.length;for(;Fe<We;){let ut=Fe++;ke.push(tt.typeStr(we[ut].t))}let Wt=Te.ECustom(fe+ke.join(",")+")"),Dt=new Se(Wt,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(Dt)}if(this.typeExpr(at,ve.NoValue),!this.hasReturn&&!this.tryUnify(j,G.TVoid)){let fe=Te.ECustom("Missing return "+tt.typeStr(j)),ke=new Se(fe,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(ke)}return this.allowDefine=pe,this.allowReturn=ee,this.hasReturn=me,this.locals=le,se==null&&(se=G.TFun(ie,j),Re!=null&&(le.h[Re]=se)),se;case 15:let dt=i.e,Oe=dt==null?G.TVoid:this.typeExpr(dt,this.allowReturn==null?ve.Value:ve.WithType(this.allowReturn));if(this.hasReturn=!0,this.allowReturn==null){let fe=Te.ECustom("Return not allowed here"),ke=new Se(fe,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(ke)}else this.unify(Oe,this.allowReturn,dt??e);return this.makeMono();case 16:let Ie=i.e,pt=i.index;this.typeExprWith(pt,G.TInt);let it=this.typeExpr(Ie,ve.Value),Ot=this.follow(it);if(Ot._hx_index==9){let fe=Ot.c,ke=Ot.args,Fe=fe.constructor,We=fe.fields,Wt=fe.interfaces,Dt=fe.isInterface,ut=fe.meta,vl=fe.params,pl=fe.statics,mt=fe.superClass;if(fe.name=="Array"){if(ke.length==1)return ke[0];{let Qt=Te.ECustom(tt.typeStr(it)+" is not an Array"),zl=new Se(Qt,Ie.pmin,Ie.pmax,Ie.origin,Ie.line);if(!this.isCompletion)throw C.thrown(zl)}}else{let Qt=Te.ECustom(tt.typeStr(it)+" is not an Array"),zl=new Se(Qt,Ie.pmin,Ie.pmax,Ie.origin,Ie.line);if(!this.isCompletion)throw C.thrown(zl)}}else{let fe=Te.ECustom(tt.typeStr(it)+" is not an Array"),ke=new Se(fe,Ie.pmin,Ie.pmax,Ie.origin,Ie.line);if(!this.isCompletion)throw C.thrown(ke)}break;case 17:let Yt=i.e,xt=null,ol=0;for(;ol<Yt.length;){let fe=Yt[ol];++ol;let ke=this.typeExpr(fe,xt==null?ve.Value:ve.WithType(xt));xt==null?xt=ke:this.tryUnify(ke,xt)||(this.tryUnify(xt,ke)?xt=ke:this.unify(ke,xt,fe))}return xt==null&&(xt=this.makeMono()),this.types.getType("Array",[xt]);case 18:let $e=i.cl,Vt=i.params;break;case 19:let Bt=i.e;return this.typeExpr(Bt,ve.Value),this.makeMono();case 20:let qt=i.e,wt=i.v,Ht=i.t,Zt=i.ecatch,Gt=this.typeExpr(qt,t),ul=this.locals.h[wt],cl=this.locals,Xt=this.makeType(Ht,Zt);cl.h[wt]=Xt;let nt=this.typeExpr(Zt,t);if(ul!=null)this.locals.h[wt]=ul;else{let fe=this.locals;Object.prototype.hasOwnProperty.call(fe.h,wt)&&delete fe.h[wt]}return t==ve.NoValue?G.TVoid:this.tryUnify(Gt,nt)?nt:(this.unify(nt,Gt,Zt),Gt);case 21:let Sl=i.fl;if(t._hx_index==2){let fe=this.follow(t.t);if(fe._hx_index==14){let ke=fe.fields;if(ke.length>0){let Fe=Object.create(null),We=0;for(;We<ke.length;){let ut=ke[We];++We,Fe[ut.name]=ut}let Wt=[],Dt=0;for(;Dt<Sl.length;){let ut=Sl[Dt];++Dt;let vl=Fe[ut.name],pl;if(vl==null){let mt=ut.e,Qt=Te.ECustom("Extra field "+ut.name),zl=new Se(Qt,mt.pmin,mt.pmax,mt.origin,mt.line);if(!this.isCompletion)throw C.thrown(zl);pl=G.TDynamic}else pl=vl.t;Wt.push({t:this.typeExprWith(ut.e,pl),opt:!1,name:ut.name})}return G.TAnon(Wt)}else{let Fe=[],We=0;for(;We<Sl.length;){let Wt=Sl[We];++We,Fe.push({t:this.typeExpr(Wt.e,ve.Value),opt:!1,name:Wt.name})}return G.TAnon(Fe)}}else{let ke=[],Fe=0;for(;Fe<Sl.length;){let We=Sl[Fe];++Fe,ke.push({t:this.typeExpr(We.e,ve.Value),opt:!1,name:We.name})}return G.TAnon(ke)}}else{let fe=[],ke=0;for(;ke<Sl.length;){let Fe=Sl[ke];++ke,fe.push({t:this.typeExpr(Fe.e,ve.Value),opt:!1,name:Fe.name})}return G.TAnon(fe)}break;case 22:let Ce=i.cond,rt=i.e1,_t=i.e2;this.typeExprWith(Ce,G.TBool);let ot=this.typeExpr(rt,t);if(_t==null)return ot;let bt=this.typeExpr(_t,t);if(t==ve.NoValue)return G.TVoid;if(this.tryUnify(bt,ot))return ot;if(this.tryUnify(ot,bt))return bt;this.unify(bt,ot,_t);break;case 23:let Ct=i.e,Ft=i.cases,el=i.defaultExpr,Tt=null,rn=this.typeExpr(Ct,ve.Value),yi=0;for(;yi<Ft.length;){let fe=Ft[yi];++yi;let ke=0,Fe=fe.values;for(;ke<Fe.length;){let Dt=Fe[ke];++ke;let ut=this.typeExpr(Dt,ve.WithType(rn));this.unify(ut,rn,Dt)}let We=this.typeExpr(fe.expr,t),Wt=fe.expr;t!=ve.NoValue&&(Tt==null?Tt=We:l.tryUnify(We,Tt)||(l.unify(Tt,We,Wt),Tt=We))}if(el!=null){let fe=this.typeExpr(el,t);t!=ve.NoValue&&(Tt==null?Tt=fe:l.tryUnify(fe,Tt)||(l.unify(Tt,fe,el),Tt=fe))}return t==ve.NoValue?G.TVoid:Tt??this.makeMono();case 24:let si=i.cond,mn=i.e;return this.typeExprWith(si,G.TBool),this.typeExpr(mn,ve.NoValue),G.TVoid;case 25:let zn=i.args,Mn=i.name,Fn=i.e;return Mn==":untyped"&&this.allowUntypedMeta?this.makeMono():this.typeExpr(Fn,t);case 26:let Cn=i.e,Ln=i.t,gn=this.makeType(Ln,e),Bn=this.typeExpr(Cn,ve.WithType(gn));return this.unify(Bn,gn,Cn),gn}let n=e.e,s=Te.ECustom("Don't know how to type "+Ye[n.__enum__].__constructs__[n._hx_index]._hx_name),r=new Se(s,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(r);return G.TDynamic}getIteratorType(e,t){let l=this.follow(t);if(l._hx_index==9){let r=l.c,a=l.args,h=r.constructor,o=r.fields,u=r.interfaces,p=r.isInterface,_=r.meta,m=r.params,f=r.statics,g=r.superClass;if(r.name=="Array"&&a.length==1)return a[0]}let i=this.getField(t,"iterator",e);if(i==null&&t._hx_index==12){let r=t.a,a=t.args,h=this.apply(r.t,r.params,a);return this.getIteratorType(e,h)}i!=null&&(i==null?i=null:i._hx_index==13&&i.args.length==0?i=i.ret:i=null);let n=this.makeMono(),s=this.makeIterator(n);return this.unify(i??t,s,e),n}static typeStr(e){switch(e._hx_index){case 0:let t=e.r;return t.r==null?"Unknown":tt.typeStr(t.r);case 6:return e.name;case 7:return"?"+e.name;case 8:let n=e.t;return"Null<"+tt.typeStr(n)+">";case 9:let s=e.c,r=e.args,a=s.name,h;if(r.length==0)h="";else{let L=[],I=0;for(;I<r.length;){let q=r[I];++I,L.push(tt.typeStr(q))}h="<"+L.join(",")+">"}return a+h;case 10:let o=e.e,u=e.args,p=o.name,_;if(u.length==0)_="";else{let L=[],I=0;for(;I<u.length;){let q=u[I];++I,L.push(tt.typeStr(q))}_="<"+L.join(",")+">"}return p+_;case 11:let m=e.t,f=e.args;if(m.name=="loreline.lorscript.TypeCheck")return tt.typeStr(f[1]);{let L=m.name,I;if(f.length==0)I="";else{let q=[],z=0;for(;z<f.length;){let P=f[z];++z,q.push(tt.typeStr(P))}I="<"+q.join(",")+">"}return L+I}break;case 12:let g=e.a,d=e.args,w=g.name,y;if(d.length==0)y="";else{let L=[],I=0;for(;I<d.length;){let q=d[I];++I,L.push(tt.typeStr(q))}y="<"+L.join(",")+">"}return w+y;case 13:let S=e.args,T=e.ret,O=[],E=0;for(;E<S.length;){let L=S[E];++E,O.push((L.opt?"?":"")+(L.name==""?"":L.name+":")+tt.typeStr(L.t))}return"("+O.join(", ")+") -> "+tt.typeStr(T);case 14:let v=e.fields,M=[],A=0;for(;A<v.length;){let L=v[A];++A,M.push((L.opt?"?":"")+L.name+":"+tt.typeStr(L.t))}return"{"+M.join(", ")+"}";default:return c.substr(Ye[e.__enum__].__constructs__[e._hx_index]._hx_name,1,null)}}static typeIter(e,t){switch(e._hx_index){case 0:let l=e.r;l.r!=null&&t(l.r);break;case 8:let i=e.t;t(i);break;case 9:let n=e.c,s=e.args,r=0;for(;r<s.length;){let E=s[r];++r,t(E)}break;case 10:let a=e.e,h=e.args,o=0;for(;o<h.length;){let E=h[o];++o,t(E)}break;case 11:let u=e.t,p=e.args,_=0;for(;_<p.length;){let E=p[_];++_,t(E)}break;case 12:let m=e.a,f=e.args,g=0;for(;g<f.length;){let E=f[g];++g,t(E)}break;case 13:let d=e.args,w=e.ret,y=0;for(;y<d.length;){let E=d[y];++y,t(E.t)}t(w);break;case 14:let S=e.fields,T=0;for(;T<S.length;){let E=S[T];++T,t(E.t)}break;case 15:let O=e.f;t(O());break;default:}}}Q["loreline.lorscript.Checker"]=tt,tt.__name__="loreline.lorscript.Checker",Object.assign(tt.prototype,{__class__:tt});var yl=Ye["loreline.lorscript.Const"]={__ename__:"loreline.lorscript.Const",__constructs__:null,CInt:(x=function(b){return{_hx_index:0,v:b,__enum__:"loreline.lorscript.Const",toString:F}},x._hx_name="CInt",x.__params__=["v"],x),CFloat:(x=function(b){return{_hx_index:1,f:b,__enum__:"loreline.lorscript.Const",toString:F}},x._hx_name="CFloat",x.__params__=["f"],x),CString:(x=function(b){return{_hx_index:2,s:b,__enum__:"loreline.lorscript.Const",toString:F}},x._hx_name="CString",x.__params__=["s"],x)};yl.__constructs__=[yl.CInt,yl.CFloat,yl.CString];var K=Ye["loreline.lorscript.ExprDef"]={__ename__:"loreline.lorscript.ExprDef",__constructs__:null,EConst:(x=function(b){return{_hx_index:0,c:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EConst",x.__params__=["c"],x),EIdent:(x=function(b){return{_hx_index:1,v:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EIdent",x.__params__=["v"],x),EVar:(x=function(b,e,t){return{_hx_index:2,n:b,t:e,e:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EVar",x.__params__=["n","t","e"],x),EParent:(x=function(b){return{_hx_index:3,e:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EParent",x.__params__=["e"],x),EBlock:(x=function(b){return{_hx_index:4,e:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EBlock",x.__params__=["e"],x),EField:(x=function(b,e){return{_hx_index:5,e:b,f:e,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EField",x.__params__=["e","f"],x),EBinop:(x=function(b,e,t){return{_hx_index:6,op:b,e1:e,e2:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EBinop",x.__params__=["op","e1","e2"],x),EUnop:(x=function(b,e,t){return{_hx_index:7,op:b,prefix:e,e:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EUnop",x.__params__=["op","prefix","e"],x),ECall:(x=function(b,e){return{_hx_index:8,e:b,params:e,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="ECall",x.__params__=["e","params"],x),EIf:(x=function(b,e,t){return{_hx_index:9,cond:b,e1:e,e2:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EIf",x.__params__=["cond","e1","e2"],x),EWhile:(x=function(b,e){return{_hx_index:10,cond:b,e,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EWhile",x.__params__=["cond","e"],x),EFor:(x=function(b,e,t){return{_hx_index:11,v:b,it:e,e:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EFor",x.__params__=["v","it","e"],x),EBreak:{_hx_name:"EBreak",_hx_index:12,__enum__:"loreline.lorscript.ExprDef",toString:F},EContinue:{_hx_name:"EContinue",_hx_index:13,__enum__:"loreline.lorscript.ExprDef",toString:F},EFunction:(x=function(b,e,t,l){return{_hx_index:14,args:b,e,name:t,ret:l,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EFunction",x.__params__=["args","e","name","ret"],x),EReturn:(x=function(b){return{_hx_index:15,e:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EReturn",x.__params__=["e"],x),EArray:(x=function(b,e){return{_hx_index:16,e:b,index:e,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EArray",x.__params__=["e","index"],x),EArrayDecl:(x=function(b){return{_hx_index:17,e:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EArrayDecl",x.__params__=["e"],x),ENew:(x=function(b,e){return{_hx_index:18,cl:b,params:e,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="ENew",x.__params__=["cl","params"],x),EThrow:(x=function(b){return{_hx_index:19,e:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EThrow",x.__params__=["e"],x),ETry:(x=function(b,e,t,l){return{_hx_index:20,e:b,v:e,t,ecatch:l,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="ETry",x.__params__=["e","v","t","ecatch"],x),EObject:(x=function(b){return{_hx_index:21,fl:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EObject",x.__params__=["fl"],x),ETernary:(x=function(b,e,t){return{_hx_index:22,cond:b,e1:e,e2:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="ETernary",x.__params__=["cond","e1","e2"],x),ESwitch:(x=function(b,e,t){return{_hx_index:23,e:b,cases:e,defaultExpr:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="ESwitch",x.__params__=["e","cases","defaultExpr"],x),EDoWhile:(x=function(b,e){return{_hx_index:24,cond:b,e,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EDoWhile",x.__params__=["cond","e"],x),EMeta:(x=function(b,e,t){return{_hx_index:25,name:b,args:e,e:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EMeta",x.__params__=["name","args","e"],x),ECheckType:(x=function(b,e){return{_hx_index:26,e:b,t:e,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="ECheckType",x.__params__=["e","t"],x)};K.__constructs__=[K.EConst,K.EIdent,K.EVar,K.EParent,K.EBlock,K.EField,K.EBinop,K.EUnop,K.ECall,K.EIf,K.EWhile,K.EFor,K.EBreak,K.EContinue,K.EFunction,K.EReturn,K.EArray,K.EArrayDecl,K.ENew,K.EThrow,K.ETry,K.EObject,K.ETernary,K.ESwitch,K.EDoWhile,K.EMeta,K.ECheckType];var sl=Ye["loreline.lorscript.CType"]={__ename__:"loreline.lorscript.CType",__constructs__:null,CTPath:(x=function(b,e){return{_hx_index:0,path:b,params:e,__enum__:"loreline.lorscript.CType",toString:F}},x._hx_name="CTPath",x.__params__=["path","params"],x),CTFun:(x=function(b,e){return{_hx_index:1,args:b,ret:e,__enum__:"loreline.lorscript.CType",toString:F}},x._hx_name="CTFun",x.__params__=["args","ret"],x),CTAnon:(x=function(b){return{_hx_index:2,fields:b,__enum__:"loreline.lorscript.CType",toString:F}},x._hx_name="CTAnon",x.__params__=["fields"],x),CTParent:(x=function(b){return{_hx_index:3,t:b,__enum__:"loreline.lorscript.CType",toString:F}},x._hx_name="CTParent",x.__params__=["t"],x),CTOpt:(x=function(b){return{_hx_index:4,t:b,__enum__:"loreline.lorscript.CType",toString:F}},x._hx_name="CTOpt",x.__params__=["t"],x),CTNamed:(x=function(b,e){return{_hx_index:5,n:b,t:e,__enum__:"loreline.lorscript.CType",toString:F}},x._hx_name="CTNamed",x.__params__=["n","t"],x)};sl.__constructs__=[sl.CTPath,sl.CTFun,sl.CTAnon,sl.CTParent,sl.CTOpt,sl.CTNamed];class Se{constructor(e,t,l,i,n){this.e=e,this.pmin=t,this.pmax=l,this.origin=i,this.line=n}toString(){return ki.errorToString(this)}}Q["loreline.lorscript.Error"]=Se,Se.__name__="loreline.lorscript.Error",Object.assign(Se.prototype,{__class__:Se});var Te=Ye["loreline.lorscript.ErrorDef"]={__ename__:"loreline.lorscript.ErrorDef",__constructs__:null,EInvalidChar:(x=function(b){return{_hx_index:0,c:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},x._hx_name="EInvalidChar",x.__params__=["c"],x),EUnexpected:(x=function(b){return{_hx_index:1,s:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},x._hx_name="EUnexpected",x.__params__=["s"],x),EUnterminatedString:{_hx_name:"EUnterminatedString",_hx_index:2,__enum__:"loreline.lorscript.ErrorDef",toString:F},EUnterminatedComment:{_hx_name:"EUnterminatedComment",_hx_index:3,__enum__:"loreline.lorscript.ErrorDef",toString:F},EInvalidPreprocessor:(x=function(b){return{_hx_index:4,msg:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},x._hx_name="EInvalidPreprocessor",x.__params__=["msg"],x),EUnknownVariable:(x=function(b){return{_hx_index:5,v:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},x._hx_name="EUnknownVariable",x.__params__=["v"],x),EInvalidIterator:(x=function(b){return{_hx_index:6,v:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},x._hx_name="EInvalidIterator",x.__params__=["v"],x),EInvalidOp:(x=function(b){return{_hx_index:7,op:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},x._hx_name="EInvalidOp",x.__params__=["op"],x),EInvalidAccess:(x=function(b){return{_hx_index:8,f:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},x._hx_name="EInvalidAccess",x.__params__=["f"],x),ECustom:(x=function(b){return{_hx_index:9,msg:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},x._hx_name="ECustom",x.__params__=["msg"],x)};Te.__constructs__=[Te.EInvalidChar,Te.EUnexpected,Te.EUnterminatedString,Te.EUnterminatedComment,Te.EInvalidPreprocessor,Te.EUnknownVariable,Te.EInvalidIterator,Te.EInvalidOp,Te.EInvalidAccess,Te.ECustom];var ni=Ye["loreline.lorscript.ModuleDecl"]={__ename__:"loreline.lorscript.ModuleDecl",__constructs__:null,DPackage:(x=function(b){return{_hx_index:0,path:b,__enum__:"loreline.lorscript.ModuleDecl",toString:F}},x._hx_name="DPackage",x.__params__=["path"],x),DImport:(x=function(b,e){return{_hx_index:1,path:b,everything:e,__enum__:"loreline.lorscript.ModuleDecl",toString:F}},x._hx_name="DImport",x.__params__=["path","everything"],x),DClass:(x=function(b){return{_hx_index:2,c:b,__enum__:"loreline.lorscript.ModuleDecl",toString:F}},x._hx_name="DClass",x.__params__=["c"],x),DTypedef:(x=function(b){return{_hx_index:3,c:b,__enum__:"loreline.lorscript.ModuleDecl",toString:F}},x._hx_name="DTypedef",x.__params__=["c"],x)};ni.__constructs__=[ni.DPackage,ni.DImport,ni.DClass,ni.DTypedef];var Al=Ye["loreline.lorscript.FieldAccess"]={__ename__:"loreline.lorscript.FieldAccess",__constructs__:null,APublic:{_hx_name:"APublic",_hx_index:0,__enum__:"loreline.lorscript.FieldAccess",toString:F},APrivate:{_hx_name:"APrivate",_hx_index:1,__enum__:"loreline.lorscript.FieldAccess",toString:F},AInline:{_hx_name:"AInline",_hx_index:2,__enum__:"loreline.lorscript.FieldAccess",toString:F},AOverride:{_hx_name:"AOverride",_hx_index:3,__enum__:"loreline.lorscript.FieldAccess",toString:F},AStatic:{_hx_name:"AStatic",_hx_index:4,__enum__:"loreline.lorscript.FieldAccess",toString:F},AMacro:{_hx_name:"AMacro",_hx_index:5,__enum__:"loreline.lorscript.FieldAccess",toString:F}};Al.__constructs__=[Al.APublic,Al.APrivate,Al.AInline,Al.AOverride,Al.AStatic,Al.AMacro];var ln=Ye["loreline.lorscript.FieldKind"]={__ename__:"loreline.lorscript.FieldKind",__constructs__:null,KFunction:(x=function(b){return{_hx_index:0,f:b,__enum__:"loreline.lorscript.FieldKind",toString:F}},x._hx_name="KFunction",x.__params__=["f"],x),KVar:(x=function(b){return{_hx_index:1,v:b,__enum__:"loreline.lorscript.FieldKind",toString:F}},x._hx_name="KVar",x.__params__=["v"],x)};ln.__constructs__=[ln.KFunction,ln.KVar];var Rl=Ye["loreline.lorscript._Interp.Stop"]={__ename__:"loreline.lorscript._Interp.Stop",__constructs__:null,SBreak:{_hx_name:"SBreak",_hx_index:0,__enum__:"loreline.lorscript._Interp.Stop",toString:F},SContinue:{_hx_name:"SContinue",_hx_index:1,__enum__:"loreline.lorscript._Interp.Stop",toString:F},SReturn:{_hx_name:"SReturn",_hx_index:2,__enum__:"loreline.lorscript._Interp.Stop",toString:F}};Rl.__constructs__=[Rl.SBreak,Rl.SContinue,Rl.SReturn];class nn{constructor(e){this.interpreter=e,this.locals=new Ee,this.declared=[],this.resetVariables(),this.initOps()}resetVariables(){this.variables=new Ee,this.variables.h.null=null,this.variables.h.true=!0,this.variables.h.false=!1;let e=this,t=this.variables,l=qe.makeVarArgs(function(i){let n=e.posInfos(),s=i.shift();i.length>0&&(n.customParams=i),Ri.trace(Y.string(s),n)});t.h.trace=l}posInfos(){return this.curExpr!=null?{fileName:this.curExpr.origin,lineNumber:this.curExpr.line}:{fileName:"lorscript",lineNumber:0}}initOps(){let e=this;this.binops=new Ee,this.binops.h["+"]=function(t,l){return e.expr(t)+e.expr(l)},this.binops.h["-"]=function(t,l){return e.expr(t)-e.expr(l)},this.binops.h["*"]=function(t,l){return e.expr(t)*e.expr(l)},this.binops.h["/"]=function(t,l){return e.expr(t)/e.expr(l)},this.binops.h["%"]=function(t,l){return e.expr(t)%e.expr(l)},this.binops.h["&"]=function(t,l){return e.expr(t)&e.expr(l)},this.binops.h["|"]=function(t,l){return e.expr(t)|e.expr(l)},this.binops.h["^"]=function(t,l){return e.expr(t)^e.expr(l)},this.binops.h["<<"]=function(t,l){return e.expr(t)<<e.expr(l)},this.binops.h[">>"]=function(t,l){return e.expr(t)>>e.expr(l)},this.binops.h[">>>"]=function(t,l){return e.expr(t)>>>e.expr(l)},this.binops.h["=="]=function(t,l){return e.expr(t)==e.expr(l)},this.binops.h["!="]=function(t,l){return e.expr(t)!=e.expr(l)},this.binops.h[">="]=function(t,l){let i=e.expr(t),n=e.expr(l);return i>=n},this.binops.h["<="]=function(t,l){let i=e.expr(t),n=e.expr(l);return i<=n},this.binops.h[">"]=function(t,l){let i=e.expr(t),n=e.expr(l);return i>n},this.binops.h["<"]=function(t,l){let i=e.expr(t),n=e.expr(l);return i<n},this.binops.h["||"]=function(t,l){return e.expr(t)!=!0?e.expr(l)==!0:!0},this.binops.h["&&"]=function(t,l){return e.expr(t)==!0?e.expr(l)==!0:!1},this.binops.h["="]=be(this,this.assign),this.binops.h["..."]=function(t,l){return new bi(e.expr(t),e.expr(l))},this.binops.h.is=function(t,l){return te.__instanceof(e.expr(t),e.expr(l))},this.assignOp("+=",function(t,l){return t+l}),this.assignOp("-=",function(t,l){return t-l}),this.assignOp("*=",function(t,l){return t*l}),this.assignOp("/=",function(t,l){return t/l}),this.assignOp("%=",function(t,l){return t%l}),this.assignOp("&=",function(t,l){return t&l}),this.assignOp("|=",function(t,l){return t|l}),this.assignOp("^=",function(t,l){return t^l}),this.assignOp("<<=",function(t,l){return t<<l}),this.assignOp(">>=",function(t,l){return t>>l}),this.assignOp(">>>=",function(t,l){return t>>>l})}setVar(e,t){if(!Object.prototype.hasOwnProperty.call(this.variables.h,e))oe.setField(this.interpreter,this.interpreter.topLevelState.fields,e,t);else throw C.thrown("Invalid assign");return t}assign(e,t){let l=this.expr(t),i=e.e;switch(i._hx_index){case 1:let n=i.v,s=this.locals.h[n];s==null?this.setVar(n,l):s.r=l;break;case 5:let r=i.e,a=i.f;l=this.set(this.expr(r),a,l);break;case 16:let h=i.e,o=i.index,u=this.expr(h),p=this.expr(o);he.isArray(u)?he.arraySet(u,p,l):oe.isFields(u)?oe.setField(this.interpreter,u,p,l):te.__implements(u,Et)?te.__cast(u,Et).set(p,l):u[p]=l;break;default:let _=new Se(Te.EInvalidOp("="),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(_)}return l}assignOp(e,t){let l=this;this.binops.h[e]=function(i,n){return l.evalAssignOp(e,t,i,n)}}evalAssignOp(e,t,l,i){let n,s=l.e;switch(s._hx_index){case 1:let r=s.v,a=this.locals.h[r];n=t(this.expr(l),this.expr(i)),a==null?this.setVar(r,n):a.r=n;break;case 5:let h=s.e,o=s.f,u=this.expr(h);n=t(this.get(u,o),this.expr(i)),n=this.set(u,o,n);break;case 16:let p=s.e,_=s.index,m=this.expr(p),f=this.expr(_);he.isArray(m)?(n=t(he.arrayGet(m,f),this.expr(i)),he.arraySet(m,f,n)):oe.isFields(m)?(n=t(oe.getField(this.interpreter,m,f),this.expr(i)),oe.setField(this.interpreter,m,f,n)):te.__implements(m,Et)?(n=t(te.__cast(m,Et).get(f),this.expr(i)),te.__cast(m,Et).set(f,n)):(n=t(m[f],this.expr(i)),m[f]=n);break;default:let g=new Se(Te.EInvalidOp(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(g)}return n}increment(e,t,l){this.curExpr=e;let i=e.e;switch(i._hx_index){case 1:let n=i.v,s=this.locals.h[n],r=s==null?this.resolve(n):s.r;return t?(r+=l,s==null?this.setVar(n,r):s.r=r):s==null?this.setVar(n,r+l):s.r=r+l,r;case 5:let a=i.e,h=i.f,o=this.expr(a),u=this.get(o,h);return t?(u+=l,this.set(o,h,u)):this.set(o,h,u+l),u;case 16:let p=i.e,_=i.index,m=this.expr(p),f=this.expr(_);if(he.isArray(m)){let d=he.arrayGet(m,f);return t?(d+=l,he.arraySet(m,f,d)):he.arraySet(m,f,d+l),d}else if(oe.isFields(m)){let d=oe.getField(this.interpreter,m,f);return t?(d+=l,oe.setField(this.interpreter,m,f,d)):oe.setField(this.interpreter,m,f,d+l),d}else if(te.__implements(m,Et)){let d=te.__cast(m,Et).get(f);return t?(d+=l,te.__cast(m,Et).set(f,d)):te.__cast(m,Et).set(f,d+l),d}else{let d=m[f];return t?(d+=l,m[f]=d):m[f]=d+l,d}break;default:let g=new Se(Te.EInvalidOp(l>0?"++":"--"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(g)}}execute(e){return this.depth=0,this.locals=new Ee,this.declared=[],this.exprReturn(e)}exprReturn(e){try{return this.expr(e)}catch(t){let l=C.caught(t).unwrap();if(te.__instanceof(l,Rl))switch(l._hx_index){case 0:throw C.thrown("Invalid break");case 1:throw C.thrown("Invalid continue");case 2:let n=this.returnValue;return this.returnValue=null,n}else throw t}}duplicate(e){let t=new Ee,l=e.h,i=l,n=Object.keys(l),s=n.length,r=0;for(;r<s;){let a=n[r++];t.h[a]=e.h[a]}return t}restore(e){for(;this.declared.length>e;){let t=this.declared.pop();this.locals.h[t.n]=t.old}}error(e,t){t==null&&(t=!1);let l=new Se(e,this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(l)}rethrow(e){throw C.thrown(e)}resolve(e){let t=this.variables.h[e];if(t==null&&!Object.prototype.hasOwnProperty.call(this.variables.h,e)){if(oe.fieldExists(this.interpreter,this.interpreter.topLevelState.fields,e))return oe.getField(this.interpreter,this.interpreter.topLevelState.fields,e);if(Object.prototype.hasOwnProperty.call(this.interpreter.topLevelCharacters.h,e))return this.interpreter.topLevelCharacters.h[e].fields;if(Object.prototype.hasOwnProperty.call(this.interpreter.topLevelFunctions.h,e))return this.interpreter.topLevelFunctions.h[e];let l=this.interpreter.resolveBeatByName(e);if(l!=null)return l;let i=new Se(Te.EUnknownVariable(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(i)}return t}expr(e){this.curExpr=e;let t=e.e,l=this;switch(t._hx_index){case 0:let i=t.c;switch(i._hx_index){case 0:return i.v;case 1:return i.f;case 2:return i.s}break;case 1:let n=t.v,s=this.locals.h[n];return s!=null?s.r:this.resolve(n);case 2:let r=t.t,a=t.n,h=t.e;this.declared.push({n:a,old:this.locals.h[a]});let o=this.locals,u=h==null?null:this.expr(h);return o.h[a]={r:u},null;case 3:let p=t.e;return this.expr(p);case 4:let _=t.e,m=this.declared.length,f=null,g=0;for(;g<_.length;){let Ce=_[g];++g,f=this.expr(Ce)}return this.restore(m),f;case 5:let d=t.e,w=t.f;return this.get(this.expr(d),w);case 6:let y=t.op,S=t.e1,T=t.e2,O=this.binops.h[y];if(O==null){let Ce=new Se(Te.EInvalidOp(y),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(Ce)}return O(S,T);case 7:let E=t.op,v=t.prefix,M=t.e;switch(E){case"!":return this.expr(M)!=!0;case"++":return this.increment(M,v,1);case"-":return-this.expr(M);case"--":return this.increment(M,v,-1);case"~":return~this.expr(M);default:let Ce=new Se(Te.EInvalidOp(E),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(Ce)}break;case 8:let A=t.e,L=t.params,I=[],q=0;for(;q<L.length;){let Ce=L[q];++q,I.push(this.expr(Ce))}let z=A.e;if(z._hx_index==5){let Ce=z.e,rt=z.f,_t=this.expr(Ce);if(_t==null){let ot=new Se(Te.EInvalidAccess(rt),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(ot)}return this.fcall(_t,rt,I)}else return this.call(null,this.expr(A),I);break;case 9:let P=t.cond,B=t.e1,N=t.e2;return this.expr(P)==!0?this.expr(B):N==null?null:this.expr(N);case 10:let D=t.cond,U=t.e;return this.whileLoop(D,U),null;case 11:let W=t.v,J=t.it,H=t.e;return this.forLoop(W,J,H),null;case 12:throw C.thrown(Rl.SBreak);case 13:throw C.thrown(Rl.SContinue);case 14:let X=t.ret,ae=t.args,ce=t.e,ne=t.name,re=this.duplicate(this.locals),xe=this,Pe=!1,Ue=0,Je=0;for(;Je<ae.length;){let Ce=ae[Je];++Je,Ce.opt||Ce.value!=null?Pe=!0:Ue+=1}let lt=function(Ce){if((Ce==null?0:Ce.length)!=ae.length){if(Ce.length<Ue){let si="Invalid number of parameters. Got "+Ce.length+", required "+Ue;ne!=null&&(si+=" for function '"+ne+"'");let mn=new Se(Te.ECustom(si),l.curExpr.pmin,l.curExpr.pmax,l.curExpr.origin,l.curExpr.line);throw C.thrown(mn)}let el=[],Tt=Ce.length-Ue,rn=0,yi=0;for(;yi<ae.length;){let si=ae[yi];++yi,si.opt||si.value!=null?Tt>0?(el.push(Ce[rn++]),--Tt):el.push(si.value!=null?xe.expr(si.value):null):el.push(Ce[rn++])}Ce=el}let rt=xe.locals,_t=xe.depth;xe.depth++,xe.locals=xe.duplicate(re);let ot=0,bt=ae.length;for(;ot<bt;){let el=ot++;xe.locals.h[ae[el].name]={r:Ce[el]}}let Ct=null,Ft=l.declared.length;if(l.inTry)try{Ct=xe.exprReturn(ce)}catch(el){let Tt=C.caught(el).unwrap();throw l.restore(Ft),xe.locals=rt,xe.depth=_t,C.thrown(Tt)}else Ct=xe.exprReturn(ce);return l.restore(Ft),xe.locals=rt,xe.depth=_t,Ct},Ve=qe.makeVarArgs(lt);if(ne!=null)if(this.depth==0)this.variables.h[ne]=Ve;else{this.declared.push({n:ne,old:this.locals.h[ne]});let Ce={r:Ve};this.locals.h[ne]=Ce,re.h[ne]=Ce}return Ve;case 15:let Qe=t.e;throw this.returnValue=Qe==null?null:this.expr(Qe),C.thrown(Rl.SReturn);case 16:let at=t.e,Re=t.index,$=this.expr(at),se=this.expr(Re);return he.isArray($)?he.arrayGet($,se):oe.isFields($)?oe.getField(this.interpreter,$,se):te.__implements($,Et)?te.__cast($,Et).get(se):$[se];case 17:let j=t.e,ie;if(j.length>0){let Ce=j[0].e;if(Ce._hx_index==6){let rt=Ce.e1,_t=Ce.e2;ie=Ce.op=="=>"}else ie=!1}else ie=!1;if(ie){let Ce=[],rt=[],_t=0;for(;_t<j.length;){let ot=j[_t];++_t;let bt=ot.e;if(bt._hx_index==6)if(bt.op=="=>"){let Ct=bt.e1,Ft=bt.e2;Ce.push(this.expr(Ct)),rt.push(this.expr(Ft))}else{this.curExpr=ot;let Ct=new Se(Te.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(Ct)}else{this.curExpr=ot;let Ct=new Se(Te.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(Ct)}}return this.makeMap(Ce,rt)}else{let Ce=[],rt=0;for(;rt<j.length;){let _t=j[rt];++rt,Ce.push(this.expr(_t))}return Ce}break;case 18:let le=t.cl,ee=t.params,pe=[],me=0;for(;me<ee.length;){let Ce=ee[me];++me,pe.push(this.expr(Ce))}return this.cnew(le,pe);case 19:let we=t.e;throw C.thrown(this.expr(we));case 20:let Ze=t.t,yt=t.e,Le=t.v,dt=t.ecatch,Oe=this.declared.length,Ie=this.inTry;try{this.inTry=!0;let Ce=this.expr(yt);return this.restore(Oe),this.inTry=Ie,Ce}catch(Ce){let rt=C.caught(Ce).unwrap();if(te.__instanceof(rt,Rl)){let _t=rt;throw this.inTry=Ie,C.thrown(_t)}else{let _t=rt;this.restore(Oe),this.inTry=Ie,this.declared.push({n:Le,old:this.locals.h[Le]}),this.locals.h[Le]={r:_t};let ot=this.expr(dt);return this.restore(Oe),ot}}break;case 21:let pt=t.fl,it=oe.createFields(this.interpreter),Ot=0;for(;Ot<pt.length;){let Ce=pt[Ot];++Ot,oe.setField(this.interpreter,it,Ce.name,this.expr(Ce.e))}return it;case 22:let Yt=t.cond,xt=t.e1,ol=t.e2;return this.expr(Yt)==!0?this.expr(xt):this.expr(ol);case 23:let $e=t.e,Vt=t.cases,Bt=t.defaultExpr,qt=this.expr($e),wt=!1,Ht=0;for(;Ht<Vt.length;){let Ce=Vt[Ht];++Ht;let rt=0,_t=Ce.values;for(;rt<_t.length;){let ot=_t[rt];if(++rt,this.expr(ot)==qt){wt=!0;break}}if(wt){qt=this.expr(Ce.expr);break}}return wt||(qt=Bt==null?null:this.expr(Bt)),qt;case 24:let Zt=t.cond,Gt=t.e;return this.doWhileLoop(Zt,Gt),null;case 25:let ul=t.name,cl=t.args,Xt=t.e;return this.expr(Xt);case 26:let nt=t.t,Sl=t.e;return this.expr(Sl)}}doWhileLoop(e,t){let l=this.declared.length,i=this;do{let n=!0;try{i.expr(t)}catch(s){let r=C.caught(s).unwrap();if(te.__instanceof(r,Rl)){let a=r;switch(a._hx_index){case 0:n=!1;break;case 1:break;case 2:throw C.thrown(a)}}else throw s}if(!n)break}while(this.expr(e)==!0);this.restore(l)}whileLoop(e,t){let l=this.declared.length,i=this;for(;this.expr(e)==!0;){let n=!0;try{i.expr(t)}catch(s){let r=C.caught(s).unwrap();if(te.__instanceof(r,Rl)){let a=r;switch(a._hx_index){case 0:n=!1;break;case 1:break;case 2:throw C.thrown(a)}}else throw s}if(!n)break}this.restore(l)}makeIterator(e){if(e instanceof Array)return new Il(e);if(he.isArray(e))return he.getIterator(e);if(e.iterator!=null&&(e=bn(e)),e.hasNext==null||e.next==null){let t=new Se(Te.EInvalidIterator(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(t)}return e}forLoop(e,t,l){let i=this.declared.length;this.declared.push({n:e,old:this.locals.h[e]});let n=this.makeIterator(this.expr(t)),s=this;for(;n.hasNext();){let r=this.locals,a={r:n.next()};r.h[e]=a;let h=!0;try{s.expr(l)}catch(o){let u=C.caught(o).unwrap();if(te.__instanceof(u,Rl)){let p=u;switch(p._hx_index){case 0:h=!1;break;case 1:break;case 2:throw C.thrown(p)}}else throw o}if(!h)break}this.restore(i)}loopRun(e){let t=!0;try{e()}catch(l){let i=C.caught(l).unwrap();if(te.__instanceof(i,Rl)){let n=i;switch(n._hx_index){case 0:t=!1;break;case 1:break;case 2:throw C.thrown(n)}}else throw l}return t}isMap(e){return te.__implements(e,Et)}getMapValue(e,t){return te.__cast(e,Et).get(t)}setMapValue(e,t,l){te.__cast(e,Et).set(t,l)}makeMap(e,t){let l=!0,i=!0,n=!0,s=!0,r=0;for(;r<e.length;){let h=e[r];++r,l=l&&typeof h=="string",i=i&&typeof h=="number"&&(h|0)===h,n=n&&qe.isObject(h),s=s&&qe.isEnumValue(h)}if(i){let h=new Kl,o=0,u=e;for(;o<u.length;){let p=u[o],m=o++,f=p;h.h[f]=t[m]}return h}if(l){let h=new Ee,o=0,u=e;for(;o<u.length;){let p=u[o],m=o++,f=p;h.h[f]=t[m]}return h}if(s){let h=new ri,o=0,u=e;for(;o<u.length;){let p=u[o],m=o++,f=p;h.set(f,t[m])}return h}if(n){let h=new Ti,o=0,u=e;for(;o<u.length;){let p=u[o],m=o++,f=p;h.set(f,t[m])}return h}let a=new Se(Te.ECustom("Invalid map keys "+Y.string(e)),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(a)}get(e,t){if(e==null){let l=new Se(Te.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(l)}return oe.isFields(e)?oe.getField(this.interpreter,e,t):qe.getProperty(e,t)}set(e,t,l){if(e==null){let i=new Se(Te.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(i)}return oe.isFields(e)?(oe.setField(this.interpreter,e,t,l),l):(qe.setProperty(e,t,l),l)}fcall(e,t,l){let i=null;return typeof e=="string"?i=oe.getStringHelper(this.interpreter,t):he.isArray(e)?i=oe.getArrayHelper(this.interpreter,t):e instanceof Me?i=oe.getBeatHelper(this.interpreter,t):oe.isFields(e)&&(i=oe.getMapHelper(this.interpreter,t)),i!=null&&qe.isFunction(i)?(l.splice(0,0,e),this.call(null,i,l)):this.call(e,this.get(e,t),l)}call(e,t,l){return t.apply(e,l)}cnew(e,t){let l=Q[e];return l==null&&(l=this.resolve(e)),_e.createInstance(l,t)}static __keepIntIterator(){let e=new bi(0,0);return[be(e,e.hasNext),be(e,e.next)]}}Q["loreline.lorscript.Interp"]=nn,nn.__name__="loreline.lorscript.Interp",Object.assign(nn.prototype,{__class__:nn});var Z=Ye["loreline.lorscript.Token"]={__ename__:"loreline.lorscript.Token",__constructs__:null,TEof:{_hx_name:"TEof",_hx_index:0,__enum__:"loreline.lorscript.Token",toString:F},TConst:(x=function(b){return{_hx_index:1,c:b,__enum__:"loreline.lorscript.Token",toString:F}},x._hx_name="TConst",x.__params__=["c"],x),TId:(x=function(b){return{_hx_index:2,s:b,__enum__:"loreline.lorscript.Token",toString:F}},x._hx_name="TId",x.__params__=["s"],x),TOp:(x=function(b){return{_hx_index:3,s:b,__enum__:"loreline.lorscript.Token",toString:F}},x._hx_name="TOp",x.__params__=["s"],x),TPOpen:{_hx_name:"TPOpen",_hx_index:4,__enum__:"loreline.lorscript.Token",toString:F},TPClose:{_hx_name:"TPClose",_hx_index:5,__enum__:"loreline.lorscript.Token",toString:F},TBrOpen:{_hx_name:"TBrOpen",_hx_index:6,__enum__:"loreline.lorscript.Token",toString:F},TBrClose:{_hx_name:"TBrClose",_hx_index:7,__enum__:"loreline.lorscript.Token",toString:F},TDot:{_hx_name:"TDot",_hx_index:8,__enum__:"loreline.lorscript.Token",toString:F},TQuestionDot:{_hx_name:"TQuestionDot",_hx_index:9,__enum__:"loreline.lorscript.Token",toString:F},TComma:{_hx_name:"TComma",_hx_index:10,__enum__:"loreline.lorscript.Token",toString:F},TSemicolon:{_hx_name:"TSemicolon",_hx_index:11,__enum__:"loreline.lorscript.Token",toString:F},TBkOpen:{_hx_name:"TBkOpen",_hx_index:12,__enum__:"loreline.lorscript.Token",toString:F},TBkClose:{_hx_name:"TBkClose",_hx_index:13,__enum__:"loreline.lorscript.Token",toString:F},TQuestion:{_hx_name:"TQuestion",_hx_index:14,__enum__:"loreline.lorscript.Token",toString:F},TDoubleDot:{_hx_name:"TDoubleDot",_hx_index:15,__enum__:"loreline.lorscript.Token",toString:F},TMeta:(x=function(b){return{_hx_index:16,s:b,__enum__:"loreline.lorscript.Token",toString:F}},x._hx_name="TMeta",x.__params__=["s"],x),TPrepro:(x=function(b){return{_hx_index:17,s:b,__enum__:"loreline.lorscript.Token",toString:F}},x._hx_name="TPrepro",x.__params__=["s"],x)};Z.__constructs__=[Z.TEof,Z.TConst,Z.TId,Z.TOp,Z.TPOpen,Z.TPClose,Z.TBrOpen,Z.TBrClose,Z.TDot,Z.TQuestionDot,Z.TComma,Z.TSemicolon,Z.TBkOpen,Z.TBkClose,Z.TQuestion,Z.TDoubleDot,Z.TMeta,Z.TPrepro];class ci{constructor(){this.uid=0,this.preprocesorValues=new Ee,this.line=1,this.opChars="+*/-=!><&|^%~",this.identChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";let e=[["%"],["*","/"],["+","-"],["<<",">>",">>>"],["|","&","^"],["==","!=",">","<",">=","<="],["..."],["&&"],["||"],["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","&=","^=","=>"],["->"]];this.opPriority=new Ee,this.opRightAssoc=new Ee;let t=0,l=e.length;for(;t<l;){let a=t++,h=0,o=e[a];for(;h<o.length;){let u=o[h];++h,this.opPriority.h[u]=a,a==9&&(this.opRightAssoc.h[u]=!0)}}let i="!";this.opPriority.h[i]=i=="++"||i=="--"?-1:-2;let n="++";this.opPriority.h[n]=n=="++"||n=="--"?-1:-2;let s="--";this.opPriority.h[s]=s=="++"||s=="--"?-1:-2;let r="~";this.opPriority.h[r]=r=="++"||r=="--"?-1:-2}get_currentPos(){return this.readPos+this.offset}error(e,t,l){if(!this.resumeErrors)throw C.thrown(new Se(e,t,l,this.origin,this.line))}invalidChar(e){if(!this.resumeErrors)throw C.thrown(new Se(Te.EInvalidChar(e),this.readPos-1,this.readPos-1,this.origin,this.line))}initParser(e,t){this.preprocStack=[],this.origin=e,this.readPos=0,this.tokenMin=this.oldTokenMin=t,this.tokenMax=this.oldTokenMax=t,this.tokens=new Ui,this.offset=t,this.char=-1,this.ops=[],this.idents=[],this.uid=0;let l=0,i=this.opChars.length;for(;l<i;){let r=l++;this.ops[c.cca(this.opChars,r)]=!0}let n=0,s=this.identChars.length;for(;n<s;){let r=n++;this.idents[c.cca(this.identChars,r)]=!0}}parseString(e,t,l){l==null&&(l=0),t==null&&(t="loreline.lorscript"),this.initParser(t,l),this.input=e,this.readPos=0;let i=[];for(;;){let n=this.token();if(n==Z.TEof)break;this.tokens.push({t:n,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.parseFullExpr(i)}if(i.length==1)return i[0];{let n=K.EBlock(i),s=0,r=null;return n==null?null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),{e:n,pmin:s,pmax:r,origin:this.origin,line:this.line})}}unexpected(e){let t=Te.EUnexpected(this.tokenString(e));if(!this.resumeErrors)throw C.thrown(new Se(t,this.tokenMin,this.tokenMax,this.origin,this.line));return null}push(e){this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}ensure(e){let t=this.token();t!=e&&this.unexpected(t)}ensureToken(e){let t=this.token();_e.enumEq(t,e)||this.unexpected(t)}maybe(e){let t=this.token();return _e.enumEq(t,e)?!0:(this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,!1)}getIdent(){let e=this.token();return e._hx_index==2?e.s:(this.unexpected(e),null)}expr(e){return e.e}pmin(e){return e==null?0:e.pmin}pmax(e){return e==null?0:e.pmax}mk(e,t,l){return e==null?null:(t==null&&(t=this.tokenMin),l==null&&(l=this.tokenMax),{e,pmin:t,pmax:l,origin:this.origin,line:this.line})}isBlock(e){if(e==null)return!1;let t=e.e;switch(t._hx_index){case 2:let l=t.n,i=t.t,n=t.e;if(n!=null)return this.isBlock(n);if(i!=null){if(i==null)return!1;if(i._hx_index==2){let X=i.fields;return!0}else return!1}else return!1;break;case 4:let s=t.e;return!0;case 6:let r=t.op,a=t.e1,h=t.e2;return this.isBlock(h);case 7:let o=t.op,u=t.prefix,p=t.e;return u?!1:this.isBlock(p);case 9:let _=t.cond,m=t.e1,f=t.e2;return f!=null?this.isBlock(f):this.isBlock(m);case 10:let g=t.cond,d=t.e;return this.isBlock(d);case 11:let w=t.v,y=t.it,S=t.e;return this.isBlock(S);case 14:let T=t.args,O=t.name,E=t.ret,v=t.e;return this.isBlock(v);case 15:let M=t.e;return M!=null?this.isBlock(M):!1;case 20:let A=t.e,L=t.v,I=t.t,q=t.ecatch;return this.isBlock(q);case 21:let z=t.fl;return!0;case 23:let P=t.e,B=t.cases,N=t.defaultExpr;return!0;case 24:let D=t.cond,U=t.e;return this.isBlock(U);case 25:let W=t.name,J=t.args,H=t.e;return this.isBlock(H);default:return!1}}parseFullExpr(e){let t=this.parseExpr();e.push(t);let l=this.token();for(;;){let i;if(l==Z.TComma&&t!=null){let n=t.e;if(n._hx_index==2){let s=n.n,r=n.t,a=n.e;i=!0}else i=!1}else i=!1;if(!i)break;t=this.parseStructure("var"),e.push(t),l=this.token()}l!=Z.TSemicolon&&l!=Z.TEof&&(this.isBlock(t)?(this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):this.unexpected(l))}parseObject(e){let t=[];e:for(;;){let r=this.token(),a=null;switch(r._hx_index){case 1:let o=r.c;this.allowJSON||this.unexpected(r),o._hx_index==2?a=o.s:this.unexpected(r);break;case 2:a=r.s;break;case 7:break e;default:this.unexpected(r);break e}let h=this.token();switch(h!=Z.TDoubleDot&&this.unexpected(h),t.push({name:a,e:this.parseExpr()}),r=this.token(),r._hx_index){case 7:break e;case 10:break;default:this.unexpected(r)}}let l=K.EObject(t),i=e,n=null,s;return l==null?s=null:(i==null&&(i=this.tokenMin),n==null&&(n=this.tokenMax),s={e:l,pmin:i,pmax:n,origin:this.origin,line:this.line}),this.parseExprNext(s)}parseExpr(){let e=this.token(),t=this.tokenMin;switch(e._hx_index){case 1:let l=e.c,i=K.EConst(l),n=null,s=null,r;return i==null?r=null:(n==null&&(n=this.tokenMin),s==null&&(s=this.tokenMax),r={e:i,pmin:n,pmax:s,origin:this.origin,line:this.line}),this.parseExprNext(r);case 2:let a=e.s,h=this.parseStructure(a);if(h==null){let E=K.EIdent(a),v=null,M=null;E==null?h=null:(v==null&&(v=this.tokenMin),M==null&&(M=this.tokenMax),h={e:E,pmin:v,pmax:M,origin:this.origin,line:this.line})}return this.parseExprNext(h);case 3:let o=e.s;if(o=="-"){let E=this.tokenMin,v=this.parseExpr();if(v==null)return this.makeUnop(o,v);let M=v.e;if(M._hx_index==0){let A=M.c;switch(A._hx_index){case 0:let L=A.v,I=K.EConst(yl.CInt(-L)),q=E,z=v==null?0:v.pmax;return I==null?null:(q==null&&(q=this.tokenMin),z==null&&(z=this.tokenMax),{e:I,pmin:q,pmax:z,origin:this.origin,line:this.line});case 1:let P=A.f,B=K.EConst(yl.CFloat(-P)),N=E,D=v==null?0:v.pmax;return B==null?null:(N==null&&(N=this.tokenMin),D==null&&(D=this.tokenMax),{e:B,pmin:N,pmax:D,origin:this.origin,line:this.line});default:return this.makeUnop(o,v)}}else return this.makeUnop(o,v)}return this.opPriority.h[o]<0?this.makeUnop(o,this.parseExpr()):this.unexpected(e);case 4:if(e=this.token(),e==Z.TPClose){let E=this.token();_e.enumEq(E,Z.TOp("->"))||this.unexpected(E);let v=this.parseExpr(),M=K.EReturn(v),A=t,L=null,I;M==null?I=null:(A==null&&(A=this.tokenMin),L==null&&(L=this.tokenMax),I={e:M,pmin:A,pmax:L,origin:this.origin,line:this.line});let q=K.EFunction([],I),z=t,P=null;return q==null?null:(z==null&&(z=this.tokenMin),P==null&&(P=this.tokenMax),{e:q,pmin:z,pmax:P,origin:this.origin,line:this.line})}this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let u=this.parseExpr();switch(e=this.token(),e._hx_index){case 5:let E=K.EParent(u),v=t,M=this.tokenMax,A;return E==null?A=null:(v==null&&(v=this.tokenMin),M==null&&(M=this.tokenMax),A={e:E,pmin:v,pmax:M,origin:this.origin,line:this.line}),this.parseExprNext(A);case 10:let L=u.e;if(L._hx_index==1){let q=L.v;return this.parseLambda([{name:q}],u==null?0:u.pmin)}break;case 15:let I=this.parseType();switch(e=this.token(),e._hx_index){case 5:let q=K.ECheckType(u,I),z=t,P=this.tokenMax,B;return q==null?B=null:(z==null&&(z=this.tokenMin),P==null&&(P=this.tokenMax),B={e:q,pmin:z,pmax:P,origin:this.origin,line:this.line}),this.parseExprNext(B);case 10:let N=u.e;if(N._hx_index==1){let D=N.v;return this.parseLambda([{name:D,t:I}],u==null?0:u.pmin)}break;default:}break;default:}return this.unexpected(e);case 6:switch(e=this.token(),e._hx_index){case 1:let E=e.c;if(this.allowJSON)if(E._hx_index==2){let z=E.s,P=this.token();if(this.tokens.push({t:P,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,P._hx_index==15)return this.parseExprNext(this.parseObject(t))}else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;case 2:let v=e.s,M=this.token();if(this.tokens.push({t:M,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,M._hx_index==15)return this.parseExprNext(this.parseObject(t));break;case 7:let A=K.EObject([]),L=t,I=null,q;return A==null?q=null:(L==null&&(L=this.tokenMin),I==null&&(I=this.tokenMax),q={e:A,pmin:L,pmax:I,origin:this.origin,line:this.line}),this.parseExprNext(q);default:this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}let p=[];for(;this.parseFullExpr(p),e=this.token(),!(e==Z.TBrClose||this.resumeErrors&&e==Z.TEof);)this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let _=K.EBlock(p),m=t,f=null;return _==null?null:(m==null&&(m=this.tokenMin),f==null&&(f=this.tokenMax),{e:_,pmin:m,pmax:f,origin:this.origin,line:this.line});case 12:let g=[];e=this.token();let d=!0;for(;e!=Z.TBkClose&&(!this.resumeErrors||e!=Z.TEof);)d||(e!=Z.TComma?this.unexpected(e):e=this.token()),d=!1,this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,g.push(this.parseExpr()),e=this.token();if(g.length==1&&g[0]!=null){let E=g[0].e;switch(E._hx_index){case 10:let v=E.cond,M=E.e,A="__a_"+this.uid++,L=K.EArrayDecl([]),I=t,q=null,z;L==null?z=null:(I==null&&(I=this.tokenMin),q==null&&(q=this.tokenMax),z={e:L,pmin:I,pmax:q,origin:this.origin,line:this.line});let P=K.EVar(A,null,z),B=t,N=null,D;P==null?D=null:(B==null&&(B=this.tokenMin),N==null&&(N=this.tokenMax),D={e:P,pmin:B,pmax:N,origin:this.origin,line:this.line});let U=this.mapCompr(A,g[0]),W=K.EIdent(A),J=t,H=null,X;W==null?X=null:(J==null&&(J=this.tokenMin),H==null&&(H=this.tokenMax),X={e:W,pmin:J,pmax:H,origin:this.origin,line:this.line});let ae=K.EBlock([D,U,X]),ce=t,ne=null,re;return ae==null?re=null:(ce==null&&(ce=this.tokenMin),ne==null&&(ne=this.tokenMax),re={e:ae,pmin:ce,pmax:ne,origin:this.origin,line:this.line}),this.parseExprNext(re);case 11:let xe=E.v,Pe=E.it,Ue=E.e,Je="__a_"+this.uid++,lt=K.EArrayDecl([]),Ve=t,Qe=null,at;lt==null?at=null:(Ve==null&&(Ve=this.tokenMin),Qe==null&&(Qe=this.tokenMax),at={e:lt,pmin:Ve,pmax:Qe,origin:this.origin,line:this.line});let Re=K.EVar(Je,null,at),$=t,se=null,j;Re==null?j=null:($==null&&($=this.tokenMin),se==null&&(se=this.tokenMax),j={e:Re,pmin:$,pmax:se,origin:this.origin,line:this.line});let ie=this.mapCompr(Je,g[0]),le=K.EIdent(Je),ee=t,pe=null,me;le==null?me=null:(ee==null&&(ee=this.tokenMin),pe==null&&(pe=this.tokenMax),me={e:le,pmin:ee,pmax:pe,origin:this.origin,line:this.line});let we=K.EBlock([j,ie,me]),Ze=t,yt=null,Le;return we==null?Le=null:(Ze==null&&(Ze=this.tokenMin),yt==null&&(yt=this.tokenMax),Le={e:we,pmin:Ze,pmax:yt,origin:this.origin,line:this.line}),this.parseExprNext(Le);case 24:let dt=E.cond,Oe=E.e,Ie="__a_"+this.uid++,pt=K.EArrayDecl([]),it=t,Ot=null,Yt;pt==null?Yt=null:(it==null&&(it=this.tokenMin),Ot==null&&(Ot=this.tokenMax),Yt={e:pt,pmin:it,pmax:Ot,origin:this.origin,line:this.line});let xt=K.EVar(Ie,null,Yt),ol=t,$e=null,Vt;xt==null?Vt=null:(ol==null&&(ol=this.tokenMin),$e==null&&($e=this.tokenMax),Vt={e:xt,pmin:ol,pmax:$e,origin:this.origin,line:this.line});let Bt=this.mapCompr(Ie,g[0]),qt=K.EIdent(Ie),wt=t,Ht=null,Zt;qt==null?Zt=null:(wt==null&&(wt=this.tokenMin),Ht==null&&(Ht=this.tokenMax),Zt={e:qt,pmin:wt,pmax:Ht,origin:this.origin,line:this.line});let Gt=K.EBlock([Vt,Bt,Zt]),ul=t,cl=null,Xt;return Gt==null?Xt=null:(ul==null&&(ul=this.tokenMin),cl==null&&(cl=this.tokenMax),Xt={e:Gt,pmin:ul,pmax:cl,origin:this.origin,line:this.line}),this.parseExprNext(Xt);default:}}let w=K.EArrayDecl(g),y=t,S=null,T;return w==null?T=null:(y==null&&(y=this.tokenMin),S==null&&(S=this.tokenMax),T={e:w,pmin:y,pmax:S,origin:this.origin,line:this.line}),this.parseExprNext(T);case 16:let O=e.s;if(this.allowMetadata){let E=this.parseMetaArgs(),v=K.EMeta(O,E,this.parseExpr()),M=t,A=null;return v==null?null:(M==null&&(M=this.tokenMin),A==null&&(A=this.tokenMax),{e:v,pmin:M,pmax:A,origin:this.origin,line:this.line})}else return this.unexpected(e);break;default:return this.unexpected(e)}}parseLambda(e,t){e:for(;;){let p=this.getIdent(),_=this.maybe(Z.TDoubleDot)?this.parseType():null;e.push({name:p,t:_});let m=this.token();switch(m._hx_index){case 5:break e;case 10:break;default:this.unexpected(m);break e}}let l=this.token();_e.enumEq(l,Z.TOp("->"))||this.unexpected(l);let i=this.parseExpr(),n=K.EReturn(i),s=t,r=null,a;n==null?a=null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),a={e:n,pmin:s,pmax:r,origin:this.origin,line:this.line});let h=K.EFunction(e,a),o=t,u=null;return h==null?null:(o==null&&(o=this.tokenMin),u==null&&(u=this.tokenMax),{e:h,pmin:o,pmax:u,origin:this.origin,line:this.line})}parseMetaArgs(){let e=this.token();if(e!=Z.TPOpen)return this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,null;let t=[];if(e=this.token(),e!=Z.TPClose){this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;e:for(;;){t.push(this.parseExpr());let l=this.token();switch(l._hx_index){case 5:break e;case 10:break;default:let i=l;this.unexpected(i)}}}return t}mapCompr(e,t){if(t==null)return null;let l,i=t.e;switch(i._hx_index){case 3:let r=i.e;l=K.EParent(this.mapCompr(e,r));break;case 4:let a=i.e;if(a.length==1){let L=a[0];l=K.EBlock([this.mapCompr(e,L)])}else{let L=K.EIdent(e),I=t==null?0:t.pmin,q=t==null?0:t.pmax,z;L==null?z=null:(I==null&&(I=this.tokenMin),q==null&&(q=this.tokenMax),z={e:L,pmin:I,pmax:q,origin:this.origin,line:this.line});let P=K.EField(z,"push"),B=t==null?0:t.pmin,N=t==null?0:t.pmax,D;P==null?D=null:(B==null&&(B=this.tokenMin),N==null&&(N=this.tokenMax),D={e:P,pmin:B,pmax:N,origin:this.origin,line:this.line}),l=K.ECall(D,[t])}break;case 9:let h=i.cond,o=i.e1;if(i.e2==null)l=K.EIf(h,this.mapCompr(e,o),null);else{let L=K.EIdent(e),I=t==null?0:t.pmin,q=t==null?0:t.pmax,z;L==null?z=null:(I==null&&(I=this.tokenMin),q==null&&(q=this.tokenMax),z={e:L,pmin:I,pmax:q,origin:this.origin,line:this.line});let P=K.EField(z,"push"),B=t==null?0:t.pmin,N=t==null?0:t.pmax,D;P==null?D=null:(B==null&&(B=this.tokenMin),N==null&&(N=this.tokenMax),D={e:P,pmin:B,pmax:N,origin:this.origin,line:this.line}),l=K.ECall(D,[t])}break;case 10:let p=i.cond,_=i.e;l=K.EWhile(p,this.mapCompr(e,_));break;case 11:let m=i.v,f=i.it,g=i.e;l=K.EFor(m,f,this.mapCompr(e,g));break;case 24:let d=i.cond,w=i.e;l=K.EDoWhile(d,this.mapCompr(e,w));break;default:let y=K.EIdent(e),S=t==null?0:t.pmin,T=t==null?0:t.pmax,O;y==null?O=null:(S==null&&(S=this.tokenMin),T==null&&(T=this.tokenMax),O={e:y,pmin:S,pmax:T,origin:this.origin,line:this.line});let E=K.EField(O,"push"),v=t==null?0:t.pmin,M=t==null?0:t.pmax,A;E==null?A=null:(v==null&&(v=this.tokenMin),M==null&&(M=this.tokenMax),A={e:E,pmin:v,pmax:M,origin:this.origin,line:this.line}),l=K.ECall(A,[t])}let n=t==null?0:t.pmin,s=t==null?0:t.pmax;return l==null?null:(n==null&&(n=this.tokenMin),s==null&&(s=this.tokenMax),{e:l,pmin:n,pmax:s,origin:this.origin,line:this.line})}makeUnop(e,t){if(t==null&&this.resumeErrors)return null;let l=t.e;switch(l._hx_index){case 6:let i=l.op,n=l.e1,s=l.e2,r=K.EBinop(i,this.makeUnop(e,n),s),a=n==null?0:n.pmin,h=s==null?0:s.pmax;return r==null?null:(a==null&&(a=this.tokenMin),h==null&&(h=this.tokenMax),{e:r,pmin:a,pmax:h,origin:this.origin,line:this.line});case 22:let o=l.cond,u=l.e1,p=l.e2,_=K.ETernary(this.makeUnop(e,o),u,p),m=o==null?0:o.pmin,f=p==null?0:p.pmax;return _==null?null:(m==null&&(m=this.tokenMin),f==null&&(f=this.tokenMax),{e:_,pmin:m,pmax:f,origin:this.origin,line:this.line});default:let g=K.EUnop(e,!0,t),d=t==null?0:t.pmin,w=t==null?0:t.pmax;return g==null?null:(d==null&&(d=this.tokenMin),w==null&&(w=this.tokenMax),{e:g,pmin:d,pmax:w,origin:this.origin,line:this.line})}}makeBinop(e,t,l){if(l==null&&this.resumeErrors){let n=K.EBinop(e,t,l),s=t==null?0:t.pmin,r=t==null?0:t.pmax;return n==null?null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),{e:n,pmin:s,pmax:r,origin:this.origin,line:this.line})}let i=l.e;switch(i._hx_index){case 6:let n=i.op,s=i.e1,r=i.e2;if(this.opPriority.h[e]<=this.opPriority.h[n]&&!Object.prototype.hasOwnProperty.call(this.opRightAssoc.h,e)){let m=K.EBinop(n,this.makeBinop(e,t,s),r),f=t==null?0:t.pmin,g=r==null?0:r.pmax;return m==null?null:(f==null&&(f=this.tokenMin),g==null&&(g=this.tokenMax),{e:m,pmin:f,pmax:g,origin:this.origin,line:this.line})}else{let m=K.EBinop(e,t,l),f=t==null?0:t.pmin,g=l==null?0:l.pmax;return m==null?null:(f==null&&(f=this.tokenMin),g==null&&(g=this.tokenMax),{e:m,pmin:f,pmax:g,origin:this.origin,line:this.line})}break;case 22:let a=i.cond,h=i.e1,o=i.e2;if(Object.prototype.hasOwnProperty.call(this.opRightAssoc.h,e)){let m=K.EBinop(e,t,l),f=t==null?0:t.pmin,g=l==null?0:l.pmax;return m==null?null:(f==null&&(f=this.tokenMin),g==null&&(g=this.tokenMax),{e:m,pmin:f,pmax:g,origin:this.origin,line:this.line})}else{let m=K.ETernary(this.makeBinop(e,t,a),h,o),f=t==null?0:t.pmin,g=l==null?0:l.pmax;return m==null?null:(f==null&&(f=this.tokenMin),g==null&&(g=this.tokenMax),{e:m,pmin:f,pmax:g,origin:this.origin,line:this.line})}break;default:let u=K.EBinop(e,t,l),p=t==null?0:t.pmin,_=l==null?0:l.pmax;return u==null?null:(p==null&&(p=this.tokenMin),_==null&&(_=this.tokenMax),{e:u,pmin:p,pmax:_,origin:this.origin,line:this.line})}}parseStructure(e){let t=this.tokenMin;switch(e){case"break":let l=K.EBreak,i=null,n=null;return l==null?null:(i==null&&(i=this.tokenMin),n==null&&(n=this.tokenMax),{e:l,pmin:i,pmax:n,origin:this.origin,line:this.line});case"continue":let s=K.EContinue,r=null,a=null;return s==null?null:(r==null&&(r=this.tokenMin),a==null&&(a=this.tokenMax),{e:s,pmin:r,pmax:a,origin:this.origin,line:this.line});case"do":let h=this.parseExpr(),o=this.token();o._hx_index==2?o.s!="while"&&this.unexpected(o):this.unexpected(o);let u=this.parseExpr(),p=K.EDoWhile(u,h),_=t,m=u==null?0:u.pmax;return p==null?null:(_==null&&(_=this.tokenMin),m==null&&(m=this.tokenMax),{e:p,pmin:_,pmax:m,origin:this.origin,line:this.line});case"else":return this.unexpected(Z.TId(e));case"for":let f=this.token();f!=Z.TPOpen&&this.unexpected(f);let g=this.getIdent(),d=this.token();_e.enumEq(d,Z.TId("in"))||this.unexpected(d);let w=this.parseExpr(),y=this.token();y!=Z.TPClose&&this.unexpected(y);let S=this.parseExpr(),T=K.EFor(g,w,S),O=t,E=S==null?0:S.pmax;return T==null?null:(O==null&&(O=this.tokenMin),E==null&&(E=this.tokenMax),{e:T,pmin:O,pmax:E,origin:this.origin,line:this.line});case"function":let v=this.token(),M=null;v._hx_index==2?M=v.s:(this.tokens.push({t:v,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax);let A=this.parseFunctionDecl(),L=K.EFunction(A.args,A.body,M,A.ret),I=t,q=A.body,z=q==null?0:q.pmax;return L==null?null:(I==null&&(I=this.tokenMin),z==null&&(z=this.tokenMax),{e:L,pmin:I,pmax:z,origin:this.origin,line:this.line});case"if":let P=this.token();P!=Z.TPOpen&&this.unexpected(P);let B=this.parseExpr(),N=this.token();N!=Z.TPClose&&this.unexpected(N);let D=this.parseExpr(),U=null,W=!1,J=this.token();J==Z.TSemicolon&&(W=!0,J=this.token()),_e.enumEq(J,Z.TId("else"))?U=this.parseExpr():(this.tokens.push({t:J,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,W&&(this.tokens.push({t:Z.TSemicolon,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax));let H=K.EIf(B,D,U),X=t,ae=U==null?this.tokenMax:U==null?0:U.pmax;return H==null?null:(X==null&&(X=this.tokenMin),ae==null&&(ae=this.tokenMax),{e:H,pmin:X,pmax:ae,origin:this.origin,line:this.line});case"inline":return this.maybe(Z.TId("function"))||this.unexpected(Z.TId("inline")),this.parseStructure("function");case"new":let ce=[];ce.push(this.getIdent());e:for(;;){let nt=this.token();switch(nt._hx_index){case 4:break e;case 8:ce.push(this.getIdent());break;default:this.unexpected(nt);break e}}let ne=this.parseExprList(Z.TPClose),re=K.ENew(ce.join("."),ne),xe=t,Pe=null;return re==null?null:(xe==null&&(xe=this.tokenMin),Pe==null&&(Pe=this.tokenMax),{e:re,pmin:xe,pmax:Pe,origin:this.origin,line:this.line});case"return":let Ue=this.token();this.tokens.push({t:Ue,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let Je=Ue==Z.TSemicolon?null:this.parseExpr(),lt=K.EReturn(Je),Ve=t,Qe=Je==null?this.tokenMax:Je==null?0:Je.pmax;return lt==null?null:(Ve==null&&(Ve=this.tokenMin),Qe==null&&(Qe=this.tokenMax),{e:lt,pmin:Ve,pmax:Qe,origin:this.origin,line:this.line});case"switch":let at=this.parseExpr(),Re=null,$=[],se=this.token();se!=Z.TBrOpen&&this.unexpected(se);e:for(;;){let nt=this.token();switch(nt._hx_index){case 2:switch(nt.s){case"case":let Sl={values:[],expr:null};$.push(Sl);t:for(;;){let bt=this.parseExpr();switch(Sl.values.push(bt),nt=this.token(),nt._hx_index){case 10:break;case 15:break t;default:this.unexpected(nt);break t}}let Ce=[];t:for(;;)switch(nt=this.token(),this.tokens.push({t:nt,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,nt._hx_index){case 0:if(this.resumeErrors)break t;this.parseFullExpr(Ce);break;case 2:switch(nt.s){case"case":case"default":break t;default:this.parseFullExpr(Ce)}break;case 7:break t;default:this.parseFullExpr(Ce)}let rt;if(Ce.length==1)rt=Ce[0];else if(Ce.length==0){let bt=K.EBlock([]),Ct=this.tokenMin,Ft=this.tokenMin;bt==null?rt=null:(Ct==null&&(Ct=this.tokenMin),Ft==null&&(Ft=this.tokenMax),rt={e:bt,pmin:Ct,pmax:Ft,origin:this.origin,line:this.line})}else{let bt=K.EBlock(Ce),Ct=Ce[0],Ft=Ct==null?0:Ct.pmin,el=Ce[Ce.length-1],Tt=el==null?0:el.pmax;bt==null?rt=null:(Ft==null&&(Ft=this.tokenMin),Tt==null&&(Tt=this.tokenMax),rt={e:bt,pmin:Ft,pmax:Tt,origin:this.origin,line:this.line})}Sl.expr=rt;break;case"default":Re!=null&&this.unexpected(nt);let _t=this.token();_t!=Z.TDoubleDot&&this.unexpected(_t);let ot=[];t:for(;;)switch(nt=this.token(),this.tokens.push({t:nt,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,nt._hx_index){case 0:if(this.resumeErrors)break t;this.parseFullExpr(ot);break;case 2:switch(nt.s){case"case":case"default":break t;default:this.parseFullExpr(ot)}break;case 7:break t;default:this.parseFullExpr(ot)}if(ot.length==1)Re=ot[0];else if(ot.length==0){let bt=K.EBlock([]),Ct=this.tokenMin,Ft=this.tokenMin;bt==null?Re=null:(Ct==null&&(Ct=this.tokenMin),Ft==null&&(Ft=this.tokenMax),Re={e:bt,pmin:Ct,pmax:Ft,origin:this.origin,line:this.line})}else{let bt=K.EBlock(ot),Ct=ot[0],Ft=Ct==null?0:Ct.pmin,el=ot[ot.length-1],Tt=el==null?0:el.pmax;bt==null?Re=null:(Ft==null&&(Ft=this.tokenMin),Tt==null&&(Tt=this.tokenMax),Re={e:bt,pmin:Ft,pmax:Tt,origin:this.origin,line:this.line})}break;default:this.unexpected(nt);break e}break;case 7:break e;default:this.unexpected(nt);break e}}let j=K.ESwitch(at,$,Re),ie=t,le=this.tokenMax;return j==null?null:(ie==null&&(ie=this.tokenMin),le==null&&(le=this.tokenMax),{e:j,pmin:ie,pmax:le,origin:this.origin,line:this.line});case"throw":let ee=this.parseExpr(),pe=K.EThrow(ee),me=t,we=ee==null?0:ee.pmax;return pe==null?null:(me==null&&(me=this.tokenMin),we==null&&(we=this.tokenMax),{e:pe,pmin:me,pmax:we,origin:this.origin,line:this.line});case"try":let Ze=this.parseExpr(),yt=this.token();_e.enumEq(yt,Z.TId("catch"))||this.unexpected(yt);let Le=this.token();Le!=Z.TPOpen&&this.unexpected(Le);let dt=this.getIdent(),Oe=this.token();Oe!=Z.TDoubleDot&&this.unexpected(Oe);let Ie=null;if(this.allowTypes)Ie=this.parseType();else{let nt=this.token();_e.enumEq(nt,Z.TId("Dynamic"))||this.unexpected(nt)}let pt=this.token();pt!=Z.TPClose&&this.unexpected(pt);let it=this.parseExpr(),Ot=K.ETry(Ze,dt,Ie,it),Yt=t,xt=it==null?0:it.pmax;return Ot==null?null:(Yt==null&&(Yt=this.tokenMin),xt==null&&(xt=this.tokenMax),{e:Ot,pmin:Yt,pmax:xt,origin:this.origin,line:this.line});case"var":let ol=this.getIdent(),$e=this.token(),Vt=null;$e==Z.TDoubleDot&&this.allowTypes&&(Vt=this.parseType(),$e=this.token());let Bt=null;switch($e._hx_index){case 3:$e.s=="="?Bt=this.parseExpr():this.unexpected($e);break;case 10:case 11:this.tokens.push({t:$e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;default:Vt!=null?(this.tokens.push({t:$e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):this.unexpected($e)}let qt=K.EVar(ol,Vt,Bt),wt=t,Ht=Bt==null?this.tokenMax:Bt==null?0:Bt.pmax;return qt==null?null:(wt==null&&(wt=this.tokenMin),Ht==null&&(Ht=this.tokenMax),{e:qt,pmin:wt,pmax:Ht,origin:this.origin,line:this.line});case"while":let Zt=this.parseExpr(),Gt=this.parseExpr(),ul=K.EWhile(Zt,Gt),cl=t,Xt=Gt==null?0:Gt.pmax;return ul==null?null:(cl==null&&(cl=this.tokenMin),Xt==null&&(Xt=this.tokenMax),{e:ul,pmin:cl,pmax:Xt,origin:this.origin,line:this.line});default:return null}}parseExprNext(e){let t=this.token();switch(t._hx_index){case 2:let l=t.s;return l=="is"?this.makeBinop(l,e,this.parseExpr()):(this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e);case 3:let i=t.s;if(i=="->"){let Le=e.e;switch(Le._hx_index){case 1:let dt=Le.v,Oe=this.parseExpr(),Ie=K.EReturn(Oe),pt=Oe==null?0:Oe.pmin,it=null,Ot;Ie==null?Ot=null:(pt==null&&(pt=this.tokenMin),it==null&&(it=this.tokenMax),Ot={e:Ie,pmin:pt,pmax:it,origin:this.origin,line:this.line});let Yt=K.EFunction([{name:dt}],Ot),xt=e==null?0:e.pmin,ol=null;return Yt==null?null:(xt==null&&(xt=this.tokenMin),ol==null&&(ol=this.tokenMax),{e:Yt,pmin:xt,pmax:ol,origin:this.origin,line:this.line});case 3:let $e=Le.e.e;if($e._hx_index==1){let Bt=$e.v,qt=this.parseExpr(),wt=K.EReturn(qt),Ht=qt==null?0:qt.pmin,Zt=null,Gt;wt==null?Gt=null:(Ht==null&&(Ht=this.tokenMin),Zt==null&&(Zt=this.tokenMax),Gt={e:wt,pmin:Ht,pmax:Zt,origin:this.origin,line:this.line});let ul=K.EFunction([{name:Bt}],Gt),cl=e==null?0:e.pmin,Xt=null;return ul==null?null:(cl==null&&(cl=this.tokenMin),Xt==null&&(Xt=this.tokenMax),{e:ul,pmin:cl,pmax:Xt,origin:this.origin,line:this.line})}break;case 26:let Vt=Le.e.e;if(Vt._hx_index==1){let Bt=Vt.v,qt=Le.t,wt=this.parseExpr(),Ht=K.EReturn(wt),Zt=wt==null?0:wt.pmin,Gt=null,ul;Ht==null?ul=null:(Zt==null&&(Zt=this.tokenMin),Gt==null&&(Gt=this.tokenMax),ul={e:Ht,pmin:Zt,pmax:Gt,origin:this.origin,line:this.line});let cl=K.EFunction([{name:Bt,t:qt}],ul),Xt=e==null?0:e.pmin,nt=null;return cl==null?null:(Xt==null&&(Xt=this.tokenMin),nt==null&&(nt=this.tokenMax),{e:cl,pmin:Xt,pmax:nt,origin:this.origin,line:this.line})}break;default:}this.unexpected(t)}if(this.opPriority.h[i]==-1){let Le;if(this.isBlock(e))Le=!0;else{let it=e.e;if(it._hx_index==3){let Ot=it.e;Le=!0}else Le=!1}if(Le)return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e;let dt=K.EUnop(i,!1,e),Oe=e==null?0:e.pmin,Ie=null,pt;return dt==null?pt=null:(Oe==null&&(Oe=this.tokenMin),Ie==null&&(Ie=this.tokenMax),pt={e:dt,pmin:Oe,pmax:Ie,origin:this.origin,line:this.line}),this.parseExprNext(pt)}return this.makeBinop(i,e,this.parseExpr());case 4:let n=K.ECall(e,this.parseExprList(Z.TPClose)),s=e==null?0:e.pmin,r=null,a;return n==null?a=null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),a={e:n,pmin:s,pmax:r,origin:this.origin,line:this.line}),this.parseExprNext(a);case 8:let h=this.getIdent(),o=K.EField(e,h),u=e==null?0:e.pmin,p=null,_;return o==null?_=null:(u==null&&(u=this.tokenMin),p==null&&(p=this.tokenMax),_={e:o,pmin:u,pmax:p,origin:this.origin,line:this.line}),this.parseExprNext(_);case 9:let m=this.getIdent(),f="__a_"+this.uid++,g=K.EVar(f,null,e),d=e==null?0:e.pmin,w=e==null?0:e.pmax,y;g==null?y=null:(d==null&&(d=this.tokenMin),w==null&&(w=this.tokenMax),y={e:g,pmin:d,pmax:w,origin:this.origin,line:this.line});let S=K.EIdent(f),T=e==null?0:e.pmin,O=e==null?0:e.pmax,E;S==null?E=null:(T==null&&(T=this.tokenMin),O==null&&(O=this.tokenMax),E={e:S,pmin:T,pmax:O,origin:this.origin,line:this.line});let v=K.EIdent("null"),M=e==null?0:e.pmin,A=e==null?0:e.pmax,L;v==null?L=null:(M==null&&(M=this.tokenMin),A==null&&(A=this.tokenMax),L={e:v,pmin:M,pmax:A,origin:this.origin,line:this.line});let I=K.EBinop("==",E,L),q=null,z=null,P;I==null?P=null:(q==null&&(q=this.tokenMin),z==null&&(z=this.tokenMax),P={e:I,pmin:q,pmax:z,origin:this.origin,line:this.line});let B=K.EIdent("null"),N=e==null?0:e.pmin,D=e==null?0:e.pmax,U;B==null?U=null:(N==null&&(N=this.tokenMin),D==null&&(D=this.tokenMax),U={e:B,pmin:N,pmax:D,origin:this.origin,line:this.line});let W=K.EIdent(f),J=e==null?0:e.pmin,H=e==null?0:e.pmax,X;W==null?X=null:(J==null&&(J=this.tokenMin),H==null&&(H=this.tokenMax),X={e:W,pmin:J,pmax:H,origin:this.origin,line:this.line});let ae=K.EField(X,m),ce=e==null?0:e.pmin,ne=null,re;ae==null?re=null:(ce==null&&(ce=this.tokenMin),ne==null&&(ne=this.tokenMax),re={e:ae,pmin:ce,pmax:ne,origin:this.origin,line:this.line});let xe=K.ETernary(P,U,re),Pe=null,Ue=null,Je;xe==null?Je=null:(Pe==null&&(Pe=this.tokenMin),Ue==null&&(Ue=this.tokenMax),Je={e:xe,pmin:Pe,pmax:Ue,origin:this.origin,line:this.line});let lt=K.EBlock([y,Je]),Ve=e==null?0:e.pmin,Qe=null,at;return lt==null?at=null:(Ve==null&&(Ve=this.tokenMin),Qe==null&&(Qe=this.tokenMax),at={e:lt,pmin:Ve,pmax:Qe,origin:this.origin,line:this.line}),this.parseExprNext(at);case 12:let Re=this.parseExpr(),$=this.token();$!=Z.TBkClose&&this.unexpected($);let se=K.EArray(e,Re),j=e==null?0:e.pmin,ie=null,le;return se==null?le=null:(j==null&&(j=this.tokenMin),ie==null&&(ie=this.tokenMax),le={e:se,pmin:j,pmax:ie,origin:this.origin,line:this.line}),this.parseExprNext(le);case 14:let ee=this.parseExpr(),pe=this.token();pe!=Z.TDoubleDot&&this.unexpected(pe);let me=this.parseExpr(),we=K.ETernary(e,ee,me),Ze=e==null?0:e.pmin,yt=me==null?0:me.pmax;return we==null?null:(Ze==null&&(Ze=this.tokenMin),yt==null&&(yt=this.tokenMax),{e:we,pmin:Ze,pmax:yt,origin:this.origin,line:this.line});default:return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e}}parseFunctionArgs(){let e=[],t=this.token();if(t!=Z.TPClose){let l=!1;for(;!l;){let i=null,n=!1;if(t._hx_index==14&&(n=!0,t=this.token()),t._hx_index==2)i=t.s;else{this.unexpected(t);break}let s={name:i};switch(e.push(s),n&&(s.opt=!0),this.allowTypes&&(this.maybe(Z.TDoubleDot)&&(s.t=this.parseType()),this.maybe(Z.TOp("="))&&(s.value=this.parseExpr())),t=this.token(),t._hx_index){case 5:l=!0;break;case 10:t=this.token();break;default:this.unexpected(t)}}}return e}parseFunctionDecl(){let e=this.token();e!=Z.TPOpen&&this.unexpected(e);let t=this.parseFunctionArgs(),l=null;if(this.allowTypes){let i=this.token();i!=Z.TDoubleDot?(this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):l=this.parseType()}return{args:t,ret:l,body:this.parseExpr()}}parsePath(){let e=[this.getIdent()];for(;;){let t=this.token();if(t!=Z.TDot){this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}e.push(this.getIdent())}return e}parseType(){let e=this.token(),t=this;switch(e._hx_index){case 2:let l=e.s;this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let i=this.parsePath(),n=null;if(e=this.token(),e._hx_index==3)if(e.s=="<"){n=[];e:for(;;){switch(n.push(this.parseType()),e=this.token(),e._hx_index){case 3:let p=e.s;if(p==">")break e;if(c.cca(p,0)==62){this.tokens.add({t:Z.TOp(c.substr(p,1,null)),min:this.tokenMax-p.length-1,max:this.tokenMax});break e}break;case 10:continue;default:}this.unexpected(e);break}}else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;return this.parseTypeNext(sl.CTPath(i,n));case 4:let s=this.token(),r=this.token();this.tokens.push({t:r,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.tokens.push({t:s,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let a=function(u){let p=t.token();if(p._hx_index==3){if(p.s!="->"){let _=p;t.unexpected(_)}}else{let _=p;t.unexpected(_)}return sl.CTFun(u,t.parseType())};switch(s._hx_index){case 2:let u=s.s;if(r._hx_index==15){let w=[],y=0,S=this.parseFunctionArgs();for(;y<S.length;){let O=S[y];++y;let E=O.value;if(E!=null){let v=E;if(!this.resumeErrors)throw C.thrown(new Se(Te.ECustom("Default values not allowed in function types"),v.pmin,v.pmax,this.origin,this.line))}w.push(sl.CTNamed(O.name,O.opt?sl.CTOpt(O.t):O.t))}return a(w)}else{let w=this.parseType(),y=this.token();switch(y._hx_index){case 5:return this.parseTypeNext(sl.CTParent(w));case 10:let S=[w];do S.push(this.parseType());while(this.maybe(Z.TComma));let T=this.token();return T!=Z.TPClose&&this.unexpected(T),a(S);default:let O=y;return this.unexpected(O)}}break;case 5:let p=[],_=0,m=this.parseFunctionArgs();for(;_<m.length;){let w=m[_];++_;let y=w.value;if(y!=null){let S=y;if(!this.resumeErrors)throw C.thrown(new Se(Te.ECustom("Default values not allowed in function types"),S.pmin,S.pmax,this.origin,this.line))}p.push(sl.CTNamed(w.name,w.opt?sl.CTOpt(w.t):w.t))}return a(p);default:let g=this.parseType(),d=this.token();switch(d._hx_index){case 5:return this.parseTypeNext(sl.CTParent(g));case 10:let w=[g];do w.push(this.parseType());while(this.maybe(Z.TComma));let y=this.token();return y!=Z.TPClose&&this.unexpected(y),a(w);default:let S=d;return this.unexpected(S)}}break;case 6:let h=[],o=null;e:for(;;)switch(e=this.token(),e._hx_index){case 2:let u=e.s;if(u=="var"){let _=this.getIdent(),m=this.token();m!=Z.TDoubleDot&&this.unexpected(m),h.push({name:_,t:this.parseType(),meta:o}),o=null;let f=this.token();f!=Z.TSemicolon&&this.unexpected(f)}else{let _=u,m=this.token();switch(m!=Z.TDoubleDot&&this.unexpected(m),h.push({name:_,t:this.parseType(),meta:o}),e=this.token(),e._hx_index){case 7:break e;case 10:break;default:this.unexpected(e)}}break;case 7:break e;case 16:let p=e.s;o==null&&(o=[]),o.push({name:p,params:this.parseMetaArgs()});break;default:this.unexpected(e);break e}return this.parseTypeNext(sl.CTAnon(h));default:return this.unexpected(e)}}parseTypeNext(e){let t=this.token();if(t._hx_index==3){if(t.s!="->")return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e}else return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e;let l=this.parseType();if(l._hx_index==1){let i=l.ret;return l.args.unshift(e),l}else return sl.CTFun([e],l)}parseExprList(e){let t=[],l=this.token();if(l==e)return t;for(this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;;)if(t.push(this.parseExpr()),l=this.token(),l._hx_index!=10){if(l==e)break;this.unexpected(l);break}return t}parseModule(e,t,l){l==null&&(l=0),t==null&&(t="loreline.lorscript"),this.initParser(t,l),this.input=e,this.readPos=0,this.allowTypes=!0,this.allowMetadata=!0;let i=[];for(;;){let n=this.token();if(n==Z.TEof)break;this.tokens.push({t:n,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,i.push(this.parseModuleDecl())}return i}parseMetadata(){let e=[];for(;;){let t=this.token();if(t._hx_index==16){let l=t.s;e.push({name:l,params:this.parseMetaArgs()})}else{this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}return e}parseParams(){if(this.maybe(Z.TOp("<"))&&!this.resumeErrors)throw C.thrown(new Se(Te.EInvalidOp("Unsupported class type parameters"),this.readPos+this.offset,this.readPos+this.offset,this.origin,this.line));return{}}parseModuleDecl(){let e=this.parseMetadata(),t=this.getIdent(),l=!1,i=!1;e:for(;;){switch(t){case"extern":i=!0;break;case"private":l=!0;break;default:break e}t=this.getIdent()}switch(t){case"class":let n=this.getIdent(),s=this.parseParams(),r=null,a=[];e:for(;;){let S=this.token();if(S._hx_index==2)switch(S.s){case"extends":r=this.parseType();break;case"implements":a.push(this.parseType());break;default:this.tokens.push({t:S,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break e}else{this.tokens.push({t:S,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}let h=[],o=this.token();for(o!=Z.TBrOpen&&this.unexpected(o);!this.maybe(Z.TBrClose);)h.push(this.parseField());return ni.DClass({name:n,meta:e,params:s,extend:r,implement:a,fields:h,isPrivate:l,isExtern:i});case"import":let u=[this.getIdent()],p=!1;for(;;){let S=this.token();if(S!=Z.TDot){this.tokens.push({t:S,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}switch(S=this.token(),S._hx_index){case 2:let T=S.s;u.push(T);break;case 3:S.s=="*"?p=!0:this.unexpected(S);break;default:this.unexpected(S)}}let _=this.token();return _!=Z.TSemicolon&&this.unexpected(_),ni.DImport(u,p);case"package":let m=this.parsePath(),f=this.token();return f!=Z.TSemicolon&&this.unexpected(f),ni.DPackage(m);case"typedef":let g=this.getIdent(),d=this.parseParams(),w=this.token();_e.enumEq(w,Z.TOp("="))||this.unexpected(w);let y=this.parseType();return ni.DTypedef({name:g,meta:e,params:d,isPrivate:l,t:y});default:this.unexpected(Z.TId(t))}return null}parseField(){let e=this.parseMetadata(),t=[];e:for(;;){let l=this.getIdent();switch(l){case"function":let i=this.getIdent(),n=this.parseFunctionDecl();return{name:i,meta:e,access:t,kind:ln.KFunction({args:n.args,expr:n.body,ret:n.ret})};case"inline":t.push(Al.AInline);break;case"macro":t.push(Al.AMacro);break;case"override":t.push(Al.AOverride);break;case"private":t.push(Al.APrivate);break;case"public":t.push(Al.APublic);break;case"static":t.push(Al.AStatic);break;case"var":let s=this.getIdent(),r=null,a=null;if(this.maybe(Z.TPOpen)){r=this.getIdent();let u=this.token();u!=Z.TComma&&this.unexpected(u),a=this.getIdent();let p=this.token();p!=Z.TPClose&&this.unexpected(p)}let h=this.maybe(Z.TDoubleDot)?this.parseType():null,o=this.maybe(Z.TOp("="))?this.parseExpr():null;if(o!=null)if(this.isBlock(o))this.maybe(Z.TSemicolon);else{let u=this.token();u!=Z.TSemicolon&&this.unexpected(u)}else{let u;if(h!=null)if(h==null)u=!1;else if(h._hx_index==2){let p=h.fields;u=!0}else u=!1;else u=!1;if(u)this.maybe(Z.TSemicolon);else{let p=this.token();p!=Z.TSemicolon&&this.unexpected(p)}}return{name:s,meta:e,access:t,kind:ln.KVar({get:r,set:a,type:h,expr:o})};default:this.unexpected(Z.TId(l));break e}}return null}readChar(){return this.input.charCodeAt(this.readPos++)}readString(e){let t=0,l="",i=!1,n=this.line,s=this.input,r=this.readPos+this.offset-1;for(;;){let a=this.input.charCodeAt(this.readPos++);if(a!=a){if(this.line=n,!this.resumeErrors)throw C.thrown(new Se(Te.EUnterminatedString,r,r,this.origin,this.line));break}if(i)switch(i=!1,a){case 47:this.allowJSON?l+=String.fromCodePoint(a):this.invalidChar(a);break;case 34:case 39:case 92:l+=String.fromCodePoint(a);break;case 110:l+=String.fromCodePoint(10);break;case 114:l+=String.fromCodePoint(13);break;case 116:l+=String.fromCodePoint(9);break;case 117:this.allowJSON||this.invalidChar(a);let h=0,o=0;for(;o<4;){let u=o++;h<<=4;let p=this.input.charCodeAt(this.readPos++);switch(p){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:h+=p-48;break;case 65:case 66:case 67:case 68:case 69:case 70:h+=p-55;break;case 97:case 98:case 99:case 100:case 101:case 102:h+=p-87;break;default:if(p!=p&&(this.line=n,!this.resumeErrors))throw C.thrown(new Se(Te.EUnterminatedString,r,r,this.origin,this.line));this.invalidChar(p)}}l+=String.fromCodePoint(h);break;default:this.invalidChar(a)}else if(a==92)i=!0;else{if(a==e)break;a==10&&this.line++,l+=String.fromCodePoint(a)}}return l}token(){let e=this.tokens.pop();if(e!=null)return this.tokenMin=e.min,this.tokenMax=e.max,e.t;this.oldTokenMin=this.tokenMin,this.oldTokenMax=this.tokenMax,this.tokenMin=this.char<0?this.readPos+this.offset:this.readPos+this.offset-1;let t=this._token();return this.tokenMax=this.char<0?this.readPos+this.offset-1:this.readPos+this.offset-2,t}_token(){let e;for(this.char<0?e=this.input.charCodeAt(this.readPos++):(e=this.char,this.char=-1);;){if(e!=e)return this.char=e,Z.TEof;switch(e){case 0:return Z.TEof;case 10:this.line++,this.tokenMin++;break;case 9:case 13:case 32:this.tokenMin++;break;case 34:case 39:return Z.TConst(yl.CString(this.readString(e)));case 35:if(e=this.input.charCodeAt(this.readPos++),this.idents[e]){let i=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),!this.idents[e])return this.char=e,this.preprocess(i);i+=String.fromCodePoint(e)}}this.invalidChar(e);break;case 40:return Z.TPOpen;case 41:return Z.TPClose;case 44:return Z.TComma;case 46:switch(e=this.input.charCodeAt(this.readPos++),e){case 46:return e=this.input.charCodeAt(this.readPos++),e!=46&&this.invalidChar(e),Z.TOp("...");case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:let i=e-48,n=1;for(;;)switch(e=this.input.charCodeAt(this.readPos++),n*=10,e){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:i=i*10+(e-48);break;default:return this.char=e,Z.TConst(yl.CFloat(i/n))}break;default:return this.char=e,Z.TDot}break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:let t=(e-48)*1,l=0;for(;;)switch(e=this.input.charCodeAt(this.readPos++),l*=10,e){case 46:if(l>0){if(l==10&&this.input.charCodeAt(this.readPos++)==46){this.tokens.push({t:Z.TOp("..."),min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let a=t|0;return Z.TConst(a==t?yl.CInt(a):yl.CFloat(t))}this.invalidChar(e)}l=1;break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:t=t*10+(e-48);break;case 69:case 101:let i=this.token(),n=null;switch(i._hx_index){case 1:let a=i.c;a._hx_index==0?n=a.v:(this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax);break;case 3:if(i.s=="-")if(i=this.token(),i._hx_index==1){let h=i.c;h._hx_index==0?n=-h.v:(this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax)}else this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;else this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;default:this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}return n==null&&this.invalidChar(e),l==0&&(l=10),Z.TConst(yl.CFloat(Math.pow(10,n)/l*t*10));case 120:(t>0||l>0)&&this.invalidChar(e);let s=0;for(;;)switch(e=this.input.charCodeAt(this.readPos++),e){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:s=(s<<4)+e-48;break;case 65:case 66:case 67:case 68:case 69:case 70:s=(s<<4)+(e-55);break;case 97:case 98:case 99:case 100:case 101:case 102:s=(s<<4)+(e-87);break;default:return this.char=e,Z.TConst(yl.CInt(s))}break;default:this.char=e;let r=t|0;return Z.TConst(l>0?yl.CFloat(t*10/l):r==t?yl.CInt(r):yl.CFloat(t))}break;case 58:return Z.TDoubleDot;case 59:return Z.TSemicolon;case 61:return e=this.input.charCodeAt(this.readPos++),e==61?Z.TOp("=="):e==62?Z.TOp("=>"):(this.char=e,Z.TOp("="));case 63:return e=this.input.charCodeAt(this.readPos++),e==46?Z.TQuestionDot:(this.char=e,Z.TQuestion);case 64:if(e=this.input.charCodeAt(this.readPos++),this.idents[e]||e==58){let i=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),!this.idents[e])return this.char=e,Z.TMeta(i);i+=String.fromCodePoint(e)}}this.invalidChar(e);break;case 91:return Z.TBkOpen;case 93:return Z.TBkClose;case 123:return Z.TBrOpen;case 125:return Z.TBrClose;default:if(this.ops[e]){let i=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),e!=e&&(e=0),!this.ops[e])return this.char=e,Z.TOp(i);let n=i;if(i+=String.fromCodePoint(e),!Object.prototype.hasOwnProperty.call(this.opPriority.h,i)&&Object.prototype.hasOwnProperty.call(this.opPriority.h,n))return i=="//"||i=="/*"?this.tokenComment(i,e):(this.char=e,Z.TOp(n))}}if(this.idents[e]){let i=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),e!=e&&(e=0),!this.idents[e])return this.char=e,Z.TId(i);i+=String.fromCodePoint(e)}}this.invalidChar(e)}e=this.input.charCodeAt(this.readPos++)}}preprocValue(e){return this.preprocesorValues.h[e]}parsePreproCond(){let e=this.token();switch(e._hx_index){case 2:let t=e.s,l=K.EIdent(t),i=this.tokenMin,n=this.tokenMax;return l==null?null:(i==null&&(i=this.tokenMin),n==null&&(n=this.tokenMax),{e:l,pmin:i,pmax:n,origin:this.origin,line:this.line});case 3:if(e.s=="!"){let s=K.EUnop("!",!0,this.parsePreproCond()),r=this.tokenMin,a=this.tokenMax;return s==null?null:(r==null&&(r=this.tokenMin),a==null&&(a=this.tokenMax),{e:s,pmin:r,pmax:a,origin:this.origin,line:this.line})}else return this.unexpected(e);break;case 4:return this.tokens.push({t:Z.TPOpen,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.parseExpr();default:return this.unexpected(e)}}evalPreproCond(e){let t=e.e;switch(t._hx_index){case 1:let l=t.v;return this.preprocValue(l)!=null;case 3:let i=t.e;return this.evalPreproCond(i);case 6:let n=t.e1,s=t.e2;switch(t.op){case"&&":let h=n,o=s;return this.evalPreproCond(h)?this.evalPreproCond(o):!1;case"||":let u=n,p=s;return this.evalPreproCond(u)?!0:this.evalPreproCond(p);default:let _=e.e;if(!this.resumeErrors)throw C.thrown(new Se(Te.EInvalidPreprocessor("Can't eval "+Ye[_.__enum__].__constructs__[_._hx_index]._hx_name),this.readPos+this.offset,this.readPos+this.offset,this.origin,this.line));return!1}break;case 7:let r=t.prefix;if(t.op=="!"){let h=t.e;return!this.evalPreproCond(h)}else{let h=e.e;if(!this.resumeErrors)throw C.thrown(new Se(Te.EInvalidPreprocessor("Can't eval "+Ye[h.__enum__].__constructs__[h._hx_index]._hx_name),this.readPos+this.offset,this.readPos+this.offset,this.origin,this.line));return!1}break;default:let a=e.e;if(!this.resumeErrors)throw C.thrown(new Se(Te.EInvalidPreprocessor("Can't eval "+Ye[a.__enum__].__constructs__[a._hx_index]._hx_name),this.readPos+this.offset,this.readPos+this.offset,this.origin,this.line));return!1}}preprocess(e){switch(e){case"else":case"elseif":return this.preprocStack.length>0?this.preprocStack[this.preprocStack.length-1].r?(this.preprocStack[this.preprocStack.length-1].r=!1,this.skipTokens(),this.token()):e=="else"?(this.preprocStack.pop(),this.preprocStack.push({r:!0}),this.token()):(this.preprocStack.pop(),this.preprocess("if")):Z.TPrepro(e);case"end":return this.preprocStack.length>0?(this.preprocStack.pop(),this.token()):Z.TPrepro(e);case"if":let t=this.parsePreproCond();return this.evalPreproCond(t)?(this.preprocStack.push({r:!0}),this.token()):(this.preprocStack.push({r:!1}),this.skipTokens(),this.token());default:return Z.TPrepro(e)}}skipTokens(){let e=this.preprocStack.length-1,t=this.preprocStack[e],l=this.readPos+this.offset;for(;;){let i=this.token();if(i==Z.TEof&&!this.resumeErrors)throw C.thrown(new Se(Te.EInvalidPreprocessor("Unclosed"),l,l,this.origin,this.line));if(this.preprocStack[e]!=t){this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}}tokenComment(e,t){let l=c.cca(e,1),i=this.input;if(l==47){for(;t!=13&&t!=10&&(t=this.input.charCodeAt(this.readPos++),t==t););return this.char=t,this.token()}if(l==42){let n=this.line;if(e=="/**/")return this.char=t,this.token();do{for(;t!=42;)if(t==10&&this.line++,t=this.input.charCodeAt(this.readPos++),t!=t){if(this.line=n,!this.resumeErrors)throw C.thrown(new Se(Te.EUnterminatedComment,this.tokenMin,this.tokenMin,this.origin,this.line));break}if(t=this.input.charCodeAt(this.readPos++),t!=t){if(this.line=n,!this.resumeErrors)throw C.thrown(new Se(Te.EUnterminatedComment,this.tokenMin,this.tokenMin,this.origin,this.line));break}}while(t!=47);return this.token()}return this.char=t,Z.TOp(e)}constString(e){switch(e._hx_index){case 0:let t=e.v;return t==null?"null":""+t;case 1:let l=e.f;return l==null?"null":""+l;case 2:return e.s}}tokenString(e){switch(e._hx_index){case 0:return"<eof>";case 1:let t=e.c;return this.constString(t);case 2:return e.s;case 3:return e.s;case 4:return"(";case 5:return")";case 6:return"{";case 7:return"}";case 8:return".";case 9:return"?.";case 10:return",";case 11:return";";case 12:return"[";case 13:return"]";case 14:return"?";case 15:return":";case 16:return"@"+e.s;case 17:return"#"+e.s}}}Q["loreline.lorscript.Parser"]=ci,ci.__name__="loreline.lorscript.Parser",Object.assign(ci.prototype,{__class__:ci,__properties__:{get_currentPos:"get_currentPos"}});class ki{constructor(){}exprToString(e){return this.buf=new gt,this.tabs="",this.expr(e),this.buf.b}typeToString(e){return this.buf=new gt,this.tabs="",this.type(e),this.buf.b}add(e){this.buf.b+=Y.string(e)}type(e){switch(e._hx_index){case 0:let t=e.path,l=e.params,i=t.join(".");if(this.buf.b+=Y.string(i),l!=null){this.buf.b+="<";let g=!0,d=0;for(;d<l.length;){let w=l[d];++d,g?g=!1:this.buf.b+=", ",this.type(w)}this.buf.b+=">"}break;case 1:let n=e.args,s=e.ret,r=n,a=s;if(cn.exists(r,function(g){if(g._hx_index==5){let d=g.n,w=g.t;return!0}else return!1})){this.buf.b+="(";let g=0;for(;g<r.length;){let d=r[g];if(++g,d._hx_index==5){let w=d.n,y=d.t;this.type(d)}else this.type(sl.CTNamed("_",d))}this.buf.b+=")->",this.type(a)}else{let g=n,d=s;if(g.length==0)this.buf.b+="Void -> ";else{let w=0;for(;w<g.length;){let y=g[w];++w,this.type(y),this.buf.b+=" -> "}}this.type(d)}break;case 2:let h=e.fields;this.buf.b+="{";let o=!0,u=0;for(;u<h.length;){let g=h[u];++u,o?(o=!1,this.buf.b+=" "):this.buf.b+=", ",this.buf.b+=Y.string(g.name+" : "),this.type(g.t)}this.buf.b+=o?"}":" }";break;case 3:let p=e.t;this.buf.b+="(",this.type(p),this.buf.b+=")";break;case 4:let _=e.t;this.buf.b+="?",this.type(_);break;case 5:let m=e.n,f=e.t;this.buf.b+=m==null?"null":""+m,this.buf.b+=":",this.type(f);break}}addType(e){e!=null&&(this.buf.b+=" : ",this.type(e))}expr(e){if(e==null){this.buf.b+="??NULL??";return}let t=e.e;switch(t._hx_index){case 0:let l=t.c;switch(l._hx_index){case 0:let Oe=l.v;this.buf.b+=Oe==null?"null":""+Oe;break;case 1:let Ie=l.f;this.buf.b+=Ie==null?"null":""+Ie;break;case 2:let pt=l.s;this.buf.b+='"';let it=pt.split('"').join('\\"').split(`
|
|
45
|
+
`).join("\\n").split("\r").join("\\r").split(" ").join("\\t");this.buf.b+=Y.string(it),this.buf.b+='"';break}break;case 1:let i=t.v;this.buf.b+=i==null?"null":""+i;break;case 2:let n=t.n,s=t.t,r=t.e;this.buf.b+=Y.string("var "+n),this.addType(s),r!=null&&(this.buf.b+=" = ",this.expr(r));break;case 3:let a=t.e;this.buf.b+="(",this.expr(a),this.buf.b+=")";break;case 4:let h=t.e;if(h.length==0)this.buf.b+="{}";else{this.tabs+=" ",this.buf.b+=`{
|
|
46
|
+
`;let Oe=0;for(;Oe<h.length;){let Ie=h[Oe];++Oe,this.buf.b+=Y.string(this.tabs),this.expr(Ie),this.buf.b+=`;
|
|
47
|
+
`}this.tabs=c.substr(this.tabs,1,null),this.buf.b+="}"}break;case 5:let o=t.e,u=t.f;this.expr(o),this.buf.b+=Y.string("."+u);break;case 6:let p=t.op,_=t.e1,m=t.e2;this.expr(_),this.buf.b+=Y.string(" "+p+" "),this.expr(m);break;case 7:let f=t.op,g=t.prefix,d=t.e;g?(this.buf.b+=f==null?"null":""+f,this.expr(d)):(this.expr(d),this.buf.b+=f==null?"null":""+f);break;case 8:let w=t.e,y=t.params;if(w==null)this.expr(w);else{let Oe=w.e;switch(Oe._hx_index){case 0:let Ie=Oe.c;this.expr(w);break;case 1:let pt=Oe.v;this.expr(w);break;case 5:let it=Oe.e,Ot=Oe.f;this.expr(w);break;default:this.buf.b+="(",this.expr(w),this.buf.b+=")"}}this.buf.b+="(";let S=!0,T=0;for(;T<y.length;){let Oe=y[T];++T,S?S=!1:this.buf.b+=", ",this.expr(Oe)}this.buf.b+=")";break;case 9:let O=t.cond,E=t.e1,v=t.e2;this.buf.b+="if( ",this.expr(O),this.buf.b+=" ) ",this.expr(E),v!=null&&(this.buf.b+=" else ",this.expr(v));break;case 10:let M=t.cond,A=t.e;this.buf.b+="while( ",this.expr(M),this.buf.b+=" ) ",this.expr(A);break;case 11:let L=t.v,I=t.it,q=t.e;this.buf.b+=Y.string("for( "+L+" in "),this.expr(I),this.buf.b+=" ) ",this.expr(q);break;case 12:this.buf.b+="break";break;case 13:this.buf.b+="continue";break;case 14:let z=t.args,P=t.e,B=t.name,N=t.ret;this.buf.b+="function",B!=null&&(this.buf.b+=Y.string(" "+B)),this.buf.b+="(";let D=!0,U=0;for(;U<z.length;){let Oe=z[U];++U,D?D=!1:this.buf.b+=", ",Oe.opt&&(this.buf.b+="?"),this.buf.b+=Y.string(Oe.name),this.addType(Oe.t)}this.buf.b+=")",this.addType(N),this.buf.b+=" ",this.expr(P);break;case 15:let W=t.e;this.buf.b+="return",W!=null&&(this.buf.b+=" ",this.expr(W));break;case 16:let J=t.e,H=t.index;this.expr(J),this.buf.b+="[",this.expr(H),this.buf.b+="]";break;case 17:let X=t.e;this.buf.b+="[";let ae=!0,ce=0;for(;ce<X.length;){let Oe=X[ce];++ce,ae?ae=!1:this.buf.b+=", ",this.expr(Oe)}this.buf.b+="]";break;case 18:let ne=t.cl,re=t.params;this.buf.b+=Y.string("new "+ne+"(");let xe=!0,Pe=0;for(;Pe<re.length;){let Oe=re[Pe];++Pe,xe?xe=!1:this.buf.b+=", ",this.expr(Oe)}this.buf.b+=")";break;case 19:let Ue=t.e;this.buf.b+="throw ",this.expr(Ue);break;case 20:let Je=t.e,lt=t.v,Ve=t.t,Qe=t.ecatch;this.buf.b+="try ",this.expr(Je),this.buf.b+=Y.string(" catch( "+lt),this.addType(Ve),this.buf.b+=") ",this.expr(Qe);break;case 21:let at=t.fl;if(at.length==0)this.buf.b+="{}";else{this.tabs+=" ",this.buf.b+=`{
|
|
48
|
+
`;let Oe=0;for(;Oe<at.length;){let Ie=at[Oe];++Oe,this.buf.b+=Y.string(this.tabs),this.buf.b+=Y.string(Ie.name+" : "),this.expr(Ie.e),this.buf.b+=`,
|
|
49
|
+
`}this.tabs=c.substr(this.tabs,1,null),this.buf.b+="}"}break;case 22:let Re=t.cond,$=t.e1,se=t.e2;this.expr(Re),this.buf.b+=" ? ",this.expr($),this.buf.b+=" : ",this.expr(se);break;case 23:let j=t.e,ie=t.cases,le=t.defaultExpr;this.buf.b+="switch( ",this.expr(j),this.buf.b+=") {";let ee=0;for(;ee<ie.length;){let Oe=ie[ee];++ee,this.buf.b+="case ";let Ie=!0,pt=0,it=Oe.values;for(;pt<it.length;){let Ot=it[pt];++pt,Ie?Ie=!1:this.buf.b+=", ",this.expr(Ot)}this.buf.b+=": ",this.expr(Oe.expr),this.buf.b+=`;
|
|
50
|
+
`}le!=null&&(this.buf.b+="default: ",this.expr(le),this.buf.b+=`;
|
|
51
|
+
`),this.buf.b+="}";break;case 24:let pe=t.cond,me=t.e;this.buf.b+="do ",this.expr(me),this.buf.b+=" while ( ",this.expr(pe),this.buf.b+=" )";break;case 25:let we=t.name,Ze=t.args,yt=t.e;if(this.buf.b+="@",this.buf.b+=we==null?"null":""+we,Ze!=null&&Ze.length>0){this.buf.b+="(";let Oe=!0,Ie=0;for(;Ie<Ze.length;){let pt=Ze[Ie];++Ie,Oe?Oe=!1:this.buf.b+=", ",this.expr(yt)}this.buf.b+=")"}this.buf.b+=" ",this.expr(yt);break;case 26:let Le=t.e,dt=t.t;this.buf.b+="(",this.expr(Le),this.buf.b+=" : ",this.addType(dt),this.buf.b+=")";break}}static toString(e){return new ki().exprToString(e)}static errorToString(e){let t,l=e.e;switch(l._hx_index){case 0:let i=l.c;t="Invalid character: '"+(i!=i?"EOF":String.fromCodePoint(i))+"' ("+i+")";break;case 1:t='Unexpected token: "'+l.s+'"';break;case 2:t="Unterminated string";break;case 3:t="Unterminated comment";break;case 4:t="Invalid preprocessor ("+l.msg+")";break;case 5:t="Unknown variable: "+l.v;break;case 6:t="Invalid iterator: "+l.v;break;case 7:t="Invalid operator: "+l.op;break;case 8:t="Invalid access to field "+l.f;break;case 9:t=l.msg;break}return e.origin+":"+e.line+": "+t}}Q["loreline.lorscript.Printer"]=ki,ki.__name__="loreline.lorscript.Printer",Object.assign(ki.prototype,{__class__:ki});class un{static iter(e,t){let l=e.e;switch(l._hx_index){case 0:let i=l.c;break;case 1:let n=l.v;break;case 2:let s=l.n,r=l.t,a=l.e;a!=null&&t(a);break;case 3:let h=l.e;t(h);break;case 4:let o=l.e,u=0;for(;u<o.length;){let Le=o[u];++u,t(Le)}break;case 5:let p=l.f,_=l.e;t(_);break;case 6:let m=l.op,f=l.e1,g=l.e2;t(f),t(g);break;case 7:let d=l.op,w=l.prefix,y=l.e;t(y);break;case 8:let S=l.e,T=l.params;t(S);let O=0;for(;O<T.length;){let Le=T[O];++O,t(Le)}break;case 9:let E=l.cond,v=l.e1,M=l.e2;t(E),t(v),M!=null&&t(M);break;case 10:let A=l.cond,L=l.e;t(A),t(L);break;case 11:let I=l.v,q=l.it,z=l.e;t(q),t(z);break;case 12:case 13:break;case 14:let P=l.args,B=l.name,N=l.ret,D=l.e;t(D);break;case 15:let U=l.e;U!=null&&t(U);break;case 16:let W=l.e,J=l.index;t(W),t(J);break;case 17:let H=l.e,X=0;for(;X<H.length;){let Le=H[X];++X,t(Le)}break;case 18:let ae=l.cl,ce=l.params,ne=0;for(;ne<ce.length;){let Le=ce[ne];++ne,t(Le)}break;case 19:let re=l.e;t(re);break;case 20:let xe=l.v,Pe=l.t,Ue=l.e,Je=l.ecatch;t(Ue),t(Je);break;case 21:let lt=l.fl,Ve=0;for(;Ve<lt.length;){let Le=lt[Ve];++Ve,t(Le.e)}break;case 22:let Qe=l.cond,at=l.e1,Re=l.e2;t(Qe),t(at),t(Re);break;case 23:let $=l.e,se=l.cases,j=l.defaultExpr;t($);let ie=0;for(;ie<se.length;){let Le=se[ie];++ie;let dt=0,Oe=Le.values;for(;dt<Oe.length;){let Ie=Oe[dt];++dt,t(Ie)}t(Le.expr)}j!=null&&t(j);break;case 24:let le=l.cond,ee=l.e;t(le),t(ee);break;case 25:let pe=l.name,me=l.args,we=l.e;if(me!=null){let Le=0;for(;Le<me.length;){let dt=me[Le];++Le,t(dt)}}t(we);break;case 26:let Ze=l.t,yt=l.e;t(yt);break}}static map(e,t){let l,i=e.e;switch(i._hx_index){case 0:let n=i.c;l=e.e;break;case 1:let s=i.v;l=e.e;break;case 2:let r=i.n,a=i.t,h=i.e;l=K.EVar(r,a,h!=null?t(h):null);break;case 3:let o=i.e;l=K.EParent(t(o));break;case 4:let u=i.e,p=[],_=0;for(;_<u.length;){let $e=u[_];++_,p.push(t($e))}l=K.EBlock(p);break;case 5:let m=i.e,f=i.f;l=K.EField(t(m),f);break;case 6:let g=i.op,d=i.e1,w=i.e2;l=K.EBinop(g,t(d),t(w));break;case 7:let y=i.op,S=i.prefix,T=i.e;l=K.EUnop(y,S,t(T));break;case 8:let O=i.e,E=i.params,v=t(O),M=[],A=0;for(;A<E.length;){let $e=E[A];++A,M.push(t($e))}l=K.ECall(v,M);break;case 9:let L=i.cond,I=i.e1,q=i.e2;l=K.EIf(t(L),t(I),q!=null?t(q):null);break;case 10:let z=i.cond,P=i.e;l=K.EWhile(t(z),t(P));break;case 11:let B=i.v,N=i.it,D=i.e;l=K.EFor(B,t(N),t(D));break;case 12:case 13:l=e.e;break;case 14:let U=i.args,W=i.e,J=i.name,H=i.ret;l=K.EFunction(U,t(W),J,H);break;case 15:let X=i.e;l=K.EReturn(X!=null?t(X):null);break;case 16:let ae=i.e,ce=i.index;l=K.EArray(t(ae),t(ce));break;case 17:let ne=i.e,re=[],xe=0;for(;xe<ne.length;){let $e=ne[xe];++xe,re.push(t($e))}l=K.EArrayDecl(re);break;case 18:let Pe=i.cl,Ue=i.params,Je=[],lt=0;for(;lt<Ue.length;){let $e=Ue[lt];++lt,Je.push(t($e))}l=K.ENew(Pe,Je);break;case 19:let Ve=i.e;l=K.EThrow(t(Ve));break;case 20:let Qe=i.e,at=i.v,Re=i.t,$=i.ecatch;l=K.ETry(t(Qe),at,Re,t($));break;case 21:let se=i.fl,j=[],ie=0;for(;ie<se.length;){let $e=se[ie];++ie,j.push({name:$e.name,e:t($e.e)})}l=K.EObject(j);break;case 22:let le=i.cond,ee=i.e1,pe=i.e2;l=K.ETernary(t(le),t(ee),t(pe));break;case 23:let me=i.e,we=i.cases,Ze=i.defaultExpr,yt=t(me),Le=[],dt=0;for(;dt<we.length;){let $e=we[dt];++dt;let Vt=[],Bt=0,qt=$e.values;for(;Bt<qt.length;){let wt=qt[Bt];++Bt,Vt.push(t(wt))}Le.push({values:Vt,expr:t($e.expr)})}l=K.ESwitch(yt,Le,Ze==null?null:t(Ze));break;case 24:let Oe=i.cond,Ie=i.e;l=K.EDoWhile(t(Oe),t(Ie));break;case 25:let pt=i.name,it=i.args,Ot=i.e,Yt;if(it==null)Yt=null;else{let $e=[],Vt=0;for(;Vt<it.length;){let Bt=it[Vt];++Vt,$e.push(t(Bt))}Yt=$e}l=K.EMeta(pt,Yt,t(Ot));break;case 26:let xt=i.e,ol=i.t;l=K.ECheckType(t(xt),ol);break}return{e:l,pmin:e.pmin,pmax:e.pmax,origin:e.origin,line:e.line}}static expr(e){return e.e}static mk(e,t){return{e,pmin:t.pmin,pmax:t.pmax,origin:t.origin,line:t.line}}}Q["loreline.lorscript.Tools"]=un,un.__name__="loreline.lorscript.Tools";class Ut{static toLoreline(e,t){return Ut.convert(e,44,t)}static tsvToLoreline(e,t){return Ut.convert(e,9,t)}static convert(e,t,l){let i=Ut.parseRows(e,t);if(i.length<1)throw C.thrown(new st("Invalid CSV: header row required"));if(i.length<2)return"";let n=i[0],s=Ut.findColumn(n,["key"]);if(s<0)throw C.thrown(new st("Invalid CSV: 'key' column not found in header"));let r=Ut.findColumn(n,["source","en","original"]),a=Ut.findLocaleColumn(n,l);if(a<0)if(n.length>=2)a=n.length-1;else return"";let h="",o=!0,u=1,p=i.length;for(;u<p;){let _=u++,m=i[_];if(m.length<=s)continue;let f=m[s];if(f==null||f==""||m.length<=a)continue;let g=m[a];if(g==null||g=="")continue;let d=r>=0&&m.length>r?m[r]:null;o||(h+=`
|
|
52
|
+
`),o=!1,h+="#",h+=f==null?"null":""+f,d!=null&&d!=""&&(h+=" // ",h+=Y.string(d.split(`
|
|
53
|
+
`).join(" ").split("\r").join(""))),h+=`
|
|
54
|
+
`,h+=g==null?"null":""+g,h+=`
|
|
55
|
+
`}return h}static fromScript(e,t,l){return Ut.generate(e,t,l,44)}static tsvFromScript(e,t,l){return Ut.generate(e,t,l,9)}static generate(e,t,l,i){let n=et.extractTranslatableEntries(e),s=new Wl,r="",a=String.fromCodePoint(i);r+=Y.string(Ut.escapeForCsvField("key",i)),r+=a==null?"null":""+a,r+=Y.string(Ut.escapeForCsvField("source",i)),r+=a==null?"null":""+a,r+=Y.string(Ut.escapeForCsvField(l,i)),r+=`
|
|
56
|
+
`;let h=0;for(;h<n.length;){let o=n[h];++h;let u=s.printStringLiteralAsText(o.str),p=t!=null&&Object.prototype.hasOwnProperty.call(t.h,o.id)?s.printStringLiteralAsText(t.h[o.id]):u;r+=Y.string(Ut.escapeForCsvField(o.id,i)),r+=a==null?"null":""+a,r+=Y.string(Ut.escapeForCsvField(u,i)),r+=a==null?"null":""+a,r+=Y.string(Ut.escapeForCsvField(p,i)),r+=`
|
|
57
|
+
`}return r}static escapeForCsvField(e,t){let l=!1,i=0,n=e.length;for(;i<n;){let s=i++,r=c.cca(e,s),a=r??-1;if(a==t||a==34||a==10||a==13){l=!0;break}}return l?'"'+e.split('"').join('""')+'"':e}static findColumn(e,t){let l=0,i=e.length;for(;l<i;){let n=l++,s=e[n].toLowerCase(),r=0;for(;r<t.length;){let a=t[r];if(++r,s==a)return n}}return-1}static findLocaleColumn(e,t){let l=t.toLowerCase(),i=0,n=e.length;for(;i<n;){let o=i++;if(e[o].toLowerCase()==l)return o}let s=l.indexOf("-",null),r=s<0?l:s!=null?c.substr(l,0,s):c.substr(l,0,null),a=0,h=e.length;for(;a<h;){let o=a++,u=e[o].toLowerCase(),p=u.indexOf("-",null);if((p<0?u:p!=null?c.substr(u,0,p):c.substr(u,0,null))==r)return o}return-1}static primarySubtag(e){let t=e.indexOf("-",null);return t<0?e:t!=null?c.substr(e,0,t):c.substr(e,0,null)}static parseRows(e,t){let l=[],i=[],n=new gt,s=!1,r=0,a=e.length;for(;r<a;){let h=c.cca(e,r),o=h??-1;if(s)if(o==34){let u;if(r+1<a){let p=c.cca(e,r+1);u=(p??-1)==34}else u=!1;u?(n.b+=String.fromCodePoint(34),r+=2):(s=!1,++r)}else n.b+=String.fromCodePoint(o),++r;else if(o==34)s=!0,++r;else if(o==t)i.push(n.b),n=new gt,++r;else if(o==10||o==13){i.push(n.b),n=new gt,(i.length>1||i.length==1&&i[0]!="")&&l.push(i),i=[];let u;if(o==13&&r+1<a){let p=c.cca(e,r+1);u=(p??-1)==10}else u=!1;u?r+=2:++r}else n.b+=String.fromCodePoint(o),++r}return(n.b!=""||i.length>0)&&(i.push(n.b),(i.length>1||i.length==1&&i[0]!="")&&l.push(i)),l}static escapeLineForComment(e){return e.split(`
|
|
58
|
+
`).join(" ").split("\r").join("")}}Q["loreline.translation.CsvTranslation"]=Ut,Ut.__name__="loreline.translation.CsvTranslation";class bl{static toLoreline(e,t){let l=bl.parse(e),i="",n=!0,s=0;for(;s<l.length;){let r=l[s];if(++s,r.msgstr==null||r.msgstr=="")continue;let a=r.msgctxt!=null&&r.msgctxt!=""?r.msgctxt:r.msgid;a==null||a==""||(n||(i+=`
|
|
59
|
+
`),n=!1,i+="#",i+=a==null?"null":""+a,r.msgctxt!=null&&r.msgid!=null&&r.msgid!=""&&(i+=" // ",i+=Y.string(bl.escapeLineForComment(r.msgid))),i+=`
|
|
60
|
+
`,i+=Y.string(bl.escapeLineForBody(r.msgstr)),i+=`
|
|
61
|
+
`)}return i}static fromScript(e,t,l){let i=et.extractTranslatableEntries(e),n=new Wl,s="";s+=`msgid ""
|
|
62
|
+
`,s+=`msgstr ""
|
|
63
|
+
`,s+=`"Content-Type: text/plain; charset=UTF-8\\n"
|
|
64
|
+
`,s+='"Language: ',s+=Y.string(bl.escapeForPoString(l)),s+=`\\n"
|
|
65
|
+
`;let r=0;for(;r<i.length;){let a=i[r];++r,s+=`
|
|
66
|
+
`;let h=n.printStringLiteralAsText(a.str),o=t!=null&&Object.prototype.hasOwnProperty.call(t.h,a.id)?n.printStringLiteralAsText(t.h[a.id]):h;s+='msgctxt "',s+=Y.string(bl.escapeForPoString(a.id)),s+=`"
|
|
67
|
+
`,s+='msgid "',s+=Y.string(bl.escapeForPoString(h)),s+=`"
|
|
68
|
+
`,s+='msgstr "',s+=Y.string(bl.escapeForPoString(o)),s+=`"
|
|
69
|
+
`}return s}static escapeForPoString(e){let t=e.split("\\").join("\\\\");return t=t.split('"').join('\\"'),t}static parse(e){let t=e.split(`
|
|
70
|
+
`),l=[],i=null,n=0;for(;n<t.length;){let s=t[n],r;if(s.length>0){let g=c.cca(s,s.length-1);r=(g??-1)==13}else r=!1;if(r){let g=s.length-1;s=g!=null?c.substr(s,0,g):c.substr(s,0,null)}let a=0,h=s.length;for(;a<h;){let g=c.cca(s,a),d=g??-1;if(d!=32&&d!=9)break;++a}let o;if(a==0)o=s;else{let g=null;o=g!=null?c.substr(s,a,g):c.substr(s,a,null)}if(o==""){i!=null&&(l.push(i),i=null),++n;continue}let u=c.cca(o,0);if((u??-1)==35){++n;continue}i==null&&(i=new sn);let p=bl.readKeyword(o);if(p==null){++n;continue}let _=bl.readQuotedString(o,p.length),m=_??"",f=n+1;for(;f<t.length;){let g=t[f],d;if(g.length>0){let E=c.cca(g,g.length-1);d=(E??-1)==13}else d=!1;if(d){let E=g.length-1;g=E!=null?c.substr(g,0,E):c.substr(g,0,null)}let w=0,y=g.length;for(;w<y;){let E=c.cca(g,w),v=E??-1;if(v!=32&&v!=9)break;++w}let S;if(w==0)S=g;else{let E=null;S=E!=null?c.substr(g,w,E):c.substr(g,w,null)}let T;if(S.length!=0){let E=c.cca(S,0);T=(E??-1)!=34}else T=!0;if(T)break;let O=bl.readQuotedString(S,0);O!=null&&(m+=O),++f}switch(p){case"msgctxt":i.msgctxt=m;break;case"msgid":i.msgid=m;break;case"msgstr":i.msgstr=m;break;default:p=="msgstr[0]"&&(i.msgstr=m)}n=f}return i!=null&&l.push(i),l}static readKeyword(e){let t=0,l=e.length;for(;t<l;){let i=c.cca(e,t),n=i??-1;if(n==32||n==9)break;++t}return t==0?null:t!=null?c.substr(e,0,t):c.substr(e,0,null)}static readQuotedString(e,t){let l=t,i=e.length;for(;l<i;){let r=c.cca(e,l),a=r??-1;if(a!=32&&a!=9)break;++l}let n;if(l<i){let r=c.cca(e,l);n=(r??-1)!=34}else n=!0;if(n)return null;++l;let s="";for(;l<i;){let r=c.cca(e,l),a=r??-1;if(a==92&&l+1<i){let h=c.cca(e,l+1),o=h??-1;switch(o){case 34:s+=String.fromCodePoint(34);break;case 92:s+=String.fromCodePoint(92);break;case 110:s+=String.fromCodePoint(10);break;case 114:s+=String.fromCodePoint(13);break;case 116:s+=String.fromCodePoint(9);break;default:s+=String.fromCodePoint(o)}l+=2}else{if(a==34)return s;s+=String.fromCodePoint(a),++l}}throw C.thrown(new st("Invalid PO: unterminated quoted string"))}static trimLeft(e){let t=0,l=e.length;for(;t<l;){let i=c.cca(e,t),n=i??-1;if(n!=32&&n!=9)break;++t}if(t==0)return e;{let i=null;return i!=null?c.substr(e,t,i):c.substr(e,t,null)}}static escapeLineForComment(e){return e.split(`
|
|
71
|
+
`).join(" ").split("\r").join("")}static escapeLineForBody(e){return e}}Q["loreline.translation.PoTranslation"]=bl,bl.__name__="loreline.translation.PoTranslation";class sn{constructor(){}}Q["loreline.translation._PoTranslation.PoEntry"]=sn,sn.__name__="loreline.translation._PoTranslation.PoEntry",Object.assign(sn.prototype,{__class__:sn});class Cl{static convert(e,t,l){switch(e){case".csv":return Ut.toLoreline(t,l);case".po":return bl.toLoreline(t,l);case".tsv":return Ut.tsvToLoreline(t,l);case".xlf":case".xliff":return vt.toLoreline(t,l);default:throw new C("Unknown translation format extension: "+e)}}static translationFormat(e,t){Cl.enabled.h[e]=t}static anyEnabled(){let e=0,t=Cl.formats;for(;e<t.length;){let l=t[e];if(++e,Cl.enabled.h[l.name]==!0)return!0}return!1}static wrap(e,t){if(!Cl.anyEnabled())return new Di(e,function(){return null});let l=null,i=null;i=function(s,r,a,h){if(a>=Cl.formats.length){r?i(s,!1,0,h):h(null);return}let o=Cl.formats[a];if(Cl.enabled.h[o.name]!=!0){i(s,r,a+1,h);return}let u=r?s+"."+t+o.ext:s+o.ext;e(u,function(p){if(p!=null)try{h(Cl.convert(o.ext,p,t))}catch(_){let m=C.caught(_).unwrap();if(m instanceof st){let f=m;l=new st('Failed to load translation file "'+u+'": '+f.message),i(s,r,a+1,h)}else throw _}else i(s,r,a+1,h)})};let n=function(s,r){e(s,function(a){if(a!=null){r(a);return}let h;if(s==null)h=!1;else{let d=s.length;if(d<4)h=!1;else{let w,y,S=c.cca(s,d-4);if((S??-1)==46){let T=c.cca(s,d-3),O=T??-1;y=O==108||O==76}else y=!1;if(y){let T=c.cca(s,d-2),O=T??-1;w=O==111||O==79}else w=!1;if(w){let T=c.cca(s,d-1),O=T??-1;h=O==114||O==82}else h=!1}}if(!h){r(null);return}let o=s.length-4,u=o!=null?c.substr(s,0,o):c.substr(s,0,null),p="."+t,_,m=u.length,f=p.length,g;if(f>m)g=!1;else{let d=m-f;g=(f!=null?c.substr(u,d,f):c.substr(u,d,null))==p}if(g){let d=u.length-p.length;_=d!=null?c.substr(u,0,d):c.substr(u,0,null)}else _=u;i(_,!0,0,r)})};return new Di(n,function(){return l})}static endsWith(e,t){let l=e.length,i=t.length;if(i>l)return!1;let n=l-i;return(i!=null?c.substr(e,n,i):c.substr(e,n,null))==t}}Q["loreline.translation.TranslationFormats"]=Cl,Cl.__name__="loreline.translation.TranslationFormats";class Di{constructor(e,t){this.handler=e,this.lastError=t}}Q["loreline.translation.WrappedFileHandler"]=Di,Di.__name__="loreline.translation.WrappedFileHandler",Object.assign(Di.prototype,{__class__:Di});class vt{static toLoreline(e,t){let l;try{l=ei.parse(e)}catch(p){let _=C.caught(p).unwrap();throw C.thrown(new st("Invalid XLIFF: "+Y.string(_)))}let i=null;if(l.nodeType!=V.Document&&l.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(l.nodeType==null?"null":de.toString(l.nodeType)));let n=0,s=l.children;for(;n<s.length;){let p=s[n++],_;if(p.nodeType==0){if(p.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(p.nodeType==null?"null":de.toString(p.nodeType)));_=p.nodeName=="xliff"}else _=!1;if(_){i=p;break}}if(i==null)throw C.thrown(new st("Invalid XLIFF: missing <xliff> root element"));let r=i.exists("trgLang")?i.get("trgLang"):null,a=r!=null;if(a&&!vt.localeMatches(r,t))return"";let h=new gt,o=!0,u=i.elementsNamed("file");for(;u.hasNext();){let p=u.next();if(!a){let _=p.exists("target-language")?p.get("target-language"):null;if(_!=null&&!vt.localeMatches(_,t))continue}if(a){let _=p.elementsNamed("unit");for(;_.hasNext();){let m=_.next();if(!m.exists("id"))continue;let f=m.get("id"),g=[],d=m.elementsNamed("segment");for(;d.hasNext();){let v=d.next();g.push(v)}let w=g;if(w.length==0)continue;let y=[],S=[],T=0;for(;T<w.length;){let v=w[T];++T;let M=vt.innerText(vt.firstChildElement(v,"source")),A=vt.innerText(vt.firstChildElement(v,"target"));M!=null&&y.push(M),A!=null&&S.push(A)}let O=y.join(""),E=S.join("");E!=""&&(o||(h.b+=`
|
|
72
|
+
`),o=!1,vt.writeEntry(h,f,O,E))}}else{let _=vt.firstChildElement(p,"body");if(_==null)continue;let m=_.elementsNamed("trans-unit");for(;m.hasNext();){let f=m.next();if(!f.exists("id"))continue;let g=f.get("id"),d=vt.innerText(vt.firstChildElement(f,"source")),w=vt.innerText(vt.firstChildElement(f,"target"));w==null||w==""||(o||(h.b+=`
|
|
73
|
+
`),o=!1,vt.writeEntry(h,g,d??"",w))}}}return h.b}static localeMatches(e,t){if(e==t)return!0;let l=e.toLowerCase(),i=t.toLowerCase();if(l==i)return!0;let n=l.indexOf("-",null),s=n<0?l:n!=null?c.substr(l,0,n):c.substr(l,0,null),r=i.indexOf("-",null),a=r<0?i:r!=null?c.substr(i,0,r):c.substr(i,0,null);return s==a}static primarySubtag(e){let t=e.indexOf("-",null);return t<0?e:t!=null?c.substr(e,0,t):c.substr(e,0,null)}static firstChildElement(e,t){if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let l=0,i=e.children;for(;l<i.length;){let n=i[l++],s;if(n.nodeType==0){if(n.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(n.nodeType==null?"null":de.toString(n.nodeType)));s=n.nodeName==t}else s=!1;if(s)return n}return null}static innerText(e){if(e==null)return null;let t="";if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let l=0,i=e.children;for(;l<i.length;){let n=i[l++];switch(n.nodeType){case 0:t+=Y.string(vt.innerText(n));break;case 1:if(n.nodeType==V.Document||n.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":de.toString(n.nodeType)));t+=Y.string(n.nodeValue);break;case 2:if(n.nodeType==V.Document||n.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":de.toString(n.nodeType)));t+=Y.string(n.nodeValue);break;default:}}return t}static fromScript(e,t,l){let i=et.extractTranslatableEntries(e),n=new Wl,s="";s+=`<?xml version="1.0" encoding="UTF-8"?>
|
|
74
|
+
`,s+=`<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
|
|
75
|
+
`,s+=' <file source-language="en" target-language="',s+=Y.string(vt.escapeForXmlAttr(l)),s+=`" datatype="plaintext">
|
|
76
|
+
`,s+=` <body>
|
|
77
|
+
`;let r=0;for(;r<i.length;){let a=i[r];++r;let h=n.printStringLiteralAsText(a.str),o=t!=null&&Object.prototype.hasOwnProperty.call(t.h,a.id)?n.printStringLiteralAsText(t.h[a.id]):h;s+=' <trans-unit id="',s+=Y.string(vt.escapeForXmlAttr(a.id)),s+=`">
|
|
78
|
+
`,s+=" <source>",s+=Y.string(vt.escapeForXmlText(h)),s+=`</source>
|
|
79
|
+
`,s+=" <target>",s+=Y.string(vt.escapeForXmlText(o)),s+=`</target>
|
|
80
|
+
`,s+=` </trans-unit>
|
|
81
|
+
`}return s+=` </body>
|
|
82
|
+
`,s+=` </file>
|
|
83
|
+
`,s+=`</xliff>
|
|
84
|
+
`,s}static escapeForXmlText(e){let t=e.split("&").join("&");return t=t.split("<").join("<"),t=t.split(">").join(">"),t}static escapeForXmlAttr(e){let t=vt.escapeForXmlText(e);return t=t.split('"').join("""),t}static writeEntry(e,t,l,i){if(e.b+="#",e.b+=t==null?"null":""+t,l!=null&&l!=""){e.b+=" // ";let n=l.split(`
|
|
85
|
+
`).join(" ").split("\r").join("");e.b+=Y.string(n)}e.b+=`
|
|
86
|
+
`,e.b+=i==null?"null":""+i,e.b+=`
|
|
87
|
+
`}static escapeLineForComment(e){return e.split(`
|
|
88
|
+
`).join(" ").split("\r").join("")}}Q["loreline.translation.XliffTranslation"]=vt,vt.__name__="loreline.translation.XliffTranslation";function bn(b){return b instanceof Array?new Il(b):b.iterator()}function be(b,e){if(e==null)return null;e.__id__==null&&(e.__id__=on.$haxeUID++);var t;return b.hx__closures__==null?b.hx__closures__={}:t=b.hx__closures__[e.__id__],t==null&&(t=e.bind(b),b.hx__closures__[e.__id__]=t),t}on.$haxeUID|=0,typeof performance<"u"&&typeof performance.now=="function"&&(c.now=performance.now.bind(performance)),Q.Math=Math,String.fromCodePoint==null&&(String.fromCodePoint=function(b){return b<65536?String.fromCharCode(b):String.fromCharCode((b>>10)+55232)+String.fromCharCode((b&1023)+56320)});{Object.defineProperty(String.prototype,"__class__",{value:Q.String=String,enumerable:!1,writable:!0}),String.__name__="String",Q.Array=Array,Array.__name__="Array",Date.prototype.__class__=Q.Date=Date,Date.__name__="Date";var Sn={},vn={},On=Number,Pn=Boolean,In={},Nn={}}te.__toStr={}.toString,V.Element=0,V.PCData=1,V.CData=2,V.Comment=3,V.DocType=4,V.ProcessingInstruction=5,V.Document=6,ei.escapes=(function(b){var e;let t=new Ee;return t.h.lt="<",t.h.gt=">",t.h.amp="&",t.h.quot='"',t.h.apos="'",e=t,e})(this),et.randomId_nonHexChars="ghijklmnopqrstuvwxyz",et.randomId_chars="0123456789abcdefghijklmnopqrstuvwxyz",gi.ObjectBrace=0,gi.ArrayBracket=1,gi.Brace=2,gi.Indent=3,gi.CaseIndent=4,gi.Bracket=5,gi.Paren=6,ti.CONTROL_KEYWORDS=["for","while","if","else","switch","catch"],El.INITIAL_SIZE=16,El.LOAD_FACTOR=.75,Bl.ChoiceBrace=0,Bl.ChoiceIndent=1,Bl.StateBrace=2,Bl.StateIndent=3,Bl.CharacterBrace=4,Bl.CharacterIndent=5,Bl.BeatBrace=6,Bl.BeatIndent=7,Bl.AlternativeBrace=8,Bl.AlternativeIndent=9,Bl.Brace=10,Bl.Indent=11,Bl.Bracket=12,kt.hasNonSpecialChar_specialChars=` "+=*/-(){}[]:
|
|
89
|
+
\r`,kt.KEYWORDS=(function(b){var e;let t=new Ee;return t.h.import=k.KwImport,t.h.state=k.KwState,t.h.beat=k.KwBeat,t.h.character=k.KwCharacter,t.h.choice=k.KwChoice,t.h.if=k.KwIf,t.h.else=k.KwElse,t.h.new=k.KwNew,t.h.sequence=k.KwSequence,t.h.cycle=k.KwCycle,t.h.once=k.KwOnce,t.h.pick=k.KwPick,t.h.shuffle=k.KwShuffle,t.h.true=k.LBoolean(!0),t.h.false=k.LBoolean(!1),t.h.null=k.LNull,t.h.and=k.OpAnd(!0),t.h.or=k.OpOr(!0),e=t,e})(this),Ae.OFFSET=32768,Ae.MAX=65535,Ae.UNDEFINED=new Ae(0,0,0,0),At._hx_skip_constructor=!1,Vl.Plain=0,Vl.Braces=1,Ni.Plain=0,Ni.Parens=2,Mi.Sequence=0,Mi.Cycle=1,Mi.Once=2,Mi.Pick=3,Mi.Shuffle=4,fn.Unquoted=0,fn.DoubleQuotes=1,Zl.timers=[],Cl.formats=[{name:"po",ext:".po"},{name:"xliff",ext:".xliff"},{name:"xliff",ext:".xlf"},{name:"csv",ext:".csv"},{name:"csv",ext:".tsv"}],Cl.enabled=new Ee,_n.main()})(hn,Wn);export const Loreline=hn.loreline.Loreline,Interpreter=hn.loreline.Interpreter,Node=hn.loreline.Node,Script=hn.loreline.Script;
|