loreline 0.5.0 → 0.6.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 +26 -7
- package/js/loreline.js +3804 -2390
- package/js/loreline.min.js +46 -45
- package/package.json +2 -2
package/js/loreline.min.js
CHANGED
|
@@ -1,51 +1,52 @@
|
|
|
1
|
-
"use strict";let
|
|
2
|
-
`);i[0]=="Error"&&i.shift();let
|
|
1
|
+
"use strict";let Jl={},Pn={};(function(Gi,Gl){"use strict";Gi.loreline=Gi.loreline||{};var z={},S=function(){return Y.__string_rec(this,"")},Je=Je||{},g;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()}}z.HxOverrides=p,p.__name__="HxOverrides";class Cl{constructor(e,t){this.min=e,this.max=t}hasNext(){return this.min<this.max}next(){return this.min++}}z.IntIterator=Cl,Cl.__name__="IntIterator",Object.assign(Cl.prototype,{__class__:Cl});class Ql{static exists(e,t){let i=on(e);for(;i.hasNext();){let l=i.next();if(t(l))return!0}return!1}}z.Lambda=Ql,Ql.__name__="Lambda",Math.__name__="Math";class je{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)}}}z.Reflect=je,je.__name__="Reflect";class te{static string(e){return Y.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}}z.Std=te,te.__name__="Std";class $t{constructor(){this.b=""}}z.StringBuf=$t,$t.__name__="StringBuf",Object.assign($t.prototype,{__class__:$t});class Be{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&&Be.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&&Be.isSpace(e,t-i-1);)++i;return i>0?p.substr(e,0,t-i):e}static trim(e){return Be.ltrim(Be.rtrim(e))}static replace(e,t,i){return e.split(t).join(i)}}z.StringTools=Be,Be.__name__="StringTools";var Ct=Je.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:(g=function(k){return{_hx_index:6,c:k,__enum__:"ValueType",toString:S}},g._hx_name="TClass",g.__params__=["c"],g),TEnum:(g=function(k){return{_hx_index:7,e:k,__enum__:"ValueType",toString:S}},g._hx_name="TEnum",g.__params__=["e"],g),TUnknown:{_hx_name:"TUnknown",_hx_index:8,__enum__:"ValueType",toString:S}};Ct.__constructs__=[Ct.TNull,Ct.TInt,Ct.TFloat,Ct.TBool,Ct.TObject,Ct.TFunction,Ct.TClass,Ct.TEnum,Ct.TUnknown];class ce{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 Ct.TBool;case"function":return e.__name__||e.__ename__?Ct.TObject:Ct.TFunction;case"number":return Math.ceil(e)==e%2147483648?Ct.TInt:Ct.TFloat;case"object":if(e==null)return Ct.TNull;let t=e.__enum__;if(t!=null)return Ct.TEnum(Je[t]);let i=Y.getClass(e);return i!=null?Ct.TClass(i):Ct.TObject;case"string":return Ct.TClass(String);case"undefined":return Ct.TNull;default:return Ct.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=Je[i].__constructs__[e._hx_index].__params__,s=0;for(;s<n.length;){let r=n[s];if(++s,!ce.enumEq(e[r],t[r]))return!1}}catch{return!1}return!0}static enumParameters(e){let i=Je[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[]}}z.Type=ce,ce.__name__="Type";class ve{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 ${constructor(e){this.nodeType=e,this.children=[],this.attributeMap=new Se}get(e){if(this.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":ve.toString(this.nodeType)));return this.attributeMap.h[e]}exists(e){if(this.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":ve.toString(this.nodeType)));return Object.prototype.hasOwnProperty.call(this.attributeMap.h,e)}attributes(){if(this.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":ve.toString(this.nodeType)));return new _l(this.attributeMap.h)}elements(){if(this.nodeType!=$.Document&&this.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":ve.toString(this.nodeType)));let e=[],t=0,i=this.children;for(;t<i.length;){let n=i[t];++t,n.nodeType==$.Element&&e.push(n)}let l=e;return new bi(l)}elementsNamed(e){if(this.nodeType!=$.Document&&this.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":ve.toString(this.nodeType)));let t=[],i=0,l=this.children;for(;i<l.length;){let s=l[i];++i;let r;if(s.nodeType==$.Element){if(s.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":ve.toString(s.nodeType)));r=s.nodeName==e}else r=!1;r&&t.push(s)}let n=t;return new bi(n)}firstElement(){if(this.nodeType!=$.Document&&this.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":ve.toString(this.nodeType)));let e=0,t=this.children;for(;e<t.length;){let i=t[e];if(++e,i.nodeType==$.Element)return i}return null}toString(){return Yi.print(this)}}z.Xml=$,$.__name__="Xml",Object.assign($.prototype,{__class__:$});var wi=Je["haxe.StackItem"]={__ename__:"haxe.StackItem",__constructs__:null,CFunction:{_hx_name:"CFunction",_hx_index:0,__enum__:"haxe.StackItem",toString:S},Module:(g=function(k){return{_hx_index:1,m:k,__enum__:"haxe.StackItem",toString:S}},g._hx_name="Module",g.__params__=["m"],g),FilePos:(g=function(k,e,t,i){return{_hx_index:2,s:k,file:e,line:t,column:i,__enum__:"haxe.StackItem",toString:S}},g._hx_name="FilePos",g.__params__=["s","file","line","column"],g),Method:(g=function(k,e){return{_hx_index:3,classname:k,method:e,__enum__:"haxe.StackItem",toString:S}},g._hx_name="Method",g.__params__=["classname","method"],g),LocalFunction:(g=function(k){return{_hx_index:4,v:k,__enum__:"haxe.StackItem",toString:S}},g._hx_name="LocalFunction",g.__params__=["v"],g)};wi.__constructs__=[wi.CFunction,wi.Module,wi.FilePos,wi.Method,wi.LocalFunction];class cn{static callStack(){return yi.toHaxe(yi.callStack())}}class kt{}z["haxe.IMap"]=kt,kt.__name__="haxe.IMap",kt.__isInterface__=!0,Object.assign(kt.prototype,{__class__:kt});class y 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 y?e:e instanceof Error?new y(e.message,null,e):new ll(e,null,e)}static thrown(e){return e instanceof y?e.get_native():e instanceof Error?e:new ll(e)}}z["haxe.Exception"]=y,y.__name__="haxe.Exception",y.__super__=Error,Object.assign(y.prototype,{__class__:y,__properties__:{get_native:"get_native"}});class Li{constructor(e,t){this.high=e,this.low=t}}z["haxe._Int64.___Int64"]=Li,Li.__name__="haxe._Int64.___Int64",Object.assign(Li.prototype,{__class__:Li});class El{static formatOutput(e,t){let i=te.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+=", "+te.string(r)}}return l+": "+i}static trace(e,t){let i=El.formatOutput(e,t);typeof console<"u"&&console.log!=null&&console.log(i)}}z["haxe.Log"]=El,El.__name__="haxe.Log";class yi{static callStack(){let e=new Error(""),t=yi.tryHaxeStack(e);if(typeof t>"u"){try{throw e}catch{}t=e.stack}return yi.normalize(t,2)}static toHaxe(e,t){if(t==null&&(t=0),e==null)return[];if(typeof e=="string"){let i=e.split(`
|
|
2
|
+
`);i[0]=="Error"&&i.shift();let l=[],n=0,s=i.length;for(;n<s;){let r=n++;if(t>r)continue;let h=i[r],a=h.match(/^ at ([$A-Za-z0-9_. ]+) \(([^)]+):([0-9]+):([0-9]+)\)$/);if(a!=null){let o=a[1].split(".");o[0]=="$hxClasses"&&o.shift();let u=o.pop(),c=a[2],f=te.parseInt(a[3]),_=te.parseInt(a[4]);l.push(wi.FilePos(u=="Anonymous function"?wi.LocalFunction():u=="Global code"?null:wi.Method(o.join("."),u),c,f,_))}else l.push(wi.Module(Be.trim(h)))}return l}else return t>0&&Array.isArray(e)?e.slice(t):e}static tryHaxeStack(e){if(e==null)return[];let t=Error.prepareStackTrace;Error.prepareStackTrace=yi.prepareHxStackTrace;let i=e.stack;return Error.prepareStackTrace=t,i}static prepareHxStackTrace(e,t){let i=[],l=0;for(;l<t.length;){let n=t[l];++l,yi.wrapCallSite!=null&&(n=yi.wrapCallSite(n));let s=null,r=n.getFunctionName();if(r!=null){let o=r.lastIndexOf(".");if(o>=0){let u=r.substring(0,o),c=r.substring(o+1);s=wi.Method(u,c)}else s=wi.Method(null,r)}let h=n.getFileName(),a=h==null?-1:h.indexOf("file:");yi.wrapCallSite!=null&&a>0&&(h=h.substring(a+6)),i.push(wi.FilePos(s,h,n.getLineNumber(),n.getColumnNumber()))}return i}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
3
|
`:case"Error:":++t;break;default:}return yi.skipLines(e,t)}else return e}static skipLines(e,t,i){return i==null&&(i=0),t>0?(i=e.indexOf(`
|
|
4
|
-
`,i),i<0?"":yi.skipLines(e,--t,i+1)):e.substring(i)}}K["haxe.NativeStackTrace"]=yi,yi.__name__="haxe.NativeStackTrace";class is extends k{constructor(e,t,i){super(String(e),t,i),this.value=e}unwrap(){return this.value}}K["haxe.ValueException"]=is,is.__name__="haxe.ValueException",is.__super__=k,Object.assign(is.prototype,{__class__:is});class ss{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 bi(e)}setLoop(e,t,i){if(i==null)return new Qt(null,e,t,null);let s=this.compare(e,i.key);if(s==0)return new Qt(i.left,e,t,i.right,i==null?0:i._height);if(s<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,s){let n=e==null?0:e._height,l=s==null?0:s._height;if(n>l+2){let r=e.left,h=e.right;return(r==null?0:r._height)>=(h==null?0:h._height)?new Qt(e.left,e.key,e.value,new Qt(e.right,t,i,s)):new Qt(new Qt(e.left,e.key,e.value,e.right.left),e.right.key,e.right.value,new Qt(e.right.right,t,i,s))}else if(l>n+2){let r=s.right,h=s.left;return(r==null?0:r._height)>(h==null?0:h._height)?new Qt(new Qt(e,t,i,s.left),s.key,s.value,s.right):new Qt(new Qt(e,t,i,s.left.left),s.left.key,s.left.value,new Qt(s.left.right,s.key,s.value,s.right))}else return new Qt(e,t,i,s,(n>l?n:l)+1)}compare(e,t){return Pe.compare(e,t)}}K["haxe.ds.BalancedTree"]=ss,ss.__name__="haxe.ds.BalancedTree",ss.__interfaces__=[ft],Object.assign(ss.prototype,{__class__:ss});class Qt{constructor(e,t,i,s,n){if(n==null&&(n=-1),this.left=e,this.key=t,this.value=i,this.right=s,n==-1){let l,r=this.left,h=this.right;if((r==null?0:r._height)>(h==null?0:h._height)){let a=this.left;l=a==null?0:a._height}else{let a=this.right;l=a==null?0:a._height}this._height=l+1}else this._height=n}}K["haxe.ds.TreeNode"]=Qt,Qt.__name__="haxe.ds.TreeNode",Object.assign(Qt.prototype,{__class__:Qt});class Gi extends ss{constructor(){super()}compare(e,t){let i=e._hx_index-t._hx_index;if(i!=0)return i;let s=re.enumParameters(e),n=re.enumParameters(t);return s.length==0&&n.length==0?0:this.compareArgs(s,n)}compareArgs(e,t){let i=e.length-t.length;if(i!=0)return i;let s=0,n=e.length;for(;s<n;){let l=s++,r=this.compareArg(e[l],t[l]);if(r!=0)return r}return 0}compareArg(e,t){return Pe.isEnumValue(e)&&Pe.isEnumValue(t)?this.compare(e,t):e instanceof Array&&t instanceof Array?this.compareArgs(e,t):Pe.compare(e,t)}}K["haxe.ds.EnumValueMap"]=Gi,Gi.__name__="haxe.ds.EnumValueMap",Gi.__interfaces__=[ft],Gi.__super__=ss,Object.assign(Gi.prototype,{__class__:Gi});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 bi(e)}}K["haxe.ds.IntMap"]=Ri,Ri.__name__="haxe.ds.IntMap",Ri.__interfaces__=[ft],Object.assign(Ri.prototype,{__class__:Ri});class Ss{constructor(){this.length=0}add(e){let t=new us(e,null);this.h==null?this.h=t:this.q.next=t,this.q=t,this.length++}push(e){let t=new us(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}}K["haxe.ds.List"]=Ss,Ss.__name__="haxe.ds.List",Object.assign(Ss.prototype,{__class__:Ss});class us{constructor(e,t){this.item=e,this.next=t}}K["haxe.ds._List.ListNode"]=us,us.__name__="haxe.ds._List.ListNode",Object.assign(us.prototype,{__class__:us});class cs{constructor(){this.h={__keys__:{}}}set(e,t){let i=e.__id__;i==null&&(i=e.__id__=Gs.$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 bi(e)}}K["haxe.ds.ObjectMap"]=cs,cs.__name__="haxe.ds.ObjectMap",cs.__interfaces__=[ft],Object.assign(cs.prototype,{__class__:cs});class me{constructor(){this.h=Object.create(null)}get(e){return this.h[e]}set(e,t){this.h[e]=t}keys(){return new ps(this.h)}}K["haxe.ds.StringMap"]=me,me.__name__="haxe.ds.StringMap",me.__interfaces__=[ft],Object.assign(me.prototype,{__class__:me});class ps{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++]}}K["haxe.ds._StringMap.StringMapKeyIterator"]=ps,ps.__name__="haxe.ds._StringMap.StringMapKeyIterator",Object.assign(ps.prototype,{__class__:ps});class Ys{static blit(e,t,i,s,n){if(e==i){if(t<s){let l=t+n,r=s+n,h=0,a=n;for(;h<a;){let o=h++;--l,--r,e[r]=e[l]}}else if(t>s){let l=t,r=s,h=0,a=n;for(;h<a;){let o=h++;e[r]=e[l],++l,++r}}}else{let l=0,r=n;for(;l<r;){let h=l++;i[s+h]=e[t+h]}}}}class vt{constructor(e){switch(e){case".":case"..":this.dir=e,this.file="";return}let t=e.lastIndexOf("/"),i=e.lastIndexOf("\\");t<i?(this.dir=u.substr(e,0,i),e=u.substr(e,i+1,null),this.backslash=!0):i<t?(this.dir=u.substr(e,0,t),e=u.substr(e,t+1,null)):this.dir=null;let s=e.lastIndexOf(".");s!=-1?(this.ext=u.substr(e,s+1,null),this.file=u.substr(e,0,s)):(this.ext=null,this.file=e)}static directory(e){let t=new vt(e);return t.dir==null?"":t.dir}static join(e){let t=[],i=0,s=e;for(;i<s.length;){let a=s[i];++i,a!=null&&a!=""&&t.push(a)}let n=t;if(n.length==0)return"";let l=n[0],r=1,h=n.length;for(;r<h;){let a=r++;l=vt.addTrailingSlash(l),l+=n[a]}return vt.normalize(l)}static normalize(e){let t="/";if(e=e.split("\\").join(t),e==t)return t;let i=[],s=0,n=e.split(t);for(;s<n.length;){let p=n[s];++s,p==".."&&i.length>0&&i[i.length-1]!=".."?i.pop():p==""?(i.length>0||u.cca(e,0)==47)&&i.push(p):p!="."&&i.push(p)}let l=i.join(t),r="",h=!1,a=!1,o=0,c=l;for(;o<c.length;){let p=c,f=o++,_=p.charCodeAt(f);_>=55296&&_<=56319&&(_=_-55232<<10|p.charCodeAt(f+1)&1023);let d=_;d>=65536&&++o;let x=d;switch(x){case 47:if(!h)a=!0;else{let b=x;h=!1,a&&(r+="/",a=!1),r+=String.fromCodePoint(b)}break;case 58:r+=":",h=!0;break;default:let y=x;h=!1,a&&(r+="/",a=!1),r+=String.fromCodePoint(y)}}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("\\\\"))}}K["haxe.io.Path"]=vt,vt.__name__="haxe.io.Path",Object.assign(vt.prototype,{__class__:vt});class bi{constructor(e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}}K["haxe.iterators.ArrayIterator"]=bi,bi.__name__="haxe.iterators.ArrayIterator",Object.assign(bi.prototype,{__class__:bi});var zt=Fe["haxe.rtti.CType"]={__ename__:"haxe.rtti.CType",__constructs__:null,CUnknown:{_hx_name:"CUnknown",_hx_index:0,__enum__:"haxe.rtti.CType",toString:C},CEnum:(m=function(w,e){return{_hx_index:1,name:w,params:e,__enum__:"haxe.rtti.CType",toString:C}},m._hx_name="CEnum",m.__params__=["name","params"],m),CClass:(m=function(w,e){return{_hx_index:2,name:w,params:e,__enum__:"haxe.rtti.CType",toString:C}},m._hx_name="CClass",m.__params__=["name","params"],m),CTypedef:(m=function(w,e){return{_hx_index:3,name:w,params:e,__enum__:"haxe.rtti.CType",toString:C}},m._hx_name="CTypedef",m.__params__=["name","params"],m),CFunction:(m=function(w,e){return{_hx_index:4,args:w,ret:e,__enum__:"haxe.rtti.CType",toString:C}},m._hx_name="CFunction",m.__params__=["args","ret"],m),CAnonymous:(m=function(w){return{_hx_index:5,fields:w,__enum__:"haxe.rtti.CType",toString:C}},m._hx_name="CAnonymous",m.__params__=["fields"],m),CDynamic:(m=function(w){return{_hx_index:6,t:w,__enum__:"haxe.rtti.CType",toString:C}},m._hx_name="CDynamic",m.__params__=["t"],m),CAbstract:(m=function(w,e){return{_hx_index:7,name:w,params:e,__enum__:"haxe.rtti.CType",toString:C}},m._hx_name="CAbstract",m.__params__=["name","params"],m)};zt.__constructs__=[zt.CUnknown,zt.CEnum,zt.CClass,zt.CTypedef,zt.CFunction,zt.CAnonymous,zt.CDynamic,zt.CAbstract];var At=Fe["haxe.rtti.Rights"]={__ename__:"haxe.rtti.Rights",__constructs__:null,RNormal:{_hx_name:"RNormal",_hx_index:0,__enum__:"haxe.rtti.Rights",toString:C},RNo:{_hx_name:"RNo",_hx_index:1,__enum__:"haxe.rtti.Rights",toString:C},RCall:(m=function(w){return{_hx_index:2,m:w,__enum__:"haxe.rtti.Rights",toString:C}},m._hx_name="RCall",m.__params__=["m"],m),RMethod:{_hx_name:"RMethod",_hx_index:3,__enum__:"haxe.rtti.Rights",toString:C},RDynamic:{_hx_name:"RDynamic",_hx_index:4,__enum__:"haxe.rtti.Rights",toString:C},RInline:{_hx_name:"RInline",_hx_index:5,__enum__:"haxe.rtti.Rights",toString:C}};At.__constructs__=[At.RNormal,At.RNo,At.RCall,At.RMethod,At.RDynamic,At.RInline];var Bi=Fe["haxe.rtti.TypeTree"]={__ename__:"haxe.rtti.TypeTree",__constructs__:null,TPackage:(m=function(w,e,t){return{_hx_index:0,name:w,full:e,subs:t,__enum__:"haxe.rtti.TypeTree",toString:C}},m._hx_name="TPackage",m.__params__=["name","full","subs"],m),TClassdecl:(m=function(w){return{_hx_index:1,c:w,__enum__:"haxe.rtti.TypeTree",toString:C}},m._hx_name="TClassdecl",m.__params__=["c"],m),TEnumdecl:(m=function(w){return{_hx_index:2,e:w,__enum__:"haxe.rtti.TypeTree",toString:C}},m._hx_name="TEnumdecl",m.__params__=["e"],m),TTypedecl:(m=function(w){return{_hx_index:3,t:w,__enum__:"haxe.rtti.TypeTree",toString:C}},m._hx_name="TTypedecl",m.__params__=["t"],m),TAbstractdecl:(m=function(w){return{_hx_index:4,a:w,__enum__:"haxe.rtti.TypeTree",toString:C}},m._hx_name="TAbstractdecl",m.__params__=["a"],m)};Bi.__constructs__=[Bi.TPackage,Bi.TClassdecl,Bi.TEnumdecl,Bi.TTypedecl,Bi.TAbstractdecl];class Qe{static typeInfos(e){let t;switch(e._hx_index){case 0:let i=e.name,s=e.full,n=e.subs;throw k.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 s=0,n=i,l=0;for(;l<t.length;){let r=t[l];if(++l,s>=n.length)return!1;let h=n[s++];if(!e(r,h))return!1}return!(s<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 s=t.m;return i==s}}return!1}static typeEq(e,t){switch(e._hx_index){case 0:return t==zt.CUnknown;case 1:let i=e.name,s=e.params;if(t._hx_index==1){let d=t.name,x=t.params;return i==d?Qe.leq(Qe.typeEq,s,x):!1}break;case 2:let n=e.name,l=e.params;if(t._hx_index==2){let d=t.name,x=t.params;return n==d?Qe.leq(Qe.typeEq,l,x):!1}break;case 3:let r=e.name,h=e.params;if(t._hx_index==3){let d=t.name,x=t.params;return r==d?Qe.leq(Qe.typeEq,h,x):!1}break;case 4:let a=e.args,o=e.ret;if(t._hx_index==4){let d=t.args,x=t.ret;return Qe.leq(function(y,b){return y.name==b.name&&y.opt==b.opt?Qe.typeEq(y.t,b.t):!1},a,d)?Qe.typeEq(o,x):!1}break;case 5:let c=e.fields;if(t._hx_index==5){let d=t.fields;return Qe.leq(function(x,y){return Qe.fieldEq(x,y)},c,d)}break;case 6:let p=e.t;if(t._hx_index==6){let d=t.t;return p==null!=(d==null)?!1:p!=null?Qe.typeEq(p,d):!0}break;case 7:let f=e.name,_=e.params;if(t._hx_index==7){let d=t.name,x=t.params;return f==d?Qe.leq(Qe.typeEq,_,x):!1}break}return!1}static fieldEq(e,t){return!(e.name!=t.name||!Qe.typeEq(e.type,t.type)||e.isPublic!=t.isPublic||e.doc!=t.doc||!Qe.rightsEq(e.get,t.get)||!Qe.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&&!Qe.leq(function(i,s){return i.name==s.name&&i.opt==s.opt?Qe.typeEq(i.t,s.t):!1},e.args,t.args))}}K["haxe.rtti.TypeApi"]=Qe,Qe.__name__="haxe.rtti.TypeApi";class vs{constructor(){this.root=[]}process(e,t){if(this.curplatform=t,e.nodeType!=G.Document&&e.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(e.nodeType==null?"null":ge.toString(e.nodeType)));this.xroot(e)}mergeRights(e,t){return e.get==At.RInline&&e.set==At.RNo&&t.get==At.RNormal&&t.set==At.RMethod?(e.get=At.RNormal,e.set=At.RMethod,!0):re.enumEq(e.get,t.get)?re.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 Qe.fieldEq(e,t)?!0:e.name==t.name&&(this.mergeRights(e,t)||this.mergeRights(t,e))&&this.mergeDoc(e,t)?Qe.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,s=t.fields;for(;i<s.length;){let r=s[i];++i;let h=null,a=0,o=e.fields;for(;a<o.length;){let c=o[a];if(++a,this.mergeFields(c,r)){h=c;break}}h==null?(this.newField(e,r),e.fields.push(r)):this.curplatform!=null&&h.platforms.push(this.curplatform)}let n=0,l=t.statics;for(;n<l.length;){let r=l[n];++n;let h=null,a=0,o=e.statics;for(;a<o.length;){let c=o[a];if(++a,this.mergeFields(c,r)){h=c;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,s=t.constructors;for(;i<s.length;){let n=s[i];++i;let l=null,r=0,h=e.constructors;for(;r<h.length;){let a=h[r];if(++r,Qe.constructorEq(a,n)){l=a;break}}l==null?e.constructors.push(n):this.curplatform!=null&&l.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,s=e.to.length;for(;i<s;){let r=i++;if(!Qe.typeEq(e.to[r].t,t.to[r].t))return!1}let n=0,l=e.from.length;for(;n<l;){let r=n++;if(!Qe.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=Qe.typeInfos(e),i=t.path.split("."),s=this.root,n=[];i.pop();let l=0;for(;l<i.length;){let h=i[l];++l;let a=!1,o=0;for(;o<s.length;){let c=s[o];if(++o,c._hx_index==0){let p=c.full,f=c.name,_=c.subs;if(f==h){a=!0,s=_;break}}}if(n.push(h),!a){let c=[];s.push(Bi.TPackage(h,n.join("."),c)),s=c}}let r=0;for(;r<s.length;){let h=s[r];++r;let a;if(h._hx_index==0){let c=h.name,p=h.full,f=h.subs;a=!0}else a=!1;if(a)continue;let o=Qe.typeInfos(h);if(o.path==t.path){let c=!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 f=h.name,_=h.full,d=h.subs;c=!1;break;case 1:let x=h.c;if(e._hx_index==1){let T=e.c;if(this.mergeClasses(x,T))return}else c=!1;break;case 2:let y=h.e;if(e._hx_index==2){let T=e.e;if(this.mergeEnums(y,T))return}else c=!1;break;case 3:let b=h.t;if(e._hx_index==3){let T=e.t;if(this.mergeTypedefs(b,T))return}break;case 4:let v=h.a;if(e._hx_index==4){let T=e.a;if(this.mergeAbstracts(v,T))return}else c=!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":c?"could not merge definition":"type kind is different";throw k.thrown("Incompatibilities between "+o.path+" in "+o.platforms.join(",")+" and "+this.curplatform+" ("+p+")")}}s.push(e)}mkPath(e){return e}mkTypeParams(e){let t=e.split(":");return t[0]==""?[]:t}mkRights(e){switch(e){case"dynamic":return At.RDynamic;case"inline":return At.RInline;case"method":return At.RMethod;case"null":return At.RNo;default:return At.RCall(e)}}xerror(e){let t;if(e.nodeType==G.Document)t="Document";else{if(e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));t=e.nodeName}throw k.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!=G.Document&&e.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(e.nodeType==null?"null":ge.toString(e.nodeType)));let t=e,i;if(t.nodeType==G.Document)i="Document";else{if(t.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(t.nodeType==null?"null":ge.toString(t.nodeType)));i=t.nodeName}switch(i){case"abstract":return Bi.TAbstractdecl(this.xabstract(t));case"class":return Bi.TClassdecl(this.xclass(t));case"enum":return Bi.TEnumdecl(this.xenum(t));case"typedef":return Bi.TTypedecl(this.xtypedef(t));default:return this.xerror(t)}}xmeta(e){let t=[],i=0,s=ln.resolve(e,"m");for(;i<s.length;){let n=s[i];++i;let l=[],r=0,h=ln.resolve(n,"e");for(;r<h.length;){let a=h[r];++r,l.push($i.get_innerHTML(a))}t.push({name:qe.resolve(n,"n"),params:l})}return t}xoverloads(e){let t=[],i=e.elements();for(;i.hasNext();){let s=i.next();t.push(this.xclassfield(s))}return t}xpath(e){let t=this.mkPath(qe.resolve(e,"path")),i=[],s=e.elements();for(;s.hasNext();){let n=s.next();i.push(this.xtype(n))}return{path:t,params:i}}xclass(e){let t=null,i=null,s=null,n=[],l=[],r=[],h=[],a=e.exists("interface"),o=e.elements();for(;o.hasNext();){let c=o.next(),p;if(c.nodeType==G.Document)p="Document";else{if(c.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(c.nodeType==null?"null":ge.toString(c.nodeType)));p=c.nodeName}switch(p){case"extends":a?n.push(this.xpath(c)):t=this.xpath(c);break;case"haxe_doc":i=$i.get_innerData(c);break;case"haxe_dynamic":let f=c.firstElement();if(f.nodeType!=G.Document&&f.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(f.nodeType==null?"null":ge.toString(f.nodeType)));s=this.xtype(f);break;case"implements":n.push(this.xpath(c));break;case"meta":h=this.xmeta(c);break;default:c.exists("static")?r.push(this.xclassfield(c)):l.push(this.xclassfield(c))}}return{file:Yt.resolve(e,"file")?qe.resolve(e,"file"):null,path:this.mkPath(qe.resolve(e,"path")),module:Yt.resolve(e,"module")?this.mkPath(qe.resolve(e,"module")):null,doc:i,isPrivate:e.exists("private"),isExtern:e.exists("extern"),isFinal:e.exists("final"),isInterface:a,params:this.mkTypeParams(qe.resolve(e,"params")),superClass:t,interfaces:n,fields:l,statics:r,tdynamic:s,platforms:this.defplat(),meta:h}}xclassfield(e,t){t==null&&(t=!1);let i=e.elements(),s=this.xtype(i.next()),n=null,l=[],r=null,h=i;for(;h.hasNext();){let o=h.next(),c;if(o.nodeType==G.Document)c="Document";else{if(o.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(o.nodeType==null?"null":ge.toString(o.nodeType)));c=o.nodeName}switch(c){case"haxe_doc":n=$i.get_innerData(o);break;case"meta":l=this.xmeta(o);break;case"overloads":r=this.xoverloads(o);break;default:this.xerror(o)}}let a;if(e.nodeType==G.Document)a="Document";else{if(e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));a=e.nodeName}return{name:a,type:s,isPublic:e.exists("public")||t,isFinal:e.exists("final"),isOverride:e.exists("override"),line:Yt.resolve(e,"line")?Z.parseInt(qe.resolve(e,"line")):null,doc:n,get:Yt.resolve(e,"get")?this.mkRights(qe.resolve(e,"get")):At.RNormal,set:Yt.resolve(e,"set")?this.mkRights(qe.resolve(e,"set")):At.RNormal,params:Yt.resolve(e,"params")?this.mkTypeParams(qe.resolve(e,"params")):[],platforms:this.defplat(),meta:l,overloads:r,expr:Yt.resolve(e,"expr")?qe.resolve(e,"expr"):null}}xenum(e){let t=[],i=null,s=[],n=e.elements();for(;n.hasNext();){let l=n.next(),r;if(l.nodeType==G.Document)r="Document";else{if(l.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(l.nodeType==null?"null":ge.toString(l.nodeType)));r=l.nodeName}if(r=="haxe_doc")i=$i.get_innerData(l);else{let h;if(l.nodeType==G.Document)h="Document";else{if(l.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(l.nodeType==null?"null":ge.toString(l.nodeType)));h=l.nodeName}h=="meta"?s=this.xmeta(l):t.push(this.xenumfield(l))}}return{file:Yt.resolve(e,"file")?qe.resolve(e,"file"):null,path:this.mkPath(qe.resolve(e,"path")),module:Yt.resolve(e,"module")?this.mkPath(qe.resolve(e,"module")):null,doc:i,isPrivate:e.exists("private"),isExtern:e.exists("extern"),params:this.mkTypeParams(qe.resolve(e,"params")),constructors:t,platforms:this.defplat(),meta:s}}xenumfield(e){let t=null,i=e.elementsNamed("haxe_doc"),s=i.hasNext()?i.next():null,n=pn.resolve(e,"meta")?this.xmeta(nn.resolve(e,"meta")):[];if(Yt.resolve(e,"a")){let h=qe.resolve(e,"a").split(":"),a=e.elements();t=[];let o=0;for(;o<h.length;){let c=h[o];++o;let p=!1;c.charAt(0)=="?"&&(p=!0,c=u.substr(c,1,null)),t.push({name:c,opt:p,t:this.xtype(a.next())})}}let l;if(e.nodeType==G.Document)l="Document";else{if(e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));l=e.nodeName}let r;if(s==null)r=null;else{if(s.nodeType!=G.Document&&s.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(s.nodeType==null?"null":ge.toString(s.nodeType)));r=$i.get_innerData(s)}return{name:l,args:t,doc:r,meta:n,platforms:this.defplat()}}xabstract(e){let t=null,i=null,s=null,n=[],l=[],r=[],h=e.elements();for(;h.hasNext();){let a=h.next(),o;if(a.nodeType==G.Document)o="Document";else{if(a.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(a.nodeType==null?"null":ge.toString(a.nodeType)));o=a.nodeName}switch(o){case"from":let c=a.elements();for(;c.hasNext();){let _=c.next(),d=_.firstElement();if(d.nodeType!=G.Document&&d.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(d.nodeType==null?"null":ge.toString(d.nodeType)));r.push({t:this.xtype(d),field:Yt.resolve(_,"field")?qe.resolve(_,"field"):null})}break;case"haxe_doc":t=$i.get_innerData(a);break;case"impl":i=this.xclass(nn.resolve(a,"class"));break;case"meta":n=this.xmeta(a);break;case"this":let p=a.firstElement();if(p.nodeType!=G.Document&&p.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(p.nodeType==null?"null":ge.toString(p.nodeType)));s=this.xtype(p);break;case"to":let f=a.elements();for(;f.hasNext();){let _=f.next(),d=_.firstElement();if(d.nodeType!=G.Document&&d.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(d.nodeType==null?"null":ge.toString(d.nodeType)));l.push({t:this.xtype(d),field:Yt.resolve(_,"field")?qe.resolve(_,"field"):null})}break;default:this.xerror(a)}}return{file:Yt.resolve(e,"file")?qe.resolve(e,"file"):null,path:this.mkPath(qe.resolve(e,"path")),module:Yt.resolve(e,"module")?this.mkPath(qe.resolve(e,"module")):null,doc:t,isPrivate:e.exists("private"),params:this.mkTypeParams(qe.resolve(e,"params")),platforms:this.defplat(),meta:n,athis:s,to:l,from:r,impl:i}}xtypedef(e){let t=null,i=null,s=[],n=e.elements();for(;n.hasNext();){let r=n.next(),h;if(r.nodeType==G.Document)h="Document";else{if(r.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":ge.toString(r.nodeType)));h=r.nodeName}if(h=="haxe_doc")t=$i.get_innerData(r);else{let a;if(r.nodeType==G.Document)a="Document";else{if(r.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":ge.toString(r.nodeType)));a=r.nodeName}a=="meta"?s=this.xmeta(r):i=this.xtype(r)}}let l=new me;return this.curplatform!=null&&(l.h[this.curplatform]=i),{file:Yt.resolve(e,"file")?qe.resolve(e,"file"):null,path:this.mkPath(qe.resolve(e,"path")),module:Yt.resolve(e,"module")?this.mkPath(qe.resolve(e,"module")):null,doc:t,isPrivate:e.exists("private"),params:this.mkTypeParams(qe.resolve(e,"params")),type:i,types:l,platforms:this.defplat(),meta:s}}xtype(e){let t;if(e.nodeType==G.Document)t="Document";else{if(e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));t=e.nodeName}switch(t){case"a":let i=[],s=e.elements();for(;s.hasNext();){let _=s.next(),d=this.xclassfield(_,!0);d.platforms=[],i.push(d)}return zt.CAnonymous(i);case"c":return zt.CClass(this.mkPath(qe.resolve(e,"path")),this.xtypeparams(e));case"d":let n=null,l=e.firstElement();if(l!=null){if(l.nodeType!=G.Document&&l.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(l.nodeType==null?"null":ge.toString(l.nodeType)));n=this.xtype(l)}return zt.CDynamic(n);case"e":return zt.CEnum(this.mkPath(qe.resolve(e,"path")),this.xtypeparams(e));case"f":let r=[],h=qe.resolve(e,"a").split(":"),a=0,o=h,c=Yt.resolve(e,"v")?new bi(qe.resolve(e,"v").split(":")):null,p=e.elements();for(;p.hasNext();){let _=p.next(),d=!1,x=a<o.length?o[a++]:null;x==null&&(x=""),x.charAt(0)=="?"&&(d=!0,x=u.substr(x,1,null));let y=c==null||c.current>=c.array.length?null:c.array[c.current++];r.push({name:x,opt:d,t:this.xtype(_),value:y==""?null:y})}let f=r[r.length-1];return u.remove(r,f),zt.CFunction(r,f.t);case"t":return zt.CTypedef(this.mkPath(qe.resolve(e,"path")),this.xtypeparams(e));case"unknown":return zt.CUnknown;case"x":return zt.CAbstract(this.mkPath(qe.resolve(e,"path")),this.xtypeparams(e));default:return this.xerror(e)}}xtypeparams(e){let t=[],i=e.elements();for(;i.hasNext();){let s=i.next();t.push(this.xtype(s))}return t}defplat(){let e=[];return this.curplatform!=null&&e.push(this.curplatform),e}}K["haxe.rtti.XmlParser"]=vs,vs.__name__="haxe.rtti.XmlParser",Object.assign(vs.prototype,{__class__:vs});class nn{static resolve(e,t){let i=e.elementsNamed(t).next();if(i==null){let s;if(e.nodeType==G.Document)s="Document";else{if(e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));s=e.nodeName}throw k.thrown(s+" is missing element "+t)}if(i.nodeType!=G.Document&&i.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(i.nodeType==null?"null":ge.toString(i.nodeType)));return i}}class qe{static resolve(e,t){if(e.nodeType==G.Document)throw k.thrown("Cannot access document attribute "+t);let i=e.get(t);if(i==null)throw e.nodeType!=G.Element?k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType))):k.thrown(e.nodeName+" is missing attribute "+t);return i}}class Yt{static resolve(e,t){if(e.nodeType==G.Document)throw k.thrown("Cannot access document attribute "+t);return e.exists(t)}}class pn{static resolve(e,t){return e.elementsNamed(t).hasNext()}}class ln{static resolve(e,t){let i=[],s=e.elementsNamed(t);for(;s.hasNext();){let n=s.next();if(n.nodeType!=G.Document&&n.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(n.nodeType==null?"null":ge.toString(n.nodeType)));i.push(n)}return i}}class $i{static get_innerData(e){if(e.nodeType!=G.Document&&e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));let t=0,i=e.children;if(t>=i.length){let n;if(e.nodeType==G.Document)n="Document";else{if(e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));n=e.nodeName}throw k.thrown(n+" does not have data")}let s=i[t++];if(t<i.length){let n=i[t++],l;if(s.nodeType==G.PCData&&n.nodeType==G.CData){if(s.nodeType==G.Document||s.nodeType==G.Element)throw k.thrown("Bad node type, unexpected "+(s.nodeType==null?"null":ge.toString(s.nodeType)));l=Te.trim(s.nodeValue)==""}else l=!1;if(l){if(t>=i.length){if(n.nodeType==G.Document||n.nodeType==G.Element)throw k.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":ge.toString(n.nodeType)));return n.nodeValue}let h=i[t++],a;if(h.nodeType==G.PCData){if(h.nodeType==G.Document||h.nodeType==G.Element)throw k.thrown("Bad node type, unexpected "+(h.nodeType==null?"null":ge.toString(h.nodeType)));a=Te.trim(h.nodeValue)==""}else a=!1;if(a&&t>=i.length){if(n.nodeType==G.Document||n.nodeType==G.Element)throw k.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":ge.toString(n.nodeType)));return n.nodeValue}}let r;if(e.nodeType==G.Document)r="Document";else{if(e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));r=e.nodeName}throw k.thrown(r+" does not only have data")}if(s.nodeType!=G.PCData&&s.nodeType!=G.CData){let n;if(e.nodeType==G.Document)n="Document";else{if(e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));n=e.nodeName}throw k.thrown(n+" does not have data")}if(s.nodeType==G.Document||s.nodeType==G.Element)throw k.thrown("Bad node type, unexpected "+(s.nodeType==null?"null":ge.toString(s.nodeType)));return s.nodeValue}static get_innerHTML(e){let t="";if(e.nodeType!=G.Document&&e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));let i=0,s=e.children;for(;i<s.length;){let n=s[i++];t+=Z.string(Qi.print(n))}return t}}$i.__properties__={get_innerHTML:"get_innerHTML",get_innerData:"get_innerData"};class Qi{constructor(e){this.output=new $t,this.pretty=e}writeNode(e,t){switch(e.nodeType){case 0:if(this.output.b+=Z.string(t+"<"),e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));this.output.b+=Z.string(e.nodeName);let i=e.attributes();for(;i.hasNext();){let o=i.next();this.output.b+=Z.string(" "+o+'="');let c=Te.htmlEscape(e.get(o),!0);this.output.b+=Z.string(c),this.output.b+='"'}if(this.hasChildren(e)){if(this.output.b+=">",this.pretty&&(this.output.b+=`
|
|
5
|
-
`),e.nodeType
|
|
4
|
+
`,i),i<0?"":yi.skipLines(e,--t,i+1)):e.substring(i)}}z["haxe.NativeStackTrace"]=yi,yi.__name__="haxe.NativeStackTrace";class ll extends y{constructor(e,t,i){super(String(e),t,i),this.value=e}unwrap(){return this.value}}z["haxe.ValueException"]=ll,ll.__name__="haxe.ValueException",ll.__super__=y,Object.assign(ll.prototype,{__class__:ll});class nl{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 bi(e)}setLoop(e,t,i){if(i==null)return new Qt(null,e,t,null);let l=this.compare(e,i.key);if(l==0)return new Qt(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 Qt(e.left,e.key,e.value,new Qt(e.right,t,i,l)):new Qt(new Qt(e.left,e.key,e.value,e.right.left),e.right.key,e.right.value,new Qt(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 Qt(new Qt(e,t,i,l.left),l.key,l.value,l.right):new Qt(new Qt(e,t,i,l.left.left),l.left.key,l.left.value,new Qt(l.left.right,l.key,l.value,l.right))}else return new Qt(e,t,i,l,(n>s?n:s)+1)}compare(e,t){return je.compare(e,t)}}z["haxe.ds.BalancedTree"]=nl,nl.__name__="haxe.ds.BalancedTree",nl.__interfaces__=[kt],Object.assign(nl.prototype,{__class__:nl});class Qt{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}}z["haxe.ds.TreeNode"]=Qt,Qt.__name__="haxe.ds.TreeNode",Object.assign(Qt.prototype,{__class__:Qt});class $i extends nl{constructor(){super()}compare(e,t){let i=e._hx_index-t._hx_index;if(i!=0)return i;let l=ce.enumParameters(e),n=ce.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 je.isEnumValue(e)&&je.isEnumValue(t)?this.compare(e,t):e instanceof Array&&t instanceof Array?this.compareArgs(e,t):je.compare(e,t)}}z["haxe.ds.EnumValueMap"]=$i,$i.__name__="haxe.ds.EnumValueMap",$i.__interfaces__=[kt],$i.__super__=nl,Object.assign($i.prototype,{__class__:$i});class Bi{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 bi(e)}}z["haxe.ds.IntMap"]=Bi,Bi.__name__="haxe.ds.IntMap",Bi.__interfaces__=[kt],Object.assign(Bi.prototype,{__class__:Bi});class Sl{constructor(){this.length=0}add(e){let t=new cl(e,null);this.h==null?this.h=t:this.q.next=t,this.q=t,this.length++}push(e){let t=new cl(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}}z["haxe.ds.List"]=Sl,Sl.__name__="haxe.ds.List",Object.assign(Sl.prototype,{__class__:Sl});class cl{constructor(e,t){this.item=e,this.next=t}}z["haxe.ds._List.ListNode"]=cl,cl.__name__="haxe.ds._List.ListNode",Object.assign(cl.prototype,{__class__:cl});class pl{constructor(){this.h={__keys__:{}}}set(e,t){let i=e.__id__;i==null&&(i=e.__id__=Gl.$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 bi(e)}}z["haxe.ds.ObjectMap"]=pl,pl.__name__="haxe.ds.ObjectMap",pl.__interfaces__=[kt],Object.assign(pl.prototype,{__class__:pl});class Se{constructor(){this.h=Object.create(null)}get(e){return this.h[e]}set(e,t){this.h[e]=t}keys(){return new _l(this.h)}}z["haxe.ds.StringMap"]=Se,Se.__name__="haxe.ds.StringMap",Se.__interfaces__=[kt],Object.assign(Se.prototype,{__class__:Se});class _l{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++]}}z["haxe.ds._StringMap.StringMapKeyIterator"]=_l,_l.__name__="haxe.ds._StringMap.StringMapKeyIterator",Object.assign(_l.prototype,{__class__:_l});class Yl{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 Pt{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 Pt(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=Pt.addTrailingSlash(s),s+=n[a]}return Pt.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,f=o++,_=c.charCodeAt(f);_>=55296&&_<=56319&&(_=_-55232<<10|c.charCodeAt(f+1)&1023);let m=_;m>=65536&&++o;let d=m;switch(d){case 47:if(!h)a=!0;else{let b=d;h=!1,a&&(r+="/",a=!1),r+=String.fromCodePoint(b)}break;case 58:r+=":",h=!0;break;default:let w=d;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("\\\\"))}}z["haxe.io.Path"]=Pt,Pt.__name__="haxe.io.Path",Object.assign(Pt.prototype,{__class__:Pt});class bi{constructor(e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}}z["haxe.iterators.ArrayIterator"]=bi,bi.__name__="haxe.iterators.ArrayIterator",Object.assign(bi.prototype,{__class__:bi});var zt=Je["haxe.rtti.CType"]={__ename__:"haxe.rtti.CType",__constructs__:null,CUnknown:{_hx_name:"CUnknown",_hx_index:0,__enum__:"haxe.rtti.CType",toString:S},CEnum:(g=function(k,e){return{_hx_index:1,name:k,params:e,__enum__:"haxe.rtti.CType",toString:S}},g._hx_name="CEnum",g.__params__=["name","params"],g),CClass:(g=function(k,e){return{_hx_index:2,name:k,params:e,__enum__:"haxe.rtti.CType",toString:S}},g._hx_name="CClass",g.__params__=["name","params"],g),CTypedef:(g=function(k,e){return{_hx_index:3,name:k,params:e,__enum__:"haxe.rtti.CType",toString:S}},g._hx_name="CTypedef",g.__params__=["name","params"],g),CFunction:(g=function(k,e){return{_hx_index:4,args:k,ret:e,__enum__:"haxe.rtti.CType",toString:S}},g._hx_name="CFunction",g.__params__=["args","ret"],g),CAnonymous:(g=function(k){return{_hx_index:5,fields:k,__enum__:"haxe.rtti.CType",toString:S}},g._hx_name="CAnonymous",g.__params__=["fields"],g),CDynamic:(g=function(k){return{_hx_index:6,t:k,__enum__:"haxe.rtti.CType",toString:S}},g._hx_name="CDynamic",g.__params__=["t"],g),CAbstract:(g=function(k,e){return{_hx_index:7,name:k,params:e,__enum__:"haxe.rtti.CType",toString:S}},g._hx_name="CAbstract",g.__params__=["name","params"],g)};zt.__constructs__=[zt.CUnknown,zt.CEnum,zt.CClass,zt.CTypedef,zt.CFunction,zt.CAnonymous,zt.CDynamic,zt.CAbstract];var At=Je["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:(g=function(k){return{_hx_index:2,m:k,__enum__:"haxe.rtti.Rights",toString:S}},g._hx_name="RCall",g.__params__=["m"],g),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}};At.__constructs__=[At.RNormal,At.RNo,At.RCall,At.RMethod,At.RDynamic,At.RInline];var Ai=Je["haxe.rtti.TypeTree"]={__ename__:"haxe.rtti.TypeTree",__constructs__:null,TPackage:(g=function(k,e,t){return{_hx_index:0,name:k,full:e,subs:t,__enum__:"haxe.rtti.TypeTree",toString:S}},g._hx_name="TPackage",g.__params__=["name","full","subs"],g),TClassdecl:(g=function(k){return{_hx_index:1,c:k,__enum__:"haxe.rtti.TypeTree",toString:S}},g._hx_name="TClassdecl",g.__params__=["c"],g),TEnumdecl:(g=function(k){return{_hx_index:2,e:k,__enum__:"haxe.rtti.TypeTree",toString:S}},g._hx_name="TEnumdecl",g.__params__=["e"],g),TTypedecl:(g=function(k){return{_hx_index:3,t:k,__enum__:"haxe.rtti.TypeTree",toString:S}},g._hx_name="TTypedecl",g.__params__=["t"],g),TAbstractdecl:(g=function(k){return{_hx_index:4,a:k,__enum__:"haxe.rtti.TypeTree",toString:S}},g._hx_name="TAbstractdecl",g.__params__=["a"],g)};Ai.__constructs__=[Ai.TPackage,Ai.TClassdecl,Ai.TEnumdecl,Ai.TTypedecl,Ai.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 y.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==zt.CUnknown;case 1:let i=e.name,l=e.params;if(t._hx_index==1){let m=t.name,d=t.params;return i==m?st.leq(st.typeEq,l,d):!1}break;case 2:let n=e.name,s=e.params;if(t._hx_index==2){let m=t.name,d=t.params;return n==m?st.leq(st.typeEq,s,d):!1}break;case 3:let r=e.name,h=e.params;if(t._hx_index==3){let m=t.name,d=t.params;return r==m?st.leq(st.typeEq,h,d):!1}break;case 4:let a=e.args,o=e.ret;if(t._hx_index==4){let m=t.args,d=t.ret;return st.leq(function(w,b){return w.name==b.name&&w.opt==b.opt?st.typeEq(w.t,b.t):!1},a,m)?st.typeEq(o,d):!1}break;case 5:let u=e.fields;if(t._hx_index==5){let m=t.fields;return st.leq(function(d,w){return st.fieldEq(d,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 f=e.name,_=e.params;if(t._hx_index==7){let m=t.name,d=t.params;return f==m?st.leq(st.typeEq,_,d):!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))}}z["haxe.rtti.TypeApi"]=st,st.__name__="haxe.rtti.TypeApi";class vl{constructor(){this.root=[]}process(e,t){if(this.curplatform=t,e.nodeType!=$.Document&&e.nodeType!=$.Element)throw y.thrown("Invalid nodeType "+(e.nodeType==null?"null":ve.toString(e.nodeType)));this.xroot(e)}mergeRights(e,t){return e.get==At.RInline&&e.set==At.RNo&&t.get==At.RNormal&&t.set==At.RMethod?(e.get=At.RNormal,e.set=At.RMethod,!0):ce.enumEq(e.get,t.get)?ce.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,f=u.name,_=u.subs;if(f==h){a=!0,l=_;break}}}if(n.push(h),!a){let u=[];l.push(Ai.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,f=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 f=h.name,_=h.full,m=h.subs;u=!1;break;case 1:let d=h.c;if(e._hx_index==1){let E=e.c;if(this.mergeClasses(d,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 b=h.t;if(e._hx_index==3){let E=e.t;if(this.mergeTypedefs(b,E))return}break;case 4:let C=h.a;if(e._hx_index==4){let E=e.a;if(this.mergeAbstracts(C,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 y.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 At.RDynamic;case"inline":return At.RInline;case"method":return At.RMethod;case"null":return At.RNo;default:return At.RCall(e)}}xerror(e){let t;if(e.nodeType==$.Document)t="Document";else{if(e.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ve.toString(e.nodeType)));t=e.nodeName}throw y.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!=$.Document&&e.nodeType!=$.Element)throw y.thrown("Invalid nodeType "+(e.nodeType==null?"null":ve.toString(e.nodeType)));let t=e,i;if(t.nodeType==$.Document)i="Document";else{if(t.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(t.nodeType==null?"null":ve.toString(t.nodeType)));i=t.nodeName}switch(i){case"abstract":return Ai.TAbstractdecl(this.xabstract(t));case"class":return Ai.TClassdecl(this.xclass(t));case"enum":return Ai.TEnumdecl(this.xenum(t));case"typedef":return Ai.TTypedecl(this.xtypedef(t));default:return this.xerror(t)}}xmeta(e){let t=[],i=0,l=sn.resolve(e,"m");for(;i<l.length;){let n=l[i];++i;let s=[],r=0,h=sn.resolve(n,"e");for(;r<h.length;){let a=h[r];++r,s.push(Qi.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==$.Document)c="Document";else{if(u.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(u.nodeType==null?"null":ve.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=Qi.get_innerData(u);break;case"haxe_dynamic":let f=u.firstElement();if(f.nodeType!=$.Document&&f.nodeType!=$.Element)throw y.thrown("Invalid nodeType "+(f.nodeType==null?"null":ve.toString(f.nodeType)));l=this.xtype(f);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:Yt.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:Yt.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==$.Document)u="Document";else{if(o.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(o.nodeType==null?"null":ve.toString(o.nodeType)));u=o.nodeName}switch(u){case"haxe_doc":n=Qi.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==$.Document)a="Document";else{if(e.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ve.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:Yt.resolve(e,"line")?te.parseInt(Xe.resolve(e,"line")):null,doc:n,get:Yt.resolve(e,"get")?this.mkRights(Xe.resolve(e,"get")):At.RNormal,set:Yt.resolve(e,"set")?this.mkRights(Xe.resolve(e,"set")):At.RNormal,params:Yt.resolve(e,"params")?this.mkTypeParams(Xe.resolve(e,"params")):[],platforms:this.defplat(),meta:s,overloads:r,expr:Yt.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==$.Document)r="Document";else{if(s.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":ve.toString(s.nodeType)));r=s.nodeName}if(r=="haxe_doc")i=Qi.get_innerData(s);else{let h;if(s.nodeType==$.Document)h="Document";else{if(s.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":ve.toString(s.nodeType)));h=s.nodeName}h=="meta"?l=this.xmeta(s):t.push(this.xenumfield(s))}}return{file:Yt.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:Yt.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=pn.resolve(e,"meta")?this.xmeta(nn.resolve(e,"meta")):[];if(Yt.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==$.Document)s="Document";else{if(e.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ve.toString(e.nodeType)));s=e.nodeName}let r;if(l==null)r=null;else{if(l.nodeType!=$.Document&&l.nodeType!=$.Element)throw y.thrown("Invalid nodeType "+(l.nodeType==null?"null":ve.toString(l.nodeType)));r=Qi.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==$.Document)o="Document";else{if(a.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(a.nodeType==null?"null":ve.toString(a.nodeType)));o=a.nodeName}switch(o){case"from":let u=a.elements();for(;u.hasNext();){let _=u.next(),m=_.firstElement();if(m.nodeType!=$.Document&&m.nodeType!=$.Element)throw y.thrown("Invalid nodeType "+(m.nodeType==null?"null":ve.toString(m.nodeType)));r.push({t:this.xtype(m),field:Yt.resolve(_,"field")?Xe.resolve(_,"field"):null})}break;case"haxe_doc":t=Qi.get_innerData(a);break;case"impl":i=this.xclass(nn.resolve(a,"class"));break;case"meta":n=this.xmeta(a);break;case"this":let c=a.firstElement();if(c.nodeType!=$.Document&&c.nodeType!=$.Element)throw y.thrown("Invalid nodeType "+(c.nodeType==null?"null":ve.toString(c.nodeType)));l=this.xtype(c);break;case"to":let f=a.elements();for(;f.hasNext();){let _=f.next(),m=_.firstElement();if(m.nodeType!=$.Document&&m.nodeType!=$.Element)throw y.thrown("Invalid nodeType "+(m.nodeType==null?"null":ve.toString(m.nodeType)));s.push({t:this.xtype(m),field:Yt.resolve(_,"field")?Xe.resolve(_,"field"):null})}break;default:this.xerror(a)}}return{file:Yt.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:Yt.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==$.Document)h="Document";else{if(r.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":ve.toString(r.nodeType)));h=r.nodeName}if(h=="haxe_doc")t=Qi.get_innerData(r);else{let a;if(r.nodeType==$.Document)a="Document";else{if(r.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":ve.toString(r.nodeType)));a=r.nodeName}a=="meta"?l=this.xmeta(r):i=this.xtype(r)}}let s=new Se;return this.curplatform!=null&&(s.h[this.curplatform]=i),{file:Yt.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:Yt.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==$.Document)t="Document";else{if(e.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ve.toString(e.nodeType)));t=e.nodeName}switch(t){case"a":let i=[],l=e.elements();for(;l.hasNext();){let _=l.next(),m=this.xclassfield(_,!0);m.platforms=[],i.push(m)}return zt.CAnonymous(i);case"c":return zt.CClass(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"d":let n=null,s=e.firstElement();if(s!=null){if(s.nodeType!=$.Document&&s.nodeType!=$.Element)throw y.thrown("Invalid nodeType "+(s.nodeType==null?"null":ve.toString(s.nodeType)));n=this.xtype(s)}return zt.CDynamic(n);case"e":return zt.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=Yt.resolve(e,"v")?new bi(Xe.resolve(e,"v").split(":")):null,c=e.elements();for(;c.hasNext();){let _=c.next(),m=!1,d=a<o.length?o[a++]:null;d==null&&(d=""),d.charAt(0)=="?"&&(m=!0,d=p.substr(d,1,null));let w=u==null||u.current>=u.array.length?null:u.array[u.current++];r.push({name:d,opt:m,t:this.xtype(_),value:w==""?null:w})}let f=r[r.length-1];return p.remove(r,f),zt.CFunction(r,f.t);case"t":return zt.CTypedef(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"unknown":return zt.CUnknown;case"x":return zt.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}}z["haxe.rtti.XmlParser"]=vl,vl.__name__="haxe.rtti.XmlParser",Object.assign(vl.prototype,{__class__:vl});class nn{static resolve(e,t){let i=e.elementsNamed(t).next();if(i==null){let l;if(e.nodeType==$.Document)l="Document";else{if(e.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ve.toString(e.nodeType)));l=e.nodeName}throw y.thrown(l+" is missing element "+t)}if(i.nodeType!=$.Document&&i.nodeType!=$.Element)throw y.thrown("Invalid nodeType "+(i.nodeType==null?"null":ve.toString(i.nodeType)));return i}}class Xe{static resolve(e,t){if(e.nodeType==$.Document)throw y.thrown("Cannot access document attribute "+t);let i=e.get(t);if(i==null)throw e.nodeType!=$.Element?y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ve.toString(e.nodeType))):y.thrown(e.nodeName+" is missing attribute "+t);return i}}class Yt{static resolve(e,t){if(e.nodeType==$.Document)throw y.thrown("Cannot access document attribute "+t);return e.exists(t)}}class pn{static resolve(e,t){return e.elementsNamed(t).hasNext()}}class sn{static resolve(e,t){let i=[],l=e.elementsNamed(t);for(;l.hasNext();){let n=l.next();if(n.nodeType!=$.Document&&n.nodeType!=$.Element)throw y.thrown("Invalid nodeType "+(n.nodeType==null?"null":ve.toString(n.nodeType)));i.push(n)}return i}}class Qi{static get_innerData(e){if(e.nodeType!=$.Document&&e.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":ve.toString(e.nodeType)));let t=0,i=e.children;if(t>=i.length){let n;if(e.nodeType==$.Document)n="Document";else{if(e.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ve.toString(e.nodeType)));n=e.nodeName}throw y.thrown(n+" does not have data")}let l=i[t++];if(t<i.length){let n=i[t++],s;if(l.nodeType==$.PCData&&n.nodeType==$.CData){if(l.nodeType==$.Document||l.nodeType==$.Element)throw y.thrown("Bad node type, unexpected "+(l.nodeType==null?"null":ve.toString(l.nodeType)));s=Be.trim(l.nodeValue)==""}else s=!1;if(s){if(t>=i.length){if(n.nodeType==$.Document||n.nodeType==$.Element)throw y.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":ve.toString(n.nodeType)));return n.nodeValue}let h=i[t++],a;if(h.nodeType==$.PCData){if(h.nodeType==$.Document||h.nodeType==$.Element)throw y.thrown("Bad node type, unexpected "+(h.nodeType==null?"null":ve.toString(h.nodeType)));a=Be.trim(h.nodeValue)==""}else a=!1;if(a&&t>=i.length){if(n.nodeType==$.Document||n.nodeType==$.Element)throw y.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":ve.toString(n.nodeType)));return n.nodeValue}}let r;if(e.nodeType==$.Document)r="Document";else{if(e.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ve.toString(e.nodeType)));r=e.nodeName}throw y.thrown(r+" does not only have data")}if(l.nodeType!=$.PCData&&l.nodeType!=$.CData){let n;if(e.nodeType==$.Document)n="Document";else{if(e.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ve.toString(e.nodeType)));n=e.nodeName}throw y.thrown(n+" does not have data")}if(l.nodeType==$.Document||l.nodeType==$.Element)throw y.thrown("Bad node type, unexpected "+(l.nodeType==null?"null":ve.toString(l.nodeType)));return l.nodeValue}static get_innerHTML(e){let t="";if(e.nodeType!=$.Document&&e.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":ve.toString(e.nodeType)));let i=0,l=e.children;for(;i<l.length;){let n=l[i++];t+=te.string(Yi.print(n))}return t}}Qi.__properties__={get_innerHTML:"get_innerHTML",get_innerData:"get_innerData"};class Yi{constructor(e){this.output=new $t,this.pretty=e}writeNode(e,t){switch(e.nodeType){case 0:if(this.output.b+=te.string(t+"<"),e.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ve.toString(e.nodeType)));this.output.b+=te.string(e.nodeName);let i=e.attributes();for(;i.hasNext();){let o=i.next();this.output.b+=te.string(" "+o+'="');let u=Be.htmlEscape(e.get(o),!0);this.output.b+=te.string(u),this.output.b+='"'}if(this.hasChildren(e)){if(this.output.b+=">",this.pretty&&(this.output.b+=`
|
|
5
|
+
`),e.nodeType!=$.Document&&e.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":ve.toString(e.nodeType)));let o=0,u=e.children;for(;o<u.length;){let c=u[o++];this.writeNode(c,this.pretty?t+" ":t)}if(this.output.b+=te.string(t+"</"),e.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ve.toString(e.nodeType)));this.output.b+=te.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(
|
|
11
|
-
`);break;case 4:if(e.nodeType
|
|
12
|
-
`);break;case 5:if(e.nodeType
|
|
13
|
-
`);break;case 6:if(e.nodeType!=G.Document&&e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":ge.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!=G.Document&&e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));let t=0,i=e.children;for(;t<i.length;){let s=i[t++];switch(s.nodeType){case 0:case 1:return!0;case 2:case 3:if(s.nodeType==G.Document||s.nodeType==G.Element)throw k.thrown("Bad node type, unexpected "+(s.nodeType==null?"null":ge.toString(s.nodeType)));if(Te.ltrim(s.nodeValue).length!=0)return!0;break;default:}}return!1}static print(e,t){t==null&&(t=!1);let i=new Qi(t);return i.writeNode(e,""),i.output.b}}K["haxe.xml.Printer"]=Qi,Qi.__name__="haxe.xml.Printer",Object.assign(Qi.prototype,{__class__:Qi});var j=Fe["hscript.TType"]={__ename__:"hscript.TType",__constructs__:null,TMono:(m=function(w){return{_hx_index:0,r:w,__enum__:"hscript.TType",toString:C}},m._hx_name="TMono",m.__params__=["r"],m),TVoid:{_hx_name:"TVoid",_hx_index:1,__enum__:"hscript.TType",toString:C},TInt:{_hx_name:"TInt",_hx_index:2,__enum__:"hscript.TType",toString:C},TFloat:{_hx_name:"TFloat",_hx_index:3,__enum__:"hscript.TType",toString:C},TBool:{_hx_name:"TBool",_hx_index:4,__enum__:"hscript.TType",toString:C},TDynamic:{_hx_name:"TDynamic",_hx_index:5,__enum__:"hscript.TType",toString:C},TParam:(m=function(w){return{_hx_index:6,name:w,__enum__:"hscript.TType",toString:C}},m._hx_name="TParam",m.__params__=["name"],m),TUnresolved:(m=function(w){return{_hx_index:7,name:w,__enum__:"hscript.TType",toString:C}},m._hx_name="TUnresolved",m.__params__=["name"],m),TNull:(m=function(w){return{_hx_index:8,t:w,__enum__:"hscript.TType",toString:C}},m._hx_name="TNull",m.__params__=["t"],m),TInst:(m=function(w,e){return{_hx_index:9,c:w,args:e,__enum__:"hscript.TType",toString:C}},m._hx_name="TInst",m.__params__=["c","args"],m),TEnum:(m=function(w,e){return{_hx_index:10,e:w,args:e,__enum__:"hscript.TType",toString:C}},m._hx_name="TEnum",m.__params__=["e","args"],m),TType:(m=function(w,e){return{_hx_index:11,t:w,args:e,__enum__:"hscript.TType",toString:C}},m._hx_name="TType",m.__params__=["t","args"],m),TAbstract:(m=function(w,e){return{_hx_index:12,a:w,args:e,__enum__:"hscript.TType",toString:C}},m._hx_name="TAbstract",m.__params__=["a","args"],m),TFun:(m=function(w,e){return{_hx_index:13,args:w,ret:e,__enum__:"hscript.TType",toString:C}},m._hx_name="TFun",m.__params__=["args","ret"],m),TAnon:(m=function(w){return{_hx_index:14,fields:w,__enum__:"hscript.TType",toString:C}},m._hx_name="TAnon",m.__params__=["fields"],m),TLazy:(m=function(w){return{_hx_index:15,f:w,__enum__:"hscript.TType",toString:C}},m._hx_name="TLazy",m.__params__=["f"],m)};j.__constructs__=[j.TMono,j.TVoid,j.TInt,j.TFloat,j.TBool,j.TDynamic,j.TParam,j.TUnresolved,j.TNull,j.TInst,j.TEnum,j.TType,j.TAbstract,j.TFun,j.TAnon,j.TLazy];var pe=Fe["hscript._Checker.WithType"]={__ename__:"hscript._Checker.WithType",__constructs__:null,NoValue:{_hx_name:"NoValue",_hx_index:0,__enum__:"hscript._Checker.WithType",toString:C},Value:{_hx_name:"Value",_hx_index:1,__enum__:"hscript._Checker.WithType",toString:C},WithType:(m=function(w){return{_hx_index:2,t:w,__enum__:"hscript._Checker.WithType",toString:C}},m._hx_name="WithType",m.__params__=["t"],m)};pe.__constructs__=[pe.NoValue,pe.Value,pe.WithType];var ni=Fe["hscript.CTypedecl"]={__ename__:"hscript.CTypedecl",__constructs__:null,CTClass:(m=function(w){return{_hx_index:0,c:w,__enum__:"hscript.CTypedecl",toString:C}},m._hx_name="CTClass",m.__params__=["c"],m),CTEnum:(m=function(w){return{_hx_index:1,e:w,__enum__:"hscript.CTypedecl",toString:C}},m._hx_name="CTEnum",m.__params__=["e"],m),CTTypedef:(m=function(w){return{_hx_index:2,t:w,__enum__:"hscript.CTypedecl",toString:C}},m._hx_name="CTTypedef",m.__params__=["t"],m),CTAlias:(m=function(w){return{_hx_index:3,t:w,__enum__:"hscript.CTypedecl",toString:C}},m._hx_name="CTAlias",m.__params__=["t"],m),CTAbstract:(m=function(w){return{_hx_index:4,a:w,__enum__:"hscript.CTypedecl",toString:C}},m._hx_name="CTAbstract",m.__params__=["a"],m)};ni.__constructs__=[ni.CTClass,ni.CTEnum,ni.CTTypedef,ni.CTAlias,ni.CTAbstract];class _s{constructor(e,t){this.expr=e,this.t=t}}K["hscript.Completion"]=_s,_s.__name__="hscript.Completion",Object.assign(_s.prototype,{__class__:_s});class Is{constructor(){this.types=new me,this.types=new me,this.types.h.Void=ni.CTAlias(j.TVoid),this.types.h.Int=ni.CTAlias(j.TInt),this.types.h.Float=ni.CTAlias(j.TFloat),this.types.h.Bool=ni.CTAlias(j.TBool),this.types.h.Dynamic=ni.CTAlias(j.TDynamic),this.parser=new Yi}addXmlApi(e){let t=new vs;t.process(e,"");let i=[],s=0,n=t.root;for(;s<n.length;){let r=n[s];++s,this.addXmlType(r,i)}let l=0;for(;l<i.length;){let r=i[l];++l,r()}this.t_string=this.getType("String")}defineClass(e,t){return t==null&&(t={name:e,fields:new me,statics:new me,params:[]}),this.types.h[e]=ni.CTClass(t),t}addXmlType(e,t){let i=this;switch(e._hx_index){case 0:let s=e.name,n=e.full,l=e.subs,r=0;for(;r<l.length;){let A=l[r];++r,this.addXmlType(A,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 me,statics:new me};this.addMeta(h,a),h.isInterface&&(a.isInterface=!0);let o=0,c=h.params;for(;o<c.length;){let A=c[o];++o,a.params.push(j.TParam(A))}t.push(function(){let A=new me,B=0,I=a.params;for(;B<I.length;){let $=I[B];++B;let te=h.path+"."+We.typeStr($);A.h[te]=$}if(i.localParams=A,h.superClass!=null){let $=i,te=h.superClass.path,O=[],q=0,S=h.superClass.params;for(;q<S.length;){let W=S[q];++q,O.push(i.makeXmlType(W))}a.superClass=$.getType(te,O)}if(h.interfaces!=null){a.interfaces=[];let $=0,te=h.interfaces;for(;$<te.length;){let O=te[$];++$;let q=a.interfaces,S=i,W=O.path,ve=[],de=0,Ce=O.params;for(;de<Ce.length;){let Se=Ce[de];++de,ve.push(i.makeXmlType(Se))}q.push(S.getType(W,ve))}}let H=[],P=function($,te){if($.isOverride||u.substr($.name,0,4)=="get_"||u.substr($.name,0,4)=="set_")return;let O=!$.name.startsWith("__"),q=0,S=$.meta;for(;q<S.length;){let Ee=S[q];if(++q,Ee.name==":noScript")return;Ee.name==":noCompletion"&&(O=!1)}let W=$.set,ve;switch(W._hx_index){case 2:let Ee=W.m;ve=!0;break;case 0:case 4:ve=!0;break;default:ve=!1}let de={isPublic:$.isPublic,canWrite:ve,complete:O,params:[],name:$.name,t:null},Ce=0,Se=$.params;for(;Ce<Se.length;){let Ee=Se[Ce];++Ce;let J=j.TParam(Ee),se=$.name+"."+Ee;H.push(se),de.params.push(J),i.localParams.h[se]=J}if(de.t=i.makeXmlType($.type),$.meta!=null&&$.meta.length>0){de.meta=[];let Ee=0,J=$.meta;for(;Ee<J.length;){let se=J[Ee];++Ee;let N=de.meta,X=se.name,rt=[],Ve=0,Ye=se.params;for(;Ve<Ye.length;){let Ue=Ye[Ve];++Ve;let He;try{He=i.parser.parseString(Ue)}catch(Je){if(k.caught(Je).unwrap()instanceof ce)He=null;else throw Je}rt.push(He)}N.push({name:X,params:rt})}}for(;H.length>0;){let Ee=i.localParams,J=H.pop(),se=Ee;Object.prototype.hasOwnProperty.call(se.h,J)&&delete se.h[J]}de.name=="new"?a.constructor=de:te.set($.name,de)},M=0,V=h.fields;for(;M<V.length;){let $=V[M];++M,P($,a.fields)}let R=0,Y=h.statics;for(;R<Y.length;){let $=Y[R];++R,P($,a.statics)}i.localParams=null}),this.types.h[a.name]=ni.CTClass(a);break;case 2:let p=e.e;if(Object.prototype.hasOwnProperty.call(this.types.h,p.path))return;let f={name:p.path,params:[],constructors:[]};this.addMeta(p,f);let _=0,d=p.params;for(;_<d.length;){let A=d[_];++_,f.params.push(j.TParam(A))}t.push(function(){let A=new me,B=0,I=f.params;for(;B<I.length;){let M=I[B];++B;let V=p.path+"."+We.typeStr(M);A.h[V]=M}i.localParams=A;let H=0,P=p.constructors;for(;H<P.length;){let M=P[H];++H;let V=f.constructors,R=M.name,Y;if(M.args==null)Y=null;else{let $=[],te=0,O=M.args;for(;te<O.length;){let q=O[te];++te,$.push({name:q.name,opt:q.opt,t:i.makeXmlType(q.t)})}Y=$}V.push({name:R,args:Y})}i.localParams=null}),this.types.h[f.name]=ni.CTEnum(f);break;case 3:let x=e.t;if(Object.prototype.hasOwnProperty.call(this.types.h,x.path))return;let y={name:x.path,params:[],t:null},b=0,v=x.params;for(;b<v.length;){let A=v[b];++b,y.params.push(j.TParam(A))}x.path=="hscript.TypeCheck"&&y.params.reverse(),t.push(function(){let A=new me,B=0,I=y.params;for(;B<I.length;){let H=I[B];++B;let P=x.path+"."+We.typeStr(H);A.h[P]=H}i.localParams=A,y.t=i.makeXmlType(x.type),i.localParams=null}),this.types.h[x.path]=ni.CTTypedef(y);break;case 4:let T=e.a;if(Object.prototype.hasOwnProperty.call(this.types.h,T.path))return;let E={name:T.path,params:[],t:null};this.addMeta(T,E);let F=0,L=T.params;for(;F<L.length;){let A=L[F];++F,E.params.push(j.TParam(A))}t.push(function(){let A=new me,B=0,I=E.params;for(;B<I.length;){let H=I[B];++B;let P=T.path+"."+We.typeStr(H);A.h[P]=H}i.localParams=A,E.t=i.makeXmlType(T.athis),i.localParams=null}),this.types.h[T.path]=ni.CTAbstract(E);break}}addMeta(e,t){if(e.meta==null||e.meta.length==0)return;t.meta=[];let i=0,s=e.meta;for(;i<s.length;){let n=s[i];++i;let l=t.meta,r=n.name,h=[],a=0,o=n.params;for(;a<o.length;){let c=o[a];++a;let p;try{p=this.parser.parseString(c)}catch(f){if(k.caught(f).unwrap()instanceof ce)p=null;else throw f}h.push(p)}l.push({name:r,params:h})}}makeXmlType(e){switch(e._hx_index){case 0:return j.TUnresolved("Unknown");case 1:let t=e.name,i=e.params,s=[],n=0;for(;n<i.length;){let I=i[n];++n,s.push(this.makeXmlType(I))}return this.getType(t,s);case 2:let l=e.name,r=e.params,h=[],a=0;for(;a<r.length;){let I=r[a];++a,h.push(this.makeXmlType(I))}return this.getType(l,h);case 3:let o=e.name,c=e.params,p=[],f=0;for(;f<c.length;){let I=c[f];++f,p.push(this.makeXmlType(I))}return this.getType(o,p);case 4:let _=e.args,d=e.ret,x=[],y=0;for(;y<_.length;){let I=_[y];++y,x.push({name:I.name,opt:I.opt,t:this.makeXmlType(I.t)})}return j.TFun(x,this.makeXmlType(d));case 5:let b=e.fields,v=[],T=0;for(;T<b.length;){let I=b[T];++T;let H=I.name,P=this.makeXmlType(I.type),M=I.meta,V;if(M==null)V=!1;else{let R=!1,Y=0;for(;Y<M.length;){let $=M[Y];if(++Y,$.name==":optional"){R=!0;break}}V=R}v.push({name:H,t:P,opt:V})}return j.TAnon(v);case 6:let E=e.t;return j.TDynamic;case 7:let F=e.name,L=e.params,A=[],B=0;for(;B<L.length;){let I=L[B];++B,A.push(this.makeXmlType(I))}return this.getType(F,A)}}getType(e,t){if(this.localParams!=null){let s=this.localParams.h[e];if(s!=null)return s}let i=this.resolve(e,t);if(i==null){let s=e.split(".");if(s.length>1){let n=s[s.length-2];if(u.cca(n,0)==95)return u.remove(s,n),this.getType(s.join("."),t)}return j.TUnresolved(e)}return i}resolve(e,t){if(e=="Null"){if(t==null||t.length!=1)throw k.thrown("Missing Null<T> parameter");return j.TNull(t[0])}let i=this.types.h[e];if(i==null)return null;switch(t==null&&(t=[]),i._hx_index){case 0:let s=i.c;return j.TInst(s,t);case 1:let n=i.e;return j.TEnum(n,t);case 2:let l=i.t;return j.TType(l,t);case 3:return i.t;case 4:let h=i.a;return j.TAbstract(h,t)}}}K["hscript.CheckerTypes"]=Is,Is.__name__="hscript.CheckerTypes",Object.assign(Is.prototype,{__class__:Is});class We{constructor(e){this.events=new me,this.globals=new me,e==null&&(e=new Is),this.types=e}setGlobals(e,t){t==null&&(t=!1);let i=this;for(;;){let s=e.fields.h,n=s,l=Object.keys(s),r=l.length,h=0;for(;h<r;){let o=n[l[h++]];if(o.isPublic||t){let c=o.params.length==0?o.t:j.TLazy(function(){let p=i,f=o.t,_=o.params,d=[],x=0,y=o.params.length;for(;x<y;){let b=x++;d.push(i.makeMono())}return p.apply(f,_,d)});this.setGlobal(o.name,c)}}if(e.superClass==null)break;let a=e.superClass;if(a==null)throw k.thrown("assert");if(a._hx_index==9){let o=a.args;e=a.c}else throw k.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=[],s=0,n=e.length;for(;s<n;){let l=s++,r=e[l],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=pe.NoValue),this.locals=new me,this.types.t_string==null&&(this.types.t_string=this.types.getType("String")),this.allowDefine=this.allowGlobalsDefine,this.isCompletion=i;let s=e.e,n;if(s._hx_index==14){let h=s.args,a=s.e,o=s.name,c=s.ret;n=!0}else n=!1;n&&(e=this.mk(D.EBlock([e]),e));let l=this,r=e.e;if(r._hx_index==4){let h=r.e,a=[],o=j.TVoid,c=0;for(;c<h.length;){let f=h[c];for(++c;;){let d=f.e;if(d._hx_index==25){let x=d.name,y=d.args;f=d.e}else break}let _=f.e;if(_._hx_index==14){let d=_.e,x=_.args,y=_.name,b=_.ret;if(y!=null){let v=b==null?this.makeMono():this.makeType(b,f),T=j.TFun(this.typeArgs(x,f),v);this.locals.h[y]=T,a.push(function(){return l.currentFunType=T,l.typeExpr(f,pe.NoValue),T})}else{let v=0;for(;v<a.length;){let T=a[v];++v,T()}a=[],h[h.length-1]==f?o=this.typeExpr(f,t):this.typeExpr(f,pe.NoValue)}}else{let d=0;for(;d<a.length;){let x=a[d];++d,x()}a=[],h[h.length-1]==f?o=this.typeExpr(f,t):this.typeExpr(f,pe.NoValue)}}let p=0;for(;p<a.length;){let f=a[p];++p,o=f()}return o}return this.typeExpr(e,t)}edef(e){return e.e}error(e,t){let i=oe.ECustom(e),s=new ce(i,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw k.thrown(s)}saveLocals(){let e=new me,t=this.locals.h,i=t,s=Object.keys(t),n=s.length,l=0;for(;l<n;){let r=s[l++];e.h[r]=this.locals.h[r]}return e}makeType(e,t){switch(e._hx_index){case 0:let i=e.path,s=e.params,n=this.types,l=i.join("."),r;if(s==null)r=[];else{let E=[],F=0;for(;F<s.length;){let L=s[F];++F,E.push(this.makeType(L,t))}r=E}let h=n.resolve(l,r);if(h==null){let E=oe.ECustom("Unknown type "+Z.string(i)),F=new ce(E,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw k.thrown(F);h=j.TDynamic}return h;case 1:let a=e.args,o=e.ret,c=0,p=[],f=0;for(;f<a.length;){let E=a[f];++f,p.push({name:"p"+c++,opt:!1,t:this.makeType(E,t)})}return j.TFun(p,this.makeType(o,t));case 2:let _=e.fields,d=[],x=0;for(;x<_.length;){let E=_[x];++x,d.push({name:E.name,opt:!1,t:this.makeType(E.t,t)})}return j.TAnon(d);case 3:let y=e.t;return this.makeType(y,t);case 4:let b=e.t;return this.makeType(b,t);case 5:let v=e.n,T=e.t;return this.makeType(T,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==j.TDynamic?!1:this.linkLoop(e,j.TDynamic);case 9:let s=t.c,n=t.args,l=0;for(;l<n.length;){let E=n[l];if(++l,this.linkLoop(e,E))return!0}return!1;case 10:let r=t.e,h=t.args,a=0;for(;a<h.length;){let E=h[a];if(++a,this.linkLoop(e,E))return!0}return!1;case 11:let o=t.t,c=t.args,p=0;for(;p<c.length;){let E=c[p];if(++p,this.linkLoop(e,E))return!0}return!1;case 12:let f=t.a,_=t.args,d=0;for(;d<_.length;){let E=_[d];if(++d,this.linkLoop(e,E))return!0}return!1;case 13:let x=t.args,y=t.ret,b=0;for(;b<x.length;){let E=x[b];if(++b,this.linkLoop(e,E.t))return!0}return this.linkLoop(e,y);case 14:let v=t.fields,T=0;for(;T<v.length;){let E=v[T];if(++T,this.linkLoop(e,E.t))return!0}return!1;default:return!1}}link(e,t,i){return this.linkLoop(e,t)?this.follow(t)==e:(t==j.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 s=e.t;switch(t._hx_index){case 0:let x=t.r;return x.r==null?this.link(t,e,x)?(x.r=e,!0):!1:this.typeEq(e,x.r);case 8:let y=t.t,b=s;return this.typeEq(b,y);case 11:let v=t.t,T=t.args;return this.typeEq(e,this.apply(v.t,v.params,T));default:let E=s;return this.typeEq(E,t)}break;case 9:let n=e.c,l=e.args;switch(t._hx_index){case 0:let x=t.r;return x.r==null?this.link(t,e,x)?(x.r=e,!0):!1:this.typeEq(e,x.r);case 8:let y=t.t;return this.typeEq(e,y);case 9:let b=t.c,v=t.args,T=l;if(n==b){let A=0,B=T.length;for(;A<B;){let I=A++;if(!this.typeEq(T[I],v[I]))return!1}return!0}break;case 11:let F=t.t,L=t.args;return this.typeEq(e,this.apply(F.t,F.params,L));default:}break;case 10:let r=e.e,h=e.args;switch(t._hx_index){case 0:let x=t.r;return x.r==null?this.link(t,e,x)?(x.r=e,!0):!1:this.typeEq(e,x.r);case 8:let y=t.t;return this.typeEq(e,y);case 10:let b=t.e,v=t.args,T=h;if(r==b){let A=0,B=T.length;for(;A<B;){let I=A++;if(!this.typeEq(T[I],v[I]))return!1}return!0}break;case 11:let F=t.t,L=t.args;return this.typeEq(e,this.apply(F.t,F.params,L));default:}break;case 11:let a=e.t,o=e.args;switch(t._hx_index){case 0:let x=t.r;return x.r==null?this.link(t,e,x)?(x.r=e,!0):!1:this.typeEq(e,x.r);case 8:let y=t.t,b=o,v=a;return this.typeEq(this.apply(v.t,v.params,b),t);case 11:let T=t.t,E=t.args,F=o;if(a==T){let I=0,H=F.length;for(;I<H;){let P=I++;if(!this.typeEq(F[P],E[P]))return!1}return!0}else{let I=o,H=a;return this.typeEq(this.apply(H.t,H.params,I),t)}break;default:let A=o,B=a;return this.typeEq(this.apply(B.t,B.params,A),t)}break;case 12:let c=e.a,p=e.args;switch(t._hx_index){case 0:let x=t.r;return x.r==null?this.link(t,e,x)?(x.r=e,!0):!1:this.typeEq(e,x.r);case 8:let y=t.t;return this.typeEq(e,y);case 11:let b=t.t,v=t.args;return this.typeEq(e,this.apply(b.t,b.params,v));case 12:let T=t.a,E=t.args,F=p;if(c==T){let A=0,B=F.length;for(;A<B;){let I=A++;if(!this.typeEq(F[I],E[I]))return!1}return!0}break;default:}break;case 13:let f=e.args,_=e.ret;switch(t._hx_index){case 0:let x=t.r;return x.r==null?this.link(t,e,x)?(x.r=e,!0):!1:this.typeEq(e,x.r);case 8:let y=t.t;return this.typeEq(e,y);case 11:let b=t.t,v=t.args;return this.typeEq(e,this.apply(b.t,b.params,v));case 13:let T=t.args,E=t.ret,F=_,L=f;if(L.length==T.length){let A=0,B=L.length;for(;A<B;){let I=A++;if(!this.typeEq(L[I].t,T[I].t))return!1}return this.typeEq(F,E)}break;default:}break;case 14:let d=e.fields;switch(t._hx_index){case 0:let x=t.r;return x.r==null?this.link(t,e,x)?(x.r=e,!0):!1:this.typeEq(e,x.r);case 8:let y=t.t;return this.typeEq(e,y);case 11:let b=t.t,v=t.args;return this.typeEq(e,this.apply(b.t,b.params,v));case 14:let T=t.fields,E=d;if(E.length==T.length){let F=Object.create(null),L=0;for(;L<T.length;){let B=T[L];++L,F[B.name]=B}let A=0;for(;A<E.length;){let B=E[A];++A;let I=F[B.name];if(I==null||!this.typeEq(B.t,I.t))return!1}return!0}break;default:}break;default:switch(t._hx_index){case 0:let x=t.r;return x.r==null?this.link(t,e,x)?(x.r=e,!0):!1:this.typeEq(e,x.r);case 8:let y=t.t;return this.typeEq(e,y);case 11:let b=t.t,v=t.args;return this.typeEq(e,this.apply(b.t,b.params,v));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 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 f=t.t;return this.tryUnify(e,f);case 11:let _=t.t,d=t.args;return this.tryUnify(e,this.apply(_.t,_.params,d));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 f=t.t;return this.tryUnify(e,f);case 11:let _=t.t,d=t.args;return this.tryUnify(e,this.apply(_.t,_.params,d));default:return!0}break;case 8:let s=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 f=s;return this.tryUnify(f,t);case 8:let _=t.t,d=s;return this.tryUnify(d,t);case 11:let x=t.t,y=t.args;return this.tryUnify(e,this.apply(x.t,x.params,y));default:let b=s;return this.tryUnify(b,t)}break;case 9:let n=e.c,l=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 f=t.t;return this.tryUnify(e,f);case 9:let _=t.c,d=t.args,x=l,y=n;for(;y!=_;){if(y.interfaces!=null){let P=0,M=y.interfaces;for(;P<M.length;){let V=M[P];if(++P,V._hx_index==9){let R=V.c,Y=V.args,$=[],te=0;for(;te<Y.length;){let q=Y[te];++te,$.push(this.apply(q,y.params,x))}let O=j.TInst(R,$);if(this.tryUnify(O,t))return!0}else throw k.thrown("assert")}}let H=y.superClass;if(H==null)return!1;if(H._hx_index==9){let P=H.c,M=H.args,V=[],R=0;for(;R<M.length;){let Y=M[R];++R,V.push(this.apply(Y,y.params,x))}x=V,y=P}else throw k.thrown("assert")}let b=0,v=x.length;for(;b<v;){let H=b++;if(!this.typeEq(x[H],d[H]))return!1}return!0;case 11:let T=t.t,E=t.args;return this.tryUnify(e,this.apply(T.t,T.params,E));case 14:let F=t.fields,L=l,A=n,B=0,I=F.length;for(;B<I;){let H=B++,P=F[H],M=null,V=A;for(;M=V.fields.h[P.name],M==null;){if(V.superClass==null)return!1;let R=V.superClass;if(R==null)throw k.thrown("assert");if(R._hx_index==9){let Y=R.args;V=R.c}else throw k.thrown("assert")}if(!this.typeEq(this.apply(M.t,A.params,L),P.t))return!1}return!0;default:}break;case 11:let r=e.t,h=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 f=h,_=r;return this.tryUnify(this.apply(_.t,_.params,f),t);case 8:let d=t.t,x=h,y=r;return this.tryUnify(this.apply(y.t,y.params,x),t);case 11:let b=t.t,v=t.args,T=h,E=r;return this.tryUnify(this.apply(E.t,E.params,T),t);default:let F=h,L=r;return this.tryUnify(this.apply(L.t,L.params,F),t)}break;case 13:let a=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 f=t.t;return this.tryUnify(e,f);case 11:let _=t.t,d=t.args;return this.tryUnify(e,this.apply(_.t,_.params,d));case 12:let x=t.a,y=t.args,b=x.meta,v=x.params,T=x.t;if(x.name=="haxe.Function")return!0;break;case 13:let E=t.args,F=t.ret,L=o,A=a;if(A.length==E.length){let B=0,I=A.length;for(;B<I;){let H=B++,P=A[H],M=E[H];if(M.opt&&!P.opt||!this.tryUnify(M.t,P.t))return!1}return this.tryUnify(L,F)}break;default:}break;case 14:let c=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 f=t.t;return this.tryUnify(e,f);case 11:let _=t.t,d=t.args;return this.tryUnify(e,this.apply(_.t,_.params,d));case 14:let x=t.fields,y=c;if(x.length==0)return!0;let b=Object.create(null),v=0;for(;v<y.length;){let E=y[v];++v,b[E.name]=E}let T=0;for(;T<x.length;){let E=x[T];++T;let F=b[E.name];if(F==null){if(E.opt)continue;return!1}if(!this.typeEq(F.t,E.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 f=t.t;return this.tryUnify(e,f);case 11:let _=t.t,d=t.args;return this.tryUnify(e,this.apply(_.t,_.params,d));default:}}return this.typeEq(e,t)}unify(e,t,i){if(!this.tryUnify(e,t)){let s=oe.ECustom(We.typeStr(e)+" should be "+We.typeStr(t)),n=new ce(s,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw k.thrown(n)}}apply(e,t,i){if(i.length!=t.length)throw k.thrown("Invalid number of type parameters");if(i.length==0)return e;let s=new Gi,n=0,l=t.length;for(;n<l;){let a=n++;s.set(t[a],i[a])}let r=null,h=this;return r=function(a){let o=s.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 s=e.name;return e;case 7:let n=e.name;return e;case 8:let l=e.t;return j.TNull(t(l));case 9:let r=e.args;if(r.length==0)return e;{let v=r,T=e.c,E=[],F=0;for(;F<v.length;){let L=v[F];++F,E.push(t(L))}return j.TInst(T,E)}break;case 10:let h=e.args;if(h.length==0)return e;{let v=h,T=e.e,E=[],F=0;for(;F<v.length;){let L=v[F];++F,E.push(t(L))}return j.TEnum(T,E)}break;case 11:let a=e.args;if(a.length==0)return e;{let v=a,T=e.t,E=[],F=0;for(;F<v.length;){let L=v[F];++F,E.push(t(L))}return j.TType(T,E)}break;case 12:let o=e.args;if(o.length==0)return e;{let v=o,T=e.a,E=[],F=0;for(;F<v.length;){let L=v[F];++F,E.push(t(L))}return j.TAbstract(T,E)}break;case 13:let c=e.args,p=e.ret,f=[],_=0;for(;_<c.length;){let v=c[_];++_,f.push({name:v.name,opt:v.opt,t:t(v.t)})}return j.TFun(f,t(p));case 14:let d=e.fields,x=[],y=0;for(;y<d.length;){let v=d[y];++y,x.push({name:v.name,opt:v.opt,t:t(v.t)})}return j.TAnon(x);case 15:let b=e.f;return t(b())}}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 s=e.t,n=e.args;return this.follow(this.apply(s.t,s.params,n));case 15:let l=e.f;return this.follow(l());default:return e}}getFields(e){let t=[],i=this,s=this.follow(e);switch(s._hx_index){case 9:let n=s.c,l=s.args,r=function(p){return i.apply(p,n.params,l)};for(;n!=null;){let p=n.fields.h,f=p,_=Object.keys(p),d=_.length,x=0;for(;x<d;){let b=_[x++],v=n.fields.h[b];if(!v.isPublic||!v.complete)continue;let T=v.name,E=r(v.t);this.allowAsync&&T.startsWith("a_")&&(E=this.unasync(E),T=u.substr(T,2,null)),t.push({name:T,t:E})}if(n.isInterface&&n.interfaces!=null){let b=0,v=n.interfaces;for(;b<v.length;){let T=v[b];++b;let E=0,F=this.getFields(T);for(;E<F.length;){let L=F[E];++E,t.push({name:L.name,t:r(L.t)})}}}if(n.superClass==null)break;let y=n.superClass;if(y==null)break;if(y._hx_index==9){let b=y.c,v=y.args,T=r;r=function(E){return T(i.apply(E,b.params,v))},n=b}else break}break;case 13:let h=s.args,a=s.ret;this.isCompletion&&t.push({name:"bind",t:j.TFun(h,j.TVoid)});break;case 14:let o=s.fields,c=0;for(;c<o.length;){let p=o[c];++c,t.push({name:p.name,t:p.t})}break;default:}return t}getField(e,t,i,s){s==null&&(s=!1);let n=this.follow(e);switch(n._hx_index){case 5:return this.makeMono();case 9:let l=n.c,r=n.args,h=l.fields.h[t];if(h==null&&this.allowAsync&&(h=l.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&&l.isInterface&&l.interfaces!=null){let p=0,f=l.interfaces;for(;p<f.length;){let _=f[p];++p;let d=this.getField(_,t,i,s);if(d!=null)return this.apply(d,l.params,r)}}if(h==null){if(l.superClass==null)return null;let p=this.getField(l.superClass,t,i,s);return p!=null&&(p=this.apply(p,l.params,r)),p}if(!h.isPublic){let p=oe.ECustom("Can't access private field "+t+" on "+l.name),f=new ce(p,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw k.thrown(f)}if(s&&!h.canWrite){let p=oe.ECustom("Can't write readonly field "+t+" on "+l.name),f=new ce(p,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw k.thrown(f)}let a=h.t;if(h.params!=null){let p=h.params,f=[],_=0,d=h.params.length;for(;_<d;){let x=_++;f.push(this.makeMono())}a=this.apply(a,p,f)}return this.apply(a,l.params,r);case 14:let o=n.fields,c=0;for(;c<o.length;){let p=o[c];if(++c,p.name==t)return p.t}return null;default:return null}}unasync(e){let t=this.follow(e);if(t._hx_index==13){let i=t.args,s=t.ret;if(i.length>0){let n=i.slice(),l=this.follow(n.shift().t);if(l._hx_index==13){let r=l.args,h=l.ret;if(r.length==1){let a=r[0];return j.TFun(n,a.t)}}}}return null}typeExprWith(e,t){let i=this.typeExpr(e,pe.WithType(t));return this.unify(i,t,e),t}makeMono(){return j.TMono({r:null})}makeIterator(e){return j.TAnon([{name:"next",opt:!1,t:j.TFun([],e)},{name:"hasNext",opt:!1,t:j.TFun([],j.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,s=t.constructor,n=t.fields,l=t.interfaces,r=t.isInterface,h=t.meta,a=t.params,o=t.statics,c=t.superClass;return t.name=="String"}else return!1}onCompletion(e,t){if(this.isCompletion)throw k.thrown(new _s(e,t))}typeField(e,t,i,s){let n=this.typeExpr(e,pe.Value);t==null&&this.onCompletion(i,n);let l=this.getField(n,t,i,s);if(l==null){let r=oe.ECustom(We.typeStr(n)+" has no field "+t),h=new ce(r,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw k.thrown(h);l=j.TDynamic}return l}typeExpr(e,t){if(e==null&&this.isCompletion)return t._hx_index==2?t.t:j.TDynamic;let i=this,s=e.e;switch(s._hx_index){case 0:let h=s.c;switch(h._hx_index){case 0:let ne=h.v;return j.TInt;case 1:let ae=h.f;return j.TFloat;case 2:let ke=h.s;return this.types.t_string}break;case 1:let a=s.v,o=this.locals.h[a];if(o!=null)return o;let c=this.globals.h[a];if(c!=null){if(c==null)return c;if(c._hx_index==15){let ne=c.f;return ne()}else return c}if(this.allowAsync&&(c=this.globals.h["a_"+a],c!=null&&(c=this.unasync(c)),c!=null))return c;switch(a){case"false":case"true":return j.TBool;case"null":return this.makeMono();case"trace":return j.TDynamic;default:if(t._hx_index==2){let ke=t.t;if(ke._hx_index==10){let Ie=ke,Bt=ke.e,St=ke.args,et=0,wi=Bt.constructors;for(;et<wi.length;){let si=wi[et];if(++et,si.name==a){if(this.onTopDownEnum(Bt,a)){let st=si.args==null?Ie:j.TFun(si.args,Ie);return this.apply(st,Bt.params,St)}break}}}}if(this.isCompletion)return j.TDynamic;let ne=oe.ECustom("Unknown identifier "+a),ae=new ce(ne,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(ae)}break;case 2:let p=s.n,f=s.t,_=s.e,d=f==null?this.makeMono():this.makeType(f,e);if(_!=null){let ne=this.typeExpr(_,f==null?pe.Value:pe.WithType(d));f==null?d=ne:this.unify(ne,d,_)}return this.locals.h[p]=d,j.TVoid;case 3:let x=s.e;return this.typeExpr(x,t);case 4:let y=s.e,b=j.TVoid,v=this.saveLocals(),T=0;for(;T<y.length;){let ne=y[T];++T,b=this.typeExpr(ne,ne==y[y.length-1]?t:pe.NoValue)}return this.locals=v,b;case 5:let E=s.e,F=s.f;return this.typeField(E,F,e,!1);case 6:let L=s.op,A=s.e1,B=s.e2;switch(L){case"!=":case"==":let ne=this.typeExpr(A,pe.Value),ae=this.typeExpr(B,pe.WithType(ne));return this.tryUnify(ne,ae)||this.unify(ae,ne,B),j.TBool;case"%":case"*":case"-":case"/":let ke=this.typeExpr(A,pe.WithType(j.TInt)),Ie=this.typeExpr(B,pe.WithType(ke));this.tryUnify(ke,Ie)||this.unify(Ie,ke,B);let Bt=this.follow(ke),St=this.follow(Ie);switch(Bt._hx_index){case 2:switch(St._hx_index){case 2:return L=="/"?j.TFloat:j.TInt;case 3:case 5:return j.TFloat;default:this.unify(ke,j.TFloat,A),this.unify(Ie,j.TFloat,B)}break;case 3:switch(St._hx_index){case 2:case 3:case 5:return j.TFloat;default:this.unify(ke,j.TFloat,A),this.unify(Ie,j.TFloat,B)}break;case 5:switch(St._hx_index){case 2:case 3:case 5:return j.TFloat;default:this.unify(ke,j.TFloat,A),this.unify(Ie,j.TFloat,B)}break;default:this.unify(ke,j.TFloat,A),this.unify(Ie,j.TFloat,B)}break;case"+":let et=this.typeExpr(A,pe.WithType(j.TInt)),wi=this.typeExpr(B,pe.WithType(et));this.tryUnify(et,wi);let si=this.follow(et),st=this.follow(wi);switch(si._hx_index){case 2:switch(st._hx_index){case 2:return j.TInt;case 3:return j.TFloat;case 5:return j.TDynamic;default:let xt=si,pi=st;if(this.isString(xt)||this.isString(pi))return this.types.t_string;this.unify(xt,j.TFloat,A),this.unify(pi,j.TFloat,B)}break;case 3:switch(st._hx_index){case 2:case 3:return j.TFloat;case 5:return j.TDynamic;default:let xt=si,pi=st;if(this.isString(xt)||this.isString(pi))return this.types.t_string;this.unify(xt,j.TFloat,A),this.unify(pi,j.TFloat,B)}break;case 5:return j.TDynamic;default:if(st._hx_index==5)return j.TDynamic;{let xt=si,pi=st;if(this.isString(xt)||this.isString(pi))return this.types.t_string;this.unify(xt,j.TFloat,A),this.unify(pi,j.TFloat,B)}}break;case"...":return this.typeExprWith(A,j.TInt),this.typeExprWith(B,j.TInt),this.makeIterator(j.TInt);case"&":case"<<":case">>":case">>>":case"^":case"|":return this.typeExprWith(A,j.TInt),this.typeExprWith(B,j.TInt),j.TInt;case"<":case"<=":case">":case">=":let Rt=this.typeExpr(A,pe.Value),Mi=this.typeExpr(B,pe.WithType(Rt));this.tryUnify(Rt,Mi)||this.unify(Mi,Rt,B);let ts=this.follow(Rt);switch(ts._hx_index){case 2:case 3:case 4:break;case 9:let xt=ts.c,pi=ts.args,sn=xt.constructor,Nn=xt.fields,Mn=xt.interfaces,Ln=xt.isInterface,Bn=xt.meta,An=xt.params,Fn=xt.statics,Dn=xt.superClass;if(xt.name!="String"){let vn=oe.ECustom("Cannot compare "+We.typeStr(Rt)),In=new ce(vn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(In)}break;default:let En=oe.ECustom("Cannot compare "+We.typeStr(Rt)),Sn=new ce(En,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(Sn)}return j.TBool;case"=":if(this.allowDefine){let xt=A.e;if(xt._hx_index==1){let pi=xt.v;if(!Object.prototype.hasOwnProperty.call(this.locals.h,pi)&&!Object.prototype.hasOwnProperty.call(this.globals.h,pi)){let sn=this.typeExpr(B,pe.Value);return this.locals.h[pi]=sn,sn}}}let Ts,Hs=A.e;if(Hs._hx_index==5){let xt=Hs.e,pi=Hs.f;Ts=this.typeField(xt,pi,A,!0)}else Ts=this.typeExpr(A,pe.Value);return this.typeExprWith(B,Ts),Ts;case"&&":case"||":return this.typeExprWith(A,j.TBool),this.typeExprWith(B,j.TBool),j.TBool;default:if(u.cca(L,L.length-1)==61){let xt=this.typeExpr(this.mk(D.EBinop(u.substr(L,0,L.length-1),A,B),e),t);return this.typeExpr(this.mk(D.EBinop("=",A,B),e),t)}let Tn=oe.ECustom("Unsupported operation "+L),Cn=new ce(Tn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(Cn)}break;case 7:let I=s.prefix,H=s.op,P=s.e,M=this.typeExpr(P,pe.Value);switch(H){case"!":return this.unify(M,j.TBool,P),M;case"++":case"-":case"--":return this.unify(M,j.TInt,P),M;default:}break;case 8:let V=s.e,R=s.params,Y=V.e;if(Y._hx_index==5&&Y.f=="bind"){let ne=Y.e,ae=this.typeExpr(ne,pe.Value);if(ae._hx_index==13){let ke=ae.args,Ie=ae.ret,Bt=ke.slice(),St=0;for(;St<R.length;){let et=R[St];++St;let wi=Bt.shift();if(wi==null){let si=oe.ECustom("Too many arguments"),st=new ce(si,et.pmin,et.pmax,et.origin,et.line);if(!this.isCompletion)throw k.thrown(st);return j.TFun([],Ie)}this.typeExprWith(et,wi.t)}return j.TFun(Bt,Ie)}}let $=V.e,te;if($._hx_index==1){let ne=$.v;if(t._hx_index==2){let ae=t.t;if(ae._hx_index==10){let ke=ae.e,Ie=ae.args;te=t}else te=pe.Value}else te=pe.Value}else te=pe.Value;let O=this.typeExpr(V,te),q=this.follow(O);switch(q._hx_index){case 5:let ne=0;for(;ne<R.length;){let st=R[ne];++ne,this.typeExpr(st,pe.Value)}return this.makeMono();case 13:let ae=q.args,ke=q.ret,Ie=0,Bt=R.length;for(;Ie<Bt;){let st=Ie++,Rt=ae[st];if(Rt==null){let ts=R[st],Ts=oe.ECustom("Too many arguments"),Hs=new ce(Ts,ts.pmin,ts.pmax,ts.origin,ts.line);if(!this.isCompletion)throw k.thrown(Hs);break}let Mi=this.typeExpr(R[st],Rt==null?pe.Value:pe.WithType(Rt.t));this.unify(Mi,Rt.t,R[st])}let St=R.length,et=ae.length;for(;St<et;){let st=St++;if(!ae[st].opt){let Rt=oe.ECustom("Missing argument "+ae[st].name+":"+We.typeStr(ae[st].t)),Mi=new ce(Rt,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(Mi)}}return ke;default:let wi=oe.ECustom(We.typeStr(O)+" cannot be called"),si=new ce(wi,V.pmin,V.pmax,V.origin,V.line);if(!this.isCompletion)throw k.thrown(si);return this.makeMono()}break;case 9:let S=s.cond,W=s.e1,ve=s.e2;this.typeExprWith(S,j.TBool);let de=this.typeExpr(W,t);if(ve==null)return de;let Ce=this.typeExpr(ve,t);if(t==pe.NoValue)return j.TVoid;if(this.tryUnify(Ce,de))return de;if(this.tryUnify(de,Ce))return Ce;this.unify(Ce,de,ve);break;case 10:let Se=s.cond,Ee=s.e;return this.typeExprWith(Se,j.TBool),this.typeExpr(Ee,pe.NoValue),j.TVoid;case 11:let J=s.v,se=s.it,N=s.e,X=this.saveLocals(),rt=this.typeExpr(se,pe.Value),Ve=this.getIteratorType(se,rt);return this.locals.h[J]=Ve,this.typeExpr(N,pe.NoValue),this.locals=X,j.TVoid;case 12:case 13:return j.TVoid;case 14:let Ye=s.args,Ue=s.e,He=s.name,Je=s.ret,$e=null,Be=null,Ne=null;if(this.currentFunType!=null){let ne=this.currentFunType;if(ne._hx_index==13){let ae=ne.args,ke=ne.ret;$e=this.currentFunType,Be=ke,Ne=ae}else throw k.thrown("assert");this.currentFunType=null}else Be=Je==null?this.makeMono():this.makeType(Je,e);let mt=this.saveLocals(),gt=this.allowReturn,Nt=this.allowDefine,ut=this.hasReturn;this.allowReturn=Be,this.allowDefine=!1,this.hasReturn=!1;let Xe=null,kt;if(He!=null){let ne;if(t._hx_index==2){let ae=this.follow(t.t);if(ae._hx_index==13){let ke=ae.args,Ie=ae.ret;ne=!0}else ne=!1}else ne=!1;kt=!ne}else kt=!1;if(kt){let ne=this.events.h[He];ne!=null&&(t=pe.WithType(ne))}if(t._hx_index==2){let ne=this.follow(t.t);if(ne._hx_index==13){let ae=ne.args,ke=ne.ret;Xe=ae,this.unify(Be,ke,e)}}Ne==null&&(Ne=this.typeArgs(Ye,e));let Ct=0,ye=Ne.length;for(;Ct<ye;){let ne=Ct++,ae=Ne[ne];if(Xe!=null)if(ne<Xe.length)this.unify(Xe[ne].t,ae.t,e);else{let ke=oe.ECustom("Extra argument "+ae.name),Ie=new ce(ke,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(Ie)}this.locals.h[ae.name]=ae.t}if(Xe!=null&&Ne.length<Xe.length){let ne="Missing "+(Xe.length-Ne.length)+" arguments (",ae=[],ke=Ne.length,Ie=Xe.length;for(;ke<Ie;){let et=ke++;ae.push(We.typeStr(Xe[et].t))}let Bt=oe.ECustom(ne+ae.join(",")+")"),St=new ce(Bt,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(St)}if(this.typeExpr(Ue,pe.NoValue),!this.hasReturn&&!this.tryUnify(Be,j.TVoid)){let ne=oe.ECustom("Missing return "+We.typeStr(Be)),ae=new ce(ne,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(ae)}return this.allowDefine=Nt,this.allowReturn=gt,this.hasReturn=ut,this.locals=mt,$e==null&&($e=j.TFun(Ne,Be),He!=null&&(mt.h[He]=$e)),$e;case 15:let ht=s.e,fe=ht==null?j.TVoid:this.typeExpr(ht,this.allowReturn==null?pe.Value:pe.WithType(this.allowReturn));if(this.hasReturn=!0,this.allowReturn==null){let ne=oe.ECustom("Return not allowed here"),ae=new ce(ne,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(ae)}else this.unify(fe,this.allowReturn,ht??e);return this.makeMono();case 16:let xe=s.e,tt=s.index;this.typeExprWith(tt,j.TInt);let Ke=this.typeExpr(xe,pe.Value),dt=this.follow(Ke);if(dt._hx_index==9){let ne=dt.c,ae=dt.args,ke=ne.constructor,Ie=ne.fields,Bt=ne.interfaces,St=ne.isInterface,et=ne.meta,wi=ne.params,si=ne.statics,st=ne.superClass;if(ne.name=="Array"){if(ae.length==1)return ae[0];{let Rt=oe.ECustom(We.typeStr(Ke)+" is not an Array"),Mi=new ce(Rt,xe.pmin,xe.pmax,xe.origin,xe.line);if(!this.isCompletion)throw k.thrown(Mi)}}else{let Rt=oe.ECustom(We.typeStr(Ke)+" is not an Array"),Mi=new ce(Rt,xe.pmin,xe.pmax,xe.origin,xe.line);if(!this.isCompletion)throw k.thrown(Mi)}}else{let ne=oe.ECustom(We.typeStr(Ke)+" is not an Array"),ae=new ce(ne,xe.pmin,xe.pmax,xe.origin,xe.line);if(!this.isCompletion)throw k.thrown(ae)}break;case 17:let Ut=s.e,at=null,ei=0;for(;ei<Ut.length;){let ne=Ut[ei];++ei;let ae=this.typeExpr(ne,at==null?pe.Value:pe.WithType(at));at==null?at=ae:this.tryUnify(ae,at)||(this.tryUnify(at,ae)?at=ae:this.unify(ae,at,ne))}return at==null&&(at=this.makeMono()),this.types.getType("Array",[at]);case 18:let Ae=s.cl,Mt=s.params;break;case 19:let Et=s.e;return this.typeExpr(Et,pe.Value),this.makeMono();case 20:let Lt=s.e,ot=s.v,Dt=s.t,qt=s.ecatch,jt=this.typeExpr(Lt,t),ti=this.locals.h[ot],ii=this.locals,Wt=this.makeType(Dt,qt);ii.h[ot]=Wt;let ze=this.typeExpr(qt,t);if(ti!=null)this.locals.h[ot]=ti;else{let ne=this.locals;Object.prototype.hasOwnProperty.call(ne.h,ot)&&delete ne.h[ot]}return t==pe.NoValue?j.TVoid:this.tryUnify(jt,ze)?ze:(this.unify(ze,jt,qt),jt);case 21:let xi=s.fl;if(t._hx_index==2){let ne=this.follow(t.t);if(ne._hx_index==14){let ae=ne.fields;if(ae.length>0){let ke=Object.create(null),Ie=0;for(;Ie<ae.length;){let et=ae[Ie];++Ie,ke[et.name]=et}let Bt=[],St=0;for(;St<xi.length;){let et=xi[St];++St;let wi=ke[et.name],si;if(wi==null){let st=et.e,Rt=oe.ECustom("Extra field "+et.name),Mi=new ce(Rt,st.pmin,st.pmax,st.origin,st.line);if(!this.isCompletion)throw k.thrown(Mi);si=j.TDynamic}else si=wi.t;Bt.push({t:this.typeExprWith(et.e,si),opt:!1,name:et.name})}return j.TAnon(Bt)}else{let ke=[],Ie=0;for(;Ie<xi.length;){let Bt=xi[Ie];++Ie,ke.push({t:this.typeExpr(Bt.e,pe.Value),opt:!1,name:Bt.name})}return j.TAnon(ke)}}else{let ae=[],ke=0;for(;ke<xi.length;){let Ie=xi[ke];++ke,ae.push({t:this.typeExpr(Ie.e,pe.Value),opt:!1,name:Ie.name})}return j.TAnon(ae)}}else{let ne=[],ae=0;for(;ae<xi.length;){let ke=xi[ae];++ae,ne.push({t:this.typeExpr(ke.e,pe.Value),opt:!1,name:ke.name})}return j.TAnon(ne)}break;case 22:let ue=s.cond,Ge=s.e1,it=s.e2;this.typeExprWith(ue,j.TBool);let Ze=this.typeExpr(Ge,t);if(it==null)return Ze;let ct=this.typeExpr(it,t);if(t==pe.NoValue)return j.TVoid;if(this.tryUnify(ct,Ze))return Ze;if(this.tryUnify(Ze,ct))return ct;this.unify(ct,Ze,it);break;case 23:let pt=s.e,yt=s.cases,Kt=s.defaultExpr,_t=null,zs=this.typeExpr(pt,pe.Value),os=0;for(;os<yt.length;){let ne=yt[os];++os;let ae=0,ke=ne.values;for(;ae<ke.length;){let St=ke[ae];++ae;let et=this.typeExpr(St,pe.WithType(zs));this.unify(et,zs,St)}let Ie=this.typeExpr(ne.expr,t),Bt=ne.expr;t!=pe.NoValue&&(_t==null?_t=Ie:i.tryUnify(Ie,_t)||(i.unify(_t,Ie,Bt),_t=Ie))}if(Kt!=null){let ne=this.typeExpr(Kt,t);t!=pe.NoValue&&(_t==null?_t=ne:i.tryUnify(ne,_t)||(i.unify(_t,ne,Kt),_t=ne))}return t==pe.NoValue?j.TVoid:_t??this.makeMono();case 24:let bs=s.cond,en=s.e;return this.typeExprWith(bs,j.TBool),this.typeExpr(en,pe.NoValue),j.TVoid;case 25:let On=s.args,wn=s.name,kn=s.e;return wn==":untyped"&&this.allowUntypedMeta?this.makeMono():this.typeExpr(kn,t);case 26:let un=s.e,yn=s.t,tn=this.makeType(yn,e),bn=this.typeExpr(un,pe.WithType(tn));return this.unify(bn,tn,un),tn}let n=e.e,l=oe.ECustom("Don't know how to type "+Fe[n.__enum__].__constructs__[n._hx_index]._hx_name),r=new ce(l,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(r);return j.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,c=r.interfaces,p=r.isInterface,f=r.meta,_=r.params,d=r.statics,x=r.superClass;if(r.name=="Array"&&h.length==1)return h[0]}let s=this.getField(t,"iterator",e);if(s==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)}s!=null&&(s==null?s=null:s._hx_index==13&&s.args.length==0?s=s.ret:s=null);let n=this.makeMono(),l=this.makeIterator(n);return this.unify(s??t,l,e),n}static typeStr(e){switch(e._hx_index){case 0:let t=e.r;return t.r==null?"Unknown":We.typeStr(t.r);case 6:return e.name;case 7:return"?"+e.name;case 8:let n=e.t;return"Null<"+We.typeStr(n)+">";case 9:let l=e.c,r=e.args,h=l.name,a;if(r.length==0)a="";else{let H=[],P=0;for(;P<r.length;){let M=r[P];++P,H.push(We.typeStr(M))}a="<"+H.join(",")+">"}return h+a;case 10:let o=e.e,c=e.args,p=o.name,f;if(c.length==0)f="";else{let H=[],P=0;for(;P<c.length;){let M=c[P];++P,H.push(We.typeStr(M))}f="<"+H.join(",")+">"}return p+f;case 11:let _=e.t,d=e.args;if(_.name=="hscript.TypeCheck")return We.typeStr(d[1]);{let H=_.name,P;if(d.length==0)P="";else{let M=[],V=0;for(;V<d.length;){let R=d[V];++V,M.push(We.typeStr(R))}P="<"+M.join(",")+">"}return H+P}break;case 12:let x=e.a,y=e.args,b=x.name,v;if(y.length==0)v="";else{let H=[],P=0;for(;P<y.length;){let M=y[P];++P,H.push(We.typeStr(M))}v="<"+H.join(",")+">"}return b+v;case 13:let T=e.args,E=e.ret,F=[],L=0;for(;L<T.length;){let H=T[L];++L,F.push((H.opt?"?":"")+(H.name==""?"":H.name+":")+We.typeStr(H.t))}return"("+F.join(", ")+") -> "+We.typeStr(E);case 14:let A=e.fields,B=[],I=0;for(;I<A.length;){let H=A[I];++I,B.push((H.opt?"?":"")+H.name+":"+We.typeStr(H.t))}return"{"+B.join(", ")+"}";default:return u.substr(Fe[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 s=e.t;t(s);break;case 9:let n=e.c,l=e.args,r=0;for(;r<l.length;){let L=l[r];++r,t(L)}break;case 10:let h=e.e,a=e.args,o=0;for(;o<a.length;){let L=a[o];++o,t(L)}break;case 11:let c=e.t,p=e.args,f=0;for(;f<p.length;){let L=p[f];++f,t(L)}break;case 12:let _=e.a,d=e.args,x=0;for(;x<d.length;){let L=d[x];++x,t(L)}break;case 13:let y=e.args,b=e.ret,v=0;for(;v<y.length;){let L=y[v];++v,t(L.t)}t(b);break;case 14:let T=e.fields,E=0;for(;E<T.length;){let L=T[E];++E,t(L.t)}break;case 15:let F=e.f;t(F());break;default:}}}K["hscript.Checker"]=We,We.__name__="hscript.Checker",Object.assign(We.prototype,{__class__:We});var ai=Fe["hscript.Const"]={__ename__:"hscript.Const",__constructs__:null,CInt:(m=function(w){return{_hx_index:0,v:w,__enum__:"hscript.Const",toString:C}},m._hx_name="CInt",m.__params__=["v"],m),CFloat:(m=function(w){return{_hx_index:1,f:w,__enum__:"hscript.Const",toString:C}},m._hx_name="CFloat",m.__params__=["f"],m),CString:(m=function(w){return{_hx_index:2,s:w,__enum__:"hscript.Const",toString:C}},m._hx_name="CString",m.__params__=["s"],m)};ai.__constructs__=[ai.CInt,ai.CFloat,ai.CString];var D=Fe["hscript.ExprDef"]={__ename__:"hscript.ExprDef",__constructs__:null,EConst:(m=function(w){return{_hx_index:0,c:w,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EConst",m.__params__=["c"],m),EIdent:(m=function(w){return{_hx_index:1,v:w,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EIdent",m.__params__=["v"],m),EVar:(m=function(w,e,t){return{_hx_index:2,n:w,t:e,e:t,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EVar",m.__params__=["n","t","e"],m),EParent:(m=function(w){return{_hx_index:3,e:w,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EParent",m.__params__=["e"],m),EBlock:(m=function(w){return{_hx_index:4,e:w,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EBlock",m.__params__=["e"],m),EField:(m=function(w,e){return{_hx_index:5,e:w,f:e,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EField",m.__params__=["e","f"],m),EBinop:(m=function(w,e,t){return{_hx_index:6,op:w,e1:e,e2:t,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EBinop",m.__params__=["op","e1","e2"],m),EUnop:(m=function(w,e,t){return{_hx_index:7,op:w,prefix:e,e:t,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EUnop",m.__params__=["op","prefix","e"],m),ECall:(m=function(w,e){return{_hx_index:8,e:w,params:e,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="ECall",m.__params__=["e","params"],m),EIf:(m=function(w,e,t){return{_hx_index:9,cond:w,e1:e,e2:t,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EIf",m.__params__=["cond","e1","e2"],m),EWhile:(m=function(w,e){return{_hx_index:10,cond:w,e,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EWhile",m.__params__=["cond","e"],m),EFor:(m=function(w,e,t){return{_hx_index:11,v:w,it:e,e:t,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EFor",m.__params__=["v","it","e"],m),EBreak:{_hx_name:"EBreak",_hx_index:12,__enum__:"hscript.ExprDef",toString:C},EContinue:{_hx_name:"EContinue",_hx_index:13,__enum__:"hscript.ExprDef",toString:C},EFunction:(m=function(w,e,t,i){return{_hx_index:14,args:w,e,name:t,ret:i,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EFunction",m.__params__=["args","e","name","ret"],m),EReturn:(m=function(w){return{_hx_index:15,e:w,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EReturn",m.__params__=["e"],m),EArray:(m=function(w,e){return{_hx_index:16,e:w,index:e,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EArray",m.__params__=["e","index"],m),EArrayDecl:(m=function(w){return{_hx_index:17,e:w,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EArrayDecl",m.__params__=["e"],m),ENew:(m=function(w,e){return{_hx_index:18,cl:w,params:e,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="ENew",m.__params__=["cl","params"],m),EThrow:(m=function(w){return{_hx_index:19,e:w,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EThrow",m.__params__=["e"],m),ETry:(m=function(w,e,t,i){return{_hx_index:20,e:w,v:e,t,ecatch:i,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="ETry",m.__params__=["e","v","t","ecatch"],m),EObject:(m=function(w){return{_hx_index:21,fl:w,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EObject",m.__params__=["fl"],m),ETernary:(m=function(w,e,t){return{_hx_index:22,cond:w,e1:e,e2:t,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="ETernary",m.__params__=["cond","e1","e2"],m),ESwitch:(m=function(w,e,t){return{_hx_index:23,e:w,cases:e,defaultExpr:t,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="ESwitch",m.__params__=["e","cases","defaultExpr"],m),EDoWhile:(m=function(w,e){return{_hx_index:24,cond:w,e,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EDoWhile",m.__params__=["cond","e"],m),EMeta:(m=function(w,e,t){return{_hx_index:25,name:w,args:e,e:t,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EMeta",m.__params__=["name","args","e"],m),ECheckType:(m=function(w,e){return{_hx_index:26,e:w,t:e,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="ECheckType",m.__params__=["e","t"],m)};D.__constructs__=[D.EConst,D.EIdent,D.EVar,D.EParent,D.EBlock,D.EField,D.EBinop,D.EUnop,D.ECall,D.EIf,D.EWhile,D.EFor,D.EBreak,D.EContinue,D.EFunction,D.EReturn,D.EArray,D.EArrayDecl,D.ENew,D.EThrow,D.ETry,D.EObject,D.ETernary,D.ESwitch,D.EDoWhile,D.EMeta,D.ECheckType];var Ht=Fe["hscript.CType"]={__ename__:"hscript.CType",__constructs__:null,CTPath:(m=function(w,e){return{_hx_index:0,path:w,params:e,__enum__:"hscript.CType",toString:C}},m._hx_name="CTPath",m.__params__=["path","params"],m),CTFun:(m=function(w,e){return{_hx_index:1,args:w,ret:e,__enum__:"hscript.CType",toString:C}},m._hx_name="CTFun",m.__params__=["args","ret"],m),CTAnon:(m=function(w){return{_hx_index:2,fields:w,__enum__:"hscript.CType",toString:C}},m._hx_name="CTAnon",m.__params__=["fields"],m),CTParent:(m=function(w){return{_hx_index:3,t:w,__enum__:"hscript.CType",toString:C}},m._hx_name="CTParent",m.__params__=["t"],m),CTOpt:(m=function(w){return{_hx_index:4,t:w,__enum__:"hscript.CType",toString:C}},m._hx_name="CTOpt",m.__params__=["t"],m),CTNamed:(m=function(w,e){return{_hx_index:5,n:w,t:e,__enum__:"hscript.CType",toString:C}},m._hx_name="CTNamed",m.__params__=["n","t"],m)};Ht.__constructs__=[Ht.CTPath,Ht.CTFun,Ht.CTAnon,Ht.CTParent,Ht.CTOpt,Ht.CTNamed];class ce{constructor(e,t,i,s,n){this.e=e,this.pmin=t,this.pmax=i,this.origin=s,this.line=n}toString(){return ns.errorToString(this)}}K["hscript.Error"]=ce,ce.__name__="hscript.Error",Object.assign(ce.prototype,{__class__:ce});var oe=Fe["hscript.ErrorDef"]={__ename__:"hscript.ErrorDef",__constructs__:null,EInvalidChar:(m=function(w){return{_hx_index:0,c:w,__enum__:"hscript.ErrorDef",toString:C}},m._hx_name="EInvalidChar",m.__params__=["c"],m),EUnexpected:(m=function(w){return{_hx_index:1,s:w,__enum__:"hscript.ErrorDef",toString:C}},m._hx_name="EUnexpected",m.__params__=["s"],m),EUnterminatedString:{_hx_name:"EUnterminatedString",_hx_index:2,__enum__:"hscript.ErrorDef",toString:C},EUnterminatedComment:{_hx_name:"EUnterminatedComment",_hx_index:3,__enum__:"hscript.ErrorDef",toString:C},EInvalidPreprocessor:(m=function(w){return{_hx_index:4,msg:w,__enum__:"hscript.ErrorDef",toString:C}},m._hx_name="EInvalidPreprocessor",m.__params__=["msg"],m),EUnknownVariable:(m=function(w){return{_hx_index:5,v:w,__enum__:"hscript.ErrorDef",toString:C}},m._hx_name="EUnknownVariable",m.__params__=["v"],m),EInvalidIterator:(m=function(w){return{_hx_index:6,v:w,__enum__:"hscript.ErrorDef",toString:C}},m._hx_name="EInvalidIterator",m.__params__=["v"],m),EInvalidOp:(m=function(w){return{_hx_index:7,op:w,__enum__:"hscript.ErrorDef",toString:C}},m._hx_name="EInvalidOp",m.__params__=["op"],m),EInvalidAccess:(m=function(w){return{_hx_index:8,f:w,__enum__:"hscript.ErrorDef",toString:C}},m._hx_name="EInvalidAccess",m.__params__=["f"],m),ECustom:(m=function(w){return{_hx_index:9,msg:w,__enum__:"hscript.ErrorDef",toString:C}},m._hx_name="ECustom",m.__params__=["msg"],m)};oe.__constructs__=[oe.EInvalidChar,oe.EUnexpected,oe.EUnterminatedString,oe.EUnterminatedComment,oe.EInvalidPreprocessor,oe.EUnknownVariable,oe.EInvalidIterator,oe.EInvalidOp,oe.EInvalidAccess,oe.ECustom];var Ui=Fe["hscript.ModuleDecl"]={__ename__:"hscript.ModuleDecl",__constructs__:null,DPackage:(m=function(w){return{_hx_index:0,path:w,__enum__:"hscript.ModuleDecl",toString:C}},m._hx_name="DPackage",m.__params__=["path"],m),DImport:(m=function(w,e){return{_hx_index:1,path:w,everything:e,__enum__:"hscript.ModuleDecl",toString:C}},m._hx_name="DImport",m.__params__=["path","everything"],m),DClass:(m=function(w){return{_hx_index:2,c:w,__enum__:"hscript.ModuleDecl",toString:C}},m._hx_name="DClass",m.__params__=["c"],m),DTypedef:(m=function(w){return{_hx_index:3,c:w,__enum__:"hscript.ModuleDecl",toString:C}},m._hx_name="DTypedef",m.__params__=["c"],m)};Ui.__constructs__=[Ui.DPackage,Ui.DImport,Ui.DClass,Ui.DTypedef];var Ti=Fe["hscript.FieldAccess"]={__ename__:"hscript.FieldAccess",__constructs__:null,APublic:{_hx_name:"APublic",_hx_index:0,__enum__:"hscript.FieldAccess",toString:C},APrivate:{_hx_name:"APrivate",_hx_index:1,__enum__:"hscript.FieldAccess",toString:C},AInline:{_hx_name:"AInline",_hx_index:2,__enum__:"hscript.FieldAccess",toString:C},AOverride:{_hx_name:"AOverride",_hx_index:3,__enum__:"hscript.FieldAccess",toString:C},AStatic:{_hx_name:"AStatic",_hx_index:4,__enum__:"hscript.FieldAccess",toString:C},AMacro:{_hx_name:"AMacro",_hx_index:5,__enum__:"hscript.FieldAccess",toString:C}};Ti.__constructs__=[Ti.APublic,Ti.APrivate,Ti.AInline,Ti.AOverride,Ti.AStatic,Ti.AMacro];var Ps=Fe["hscript.FieldKind"]={__ename__:"hscript.FieldKind",__constructs__:null,KFunction:(m=function(w){return{_hx_index:0,f:w,__enum__:"hscript.FieldKind",toString:C}},m._hx_name="KFunction",m.__params__=["f"],m),KVar:(m=function(w){return{_hx_index:1,v:w,__enum__:"hscript.FieldKind",toString:C}},m._hx_name="KVar",m.__params__=["v"],m)};Ps.__constructs__=[Ps.KFunction,Ps.KVar];var U=Fe["hscript.Token"]={__ename__:"hscript.Token",__constructs__:null,TEof:{_hx_name:"TEof",_hx_index:0,__enum__:"hscript.Token",toString:C},TConst:(m=function(w){return{_hx_index:1,c:w,__enum__:"hscript.Token",toString:C}},m._hx_name="TConst",m.__params__=["c"],m),TId:(m=function(w){return{_hx_index:2,s:w,__enum__:"hscript.Token",toString:C}},m._hx_name="TId",m.__params__=["s"],m),TOp:(m=function(w){return{_hx_index:3,s:w,__enum__:"hscript.Token",toString:C}},m._hx_name="TOp",m.__params__=["s"],m),TPOpen:{_hx_name:"TPOpen",_hx_index:4,__enum__:"hscript.Token",toString:C},TPClose:{_hx_name:"TPClose",_hx_index:5,__enum__:"hscript.Token",toString:C},TBrOpen:{_hx_name:"TBrOpen",_hx_index:6,__enum__:"hscript.Token",toString:C},TBrClose:{_hx_name:"TBrClose",_hx_index:7,__enum__:"hscript.Token",toString:C},TDot:{_hx_name:"TDot",_hx_index:8,__enum__:"hscript.Token",toString:C},TQuestionDot:{_hx_name:"TQuestionDot",_hx_index:9,__enum__:"hscript.Token",toString:C},TComma:{_hx_name:"TComma",_hx_index:10,__enum__:"hscript.Token",toString:C},TSemicolon:{_hx_name:"TSemicolon",_hx_index:11,__enum__:"hscript.Token",toString:C},TBkOpen:{_hx_name:"TBkOpen",_hx_index:12,__enum__:"hscript.Token",toString:C},TBkClose:{_hx_name:"TBkClose",_hx_index:13,__enum__:"hscript.Token",toString:C},TQuestion:{_hx_name:"TQuestion",_hx_index:14,__enum__:"hscript.Token",toString:C},TDoubleDot:{_hx_name:"TDoubleDot",_hx_index:15,__enum__:"hscript.Token",toString:C},TMeta:(m=function(w){return{_hx_index:16,s:w,__enum__:"hscript.Token",toString:C}},m._hx_name="TMeta",m.__params__=["s"],m),TPrepro:(m=function(w){return{_hx_index:17,s:w,__enum__:"hscript.Token",toString:C}},m._hx_name="TPrepro",m.__params__=["s"],m)};U.__constructs__=[U.TEof,U.TConst,U.TId,U.TOp,U.TPOpen,U.TPClose,U.TBrOpen,U.TBrClose,U.TDot,U.TQuestionDot,U.TComma,U.TSemicolon,U.TBkOpen,U.TBkClose,U.TQuestion,U.TDoubleDot,U.TMeta,U.TPrepro];class Yi{constructor(){this.uid=0,this.preprocesorValues=new me,this.line=1,this.opChars="+*/-=!><&|^%~",this.identChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";let e=[["%"],["*","/"],["+","-"],["<<",">>",">>>"],["|","&","^"],["==","!=",">","<",">=","<="],["..."],["&&"],["||"],["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","&=","^=","=>"],["->"]];this.opPriority=new me,this.opRightAssoc=new me;let t=0,i=e.length;for(;t<i;){let h=t++,a=0,o=e[h];for(;a<o.length;){let c=o[a];++a,this.opPriority.h[c]=h,h==9&&(this.opRightAssoc.h[c]=!0)}}let s="!";this.opPriority.h[s]=s=="++"||s=="--"?-1:-2;let n="++";this.opPriority.h[n]=n=="++"||n=="--"?-1:-2;let l="--";this.opPriority.h[l]=l=="++"||l=="--"?-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 k.thrown(new ce(e,t,i,this.origin,this.line))}invalidChar(e){if(!this.resumeErrors)throw k.thrown(new ce(oe.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 Ss,this.offset=t,this.char=-1,this.ops=[],this.idents=[],this.uid=0;let i=0,s=this.opChars.length;for(;i<s;){let r=i++;this.ops[u.cca(this.opChars,r)]=!0}let n=0,l=this.identChars.length;for(;n<l;){let r=n++;this.idents[u.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 s=[];for(;;){let n=this.token();if(n==U.TEof)break;this.tokens.push({t:n,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.parseFullExpr(s)}if(s.length==1)return s[0];{let n=D.EBlock(s),l=0,r=null;return n==null?null:(l==null&&(l=this.tokenMin),r==null&&(r=this.tokenMax),{e:n,pmin:l,pmax:r,origin:this.origin,line:this.line})}}unexpected(e){let t=oe.EUnexpected(this.tokenString(e));if(!this.resumeErrors)throw k.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();re.enumEq(t,e)||this.unexpected(t)}maybe(e){let t=this.token();return re.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,s=t.t,n=t.e;if(n!=null)return this.isBlock(n);if(s!=null){if(s==null)return!1;if(s._hx_index==2){let ve=s.fields;return!0}else return!1}else return!1;break;case 4:let l=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,c=t.prefix,p=t.e;return c?!1:this.isBlock(p);case 9:let f=t.cond,_=t.e1,d=t.e2;return d!=null?this.isBlock(d):this.isBlock(_);case 10:let x=t.cond,y=t.e;return this.isBlock(y);case 11:let b=t.v,v=t.it,T=t.e;return this.isBlock(T);case 14:let E=t.args,F=t.name,L=t.ret,A=t.e;return this.isBlock(A);case 15:let B=t.e;return B!=null?this.isBlock(B):!1;case 20:let I=t.e,H=t.v,P=t.t,M=t.ecatch;return this.isBlock(M);case 21:let V=t.fl;return!0;case 23:let R=t.e,Y=t.cases,$=t.defaultExpr;return!0;case 24:let te=t.cond,O=t.e;return this.isBlock(O);case 25:let q=t.name,S=t.args,W=t.e;return this.isBlock(W);default:return!1}}parseFullExpr(e){let t=this.parseExpr();e.push(t);let i=this.token();for(;;){let s;if(i==U.TComma&&t!=null){let n=t.e;if(n._hx_index==2){let l=n.n,r=n.t,h=n.e;s=!0}else s=!1}else s=!1;if(!s)break;t=this.parseStructure("var"),e.push(t),i=this.token()}i!=U.TSemicolon&&i!=U.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!=U.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=D.EObject(t),s=e,n=null,l;return i==null?l=null:(s==null&&(s=this.tokenMin),n==null&&(n=this.tokenMax),l={e:i,pmin:s,pmax:n,origin:this.origin,line:this.line}),this.parseExprNext(l)}parseExpr(){let e=this.token(),t=this.tokenMin;switch(e._hx_index){case 1:let i=e.c,s=D.EConst(i),n=null,l=null,r;return s==null?r=null:(n==null&&(n=this.tokenMin),l==null&&(l=this.tokenMax),r={e:s,pmin:n,pmax:l,origin:this.origin,line:this.line}),this.parseExprNext(r);case 2:let h=e.s,a=this.parseStructure(h);if(a==null){let L=D.EIdent(h),A=null,B=null;L==null?a=null:(A==null&&(A=this.tokenMin),B==null&&(B=this.tokenMax),a={e:L,pmin:A,pmax:B,origin:this.origin,line:this.line})}return this.parseExprNext(a);case 3:let o=e.s;if(o=="-"){let L=this.tokenMin,A=this.parseExpr();if(A==null)return this.makeUnop(o,A);let B=A.e;if(B._hx_index==0){let I=B.c;switch(I._hx_index){case 0:let H=I.v,P=D.EConst(ai.CInt(-H)),M=L,V=A==null?0:A.pmax;return P==null?null:(M==null&&(M=this.tokenMin),V==null&&(V=this.tokenMax),{e:P,pmin:M,pmax:V,origin:this.origin,line:this.line});case 1:let R=I.f,Y=D.EConst(ai.CFloat(-R)),$=L,te=A==null?0:A.pmax;return Y==null?null:($==null&&($=this.tokenMin),te==null&&(te=this.tokenMax),{e:Y,pmin:$,pmax:te,origin:this.origin,line:this.line});default:return this.makeUnop(o,A)}}else return this.makeUnop(o,A)}return this.opPriority.h[o]<0?this.makeUnop(o,this.parseExpr()):this.unexpected(e);case 4:if(e=this.token(),e==U.TPClose){let L=this.token();re.enumEq(L,U.TOp("->"))||this.unexpected(L);let A=this.parseExpr(),B=D.EReturn(A),I=t,H=null,P;B==null?P=null:(I==null&&(I=this.tokenMin),H==null&&(H=this.tokenMax),P={e:B,pmin:I,pmax:H,origin:this.origin,line:this.line});let M=D.EFunction([],P),V=t,R=null;return M==null?null:(V==null&&(V=this.tokenMin),R==null&&(R=this.tokenMax),{e:M,pmin:V,pmax:R,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 c=this.parseExpr();switch(e=this.token(),e._hx_index){case 5:let L=D.EParent(c),A=t,B=this.tokenMax,I;return L==null?I=null:(A==null&&(A=this.tokenMin),B==null&&(B=this.tokenMax),I={e:L,pmin:A,pmax:B,origin:this.origin,line:this.line}),this.parseExprNext(I);case 10:let H=c.e;if(H._hx_index==1){let M=H.v;return this.parseLambda([{name:M}],c==null?0:c.pmin)}break;case 15:let P=this.parseType();switch(e=this.token(),e._hx_index){case 5:let M=D.ECheckType(c,P),V=t,R=this.tokenMax,Y;return M==null?Y=null:(V==null&&(V=this.tokenMin),R==null&&(R=this.tokenMax),Y={e:M,pmin:V,pmax:R,origin:this.origin,line:this.line}),this.parseExprNext(Y);case 10:let $=c.e;if($._hx_index==1){let te=$.v;return this.parseLambda([{name:te,t:P}],c==null?0:c.pmin)}break;default:}break;default:}return this.unexpected(e);case 6:switch(e=this.token(),e._hx_index){case 1:let L=e.c;if(this.allowJSON)if(L._hx_index==2){let V=L.s,R=this.token();if(this.tokens.push({t:R,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,R._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 A=e.s,B=this.token();if(this.tokens.push({t:B,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,B._hx_index==15)return this.parseExprNext(this.parseObject(t));break;case 7:let I=D.EObject([]),H=t,P=null,M;return I==null?M=null:(H==null&&(H=this.tokenMin),P==null&&(P=this.tokenMax),M={e:I,pmin:H,pmax:P,origin:this.origin,line:this.line}),this.parseExprNext(M);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==U.TBrClose||this.resumeErrors&&e==U.TEof);)this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let f=D.EBlock(p),_=t,d=null;return f==null?null:(_==null&&(_=this.tokenMin),d==null&&(d=this.tokenMax),{e:f,pmin:_,pmax:d,origin:this.origin,line:this.line});case 12:let x=[];e=this.token();let y=!0;for(;e!=U.TBkClose&&(!this.resumeErrors||e!=U.TEof);)y||(e!=U.TComma?this.unexpected(e):e=this.token()),y=!1,this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,x.push(this.parseExpr()),e=this.token();if(x.length==1&&x[0]!=null){let L=x[0].e;switch(L._hx_index){case 10:let A=L.cond,B=L.e,I="__a_"+this.uid++,H=D.EArrayDecl([]),P=t,M=null,V;H==null?V=null:(P==null&&(P=this.tokenMin),M==null&&(M=this.tokenMax),V={e:H,pmin:P,pmax:M,origin:this.origin,line:this.line});let R=D.EVar(I,null,V),Y=t,$=null,te;R==null?te=null:(Y==null&&(Y=this.tokenMin),$==null&&($=this.tokenMax),te={e:R,pmin:Y,pmax:$,origin:this.origin,line:this.line});let O=this.mapCompr(I,x[0]),q=D.EIdent(I),S=t,W=null,ve;q==null?ve=null:(S==null&&(S=this.tokenMin),W==null&&(W=this.tokenMax),ve={e:q,pmin:S,pmax:W,origin:this.origin,line:this.line});let de=D.EBlock([te,O,ve]),Ce=t,Se=null,Ee;return de==null?Ee=null:(Ce==null&&(Ce=this.tokenMin),Se==null&&(Se=this.tokenMax),Ee={e:de,pmin:Ce,pmax:Se,origin:this.origin,line:this.line}),this.parseExprNext(Ee);case 11:let J=L.v,se=L.it,N=L.e,X="__a_"+this.uid++,rt=D.EArrayDecl([]),Ve=t,Ye=null,Ue;rt==null?Ue=null:(Ve==null&&(Ve=this.tokenMin),Ye==null&&(Ye=this.tokenMax),Ue={e:rt,pmin:Ve,pmax:Ye,origin:this.origin,line:this.line});let He=D.EVar(X,null,Ue),Je=t,$e=null,Be;He==null?Be=null:(Je==null&&(Je=this.tokenMin),$e==null&&($e=this.tokenMax),Be={e:He,pmin:Je,pmax:$e,origin:this.origin,line:this.line});let Ne=this.mapCompr(X,x[0]),mt=D.EIdent(X),gt=t,Nt=null,ut;mt==null?ut=null:(gt==null&&(gt=this.tokenMin),Nt==null&&(Nt=this.tokenMax),ut={e:mt,pmin:gt,pmax:Nt,origin:this.origin,line:this.line});let Xe=D.EBlock([Be,Ne,ut]),kt=t,Ct=null,ye;return Xe==null?ye=null:(kt==null&&(kt=this.tokenMin),Ct==null&&(Ct=this.tokenMax),ye={e:Xe,pmin:kt,pmax:Ct,origin:this.origin,line:this.line}),this.parseExprNext(ye);case 24:let ht=L.cond,fe=L.e,xe="__a_"+this.uid++,tt=D.EArrayDecl([]),Ke=t,dt=null,Ut;tt==null?Ut=null:(Ke==null&&(Ke=this.tokenMin),dt==null&&(dt=this.tokenMax),Ut={e:tt,pmin:Ke,pmax:dt,origin:this.origin,line:this.line});let at=D.EVar(xe,null,Ut),ei=t,Ae=null,Mt;at==null?Mt=null:(ei==null&&(ei=this.tokenMin),Ae==null&&(Ae=this.tokenMax),Mt={e:at,pmin:ei,pmax:Ae,origin:this.origin,line:this.line});let Et=this.mapCompr(xe,x[0]),Lt=D.EIdent(xe),ot=t,Dt=null,qt;Lt==null?qt=null:(ot==null&&(ot=this.tokenMin),Dt==null&&(Dt=this.tokenMax),qt={e:Lt,pmin:ot,pmax:Dt,origin:this.origin,line:this.line});let jt=D.EBlock([Mt,Et,qt]),ti=t,ii=null,Wt;return jt==null?Wt=null:(ti==null&&(ti=this.tokenMin),ii==null&&(ii=this.tokenMax),Wt={e:jt,pmin:ti,pmax:ii,origin:this.origin,line:this.line}),this.parseExprNext(Wt);default:}}let b=D.EArrayDecl(x),v=t,T=null,E;return b==null?E=null:(v==null&&(v=this.tokenMin),T==null&&(T=this.tokenMax),E={e:b,pmin:v,pmax:T,origin:this.origin,line:this.line}),this.parseExprNext(E);case 16:let F=e.s;if(this.allowMetadata){let L=this.parseMetaArgs(),A=D.EMeta(F,L,this.parseExpr()),B=t,I=null;return A==null?null:(B==null&&(B=this.tokenMin),I==null&&(I=this.tokenMax),{e:A,pmin:B,pmax:I,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(),f=this.maybe(U.TDoubleDot)?this.parseType():null;e.push({name:p,t:f});let _=this.token();switch(_._hx_index){case 5:break e;case 10:break;default:this.unexpected(_);break e}}let i=this.token();re.enumEq(i,U.TOp("->"))||this.unexpected(i);let s=this.parseExpr(),n=D.EReturn(s),l=t,r=null,h;n==null?h=null:(l==null&&(l=this.tokenMin),r==null&&(r=this.tokenMax),h={e:n,pmin:l,pmax:r,origin:this.origin,line:this.line});let a=D.EFunction(e,h),o=t,c=null;return a==null?null:(o==null&&(o=this.tokenMin),c==null&&(c=this.tokenMax),{e:a,pmin:o,pmax:c,origin:this.origin,line:this.line})}parseMetaArgs(){let e=this.token();if(e!=U.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!=U.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 s=i;this.unexpected(s)}}}return t}mapCompr(e,t){if(t==null)return null;let i,s=t.e;switch(s._hx_index){case 3:let r=s.e;i=D.EParent(this.mapCompr(e,r));break;case 4:let h=s.e;if(h.length==1){let H=h[0];i=D.EBlock([this.mapCompr(e,H)])}else{let H=D.EIdent(e),P=t==null?0:t.pmin,M=t==null?0:t.pmax,V;H==null?V=null:(P==null&&(P=this.tokenMin),M==null&&(M=this.tokenMax),V={e:H,pmin:P,pmax:M,origin:this.origin,line:this.line});let R=D.EField(V,"push"),Y=t==null?0:t.pmin,$=t==null?0:t.pmax,te;R==null?te=null:(Y==null&&(Y=this.tokenMin),$==null&&($=this.tokenMax),te={e:R,pmin:Y,pmax:$,origin:this.origin,line:this.line}),i=D.ECall(te,[t])}break;case 9:let a=s.cond,o=s.e1;if(s.e2==null)i=D.EIf(a,this.mapCompr(e,o),null);else{let H=D.EIdent(e),P=t==null?0:t.pmin,M=t==null?0:t.pmax,V;H==null?V=null:(P==null&&(P=this.tokenMin),M==null&&(M=this.tokenMax),V={e:H,pmin:P,pmax:M,origin:this.origin,line:this.line});let R=D.EField(V,"push"),Y=t==null?0:t.pmin,$=t==null?0:t.pmax,te;R==null?te=null:(Y==null&&(Y=this.tokenMin),$==null&&($=this.tokenMax),te={e:R,pmin:Y,pmax:$,origin:this.origin,line:this.line}),i=D.ECall(te,[t])}break;case 10:let p=s.cond,f=s.e;i=D.EWhile(p,this.mapCompr(e,f));break;case 11:let _=s.v,d=s.it,x=s.e;i=D.EFor(_,d,this.mapCompr(e,x));break;case 24:let y=s.cond,b=s.e;i=D.EDoWhile(y,this.mapCompr(e,b));break;default:let v=D.EIdent(e),T=t==null?0:t.pmin,E=t==null?0:t.pmax,F;v==null?F=null:(T==null&&(T=this.tokenMin),E==null&&(E=this.tokenMax),F={e:v,pmin:T,pmax:E,origin:this.origin,line:this.line});let L=D.EField(F,"push"),A=t==null?0:t.pmin,B=t==null?0:t.pmax,I;L==null?I=null:(A==null&&(A=this.tokenMin),B==null&&(B=this.tokenMax),I={e:L,pmin:A,pmax:B,origin:this.origin,line:this.line}),i=D.ECall(I,[t])}let n=t==null?0:t.pmin,l=t==null?0:t.pmax;return i==null?null:(n==null&&(n=this.tokenMin),l==null&&(l=this.tokenMax),{e:i,pmin:n,pmax:l,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 s=i.op,n=i.e1,l=i.e2,r=D.EBinop(s,this.makeUnop(e,n),l),h=n==null?0:n.pmin,a=l==null?0:l.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,c=i.e1,p=i.e2,f=D.ETernary(this.makeUnop(e,o),c,p),_=o==null?0:o.pmin,d=p==null?0:p.pmax;return f==null?null:(_==null&&(_=this.tokenMin),d==null&&(d=this.tokenMax),{e:f,pmin:_,pmax:d,origin:this.origin,line:this.line});default:let x=D.EUnop(e,!0,t),y=t==null?0:t.pmin,b=t==null?0:t.pmax;return x==null?null:(y==null&&(y=this.tokenMin),b==null&&(b=this.tokenMax),{e:x,pmin:y,pmax:b,origin:this.origin,line:this.line})}}makeBinop(e,t,i){if(i==null&&this.resumeErrors){let n=D.EBinop(e,t,i),l=t==null?0:t.pmin,r=t==null?0:t.pmax;return n==null?null:(l==null&&(l=this.tokenMin),r==null&&(r=this.tokenMax),{e:n,pmin:l,pmax:r,origin:this.origin,line:this.line})}let s=i.e;switch(s._hx_index){case 6:let n=s.op,l=s.e1,r=s.e2;if(this.opPriority.h[e]<=this.opPriority.h[n]&&!Object.prototype.hasOwnProperty.call(this.opRightAssoc.h,e)){let _=D.EBinop(n,this.makeBinop(e,t,l),r),d=t==null?0:t.pmin,x=r==null?0:r.pmax;return _==null?null:(d==null&&(d=this.tokenMin),x==null&&(x=this.tokenMax),{e:_,pmin:d,pmax:x,origin:this.origin,line:this.line})}else{let _=D.EBinop(e,t,i),d=t==null?0:t.pmin,x=i==null?0:i.pmax;return _==null?null:(d==null&&(d=this.tokenMin),x==null&&(x=this.tokenMax),{e:_,pmin:d,pmax:x,origin:this.origin,line:this.line})}break;case 22:let h=s.cond,a=s.e1,o=s.e2;if(Object.prototype.hasOwnProperty.call(this.opRightAssoc.h,e)){let _=D.EBinop(e,t,i),d=t==null?0:t.pmin,x=i==null?0:i.pmax;return _==null?null:(d==null&&(d=this.tokenMin),x==null&&(x=this.tokenMax),{e:_,pmin:d,pmax:x,origin:this.origin,line:this.line})}else{let _=D.ETernary(this.makeBinop(e,t,h),a,o),d=t==null?0:t.pmin,x=i==null?0:i.pmax;return _==null?null:(d==null&&(d=this.tokenMin),x==null&&(x=this.tokenMax),{e:_,pmin:d,pmax:x,origin:this.origin,line:this.line})}break;default:let c=D.EBinop(e,t,i),p=t==null?0:t.pmin,f=i==null?0:i.pmax;return c==null?null:(p==null&&(p=this.tokenMin),f==null&&(f=this.tokenMax),{e:c,pmin:p,pmax:f,origin:this.origin,line:this.line})}}parseStructure(e){let t=this.tokenMin;switch(e){case"break":let i=D.EBreak,s=null,n=null;return i==null?null:(s==null&&(s=this.tokenMin),n==null&&(n=this.tokenMax),{e:i,pmin:s,pmax:n,origin:this.origin,line:this.line});case"continue":let l=D.EContinue,r=null,h=null;return l==null?null:(r==null&&(r=this.tokenMin),h==null&&(h=this.tokenMax),{e:l,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 c=this.parseExpr(),p=D.EDoWhile(c,a),f=t,_=c==null?0:c.pmax;return p==null?null:(f==null&&(f=this.tokenMin),_==null&&(_=this.tokenMax),{e:p,pmin:f,pmax:_,origin:this.origin,line:this.line});case"else":return this.unexpected(U.TId(e));case"for":let d=this.token();d!=U.TPOpen&&this.unexpected(d);let x=this.getIdent(),y=this.token();re.enumEq(y,U.TId("in"))||this.unexpected(y);let b=this.parseExpr(),v=this.token();v!=U.TPClose&&this.unexpected(v);let T=this.parseExpr(),E=D.EFor(x,b,T),F=t,L=T==null?0:T.pmax;return E==null?null:(F==null&&(F=this.tokenMin),L==null&&(L=this.tokenMax),{e:E,pmin:F,pmax:L,origin:this.origin,line:this.line});case"function":let A=this.token(),B=null;A._hx_index==2?B=A.s:(this.tokens.push({t:A,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax);let I=this.parseFunctionDecl(),H=D.EFunction(I.args,I.body,B,I.ret),P=t,M=I.body,V=M==null?0:M.pmax;return H==null?null:(P==null&&(P=this.tokenMin),V==null&&(V=this.tokenMax),{e:H,pmin:P,pmax:V,origin:this.origin,line:this.line});case"if":let R=this.token();R!=U.TPOpen&&this.unexpected(R);let Y=this.parseExpr(),$=this.token();$!=U.TPClose&&this.unexpected($);let te=this.parseExpr(),O=null,q=!1,S=this.token();S==U.TSemicolon&&(q=!0,S=this.token()),re.enumEq(S,U.TId("else"))?O=this.parseExpr():(this.tokens.push({t:S,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,q&&(this.tokens.push({t:U.TSemicolon,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax));let W=D.EIf(Y,te,O),ve=t,de=O==null?this.tokenMax:O==null?0:O.pmax;return W==null?null:(ve==null&&(ve=this.tokenMin),de==null&&(de=this.tokenMax),{e:W,pmin:ve,pmax:de,origin:this.origin,line:this.line});case"inline":return this.maybe(U.TId("function"))||this.unexpected(U.TId("inline")),this.parseStructure("function");case"new":let Ce=[];Ce.push(this.getIdent());e:for(;;){let ze=this.token();switch(ze._hx_index){case 4:break e;case 8:Ce.push(this.getIdent());break;default:this.unexpected(ze);break e}}let Se=this.parseExprList(U.TPClose),Ee=D.ENew(Ce.join("."),Se),J=t,se=null;return Ee==null?null:(J==null&&(J=this.tokenMin),se==null&&(se=this.tokenMax),{e:Ee,pmin:J,pmax:se,origin:this.origin,line:this.line});case"return":let N=this.token();this.tokens.push({t:N,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let X=N==U.TSemicolon?null:this.parseExpr(),rt=D.EReturn(X),Ve=t,Ye=X==null?this.tokenMax:X==null?0:X.pmax;return rt==null?null:(Ve==null&&(Ve=this.tokenMin),Ye==null&&(Ye=this.tokenMax),{e:rt,pmin:Ve,pmax:Ye,origin:this.origin,line:this.line});case"switch":let Ue=this.parseExpr(),He=null,Je=[],$e=this.token();$e!=U.TBrOpen&&this.unexpected($e);e:for(;;){let ze=this.token();switch(ze._hx_index){case 2:switch(ze.s){case"case":let xi={values:[],expr:null};Je.push(xi);t:for(;;){let ct=this.parseExpr();switch(xi.values.push(ct),ze=this.token(),ze._hx_index){case 10:break;case 15:break t;default:this.unexpected(ze);break t}}let ue=[];t:for(;;)switch(ze=this.token(),this.tokens.push({t:ze,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,ze._hx_index){case 0:if(this.resumeErrors)break t;this.parseFullExpr(ue);break;case 2:switch(ze.s){case"case":case"default":break t;default:this.parseFullExpr(ue)}break;case 7:break t;default:this.parseFullExpr(ue)}let Ge;if(ue.length==1)Ge=ue[0];else if(ue.length==0){let ct=D.EBlock([]),pt=this.tokenMin,yt=this.tokenMin;ct==null?Ge=null:(pt==null&&(pt=this.tokenMin),yt==null&&(yt=this.tokenMax),Ge={e:ct,pmin:pt,pmax:yt,origin:this.origin,line:this.line})}else{let ct=D.EBlock(ue),pt=ue[0],yt=pt==null?0:pt.pmin,Kt=ue[ue.length-1],_t=Kt==null?0:Kt.pmax;ct==null?Ge=null:(yt==null&&(yt=this.tokenMin),_t==null&&(_t=this.tokenMax),Ge={e:ct,pmin:yt,pmax:_t,origin:this.origin,line:this.line})}xi.expr=Ge;break;case"default":He!=null&&this.unexpected(ze);let it=this.token();it!=U.TDoubleDot&&this.unexpected(it);let Ze=[];t:for(;;)switch(ze=this.token(),this.tokens.push({t:ze,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,ze._hx_index){case 0:if(this.resumeErrors)break t;this.parseFullExpr(Ze);break;case 2:switch(ze.s){case"case":case"default":break t;default:this.parseFullExpr(Ze)}break;case 7:break t;default:this.parseFullExpr(Ze)}if(Ze.length==1)He=Ze[0];else if(Ze.length==0){let ct=D.EBlock([]),pt=this.tokenMin,yt=this.tokenMin;ct==null?He=null:(pt==null&&(pt=this.tokenMin),yt==null&&(yt=this.tokenMax),He={e:ct,pmin:pt,pmax:yt,origin:this.origin,line:this.line})}else{let ct=D.EBlock(Ze),pt=Ze[0],yt=pt==null?0:pt.pmin,Kt=Ze[Ze.length-1],_t=Kt==null?0:Kt.pmax;ct==null?He=null:(yt==null&&(yt=this.tokenMin),_t==null&&(_t=this.tokenMax),He={e:ct,pmin:yt,pmax:_t,origin:this.origin,line:this.line})}break;default:this.unexpected(ze);break e}break;case 7:break e;default:this.unexpected(ze);break e}}let Be=D.ESwitch(Ue,Je,He),Ne=t,mt=this.tokenMax;return Be==null?null:(Ne==null&&(Ne=this.tokenMin),mt==null&&(mt=this.tokenMax),{e:Be,pmin:Ne,pmax:mt,origin:this.origin,line:this.line});case"throw":let gt=this.parseExpr(),Nt=D.EThrow(gt),ut=t,Xe=gt==null?0:gt.pmax;return Nt==null?null:(ut==null&&(ut=this.tokenMin),Xe==null&&(Xe=this.tokenMax),{e:Nt,pmin:ut,pmax:Xe,origin:this.origin,line:this.line});case"try":let kt=this.parseExpr(),Ct=this.token();re.enumEq(Ct,U.TId("catch"))||this.unexpected(Ct);let ye=this.token();ye!=U.TPOpen&&this.unexpected(ye);let ht=this.getIdent(),fe=this.token();fe!=U.TDoubleDot&&this.unexpected(fe);let xe=null;if(this.allowTypes)xe=this.parseType();else{let ze=this.token();re.enumEq(ze,U.TId("Dynamic"))||this.unexpected(ze)}let tt=this.token();tt!=U.TPClose&&this.unexpected(tt);let Ke=this.parseExpr(),dt=D.ETry(kt,ht,xe,Ke),Ut=t,at=Ke==null?0:Ke.pmax;return dt==null?null:(Ut==null&&(Ut=this.tokenMin),at==null&&(at=this.tokenMax),{e:dt,pmin:Ut,pmax:at,origin:this.origin,line:this.line});case"var":let ei=this.getIdent(),Ae=this.token(),Mt=null;Ae==U.TDoubleDot&&this.allowTypes&&(Mt=this.parseType(),Ae=this.token());let Et=null;switch(Ae._hx_index){case 3:Ae.s=="="?Et=this.parseExpr():this.unexpected(Ae);break;case 10:case 11:this.tokens.push({t:Ae,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;default:Mt!=null?(this.tokens.push({t:Ae,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):this.unexpected(Ae)}let Lt=D.EVar(ei,Mt,Et),ot=t,Dt=Et==null?this.tokenMax:Et==null?0:Et.pmax;return Lt==null?null:(ot==null&&(ot=this.tokenMin),Dt==null&&(Dt=this.tokenMax),{e:Lt,pmin:ot,pmax:Dt,origin:this.origin,line:this.line});case"while":let qt=this.parseExpr(),jt=this.parseExpr(),ti=D.EWhile(qt,jt),ii=t,Wt=jt==null?0:jt.pmax;return ti==null?null:(ii==null&&(ii=this.tokenMin),Wt==null&&(Wt=this.tokenMax),{e:ti,pmin:ii,pmax:Wt,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 s=t.s;if(s=="->"){let ye=e.e;switch(ye._hx_index){case 1:let ht=ye.v,fe=this.parseExpr(),xe=D.EReturn(fe),tt=fe==null?0:fe.pmin,Ke=null,dt;xe==null?dt=null:(tt==null&&(tt=this.tokenMin),Ke==null&&(Ke=this.tokenMax),dt={e:xe,pmin:tt,pmax:Ke,origin:this.origin,line:this.line});let Ut=D.EFunction([{name:ht}],dt),at=e==null?0:e.pmin,ei=null;return Ut==null?null:(at==null&&(at=this.tokenMin),ei==null&&(ei=this.tokenMax),{e:Ut,pmin:at,pmax:ei,origin:this.origin,line:this.line});case 3:let Ae=ye.e.e;if(Ae._hx_index==1){let Et=Ae.v,Lt=this.parseExpr(),ot=D.EReturn(Lt),Dt=Lt==null?0:Lt.pmin,qt=null,jt;ot==null?jt=null:(Dt==null&&(Dt=this.tokenMin),qt==null&&(qt=this.tokenMax),jt={e:ot,pmin:Dt,pmax:qt,origin:this.origin,line:this.line});let ti=D.EFunction([{name:Et}],jt),ii=e==null?0:e.pmin,Wt=null;return ti==null?null:(ii==null&&(ii=this.tokenMin),Wt==null&&(Wt=this.tokenMax),{e:ti,pmin:ii,pmax:Wt,origin:this.origin,line:this.line})}break;case 26:let Mt=ye.e.e;if(Mt._hx_index==1){let Et=Mt.v,Lt=ye.t,ot=this.parseExpr(),Dt=D.EReturn(ot),qt=ot==null?0:ot.pmin,jt=null,ti;Dt==null?ti=null:(qt==null&&(qt=this.tokenMin),jt==null&&(jt=this.tokenMax),ti={e:Dt,pmin:qt,pmax:jt,origin:this.origin,line:this.line});let ii=D.EFunction([{name:Et,t:Lt}],ti),Wt=e==null?0:e.pmin,ze=null;return ii==null?null:(Wt==null&&(Wt=this.tokenMin),ze==null&&(ze=this.tokenMax),{e:ii,pmin:Wt,pmax:ze,origin:this.origin,line:this.line})}break;default:}this.unexpected(t)}if(this.opPriority.h[s]==-1){let ye;if(this.isBlock(e))ye=!0;else{let Ke=e.e;if(Ke._hx_index==3){let dt=Ke.e;ye=!0}else ye=!1}if(ye)return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e;let ht=D.EUnop(s,!1,e),fe=e==null?0:e.pmin,xe=null,tt;return ht==null?tt=null:(fe==null&&(fe=this.tokenMin),xe==null&&(xe=this.tokenMax),tt={e:ht,pmin:fe,pmax:xe,origin:this.origin,line:this.line}),this.parseExprNext(tt)}return this.makeBinop(s,e,this.parseExpr());case 4:let n=D.ECall(e,this.parseExprList(U.TPClose)),l=e==null?0:e.pmin,r=null,h;return n==null?h=null:(l==null&&(l=this.tokenMin),r==null&&(r=this.tokenMax),h={e:n,pmin:l,pmax:r,origin:this.origin,line:this.line}),this.parseExprNext(h);case 8:let a=this.getIdent(),o=D.EField(e,a),c=e==null?0:e.pmin,p=null,f;return o==null?f=null:(c==null&&(c=this.tokenMin),p==null&&(p=this.tokenMax),f={e:o,pmin:c,pmax:p,origin:this.origin,line:this.line}),this.parseExprNext(f);case 9:let _=this.getIdent(),d="__a_"+this.uid++,x=D.EVar(d,null,e),y=e==null?0:e.pmin,b=e==null?0:e.pmax,v;x==null?v=null:(y==null&&(y=this.tokenMin),b==null&&(b=this.tokenMax),v={e:x,pmin:y,pmax:b,origin:this.origin,line:this.line});let T=D.EIdent(d),E=e==null?0:e.pmin,F=e==null?0:e.pmax,L;T==null?L=null:(E==null&&(E=this.tokenMin),F==null&&(F=this.tokenMax),L={e:T,pmin:E,pmax:F,origin:this.origin,line:this.line});let A=D.EIdent("null"),B=e==null?0:e.pmin,I=e==null?0:e.pmax,H;A==null?H=null:(B==null&&(B=this.tokenMin),I==null&&(I=this.tokenMax),H={e:A,pmin:B,pmax:I,origin:this.origin,line:this.line});let P=D.EBinop("==",L,H),M=null,V=null,R;P==null?R=null:(M==null&&(M=this.tokenMin),V==null&&(V=this.tokenMax),R={e:P,pmin:M,pmax:V,origin:this.origin,line:this.line});let Y=D.EIdent("null"),$=e==null?0:e.pmin,te=e==null?0:e.pmax,O;Y==null?O=null:($==null&&($=this.tokenMin),te==null&&(te=this.tokenMax),O={e:Y,pmin:$,pmax:te,origin:this.origin,line:this.line});let q=D.EIdent(d),S=e==null?0:e.pmin,W=e==null?0:e.pmax,ve;q==null?ve=null:(S==null&&(S=this.tokenMin),W==null&&(W=this.tokenMax),ve={e:q,pmin:S,pmax:W,origin:this.origin,line:this.line});let de=D.EField(ve,_),Ce=e==null?0:e.pmin,Se=null,Ee;de==null?Ee=null:(Ce==null&&(Ce=this.tokenMin),Se==null&&(Se=this.tokenMax),Ee={e:de,pmin:Ce,pmax:Se,origin:this.origin,line:this.line});let J=D.ETernary(R,O,Ee),se=null,N=null,X;J==null?X=null:(se==null&&(se=this.tokenMin),N==null&&(N=this.tokenMax),X={e:J,pmin:se,pmax:N,origin:this.origin,line:this.line});let rt=D.EBlock([v,X]),Ve=e==null?0:e.pmin,Ye=null,Ue;return rt==null?Ue=null:(Ve==null&&(Ve=this.tokenMin),Ye==null&&(Ye=this.tokenMax),Ue={e:rt,pmin:Ve,pmax:Ye,origin:this.origin,line:this.line}),this.parseExprNext(Ue);case 12:let He=this.parseExpr(),Je=this.token();Je!=U.TBkClose&&this.unexpected(Je);let $e=D.EArray(e,He),Be=e==null?0:e.pmin,Ne=null,mt;return $e==null?mt=null:(Be==null&&(Be=this.tokenMin),Ne==null&&(Ne=this.tokenMax),mt={e:$e,pmin:Be,pmax:Ne,origin:this.origin,line:this.line}),this.parseExprNext(mt);case 14:let gt=this.parseExpr(),Nt=this.token();Nt!=U.TDoubleDot&&this.unexpected(Nt);let ut=this.parseExpr(),Xe=D.ETernary(e,gt,ut),kt=e==null?0:e.pmin,Ct=ut==null?0:ut.pmax;return Xe==null?null:(kt==null&&(kt=this.tokenMin),Ct==null&&(Ct=this.tokenMax),{e:Xe,pmin:kt,pmax:Ct,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!=U.TPClose){let i=!1;for(;!i;){let s=null,n=!1;if(t._hx_index==14&&(n=!0,t=this.token()),t._hx_index==2)s=t.s;else{this.unexpected(t);break}let l={name:s};switch(e.push(l),n&&(l.opt=!0),this.allowTypes&&(this.maybe(U.TDoubleDot)&&(l.t=this.parseType()),this.maybe(U.TOp("="))&&(l.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!=U.TPOpen&&this.unexpected(e);let t=this.parseFunctionArgs(),i=null;if(this.allowTypes){let s=this.token();s!=U.TDoubleDot?(this.tokens.push({t:s,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!=U.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 s=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(u.cca(p,0)==62){this.tokens.add({t:U.TOp(u.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(Ht.CTPath(s,n));case 4:let l=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:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let h=function(c){let p=t.token();if(p._hx_index==3){if(p.s!="->"){let f=p;t.unexpected(f)}}else{let f=p;t.unexpected(f)}return Ht.CTFun(c,t.parseType())};switch(l._hx_index){case 2:let c=l.s;if(r._hx_index==15){let b=[],v=0,T=this.parseFunctionArgs();for(;v<T.length;){let F=T[v];++v;let L=F.value;if(L!=null){let A=L;if(!this.resumeErrors)throw k.thrown(new ce(oe.ECustom("Default values not allowed in function types"),A.pmin,A.pmax,this.origin,this.line))}b.push(Ht.CTNamed(F.name,F.opt?Ht.CTOpt(F.t):F.t))}return h(b)}else{let b=this.parseType(),v=this.token();switch(v._hx_index){case 5:return this.parseTypeNext(Ht.CTParent(b));case 10:let T=[b];do T.push(this.parseType());while(this.maybe(U.TComma));let E=this.token();return E!=U.TPClose&&this.unexpected(E),h(T);default:let F=v;return this.unexpected(F)}}break;case 5:let p=[],f=0,_=this.parseFunctionArgs();for(;f<_.length;){let b=_[f];++f;let v=b.value;if(v!=null){let T=v;if(!this.resumeErrors)throw k.thrown(new ce(oe.ECustom("Default values not allowed in function types"),T.pmin,T.pmax,this.origin,this.line))}p.push(Ht.CTNamed(b.name,b.opt?Ht.CTOpt(b.t):b.t))}return h(p);default:let x=this.parseType(),y=this.token();switch(y._hx_index){case 5:return this.parseTypeNext(Ht.CTParent(x));case 10:let b=[x];do b.push(this.parseType());while(this.maybe(U.TComma));let v=this.token();return v!=U.TPClose&&this.unexpected(v),h(b);default:let T=y;return this.unexpected(T)}}break;case 6:let a=[],o=null;e:for(;;)switch(e=this.token(),e._hx_index){case 2:let c=e.s;if(c=="var"){let f=this.getIdent(),_=this.token();_!=U.TDoubleDot&&this.unexpected(_),a.push({name:f,t:this.parseType(),meta:o}),o=null;let d=this.token();d!=U.TSemicolon&&this.unexpected(d)}else{let f=c,_=this.token();switch(_!=U.TDoubleDot&&this.unexpected(_),a.push({name:f,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(Ht.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 s=i.ret;return i.args.unshift(e),i}else return Ht.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 s=[];for(;;){let n=this.token();if(n==U.TEof)break;this.tokens.push({t:n,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,s.push(this.parseModuleDecl())}return s}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(U.TOp("<"))&&!this.resumeErrors)throw k.thrown(new ce(oe.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,s=!1;e:for(;;){switch(t){case"extern":s=!0;break;case"private":i=!0;break;default:break e}t=this.getIdent()}switch(t){case"class":let n=this.getIdent(),l=this.parseParams(),r=null,h=[];e:for(;;){let T=this.token();if(T._hx_index==2)switch(T.s){case"extends":r=this.parseType();break;case"implements":h.push(this.parseType());break;default:this.tokens.push({t:T,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break e}else{this.tokens.push({t:T,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}let a=[],o=this.token();for(o!=U.TBrOpen&&this.unexpected(o);!this.maybe(U.TBrClose);)a.push(this.parseField());return Ui.DClass({name:n,meta:e,params:l,extend:r,implement:h,fields:a,isPrivate:i,isExtern:s});case"import":let c=[this.getIdent()],p=!1;for(;;){let T=this.token();if(T!=U.TDot){this.tokens.push({t:T,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}switch(T=this.token(),T._hx_index){case 2:let E=T.s;c.push(E);break;case 3:T.s=="*"?p=!0:this.unexpected(T);break;default:this.unexpected(T)}}let f=this.token();return f!=U.TSemicolon&&this.unexpected(f),Ui.DImport(c,p);case"package":let _=this.parsePath(),d=this.token();return d!=U.TSemicolon&&this.unexpected(d),Ui.DPackage(_);case"typedef":let x=this.getIdent(),y=this.parseParams(),b=this.token();re.enumEq(b,U.TOp("="))||this.unexpected(b);let v=this.parseType();return Ui.DTypedef({name:x,meta:e,params:y,isPrivate:i,t:v});default:this.unexpected(U.TId(t))}return null}parseField(){let e=this.parseMetadata(),t=[];e:for(;;){let i=this.getIdent();switch(i){case"function":let s=this.getIdent(),n=this.parseFunctionDecl();return{name:s,meta:e,access:t,kind:Ps.KFunction({args:n.args,expr:n.body,ret:n.ret})};case"inline":t.push(Ti.AInline);break;case"macro":t.push(Ti.AMacro);break;case"override":t.push(Ti.AOverride);break;case"private":t.push(Ti.APrivate);break;case"public":t.push(Ti.APublic);break;case"static":t.push(Ti.AStatic);break;case"var":let l=this.getIdent(),r=null,h=null;if(this.maybe(U.TPOpen)){r=this.getIdent();let c=this.token();c!=U.TComma&&this.unexpected(c),h=this.getIdent();let p=this.token();p!=U.TPClose&&this.unexpected(p)}let a=this.maybe(U.TDoubleDot)?this.parseType():null,o=this.maybe(U.TOp("="))?this.parseExpr():null;if(o!=null)if(this.isBlock(o))this.maybe(U.TSemicolon);else{let c=this.token();c!=U.TSemicolon&&this.unexpected(c)}else{let c;if(a!=null)if(a==null)c=!1;else if(a._hx_index==2){let p=a.fields;c=!0}else c=!1;else c=!1;if(c)this.maybe(U.TSemicolon);else{let p=this.token();p!=U.TSemicolon&&this.unexpected(p)}}return{name:l,meta:e,access:t,kind:Ps.KVar({get:r,set:h,type:a,expr:o})};default:this.unexpected(U.TId(i));break e}}return null}readChar(){return this.input.charCodeAt(this.readPos++)}readString(e){let t=0,i="",s=!1,n=this.line,l=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 k.thrown(new ce(oe.EUnterminatedString,r,r,this.origin,this.line));break}if(s)switch(s=!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 c=o++;a<<=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:a+=p-48;break;case 65:case 66:case 67:case 68:case 69:case 70:a+=p-55;break;case 97:case 98:case 99:case 100:case 101:case 102:a+=p-87;break;default:if(p!=p&&(this.line=n,!this.resumeErrors))throw k.thrown(new ce(oe.EUnterminatedString,r,r,this.origin,this.line));this.invalidChar(p)}}i+=String.fromCodePoint(a);break;default:this.invalidChar(h)}else if(h==92)s=!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,U.TEof;switch(e){case 0:return U.TEof;case 10:this.line++,this.tokenMin++;break;case 9:case 13:case 32:this.tokenMin++;break;case 34:case 39:return U.TConst(ai.CString(this.readString(e)));case 35:if(e=this.input.charCodeAt(this.readPos++),this.idents[e]){let s=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),!this.idents[e])return this.char=e,this.preprocess(s);s+=String.fromCodePoint(e)}}this.invalidChar(e);break;case 40:return U.TPOpen;case 41:return U.TPClose;case 44:return U.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),U.TOp("...");case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:let s=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:s=s*10+(e-48);break;default:return this.char=e,U.TConst(ai.CFloat(s/n))}break;default:return this.char=e,U.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:U.TOp("..."),min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let h=t|0;return U.TConst(h==t?ai.CInt(h):ai.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 s=this.token(),n=null;switch(s._hx_index){case 1:let h=s.c;h._hx_index==0?n=h.v:(this.tokens.push({t:s,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax);break;case 3:if(s.s=="-")if(s=this.token(),s._hx_index==1){let a=s.c;a._hx_index==0?n=-a.v:(this.tokens.push({t:s,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax)}else this.tokens.push({t:s,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;else this.tokens.push({t:s,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;default:this.tokens.push({t:s,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}return n==null&&this.invalidChar(e),i==0&&(i=10),U.TConst(ai.CFloat(Math.pow(10,n)/i*t*10));case 120:(t>0||i>0)&&this.invalidChar(e);let l=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:l=(l<<4)+e-48;break;case 65:case 66:case 67:case 68:case 69:case 70:l=(l<<4)+(e-55);break;case 97:case 98:case 99:case 100:case 101:case 102:l=(l<<4)+(e-87);break;default:return this.char=e,U.TConst(ai.CInt(l))}break;default:this.char=e;let r=t|0;return U.TConst(i>0?ai.CFloat(t*10/i):r==t?ai.CInt(r):ai.CFloat(t))}break;case 58:return U.TDoubleDot;case 59:return U.TSemicolon;case 61:return e=this.input.charCodeAt(this.readPos++),e==61?U.TOp("=="):e==62?U.TOp("=>"):(this.char=e,U.TOp("="));case 63:return e=this.input.charCodeAt(this.readPos++),e==46?U.TQuestionDot:(this.char=e,U.TQuestion);case 64:if(e=this.input.charCodeAt(this.readPos++),this.idents[e]||e==58){let s=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),!this.idents[e])return this.char=e,U.TMeta(s);s+=String.fromCodePoint(e)}}this.invalidChar(e);break;case 91:return U.TBkOpen;case 93:return U.TBkClose;case 123:return U.TBrOpen;case 125:return U.TBrClose;default:if(this.ops[e]){let s=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),e!=e&&(e=0),!this.ops[e])return this.char=e,U.TOp(s);let n=s;if(s+=String.fromCodePoint(e),!Object.prototype.hasOwnProperty.call(this.opPriority.h,s)&&Object.prototype.hasOwnProperty.call(this.opPriority.h,n))return s=="//"||s=="/*"?this.tokenComment(s,e):(this.char=e,U.TOp(n))}}if(this.idents[e]){let s=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),e!=e&&(e=0),!this.idents[e])return this.char=e,U.TId(s);s+=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=D.EIdent(t),s=this.tokenMin,n=this.tokenMax;return i==null?null:(s==null&&(s=this.tokenMin),n==null&&(n=this.tokenMax),{e:i,pmin:s,pmax:n,origin:this.origin,line:this.line});case 3:if(e.s=="!"){let l=D.EUnop("!",!0,this.parsePreproCond()),r=this.tokenMin,h=this.tokenMax;return l==null?null:(r==null&&(r=this.tokenMin),h==null&&(h=this.tokenMax),{e:l,pmin:r,pmax:h,origin:this.origin,line:this.line})}else return this.unexpected(e);break;case 4:return this.tokens.push({t:U.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 s=t.e;return this.evalPreproCond(s);case 6:let n=t.e1,l=t.e2;switch(t.op){case"&&":let a=n,o=l;return this.evalPreproCond(a)?this.evalPreproCond(o):!1;case"||":let c=n,p=l;return this.evalPreproCond(c)?!0:this.evalPreproCond(p);default:let f=e.e;if(!this.resumeErrors)throw k.thrown(new ce(oe.EInvalidPreprocessor("Can't eval "+Fe[f.__enum__].__constructs__[f._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 k.thrown(new ce(oe.EInvalidPreprocessor("Can't eval "+Fe[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 k.thrown(new ce(oe.EInvalidPreprocessor("Can't eval "+Fe[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")):U.TPrepro(e);case"end":return this.preprocStack.length>0?(this.preprocStack.pop(),this.token()):U.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 U.TPrepro(e)}}skipTokens(){let e=this.preprocStack.length-1,t=this.preprocStack[e],i=this.readPos+this.offset;for(;;){let s=this.token();if(s==U.TEof&&!this.resumeErrors)throw k.thrown(new ce(oe.EInvalidPreprocessor("Unclosed"),i,i,this.origin,this.line));if(this.preprocStack[e]!=t){this.tokens.push({t:s,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}}tokenComment(e,t){let i=u.cca(e,1),s=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 k.thrown(new ce(oe.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 k.thrown(new ce(oe.EUnterminatedComment,this.tokenMin,this.tokenMin,this.origin,this.line));break}}while(t!=47);return this.token()}return this.char=t,U.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}}}K["hscript.Parser"]=Yi,Yi.__name__="hscript.Parser",Object.assign(Yi.prototype,{__class__:Yi,__properties__:{get_currentPos:"get_currentPos"}});class ns{constructor(){}exprToString(e){return this.buf=new $t,this.tabs="",this.expr(e),this.buf.b}typeToString(e){return this.buf=new $t,this.tabs="",this.type(e),this.buf.b}add(e){this.buf.b+=Z.string(e)}type(e){switch(e._hx_index){case 0:let t=e.path,i=e.params,s=t.join(".");if(this.buf.b+=Z.string(s),i!=null){this.buf.b+="<";let x=!0,y=0;for(;y<i.length;){let b=i[y];++y,x?x=!1:this.buf.b+=", ",this.type(b)}this.buf.b+=">"}break;case 1:let n=e.args,l=e.ret,r=n,h=l;if(Qs.exists(r,function(x){if(x._hx_index==5){let y=x.n,b=x.t;return!0}else return!1})){this.buf.b+="(";let x=0;for(;x<r.length;){let y=r[x];if(++x,y._hx_index==5){let b=y.n,v=y.t;this.type(y)}else this.type(Ht.CTNamed("_",y))}this.buf.b+=")->",this.type(h)}else{let x=n,y=l;if(x.length==0)this.buf.b+="Void -> ";else{let b=0;for(;b<x.length;){let v=x[b];++b,this.type(v),this.buf.b+=" -> "}}this.type(y)}break;case 2:let a=e.fields;this.buf.b+="{";let o=!0,c=0;for(;c<a.length;){let x=a[c];++c,o?(o=!1,this.buf.b+=" "):this.buf.b+=", ",this.buf.b+=Z.string(x.name+" : "),this.type(x.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 f=e.t;this.buf.b+="?",this.type(f);break;case 5:let _=e.n,d=e.t;this.buf.b+=_==null?"null":""+_,this.buf.b+=":",this.type(d);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 fe=i.v;this.buf.b+=fe==null?"null":""+fe;break;case 1:let xe=i.f;this.buf.b+=xe==null?"null":""+xe;break;case 2:let tt=i.s;this.buf.b+='"';let Ke=tt.split('"').join('\\"').split(`
|
|
14
|
-
`).join("\\n").split("\r").join("\\r").split(" ").join("\\t");this.buf.b+=
|
|
15
|
-
`;let
|
|
16
|
-
`}this.tabs=
|
|
17
|
-
`;let
|
|
18
|
-
`}this.tabs=
|
|
19
|
-
`}
|
|
20
|
-
`),this.buf.b+="}";break;case 24:let
|
|
21
|
-
`;t+=" ";let
|
|
22
|
-
`),n+=t+r+" : "+
|
|
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 i=e.__interfaces__;if(i!=null&&(e.__super__==null||e.__super__.__interfaces__!=i)){let
|
|
24
|
-
`),n=Object.create(null);t.each(function(a,o){if(a instanceof
|
|
25
|
-
`;let r=0;for(;r<
|
|
26
|
-
`),
|
|
27
|
-
`,t!=null&&Object.prototype.hasOwnProperty.call(t.h,h.id)?n+=
|
|
28
|
-
`}return n}static unquotedRawToQuotedRaw(e){let t="",i=0;for(;i<e.length;){let
|
|
29
|
-
`)!=-1||e.indexOf("{")!=-1)return!1;let t=
|
|
30
|
-
`),n="",
|
|
31
|
-
`);let a=
|
|
32
|
-
//<END>`,this.input=e,this.index=0,this.output=new $t,this.lineOutput=new $t,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(),
|
|
33
|
-
`}toLorelinePos(e,t,i){let
|
|
34
|
-
`,t);l==-1&&(l=this.length);let r=this.input,h=l!=null?r.substring(t,l):r.substring(t),a=Te.ltrim(h);if(a.length>0&&(!a.startsWith("//")||a.startsWith("//<END>"))&&!a.startsWith("/*")){let o=h.length-a.length;return a.startsWith("//<END>")&&s==0&&n>0?n-s:o-s}a.length>0&&n==-1&&(n=h.length-a.length),t=l+1}return s==0&&n>0?n-s:0}followsWithIf(e){let t=e;for(;t<this.length;){let i=u.cca(this.input,t);if(i==32||i==9||i==10||i==13){++t;continue}if(i==47&&t+1<this.length){let s=u.cca(this.input,t+1);if(s==47){for(t+=2;t<this.length&&u.cca(this.input,t)!=13&&u.cca(this.input,t)!=10;)++t;continue}if(s==42){for(t+=2;t+1<this.length;){if(u.cca(this.input,t)==42&&u.cca(this.input,t+1)==47){t+=2;break}++t}continue}}return t+1<this.length&&u.cca(this.input,t)==105&&u.cca(this.input,t+1)==102&&(t+2>=this.length||!this.isAlphaNumeric(u.cca(this.input,t+2)))}return!1}endsWithControlKeyword(e,t){let i=Te.rtrim(e);if(i.length==0)return!1;let s=0,n=qi.CONTROL_KEYWORDS;for(;s<n.length;){let l=n[s];if(++s,i.endsWith(l)){let r=e.length-i.length,h=i.length-l.length,a=h==0||!this.isAlphaNumeric(u.cca(i,h-1)),o=t,c=o<this.length&&(r>0||!this.isAlphaNumeric(u.cca(this.input,o)));if(a&&c&&(l!="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 n=u.cca(e,i);if(!this.isWhitespace(n))break;--i}if(i<0)return!1;let s=u.cca(e,i);return s==41||s==125||s==93?!0:this.isAlphaNumeric(s)}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=u.cca(this.input,e);if(!(t>=97&&t<=122||t>=65&&t<=90||t==95))return!1;let i=e;for(++e;;){let r;if(e<this.length){let h=u.cca(this.input,e);r=h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57}else r=!1;if(!r)break;++e}for(;e<this.length&&this.isWhitespace(u.cca(this.input,e));)++e;if(e>=this.length||u.cca(this.input,e)!=58)return!1;let s=this.input,n=e-i;return(n!=null?u.substr(s,i,n):u.substr(s,i,null))!="case"}skipWhitespaceAndComments(e){let t=e,i=!1;for(;e<this.length;){for(;e<this.length&&(u.cca(this.input,e)==32||u.cca(this.input,e)==9||u.cca(this.input,e)==10||u.cca(this.input,e)==13);)++e,i=!0;if(e<this.length-1&&u.cca(this.input,e)==47){if(u.cca(this.input,e+1)==47)return e=t,e;if(u.cca(this.input,e+1)==42){e+=2,i=!0;let s=!1;for(;e<this.length-1;){if(u.cca(this.input,e)==42&&u.cca(this.input,e+1)==47){e+=2,s=!0;break}++e}if(!s)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 $t,this.inStatementsBlock()||this.inObjectBlock()||this.inArrayBlock()){let s=this.nextLineIndentOffset(i,this.index);if(Te.trim(i).length!=0)if(s>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=Te.ltrim(i);n.startsWith("case ")||n.startsWith("case ")||n=="default"||n.startsWith("default ")||n.startsWith("default ")?(this.stack.push(4),this.indentLevel+=s,this.indentStack.push(this.indentLevel),this.currentPosOffset++,this.output.b+=String.fromCodePoint(58),this.posOffsets.push(this.currentPosOffset)):(this.stack.push(3),this.indentLevel+=s,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(s<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+=s;let n=!0;for(;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 l=this.stack.pop();this.indentStack.pop(),l==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 s==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 k.thrown(new li(e,z.fromContentAndIndex(this.input,this.index)))}}K["loreline.CodeToHscript"]=qi,qi.__name__="loreline.CodeToHscript",Object.assign(qi.prototype,{__class__:qi});class Ci{static equal(e,t,i){return t==i?!0:ee.isArray(t)?ee.isArray(i)?Ci.arrayEqual(e,t,i):!1:t instanceof me?i instanceof me?Ci.stringMapEqual(e,t,i):!1:t instanceof Ri?i instanceof Ri?Ci.intMapEqual(e,t,i):!1:le.isFields(t)&&le.isFields(i)?Ci.objectFieldsEqual(e,t,i):!1}static objectFieldsEqual(e,t,i){let s=0,n=le.getFields(e,t);for(;s<n.length;){let h=n[s];if(++s,!le.fieldExists(e,i,h)||!Ci.equal(e,le.getField(e,t,h),le.getField(e,i,h)))return!1}let l=0,r=le.getFields(e,i);for(;l<r.length;){let h=r[l];if(++l,!le.fieldExists(e,t,h))return!1}return!0}static arrayEqual(e,t,i){let s=ee.arrayLength(t),n=ee.arrayLength(i);if(s!=n)return!1;let l=0,r=s;for(;l<r;){let h=l++;if(!Ci.equal(e,ee.arrayGet(t,h),ee.arrayGet(i,h)))return!1}return!0}static stringMapEqual(e,t,i){let s=t.h,n=s,l=Object.keys(s),r=l.length,h=0;for(;h<r;){let _=l[h++],d=_,x=n[_],y=d,b=x;if(!Object.prototype.hasOwnProperty.call(i.h,y)||!Ci.equal(e,i.h[y],b))return!1}let a=i.h,o=a,c=Object.keys(a),p=c.length,f=0;for(;f<p;){let _=c[f++];if(!Object.prototype.hasOwnProperty.call(t.h,_))return!1}return!0}static intMapEqual(e,t,i){let s=t,n=s,l=s.keys();for(;l.hasNext();){let h=l.next(),a=n.get(h),c=h,p=a;if(!i.h.hasOwnProperty(c)||!Ci.equal(e,i.h[c],p))return!1}let r=i.keys();for(;r.hasNext();){let h=r.next();if(!t.h.hasOwnProperty(h))return!1}return!0}}K["loreline.Equal"]=Ci,Ci.__name__="loreline.Equal";class li{constructor(e,t){this.message=e,this.pos=t,this.stack=cn.callStack()}toString(){return this.pos!=null?""+this.message+" at "+this.pos.toString():this.message}}K["loreline.Error"]=li,li.__name__="loreline.Error",Object.assign(li.prototype,{__class__:li});class Ei{}K["loreline.Fields"]=Ji.loreline.Fields=Ei,Ei.__name__="loreline.Fields",Ei.__isInterface__=!0,Object.assign(Ei.prototype,{__class__:Ei});class Os{constructor(e){this._random=null,this.interpreter=e}bindAll(e){e.h.floor=_e(this,this.floor),e.h.ceil=_e(this,this.ceil),e.h.round=_e(this,this.round),e.h.abs=_e(this,this.abs),e.h.min=_e(this,this.min),e.h.max=_e(this,this.max),e.h.clamp=_e(this,this.clamp),e.h.pow=_e(this,this.pow),e.h.random=_e(this,this.random),e.h.chance=_e(this,this.chance),e.h.seed_random=_e(this,this.seed_random),e.h.random_float=_e(this,this.random_float),e.h.wait=_e(this,this.wait),e.h.float=_e(this,this.float_),e.h.string=_e(this,this.string_),e.h.bool=_e(this,this.bool),e.h.string_length=_e(this,this.string_length),e.h.string_upper=_e(this,this.string_upper),e.h.string_lower=_e(this,this.string_lower),e.h.string_contains=_e(this,this.string_contains),e.h.string_replace=_e(this,this.string_replace),e.h.string_split=_e(this,this.string_split),e.h.string_trim=_e(this,this.string_trim),e.h.string_index=_e(this,this.string_index),e.h.string_sub=_e(this,this.string_sub),e.h.string_starts=_e(this,this.string_starts),e.h.string_ends=_e(this,this.string_ends),e.h.string_repeat=_e(this,this.string_repeat),e.h.plural=_e(this,this.plural),e.h.array_length=_e(this,this.array_length),e.h.array_add=_e(this,this.array_add),e.h.array_pop=_e(this,this.array_pop),e.h.array_prepend=_e(this,this.array_prepend),e.h.array_shift=_e(this,this.array_shift),e.h.array_remove=_e(this,this.array_remove),e.h.array_index=_e(this,this.array_index),e.h.array_has=_e(this,this.array_has),e.h.array_sort=_e(this,this.array_sort),e.h.array_reverse=_e(this,this.array_reverse),e.h.array_join=_e(this,this.array_join),e.h.array_pick=_e(this,this.array_pick),e.h.array_shuffle=_e(this,this.array_shuffle),e.h.array_copy=_e(this,this.array_copy),e.h.map_length=_e(this,this.map_length),e.h.map_keys=_e(this,this.map_keys),e.h.map_has=_e(this,this.map_has),e.h.map_get=_e(this,this.map_get),e.h.map_set=_e(this,this.map_set),e.h.map_remove=_e(this,this.map_remove),e.h.map_copy=_e(this,this.map_copy),e.h.current_beat=_e(this,this.current_beat),e.h.has_beat=_e(this,this.has_beat)}rng(){this._random==null&&(this._random=new as);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 as(e),null}random_float(e,t){return e+this.rng()*(t-e)}wait(e){return new Xi(function(t){t()})}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":Z.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 Te.replace(e,t,i)}string_split(e,t){return e.split(t)}string_trim(e){return Te.trim(e)}string_index(e,t){return e.indexOf(t)}string_sub(e,t,i){return u.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="",s=0;for(;s<t;)i+=e==null?"null":""+e,++s;return i}plural(e,t,i){let s=0;return typeof e=="number"&&(e|0)===e?s=e*1:typeof e=="number"&&(s=e),s==1?t:i}array_length(e){return ee.isArray(e)?ee.arrayLength(e):0}array_add(e,t){return ee.arrayPush(e,t),null}array_pop(e){return ee.isArray(e)?ee.arrayPop(e):null}array_prepend(e,t){return ee.isArray(e)&&ee.arrayInsert(e,0,t),null}array_shift(e){return ee.isArray(e)?ee.arrayShift(e):null}array_remove(e,t){if(ee.isArray(e)){let i=ee.arrayLength(e),s=0,n=i;for(;s<n;){let l=s++;if(ee.arrayGet(e,l)==t)return ee.arrayRemoveAt(e,l),!0}}return!1}array_index(e,t){if(ee.isArray(e)){let i=ee.arrayLength(e),s=0,n=i;for(;s<n;){let l=s++;if(ee.arrayGet(e,l)==t)return l}}return-1}array_has(e,t){if(ee.isArray(e)){let i=ee.arrayLength(e),s=0,n=i;for(;s<n;){let l=s++;if(ee.arrayGet(e,l)==t)return!0}}return!1}array_sort(e){return ee.isArray(e)&&ee.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":Z.string(t))<(i==null?"null":Z.string(i))?-1:(t==null?"null":Z.string(t))>(i==null?"null":Z.string(i))?1:0}),e}array_reverse(e){return ee.isArray(e)&&ee.arrayReverse(e),e}array_join(e,t){return ee.isArray(e)?ee.arrayJoin(e,t):""}array_pick(e){if(ee.isArray(e)){let t=ee.arrayLength(e);if(t==0)return null;let i=Math.floor(this.rng()*t);return ee.arrayGet(e,i)}return null}array_shuffle(e){if(ee.isArray(e)){let t=ee.arrayLength(e)-1;for(;t>0;){let i=Math.floor(this.rng()*(t+1)),s=ee.arrayGet(e,t);ee.arraySet(e,t,ee.arrayGet(e,i)),ee.arraySet(e,i,s),--t}}return e}array_copy(e){return ee.isArray(e)?ee.arrayCopy(e):e}map_length(e){return le.getFields(this.interpreter,e).length}map_keys(e){let t=le.getFields(this.interpreter,e);return t.sort(function(i,s){return i<s?-1:i>s?1:0}),t}map_has(e,t){return le.fieldExists(this.interpreter,e,t)}map_get(e,t){return le.getField(this.interpreter,e,t)}map_set(e,t,i){return le.setField(this.interpreter,e,t,i),null}map_remove(e,t){return le.fieldExists(this.interpreter,e,t)?le.removeField(this.interpreter,e,t):!1}map_copy(e){let t=le.getFields(this.interpreter,e),i=le.createFields(this.interpreter),s=0;for(;s<t.length;){let n=t[s];++s,le.setField(this.interpreter,i,n,le.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.name;--e}return null}has_beat(e){let t=this.interpreter.stack.length-1;for(;t>=0;){let i=this.interpreter.stack[t];if(i.beat!=null&&i.beat.body!=null){let s=0,n=i.beat.body;for(;s<n.length;){let l=n[s];if(++s,l instanceof De&&l.name==e)return!0}}--t}return Object.prototype.hasOwnProperty.call(this.interpreter.topLevelBeats.h,e)}}K["loreline.Functions"]=Os,Os.__name__="loreline.Functions",Object.assign(Os.prototype,{__class__:Os});var Si=Fe["loreline._HscriptInterp.Stop"]={__ename__:"loreline._HscriptInterp.Stop",__constructs__:null,SBreak:{_hx_name:"SBreak",_hx_index:0,__enum__:"loreline._HscriptInterp.Stop",toString:C},SContinue:{_hx_name:"SContinue",_hx_index:1,__enum__:"loreline._HscriptInterp.Stop",toString:C},SReturn:{_hx_name:"SReturn",_hx_index:2,__enum__:"loreline._HscriptInterp.Stop",toString:C}};Si.__constructs__=[Si.SBreak,Si.SContinue,Si.SReturn];class Ns{constructor(e){this.interpreter=e,this.locals=new me,this.declared=[],this.resetVariables(),this.initOps()}resetVariables(){this.variables=new me,this.variables.h.null=null,this.variables.h.true=!0,this.variables.h.false=!1;let e=this,t=this.variables,i=Pe.makeVarArgs(function(s){let n=e.posInfos(),l=s.shift();s.length>0&&(n.customParams=s),Es.trace(Z.string(l),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 me,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 s=e.expr(t),n=e.expr(i);return s>=n},this.binops.h["<="]=function(t,i){let s=e.expr(t),n=e.expr(i);return s<=n},this.binops.h[">"]=function(t,i){let s=e.expr(t),n=e.expr(i);return s>n},this.binops.h["<"]=function(t,i){let s=e.expr(t),n=e.expr(i);return s<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["="]=_e(this,this.assign),this.binops.h["..."]=function(t,i){return new Cs(e.expr(t),e.expr(i))},this.binops.h.is=function(t,i){return Q.__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))le.setField(this.interpreter,this.interpreter.topLevelState.fields,e,t);else throw k.thrown("Invalid assign");return t}assign(e,t){let i=this.expr(t),s=e.e;switch(s._hx_index){case 1:let n=s.v,l=this.locals.h[n];l==null?this.setVar(n,i):l.r=i;break;case 5:let r=s.e,h=s.f;i=this.set(this.expr(r),h,i);break;case 16:let a=s.e,o=s.index,c=this.expr(a),p=this.expr(o);ee.isArray(c)?ee.arraySet(c,p,i):le.isFields(c)?le.setField(this.interpreter,c,p,i):Q.__implements(c,ft)?Q.__cast(c,ft).set(p,i):c[p]=i;break;default:let f=new ce(oe.EInvalidOp("="),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(f)}return i}assignOp(e,t){let i=this;this.binops.h[e]=function(s,n){return i.evalAssignOp(e,t,s,n)}}evalAssignOp(e,t,i,s){let n,l=i.e;switch(l._hx_index){case 1:let r=l.v,h=this.locals.h[r];n=t(this.expr(i),this.expr(s)),h==null?this.setVar(r,n):h.r=n;break;case 5:let a=l.e,o=l.f,c=this.expr(a);n=t(this.get(c,o),this.expr(s)),n=this.set(c,o,n);break;case 16:let p=l.e,f=l.index,_=this.expr(p),d=this.expr(f);ee.isArray(_)?(n=t(ee.arrayGet(_,d),this.expr(s)),ee.arraySet(_,d,n)):le.isFields(_)?(n=t(le.getField(this.interpreter,_,d),this.expr(s)),le.setField(this.interpreter,_,d,n)):Q.__implements(_,ft)?(n=t(Q.__cast(_,ft).get(d),this.expr(s)),Q.__cast(_,ft).set(d,n)):(n=t(_[d],this.expr(s)),_[d]=n);break;default:let x=new ce(oe.EInvalidOp(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(x)}return n}increment(e,t,i){this.curExpr=e;let s=e.e;switch(s._hx_index){case 1:let n=s.v,l=this.locals.h[n],r=l==null?this.resolve(n):l.r;return t?(r+=i,l==null?this.setVar(n,r):l.r=r):l==null?this.setVar(n,r+i):l.r=r+i,r;case 5:let h=s.e,a=s.f,o=this.expr(h),c=this.get(o,a);return t?(c+=i,this.set(o,a,c)):this.set(o,a,c+i),c;case 16:let p=s.e,f=s.index,_=this.expr(p),d=this.expr(f);if(ee.isArray(_)){let y=ee.arrayGet(_,d);return t?(y+=i,ee.arraySet(_,d,y)):ee.arraySet(_,d,y+i),y}else if(le.isFields(_)){let y=le.getField(this.interpreter,_,d);return t?(y+=i,le.setField(this.interpreter,_,d,y)):le.setField(this.interpreter,_,d,y+i),y}else if(Q.__implements(_,ft)){let y=Q.__cast(_,ft).get(d);return t?(y+=i,Q.__cast(_,ft).set(d,y)):Q.__cast(_,ft).set(d,y+i),y}else{let y=_[d];return t?(y+=i,_[d]=y):_[d]=y+i,y}break;default:let x=new ce(oe.EInvalidOp(i>0?"++":"--"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(x)}}execute(e){return this.depth=0,this.locals=new me,this.declared=[],this.exprReturn(e)}exprReturn(e){try{return this.expr(e)}catch(t){let i=k.caught(t).unwrap();if(Q.__instanceof(i,Si))switch(i._hx_index){case 0:throw k.thrown("Invalid break");case 1:throw k.thrown("Invalid continue");case 2:let n=this.returnValue;return this.returnValue=null,n}else throw t}}duplicate(e){let t=new me,i=e.h,s=i,n=Object.keys(i),l=n.length,r=0;for(;r<l;){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 k.thrown(i)}rethrow(e){throw k.thrown(e)}resolve(e){let t=this.variables.h[e];if(t==null&&!Object.prototype.hasOwnProperty.call(this.variables.h,e)){if(le.fieldExists(this.interpreter,this.interpreter.topLevelState.fields,e))return le.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=new ce(oe.EUnknownVariable(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(i)}return t}expr(e){this.curExpr=e;let t=e.e,i=this;switch(t._hx_index){case 0:let s=t.c;switch(s._hx_index){case 0:return s.v;case 1:return s.f;case 2:return s.s}break;case 1:let n=t.v,l=this.locals.h[n];return l!=null?l.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,c=a==null?null:this.expr(a);return o.h[h]={r:c},null;case 3:let p=t.e;return this.expr(p);case 4:let f=t.e,_=this.declared.length,d=null,x=0;for(;x<f.length;){let ue=f[x];++x,d=this.expr(ue)}return this.restore(_),d;case 5:let y=t.e,b=t.f;return this.get(this.expr(y),b);case 6:let v=t.op,T=t.e1,E=t.e2,F=this.binops.h[v];if(F==null){let ue=new ce(oe.EInvalidOp(v),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(ue)}return F(T,E);case 7:let L=t.op,A=t.prefix,B=t.e;switch(L){case"!":return this.expr(B)!=!0;case"++":return this.increment(B,A,1);case"-":return-this.expr(B);case"--":return this.increment(B,A,-1);case"~":return~this.expr(B);default:let ue=new ce(oe.EInvalidOp(L),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(ue)}break;case 8:let I=t.e,H=t.params,P=[],M=0;for(;M<H.length;){let ue=H[M];++M,P.push(this.expr(ue))}let V=I.e;if(V._hx_index==5){let ue=V.e,Ge=V.f,it=this.expr(ue);if(it==null){let Ze=new ce(oe.EInvalidAccess(Ge),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(Ze)}return this.fcall(it,Ge,P)}else return this.call(null,this.expr(I),P);break;case 9:let R=t.cond,Y=t.e1,$=t.e2;return this.expr(R)==!0?this.expr(Y):$==null?null:this.expr($);case 10:let te=t.cond,O=t.e;return this.whileLoop(te,O),null;case 11:let q=t.v,S=t.it,W=t.e;return this.forLoop(q,S,W),null;case 12:throw k.thrown(Si.SBreak);case 13:throw k.thrown(Si.SContinue);case 14:let ve=t.ret,de=t.args,Ce=t.e,Se=t.name,Ee=this.duplicate(this.locals),J=this,se=!1,N=0,X=0;for(;X<de.length;){let ue=de[X];++X,ue.opt?se=!0:N+=1}let rt=function(ue){if((ue==null?0:ue.length)!=de.length){if(ue.length<N){let bs="Invalid number of parameters. Got "+ue.length+", required "+N;Se!=null&&(bs+=" for function '"+Se+"'");let en=new ce(oe.ECustom(bs),i.curExpr.pmin,i.curExpr.pmax,i.curExpr.origin,i.curExpr.line);throw k.thrown(en)}let Kt=[],_t=ue.length-N,zs=0,os=0;for(;os<de.length;){let bs=de[os];++os,bs.opt?_t>0?(Kt.push(ue[zs++]),--_t):Kt.push(null):Kt.push(ue[zs++])}ue=Kt}let Ge=J.locals,it=J.depth;J.depth++,J.locals=J.duplicate(Ee);let Ze=0,ct=de.length;for(;Ze<ct;){let Kt=Ze++;J.locals.h[de[Kt].name]={r:ue[Kt]}}let pt=null,yt=i.declared.length;if(i.inTry)try{pt=J.exprReturn(Ce)}catch(Kt){let _t=k.caught(Kt).unwrap();throw i.restore(yt),J.locals=Ge,J.depth=it,k.thrown(_t)}else pt=J.exprReturn(Ce);return i.restore(yt),J.locals=Ge,J.depth=it,pt},Ve=Pe.makeVarArgs(rt);if(Se!=null)if(this.depth==0)this.variables.h[Se]=Ve;else{this.declared.push({n:Se,old:this.locals.h[Se]});let ue={r:Ve};this.locals.h[Se]=ue,Ee.h[Se]=ue}return Ve;case 15:let Ye=t.e;throw this.returnValue=Ye==null?null:this.expr(Ye),k.thrown(Si.SReturn);case 16:let Ue=t.e,He=t.index,Je=this.expr(Ue),$e=this.expr(He);return ee.isArray(Je)?ee.arrayGet(Je,$e):le.isFields(Je)?le.getField(this.interpreter,Je,$e):Q.__implements(Je,ft)?Q.__cast(Je,ft).get($e):Je[$e];case 17:let Be=t.e,Ne;if(Be.length>0){let ue=Be[0].e;if(ue._hx_index==6){let Ge=ue.e1,it=ue.e2;Ne=ue.op=="=>"}else Ne=!1}else Ne=!1;if(Ne){let ue=[],Ge=[],it=0;for(;it<Be.length;){let Ze=Be[it];++it;let ct=Ze.e;if(ct._hx_index==6)if(ct.op=="=>"){let pt=ct.e1,yt=ct.e2;ue.push(this.expr(pt)),Ge.push(this.expr(yt))}else{this.curExpr=Ze;let pt=new ce(oe.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(pt)}else{this.curExpr=Ze;let pt=new ce(oe.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(pt)}}return this.makeMap(ue,Ge)}else{let ue=[],Ge=0;for(;Ge<Be.length;){let it=Be[Ge];++Ge,ue.push(this.expr(it))}return ue}break;case 18:let mt=t.cl,gt=t.params,Nt=[],ut=0;for(;ut<gt.length;){let ue=gt[ut];++ut,Nt.push(this.expr(ue))}return this.cnew(mt,Nt);case 19:let Xe=t.e;throw k.thrown(this.expr(Xe));case 20:let kt=t.t,Ct=t.e,ye=t.v,ht=t.ecatch,fe=this.declared.length,xe=this.inTry;try{this.inTry=!0;let ue=this.expr(Ct);return this.restore(fe),this.inTry=xe,ue}catch(ue){let Ge=k.caught(ue).unwrap();if(Q.__instanceof(Ge,Si)){let it=Ge;throw this.inTry=xe,k.thrown(it)}else{let it=Ge;this.restore(fe),this.inTry=xe,this.declared.push({n:ye,old:this.locals.h[ye]}),this.locals.h[ye]={r:it};let Ze=this.expr(ht);return this.restore(fe),Ze}}break;case 21:let tt=t.fl,Ke=le.createFields(this.interpreter),dt=0;for(;dt<tt.length;){let ue=tt[dt];++dt,le.setField(this.interpreter,Ke,ue.name,this.expr(ue.e))}return Ke;case 22:let Ut=t.cond,at=t.e1,ei=t.e2;return this.expr(Ut)==!0?this.expr(at):this.expr(ei);case 23:let Ae=t.e,Mt=t.cases,Et=t.defaultExpr,Lt=this.expr(Ae),ot=!1,Dt=0;for(;Dt<Mt.length;){let ue=Mt[Dt];++Dt;let Ge=0,it=ue.values;for(;Ge<it.length;){let Ze=it[Ge];if(++Ge,this.expr(Ze)==Lt){ot=!0;break}}if(ot){Lt=this.expr(ue.expr);break}}return ot||(Lt=Et==null?null:this.expr(Et)),Lt;case 24:let qt=t.cond,jt=t.e;return this.doWhileLoop(qt,jt),null;case 25:let ti=t.name,ii=t.args,Wt=t.e;return this.expr(Wt);case 26:let ze=t.t,xi=t.e;return this.expr(xi)}}doWhileLoop(e,t){let i=this.declared.length,s=this;do{let n=!0;try{s.expr(t)}catch(l){let r=k.caught(l).unwrap();if(Q.__instanceof(r,Si)){let h=r;switch(h._hx_index){case 0:n=!1;break;case 1:break;case 2:throw k.thrown(h)}}else throw l}if(!n)break}while(this.expr(e)==!0);this.restore(i)}whileLoop(e,t){let i=this.declared.length,s=this;for(;this.expr(e)==!0;){let n=!0;try{s.expr(t)}catch(l){let r=k.caught(l).unwrap();if(Q.__instanceof(r,Si)){let h=r;switch(h._hx_index){case 0:n=!1;break;case 1:break;case 2:throw k.thrown(h)}}else throw l}if(!n)break}this.restore(i)}makeIterator(e){if(e instanceof Array)return new bi(e);if(ee.isArray(e))return ee.getIterator(e);if(e.iterator!=null&&(e=on(e)),e.hasNext==null||e.next==null){let t=new ce(oe.EInvalidIterator(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(t)}return e}forLoop(e,t,i){let s=this.declared.length;this.declared.push({n:e,old:this.locals.h[e]});let n=this.makeIterator(this.expr(t)),l=this;for(;n.hasNext();){let r=this.locals,h={r:n.next()};r.h[e]=h;let a=!0;try{l.expr(i)}catch(o){let c=k.caught(o).unwrap();if(Q.__instanceof(c,Si)){let p=c;switch(p._hx_index){case 0:a=!1;break;case 1:break;case 2:throw k.thrown(p)}}else throw o}if(!a)break}this.restore(s)}loopRun(e){let t=!0;try{e()}catch(i){let s=k.caught(i).unwrap();if(Q.__instanceof(s,Si)){let n=s;switch(n._hx_index){case 0:t=!1;break;case 1:break;case 2:throw k.thrown(n)}}else throw i}return t}isMap(e){return Q.__implements(e,ft)}getMapValue(e,t){return Q.__cast(e,ft).get(t)}setMapValue(e,t,i){Q.__cast(e,ft).set(t,i)}makeMap(e,t){let i=!0,s=!0,n=!0,l=!0,r=0;for(;r<e.length;){let a=e[r];++r,i=i&&typeof a=="string",s=s&&typeof a=="number"&&(a|0)===a,n=n&&Pe.isObject(a),l=l&&Pe.isEnumValue(a)}if(s){let a=new Ri,o=0,c=e;for(;o<c.length;){let p=c[o],_=o++,d=p;a.h[d]=t[_]}return a}if(i){let a=new me,o=0,c=e;for(;o<c.length;){let p=c[o],_=o++,d=p;a.h[d]=t[_]}return a}if(l){let a=new Gi,o=0,c=e;for(;o<c.length;){let p=c[o],_=o++,d=p;a.set(d,t[_])}return a}if(n){let a=new cs,o=0,c=e;for(;o<c.length;){let p=c[o],_=o++,d=p;a.set(d,t[_])}return a}let h=new ce(oe.ECustom("Invalid map keys "+Z.string(e)),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(h)}get(e,t){if(e==null){let i=new ce(oe.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(i)}return le.isFields(e)?le.getField(this.interpreter,e,t):Pe.getProperty(e,t)}set(e,t,i){if(e==null){let s=new ce(oe.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(s)}return le.isFields(e)?(le.setField(this.interpreter,e,t,i),i):(Pe.setProperty(e,t,i),i)}fcall(e,t,i){let s=null;return typeof e=="string"?s=le.getStringHelper(this.interpreter,t):ee.isArray(e)?s=le.getArrayHelper(this.interpreter,t):le.isFields(e)&&(s=le.getMapHelper(this.interpreter,t)),s!=null&&Pe.isFunction(s)?(i.splice(0,0,e),this.call(null,s,i)):this.call(e,this.get(e,t),i)}call(e,t,i){return t.apply(e,i)}cnew(e,t){let i=K[e];return i==null&&(i=this.resolve(e)),re.createInstance(i,t)}}K["loreline.HscriptInterp"]=Ns,Ns.__name__="loreline.HscriptInterp",Object.assign(Ns.prototype,{__class__:Ns});class Ms{constructor(e){this.finished=e}}K["loreline._Imports.ImportsLoopInfo"]=Ms,Ms.__name__="loreline._Imports.ImportsLoopInfo",Object.assign(Ms.prototype,{__class__:Ms});class Ls{constructor(){this.ext=".lor",this.pendingImports=0,this.hasErrors=!1,this.done=null,this.resolvedImports=null,this.autoAddExtension=!0}resolve(e,t,i,s,n){this.rootPath=e,this.tokens=t,this.handleFile=i,this.handleError=s,this.done=n,this.hasErrors=!1,this.pendingImports=0,e!=null&&e.endsWith(".lor.txt")&&(this.ext=".lor.txt");let l=new me,r=[],h=new me,a=vt.directory(e);this.extractImports(a,t,r,h),this.processImports(r,h,l)}processImports(e,t,i){let s=new Ms(!1);for(;e.length>0;){let n=e.shift();this.handleItemInLoop(n,s,e,t,i)}s.finished=!0,this.pendingImports==0&&this.done!=null&&(this.resolvedImports=i,this.done(this.hasErrors,i),this.done=null)}handleItemInLoop(e,t,i,s,n){let l=this;this.handleFile(e,function(r){if(l.pendingImports--,r!=null)try{let h=new wt(r),a=h.tokenize(),o=h.getErrors();o!=null&&o.length>0&&l.handleError(o[0]),n.h[e]=a,l.extractImports(vt.directory(e),a,i,s),t.finished&&l.processImports(i,s,n)}catch(h){let a=k.caught(h).unwrap();if(l.hasErrors=!0,a instanceof li)l.handleError(a);else throw k.thrown(a)}else l.hasErrors=!0;t.finished&&l.pendingImports==0&&l.done!=null&&(l.resolvedImports=n,l.done(l.hasErrors,n),l.done=null)})}extractImports(e,t,i,s){let n=0,l=t.length;for(;n<l-1;){if(t[n].type==g.KwImport){let r=t[n+1].type;if(r._hx_index==15){let h=r.quotes,a=r.attachments,o=r.s,c=o;vt.isAbsolute(o)||(c=vt.join([e,c])),c=vt.normalize(c),c.toLowerCase().endsWith(this.ext)||(c+=this.ext),Object.prototype.hasOwnProperty.call(s.h,c)||(this.pendingImports++,s.h[c]=!0,i.push(c))}}++n}}}K["loreline.Imports"]=Ls,Ls.__name__="loreline.Imports",Object.assign(Ls.prototype,{__class__:Ls});class _i{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 s=0,n=e.length;for(;s<n;){let l=s++;i[l]!=null&&this._set(e[l],t[l],i[l])}}}resize(e){let t=this._keys1,i=this._keys2,s=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,l=t.length;for(;n<l;){let r=n++;s[r]!=null&&this._set(t[r],i[r],s[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 s=0,n=e.length;for(;s<n;){let l=s++;i[l]!=null&&this._set(e[l],t[l],i[l])}}this.size=0}copy(){let e=new _i,t=this._keys1,i=new Array(t.length);Ys.blit(t,0,i,0,t.length),e._keys1=i;let s=this._keys2,n=new Array(s.length);Ys.blit(s,0,n,0,s.length),e._keys2=n;let l=this._values,r=new Array(l.length);return Ys.blit(l,0,r,0,l.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 c=0,p=h.length;for(;c<p;){let f=c++;o[f]!=null&&this._set(h[f],a[f],o[f])}}}let s=e+(t<<16);s=(s^s>>>16)*-2048144789,s=(s^s>>>13)*-1028477387;let l=(s^s>>>16)&this.mask;for(;;){if(this._values[l]==null){this._keys1[l]=e,this._keys2[l]=t,this._values[l]=i,this.size++;return}if(this._keys1[l]==e&&this._keys2[l]==t){this._values[l]=i;return}l=l+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 l=this._keys1[n],r=this._keys2[n],h=this._values[n];this._values[n]=null,this.size--,this._set(l,r,h),n=n+1&this.mask}return!0}n=n+1&this.mask}}iterator(){return new Bs(this)}keyIterator(){return new As(this)}keyValueIterator(){return new Fs(this)}length(){return this.size}}K["loreline.Int64Map"]=_i,_i.__name__="loreline.Int64Map",Object.assign(_i.prototype,{__class__:_i});class Bs{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}}K["loreline._Int64Map.Int64MapIterator"]=Bs,Bs.__name__="loreline._Int64Map.Int64MapIterator",Object.assign(Bs.prototype,{__class__:Bs});class As{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}}}K["loreline._Int64Map.Int64MapKeyIterator"]=As,As.__name__="loreline._Int64Map.Int64MapKeyIterator",Object.assign(As.prototype,{__class__:As});class Fs{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}}}K["loreline._Int64Map.Int64MapKeyValueIterator"]=Fs,Fs.__name__="loreline._Int64Map.Int64MapKeyValueIterator",Object.assign(Fs.prototype,{__class__:Fs});class Ai{constructor(e,t,i,s){this.scope=-1,i!=null?this.fields=i:this.clear(e,t),s!=null?this.originalFields=s:this.createOriginalFields()}clear(e,t){this.fields=le.createFields(e,null,t)}createOriginalFields(){this.originalFields=le.createFields()}}K["loreline.RuntimeState"]=Ai,Ai.__name__="loreline.RuntimeState",Object.assign(Ai.prototype,{__class__:Ai});class rs extends Ai{constructor(e,t,i,s){super(e,t,i,s)}}K["loreline.RuntimeCharacter"]=rs,rs.__name__="loreline.RuntimeCharacter",rs.__super__=Ai,Object.assign(rs.prototype,{__class__:rs});var vi=Fe["loreline.RuntimeAccess"]={__ename__:"loreline.RuntimeAccess",__constructs__:null,FieldAccess:(m=function(w,e,t){return{_hx_index:0,pos:w,obj:e,name:t,__enum__:"loreline.RuntimeAccess",toString:C}},m._hx_name="FieldAccess",m.__params__=["pos","obj","name"],m),ArrayAccess:(m=function(w,e,t){return{_hx_index:1,pos:w,array:e,index:t,__enum__:"loreline.RuntimeAccess",toString:C}},m._hx_name="ArrayAccess",m.__params__=["pos","array","index"],m),CharacterAccess:(m=function(w,e){return{_hx_index:2,pos:w,name:e,__enum__:"loreline.RuntimeAccess",toString:C}},m._hx_name="CharacterAccess",m.__params__=["pos","name"],m),FunctionAccess:(m=function(w,e){return{_hx_index:3,pos:w,name:e,__enum__:"loreline.RuntimeAccess",toString:C}},m._hx_name="FunctionAccess",m.__params__=["pos","name"],m)};vi.__constructs__=[vi.FieldAccess,vi.ArrayAccess,vi.CharacterAccess,vi.FunctionAccess];class hs{constructor(e,t,i,s,n,l,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,s!=null&&(this.beats=s),n!=null&&(this.state=n),l!=null&&(this.head=l),r!=null&&(this.insertion=r)}beatByName(e){if(this.beats==null)return null;let t=0,i=this.beats.length;for(;t<i;){let s=t++,n=this.beats[s];if(n.name==e)return n}return null}}K["loreline.RuntimeScope"]=hs,hs.__name__="loreline.RuntimeScope",Object.assign(hs.prototype,{__class__:hs});class fs{constructor(e,t){this.stack=[],this.options=null,this.id=e,this.origin=t}}K["loreline.RuntimeInsertion"]=fs,fs.__name__="loreline.RuntimeInsertion",Object.assign(fs.prototype,{__class__:fs});class ms{constructor(e,t,i){this.closing=e,this.value=t,this.offset=i}}K["loreline.TextTag"]=ms,ms.__name__="loreline.TextTag",Object.assign(ms.prototype,{__class__:ms});class gs{constructor(e,t,i,s,n){this.text=e,this.tags=t,this.enabled=i,this.node=s,this.insertion=n}}K["loreline.ChoiceOption"]=gs,gs.__name__="loreline.ChoiceOption",Object.assign(gs.prototype,{__class__:gs});class he extends li{constructor(e,t){super(e,t)}}K["loreline.RuntimeError"]=he,he.__name__="loreline.RuntimeError",he.__super__=li,Object.assign(he.prototype,{__class__:he});class Ds{constructor(){this.cb=null,this.sync=!0}}K["loreline.EvalNext"]=Ds,Ds.__name__="loreline.EvalNext",Object.assign(Ds.prototype,{__class__:Ds});class ds{constructor(e,t,i,s,n){this.beatToResume=null,this.finishTrigger=null,this.flushing=!1,this.syncCallbacks=[],this.nextInsertionId=1,this.nextScopeId=1,this.stack=[],this.stringLiteralProcessors=[],this.mapHelpers=new me,this.arrayHelpers=new me,this.stringHelpers=new me,this.topLevelFunctions=new me,this.nodeStates=new Wi,this.topLevelBeats=new me,this.topLevelCharacters=new me,this.script=e,this.handleDialogue=t,this.handleChoice=i,this.handleFinish=s,this.lens=new Vs(e);let l=n!=null?n.strictAccess:null;this.strictAccess=l!=null&&l,this.translations=n!=null?n.translations:null,this.topLevelState=new Ai(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(Q.getClass(h)){case De:this.initializeTopLevelBeat(h);break;case Gt:this.initializeTopLevelCharacter(h);break;case Di:this.initializeTopLevelFunction(h);break;case Jt: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 k.thrown(new he("Beat "+e+" not found",this.script.pos))}else{let i=this.script.iterator();for(;i.hasNext();){let s=i.next();if(s instanceof De){let n=s;n.name=="_"&&(t=n);break}}if(t==null){let s=this.script.iterator();for(;s.hasNext();){let n=s.next();if(n instanceof De){t=n;break}}}if(t==null)throw k.thrown(new he("No beats found in script",this.script.pos))}this.transitionToBeat(t),this.flush()}save(){let e={},t=[],i=0,s=this.stack;for(;i<s.length;){let l=s[i];++i,t.push(this.serializeScope(l,e))}let n={version:1,stack:t,state:this.serializeState(this.topLevelState),characters:this.serializeCharacters(),nodeStates:this.serializeNodeStates()};return Pe.fields(e).length>0&&(n.insertions=e),n}restore(e){if(e.version!=1)throw k.thrown(new he("Unsupported save version: "+e.version,this.script.pos));this.stack.length=0,this.nodeStates.map.clear(),this.nextScopeId=1,this.nextInsertionId=1,this.restoreState(this.topLevelState,e.state),this.restoreCharacters(e.characters),this.restoreNodeStates(e.nodeStates),this.restoreStack(e.stack,e.insertions)||(this.beatToResume=this.restoreBeatToResume(e.stack))}resume(){if(this.stack.length==0){this.start();return}let e=this.wrapNext(_e(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.finishTrigger=i,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],s=i!=null?i.fields:null;return s!=null?le.getField(this,s,t):null}setCharacterField(e,t,i){let s=this.topLevelCharacters.h[e].fields;le.setField(this,s,t,i)}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 s=[],n=0,l=e.beats;for(;n<l.length;){let r=l[n];++n,s.push(this.serializeBeatReference(r))}i.beats=s}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,s=Pe.field(t,i);if(s==null){if(s={},e.options!=null){let n=[],l=0,r=e.options;for(;l<r.length;){let h=r[l];++l,n.push(this.serializeChoiceOption(h,t))}s.options=n}if(e.origin!=null&&(s.origin=this.serializeNodeReference(e.origin)),e.stack!=null){let n=[],l=0,r=e.stack;for(;l<r.length;){let h=r[l];++l,n.push(this.serializeScope(h,t))}s.stack=n}t[i]=s}return e.id}serializeChoiceOption(e,t){let i={text:e.text};if(e.enabled||(i.disabled=!0),e.tags!=null){let s=[],n=0,l=e.tags;for(;n<l.length;){let r=l[n];++n,s.push(this.serializeTextTag(r))}i.tags=s}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,s=Object.keys(t),n=s.length,l=0;for(;l<n;){let r=s[l++],h=r,a=i[r],o=h,c=a,p=this.serializeCharacter(c);Pe.fields(p.fields).length>0&&(e[o]=p)}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 s=t._keys1[i],n=t._keys2[i],l=t._values[i];for(++i;i<t._values.length&&t._values[i]==null;)++i;let r=Me.fromTwoInt32(s,n),h=l,a=r,o=h,c=this.serializeState(o);Pe.fields(c.fields).length>0&&(e[a.toString()]=c)}return e}serializeBeatReference(e){let t=e.name,i=e;do i=this.lens.getFirstParentOfType(i,De),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,s={};if(Q.__implements(e,Ei)){let n=Q.getClass(e);n!=null&&(i=n.__name__);let l=e,r=0,h=l.lorelineFields(this);for(;r<h.length;){let a=h[r];++r,s[a]=this.serializeValue(l.lorelineGet(this,a))}}else if(e instanceof me){let n=e,l=n.h,r=l,h=Object.keys(l),a=h.length,o=0;for(;o<a;){let c=h[o++],p=n.h[c];(t==null||!le.fieldExists(this,t,c)||!Ci.equal(this,le.getField(this,t,c),p))&&(s[c]=this.serializeValue(p))}}else{let n=Q.getClass(e);n!=null&&(i=n.__name__);let l=0,r=Pe.fields(e);for(;l<r.length;){let h=r[l];++l;let a=Pe.getProperty(e,h);(t==null||!le.fieldExists(this,t,h)||!Ci.equal(this,le.getField(this,t,h),a))&&(s[h]=this.serializeValue(a))}}return i!=null?{type:i,fields:s}:{fields:s}}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(ee.isArray(e)){let t=[],i=ee.arrayLength(e),s=0,n=i;for(;s<n;){let l=s++;t.push(this.serializeValue(ee.arrayGet(e,l)))}return t}return this.serializeFields(e)}resumeNode(e,t,i){let s=this.stack.length-1;if(t>=this.stack.length)switch(Q.getClass(e)){case Vi:this.evalAlternative(e,i);break;case Vt:if(!this.isBeatCall(e))this.evalCall(e,i);else{let r=Q.getClass(e);throw k.thrown(new he("Resume execution not supported from last node: "+r.__name__,e.pos))}break;case fi:this.evalChoice(e,i);break;case hi:this.evalDialogue(e,i);break;case oi:this.evalText(e,i);break;default:let l=Q.getClass(e);throw k.thrown(new he("Resume execution not supported from last node: "+l.__name__,e.pos))}else switch(Q.getClass(e)){case Vi:this.resumeAlternative(e,t,i);break;case De:this.resumeBeatRun(e,t,i);break;case Vt:if(this.isBeatCall(e,t))this.resumeCall(e,t,i);else{let r=Q.getClass(e);throw k.thrown(new he("Resume execution not supported from node within stack: "+r.__name__,e.pos))}break;case Ot:this.resumeChoiceOption(e,t,i);break;case fi:this.resumeChoice(e,t,i);break;case gi:this.resumeIf(e,t,i);break;default:let l=Q.getClass(e);throw k.thrown(new he("Resume execution not supported from node within stack: "+l.__name__,e.pos))}}resumeNodeBody(e,t,i,s){let n=this.stack[t],l=0,r=-1;if(n.head==null&&t<this.stack.length-1)throw k.thrown(new he("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&&(l=i.indexOf(n.head),r=l,l==-1))throw k.thrown(new he("Failed to resolve head in scope when resuming through body",e.pos));let h=null,a=this;h=function(){if(l!=-1&&l==r){let o=i[l];l+=1;let c=a.wrapNext(h);a.resumeNode(o,t+1,c.cb),c.sync=!1}else if(l<i.length){let o=i[l];n.head=o,l+=1;let c=a.wrapNext(h);a.evalNode(o,c.cb),c.sync=!1}else a.pop(),s()},h()}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 s=this.stack[t];if(s.head==null)this.evalChoice(e,i);else if(s.head instanceof Ot){let n=s.head;this.evalNodeBody(s.beat,n,n.body,null,i)}else if(s.insertion!=null){for(;this.stack.length>t;)this.pop();this.evalChoice(e,i)}else throw k.thrown(new he("Choice head is not a choice option",s.head.pos))}resumeIf(e,t,i){let s=this.stack[t];if(s.head==null)throw k.thrown(new he("Failed to resolve head in scope when resuming through condition",e.pos));let l=e.thenBranch.body.indexOf(s.head)!=-1?e.thenBranch:e.elseBranch;if(l!=null&&l.body.length>0)this.resumeNodeBody(l,t,l.body,i);else throw k.thrown(new he("Failed to resume condition: invalid scope",e.pos))}resumeAlternative(e,t,i){let s=this.stack[t];if(s.head==null)throw k.thrown(new he("Failed to resolve head when resuming alternative",e.pos));let n=0,l=e.items;for(;n<l.length;){let r=l[n];if(++n,r.body.indexOf(s.head)!=-1){this.resumeNodeBody(r,t,r.body,i);return}}throw k.thrown(new he("Failed to resume alternative: head not found in any item",e.pos))}resumeCall(e,t,i){if(e.target instanceof lt){let s=e.target;if(s.target==null){let n=s.name,l=null,r=this.stack.length-1;for(;r>=0;){let a=this.stack[r].beatByName(n);if(a!=null){l=a;break}--r}if(l==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,n)&&(l=this.topLevelBeats.h[n]),l!=null){this.resumeBeatRun(l,t,i);return}}}throw k.thrown(new he("Cannot resume through a function call that is not at the bottom of the stack",e.pos))}restoreStack(e,t){let i=[],s=new Ri,n=e.length-1;for(;n>=0;){let l=this.restoreScopeItem(e[n],t,s);if(l==null)return!1;i.push(l),--n}for(n=i.length-1;n>=0;)this.push(i[n]),--n;return!0}restoreScopeItem(e,t,i){let s=this.restoreBeat(e.beat);if(s==null)return null;let n=Me.fromString(e.beat.id),l=e.node,r=l!=null?this.restoreNode(l,n,s):null;if(l!=null&&r==null)return null;let h=[];if(e.beats!=null){let _=0,d=e.beats;for(;_<d.length;){let x=d[_];++_;let y=this.restoreBeat(x);if(y==null)return null;h.push(y)}}let o=e.state!=null?this.restoreState(null,e.state):null,c=e.head,p=c!=null?this.restoreNode(c,n,s):null;if(c!=null&&p==null)return null;let f=null;return e.insertion!=null&&t!=null&&(f=this.restoreInsertion(e.insertion,t,i)),new hs(null,s,r,h,o,p,f)}restoreInsertion(e,t,i){if(i.h.hasOwnProperty(e))return i.h[e];let s=e==null?"null":""+e,n=Pe.field(t,s);if(n==null)return null;let l=null;if(n.origin!=null){let h=Me.fromString(n.origin.id),a=this.lens.getNodeById(h);a!=null&&a.type()==n.origin.type&&(l=a)}let r=new fs(e,l);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 c=this.restoreChoiceOption(o,t,i);c!=null&&r.options.push(c)}}if(n.stack!=null){r.stack=[];let h=0,a=n.stack;for(;h<a.length;){let o=a[h];++h;let c=this.restoreScopeItem(o,t,i);c!=null&&r.stack.push(c)}}return r}restoreChoiceOption(e,t,i){let s=null;if(e.node!=null){let r=Me.fromString(e.node.id),h=this.lens.getNodeById(r);h!=null&&h.type()==e.node.type&&(s=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 ms(o.closing==!0,o.value,o.offset))}n=r}let l=null;return e.insertion!=null&&t!=null&&(l=this.restoreInsertion(e.insertion,t,i)),new gs(e.text,n,e.disabled!=!0,s,l)}restoreBeatToResume(e){let t=null;if(e.length>0){let i=e[0];if(t=this.restoreBeat(i.beat),t!=null){let s=t;do s=this.lens.getFirstParentOfType(s,De),s!=null&&(t=s);while(s!=null)}}return t}restoreNode(e,t,i){let s=i.id.thisVal.high>>16&65535,n=t.thisVal.high>>16&65535,l=(s>=32768?s-65536:s)+32768-((n>=32768?n-65536:n)+32768),r=Me.fromString(e.id);if(r==t)return i;let h=r.thisVal.high>>16&65535,o=(h>=32768?h-65536:h)+32768+l-32768;o<0&&(o=o+65536&65535),r.thisVal=new Li(r.thisVal.high&65535|o<<16,r.thisVal.low);let c=this.lens.getNodeById(r);return c!=null&&c.type()==e.type?c:null}restoreBeat(e){return this.lens.findBeatByPathFromNode(e.path,this.script)}restoreState(e,t){let i=e!=null?e.fields:null,s=this.restoreFields(i??null,t);return e==null&&(e=new Ai(this,null,s,null)),e}restoreCharacters(e){let t=0,i=Pe.fields(e);for(;t<i.length;){let s=i[t];++t;let n=Pe.field(e,s);if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,s))this.restoreCharacter(this.topLevelCharacters.h[s],n);else{let l=this.restoreCharacter(null,n);this.topLevelCharacters.h[s]=l}}}restoreNodeStates(e){let t=0,i=Pe.fields(e);for(;t<i.length;){let s=i[t];++t;let n=Me.fromString(s),l=Pe.field(e,s),r=this.restoreState(null,l),h=n.thisVal;this.nodeStates.map._set(h.high,h.low,r)}}restoreCharacter(e,t){let i=e!=null?e.fields:null,s=this.restoreFields(i??null,t);return e==null&&(e=new rs(this,null,s,null)),e}restoreFields(e,t){if(t==null||t.fields==null)return e;e==null&&(e=le.createFields(this,t.type));let i=t.fields;if(le.isFields(e)){let s=0,n=Pe.fields(i);for(;s<n.length;){let l=n[s];++s,le.setField(this,e,l,this.restoreValue(Pe.field(i,l)))}}else{let s=0,n=Pe.fields(i);for(;s<n.length;){let l=n[s];++s,e[l]=this.restoreValue(Pe.field(i,l))}}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(ee.isArray(e)){let t=ee.arrayLength(e),i=ee.createArray(),s=0,n=t;for(;s<n;){let l=s++;ee.arrayPush(i,this.restoreValue(ee.arrayGet(e,l)))}return i}return this.restoreFields(null,e)}initializeTopLevelFunctions(e){if(this.builtins=new Os(this),this.builtins.bindAll(this.topLevelFunctions),e!=null){let r=e,h=r,a=Pe.fields(r),o=0;for(;o<a.length;){let c=a[o++],p=h[c],_=c,d=p;this.topLevelFunctions.h[_]=d}}let t=this.topLevelFunctions.h,i=t,s=Object.keys(t),n=s.length,l=0;for(;l<n;){let r=s[l++],h=r,a=i[r],o=h,c=a;o.startsWith("string_")?this.stringHelpers.h[u.substr(o,7,null)]=c:o.startsWith("array_")?this.arrayHelpers.h[u.substr(o,6,null)]=c:o.startsWith("map_")&&(this.mapHelpers.h[u.substr(o,4,null)]=c)}}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 s=e[i];++i,this.stringLiteralProcessors.push(s)}}}initializeTopLevelFunction(e){if(e.name!=null){if(!e.external||!Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,e.name)){let t=new qi;try{let i=t.process(e.code+(e.external?" {}":"")),s=new Yi;s.allowJSON=!0,s.allowTypes=!0;let n=s.parseString(i),r=new Ns(this).execute(n);this.topLevelFunctions.h[e.name]=r}catch(i){let s=k.caught(i).unwrap();throw k.thrown(new he("Failed to parse function code: "+(s==null?"null":Z.string(s)),e.pos))}}}else throw k.thrown(new he("Top level function must have a name",e.pos))}wrapNext(e){let t=new Ds;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=k.caught(e).unwrap();throw this.flushing=!1,k.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 k.thrown(new he("Top level temporary states are not allowed",e.pos));let t=0,i=e.fields;for(;t<i.length;){let s=i[t];++t;let n=this.evaluateExpression(s.value);le.setField(this,this.topLevelState.fields,s.name,n),this.isOriginalScriptExpression(s.value)&&le.setField(this,this.topLevelState.originalFields,s.name,n)}}initializeTopLevelBeat(e){if(Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,e.name))throw k.thrown(new he("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 k.thrown(new he("Duplicate top level character: "+e.name,e.pos));let t=new rs(this,e,null,null);this.topLevelCharacters.h[e.name]=t;let i=0,s=e.fields;for(;i<s.length;){let n=s[i];++i;let l=this.evaluateExpression(n.value);le.setField(this,t.fields,n.name,l),this.isOriginalScriptExpression(n.value)&&le.setField(this,t.originalFields,n.name,l)}}initializeState(e,t){let i=null;if(e.temporary)t.state==null&&(t.state=new Ai(this,e,null,null)),i=t.state;else{let l=t.node.id.thisVal;if(i=this.nodeStates.map._get(l.high,l.low),i==null){i=new Ai(this,e,null,null);let r=t.node.id.thisVal;this.nodeStates.map._set(r.high,r.low,i)}}let s=0,n=e.fields;for(;s<n.length;){let l=n[s];if(++s,!le.fieldExists(this,i.fields,l.name)){let r=this.evaluateExpression(l.value);le.setField(this,i.fields,l.name,r),!e.temporary&&this.isOriginalScriptExpression(l.value)&&le.setField(this,i.originalFields,l.name,r)}}}finish(){this.finishTrigger=null,this.handleFinish!=null&&this.handleFinish(this)}transitionToBeat(e){for(;this.pop(););this.nextScopeId=1,this.nextInsertionId=1;let t=this.wrapNext(_e(this,this.finish));this.finishTrigger=t,this.evalBeatRun(e,t.cb),t.sync=!1}evalNode(e,t){switch(Q.getClass(e)){case Vi:this.evalAlternative(e,t);break;case di:this.evalAssignment(e,t);break;case De:this.evalBeatDecl(e,t);break;case Vt:this.evalCall(e,t);break;case Ot:this.evalChoiceOption(e,t);break;case fi:this.evalChoice(e,t);break;case hi:this.evalDialogue(e,t);break;case gi:this.evalIf(e,t);break;case Jt:this.evalStateDecl(e,t);break;case oi:this.evalText(e,t);break;case Ni:this.evalTransition(e);break;default:let i=Q.getClass(e);throw k.thrown(new he("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 k.thrown(new he("Duplicate beat with name: "+e.name,e.pos));this.get_currentScope().beats.push(e),t()}evalNodeBody(e,t,i,s,n){this.push(new hs(null,e,t,null,null,null,s));let l=0,r=null,h=this.get_currentInsertion(),a=this;r=function(){if((h!=null?h.options:null)!=null)a.pop(),n();else if(l<i.length){let o=i[l];a.get_currentScope().head=o,l+=1;let c=a.wrapNext(r);a.evalNode(o,c.cb),c.sync=!1}else a.pop(),n()},r()}evalBeatRun(e,t){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),s=this.evaluateString(i);this.handleDialogue(this,null,s.text,s.tags,t)}evalDialogue(e,t){if(e.condition!=null&&!this.evaluateCondition(e.condition)){t();return}let i=this.getTranslatedString(e,e.content),s=this.evaluateString(i);this.handleDialogue(this,e.character,s.text,s.tags,t)}evalChoice(e,t){let i=[],s=this,n=this.wrapNext(function(){let l=s.get_currentInsertion();if(l!=null&&l.options==null){l.stack=[].concat(s.stack),l.options=i,t();return}let r=-1,h=s.wrapNext(function(){if(r>=0&&r<i.length){let a=i[r];if(a.insertion!=null){let o=s.stack.length;for(;s.stack.length>0;)s.stack.pop();let c=0,p=a.insertion.stack;for(;c<p.length;){let _=p[c];++c,_.insertion==a.insertion&&(_.insertion=null),s.stack.push(_)}let f=s.stack[s.stack.length-1];s.push(new hs(null,f.beat,s.lens.getParentNode(a.node),null,null,a.node,null)),s.resumeFromLevel(o,t)}else s.evalChoiceOption(a.node,t)}else t()});s.handleChoice(s,i,function(a){r=a,h.cb()}),h.sync=!1});this.evalChoiceOptionsAndInsertions(this.get_currentScope().beat,e,i,n.cb),n.sync=!1}evalChoiceOptionsAndInsertions(e,t,i,s){let n=t.options,l=0,r=null,h=null,a=this;r=function(){if(h!=null&&h.options!=null){let o=0,c=h.options.length;for(;o<c;){let p=o++,f=h.options[p];i.push(f)}h=null}if(l<n.length){let o=n[l];l+=1;let c=o.condition==null||a.evaluateCondition(o.condition);if(o.text!=null){let p=a.wrapNext(r),f=a.getTranslatedString(o,o.text),_=a.evaluateString(f);i.push(new gs(_.text,_.tags,c,o,a.get_currentInsertion())),p.cb(),p.sync=!1}else if(o.insertion!=null){let p=a.wrapNext(r);h=new fs(a.nextInsertionId++,o.insertion),a.evalInsertion(h,p.cb),p.sync=!1}else throw k.thrown(new he("Invalid choice option",o.pos))}else s()},r()}evalInsertion(e,t){let i=e.origin.target,s=null,n=this.stack.length-1;for(;n>=0;){let r=this.stack[n].beatByName(i);if(r!=null){s=r;break}--n}if(s==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,i)&&(s=this.topLevelBeats.h[i]),s==null)throw k.thrown(new he("Beat "+i+" not found",this.script.pos));this.evalNodeBody(s,s,s.body,e,t)}evalChoiceOption(e,t){this.evalNodeBody(this.get_currentScope().beat,e,e.body,null,t)}evalIf(e,t){let s=this.evaluateCondition(e.condition)?e.thenBranch:e.elseBranch;s!=null&&s.body.length>0?this.evalNodeBody(this.get_currentScope().beat,s,s.body,null,t):t()}evalAlternative(e,t){if(e.items.length==0){t();return}switch(e.mode){case 0:let i=this.getAlternativeVisitCount(e),s=i<e.items.length?i:e.items.length-1;this.setAlternativeVisitCount(e,i+1);let n=e.items[s];this.evalNodeBody(this.get_currentScope().beat,n,n.body,null,t);break;case 1:let l=this.getAlternativeVisitCount(e),r=l%e.items.length;this.setAlternativeVisitCount(e,l+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 c=this.builtins.random(0,e.items.length-1),p=e.items[c];this.evalNodeBody(this.get_currentScope().beat,p,p.body,null,t);break;case 4:let f=[],_=0,d=e.items.length;for(;_<d;){let b=_++;f.push(b)}let x=f,y=x.length-1;for(;y>0;){let b=this.builtins.random(0,y),v=x[y];x[y]=x[b],x[b]=v,--y}this.evalShuffledItems(e,x,0,t);break}}evalShuffledItems(e,t,i,s){if(i>=t.length){s();return}let n=e.items[t[i]],l=this;this.evalNodeBody(this.get_currentScope().beat,n,n.body,null,function(){l.evalShuffledItems(e,t,i+1,s)})}getAlternativeVisitCount(e){let t=e.id.thisVal,i=this.nodeStates.map._get(t.high,t.low);if(i==null)return 0;let s=le.getField(this,i.fields,"_visitCount");return s??0}setAlternativeVisitCount(e,t){let i=e.id.thisVal,s=this.nodeStates.map._get(i.high,i.low);if(s==null){s=new Ai(this,e,null,null);let n=e.id.thisVal;this.nodeStates.map._set(n.high,n.low,s)}le.setField(this,s.fields,"_visitCount",t)}evalAssignment(e,t){let i=this.resolveAssignmentTarget(e.target),s=this.evaluateExpression(e.value),n;switch(e.op._hx_index){case 20:n=s;break;case 21:n=this.performOperation(g.OpPlus,this.readAccess(i),s,e.pos);break;case 22:n=this.performOperation(g.OpMinus,this.readAccess(i),s,e.pos);break;case 23:n=this.performOperation(g.OpMultiply,this.readAccess(i),s,e.pos);break;case 24:n=this.performOperation(g.OpDivide,this.readAccess(i),s,e.pos);break;default:throw k.thrown(new he("Invalid assignment operator",e.pos))}this.writeAccess(i,n),t()}isOriginalScriptExpression(e){switch(Q.getClass(e)){case Xt:let t=e;return this.isOriginalScriptExpression(t.left)?this.isOriginalScriptExpression(t.right):!1;case lt:case ui:case Vt:return!1;case Oe:let i=e,s=i.literalType;switch(s._hx_index){case 0:case 1:case 2:return!0;case 3:let a=i.value,o=0;for(;o<a.length;){let _=a[o];if(++o,_ instanceof nt&&!this.isOriginalScriptExpression(_))return!1}return!0;case 4:let c=s.style,p=i.value,f=0;for(;f<p.length;){let _=p[f];if(++f,!this.isOriginalScriptExpression(_.value))return!1}return!0}break;case Tt:let n=e,l=0,r=n.parts;for(;l<r.length;){let a=r[l];++l;let o=a.partType;switch(o._hx_index){case 0:let c=o.text;continue;case 1:let p=o.expr;return!1;case 2:let f=o.closing,_=o.expr;if(!this.isOriginalScriptExpression(_))return!1;break}}return!0;case Hi:let h=e;return this.isOriginalScriptExpression(h.operand)}return!1}isBeatCall(e,t){return t==null&&(t=-1),e instanceof Vt?this.resolveBeatFromCall(e,t)!=null:!1}resolveBeatFromCall(e,t){if(t==null&&(t=-1),e.target instanceof lt){let i=e.target;if(i.target==null){let s=i.name,n=null,l=t==-1?this.stack.length-1:t;for(;l>=0;){let h=this.stack[l].beatByName(s);if(h!=null){n=h;break}--l}if(n==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,s)&&(n=this.topLevelBeats.h[s]),n!=null)return n}}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,s=this.stack.length-1;for(;s>=0;){let l=this.stack[s].beatByName(t);if(l!=null){i=l;break}--s}if(i==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,t)&&(i=this.topLevelBeats.h[t]),i==null)throw k.thrown(new he("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 s=this.translations.h[i];if(s!=null)return s}}return t}findHashCommentId(e,t){return It.findHashComment(e,t)}evaluateString(e){let t=0,i=this.stringLiteralProcessors.length;for(;t<i;){let _=t++;e=this.stringLiteralProcessors[_](e)}let s="",n=[],l=0,r=e.parts.length,h=e.quotes!=0,a=e.quotes!=0,o=e.quotes!=0,c=-1;if(!h){let _=r-1;e:for(;_>=0;){let x=e.parts[_].partType;switch(x._hx_index){case 0:let y=x.text;c=_;break e;case 1:let b=x.expr;break e;case 2:let v=x.closing,T=x.expr;--_;break}}}let p=0,f=r;for(;p<f;){let _=p++,x=e.parts[_].partType;switch(x._hx_index){case 0:let y=x.text;h||(y=Te.ltrim(y)),_==c&&(y=Te.rtrim(y)),o||(y=this.stripStringComments(y)),a||(y=this.stripStringIndent(y));let b=y.length;b>0&&(h=!0);let v=!1,T=!1,E=!1,F=0,L=b;for(;F<L;){let P=F++,M=u.cca(y,P);E?(M==110?s+=String.fromCodePoint(10):M==114?s+=String.fromCodePoint(13):M==116?s+=String.fromCodePoint(9):s+=String.fromCodePoint(M),E=!1,v=!1,T=!1):M==92?(E=!0,v=!1,T=!1):M==36?(v?(s+=String.fromCodePoint(M),v=!1):v=!0,T=!1):M==35?(T?(s+=String.fromCodePoint(M),T=!1):T=!0,v=!1):(T&&(s+=String.fromCodePoint(35),T=!1),s+=String.fromCodePoint(M))}T&&(s+=String.fromCodePoint(35)),l+=b;break;case 1:let A=x.expr;if(h=!0,A instanceof lt){let P=A,M=this.resolveAccess(P,P.target,P.name);if(M._hx_index==2){let V=M.pos,R=M.name,Y=this.evaluateExpression(A),$=le.getField(this,Y,"name"),te=$??R,O=this.valueToString(te);l+=O.length,s+=O==null?"null":""+O}else{let V=this.evaluateExpression(A),R=this.valueToString(V);l+=R.length,s+=R==null?"null":""+R}}else{let P=this.evaluateExpression(A),M=this.valueToString(P);l+=M.length,s+=M==null?"null":""+M}break;case 2:let B=x.closing,I=x.expr,H=this.evaluateString(I).text;n.push(new ms(B,H,l));break}}return{text:s,tags:n}}pluralPipeProcess(e){let t=-1,i=!1,s=null,n=0,l=e.parts.length;for(;n<l;){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 _,d=e.parts[t].partType;if(d._hx_index==1?_=d.expr:_=null,_!=null){if(!i){let x=[],y=0,b=r;for(;y<b;){let v=y++;x.push(e.parts[v])}s=x,i=!0}this.transformPipeRaw(o,_,h.pos,s);continue}}break;case 1:let c=a.expr;t=r;break;case 2:let p=a.closing,f=a.expr;break}i&&s.push(h)}return i?new Tt(e.id,e.pos,e.quotes,s):e}rawTextHasUnescapedPipe(e){let t=e.length,i=0;for(;i<t;){let s=u.cca(e,i);if(s==92){i+=2;continue}if(s==124)return!0;++i}return!1}transformPipeRaw(e,t,i,s){let n=e.length,l=0,r=0;for(;l<n;){let h=u.cca(e,l);if(h==92&&l+1<n){l+=2;continue}if(h==40){let a=-1,o=-1,c=l+1;for(;c<n;){let p=u.cca(e,c);if(p==92&&c+1<n){c+=2;continue}if(p==124&&a==-1)a=c;else if(p==41){o=c;break}++c}if(a!=-1&&o!=-1&&a>l+1&&o>a+1){let p=l+1,f=a-l-1,_=f!=null?u.substr(e,p,f):u.substr(e,p,null),d=a+1,x=o-a-1,y=x!=null?u.substr(e,d,x):u.substr(e,d,null);if(l>r){let b=l-r;s.push(new je(Me.UNDEFINED,i,Le.Raw(b!=null?u.substr(e,r,b):u.substr(e,r,null))))}s.push(new je(Me.UNDEFINED,i,Le.Expr(this.makePluralCall(t,_,y,i)))),l=o+1,r=l;continue}}if(h==124){let a=l;for(;a>r;){let x=u.cca(e,a-1);if(x==32||x==9||x==10||x==124||x==40||x==41)break;--a}let o=l+1;for(;o<n;){let x=u.cca(e,o);if(x==32||x==9||x==10||x==124||x==40||x==41)break;++o}let c=l-a,p=c!=null?u.substr(e,a,c):u.substr(e,a,null),f=l+1,_=o-l-1,d=_!=null?u.substr(e,f,_):u.substr(e,f,null);if(p.length>0&&d.length>0){if(a>r){let x=a-r;s.push(new je(Me.UNDEFINED,i,Le.Raw(x!=null?u.substr(e,r,x):u.substr(e,r,null))))}s.push(new je(Me.UNDEFINED,i,Le.Expr(this.makePluralCall(t,p,d,i)))),l=o,r=l;continue}}++l}if(r<n){let h=n-r;s.push(new je(Me.UNDEFINED,i,Le.Raw(h!=null?u.substr(e,r,h):u.substr(e,r,null))))}}makePluralCall(e,t,i,s){let n=new lt(Me.UNDEFINED,s,null,"plural"),l=new Tt(Me.UNDEFINED,s,1,[new je(Me.UNDEFINED,s,Le.Raw(t))]),r=new Tt(Me.UNDEFINED,s,1,[new je(Me.UNDEFINED,s,Le.Raw(i))]);return new Vt(Me.UNDEFINED,s,n,[e,l,r])}stripStringIndent(e){let t=-1,i=-1,s=e.length,n=0;for(;u.cca(e,n)==32&&n<s;)++n;for(n>0&&(t=n);n<s;){let l=u.cca(e,n);l==10?i=0:i>=0&&l==32?++i:i>=0&&((t==-1||t>i)&&(t=i),i=-1),++n}if(t>0){let l="",r=0,h=t;for(;r<h;){let a=r++;l+=String.fromCodePoint(32)}e=Te.replace(e,`
|
|
35
|
-
|
|
36
|
-
`)}return e}stripStringComments(e){let t="",i=e.length,s=0;for(;s<i;){let n=u.cca(e,s);if(n==47&&s+1<i&&u.cca(e,s+1)==47){for(;s<i&&u.cca(e,s)!=10;)++s;continue}if(n==47&&s+1<i&&u.cca(e,s+1)==42){let l=s>0&&u.cca(e,s-1)==32;for(s+=2;s+1<i&&!(u.cca(e,s)==42&&u.cca(e,s+1)==47);)++s;s+=2;let r=s<i&&u.cca(e,s)==32;l&&r&&++s,!l&&!r&&s<i&&(t+=String.fromCodePoint(32));continue}t+=String.fromCodePoint(n),++s}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 lt){let n=e.target;if(n.target==null){let l=this.evaluateExpression(e.target);if(l!=null&&Pe.isFunction(l)){let r=[],h=0,a=e.args;for(;h<a.length;){let c=a[h];++h,r.push(this.evaluateExpression(c))}let o=r;try{let c=l.apply(null,o);if(c!=null&&c instanceof Xi){if(t==null)throw k.thrown(new he("Cannot call async function in expression",e.pos));c.func(t)}else t?.();return c}catch(c){let p=k.caught(c).unwrap();if(p instanceof ce){let f=p;throw k.thrown(new he("Error when evaluating function ("+f.pmin+"-"+f.pmax+"): "+Z.string(f.e),e.pos))}throw k.thrown(new he("Error when calling function: "+Z.string(p),e.pos))}}}else{let l=this.evaluateExpression(n.target),r=null;if(typeof l=="string"?r=le.getStringHelper(this,n.name):ee.isArray(l)?r=le.getArrayHelper(this,n.name):le.isFields(l)&&(r=le.getMapHelper(this,n.name)),r!=null&&Pe.isFunction(r)){let h=[],a=0,o=e.args;for(;a<o.length;){let f=o[a];++a,h.push(this.evaluateExpression(f))}let c=h;c.splice(0,0,l);let p=r.apply(null,c);if(p!=null&&p instanceof Xi){if(t==null)throw k.thrown(new he("Cannot call async function in expression",e.pos));p.func(t)}else t?.();return p}else if(r==null&&!(typeof l=="string"||ee.isArray(l)||le.isFields(l))){let h=Pe.getProperty(l,n.name);if(Pe.isFunction(h)){let a=[],o=0,c=e.args;for(;o<c.length;){let _=c[o];++o,a.push(this.evaluateExpression(_))}let p=a,f=h.apply(l,p);if(f!=null&&f instanceof Xi){if(t==null)throw k.thrown(new he("Cannot call async function in expression",e.pos));f.func(t)}else t?.();return f}}}}let i=this.printLoreline(e.target),s;throw i!=null?s=i:s=Q.getClass(e.target).__name__,k.thrown(new he("Invalid call target: "+s,e.pos))}evaluateArrayLiteral(e){let t=[],i=0;for(;i<e.length;){let s=e[i];++i,t.push(this.evaluateExpression(s))}return t}evaluateObjectLiteral(e){let t=new me,i=0;for(;i<e.length;){let s=e[i];++i;let n=s.name,l=this.evaluateExpression(s.value);t.h[n]=l}return t}evaluateExpression(e){switch(Q.getClass(e)){case lt:let t=e,i=this.resolveAccess(t,t.target,t.name);return this.readAccess(i);case ui:let s=e,n=this.evaluateExpression(s.target),l=this.evaluateExpression(s.index);if(ee.isArray(n)&&(typeof l=="number"&&(l|0)===l||typeof l=="number")){let x=l|0;if(x<0||x>=ee.arrayLength(n))throw k.thrown(new he("Array index out of bounds: "+x,s.pos));return ee.arrayGet(n,x)}else if(typeof l=="string"){if(n==null)throw k.thrown(new he("Cannot access field '"+(l==null?"null":Z.string(l))+"' of null",s.pos));return le.getField(this,n,l)}else throw k.thrown(new he("Invalid array access",s.pos));break;case Xt:let r=e,h=this.evaluateExpression(r.left),a=this.evaluateExpression(r.right);return this.performOperation(r.op,h,a,r.pos);case Vt:return this.evaluateFunctionCall(e,null);case Oe:let o=e,c=o.literalType;switch(c._hx_index){case 0:case 1:case 2:return o.value;case 3:return this.evaluateArrayLiteral(o.value);case 4:let x=c.style;return this.evaluateObjectLiteral(o.value)}break;case Tt:let p=e;if(p.parts.length==1&&p.quotes==0){let x=p.parts[0].partType;if(x._hx_index==1){let y=x.expr;return this.evaluateExpression(y)}else return this.evaluateString(p).text}else return this.evaluateString(p).text;break;case Hi:let f=e,_=this.evaluateExpression(f.operand);switch(f.op._hx_index){case 26:if(typeof _=="number"&&(_|0)===_)return-_;if(typeof _=="number")return-_;throw k.thrown(new he("Invalid unary operation",f.pos));break;case 38:if(typeof _=="boolean")return!_;if(typeof _=="string"){let x=_;return x!=null?x.length==0:!0}else if(_ instanceof Array){let x=_;return x!=null?x.length==0:!0}else return typeof _=="number"&&(_|0)===_||typeof _=="number"?_==0:_==null;break;default:throw k.thrown(new he("Invalid unary operation",f.pos))}break;default:let d=Q.getClass(e);throw k.thrown(new he("Unsupported expression type: "+d.__name__,e.pos))}}readAccess(e){switch(e._hx_index){case 0:let t=e.pos,i=e.obj,s=e.name;if(i==null)throw k.thrown(new he("Cannot read field '"+s+"' of null",t));return le.getField(this,i,s);case 1:let n=e.pos,l=e.array,r=e.index;return ee.arrayGet(l,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 k.thrown(new he("Character not found: "+a,h));case 3:let o=e.pos,c=e.name;if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,c))return this.topLevelFunctions.h[c];throw k.thrown(new he("Function not found: "+c,o))}}writeAccess(e,t){switch(e._hx_index){case 0:let i=e.pos,s=e.obj,n=e.name;if(s==null)throw k.thrown(new he("Cannot set field '"+n+"' of null",i));le.setField(this,s,n,t);break;case 1:let l=e.pos,r=e.array,h=e.index;ee.arraySet(r,h,t);break;case 2:let a=e.pos,o=e.name;throw k.thrown(new he("Cannot overwrite character: "+o,a));case 3:let c=e.pos,p=e.name;throw k.thrown(new he("Cannot overwrite function: "+p,c))}}resolveAssignmentTarget(e){switch(Q.getClass(e)){case lt:let t=e;return this.resolveAccess(t,t.target,t.name);case ui:let i=e,s=this.evaluateExpression(i.target),n=this.evaluateExpression(i.index);if(ee.isArray(s)&&(typeof n=="number"&&(n|0)===n||typeof n=="number")){let l=n|0;return vi.ArrayAccess(i.pos,s,l)}else throw k.thrown(new he("Invalid array access target",i.pos));break;default:throw k.thrown(new he("Invalid assignment target",e.pos))}}resolveAccess(e,t,i){if(t!=null){let r=this.evaluateExpression(t);if(r==null){let h=Q.getClass(t)==lt?t.name:null;throw k.thrown(new he(h!=null?"Cannot access field '"+i+"' of undefined variable '"+h+"'":"Cannot access field '"+i+"' of null value",t.pos))}return vi.FieldAccess(t.pos,r,i)}let s=this.stack.length-1;for(;s>=0;){let r=this.stack[s];if(r.state!=null&&le.fieldExists(this,r.state.fields,i)){let h=e!=null?e.pos:null,a;if(h!=null)a=h;else{let o=this.get_currentScope(),c=o!=null?o.node:null;a=c!=null?c.pos:null}return vi.FieldAccess(a??this.script.pos,r.state.fields,i)}if(r.node!=null){let h=r.node.id.thisVal,a=this.nodeStates.map._get(h.high,h.low);if(a!=null&&le.fieldExists(this,a.fields,i)){let o=e!=null?e.pos:null,c;if(o!=null)c=o;else{let p=this.get_currentScope(),f=p!=null?p.node:null;c=f!=null?f.pos:null}return vi.FieldAccess(c??this.script.pos,a.fields,i)}}--s}if(le.fieldExists(this,this.topLevelState.fields,i)){let r=e!=null?e.pos:null,h;if(r!=null)h=r;else{let a=this.get_currentScope(),o=a!=null?a.node:null;h=o!=null?o.pos:null}return vi.FieldAccess(h??this.script.pos,this.topLevelState.fields,i)}if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,i)){let r=e!=null?e.pos:null,h;if(r!=null)h=r;else{let a=this.get_currentScope(),o=a!=null?a.node:null;h=o!=null?o.pos:null}return vi.CharacterAccess(h??this.script.pos,i)}if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,i)){let r=e!=null?e.pos:null,h;if(r!=null)h=r;else{let a=this.get_currentScope(),o=a!=null?a.node:null;h=o!=null?o.pos:null}return vi.FunctionAccess(h??this.script.pos,i)}if(!this.strictAccess){let r=e!=null?e.pos:null,h;if(r!=null)h=r;else{let a=this.get_currentScope(),o=a!=null?a.node:null;h=o!=null?o.pos:null}return vi.FieldAccess(h??this.script.pos,this.topLevelState.fields,i)}let n=e!=null?e.pos:null,l;if(n!=null)l=n;else{let r=this.get_currentScope(),h=r!=null?r.node:null;l=h!=null?h.pos:null}throw k.thrown(new he("Undefined variable: "+i,l??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,s){let n=re.typeof(t),l=re.typeof(i);switch(e._hx_index){case 25:switch(n._hx_index){case 1:switch(l._hx_index){case 1:case 2:return parseFloat(Z.string(t))+parseFloat(Z.string(i));case 6:if(l.c==String)return Z.string(t)+Z.string(i);{let d="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(l),x=s,y;if(x!=null)y=x;else{let b=this.get_currentScope(),v=b!=null?b.node:null;y=v!=null?v.pos:null}throw k.thrown(new he(d,y??this.script.pos))}break;default:let p="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}break;case 2:switch(l._hx_index){case 1:case 2:return parseFloat(Z.string(t))+parseFloat(Z.string(i));case 6:if(l.c==String)return Z.string(t)+Z.string(i);{let d="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(l),x=s,y;if(x!=null)y=x;else{let b=this.get_currentScope(),v=b!=null?b.node:null;y=v!=null?v.pos:null}throw k.thrown(new he(d,y??this.script.pos))}break;default:let p="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}break;case 6:if(n.c==String)return Z.string(t)+Z.string(i);if(l._hx_index==6){if(l.c==String)return Z.string(t)+Z.string(i);{let p="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}}else{let p="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}break;default:if(l._hx_index==6){if(l.c==String)return Z.string(t)+Z.string(i);{let p="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}}else{let p="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}}break;case 26:case 27:case 28:case 29:switch(n._hx_index){case 1:case 2:switch(l._hx_index){case 1:case 2:let x=parseFloat(Z.string(t)),y=parseFloat(Z.string(i));switch(e._hx_index){case 26:return x-y;case 27:return x*y;case 28:if(y==0){let F=s,L;if(F!=null)L=F;else{let A=this.get_currentScope(),B=A!=null?A.node:null;L=B!=null?B.pos:null}throw k.thrown(new he("Division by zero",L??this.script.pos))}return x/y;case 29:if(y==0){let F=s,L;if(F!=null)L=F;else{let A=this.get_currentScope(),B=A!=null?A.node:null;L=B!=null?B.pos:null}throw k.thrown(new he("Modulo by zero",L??this.script.pos))}return x%y;default:throw k.thrown("Unreachable")}break;default:let b;switch(e._hx_index){case 26:b="subtract";break;case 27:b="multiply";break;case 28:b="divide";break;case 29:b="modulo";break;default:b="perform operation on"}let v="Cannot "+b+" "+this.getTypeName(n)+" and "+this.getTypeName(l),T=s,E;if(T!=null)E=T;else{let F=this.get_currentScope(),L=F!=null?F.node:null;E=L!=null?L.pos:null}throw k.thrown(new he(v,E??this.script.pos))}break;default:let p;switch(e._hx_index){case 26:p="subtract";break;case 27:p="multiply";break;case 28:p="divide";break;case 29:p="modulo";break;default:p="perform operation on"}let f="Cannot "+p+" "+this.getTypeName(n)+" and "+this.getTypeName(l),_=s,d;if(_!=null)d=_;else{let x=this.get_currentScope(),y=x!=null?x.node:null;d=y!=null?y.pos:null}throw k.thrown(new he(f,d??this.script.pos))}break;case 30:case 31:switch(e._hx_index){case 30:return t==i;case 31:return t!=i;default:throw k.thrown("Unreachable")}break;case 32:case 33:case 34:case 35:switch(n._hx_index){case 1:case 2:switch(l._hx_index){case 1:case 2:let d=parseFloat(Z.string(t)),x=parseFloat(Z.string(i));switch(e._hx_index){case 32:return d>x;case 33:return d<x;case 34:return d>=x;case 35:return d<=x;default:throw k.thrown("Unreachable")}break;default:let y="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(l),b=s,v;if(b!=null)v=b;else{let T=this.get_currentScope(),E=T!=null?T.node:null;v=E!=null?E.pos:null}throw k.thrown(new he(y,v??this.script.pos))}break;default:let p="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}break;case 36:let r=e.word;if(n._hx_index==3)if(l._hx_index==3)switch(e._hx_index){case 36:let p=e.word;return t?i:!1;case 37:let f=e.word;return t?!0:i;default:throw k.thrown("Unreachable")}else{let p="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}else{let p="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}break;case 37:let h=e.word;if(n._hx_index==3)if(l._hx_index==3)switch(e._hx_index){case 36:let p=e.word;return t?i:!1;case 37:let f=e.word;return t?!0:i;default:throw k.thrown("Unreachable")}else{let p="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}else{let p="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}break;default:let a="Invalid operation: "+Z.string(e),o=s,c;if(o!=null)c=o;else{let p=this.get_currentScope(),f=p!=null?p.node:null;c=f!=null?f.pos:null}throw k.thrown(new he(a,c??this.script.pos))}}valueToString(e){return e==null?"null":Z.string(e)}printLoreline(e){try{let t=new es;return t.enableComments=!1,Te.trim(t.print(e))}catch{return null}}}K["loreline.Interpreter"]=Ji.loreline.Interpreter=ds,ds.__name__="loreline.Interpreter",Object.assign(ds.prototype,{__class__:ds,__properties__:{get_currentInsertion:"get_currentInsertion",get_currentScope:"get_currentScope"}});class rn{static stringify(e,t){return t==null&&(t=!1),JSON.stringify(e,null,t?" ":null)}static parse(e){return JSON.parse(e)}}K["loreline.Json"]=rn,rn.__name__="loreline.Json";class ri{constructor(e,t){this.target=e,this.origin=t}}K["loreline.Reference"]=ri,ri.__name__="loreline.Reference",Object.assign(ri.prototype,{__class__:ri});class js{constructor(e){this.error=null,this.expr=null,this.hscript=null,this.func=e,this.codeToHscript=new qi;try{this.hscript=this.codeToHscript.process(e.code)}catch(t){let i=k.caught(t).unwrap();i instanceof li&&(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 Yi;t.resumeErrors=!1,t.allowJSON=!0,t.allowTypes=!0;let i=e.name;this.expr=t.parseString(this.hscript,i??"?")}catch(t){let i=k.caught(t).unwrap();if(this.error==null)if(i instanceof ce){let s=i,n,l=s.e;switch(l._hx_index){case 0:n="Invalid character: "+l.c;break;case 1:n="Unexpected: "+l.s;break;case 2:n="Unterminated string";break;case 3:n="Unterminated comment";break;case 4:n="Invalid preprocessor: "+l.msg;break;case 5:n="Unknown variable: "+l.v;break;case 6:n="Invalid iterator: "+l.v;break;case 7:n="Invalid operator: "+l.op;break;case 8:n="Invalid access: "+l.f;break;case 9:n=l.msg;break}this.error=new ys(s,n,this.codeToHscript.toLorelinePos(e.pos,s.pmin,s.pmax))}else i instanceof li&&(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 s=new Yi;s.resumeErrors=!0,s.allowJSON=!0,s.allowTypes=!0;let n=e.name;this.expr=s.parseString(this.hscript,n??"?")}catch{}}}}K["loreline.FuncHscript"]=js,js.__name__="loreline.FuncHscript",Object.assign(js.prototype,{__class__:js});class Rs{constructor(e,t){this.completion=null,this.locals=null,e!=null&&(this.locals=e),t!=null&&(this.completion=t)}}K["loreline.HscriptCompletion"]=Rs,Rs.__name__="loreline.HscriptCompletion",Object.assign(Rs.prototype,{__class__:Rs});class Vs{constructor(e){this.hscriptFunctions=new Wi,this.childNodes=new Wi,this.parentNodes=new Wi,this.nodesById=new Wi,this.script=e,this.initialize()}initialize(){let e=this;this.script.each(function(t,i){let s=t.id.thisVal;if(e.nodesById.map._set(s.high,s.low,t),i!=null){let n=t.id.thisVal;e.parentNodes.map._set(n.high,n.low,i);let l=i.id.thisVal,r=e.childNodes.map._get(l.high,l.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,s){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(s,n){let l=s.pos,r=e.offset-l.offset;r>=0&&r<i&&(i=r,t=s)}),t}getNodesOfType(e,t){t==null&&(t=!1);let i=[],s=this;return this.traverse(this.script,function(n,l){return Q.__instanceof(n,e)&&i.push(n),t||n==s.script?!0:!(n instanceof Zt||n instanceof ci)}),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&&Q.getClass(i)==t)return i;return null}getImportedPaths(e){let t=[];return this._getImportedPaths(e,this.script,t,new me),t}_getImportedPaths(e,t,i,s){let n=vt.directory(e);t==null&&(t=this.script);let l=".lor";e!=null&&e.endsWith(".lor.txt")&&(l=".lor.txt");let r=0,h=t.body;for(;r<h.length;){let a=h[r];if(++r,a instanceof Zt){let o=a,c,p=o.path.parts[0].partType;p._hx_index==0?c=p.text:c="",vt.isAbsolute(c)||(c=vt.join([n,c])),c=vt.normalize(c),c.toLowerCase().endsWith(l)||(c+=l),Object.prototype.hasOwnProperty.call(s.h,c)||(s.h[c]=!0,i.push(c),o.script!=null&&this._getImportedPaths(c,o.script,i,s))}}return i}resolveArrayAccess(e){let t=null;if(e.target instanceof lt?t=this.resolveAccess(e.target):e.target instanceof ui&&(t=this.resolveArrayAccess(e.target)),t==null)return null;switch(Q.getClass(t)){case Oe:let i=t;if(i.literalType==Re.Array){let n=i.value;if(e.index instanceof Oe){let l=e.index;if(l.literalType==Re.Number){let r=l.value|0;if(r>=0&&r<n.length){let h=n[r];if(h instanceof Pt)return h}}}}break;case Fi:let s=t;if(s.value instanceof Oe){let n=s.value;if(n.literalType==Re.Array){let l=n.value;if(e.index instanceof Oe){let r=e.index;if(r.literalType==Re.Number){let h=r.value|0;if(h>=0&&h<l.length){let a=l[h];if(a instanceof Pt)return a}}}}}break;default:}return null}resolveAccess(e){if(e.target!=null){let h=e.target instanceof lt?this.resolveAccess(e.target):e.target instanceof ui?this.resolveArrayAccess(e.target):null;if(h!=null)switch(h instanceof Fi&&(h=h.value),Q.getClass(h)){case Gt:let a=h,o=0,c=a.fields;for(;o<c.length;){let _=c[o];if(++o,_.name==e.name)return _}break;case Oe:let p=h,f=p.literalType;if(f._hx_index==4){let _=f.style,d=p.value,x=0;for(;x<d.length;){let y=d[x];if(++x,y.name==e.name)return y}}break;default:}return null}let t=e.name;if(t==null)return null;let i=this.getFirstParentOfType(e,De);for(;i!=null;){let h=null;if(this.traverse(i,function(a,o){if(h!=null)return!1;if(a instanceof Jt){let c=a,p=0,f=c.fields;for(;p<f.length;){let _=f[p];if(++p,_.name==t)return h=_,!1}}return!0}),h!=null)return h;i=this.getFirstParentOfType(i,De)}let s=null;if(this.traverse(this.script,function(h,a){if(s!=null)return!1;if(h instanceof Jt){let o=h,c=0,p=o.fields;for(;c<p.length;){let f=p[c];if(++c,f.name==t)return s=f,!1}}return h instanceof Zt?!0:h instanceof ci}),s!=null)return s;let n=this.findCharacterByNameFromNode(t,e);if(n!=null)return n;let l=this.findBeatByNameFromNode(t,e);if(l!=null)return l;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("."),s=this.findBeatByNameFromNode(i[0],t),n=1;for(;s!=null&&n<i.length;){let l=i[n],r=null;this.traverse(s,function(h,a){if(h instanceof De){let o=h;return o.name==l&&(r=o),!1}else return r==null}),s=r,++n}return s}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 De?e:null;{let t=this.getFirstParentOfType(e,De);for(;t!=null&&!this.isTopLevelNode(t);)t=this.getFirstParentOfType(t,De);if(t!=null&&t instanceof De)return t}return null}findBeatByNameFromNode(e,t){let i=null,s=this.getFirstParentOfType(t,De);for(;s!=null;)this.traverse(s,function(n,l){if(i!=null||n==t)return!1;if(n instanceof De){let r=n;return r.name==e&&(i=r),!1}return!0}),s=this.getFirstParentOfType(s,De);return i==null&&this.traverse(this.script,function(n,l){if(i==null&&n instanceof De){let r=n;r.name==e&&(i=r)}return n instanceof Zt?!0:n instanceof ci}),i}findCharacterFromDialogue(e){return this.findCharacterByNameFromNode(e.character,e)}findCharacterByNameFromNode(e,t){let i=null;return this.traverse(this.script,function(s,n){if(i==null&&s instanceof Gt){let l=s;l.name==e&&(i=l)}return s instanceof Zt?!0:s instanceof ci}),i}findFunctionByNameFromNode(e,t){let i=null;return this.traverse(this.script,function(s,n){if(i==null&&s instanceof Di){let l=s;l.name==e&&(i=l)}return s instanceof Zt?!0:s instanceof ci}),i}getVisibleCharacters(){let e=[],t=this.script.iterator();for(;t.hasNext();){let i=t.next();i instanceof Gt&&e.push(i)}return e}getVisibleFunctions(){let e=[],t=this.script.iterator();for(;t.hasNext();){let i=t.next();i instanceof Di&&e.push(i)}return e}getVisibleStateFields(e){let t=[],i=new _i,s=e;for(;s!=null;){if(Q.getClass(s)==Jt){let l=s,r=0,h=l.fields;for(;r<h.length;){let a=h[r];++r;let o=a.id.thisVal;if(!i._exists(o.high,o.low)){let c=a.id.thisVal;i._set(c.high,c.low,!0),t.push(a)}}}let n=s.id.thisVal;s=this.parentNodes.map._get(n.high,n.low)}return this.script.each(function(n,l){if(Q.getClass(n)==Jt){let r=n;if(l instanceof ci){let h=0,a=r.fields;for(;h<a.length;){let o=a[h];++h;let c=o.id.thisVal;if(!i._exists(c.high,c.low)){let p=o.id.thisVal;i._set(p.high,p.low,!0),t.push(o)}}}}}),t}getVisibleBeats(e){let t=[],i=Object.create(null),s=this.getParentNode(e);for(;s!=null;){if(Q.getClass(s)==De&&this.getParentNode(s)!=null){let l=0,r=this.getNodesOfType(De);for(;l<r.length;){let h=r[l];++l,Object.prototype.hasOwnProperty.call(i,h.name)||(i[h.name]=!0,t.push(h))}}s=this.getParentNode(s)}return this.script.each(function(n,l){if(Q.getClass(n)==De&&l instanceof ci){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 be?h:null;if(o!=null&&o.trailingComments!=null){let c=0,p=o.trailingComments;for(;c<p.length;){let f=p[c];if(++c,f.isHash){let _=Te.trim(f.content);e[_]=!0}}}});let t=[],i=e,s=i,n=Object.keys(i),l=n.length,r=0;for(;r<l;){let h=n[r++];t.push(h)}return t}countTags(){let e=new me;return this.script.each(function(t,i){let s=t instanceof be?t:null;if(s!=null&&s.trailingComments!=null){let n=0,l=s.trailingComments;for(;n<l.length;){let r=l[n];if(++n,r.isHash){let h=Te.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 s=t[i];if(++i,s.name==e.name)return s}return null}findOutboundBeats(e){let t=new _i,i=this;this.traverse(e,function(r,h){switch(Q.getClass(r)){case Vt:let a=r;if(a.target instanceof lt){let _=a.target;if(_.target==null){let d=i.findBeatFromAccess(_);if(d!=null){let x=d.id,y=new ri(d,a),b=x.thisVal;t._set(b.high,b.low,y)}}}break;case zi:let o=r,c=i.findBeatByNameFromNode(o.target,o);if(c!=null){let _=c.id,d=new ri(c,o),x=_.thisVal;t._set(x.high,x.low,d)}break;case Ni:let p=r,f=i.findBeatByNameFromNode(p.target,p);if(f!=null){let _=f.id,d=new ri(f,p),x=_.thisVal;t._set(x.high,x.low,d)}break;default:}return!0});let s=[],n=t,l=0;for(;l<n._values.length&&n._values[l]==null;)++l;for(;l<n._values.length;){let r=n._values[l];for(++l;l<n._values.length&&n._values[l]==null;)++l;let h=r;s.push(h)}return s}findReferencesToBeat(e){let t=[],i=this;return this.script.each(function(s,n){switch(Q.getClass(s)){case Vt:let l=s;if(l.target instanceof lt){let a=l.target;if(a.target==null&&a.name==e.name){let o=i.findBeatFromAccess(a);o!=null&&o.id==e.id&&t.push(new ri(e,l))}}break;case zi:let r=s;r.target==e.name&&t.push(new ri(e,r));break;case Ni:let h=s;h.target==e.name&&t.push(new ri(e,h));break;default:}}),t}findModifiedStateFields(e){let t=Object.create(null),i=this;this.traverse(e,function(c,p){if(Q.getClass(c)==di){let f=c;if(f.target instanceof lt){let _=f.target,d=i.findStateField(_);if(d!=null){let x=d.name,y=new ri(d,f);t[x]=y}}}return!0});let s=[],n=t,l=n,r=Object.keys(n),h=r.length,a=0;for(;a<h;){let c=l[r[a++]];s.push(c)}let o=s;return o.sort(function(c,p){let f=c.target.name.toLowerCase(),_=p.target.name.toLowerCase();return f<_?-1:f>_?1:0}),o}findReadStateFields(e){let t=Object.create(null),i=this;this.traverse(e,function(c,p){if(Q.getClass(c)==lt){let f=c;if(p instanceof di&&p.target==c)return!0;let _=i.findStateField(f);if(_!=null){let d=_.name,x=new ri(_,f);t[d]=x}}return!0});let s=[],n=t,l=n,r=Object.keys(n),h=r.length,a=0;for(;a<h;){let c=l[r[a++]];s.push(c)}let o=s;return o.sort(function(c,p){let f=c.target.name.toLowerCase(),_=p.target.name.toLowerCase();return f<_?-1:f>_?1:0}),o}findBeatCharacters(e){let t=new _i,i=this;this.traverse(e,function(h,a){switch(Q.getClass(h)){case lt:let o=h;if(o.target==null){let f=i.findCharacterByNameFromNode(o.name,o);if(f!=null){let _=f.id,d=new ri(f,o),x=_.thisVal;t._set(x.high,x.low,d)}}break;case hi:let c=h,p=i.findCharacterFromDialogue(c);if(p!=null){let f=p.id,_=new ri(p,c),d=f.thisVal;t._set(d.high,d.low,_)}break;default:}return!0});let s=[],n=t,l=0;for(;l<n._values.length&&n._values[l]==null;)++l;for(;l<n._values.length;){let h=n._values[l];for(++l;l<n._values.length&&n._values[l]==null;)++l;let a=h;s.push(a)}let r=s;return r.sort(function(h,a){let o=h.target.name.toLowerCase(),c=a.target.name.toLowerCase();return o<c?-1:o>c?1:0}),r}findModifiedCharacterFields(e){let t=new _i,i=[],s=this;return this.traverse(e,function(n,l){if(Q.getClass(n)==di){let r=n;if(r.target instanceof lt){let h=r.target,a=s.resolveAccess(h);if(a instanceof Fi){let o=a.id.thisVal;if(!t._exists(o.high,o.low)&&s.getParentNode(a)instanceof Gt){let p=a.id.thisVal;t._set(p.high,p.low,!0),i.push(new ri(a,n))}}}}return!0}),i}findReadCharacterFields(e){let t=new _i,i=[],s=this;return this.traverse(e,function(n,l){if(Q.getClass(n)==lt){let r=n,h=s.getParentNode(r);if(h instanceof di&&h.target==r)return!0;let a=s.resolveAccess(r);if(a instanceof Fi){let o=a.id.thisVal;if(!t._exists(o.high,o.low)&&s.getParentNode(a)instanceof Gt){let p=a.id.thisVal;t._set(p.high,p.low,!0),i.push(new ri(a,n))}}}return!0}),i}traverse(e,t){let i=e.id.thisVal,s=this.childNodes.map._get(i.high,i.low);if(s!=null){let n=0,l=s.length;for(;n<l;){let r=n++,h=s[r];t(h,e)&&this.traverse(h,t)}}}getFuncHscript(e){let t=e.id,i=t.thisVal,s=this.hscriptFunctions.map._get(i.high,i.low);if(s==null){s=new js(e);let n=t.thisVal;this.hscriptFunctions.map._set(n.high,n.low,s)}return s}getHscriptExpr(e,t){let i=this.getFuncHscript(e);if(i.expr==null)return null;let s=t.offset-e.pos.offset,n=null,l=null;return l=function(r){if(r!=null){let h=i.codeToHscript.inputPosFromProcessedPos(r.pmin),a=i.codeToHscript.inputPosFromProcessedPos(r.pmax);s>=h&&s<=a&&(n=r),$s.iter(r,l)}},$s.iter(i.expr,l),n}resolveHscriptAccess(e,t){let i=t.e;switch(i._hx_index){case 1:let s=i.v,n=null;if(this.traverse(this.script,function(f,_){if(n!=null)return!1;if(f instanceof Jt){let d=f,x=0,y=d.fields;for(;x<y.length;){let b=y[x];if(++x,b.name==s)return n=b,!1}}return f instanceof Zt?!0:f instanceof ci}),n!=null)return n;let l=this.findCharacterByNameFromNode(s,e);if(l!=null)return l;let r=this.findBeatByNameFromNode(s,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),Q.getClass(o)){case Gt:let f=o,_=0,d=f.fields;for(;_<d.length;){let b=d[_];if(++_,b.name==a)return b}break;case Oe:let x=o,y=x.literalType;if(y._hx_index==4){let b=y.style,v=x.value,T=0;for(;T<v.length;){let E=v[T];if(++T,E.name==a)return E}}break;default:}break;case 16:let c=i.e,p=i.index;break;default:}return null}isHscriptExpr(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"e")?Q.__instanceof(Pe.field(e,"e"),D):!1}getHscriptCompletion(e,t){let i=this.getFuncHscript(e),s=t.offset-e.pos.offset+t.length,n=i.codeToHscript.processedPosFromInputPos(s),l=i.hscript,r=Math.min(n,i.hscript.length)|0,h=r!=null?l.substring(0,r):l.substring(0),a=h.length,o=h.indexOf("{",null)+1;h=a!=null?h.substring(o,a):h.substring(o);let c=h.length,p="",f=0,_=a-c;for(;f<_;){let b=f++;p+=String.fromCodePoint(32)}h=p+h;let d=null,x=new We;try{x.types.parser.allowJSON=!0,x.types.parser.allowTypes=!0,x.types.parser.resumeErrors=!0;let b=x.types.parser.parseString(h);x.check(b,null,!0)}catch(b){let v=k.caught(b).unwrap();v instanceof _s&&(d=v)}let y=x.locals;return new Rs(y,d)}resolveAccessInFunction(e,t){if(this.getFuncHscript(e).expr==null)return null;let s=this.getHscriptExpr(e,t);return s!=null?this.resolveHscriptAccess(e,s):null}}K["loreline.Lens"]=Vs,Vs.__name__="loreline.Lens",Object.assign(Vs.prototype,{__class__:Vs});class Zi extends li{constructor(e,t){super(e,t)}}K["loreline.LexerError"]=Zi,Zi.__name__="loreline.LexerError",Zi.__super__=li,Object.assign(Zi.prototype,{__class__:Zi});var Ii=Fe["loreline.LStringAttachment"]={__ename__:"loreline.LStringAttachment",__constructs__:null,Interpolation:(m=function(w,e,t,i,s){return{_hx_index:0,braces:w,inTag:e,expr:t,start:i,length:s,__enum__:"loreline.LStringAttachment",toString:C}},m._hx_name="Interpolation",m.__params__=["braces","inTag","expr","start","length"],m),Tag:(m=function(w,e,t){return{_hx_index:1,closing:w,start:e,length:t,__enum__:"loreline.LStringAttachment",toString:C}},m._hx_name="Tag",m.__params__=["closing","start","length"],m)};Ii.__constructs__=[Ii.Interpolation,Ii.Tag];class Pi{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 g=Fe["loreline.TokenType"]={__ename__:"loreline.TokenType",__constructs__:null,KwImport:{_hx_name:"KwImport",_hx_index:0,__enum__:"loreline.TokenType",toString:C},KwState:{_hx_name:"KwState",_hx_index:1,__enum__:"loreline.TokenType",toString:C},KwBeat:{_hx_name:"KwBeat",_hx_index:2,__enum__:"loreline.TokenType",toString:C},KwCharacter:{_hx_name:"KwCharacter",_hx_index:3,__enum__:"loreline.TokenType",toString:C},KwChoice:{_hx_name:"KwChoice",_hx_index:4,__enum__:"loreline.TokenType",toString:C},KwIf:{_hx_name:"KwIf",_hx_index:5,__enum__:"loreline.TokenType",toString:C},KwElse:{_hx_name:"KwElse",_hx_index:6,__enum__:"loreline.TokenType",toString:C},KwNew:{_hx_name:"KwNew",_hx_index:7,__enum__:"loreline.TokenType",toString:C},KwSequence:{_hx_name:"KwSequence",_hx_index:8,__enum__:"loreline.TokenType",toString:C},KwCycle:{_hx_name:"KwCycle",_hx_index:9,__enum__:"loreline.TokenType",toString:C},KwOnce:{_hx_name:"KwOnce",_hx_index:10,__enum__:"loreline.TokenType",toString:C},KwPick:{_hx_name:"KwPick",_hx_index:11,__enum__:"loreline.TokenType",toString:C},KwShuffle:{_hx_name:"KwShuffle",_hx_index:12,__enum__:"loreline.TokenType",toString:C},Separator:{_hx_name:"Separator",_hx_index:13,__enum__:"loreline.TokenType",toString:C},Function:(m=function(w,e,t,i){return{_hx_index:14,name:w,args:e,code:t,external:i,__enum__:"loreline.TokenType",toString:C}},m._hx_name="Function",m.__params__=["name","args","code","external"],m),LString:(m=function(w,e,t){return{_hx_index:15,quotes:w,s:e,attachments:t,__enum__:"loreline.TokenType",toString:C}},m._hx_name="LString",m.__params__=["quotes","s","attachments"],m),LNumber:(m=function(w){return{_hx_index:16,n:w,__enum__:"loreline.TokenType",toString:C}},m._hx_name="LNumber",m.__params__=["n"],m),LBoolean:(m=function(w){return{_hx_index:17,b:w,__enum__:"loreline.TokenType",toString:C}},m._hx_name="LBoolean",m.__params__=["b"],m),LNull:{_hx_name:"LNull",_hx_index:18,__enum__:"loreline.TokenType",toString:C},Identifier:(m=function(w){return{_hx_index:19,name:w,__enum__:"loreline.TokenType",toString:C}},m._hx_name="Identifier",m.__params__=["name"],m),OpAssign:{_hx_name:"OpAssign",_hx_index:20,__enum__:"loreline.TokenType",toString:C},OpPlusAssign:{_hx_name:"OpPlusAssign",_hx_index:21,__enum__:"loreline.TokenType",toString:C},OpMinusAssign:{_hx_name:"OpMinusAssign",_hx_index:22,__enum__:"loreline.TokenType",toString:C},OpMultiplyAssign:{_hx_name:"OpMultiplyAssign",_hx_index:23,__enum__:"loreline.TokenType",toString:C},OpDivideAssign:{_hx_name:"OpDivideAssign",_hx_index:24,__enum__:"loreline.TokenType",toString:C},OpPlus:{_hx_name:"OpPlus",_hx_index:25,__enum__:"loreline.TokenType",toString:C},OpMinus:{_hx_name:"OpMinus",_hx_index:26,__enum__:"loreline.TokenType",toString:C},OpMultiply:{_hx_name:"OpMultiply",_hx_index:27,__enum__:"loreline.TokenType",toString:C},OpDivide:{_hx_name:"OpDivide",_hx_index:28,__enum__:"loreline.TokenType",toString:C},OpModulo:{_hx_name:"OpModulo",_hx_index:29,__enum__:"loreline.TokenType",toString:C},OpEquals:{_hx_name:"OpEquals",_hx_index:30,__enum__:"loreline.TokenType",toString:C},OpNotEquals:{_hx_name:"OpNotEquals",_hx_index:31,__enum__:"loreline.TokenType",toString:C},OpGreater:{_hx_name:"OpGreater",_hx_index:32,__enum__:"loreline.TokenType",toString:C},OpLess:{_hx_name:"OpLess",_hx_index:33,__enum__:"loreline.TokenType",toString:C},OpGreaterEq:{_hx_name:"OpGreaterEq",_hx_index:34,__enum__:"loreline.TokenType",toString:C},OpLessEq:{_hx_name:"OpLessEq",_hx_index:35,__enum__:"loreline.TokenType",toString:C},OpAnd:(m=function(w){return{_hx_index:36,word:w,__enum__:"loreline.TokenType",toString:C}},m._hx_name="OpAnd",m.__params__=["word"],m),OpOr:(m=function(w){return{_hx_index:37,word:w,__enum__:"loreline.TokenType",toString:C}},m._hx_name="OpOr",m.__params__=["word"],m),OpNot:{_hx_name:"OpNot",_hx_index:38,__enum__:"loreline.TokenType",toString:C},Arrow:{_hx_name:"Arrow",_hx_index:39,__enum__:"loreline.TokenType",toString:C},Colon:{_hx_name:"Colon",_hx_index:40,__enum__:"loreline.TokenType",toString:C},Comma:{_hx_name:"Comma",_hx_index:41,__enum__:"loreline.TokenType",toString:C},Dot:{_hx_name:"Dot",_hx_index:42,__enum__:"loreline.TokenType",toString:C},LBrace:{_hx_name:"LBrace",_hx_index:43,__enum__:"loreline.TokenType",toString:C},RBrace:{_hx_name:"RBrace",_hx_index:44,__enum__:"loreline.TokenType",toString:C},LParen:{_hx_name:"LParen",_hx_index:45,__enum__:"loreline.TokenType",toString:C},RParen:{_hx_name:"RParen",_hx_index:46,__enum__:"loreline.TokenType",toString:C},LBracket:{_hx_name:"LBracket",_hx_index:47,__enum__:"loreline.TokenType",toString:C},RBracket:{_hx_name:"RBracket",_hx_index:48,__enum__:"loreline.TokenType",toString:C},CommentLine:(m=function(w){return{_hx_index:49,content:w,__enum__:"loreline.TokenType",toString:C}},m._hx_name="CommentLine",m.__params__=["content"],m),CommentMultiLine:(m=function(w){return{_hx_index:50,content:w,__enum__:"loreline.TokenType",toString:C}},m._hx_name="CommentMultiLine",m.__params__=["content"],m),CommentHash:(m=function(w){return{_hx_index:51,content:w,__enum__:"loreline.TokenType",toString:C}},m._hx_name="CommentHash",m.__params__=["content"],m),Indent:{_hx_name:"Indent",_hx_index:52,__enum__:"loreline.TokenType",toString:C},Unindent:{_hx_name:"Unindent",_hx_index:53,__enum__:"loreline.TokenType",toString:C},LineBreak:{_hx_name:"LineBreak",_hx_index:54,__enum__:"loreline.TokenType",toString:C},Eof:{_hx_name:"Eof",_hx_index:55,__enum__:"loreline.TokenType",toString:C}};g.__constructs__=[g.KwImport,g.KwState,g.KwBeat,g.KwCharacter,g.KwChoice,g.KwIf,g.KwElse,g.KwNew,g.KwSequence,g.KwCycle,g.KwOnce,g.KwPick,g.KwShuffle,g.Separator,g.Function,g.LString,g.LNumber,g.LBoolean,g.LNull,g.Identifier,g.OpAssign,g.OpPlusAssign,g.OpMinusAssign,g.OpMultiplyAssign,g.OpDivideAssign,g.OpPlus,g.OpMinus,g.OpMultiply,g.OpDivide,g.OpModulo,g.OpEquals,g.OpNotEquals,g.OpGreater,g.OpLess,g.OpGreaterEq,g.OpLessEq,g.OpAnd,g.OpOr,g.OpNot,g.Arrow,g.Colon,g.Comma,g.Dot,g.LBrace,g.RBrace,g.LParen,g.RParen,g.LBracket,g.RBracket,g.CommentLine,g.CommentMultiLine,g.CommentHash,g.Indent,g.Unindent,g.LineBreak,g.Eof];class Ft{static equals(e,t){switch(e._hx_index){case 1:return t._hx_index==1?!0:re.enumEq(e,t);case 2:return t._hx_index==2?!0:re.enumEq(e,t);case 3:return t._hx_index==3?!0:re.enumEq(e,t);case 4:return t._hx_index==4?!0:re.enumEq(e,t);case 5:return t._hx_index==5?!0:re.enumEq(e,t);case 6:return t._hx_index==6?!0:re.enumEq(e,t);case 7:return t._hx_index==7?!0:re.enumEq(e,t);case 8:return t._hx_index==8?!0:re.enumEq(e,t);case 9:return t._hx_index==9?!0:re.enumEq(e,t);case 10:return t._hx_index==10?!0:re.enumEq(e,t);case 11:return t._hx_index==11?!0:re.enumEq(e,t);case 12:return t._hx_index==12?!0:re.enumEq(e,t);case 13:return t._hx_index==13?!0:re.enumEq(e,t);case 15:let i=e.s,s=e.attachments;if(t._hx_index==15){let r=t.s,h=t.attachments,a=t.quotes;return e.quotes==a}else return re.enumEq(e,t);break;case 16:if(t._hx_index==16){let r=t.n;return e.n==r}else return re.enumEq(e,t);break;case 17:if(t._hx_index==17){let r=t.b;return e.b==r}else return re.enumEq(e,t);break;case 18:return t._hx_index==18?!0:re.enumEq(e,t);case 19:if(t._hx_index==19){let r=t.name;return e.name==r}else return re.enumEq(e,t);break;case 20:return t._hx_index==20?!0:re.enumEq(e,t);case 21:return t._hx_index==21?!0:re.enumEq(e,t);case 22:return t._hx_index==22?!0:re.enumEq(e,t);case 23:return t._hx_index==23?!0:re.enumEq(e,t);case 24:return t._hx_index==24?!0:re.enumEq(e,t);case 25:return t._hx_index==25?!0:re.enumEq(e,t);case 26:return t._hx_index==26?!0:re.enumEq(e,t);case 27:return t._hx_index==27?!0:re.enumEq(e,t);case 28:return t._hx_index==28?!0:re.enumEq(e,t);case 29:return t._hx_index==29?!0:re.enumEq(e,t);case 30:return t._hx_index==30?!0:re.enumEq(e,t);case 31:return t._hx_index==31?!0:re.enumEq(e,t);case 32:return t._hx_index==32?!0:re.enumEq(e,t);case 33:return t._hx_index==33?!0:re.enumEq(e,t);case 34:return t._hx_index==34?!0:re.enumEq(e,t);case 35:return t._hx_index==35?!0:re.enumEq(e,t);case 36:let n=e.word;if(t._hx_index==36){let r=t.word;return!0}else return re.enumEq(e,t);break;case 37:let l=e.word;if(t._hx_index==37){let r=t.word;return!0}else return re.enumEq(e,t);break;case 38:return t._hx_index==38?!0:re.enumEq(e,t);case 39:return t._hx_index==39?!0:re.enumEq(e,t);case 40:return t._hx_index==40?!0:re.enumEq(e,t);case 42:return t._hx_index==42?!0:re.enumEq(e,t);case 43:return t._hx_index==43?!0:re.enumEq(e,t);case 44:return t._hx_index==44?!0:re.enumEq(e,t);case 45:return t._hx_index==45?!0:re.enumEq(e,t);case 46:return t._hx_index==46?!0:re.enumEq(e,t);case 47:return t._hx_index==47?!0:re.enumEq(e,t);case 48:return t._hx_index==48?!0:re.enumEq(e,t);case 49:if(t._hx_index==49){let r=t.content;return e.content==r}else return re.enumEq(e,t);break;case 50:if(t._hx_index==50){let r=t.content;return e.content==r}else return re.enumEq(e,t);break;case 51:if(t._hx_index==51){let r=t.content;return e.content==r}else return re.enumEq(e,t);break;case 52:return t._hx_index==52?!0:re.enumEq(e,t);case 53:return t._hx_index==53?!0:re.enumEq(e,t);case 54:return t._hx_index==54?!0:re.enumEq(e,t);case 55:return t._hx_index==55?!0:re.enumEq(e,t);default:return re.enumEq(e,t)}}static isComment(e){switch(e._hx_index){case 49:let t=e.content;return!0;case 50:let i=e.content;return!0;case 51:let s=e.content;return!0;default:return!1}}static isAssignOp(e){switch(e._hx_index){case 20:case 21:case 22:case 23:case 24: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,s=e.code,n=e.external;return"function";case 15:let l=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 c=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 e.word?"and":"&&";case 37:return e.word?"or":"||";case 38:return"!";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:let _=e.content;return"comment";case 50:let d=e.content;return"multiline comment";case 51:let x=e.content;return"hash comment";case 52:return"indent";case 53:return"unindent";case 54:return"line break";case 55:return"end of file"}}}K["loreline.TokenTypeHelpers"]=Ft,Ft.__name__="loreline.TokenTypeHelpers";class ie{constructor(e,t){this.type=e,this.pos=t}toString(){return""+Z.string(this.type)+" at "+this.pos.toString()}}K["loreline.Token"]=ie,ie.__name__="loreline.Token",Object.assign(ie.prototype,{__class__:ie});class wt{constructor(e){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==g.Eof){if(this.indentStack.length>1){let i=this.indentStack.length-1,s=0,n=i;for(;s<n;){let l=s++,r=null;r==null&&(r=new z(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ie(g.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 43: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 47:this.stack.push(12),this.nextBlock=10;break;case 44:case 48:case 53:this.stack.pop(),this.nextBlock=10;break;case 52:let s;switch(this.nextBlock){case 0:case 1:s=1;break;case 2:case 3:s=3;break;case 4:case 5:s=5;break;case 6:case 7:s=7;break;case 8:case 9:s=9;break;case 10:case 11:case 12:s=11;break}this.stack.push(s),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 z(this.startLine,this.startColumn,this.pos)),i.length=this.pos-i.offset;let s=new ie(g.Eof,i);return this.previous=s,s}this.startLine=this.line,this.startColumn=this.column;let e=u.cca(this.input,this.pos);if(e==10||e==13){let i=this.readLineBreak(),s=this.countIndentation();if(s>this.indentStack[this.indentStack.length-1]){this.indentStack.length==1&&(this.detectedIndentSize=s-this.indentStack[0]),this.indentStack.push(s);let n=this.indentTokens,l=null;l==null&&(l=new z(this.startLine,this.startColumn,this.pos)),l.length=this.pos-l.offset;let r=new ie(g.Indent,l);this.previous=r,n.push(r)}else if(s<this.indentStack[this.indentStack.length-1])for(;this.indentStack.length>0&&s<this.indentStack[this.indentStack.length-1];){this.indentStack.pop();let n=this.indentTokens,l=null;l==null&&(l=new z(this.startLine,this.startColumn,this.pos)),l.length=this.pos-l.offset;let r=new ie(g.Unindent,l);this.previous=r,n.push(r)}return i}let t=new z(this.startLine,this.startColumn,this.pos);if(this.tokenized.length>0&&this.tokenized[this.tokenized.length-1].type==g.KwImport)return this.readImportValue(e,t);if(e==null){let i=this.tryReadUnquotedString();if(i!=null)return i;if(e==null){let s=e;if(s>=48&&s<=57)return this.readNumber();{let n=e;return n>=97&&n<=122||n>=65&&n<=90||n==95?this.readIdentifier():(this.error("Unexpected character: "+String.fromCodePoint(e),!0),null)}}else switch(e){case 33:let s=e;if(s>=48&&s<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpNotEquals,S);return this.previous=W,W}else{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpNot,S);return this.previous=W,W}}break;case 35:let n=e;if(n>=48&&n<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();{let q=this.pos+1<this.length?u.cca(this.input,this.pos+1):0;return q>=97&&q<=122||q>=65&&q<=90||q==95||q>=48&&q<=57||q==45?this.readHashComment():(this.error("Unexpected character: #",!0),null)}}break;case 37:let l=e;if(l>=48&&l<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpModulo,S);return this.previous=W,W}}break;case 38:let r=e;if(r>=48&&r<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==38){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpAnd(!1),S);return this.previous=W,W}else{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.error("Expected &",!1);let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpAnd(!1),S);return this.previous=W,W}}break;case 40:let h=1;for(;h-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.makeStrictIfFollowingCallable();let a=t;a==null&&(a=new z(this.startLine,this.startColumn,this.pos)),a.length=this.pos-a.offset;let o=new ie(g.LParen,a);return this.previous=o,o;case 41:let c=1;for(;c-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.strictExprs.pop();let p=t;p==null&&(p=new z(this.startLine,this.startColumn,this.pos)),p.length=this.pos-p.offset;let f=new ie(g.RParen,p);return this.previous=f,f;case 42:let _=e;if(_>=48&&_<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpMultiplyAssign,S);return this.previous=W,W}else{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpMultiply,S);return this.previous=W,W}}break;case 43:let d=e;if(d>=48&&d<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpPlusAssign,S);return this.previous=W,W}else{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpPlus,S);return this.previous=W,W}}break;case 44:let x=1;for(;x-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let y=t;y==null&&(y=new z(this.startLine,this.startColumn,this.pos)),y.length=this.pos-y.offset;let b=new ie(g.Comma,y);return this.previous=b,b;case 45:let v=e;if(v>=48&&v<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==62){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.Arrow,S);return this.previous=W,W}else if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==45&&this.strictExprs.length==0){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.Separator,S);return this.previous=W,W}else if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpMinusAssign,S);return this.previous=W,W}else{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpMinus,S);return this.previous=W,W}}break;case 46:let T=1;for(;T-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let E=t;E==null&&(E=new z(this.startLine,this.startColumn,this.pos)),E.length=this.pos-E.offset;let F=new ie(g.Dot,E);return this.previous=F,F;case 47:let L=e;if(L>=48&&L<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpDivideAssign,S);return this.previous=W,W}else{if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==47)return this.readLineComment();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==42)return this.readMultiLineComment();{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpDivide,S);return this.previous=W,W}}}break;case 58:let A=1;for(;A-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let B=t;B==null&&(B=new z(this.startLine,this.startColumn,this.pos)),B.length=this.pos-B.offset;let I=new ie(g.Colon,B);return this.previous=I,I;case 60:let H=e;if(H>=48&&H<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpLessEq,S);return this.previous=W,W}else{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpLess,S);return this.previous=W,W}}break;case 61:let P=e;if(P>=48&&P<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpEquals,S);return this.previous=W,W}else{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpAssign,S);return this.previous=W,W}}break;case 62:let M=e;if(M>=48&&M<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpGreaterEq,S);return this.previous=W,W}else{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpGreater,S);return this.previous=W,W}}break;case 93:let V=1;for(;V-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.strictExprs.pop();let R=t;R==null&&(R=new z(this.startLine,this.startColumn,this.pos)),R.length=this.pos-R.offset;let Y=new ie(g.RBracket,R);return this.previous=Y,Y;case 124:let $=e;if($>=48&&$<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==124){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpOr(!1),S);return this.previous=W,W}else{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.error("Expected |",!1);let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpOr(!1),S);return this.previous=W,W}}break;default:let te=e;if(te>=48&&te<=57)return this.readNumber();{let O=e;return O>=97&&O<=122||O>=65&&O<=90||O==95?this.readIdentifier():(this.error("Unexpected character: "+String.fromCodePoint(e),!0),null)}}}else switch(e){case 34:return this.readString(t);case 91:let i=1;for(;i-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.makeLooseOrStrictAfterBracket();let s=t;s==null&&(s=new z(this.startLine,this.startColumn,this.pos)),s.length=this.pos-s.offset;let n=new ie(g.LBracket,s);return this.previous=n,n;case 123:let l=1;for(;l-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let r=t;r==null&&(r=new z(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ie(g.LBrace,r);return this.previous=h,h;case 125:let a=1;for(;a-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let o=t;o==null&&(o=new z(this.startLine,this.startColumn,this.pos)),o.length=this.pos-o.offset;let c=new ie(g.RBrace,o);return this.previous=c,c;default:let p=this.tryReadUnquotedString();if(p!=null)return p;if(e==null){let f=e;if(f>=48&&f<=57)return this.readNumber();{let _=e;return _>=97&&_<=122||_>=65&&_<=90||_==95?this.readIdentifier():(this.error("Unexpected character: "+String.fromCodePoint(e),!0),null)}}else switch(e){case 33:let f=e;if(f>=48&&f<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpNotEquals,N);return this.previous=X,X}else{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpNot,N);return this.previous=X,X}}break;case 35:let _=e;if(_>=48&&_<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();{let se=this.pos+1<this.length?u.cca(this.input,this.pos+1):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 d=e;if(d>=48&&d<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpModulo,N);return this.previous=X,X}}break;case 38:let x=e;if(x>=48&&x<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==38){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpAnd(!1),N);return this.previous=X,X}else{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.error("Expected &",!1);let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpAnd(!1),N);return this.previous=X,X}}break;case 40:let y=1;for(;y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.makeStrictIfFollowingCallable();let b=t;b==null&&(b=new z(this.startLine,this.startColumn,this.pos)),b.length=this.pos-b.offset;let v=new ie(g.LParen,b);return this.previous=v,v;case 41:let T=1;for(;T-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.strictExprs.pop();let E=t;E==null&&(E=new z(this.startLine,this.startColumn,this.pos)),E.length=this.pos-E.offset;let F=new ie(g.RParen,E);return this.previous=F,F;case 42:let L=e;if(L>=48&&L<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpMultiplyAssign,N);return this.previous=X,X}else{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpMultiply,N);return this.previous=X,X}}break;case 43:let A=e;if(A>=48&&A<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpPlusAssign,N);return this.previous=X,X}else{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpPlus,N);return this.previous=X,X}}break;case 44:let B=1;for(;B-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let I=t;I==null&&(I=new z(this.startLine,this.startColumn,this.pos)),I.length=this.pos-I.offset;let H=new ie(g.Comma,I);return this.previous=H,H;case 45:let P=e;if(P>=48&&P<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==62){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.Arrow,N);return this.previous=X,X}else if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==45&&this.strictExprs.length==0){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.Separator,N);return this.previous=X,X}else if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpMinusAssign,N);return this.previous=X,X}else{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpMinus,N);return this.previous=X,X}}break;case 46:let M=1;for(;M-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let V=t;V==null&&(V=new z(this.startLine,this.startColumn,this.pos)),V.length=this.pos-V.offset;let R=new ie(g.Dot,V);return this.previous=R,R;case 47:let Y=e;if(Y>=48&&Y<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpDivideAssign,N);return this.previous=X,X}else{if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==47)return this.readLineComment();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==42)return this.readMultiLineComment();{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpDivide,N);return this.previous=X,X}}}break;case 58:let $=1;for(;$-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let te=t;te==null&&(te=new z(this.startLine,this.startColumn,this.pos)),te.length=this.pos-te.offset;let O=new ie(g.Colon,te);return this.previous=O,O;case 60:let q=e;if(q>=48&&q<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpLessEq,N);return this.previous=X,X}else{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpLess,N);return this.previous=X,X}}break;case 61:let S=e;if(S>=48&&S<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpEquals,N);return this.previous=X,X}else{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpAssign,N);return this.previous=X,X}}break;case 62:let W=e;if(W>=48&&W<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpGreaterEq,N);return this.previous=X,X}else{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpGreater,N);return this.previous=X,X}}break;case 93:let ve=1;for(;ve-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.strictExprs.pop();let de=t;de==null&&(de=new z(this.startLine,this.startColumn,this.pos)),de.length=this.pos-de.offset;let Ce=new ie(g.RBracket,de);return this.previous=Ce,Ce;case 124:let Se=e;if(Se>=48&&Se<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==124){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpOr(!1),N);return this.previous=X,X}else{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.error("Expected |",!1);let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpOr(!1),N);return this.previous=X,X}}break;default:let Ee=e;if(Ee>=48&&Ee<=57)return this.readNumber();{let J=e;return J>=97&&J<=122||J>=65&&J<=90||J==95?this.readIdentifier():(this.error("Unexpected character: "+String.fromCodePoint(e),!0),null)}}}}countIndentation(){let e=this.pos,t=0;for(;e<this.length;){let i=u.cca(this.input,e);if(i==32)++t;else if(i==9)++t;else break;++e}return e>=this.length||u.cca(this.input,e)==10||u.cca(this.input,e)==13?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 g.KwBeat;case 2:case 3:return g.KwState;case 4:case 5:return g.KwCharacter;case 6:case 7:return g.KwBeat;case 8:case 9:return g.KwBeat;case 10:return g.LBrace;case 11:return g.Indent;case 12:return g.LBracket}--e}return g.KwBeat}inBeat(){return this.parentBlockType()==g.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!=g.KwState?e==g.KwCharacter:!0}readLineBreak(){let e=new z(this.startLine,this.startColumn,this.pos);if(u.cca(this.input,this.pos)==13){let s=1;for(;s-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;if(this.pos<this.length&&u.cca(this.input,this.pos)==10){let n=1;for(;n-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let s=1;for(;s-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let t=e;t==null&&(t=new z(this.startLine,this.startColumn,this.pos)),t.length=this.pos-t.offset;let i=new ie(g.LineBreak,t);return this.previous=i,i}isWhitespace(e){return e!=32?e==9:!0}matchIdentifier(e){if(this.length==0)return null;let t=u.cca(this.input,e);if(!(t>=97&&t<=122||t>=65&&t<=90||t==95))return null;let i=1;for(;i<this.length;){let n=u.cca(this.input,e+i);if(!(n>=97&&n<=122||n>=65&&n<=90||n==95||n>=48&&n<=57))break;++i}let s=this.input;return i!=null?u.substr(s,e,i):u.substr(s,e,null)}_skipWhitespaceAndComments(e,t){if(t==null&&(t=!1),t)return this._skipWhitespaceAndCommentsStopNextLine(e);{let i=e,s=!1;for(;e<this.length;){for(;e<this.length&&(u.cca(this.input,e)==32||u.cca(this.input,e)==9);)++e,s=!0;if(e<this.length-1&&u.cca(this.input,e)==47){if(u.cca(this.input,e+1)==47)return e=i,e;if(u.cca(this.input,e+1)==42){e+=2,s=!0;let n=!1;for(;e<this.length-1;){if(u.cca(this.input,e)==42&&u.cca(this.input,e+1)==47){e+=2,n=!0;break}++e}if(!n)return e=i,e;continue}}break}return s?e:i}}_skipWhitespaceAndCommentsStopNextLine(e){let t=e,i=!1,s=!1;for(;e<this.length;){for(;e<this.length;){let n=u.cca(this.input,e);if(n==32||n==9||n==13||!s&&n==10)n==10&&(s=!0),++e,i=!0;else break}if(e<this.length-1&&!s&&u.cca(this.input,e)==47){if(u.cca(this.input,e+1)==47){for(e+=2,i=!0;e<this.length&&u.cca(this.input,e)!=10&&u.cca(this.input,e)!=13;)++e;continue}else if(u.cca(this.input,e+1)==42){e+=2,i=!0;let n=!1;for(;e<this.length-1;){if(u.cca(this.input,e)==42&&u.cca(this.input,e+1)==47){e+=2,n=!0;break}++e}if(!n)return e=t,e;continue}}break}return i?e:t}isIfStart(e){if(e=this._skipWhitespaceAndComments(e,!1),u.cca(this.input,e)!=105||(++e,u.cca(this.input,e)!=102))return!1;let t=++e;if(e=this._skipWhitespaceAndComments(e,!1),e<this.length&&u.cca(this.input,e)==33&&(++e,e=this._skipWhitespaceAndComments(e,!1)),u.cca(this.input,e)==40)return!0;let i;if(e==t){let l=u.cca(this.input,t);i=l>=97&&l<=122||l>=65&&l<=90||l==95}else i=!1;if(i)return!1;let s;if(e<this.length){let l=u.cca(this.input,e);s=!(l>=97&&l<=122||l>=65&&l<=90||l==95)}else s=!0;if(s)return!1;let n=this;for(;e<this.length;){if(u.cca(this.input,e)==40)return!0;{let a=!0,o=n.length;if(e>=o)a=!1;else{let c;if(e+1<o&&u.cca(n.input,e)==111&&u.cca(n.input,e+1)==114){let p=u.cca(n.input,e+2);c=!(p>=97&&p<=122||p>=65&&p<=90||p==95)}else c=!1;if(c)a=!1;else{let p;if(e+2<o&&u.cca(n.input,e)==97&&u.cca(n.input,e+1)==110&&u.cca(n.input,e+2)==100){let f=u.cca(n.input,e+3);p=!(f>=97&&f<=122||f>=65&&f<=90||f==95)}else p=!1;if(p)a=!1;else{let f=u.cca(n.input,e);if(!(f>=97&&f<=122||f>=65&&f<=90||f==95))a=!1;else for(++e;e<n.length&&(f=u.cca(n.input,e),f>=97&&f<=122||f>=65&&f<=90||f==95||f>=48&&f<=57);)++e}}}if(!a)return!1}if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let l=u.cca(this.input,e);if(l==46){++e,e=this._skipWhitespaceAndComments(e,!1);let a=!0,o=n.length;if(e>=o)a=!1;else{let c;if(e+1<o&&u.cca(n.input,e)==111&&u.cca(n.input,e+1)==114){let p=u.cca(n.input,e+2);c=!(p>=97&&p<=122||p>=65&&p<=90||p==95)}else c=!1;if(c)a=!1;else{let p;if(e+2<o&&u.cca(n.input,e)==97&&u.cca(n.input,e+1)==110&&u.cca(n.input,e+2)==100){let f=u.cca(n.input,e+3);p=!(f>=97&&f<=122||f>=65&&f<=90||f==95)}else p=!1;if(p)a=!1;else{let f=u.cca(n.input,e);if(!(f>=97&&f<=122||f>=65&&f<=90||f==95))a=!1;else for(++e;e<n.length&&(f=u.cca(n.input,e),f>=97&&f<=122||f>=65&&f<=90||f==95||f>=48&&f<=57);)++e}}}if(!a||(e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!0;l=u.cca(this.input,e)}if(l==91){++e;let a=1;for(;e<this.length&&a>0;)l=u.cca(this.input,e),l==91&&++a,l==93&&--a,++e;if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;l=u.cca(this.input,e)}let r;if(l==97&&u.cca(this.input,e+1)==110&&u.cca(this.input,e+2)==100){let a=u.cca(this.input,e+3);r=!(a>=97&&a<=122||a>=65&&a<=90||a==95)}else r=!1;if(r)return!0;let h;if(l==111&&u.cca(this.input,e+1)==114){let a=u.cca(this.input,e+2);h=!(a>=97&&a<=122||a>=65&&a<=90||a==95)}else h=!1;if(h||l==40||l==38||l==124||u.cca(this.input,e+1)==61&&l==61||l==62||l==60||l==33&&u.cca(this.input,e+1)==61||u.cca(this.input,e+1)!=61&&(l==43||l==45||l==42||l==47||l==123))return!0;if(l==10||l==13||e>=this.length)return e=t,!0;if(l==32||l==9){let a=e;for(;;){let o;if(a<this.length){let c=u.cca(this.input,a);o=c==32||c==9}else o=!1;if(!o)break;++a}if(a+1<this.length&&u.cca(this.input,a)==47&&u.cca(this.input,a+1)==47)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;if(u.cca(this.input,e)==40)return!0;let i=this,s=t;s==null&&(s=!1);let n=!0;if(e>=i.length)n=!1;else{let l=!1,r=u.cca(i.input,e);if(l=r==95,!(r>=97&&r<=122||r>=65&&r<=90||r==95)||s&&!l&&!(r>=97&&r<=122))n=!1;else for(++e;e<i.length;){let h=l;if(r=u.cca(i.input,e),l=r==95,!(r>=97&&r<=122||r>=65&&r<=90||r==95||r>=48&&r<=57))break;if(s&&h&&!l&&!(r>=97&&r<=122)){n=!1;break}++e}}if(!n)return!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let l=u.cca(this.input,e);if(!(l==32||l==9)&&l!=46&&l!=91&&l!=10&&l!=13&&l!=47)return!1;if(l==10||l==13||l==47&&e+1<this.length&&(u.cca(this.input,e+1)==47||u.cca(this.input,e+1)==42))return!0;if(l==46){if(++e,e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let r=!0;if(e>=i.length)r=!1;else{let h=!1,a=u.cca(i.input,e);if(h=a==95,!(a>=97&&a<=122||a>=65&&a<=90||a==95))r=!1;else for(++e;e<i.length;){let o=h;if(a=u.cca(i.input,e),h=a==95,!(a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57))break;++e}}if(!r)return!0;continue}if(l==91){++e;let r=1;for(;e<this.length&&r>0;)l=u.cca(this.input,e),l==91&&++r,l==93&&--r,++e;continue}if(l==32||l==9){++e;continue}break}return!0}isTransitionStart(e){if(u.cca(this.input,e)!=45||e>=this.length-1||u.cca(this.input,e+1)!=62||(e+=2,e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!1;if(u.cca(this.input,e)==46)++e;else{let i=u.cca(this.input,e);if(i>=97&&i<=122||i>=65&&i<=90||i==95||i>=48&&i<=57)for(++e;;){let s;if(e<this.length){let n=u.cca(this.input,e);s=n>=97&&n<=122||n>=65&&n<=90||n==95||n>=48&&n<=57}else s=!1;if(!s)break;++e}else return!1}if(e=this._skipWhitespaceAndComments(e,!1),e<this.length){let i=u.cca(this.input,e);if(i!=10&&i!=13&&i!=32&&i!=9&&i!=47&&i!=35)return!1}return!0}isInsertionStart(e){if(u.cca(this.input,e)!=43||(++e,e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!1;if(u.cca(this.input,e)==46)++e;else{let i=u.cca(this.input,e);if(i>=97&&i<=122||i>=65&&i<=90||i==95||i>=48&&i<=57)for(++e;;){let s;if(e<this.length){let n=u.cca(this.input,e);s=n>=97&&n<=122||n>=65&&n<=90||n==95||n>=48&&n<=57}else s=!1;if(!s)break;++e}else return!1}if(e=this._skipWhitespaceAndComments(e,!1),e<this.length){let i=u.cca(this.input,e);if(i!=10&&i!=13&&i!=32&&i!=9&&i!=47)return!1}return!0}isLabelStart(e){e=this._skipWhitespaceAndComments(e,!1);let t=u.cca(this.input,e);if(!(t>=97&&t<=122||t>=65&&t<=90||t==95))return!1;let i=e;for(++e;;){let r;if(e<this.length){let h=u.cca(this.input,e);r=h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57}else r=!1;if(!r)break;++e}for(;;){let r;if(e<this.length){let h=u.cca(this.input,e);r=h==32||h==9}else r=!1;if(!r)break;++e}if(e>=this.length||u.cca(this.input,e)!=58)return!1;let s=this.input,n=e-i,l=n!=null?u.substr(s,i,n):u.substr(s,i,null);return!Object.prototype.hasOwnProperty.call(wt.KEYWORDS.h,l)}isCallStart(e){let t=e,i=this,s=!0;if(e>=i.length)s=!1;else{let n=u.cca(i.input,e);if(!(n>=97&&n<=122||n>=65&&n<=90||n==95))s=!1;else for(++e;e<i.length&&(n=u.cca(i.input,e),n>=97&&n<=122||n>=65&&n<=90||n==95||n>=48&&n<=57);)++e}if(!s)return e=t,!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return e=t,!1;let n=u.cca(this.input,e);if(n==40)return e=t,!0;if(n==46){++e,e=this._skipWhitespaceAndComments(e,!1);let l=!0;if(e>=i.length)l=!1;else{let r=u.cca(i.input,e);if(!(r>=97&&r<=122||r>=65&&r<=90||r==95))l=!1;else for(++e;e<i.length&&(r=u.cca(i.input,e),r>=97&&r<=122||r>=65&&r<=90||r==95||r>=48&&r<=57);)++e}if(!l)return e=t,!1;continue}if(n==91){for(++e;e<this.length;){if(u.cca(this.input,e)==93){++e;break}++e}continue}return e=t,!1}return e=t,!1}isAssignStart(e,t){let i=this,s;if(t){let l=!0,r=e;if(e>=i.length)l=!1;else{let h=u.cca(i.input,e);if(!(h>=97&&h<=122||h>=65&&h<=90||h==95))l=!1;else for(++e;e<i.length&&(h=u.cca(i.input,e),h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57);)++e}s=!(!(e==r+2&&u.cca(i.input,r)==105&&u.cca(i.input,r+1)==102)&&l)}else s=!1;if(s)return!1;let n=!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!1;let l=u.cca(this.input,e);if(!n&&(l==61||u.cca(this.input,e+1)==61&&(l==43||l==45||l==42||l==47)))return!0;if(t){if(l==46){++e,e=this._skipWhitespaceAndComments(e,!1);let r=!0,h=e;if(e>=i.length)r=!1;else{let a=u.cca(i.input,e);if(!(a>=97&&a<=122||a>=65&&a<=90||a==95))r=!1;else for(++e;e<i.length&&(a=u.cca(i.input,e),a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57);)++e}if(!(!(e==h+2&&u.cca(i.input,h)==105&&u.cca(i.input,h+1)==102)&&r))return!1;continue}if(l==91){for(++e;e<this.length;){if(u.cca(this.input,e)==93){++e;break}++e}continue}return!1}else if(l==92)n=!0,++e;else{if(l==13||l==10)return!1;if(l>=97&&l<=122||l>=65&&l<=90||l==95){let r=!0,h=e;if(e>=i.length)r=!1;else{let a=u.cca(i.input,e);if(!(a>=97&&a<=122||a>=65&&a<=90||a==95))r=!1;else for(++e;e<i.length&&(a=u.cca(i.input,e),a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57);)++e}if(!(!(e==h+2&&u.cca(i.input,h)==105&&u.cca(i.input,h+1)==102)&&r))return!1}else++e}}return!1}isColon(e,t){if(t==null&&(t=!0),t)for(;e<this.length&&(u.cca(this.input,e)==32||u.cca(this.input,e)==9);)++e;return e<this.length?u.cca(this.input,e)==58:!1}afterLabelIdentifierToken(e){e==null&&(e=!0);let t=this.tokenized.length-1;for(;t>=0;){let i=this.tokenized[t];if(!Ft.isComment(i.type)&&(e||i.type!=g.LineBreak&&i.type!=g.Indent&&i.type!=g.Unindent))return i.type==g.Colon&&t>0&&Ft.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!=g.Colon;)++i;let s=this.tokenized[i].pos.offset+1,n=t.pos.column,l=!0,r=!1;for(;s<this.length;){let _=u.cca(this.input,s);if(_==32||_==9)++s;else break}for(;s<this.length;){let _=u.cca(this.input,s);if(_==10||_==13)break;if(_==47&&s+1<this.length){let d=u.cca(this.input,s+1);if(d==47)break;if(d==42){for(s+=2;s<this.length;){if(u.cca(this.input,s)==42&&s+1<this.length&&u.cca(this.input,s+1)==47){s+=2;break}++s}continue}}if(_==60)r=!0;else if(_==62)r=!1;else if(!r&&!(_==32||_==9)){l=!1;break}++s}if(!l)return-1;let h=s,a=!0;if(a==null&&(a=!1),s=this._skipWhitespaceAndComments(s,a),s<=h)return-1;let o=0,c=s;for(;c>0&&(u.cca(this.input,c-1)==32||u.cca(this.input,c-1)==9);)++o,--c;if(o<=n-1)return-1;let p=!1;p==null&&(p=!1),s=this._skipWhitespaceAndComments(s,p);let f=u.cca(this.input,s);return f==32||f==9||u.cca(this.input,s)==47&&u.cca(this.input,s+1)==47?-1:o}isContinuingMultilineText(e,t){if(u.cca(this.input,e)==47&&u.cca(this.input,e+1)==47)for(;e<this.length&&u.cca(this.input,e)!=13&&u.cca(this.input,e)!=10;)++e;if(u.cca(this.input,e)==13&&++e,u.cca(this.input,e)==10)++e;else return!1;let i=0;for(;u.cca(this.input,e)==32||u.cca(this.input,e)==9;)++i,++e;if(i!=t)return!1;let s=!1;s==null&&(s=!1),e=this._skipWhitespaceAndComments(e,s);let n=u.cca(this.input,e);return!(n==32||n==9||u.cca(this.input,e)==13||u.cca(this.input,e)==10||u.cca(this.input,e)==47&&u.cca(this.input,e+1)==47)}isAfterComma(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(!Ft.isComment(t.type)&&t.type!=g.LineBreak&&t.type!=g.Indent&&t.type!=g.Unindent)return t.type==g.Comma;--e}return!1}isAfterLBracket(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(!Ft.isComment(t.type)&&t.type!=g.LineBreak&&t.type!=g.Indent&&t.type!=g.Unindent)return t.type==g.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(Ft.isComment(t.type)||t.type==g.Indent||t.type==g.Unindent)--e;else return!!Ft.isAssignOp(t.type)}return!1}followsOnlyLabelOrCommentsInLine(){let e=!1,t=this.tokenized.length-1;for(;t>=0;){let i=this.tokenized[t];if(Ft.isComment(i.type)||i.type==g.Indent||i.type==g.Unindent)--t;else if(!e&&i.type==g.Colon)if(--t,t>=0)Ft.isIdentifier(this.tokenized[t].type)&&(e=!0,--t);else return!1;else return i.type==g.LineBreak}return!0}followsOnlyWhitespacesOrCommentsInLine(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Ft.isComment(t.type)||t.type==g.Indent||t.type==g.Unindent)--e;else return t.type==g.LineBreak}return!0}hasNonSpecialChar(e){let t=0,i=e.length;for(;t<i;){let s=t++,n=!1,l=u.cca(e,s),r=0,h=wt.hasNonSpecialChar_specialChars.length;for(;r<h;){let a=r++;if(l==u.cca(wt.hasNonSpecialChar_specialChars,a)){n=!0;break}}if(!n)return!0}return!1}isNumber(e){let t=0,i=e.length;for(;;){let n;if(t<i){let l=u.cca(e,t);n=l>=48&&l<=57}else n=!1;if(!n)break;++t}let s;if(t<i&&u.cca(e,t)==46&&t+1<i){let n=u.cca(e,t+1);s=n>=48&&n<=57}else s=!1;if(s)for(++t;;){let n;if(t<i){let l=u.cca(e,t);n=l>=48&&l<=57}else n=!1;if(!n)break;++t}return t==i}makeLooseOrStrictAfterBracket(){let e=this.tokenized.length-1;for(;e>=0;){let i=this.tokenized[e].type;switch(i._hx_index){case 19:let s=i.name;this.strictExprs.push(1);return;case 46:case 48:this.strictExprs.push(1);return;case 49:let n=i.content;break;case 50:let l=i.content;break;case 51:let r=i.content;break;case 52:case 53:case 54: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 s=i.name;return!0;case 46:case 48:return!0;case 49:let n=i.content;break;case 50:let l=i.content;break;case 51:let r=i.content;break;case 52:case 53:case 54: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=u.cca(this.input,this.pos);if(r==10)break;i+=String.fromCodePoint(r),this.pos++}let s=Te.rtrim(i),n=new z(t.line,t.column,t.offset,s.length);n==null&&(n=new z(this.startLine,this.startColumn,this.pos)),n.length=this.pos-n.offset;let l=new ie(g.LString(0,s,[]),n);return this.previous=l,l}}tryReadUnquotedString(){if(this.isStrict())return null;let e=u.cca(this.input,this.pos),t=this.pos+1<this.length?u.cca(this.input,this.pos+1):0;if(e==47&&this.pos<this.length-1){let I=u.cca(this.input,this.pos+1);if(I==47||I==42)return null}if(e==123||e==125||e==91||e==93||e==34||e==58||e==35||e==32||e==9)return null;let i=this.parentBlockType();if(i!=g.KwBeat&&i!=g.KwState&&i!=g.KwCharacter)return null;let s=this.isInsideBrackets(),n=!1,l=this.afterLabelIdentifierToken(!1);if(l!=-1&&this.tokenized[l].pos.line<this.line&&(this.tokenized[l].pos.column>=this.column||this.line-this.tokenized[l].pos.line>1))return null;let r=l!=-1?this.isStartingMultilineDialogue(l):-1,h=l!=-1,a=i==g.KwState||i==g.KwCharacter||s||n;if(a){if(this.isCallStart(this.pos)||this.isLabelStart(this.pos))return null}else if(!h&&(this.isIdentifierExpressionStart(this.pos,!0)||this.isIfStart(this.pos)||this.isCallStart(this.pos)||this.isAssignStart(this.pos,!1)))return null;if(!a&&(e==61||t==61&&(e==43||e==45||e==42||e==47))||!a&&!h&&this.isInsertionStart(this.pos))return null;let o=this.matchIdentifier(this.pos);if(o!=null&&(o=="function"||!a&&(o!="if"&&o!="null"&&o!="true"&&o!="false"&&o!="and"&&o!="or"&&Object.prototype.hasOwnProperty.call(wt.KEYWORDS.h,o)||this.isColon(this.pos+o.length))))return null;let c=!a,p=!1;if(a){if(s){if(!h&&!this.followsOnlyWhitespacesOrCommentsInLine()&&!this.isAfterComma()&&!this.isAfterLBracket())return null}else if(!n&&!h)return null}else if(p=this.followsOnlyLabelOrCommentsInLine(),!p&&!this.followsOnlyWhitespacesOrCommentsInLine()||!p&&t==62&&e==45)return null;let f=new z(this.startLine,this.startColumn,this.pos),_="",d=[],x=this.line,y=this.column,b=this.pos,v=!1,T=-1,E=!1,F=this.column,L=this.line,A=!0,B=!1;for(;this.pos<this.length;){let I=u.cca(this.input,this.pos),H=I==32||I==9;if(B||!H&&T==-1&&(I!=60||!c)&&(B=!0),v){_+=String.fromCodePoint(92),_+=String.fromCodePoint(I),v=!1;let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;F+=2}else if(I==92){v=!0;let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}else if(T==-1&&H&&!B&&d.length==0){let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}else{if(T==-1&&I==123)break;if(T==-1&&(I==10||I==13||I==47&&this.pos<this.length-1&&u.cca(this.input,this.pos+1)==47))if(r!=-1)if(this.isContinuingMultilineText(this.pos,r)){_+=String.fromCodePoint(I);let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;if(I==13&&u.cca(this.input,this.pos)==10){_+=String.fromCodePoint(10);let M=1;for(;M-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}F=this.column,L=this.line}else break;else break;else if(T==-1&&I==47&&this.pos<this.length-1&&u.cca(this.input,this.pos+1)==42){_+=String.fromCodePoint(47),_+=String.fromCodePoint(42);let P=2;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let M=!1;for(;this.pos<this.length;){if(u.cca(this.input,this.pos)==42&&this.pos+1<this.length&&u.cca(this.input,this.pos+1)==47){_+=String.fromCodePoint(42),_+=String.fromCodePoint(47);let Y=2;for(;Y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;M=!0;break}let V=u.cca(this.input,this.pos);_+=String.fromCodePoint(V);let R=1;for(;R-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}F=this.column,L=this.line,M||this.error("Unterminated multiline comment",!1)}else{if(T==-1&&!a&&this.isIfStart(this.pos))break;if(T==-1&&I==45&&this.pos<this.length-1&&u.cca(this.input,this.pos+1)==62&&this.isTransitionStart(this.pos))break;if(T==-1&&a&&(I==44||I==93||I==125))break;if(c&&I==60){T!=-1&&this.error("Unexpected < inside tag",!0),E=(this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==47;let M=this.pos+(E?2:1);if(M<this.length){let R=u.cca(this.input,M);(R>=97&&R<=122||R>=65&&R<=90||R==95||R==95||R==36||E&&R==62)&&(T=_.length)}_+=String.fromCodePoint(I);let V=1;for(;V-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;++F}else if(c&&I==62){_+=String.fromCodePoint(I);let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;++F,T!=-1&&(d.push(Ii.Tag(E,T,_.length-T)),T=-1)}else if(T==-1&&I==35&&!v){let P=this.pos+1<this.length?u.cca(this.input,this.pos+1):0;if(P==35){_+=String.fromCodePoint(35),_+=String.fromCodePoint(35);let M=1;for(;M-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let V=1;for(;V-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;F+=2}else{if(P>=97&&P<=122||P>=65&&P<=90||P==95||P>=48&&P<=57||P==45)break;{_+=String.fromCodePoint(I);let M=1;for(;M-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;++F}}}else if(I==36&&!v){let P=_.length,M=L,V=F,R=this.pos;try{let Y=1;for(;Y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;if(++F,u.cca(this.input,this.pos)==123){let $=1;for(;$-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;++F;let te=new z(M,V+2,this.pos),O=this.readComplexInterpolation(te),q=this.pos-R;d.push(Ii.Interpolation(!0,T!=-1,O,P,q));let S=this.input;_+=Z.string(q!=null?u.substr(S,R,q):u.substr(S,R,null))}else{let $=u.cca(this.input,this.pos);if($>=97&&$<=122||$>=65&&$<=90||$==95){let te=new z(M,V+1,this.pos),O=this.readFieldAccessInterpolation(te),q=this.pos-R;d.push(Ii.Interpolation(!1,T!=-1,O,P,q));let S=this.input;_+=Z.string(q!=null?u.substr(S,R,q):u.substr(S,R,null))}else if(u.cca(this.input,this.pos)==36){_+=String.fromCodePoint(36),_+=String.fromCodePoint(36);let te=1;for(;te-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;++F}else{this.error("Expected identifier or { after $",!1);let te=this.pos-R;d.push(Ii.Interpolation(!1,T!=-1,[],P,te));let O=this.input;_+=Z.string(te!=null?u.substr(O,R,te):u.substr(O,R,null))}}}catch(Y){let $=k.caught(Y).unwrap();if($ instanceof Zi){let te=$;throw te.pos==null&&(te.pos=new z(M,V,this.pos)),k.thrown(te)}else throw Y}F=V+(this.pos-R)}else{I==10?(++L,F=1):++F,_+=String.fromCodePoint(I);let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}if(A){let I=_,H=I.length;I=Te.rtrim(I);let P=I.length,M=H-P;if(P>0&&this.hasNonSpecialChar(I)&&!this.isNumber(I)&&I!="null"&&I!="true"&&I!="false"){if(r==-1&&!h&&!this.inChoiceRoot()){let te=this.line,O=this.column,q=this.pos,S=!0;S==null&&(S=!1);let W=S;W==null&&(W=!1);let ve=this._skipWhitespaceAndComments(this.pos,W);for(;this.pos<ve;){let Ce=1;for(;Ce-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let de=this.pos;if(this.column==y){let Ce=this.tryReadUnquotedString();if(Ce!=null){let Se=this.input,Ee=q-M,J=de!=null?Se.substring(Ee,de):Se.substring(Ee),se=Ce.type;if(se._hx_index==15){let X=se.quotes,rt=se.s,Ve=se.attachments;if(Ve!=null){let Ye=0;for(;Ye<Ve.length;){let Ue=Ve[Ye];switch(++Ye,Ue._hx_index){case 0:let He=Ue.braces,Je=Ue.inTag,$e=Ue.expr,Be=Ue.start,Ne=Ue.length;d.push(Ii.Interpolation(He,Je,$e,Be+de-b,Ne));break;case 1:let mt=Ue.closing,gt=Ue.start,Nt=Ue.length;d.push(Ii.Tag(mt,gt+de-b,Nt));break}}}I+=J,I+=rt}M=0;let N=this.pos-1;for(;N>=0&&u.cca(this.input,N)==32||u.cca(this.input,N)==9;)++M,--N}else this.line=te,this.column=O,this.pos=q}else this.line=te,this.column=O,this.pos=q}d.sort(function(te,O){return wt.compareAttachments(te,O)});let V=d.length>0?d:null,R=f;R==null&&(R=new z(this.startLine,this.startColumn,this.pos)),R.length=this.pos-R.offset;let Y=new ie(g.LString(0,I,V),R);this.previous=Y;let $=Y;return $.pos.length-=M,$}}return this.line=x,this.column=y,this.pos=b,null}readString(e){let t=1;for(;t-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let i="",s=[],n=!1,l=-1,r=!1,h=e.column+1,a=e.line,o=this.parentBlockType()==g.KwBeat;for(;this.pos<this.length;){let c=u.cca(this.input,this.pos);if(n){i+=String.fromCodePoint(92),i+=String.fromCodePoint(c),n=!1;let p=1;for(;p-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;h+=2}else if(c==92){n=!0;let p=1;for(;p-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}else if(c==34&&l==-1){let p=1;for(;p-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;s.sort(function(x,y){return wt.compareAttachments(x,y)});let f=s.length>0?s:null,_=e;_==null&&(_=new z(this.startLine,this.startColumn,this.pos)),_.length=this.pos-_.offset;let d=new ie(g.LString(1,i,f),_);return this.previous=d,d}else if(o&&c==60){l!=-1&&this.error("Unexpected < inside tag",!0),r=(this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==47;let f=this.pos+(r?2:1);if(f<this.length){let d=u.cca(this.input,f);(d>=97&&d<=122||d>=65&&d<=90||d==95||d==95||d==36||r&&d==62)&&(l=i.length)}i+=String.fromCodePoint(c);let _=1;for(;_-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;++h}else if(c==62){i+=String.fromCodePoint(c);let p=1;for(;p-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;++h,l!=-1&&(s.push(Ii.Tag(r,l,i.length-l)),l=-1)}else if(c==36&&!n){let p=i.length,f=a,_=h,d=this.pos;try{let x=1;for(;x-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;if(++h,u.cca(this.input,this.pos)==123){let y=1;for(;y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;++h;let b=new z(f,_+2,this.pos),v=this.readComplexInterpolation(b),T=this.pos-d;s.push(Ii.Interpolation(!0,l!=-1,v,p,T));let E=this.input;i+=Z.string(T!=null?u.substr(E,d,T):u.substr(E,d,null))}else{let y=u.cca(this.input,this.pos);if(y>=97&&y<=122||y>=65&&y<=90||y==95){let b=new z(f,_+1,this.pos),v=this.readFieldAccessInterpolation(b),T=this.pos-d;s.push(Ii.Interpolation(!1,l!=-1,v,p,T));let E=this.input;i+=Z.string(T!=null?u.substr(E,d,T):u.substr(E,d,null))}else if(u.cca(this.input,this.pos)==36){i+=String.fromCodePoint(36),i+=String.fromCodePoint(36);let b=1;for(;b-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;++h}else{this.error("Expected identifier or { after $",!1);let b=this.pos-d;s.push(Ii.Interpolation(!1,l!=-1,[],p,b));let v=this.input;i+=Z.string(b!=null?u.substr(v,d,b):u.substr(v,d,null))}}}catch(x){let y=k.caught(x).unwrap();if(y instanceof Zi){let b=y;throw b.pos==null&&(b.pos=new z(f,_,this.pos)),k.thrown(b)}else throw x}h=_+(this.pos-d)}else{c==10?(++a,h=1):++h,i+=String.fromCodePoint(c);let p=1;for(;p-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==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,s=e.column,n=e.line;for(;this.pos<this.length&&i>0;){if(u.cca(this.input,this.pos)==34){let r=new z(n,s,this.pos);t.push(this.readString(r)),s+=this.pos-r.offset;continue}let l=this.nextToken();if(t.push(l),l.type==g.LineBreak)++n,s=1;else if(!(l.type==g.Indent||l.type==g.Unindent)){let r,h=l.type;switch(h._hx_index){case 15:let a=h.attachments,o=h.quotes;r=h.s.length+(o!=0?2:0);break;case 16:let p=h.n;r=(p==null?"null":""+p).length;break;case 19:r=h.name.length;break;default:r=1}s+=r}switch(l.type._hx_index){case 43:++i;break;case 44:--i;break;default:}l.type==g.Eof&&this.error("Unterminated interpolation expression",!0)}return t.pop(),this.strictExprs.pop(),t}nextTokenWithPosition(e){let t=this.line,i=this.column,s=this.pos,n=this.nextToken(),l=n.pos.length,r=this.pos-s;return n.pos=new z(e.line,e.column+r,e.offset+r,l),this.line=t,this.column=i,n}readFieldAccessInterpolation(e){this.strictExprs.push(1);let t=[],i=u.cca(this.input,this.pos);i>=97&&i<=122||i>=65&&i<=90||i==95||this.error("Expected identifier in field access",!0);let s=this.pos;for(;this.pos<this.length;){let a=u.cca(this.input,this.pos);if(!(a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57))break;let o=1;for(;o-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let n=this.input,l=this.pos-s,r=l!=null?u.substr(n,s,l):u.substr(n,s,null),h=Object.prototype.hasOwnProperty.call(wt.KEYWORDS.h,r)?wt.KEYWORDS.h[r]:g.Identifier(r);t.push(new ie(h,new z(e.line,e.column,s,this.pos-s)));e:for(;this.pos<this.length;){let a=u.cca(this.input,this.pos);if(a==null)break;switch(a){case 40:t.push(new ie(g.LParen,new z(this.line,this.column,this.pos,1)));let o=1;for(;o-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.stack.push(10),this.strictExprs.push(1);let c=1;for(;this.pos<this.length&&c>0;){if(u.cca(this.input,this.pos)==41){if(--c,c==0){t.push(new ie(g.RParen,new z(this.line,this.column,this.pos,1)));let d=1;for(;d-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.stack.pop(),this.strictExprs.pop();break}}else u.cca(this.input,this.pos)==40&&++c;if(u.cca(this.input,this.pos)==44){t.push(new ie(g.Comma,new z(this.line,this.column,this.pos,1)));let d=1;for(;d-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}else t.push(this.nextToken())}c>0&&this.error("Unterminated function call in interpolation",!0);break;case 46:let p;if(this.pos+1<this.length){let d=u.cca(this.input,this.pos+1);p=d>=97&&d<=122||d>=65&&d<=90||d==95}else p=!1;if(p){t.push(new ie(g.Dot,new z(this.line,this.column,this.pos,1)));let d=1;for(;d-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let x=this.pos;for(;this.pos<this.length;){let E=u.cca(this.input,this.pos);if(!(E>=97&&E<=122||E>=65&&E<=90||E==95||E>=48&&E<=57))break;let F=1;for(;F-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let y=this.input,b=this.pos-x,v=b!=null?u.substr(y,x,b):u.substr(y,x,null),T=Object.prototype.hasOwnProperty.call(wt.KEYWORDS.h,v)?wt.KEYWORDS.h[v]:g.Identifier(v);t.push(new ie(T,new z(this.line,this.column-(this.pos-x),x)))}else break e;break;case 91:t.push(new ie(g.LBracket,new z(this.line,this.column,this.pos,1)));let f=1;for(;f-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.stack.push(12),this.strictExprs.push(1);let _=1;for(;this.pos<this.length&&_>0;){if(u.cca(this.input,this.pos)==93){if(--_,_==0){t.push(new ie(g.RBracket,new z(this.line,this.column,this.pos,1)));let d=1;for(;d-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.stack.pop(),this.strictExprs.pop();break}}else u.cca(this.input,this.pos)==91&&++_;t.push(this.nextToken())}_>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=u.cca(this.input,this.pos);if(!(h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57))break;let a=1;for(;a-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let s=this.input,n=this.pos-i,l=n!=null?u.substr(s,i,n):u.substr(s,i,null),r=Object.prototype.hasOwnProperty.call(wt.KEYWORDS.h,l)?wt.KEYWORDS.h[l]:g.Identifier(l);return new ie(r,t)}makePositionRelativeTo(e){let t=e.line,i=e.column,s=e.offset;for(;s<this.pos;)u.cca(this.input,s)==10?(++t,i=1):++i,++s;return new z(t,i,this.pos,e.length)}readLineComment(){let e=new z(this.startLine,this.startColumn,this.pos),t=2;for(;t-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let i=this.pos;for(;this.pos<this.length;){let a=u.cca(this.input,this.pos);if(a==10||a==13)break;let o=1;for(;o-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let s=this.input,n=this.pos-i,l=n!=null?u.substr(s,i,n):u.substr(s,i,null),r=e;r==null&&(r=new z(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ie(g.CommentLine(l),r);return this.previous=h,h}readMultiLineComment(){let e=new z(this.startLine,this.startColumn,this.pos),t=2;for(;t-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let i=this.pos,s=1;for(;this.pos<this.length&&s>0;)if(u.cca(this.input,this.pos)==42&&(this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==47){if(--s,s==0){let l=this.input,r=this.pos-i,h=r!=null?u.substr(l,i,r):u.substr(l,i,null),a=2;for(;a-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let o=e;o==null&&(o=new z(this.startLine,this.startColumn,this.pos)),o.length=this.pos-o.offset;let c=new ie(g.CommentMultiLine(h),o);return this.previous=c,c}let n=2;for(;n-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}else if(u.cca(this.input,this.pos)==47&&(this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==42){++s;let n=2;for(;n-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}else{let n=1;for(;n-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}return this.error("Unterminated multi-line comment",!0),null}readHashComment(){let e=new z(this.startLine,this.startColumn,this.pos),t=1;for(;t-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let i=this.pos;for(;this.pos<this.length;){let a=u.cca(this.input,this.pos);if(a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57||a==45){let o=1;for(;o-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}else break}let s=this.input,n=this.pos-i,l=n!=null?u.substr(s,i,n):u.substr(s,i,null),r=e;r==null&&(r=new z(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ie(g.CommentHash(l),r);return this.previous=h,h}readNumber(){let e=new z(this.startLine,this.startColumn,this.pos),t=this.pos;for(;;){let o;if(this.pos<this.length){let p=u.cca(this.input,this.pos);o=p>=48&&p<=57}else o=!1;if(!o)break;let c=1;for(;c-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let i;if(this.pos<this.length&&u.cca(this.input,this.pos)==46&&this.pos+1<this.length){let o=u.cca(this.input,this.pos+1);i=o>=48&&o<=57}else i=!1;if(i){let o=1;for(;o-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;for(;;){let c;if(this.pos<this.length){let f=u.cca(this.input,this.pos);c=f>=48&&f<=57}else c=!1;if(!c)break;let p=1;for(;p-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}let s=this.input,n=this.pos-t,l=g.LNumber(parseFloat(n!=null?u.substr(s,t,n):u.substr(s,t,null))),r=e;r==null&&(r=new z(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ie(l,r);return this.previous=h,h}readIdentifier(){let e=new z(this.startLine,this.startColumn,this.pos),t=this.pos;for(;this.pos<this.length;){let a=u.cca(this.input,this.pos);if(!(a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57))break;let o=1;for(;o-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let i=this.input,s=this.pos-t,n=s!=null?u.substr(i,t,s):u.substr(i,t,null);if(n=="function")return this.readFunction(e);let l=Object.prototype.hasOwnProperty.call(wt.KEYWORDS.h,n)?wt.KEYWORDS.h[n]:g.Identifier(n);if(this.previous!=null&&this.previous.type==g.Dot&&l!=null)switch(l._hx_index){case 8:case 9:case 10:case 11:case 12:l=g.Identifier(n);break;default:}let r=e;r==null&&(r=new z(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ie(l,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 P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let s=e.column,n=null,l=u.cca(this.input,this.pos);if(l>=97&&l<=122||l>=65&&l<=90||l==95){let P=this.pos;for(;;){let R;if(this.pos<this.length){let $=u.cca(this.input,this.pos);R=$>=97&&$<=122||$>=65&&$<=90||$==95||$>=48&&$<=57}else R=!1;if(!R)break;let Y=1;for(;Y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let M=this.input,V=this.pos-P;n=V!=null?u.substr(M,P,V):u.substr(M,P,null)}let r=!1;r==null&&(r=!1);let h=this._skipWhitespaceAndComments(this.pos,r);for(;this.pos<h;){let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}(this.pos>=this.length||u.cca(this.input,this.pos)!=40)&&this.error("Expected opening parenthesis after function name",!0);let a=0,o=[],c=1;for(;c-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;a=1;let p=new $t;for(;this.pos<this.length&&a>0;){let P=u.cca(this.input,this.pos);if(P==47){let M=this.pos,V=!1;V==null&&(V=!1);let R=this._skipWhitespaceAndComments(this.pos,V);for(;this.pos<R;){let Y=1;for(;Y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}if(this.pos==M){let Y=1;for(;Y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.error('Invalid character "/"',!1)}}else if(P==40){++a,p.b+=String.fromCodePoint(P);let M=1;for(;M-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let V=!1;V==null&&(V=!1);let R=this._skipWhitespaceAndComments(this.pos,V);for(;this.pos<R;){let Y=1;for(;Y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(P==41){if(--a,a>0)p.b+=String.fromCodePoint(P);else{let Y=Te.trim(p.b);Y.length>0&&o.push(Y)}let M=1;for(;M-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let V=!1;V==null&&(V=!1);let R=this._skipWhitespaceAndComments(this.pos,V);for(;this.pos<R;){let Y=1;for(;Y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(P==44&&a==1){let M=Te.trim(p.b);M.length>0&&o.push(M),p=new $t;let V=1;for(;V-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let R=!1;R==null&&(R=!1);let Y=this._skipWhitespaceAndComments(this.pos,R);for(;this.pos<Y;){let $=1;for(;$-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{p.b+=String.fromCodePoint(P);let M=1;for(;M-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}a>0&&this.error("Unclosed parentheses in function declaration",!1);let f=!1;f==null&&(f=!1);let _=this._skipWhitespaceAndComments(this.pos,f);for(;this.pos<_;){let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let d=this.pos<this.length&&u.cca(this.input,this.pos)==123,x=this.pos,y=this.line,b=this.column;if(d){let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let M=1;for(;this.pos<this.length&&M>0;){let V=u.cca(this.input,this.pos);if(V==34){let Y=1;for(;Y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.skipQuotedString();continue}V==123?++M:V==125&&--M;let R=1;for(;R-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}M>0&&this.error("Unclosed braces in function body",!1)}else{let P=-1,M=!0;for(;this.pos<this.length;){let V=u.cca(this.input,this.pos);if(V==10||V==13){x=this.pos,y=this.line,b=this.column;let Y=1;for(;Y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;M=!0;break}let R=1;for(;R-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}for(;this.pos<this.length;){if(M){let Y=0,$=this.pos;for(;this.pos<this.length;){let te=u.cca(this.input,this.pos);if(te==32)++Y;else if(te==9)++Y;else break;let O=1;for(;O-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}if(P==-1&&this.pos<this.length&&u.cca(this.input,this.pos)!=10&&u.cca(this.input,this.pos)!=13){if(P=Y,P<s){this.pos=$;break}}else if(P!=-1&&Y<P&&(this.pos>=this.length||u.cca(this.input,this.pos)!=10&&u.cca(this.input,this.pos)!=13)){this.pos=$;break}M=!1}let V=u.cca(this.input,this.pos);if(V==34){this.skipQuotedString();continue}(V==10||V==13)&&(x=this.pos,y=this.line,b=this.column,M=!0);let R=1;for(;R-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}this.pos=x,this.line=y,this.column=b;let v=this.pos,T=this.input,E=e.offset,F=v-e.offset,L=Te.rtrim(F!=null?u.substr(T,E,F):u.substr(T,E,null)),A=L.indexOf(`
|
|
37
|
-
`,null)==-1;A||(L+=`
|
|
38
|
-
|
|
39
|
-
`).print(e)}}K["loreline.Loreline"]=Ji.loreline.Loreline=hn,hn.__name__="loreline.Loreline";class Me{constructor(e,t,i,s){if(e<0||e>65535)throw k.thrown("Section value ("+e+") should be between 0 and 65535");if(t<0||t>65535)throw k.thrown("Branch value ("+t+") should be between 0 and 65535");if(i<0||i>65535)throw k.thrown("Block value ("+i+") should be between 0 and 65535");if(s<0||s>65535)throw k.thrown("Node value ("+s+") should be between 0 and 65535");let n=e-32768,l=t-32768;n<0&&(n=n+65536&65535),l<0&&(l=l+65536&65535);let r=i-32768,h=s-32768;r<0&&(r=r+65536&65535),h<0&&(h=h+65536&65535),this.thisVal=new Li(n<<16|l&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 Li(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 Li(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 Li(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 Li(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 k.thrown("Node id section overflow");return new Me(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 Me((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,s=this.thisVal.high&65535;return new Me((i>=32768?i-65536:i)+32768,(s>=32768?s-65536:s)+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,s=this.thisVal.high&65535,n=this.thisVal.low>>16&65535;return new Me((i>=32768?i-65536:i)+32768,(s>=32768?s-65536:s)+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,s=this.thisVal.low&65535;return""+((e>=32768?e-65536:e)+32768)+"."+((t>=32768?t-65536:t)+32768)+"."+((i>=32768?i-65536:i)+32768)+"."+((s>=32768?s-65536:s)+32768)}static fromInt64(e){return e}static fromString(e){let t=e.split(".");return new Me(Z.parseInt(t[0]),Z.parseInt(t[1]),Z.parseInt(t[2]),Z.parseInt(t[3]))}static fromTwoInt32(e,t){return Me.fromInt64(new Li(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,s=t.thisVal;return i.high==s.high?i.low==s.low:!1}}K["loreline.NodeId"]=Me,Me.__name__="loreline.NodeId",Object.assign(Me.prototype,{__class__:Me,__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 Wi{constructor(){this.map=new _i}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 Us(this.map)}keys(){return new qs(this.map)}keyValueIterator(){return new Ws(this.map)}}K["loreline.NodeIdMap"]=Wi,Wi.__name__="loreline.NodeIdMap",Object.assign(Wi.prototype,{__class__:Wi});class Us{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}}K["loreline._Node.NodeIdMapIterator"]=Us,Us.__name__="loreline._Node.NodeIdMapIterator",Object.assign(Us.prototype,{__class__:Us});class qs{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 Me.fromTwoInt32(e,t)}}K["loreline._Node.NodeIdMapKeyIterator"]=qs,qs.__name__="loreline._Node.NodeIdMapKeyIterator",Object.assign(qs.prototype,{__class__:qs});class Ws{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:Me.fromTwoInt32(e,t),value:i}}}K["loreline._Node.NodeIdMapKeyValueIterator"]=Ws,Ws.__name__="loreline._Node.NodeIdMapKeyValueIterator",Object.assign(Ws.prototype,{__class__:Ws});class Pt{constructor(e,t){Pt._hx_skip_constructor||this._hx_constructor(e,t)}_hx_constructor(e,t){this.id=Me.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){}}K["loreline.Node"]=Ji.loreline.Node=Pt,Pt.__name__="loreline.Node",Object.assign(Pt.prototype,{__class__:Pt});class Ki extends Pt{constructor(e,t,i,s,n){n==null&&(n=!1),super(e,t),this.content=i,this.multiline=s,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}}K["loreline.Comment"]=Ki,Ki.__name__="loreline.Comment",Ki.__super__=Pt,Object.assign(Ki.prototype,{__class__:Ki});class be extends Pt{constructor(e,t,i,s){if(Pt._hx_skip_constructor){super();return}Pt._hx_skip_constructor=!0,super(),Pt._hx_skip_constructor=!1,this._hx_constructor(e,t,i,s)}_hx_constructor(e,t,i,s){super._hx_constructor(e,t),this.leadingComments=i,this.trailingComments=s}type(){return"AstNode"}eachComment(e){if(this.leadingComments!=null){let i=0,s=this.leadingComments;for(;i<s.length;){let n=s[i];++i,e(this,n)}}if(this.trailingComments!=null){let i=0,s=this.trailingComments;for(;i<s.length;){let n=s[i];++i,e(this,n)}}let t=this;this.each(function(i,s){if(i instanceof be){let n=i;if(n.leadingComments!=null){let l=0,r=n.leadingComments;for(;l<r.length;){let h=r[l];++l,e(t,h)}}if(n.trailingComments!=null){let l=0,r=n.trailingComments;for(;l<r.length;){let h=r[l];++l,e(t,h)}}}})}each(e){if(super.each(e),this.leadingComments!=null){let t=0,i=this.leadingComments;for(;t<i.length;){let s=i[t];++t,e(s,this),s.each(e)}}if(this.trailingComments!=null){let t=0,i=this.trailingComments;for(;t<i.length;){let s=i[t];++t,e(s,this),s.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=[],s=0,n=this.leadingComments;for(;s<n.length;){let l=n[s];++s,i.push(l.toJson())}t.leading=i}if(this.trailingComments!=null&&this.trailingComments.length>0){let i=[],s=0,n=this.trailingComments;for(;s<n.length;){let l=n[s];++s,i.push(l.toJson())}t.trailing=i}e.comments=t}return e}}K["loreline.AstNode"]=be,be.__name__="loreline.AstNode",be.__super__=Pt,Object.assign(be.prototype,{__class__:be});class nt extends be{constructor(e,t,i,s){super(e,t,i,s)}toJson(){return super.toJson()}type(){return"Expr"}}K["loreline.NExpr"]=nt,nt.__name__="loreline.NExpr",nt.__super__=be,Object.assign(nt.prototype,{__class__:nt});class Jt extends be{constructor(e,t,i,s,n,l){super(e,t,n,l),this.temporary=i,this.fields=s,this.style=0}type(){return"State"}get(e){let t=0,i=this.fields;for(;t<i.length;){let s=i[t];if(++t,s.name==e)return s.value}return null}each(e){if(super.each(e),this.fields!=null){let t=0,i=this.fields.length;for(;t<i;){let s=t++,n=this.fields[s];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.temporary=this.temporary;let t=[],i=0,s=this.fields;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}return e.fields=t,e.style=Oi.toString(this.style),e}}K["loreline.NStateDecl"]=Jt,Jt.__name__="loreline.NStateDecl",Jt.__super__=be,Object.assign(Jt.prototype,{__class__:Jt});class Fi extends be{constructor(e,t,i,s,n,l){super(e,t,n,l),this.name=i,this.value=s}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}}K["loreline.NObjectField"]=Fi,Fi.__name__="loreline.NObjectField",Fi.__super__=be,Object.assign(Fi.prototype,{__class__:Fi});class Gt extends be{constructor(e,t,i,s,n,l,r){super(e,t,l,r),this.name=i,this.namePos=s,this.fields=n,this.style=0}type(){return"Character"}get(e){let t=0,i=this.fields;for(;t<i.length;){let s=i[t];if(++t,s.name==e)return s.value}return null}each(e){if(super.each(e),this.fields!=null){let t=0,i=this.fields.length;for(;t<i;){let s=t++,n=this.fields[s];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.name=this.name,e.namePos=this.namePos.toJson();let t=[],i=0,s=this.fields;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}return e.fields=t,e.style=Oi.toString(this.style),e}}K["loreline.NCharacterDecl"]=Gt,Gt.__name__="loreline.NCharacterDecl",Gt.__super__=be,Object.assign(Gt.prototype,{__class__:Gt});class De extends be{constructor(e,t,i,s,n,l){super(e,t,n,l),this.name=i,this.body=s,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 s=t++,n=this.body[s];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.name=this.name;let t=[],i=0,s=this.body;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}return e.body=t,e.style=Oi.toString(this.style),e}}K["loreline.NBeatDecl"]=De,De.__name__="loreline.NBeatDecl",De.__super__=be,Object.assign(De.prototype,{__class__:De});var Le=Fe["loreline.StringPartType"]={__ename__:"loreline.StringPartType",__constructs__:null,Raw:(m=function(w){return{_hx_index:0,text:w,__enum__:"loreline.StringPartType",toString:C}},m._hx_name="Raw",m.__params__=["text"],m),Expr:(m=function(w){return{_hx_index:1,expr:w,__enum__:"loreline.StringPartType",toString:C}},m._hx_name="Expr",m.__params__=["expr"],m),Tag:(m=function(w,e){return{_hx_index:2,closing:w,expr:e,__enum__:"loreline.StringPartType",toString:C}},m._hx_name="Tag",m.__params__=["closing","expr"],m)};Le.__constructs__=[Le.Raw,Le.Expr,Le.Tag];class Oi{static toString(e){switch(e){case 0:return"Plain";case 1:return"Braces"}}}class xs{static toString(e){switch(e){case 0:return"Plain";case 2:return"Parens"}}}class ws{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 nt{constructor(e,t,i,s,n){super(e,t,s,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 s=t.expr;e(s,this),s.each(e);break;case 2:let n=t.closing,l=t.expr;e(l,this),l.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 s=t.expr;e.part="Expr",e.expression=s.toJson();break;case 2:let n=t.closing,l=t.expr;e.part="Tag",e.closing=n,e.content=l.toJson();break}return e}}K["loreline.NStringPart"]=je,je.__name__="loreline.NStringPart",je.__super__=nt,Object.assign(je.prototype,{__class__:je});class Tt extends nt{constructor(e,t,i,s,n,l){super(e,t,n,l),this.parts=s,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 s=t++,n=this.parts[s];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],i=0,s=this.parts;for(;i<s.length;){let l=s[i];++i,t.push(l.toJson())}let n=t;return e.parts=n,e.quotes=Xs.toString(this.quotes),e}}K["loreline.NStringLiteral"]=Tt,Tt.__name__="loreline.NStringLiteral",Tt.__super__=nt,Object.assign(Tt.prototype,{__class__:Tt});class oi extends be{constructor(e,t,i,s,n){super(e,t,s,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=xs.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}K["loreline.NTextStatement"]=oi,oi.__name__="loreline.NTextStatement",oi.__super__=be,Object.assign(oi.prototype,{__class__:oi});class hi extends be{constructor(e,t,i,s,n,l,r){super(e,t,l,r),this.character=i,this.characterPos=s,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=xs.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}K["loreline.NDialogueStatement"]=hi,hi.__name__="loreline.NDialogueStatement",hi.__super__=be,Object.assign(hi.prototype,{__class__:hi});class fi extends be{constructor(e,t,i,s,n){super(e,t,s,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 s=t++,n=this.options[s];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],i=0,s=this.options;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}return e.options=t,e.style=Oi.toString(this.style),e}}K["loreline.NChoiceStatement"]=fi,fi.__name__="loreline.NChoiceStatement",fi.__super__=be,Object.assign(fi.prototype,{__class__:fi});class Ot extends be{constructor(e,t,i,s,n,l,r,h,a){super(e,t,h,a),this.text=i,this.insertion=s,this.condition=n,this.conditionStyle=l,this.body=r,this.style=0}type(){return"Option"}each(e){if(super.each(e),this.body!=null){let t=0,i=this.body.length;for(;t<i;){let s=t++,n=this.body[s];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=xs.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson());let t=[],i=0,s=this.body;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}return e.body=t,e.style=Oi.toString(this.style),e}}K["loreline.NChoiceOption"]=Ot,Ot.__name__="loreline.NChoiceOption",Ot.__super__=be,Object.assign(Ot.prototype,{__class__:Ot});class mi extends be{constructor(e,t,i,s,n){super(e,t,s,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 s=t++,n=this.body[s];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],i=0,s=this.body;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}return e.body=t,e.style=Oi.toString(this.style),e}}K["loreline.NBlock"]=mi,mi.__name__="loreline.NBlock",mi.__super__=be,Object.assign(mi.prototype,{__class__:mi});class gi extends be{constructor(e,t,i,s,n,l,r,h,a,o){super(e,t,r,h),this.condition=i,this.conditionStyle=s,this.thenBranch=n,this.elseBranch=l,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 s=i[t];++t,e(s,this),s.each(e)}}if(this.elseTrailingComments!=null){let t=0,i=this.elseTrailingComments;for(;t<i.length;){let s=i[t];++t,e(s,this),s.each(e)}}}toJson(){let e=super.toJson();e.condition=this.condition.toJson(),e.conditionStyle=xs.toString(this.conditionStyle);let t=[],i=0,s=this.thenBranch.body;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}if(e.thenBranch=t,e.thenStyle=Oi.toString(this.thenBranch.style),this.elseBranch!=null){let n=[],l=0,r=this.elseBranch.body;for(;l<r.length;){let h=r[l];++l,n.push(h.toJson())}if(e.elseBranch=n,e.elseStyle=Oi.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=[],c=0,p=this.elseLeadingComments;for(;c<p.length;){let f=p[c];++c,o.push(f.toJson())}a.elseLeading=o}if(this.elseTrailingComments!=null&&this.elseTrailingComments.length>0){let o=[],c=0,p=this.elseTrailingComments;for(;c<p.length;){let f=p[c];++c,o.push(f.toJson())}a.elseTrailing=o}e.comments=a}}return e}}K["loreline.NIfStatement"]=gi,gi.__name__="loreline.NIfStatement",gi.__super__=be,Object.assign(gi.prototype,{__class__:gi});class Vi extends be{constructor(e,t,i,s,n,l){super(e,t,n,l),this.mode=i,this.items=s,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 s=t++,n=this.items[s];e(n,this),n.each(e)}}if(this.separatorComments!=null){let t=0,i=this.separatorComments;for(;t<i.length;){let s=i[t];if(++t,s!=null){let n=0;for(;n<s.length;){let l=s[n];++n,e(l,this),l.each(e)}}}}}toJson(){let e=super.toJson();e.mode=ws.toString(this.mode);let t=[],i=0,s=this.items;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}return e.items=t,e.style=Oi.toString(this.style),e}}K["loreline.NAlternative"]=Vi,Vi.__name__="loreline.NAlternative",Vi.__super__=be,Object.assign(Vi.prototype,{__class__:Vi});class Vt extends nt{constructor(e,t,i,s,n,l){super(e,t,n,l),this.target=i,this.args=s}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 s=i[t];++t,e(s,this),s.each(e)}}}toJson(){let e=super.toJson();e.target=this.target.toJson();let t=[],i=0,s=this.args;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}return e.args=t,e}}K["loreline.NCall"]=Vt,Vt.__name__="loreline.NCall",Vt.__super__=nt,Object.assign(Vt.prototype,{__class__:Vt});class Ni extends be{constructor(e,t,i,s,n,l){super(e,t,n,l),this.target=i,this.targetPos=s}type(){return"Transition"}toJson(){let e=super.toJson();return e.target=this.target,e.targetPos=this.targetPos.toJson(),e}}K["loreline.NTransition"]=Ni,Ni.__name__="loreline.NTransition",Ni.__super__=be,Object.assign(Ni.prototype,{__class__:Ni});class zi extends be{constructor(e,t,i,s,n,l){super(e,t,n,l),this.target=i,this.targetPos=s}type(){return"Insertion"}toJson(){let e=super.toJson();return e.target=this.target,e.targetPos=this.targetPos.toJson(),e}}K["loreline.NInsertion"]=zi,zi.__name__="loreline.NInsertion",zi.__super__=be,Object.assign(zi.prototype,{__class__:zi});class Di extends nt{constructor(e,t,i,s,n,l,r,h){super(e,t,r,h),this.name=i,this.args=s,this.code=n,this.external=l}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}}K["loreline.NFunctionDecl"]=Di,Di.__name__="loreline.NFunctionDecl",Di.__super__=nt,Object.assign(Di.prototype,{__class__:Di});class Oe extends nt{constructor(e,t,i,s,n,l){super(e,t,n,l),this.value=i,this.literalType=s}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 s=0,n=this.value;for(;s<n.length;){let l=n[s];if(++s,l instanceof Pt){let r=l;e(r,this),r.each(e)}}}break;case 4:let i=t.style;if(this.value!=null){let s=0,n=this.value;for(;s<n.length;){let l=n[s];if(++s,l.value instanceof Pt){let r=l.value;e(r,this),r.each(e)}}}break}}toJson(){let e=super.toJson(),t=this.literalType;e.literal=Fe[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=[],l=0,r=this.value;for(;l<r.length;){let h=r[l];++l,h instanceof Pt?n.push(h.toJson()):n.push(h)}e.value=n}break;case 4:let s=i.style;if(this.value!=null){let n=[],l=0,r=this.value;for(;l<r.length;){let h=r[l];++l,n.push(h.toJson())}e.value=n}else e.value=[];e.style=Oi.toString(s);break}return e}}K["loreline.NLiteral"]=Oe,Oe.__name__="loreline.NLiteral",Oe.__super__=nt,Object.assign(Oe.prototype,{__class__:Oe});var Re=Fe["loreline.LiteralType"]={__ename__:"loreline.LiteralType",__constructs__:null,Number:{_hx_name:"Number",_hx_index:0,__enum__:"loreline.LiteralType",toString:C},Boolean:{_hx_name:"Boolean",_hx_index:1,__enum__:"loreline.LiteralType",toString:C},Null:{_hx_name:"Null",_hx_index:2,__enum__:"loreline.LiteralType",toString:C},Array:{_hx_name:"Array",_hx_index:3,__enum__:"loreline.LiteralType",toString:C},Object:(m=function(w){return{_hx_index:4,style:w,__enum__:"loreline.LiteralType",toString:C}},m._hx_name="Object",m.__params__=["style"],m)};Re.__constructs__=[Re.Number,Re.Boolean,Re.Null,Re.Array,Re.Object];class lt extends nt{constructor(e,t,i,s,n,l){super(e,t,n,l),this.target=i,this.name=s}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}}K["loreline.NAccess"]=lt,lt.__name__="loreline.NAccess",lt.__super__=nt,Object.assign(lt.prototype,{__class__:lt});class di extends nt{constructor(e,t,i,s,n,l,r){super(e,t,l,r),this.target=i,this.op=s,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=Z.string(this.op),e.value=this.value.toJson(),e}}K["loreline.NAssign"]=di,di.__name__="loreline.NAssign",di.__super__=nt,Object.assign(di.prototype,{__class__:di});class ui extends nt{constructor(e,t,i,s,n,l){super(e,t,n,l),this.target=i,this.index=s}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}}K["loreline.NArrayAccess"]=ui,ui.__name__="loreline.NArrayAccess",ui.__super__=nt,Object.assign(ui.prototype,{__class__:ui});class Xt extends nt{constructor(e,t,i,s,n,l,r){super(e,t,l,r),this.left=i,this.op=s,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=Z.string(this.op),e.right=this.right.toJson(),e}}K["loreline.NBinary"]=Xt,Xt.__name__="loreline.NBinary",Xt.__super__=nt,Object.assign(Xt.prototype,{__class__:Xt});class Hi extends nt{constructor(e,t,i,s,n,l){super(e,t,n,l),this.op=i,this.operand=s}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=Z.string(this.op),e.operand=this.operand.toJson(),e}}K["loreline.NUnary"]=Hi,Hi.__name__="loreline.NUnary",Hi.__super__=nt,Object.assign(Hi.prototype,{__class__:Hi});class Zt extends be{constructor(e,t,i,s,n,l){super(e,t,n,l),this.path=i,this.script=s}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(),e}}K["loreline.NImportStatement"]=Zt,Zt.__name__="loreline.NImportStatement",Zt.__super__=be,Object.assign(Zt.prototype,{__class__:Zt});class le{static isFields(e){return Q.__implements(e,Ei)||e instanceof me?!0:e instanceof Ri||typeof e=="number"&&(e|0)===e||typeof e=="number"||typeof e=="boolean"||typeof e=="string"?!1:!ee.isArray(e)}static getField(e,t,i){return Q.__implements(t,Ei)?t.lorelineGet(e,i):t instanceof me?t.h[i]:Pe.getProperty(t,i)}static getFields(e,t){if(Q.__implements(t,Ei))return t.lorelineFields(e);if(t instanceof me){let i=[],s=t.h,n=s,l=Object.keys(s),r=l.length,h=0;for(;h<r;){let a=l[h++];i.push(a)}return i}else return Pe.fields(t)}static setField(e,t,i,s){Q.__implements(t,Ei)?t.lorelineSet(e,i,s):t instanceof me?t.h[i]=s:Pe.setProperty(t,i,s)}static removeField(e,t,i){if(Q.__implements(t,Ei))return t.lorelineRemove(e,i);if(t instanceof me){let s=t;return Object.prototype.hasOwnProperty.call(s.h,i)?(delete s.h[i],!0):!1}else return Pe.deleteField(t,i)}static fieldExists(e,t,i){return Q.__implements(t,Ei)?t.lorelineExists(e,i):t instanceof me?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 createFields(e,t,i){if(e!=null&&e.customCreateFields!=null){let s=e.customCreateFields(e,t,i);if(s!=null)return s}if(t!=null){let s=Object.create(K[t].prototype);return Q.__implements(s,Ei)&&s.lorelineCreate(e),s}return new me}}K["loreline.Objects"]=le,le.__name__="loreline.Objects";class we extends li{constructor(e,t){super(e,t)}}K["loreline.ParseError"]=we,we.__name__="loreline.ParseError",we.__super__=li,Object.assign(we.prototype,{__class__:we});class ks{constructor(e,t,i,s){this.imported=new me,this.rootPath=e,this.path=t,this.imports=i,s!=null&&(this.imported=s)}}K["loreline.ParserContext"]=ks,ks.__name__="loreline.ParserContext",Object.assign(ks.prototype,{__class__:ks});class ji{constructor(e,t){this.tokens=e,this.current=0,this.errors=null,this.pendingComments=null,this.lastTokenEnd=new z(1,1,0),this.lastLineBreak=null,this.lineBreakAfterToken=!1,this.currentNodeId=Me.UNDEFINED,this.rootBeat=null,this.context=t}parse(){let e=this.currentPos(),t=[],i=new ci(this.nextNodeId(4),e,t);for(;!this.isAtEnd();)try{let s=this.parseNode(!0);for(s!=null&&t.push(s);this.match(g.LineBreak););}catch(s){let n=k.caught(s).unwrap();if(n instanceof we){let l=n;this.addError(l),this.synchronize()}else throw s}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 49:let i=t.content;++e;break;case 50:let s=t.content;++e;break;case 51:let n=t.content;++e;break;case 54:++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==g.LineBreak);){this.current++;let i=this.tokens[this.current].type;switch(i._hx_index){case 49:let s=i.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Ki(this.nextNodeId(4),this.currentPos(),s,!1));break;case 50:let n=i.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Ki(this.nextNodeId(4),this.currentPos(),n,!0));break;case 51:let l=i.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Ki(this.nextNodeId(4),this.currentPos(),l,!1,!0));break;case 54: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(Ft.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 49:let i=t.content;break;case 50:let s=t.content;break;case 51:let n=t.content;break;case 52:case 53:case 54: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 49:let i=t.content;break;case 50:let s=t.content;break;case 51:let n=t.content;break;case 52:case 53:case 54: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 49:let i=t.content;break;case 50:let s=t.content;break;case 51:let n=t.content;break;case 54: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 z(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?Ft.toCodeString(t):null}return null}check(e){return this.isAtEnd()?!1:e._hx_index==40?this.tokens[this.current].type==g.Colon:Ft.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,s=e.s;return!0}else return!1}isAtEnd(){return this.current<this.tokens.length?this.tokens[this.current].type==g.Eof:!0}isComment(e){switch(e._hx_index){case 49:let t=e.content;return!0;case 50:let i=e.content;return!0;case 51:let s=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==g.LineBreak;){if(this.isComment(this.tokens[this.current].type)){this.pendingComments==null&&(this.pendingComments=[]);let s=this.pendingComments,n=this.nextNodeId(4),l=this.currentPos(),r=this.tokens[this.current].type,h;switch(r._hx_index){case 49:h=r.content;break;case 50:h=r.content;break;case 51:h=r.content;break;default:h=""}let a=this.tokens[this.current].type,o;if(a._hx_index==50){let f=a.content;o=!0}else o=!1;let c=this.tokens[this.current].type,p;if(c._hx_index==51){let f=c.content;p=!0}else p=!1;s.push(new Ki(n,l,h,o,p))}if(this.advance(),this.isAtEnd())throw k.thrown(new we("Unexpected end of file",this.currentPos()))}if(this.isAtEnd())throw k.thrown(new we("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 we("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new Oe(this.nextNodeId(4),this.currentPos(),null,Re.Null));case 4:let s=this.parseChoiceStatement();return e?t.wrapInRootBeat(s):s;case 5:let n=this.parseIfStatement();return e?t.wrapInRootBeat(n):n;case 7:if(this.advance(),!this.check(g.KwState))throw k.thrown(new we("Expected 'state' after 'new'",this.currentPos()));let l=this.parseStateDecl(!0);return e?t.wrapInRootBeat(l):l;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,c=i.external;return e?this.parseFunction():(this.addError(new we("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new Oe(this.nextNodeId(4),this.currentPos(),null,Re.Null));case 15:let p=i.quotes,f=i.s,_=i.attachments,d=this.parseTextStatement();return e?t.wrapInRootBeat(d):d;case 16:let x=i.n,y=this.parseExpressionStatement();return e?t.wrapInRootBeat(y):y;case 17:let b=i.b,v=this.parseExpressionStatement();return e?t.wrapInRootBeat(v):v;case 19:let T=i.name;if(this.peek().type==g.Colon){let A=this.parseDialogueStatement();return e?t.wrapInRootBeat(A):A}else{let A=this.parseExpressionStatement();return e?t.wrapInRootBeat(A):A}break;case 25:let E=this.parseInsertion();return e?t.wrapInRootBeat(E):E;case 18:case 26:case 38:case 43:case 45:case 47:let F=this.parseExpressionStatement();return e?t.wrapInRootBeat(F):F;case 39:let L=this.parseTransition();return e?t.wrapInRootBeat(L):L;default:return this.addError(new we("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new Oe(this.nextNodeId(4),this.currentPos(),null,Re.Null)}}wrapInRootBeat(e){let t,i=null;if(this.rootBeat==null){let s=this.currentPos();t=[],this.rootBeat=new De(this.nextNodeId(1),s,"_",t),i=this.rootBeat}else t=this.rootBeat.body;return t.push(e),i}parseImport(){let e=this.currentPos();if(this.expect(g.KwImport),this.context==null)throw k.thrown(new we("Cannot import without a context",this.currentPos()));let t=0,i=this.tokens[this.current],s,n=i.type;if(n._hx_index==15){let p=n.attachments,f=n.quotes,_=n.s;t=f,s=_}else throw k.thrown(new we("Expected string literal for import path",this.currentPos()));let l=s;vt.isAbsolute(l)||(l=vt.join([vt.directory(this.context.rootPath),l])),l=vt.normalize(l);let r=".lor";if(this.context.rootPath.endsWith(".lor.txt")&&(r=".lor.txt"),l.toLowerCase().endsWith(r)||(l+=r),Object.prototype.hasOwnProperty.call(this.context.imported.h,l)){this.advance();let p=new Zt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,null);return p.path=new Tt(this.nextNodeId(4),i.pos,t,[new je(this.nextNodeId(4),i.pos,Le.Raw(s))]),this.attachComments(p)}let h=this.context.imports.h[l];if(h==null)throw k.thrown(new we("Failed to import file at path "+l+" ("+s+")",this.currentPos()));let a=new ji(h,new ks(this.context.rootPath,l,this.context.imports,this.context.imported));a.currentNodeId=this.currentNodeId;let o=a.parse();this.currentNodeId=a.currentNodeId,this.advance();let c=new Zt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,o);return c.path=new Tt(this.nextNodeId(4),i.pos,t,[new je(this.nextNodeId(4),i.pos,Le.Raw(s))]),this.attachComments(c)}parseDialogueStatement(){let e=this.currentPos(),t=new hi(this.nextNodeId(4),e,null,null,null),i=this.tokens[this.current].type,s;if(i._hx_index==19)s=i.name;else throw k.thrown(new we("Expected character name",this.currentPos()));t.character=s,t.characterPos=this.tokens[this.current].pos,this.advance(),this.expect(g.Colon),this.attachComments(t);let n=!1;if(this.checkBlockStart()){let l=this.parseBlockStart();if(l.type!=g.Indent)throw k.thrown(new we("Expected indent, got "+Ft.toCodeString(l.type),l.pos));n=!0}try{t.content=this.parseStringLiteral()}catch(l){let r=k.caught(l).unwrap();if(r instanceof we){let h=r;this.addError(h),t.content=new Tt(this.nextNodeId(4),this.currentPos(),0,[new je(this.nextNodeId(4),this.currentPos(),Le.Raw("?"))])}else throw l}if(!this.lineBreakAfterToken&&this.match(g.KwIf)){let l=this.previous().pos;this.check(g.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression(),t.conditionPos=l.extendedTo(this.prevNonWhitespaceOrComment().pos)}if(n){for(;this.match(g.LineBreak););this.expect(g.Unindent)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseStatementBlock(e){let t=this.parseBlockStart().type==g.Indent?g.Unindent:g.RBrace;for(;!this.check(t)&&!this.isAtEnd();){for(;this.match(g.LineBreak)||t!=g.Unindent&&this.match(g.Unindent););if(this.check(t))break;try{e.push(this.parseNode())}catch(i){let s=k.caught(i).unwrap();if(s instanceof we){let n=s;if(this.errors==null&&(this.errors=[]),this.errors.push(n),this.synchronize(),this.check(t))break}else throw i}for(;this.match(g.LineBreak)||t!=g.Unindent&&this.match(g.Unindent););}return this.expect(t),t==g.RBrace?1:0}parseStateDecl(e){let t=this.currentPos(),i=new Jt(this.nextNodeId(3),t,e,[]);this.expect(g.KwState);let s=this.parseBlockStart().type==g.Indent?g.Unindent:g.RBrace;for(i.style=s==g.RBrace?1:0,this.attachComments(i);!this.check(s)&&!this.isAtEnd();){for(;this.match(g.LineBreak)||s!=g.Unindent&&this.match(g.Unindent););for(i.fields.push(this.parseObjectField());this.match(g.LineBreak)||s!=g.Unindent&&this.match(g.Unindent););}for(;this.match(g.LineBreak)||s!=g.Unindent&&this.match(g.Unindent););return this.expect(s),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(g.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 De(this.nextNodeId(1),e,null,[],[]);this.expect(g.KwBeat),t.pos=e.extendedTo(this.currentPos()),t.name=this.expectIdentifier();let s=this.parseBlockStart().type==g.Indent?g.Unindent:g.RBrace;for(t.style=s==g.RBrace?1:0,this.attachComments(t);!this.check(s)&&!this.isAtEnd();){for(;this.match(g.LineBreak)||s!=g.Unindent&&this.match(g.Unindent););for(t.body.push(this.parseNode());this.match(g.LineBreak)||s!=g.Unindent&&this.match(g.Unindent););}for(;this.match(g.LineBreak)||s!=g.Unindent&&this.match(g.Unindent););return this.expect(s),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}checkBlockStart(){let e=null,t=null,i=0,s=0;for(;this.current+s<this.tokens.length;){let n=this.tokens[this.current+s];if(++s,n.type!=g.LineBreak){if(n.type==g.Indent){++i,e=n;continue}if(n.type==g.LBrace){t==null&&(t=n);continue}break}}if(t!=null)return!0;if(e!=null){if(i>1)throw k.thrown(new we("Invalid indentation level",e.pos));return!0}else return!1}parseBlockStart(){let e=null,t=null,i=0;for(;!this.isAtEnd();)if(!this.match(g.LineBreak)){if(this.match(g.Indent)){++i,e=this.prevWithType(g.Indent);continue}if(this.match(g.LBrace)){t==null&&(t=this.prevWithType(g.LBrace));continue}break}if(t!=null)return t;if(e!=null){if(i>1)throw k.thrown(new we("Invalid indentation level",e.pos));return e}else return this.addError(new we("Expected "+Ft.toCodeString(g.LBrace)+" or "+Ft.toCodeString(g.Indent)+", got "+this.currentTokenTypeToString(),this.currentPos())),new ie(g.Indent,this.currentPos())}parseCharacterDecl(){let e=this.currentPos(),t=new Gt(this.nextNodeId(3),e,null,null,[]);this.expect(g.KwCharacter),t.name=this.expectIdentifier(),t.namePos=this.prevNonWhitespaceOrComment().pos;let i=this.parseBlockStart().type==g.Indent?g.Unindent:g.RBrace;for(t.style=i==g.RBrace?1:0,this.attachComments(t);!this.check(i)&&!this.isAtEnd();){for(;this.match(g.LineBreak)||i!=g.Unindent&&this.match(g.Unindent););for(t.fields.push(this.parseObjectField());this.match(g.LineBreak)||i!=g.Unindent&&this.match(g.Unindent););}for(;this.match(g.LineBreak)||i!=g.Unindent&&this.match(g.Unindent););return this.expect(i),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseTextStatement(){let e=this.currentPos(),t=this.attachComments(new oi(this.nextNodeId(4),e,null));if(t.content=this.parseStringLiteral(),!this.lineBreakAfterToken&&this.match(g.KwIf)){let i=this.previous().pos;this.check(g.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 fi(this.nextNodeId(2),e,[]);this.expect(g.KwChoice);let i=this.parseBlockStart().type==g.Indent?g.Unindent:g.RBrace;for(t.style=i==g.RBrace?1:0,this.attachComments(t);!this.check(i)&&!this.isAtEnd();){for(;this.match(g.LineBreak)||i!=g.Unindent&&this.match(g.Unindent););for(t.options.push(this.parseChoiceOption(i));this.match(g.LineBreak)||i!=g.Unindent&&this.match(g.Unindent););}return this.expect(i),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseChoiceOption(e){let t=this.currentPos(),i=this.attachComments(new Ot(this.nextNodeId(3),t,null,null,null,0,[])),s=null,n=!1;try{this.check(g.OpPlus)?(n=!0,i.insertion=this.parseInsertion()):i.text=this.parseStringLiteral()}catch(l){let r=k.caught(l).unwrap();if(r instanceof we){let h=r;this.addError(h),s=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(),Le.Raw("?"))])}else throw l}if(!n){if(this.match(g.KwIf)){let l=this.previous().pos,r=this.currentPos().offset;try{this.check(g.LParen)&&(i.conditionStyle=2),i.condition=this.parseConditionExpression(),i.conditionPos=l.extendedTo(this.prevNonWhitespaceOrComment().pos)}catch(h){let a=k.caught(h).unwrap();if(a instanceof we){let o=a;this.addError(o),s=this.currentPos(),this.currentPos().offset==r&&this.advance()}else throw h}}if(this.checkBlockStart()){i.body=[];let l=this.currentPos().offset;try{i.style=this.parseStatementBlock(i.body)}catch(r){let h=k.caught(r).unwrap();if(h instanceof we){let a=h;this.addError(a),s=this.currentPos(),this.currentPos().offset==l&&this.advance(),i.body.length==0&&(i.body=[new Oe(this.nextNodeId(4),this.currentPos(),null,Re.Null)])}else throw r}}else if(this.check(g.Arrow)){let l=this.currentPos().offset;try{i.body=[],i.body.push(this.parseNode())}catch(r){let h=k.caught(r).unwrap();if(h instanceof we){let a=h;this.addError(a),s=this.currentPos(),this.currentPos().offset==l&&this.advance(),i.body.length==0&&(i.body=[new Oe(this.nextNodeId(4),this.currentPos(),null,Re.Null)])}else throw r}i.style=0}}if(i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),s!=null)for(;!this.isAtEnd()&&this.currentPos().line<=s.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,s=e.attachments;return!0;case 16:let n=e.n;return!0;case 17:let l=e.b;return!0;case 19:let r=e.name;return this.peek().type!=g.Colon;case 18:case 26:case 38:case 43:case 45:case 47:return!0;default:return!1}}parseExpressionStatement(){let e=this.parseExpression();if(this.match(g.OpAssign)||this.match(g.OpPlusAssign)||this.match(g.OpMinusAssign)||this.match(g.OpMultiplyAssign)||this.match(g.OpDivideAssign)){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,s=e.attachments;return!0;case 19:let n=e.name;return this.peek().type==g.Colon?!0:this.peek().type==g.Arrow;case 1:case 2:case 3:case 4:case 5:case 39:return!0;default:return!1}}parseIfStatement(){let e=this.currentPos(),t=new gi(this.nextNodeId(4),e,null,0,null,null);for(this.expect(g.KwIf),this.check(g.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression();this.match(g.LineBreak););this.attachComments(t),t.thenBranch=new mi(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==g.KwElse){for(this.advance();this.match(g.LineBreak););if(this.attachElseComments(t,i),this.check(g.KwIf)){t.elseBranch=new mi(this.nextNodeId(3),this.currentPos(),null);let s=this.parseIfStatement();t.elseBranch.body=[s],t.elseBranch.style=0}else t.elseBranch=new mi(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 k.thrown(new we("Expected alternative keyword",this.currentPos()))}let i=new Vi(this.nextNodeId(2),e,t,[]);for(this.advance();this.match(g.LineBreak););this.attachComments(i);let s=new mi(this.nextNodeId(3),this.currentPos(),null);for(s.body=[],s.style=this.parseStatementBlock(s.body),i.items.push(s),i.style=s.style;this.check(g.Separator);){let n=this.tokens[this.current];for(this.advance();this.match(g.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 c=o[a];++a,c.pos.line<=n.pos.line?r.push(c):h.push(c)}i.separatorComments.push(r),this.pendingComments=h}let l=new mi(this.nextNodeId(3),this.currentPos(),null);l.body=[],l.style=this.parseStatementBlock(l.body),i.items.push(l)}return i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),i}parseTransition(){let e=this.currentPos();if(this.expect(g.Arrow),this.match(g.Dot))return this.attachComments(new Ni(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),".",this.prevNonWhitespaceOrComment().pos));let t=this.expectIdentifier();return this.attachComments(new Ni(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),t,this.prevNonWhitespaceOrComment().pos))}parseInsertion(){let e=this.currentPos();this.expect(g.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,s=t.args,n=t.code,l=t.external;return this.advance(),this.attachComments(new Di(this.nextNodeId(3),e,i,[].concat(s),n,l))}else throw k.thrown(new we("Unexpected token in expression",this.currentPos()))}parseExpression(){try{let e=this.parseLogicalOr();if(this.check(g.OpAssign)||this.check(g.OpPlusAssign)||this.check(g.OpMinusAssign)||this.check(g.OpMultiplyAssign)||this.check(g.OpDivideAssign)){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=k.caught(e).unwrap();return t instanceof we&&this.addError(t),new Oe(this.nextNodeId(4),this.currentPos(),null,Re.Null)}}parseLogicalOr(){let e=this.parseLogicalAnd();for(;this.match(g.OpOr(!1));){let t=this.previous().type,i=this.attachComments(new Xt(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(g.OpAnd(!1));){let t=this.previous().type,i=this.attachComments(new Xt(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(g.OpEquals)||this.match(g.OpNotEquals);){let t=this.previous().type,i=this.attachComments(new Xt(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(g.OpGreater)||this.match(g.OpGreaterEq)||this.match(g.OpLess)||this.match(g.OpLessEq);){let t=this.previous().type,i=this.attachComments(new Xt(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(g.OpPlus)||this.match(g.OpMinus);){let t=this.previous().type,i=this.attachComments(new Xt(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(g.OpMultiply)||this.match(g.OpDivide)||this.match(g.OpModulo);){let t=this.previous().type,i=this.attachComments(new Xt(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(g.OpNot)||this.match(g.OpMinus)){let e=this.previous().type,t=this.attachComments(new Hi(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,s=t.s,n=t.attachments;return this.parsePostfix(e,this.parseStringLiteral());case 16:let l=t.n;return this.advance(),this.attachComments(new Oe(this.nextNodeId(4),e,l,Re.Number));case 17:let r=t.b;return this.advance(),this.attachComments(new Oe(this.nextNodeId(4),e,r,Re.Boolean));case 18:return this.advance(),this.attachComments(new Oe(this.nextNodeId(4),e,null,Re.Null));case 19:let h=t.name;if(this.peek().type==g.Colon){let o=[this.parseObjectField()];return new Oe(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),o,Re.Object(0))}else return this.advance(),this.parseIdentifierExpression(e,h);break;case 43:return this.parsePostfix(e,this.parseObjectLiteral());case 45:this.advance();let a=this.parseExpression();return this.expect(g.RParen),this.parsePostfix(e,a);case 47:return this.parsePostfix(e,this.parseArrayLiteral());default:throw k.thrown(new we("Unexpected token in expression",this.currentPos()))}}parseStringLiteral(){let e=this.currentPos(),t=[],i=this.tokens[this.current].type;if(i._hx_index==15){let s=i.quotes,n=i.s,l=i.attachments,r=s!=0?e.withOffset(n,1,e.length-2):e,h=0;if(l==null||l.length==0){let p=this.makeStringPartPosition(r,n,0);p.length=r.length;let f=this.nextNodeId(4),_=this.nextNodeId(4);return t.push(new je(_,p,Le.Raw(n))),this.advance(),this.attachComments(new Tt(f,e,s,t))}let a=this.attachComments(new Tt(this.nextNodeId(4),e,s,t)),o=0,c=l.length;for(;o<c;){let p=o++,f=l[p];switch(f._hx_index){case 0:let _=f.braces,d=f.inTag,x=f.expr,y=f.start,b=f.length;if(h>=y+b)continue;if(y>h){let F=this.makeStringPartPosition(r,n,h);F.length=y-h;let L=y-h;t.push(new je(this.nextNodeId(4),F,Le.Raw(L!=null?u.substr(n,h,L):u.substr(n,h,null))))}t.push(this.parseStringInterpolation(_,d,x,y,b,n)),h=y+b;break;case 1:let v=f.closing,T=f.start,E=f.length;if(h>=T+E)continue;if(T>h){let F=this.makeStringPartPosition(r,n,h);F.length=T-h;let L=T-h;t.push(new je(this.nextNodeId(4),F,Le.Raw(L!=null?u.substr(n,h,L):u.substr(n,h,null))))}t.push(this.parseStringTag(v,T,E,n,s,l)),h=T+E;break}}if(h<n.length){let p=this.makeStringPartPosition(r,n,h);p.length=n.length-h;let f=null;t.push(new je(this.nextNodeId(4),p,Le.Raw(f!=null?u.substr(n,h,f):u.substr(n,h,null))))}if(this.advance(),this.pendingComments!=null){let p=null,f=0,_=this.pendingComments;for(;f<_.length;){let d=_[f];++f,d.pos.line==e.line?(a.trailingComments==null&&(a.trailingComments=[]),a.trailingComments.push(d)):(p==null&&(p=[]),p.push(d))}this.pendingComments=p}return a}else throw k.thrown(new we("Expected text, got "+this.currentTokenTypeToString(),this.currentPos()))}makeStringPartPosition(e,t,i){let s=e.line,n=e.column,l=0,r=i;for(;l<r;){let h=l++;u.cca(t,h)==10?(++s,n=1):++n}return new z(s,n,e.offset+i)}makeAccess(e,t,i,s){if(i!=null){if(i.length==0&&(this.errors==null||this.errors.length==0)&&this.addError(new we("Invalid access: "+(i!=null?"'"+i+"'":"null"),e)),t!=null)if(s!=null)e=new z(t.pos.line,t.pos.column,t.pos.offset,s.offset+i.length-t.pos.offset);else throw k.thrown(new we("Invalid access (missing name position)",e));else if(e.length==0){let n=s!=null?s.length:null;e=new z(e.line,e.column,e.offset,n??i.length)}}return new lt(this.nextNodeId(4),e,t,i)}parseStringInterpolation(e,t,i,s,n,l){let r=i[0],h=r!=null?r.pos:null,a=this.makeStringPartPosition(h??this.currentPos(),l,s);if(a.length=n,i.length==0){let p=i[0],f=p!=null?p.pos:null;this.addError(new we("Empty interpolation",f??this.currentPos()));let _=this.nextNodeId(4),d=this.nextNodeId(4),x=i[0],y=x!=null?x.pos:null;return new je(_,a,Le.Expr(new Oe(d,y??this.currentPos(),null,Re.Null)))}let o=null;if(!e&&i.length>0){let p=null,f=0,_=!1;for(;f<i.length;){let d=i[f];++f;let x=d.type;switch(x._hx_index){case 19:let y=x.name;if(p==null)p=this.attachComments(this.makeAccess(d.pos,null,y,null));else if(_)p=this.attachComments(this.makeAccess(d.pos,p,y,d.pos));else{this.addError(new we("Missing dot in field access",d.pos));let O=this.nextNodeId(4),q=this.nextNodeId(4),S=i[0],W=S!=null?S.pos:null;return new je(O,a,Le.Expr(new Oe(q,W??this.currentPos(),null,Re.Null)))}_=!1;break;case 42:if(p==null){this.addError(new we("Leading dot in field access",d.pos));let O=this.nextNodeId(4),q=this.nextNodeId(4),S=i[0],W=S!=null?S.pos:null;return new je(O,a,Le.Expr(new Oe(q,W??this.currentPos(),null,Re.Null)))}_=!0;break;case 45:if(p==null){this.addError(new we("Function call without target",d.pos));let O=this.nextNodeId(4),q=this.nextNodeId(4),S=i[0],W=S!=null?S.pos:null;return new je(O,a,Le.Expr(new Oe(q,W??this.currentPos(),null,Re.Null)))}let b=d.pos,v=[],T=[],E=1;for(;f<i.length&&E>0;){let O=i[f];switch(++f,O.type._hx_index){case 41:E==1?T.length>0&&(v.push(T),T=[]):T.push(O);break;case 45:++E,T.push(O);break;case 46:--E,E>0?T.push(O):T.length>0&&v.push(T);break;default:T.push(O)}}if(E>0){this.addError(new we("Unterminated function call",b));let O=this.nextNodeId(4),q=this.nextNodeId(4),S=i[0],W=S!=null?S.pos:null;return new je(O,a,Le.Expr(new Oe(q,W??this.currentPos(),null,Re.Null)))}let F=[],L=0;for(;L<v.length;){let O=v[L];++L;let q=new ji(O);q.currentNodeId=this.currentNodeId;let S=q.parseExpression();F.push(S),this.currentNodeId=q.currentNodeId}p=this.attachComments(new Vt(this.nextNodeId(4),b.extendedTo(i[f-1].pos),p,F)),_=!1;break;case 47:if(p==null){this.addError(new we("Array access without target",d.pos));let O=this.nextNodeId(4),q=this.nextNodeId(4),S=i[0],W=S!=null?S.pos:null;return new je(O,a,Le.Expr(new Oe(q,W??this.currentPos(),null,Re.Null)))}let A=d.pos,B=[],I=1,H=null;for(;f<i.length&&I>0;){let O=i[f];switch(++f,O.type._hx_index){case 47:++I,B.push(O);break;case 48:--I,I>0&&B.push(O),H=O;break;default:B.push(O)}}if(I>0){this.addError(new we("Unterminated array access",A));let O=this.nextNodeId(4),q=this.nextNodeId(4),S=i[0],W=S!=null?S.pos:null;return new je(O,a,Le.Expr(new Oe(q,W??this.currentPos(),null,Re.Null)))}let P=new ji(B);P.currentNodeId=this.currentNodeId;let M=P.parseExpression();this.currentNodeId=P.currentNodeId;let V=a.extendedTo(i[f-1].pos);V.length+=1,p=this.attachComments(new ui(this.nextNodeId(4),V,p,M)),_=!1;break;default:this.addError(new we("Unexpected token in field access: "+Ft.toCodeString(d.type),d.pos));let R=this.nextNodeId(4),Y=this.nextNodeId(4),$=i[0],te=$!=null?$.pos:null;return new je(R,a,Le.Expr(new Oe(Y,te??this.currentPos(),null,Re.Null)))}}_&&this.addError(new we("Trailing dot in field access",i[i.length-1].pos)),o=p}else{let p=new ji(i);p.currentNodeId=this.currentNodeId,o=p.parseExpression(),this.currentNodeId=p.currentNodeId,p.isAtEnd()||this.addError(new we("Unexpected tokens after interpolation expression",p.tokens[p.current].pos))}let c=new z(a.line,a.column+(e?1:0),a.offset-(e?2:0),n);return new je(this.nextNodeId(4),c,Le.Expr(o))}parseStringTag(e,t,i,s,n,l){let r=this.currentPos();n!=0&&(r=r.withOffset(s,1,r.length-2));let h=this.makeStringPartPosition(r,s,t);h.length=i;let a=e?2:1,o=t+a,c=i-(e?3:2),p=o+c,f=this.nextNodeId(4),_=!1;if(l!=null){let b=0,v=l.length;e:for(;b<v;){let T=b++,E=l[T];switch(E._hx_index){case 0:let F=E.braces,L=E.inTag,A=E.expr,B=E.start,I=E.length,H=B+I;if(B>=o&&H<=p){_=!0;break e}break;case 1:let P=E.closing,M=E.start,V=E.length;continue}}}if(!_){let b=this.makeStringPartPosition(r,s,o);b.length=c;let v=this.nextNodeId(4),T=this.nextNodeId(4);return new je(f,h,Le.Tag(e,this.attachComments(new Tt(v,b,0,[new je(T,b,Le.Raw(c!=null?u.substr(s,o,c):u.substr(s,o,null)))]))))}let d=[],x=this.attachComments(new Tt(this.nextNodeId(4),h,0,d)),y=o;if(l!=null){let b=0,v=l.length;for(;b<v;){let T=b++,E=l[T];switch(E._hx_index){case 0:let F=E.inTag,L=E.braces,A=E.expr,B=E.start,I=E.length,H=B+I;if(B>=o&&H<=p){if(B>y){let Y=this.makeStringPartPosition(r,s,o);Y.length=B-o;let $=B-y;d.push(new je(this.nextNodeId(4),Y,Le.Raw($!=null?u.substr(s,y,$):u.substr(s,y,null))))}let R=this.parseStringInterpolation(L,!0,A,B,I,s);R.pos=this.makeStringPartPosition(r,s,B),R.pos.length=I,d.push(R),y=H}break;case 1:let P=E.closing,M=E.start,V=E.length;continue}}}if(y<p){let b=null,v=this.makeStringPartPosition(h,b!=null?u.substr(s,t,b):u.substr(s,t,null),y-t+a);v.length=o+p-y;let T=p-y;d.push(new je(this.nextNodeId(4),v,Le.Raw(T!=null?u.substr(s,y,T):u.substr(s,y,null))))}return new je(f,h,Le.Tag(e,x))}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(g.Dot,!1)){let i=null,s=this.currentPos();this.checkIdentifier()?i=this.expectIdentifier():(this.addError(new we("Expected identifier after '.'",this.currentPos())),i=""),t=this.attachComments(this.makeAccess(e,t,i,s))}else if(this.match(g.LBracket)){let i=this.parseExpression();this.expect(g.RBracket);let s=e.extendedTo(this.previous().pos);t=this.attachComments(new ui(this.nextNodeId(4),s,t,i))}else if(this.match(g.LParen)){let i=this.parseCallArguments();t=this.attachComments(new Vt(this.nextNodeId(4),e.extendedTo(this.previous().pos),t,i))}else break;return t}parseArrayLiteral(){let e=this.currentPos(),t=[],i=new Oe(this.nextNodeId(4),e,t,Re.Array);this.expect(g.LBracket),this.attachComments(i);let s=!1;for(;!this.check(g.RBracket)&&!this.isAtEnd();){if(s){for(;this.match(g.LineBreak);)s=!1;this.match(g.Comma)&&(s=!1)}for(;this.match(g.LineBreak)||this.match(g.Indent)||this.match(g.Unindent);)s=!1;if(!this.check(g.RBracket)&&s)throw k.thrown(new we("Expected comma or line break between elements",this.currentPos()));for(;this.match(g.LineBreak)||this.match(g.Indent)||this.match(g.Unindent););this.check(g.RBracket)||t.push(this.parseExpression());let n=this.previous();s=n.type!=g.Colon&&n.type!=g.LineBreak}for(;this.match(g.LineBreak)||this.match(g.Indent)||this.match(g.Unindent););return this.expect(g.RBracket),i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),i}parseObjectLiteral(){let e=this.currentPos(),t=[],i=this.parseBlockStart().type==g.Indent?g.Unindent:g.RBrace,s=i==g.RBrace?1:0,n=new Oe(this.nextNodeId(4),i!=g.RBrace?this.nextNonWhitespaceOrComment().pos:e,t,Re.Object(s));this.attachComments(n);let l=!1;for(;!this.check(i)&&!this.isAtEnd();){if(l){for(;this.match(g.LineBreak)||i!=g.Unindent&&this.match(g.Unindent);)l=!1;this.match(g.Comma)&&(l=!1)}for(;this.match(g.LineBreak)||i!=g.Unindent&&this.match(g.Unindent);)l=!1;if(!this.check(i)&&l)throw k.thrown(new we("Expected comma or line break between fields",this.currentPos()));for(;this.match(g.LineBreak)||i!=g.Unindent&&this.match(g.Unindent););this.check(i)||t.push(this.parseObjectField());let r=this.previous();l=r.type!=g.Colon&&r.type!=g.LineBreak}for(;this.match(g.LineBreak)||i!=g.Unindent&&this.match(g.Unindent););return this.expect(i),n.pos=n.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),n}parseCallArguments(){let e=[];if(!this.check(g.RParen))do{for(;this.match(g.LineBreak););for(e.push(this.parseExpression());this.match(g.LineBreak););}while(this.match(g.Comma));return this.expect(g.RParen),e}parseConditionExpression(){let e=this.match(g.LParen),t=null;try{t=this.parseExpression(),t!=null&&Q.getClass(t)==di&&this.addError(new we("Invalid condition expression: can't assign a variable here. Did you want to use '==' instead?",t.pos))}catch(i){let s=k.caught(i).unwrap();if(s instanceof we){let n=s;this.addError(n),t=new Oe(this.nextNodeId(4),this.currentPos(),null,Re.Null)}else throw i}return e&&this.expect(g.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==g.LineBreak}expect(e){if(this.check(e))return this.advance();{let t=new we("Expected "+Ft.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 44:case 46:case 53:return this.addError(t),new ie(e,this.currentPos());default:}throw k.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 k.thrown(new we("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,s=0,n=this.pendingComments.length;for(;s<n;){let l=s++,r=this.pendingComments[l];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,s=[],n=0,l=this.pendingComments;for(;n<l.length;){let r=l[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)):s.push(r)}this.pendingComments=s}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,s=e.attachments;if(this.previous().type==g.RBrace)return;this.advance();break;case 39:this.advance(),(this.check(g.Dot)||Ft.isIdentifier(this.tokens[this.current].type))&&this.advance();return;case 1:case 2:case 3:case 4:case 5:case 44:case 52:return;default:this.advance()}}}requiresNewLine(){switch(this.tokens[this.current].type._hx_index){case 6:case 39:case 44:return!1;default:return!0}}addError(e){return this.errors==null&&(this.errors=[]),this.errors.includes(e)||this.errors.push(e),e}}K["loreline.Parser"]=ji,ji.__name__="loreline.Parser",Object.assign(ji.prototype,{__class__:ji});class z{constructor(e,t,i,s){s==null&&(s=0),this.line=e,this.column=t,this.offset=i,this.length=s}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,s){if(s==null&&(s=0),i==null&&(i=0),t==0)return new z(this.line,this.column,this.offset,i);let n=this.line,l=this.column,r=this.offset;if(t>0){let h=0;for(;h<t;)r<s+e.length&&u.cca(e,r-s)==10?(++n,l=1):++l,++h,++r}else{let h=0;for(;h>t;){if(--r,r>=0&&u.cca(e,r-s)==10){--n;let a=1,o=r-1;for(;o>=0&&u.cca(e,o-s)!=10;)++a,--o;l=a}else--l;--h}}return r<0&&(r=0,n=1,l=1),new z(n,l,r,i)}extendedTo(e){return new z(this.line,this.column,this.offset,e.offset+e.length-this.offset)}static fromContentAndIndex(e,t,i){i==null&&(i=0);let s=1,n=1,l=0,r=e.length;for(t>r&&(t=r),t<0&&(t=0);l<t;)u.cca(e,l)==10?(++s,n=1):++n,++l;return new z(s,n,t,i)}}K["loreline.Position"]=z,z.__name__="loreline.Position",Object.assign(z.prototype,{__class__:z});class es{constructor(e,t){t==null&&(t=`
|
|
40
|
-
`),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 $t}clear(){this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new $t}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,this._lastChar=u.cca(e,e.length-1);let t=e.length-1;for(;t>=0;){let i=u.cca(e,t);if(i!=32&&i!=10&&i!=13&&i!=9){this._lastVisibleChar=i;break}--t}}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+=Z.string(this._newline),this._beginLine++),this}tab(){let e=0,t=this._level;for(;e<t;){let i=e++;this._buf.b+=Z.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 $t,this._beginLine=1,this.printStringLiteral(e),this.enableComments=t;let i=Te.trim(this.toString());return i=i.split(`
|
|
41
|
-
`)
|
|
42
|
-
`).join("\\n"),
|
|
7
|
+
`);break;case 1:if(e.nodeType==$.Document||e.nodeType==$.Element)throw y.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":ve.toString(e.nodeType)));let l=e.nodeValue;if(l.length!=0){let o=t+Be.htmlEscape(l);this.output.b+=te.string(o),this.pretty&&(this.output.b+=`
|
|
8
|
+
`)}break;case 2:if(this.output.b+=te.string(t+"<![CDATA["),e.nodeType==$.Document||e.nodeType==$.Element)throw y.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":ve.toString(e.nodeType)));this.output.b+=te.string(e.nodeValue),this.output.b+="]]>",this.pretty&&(this.output.b+=`
|
|
9
|
+
`);break;case 3:if(e.nodeType==$.Document||e.nodeType==$.Element)throw y.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":ve.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=Be.trim(n);this.output.b+=te.string(r),this.pretty&&(this.output.b+=`
|
|
11
|
+
`);break;case 4:if(e.nodeType==$.Document||e.nodeType==$.Element)throw y.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":ve.toString(e.nodeType)));this.output.b+=te.string("<!DOCTYPE "+e.nodeValue+">"),this.pretty&&(this.output.b+=`
|
|
12
|
+
`);break;case 5:if(e.nodeType==$.Document||e.nodeType==$.Element)throw y.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":ve.toString(e.nodeType)));this.output.b+=te.string("<?"+e.nodeValue+"?>"),this.pretty&&(this.output.b+=`
|
|
13
|
+
`);break;case 6:if(e.nodeType!=$.Document&&e.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":ve.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!=$.Document&&e.nodeType!=$.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":ve.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==$.Document||l.nodeType==$.Element)throw y.thrown("Bad node type, unexpected "+(l.nodeType==null?"null":ve.toString(l.nodeType)));if(Be.ltrim(l.nodeValue).length!=0)return!0;break;default:}}return!1}static print(e,t){t==null&&(t=!1);let i=new Yi(t);return i.writeNode(e,""),i.output.b}}z["haxe.xml.Printer"]=Yi,Yi.__name__="haxe.xml.Printer",Object.assign(Yi.prototype,{__class__:Yi});var R=Je["hscript.TType"]={__ename__:"hscript.TType",__constructs__:null,TMono:(g=function(k){return{_hx_index:0,r:k,__enum__:"hscript.TType",toString:S}},g._hx_name="TMono",g.__params__=["r"],g),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:(g=function(k){return{_hx_index:6,name:k,__enum__:"hscript.TType",toString:S}},g._hx_name="TParam",g.__params__=["name"],g),TUnresolved:(g=function(k){return{_hx_index:7,name:k,__enum__:"hscript.TType",toString:S}},g._hx_name="TUnresolved",g.__params__=["name"],g),TNull:(g=function(k){return{_hx_index:8,t:k,__enum__:"hscript.TType",toString:S}},g._hx_name="TNull",g.__params__=["t"],g),TInst:(g=function(k,e){return{_hx_index:9,c:k,args:e,__enum__:"hscript.TType",toString:S}},g._hx_name="TInst",g.__params__=["c","args"],g),TEnum:(g=function(k,e){return{_hx_index:10,e:k,args:e,__enum__:"hscript.TType",toString:S}},g._hx_name="TEnum",g.__params__=["e","args"],g),TType:(g=function(k,e){return{_hx_index:11,t:k,args:e,__enum__:"hscript.TType",toString:S}},g._hx_name="TType",g.__params__=["t","args"],g),TAbstract:(g=function(k,e){return{_hx_index:12,a:k,args:e,__enum__:"hscript.TType",toString:S}},g._hx_name="TAbstract",g.__params__=["a","args"],g),TFun:(g=function(k,e){return{_hx_index:13,args:k,ret:e,__enum__:"hscript.TType",toString:S}},g._hx_name="TFun",g.__params__=["args","ret"],g),TAnon:(g=function(k){return{_hx_index:14,fields:k,__enum__:"hscript.TType",toString:S}},g._hx_name="TAnon",g.__params__=["fields"],g),TLazy:(g=function(k){return{_hx_index:15,f:k,__enum__:"hscript.TType",toString:S}},g._hx_name="TLazy",g.__params__=["f"],g)};R.__constructs__=[R.TMono,R.TVoid,R.TInt,R.TFloat,R.TBool,R.TDynamic,R.TParam,R.TUnresolved,R.TNull,R.TInst,R.TEnum,R.TType,R.TAbstract,R.TFun,R.TAnon,R.TLazy];var Te=Je["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:(g=function(k){return{_hx_index:2,t:k,__enum__:"hscript._Checker.WithType",toString:S}},g._hx_name="WithType",g.__params__=["t"],g)};Te.__constructs__=[Te.NoValue,Te.Value,Te.WithType];var ni=Je["hscript.CTypedecl"]={__ename__:"hscript.CTypedecl",__constructs__:null,CTClass:(g=function(k){return{_hx_index:0,c:k,__enum__:"hscript.CTypedecl",toString:S}},g._hx_name="CTClass",g.__params__=["c"],g),CTEnum:(g=function(k){return{_hx_index:1,e:k,__enum__:"hscript.CTypedecl",toString:S}},g._hx_name="CTEnum",g.__params__=["e"],g),CTTypedef:(g=function(k){return{_hx_index:2,t:k,__enum__:"hscript.CTypedecl",toString:S}},g._hx_name="CTTypedef",g.__params__=["t"],g),CTAlias:(g=function(k){return{_hx_index:3,t:k,__enum__:"hscript.CTypedecl",toString:S}},g._hx_name="CTAlias",g.__params__=["t"],g),CTAbstract:(g=function(k){return{_hx_index:4,a:k,__enum__:"hscript.CTypedecl",toString:S}},g._hx_name="CTAbstract",g.__params__=["a"],g)};ni.__constructs__=[ni.CTClass,ni.CTEnum,ni.CTTypedef,ni.CTAlias,ni.CTAbstract];class fl{constructor(e,t){this.expr=e,this.t=t}}z["hscript.Completion"]=fl,fl.__name__="hscript.Completion",Object.assign(fl.prototype,{__class__:fl});class Il{constructor(){this.types=new Se,this.types=new Se,this.types.h.Void=ni.CTAlias(R.TVoid),this.types.h.Int=ni.CTAlias(R.TInt),this.types.h.Float=ni.CTAlias(R.TFloat),this.types.h.Bool=ni.CTAlias(R.TBool),this.types.h.Dynamic=ni.CTAlias(R.TDynamic),this.parser=new Xi}addXmlApi(e){let t=new vl;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 Se,statics:new Se,params:[]}),this.types.h[e]=ni.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 I=s[r];++r,this.addXmlType(I,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 Se,statics:new Se};this.addMeta(h,a),h.isInterface&&(a.isInterface=!0);let o=0,u=h.params;for(;o<u.length;){let I=u[o];++o,a.params.push(R.TParam(I))}t.push(function(){let I=new Se,O=0,L=a.params;for(;O<L.length;){let N=L[O];++O;let U=h.path+"."+Ze.typeStr(N);I.h[U]=N}if(i.localParams=I,h.superClass!=null){let N=i,U=h.superClass.path,q=[],J=0,G=h.superClass.params;for(;J<G.length;){let H=G[J];++J,q.push(i.makeXmlType(H))}a.superClass=N.getType(U,q)}if(h.interfaces!=null){a.interfaces=[];let N=0,U=h.interfaces;for(;N<U.length;){let q=U[N];++N;let J=a.interfaces,G=i,H=q.path,re=[],_e=0,ue=q.params;for(;_e<ue.length;){let de=ue[_e];++_e,re.push(i.makeXmlType(de))}J.push(G.getType(H,re))}}let B=[],A=function(N,U){if(N.isOverride||p.substr(N.name,0,4)=="get_"||p.substr(N.name,0,4)=="set_")return;let q=!N.name.startsWith("__"),J=0,G=N.meta;for(;J<G.length;){let fe=G[J];if(++J,fe.name==":noScript")return;fe.name==":noCompletion"&&(q=!1)}let H=N.set,re;switch(H._hx_index){case 2:let fe=H.m;re=!0;break;case 0:case 4:re=!0;break;default:re=!1}let _e={isPublic:N.isPublic,canWrite:re,complete:q,params:[],name:N.name,t:null},ue=0,de=N.params;for(;ue<de.length;){let fe=de[ue];++ue;let ge=R.TParam(fe),Ne=N.name+"."+fe;B.push(Ne),_e.params.push(ge),i.localParams.h[Ne]=ge}if(_e.t=i.makeXmlType(N.type),N.meta!=null&&N.meta.length>0){_e.meta=[];let fe=0,ge=N.meta;for(;fe<ge.length;){let Ne=ge[fe];++fe;let Fe=_e.meta,Re=Ne.name,Ye=[],Ke=0,Ve=Ne.params;for(;Ke<Ve.length;){let nt=Ve[Ke];++Ke;let Ae;try{Ae=i.parser.parseString(nt)}catch($e){if(y.caught($e).unwrap()instanceof ye)Ae=null;else throw $e}Ye.push(Ae)}Fe.push({name:Re,params:Ye})}}for(;B.length>0;){let fe=i.localParams,ge=B.pop(),Ne=fe;Object.prototype.hasOwnProperty.call(Ne.h,ge)&&delete Ne.h[ge]}_e.name=="new"?a.constructor=_e:U.set(N.name,_e)},K=0,D=h.fields;for(;K<D.length;){let N=D[K];++K,A(N,a.fields)}let M=0,V=h.statics;for(;M<V.length;){let N=V[M];++M,A(N,a.statics)}i.localParams=null}),this.types.h[a.name]=ni.CTClass(a);break;case 2:let c=e.e;if(Object.prototype.hasOwnProperty.call(this.types.h,c.path))return;let f={name:c.path,params:[],constructors:[]};this.addMeta(c,f);let _=0,m=c.params;for(;_<m.length;){let I=m[_];++_,f.params.push(R.TParam(I))}t.push(function(){let I=new Se,O=0,L=f.params;for(;O<L.length;){let K=L[O];++O;let D=c.path+"."+Ze.typeStr(K);I.h[D]=K}i.localParams=I;let B=0,A=c.constructors;for(;B<A.length;){let K=A[B];++B;let D=f.constructors,M=K.name,V;if(K.args==null)V=null;else{let N=[],U=0,q=K.args;for(;U<q.length;){let J=q[U];++U,N.push({name:J.name,opt:J.opt,t:i.makeXmlType(J.t)})}V=N}D.push({name:M,args:V})}i.localParams=null}),this.types.h[f.name]=ni.CTEnum(f);break;case 3:let d=e.t;if(Object.prototype.hasOwnProperty.call(this.types.h,d.path))return;let w={name:d.path,params:[],t:null},b=0,C=d.params;for(;b<C.length;){let I=C[b];++b,w.params.push(R.TParam(I))}d.path=="hscript.TypeCheck"&&w.params.reverse(),t.push(function(){let I=new Se,O=0,L=w.params;for(;O<L.length;){let B=L[O];++O;let A=d.path+"."+Ze.typeStr(B);I.h[A]=B}i.localParams=I,w.t=i.makeXmlType(d.type),i.localParams=null}),this.types.h[d.path]=ni.CTTypedef(w);break;case 4:let E=e.a;if(Object.prototype.hasOwnProperty.call(this.types.h,E.path))return;let T={name:E.path,params:[],t:null};this.addMeta(E,T);let P=0,v=E.params;for(;P<v.length;){let I=v[P];++P,T.params.push(R.TParam(I))}t.push(function(){let I=new Se,O=0,L=T.params;for(;O<L.length;){let B=L[O];++O;let A=E.path+"."+Ze.typeStr(B);I.h[A]=B}i.localParams=I,T.t=i.makeXmlType(E.athis),i.localParams=null}),this.types.h[E.path]=ni.CTAbstract(T);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(f){if(y.caught(f).unwrap()instanceof ye)c=null;else throw f}h.push(c)}s.push({name:r,params:h})}}makeXmlType(e){switch(e._hx_index){case 0:return R.TUnresolved("Unknown");case 1:let t=e.name,i=e.params,l=[],n=0;for(;n<i.length;){let L=i[n];++n,l.push(this.makeXmlType(L))}return this.getType(t,l);case 2:let s=e.name,r=e.params,h=[],a=0;for(;a<r.length;){let L=r[a];++a,h.push(this.makeXmlType(L))}return this.getType(s,h);case 3:let o=e.name,u=e.params,c=[],f=0;for(;f<u.length;){let L=u[f];++f,c.push(this.makeXmlType(L))}return this.getType(o,c);case 4:let _=e.args,m=e.ret,d=[],w=0;for(;w<_.length;){let L=_[w];++w,d.push({name:L.name,opt:L.opt,t:this.makeXmlType(L.t)})}return R.TFun(d,this.makeXmlType(m));case 5:let b=e.fields,C=[],E=0;for(;E<b.length;){let L=b[E];++E;let B=L.name,A=this.makeXmlType(L.type),K=L.meta,D;if(K==null)D=!1;else{let M=!1,V=0;for(;V<K.length;){let N=K[V];if(++V,N.name==":optional"){M=!0;break}}D=M}C.push({name:B,t:A,opt:D})}return R.TAnon(C);case 6:let T=e.t;return R.TDynamic;case 7:let P=e.name,v=e.params,I=[],O=0;for(;O<v.length;){let L=v[O];++O,I.push(this.makeXmlType(L))}return this.getType(P,I)}}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 R.TUnresolved(e)}return i}resolve(e,t){if(e=="Null"){if(t==null||t.length!=1)throw y.thrown("Missing Null<T> parameter");return R.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 R.TInst(l,t);case 1:let n=i.e;return R.TEnum(n,t);case 2:let s=i.t;return R.TType(s,t);case 3:return i.t;case 4:let h=i.a;return R.TAbstract(h,t)}}}z["hscript.CheckerTypes"]=Il,Il.__name__="hscript.CheckerTypes",Object.assign(Il.prototype,{__class__:Il});class Ze{constructor(e){this.events=new Se,this.globals=new Se,e==null&&(e=new Il),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:R.TLazy(function(){let c=i,f=o.t,_=o.params,m=[],d=0,w=o.params.length;for(;d<w;){let b=d++;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 y.thrown("assert");if(a._hx_index==9){let o=a.args;e=a.c}else throw y.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=Te.NoValue),this.locals=new Se,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(F.EBlock([e]),e));let s=this,r=e.e;if(r._hx_index==4){let h=r.e,a=[],o=R.TVoid,u=0;for(;u<h.length;){let f=h[u];for(++u;;){let m=f.e;if(m._hx_index==25){let d=m.name,w=m.args;f=m.e}else break}let _=f.e;if(_._hx_index==14){let m=_.e,d=_.args,w=_.name,b=_.ret;if(w!=null){let C=b==null?this.makeMono():this.makeType(b,f),E=R.TFun(this.typeArgs(d,f),C);this.locals.h[w]=E,a.push(function(){return s.currentFunType=E,s.typeExpr(f,Te.NoValue),E})}else{let C=0;for(;C<a.length;){let E=a[C];++C,E()}a=[],h[h.length-1]==f?o=this.typeExpr(f,t):this.typeExpr(f,Te.NoValue)}}else{let m=0;for(;m<a.length;){let d=a[m];++m,d()}a=[],h[h.length-1]==f?o=this.typeExpr(f,t):this.typeExpr(f,Te.NoValue)}}let c=0;for(;c<a.length;){let f=a[c];++c,o=f()}return o}return this.typeExpr(e,t)}edef(e){return e.e}error(e,t){let i=we.ECustom(e),l=new ye(i,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw y.thrown(l)}saveLocals(){let e=new Se,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 T=[],P=0;for(;P<l.length;){let v=l[P];++P,T.push(this.makeType(v,t))}r=T}let h=n.resolve(s,r);if(h==null){let T=we.ECustom("Unknown type "+te.string(i)),P=new ye(T,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw y.thrown(P);h=R.TDynamic}return h;case 1:let a=e.args,o=e.ret,u=0,c=[],f=0;for(;f<a.length;){let T=a[f];++f,c.push({name:"p"+u++,opt:!1,t:this.makeType(T,t)})}return R.TFun(c,this.makeType(o,t));case 2:let _=e.fields,m=[],d=0;for(;d<_.length;){let T=_[d];++d,m.push({name:T.name,opt:!1,t:this.makeType(T.t,t)})}return R.TAnon(m);case 3:let w=e.t;return this.makeType(w,t);case 4:let b=e.t;return this.makeType(b,t);case 5:let C=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==R.TDynamic?!1:this.linkLoop(e,R.TDynamic);case 9:let l=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,h=t.args,a=0;for(;a<h.length;){let T=h[a];if(++a,this.linkLoop(e,T))return!0}return!1;case 11:let o=t.t,u=t.args,c=0;for(;c<u.length;){let T=u[c];if(++c,this.linkLoop(e,T))return!0}return!1;case 12:let f=t.a,_=t.args,m=0;for(;m<_.length;){let T=_[m];if(++m,this.linkLoop(e,T))return!0}return!1;case 13:let d=t.args,w=t.ret,b=0;for(;b<d.length;){let T=d[b];if(++b,this.linkLoop(e,T.t))return!0}return this.linkLoop(e,w);case 14:let C=t.fields,E=0;for(;E<C.length;){let T=C[E];if(++E,this.linkLoop(e,T.t))return!0}return!1;default:return!1}}link(e,t,i){return this.linkLoop(e,t)?this.follow(t)==e:(t==R.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 d=t.r;return d.r==null?this.link(t,e,d)?(d.r=e,!0):!1:this.typeEq(e,d.r);case 8:let w=t.t,b=l;return this.typeEq(b,w);case 11:let C=t.t,E=t.args;return this.typeEq(e,this.apply(C.t,C.params,E));default:let T=l;return this.typeEq(T,t)}break;case 9:let n=e.c,s=e.args;switch(t._hx_index){case 0:let d=t.r;return d.r==null?this.link(t,e,d)?(d.r=e,!0):!1:this.typeEq(e,d.r);case 8:let w=t.t;return this.typeEq(e,w);case 9:let b=t.c,C=t.args,E=s;if(n==b){let I=0,O=E.length;for(;I<O;){let L=I++;if(!this.typeEq(E[L],C[L]))return!1}return!0}break;case 11:let P=t.t,v=t.args;return this.typeEq(e,this.apply(P.t,P.params,v));default:}break;case 10:let r=e.e,h=e.args;switch(t._hx_index){case 0:let d=t.r;return d.r==null?this.link(t,e,d)?(d.r=e,!0):!1:this.typeEq(e,d.r);case 8:let w=t.t;return this.typeEq(e,w);case 10:let b=t.e,C=t.args,E=h;if(r==b){let I=0,O=E.length;for(;I<O;){let L=I++;if(!this.typeEq(E[L],C[L]))return!1}return!0}break;case 11:let P=t.t,v=t.args;return this.typeEq(e,this.apply(P.t,P.params,v));default:}break;case 11:let a=e.t,o=e.args;switch(t._hx_index){case 0:let d=t.r;return d.r==null?this.link(t,e,d)?(d.r=e,!0):!1:this.typeEq(e,d.r);case 8:let w=t.t,b=o,C=a;return this.typeEq(this.apply(C.t,C.params,b),t);case 11:let E=t.t,T=t.args,P=o;if(a==E){let L=0,B=P.length;for(;L<B;){let A=L++;if(!this.typeEq(P[A],T[A]))return!1}return!0}else{let L=o,B=a;return this.typeEq(this.apply(B.t,B.params,L),t)}break;default:let I=o,O=a;return this.typeEq(this.apply(O.t,O.params,I),t)}break;case 12:let u=e.a,c=e.args;switch(t._hx_index){case 0:let d=t.r;return d.r==null?this.link(t,e,d)?(d.r=e,!0):!1:this.typeEq(e,d.r);case 8:let w=t.t;return this.typeEq(e,w);case 11:let b=t.t,C=t.args;return this.typeEq(e,this.apply(b.t,b.params,C));case 12:let E=t.a,T=t.args,P=c;if(u==E){let I=0,O=P.length;for(;I<O;){let L=I++;if(!this.typeEq(P[L],T[L]))return!1}return!0}break;default:}break;case 13:let f=e.args,_=e.ret;switch(t._hx_index){case 0:let d=t.r;return d.r==null?this.link(t,e,d)?(d.r=e,!0):!1:this.typeEq(e,d.r);case 8:let w=t.t;return this.typeEq(e,w);case 11:let b=t.t,C=t.args;return this.typeEq(e,this.apply(b.t,b.params,C));case 13:let E=t.args,T=t.ret,P=_,v=f;if(v.length==E.length){let I=0,O=v.length;for(;I<O;){let L=I++;if(!this.typeEq(v[L].t,E[L].t))return!1}return this.typeEq(P,T)}break;default:}break;case 14:let m=e.fields;switch(t._hx_index){case 0:let d=t.r;return d.r==null?this.link(t,e,d)?(d.r=e,!0):!1:this.typeEq(e,d.r);case 8:let w=t.t;return this.typeEq(e,w);case 11:let b=t.t,C=t.args;return this.typeEq(e,this.apply(b.t,b.params,C));case 14:let E=t.fields,T=m;if(T.length==E.length){let P=Object.create(null),v=0;for(;v<E.length;){let O=E[v];++v,P[O.name]=O}let I=0;for(;I<T.length;){let O=T[I];++I;let L=P[O.name];if(L==null||!this.typeEq(O.t,L.t))return!1}return!0}break;default:}break;default:switch(t._hx_index){case 0:let d=t.r;return d.r==null?this.link(t,e,d)?(d.r=e,!0):!1:this.typeEq(e,d.r);case 8:let w=t.t;return this.typeEq(e,w);case 11:let b=t.t,C=t.args;return this.typeEq(e,this.apply(b.t,b.params,C));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 f=t.t;return this.tryUnify(e,f);case 11:let _=t.t,m=t.args;return this.tryUnify(e,this.apply(_.t,_.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 f=t.t;return this.tryUnify(e,f);case 11:let _=t.t,m=t.args;return this.tryUnify(e,this.apply(_.t,_.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 f=l;return this.tryUnify(f,t);case 8:let _=t.t,m=l;return this.tryUnify(m,t);case 11:let d=t.t,w=t.args;return this.tryUnify(e,this.apply(d.t,d.params,w));default:let b=l;return this.tryUnify(b,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 f=t.t;return this.tryUnify(e,f);case 9:let _=t.c,m=t.args,d=s,w=n;for(;w!=_;){if(w.interfaces!=null){let A=0,K=w.interfaces;for(;A<K.length;){let D=K[A];if(++A,D._hx_index==9){let M=D.c,V=D.args,N=[],U=0;for(;U<V.length;){let J=V[U];++U,N.push(this.apply(J,w.params,d))}let q=R.TInst(M,N);if(this.tryUnify(q,t))return!0}else throw y.thrown("assert")}}let B=w.superClass;if(B==null)return!1;if(B._hx_index==9){let A=B.c,K=B.args,D=[],M=0;for(;M<K.length;){let V=K[M];++M,D.push(this.apply(V,w.params,d))}d=D,w=A}else throw y.thrown("assert")}let b=0,C=d.length;for(;b<C;){let B=b++;if(!this.typeEq(d[B],m[B]))return!1}return!0;case 11:let E=t.t,T=t.args;return this.tryUnify(e,this.apply(E.t,E.params,T));case 14:let P=t.fields,v=s,I=n,O=0,L=P.length;for(;O<L;){let B=O++,A=P[B],K=null,D=I;for(;K=D.fields.h[A.name],K==null;){if(D.superClass==null)return!1;let M=D.superClass;if(M==null)throw y.thrown("assert");if(M._hx_index==9){let V=M.args;D=M.c}else throw y.thrown("assert")}if(!this.typeEq(this.apply(K.t,I.params,v),A.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 f=h,_=r;return this.tryUnify(this.apply(_.t,_.params,f),t);case 8:let m=t.t,d=h,w=r;return this.tryUnify(this.apply(w.t,w.params,d),t);case 11:let b=t.t,C=t.args,E=h,T=r;return this.tryUnify(this.apply(T.t,T.params,E),t);default:let P=h,v=r;return this.tryUnify(this.apply(v.t,v.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 f=t.t;return this.tryUnify(e,f);case 11:let _=t.t,m=t.args;return this.tryUnify(e,this.apply(_.t,_.params,m));case 12:let d=t.a,w=t.args,b=d.meta,C=d.params,E=d.t;if(d.name=="haxe.Function")return!0;break;case 13:let T=t.args,P=t.ret,v=o,I=a;if(I.length==T.length){let O=0,L=I.length;for(;O<L;){let B=O++,A=I[B],K=T[B];if(K.opt&&!A.opt||!this.tryUnify(K.t,A.t))return!1}return this.tryUnify(v,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 f=t.t;return this.tryUnify(e,f);case 11:let _=t.t,m=t.args;return this.tryUnify(e,this.apply(_.t,_.params,m));case 14:let d=t.fields,w=u;if(d.length==0)return!0;let b=Object.create(null),C=0;for(;C<w.length;){let T=w[C];++C,b[T.name]=T}let E=0;for(;E<d.length;){let T=d[E];++E;let P=b[T.name];if(P==null){if(T.opt)continue;return!1}if(!this.typeEq(P.t,T.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 f=t.t;return this.tryUnify(e,f);case 11:let _=t.t,m=t.args;return this.tryUnify(e,this.apply(_.t,_.params,m));default:}}return this.typeEq(e,t)}unify(e,t,i){if(!this.tryUnify(e,t)){let l=we.ECustom(Ze.typeStr(e)+" should be "+Ze.typeStr(t)),n=new ye(l,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw y.thrown(n)}}apply(e,t,i){if(i.length!=t.length)throw y.thrown("Invalid number of type parameters");if(i.length==0)return e;let l=new $i,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 R.TNull(t(s));case 9:let r=e.args;if(r.length==0)return e;{let C=r,E=e.c,T=[],P=0;for(;P<C.length;){let v=C[P];++P,T.push(t(v))}return R.TInst(E,T)}break;case 10:let h=e.args;if(h.length==0)return e;{let C=h,E=e.e,T=[],P=0;for(;P<C.length;){let v=C[P];++P,T.push(t(v))}return R.TEnum(E,T)}break;case 11:let a=e.args;if(a.length==0)return e;{let C=a,E=e.t,T=[],P=0;for(;P<C.length;){let v=C[P];++P,T.push(t(v))}return R.TType(E,T)}break;case 12:let o=e.args;if(o.length==0)return e;{let C=o,E=e.a,T=[],P=0;for(;P<C.length;){let v=C[P];++P,T.push(t(v))}return R.TAbstract(E,T)}break;case 13:let u=e.args,c=e.ret,f=[],_=0;for(;_<u.length;){let C=u[_];++_,f.push({name:C.name,opt:C.opt,t:t(C.t)})}return R.TFun(f,t(c));case 14:let m=e.fields,d=[],w=0;for(;w<m.length;){let C=m[w];++w,d.push({name:C.name,opt:C.opt,t:t(C.t)})}return R.TAnon(d);case 15:let b=e.f;return t(b())}}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,f=c,_=Object.keys(c),m=_.length,d=0;for(;d<m;){let b=_[d++],C=n.fields.h[b];if(!C.isPublic||!C.complete)continue;let E=C.name,T=r(C.t);this.allowAsync&&E.startsWith("a_")&&(T=this.unasync(T),E=p.substr(E,2,null)),t.push({name:E,t:T})}if(n.isInterface&&n.interfaces!=null){let b=0,C=n.interfaces;for(;b<C.length;){let E=C[b];++b;let T=0,P=this.getFields(E);for(;T<P.length;){let v=P[T];++T,t.push({name:v.name,t:r(v.t)})}}}if(n.superClass==null)break;let w=n.superClass;if(w==null)break;if(w._hx_index==9){let b=w.c,C=w.args,E=r;r=function(T){return E(i.apply(T,b.params,C))},n=b}else break}break;case 13:let h=l.args,a=l.ret;this.isCompletion&&t.push({name:"bind",t:R.TFun(h,R.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,f=s.interfaces;for(;c<f.length;){let _=f[c];++c;let m=this.getField(_,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=we.ECustom("Can't access private field "+t+" on "+s.name),f=new ye(c,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw y.thrown(f)}if(l&&!h.canWrite){let c=we.ECustom("Can't write readonly field "+t+" on "+s.name),f=new ye(c,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw y.thrown(f)}let a=h.t;if(h.params!=null){let c=h.params,f=[],_=0,m=h.params.length;for(;_<m;){let d=_++;f.push(this.makeMono())}a=this.apply(a,c,f)}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 R.TFun(n,a.t)}}}}return null}typeExprWith(e,t){let i=this.typeExpr(e,Te.WithType(t));return this.unify(i,t,e),t}makeMono(){return R.TMono({r:null})}makeIterator(e){return R.TAnon([{name:"next",opt:!1,t:R.TFun([],e)},{name:"hasNext",opt:!1,t:R.TFun([],R.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 y.thrown(new fl(e,t))}typeField(e,t,i,l){let n=this.typeExpr(e,Te.Value);t==null&&this.onCompletion(i,n);let s=this.getField(n,t,i,l);if(s==null){let r=we.ECustom(Ze.typeStr(n)+" has no field "+t),h=new ye(r,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw y.thrown(h);s=R.TDynamic}return s}typeExpr(e,t){if(e==null&&this.isCompletion)return t._hx_index==2?t.t:R.TDynamic;let i=this,l=e.e;switch(l._hx_index){case 0:let h=l.c;switch(h._hx_index){case 0:let he=h.v;return R.TInt;case 1:let me=h.f;return R.TFloat;case 2:let Me=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 he=u.f;return he()}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 R.TBool;case"null":return this.makeMono();case"trace":return R.TDynamic;default:if(t._hx_index==2){let Me=t.t;if(Me._hx_index==10){let De=Me,Bt=Me.e,It=Me.args,ht=0,ki=Bt.constructors;for(;ht<ki.length;){let li=ki[ht];if(++ht,li.name==a){if(this.onTopDownEnum(Bt,a)){let ut=li.args==null?De:R.TFun(li.args,De);return this.apply(ut,Bt.params,It)}break}}}}if(this.isCompletion)return R.TDynamic;let he=we.ECustom("Unknown identifier "+a),me=new ye(he,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw y.thrown(me)}break;case 2:let c=l.n,f=l.t,_=l.e,m=f==null?this.makeMono():this.makeType(f,e);if(_!=null){let he=this.typeExpr(_,f==null?Te.Value:Te.WithType(m));f==null?m=he:this.unify(he,m,_)}return this.locals.h[c]=m,R.TVoid;case 3:let d=l.e;return this.typeExpr(d,t);case 4:let w=l.e,b=R.TVoid,C=this.saveLocals(),E=0;for(;E<w.length;){let he=w[E];++E,b=this.typeExpr(he,he==w[w.length-1]?t:Te.NoValue)}return this.locals=C,b;case 5:let T=l.e,P=l.f;return this.typeField(T,P,e,!1);case 6:let v=l.op,I=l.e1,O=l.e2;switch(v){case"!=":case"==":let he=this.typeExpr(I,Te.Value),me=this.typeExpr(O,Te.WithType(he));return this.tryUnify(he,me)||this.unify(me,he,O),R.TBool;case"%":case"*":case"-":case"/":let Me=this.typeExpr(I,Te.WithType(R.TInt)),De=this.typeExpr(O,Te.WithType(Me));this.tryUnify(Me,De)||this.unify(De,Me,O);let Bt=this.follow(Me),It=this.follow(De);switch(Bt._hx_index){case 2:switch(It._hx_index){case 2:return v=="/"?R.TFloat:R.TInt;case 3:case 5:return R.TFloat;default:this.unify(Me,R.TFloat,I),this.unify(De,R.TFloat,O)}break;case 3:switch(It._hx_index){case 2:case 3:case 5:return R.TFloat;default:this.unify(Me,R.TFloat,I),this.unify(De,R.TFloat,O)}break;case 5:switch(It._hx_index){case 2:case 3:case 5:return R.TFloat;default:this.unify(Me,R.TFloat,I),this.unify(De,R.TFloat,O)}break;default:this.unify(Me,R.TFloat,I),this.unify(De,R.TFloat,O)}break;case"+":let ht=this.typeExpr(I,Te.WithType(R.TInt)),ki=this.typeExpr(O,Te.WithType(ht));this.tryUnify(ht,ki);let li=this.follow(ht),ut=this.follow(ki);switch(li._hx_index){case 2:switch(ut._hx_index){case 2:return R.TInt;case 3:return R.TFloat;case 5:return R.TDynamic;default:let yt=li,pi=ut;if(this.isString(yt)||this.isString(pi))return this.types.t_string;this.unify(yt,R.TFloat,I),this.unify(pi,R.TFloat,O)}break;case 3:switch(ut._hx_index){case 2:case 3:return R.TFloat;case 5:return R.TDynamic;default:let yt=li,pi=ut;if(this.isString(yt)||this.isString(pi))return this.types.t_string;this.unify(yt,R.TFloat,I),this.unify(pi,R.TFloat,O)}break;case 5:return R.TDynamic;default:if(ut._hx_index==5)return R.TDynamic;{let yt=li,pi=ut;if(this.isString(yt)||this.isString(pi))return this.types.t_string;this.unify(yt,R.TFloat,I),this.unify(pi,R.TFloat,O)}}break;case"...":return this.typeExprWith(I,R.TInt),this.typeExprWith(O,R.TInt),this.makeIterator(R.TInt);case"&":case"<<":case">>":case">>>":case"^":case"|":return this.typeExprWith(I,R.TInt),this.typeExprWith(O,R.TInt),R.TInt;case"<":case"<=":case">":case">=":let Rt=this.typeExpr(I,Te.Value),Mi=this.typeExpr(O,Te.WithType(Rt));this.tryUnify(Rt,Mi)||this.unify(Mi,Rt,O);let il=this.follow(Rt);switch(il._hx_index){case 2:case 3:case 4:break;case 9:let yt=il.c,pi=il.args,ln=yt.constructor,Nn=yt.fields,Mn=yt.interfaces,Ln=yt.isInterface,Bn=yt.meta,An=yt.params,Fn=yt.statics,Dn=yt.superClass;if(yt.name!="String"){let vn=we.ECustom("Cannot compare "+Ze.typeStr(Rt)),In=new ye(vn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw y.thrown(In)}break;default:let En=we.ECustom("Cannot compare "+Ze.typeStr(Rt)),Sn=new ye(En,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw y.thrown(Sn)}return R.TBool;case"=":if(this.allowDefine){let yt=I.e;if(yt._hx_index==1){let pi=yt.v;if(!Object.prototype.hasOwnProperty.call(this.locals.h,pi)&&!Object.prototype.hasOwnProperty.call(this.globals.h,pi)){let ln=this.typeExpr(O,Te.Value);return this.locals.h[pi]=ln,ln}}}let Tl,Hl=I.e;if(Hl._hx_index==5){let yt=Hl.e,pi=Hl.f;Tl=this.typeField(yt,pi,I,!0)}else Tl=this.typeExpr(I,Te.Value);return this.typeExprWith(O,Tl),Tl;case"&&":case"||":return this.typeExprWith(I,R.TBool),this.typeExprWith(O,R.TBool),R.TBool;default:if(p.cca(v,v.length-1)==61){let yt=this.typeExpr(this.mk(F.EBinop(p.substr(v,0,v.length-1),I,O),e),t);return this.typeExpr(this.mk(F.EBinop("=",I,O),e),t)}let Tn=we.ECustom("Unsupported operation "+v),Cn=new ye(Tn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw y.thrown(Cn)}break;case 7:let L=l.prefix,B=l.op,A=l.e,K=this.typeExpr(A,Te.Value);switch(B){case"!":return this.unify(K,R.TBool,A),K;case"++":case"-":case"--":return this.unify(K,R.TInt,A),K;default:}break;case 8:let D=l.e,M=l.params,V=D.e;if(V._hx_index==5&&V.f=="bind"){let he=V.e,me=this.typeExpr(he,Te.Value);if(me._hx_index==13){let Me=me.args,De=me.ret,Bt=Me.slice(),It=0;for(;It<M.length;){let ht=M[It];++It;let ki=Bt.shift();if(ki==null){let li=we.ECustom("Too many arguments"),ut=new ye(li,ht.pmin,ht.pmax,ht.origin,ht.line);if(!this.isCompletion)throw y.thrown(ut);return R.TFun([],De)}this.typeExprWith(ht,ki.t)}return R.TFun(Bt,De)}}let N=D.e,U;if(N._hx_index==1){let he=N.v;if(t._hx_index==2){let me=t.t;if(me._hx_index==10){let Me=me.e,De=me.args;U=t}else U=Te.Value}else U=Te.Value}else U=Te.Value;let q=this.typeExpr(D,U),J=this.follow(q);switch(J._hx_index){case 5:let he=0;for(;he<M.length;){let ut=M[he];++he,this.typeExpr(ut,Te.Value)}return this.makeMono();case 13:let me=J.args,Me=J.ret,De=0,Bt=M.length;for(;De<Bt;){let ut=De++,Rt=me[ut];if(Rt==null){let il=M[ut],Tl=we.ECustom("Too many arguments"),Hl=new ye(Tl,il.pmin,il.pmax,il.origin,il.line);if(!this.isCompletion)throw y.thrown(Hl);break}let Mi=this.typeExpr(M[ut],Rt==null?Te.Value:Te.WithType(Rt.t));this.unify(Mi,Rt.t,M[ut])}let It=M.length,ht=me.length;for(;It<ht;){let ut=It++;if(!me[ut].opt){let Rt=we.ECustom("Missing argument "+me[ut].name+":"+Ze.typeStr(me[ut].t)),Mi=new ye(Rt,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw y.thrown(Mi)}}return Me;default:let ki=we.ECustom(Ze.typeStr(q)+" cannot be called"),li=new ye(ki,D.pmin,D.pmax,D.origin,D.line);if(!this.isCompletion)throw y.thrown(li);return this.makeMono()}break;case 9:let G=l.cond,H=l.e1,re=l.e2;this.typeExprWith(G,R.TBool);let _e=this.typeExpr(H,t);if(re==null)return _e;let ue=this.typeExpr(re,t);if(t==Te.NoValue)return R.TVoid;if(this.tryUnify(ue,_e))return _e;if(this.tryUnify(_e,ue))return ue;this.unify(ue,_e,re);break;case 10:let de=l.cond,fe=l.e;return this.typeExprWith(de,R.TBool),this.typeExpr(fe,Te.NoValue),R.TVoid;case 11:let ge=l.v,Ne=l.it,Fe=l.e,Re=this.saveLocals(),Ye=this.typeExpr(Ne,Te.Value),Ke=this.getIteratorType(Ne,Ye);return this.locals.h[ge]=Ke,this.typeExpr(Fe,Te.NoValue),this.locals=Re,R.TVoid;case 12:case 13:return R.TVoid;case 14:let Ve=l.args,nt=l.e,Ae=l.name,$e=l.ret,X=null,ee=null,j=null;if(this.currentFunType!=null){let he=this.currentFunType;if(he._hx_index==13){let me=he.args,Me=he.ret;X=this.currentFunType,ee=Me,j=me}else throw y.thrown("assert");this.currentFunType=null}else ee=$e==null?this.makeMono():this.makeType($e,e);let le=this.saveLocals(),Z=this.allowReturn,Q=this.allowDefine,se=this.hasReturn;this.allowReturn=ee,this.allowDefine=!1,this.hasReturn=!1;let ae=null,be;if(Ae!=null){let he;if(t._hx_index==2){let me=this.follow(t.t);if(me._hx_index==13){let Me=me.args,De=me.ret;he=!0}else he=!1}else he=!1;be=!he}else be=!1;if(be){let he=this.events.h[Ae];he!=null&&(t=Te.WithType(he))}if(t._hx_index==2){let he=this.follow(t.t);if(he._hx_index==13){let me=he.args,Me=he.ret;ae=me,this.unify(ee,Me,e)}}j==null&&(j=this.typeArgs(Ve,e));let et=0,Oe=j.length;for(;et<Oe;){let he=et++,me=j[he];if(ae!=null)if(he<ae.length)this.unify(ae[he].t,me.t,e);else{let Me=we.ECustom("Extra argument "+me.name),De=new ye(Me,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw y.thrown(De)}this.locals.h[me.name]=me.t}if(ae!=null&&j.length<ae.length){let he="Missing "+(ae.length-j.length)+" arguments (",me=[],Me=j.length,De=ae.length;for(;Me<De;){let ht=Me++;me.push(Ze.typeStr(ae[ht].t))}let Bt=we.ECustom(he+me.join(",")+")"),It=new ye(Bt,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw y.thrown(It)}if(this.typeExpr(nt,Te.NoValue),!this.hasReturn&&!this.tryUnify(ee,R.TVoid)){let he=we.ECustom("Missing return "+Ze.typeStr(ee)),me=new ye(he,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw y.thrown(me)}return this.allowDefine=Q,this.allowReturn=Z,this.hasReturn=se,this.locals=le,X==null&&(X=R.TFun(j,ee),Ae!=null&&(le.h[Ae]=X)),X;case 15:let _t=l.e,Ee=_t==null?R.TVoid:this.typeExpr(_t,this.allowReturn==null?Te.Value:Te.WithType(this.allowReturn));if(this.hasReturn=!0,this.allowReturn==null){let he=we.ECustom("Return not allowed here"),me=new ye(he,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw y.thrown(me)}else this.unify(Ee,this.allowReturn,_t??e);return this.makeMono();case 16:let Ie=l.e,at=l.index;this.typeExprWith(at,R.TInt);let tt=this.typeExpr(Ie,Te.Value),wt=this.follow(tt);if(wt._hx_index==9){let he=wt.c,me=wt.args,Me=he.constructor,De=he.fields,Bt=he.interfaces,It=he.isInterface,ht=he.meta,ki=he.params,li=he.statics,ut=he.superClass;if(he.name=="Array"){if(me.length==1)return me[0];{let Rt=we.ECustom(Ze.typeStr(tt)+" is not an Array"),Mi=new ye(Rt,Ie.pmin,Ie.pmax,Ie.origin,Ie.line);if(!this.isCompletion)throw y.thrown(Mi)}}else{let Rt=we.ECustom(Ze.typeStr(tt)+" is not an Array"),Mi=new ye(Rt,Ie.pmin,Ie.pmax,Ie.origin,Ie.line);if(!this.isCompletion)throw y.thrown(Mi)}}else{let he=we.ECustom(Ze.typeStr(tt)+" is not an Array"),me=new ye(he,Ie.pmin,Ie.pmax,Ie.origin,Ie.line);if(!this.isCompletion)throw y.thrown(me)}break;case 17:let Ut=l.e,ft=null,ei=0;for(;ei<Ut.length;){let he=Ut[ei];++ei;let me=this.typeExpr(he,ft==null?Te.Value:Te.WithType(ft));ft==null?ft=me:this.tryUnify(me,ft)||(this.tryUnify(ft,me)?ft=me:this.unify(me,ft,he))}return ft==null&&(ft=this.makeMono()),this.types.getType("Array",[ft]);case 18:let He=l.cl,Mt=l.params;break;case 19:let vt=l.e;return this.typeExpr(vt,Te.Value),this.makeMono();case 20:let Lt=l.e,mt=l.v,Dt=l.t,qt=l.ecatch,jt=this.typeExpr(Lt,t),ti=this.locals.h[mt],ii=this.locals,Wt=this.makeType(Dt,qt);ii.h[mt]=Wt;let it=this.typeExpr(qt,t);if(ti!=null)this.locals.h[mt]=ti;else{let he=this.locals;Object.prototype.hasOwnProperty.call(he.h,mt)&&delete he.h[mt]}return t==Te.NoValue?R.TVoid:this.tryUnify(jt,it)?it:(this.unify(it,jt,qt),jt);case 21:let xi=l.fl;if(t._hx_index==2){let he=this.follow(t.t);if(he._hx_index==14){let me=he.fields;if(me.length>0){let Me=Object.create(null),De=0;for(;De<me.length;){let ht=me[De];++De,Me[ht.name]=ht}let Bt=[],It=0;for(;It<xi.length;){let ht=xi[It];++It;let ki=Me[ht.name],li;if(ki==null){let ut=ht.e,Rt=we.ECustom("Extra field "+ht.name),Mi=new ye(Rt,ut.pmin,ut.pmax,ut.origin,ut.line);if(!this.isCompletion)throw y.thrown(Mi);li=R.TDynamic}else li=ki.t;Bt.push({t:this.typeExprWith(ht.e,li),opt:!1,name:ht.name})}return R.TAnon(Bt)}else{let Me=[],De=0;for(;De<xi.length;){let Bt=xi[De];++De,Me.push({t:this.typeExpr(Bt.e,Te.Value),opt:!1,name:Bt.name})}return R.TAnon(Me)}}else{let me=[],Me=0;for(;Me<xi.length;){let De=xi[Me];++Me,me.push({t:this.typeExpr(De.e,Te.Value),opt:!1,name:De.name})}return R.TAnon(me)}}else{let he=[],me=0;for(;me<xi.length;){let Me=xi[me];++me,he.push({t:this.typeExpr(Me.e,Te.Value),opt:!1,name:Me.name})}return R.TAnon(he)}break;case 22:let ke=l.cond,lt=l.e1,ot=l.e2;this.typeExprWith(ke,R.TBool);let rt=this.typeExpr(lt,t);if(ot==null)return rt;let gt=this.typeExpr(ot,t);if(t==Te.NoValue)return R.TVoid;if(this.tryUnify(gt,rt))return rt;if(this.tryUnify(rt,gt))return gt;this.unify(gt,rt,ot);break;case 23:let dt=l.e,Tt=l.cases,Kt=l.defaultExpr,xt=null,zl=this.typeExpr(dt,Te.Value),ul=0;for(;ul<Tt.length;){let he=Tt[ul];++ul;let me=0,Me=he.values;for(;me<Me.length;){let It=Me[me];++me;let ht=this.typeExpr(It,Te.WithType(zl));this.unify(ht,zl,It)}let De=this.typeExpr(he.expr,t),Bt=he.expr;t!=Te.NoValue&&(xt==null?xt=De:i.tryUnify(De,xt)||(i.unify(xt,De,Bt),xt=De))}if(Kt!=null){let he=this.typeExpr(Kt,t);t!=Te.NoValue&&(xt==null?xt=he:i.tryUnify(he,xt)||(i.unify(xt,he,Kt),xt=he))}return t==Te.NoValue?R.TVoid:xt??this.makeMono();case 24:let Ji=l.cond,en=l.e;return this.typeExprWith(Ji,R.TBool),this.typeExpr(en,Te.NoValue),R.TVoid;case 25:let On=l.args,kn=l.name,wn=l.e;return kn==":untyped"&&this.allowUntypedMeta?this.makeMono():this.typeExpr(wn,t);case 26:let un=l.e,yn=l.t,tn=this.makeType(yn,e),bn=this.typeExpr(un,Te.WithType(tn));return this.unify(bn,tn,un),tn}let n=e.e,s=we.ECustom("Don't know how to type "+Je[n.__enum__].__constructs__[n._hx_index]._hx_name),r=new ye(s,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw y.thrown(r);return R.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,f=r.meta,_=r.params,m=r.statics,d=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 B=[],A=0;for(;A<r.length;){let K=r[A];++A,B.push(Ze.typeStr(K))}a="<"+B.join(",")+">"}return h+a;case 10:let o=e.e,u=e.args,c=o.name,f;if(u.length==0)f="";else{let B=[],A=0;for(;A<u.length;){let K=u[A];++A,B.push(Ze.typeStr(K))}f="<"+B.join(",")+">"}return c+f;case 11:let _=e.t,m=e.args;if(_.name=="hscript.TypeCheck")return Ze.typeStr(m[1]);{let B=_.name,A;if(m.length==0)A="";else{let K=[],D=0;for(;D<m.length;){let M=m[D];++D,K.push(Ze.typeStr(M))}A="<"+K.join(",")+">"}return B+A}break;case 12:let d=e.a,w=e.args,b=d.name,C;if(w.length==0)C="";else{let B=[],A=0;for(;A<w.length;){let K=w[A];++A,B.push(Ze.typeStr(K))}C="<"+B.join(",")+">"}return b+C;case 13:let E=e.args,T=e.ret,P=[],v=0;for(;v<E.length;){let B=E[v];++v,P.push((B.opt?"?":"")+(B.name==""?"":B.name+":")+Ze.typeStr(B.t))}return"("+P.join(", ")+") -> "+Ze.typeStr(T);case 14:let I=e.fields,O=[],L=0;for(;L<I.length;){let B=I[L];++L,O.push((B.opt?"?":"")+B.name+":"+Ze.typeStr(B.t))}return"{"+O.join(", ")+"}";default:return p.substr(Je[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 v=s[r];++r,t(v)}break;case 10:let h=e.e,a=e.args,o=0;for(;o<a.length;){let v=a[o];++o,t(v)}break;case 11:let u=e.t,c=e.args,f=0;for(;f<c.length;){let v=c[f];++f,t(v)}break;case 12:let _=e.a,m=e.args,d=0;for(;d<m.length;){let v=m[d];++d,t(v)}break;case 13:let w=e.args,b=e.ret,C=0;for(;C<w.length;){let v=w[C];++C,t(v.t)}t(b);break;case 14:let E=e.fields,T=0;for(;T<E.length;){let v=E[T];++T,t(v.t)}break;case 15:let P=e.f;t(P());break;default:}}}z["hscript.Checker"]=Ze,Ze.__name__="hscript.Checker",Object.assign(Ze.prototype,{__class__:Ze});var ai=Je["hscript.Const"]={__ename__:"hscript.Const",__constructs__:null,CInt:(g=function(k){return{_hx_index:0,v:k,__enum__:"hscript.Const",toString:S}},g._hx_name="CInt",g.__params__=["v"],g),CFloat:(g=function(k){return{_hx_index:1,f:k,__enum__:"hscript.Const",toString:S}},g._hx_name="CFloat",g.__params__=["f"],g),CString:(g=function(k){return{_hx_index:2,s:k,__enum__:"hscript.Const",toString:S}},g._hx_name="CString",g.__params__=["s"],g)};ai.__constructs__=[ai.CInt,ai.CFloat,ai.CString];var F=Je["hscript.ExprDef"]={__ename__:"hscript.ExprDef",__constructs__:null,EConst:(g=function(k){return{_hx_index:0,c:k,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EConst",g.__params__=["c"],g),EIdent:(g=function(k){return{_hx_index:1,v:k,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EIdent",g.__params__=["v"],g),EVar:(g=function(k,e,t){return{_hx_index:2,n:k,t:e,e:t,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EVar",g.__params__=["n","t","e"],g),EParent:(g=function(k){return{_hx_index:3,e:k,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EParent",g.__params__=["e"],g),EBlock:(g=function(k){return{_hx_index:4,e:k,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EBlock",g.__params__=["e"],g),EField:(g=function(k,e){return{_hx_index:5,e:k,f:e,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EField",g.__params__=["e","f"],g),EBinop:(g=function(k,e,t){return{_hx_index:6,op:k,e1:e,e2:t,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EBinop",g.__params__=["op","e1","e2"],g),EUnop:(g=function(k,e,t){return{_hx_index:7,op:k,prefix:e,e:t,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EUnop",g.__params__=["op","prefix","e"],g),ECall:(g=function(k,e){return{_hx_index:8,e:k,params:e,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="ECall",g.__params__=["e","params"],g),EIf:(g=function(k,e,t){return{_hx_index:9,cond:k,e1:e,e2:t,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EIf",g.__params__=["cond","e1","e2"],g),EWhile:(g=function(k,e){return{_hx_index:10,cond:k,e,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EWhile",g.__params__=["cond","e"],g),EFor:(g=function(k,e,t){return{_hx_index:11,v:k,it:e,e:t,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EFor",g.__params__=["v","it","e"],g),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:(g=function(k,e,t,i){return{_hx_index:14,args:k,e,name:t,ret:i,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EFunction",g.__params__=["args","e","name","ret"],g),EReturn:(g=function(k){return{_hx_index:15,e:k,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EReturn",g.__params__=["e"],g),EArray:(g=function(k,e){return{_hx_index:16,e:k,index:e,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EArray",g.__params__=["e","index"],g),EArrayDecl:(g=function(k){return{_hx_index:17,e:k,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EArrayDecl",g.__params__=["e"],g),ENew:(g=function(k,e){return{_hx_index:18,cl:k,params:e,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="ENew",g.__params__=["cl","params"],g),EThrow:(g=function(k){return{_hx_index:19,e:k,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EThrow",g.__params__=["e"],g),ETry:(g=function(k,e,t,i){return{_hx_index:20,e:k,v:e,t,ecatch:i,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="ETry",g.__params__=["e","v","t","ecatch"],g),EObject:(g=function(k){return{_hx_index:21,fl:k,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EObject",g.__params__=["fl"],g),ETernary:(g=function(k,e,t){return{_hx_index:22,cond:k,e1:e,e2:t,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="ETernary",g.__params__=["cond","e1","e2"],g),ESwitch:(g=function(k,e,t){return{_hx_index:23,e:k,cases:e,defaultExpr:t,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="ESwitch",g.__params__=["e","cases","defaultExpr"],g),EDoWhile:(g=function(k,e){return{_hx_index:24,cond:k,e,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EDoWhile",g.__params__=["cond","e"],g),EMeta:(g=function(k,e,t){return{_hx_index:25,name:k,args:e,e:t,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="EMeta",g.__params__=["name","args","e"],g),ECheckType:(g=function(k,e){return{_hx_index:26,e:k,t:e,__enum__:"hscript.ExprDef",toString:S}},g._hx_name="ECheckType",g.__params__=["e","t"],g)};F.__constructs__=[F.EConst,F.EIdent,F.EVar,F.EParent,F.EBlock,F.EField,F.EBinop,F.EUnop,F.ECall,F.EIf,F.EWhile,F.EFor,F.EBreak,F.EContinue,F.EFunction,F.EReturn,F.EArray,F.EArrayDecl,F.ENew,F.EThrow,F.ETry,F.EObject,F.ETernary,F.ESwitch,F.EDoWhile,F.EMeta,F.ECheckType];var Ht=Je["hscript.CType"]={__ename__:"hscript.CType",__constructs__:null,CTPath:(g=function(k,e){return{_hx_index:0,path:k,params:e,__enum__:"hscript.CType",toString:S}},g._hx_name="CTPath",g.__params__=["path","params"],g),CTFun:(g=function(k,e){return{_hx_index:1,args:k,ret:e,__enum__:"hscript.CType",toString:S}},g._hx_name="CTFun",g.__params__=["args","ret"],g),CTAnon:(g=function(k){return{_hx_index:2,fields:k,__enum__:"hscript.CType",toString:S}},g._hx_name="CTAnon",g.__params__=["fields"],g),CTParent:(g=function(k){return{_hx_index:3,t:k,__enum__:"hscript.CType",toString:S}},g._hx_name="CTParent",g.__params__=["t"],g),CTOpt:(g=function(k){return{_hx_index:4,t:k,__enum__:"hscript.CType",toString:S}},g._hx_name="CTOpt",g.__params__=["t"],g),CTNamed:(g=function(k,e){return{_hx_index:5,n:k,t:e,__enum__:"hscript.CType",toString:S}},g._hx_name="CTNamed",g.__params__=["n","t"],g)};Ht.__constructs__=[Ht.CTPath,Ht.CTFun,Ht.CTAnon,Ht.CTParent,Ht.CTOpt,Ht.CTNamed];class ye{constructor(e,t,i,l,n){this.e=e,this.pmin=t,this.pmax=i,this.origin=l,this.line=n}toString(){return sl.errorToString(this)}}z["hscript.Error"]=ye,ye.__name__="hscript.Error",Object.assign(ye.prototype,{__class__:ye});var we=Je["hscript.ErrorDef"]={__ename__:"hscript.ErrorDef",__constructs__:null,EInvalidChar:(g=function(k){return{_hx_index:0,c:k,__enum__:"hscript.ErrorDef",toString:S}},g._hx_name="EInvalidChar",g.__params__=["c"],g),EUnexpected:(g=function(k){return{_hx_index:1,s:k,__enum__:"hscript.ErrorDef",toString:S}},g._hx_name="EUnexpected",g.__params__=["s"],g),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:(g=function(k){return{_hx_index:4,msg:k,__enum__:"hscript.ErrorDef",toString:S}},g._hx_name="EInvalidPreprocessor",g.__params__=["msg"],g),EUnknownVariable:(g=function(k){return{_hx_index:5,v:k,__enum__:"hscript.ErrorDef",toString:S}},g._hx_name="EUnknownVariable",g.__params__=["v"],g),EInvalidIterator:(g=function(k){return{_hx_index:6,v:k,__enum__:"hscript.ErrorDef",toString:S}},g._hx_name="EInvalidIterator",g.__params__=["v"],g),EInvalidOp:(g=function(k){return{_hx_index:7,op:k,__enum__:"hscript.ErrorDef",toString:S}},g._hx_name="EInvalidOp",g.__params__=["op"],g),EInvalidAccess:(g=function(k){return{_hx_index:8,f:k,__enum__:"hscript.ErrorDef",toString:S}},g._hx_name="EInvalidAccess",g.__params__=["f"],g),ECustom:(g=function(k){return{_hx_index:9,msg:k,__enum__:"hscript.ErrorDef",toString:S}},g._hx_name="ECustom",g.__params__=["msg"],g)};we.__constructs__=[we.EInvalidChar,we.EUnexpected,we.EUnterminatedString,we.EUnterminatedComment,we.EInvalidPreprocessor,we.EUnknownVariable,we.EInvalidIterator,we.EInvalidOp,we.EInvalidAccess,we.ECustom];var Ui=Je["hscript.ModuleDecl"]={__ename__:"hscript.ModuleDecl",__constructs__:null,DPackage:(g=function(k){return{_hx_index:0,path:k,__enum__:"hscript.ModuleDecl",toString:S}},g._hx_name="DPackage",g.__params__=["path"],g),DImport:(g=function(k,e){return{_hx_index:1,path:k,everything:e,__enum__:"hscript.ModuleDecl",toString:S}},g._hx_name="DImport",g.__params__=["path","everything"],g),DClass:(g=function(k){return{_hx_index:2,c:k,__enum__:"hscript.ModuleDecl",toString:S}},g._hx_name="DClass",g.__params__=["c"],g),DTypedef:(g=function(k){return{_hx_index:3,c:k,__enum__:"hscript.ModuleDecl",toString:S}},g._hx_name="DTypedef",g.__params__=["c"],g)};Ui.__constructs__=[Ui.DPackage,Ui.DImport,Ui.DClass,Ui.DTypedef];var Ti=Je["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}};Ti.__constructs__=[Ti.APublic,Ti.APrivate,Ti.AInline,Ti.AOverride,Ti.AStatic,Ti.AMacro];var Pl=Je["hscript.FieldKind"]={__ename__:"hscript.FieldKind",__constructs__:null,KFunction:(g=function(k){return{_hx_index:0,f:k,__enum__:"hscript.FieldKind",toString:S}},g._hx_name="KFunction",g.__params__=["f"],g),KVar:(g=function(k){return{_hx_index:1,v:k,__enum__:"hscript.FieldKind",toString:S}},g._hx_name="KVar",g.__params__=["v"],g)};Pl.__constructs__=[Pl.KFunction,Pl.KVar];var W=Je["hscript.Token"]={__ename__:"hscript.Token",__constructs__:null,TEof:{_hx_name:"TEof",_hx_index:0,__enum__:"hscript.Token",toString:S},TConst:(g=function(k){return{_hx_index:1,c:k,__enum__:"hscript.Token",toString:S}},g._hx_name="TConst",g.__params__=["c"],g),TId:(g=function(k){return{_hx_index:2,s:k,__enum__:"hscript.Token",toString:S}},g._hx_name="TId",g.__params__=["s"],g),TOp:(g=function(k){return{_hx_index:3,s:k,__enum__:"hscript.Token",toString:S}},g._hx_name="TOp",g.__params__=["s"],g),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:(g=function(k){return{_hx_index:16,s:k,__enum__:"hscript.Token",toString:S}},g._hx_name="TMeta",g.__params__=["s"],g),TPrepro:(g=function(k){return{_hx_index:17,s:k,__enum__:"hscript.Token",toString:S}},g._hx_name="TPrepro",g.__params__=["s"],g)};W.__constructs__=[W.TEof,W.TConst,W.TId,W.TOp,W.TPOpen,W.TPClose,W.TBrOpen,W.TBrClose,W.TDot,W.TQuestionDot,W.TComma,W.TSemicolon,W.TBkOpen,W.TBkClose,W.TQuestion,W.TDoubleDot,W.TMeta,W.TPrepro];class Xi{constructor(){this.uid=0,this.preprocesorValues=new Se,this.line=1,this.opChars="+*/-=!><&|^%~",this.identChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";let e=[["%"],["*","/"],["+","-"],["<<",">>",">>>"],["|","&","^"],["==","!=",">","<",">=","<="],["..."],["&&"],["||"],["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","&=","^=","=>"],["->"]];this.opPriority=new Se,this.opRightAssoc=new Se;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 y.thrown(new ye(e,t,i,this.origin,this.line))}invalidChar(e){if(!this.resumeErrors)throw y.thrown(new ye(we.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 Sl,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==W.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=F.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=we.EUnexpected(this.tokenString(e));if(!this.resumeErrors)throw y.thrown(new ye(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();ce.enumEq(t,e)||this.unexpected(t)}maybe(e){let t=this.token();return ce.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 re=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 f=t.cond,_=t.e1,m=t.e2;return m!=null?this.isBlock(m):this.isBlock(_);case 10:let d=t.cond,w=t.e;return this.isBlock(w);case 11:let b=t.v,C=t.it,E=t.e;return this.isBlock(E);case 14:let T=t.args,P=t.name,v=t.ret,I=t.e;return this.isBlock(I);case 15:let O=t.e;return O!=null?this.isBlock(O):!1;case 20:let L=t.e,B=t.v,A=t.t,K=t.ecatch;return this.isBlock(K);case 21:let D=t.fl;return!0;case 23:let M=t.e,V=t.cases,N=t.defaultExpr;return!0;case 24:let U=t.cond,q=t.e;return this.isBlock(q);case 25:let J=t.name,G=t.args,H=t.e;return this.isBlock(H);default:return!1}}parseFullExpr(e){let t=this.parseExpr();e.push(t);let i=this.token();for(;;){let l;if(i==W.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!=W.TSemicolon&&i!=W.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!=W.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=F.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=F.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 v=F.EIdent(h),I=null,O=null;v==null?a=null:(I==null&&(I=this.tokenMin),O==null&&(O=this.tokenMax),a={e:v,pmin:I,pmax:O,origin:this.origin,line:this.line})}return this.parseExprNext(a);case 3:let o=e.s;if(o=="-"){let v=this.tokenMin,I=this.parseExpr();if(I==null)return this.makeUnop(o,I);let O=I.e;if(O._hx_index==0){let L=O.c;switch(L._hx_index){case 0:let B=L.v,A=F.EConst(ai.CInt(-B)),K=v,D=I==null?0:I.pmax;return A==null?null:(K==null&&(K=this.tokenMin),D==null&&(D=this.tokenMax),{e:A,pmin:K,pmax:D,origin:this.origin,line:this.line});case 1:let M=L.f,V=F.EConst(ai.CFloat(-M)),N=v,U=I==null?0:I.pmax;return V==null?null:(N==null&&(N=this.tokenMin),U==null&&(U=this.tokenMax),{e:V,pmin:N,pmax:U,origin:this.origin,line:this.line});default:return this.makeUnop(o,I)}}else return this.makeUnop(o,I)}return this.opPriority.h[o]<0?this.makeUnop(o,this.parseExpr()):this.unexpected(e);case 4:if(e=this.token(),e==W.TPClose){let v=this.token();ce.enumEq(v,W.TOp("->"))||this.unexpected(v);let I=this.parseExpr(),O=F.EReturn(I),L=t,B=null,A;O==null?A=null:(L==null&&(L=this.tokenMin),B==null&&(B=this.tokenMax),A={e:O,pmin:L,pmax:B,origin:this.origin,line:this.line});let K=F.EFunction([],A),D=t,M=null;return K==null?null:(D==null&&(D=this.tokenMin),M==null&&(M=this.tokenMax),{e:K,pmin:D,pmax:M,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 v=F.EParent(u),I=t,O=this.tokenMax,L;return v==null?L=null:(I==null&&(I=this.tokenMin),O==null&&(O=this.tokenMax),L={e:v,pmin:I,pmax:O,origin:this.origin,line:this.line}),this.parseExprNext(L);case 10:let B=u.e;if(B._hx_index==1){let K=B.v;return this.parseLambda([{name:K}],u==null?0:u.pmin)}break;case 15:let A=this.parseType();switch(e=this.token(),e._hx_index){case 5:let K=F.ECheckType(u,A),D=t,M=this.tokenMax,V;return K==null?V=null:(D==null&&(D=this.tokenMin),M==null&&(M=this.tokenMax),V={e:K,pmin:D,pmax:M,origin:this.origin,line:this.line}),this.parseExprNext(V);case 10:let N=u.e;if(N._hx_index==1){let U=N.v;return this.parseLambda([{name:U,t:A}],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 v=e.c;if(this.allowJSON)if(v._hx_index==2){let D=v.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))}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 I=e.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));break;case 7:let L=F.EObject([]),B=t,A=null,K;return L==null?K=null:(B==null&&(B=this.tokenMin),A==null&&(A=this.tokenMax),K={e:L,pmin:B,pmax:A,origin:this.origin,line:this.line}),this.parseExprNext(K);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==W.TBrClose||this.resumeErrors&&e==W.TEof);)this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let f=F.EBlock(c),_=t,m=null;return f==null?null:(_==null&&(_=this.tokenMin),m==null&&(m=this.tokenMax),{e:f,pmin:_,pmax:m,origin:this.origin,line:this.line});case 12:let d=[];e=this.token();let w=!0;for(;e!=W.TBkClose&&(!this.resumeErrors||e!=W.TEof);)w||(e!=W.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,d.push(this.parseExpr()),e=this.token();if(d.length==1&&d[0]!=null){let v=d[0].e;switch(v._hx_index){case 10:let I=v.cond,O=v.e,L="__a_"+this.uid++,B=F.EArrayDecl([]),A=t,K=null,D;B==null?D=null:(A==null&&(A=this.tokenMin),K==null&&(K=this.tokenMax),D={e:B,pmin:A,pmax:K,origin:this.origin,line:this.line});let M=F.EVar(L,null,D),V=t,N=null,U;M==null?U=null:(V==null&&(V=this.tokenMin),N==null&&(N=this.tokenMax),U={e:M,pmin:V,pmax:N,origin:this.origin,line:this.line});let q=this.mapCompr(L,d[0]),J=F.EIdent(L),G=t,H=null,re;J==null?re=null:(G==null&&(G=this.tokenMin),H==null&&(H=this.tokenMax),re={e:J,pmin:G,pmax:H,origin:this.origin,line:this.line});let _e=F.EBlock([U,q,re]),ue=t,de=null,fe;return _e==null?fe=null:(ue==null&&(ue=this.tokenMin),de==null&&(de=this.tokenMax),fe={e:_e,pmin:ue,pmax:de,origin:this.origin,line:this.line}),this.parseExprNext(fe);case 11:let ge=v.v,Ne=v.it,Fe=v.e,Re="__a_"+this.uid++,Ye=F.EArrayDecl([]),Ke=t,Ve=null,nt;Ye==null?nt=null:(Ke==null&&(Ke=this.tokenMin),Ve==null&&(Ve=this.tokenMax),nt={e:Ye,pmin:Ke,pmax:Ve,origin:this.origin,line:this.line});let Ae=F.EVar(Re,null,nt),$e=t,X=null,ee;Ae==null?ee=null:($e==null&&($e=this.tokenMin),X==null&&(X=this.tokenMax),ee={e:Ae,pmin:$e,pmax:X,origin:this.origin,line:this.line});let j=this.mapCompr(Re,d[0]),le=F.EIdent(Re),Z=t,Q=null,se;le==null?se=null:(Z==null&&(Z=this.tokenMin),Q==null&&(Q=this.tokenMax),se={e:le,pmin:Z,pmax:Q,origin:this.origin,line:this.line});let ae=F.EBlock([ee,j,se]),be=t,et=null,Oe;return ae==null?Oe=null:(be==null&&(be=this.tokenMin),et==null&&(et=this.tokenMax),Oe={e:ae,pmin:be,pmax:et,origin:this.origin,line:this.line}),this.parseExprNext(Oe);case 24:let _t=v.cond,Ee=v.e,Ie="__a_"+this.uid++,at=F.EArrayDecl([]),tt=t,wt=null,Ut;at==null?Ut=null:(tt==null&&(tt=this.tokenMin),wt==null&&(wt=this.tokenMax),Ut={e:at,pmin:tt,pmax:wt,origin:this.origin,line:this.line});let ft=F.EVar(Ie,null,Ut),ei=t,He=null,Mt;ft==null?Mt=null:(ei==null&&(ei=this.tokenMin),He==null&&(He=this.tokenMax),Mt={e:ft,pmin:ei,pmax:He,origin:this.origin,line:this.line});let vt=this.mapCompr(Ie,d[0]),Lt=F.EIdent(Ie),mt=t,Dt=null,qt;Lt==null?qt=null:(mt==null&&(mt=this.tokenMin),Dt==null&&(Dt=this.tokenMax),qt={e:Lt,pmin:mt,pmax:Dt,origin:this.origin,line:this.line});let jt=F.EBlock([Mt,vt,qt]),ti=t,ii=null,Wt;return jt==null?Wt=null:(ti==null&&(ti=this.tokenMin),ii==null&&(ii=this.tokenMax),Wt={e:jt,pmin:ti,pmax:ii,origin:this.origin,line:this.line}),this.parseExprNext(Wt);default:}}let b=F.EArrayDecl(d),C=t,E=null,T;return b==null?T=null:(C==null&&(C=this.tokenMin),E==null&&(E=this.tokenMax),T={e:b,pmin:C,pmax:E,origin:this.origin,line:this.line}),this.parseExprNext(T);case 16:let P=e.s;if(this.allowMetadata){let v=this.parseMetaArgs(),I=F.EMeta(P,v,this.parseExpr()),O=t,L=null;return I==null?null:(O==null&&(O=this.tokenMin),L==null&&(L=this.tokenMax),{e:I,pmin:O,pmax:L,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(),f=this.maybe(W.TDoubleDot)?this.parseType():null;e.push({name:c,t:f});let _=this.token();switch(_._hx_index){case 5:break e;case 10:break;default:this.unexpected(_);break e}}let i=this.token();ce.enumEq(i,W.TOp("->"))||this.unexpected(i);let l=this.parseExpr(),n=F.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=F.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!=W.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!=W.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=F.EParent(this.mapCompr(e,r));break;case 4:let h=l.e;if(h.length==1){let B=h[0];i=F.EBlock([this.mapCompr(e,B)])}else{let B=F.EIdent(e),A=t==null?0:t.pmin,K=t==null?0:t.pmax,D;B==null?D=null:(A==null&&(A=this.tokenMin),K==null&&(K=this.tokenMax),D={e:B,pmin:A,pmax:K,origin:this.origin,line:this.line});let M=F.EField(D,"push"),V=t==null?0:t.pmin,N=t==null?0:t.pmax,U;M==null?U=null:(V==null&&(V=this.tokenMin),N==null&&(N=this.tokenMax),U={e:M,pmin:V,pmax:N,origin:this.origin,line:this.line}),i=F.ECall(U,[t])}break;case 9:let a=l.cond,o=l.e1;if(l.e2==null)i=F.EIf(a,this.mapCompr(e,o),null);else{let B=F.EIdent(e),A=t==null?0:t.pmin,K=t==null?0:t.pmax,D;B==null?D=null:(A==null&&(A=this.tokenMin),K==null&&(K=this.tokenMax),D={e:B,pmin:A,pmax:K,origin:this.origin,line:this.line});let M=F.EField(D,"push"),V=t==null?0:t.pmin,N=t==null?0:t.pmax,U;M==null?U=null:(V==null&&(V=this.tokenMin),N==null&&(N=this.tokenMax),U={e:M,pmin:V,pmax:N,origin:this.origin,line:this.line}),i=F.ECall(U,[t])}break;case 10:let c=l.cond,f=l.e;i=F.EWhile(c,this.mapCompr(e,f));break;case 11:let _=l.v,m=l.it,d=l.e;i=F.EFor(_,m,this.mapCompr(e,d));break;case 24:let w=l.cond,b=l.e;i=F.EDoWhile(w,this.mapCompr(e,b));break;default:let C=F.EIdent(e),E=t==null?0:t.pmin,T=t==null?0:t.pmax,P;C==null?P=null:(E==null&&(E=this.tokenMin),T==null&&(T=this.tokenMax),P={e:C,pmin:E,pmax:T,origin:this.origin,line:this.line});let v=F.EField(P,"push"),I=t==null?0:t.pmin,O=t==null?0:t.pmax,L;v==null?L=null:(I==null&&(I=this.tokenMin),O==null&&(O=this.tokenMax),L={e:v,pmin:I,pmax:O,origin:this.origin,line:this.line}),i=F.ECall(L,[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=F.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,f=F.ETernary(this.makeUnop(e,o),u,c),_=o==null?0:o.pmin,m=c==null?0:c.pmax;return f==null?null:(_==null&&(_=this.tokenMin),m==null&&(m=this.tokenMax),{e:f,pmin:_,pmax:m,origin:this.origin,line:this.line});default:let d=F.EUnop(e,!0,t),w=t==null?0:t.pmin,b=t==null?0:t.pmax;return d==null?null:(w==null&&(w=this.tokenMin),b==null&&(b=this.tokenMax),{e:d,pmin:w,pmax:b,origin:this.origin,line:this.line})}}makeBinop(e,t,i){if(i==null&&this.resumeErrors){let n=F.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.EBinop(n,this.makeBinop(e,t,s),r),m=t==null?0:t.pmin,d=r==null?0:r.pmax;return _==null?null:(m==null&&(m=this.tokenMin),d==null&&(d=this.tokenMax),{e:_,pmin:m,pmax:d,origin:this.origin,line:this.line})}else{let _=F.EBinop(e,t,i),m=t==null?0:t.pmin,d=i==null?0:i.pmax;return _==null?null:(m==null&&(m=this.tokenMin),d==null&&(d=this.tokenMax),{e:_,pmin:m,pmax:d,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.EBinop(e,t,i),m=t==null?0:t.pmin,d=i==null?0:i.pmax;return _==null?null:(m==null&&(m=this.tokenMin),d==null&&(d=this.tokenMax),{e:_,pmin:m,pmax:d,origin:this.origin,line:this.line})}else{let _=F.ETernary(this.makeBinop(e,t,h),a,o),m=t==null?0:t.pmin,d=i==null?0:i.pmax;return _==null?null:(m==null&&(m=this.tokenMin),d==null&&(d=this.tokenMax),{e:_,pmin:m,pmax:d,origin:this.origin,line:this.line})}break;default:let u=F.EBinop(e,t,i),c=t==null?0:t.pmin,f=i==null?0:i.pmax;return u==null?null:(c==null&&(c=this.tokenMin),f==null&&(f=this.tokenMax),{e:u,pmin:c,pmax:f,origin:this.origin,line:this.line})}}parseStructure(e){let t=this.tokenMin;switch(e){case"break":let i=F.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=F.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=F.EDoWhile(u,a),f=t,_=u==null?0:u.pmax;return c==null?null:(f==null&&(f=this.tokenMin),_==null&&(_=this.tokenMax),{e:c,pmin:f,pmax:_,origin:this.origin,line:this.line});case"else":return this.unexpected(W.TId(e));case"for":let m=this.token();m!=W.TPOpen&&this.unexpected(m);let d=this.getIdent(),w=this.token();ce.enumEq(w,W.TId("in"))||this.unexpected(w);let b=this.parseExpr(),C=this.token();C!=W.TPClose&&this.unexpected(C);let E=this.parseExpr(),T=F.EFor(d,b,E),P=t,v=E==null?0:E.pmax;return T==null?null:(P==null&&(P=this.tokenMin),v==null&&(v=this.tokenMax),{e:T,pmin:P,pmax:v,origin:this.origin,line:this.line});case"function":let I=this.token(),O=null;I._hx_index==2?O=I.s:(this.tokens.push({t:I,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax);let L=this.parseFunctionDecl(),B=F.EFunction(L.args,L.body,O,L.ret),A=t,K=L.body,D=K==null?0:K.pmax;return B==null?null:(A==null&&(A=this.tokenMin),D==null&&(D=this.tokenMax),{e:B,pmin:A,pmax:D,origin:this.origin,line:this.line});case"if":let M=this.token();M!=W.TPOpen&&this.unexpected(M);let V=this.parseExpr(),N=this.token();N!=W.TPClose&&this.unexpected(N);let U=this.parseExpr(),q=null,J=!1,G=this.token();G==W.TSemicolon&&(J=!0,G=this.token()),ce.enumEq(G,W.TId("else"))?q=this.parseExpr():(this.tokens.push({t:G,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,J&&(this.tokens.push({t:W.TSemicolon,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax));let H=F.EIf(V,U,q),re=t,_e=q==null?this.tokenMax:q==null?0:q.pmax;return H==null?null:(re==null&&(re=this.tokenMin),_e==null&&(_e=this.tokenMax),{e:H,pmin:re,pmax:_e,origin:this.origin,line:this.line});case"inline":return this.maybe(W.TId("function"))||this.unexpected(W.TId("inline")),this.parseStructure("function");case"new":let ue=[];ue.push(this.getIdent());e:for(;;){let it=this.token();switch(it._hx_index){case 4:break e;case 8:ue.push(this.getIdent());break;default:this.unexpected(it);break e}}let de=this.parseExprList(W.TPClose),fe=F.ENew(ue.join("."),de),ge=t,Ne=null;return fe==null?null:(ge==null&&(ge=this.tokenMin),Ne==null&&(Ne=this.tokenMax),{e:fe,pmin:ge,pmax:Ne,origin:this.origin,line:this.line});case"return":let Fe=this.token();this.tokens.push({t:Fe,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let Re=Fe==W.TSemicolon?null:this.parseExpr(),Ye=F.EReturn(Re),Ke=t,Ve=Re==null?this.tokenMax:Re==null?0:Re.pmax;return Ye==null?null:(Ke==null&&(Ke=this.tokenMin),Ve==null&&(Ve=this.tokenMax),{e:Ye,pmin:Ke,pmax:Ve,origin:this.origin,line:this.line});case"switch":let nt=this.parseExpr(),Ae=null,$e=[],X=this.token();X!=W.TBrOpen&&this.unexpected(X);e:for(;;){let it=this.token();switch(it._hx_index){case 2:switch(it.s){case"case":let xi={values:[],expr:null};$e.push(xi);t:for(;;){let gt=this.parseExpr();switch(xi.values.push(gt),it=this.token(),it._hx_index){case 10:break;case 15:break t;default:this.unexpected(it);break t}}let ke=[];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(ke);break;case 2:switch(it.s){case"case":case"default":break t;default:this.parseFullExpr(ke)}break;case 7:break t;default:this.parseFullExpr(ke)}let lt;if(ke.length==1)lt=ke[0];else if(ke.length==0){let gt=F.EBlock([]),dt=this.tokenMin,Tt=this.tokenMin;gt==null?lt=null:(dt==null&&(dt=this.tokenMin),Tt==null&&(Tt=this.tokenMax),lt={e:gt,pmin:dt,pmax:Tt,origin:this.origin,line:this.line})}else{let gt=F.EBlock(ke),dt=ke[0],Tt=dt==null?0:dt.pmin,Kt=ke[ke.length-1],xt=Kt==null?0:Kt.pmax;gt==null?lt=null:(Tt==null&&(Tt=this.tokenMin),xt==null&&(xt=this.tokenMax),lt={e:gt,pmin:Tt,pmax:xt,origin:this.origin,line:this.line})}xi.expr=lt;break;case"default":Ae!=null&&this.unexpected(it);let ot=this.token();ot!=W.TDoubleDot&&this.unexpected(ot);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)Ae=rt[0];else if(rt.length==0){let gt=F.EBlock([]),dt=this.tokenMin,Tt=this.tokenMin;gt==null?Ae=null:(dt==null&&(dt=this.tokenMin),Tt==null&&(Tt=this.tokenMax),Ae={e:gt,pmin:dt,pmax:Tt,origin:this.origin,line:this.line})}else{let gt=F.EBlock(rt),dt=rt[0],Tt=dt==null?0:dt.pmin,Kt=rt[rt.length-1],xt=Kt==null?0:Kt.pmax;gt==null?Ae=null:(Tt==null&&(Tt=this.tokenMin),xt==null&&(xt=this.tokenMax),Ae={e:gt,pmin:Tt,pmax:xt,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 ee=F.ESwitch(nt,$e,Ae),j=t,le=this.tokenMax;return ee==null?null:(j==null&&(j=this.tokenMin),le==null&&(le=this.tokenMax),{e:ee,pmin:j,pmax:le,origin:this.origin,line:this.line});case"throw":let Z=this.parseExpr(),Q=F.EThrow(Z),se=t,ae=Z==null?0:Z.pmax;return Q==null?null:(se==null&&(se=this.tokenMin),ae==null&&(ae=this.tokenMax),{e:Q,pmin:se,pmax:ae,origin:this.origin,line:this.line});case"try":let be=this.parseExpr(),et=this.token();ce.enumEq(et,W.TId("catch"))||this.unexpected(et);let Oe=this.token();Oe!=W.TPOpen&&this.unexpected(Oe);let _t=this.getIdent(),Ee=this.token();Ee!=W.TDoubleDot&&this.unexpected(Ee);let Ie=null;if(this.allowTypes)Ie=this.parseType();else{let it=this.token();ce.enumEq(it,W.TId("Dynamic"))||this.unexpected(it)}let at=this.token();at!=W.TPClose&&this.unexpected(at);let tt=this.parseExpr(),wt=F.ETry(be,_t,Ie,tt),Ut=t,ft=tt==null?0:tt.pmax;return wt==null?null:(Ut==null&&(Ut=this.tokenMin),ft==null&&(ft=this.tokenMax),{e:wt,pmin:Ut,pmax:ft,origin:this.origin,line:this.line});case"var":let ei=this.getIdent(),He=this.token(),Mt=null;He==W.TDoubleDot&&this.allowTypes&&(Mt=this.parseType(),He=this.token());let vt=null;switch(He._hx_index){case 3:He.s=="="?vt=this.parseExpr():this.unexpected(He);break;case 10:case 11:this.tokens.push({t:He,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;default:Mt!=null?(this.tokens.push({t:He,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):this.unexpected(He)}let Lt=F.EVar(ei,Mt,vt),mt=t,Dt=vt==null?this.tokenMax:vt==null?0:vt.pmax;return Lt==null?null:(mt==null&&(mt=this.tokenMin),Dt==null&&(Dt=this.tokenMax),{e:Lt,pmin:mt,pmax:Dt,origin:this.origin,line:this.line});case"while":let qt=this.parseExpr(),jt=this.parseExpr(),ti=F.EWhile(qt,jt),ii=t,Wt=jt==null?0:jt.pmax;return ti==null?null:(ii==null&&(ii=this.tokenMin),Wt==null&&(Wt=this.tokenMax),{e:ti,pmin:ii,pmax:Wt,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 Oe=e.e;switch(Oe._hx_index){case 1:let _t=Oe.v,Ee=this.parseExpr(),Ie=F.EReturn(Ee),at=Ee==null?0:Ee.pmin,tt=null,wt;Ie==null?wt=null:(at==null&&(at=this.tokenMin),tt==null&&(tt=this.tokenMax),wt={e:Ie,pmin:at,pmax:tt,origin:this.origin,line:this.line});let Ut=F.EFunction([{name:_t}],wt),ft=e==null?0:e.pmin,ei=null;return Ut==null?null:(ft==null&&(ft=this.tokenMin),ei==null&&(ei=this.tokenMax),{e:Ut,pmin:ft,pmax:ei,origin:this.origin,line:this.line});case 3:let He=Oe.e.e;if(He._hx_index==1){let vt=He.v,Lt=this.parseExpr(),mt=F.EReturn(Lt),Dt=Lt==null?0:Lt.pmin,qt=null,jt;mt==null?jt=null:(Dt==null&&(Dt=this.tokenMin),qt==null&&(qt=this.tokenMax),jt={e:mt,pmin:Dt,pmax:qt,origin:this.origin,line:this.line});let ti=F.EFunction([{name:vt}],jt),ii=e==null?0:e.pmin,Wt=null;return ti==null?null:(ii==null&&(ii=this.tokenMin),Wt==null&&(Wt=this.tokenMax),{e:ti,pmin:ii,pmax:Wt,origin:this.origin,line:this.line})}break;case 26:let Mt=Oe.e.e;if(Mt._hx_index==1){let vt=Mt.v,Lt=Oe.t,mt=this.parseExpr(),Dt=F.EReturn(mt),qt=mt==null?0:mt.pmin,jt=null,ti;Dt==null?ti=null:(qt==null&&(qt=this.tokenMin),jt==null&&(jt=this.tokenMax),ti={e:Dt,pmin:qt,pmax:jt,origin:this.origin,line:this.line});let ii=F.EFunction([{name:vt,t:Lt}],ti),Wt=e==null?0:e.pmin,it=null;return ii==null?null:(Wt==null&&(Wt=this.tokenMin),it==null&&(it=this.tokenMax),{e:ii,pmin:Wt,pmax:it,origin:this.origin,line:this.line})}break;default:}this.unexpected(t)}if(this.opPriority.h[l]==-1){let Oe;if(this.isBlock(e))Oe=!0;else{let tt=e.e;if(tt._hx_index==3){let wt=tt.e;Oe=!0}else Oe=!1}if(Oe)return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e;let _t=F.EUnop(l,!1,e),Ee=e==null?0:e.pmin,Ie=null,at;return _t==null?at=null:(Ee==null&&(Ee=this.tokenMin),Ie==null&&(Ie=this.tokenMax),at={e:_t,pmin:Ee,pmax:Ie,origin:this.origin,line:this.line}),this.parseExprNext(at)}return this.makeBinop(l,e,this.parseExpr());case 4:let n=F.ECall(e,this.parseExprList(W.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=F.EField(e,a),u=e==null?0:e.pmin,c=null,f;return o==null?f=null:(u==null&&(u=this.tokenMin),c==null&&(c=this.tokenMax),f={e:o,pmin:u,pmax:c,origin:this.origin,line:this.line}),this.parseExprNext(f);case 9:let _=this.getIdent(),m="__a_"+this.uid++,d=F.EVar(m,null,e),w=e==null?0:e.pmin,b=e==null?0:e.pmax,C;d==null?C=null:(w==null&&(w=this.tokenMin),b==null&&(b=this.tokenMax),C={e:d,pmin:w,pmax:b,origin:this.origin,line:this.line});let E=F.EIdent(m),T=e==null?0:e.pmin,P=e==null?0:e.pmax,v;E==null?v=null:(T==null&&(T=this.tokenMin),P==null&&(P=this.tokenMax),v={e:E,pmin:T,pmax:P,origin:this.origin,line:this.line});let I=F.EIdent("null"),O=e==null?0:e.pmin,L=e==null?0:e.pmax,B;I==null?B=null:(O==null&&(O=this.tokenMin),L==null&&(L=this.tokenMax),B={e:I,pmin:O,pmax:L,origin:this.origin,line:this.line});let A=F.EBinop("==",v,B),K=null,D=null,M;A==null?M=null:(K==null&&(K=this.tokenMin),D==null&&(D=this.tokenMax),M={e:A,pmin:K,pmax:D,origin:this.origin,line:this.line});let V=F.EIdent("null"),N=e==null?0:e.pmin,U=e==null?0:e.pmax,q;V==null?q=null:(N==null&&(N=this.tokenMin),U==null&&(U=this.tokenMax),q={e:V,pmin:N,pmax:U,origin:this.origin,line:this.line});let J=F.EIdent(m),G=e==null?0:e.pmin,H=e==null?0:e.pmax,re;J==null?re=null:(G==null&&(G=this.tokenMin),H==null&&(H=this.tokenMax),re={e:J,pmin:G,pmax:H,origin:this.origin,line:this.line});let _e=F.EField(re,_),ue=e==null?0:e.pmin,de=null,fe;_e==null?fe=null:(ue==null&&(ue=this.tokenMin),de==null&&(de=this.tokenMax),fe={e:_e,pmin:ue,pmax:de,origin:this.origin,line:this.line});let ge=F.ETernary(M,q,fe),Ne=null,Fe=null,Re;ge==null?Re=null:(Ne==null&&(Ne=this.tokenMin),Fe==null&&(Fe=this.tokenMax),Re={e:ge,pmin:Ne,pmax:Fe,origin:this.origin,line:this.line});let Ye=F.EBlock([C,Re]),Ke=e==null?0:e.pmin,Ve=null,nt;return Ye==null?nt=null:(Ke==null&&(Ke=this.tokenMin),Ve==null&&(Ve=this.tokenMax),nt={e:Ye,pmin:Ke,pmax:Ve,origin:this.origin,line:this.line}),this.parseExprNext(nt);case 12:let Ae=this.parseExpr(),$e=this.token();$e!=W.TBkClose&&this.unexpected($e);let X=F.EArray(e,Ae),ee=e==null?0:e.pmin,j=null,le;return X==null?le=null:(ee==null&&(ee=this.tokenMin),j==null&&(j=this.tokenMax),le={e:X,pmin:ee,pmax:j,origin:this.origin,line:this.line}),this.parseExprNext(le);case 14:let Z=this.parseExpr(),Q=this.token();Q!=W.TDoubleDot&&this.unexpected(Q);let se=this.parseExpr(),ae=F.ETernary(e,Z,se),be=e==null?0:e.pmin,et=se==null?0:se.pmax;return ae==null?null:(be==null&&(be=this.tokenMin),et==null&&(et=this.tokenMax),{e:ae,pmin:be,pmax:et,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!=W.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(W.TDoubleDot)&&(s.t=this.parseType()),this.maybe(W.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!=W.TPOpen&&this.unexpected(e);let t=this.parseFunctionArgs(),i=null;if(this.allowTypes){let l=this.token();l!=W.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!=W.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:W.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(Ht.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 f=c;t.unexpected(f)}}else{let f=c;t.unexpected(f)}return Ht.CTFun(u,t.parseType())};switch(s._hx_index){case 2:let u=s.s;if(r._hx_index==15){let b=[],C=0,E=this.parseFunctionArgs();for(;C<E.length;){let P=E[C];++C;let v=P.value;if(v!=null){let I=v;if(!this.resumeErrors)throw y.thrown(new ye(we.ECustom("Default values not allowed in function types"),I.pmin,I.pmax,this.origin,this.line))}b.push(Ht.CTNamed(P.name,P.opt?Ht.CTOpt(P.t):P.t))}return h(b)}else{let b=this.parseType(),C=this.token();switch(C._hx_index){case 5:return this.parseTypeNext(Ht.CTParent(b));case 10:let E=[b];do E.push(this.parseType());while(this.maybe(W.TComma));let T=this.token();return T!=W.TPClose&&this.unexpected(T),h(E);default:let P=C;return this.unexpected(P)}}break;case 5:let c=[],f=0,_=this.parseFunctionArgs();for(;f<_.length;){let b=_[f];++f;let C=b.value;if(C!=null){let E=C;if(!this.resumeErrors)throw y.thrown(new ye(we.ECustom("Default values not allowed in function types"),E.pmin,E.pmax,this.origin,this.line))}c.push(Ht.CTNamed(b.name,b.opt?Ht.CTOpt(b.t):b.t))}return h(c);default:let d=this.parseType(),w=this.token();switch(w._hx_index){case 5:return this.parseTypeNext(Ht.CTParent(d));case 10:let b=[d];do b.push(this.parseType());while(this.maybe(W.TComma));let C=this.token();return C!=W.TPClose&&this.unexpected(C),h(b);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 f=this.getIdent(),_=this.token();_!=W.TDoubleDot&&this.unexpected(_),a.push({name:f,t:this.parseType(),meta:o}),o=null;let m=this.token();m!=W.TSemicolon&&this.unexpected(m)}else{let f=u,_=this.token();switch(_!=W.TDoubleDot&&this.unexpected(_),a.push({name:f,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(Ht.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 Ht.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==W.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(W.TOp("<"))&&!this.resumeErrors)throw y.thrown(new ye(we.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!=W.TBrOpen&&this.unexpected(o);!this.maybe(W.TBrClose);)a.push(this.parseField());return Ui.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!=W.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 T=E.s;u.push(T);break;case 3:E.s=="*"?c=!0:this.unexpected(E);break;default:this.unexpected(E)}}let f=this.token();return f!=W.TSemicolon&&this.unexpected(f),Ui.DImport(u,c);case"package":let _=this.parsePath(),m=this.token();return m!=W.TSemicolon&&this.unexpected(m),Ui.DPackage(_);case"typedef":let d=this.getIdent(),w=this.parseParams(),b=this.token();ce.enumEq(b,W.TOp("="))||this.unexpected(b);let C=this.parseType();return Ui.DTypedef({name:d,meta:e,params:w,isPrivate:i,t:C});default:this.unexpected(W.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:Pl.KFunction({args:n.args,expr:n.body,ret:n.ret})};case"inline":t.push(Ti.AInline);break;case"macro":t.push(Ti.AMacro);break;case"override":t.push(Ti.AOverride);break;case"private":t.push(Ti.APrivate);break;case"public":t.push(Ti.APublic);break;case"static":t.push(Ti.AStatic);break;case"var":let s=this.getIdent(),r=null,h=null;if(this.maybe(W.TPOpen)){r=this.getIdent();let u=this.token();u!=W.TComma&&this.unexpected(u),h=this.getIdent();let c=this.token();c!=W.TPClose&&this.unexpected(c)}let a=this.maybe(W.TDoubleDot)?this.parseType():null,o=this.maybe(W.TOp("="))?this.parseExpr():null;if(o!=null)if(this.isBlock(o))this.maybe(W.TSemicolon);else{let u=this.token();u!=W.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(W.TSemicolon);else{let c=this.token();c!=W.TSemicolon&&this.unexpected(c)}}return{name:s,meta:e,access:t,kind:Pl.KVar({get:r,set:h,type:a,expr:o})};default:this.unexpected(W.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 y.thrown(new ye(we.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 y.thrown(new ye(we.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,W.TEof;switch(e){case 0:return W.TEof;case 10:this.line++,this.tokenMin++;break;case 9:case 13:case 32:this.tokenMin++;break;case 34:case 39:return W.TConst(ai.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 W.TPOpen;case 41:return W.TPClose;case 44:return W.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),W.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,W.TConst(ai.CFloat(l/n))}break;default:return this.char=e,W.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:W.TOp("..."),min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let h=t|0;return W.TConst(h==t?ai.CInt(h):ai.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),W.TConst(ai.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,W.TConst(ai.CInt(s))}break;default:this.char=e;let r=t|0;return W.TConst(i>0?ai.CFloat(t*10/i):r==t?ai.CInt(r):ai.CFloat(t))}break;case 58:return W.TDoubleDot;case 59:return W.TSemicolon;case 61:return e=this.input.charCodeAt(this.readPos++),e==61?W.TOp("=="):e==62?W.TOp("=>"):(this.char=e,W.TOp("="));case 63:return e=this.input.charCodeAt(this.readPos++),e==46?W.TQuestionDot:(this.char=e,W.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,W.TMeta(l);l+=String.fromCodePoint(e)}}this.invalidChar(e);break;case 91:return W.TBkOpen;case 93:return W.TBkClose;case 123:return W.TBrOpen;case 125:return W.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,W.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,W.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,W.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=F.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=F.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:W.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 f=e.e;if(!this.resumeErrors)throw y.thrown(new ye(we.EInvalidPreprocessor("Can't eval "+Je[f.__enum__].__constructs__[f._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 y.thrown(new ye(we.EInvalidPreprocessor("Can't eval "+Je[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 y.thrown(new ye(we.EInvalidPreprocessor("Can't eval "+Je[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")):W.TPrepro(e);case"end":return this.preprocStack.length>0?(this.preprocStack.pop(),this.token()):W.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 W.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==W.TEof&&!this.resumeErrors)throw y.thrown(new ye(we.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 y.thrown(new ye(we.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 y.thrown(new ye(we.EUnterminatedComment,this.tokenMin,this.tokenMin,this.origin,this.line));break}}while(t!=47);return this.token()}return this.char=t,W.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}}}z["hscript.Parser"]=Xi,Xi.__name__="hscript.Parser",Object.assign(Xi.prototype,{__class__:Xi,__properties__:{get_currentPos:"get_currentPos"}});class sl{constructor(){}exprToString(e){return this.buf=new $t,this.tabs="",this.expr(e),this.buf.b}typeToString(e){return this.buf=new $t,this.tabs="",this.type(e),this.buf.b}add(e){this.buf.b+=te.string(e)}type(e){switch(e._hx_index){case 0:let t=e.path,i=e.params,l=t.join(".");if(this.buf.b+=te.string(l),i!=null){this.buf.b+="<";let d=!0,w=0;for(;w<i.length;){let b=i[w];++w,d?d=!1:this.buf.b+=", ",this.type(b)}this.buf.b+=">"}break;case 1:let n=e.args,s=e.ret,r=n,h=s;if(Ql.exists(r,function(d){if(d._hx_index==5){let w=d.n,b=d.t;return!0}else return!1})){this.buf.b+="(";let d=0;for(;d<r.length;){let w=r[d];if(++d,w._hx_index==5){let b=w.n,C=w.t;this.type(w)}else this.type(Ht.CTNamed("_",w))}this.buf.b+=")->",this.type(h)}else{let d=n,w=s;if(d.length==0)this.buf.b+="Void -> ";else{let b=0;for(;b<d.length;){let C=d[b];++b,this.type(C),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 d=a[u];++u,o?(o=!1,this.buf.b+=" "):this.buf.b+=", ",this.buf.b+=te.string(d.name+" : "),this.type(d.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 f=e.t;this.buf.b+="?",this.type(f);break;case 5:let _=e.n,m=e.t;this.buf.b+=_==null?"null":""+_,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 Ee=i.v;this.buf.b+=Ee==null?"null":""+Ee;break;case 1:let Ie=i.f;this.buf.b+=Ie==null?"null":""+Ie;break;case 2:let at=i.s;this.buf.b+='"';let tt=at.split('"').join('\\"').split(`
|
|
14
|
+
`).join("\\n").split("\r").join("\\r").split(" ").join("\\t");this.buf.b+=te.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+=te.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 Ee=0;for(;Ee<a.length;){let Ie=a[Ee];++Ee,this.buf.b+=te.string(this.tabs),this.expr(Ie),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+=te.string("."+u);break;case 6:let c=t.op,f=t.e1,_=t.e2;this.expr(f),this.buf.b+=te.string(" "+c+" "),this.expr(_);break;case 7:let m=t.op,d=t.prefix,w=t.e;d?(this.buf.b+=m==null?"null":""+m,this.expr(w)):(this.expr(w),this.buf.b+=m==null?"null":""+m);break;case 8:let b=t.e,C=t.params;if(b==null)this.expr(b);else{let Ee=b.e;switch(Ee._hx_index){case 0:let Ie=Ee.c;this.expr(b);break;case 1:let at=Ee.v;this.expr(b);break;case 5:let tt=Ee.e,wt=Ee.f;this.expr(b);break;default:this.buf.b+="(",this.expr(b),this.buf.b+=")"}}this.buf.b+="(";let E=!0,T=0;for(;T<C.length;){let Ee=C[T];++T,E?E=!1:this.buf.b+=", ",this.expr(Ee)}this.buf.b+=")";break;case 9:let P=t.cond,v=t.e1,I=t.e2;this.buf.b+="if( ",this.expr(P),this.buf.b+=" ) ",this.expr(v),I!=null&&(this.buf.b+=" else ",this.expr(I));break;case 10:let O=t.cond,L=t.e;this.buf.b+="while( ",this.expr(O),this.buf.b+=" ) ",this.expr(L);break;case 11:let B=t.v,A=t.it,K=t.e;this.buf.b+=te.string("for( "+B+" in "),this.expr(A),this.buf.b+=" ) ",this.expr(K);break;case 12:this.buf.b+="break";break;case 13:this.buf.b+="continue";break;case 14:let D=t.args,M=t.e,V=t.name,N=t.ret;this.buf.b+="function",V!=null&&(this.buf.b+=te.string(" "+V)),this.buf.b+="(";let U=!0,q=0;for(;q<D.length;){let Ee=D[q];++q,U?U=!1:this.buf.b+=", ",Ee.opt&&(this.buf.b+="?"),this.buf.b+=te.string(Ee.name),this.addType(Ee.t)}this.buf.b+=")",this.addType(N),this.buf.b+=" ",this.expr(M);break;case 15:let J=t.e;this.buf.b+="return",J!=null&&(this.buf.b+=" ",this.expr(J));break;case 16:let G=t.e,H=t.index;this.expr(G),this.buf.b+="[",this.expr(H),this.buf.b+="]";break;case 17:let re=t.e;this.buf.b+="[";let _e=!0,ue=0;for(;ue<re.length;){let Ee=re[ue];++ue,_e?_e=!1:this.buf.b+=", ",this.expr(Ee)}this.buf.b+="]";break;case 18:let de=t.cl,fe=t.params;this.buf.b+=te.string("new "+de+"(");let ge=!0,Ne=0;for(;Ne<fe.length;){let Ee=fe[Ne];++Ne,ge?ge=!1:this.buf.b+=", ",this.expr(Ee)}this.buf.b+=")";break;case 19:let Fe=t.e;this.buf.b+="throw ",this.expr(Fe);break;case 20:let Re=t.e,Ye=t.v,Ke=t.t,Ve=t.ecatch;this.buf.b+="try ",this.expr(Re),this.buf.b+=te.string(" catch( "+Ye),this.addType(Ke),this.buf.b+=") ",this.expr(Ve);break;case 21:let nt=t.fl;if(nt.length==0)this.buf.b+="{}";else{this.tabs+=" ",this.buf.b+=`{
|
|
17
|
+
`;let Ee=0;for(;Ee<nt.length;){let Ie=nt[Ee];++Ee,this.buf.b+=te.string(this.tabs),this.buf.b+=te.string(Ie.name+" : "),this.expr(Ie.e),this.buf.b+=`,
|
|
18
|
+
`}this.tabs=p.substr(this.tabs,1,null),this.buf.b+="}"}break;case 22:let Ae=t.cond,$e=t.e1,X=t.e2;this.expr(Ae),this.buf.b+=" ? ",this.expr($e),this.buf.b+=" : ",this.expr(X);break;case 23:let ee=t.e,j=t.cases,le=t.defaultExpr;this.buf.b+="switch( ",this.expr(ee),this.buf.b+=") {";let Z=0;for(;Z<j.length;){let Ee=j[Z];++Z,this.buf.b+="case ";let Ie=!0,at=0,tt=Ee.values;for(;at<tt.length;){let wt=tt[at];++at,Ie?Ie=!1:this.buf.b+=", ",this.expr(wt)}this.buf.b+=": ",this.expr(Ee.expr),this.buf.b+=`;
|
|
19
|
+
`}le!=null&&(this.buf.b+="default: ",this.expr(le),this.buf.b+=`;
|
|
20
|
+
`),this.buf.b+="}";break;case 24:let Q=t.cond,se=t.e;this.buf.b+="do ",this.expr(se),this.buf.b+=" while ( ",this.expr(Q),this.buf.b+=" )";break;case 25:let ae=t.name,be=t.args,et=t.e;if(this.buf.b+="@",this.buf.b+=ae==null?"null":""+ae,be!=null&&be.length>0){this.buf.b+="(";let Ee=!0,Ie=0;for(;Ie<be.length;){let at=be[Ie];++Ie,Ee?Ee=!1:this.buf.b+=", ",this.expr(et)}this.buf.b+=")"}this.buf.b+=" ",this.expr(et);break;case 26:let Oe=t.e,_t=t.t;this.buf.b+="(",this.expr(Oe),this.buf.b+=" : ",this.addType(_t),this.buf.b+=")";break}}static toString(e){return new sl().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}}z["hscript.Printer"]=sl,sl.__name__="hscript.Printer",Object.assign(sl.prototype,{__class__:sl});class $l{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 Oe=o[u];++u,t(Oe)}break;case 5:let c=i.f,f=i.e;t(f);break;case 6:let _=i.op,m=i.e1,d=i.e2;t(m),t(d);break;case 7:let w=i.op,b=i.prefix,C=i.e;t(C);break;case 8:let E=i.e,T=i.params;t(E);let P=0;for(;P<T.length;){let Oe=T[P];++P,t(Oe)}break;case 9:let v=i.cond,I=i.e1,O=i.e2;t(v),t(I),O!=null&&t(O);break;case 10:let L=i.cond,B=i.e;t(L),t(B);break;case 11:let A=i.v,K=i.it,D=i.e;t(K),t(D);break;case 12:case 13:break;case 14:let M=i.args,V=i.name,N=i.ret,U=i.e;t(U);break;case 15:let q=i.e;q!=null&&t(q);break;case 16:let J=i.e,G=i.index;t(J),t(G);break;case 17:let H=i.e,re=0;for(;re<H.length;){let Oe=H[re];++re,t(Oe)}break;case 18:let _e=i.cl,ue=i.params,de=0;for(;de<ue.length;){let Oe=ue[de];++de,t(Oe)}break;case 19:let fe=i.e;t(fe);break;case 20:let ge=i.v,Ne=i.t,Fe=i.e,Re=i.ecatch;t(Fe),t(Re);break;case 21:let Ye=i.fl,Ke=0;for(;Ke<Ye.length;){let Oe=Ye[Ke];++Ke,t(Oe.e)}break;case 22:let Ve=i.cond,nt=i.e1,Ae=i.e2;t(Ve),t(nt),t(Ae);break;case 23:let $e=i.e,X=i.cases,ee=i.defaultExpr;t($e);let j=0;for(;j<X.length;){let Oe=X[j];++j;let _t=0,Ee=Oe.values;for(;_t<Ee.length;){let Ie=Ee[_t];++_t,t(Ie)}t(Oe.expr)}ee!=null&&t(ee);break;case 24:let le=i.cond,Z=i.e;t(le),t(Z);break;case 25:let Q=i.name,se=i.args,ae=i.e;if(se!=null){let Oe=0;for(;Oe<se.length;){let _t=se[Oe];++Oe,t(_t)}}t(ae);break;case 26:let be=i.t,et=i.e;t(et);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=F.EVar(r,h,a!=null?t(a):null);break;case 3:let o=l.e;i=F.EParent(t(o));break;case 4:let u=l.e,c=[],f=0;for(;f<u.length;){let He=u[f];++f,c.push(t(He))}i=F.EBlock(c);break;case 5:let _=l.e,m=l.f;i=F.EField(t(_),m);break;case 6:let d=l.op,w=l.e1,b=l.e2;i=F.EBinop(d,t(w),t(b));break;case 7:let C=l.op,E=l.prefix,T=l.e;i=F.EUnop(C,E,t(T));break;case 8:let P=l.e,v=l.params,I=t(P),O=[],L=0;for(;L<v.length;){let He=v[L];++L,O.push(t(He))}i=F.ECall(I,O);break;case 9:let B=l.cond,A=l.e1,K=l.e2;i=F.EIf(t(B),t(A),K!=null?t(K):null);break;case 10:let D=l.cond,M=l.e;i=F.EWhile(t(D),t(M));break;case 11:let V=l.v,N=l.it,U=l.e;i=F.EFor(V,t(N),t(U));break;case 12:case 13:i=e.e;break;case 14:let q=l.args,J=l.e,G=l.name,H=l.ret;i=F.EFunction(q,t(J),G,H);break;case 15:let re=l.e;i=F.EReturn(re!=null?t(re):null);break;case 16:let _e=l.e,ue=l.index;i=F.EArray(t(_e),t(ue));break;case 17:let de=l.e,fe=[],ge=0;for(;ge<de.length;){let He=de[ge];++ge,fe.push(t(He))}i=F.EArrayDecl(fe);break;case 18:let Ne=l.cl,Fe=l.params,Re=[],Ye=0;for(;Ye<Fe.length;){let He=Fe[Ye];++Ye,Re.push(t(He))}i=F.ENew(Ne,Re);break;case 19:let Ke=l.e;i=F.EThrow(t(Ke));break;case 20:let Ve=l.e,nt=l.v,Ae=l.t,$e=l.ecatch;i=F.ETry(t(Ve),nt,Ae,t($e));break;case 21:let X=l.fl,ee=[],j=0;for(;j<X.length;){let He=X[j];++j,ee.push({name:He.name,e:t(He.e)})}i=F.EObject(ee);break;case 22:let le=l.cond,Z=l.e1,Q=l.e2;i=F.ETernary(t(le),t(Z),t(Q));break;case 23:let se=l.e,ae=l.cases,be=l.defaultExpr,et=t(se),Oe=[],_t=0;for(;_t<ae.length;){let He=ae[_t];++_t;let Mt=[],vt=0,Lt=He.values;for(;vt<Lt.length;){let mt=Lt[vt];++vt,Mt.push(t(mt))}Oe.push({values:Mt,expr:t(He.expr)})}i=F.ESwitch(et,Oe,be==null?null:t(be));break;case 24:let Ee=l.cond,Ie=l.e;i=F.EDoWhile(t(Ee),t(Ie));break;case 25:let at=l.name,tt=l.args,wt=l.e,Ut;if(tt==null)Ut=null;else{let He=[],Mt=0;for(;Mt<tt.length;){let vt=tt[Mt];++Mt,He.push(t(vt))}Ut=He}i=F.EMeta(at,Ut,t(wt));break;case 26:let ft=l.e,ei=l.t;i=F.ECheckType(t(ft),ei);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}}}z["hscript.Tools"]=$l,$l.__name__="hscript.Tools";class Y{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=Y.__nativeClassName(e);return i!=null?Y.__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=Je[e.__enum__].__constructs__[e._hx_index],o=a._hx_name;return a.__params__?(t=t+" ",o+"("+(function(u){var c;let f=[];{let _=0,m=a.__params__;for(;_<m.length;){let d=m[_];_=_+1,f.push(Y.__string_rec(e[d],t))}}return c=f,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?",":"")+Y.__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=`{
|
|
21
|
+
`;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
|
+
`),n+=t+r+" : "+Y.__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 i=e.__interfaces__;if(i!=null&&(e.__super__==null||e.__super__.__interfaces__!=i)){let l=0,n=i.length;for(;l<n;){let s=l++,r=i[s];if(r==t||Y.__interfLoop(r,t))return!0}}return Y.__interfLoop(e.__super__,t)}static __instanceof(e,t){if(t==null)return!1;switch(t){case Array:return e instanceof Array;case gn:return typeof e=="boolean";case fn:return e!=null;case mn:return typeof e=="number";case _n:return typeof e=="number"?(e|0)===e:!1;case String:return typeof e=="string";default:if(e!=null){if(typeof t=="function"){if(Y.__downcastCheck(e,t))return!0}else if(typeof t=="object"&&Y.__isNativeObj(t)&&e instanceof t)return!0}else return!1;return t==dn&&e.__name__!=null||t==xn&&e.__ename__!=null?!0:e.__enum__!=null?Je[e.__enum__]==t:!1}}static __downcastCheck(e,t){return e instanceof t?!0:t.__isInterface__?Y.__interfLoop(Y.getClass(e),t):!1}static __implements(e,t){return Y.__interfLoop(Y.getClass(e),t)}static __cast(e,t){if(e==null||Y.__instanceof(e,t))return e;throw y.thrown("Cannot cast "+te.string(e)+" to "+te.string(t))}static __nativeClassName(e){let t=Y.__toStr.call(e).slice(8,-1);return t=="Object"||t=="Function"||t=="Math"||t=="JSON"?null:t}static __isNativeObj(e){return Y.__nativeClassName(e)!=null}static __resolveNativeClass(e){return Gl[e]}}z["js.Boot"]=Y,Y.__name__="js.Boot";class ie{static isArray(e){return e instanceof Array}static arrayLength(e){return e.length}static arrayGet(e,t){let i=t|0,l=e;return i>=0&&i<l.length?l[i]:null}static arraySet(e,t,i){let l=t|0,n=e;n[l]=i}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,i){e.splice(t,0,i)}static arrayRemoveAt(e,t){e.splice(t,1)}static getIterator(e){return new bi(e)}static arrayCopy(e){let t=ie.arrayLength(e),i=ie.createArray(),l=0,n=t;for(;l<n;){let s=l++;ie.arrayPush(i,ie.arrayGet(e,s))}return i}static arraySort(e,t){let i=ie.arrayLength(e),l=1,n=i;for(;l<n;){let s=l++,r=ie.arrayGet(e,s),h=s-1;for(;h>=0&&t(ie.arrayGet(e,h),r)>0;)ie.arraySet(e,h+1,ie.arrayGet(e,h)),--h;ie.arraySet(e,h+1,r)}}static arrayReverse(e){let t=0,i=ie.arrayLength(e)-1;for(;t<i;){let l=ie.arrayGet(e,t);ie.arraySet(e,t,ie.arrayGet(e,i)),ie.arraySet(e,i,l),++t,--i}}static arrayJoin(e,t){let i=ie.arrayLength(e),l="",n=0,s=i;for(;n<s;){let r=n++;r>0&&(l+=t==null?"null":""+t),l+=te.string(ie.arrayGet(e,r)==null?"null":te.string(ie.arrayGet(e,r)))}return l}}z["loreline.Arrays"]=ie,ie.__name__="loreline.Arrays";class Ot{static addQuotes(e){e.each(function(t,i){if(t instanceof Et){let l=t;if(l.quotes==0){l.quotes=1;let n=0,s=l.parts.length;for(;n<s;){let r=n++,h=l.parts[r].partType;if(h._hx_index==0){let a=h.text,o=Ot.unquotedRawToQuotedRaw(a);l.parts[r].partType=ze.Raw(o)}}}}})}static removeQuotes(e){e.each(function(t,i){if(t instanceof Et){let l=t;if(l.quotes==1){let n="",s=0,r=l.parts;for(;s<r.length;){let h=r[s];++s;let a=h.partType;if(a._hx_index==0){let o=a.text;n+=o}}if(Ot.canSafelyRemoveQuotes(n)){l.quotes=0;let h=0,a=l.parts.length;for(;h<a;){let o=h++,u=l.parts[o].partType;if(u._hx_index==0){let c=u.text,f=Ot.quotedRawToUnquotedRaw(c);l.parts[o].partType=ze.Raw(f)}}}}}})}static toBraceStyle(e){e.each(function(t,i){if(t instanceof Jt)Y.__cast(t,Jt).style=1;else if(t instanceof Gt)Y.__cast(t,Gt).style=1;else if(t instanceof We)Y.__cast(t,We).style=1;else if(t instanceof fi)Y.__cast(t,fi).style=1;else if(t instanceof St)Y.__cast(t,St).style=1;else if(t instanceof mi)Y.__cast(t,mi).style=1;else if(t instanceof qe){let l=t,n=l.literalType;if(n._hx_index==4){let s=n.style;l.literalType=Qe.Object(1)}}})}static toPlainStyle(e){e.each(function(t,i){if(t instanceof Jt)Y.__cast(t,Jt).style=0;else if(t instanceof Gt)Y.__cast(t,Gt).style=0;else if(t instanceof We)Y.__cast(t,We).style=0;else if(t instanceof fi)Y.__cast(t,fi).style=0;else if(t instanceof St)Y.__cast(t,St).style=0;else if(t instanceof mi)Y.__cast(t,mi).style=0;else if(t instanceof qe){let l=t,n=l.literalType;if(n._hx_index==4){let s=n.style;l.literalType=Qe.Object(0)}}})}static useWordOperators(e){e.each(function(t,i){if(t instanceof Xt){let l=t,n=l.op;switch(n._hx_index){case 36:let s=n.word;l.op=x.OpAnd(!0);break;case 37:let r=n.word;l.op=x.OpOr(!0);break;default:}}})}static useSymbolOperators(e){e.each(function(t,i){if(t instanceof Xt){let l=t,n=l.op;switch(n._hx_index){case 36:let s=n.word;l.op=x.OpAnd(!1);break;case 37:let r=n.word;l.op=x.OpOr(!1);break;default:}}})}static useParenConditions(e){e.each(function(t,i){t instanceof gi?Y.__cast(t,gi).conditionStyle=2:t instanceof St&&(Y.__cast(t,St).conditionStyle=2)})}static usePlainConditions(e){e.each(function(t,i){t instanceof gi?Y.__cast(t,gi).conditionStyle=0:t instanceof St&&(Y.__cast(t,St).conditionStyle=0)})}static reindentFunctions(e,t,i){e.each(function(l,n){if(l instanceof ji){let s=l;s.code!=null&&s.code.length>0&&!s.external&&(s.code=Ot.reindentCode(s.code,t,i))}})}static insertLocalizationKeys(e,t){let i=new ol,l=e.split(`
|
|
24
|
+
`),n=Object.create(null);t.each(function(a,o){if(a instanceof Le){let u=a;if(u.trailingComments!=null){let c=0,f=u.trailingComments;for(;c<f.length;){let _=f[c];if(++c,_.isHash){let m=Be.trim(_.content);n[m]=!0}}}if(u.leadingComments!=null){let c=0,f=u.leadingComments;for(;c<f.length;){let _=f[c];if(++c,_.isHash){let m=Be.trim(_.content);n[m]=!0}}}}});let s=[];if(t.each(function(a,o){let u=null;if(a instanceof oi?u=Y.__cast(a,oi).content:a instanceof hi?u=Y.__cast(a,hi).content:a instanceof St&&(u=Y.__cast(a,St).text),u!=null){let f=Ot.getStringEndLine(u)-1;if(f>=0&&f<l.length&&Ot.lineHasHashComment(l[f]))return;let _,m=0;do _=Ot.randomId(i,4+(m*.01|0)),++m;while(Object.prototype.hasOwnProperty.call(n,_));n[_]=!0,s.push({offset:u.pos.offset+u.pos.length,text:" #"+_})}}),s.length==0)return e;s.sort(function(a,o){return o.offset-a.offset});let r=e,h=0;for(;h<s.length;){let a=s[h];++h;let o=a.offset,u=a.offset,c=null;r=(o!=null?p.substr(r,0,o):p.substr(r,0,null))+a.text+(c!=null?p.substr(r,u,c):p.substr(r,u,null))}return r}static removeLocalizationKeys(e,t){let i=[];if(t.each(function(s,r){if(s instanceof Le){let h=s,a=h.trailingComments;if(a!=null){let u=0;for(;u<a.length;){let c=a[u];if(++u,c.isHash){let f=c.pos.offset,_=c.pos.offset+c.pos.length;for(;f>0;){let m=p.cca(e,f-1),d=m??-1;if(d==32||d==9)--f;else break}i.push({start:f,end:_})}}}let o=h.leadingComments;if(o!=null){let u=0;for(;u<o.length;){let c=o[u];if(++u,c.isHash){let f=c.pos.offset,_=c.pos.offset+c.pos.length;for(;f>0;){let m=p.cca(e,f-1),d=m??-1;if(d==32||d==9)--f;else break}i.push({start:f,end:_})}}}}}),i.length==0)return e;i.sort(function(s,r){return r.start-s.start});let l=e,n=0;for(;n<i.length;){let s=i[n];++n;let r=s.start,h=s.end,a=null;l=(r!=null?p.substr(l,0,r):p.substr(l,0,null))+(a!=null?p.substr(l,h,a):p.substr(l,h,null))}return l}static lineHasHashComment(e){let t=0;for(;t<e.length;){if(p.cca(e,t)==35){if(t+1<e.length&&p.cca(e,t+1)==35){t+=2;continue}if(t>0&&p.cca(e,t-1)==92){++t;continue}let i=t+1;for(;i<e.length;){let l=p.cca(e,i);if(l>=97&&l<=122||l>=65&&l<=90||l>=48&&l<=57||l==95||l==45)++i;else break}if(i>t+1)return!0}++t}return!1}static extractTranslations(e){let t=new Se;return e.each(function(i,l){let n=null,s=null;if(i instanceof oi?(s=i,n=Y.__cast(i,oi).content):i instanceof hi&&(s=i,n=Y.__cast(i,hi).content),n!=null&&s!=null){let r=Ot.findHashComment(s,n);r!=null&&(t.h[r]=n)}}),t}static extractTranslatableEntries(e){let t=[];return e.each(function(i,l){let n=null,s=null;if(i instanceof oi)n=i,s=Y.__cast(i,oi).content;else if(i instanceof hi)n=i,s=Y.__cast(i,hi).content;else if(i instanceof St){let r=i;r.text!=null&&(n=i,s=r.text)}if(s!=null&&n!=null){let r=Ot.findHashComment(n,s);r!=null&&t.push({id:r,str:s})}}),t}static generateTranslationFile(e,t,i){let l=Ot.extractTranslatableEntries(e),n="",s=!0;n+=`
|
|
25
|
+
`;let r=0;for(;r<l.length;){let h=l[r];++r,s||(n+=`
|
|
26
|
+
`),s=!1;let a=i.printStringLiteralAsReference(h.str),o=i.printStringLiteralAsText(h.str);n+="#",n+=te.string(h.id),n+=" // ",n+=a==null?"null":""+a,n+=`
|
|
27
|
+
`,t!=null&&Object.prototype.hasOwnProperty.call(t.h,h.id)?n+=te.string(i.printStringLiteralAsText(t.h[h.id])):n+=o==null?"null":""+o,n+=`
|
|
28
|
+
`}return n}static unquotedRawToQuotedRaw(e){let t="",i=0;for(;i<e.length;){let l=p.cca(e,i);if(l==92&&i+1<e.length){let n=p.cca(e,i+1);n==110||n==116||n==114||n==92||n==60?(t+=String.fromCodePoint(l),t+=String.fromCodePoint(n),i+=2):(t+=String.fromCodePoint(n),i+=2)}else l==34?(t+='\\"',++i):(t+=String.fromCodePoint(l),++i)}return t}static quotedRawToUnquotedRaw(e){let t="",i=0;for(;i<e.length;){let l=p.cca(e,i);if(l==92&&i+1<e.length){let n=p.cca(e,i+1);n==34?(t+=String.fromCodePoint(n),i+=2):(t+=String.fromCodePoint(l),t+=String.fromCodePoint(n),i+=2)}else t+=String.fromCodePoint(l),++i}return t}static canSafelyRemoveQuotes(e){if(e.length==0||e.indexOf(`
|
|
29
|
+
`)!=-1||e.indexOf("{")!=-1)return!1;let t=p.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=p.cca(e,1);if(s==47||s==42)return!1}if(e.length>=2&&t==45&&p.cca(e,1)==62||t==43&&e.length>=3&&p.cca(e,1)==32)return!1;let i=["beat ","state ","character ","choice ","import ","new ","function ","if ","else "],l=0;for(;l<i.length;){let s=i[l];if(++l,e.startsWith(s))return!1}let n=e.indexOf(":");if(n>0){let s=!0,r=0,h=n;for(;r<h;){let a=r++,o=p.cca(e,a);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"||Ot.isNumberLiteral(e)||e.length>=2&&p.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(p.cca(e,0)==45&&++t,t>=e.length)return!1;let i=!1,l=!1;for(;t<e.length;){let n=p.cca(e,t);if(n>=48&&n<=57)i=!0;else if(n==46&&!l)l=!0;else return!1;++t}return i}static reindentCode(e,t,i){if(t==i)return e;let l=e.split(`
|
|
30
|
+
`),n="",s=0,r=l.length;for(;s<r;){let h=s++;h>0&&(n+=`
|
|
31
|
+
`);let a=l[h],o=0,u=0;for(;p.substr(a,u,null).startsWith(t);)++o,u+=t.length;let c=0,f=o;for(;c<f;){let _=c++;n+=i==null?"null":""+i}n+=te.string(p.substr(a,u,null))}return n}static getStringEndLine(e){let t=e.pos.line,i=0,l=e.parts;for(;i<l.length;){let n=l[i];if(++i,n.pos!=null){let s=n.pos.line,r=n.partType;if(r._hx_index==0){let h=r.text,a=0;for(;a<h.length;)p.cca(h,a)==10&&++s,++a}s>t&&(t=s)}}return t}static findHashComment(e,t){if(e.trailingComments!=null){let i=0,l=e.trailingComments;for(;i<l.length;){let n=l[i];if(++i,n.isHash)return Be.trim(n.content)}}if(e.leadingComments!=null){let i=0,l=e.leadingComments;for(;i<l.length;){let n=l[i];if(++i,n.isHash)return Be.trim(n.content)}}if(t!=null){if(t.trailingComments!=null){let i=0,l=t.trailingComments;for(;i<l.length;){let n=l[i];if(++i,n.isHash)return Be.trim(n.content)}}if(t.leadingComments!=null){let i=0,l=t.leadingComments;for(;i<l.length;){let n=l[i];if(++i,n.isHash)return Be.trim(n.content)}}}return null}static randomId(e,t){let i="",l=0,n=t;for(;l<n;){let o=l++,u=p.cca(Ot.randomId_chars,Math.floor(36*((e.seed=e.seed*16807%2147483647)/2147483647+233e-12)));i+=String.fromCodePoint(u)}let s=i,r=!0,h=0,a=s.length;for(;h<a;){let o=h++,u=p.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=p.cca(Ot.randomId_nonHexChars,Math.floor(Ot.randomId_nonHexChars.length*((e.seed=e.seed*16807%2147483647)/2147483647+233e-12)));s=p.substr(s,0,o)+String.fromCodePoint(u)+p.substr(s,o+1,null)}return s}}z["loreline.AstUtils"]=Gi.loreline.AstUtils=Ot,Ot.__name__="loreline.AstUtils";class Zi{constructor(e){this.func=e}}z["loreline.Async"]=Zi,Zi.__name__="loreline.Async",Object.assign(Zi.prototype,{__class__:Zi});class rl{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 qi{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=Be.rtrim(e)+`
|
|
32
|
+
//<END>`,this.input=e,this.index=0,this.output=new $t,this.lineOutput=new $t,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(),Be.rtrim(this.output.b)+`
|
|
33
|
+
`}toLorelinePos(e,t,i){let l=this.inputPosFromProcessedPos(t),s=this.inputPosFromProcessedPos(i)+1-l;return e.withOffset(this.input,l,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,i=0,l=this.posOffsets.length;for(;i<l;){let n=i++;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,i=0,l=0;for(;this.index<this.length;){let n=p.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=p.cca(this.input,this.index+1),h=r??-1;h==47||h==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)++i,this._add(s,!0);else if(s==93){if(--i,s==e&&i<0)return;this._add(s,!0)}else if(s==40)++l,this._add(s,!0);else if(s==41){if(--l,s==e&&l<0)return;this._add(s,!0)}else{let r;if(this.isAlphaNumeric(s)&&this.index>0){let h=p.cca(this.input,this.index-1);r=!this.isAlphaNumeric(h??-1)}else r=!1;if(r)if(s==97){let h,a,o=p.cca(this.input,this.index+1);if((o??-1)==110){let u=p.cca(this.input,this.index+2);a=(u??-1)==100}else a=!1;if(a){let u=p.cca(this.input,this.index+3);h=!this.isAlphaNumeric(u??-1)}else h=!1;h?(this._add(38,!0),this._add(38,!0),this._add(32,!0)):this._add(s,!0)}else if(s==111){let h,a=p.cca(this.input,this.index+1);if((a??-1)==114){let o=p.cca(this.input,this.index+2);h=!this.isAlphaNumeric(o??-1)}else h=!1;h?(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=p.cca(this.input,this.index),i=t??-1;if(e)this._add(i,!0),e=!1;else if(i==92)e=!0,this._add(92,!0);else if(i==34){this._add(i,!0),this.inString=!1;return}else if(i==36&&!e){this.index++;let l=p.cca(this.input,this.index);i=l??-1,i==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++):i>=97&&i<=122||i>=65&&i<=90||i==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++):i==36?this._add(36,!0):this.error("Expected identifier or { after $")}else this._add(i,!0)}this.error("Unterminated string")}processComplexInterpolation(){this.processInput(125)}processFieldAccessInterpolation(){let e=p.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 i=p.cca(this.input,this.index);switch(i??-1){case 40:this._add(40,!0),this.processInput(41),this._add(41,!0);break;case 46:let l;if(this.index+1<this.length){let n=p.cca(this.input,this.index+1),s=n??-1;l=s>=97&&s<=122||s>=65&&s<=90||s==95}else l=!1;if(l)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=p.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=p.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 i=p.cca(this.input,this.index),l=i??-1;if(l==13||l==10)break;this._add(32,!0)}else if(t==42)for(this._add(32,!0),this._add(32,!0);this.index<this.length;){let i=p.cca(this.input,this.index),l=i??-1,n;if(l==42&&this.index+1<this.length){let s=p.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 l==13||l==10?this._add(l,!0):this._add(32,!0)}this.inComment=!1}endsWithChar(e,t){if(e.length==0)return!1;let i=Be.rtrim(e),l=i.length,n;if(l>0){let s=p.cca(i,l-1);n=(s??-1)==t}else n=!1;return n}followsWithChar(e,t){let i=t,l=!1;for(;i<this.length;){let n=p.cca(this.input,i),s=n??-1;if(s==32||s==9||s==10||s==13){++i;continue}if(s==47&&i+1<this.length){let r=p.cca(this.input,i+1),h=r??-1;if(h==47){for(i+=2;;){let a,o;if(i<this.length){let u=p.cca(this.input,i);o=(u??-1)!=13}else o=!1;if(o){let u=p.cca(this.input,i);a=(u??-1)!=10}else a=!1;if(!a)break;++i}i<this.length&&++i;continue}if(h==42){for(i+=2;i+1<this.length;){let a,o=p.cca(this.input,i);if((o??-1)==42){let u=p.cca(this.input,i+1);a=(u??-1)==47}else a=!1;if(a){i+=2;break}++i}continue}}l=s==e;break}return l}endsOrFollowsWithChar(e,t,i,l){return this.endsWithChar(e,t)?!0:this.followsWithChar(t,i)}nextLineIndentOffset(e,t){let i=Be.ltrim(e);if(i.length==0)return 0;let l=e.length-i.length,n=-1;for(;t<this.length;){let s=this.input.indexOf(`
|
|
34
|
+
`,t);s==-1&&(s=this.length);let r=this.input,h=s!=null?r.substring(t,s):r.substring(t),a=Be.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=Be.rtrim(e);if(i.length==0)return!1;let l=0,n=qi.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 $t,this.inStatementsBlock()||this.inObjectBlock()||this.inArrayBlock()){let l=this.nextLineIndentOffset(i,this.index);if(Be.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=Be.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 y.thrown(new si(e,ne.fromContentAndIndex(this.input,this.index)))}}z["loreline.CodeToHscript"]=qi,qi.__name__="loreline.CodeToHscript",Object.assign(qi.prototype,{__class__:qi});class Ci{static equal(e,t,i){return t==i?!0:ie.isArray(t)?ie.isArray(i)?Ci.arrayEqual(e,t,i):!1:t instanceof Se?i instanceof Se?Ci.stringMapEqual(e,t,i):!1:t instanceof Bi?i instanceof Bi?Ci.intMapEqual(e,t,i):!1:oe.isFields(t)&&oe.isFields(i)?Ci.objectFieldsEqual(e,t,i):!1}static objectFieldsEqual(e,t,i){let l=0,n=oe.getFields(e,t);for(;l<n.length;){let h=n[l];if(++l,!oe.fieldExists(e,i,h)||!Ci.equal(e,oe.getField(e,t,h),oe.getField(e,i,h)))return!1}let s=0,r=oe.getFields(e,i);for(;s<r.length;){let h=r[s];if(++s,!oe.fieldExists(e,t,h))return!1}return!0}static arrayEqual(e,t,i){let l=ie.arrayLength(t),n=ie.arrayLength(i);if(l!=n)return!1;let s=0,r=l;for(;s<r;){let h=s++;if(!Ci.equal(e,ie.arrayGet(t,h),ie.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 _=s[h++],m=_,d=n[_],w=m,b=d;if(!Object.prototype.hasOwnProperty.call(i.h,w)||!Ci.equal(e,i.h[w],b))return!1}let a=i.h,o=a,u=Object.keys(a),c=u.length,f=0;for(;f<c;){let _=u[f++];if(!Object.prototype.hasOwnProperty.call(t.h,_))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)||!Ci.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}}z["loreline.Equal"]=Ci,Ci.__name__="loreline.Equal";class si{constructor(e,t){this.message=e,this.pos=t,this.stack=cn.callStack()}toString(){return this.pos!=null?""+this.message+" at "+this.pos.toString():this.message}}z["loreline.Error"]=si,si.__name__="loreline.Error",Object.assign(si.prototype,{__class__:si});class Ei{}z["loreline.Fields"]=Gi.loreline.Fields=Ei,Ei.__name__="loreline.Fields",Ei.__isInterface__=!0,Object.assign(Ei.prototype,{__class__:Ei});class Ol{constructor(e){this._random=null,this.interpreter=e}bindAll(e){e.h.floor=Ce(this,this.floor),e.h.ceil=Ce(this,this.ceil),e.h.round=Ce(this,this.round),e.h.abs=Ce(this,this.abs),e.h.min=Ce(this,this.min),e.h.max=Ce(this,this.max),e.h.clamp=Ce(this,this.clamp),e.h.pow=Ce(this,this.pow),e.h.random=Ce(this,this.random),e.h.chance=Ce(this,this.chance),e.h.seed_random=Ce(this,this.seed_random),e.h.random_float=Ce(this,this.random_float),e.h.wait=Ce(this,this.wait),e.h.float=Ce(this,this.float_),e.h.string=Ce(this,this.string_),e.h.bool=Ce(this,this.bool),e.h.string_length=Ce(this,this.string_length),e.h.string_upper=Ce(this,this.string_upper),e.h.string_lower=Ce(this,this.string_lower),e.h.string_contains=Ce(this,this.string_contains),e.h.string_replace=Ce(this,this.string_replace),e.h.string_split=Ce(this,this.string_split),e.h.string_trim=Ce(this,this.string_trim),e.h.string_index=Ce(this,this.string_index),e.h.string_sub=Ce(this,this.string_sub),e.h.string_starts=Ce(this,this.string_starts),e.h.string_ends=Ce(this,this.string_ends),e.h.string_repeat=Ce(this,this.string_repeat),e.h.plural=Ce(this,this.plural),e.h.array_length=Ce(this,this.array_length),e.h.array_add=Ce(this,this.array_add),e.h.array_pop=Ce(this,this.array_pop),e.h.array_prepend=Ce(this,this.array_prepend),e.h.array_shift=Ce(this,this.array_shift),e.h.array_remove=Ce(this,this.array_remove),e.h.array_index=Ce(this,this.array_index),e.h.array_has=Ce(this,this.array_has),e.h.array_sort=Ce(this,this.array_sort),e.h.array_reverse=Ce(this,this.array_reverse),e.h.array_join=Ce(this,this.array_join),e.h.array_pick=Ce(this,this.array_pick),e.h.array_shuffle=Ce(this,this.array_shuffle),e.h.array_copy=Ce(this,this.array_copy),e.h.map_length=Ce(this,this.map_length),e.h.map_keys=Ce(this,this.map_keys),e.h.map_has=Ce(this,this.map_has),e.h.map_get=Ce(this,this.map_get),e.h.map_set=Ce(this,this.map_set),e.h.map_remove=Ce(this,this.map_remove),e.h.map_copy=Ce(this,this.map_copy),e.h.current_beat=Ce(this,this.current_beat),e.h.has_beat=Ce(this,this.has_beat)}rng(){this._random==null&&(this._random=new ol);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 ol(e),null}random_float(e,t){return e+this.rng()*(t-e)}wait(e){return new Zi(function(t){t()})}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":te.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 Be.replace(e,t,i)}string_split(e,t){return e.split(t)}string_trim(e){return Be.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 ie.isArray(e)?ie.arrayLength(e):0}array_add(e,t){return ie.arrayPush(e,t),null}array_pop(e){return ie.isArray(e)?ie.arrayPop(e):null}array_prepend(e,t){return ie.isArray(e)&&ie.arrayInsert(e,0,t),null}array_shift(e){return ie.isArray(e)?ie.arrayShift(e):null}array_remove(e,t){if(ie.isArray(e)){let i=ie.arrayLength(e),l=0,n=i;for(;l<n;){let s=l++;if(ie.arrayGet(e,s)==t)return ie.arrayRemoveAt(e,s),!0}}return!1}array_index(e,t){if(ie.isArray(e)){let i=ie.arrayLength(e),l=0,n=i;for(;l<n;){let s=l++;if(ie.arrayGet(e,s)==t)return s}}return-1}array_has(e,t){if(ie.isArray(e)){let i=ie.arrayLength(e),l=0,n=i;for(;l<n;){let s=l++;if(ie.arrayGet(e,s)==t)return!0}}return!1}array_sort(e){return ie.isArray(e)&&ie.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":te.string(t))<(i==null?"null":te.string(i))?-1:(t==null?"null":te.string(t))>(i==null?"null":te.string(i))?1:0}),e}array_reverse(e){return ie.isArray(e)&&ie.arrayReverse(e),e}array_join(e,t){return ie.isArray(e)?ie.arrayJoin(e,t):""}array_pick(e){if(ie.isArray(e)){let t=ie.arrayLength(e);if(t==0)return null;let i=Math.floor(this.rng()*t);return ie.arrayGet(e,i)}return null}array_shuffle(e){if(ie.isArray(e)){let t=ie.arrayLength(e)-1;for(;t>0;){let i=Math.floor(this.rng()*(t+1)),l=ie.arrayGet(e,t);ie.arraySet(e,t,ie.arrayGet(e,i)),ie.arraySet(e,i,l),--t}}return e}array_copy(e){return ie.isArray(e)?ie.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(i,l){return i<l?-1:i>l?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,i){return oe.setField(this.interpreter,e,t,i),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),i=oe.createFields(this.interpreter),l=0;for(;l<t.length;){let n=t[l];++l,oe.setField(this.interpreter,i,n,oe.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.name;--e}return null}has_beat(e){let t=this.interpreter.stack.length-1;for(;t>=0;){let i=this.interpreter.stack[t];if(i.beat!=null&&i.beat.body!=null){let l=0,n=i.beat.body;for(;l<n.length;){let s=n[l];if(++l,s instanceof We&&s.name==e)return!0}}--t}return Object.prototype.hasOwnProperty.call(this.interpreter.topLevelBeats.h,e)}}z["loreline.Functions"]=Ol,Ol.__name__="loreline.Functions",Object.assign(Ol.prototype,{__class__:Ol});var Si=Je["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}};Si.__constructs__=[Si.SBreak,Si.SContinue,Si.SReturn];class Nl{constructor(e){this.interpreter=e,this.locals=new Se,this.declared=[],this.resetVariables(),this.initOps()}resetVariables(){this.variables=new Se,this.variables.h.null=null,this.variables.h.true=!0,this.variables.h.false=!1;let e=this,t=this.variables,i=je.makeVarArgs(function(l){let n=e.posInfos(),s=l.shift();l.length>0&&(n.customParams=l),El.trace(te.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 Se,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["="]=Ce(this,this.assign),this.binops.h["..."]=function(t,i){return new Cl(e.expr(t),e.expr(i))},this.binops.h.is=function(t,i){return Y.__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))oe.setField(this.interpreter,this.interpreter.topLevelState.fields,e,t);else throw y.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);ie.isArray(u)?ie.arraySet(u,c,i):oe.isFields(u)?oe.setField(this.interpreter,u,c,i):Y.__implements(u,kt)?Y.__cast(u,kt).set(c,i):u[c]=i;break;default:let f=new ye(we.EInvalidOp("="),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(f)}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,f=s.index,_=this.expr(c),m=this.expr(f);ie.isArray(_)?(n=t(ie.arrayGet(_,m),this.expr(l)),ie.arraySet(_,m,n)):oe.isFields(_)?(n=t(oe.getField(this.interpreter,_,m),this.expr(l)),oe.setField(this.interpreter,_,m,n)):Y.__implements(_,kt)?(n=t(Y.__cast(_,kt).get(m),this.expr(l)),Y.__cast(_,kt).set(m,n)):(n=t(_[m],this.expr(l)),_[m]=n);break;default:let d=new ye(we.EInvalidOp(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(d)}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,f=l.index,_=this.expr(c),m=this.expr(f);if(ie.isArray(_)){let w=ie.arrayGet(_,m);return t?(w+=i,ie.arraySet(_,m,w)):ie.arraySet(_,m,w+i),w}else if(oe.isFields(_)){let w=oe.getField(this.interpreter,_,m);return t?(w+=i,oe.setField(this.interpreter,_,m,w)):oe.setField(this.interpreter,_,m,w+i),w}else if(Y.__implements(_,kt)){let w=Y.__cast(_,kt).get(m);return t?(w+=i,Y.__cast(_,kt).set(m,w)):Y.__cast(_,kt).set(m,w+i),w}else{let w=_[m];return t?(w+=i,_[m]=w):_[m]=w+i,w}break;default:let d=new ye(we.EInvalidOp(i>0?"++":"--"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(d)}}execute(e){return this.depth=0,this.locals=new Se,this.declared=[],this.exprReturn(e)}exprReturn(e){try{return this.expr(e)}catch(t){let i=y.caught(t).unwrap();if(Y.__instanceof(i,Si))switch(i._hx_index){case 0:throw y.thrown("Invalid break");case 1:throw y.thrown("Invalid continue");case 2:let n=this.returnValue;return this.returnValue=null,n}else throw t}}duplicate(e){let t=new Se,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 ye(e,this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(i)}rethrow(e){throw y.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 i=new ye(we.EUnknownVariable(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(i)}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 f=t.e,_=this.declared.length,m=null,d=0;for(;d<f.length;){let ke=f[d];++d,m=this.expr(ke)}return this.restore(_),m;case 5:let w=t.e,b=t.f;return this.get(this.expr(w),b);case 6:let C=t.op,E=t.e1,T=t.e2,P=this.binops.h[C];if(P==null){let ke=new ye(we.EInvalidOp(C),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(ke)}return P(E,T);case 7:let v=t.op,I=t.prefix,O=t.e;switch(v){case"!":return this.expr(O)!=!0;case"++":return this.increment(O,I,1);case"-":return-this.expr(O);case"--":return this.increment(O,I,-1);case"~":return~this.expr(O);default:let ke=new ye(we.EInvalidOp(v),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(ke)}break;case 8:let L=t.e,B=t.params,A=[],K=0;for(;K<B.length;){let ke=B[K];++K,A.push(this.expr(ke))}let D=L.e;if(D._hx_index==5){let ke=D.e,lt=D.f,ot=this.expr(ke);if(ot==null){let rt=new ye(we.EInvalidAccess(lt),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(rt)}return this.fcall(ot,lt,A)}else return this.call(null,this.expr(L),A);break;case 9:let M=t.cond,V=t.e1,N=t.e2;return this.expr(M)==!0?this.expr(V):N==null?null:this.expr(N);case 10:let U=t.cond,q=t.e;return this.whileLoop(U,q),null;case 11:let J=t.v,G=t.it,H=t.e;return this.forLoop(J,G,H),null;case 12:throw y.thrown(Si.SBreak);case 13:throw y.thrown(Si.SContinue);case 14:let re=t.ret,_e=t.args,ue=t.e,de=t.name,fe=this.duplicate(this.locals),ge=this,Ne=!1,Fe=0,Re=0;for(;Re<_e.length;){let ke=_e[Re];++Re,ke.opt||ke.value!=null?Ne=!0:Fe+=1}let Ye=function(ke){if((ke==null?0:ke.length)!=_e.length){if(ke.length<Fe){let Ji="Invalid number of parameters. Got "+ke.length+", required "+Fe;de!=null&&(Ji+=" for function '"+de+"'");let en=new ye(we.ECustom(Ji),i.curExpr.pmin,i.curExpr.pmax,i.curExpr.origin,i.curExpr.line);throw y.thrown(en)}let Kt=[],xt=ke.length-Fe,zl=0,ul=0;for(;ul<_e.length;){let Ji=_e[ul];++ul,Ji.opt||Ji.value!=null?xt>0?(Kt.push(ke[zl++]),--xt):Kt.push(Ji.value!=null?ge.expr(Ji.value):null):Kt.push(ke[zl++])}ke=Kt}let lt=ge.locals,ot=ge.depth;ge.depth++,ge.locals=ge.duplicate(fe);let rt=0,gt=_e.length;for(;rt<gt;){let Kt=rt++;ge.locals.h[_e[Kt].name]={r:ke[Kt]}}let dt=null,Tt=i.declared.length;if(i.inTry)try{dt=ge.exprReturn(ue)}catch(Kt){let xt=y.caught(Kt).unwrap();throw i.restore(Tt),ge.locals=lt,ge.depth=ot,y.thrown(xt)}else dt=ge.exprReturn(ue);return i.restore(Tt),ge.locals=lt,ge.depth=ot,dt},Ke=je.makeVarArgs(Ye);if(de!=null)if(this.depth==0)this.variables.h[de]=Ke;else{this.declared.push({n:de,old:this.locals.h[de]});let ke={r:Ke};this.locals.h[de]=ke,fe.h[de]=ke}return Ke;case 15:let Ve=t.e;throw this.returnValue=Ve==null?null:this.expr(Ve),y.thrown(Si.SReturn);case 16:let nt=t.e,Ae=t.index,$e=this.expr(nt),X=this.expr(Ae);return ie.isArray($e)?ie.arrayGet($e,X):oe.isFields($e)?oe.getField(this.interpreter,$e,X):Y.__implements($e,kt)?Y.__cast($e,kt).get(X):$e[X];case 17:let ee=t.e,j;if(ee.length>0){let ke=ee[0].e;if(ke._hx_index==6){let lt=ke.e1,ot=ke.e2;j=ke.op=="=>"}else j=!1}else j=!1;if(j){let ke=[],lt=[],ot=0;for(;ot<ee.length;){let rt=ee[ot];++ot;let gt=rt.e;if(gt._hx_index==6)if(gt.op=="=>"){let dt=gt.e1,Tt=gt.e2;ke.push(this.expr(dt)),lt.push(this.expr(Tt))}else{this.curExpr=rt;let dt=new ye(we.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(dt)}else{this.curExpr=rt;let dt=new ye(we.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(dt)}}return this.makeMap(ke,lt)}else{let ke=[],lt=0;for(;lt<ee.length;){let ot=ee[lt];++lt,ke.push(this.expr(ot))}return ke}break;case 18:let le=t.cl,Z=t.params,Q=[],se=0;for(;se<Z.length;){let ke=Z[se];++se,Q.push(this.expr(ke))}return this.cnew(le,Q);case 19:let ae=t.e;throw y.thrown(this.expr(ae));case 20:let be=t.t,et=t.e,Oe=t.v,_t=t.ecatch,Ee=this.declared.length,Ie=this.inTry;try{this.inTry=!0;let ke=this.expr(et);return this.restore(Ee),this.inTry=Ie,ke}catch(ke){let lt=y.caught(ke).unwrap();if(Y.__instanceof(lt,Si)){let ot=lt;throw this.inTry=Ie,y.thrown(ot)}else{let ot=lt;this.restore(Ee),this.inTry=Ie,this.declared.push({n:Oe,old:this.locals.h[Oe]}),this.locals.h[Oe]={r:ot};let rt=this.expr(_t);return this.restore(Ee),rt}}break;case 21:let at=t.fl,tt=oe.createFields(this.interpreter),wt=0;for(;wt<at.length;){let ke=at[wt];++wt,oe.setField(this.interpreter,tt,ke.name,this.expr(ke.e))}return tt;case 22:let Ut=t.cond,ft=t.e1,ei=t.e2;return this.expr(Ut)==!0?this.expr(ft):this.expr(ei);case 23:let He=t.e,Mt=t.cases,vt=t.defaultExpr,Lt=this.expr(He),mt=!1,Dt=0;for(;Dt<Mt.length;){let ke=Mt[Dt];++Dt;let lt=0,ot=ke.values;for(;lt<ot.length;){let rt=ot[lt];if(++lt,this.expr(rt)==Lt){mt=!0;break}}if(mt){Lt=this.expr(ke.expr);break}}return mt||(Lt=vt==null?null:this.expr(vt)),Lt;case 24:let qt=t.cond,jt=t.e;return this.doWhileLoop(qt,jt),null;case 25:let ti=t.name,ii=t.args,Wt=t.e;return this.expr(Wt);case 26:let it=t.t,xi=t.e;return this.expr(xi)}}doWhileLoop(e,t){let i=this.declared.length,l=this;do{let n=!0;try{l.expr(t)}catch(s){let r=y.caught(s).unwrap();if(Y.__instanceof(r,Si)){let h=r;switch(h._hx_index){case 0:n=!1;break;case 1:break;case 2:throw y.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=y.caught(s).unwrap();if(Y.__instanceof(r,Si)){let h=r;switch(h._hx_index){case 0:n=!1;break;case 1:break;case 2:throw y.thrown(h)}}else throw s}if(!n)break}this.restore(i)}makeIterator(e){if(e instanceof Array)return new bi(e);if(ie.isArray(e))return ie.getIterator(e);if(e.iterator!=null&&(e=on(e)),e.hasNext==null||e.next==null){let t=new ye(we.EInvalidIterator(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.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=y.caught(o).unwrap();if(Y.__instanceof(u,Si)){let c=u;switch(c._hx_index){case 0:a=!1;break;case 1:break;case 2:throw y.thrown(c)}}else throw o}if(!a)break}this.restore(l)}loopRun(e){let t=!0;try{e()}catch(i){let l=y.caught(i).unwrap();if(Y.__instanceof(l,Si)){let n=l;switch(n._hx_index){case 0:t=!1;break;case 1:break;case 2:throw y.thrown(n)}}else throw i}return t}isMap(e){return Y.__implements(e,kt)}getMapValue(e,t){return Y.__cast(e,kt).get(t)}setMapValue(e,t,i){Y.__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&&je.isObject(a),s=s&&je.isEnumValue(a)}if(l){let a=new Bi,o=0,u=e;for(;o<u.length;){let c=u[o],_=o++,m=c;a.h[m]=t[_]}return a}if(i){let a=new Se,o=0,u=e;for(;o<u.length;){let c=u[o],_=o++,m=c;a.h[m]=t[_]}return a}if(s){let a=new $i,o=0,u=e;for(;o<u.length;){let c=u[o],_=o++,m=c;a.set(m,t[_])}return a}if(n){let a=new pl,o=0,u=e;for(;o<u.length;){let c=u[o],_=o++,m=c;a.set(m,t[_])}return a}let h=new ye(we.ECustom("Invalid map keys "+te.string(e)),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(h)}get(e,t){if(e==null){let i=new ye(we.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(i)}return oe.isFields(e)?oe.getField(this.interpreter,e,t):je.getProperty(e,t)}set(e,t,i){if(e==null){let l=new ye(we.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(l)}return oe.isFields(e)?(oe.setField(this.interpreter,e,t,i),i):(je.setProperty(e,t,i),i)}fcall(e,t,i){let l=null;return typeof e=="string"?l=oe.getStringHelper(this.interpreter,t):ie.isArray(e)?l=oe.getArrayHelper(this.interpreter,t):oe.isFields(e)&&(l=oe.getMapHelper(this.interpreter,t)),l!=null&&je.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=z[e];return i==null&&(i=this.resolve(e)),ce.createInstance(i,t)}}z["loreline.HscriptInterp"]=Nl,Nl.__name__="loreline.HscriptInterp",Object.assign(Nl.prototype,{__class__:Nl});class Ml{constructor(e){this.finished=e}}z["loreline._Imports.ImportsLoopInfo"]=Ml,Ml.__name__="loreline._Imports.ImportsLoopInfo",Object.assign(Ml.prototype,{__class__:Ml});class Ll{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 Se,r=[],h=new Se,a=Pt.directory(e);this.extractImports(a,t,r,h),this.processImports(r,h,s)}processImports(e,t,i){let l=new Ml(!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 bt(r),a=h.tokenize(),o=h.getErrors();o!=null&&o.length>0&&s.handleError(o[0]),n.h[e]=a,s.extractImports(Pt.directory(e),a,i,l),t.finished&&s.processImports(i,l,n)}catch(h){let a=y.caught(h).unwrap();if(s.hasErrors=!0,a instanceof si)s.handleError(a);else throw y.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;Pt.isAbsolute(o)||(u=Pt.join([e,u])),u=Pt.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}}}z["loreline.Imports"]=Ll,Ll.__name__="loreline.Imports",Object.assign(Ll.prototype,{__class__:Ll});class _i{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 _i,t=this._keys1,i=new Array(t.length);Yl.blit(t,0,i,0,t.length),e._keys1=i;let l=this._keys2,n=new Array(l.length);Yl.blit(l,0,n,0,l.length),e._keys2=n;let s=this._values,r=new Array(s.length);return Yl.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 f=u++;o[f]!=null&&this._set(h[f],a[f],o[f])}}}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 Bl(this)}keyIterator(){return new Al(this)}keyValueIterator(){return new Fl(this)}length(){return this.size}}z["loreline.Int64Map"]=_i,_i.__name__="loreline.Int64Map",Object.assign(_i.prototype,{__class__:_i});class Bl{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}}z["loreline._Int64Map.Int64MapIterator"]=Bl,Bl.__name__="loreline._Int64Map.Int64MapIterator",Object.assign(Bl.prototype,{__class__:Bl});class Al{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}}}z["loreline._Int64Map.Int64MapKeyIterator"]=Al,Al.__name__="loreline._Int64Map.Int64MapKeyIterator",Object.assign(Al.prototype,{__class__:Al});class Fl{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}}}z["loreline._Int64Map.Int64MapKeyValueIterator"]=Fl,Fl.__name__="loreline._Int64Map.Int64MapKeyValueIterator",Object.assign(Fl.prototype,{__class__:Fl});class Fi{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=oe.createFields(e,null,t)}createOriginalFields(){this.originalFields=oe.createFields()}}z["loreline.RuntimeState"]=Fi,Fi.__name__="loreline.RuntimeState",Object.assign(Fi.prototype,{__class__:Fi});class hl extends Fi{constructor(e,t,i,l){super(e,t,i,l)}}z["loreline.RuntimeCharacter"]=hl,hl.__name__="loreline.RuntimeCharacter",hl.__super__=Fi,Object.assign(hl.prototype,{__class__:hl});var vi=Je["loreline.RuntimeAccess"]={__ename__:"loreline.RuntimeAccess",__constructs__:null,FieldAccess:(g=function(k,e,t){return{_hx_index:0,pos:k,obj:e,name:t,__enum__:"loreline.RuntimeAccess",toString:S}},g._hx_name="FieldAccess",g.__params__=["pos","obj","name"],g),ArrayAccess:(g=function(k,e,t){return{_hx_index:1,pos:k,array:e,index:t,__enum__:"loreline.RuntimeAccess",toString:S}},g._hx_name="ArrayAccess",g.__params__=["pos","array","index"],g),CharacterAccess:(g=function(k,e){return{_hx_index:2,pos:k,name:e,__enum__:"loreline.RuntimeAccess",toString:S}},g._hx_name="CharacterAccess",g.__params__=["pos","name"],g),FunctionAccess:(g=function(k,e){return{_hx_index:3,pos:k,name:e,__enum__:"loreline.RuntimeAccess",toString:S}},g._hx_name="FunctionAccess",g.__params__=["pos","name"],g)};vi.__constructs__=[vi.FieldAccess,vi.ArrayAccess,vi.CharacterAccess,vi.FunctionAccess];class al{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}}z["loreline.RuntimeScope"]=al,al.__name__="loreline.RuntimeScope",Object.assign(al.prototype,{__class__:al});class ml{constructor(e,t){this.parentNextOptionIndex=0,this.parentPartialOptions=null,this.stack=[],this.options=null,this.id=e,this.origin=t}}z["loreline.RuntimeInsertion"]=ml,ml.__name__="loreline.RuntimeInsertion",Object.assign(ml.prototype,{__class__:ml});class gl{constructor(e,t,i){this.closing=e,this.value=t,this.offset=i}}z["loreline.TextTag"]=gl,gl.__name__="loreline.TextTag",Object.assign(gl.prototype,{__class__:gl});class dl{constructor(e,t,i,l,n){this.text=e,this.tags=t,this.enabled=i,this.node=l,this.insertion=n}}z["loreline.ChoiceOption"]=dl,dl.__name__="loreline.ChoiceOption",Object.assign(dl.prototype,{__class__:dl});class pe extends si{constructor(e,t){super(e,t)}}z["loreline.RuntimeError"]=pe,pe.__name__="loreline.RuntimeError",pe.__super__=si,Object.assign(pe.prototype,{__class__:pe});class Dl{constructor(){this.cb=null,this.sync=!0}}z["loreline.EvalNext"]=Dl,Dl.__name__="loreline.EvalNext",Object.assign(Dl.prototype,{__class__:Dl});class xl{constructor(e,t,i,l,n){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.mapHelpers=new Se,this.arrayHelpers=new Se,this.stringHelpers=new Se,this.topLevelFunctions=new Se,this.nodeStates=new Wi,this.topLevelBeats=new Se,this.topLevelCharacters=new Se,this.script=e,this.handleDialogue=t,this.handleChoice=i,this.handleFinish=l,this.lens=new Vl(e);let s=n!=null?n.strictAccess:null;this.strictAccess=s!=null&&s,this.translations=n!=null?n.translations:null,this.topLevelState=new Fi(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(Y.getClass(h)){case We:this.initializeTopLevelBeat(h);break;case Gt:this.initializeTopLevelCharacter(h);break;case ji:this.initializeTopLevelFunction(h);break;case Jt: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 y.thrown(new pe("Beat "+e+" not found",this.script.pos))}else{let i=this.script.iterator();for(;i.hasNext();){let l=i.next();if(l instanceof We){let n=l;n.name=="_"&&(t=n);break}}if(t==null){let l=this.script.iterator();for(;l.hasNext();){let n=l.next();if(n instanceof We){t=n;break}}}if(t==null)throw y.thrown(new pe("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}return je.fields(e).length>0&&(n.insertions=e),n}restore(e){if(e.version!=1)throw y.thrown(new pe("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.restoreState(this.topLevelState,e.state),this.restoreCharacters(e.characters),this.restoreNodeStates(e.nodeStates);let t=new Bi;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)}}}resume(){if(this.stack.length==0){this.start();return}let e=this.wrapNext(Ce(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?oe.getField(this,l,t):null}setCharacterField(e,t,i){let l=this.topLevelCharacters.h[e].fields;oe.setField(this,l,t,i)}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=je.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);je.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=Ue.fromTwoInt32(l,n),h=s,a=r,o=h,u=this.serializeState(o);je.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,We),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(Y.__implements(e,Ei)){let n=Y.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 Se){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||!oe.fieldExists(this,t,u)||!Ci.equal(this,oe.getField(this,t,u),c))&&(l[u]=this.serializeValue(c))}}else{let n=Y.getClass(e);n!=null&&(i=n.__name__);let s=0,r=je.fields(e);for(;s<r.length;){let h=r[s];++s;let a=je.getProperty(e,h);(t==null||!oe.fieldExists(this,t,h)||!Ci.equal(this,oe.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(ie.isArray(e)){let t=[],i=ie.arrayLength(e),l=0,n=i;for(;l<n;){let s=l++;t.push(this.serializeValue(ie.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(Y.getClass(e)){case Vi:this.evalAlternative(e,i);break;case Vt:if(!this.isBeatCall(e))this.evalCall(e,i);else{let r=Y.getClass(e);throw y.thrown(new pe("Resume execution not supported from last node: "+r.__name__,e.pos))}break;case fi:this.evalChoice(e,i);break;case hi:this.evalDialogue(e,i);break;case oi:this.evalText(e,i);break;default:let s=Y.getClass(e);throw y.thrown(new pe("Resume execution not supported from last node: "+s.__name__,e.pos))}else switch(Y.getClass(e)){case Vi:this.resumeAlternative(e,t,i);break;case We:this.resumeBeatRun(e,t,i);break;case Vt:if(this.isBeatCall(e,t))this.resumeCall(e,t,i);else{let r=Y.getClass(e);throw y.thrown(new pe("Resume execution not supported from node within stack: "+r.__name__,e.pos))}break;case St:this.resumeChoiceOption(e,t,i);break;case fi:this.resumeChoice(e,t,i);break;case gi:this.resumeIf(e,t,i);break;default:let s=Y.getClass(e);throw y.thrown(new pe("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 y.thrown(new pe("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 y.thrown(new pe("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 St){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 We){let h=s;this.resumeNodeBody(h,t,h.body,function(){let a=r.parentPartialOptions!=null?r.parentPartialOptions:[];if(r.options!=null){let f=0,_=r.options;for(;f<_.length;){let m=_[f];++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 St){let s=l.node;this.resumeNodeBody(s,t,s.body,i)}else if(l.node instanceof We){let s=l.node;this.resumeNodeBody(s,t,s.body,i)}else throw y.thrown(new pe("Choice head is not a choice option",l.head.pos))}resumeIf(e,t,i){let l=this.stack[t];if(l.head==null)throw y.thrown(new pe("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 y.thrown(new pe("Failed to resume condition: invalid scope",e.pos))}resumeAlternative(e,t,i){let l=this.stack[t];if(l.head==null)throw y.thrown(new pe("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 y.thrown(new pe("Failed to resume alternative: head not found in any item",e.pos))}resumeCall(e,t,i){if(e.target instanceof pt){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 y.thrown(new pe("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 Bi);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=Ue.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 _=0,m=e.beats;for(;_<m.length;){let d=m[_];++_;let w=this.restoreBeat(d);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 f=null;return e.insertion!=null&&t!=null&&(f=this.restoreInsertion(e.insertion,t,i)),new al(null,l,r,h,o,c,f)}restoreInsertion(e,t,i){if(i.h.hasOwnProperty(e))return i.h[e];let l=e==null?"null":""+e,n=je.field(t,l);if(n==null)return null;let s=null;if(n.origin!=null){let h=Ue.fromString(n.origin.id),a=this.lens.getNodeById(h);a!=null&&a.type()==n.origin.type&&(s=a)}let r=new ml(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=Ue.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 gl(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 dl(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,We),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=Ue.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 Li(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 Fi(this,null,l,null)),e}restoreCharacters(e){let t=0,i=je.fields(e);for(;t<i.length;){let l=i[t];++t;let n=je.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=je.fields(e);for(;t<i.length;){let l=i[t];++t;let n=Ue.fromString(l),s=je.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 hl(this,null,l,null)),e}restoreFields(e,t){if(t==null||t.fields==null)return e;e==null&&(e=oe.createFields(this,t.type));let i=t.fields;if(oe.isFields(e)){let l=0,n=je.fields(i);for(;l<n.length;){let s=n[l];++l,oe.setField(this,e,s,this.restoreValue(je.field(i,s)))}}else{let l=0,n=je.fields(i);for(;l<n.length;){let s=n[l];++l,e[s]=this.restoreValue(je.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(ie.isArray(e)){let t=ie.arrayLength(e),i=ie.createArray(),l=0,n=t;for(;l<n;){let s=l++;ie.arrayPush(i,this.restoreValue(ie.arrayGet(e,s)))}return i}return this.restoreFields(null,e)}initializeTopLevelFunctions(e){if(this.builtins=new Ol(this),this.builtins.bindAll(this.topLevelFunctions),e!=null){let r=e,h=r,a=je.fields(r),o=0;for(;o<a.length;){let u=a[o++],c=h[u],_=u,m=c;this.topLevelFunctions.h[_]=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)}}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 qi;try{let i=t.process(e.code+(e.external?" {}":"")),l=new Xi;l.allowJSON=!0,l.allowTypes=!0;let n=l.parseString(i),r=new Nl(this).execute(n);this.topLevelFunctions.h[e.name]=r}catch(i){let l=y.caught(i).unwrap();throw y.thrown(new pe("Failed to parse function code: "+(l==null?"null":te.string(l)),e.pos))}}}else throw y.thrown(new pe("Top level function must have a name",e.pos))}wrapNext(e){let t=new Dl;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=y.caught(e).unwrap();throw this.flushing=!1,y.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 y.thrown(new pe("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);oe.setField(this,this.topLevelState.fields,l.name,n),this.isOriginalScriptExpression(l.value)&&oe.setField(this,this.topLevelState.originalFields,l.name,n)}}initializeTopLevelBeat(e){if(Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,e.name))throw y.thrown(new pe("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 y.thrown(new pe("Duplicate top level character: "+e.name,e.pos));let t=new hl(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);oe.setField(this,t.fields,n.name,s),this.isOriginalScriptExpression(n.value)&&oe.setField(this,t.originalFields,n.name,s)}}initializeState(e,t){let i=null;if(e.temporary)t.state==null&&(t.state=new Fi(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 Fi(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,!oe.fieldExists(this,i.fields,s.name)){let r=this.evaluateExpression(s.value);oe.setField(this,i.fields,s.name,r),!e.temporary&&this.isOriginalScriptExpression(s.value)&&oe.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;let t=this.wrapNext(Ce(this,this.finish));this.finishTrigger=t,this.evalBeatRun(e,t.cb),t.sync=!1}evalNode(e,t){switch(Y.getClass(e)){case Vi:this.evalAlternative(e,t);break;case di:this.evalAssignment(e,t);break;case We:this.evalBeatDecl(e,t);break;case Vt:this.evalCall(e,t);break;case St:this.evalChoiceOption(e,t);break;case fi:this.evalChoice(e,t);break;case hi:this.evalDialogue(e,t);break;case gi:this.evalIf(e,t);break;case Jt:this.evalStateDecl(e,t);break;case oi:this.evalText(e,t);break;case Ni:this.evalTransition(e);break;default:let i=Y.getClass(e);throw y.thrown(new pe("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 y.thrown(new pe("Duplicate beat with name: "+e.name,e.pos));this.get_currentScope().beats.push(e),t()}evalNodeBody(e,t,i,l,n){this.push(new al(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.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.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 o=s[n];if(++n,o.insertion!=null){this.pendingChoiceOptions=t;break}}let r=-1,h=this,a=this.wrapNext(function(){if(h.pendingChoiceOptions=null,r>=0&&r<t.length){let o=t[r];if(o.insertion!=null){let u=h.stack.length;for(;h.stack.length>0;)h.stack.pop();let c=0,f=o.insertion.stack;for(;c<f.length;){let m=f[c];++c,m.insertion!=null&&(m.insertion=null),h.stack.push(m)}let _=h.stack[h.stack.length-1];h.push(new al(null,_.beat,h.lens.getParentNode(o.node),null,null,o.node,null)),h.resumeFromLevel(u,i)}else h.evalChoiceOption(o.node,i)}else i()});this.handleChoice(this,t,function(o){r=o,a.cb()}),a.sync=!1}evalChoiceOptionsAndInsertions(e,t,i,l,n){let s=t.options,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 f=u++,_=a.options[f];i.push(_)}a=null}if(r<s.length){let u=s[r];r+=1;let c=u.condition==null||o.evaluateCondition(u.condition);if(u.text!=null){let f=o.wrapNext(h),_=o.getTranslatedString(u,u.text),m=o.evaluateString(_);i.push(new dl(m.text,m.tags,c,u,o.get_currentInsertion())),f.cb(),f.sync=!1}else if(u.insertion!=null){let f=o.wrapNext(h);a=new ml(o.nextInsertionId++,u.insertion),a.parentPartialOptions=[].concat(i),a.parentNextOptionIndex=r,o.evalInsertion(a,f.cb),f.sync=!1}else throw y.thrown(new pe("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 y.thrown(new pe("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(;_<m;){let b=_++;f.push(b)}let d=f,w=d.length-1;for(;w>0;){let b=this.builtins.random(0,w),C=d[w];d[w]=d[b],d[b]=C,--w}this.evalShuffledItems(e,d,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)})}getAlternativeVisitCount(e){let t=e.id.thisVal,i=this.nodeStates.map._get(t.high,t.low);if(i==null)return 0;let l=oe.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 Fi(this,e,null,null);let n=e.id.thisVal;this.nodeStates.map._set(n.high,n.low,l)}oe.setField(this,l.fields,"_visitCount",t)}evalAssignment(e,t){let i=this.resolveAssignmentTarget(e.target),l=this.evaluateExpression(e.value),n;switch(e.op._hx_index){case 20:n=l;break;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;default:throw y.thrown(new pe("Invalid assignment operator",e.pos))}this.writeAccess(i,n),t()}isOriginalScriptExpression(e){switch(Y.getClass(e)){case Xt:let t=e;return this.isOriginalScriptExpression(t.left)?this.isOriginalScriptExpression(t.right):!1;case pt:case ui:case Vt:return!1;case qe: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 _=a[o];if(++o,_ instanceof ct&&!this.isOriginalScriptExpression(_))return!1}return!0;case 4:let u=l.style,c=i.value,f=0;for(;f<c.length;){let _=c[f];if(++f,!this.isOriginalScriptExpression(_.value))return!1}return!0}break;case Et: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 f=o.closing,_=o.expr;if(!this.isOriginalScriptExpression(_))return!1;break}}return!0;case Hi:let h=e;return this.isOriginalScriptExpression(h.operand)}return!1}isBeatCall(e,t){return t==null&&(t=-1),e instanceof Vt?this.resolveBeatFromCall(e,t)!=null:!1}resolveBeatFromCall(e,t){if(t==null&&(t=-1),e.target instanceof pt){let i=e.target;if(i.target==null){let l=i.name,n=null,s=t==-1?this.stack.length-1:t;for(;s>=0;){let h=this.stack[s].beatByName(l);if(h!=null){n=h;break}--s}if(n==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,l)&&(n=this.topLevelBeats.h[l]),n!=null)return n}}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 y.thrown(new pe("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 Ot.findHashComment(e,t)}evaluateString(e){let t=0,i=this.stringLiteralProcessors.length;for(;t<i;){let _=t++;e=this.stringLiteralProcessors[_](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 _=r-1;e:for(;_>=0;){let d=e.parts[_].partType;switch(d._hx_index){case 0:let w=d.text;u=_;break e;case 1:let b=d.expr;break e;case 2:let C=d.closing,E=d.expr;--_;break}}}let c=0,f=r;for(;c<f;){let _=c++,d=e.parts[_].partType;switch(d._hx_index){case 0:let w=d.text;h||(w=Be.ltrim(w)),_==u&&(w=Be.rtrim(w)),o||(w=this.stripStringComments(w)),a||(w=this.stripStringIndent(w));let b=w.length;b>0&&(h=!0);let C=!1,E=!1,T=!1,P=0,v=b;for(;P<v;){let A=P++,K=p.cca(w,A),D=K??-1;T?(D==110?l+=String.fromCodePoint(10):D==114?l+=String.fromCodePoint(13):D==116?l+=String.fromCodePoint(9):l+=String.fromCodePoint(D),T=!1,C=!1,E=!1):D==92?(T=!0,C=!1,E=!1):D==36?(C?(l+=String.fromCodePoint(D),C=!1):C=!0,E=!1):D==35?(E?(l+=String.fromCodePoint(D),E=!1):E=!0,C=!1):(E&&(l+=String.fromCodePoint(35),E=!1),l+=String.fromCodePoint(D))}E&&(l+=String.fromCodePoint(35)),s+=b;break;case 1:let I=d.expr;if(h=!0,I instanceof pt){let A=I,K=this.resolveAccess(A,A.target,A.name);if(K._hx_index==2){let D=K.pos,M=K.name,V=this.evaluateExpression(I),N=oe.getField(this,V,"name"),U=N??M,q=this.valueToString(U);s+=q.length,l+=q==null?"null":""+q}else{let D=this.evaluateExpression(I),M=this.valueToString(D);s+=M.length,l+=M==null?"null":""+M}}else{let A=this.evaluateExpression(I),K=this.valueToString(A);s+=K.length,l+=K==null?"null":""+K}break;case 2:let O=d.closing,L=d.expr,B=this.evaluateString(L).text;n.push(new gl(O,B,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 _,m=e.parts[t].partType;if(m._hx_index==1?_=m.expr:_=null,_!=null){if(!i){let d=[],w=0,b=r;for(;w<b;){let C=w++;d.push(e.parts[C])}l=d,i=!0}this.transformPipeRaw(o,_,h.pos,l);continue}}break;case 1:let u=a.expr;t=r;break;case 2:let c=a.closing,f=a.expr;break}i&&l.push(h)}return i?new Et(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 f=p.cca(e,c),_=f??-1;if(_==92&&c+1<n){c+=2;continue}if(_==124&&o==-1)o=c;else if(_==41){u=c;break}++c}if(o!=-1&&u!=-1&&o>s+1&&u>o+1){let f=s+1,_=o-s-1,m=_!=null?p.substr(e,f,_):p.substr(e,f,null),d=o+1,w=u-o-1,b=w!=null?p.substr(e,d,w):p.substr(e,d,null);if(s>r){let C=s-r;l.push(new Ge(Ue.UNDEFINED,i,ze.Raw(C!=null?p.substr(e,r,C):p.substr(e,r,null))))}l.push(new Ge(Ue.UNDEFINED,i,ze.Expr(this.makePluralCall(t,m,b,i)))),s=u+1,r=s;continue}}if(a==124){let o=s;for(;o>r;){let w=p.cca(e,o-1),b=w??-1;if(b==32||b==9||b==10||b==124||b==40||b==41)break;--o}let u=s+1;for(;u<n;){let w=p.cca(e,u),b=w??-1;if(b==32||b==9||b==10||b==124||b==40||b==41)break;++u}let c=s-o,f=c!=null?p.substr(e,o,c):p.substr(e,o,null),_=s+1,m=u-s-1,d=m!=null?p.substr(e,_,m):p.substr(e,_,null);if(f.length>0&&d.length>0){if(o>r){let w=o-r;l.push(new Ge(Ue.UNDEFINED,i,ze.Raw(w!=null?p.substr(e,r,w):p.substr(e,r,null))))}l.push(new Ge(Ue.UNDEFINED,i,ze.Expr(this.makePluralCall(t,f,d,i)))),s=u,r=s;continue}}++s}if(r<n){let h=n-r;l.push(new Ge(Ue.UNDEFINED,i,ze.Raw(h!=null?p.substr(e,r,h):p.substr(e,r,null))))}}makePluralCall(e,t,i,l){let n=new pt(Ue.UNDEFINED,l,null,"plural"),s=new Et(Ue.UNDEFINED,l,1,[new Ge(Ue.UNDEFINED,l,ze.Raw(t))]),r=new Et(Ue.UNDEFINED,l,1,[new Ge(Ue.UNDEFINED,l,ze.Raw(i))]);return new Vt(Ue.UNDEFINED,l,n,[e,s,r])}stripStringIndent(e){if(e.indexOf(`
|
|
35
|
+
`)==-1)return e;let t=e.split(`
|
|
36
|
+
`),i=-1;if(t[0].length>0){let s=0;for(;s<t[0].length;){let r=p.cca(t[0],s),h=r??-1;if(h!=32&&h!=9)break;++s}s>0&&s<t[0].length&&(i=s)}let l=1,n=t.length;for(;l<n;){let s=l++,r=t[s];if(r.length==0)continue;let h=0;for(;h<r.length;){let a=p.cca(r,h),o=a??-1;if(o!=32&&o!=9)break;++h}h<r.length&&(i==-1||h<i)&&(i=h)}if(i>0){let s=1,r=t.length;for(;s<r;){let h=s++;if(t[h].length>0){let a=t[h],o=null;t[h]=o!=null?a.substring(i,o):a.substring(i)}}e=t.join(`
|
|
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,f=p.cca(e,l);if((f??-1)==42){let _=p.cca(e,l+1);c=(_??-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 pt){let n=e.target;if(n.target==null){let s=this.evaluateExpression(e.target);if(s!=null&&je.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 Zi){if(t==null)throw y.thrown(new pe("Cannot call async function in expression",e.pos));u.func(t)}else t?.();return u}catch(u){let c=y.caught(u).unwrap();if(c instanceof ye){let f=c;throw y.thrown(new pe("Error when evaluating function ("+f.pmin+"-"+f.pmax+"): "+te.string(f.e),e.pos))}throw y.thrown(new pe("Error when calling function: "+te.string(c),e.pos))}}}else{let s=this.evaluateExpression(n.target),r=null;if(typeof s=="string"?r=oe.getStringHelper(this,n.name):ie.isArray(s)?r=oe.getArrayHelper(this,n.name):oe.isFields(s)&&(r=oe.getMapHelper(this,n.name)),r!=null&&je.isFunction(r)){let h=[],a=0,o=e.args;for(;a<o.length;){let f=o[a];++a,h.push(this.evaluateExpression(f))}let u=h;u.splice(0,0,s);let c=r.apply(null,u);if(c!=null&&c instanceof Zi){if(t==null)throw y.thrown(new pe("Cannot call async function in expression",e.pos));c.func(t)}else t?.();return c}else if(r==null&&!(typeof s=="string"||ie.isArray(s)||oe.isFields(s))){let h=je.getProperty(s,n.name);if(je.isFunction(h)){let a=[],o=0,u=e.args;for(;o<u.length;){let _=u[o];++o,a.push(this.evaluateExpression(_))}let c=a,f=h.apply(s,c);if(f!=null&&f instanceof Zi){if(t==null)throw y.thrown(new pe("Cannot call async function in expression",e.pos));f.func(t)}else t?.();return f}}}}let i=this.printLoreline(e.target),l;throw i!=null?l=i:l=Y.getClass(e.target).__name__,y.thrown(new pe("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 Se,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(Y.getClass(e)){case pt:let t=e,i=this.resolveAccess(t,t.target,t.name);return this.readAccess(i);case ui:let l=e,n=this.evaluateExpression(l.target),s=this.evaluateExpression(l.index);if(ie.isArray(n)&&(typeof s=="number"&&(s|0)===s||typeof s=="number")){let d=s|0;if(d<0||d>=ie.arrayLength(n))throw y.thrown(new pe("Array index out of bounds: "+d,l.pos));return ie.arrayGet(n,d)}else if(typeof s=="string"){if(n==null)throw y.thrown(new pe("Cannot access field '"+(s==null?"null":te.string(s))+"' of null",l.pos));return oe.getField(this,n,s)}else throw y.thrown(new pe("Invalid array access",l.pos));break;case Xt:let r=e,h=this.evaluateExpression(r.left),a=this.evaluateExpression(r.right);return this.performOperation(r.op,h,a,r.pos);case Vt:return this.evaluateFunctionCall(e,null);case qe: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 d=u.style;return this.evaluateObjectLiteral(o.value)}break;case Et:let c=e;if(c.parts.length==1&&c.quotes==0){let d=c.parts[0].partType;if(d._hx_index==1){let w=d.expr;return this.evaluateExpression(w)}else return this.evaluateString(c).text}else return this.evaluateString(c).text;break;case Hi:let f=e,_=this.evaluateExpression(f.operand);switch(f.op._hx_index){case 26:if(typeof _=="number"&&(_|0)===_)return-_;if(typeof _=="number")return-_;throw y.thrown(new pe("Invalid unary operation",f.pos));break;case 38:if(typeof _=="boolean")return!_;if(typeof _=="string"){let d=_;return d!=null?d.length==0:!0}else if(_ instanceof Array){let d=_;return d!=null?d.length==0:!0}else return typeof _=="number"&&(_|0)===_||typeof _=="number"?_==0:_==null;break;default:throw y.thrown(new pe("Invalid unary operation",f.pos))}break;default:let m=Y.getClass(e);throw y.thrown(new pe("Unsupported expression type: "+m.__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 y.thrown(new pe("Cannot read field '"+l+"' of null",t));return oe.getField(this,i,l);case 1:let n=e.pos,s=e.array,r=e.index;return ie.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 y.thrown(new pe("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 y.thrown(new pe("Function not found: "+u,o))}}writeAccess(e,t){switch(e._hx_index){case 0:let i=e.pos,l=e.obj,n=e.name;if(l==null)throw y.thrown(new pe("Cannot set field '"+n+"' of null",i));oe.setField(this,l,n,t);break;case 1:let s=e.pos,r=e.array,h=e.index;ie.arraySet(r,h,t);break;case 2:let a=e.pos,o=e.name;throw y.thrown(new pe("Cannot overwrite character: "+o,a));case 3:let u=e.pos,c=e.name;throw y.thrown(new pe("Cannot overwrite function: "+c,u))}}resolveAssignmentTarget(e){switch(Y.getClass(e)){case pt:let t=e;return this.resolveAccess(t,t.target,t.name);case ui:let i=e,l=this.evaluateExpression(i.target),n=this.evaluateExpression(i.index);if(ie.isArray(l)&&(typeof n=="number"&&(n|0)===n||typeof n=="number")){let s=n|0;return vi.ArrayAccess(i.pos,l,s)}else throw y.thrown(new pe("Invalid array access target",i.pos));break;default:throw y.thrown(new pe("Invalid assignment target",e.pos))}}resolveAccess(e,t,i){if(t!=null){let r=this.evaluateExpression(t);if(r==null){let h=Y.getClass(t)==pt?t.name:null;throw y.thrown(new pe(h!=null?"Cannot access field '"+i+"' of undefined variable '"+h+"'":"Cannot access field '"+i+"' of null value",t.pos))}return vi.FieldAccess(t.pos,r,i)}let l=this.stack.length-1;for(;l>=0;){let r=this.stack[l];if(r.state!=null&&oe.fieldExists(this,r.state.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 vi.FieldAccess(a??this.script.pos,r.state.fields,i)}if(r.node!=null){let h=r.node.id.thisVal,a=this.nodeStates.map._get(h.high,h.low);if(a!=null&&oe.fieldExists(this,a.fields,i)){let o=e!=null?e.pos:null,u;if(o!=null)u=o;else{let c=this.get_currentScope(),f=c!=null?c.node:null;u=f!=null?f.pos:null}return vi.FieldAccess(u??this.script.pos,a.fields,i)}}--l}if(oe.fieldExists(this,this.topLevelState.fields,i)){let r=e!=null?e.pos:null,h;if(r!=null)h=r;else{let a=this.get_currentScope(),o=a!=null?a.node:null;h=o!=null?o.pos:null}return vi.FieldAccess(h??this.script.pos,this.topLevelState.fields,i)}if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,i)){let r=e!=null?e.pos:null,h;if(r!=null)h=r;else{let a=this.get_currentScope(),o=a!=null?a.node:null;h=o!=null?o.pos:null}return vi.CharacterAccess(h??this.script.pos,i)}if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,i)){let r=e!=null?e.pos:null,h;if(r!=null)h=r;else{let a=this.get_currentScope(),o=a!=null?a.node:null;h=o!=null?o.pos:null}return vi.FunctionAccess(h??this.script.pos,i)}if(!this.strictAccess){let r=e!=null?e.pos:null,h;if(r!=null)h=r;else{let a=this.get_currentScope(),o=a!=null?a.node:null;h=o!=null?o.pos:null}return vi.FieldAccess(h??this.script.pos,this.topLevelState.fields,i)}let n=e!=null?e.pos:null,s;if(n!=null)s=n;else{let r=this.get_currentScope(),h=r!=null?r.node:null;s=h!=null?h.pos:null}throw y.thrown(new pe("Undefined variable: "+i,s??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=ce.typeof(t),s=ce.typeof(i);switch(e._hx_index){case 25:switch(n._hx_index){case 1:switch(s._hx_index){case 1:case 2:return parseFloat(te.string(t))+parseFloat(te.string(i));case 6:if(s.c==String)return te.string(t)+te.string(i);{let m="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),d=l,w;if(d!=null)w=d;else{let b=this.get_currentScope(),C=b!=null?b.node:null;w=C!=null?C.pos:null}throw y.thrown(new pe(m,w??this.script.pos))}break;default:let c="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,_;if(f!=null)_=f;else{let m=this.get_currentScope(),d=m!=null?m.node:null;_=d!=null?d.pos:null}throw y.thrown(new pe(c,_??this.script.pos))}break;case 2:switch(s._hx_index){case 1:case 2:return parseFloat(te.string(t))+parseFloat(te.string(i));case 6:if(s.c==String)return te.string(t)+te.string(i);{let m="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),d=l,w;if(d!=null)w=d;else{let b=this.get_currentScope(),C=b!=null?b.node:null;w=C!=null?C.pos:null}throw y.thrown(new pe(m,w??this.script.pos))}break;default:let c="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,_;if(f!=null)_=f;else{let m=this.get_currentScope(),d=m!=null?m.node:null;_=d!=null?d.pos:null}throw y.thrown(new pe(c,_??this.script.pos))}break;case 6:if(n.c==String)return te.string(t)+te.string(i);if(s._hx_index==6){if(s.c==String)return te.string(t)+te.string(i);{let c="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,_;if(f!=null)_=f;else{let m=this.get_currentScope(),d=m!=null?m.node:null;_=d!=null?d.pos:null}throw y.thrown(new pe(c,_??this.script.pos))}}else{let c="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,_;if(f!=null)_=f;else{let m=this.get_currentScope(),d=m!=null?m.node:null;_=d!=null?d.pos:null}throw y.thrown(new pe(c,_??this.script.pos))}break;default:if(s._hx_index==6){if(s.c==String)return te.string(t)+te.string(i);{let c="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,_;if(f!=null)_=f;else{let m=this.get_currentScope(),d=m!=null?m.node:null;_=d!=null?d.pos:null}throw y.thrown(new pe(c,_??this.script.pos))}}else{let c="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,_;if(f!=null)_=f;else{let m=this.get_currentScope(),d=m!=null?m.node:null;_=d!=null?d.pos:null}throw y.thrown(new pe(c,_??this.script.pos))}}break;case 26:case 27:case 28:case 29:switch(n._hx_index){case 1:case 2:switch(s._hx_index){case 1:case 2:let d=parseFloat(te.string(t)),w=parseFloat(te.string(i));switch(e._hx_index){case 26:return d-w;case 27:return d*w;case 28:if(w==0){let P=l,v;if(P!=null)v=P;else{let I=this.get_currentScope(),O=I!=null?I.node:null;v=O!=null?O.pos:null}throw y.thrown(new pe("Division by zero",v??this.script.pos))}return d/w;case 29:if(w==0){let P=l,v;if(P!=null)v=P;else{let I=this.get_currentScope(),O=I!=null?I.node:null;v=O!=null?O.pos:null}throw y.thrown(new pe("Modulo by zero",v??this.script.pos))}return d%w;default:throw y.thrown("Unreachable")}break;default:let b;switch(e._hx_index){case 26:b="subtract";break;case 27:b="multiply";break;case 28:b="divide";break;case 29:b="modulo";break;default:b="perform operation on"}let C="Cannot "+b+" "+this.getTypeName(n)+" and "+this.getTypeName(s),E=l,T;if(E!=null)T=E;else{let P=this.get_currentScope(),v=P!=null?P.node:null;T=v!=null?v.pos:null}throw y.thrown(new pe(C,T??this.script.pos))}break;default:let c;switch(e._hx_index){case 26:c="subtract";break;case 27:c="multiply";break;case 28:c="divide";break;case 29:c="modulo";break;default:c="perform operation on"}let f="Cannot "+c+" "+this.getTypeName(n)+" and "+this.getTypeName(s),_=l,m;if(_!=null)m=_;else{let d=this.get_currentScope(),w=d!=null?d.node:null;m=w!=null?w.pos:null}throw y.thrown(new pe(f,m??this.script.pos))}break;case 30:case 31:switch(e._hx_index){case 30:return t==i;case 31:return t!=i;default:throw y.thrown("Unreachable")}break;case 32:case 33:case 34:case 35:switch(n._hx_index){case 1:case 2:switch(s._hx_index){case 1:case 2:let m=parseFloat(te.string(t)),d=parseFloat(te.string(i));switch(e._hx_index){case 32:return m>d;case 33:return m<d;case 34:return m>=d;case 35:return m<=d;default:throw y.thrown("Unreachable")}break;default:let w="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(s),b=l,C;if(b!=null)C=b;else{let E=this.get_currentScope(),T=E!=null?E.node:null;C=T!=null?T.pos:null}throw y.thrown(new pe(w,C??this.script.pos))}break;default:let c="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,_;if(f!=null)_=f;else{let m=this.get_currentScope(),d=m!=null?m.node:null;_=d!=null?d.pos:null}throw y.thrown(new pe(c,_??this.script.pos))}break;case 36:let r=e.word;if(n._hx_index==3)if(s._hx_index==3)switch(e._hx_index){case 36:let c=e.word;return t?i:!1;case 37:let f=e.word;return t?!0:i;default:throw y.thrown("Unreachable")}else{let c="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,_;if(f!=null)_=f;else{let m=this.get_currentScope(),d=m!=null?m.node:null;_=d!=null?d.pos:null}throw y.thrown(new pe(c,_??this.script.pos))}else{let c="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,_;if(f!=null)_=f;else{let m=this.get_currentScope(),d=m!=null?m.node:null;_=d!=null?d.pos:null}throw y.thrown(new pe(c,_??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 36:let c=e.word;return t?i:!1;case 37:let f=e.word;return t?!0:i;default:throw y.thrown("Unreachable")}else{let c="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,_;if(f!=null)_=f;else{let m=this.get_currentScope(),d=m!=null?m.node:null;_=d!=null?d.pos:null}throw y.thrown(new pe(c,_??this.script.pos))}else{let c="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,_;if(f!=null)_=f;else{let m=this.get_currentScope(),d=m!=null?m.node:null;_=d!=null?d.pos:null}throw y.thrown(new pe(c,_??this.script.pos))}break;default:let a="Invalid operation: "+te.string(e),o=l,u;if(o!=null)u=o;else{let c=this.get_currentScope(),f=c!=null?c.node:null;u=f!=null?f.pos:null}throw y.thrown(new pe(a,u??this.script.pos))}}valueToString(e){return e==null?"null":te.string(e)}printLoreline(e){try{let t=new tl;return t.enableComments=!1,Be.trim(t.print(e))}catch{return null}}}z["loreline.Interpreter"]=Gi.loreline.Interpreter=xl,xl.__name__="loreline.Interpreter",Object.assign(xl.prototype,{__class__:xl,__properties__:{get_currentInsertion:"get_currentInsertion",get_currentScope:"get_currentScope"}});class rn{static stringify(e,t){return t==null&&(t=!1),JSON.stringify(e,null,t?" ":null)}static parse(e){return JSON.parse(e)}}z["loreline.Json"]=rn,rn.__name__="loreline.Json";class ri{constructor(e,t){this.target=e,this.origin=t}}z["loreline.Reference"]=ri,ri.__name__="loreline.Reference",Object.assign(ri.prototype,{__class__:ri});class jl{constructor(e){this.error=null,this.expr=null,this.hscript=null,this.func=e,this.codeToHscript=new qi;try{this.hscript=this.codeToHscript.process(e.code)}catch(t){let i=y.caught(t).unwrap();i instanceof si&&(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 Xi;t.resumeErrors=!1,t.allowJSON=!0,t.allowTypes=!0;let i=e.name;this.expr=t.parseString(this.hscript,i??"?")}catch(t){let i=y.caught(t).unwrap();if(this.error==null)if(i instanceof ye){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 bl(l,n,this.codeToHscript.toLorelinePos(e.pos,l.pmin,l.pmax))}else i instanceof si&&(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 Xi;l.resumeErrors=!0,l.allowJSON=!0,l.allowTypes=!0;let n=e.name;this.expr=l.parseString(this.hscript,n??"?")}catch{}}}}z["loreline.FuncHscript"]=jl,jl.__name__="loreline.FuncHscript",Object.assign(jl.prototype,{__class__:jl});class Rl{constructor(e,t){this.completion=null,this.locals=null,e!=null&&(this.locals=e),t!=null&&(this.completion=t)}}z["loreline.HscriptCompletion"]=Rl,Rl.__name__="loreline.HscriptCompletion",Object.assign(Rl.prototype,{__class__:Rl});class Vl{constructor(e){this.hscriptFunctions=new Wi,this.childNodes=new Wi,this.parentNodes=new Wi,this.nodesById=new Wi,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 Y.__instanceof(n,e)&&i.push(n),t||n==l.script?!0:!(n instanceof Zt||n instanceof ci)}),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&&Y.getClass(i)==t)return i;return null}getImportedPaths(e){let t=[];return this._getImportedPaths(e,this.script,t,new Se),t}_getImportedPaths(e,t,i,l){let n=Pt.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 Zt){let o=a,u,c=o.path.parts[0].partType;c._hx_index==0?u=c.text:u="",Pt.isAbsolute(u)||(u=Pt.join([n,u])),u=Pt.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 pt?t=this.resolveAccess(e.target):e.target instanceof ui&&(t=this.resolveArrayAccess(e.target)),t==null)return null;switch(Y.getClass(t)){case qe:let i=t;if(i.literalType==Qe.Array){let n=i.value;if(e.index instanceof qe){let s=e.index;if(s.literalType==Qe.Number){let r=s.value|0;if(r>=0&&r<n.length){let h=n[r];if(h instanceof Nt)return h}}}}break;case Di:let l=t;if(l.value instanceof qe){let n=l.value;if(n.literalType==Qe.Array){let s=n.value;if(e.index instanceof qe){let r=e.index;if(r.literalType==Qe.Number){let h=r.value|0;if(h>=0&&h<s.length){let a=s[h];if(a instanceof Nt)return a}}}}}break;default:}return null}resolveAccess(e){if(e.target!=null){let h=e.target instanceof pt?this.resolveAccess(e.target):e.target instanceof ui?this.resolveArrayAccess(e.target):null;if(h!=null)switch(h instanceof Di&&(h=h.value),Y.getClass(h)){case Gt:let a=h,o=0,u=a.fields;for(;o<u.length;){let _=u[o];if(++o,_.name==e.name)return _}break;case qe:let c=h,f=c.literalType;if(f._hx_index==4){let _=f.style,m=c.value,d=0;for(;d<m.length;){let w=m[d];if(++d,w.name==e.name)return w}}break;default:}return null}let t=e.name;if(t==null)return null;let i=this.getFirstParentOfType(e,We);for(;i!=null;){let h=null;if(this.traverse(i,function(a,o){if(h!=null)return!1;if(a instanceof Jt){let u=a,c=0,f=u.fields;for(;c<f.length;){let _=f[c];if(++c,_.name==t)return h=_,!1}}return!0}),h!=null)return h;i=this.getFirstParentOfType(i,We)}let l=null;if(this.traverse(this.script,function(h,a){if(l!=null)return!1;if(h instanceof Jt){let o=h,u=0,c=o.fields;for(;u<c.length;){let f=c[u];if(++u,f.name==t)return l=f,!1}}return h instanceof Zt?!0:h instanceof ci}),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 We){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 We?e:null;{let t=this.getFirstParentOfType(e,We);for(;t!=null&&!this.isTopLevelNode(t);)t=this.getFirstParentOfType(t,We);if(t!=null&&t instanceof We)return t}return null}findBeatByNameFromNode(e,t){let i=null,l=this.getFirstParentOfType(t,We);for(;l!=null;)this.traverse(l,function(n,s){if(i!=null||n==t)return!1;if(n instanceof We){let r=n;return r.name==e&&(i=r),!1}return!0}),l=this.getFirstParentOfType(l,We);return i==null&&this.traverse(this.script,function(n,s){if(i==null&&n instanceof We){let r=n;r.name==e&&(i=r)}return n instanceof Zt?!0:n instanceof ci}),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 Gt){let s=l;s.name==e&&(i=s)}return l instanceof Zt?!0:l instanceof ci}),i}findFunctionByNameFromNode(e,t){let i=null;return this.traverse(this.script,function(l,n){if(i==null&&l instanceof ji){let s=l;s.name==e&&(i=s)}return l instanceof Zt?!0:l instanceof ci}),i}getVisibleCharacters(){let e=[],t=this.script.iterator();for(;t.hasNext();){let i=t.next();i instanceof Gt&&e.push(i)}return e}getVisibleFunctions(){let e=[],t=this.script.iterator();for(;t.hasNext();){let i=t.next();i instanceof ji&&e.push(i)}return e}getVisibleStateFields(e){let t=[],i=new _i,l=e;for(;l!=null;){if(Y.getClass(l)==Jt){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(Y.getClass(n)==Jt){let r=n;if(s instanceof ci){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(Y.getClass(l)==We&&this.getParentNode(l)!=null){let s=0,r=this.getNodesOfType(We);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(Y.getClass(n)==We&&s instanceof ci){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 f=c[u];if(++u,f.isHash){let _=Be.trim(f.content);e[_]=!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 Se;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=Be.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 _i,i=this;this.traverse(e,function(r,h){switch(Y.getClass(r)){case Vt:let a=r;if(a.target instanceof pt){let _=a.target;if(_.target==null){let m=i.findBeatFromAccess(_);if(m!=null){let d=m.id,w=new ri(m,a),b=d.thisVal;t._set(b.high,b.low,w)}}}break;case zi:let o=r,u=i.findBeatByNameFromNode(o.target,o);if(u!=null){let _=u.id,m=new ri(u,o),d=_.thisVal;t._set(d.high,d.low,m)}break;case Ni:let c=r,f=i.findBeatByNameFromNode(c.target,c);if(f!=null){let _=f.id,m=new ri(f,c),d=_.thisVal;t._set(d.high,d.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(Y.getClass(l)){case Vt:let s=l;if(s.target instanceof pt){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 ri(e,s))}}break;case zi:let r=l;r.target==e.name&&t.push(new ri(e,r));break;case Ni:let h=l;h.target==e.name&&t.push(new ri(e,h));break;default:}}),t}findModifiedStateFields(e){let t=Object.create(null),i=this;this.traverse(e,function(u,c){if(Y.getClass(u)==di){let f=u;if(f.target instanceof pt){let _=f.target,m=i.findStateField(_);if(m!=null){let d=m.name,w=new ri(m,f);t[d]=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 f=u.target.name.toLowerCase(),_=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(Y.getClass(u)==pt){let f=u;if(c instanceof di&&c.target==u)return!0;let _=i.findStateField(f);if(_!=null){let m=_.name,d=new ri(_,f);t[m]=d}}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 f=u.target.name.toLowerCase(),_=c.target.name.toLowerCase();return f<_?-1:f>_?1:0}),o}findBeatCharacters(e){let t=new _i,i=this;this.traverse(e,function(h,a){switch(Y.getClass(h)){case pt:let o=h;if(o.target==null){let f=i.findCharacterByNameFromNode(o.name,o);if(f!=null){let _=f.id,m=new ri(f,o),d=_.thisVal;t._set(d.high,d.low,m)}}break;case hi:let u=h,c=i.findCharacterFromDialogue(u);if(c!=null){let f=c.id,_=new ri(c,u),m=f.thisVal;t._set(m.high,m.low,_)}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 _i,i=[],l=this;return this.traverse(e,function(n,s){if(Y.getClass(n)==di){let r=n;if(r.target instanceof pt){let h=r.target,a=l.resolveAccess(h);if(a instanceof Di){let o=a.id.thisVal;if(!t._exists(o.high,o.low)&&l.getParentNode(a)instanceof Gt){let c=a.id.thisVal;t._set(c.high,c.low,!0),i.push(new ri(a,n))}}}}return!0}),i}findReadCharacterFields(e){let t=new _i,i=[],l=this;return this.traverse(e,function(n,s){if(Y.getClass(n)==pt){let r=n,h=l.getParentNode(r);if(h instanceof di&&h.target==r)return!0;let a=l.resolveAccess(r);if(a instanceof Di){let o=a.id.thisVal;if(!t._exists(o.high,o.low)&&l.getParentNode(a)instanceof Gt){let c=a.id.thisVal;t._set(c.high,c.low,!0),i.push(new ri(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 jl(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),$l.iter(r,s)}},$l.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(f instanceof Jt){let m=f,d=0,w=m.fields;for(;d<w.length;){let b=w[d];if(++d,b.name==l)return n=b,!1}}return f instanceof Zt?!0:f instanceof ci}),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 Di&&(o=o.value),Y.getClass(o)){case Gt:let f=o,_=0,m=f.fields;for(;_<m.length;){let b=m[_];if(++_,b.name==a)return b}break;case qe:let d=o,w=d.literalType;if(w._hx_index==4){let b=w.style,C=d.value,E=0;for(;E<C.length;){let T=C[E];if(++E,T.name==a)return T}}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")?Y.__instanceof(je.field(e,"e"),F):!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="",f=0,_=a-u;for(;f<_;){let b=f++;c+=String.fromCodePoint(32)}h=c+h;let m=null,d=new Ze;try{d.types.parser.allowJSON=!0,d.types.parser.allowTypes=!0,d.types.parser.resumeErrors=!0;let b=d.types.parser.parseString(h);d.check(b,null,!0)}catch(b){let C=y.caught(b).unwrap();C instanceof fl&&(m=C)}let w=d.locals;return new Rl(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}}z["loreline.Lens"]=Vl,Vl.__name__="loreline.Lens",Object.assign(Vl.prototype,{__class__:Vl});class el extends si{constructor(e,t){super(e,t)}}z["loreline.LexerError"]=el,el.__name__="loreline.LexerError",el.__super__=si,Object.assign(el.prototype,{__class__:el});var Ii=Je["loreline.LStringAttachment"]={__ename__:"loreline.LStringAttachment",__constructs__:null,Interpolation:(g=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}},g._hx_name="Interpolation",g.__params__=["braces","inTag","expr","start","length"],g),Tag:(g=function(k,e,t){return{_hx_index:1,closing:k,start:e,length:t,__enum__:"loreline.LStringAttachment",toString:S}},g._hx_name="Tag",g.__params__=["closing","start","length"],g)};Ii.__constructs__=[Ii.Interpolation,Ii.Tag];class Pi{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=Je["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:(g=function(k,e,t,i){return{_hx_index:14,name:k,args:e,code:t,external:i,__enum__:"loreline.TokenType",toString:S}},g._hx_name="Function",g.__params__=["name","args","code","external"],g),LString:(g=function(k,e,t){return{_hx_index:15,quotes:k,s:e,attachments:t,__enum__:"loreline.TokenType",toString:S}},g._hx_name="LString",g.__params__=["quotes","s","attachments"],g),LNumber:(g=function(k){return{_hx_index:16,n:k,__enum__:"loreline.TokenType",toString:S}},g._hx_name="LNumber",g.__params__=["n"],g),LBoolean:(g=function(k){return{_hx_index:17,b:k,__enum__:"loreline.TokenType",toString:S}},g._hx_name="LBoolean",g.__params__=["b"],g),LNull:{_hx_name:"LNull",_hx_index:18,__enum__:"loreline.TokenType",toString:S},Identifier:(g=function(k){return{_hx_index:19,name:k,__enum__:"loreline.TokenType",toString:S}},g._hx_name="Identifier",g.__params__=["name"],g),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},OpPlus:{_hx_name:"OpPlus",_hx_index:25,__enum__:"loreline.TokenType",toString:S},OpMinus:{_hx_name:"OpMinus",_hx_index:26,__enum__:"loreline.TokenType",toString:S},OpMultiply:{_hx_name:"OpMultiply",_hx_index:27,__enum__:"loreline.TokenType",toString:S},OpDivide:{_hx_name:"OpDivide",_hx_index:28,__enum__:"loreline.TokenType",toString:S},OpModulo:{_hx_name:"OpModulo",_hx_index:29,__enum__:"loreline.TokenType",toString:S},OpEquals:{_hx_name:"OpEquals",_hx_index:30,__enum__:"loreline.TokenType",toString:S},OpNotEquals:{_hx_name:"OpNotEquals",_hx_index:31,__enum__:"loreline.TokenType",toString:S},OpGreater:{_hx_name:"OpGreater",_hx_index:32,__enum__:"loreline.TokenType",toString:S},OpLess:{_hx_name:"OpLess",_hx_index:33,__enum__:"loreline.TokenType",toString:S},OpGreaterEq:{_hx_name:"OpGreaterEq",_hx_index:34,__enum__:"loreline.TokenType",toString:S},OpLessEq:{_hx_name:"OpLessEq",_hx_index:35,__enum__:"loreline.TokenType",toString:S},OpAnd:(g=function(k){return{_hx_index:36,word:k,__enum__:"loreline.TokenType",toString:S}},g._hx_name="OpAnd",g.__params__=["word"],g),OpOr:(g=function(k){return{_hx_index:37,word:k,__enum__:"loreline.TokenType",toString:S}},g._hx_name="OpOr",g.__params__=["word"],g),OpNot:{_hx_name:"OpNot",_hx_index:38,__enum__:"loreline.TokenType",toString:S},Arrow:{_hx_name:"Arrow",_hx_index:39,__enum__:"loreline.TokenType",toString:S},Colon:{_hx_name:"Colon",_hx_index:40,__enum__:"loreline.TokenType",toString:S},Comma:{_hx_name:"Comma",_hx_index:41,__enum__:"loreline.TokenType",toString:S},Dot:{_hx_name:"Dot",_hx_index:42,__enum__:"loreline.TokenType",toString:S},LBrace:{_hx_name:"LBrace",_hx_index:43,__enum__:"loreline.TokenType",toString:S},RBrace:{_hx_name:"RBrace",_hx_index:44,__enum__:"loreline.TokenType",toString:S},LParen:{_hx_name:"LParen",_hx_index:45,__enum__:"loreline.TokenType",toString:S},RParen:{_hx_name:"RParen",_hx_index:46,__enum__:"loreline.TokenType",toString:S},LBracket:{_hx_name:"LBracket",_hx_index:47,__enum__:"loreline.TokenType",toString:S},RBracket:{_hx_name:"RBracket",_hx_index:48,__enum__:"loreline.TokenType",toString:S},CommentLine:(g=function(k){return{_hx_index:49,content:k,__enum__:"loreline.TokenType",toString:S}},g._hx_name="CommentLine",g.__params__=["content"],g),CommentMultiLine:(g=function(k){return{_hx_index:50,content:k,__enum__:"loreline.TokenType",toString:S}},g._hx_name="CommentMultiLine",g.__params__=["content"],g),CommentHash:(g=function(k){return{_hx_index:51,content:k,__enum__:"loreline.TokenType",toString:S}},g._hx_name="CommentHash",g.__params__=["content"],g),Indent:{_hx_name:"Indent",_hx_index:52,__enum__:"loreline.TokenType",toString:S},Unindent:{_hx_name:"Unindent",_hx_index:53,__enum__:"loreline.TokenType",toString:S},LineBreak:{_hx_name:"LineBreak",_hx_index:54,__enum__:"loreline.TokenType",toString:S},Eof:{_hx_name:"Eof",_hx_index:55,__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.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.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 Ft{static equals(e,t){switch(e._hx_index){case 1:return t._hx_index==1?!0:ce.enumEq(e,t);case 2:return t._hx_index==2?!0:ce.enumEq(e,t);case 3:return t._hx_index==3?!0:ce.enumEq(e,t);case 4:return t._hx_index==4?!0:ce.enumEq(e,t);case 5:return t._hx_index==5?!0:ce.enumEq(e,t);case 6:return t._hx_index==6?!0:ce.enumEq(e,t);case 7:return t._hx_index==7?!0:ce.enumEq(e,t);case 8:return t._hx_index==8?!0:ce.enumEq(e,t);case 9:return t._hx_index==9?!0:ce.enumEq(e,t);case 10:return t._hx_index==10?!0:ce.enumEq(e,t);case 11:return t._hx_index==11?!0:ce.enumEq(e,t);case 12:return t._hx_index==12?!0:ce.enumEq(e,t);case 13:return t._hx_index==13?!0:ce.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 ce.enumEq(e,t);break;case 16:if(t._hx_index==16){let r=t.n;return e.n==r}else return ce.enumEq(e,t);break;case 17:if(t._hx_index==17){let r=t.b;return e.b==r}else return ce.enumEq(e,t);break;case 18:return t._hx_index==18?!0:ce.enumEq(e,t);case 19:if(t._hx_index==19){let r=t.name;return e.name==r}else return ce.enumEq(e,t);break;case 20:return t._hx_index==20?!0:ce.enumEq(e,t);case 21:return t._hx_index==21?!0:ce.enumEq(e,t);case 22:return t._hx_index==22?!0:ce.enumEq(e,t);case 23:return t._hx_index==23?!0:ce.enumEq(e,t);case 24:return t._hx_index==24?!0:ce.enumEq(e,t);case 25:return t._hx_index==25?!0:ce.enumEq(e,t);case 26:return t._hx_index==26?!0:ce.enumEq(e,t);case 27:return t._hx_index==27?!0:ce.enumEq(e,t);case 28:return t._hx_index==28?!0:ce.enumEq(e,t);case 29:return t._hx_index==29?!0:ce.enumEq(e,t);case 30:return t._hx_index==30?!0:ce.enumEq(e,t);case 31:return t._hx_index==31?!0:ce.enumEq(e,t);case 32:return t._hx_index==32?!0:ce.enumEq(e,t);case 33:return t._hx_index==33?!0:ce.enumEq(e,t);case 34:return t._hx_index==34?!0:ce.enumEq(e,t);case 35:return t._hx_index==35?!0:ce.enumEq(e,t);case 36:let n=e.word;if(t._hx_index==36){let r=t.word;return!0}else return ce.enumEq(e,t);break;case 37:let s=e.word;if(t._hx_index==37){let r=t.word;return!0}else return ce.enumEq(e,t);break;case 38:return t._hx_index==38?!0:ce.enumEq(e,t);case 39:return t._hx_index==39?!0:ce.enumEq(e,t);case 40:return t._hx_index==40?!0:ce.enumEq(e,t);case 42:return t._hx_index==42?!0:ce.enumEq(e,t);case 43:return t._hx_index==43?!0:ce.enumEq(e,t);case 44:return t._hx_index==44?!0:ce.enumEq(e,t);case 45:return t._hx_index==45?!0:ce.enumEq(e,t);case 46:return t._hx_index==46?!0:ce.enumEq(e,t);case 47:return t._hx_index==47?!0:ce.enumEq(e,t);case 48:return t._hx_index==48?!0:ce.enumEq(e,t);case 49:if(t._hx_index==49){let r=t.content;return e.content==r}else return ce.enumEq(e,t);break;case 50:if(t._hx_index==50){let r=t.content;return e.content==r}else return ce.enumEq(e,t);break;case 51:if(t._hx_index==51){let r=t.content;return e.content==r}else return ce.enumEq(e,t);break;case 52:return t._hx_index==52?!0:ce.enumEq(e,t);case 53:return t._hx_index==53?!0:ce.enumEq(e,t);case 54:return t._hx_index==54?!0:ce.enumEq(e,t);case 55:return t._hx_index==55?!0:ce.enumEq(e,t);default:return ce.enumEq(e,t)}}static isComment(e){switch(e._hx_index){case 49:let t=e.content;return!0;case 50:let i=e.content;return!0;case 51: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: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 e.word?"and":"&&";case 37:return e.word?"or":"||";case 38:return"!";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:let _=e.content;return"comment";case 50:let m=e.content;return"multiline comment";case 51:let d=e.content;return"hash comment";case 52:return"indent";case 53:return"unindent";case 54:return"line break";case 55:return"end of file"}}}z["loreline.TokenTypeHelpers"]=Ft,Ft.__name__="loreline.TokenTypeHelpers";class xe{constructor(e,t){this.type=e,this.pos=t}toString(){return""+te.string(this.type)+" at "+this.pos.toString()}}z["loreline.Token"]=xe,xe.__name__="loreline.Token",Object.assign(xe.prototype,{__class__:xe});class bt{constructor(e){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 ne(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new xe(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 43: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 47:this.stack.push(12),this.nextBlock=10;break;case 44:case 48:case 53:this.stack.pop(),this.nextBlock=10;break;case 52: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 ne(this.startLine,this.startColumn,this.pos)),l.length=this.pos-l.offset;let n=new xe(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 ne(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new xe(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 ne(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new xe(x.Unindent,r);this.previous=h,s.push(h)}return l}let i=new ne(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:return this.readString(i);case 91:let l=0,n=1;for(;l<n;){let w=l++;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++}this.makeLooseOrStrictAfterBracket();let s=i;s==null&&(s=new ne(this.startLine,this.startColumn,this.pos)),s.length=this.pos-s.offset;let r=new xe(x.LBracket,s);return this.previous=r,r;case 123:let h=0,a=1;for(;h<a;){let w=h++;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 o=i;o==null&&(o=new ne(this.startLine,this.startColumn,this.pos)),o.length=this.pos-o.offset;let u=new xe(x.LBrace,o);return this.previous=u,u;case 125:let c=0,f=1;for(;c<f;){let w=c++;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 _=i;_==null&&(_=new ne(this.startLine,this.startColumn,this.pos)),_.length=this.pos-_.offset;let m=new xe(x.RBrace,_);return this.previous=m,m;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 X=t;if(X>=97&&X<=122||X>=65&&X<=90||X==95)return this.readIdentifier();{let ee;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);ee=j??-1}else ee=0;if(ee==61){let j=2;j==null&&(j=1);let le=0,Z=j;for(;le<Z;){let ae=le++;if(this.pos>=this.length)break;let be=p.cca(this.input,this.pos);(be??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new ne(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let se=new xe(x.OpNotEquals,Q);return this.previous=se,se}else{let j=0,le=1;for(;j<le;){let se=j++;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 Z=i;Z==null&&(Z=new ne(this.startLine,this.startColumn,this.pos)),Z.length=this.pos-Z.offset;let Q=new xe(x.OpNot,Z);return this.previous=Q,Q}}}break;case 35:let b=t;if(b>=48&&b<=57)return this.readNumber();{let X=t;if(X>=97&&X<=122||X>=65&&X<=90||X==95)return this.readIdentifier();{let ee;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);ee=j??-1}else ee=0;return ee>=97&&ee<=122||ee>=65&&ee<=90||ee==95||ee>=48&&ee<=57||ee==45?this.readHashComment():(this.error("Unexpected character: #",!0),null)}}break;case 37:let C=t;if(C>=48&&C<=57)return this.readNumber();{let X=t;if(X>=97&&X<=122||X>=65&&X<=90||X==95)return this.readIdentifier();{let ee=0,j=1;for(;ee<j;){let Q=ee++;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 le=i;le==null&&(le=new ne(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let Z=new xe(x.OpModulo,le);return this.previous=Z,Z}}break;case 38:let E=t;if(E>=48&&E<=57)return this.readNumber();{let X=t;if(X>=97&&X<=122||X>=65&&X<=90||X==95)return this.readIdentifier();{let ee;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);ee=j??-1}else ee=0;if(ee==38){let j=2;j==null&&(j=1);let le=0,Z=j;for(;le<Z;){let ae=le++;if(this.pos>=this.length)break;let be=p.cca(this.input,this.pos);(be??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new ne(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let se=new xe(x.OpAnd(!1),Q);return this.previous=se,se}else{let j=0,le=1;for(;j<le;){let se=j++;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++}this.error("Expected &",!1);let Z=i;Z==null&&(Z=new ne(this.startLine,this.startColumn,this.pos)),Z.length=this.pos-Z.offset;let Q=new xe(x.OpAnd(!1),Z);return this.previous=Q,Q}}}break;case 40:let T=0,P=1;for(;T<P;){let X=T++;if(this.pos>=this.length)break;let ee=p.cca(this.input,this.pos);(ee??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.makeStrictIfFollowingCallable();let v=i;v==null&&(v=new ne(this.startLine,this.startColumn,this.pos)),v.length=this.pos-v.offset;let I=new xe(x.LParen,v);return this.previous=I,I;case 41:let O=0,L=1;for(;O<L;){let X=O++;if(this.pos>=this.length)break;let ee=p.cca(this.input,this.pos);(ee??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.strictExprs.pop();let B=i;B==null&&(B=new ne(this.startLine,this.startColumn,this.pos)),B.length=this.pos-B.offset;let A=new xe(x.RParen,B);return this.previous=A,A;case 42:let K=t;if(K>=48&&K<=57)return this.readNumber();{let X=t;if(X>=97&&X<=122||X>=65&&X<=90||X==95)return this.readIdentifier();{let ee;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);ee=j??-1}else ee=0;if(ee==61){let j=2;j==null&&(j=1);let le=0,Z=j;for(;le<Z;){let ae=le++;if(this.pos>=this.length)break;let be=p.cca(this.input,this.pos);(be??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new ne(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let se=new xe(x.OpMultiplyAssign,Q);return this.previous=se,se}else{let j=0,le=1;for(;j<le;){let se=j++;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 Z=i;Z==null&&(Z=new ne(this.startLine,this.startColumn,this.pos)),Z.length=this.pos-Z.offset;let Q=new xe(x.OpMultiply,Z);return this.previous=Q,Q}}}break;case 43:let D=t;if(D>=48&&D<=57)return this.readNumber();{let X=t;if(X>=97&&X<=122||X>=65&&X<=90||X==95)return this.readIdentifier();{let ee;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);ee=j??-1}else ee=0;if(ee==61){let j=2;j==null&&(j=1);let le=0,Z=j;for(;le<Z;){let ae=le++;if(this.pos>=this.length)break;let be=p.cca(this.input,this.pos);(be??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new ne(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let se=new xe(x.OpPlusAssign,Q);return this.previous=se,se}else{let j=0,le=1;for(;j<le;){let se=j++;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 Z=i;Z==null&&(Z=new ne(this.startLine,this.startColumn,this.pos)),Z.length=this.pos-Z.offset;let Q=new xe(x.OpPlus,Z);return this.previous=Q,Q}}}break;case 44:let M=0,V=1;for(;M<V;){let X=M++;if(this.pos>=this.length)break;let ee=p.cca(this.input,this.pos);(ee??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let N=i;N==null&&(N=new ne(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let U=new xe(x.Comma,N);return this.previous=U,U;case 45:let q=t;if(q>=48&&q<=57)return this.readNumber();{let X=t;if(X>=97&&X<=122||X>=65&&X<=90||X==95)return this.readIdentifier();{let ee;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);ee=j??-1}else ee=0;if(ee==62){let j=2;j==null&&(j=1);let le=0,Z=j;for(;le<Z;){let ae=le++;if(this.pos>=this.length)break;let be=p.cca(this.input,this.pos);(be??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new ne(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let se=new xe(x.Arrow,Q);return this.previous=se,se}else{let j;if(this.pos+1<this.length){let le=p.cca(this.input,this.pos+1);j=le??-1}else j=0;if(j==45&&this.strictExprs.length==0){let le=2;le==null&&(le=1);let Z=0,Q=le;for(;Z<Q;){let be=Z++;if(this.pos>=this.length)break;let et=p.cca(this.input,this.pos);(et??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let se=i;se==null&&(se=new ne(this.startLine,this.startColumn,this.pos)),se.length=this.pos-se.offset;let ae=new xe(x.Separator,se);return this.previous=ae,ae}else{let le;if(this.pos+1<this.length){let Z=p.cca(this.input,this.pos+1);le=Z??-1}else le=0;if(le==61){let Z=2;Z==null&&(Z=1);let Q=0,se=Z;for(;Q<se;){let et=Q++;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 ae=i;ae==null&&(ae=new ne(this.startLine,this.startColumn,this.pos)),ae.length=this.pos-ae.offset;let be=new xe(x.OpMinusAssign,ae);return this.previous=be,be}else{let Z=0,Q=1;for(;Z<Q;){let be=Z++;if(this.pos>=this.length)break;let et=p.cca(this.input,this.pos);(et??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let se=i;se==null&&(se=new ne(this.startLine,this.startColumn,this.pos)),se.length=this.pos-se.offset;let ae=new xe(x.OpMinus,se);return this.previous=ae,ae}}}}}break;case 46:let J=0,G=1;for(;J<G;){let X=J++;if(this.pos>=this.length)break;let ee=p.cca(this.input,this.pos);(ee??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let H=i;H==null&&(H=new ne(this.startLine,this.startColumn,this.pos)),H.length=this.pos-H.offset;let re=new xe(x.Dot,H);return this.previous=re,re;case 47:let _e=t;if(_e>=48&&_e<=57)return this.readNumber();{let X=t;if(X>=97&&X<=122||X>=65&&X<=90||X==95)return this.readIdentifier();{let ee;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);ee=j??-1}else ee=0;if(ee==61){let j=2;j==null&&(j=1);let le=0,Z=j;for(;le<Z;){let ae=le++;if(this.pos>=this.length)break;let be=p.cca(this.input,this.pos);(be??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new ne(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let se=new xe(x.OpDivideAssign,Q);return this.previous=se,se}else{let j;if(this.pos+1<this.length){let le=p.cca(this.input,this.pos+1);j=le??-1}else j=0;if(j==47)return this.readLineComment();{let le;if(this.pos+1<this.length){let Z=p.cca(this.input,this.pos+1);le=Z??-1}else le=0;if(le==42)return this.readMultiLineComment();{let Z=0,Q=1;for(;Z<Q;){let be=Z++;if(this.pos>=this.length)break;let et=p.cca(this.input,this.pos);(et??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let se=i;se==null&&(se=new ne(this.startLine,this.startColumn,this.pos)),se.length=this.pos-se.offset;let ae=new xe(x.OpDivide,se);return this.previous=ae,ae}}}}}break;case 58:let ue=0,de=1;for(;ue<de;){let X=ue++;if(this.pos>=this.length)break;let ee=p.cca(this.input,this.pos);(ee??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let fe=i;fe==null&&(fe=new ne(this.startLine,this.startColumn,this.pos)),fe.length=this.pos-fe.offset;let ge=new xe(x.Colon,fe);return this.previous=ge,ge;case 60:let Ne=t;if(Ne>=48&&Ne<=57)return this.readNumber();{let X=t;if(X>=97&&X<=122||X>=65&&X<=90||X==95)return this.readIdentifier();{let ee;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);ee=j??-1}else ee=0;if(ee==61){let j=2;j==null&&(j=1);let le=0,Z=j;for(;le<Z;){let ae=le++;if(this.pos>=this.length)break;let be=p.cca(this.input,this.pos);(be??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new ne(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let se=new xe(x.OpLessEq,Q);return this.previous=se,se}else{let j=0,le=1;for(;j<le;){let se=j++;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 Z=i;Z==null&&(Z=new ne(this.startLine,this.startColumn,this.pos)),Z.length=this.pos-Z.offset;let Q=new xe(x.OpLess,Z);return this.previous=Q,Q}}}break;case 61:let Fe=t;if(Fe>=48&&Fe<=57)return this.readNumber();{let X=t;if(X>=97&&X<=122||X>=65&&X<=90||X==95)return this.readIdentifier();{let ee;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);ee=j??-1}else ee=0;if(ee==61){let j=2;j==null&&(j=1);let le=0,Z=j;for(;le<Z;){let ae=le++;if(this.pos>=this.length)break;let be=p.cca(this.input,this.pos);(be??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new ne(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let se=new xe(x.OpEquals,Q);return this.previous=se,se}else{let j=0,le=1;for(;j<le;){let se=j++;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 Z=i;Z==null&&(Z=new ne(this.startLine,this.startColumn,this.pos)),Z.length=this.pos-Z.offset;let Q=new xe(x.OpAssign,Z);return this.previous=Q,Q}}}break;case 62:let Re=t;if(Re>=48&&Re<=57)return this.readNumber();{let X=t;if(X>=97&&X<=122||X>=65&&X<=90||X==95)return this.readIdentifier();{let ee;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);ee=j??-1}else ee=0;if(ee==61){let j=2;j==null&&(j=1);let le=0,Z=j;for(;le<Z;){let ae=le++;if(this.pos>=this.length)break;let be=p.cca(this.input,this.pos);(be??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new ne(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let se=new xe(x.OpGreaterEq,Q);return this.previous=se,se}else{let j=0,le=1;for(;j<le;){let se=j++;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 Z=i;Z==null&&(Z=new ne(this.startLine,this.startColumn,this.pos)),Z.length=this.pos-Z.offset;let Q=new xe(x.OpGreater,Z);return this.previous=Q,Q}}}break;case 93:let Ye=0,Ke=1;for(;Ye<Ke;){let X=Ye++;if(this.pos>=this.length)break;let ee=p.cca(this.input,this.pos);(ee??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.strictExprs.pop();let Ve=i;Ve==null&&(Ve=new ne(this.startLine,this.startColumn,this.pos)),Ve.length=this.pos-Ve.offset;let nt=new xe(x.RBracket,Ve);return this.previous=nt,nt;case 124:let Ae=t;if(Ae>=48&&Ae<=57)return this.readNumber();{let X=t;if(X>=97&&X<=122||X>=65&&X<=90||X==95)return this.readIdentifier();{let ee;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);ee=j??-1}else ee=0;if(ee==124){let j=2;j==null&&(j=1);let le=0,Z=j;for(;le<Z;){let ae=le++;if(this.pos>=this.length)break;let be=p.cca(this.input,this.pos);(be??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new ne(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let se=new xe(x.OpOr(!1),Q);return this.previous=se,se}else{let j=0,le=1;for(;j<le;){let se=j++;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++}this.error("Expected |",!1);let Z=i;Z==null&&(Z=new ne(this.startLine,this.startColumn,this.pos)),Z.length=this.pos-Z.offset;let Q=new xe(x.OpOr(!1),Z);return this.previous=Q,Q}}}break;default:let $e=t;if($e>=48&&$e<=57)return this.readNumber();{let X=t;return X>=97&&X<=122||X>=65&&X<=90||X==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 ne(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 ne(this.startLine,this.startColumn,this.pos)),i.length=this.pos-i.offset;let l=new xe(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 T=!0,P=a.length;if(e>=P)T=!1;else{let v,I,O;if(e+1<P){let L=p.cca(a.input,e);O=(L??-1)==111}else O=!1;if(O){let L=p.cca(a.input,e+1);I=(L??-1)==114}else I=!1;if(I)if(e+2<P){let L=p.cca(a.input,e+2),B=L??-1;v=!(B>=97&&B<=122||B>=65&&B<=90||B==95)}else v=!0;else v=!1;if(v)T=!1;else{let L,B,A,K;if(e+2<P){let D=p.cca(a.input,e);K=(D??-1)==97}else K=!1;if(K){let D=p.cca(a.input,e+1);A=(D??-1)==110}else A=!1;if(A){let D=p.cca(a.input,e+2);B=(D??-1)==100}else B=!1;if(B)if(e+3<P){let D=p.cca(a.input,e+3),M=D??-1;L=!(M>=97&&M<=122||M>=65&&M<=90||M==95)}else L=!0;else L=!1;if(L)T=!1;else{let D=p.cca(a.input,e),M=D??-1;if(!(M>=97&&M<=122||M>=65&&M<=90||M==95))T=!1;else for(++e;e<a.length;){let V=p.cca(a.input,e);if(M=V??-1,!(M>=97&&M<=122||M>=65&&M<=90||M==95||M>=48&&M<=57))break;++e}}}}if(!T)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 T=!0,P=a.length;if(e>=P)T=!1;else{let I,O,L;if(e+1<P){let B=p.cca(a.input,e);L=(B??-1)==111}else L=!1;if(L){let B=p.cca(a.input,e+1);O=(B??-1)==114}else O=!1;if(O)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)T=!1;else{let B,A,K,D;if(e+2<P){let M=p.cca(a.input,e);D=(M??-1)==97}else D=!1;if(D){let M=p.cca(a.input,e+1);K=(M??-1)==110}else K=!1;if(K){let M=p.cca(a.input,e+2);A=(M??-1)==100}else A=!1;if(A)if(e+3<P){let M=p.cca(a.input,e+3),V=M??-1;B=!(V>=97&&V<=122||V>=65&&V<=90||V==95)}else B=!0;else B=!1;if(B)T=!1;else{let M=p.cca(a.input,e),V=M??-1;if(!(V>=97&&V<=122||V>=65&&V<=90||V==95))T=!1;else for(++e;e<a.length;){let N=p.cca(a.input,e);if(V=N??-1,!(V>=97&&V<=122||V>=65&&V<=90||V==95||V>=48&&V<=57))break;++e}}}}if(!T||(e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!0;let v=p.cca(this.input,e);c=v??-1}if(c==91){++e;let T=1;for(;e<this.length&&T>0;){let v=p.cca(this.input,e);c=v??-1,c==91&&++T,c==93&&--T,++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 T=p.cca(this.input,e+1);m=(T??-1)==110}else m=!1;if(m){let T=p.cca(this.input,e+2);_=(T??-1)==100}else _=!1;if(_)if(e+3<this.length){let T=p.cca(this.input,e+3),P=T??-1;f=!(P>=97&&P<=122||P>=65&&P<=90||P==95)}else f=!0;else f=!1;if(f)return!0;let d,w;if(c==111){let T=p.cca(this.input,e+1);w=(T??-1)==114}else w=!1;if(w)if(e+2<this.length){let T=p.cca(this.input,e+2),P=T??-1;d=!(P>=97&&P<=122||P>=65&&P<=90||P==95)}else d=!0;else d=!1;if(d)return!0;let b,C,E;if(c==40||c==38||c==124)E=!0;else{let T=p.cca(this.input,e+1);E=(T??-1)==61&&c==61}if(E||c==62||c==60)C=!0;else if(c==33){let T=p.cca(this.input,e+1);C=(T??-1)==61}else C=!1;if(C)b=!0;else{let T=p.cca(this.input,e+1);b=(T??-1)!=61&&(c==43||c==45||c==42||c==47||c==123)}if(b)return!0;if(c==10||c==13||e>=this.length)return e=l,!0;if(c==32||c==9){let T=e;for(;;){let I;if(T<this.length){let O=p.cca(this.input,T),L=O??-1;I=L==32||L==9}else I=!1;if(!I)break;++T}let P,v;if(T+1<this.length){let I=p.cca(this.input,T);v=(I??-1)==47}else v=!1;if(v){let I=p.cca(this.input,T+1);P=(I??-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),f=c??-1;if(u=f==95,!(f>=97&&f<=122||f>=65&&f<=90||f==95))o=!1;else for(++e;e<l.length;){let _=u,m=p.cca(l.input,e);if(f=m??-1,u=f==95,!(f>=97&&f<=122||f>=65&&f<=90||f==95||f>=48&&f<=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);h=u??-1,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;if(s!=10&&s!=13&&s!=32&&s!=9&&s!=47)return!1}return!0}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(bt.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);if((r??-1)==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 if(r!=61){let a=p.cca(this.input,e+1);h=(a??-1)==61&&(r==43||r==45||r==42||r==47)}else h=!0;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 f=p.cca(i.input,e),_=f??-1;if(!(_>=97&&_<=122||_>=65&&_<=90||_==95))a=!1;else for(++e;e<i.length;){let m=p.cca(i.input,e);if(_=m??-1,!(_>=97&&_<=122||_>=65&&_<=90||_==95||_>=48&&_<=57))break;++e}}let u,c;if(e==o+2){let f=p.cca(i.input,o);c=(f??-1)==105}else c=!1;if(c){let f=p.cca(i.input,o+1);u=(f??-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);if((a??-1)==93){++e;break}++e}continue}return!1}else if(r==92)n=!0,++e;else{if(r==13||r==10)return!1;if(r>=97&&r<=122||r>=65&&r<=90||r==95){let a=!0,o=e;if(e>=i.length)a=!1;else{let f=p.cca(i.input,e),_=f??-1;if(!(_>=97&&_<=122||_>=65&&_<=90||_==95))a=!1;else for(++e;e<i.length;){let m=p.cca(i.input,e);if(_=m??-1,!(_>=97&&_<=122||_>=65&&_<=90||_==95||_>=48&&_<=57))break;++e}}let u,c;if(e==o+2){let f=p.cca(i.input,o);c=(f??-1)==105}else c=!1;if(c){let f=p.cca(i.input,o+1);u=(f??-1)==102}else u=!1;if(!(!u&&a))return!1}else++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(!Ft.isComment(i.type)&&(e||i.type!=x.LineBreak&&i.type!=x.Indent&&i.type!=x.Unindent))return i.type==x.Colon&&t>0&&Ft.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 d=p.cca(this.input,l),w=d??-1;if(w==32||w==9)++l;else break}for(;l<this.length;){let d=p.cca(this.input,l),w=d??-1;if(w==10||w==13)break;if(w==47&&l+1<this.length){let b=p.cca(this.input,l+1),C=b??-1;if(C==47)break;if(C==42){for(l+=2;l<this.length;){let E,T=p.cca(this.input,l);if((T??-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)return-1;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 d;if(u>0){let w=p.cca(this.input,u-1);if((w??-1)!=32){let b=p.cca(this.input,u-1);d=(b??-1)==9}else d=!0}else d=!1;if(!d)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=_??-1;if(m==32||m==9)f=!0;else{let d=p.cca(this.input,l);if((d??-1)==47){let w=p.cca(this.input,l+1);f=(w??-1)==47}else f=!1}return f?-1:o}isContinuingMultilineText(e,t){let i,l=p.cca(this.input,e);if((l??-1)==47){let _=p.cca(this.input,e+1);i=(_??-1)==47}else i=!1;if(i)for(;;){let _,m;if(e<this.length){let d=p.cca(this.input,e);m=(d??-1)!=13}else m=!1;if(m){let d=p.cca(this.input,e);_=(d??-1)!=10}else _=!1;if(!_)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 _,m=p.cca(this.input,e);if((m??-1)!=32){let d=p.cca(this.input,e);_=(d??-1)==9}else _=!0;if(!_)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),f=c??-1;if(f==32||f==9)u=!0;else{let _=p.cca(this.input,e);u=(_??-1)==13}if(u)o=!0;else{let _=p.cca(this.input,e);o=(_??-1)==10}if(o)a=!0;else{let _=p.cca(this.input,e);if((_??-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(!Ft.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(!Ft.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(Ft.isComment(t.type)||t.type==x.Indent||t.type==x.Unindent)--e;else return!!Ft.isAssignOp(t.type)}return!1}followsOnlyLabelOrCommentsInLine(){let e=!1,t=this.tokenized.length-1;for(;t>=0;){let i=this.tokenized[t];if(Ft.isComment(i.type)||i.type==x.Indent||i.type==x.Unindent)--t;else if(!e&&i.type==x.Colon)if(--t,t>=0)Ft.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(Ft.isComment(t.type)||t.type==x.Indent||t.type==x.Unindent)--e;else return t.type==x.LineBreak}return!0}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=bt.hasNonSpecialChar_specialChars.length;for(;h<a;){let o=h++,u=p.cca(bt.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(){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 46:case 48:this.strictExprs.push(1);return;case 49:let n=i.content;break;case 50:let s=i.content;break;case 51:let r=i.content;break;case 52:case 53:case 54: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 46:case 48:return!0;case 49:let n=i.content;break;case 50:let s=i.content;break;case 51:let r=i.content;break;case 52:case 53:case 54: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;i+=String.fromCodePoint(h),this.pos++}let l=Be.rtrim(i),n=new ne(t.line,t.column,t.offset,l.length);n==null&&(n=new ne(this.startLine,this.startColumn,this.pos)),n.length=this.pos-n.offset;let s=new xe(x.LString(0,l,[]),n);return this.previous=s,s}}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 B=p.cca(this.input,this.pos+1);i=B??-1}else i=0;if(t==47&&this.pos<this.length-1){let B=p.cca(this.input,this.pos+1),A=B??-1;if(A==47||A==42)return null}if(t==123||t==125||t==91||t==93||t==34||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=!1,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;if(o){if(this.isCallStart(this.pos)||this.isLabelStart(this.pos))return null}else if(!a&&(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))return null;let u=this.matchIdentifier(this.pos);if(u!=null&&(u=="function"||!o&&(u!="if"&&u!="null"&&u!="true"&&u!="false"&&u!="and"&&u!="or"&&Object.prototype.hasOwnProperty.call(bt.KEYWORDS.h,u)||this.isColon(this.pos+u.length))))return null;let c=!o,f=!1;if(o){if(n){if(!a&&!this.followsOnlyWhitespacesOrCommentsInLine()&&!this.isAfterComma()&&!this.isAfterLBracket())return null}else if(!s&&!a)return null}else if(f=this.followsOnlyLabelOrCommentsInLine(),!f&&!this.followsOnlyWhitespacesOrCommentsInLine()||!f&&i==62&&t==45)return null;let _=new ne(this.startLine,this.startColumn,this.pos),m="",d=[],w=this.line,b=this.column,C=this.pos,E=!1,T=-1,P=!1,v=this.column,I=this.line,O=!0,L=!1;for(;this.pos<this.length;){let B=p.cca(this.input,this.pos),A=B??-1,K=A==32||A==9;if(L||!K&&T==-1&&(A!=60||!c)&&(L=!0),E){m+=String.fromCodePoint(92),m+=String.fromCodePoint(A),E=!1;let D=0,M=1;for(;D<M;){let V=D++;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++}v+=2}else if(A==92){E=!0;let D=0,M=1;for(;D<M;){let V=D++;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++}}else if(T==-1&&K&&!L&&d.length==0){let D=0,M=1;for(;D<M;){let V=D++;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++}}else{if(T==-1&&A==123)break;{let D;if(T==-1)if(A==10||A==13)D=!0;else if(A==47&&this.pos<this.length-1){let M=p.cca(this.input,this.pos+1);D=(M??-1)==47}else D=!1;else D=!1;if(D)if(h!=-1)if(this.isContinuingMultilineText(this.pos,h)){m+=String.fromCodePoint(A);let M=0,V=1;for(;M<V;){let U=M++;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 N;if(A==13){let U=p.cca(this.input,this.pos);N=(U??-1)==10}else N=!1;if(N){m+=String.fromCodePoint(10);let U=0,q=1;for(;U<q;){let J=U++;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++}}v=this.column,I=this.line}else break;else break;else{let M;if(T==-1)if(A==47&&this.pos<this.length-1){let V=p.cca(this.input,this.pos+1);M=(V??-1)==42}else M=!1;else M=!1;if(M){m+=String.fromCodePoint(47),m+=String.fromCodePoint(42);let V=2;V==null&&(V=1);let N=0,U=V;for(;N<U;){let J=N++;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 q=!1;for(;this.pos<this.length;){let J,G=p.cca(this.input,this.pos);if((G??-1)==42&&this.pos+1<this.length){let de=p.cca(this.input,this.pos+1);J=(de??-1)==47}else J=!1;if(J){m+=String.fromCodePoint(42),m+=String.fromCodePoint(47);let de=2;de==null&&(de=1);let fe=0,ge=de;for(;fe<ge;){let Ne=fe++;if(this.pos>=this.length)break;let Fe=p.cca(this.input,this.pos);(Fe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}q=!0;break}let H=p.cca(this.input,this.pos),re=H??-1;m+=String.fromCodePoint(re);let _e=0,ue=1;for(;_e<ue;){let de=_e++;if(this.pos>=this.length)break;let fe=p.cca(this.input,this.pos);(fe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}v=this.column,I=this.line,q||this.error("Unterminated multiline comment",!1)}else{if(T==-1&&!o&&this.isIfStart(this.pos))break;{let V;if(T==-1&&A==45&&this.pos<this.length-1){let N=p.cca(this.input,this.pos+1);V=(N??-1)==62}else V=!1;if(V&&this.isTransitionStart(this.pos))break;if(T==-1&&o&&(A==44||A==93||A==125))break;if(c&&A==60){T!=-1&&this.error("Unexpected < inside tag",!0);let N;if(this.pos+1<this.length){let G=p.cca(this.input,this.pos+1);N=G??-1}else N=0;P=N==47;let U=this.pos+(P?2:1);if(U<this.length){let G=p.cca(this.input,U),H=G??-1;(H>=97&&H<=122||H>=65&&H<=90||H==95||H==95||H==36||P&&H==62)&&(T=m.length)}m+=String.fromCodePoint(A);let q=0,J=1;for(;q<J;){let G=q++;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++}++v}else if(c&&A==62){m+=String.fromCodePoint(A);let N=0,U=1;for(;N<U;){let q=N++;if(this.pos>=this.length)break;let J=p.cca(this.input,this.pos);(J??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++v,T!=-1&&(d.push(Ii.Tag(P,T,m.length-T)),T=-1)}else if(T==-1&&A==35&&!E){let N;if(this.pos+1<this.length){let U=p.cca(this.input,this.pos+1);N=U??-1}else N=0;if(N==35){m+=String.fromCodePoint(35),m+=String.fromCodePoint(35);let U=0,q=1;for(;U<q;){let H=U++;if(this.pos>=this.length)break;let re=p.cca(this.input,this.pos);(re??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let J=0,G=1;for(;J<G;){let H=J++;if(this.pos>=this.length)break;let re=p.cca(this.input,this.pos);(re??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}v+=2}else{if(N>=97&&N<=122||N>=65&&N<=90||N==95||N>=48&&N<=57||N==45)break;{m+=String.fromCodePoint(A);let U=0,q=1;for(;U<q;){let J=U++;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++}++v}}}else if(A==36&&!E){let N=m.length,U=I,q=v,J=this.pos;try{let G=0,H=1;for(;G<H;){let _e=G++;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++}++v;let re=p.cca(this.input,this.pos);if((re??-1)==123){let _e=0,ue=1;for(;_e<ue;){let Fe=_e++;if(this.pos>=this.length)break;let Re=p.cca(this.input,this.pos);(Re??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++v;let de=new ne(U,q+2,this.pos),fe=this.readComplexInterpolation(de),ge=this.pos-J;d.push(Ii.Interpolation(!0,T!=-1,fe,N,ge));let Ne=this.input;m+=te.string(ge!=null?p.substr(Ne,J,ge):p.substr(Ne,J,null))}else{let _e=p.cca(this.input,this.pos),ue=_e??-1;if(ue>=97&&ue<=122||ue>=65&&ue<=90||ue==95){let de=new ne(U,q+1,this.pos),fe=this.readFieldAccessInterpolation(de),ge=this.pos-J;d.push(Ii.Interpolation(!1,T!=-1,fe,N,ge));let Ne=this.input;m+=te.string(ge!=null?p.substr(Ne,J,ge):p.substr(Ne,J,null))}else{let de=p.cca(this.input,this.pos);if((de??-1)==36){m+=String.fromCodePoint(36),m+=String.fromCodePoint(36);let fe=0,ge=1;for(;fe<ge;){let Ne=fe++;if(this.pos>=this.length)break;let Fe=p.cca(this.input,this.pos);(Fe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++v}else{this.error("Expected identifier or { after $",!1);let fe=this.pos-J;d.push(Ii.Interpolation(!1,T!=-1,[],N,fe));let ge=this.input;m+=te.string(fe!=null?p.substr(ge,J,fe):p.substr(ge,J,null))}}}}catch(G){let H=y.caught(G).unwrap();if(H instanceof el){let re=H;throw re.pos==null&&(re.pos=new ne(U,q,this.pos)),y.thrown(re)}else throw G}v=q+(this.pos-J)}else{A==10?(++I,v=1):++v,m+=String.fromCodePoint(A);let N=0,U=1;for(;N<U;){let q=N++;if(this.pos>=this.length)break;let J=p.cca(this.input,this.pos);(J??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}}}}}if(O){let B=m,A=B.length;B=Be.rtrim(B);let K=B.length,D=A-K;if(K>0&&this.hasNonSpecialChar(B)&&!this.isNumber(B)&&B!="null"&&B!="true"&&B!="false"){if(h==-1&&!a&&!this.inChoiceRoot()){let q=this.line,J=this.column,G=this.pos,H=!0;H==null&&(H=!1);let re=H;re==null&&(re=!1);let _e=this._skipWhitespaceAndComments(this.pos,re);for(;this.pos<_e;){let de=0,fe=1;for(;de<fe;){let ge=de++;if(this.pos>=this.length)break;let Ne=p.cca(this.input,this.pos);(Ne??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let ue=this.pos;if(this.column==b){let de=this.tryReadUnquotedString();if(de!=null){let fe=this.input,ge=G-D,Ne=ue!=null?fe.substring(ge,ue):fe.substring(ge),Fe=de.type;if(Fe._hx_index==15){let Ye=Fe.quotes,Ke=Fe.s,Ve=Fe.attachments;if(Ve!=null){let nt=0;for(;nt<Ve.length;){let Ae=Ve[nt];switch(++nt,Ae._hx_index){case 0:let $e=Ae.braces,X=Ae.inTag,ee=Ae.expr,j=Ae.start,le=Ae.length;d.push(Ii.Interpolation($e,X,ee,j+ue-C,le));break;case 1:let Z=Ae.closing,Q=Ae.start,se=Ae.length;d.push(Ii.Tag(Z,Q+ue-C,se));break}}}B+=Ne,B+=Ke}D=0;let Re=this.pos-1;for(;;){let Ye;if(Re>=0){let Ke=p.cca(this.input,Re);if((Ke??-1)!=32){let Ve=p.cca(this.input,Re);Ye=(Ve??-1)==9}else Ye=!0}else Ye=!1;if(!Ye)break;++D,--Re}}else this.line=q,this.column=J,this.pos=G}else this.line=q,this.column=J,this.pos=G}d.sort(function(q,J){return bt.compareAttachments(q,J)});let M=d.length>0?d:null,V=_;V==null&&(V=new ne(this.startLine,this.startColumn,this.pos)),V.length=this.pos-V.offset;let N=new xe(x.LString(0,B,M),V);this.previous=N;let U=N;return U.pos.length-=D,U}}return this.line=w,this.column=b,this.pos=C,null}readString(e){let t=0,i=1;for(;t<i;){let c=t++;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 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),f=c??-1;if(s){l+=String.fromCodePoint(92),l+=String.fromCodePoint(f),s=!1;let _=0,m=1;for(;_<m;){let d=_++;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(f==92){s=!0;let _=0,m=1;for(;_<m;){let d=_++;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(f==34&&r==-1){let _=0,m=1;for(;_<m;){let C=_++;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(C,E){return bt.compareAttachments(C,E)});let d=n.length>0?n:null,w=e;w==null&&(w=new ne(this.startLine,this.startColumn,this.pos)),w.length=this.pos-w.offset;let b=new xe(x.LString(1,l,d),w);return this.previous=b,b}else if(u&&f==60){r!=-1&&this.error("Unexpected < inside tag",!0);let _;if(this.pos+1<this.length){let b=p.cca(this.input,this.pos+1);_=b??-1}else _=0;h=_==47;let m=this.pos+(h?2:1);if(m<this.length){let b=p.cca(this.input,m),C=b??-1;(C>=97&&C<=122||C>=65&&C<=90||C==95||C==95||C==36||h&&C==62)&&(r=l.length)}l+=String.fromCodePoint(f);let d=0,w=1;for(;d<w;){let b=d++;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++}++a}else if(f==62){l+=String.fromCodePoint(f);let _=0,m=1;for(;_<m;){let d=_++;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(Ii.Tag(h,r,l.length-r)),r=-1)}else if(f==36&&!s){let _=l.length,m=o,d=a,w=this.pos;try{let b=0,C=1;for(;b<C;){let T=b++;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 T=0,P=1;for(;T<P;){let B=T++;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;let v=new ne(m,d+2,this.pos),I=this.readComplexInterpolation(v),O=this.pos-w;n.push(Ii.Interpolation(!0,r!=-1,I,_,O));let L=this.input;l+=te.string(O!=null?p.substr(L,w,O):p.substr(L,w,null))}else{let T=p.cca(this.input,this.pos),P=T??-1;if(P>=97&&P<=122||P>=65&&P<=90||P==95){let v=new ne(m,d+1,this.pos),I=this.readFieldAccessInterpolation(v),O=this.pos-w;n.push(Ii.Interpolation(!1,r!=-1,I,_,O));let L=this.input;l+=te.string(O!=null?p.substr(L,w,O):p.substr(L,w,null))}else{let v=p.cca(this.input,this.pos);if((v??-1)==36){l+=String.fromCodePoint(36),l+=String.fromCodePoint(36);let I=0,O=1;for(;I<O;){let L=I++;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++}++a}else{this.error("Expected identifier or { after $",!1);let I=this.pos-w;n.push(Ii.Interpolation(!1,r!=-1,[],_,I));let O=this.input;l+=te.string(I!=null?p.substr(O,w,I):p.substr(O,w,null))}}}}catch(b){let C=y.caught(b).unwrap();if(C instanceof el){let E=C;throw E.pos==null&&(E.pos=new ne(m,d,this.pos)),y.thrown(E)}else throw b}a=d+(this.pos-w)}else{f==10?(++o,a=1):++a,l+=String.fromCodePoint(f);let _=0,m=1;for(;_<m;){let d=_++;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 ne(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 f=a.n;h=(f==null?"null":""+f).length;break;case 19:h=a.name.length;break;default:h=1}l+=h}switch(r.type._hx_index){case 43:++i;break;case 44:--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 ne(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,f=1;for(;c<f;){let _=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(bt.KEYWORDS.h,h)?bt.KEYWORDS.h[h]:x.Identifier(h);t.push(new xe(a,new ne(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 xe(x.LParen,new ne(this.line,this.column,this.pos,1)));let u=0,c=1;for(;u<c;){let b=u++;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++}this.stack.push(10),this.strictExprs.push(1);let f=1;for(;this.pos<this.length&&f>0;){let b=p.cca(this.input,this.pos);if((b??-1)==41){if(--f,f==0){t.push(new xe(x.RParen,new ne(this.line,this.column,this.pos,1)));let E=0,T=1;for(;E<T;){let P=E++;if(this.pos>=this.length)break;let v=p.cca(this.input,this.pos);(v??-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&&++f}let C=p.cca(this.input,this.pos);if((C??-1)==44){t.push(new xe(x.Comma,new ne(this.line,this.column,this.pos,1)));let E=0,T=1;for(;E<T;){let P=E++;if(this.pos>=this.length)break;let v=p.cca(this.input,this.pos);(v??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else t.push(this.nextToken())}f>0&&this.error("Unterminated function call in interpolation",!0);break;case 46:let _;if(this.pos+1<this.length){let b=p.cca(this.input,this.pos+1),C=b??-1;_=C>=97&&C<=122||C>=65&&C<=90||C==95}else _=!1;if(_){t.push(new xe(x.Dot,new ne(this.line,this.column,this.pos,1)));let b=0,C=1;for(;b<C;){let O=b++;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++}let E=this.pos;for(;this.pos<this.length;){let O=p.cca(this.input,this.pos),L=O??-1;if(!(L>=97&&L<=122||L>=65&&L<=90||L==95||L>=48&&L<=57))break;let B=0,A=1;for(;B<A;){let K=B++;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 T=this.input,P=this.pos-E,v=P!=null?p.substr(T,E,P):p.substr(T,E,null),I=Object.prototype.hasOwnProperty.call(bt.KEYWORDS.h,v)?bt.KEYWORDS.h[v]:x.Identifier(v);t.push(new xe(I,new ne(this.line,this.column-(this.pos-E),E)))}else break e;break;case 91:t.push(new xe(x.LBracket,new ne(this.line,this.column,this.pos,1)));let m=0,d=1;for(;m<d;){let b=m++;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++}this.stack.push(12),this.strictExprs.push(1);let w=1;for(;this.pos<this.length&&w>0;){let b=p.cca(this.input,this.pos);if((b??-1)==93){if(--w,w==0){t.push(new xe(x.RBracket,new ne(this.line,this.column,this.pos,1)));let C=0,E=1;for(;C<E;){let T=C++;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 C=p.cca(this.input,this.pos);(C??-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 f=p.cca(this.input,this.pos);(f??-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(bt.KEYWORDS.h,s)?bt.KEYWORDS.h[s]:x.Identifier(s);return new xe(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 ne(t,i,this.pos,e.length)}readLineComment(){let e=new ne(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 f=0,_=1;for(;f<_;){let m=f++;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 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 ne(this.startLine,this.startColumn,this.pos)),a.length=this.pos-a.offset;let o=new xe(x.CommentLine(h),a);return this.previous=o,o}readMultiLineComment(){let e=new ne(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,f=this.pos-n,_=f!=null?p.substr(c,n,f):p.substr(c,n,null),m=2;m==null&&(m=1);let d=0,w=m;for(;d<w;){let E=d++;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 b=e;b==null&&(b=new ne(this.startLine,this.startColumn,this.pos)),b.length=this.pos-b.offset;let C=new xe(x.CommentMultiLine(_),b);return this.previous=C,C}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 f=p.cca(this.input,this.pos);(f??-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,f=u;for(;c<f;){let _=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 f=u++;if(this.pos>=this.length)break;let _=p.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}return this.error("Unterminated multi-line comment",!0),null}readHashComment(){let e=new ne(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,f=1;for(;c<f;){let _=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 ne(this.startLine,this.startColumn,this.pos)),h.length=this.pos-h.offset;let a=new xe(x.CommentHash(r),h);return this.previous=a,a}readNumber(){let e=new ne(this.startLine,this.startColumn,this.pos),t=this.pos;for(;;){let u;if(this.pos<this.length){let _=p.cca(this.input,this.pos),m=_??-1;u=m>=48&&m<=57}else u=!1;if(!u)break;let c=0,f=1;for(;c<f;){let _=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 f=u++;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(;;){let f;if(this.pos<this.length){let d=p.cca(this.input,this.pos),w=d??-1;f=w>=48&&w<=57}else f=!1;if(!f)break;let _=0,m=1;for(;_<m;){let d=_++;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 ne(this.startLine,this.startColumn,this.pos)),h.length=this.pos-h.offset;let a=new xe(r,h);return this.previous=a,a}readIdentifier(){let e=new ne(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 f=u++;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 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(bt.KEYWORDS.h,n)?bt.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 ne(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new xe(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 M=0,V=1;for(;M<V;){let N=M++;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 M=this.pos;for(;;){let U;if(this.pos<this.length){let G=p.cca(this.input,this.pos),H=G??-1;U=H>=97&&H<=122||H>=65&&H<=90||H==95||H>=48&&H<=57}else U=!1;if(!U)break;let q=0,J=1;for(;q<J;){let G=q++;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 V=this.input,N=this.pos-M;n=N!=null?p.substr(V,M,N):p.substr(V,M,null)}let h=!1;h==null&&(h=!1);let a=this._skipWhitespaceAndComments(this.pos,h);for(;this.pos<a;){let M=0,V=1;for(;M<V;){let N=M++;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 M=p.cca(this.input,this.pos);o=(M??-1)!=40}else o=!0;o&&this.error("Expected opening parenthesis after function name",!0);let u=0,c=[],f=0,_=1;for(;f<_;){let M=f++;if(this.pos>=this.length)break;let V=p.cca(this.input,this.pos);(V??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}u=1;let m=new $t;for(;this.pos<this.length&&u>0;){let M=p.cca(this.input,this.pos),V=M??-1;if(V==47){let N=this.pos,U=!1;U==null&&(U=!1);let q=this._skipWhitespaceAndComments(this.pos,U);for(;this.pos<q;){let J=0,G=1;for(;J<G;){let H=J++;if(this.pos>=this.length)break;let re=p.cca(this.input,this.pos);(re??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}if(this.pos==N){let J=0,G=1;for(;J<G;){let H=J++;if(this.pos>=this.length)break;let re=p.cca(this.input,this.pos);(re??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error('Invalid character "/"',!1)}}else if(V==40){++u,m.b+=String.fromCodePoint(V);let N=0,U=1;for(;N<U;){let G=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 q=!1;q==null&&(q=!1);let J=this._skipWhitespaceAndComments(this.pos,q);for(;this.pos<J;){let G=0,H=1;for(;G<H;){let re=G++;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++}}}else if(V==41){if(--u,u>0)m.b+=String.fromCodePoint(V);else{let G=Be.trim(m.b);G.length>0&&c.push(G)}let N=0,U=1;for(;N<U;){let G=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 q=!1;q==null&&(q=!1);let J=this._skipWhitespaceAndComments(this.pos,q);for(;this.pos<J;){let G=0,H=1;for(;G<H;){let re=G++;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++}}}else if(V==44&&u==1){let N=Be.trim(m.b);N.length>0&&c.push(N),m=new $t;let U=0,q=1;for(;U<q;){let H=U++;if(this.pos>=this.length)break;let re=p.cca(this.input,this.pos);(re??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let J=!1;J==null&&(J=!1);let G=this._skipWhitespaceAndComments(this.pos,J);for(;this.pos<G;){let H=0,re=1;for(;H<re;){let _e=H++;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{m.b+=String.fromCodePoint(V);let N=0,U=1;for(;N<U;){let q=N++;if(this.pos>=this.length)break;let J=p.cca(this.input,this.pos);(J??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}u>0&&this.error("Unclosed parentheses in function declaration",!1);let d=!1;d==null&&(d=!1);let w=this._skipWhitespaceAndComments(this.pos,d);for(;this.pos<w;){let M=0,V=1;for(;M<V;){let N=M++;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 b;if(this.pos<this.length){let M=p.cca(this.input,this.pos);b=(M??-1)==123}else b=!1;let C=this.pos,E=this.line,T=this.column;if(b){let M=0,V=1;for(;M<V;){let U=M++;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 N=1;for(;this.pos<this.length&&N>0;){let U=p.cca(this.input,this.pos),q=U??-1;if(q==34){let H=0,re=1;for(;H<re;){let _e=H++;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++}this.skipQuotedString();continue}q==123?++N:q==125&&--N;let J=0,G=1;for(;J<G;){let H=J++;if(this.pos>=this.length)break;let re=p.cca(this.input,this.pos);(re??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}N>0&&this.error("Unclosed braces in function body",!1)}else{let M=-1,V=!0;for(;this.pos<this.length;){let N=p.cca(this.input,this.pos),U=N??-1;if(U==10||U==13){C=this.pos,E=this.line,T=this.column;let G=0,H=1;for(;G<H;){let re=G++;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++}V=!0;break}let q=0,J=1;for(;q<J;){let G=q++;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++}}for(;this.pos<this.length;){if(V){let G=0,H=this.pos;for(;this.pos<this.length;){let ue=p.cca(this.input,this.pos),de=ue??-1;if(de==32)++G;else if(de==9)++G;else break;let fe=0,ge=1;for(;fe<ge;){let Ne=fe++;if(this.pos>=this.length)break;let Fe=p.cca(this.input,this.pos);(Fe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let re,_e;if(M==-1&&this.pos<this.length){let ue=p.cca(this.input,this.pos);_e=(ue??-1)!=10}else _e=!1;if(_e){let ue=p.cca(this.input,this.pos);re=(ue??-1)!=13}else re=!1;if(re){if(M=G,M<l){this.pos=H;break}}else{let ue;if(M!=-1&&G<M)if(this.pos<this.length){let de=p.cca(this.input,this.pos);if((de??-1)!=10){let fe=p.cca(this.input,this.pos);ue=(fe??-1)!=13}else ue=!1}else ue=!0;else ue=!1;if(ue){this.pos=H;break}}V=!1}let N=p.cca(this.input,this.pos),U=N??-1;if(U==34){this.skipQuotedString();continue}(U==10||U==13)&&(C=this.pos,E=this.line,T=this.column,V=!0);let q=0,J=1;for(;q<J;){let G=q++;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++}}}this.pos=C,this.line=E,this.column=T;let P=this.pos,v=this.input,I=e.offset,O=P-e.offset,L=Be.rtrim(O!=null?p.substr(v,I,O):p.substr(v,I,null)),B=L.indexOf(`
|
|
38
|
+
`,null)==-1;B||(L+=`
|
|
39
|
+
`);let A=e;A==null&&(A=new ne(this.startLine,this.startColumn,this.pos)),A.length=this.pos-A.offset;let K=new xe(x.Function(n,c,L,B),A);this.previous=K;let D=K;return D.pos.length=L.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 f=p.cca(this.input,this.pos);(f??-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),f=c??-1;if(f==34){this.skipQuotedString();continue}else f==123?++u:f==125&&--u;if(u>0||f!=125){let _=0,m=1;for(;_<m;){let d=_++;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 _=0,m=1;for(;_<m;){let d=_++;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 _=p.cca(this.input,this.pos),m=_??-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,f=1;for(;c<f;){let _=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 ne(this.startLine,this.startColumn,this.pos)}makeToken(e,t){t==null&&(t=new ne(this.startLine,this.startColumn,this.pos)),t.length=this.pos-t.offset;let i=new xe(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 el(e,new ne(this.startLine,this.startColumn,this.pos));if(this.errors==null&&(this.errors=[]),this.errors.push(i),t)throw y.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}}z["loreline.Lexer"]=bt,bt.__name__="loreline.Lexer",Object.assign(bt.prototype,{__class__:bt});class hn{static parse(e,t,i,l){let n=new bt(e),s=n.tokenize(),r=n.getErrors();if(r!=null&&r.length>0)throw y.thrown(r[0]);let h=null;if(t!=null&&i!=null)return new Ll().resolve(t,s,i,function(c){throw y.thrown(c)},function(c,f){let _=new Ri(s,new yl(t,t,f,null));h=_.parse(),h.indentSize=n.detectedIndentSize;let m=_.getErrors();if(m!=null&&m.length>0)throw y.thrown(m[0]);l?.(h)}),h;let a=new Ri(s);h=a.parse(),h.indentSize=n.detectedIndentSize;let o=a.getErrors();if(o!=null&&o.length>0)throw y.thrown(o[0]);return l?.(h),h}static play(e,t,i,l,n,s){let r=new xl(e,t,i,l,s);return r.start(n),r}static resume(e,t,i,l,n,s,r){let h=new xl(e,t,i,l,r);return h.restore(n),s!=null?h.start(s):h.resume(),h}static extractTranslations(e){return Ot.extractTranslations(e)}static print(e,t,i){let l=t,n=i;return new tl(l??" ",n??`
|
|
40
|
+
`).print(e)}}z["loreline.Loreline"]=Gi.loreline.Loreline=hn,hn.__name__="loreline.Loreline";class Ue{constructor(e,t,i,l){if(e<0||e>65535)throw y.thrown("Section value ("+e+") should be between 0 and 65535");if(t<0||t>65535)throw y.thrown("Branch value ("+t+") should be between 0 and 65535");if(i<0||i>65535)throw y.thrown("Block value ("+i+") should be between 0 and 65535");if(l<0||l>65535)throw y.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 Li(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 Li(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 Li(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 Li(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 Li(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 y.thrown("Node id section overflow");return new Ue(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 Ue((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 Ue((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 Ue((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 Ue(32768,32768,32768,32768);return t.thisVal=e,t}static fromString(e){let t=e.split(".");return new Ue(te.parseInt(t[0]),te.parseInt(t[1]),te.parseInt(t[2]),te.parseInt(t[3]))}static fromTwoInt32(e,t){return Ue.fromInt64(new Li(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}}z["loreline.NodeId"]=Ue,Ue.__name__="loreline.NodeId",Object.assign(Ue.prototype,{__class__:Ue,__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 Wi{constructor(){this.map=new _i}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 Ul(this.map)}keys(){return new ql(this.map)}keyValueIterator(){return new Wl(this.map)}}z["loreline.NodeIdMap"]=Wi,Wi.__name__="loreline.NodeIdMap",Object.assign(Wi.prototype,{__class__:Wi});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._values[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return e}}z["loreline._Node.NodeIdMapIterator"]=Ul,Ul.__name__="loreline._Node.NodeIdMapIterator",Object.assign(Ul.prototype,{__class__:Ul});class ql{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 Ue.fromTwoInt32(e,t)}}z["loreline._Node.NodeIdMapKeyIterator"]=ql,ql.__name__="loreline._Node.NodeIdMapKeyIterator",Object.assign(ql.prototype,{__class__:ql});class Wl{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:Ue.fromTwoInt32(e,t),value:i}}}z["loreline._Node.NodeIdMapKeyValueIterator"]=Wl,Wl.__name__="loreline._Node.NodeIdMapKeyValueIterator",Object.assign(Wl.prototype,{__class__:Wl});class Nt{constructor(e,t){Nt._hx_skip_constructor||this._hx_constructor(e,t)}_hx_constructor(e,t){this.id=Ue.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){}}z["loreline.Node"]=Gi.loreline.Node=Nt,Nt.__name__="loreline.Node",Object.assign(Nt.prototype,{__class__:Nt});class Ki extends Nt{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}}z["loreline.Comment"]=Ki,Ki.__name__="loreline.Comment",Ki.__super__=Nt,Object.assign(Ki.prototype,{__class__:Ki});class Le extends Nt{constructor(e,t,i,l){if(Nt._hx_skip_constructor){super();return}Nt._hx_skip_constructor=!0,super(),Nt._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}}z["loreline.AstNode"]=Le,Le.__name__="loreline.AstNode",Le.__super__=Nt,Object.assign(Le.prototype,{__class__:Le});class ct extends Le{constructor(e,t,i,l){super(e,t,i,l)}toJson(){return super.toJson()}type(){return"Expr"}}z["loreline.NExpr"]=ct,ct.__name__="loreline.NExpr",ct.__super__=Le,Object.assign(ct.prototype,{__class__:ct});class Jt 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=Oi.toString(this.style),e}}z["loreline.NStateDecl"]=Jt,Jt.__name__="loreline.NStateDecl",Jt.__super__=Le,Object.assign(Jt.prototype,{__class__:Jt});class Di 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}}z["loreline.NObjectField"]=Di,Di.__name__="loreline.NObjectField",Di.__super__=Le,Object.assign(Di.prototype,{__class__:Di});class Gt 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=Oi.toString(this.style),e}}z["loreline.NCharacterDecl"]=Gt,Gt.__name__="loreline.NCharacterDecl",Gt.__super__=Le,Object.assign(Gt.prototype,{__class__:Gt});class We 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=Oi.toString(this.style),e}}z["loreline.NBeatDecl"]=We,We.__name__="loreline.NBeatDecl",We.__super__=Le,Object.assign(We.prototype,{__class__:We});var ze=Je["loreline.StringPartType"]={__ename__:"loreline.StringPartType",__constructs__:null,Raw:(g=function(k){return{_hx_index:0,text:k,__enum__:"loreline.StringPartType",toString:S}},g._hx_name="Raw",g.__params__=["text"],g),Expr:(g=function(k){return{_hx_index:1,expr:k,__enum__:"loreline.StringPartType",toString:S}},g._hx_name="Expr",g.__params__=["expr"],g),Tag:(g=function(k,e){return{_hx_index:2,closing:k,expr:e,__enum__:"loreline.StringPartType",toString:S}},g._hx_name="Tag",g.__params__=["closing","expr"],g)};ze.__constructs__=[ze.Raw,ze.Expr,ze.Tag];class Oi{static toString(e){switch(e){case 0:return"Plain";case 1:return"Braces"}}}class kl{static toString(e){switch(e){case 0:return"Plain";case 2:return"Parens"}}}class wl{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,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}}z["loreline.NStringPart"]=Ge,Ge.__name__="loreline.NStringPart",Ge.__super__=ct,Object.assign(Ge.prototype,{__class__:Ge});class Et extends ct{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=Xl.toString(this.quotes),e}}z["loreline.NStringLiteral"]=Et,Et.__name__="loreline.NStringLiteral",Et.__super__=ct,Object.assign(Et.prototype,{__class__:Et});class oi 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=kl.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}z["loreline.NTextStatement"]=oi,oi.__name__="loreline.NTextStatement",oi.__super__=Le,Object.assign(oi.prototype,{__class__:oi});class hi 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=kl.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}z["loreline.NDialogueStatement"]=hi,hi.__name__="loreline.NDialogueStatement",hi.__super__=Le,Object.assign(hi.prototype,{__class__:hi});class fi 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=Oi.toString(this.style),e}}z["loreline.NChoiceStatement"]=fi,fi.__name__="loreline.NChoiceStatement",fi.__super__=Le,Object.assign(fi.prototype,{__class__:fi});class St 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}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=kl.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=Oi.toString(this.style),e}}z["loreline.NChoiceOption"]=St,St.__name__="loreline.NChoiceOption",St.__super__=Le,Object.assign(St.prototype,{__class__:St});class mi 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=Oi.toString(this.style),e}}z["loreline.NBlock"]=mi,mi.__name__="loreline.NBlock",mi.__super__=Le,Object.assign(mi.prototype,{__class__:mi});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=kl.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=Oi.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=Oi.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 f=c[u];++u,o.push(f.toJson())}a.elseLeading=o}if(this.elseTrailingComments!=null&&this.elseTrailingComments.length>0){let o=[],u=0,c=this.elseTrailingComments;for(;u<c.length;){let f=c[u];++u,o.push(f.toJson())}a.elseTrailing=o}e.comments=a}}return e}}z["loreline.NIfStatement"]=gi,gi.__name__="loreline.NIfStatement",gi.__super__=Le,Object.assign(gi.prototype,{__class__:gi});class Vi 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=wl.toString(this.mode);let t=[],i=0,l=this.items;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.items=t,e.style=Oi.toString(this.style),e}}z["loreline.NAlternative"]=Vi,Vi.__name__="loreline.NAlternative",Vi.__super__=Le,Object.assign(Vi.prototype,{__class__:Vi});class Vt extends ct{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}}z["loreline.NCall"]=Vt,Vt.__name__="loreline.NCall",Vt.__super__=ct,Object.assign(Vt.prototype,{__class__:Vt});class Ni 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}}z["loreline.NTransition"]=Ni,Ni.__name__="loreline.NTransition",Ni.__super__=Le,Object.assign(Ni.prototype,{__class__:Ni});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}}z["loreline.NInsertion"]=zi,zi.__name__="loreline.NInsertion",zi.__super__=Le,Object.assign(zi.prototype,{__class__:zi});class ji extends ct{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}}z["loreline.NFunctionDecl"]=ji,ji.__name__="loreline.NFunctionDecl",ji.__super__=ct,Object.assign(ji.prototype,{__class__:ji});class qe extends ct{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 Nt){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 Nt){let r=s.value;e(r,this),r.each(e)}}}break}}toJson(){let e=super.toJson(),t=this.literalType;e.literal=Je[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 Nt?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=Oi.toString(l);break}return e}}z["loreline.NLiteral"]=qe,qe.__name__="loreline.NLiteral",qe.__super__=ct,Object.assign(qe.prototype,{__class__:qe});var Qe=Je["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:(g=function(k){return{_hx_index:4,style:k,__enum__:"loreline.LiteralType",toString:S}},g._hx_name="Object",g.__params__=["style"],g)};Qe.__constructs__=[Qe.Number,Qe.Boolean,Qe.Null,Qe.Array,Qe.Object];class pt extends ct{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}}z["loreline.NAccess"]=pt,pt.__name__="loreline.NAccess",pt.__super__=ct,Object.assign(pt.prototype,{__class__:pt});class di extends ct{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=te.string(this.op),e.value=this.value.toJson(),e}}z["loreline.NAssign"]=di,di.__name__="loreline.NAssign",di.__super__=ct,Object.assign(di.prototype,{__class__:di});class ui extends ct{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}}z["loreline.NArrayAccess"]=ui,ui.__name__="loreline.NArrayAccess",ui.__super__=ct,Object.assign(ui.prototype,{__class__:ui});class Xt extends ct{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=te.string(this.op),e.right=this.right.toJson(),e}}z["loreline.NBinary"]=Xt,Xt.__name__="loreline.NBinary",Xt.__super__=ct,Object.assign(Xt.prototype,{__class__:Xt});class Hi extends ct{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=te.string(this.op),e.operand=this.operand.toJson(),e}}z["loreline.NUnary"]=Hi,Hi.__name__="loreline.NUnary",Hi.__super__=ct,Object.assign(Hi.prototype,{__class__:Hi});class Zt 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(),e}}z["loreline.NImportStatement"]=Zt,Zt.__name__="loreline.NImportStatement",Zt.__super__=Le,Object.assign(Zt.prototype,{__class__:Zt});class oe{static isFields(e){return Y.__implements(e,Ei)||e instanceof Se?!0:e instanceof Bi||typeof e=="number"&&(e|0)===e||typeof e=="number"||typeof e=="boolean"||typeof e=="string"?!1:!ie.isArray(e)}static getField(e,t,i){return Y.__implements(t,Ei)?t.lorelineGet(e,i):t instanceof Se?t.h[i]:je.getProperty(t,i)}static getFields(e,t){if(Y.__implements(t,Ei))return t.lorelineFields(e);if(t instanceof Se){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 je.fields(t)}static setField(e,t,i,l){Y.__implements(t,Ei)?t.lorelineSet(e,i,l):t instanceof Se?t.h[i]=l:je.setProperty(t,i,l)}static removeField(e,t,i){if(Y.__implements(t,Ei))return t.lorelineRemove(e,i);if(t instanceof Se){let l=t;return Object.prototype.hasOwnProperty.call(l.h,i)?(delete l.h[i],!0):!1}else return je.deleteField(t,i)}static fieldExists(e,t,i){return Y.__implements(t,Ei)?t.lorelineExists(e,i):t instanceof Se?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 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(z[t].prototype);return Y.__implements(l,Ei)&&l.lorelineCreate(e),l}return new Se}}z["loreline.Objects"]=oe,oe.__name__="loreline.Objects";class Pe extends si{constructor(e,t){super(e,t)}}z["loreline.ParseError"]=Pe,Pe.__name__="loreline.ParseError",Pe.__super__=si,Object.assign(Pe.prototype,{__class__:Pe});class yl{constructor(e,t,i,l){this.imported=new Se,this.rootPath=e,this.path=t,this.imports=i,l!=null&&(this.imported=l)}}z["loreline.ParserContext"]=yl,yl.__name__="loreline.ParserContext",Object.assign(yl.prototype,{__class__:yl});class Ri{constructor(e,t){this.tokens=e,this.current=0,this.errors=null,this.pendingComments=null,this.lastTokenEnd=new ne(1,1,0),this.lastLineBreak=null,this.lineBreakAfterToken=!1,this.currentNodeId=Ue.UNDEFINED,this.rootBeat=null,this.context=t}parse(){let e=this.currentPos(),t=[],i=new ci(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=y.caught(l).unwrap();if(n instanceof Pe){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 49:let i=t.content;++e;break;case 50:let l=t.content;++e;break;case 51:let n=t.content;++e;break;case 54:++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 49:let l=i.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Ki(this.nextNodeId(4),this.currentPos(),l,!1));break;case 50:let n=i.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Ki(this.nextNodeId(4),this.currentPos(),n,!0));break;case 51:let s=i.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Ki(this.nextNodeId(4),this.currentPos(),s,!1,!0));break;case 54: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(Ft.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 49:let i=t.content;break;case 50:let l=t.content;break;case 51:let n=t.content;break;case 52:case 53:case 54: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 49:let i=t.content;break;case 50:let l=t.content;break;case 51:let n=t.content;break;case 52:case 53:case 54: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 49:let i=t.content;break;case 50:let l=t.content;break;case 51:let n=t.content;break;case 54: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 ne(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?Ft.toCodeString(t):null}return null}check(e){return this.isAtEnd()?!1:e._hx_index==40?this.tokens[this.current].type==x.Colon:Ft.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 49:let t=e.content;return!0;case 50:let i=e.content;return!0;case 51: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 49:h=r.content;break;case 50:h=r.content;break;case 51:h=r.content;break;default:h=""}let a=this.tokens[this.current].type,o;if(a._hx_index==50){let f=a.content;o=!0}else o=!1;let u=this.tokens[this.current].type,c;if(u._hx_index==51){let f=u.content;c=!0}else c=!1;l.push(new Ki(n,s,h,o,c))}if(this.advance(),this.isAtEnd())throw y.thrown(new Pe("Unexpected end of file",this.currentPos()))}if(this.isAtEnd())throw y.thrown(new Pe("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 Pe("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new qe(this.nextNodeId(4),this.currentPos(),null,Qe.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 y.thrown(new Pe("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 Pe("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new qe(this.nextNodeId(4),this.currentPos(),null,Qe.Null));case 15:let c=i.quotes,f=i.s,_=i.attachments,m=this.parseTextStatement();return e?t.wrapInRootBeat(m):m;case 16:let d=i.n,w=this.parseExpressionStatement();return e?t.wrapInRootBeat(w):w;case 17:let b=i.b,C=this.parseExpressionStatement();return e?t.wrapInRootBeat(C):C;case 19:let E=i.name;if(this.peek().type==x.Colon){let I=this.parseDialogueStatement();return e?t.wrapInRootBeat(I):I}else{let I=this.parseExpressionStatement();return e?t.wrapInRootBeat(I):I}break;case 25:let T=this.parseInsertion();return e?t.wrapInRootBeat(T):T;case 18:case 26:case 38:case 43:case 45:case 47:let P=this.parseExpressionStatement();return e?t.wrapInRootBeat(P):P;case 39:let v=this.parseTransition();return e?t.wrapInRootBeat(v):v;default:return this.addError(new Pe("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new qe(this.nextNodeId(4),this.currentPos(),null,Qe.Null)}}wrapInRootBeat(e){let t,i=null;if(this.rootBeat==null){let l=this.currentPos();t=[],this.rootBeat=new We(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 y.thrown(new Pe("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,f=n.quotes,_=n.s;t=f,l=_}else throw y.thrown(new Pe("Expected string literal for import path",this.currentPos()));let s=l;Pt.isAbsolute(s)||(s=Pt.join([Pt.directory(this.context.rootPath),s])),s=Pt.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 Zt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,null);return c.path=new Et(this.nextNodeId(4),i.pos,t,[new Ge(this.nextNodeId(4),i.pos,ze.Raw(l))]),this.attachComments(c)}let h=this.context.imports.h[s];if(h==null)throw y.thrown(new Pe("Failed to import file at path "+s+" ("+l+")",this.currentPos()));let a=new Ri(h,new yl(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 Zt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,o);return u.path=new Et(this.nextNodeId(4),i.pos,t,[new Ge(this.nextNodeId(4),i.pos,ze.Raw(l))]),this.attachComments(u)}parseDialogueStatement(){let e=this.currentPos(),t=new hi(this.nextNodeId(4),e,null,null,null),i=this.tokens[this.current].type,l;if(i._hx_index==19)l=i.name;else throw y.thrown(new Pe("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 y.thrown(new Pe("Expected indent, got "+Ft.toCodeString(s.type),s.pos));n=!0}try{t.content=this.parseStringLiteral()}catch(s){let r=y.caught(s).unwrap();if(r instanceof Pe){let h=r;this.addError(h),t.content=new Et(this.nextNodeId(4),this.currentPos(),0,[new Ge(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=y.caught(i).unwrap();if(l instanceof Pe){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 Jt(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 Di(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 We(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 y.thrown(new Pe("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 y.thrown(new Pe("Invalid indentation level",e.pos));return e}else return this.addError(new Pe("Expected "+Ft.toCodeString(x.LBrace)+" or "+Ft.toCodeString(x.Indent)+", got "+this.currentTokenTypeToString(),this.currentPos())),new xe(x.Indent,this.currentPos())}parseCharacterDecl(){let e=this.currentPos(),t=new Gt(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 oi(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 fi(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 St(this.nextNodeId(3),t,null,null,null,0,[])),l=null,n=!1;try{this.check(x.OpPlus)?(n=!0,i.insertion=this.parseInsertion()):i.text=this.parseStringLiteral()}catch(s){let r=y.caught(s).unwrap();if(r instanceof Pe){let h=r;this.addError(h),l=this.currentPos(),this.currentPos().offset==t.offset&&this.advance(),i.text=new Et(this.nextNodeId(4),this.currentPos(),0,[new Ge(this.nextNodeId(4),this.currentPos(),ze.Raw("?"))])}else throw s}if(!n){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=y.caught(h).unwrap();if(a instanceof Pe){let o=a;this.addError(o),l=this.currentPos(),this.currentPos().offset==r&&this.advance()}else throw h}}if(this.checkBlockStart()){i.body=[];let s=this.currentPos().offset;try{i.style=this.parseStatementBlock(i.body)}catch(r){let h=y.caught(r).unwrap();if(h instanceof Pe){let a=h;this.addError(a),l=this.currentPos(),this.currentPos().offset==s&&this.advance(),i.body.length==0&&(i.body=[new qe(this.nextNodeId(4),this.currentPos(),null,Qe.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=y.caught(r).unwrap();if(h instanceof Pe){let a=h;this.addError(a),l=this.currentPos(),this.currentPos().offset==s&&this.advance(),i.body.length==0&&(i.body=[new qe(this.nextNodeId(4),this.currentPos(),null,Qe.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 26:case 38:case 43:case 45:case 47: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)){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 39: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 mi(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 mi(this.nextNodeId(3),this.currentPos(),null);let l=this.parseIfStatement();t.elseBranch.body=[l],t.elseBranch.style=0}else t.elseBranch=new mi(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 y.thrown(new Pe("Expected alternative keyword",this.currentPos()))}let i=new Vi(this.nextNodeId(2),e,t,[]);for(this.advance();this.match(x.LineBreak););this.attachComments(i);let l=new mi(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 mi(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 Ni(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),".",this.prevNonWhitespaceOrComment().pos));let t=this.expectIdentifier();return this.attachComments(new Ni(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 ji(this.nextNodeId(3),e,i,[].concat(l),n,s))}else throw y.thrown(new Pe("Unexpected token in expression",this.currentPos()))}parseExpression(){try{let e=this.parseLogicalOr();if(this.check(x.OpAssign)||this.check(x.OpPlusAssign)||this.check(x.OpMinusAssign)||this.check(x.OpMultiplyAssign)||this.check(x.OpDivideAssign)){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=y.caught(e).unwrap();return t instanceof Pe&&this.addError(t),new qe(this.nextNodeId(4),this.currentPos(),null,Qe.Null)}}parseLogicalOr(){let e=this.parseLogicalAnd();for(;this.match(x.OpOr(!1));){let t=this.previous().type,i=this.attachComments(new Xt(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 Xt(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 Xt(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 Xt(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 Xt(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 Xt(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 Hi(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 qe(this.nextNodeId(4),e,s,Qe.Number));case 17:let r=t.b;return this.advance(),this.attachComments(new qe(this.nextNodeId(4),e,r,Qe.Boolean));case 18:return this.advance(),this.attachComments(new qe(this.nextNodeId(4),e,null,Qe.Null));case 19:let h=t.name;if(this.peek().type==x.Colon){let o=[this.parseObjectField()];return new qe(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),o,Qe.Object(0))}else return this.advance(),this.parseIdentifierExpression(e,h);break;case 43:return this.parsePostfix(e,this.parseObjectLiteral());case 45:this.advance();let a=this.parseExpression();return this.expect(x.RParen),this.parsePostfix(e,a);case 47:return this.parsePostfix(e,this.parseArrayLiteral());default:throw y.thrown(new Pe("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 f=this.nextNodeId(4),_=this.nextNodeId(4);return t.push(new Ge(_,c,ze.Raw(n))),this.advance(),this.attachComments(new Et(f,e,l,t))}let a=this.attachComments(new Et(this.nextNodeId(4),e,l,t)),o=0,u=s.length;for(;o<u;){let c=o++,f=s[c];switch(f._hx_index){case 0:let _=f.braces,m=f.inTag,d=f.expr,w=f.start,b=f.length;if(h>=w+b)continue;if(w>h){let P=this.makeStringPartPosition(r,n,h);P.length=w-h;let v=w-h;t.push(new Ge(this.nextNodeId(4),P,ze.Raw(v!=null?p.substr(n,h,v):p.substr(n,h,null))))}t.push(this.parseStringInterpolation(_,m,d,w,b,n)),h=w+b;break;case 1:let C=f.closing,E=f.start,T=f.length;if(h>=E+T)continue;if(E>h){let P=this.makeStringPartPosition(r,n,h);P.length=E-h;let v=E-h;t.push(new Ge(this.nextNodeId(4),P,ze.Raw(v!=null?p.substr(n,h,v):p.substr(n,h,null))))}t.push(this.parseStringTag(C,E,T,n,l,s)),h=E+T;break}}if(h<n.length){let c=this.makeStringPartPosition(r,n,h);c.length=n.length-h;let f=null;t.push(new Ge(this.nextNodeId(4),c,ze.Raw(f!=null?p.substr(n,h,f):p.substr(n,h,null))))}if(this.advance(),this.pendingComments!=null){let c=null,f=0,_=this.pendingComments;for(;f<_.length;){let m=_[f];++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 y.thrown(new Pe("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 ne(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 Pe("Invalid access: "+(i!=null?"'"+i+"'":"null"),e)),t!=null)if(l!=null)e=new ne(t.pos.line,t.pos.column,t.pos.offset,l.offset+i.length-t.pos.offset);else throw y.thrown(new Pe("Invalid access (missing name position)",e));else if(e.length==0){let n=l!=null?l.length:null;e=new ne(e.line,e.column,e.offset,n??i.length)}}return new pt(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],f=c!=null?c.pos:null;this.addError(new Pe("Empty interpolation",f??this.currentPos()));let _=this.nextNodeId(4),m=this.nextNodeId(4),d=i[0],w=d!=null?d.pos:null;return new Ge(_,a,ze.Expr(new qe(m,w??this.currentPos(),null,Qe.Null)))}let o=null;if(!e&&i.length>0){let c=null,f=0,_=!1;for(;f<i.length;){let m=i[f];++f;let d=m.type;switch(d._hx_index){case 19:let w=d.name;if(c==null)c=this.attachComments(this.makeAccess(m.pos,null,w,null));else if(_)c=this.attachComments(this.makeAccess(m.pos,c,w,m.pos));else{this.addError(new Pe("Missing dot in field access",m.pos));let q=this.nextNodeId(4),J=this.nextNodeId(4),G=i[0],H=G!=null?G.pos:null;return new Ge(q,a,ze.Expr(new qe(J,H??this.currentPos(),null,Qe.Null)))}_=!1;break;case 42:if(c==null){this.addError(new Pe("Leading dot in field access",m.pos));let q=this.nextNodeId(4),J=this.nextNodeId(4),G=i[0],H=G!=null?G.pos:null;return new Ge(q,a,ze.Expr(new qe(J,H??this.currentPos(),null,Qe.Null)))}_=!0;break;case 45:if(c==null){this.addError(new Pe("Function call without target",m.pos));let q=this.nextNodeId(4),J=this.nextNodeId(4),G=i[0],H=G!=null?G.pos:null;return new Ge(q,a,ze.Expr(new qe(J,H??this.currentPos(),null,Qe.Null)))}let b=m.pos,C=[],E=[],T=1;for(;f<i.length&&T>0;){let q=i[f];switch(++f,q.type._hx_index){case 41:T==1?E.length>0&&(C.push(E),E=[]):E.push(q);break;case 45:++T,E.push(q);break;case 46:--T,T>0?E.push(q):E.length>0&&C.push(E);break;default:E.push(q)}}if(T>0){this.addError(new Pe("Unterminated function call",b));let q=this.nextNodeId(4),J=this.nextNodeId(4),G=i[0],H=G!=null?G.pos:null;return new Ge(q,a,ze.Expr(new qe(J,H??this.currentPos(),null,Qe.Null)))}let P=[],v=0;for(;v<C.length;){let q=C[v];++v;let J=new Ri(q);J.currentNodeId=this.currentNodeId;let G=J.parseExpression();P.push(G),this.currentNodeId=J.currentNodeId}c=this.attachComments(new Vt(this.nextNodeId(4),b.extendedTo(i[f-1].pos),c,P)),_=!1;break;case 47:if(c==null){this.addError(new Pe("Array access without target",m.pos));let q=this.nextNodeId(4),J=this.nextNodeId(4),G=i[0],H=G!=null?G.pos:null;return new Ge(q,a,ze.Expr(new qe(J,H??this.currentPos(),null,Qe.Null)))}let I=m.pos,O=[],L=1,B=null;for(;f<i.length&&L>0;){let q=i[f];switch(++f,q.type._hx_index){case 47:++L,O.push(q);break;case 48:--L,L>0&&O.push(q),B=q;break;default:O.push(q)}}if(L>0){this.addError(new Pe("Unterminated array access",I));let q=this.nextNodeId(4),J=this.nextNodeId(4),G=i[0],H=G!=null?G.pos:null;return new Ge(q,a,ze.Expr(new qe(J,H??this.currentPos(),null,Qe.Null)))}let A=new Ri(O);A.currentNodeId=this.currentNodeId;let K=A.parseExpression();this.currentNodeId=A.currentNodeId;let D=a.extendedTo(i[f-1].pos);D.length+=1,c=this.attachComments(new ui(this.nextNodeId(4),D,c,K)),_=!1;break;default:this.addError(new Pe("Unexpected token in field access: "+Ft.toCodeString(m.type),m.pos));let M=this.nextNodeId(4),V=this.nextNodeId(4),N=i[0],U=N!=null?N.pos:null;return new Ge(M,a,ze.Expr(new qe(V,U??this.currentPos(),null,Qe.Null)))}}_&&this.addError(new Pe("Trailing dot in field access",i[i.length-1].pos)),o=c}else{let c=new Ri(i);c.currentNodeId=this.currentNodeId,o=c.parseExpression(),this.currentNodeId=c.currentNodeId,c.isAtEnd()||this.addError(new Pe("Unexpected tokens after interpolation expression",c.tokens[c.current].pos))}let u=new ne(a.line,a.column+(e?1:0),a.offset-(e?2:0),n);return new Ge(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,f=this.nextNodeId(4),_=!1;if(s!=null){let b=0,C=s.length;e:for(;b<C;){let E=b++,T=s[E];switch(T._hx_index){case 0:let P=T.braces,v=T.inTag,I=T.expr,O=T.start,L=T.length,B=O+L;if(O>=o&&B<=c){_=!0;break e}break;case 1:let A=T.closing,K=T.start,D=T.length;continue}}}if(!_){let b=this.makeStringPartPosition(r,l,o);b.length=u;let C=this.nextNodeId(4),E=this.nextNodeId(4);return new Ge(f,h,ze.Tag(e,this.attachComments(new Et(C,b,0,[new Ge(E,b,ze.Raw(u!=null?p.substr(l,o,u):p.substr(l,o,null)))]))))}let m=[],d=this.attachComments(new Et(this.nextNodeId(4),h,0,m)),w=o;if(s!=null){let b=0,C=s.length;for(;b<C;){let E=b++,T=s[E];switch(T._hx_index){case 0:let P=T.inTag,v=T.braces,I=T.expr,O=T.start,L=T.length,B=O+L;if(O>=o&&B<=c){if(O>w){let V=this.makeStringPartPosition(r,l,o);V.length=O-o;let N=O-w;m.push(new Ge(this.nextNodeId(4),V,ze.Raw(N!=null?p.substr(l,w,N):p.substr(l,w,null))))}let M=this.parseStringInterpolation(v,!0,I,O,L,l);M.pos=this.makeStringPartPosition(r,l,O),M.pos.length=L,m.push(M),w=B}break;case 1:let A=T.closing,K=T.start,D=T.length;continue}}}if(w<c){let b=null,C=this.makeStringPartPosition(h,b!=null?p.substr(l,t,b):p.substr(l,t,null),w-t+a);C.length=o+c-w;let E=c-w;m.push(new Ge(this.nextNodeId(4),C,ze.Raw(E!=null?p.substr(l,w,E):p.substr(l,w,null))))}return new Ge(f,h,ze.Tag(e,d))}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 Pe("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 ui(this.nextNodeId(4),l,t,i))}else if(this.match(x.LParen)){let i=this.parseCallArguments();t=this.attachComments(new Vt(this.nextNodeId(4),e.extendedTo(this.previous().pos),t,i))}else break;return t}parseArrayLiteral(){let e=this.currentPos(),t=[],i=new qe(this.nextNodeId(4),e,t,Qe.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 y.thrown(new Pe("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 qe(this.nextNodeId(4),i!=x.RBrace?this.nextNonWhitespaceOrComment().pos:e,t,Qe.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 y.thrown(new Pe("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&&Y.getClass(t)==di&&this.addError(new Pe("Invalid condition expression: can't assign a variable here. Did you want to use '==' instead?",t.pos))}catch(i){let l=y.caught(i).unwrap();if(l instanceof Pe){let n=l;this.addError(n),t=new qe(this.nextNodeId(4),this.currentPos(),null,Qe.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 Pe("Expected "+Ft.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 44:case 46:case 53:return this.addError(t),new xe(e,this.currentPos());default:}throw y.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 y.thrown(new Pe("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 39:this.advance(),(this.check(x.Dot)||Ft.isIdentifier(this.tokens[this.current].type))&&this.advance();return;case 1:case 2:case 3:case 4:case 5:case 44:case 52:return;default:this.advance()}}}requiresNewLine(){switch(this.tokens[this.current].type._hx_index){case 6:case 39:case 44:return!1;default:return!0}}addError(e){return this.errors==null&&(this.errors=[]),this.errors.includes(e)||this.errors.push(e),e}}z["loreline.Parser"]=Ri,Ri.__name__="loreline.Parser",Object.assign(Ri.prototype,{__class__:Ri});class ne{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 ne(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 ne(n,s,r,i)}extendedTo(e){return new ne(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 ne(l,n,t,i)}}z["loreline.Position"]=ne,ne.__name__="loreline.Position",Object.assign(ne.prototype,{__class__:ne});class tl{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 $t}clear(){this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new $t}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=p.cca(e,e.length-1);this._lastChar=t??-1;let i=e.length-1;for(;i>=0;){let l=p.cca(e,i),n=l??-1;if(n!=32&&n!=10&&n!=13&&n!=9){this._lastVisibleChar=n;break}--i}}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+=te.string(this._newline),this._beginLine++),this}tab(){let e=0,t=this._level;for(;e<t;){let i=e++;this._buf.b+=te.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 $t,this._beginLine=1,this.printStringLiteral(e),this.enableComments=t;let i=Be.trim(this.toString());return i=i.split(`
|
|
42
|
+
`).join("\\n"),i}printStringLiteralAsText(e){let t=this.enableComments;this.enableComments=!1,this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new $t,this._beginLine=1;let i=0,l=e.parts;for(;i<l.length;){let s=l[i];++i;let r=s.partType;switch(r._hx_index){case 0:let h=r.text;e.quotes==1?this.writeQuotedRaw(h):this.writeUnquotedRaw(h);break;case 1:let a=r.expr,o=this.isSimpleInterpolationExpr(a);this.write("$"),o||this.write("{"),this.printNode(a),o||this.write("}");break;case 2:let u=r.closing,c=r.expr;this.write(u?"</":"<"),this.printStringLiteral(c),this.write(">");break}}this.enableComments=t;let n=Be.trim(this.toString());return n=n.split(`
|
|
43
|
+
`).join("\\n"),n}print(e){return this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new $t,this._beginLine=1,this.printNode(e),this.toString()}printNode(e,t){if(t==null&&(t=!1),e!=null)switch(Y.getClass(e)){case pt:this.printAccess(e);break;case Vi:this.printAlternative(e);break;case ui:this.printArrayAccess(e);break;case di:this.printAssignment(e);break;case We:this.printBeatDecl(e);break;case Xt:this.printBinary(e);break;case Vt:this.printCall(e);break;case Gt:this.printCharacterDecl(e);break;case St:this.printChoiceOption(e);break;case fi:this.printChoiceStatement(e);break;case hi:this.printDialogueStatement(e);break;case ji:this.printFunctionDecl(e);break;case gi:this.printIfStatement(e);break;case Zt:this.printImportStatement(e);break;case zi:this.printInsertion(e);break;case qe:this.printLiteral(e);break;case Jt:this.printStateDecl(e);break;case Et:this.printStringLiteral(e);break;case oi:this.printTextStatement(e);break;case Ni:this.printTransition(e,t);break;case Hi:this.printUnary(e);break;case ci:this.printScript(e);break;default:let i=Y.getClass(e);throw y.thrown("Unsupported node type: "+i.__name__)}}printLeadingComments(e){if(this.enableComments&&e.leadingComments!=null){let t=0,i=e.leadingComments;for(;t<i.length;){let l=i[t];++t,l.multiline?(this.write("/*"+l.content+"*/"),this.newline()):l.isHash?(this.write("#"+l.content),this.newline()):(this.write("//"+l.content),this.newline())}}}printHashTrailingComments(e){if(this.enableComments&&e.trailingComments!=null){let t=0,i=e.trailingComments;for(;t<i.length;){let l=i[t];++t,l.isHash&&(this._lastChar!=32&&this._beginLine==0&&this.write(" "),this.write("#"+l.content),this.newline())}}}printTrailingComments(e){if(this.enableComments&&e.trailingComments!=null){let t=0,i=e.trailingComments;for(;t<i.length;){let l=i[t];++t,this._lastChar!=32&&this._beginLine==0&&this.write(" "),l.multiline?this.write("/*"+l.content+"*/ "):l.isHash?(this.write("#"+l.content),this.newline()):(this.write("//"+l.content),this.newline())}}}printImport(e){this.printLeadingComments(e),this.write('import "'+te.string(e.path)+'"'),this.newline(),this.printTrailingComments(e)}printScript(e){let t=0,i=e.body;for(;t<i.length;){let l=i[t];++t,this._prevLevel=this._level,this.printNode(l)}}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,i=0,l=e.fields;for(;i<l.length;){let n=l[i];++i,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,i=e.fields;for(;t<i.length;){let l=i[t];++t,this.printLeadingComments(l),this.write(""+l.name+": "),this.printTrailingComments(l),this.printNode(l.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,i=e.body.length;for(;t<i;){let l=t++;this._prevLevel=this._level,this.printNode(e.body[l]),l<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,i=e.options;for(;t<i.length;){let l=i[t];++t,this.printNode(l),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.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 Ni)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,i=e.body;for(;t<i.length;){let l=i[t];++t,this.printNode(l),this._beginLine==0&&l!=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 i=this._numEmptyLines,l=0,n=e.thenBranch.body;for(;l<n.length;){let s=n[l];++l,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 gi){let s=e.elseBranch.body[0];(this._numEmptyLines-i>0||this.needsEmptyLines(s))&&this.newline(),this.write("else "),this.printIfStatement(e.elseBranch.body[0],!0)}else{this._numEmptyLines-i>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 h=r[s];++s,this.printNode(h),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 i=0,l=e.items.length;for(;i<l;){let n=i++,s=e.items[n];this._level++;let r=0,h=s.body;for(;r<h.length;){let a=h[r];++r,this.printNode(a),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 tl(this._indent,`
|
|
43
44
|
`).print(e).indexOf(`
|
|
44
45
|
|
|
45
|
-
`)!=-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 i=0,
|
|
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 i=0,l=e.parts;for(;i<l.length;){let n=l[i];++i;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 h=s.expr,a=this.isSimpleInterpolationExpr(h);this.write("$"),a||this.write("{"),this.printNode(h),a||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(`
|
|
46
47
|
`)==-1){this.write(e);return}let t=e.split(`
|
|
47
|
-
`),i=0,
|
|
48
|
+
`),i=0,l=t.length;for(;i<l;){let n=i++;n>0&&(this._buf.b+=te.string(this._newline));let s=t[n],r;if(s.length>0){let h=p.cca(s,s.length-1);r=(h??-1)==13}else r=!1;if(r){let h=s.length-1;s=h!=null?s.substring(0,h):s.substring(0)}if(s.length>0){this._buf.b+=s==null?"null":""+s;let h=p.cca(s,s.length-1);this._lastChar=h??-1}}}writeRawWithContinuation(e,t){if(e.indexOf(`
|
|
48
49
|
`)==-1){this.write(e);return}let i=e.split(`
|
|
49
|
-
`),
|
|
50
|
-
`)!=-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 e.word?"and":"&&";case 37:return e.word?"or":"||";case 38:return"!";default:throw
|
|
51
|
-
\r`,
|
|
50
|
+
`),l=0,n=i.length;for(;l<n;){let s=l++;s>0&&(this._buf.b+=te.string(this._newline),this._beginLine=1);let r=i[s],h;if(r.length>0){let a=p.cca(r,r.length-1);h=(a??-1)==13}else h=!1;if(h){let a=r.length-1;r=a!=null?r.substring(0,a):r.substring(0)}if(t&&s>0){let a=0;for(;;){let o;if(a<r.length){let u=p.cca(r,a);if((u??-1)!=32){let c=p.cca(r,a);o=(c??-1)==9}else o=!0}else o=!1;if(!o)break;++a}if(a>0){let o=null;r=o!=null?r.substring(a,o):r.substring(a)}}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":te.string(e.value));break;case 1:this.write(e.value?"true":"false");break;case 2:this.write("null");break;case 3:let i=!0;this.write("[");let l=0,n=e.value;for(;l<n.length;){let o=n[l];++l,i||this.write(", "),i=!1,this.printNode(o)}this.write("]");break;case 4:let s=t.style;s==1?(this.write("{"),this.newline()):this.newline(),this._level++;let r=!0,h=0,a=e.value;for(;h<a.length;){let o=a[h];++h,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,i=0,l=e.args;for(;i<l.length;){let n=l[i];++i,t||this.write(", "),t=!1,this.printNode(n)}this.write(")"),this.printTrailingComments(e)}printBinary(e,t){t==null&&(t=!1),this.printLeadingComments(e);let i;if(t)i=!1;else{let l=e.op;switch(l._hx_index){case 36:let n=l.word;i=!0;break;case 37:let s=l.word;i=!0;break;default:i=!1}}i&&this.write("("),this.printNode(e.left),this.write(" "+this.getOperator(e.op)+" "),this.printNode(e.right),i&&this.write(")"),this.printTrailingComments(e)}printUnary(e){this.printLeadingComments(e),this.write(this.getOperator(e.op)),this.printTrailingComments(e),this.printNode(e.operand)}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 i=this.enableComments;this.enableComments=!1,t&&this.write("("),e instanceof Xt?this.printBinary(e,!0):this.printNode(e),t&&this.write(")"),this.enableComments=i}isSimpleInterpolationExpr(e){if(e instanceof pt){let t=e;return t.target==null?!0:this.isSimpleInterpolationExpr(t.target)}return e instanceof ui?this.isSimpleInterpolationExpr(Y.__cast(e,ui).target):e instanceof Vt?this.isSimpleInterpolationExpr(Y.__cast(e,Vt).target):!1}hasRealNewlines(e){if(e instanceof Et){let t=e;if(t.quotes==1)return!1;let i=0,l=t.parts;for(;i<l.length;){let n=l[i];++i;let s=n.partType;if(s._hx_index==0&&s.text.indexOf(`
|
|
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 e.word?"and":"&&";case 37:return e.word?"or":"||";case 38:return"!";default:throw y.thrown("Unsupported operator: "+te.string(e))}}}z["loreline.Printer"]=tl,tl.__name__="loreline.Printer",Object.assign(tl.prototype,{__class__:tl});class Xl{static toString(e){switch(e){case 0:return"Unquoted";case 1:return"DoubleQuotes"}}}class ol{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}}z["loreline.Random"]=ol,ol.__name__="loreline.Random",Object.assign(ol.prototype,{__class__:ol});class ci extends Le{constructor(e,t,i){Nt._hx_skip_constructor=!0,super(),Nt._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}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 Zt||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 Kl(this.body)}}z["loreline.Script"]=Gi.loreline.Script=ci,ci.__name__="loreline.Script",ci.__super__=Le,Object.assign(ci.prototype,{__class__:ci});class Kl{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 Zt){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}}z["loreline._Script.ScriptBodyIterator"]=Kl,Kl.__name__="loreline._Script.ScriptBodyIterator",Object.assign(Kl.prototype,{__class__:Kl});class an{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)}}z["loreline.Utf8"]=an,an.__name__="loreline.Utf8";class bl extends si{constructor(e,t,i){super(t,i),this.wrapped=e}}z["loreline.WrappedError"]=bl,bl.__name__="loreline.WrappedError",bl.__super__=si,Object.assign(bl.prototype,{__class__:bl});class Zl{static main(){}}z["loreline.lib.Library"]=Zl,Zl.__name__="loreline.lib.Library";function on(k){return k instanceof Array?new bi(k):k.iterator()}function Ce(k,e){if(e==null)return null;e.__id__==null&&(e.__id__=Gl.$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}Gl.$haxeUID|=0,typeof performance<"u"&&typeof performance.now=="function"&&(p.now=performance.now.bind(performance)),z.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:z.String=String,enumerable:!1,writable:!0}),String.__name__="String",z.Array=Array,Array.__name__="Array",Date.prototype.__class__=z.Date=Date,Date.__name__="Date";var _n={},fn={},mn=Number,gn=Boolean,dn={},xn={}}Y.__toStr={}.toString,$.Element=0,$.PCData=1,$.CData=2,$.Document=6,Ot.randomId_nonHexChars="ghijklmnopqrstuvwxyz",Ot.randomId_chars="0123456789abcdefghijklmnopqrstuvwxyz",rl.ObjectBrace=0,rl.ArrayBracket=1,rl.Brace=2,rl.Indent=3,rl.CaseIndent=4,rl.Bracket=5,rl.Paren=6,qi.CONTROL_KEYWORDS=["for","while","if","else","switch","catch"],_i.INITIAL_SIZE=16,_i.LOAD_FACTOR=.75,Pi.ChoiceBrace=0,Pi.ChoiceIndent=1,Pi.StateBrace=2,Pi.StateIndent=3,Pi.CharacterBrace=4,Pi.CharacterIndent=5,Pi.BeatBrace=6,Pi.BeatIndent=7,Pi.AlternativeBrace=8,Pi.AlternativeIndent=9,Pi.Brace=10,Pi.Indent=11,Pi.Bracket=12,bt.hasNonSpecialChar_specialChars=` "+=*/-(){}[]:
|
|
52
|
+
\r`,bt.KEYWORDS=(function(k){var e;let t=new Se;return t.h.import=x.KwImport,t.h.state=x.KwState,t.h.beat=x.KwBeat,t.h.character=x.KwCharacter,t.h.choice=x.KwChoice,t.h.if=x.KwIf,t.h.else=x.KwElse,t.h.new=x.KwNew,t.h.sequence=x.KwSequence,t.h.cycle=x.KwCycle,t.h.once=x.KwOnce,t.h.pick=x.KwPick,t.h.shuffle=x.KwShuffle,t.h.true=x.LBoolean(!0),t.h.false=x.LBoolean(!1),t.h.null=x.LNull,t.h.and=x.OpAnd(!0),t.h.or=x.OpOr(!0),e=t,e})(this),Ue.OFFSET=32768,Ue.MAX=65535,Ue.UNDEFINED=new Ue(0,0,0,0),Nt._hx_skip_constructor=!1,Oi.Plain=0,Oi.Braces=1,kl.Plain=0,kl.Parens=2,wl.Sequence=0,wl.Cycle=1,wl.Once=2,wl.Pick=3,wl.Shuffle=4,Xl.Unquoted=0,Xl.DoubleQuotes=1,Zl.main()})(Jl,Pn);export const Loreline=Jl.loreline.Loreline,Interpreter=Jl.loreline.Interpreter,Node=Jl.loreline.Node,Script=Jl.loreline.Script;
|