loreline 0.7.0 → 0.7.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/js/loreline.js +4 -0
- package/js/loreline.min.js +1 -1
- package/package.json +1 -1
package/js/loreline.js
CHANGED
|
@@ -22767,6 +22767,10 @@ class loreline_Lexer {
|
|
|
22767
22767
|
return pos == length;
|
|
22768
22768
|
}
|
|
22769
22769
|
makeLooseOrStrictAfterBracket() {
|
|
22770
|
+
if(this.isStrict()) {
|
|
22771
|
+
this.strictExprs.push(1);
|
|
22772
|
+
return;
|
|
22773
|
+
}
|
|
22770
22774
|
let i = this.tokenized.length - 1;
|
|
22771
22775
|
while(i >= 0) {
|
|
22772
22776
|
let token = this.tokenized[i];
|
package/js/loreline.min.js
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
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
35
|
`)==-1)return e;let t=e.split(`
|
|
36
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(`
|
|
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(){if(this.isStrict()){this.strictExprs.push(1);return}let e=this.tokenized.length-1;for(;e>=0;){let i=this.tokenized[e].type;switch(i._hx_index){case 19:let l=i.name;this.strictExprs.push(1);return;case 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
38
|
`,null)==-1;B||(L+=`
|
|
39
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
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=`
|
package/package.json
CHANGED