phaser4-rex-plugins
Version:
16 lines • 325 kB
JavaScript
var e,t;e=void 0,t=function(){function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function i(){}function n(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function s(e,t,i,s,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new n(i,s||e,o),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],a]:e._events[u].push(a):(e._events[u]=a,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(r=!1)),a.prototype.eventNames=function(){var e,i,n=[];if(0===this._eventsCount)return n;for(i in e=this._events)t.call(e,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},a.prototype.listeners=function(e){var t=r?r+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,s=i.length,o=new Array(s);n<s;n++)o[n]=i[n].fn;return o},a.prototype.listenerCount=function(e){var t=r?r+e:e,i=this._events[t];return i?i.fn?1:i.length:0},a.prototype.emit=function(e,t,i,n,s,o){var a=r?r+e:e;if(!this._events[a])return!1;var u,c,l=this._events[a],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,i),!0;case 4:return l.fn.call(l.context,t,i,n),!0;case 5:return l.fn.call(l.context,t,i,n,s),!0;case 6:return l.fn.call(l.context,t,i,n,s,o),!0}for(c=1,u=new Array(h-1);c<h;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var p,d=l.length;for(c=0;c<d;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),h){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,i);break;case 4:l[c].fn.call(l[c].context,t,i,n);break;default:if(!u)for(p=1,u=new Array(h-1);p<h;p++)u[p-1]=arguments[p];l[c].fn.apply(l[c].context,u)}}return!0},a.prototype.on=function(e,t,r){return s(this,e,t,r,!1)},a.prototype.once=function(e,t,r){return s(this,e,t,r,!0)},a.prototype.removeListener=function(e,t,i,n){var s=r?r+e:e;if(!this._events[s])return this;if(!t)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn!==t||n&&!a.once||i&&a.context!==i||o(this,s);else{for(var u=0,c=[],l=a.length;u<l;u++)(a[u].fn!==t||n&&!a[u].once||i&&a[u].context!==i)&&c.push(a[u]);c.length?this._events[s]=1===c.length?c[0]:c:o(this,s)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&o(this,t)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,e.exports=a}(t);var r=e(t.exports);let i=class extends r{shutdown(){this.removeAllListeners()}destroy(){this.removeAllListeners()}};var n=function(e){if("object"!=typeof e||e.nodeType||e===e.window)return!1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}return!0};const s="tree",o="composite",a="decorator",u="action",c="$state",l=window.crypto&&window.crypto.randomUUID;var h=null,p="#",d=function(e){void 0===e&&(e=null),h=e},f=function(){return h},g=function(){return null===h?l?window.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})):`${p}${h+=1}`},m={getTreeMemory(e){return e.getTreeMemory(this.id)},getData(e,t){return e.get(t,this.id)},setData(e,t,r){return e.set(t,r,this.id),this},getState(e){return this.getData(e,c)},resetState(e){return this.setData(e,c,0),this}},v=function(e,t,r){for(var i=[e];i.length>0;){var n=i.shift();if(!t.call(r,n))switch(n.category){case o:i.push(...n.children),(s=n.services)&&i.push(...s);break;case a:i.push(n.child);break;case u:var s;(s=n.services)&&i.push(...s)}}};function y(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map((e=>y(e)));if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e);if(Object.getPrototypeOf(e)!==Object.prototype)return e;const t={};for(let r in e)e.hasOwnProperty(r)&&(t[r]=y(e[r]));return t}class b{setExpressionHandler(e){return this.expressionHandler=e,this}eval(e){return this.expressionHandler(e)}}function _(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var k={};!function(e){var t=function(){var e=function(e,t,r,i){for(r=r||{},i=e.length;i--;r[e[i]]=t);return r},t=[1,11],r=[1,3],i=[1,4],n=[1,5],s=[1,6],o=[1,8],a=[1,9],u=[1,10],c=[1,13],l=[1,14],h=[1,15],p=[1,16],d=[1,17],f=[1,18],g=[1,19],m=[1,20],v=[1,21],y=[1,22],b=[1,23],_=[1,24],k=[1,25],S=[1,26],E=[5,7,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,28,30],x=[5,7,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,30],w=[5,7,12,13,14,19,20,21,22,23,24,25,26,28,30],C=[5,7,12,13,14,15,16,17,19,20,21,22,23,24,25,26,28,30],M=[5,7,12,19,20,21,22,23,24,25,26,28,30],O=[5,7,12,25,26,28,30],P=[7,28],T={trace:function(){},yy:{},symbols_:{error:2,expressions:3,e:4,EOF:5,expression_list:6,",":7,dot_name:8,".":9,NAME:10,"[":11,"]":12,"+":13,"-":14,"*":15,"/":16,"%":17,"^":18,">":19,"<":20,"==":21,"!=":22,">=":23,"<=":24,"||":25,"&&":26,"(":27,")":28,"?":29,":":30,true:31,false:32,QUOTED_STRING:33,NUMBER:34,HEXNUMBER:35,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",7:",",9:".",10:"NAME",11:"[",12:"]",13:"+",14:"-",15:"*",16:"/",17:"%",18:"^",19:">",20:"<",21:"==",22:"!=",23:">=",24:"<=",25:"||",26:"&&",27:"(",28:")",29:"?",30:":",31:"true",32:"false",33:"QUOTED_STRING",34:"NUMBER",35:"HEXNUMBER"},productions_:[0,[3,2],[6,3],[6,1],[8,3],[8,4],[8,1],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,2],[4,3],[4,7],[4,1],[4,1],[4,1],[4,3],[4,4],[4,1],[4,1],[4,1]],performAction:function(e,t,r,i,n,s,o){var a=s.length-1;switch(n){case 1:var u=s[a-1];return"function"==typeof u?u:function(e){return u};case 2:case 4:this.$=s[a-2].concat([s[a]]);break;case 3:case 6:this.$=[s[a]];break;case 5:this.$=s[a-3].concat([s[a-1]]);break;case 7:this.$=function(e){return N(i.parser,e,"_add",[s[a-2],s[a]])};break;case 8:this.$=function(e){return N(i.parser,e,"_subtract",[s[a-2],s[a]])};break;case 9:this.$=function(e){return N(i.parser,e,"_multiply",[s[a-2],s[a]])};break;case 10:this.$=function(e){return N(i.parser,e,"_divide",[s[a-2],s[a]])};break;case 11:this.$=function(e){return N(i.parser,e,"_mod",[s[a-2],s[a]])};break;case 12:this.$=function(e){return N(i.parser,e,"_pow",[s[a-2],s[a]])};break;case 13:this.$=function(e){return 1==N(i.parser,e,"_greaterThen",[s[a-2],s[a]])};break;case 14:this.$=function(e){return 1==N(i.parser,e,"_lessThen",[s[a-2],s[a]])};break;case 15:this.$=function(e){return 1==N(i.parser,e,"_equalTo",[s[a-2],s[a]])};break;case 16:this.$=function(e){return 0==N(i.parser,e,"_equalTo",[s[a-2],s[a]])};break;case 17:this.$=function(e){return 0==N(i.parser,e,"_lessThen",[s[a-2],s[a]])};break;case 18:this.$=function(e){return 0==N(i.parser,e,"_greaterThen",[s[a-2],s[a]])};break;case 19:this.$=function(e){return 1==N(i.parser,e,"_or",[s[a-2],s[a]])};break;case 20:this.$=function(e){return 1==N(i.parser,e,"_and",[s[a-2],s[a]])};break;case 21:this.$=function(e){return-A(s[a],e)};break;case 22:this.$=function(e){return A(s[a-1],e)};break;case 23:this.$=function(e){return A(s[a-5],e)?A(s[a-2],e):A(s[a],e)};break;case 24:this.$=!0;break;case 25:this.$=!1;break;case 26:this.$=function(e){return i.parser.getDotProperty(e,L(s[a],e),0)};break;case 27:this.$=function(e){return j(i.parser,e,L(s[a-2],e),void 0,!0)};break;case 28:this.$=function(e){return j(i.parser,e,L(s[a-3],e),s[a-1],!0)};break;case 29:this.$=e.slice(1,-1);break;case 30:this.$=Number(e);break;case 31:this.$=parseInt(e,16)}},table:[{3:1,4:2,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},{1:[3]},{5:[1,12],13:c,14:l,15:h,16:p,17:d,18:f,19:g,20:m,21:v,22:y,23:b,24:_,25:k,26:S},{4:27,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},{4:28,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},e(E,[2,24]),e(E,[2,25]),e(E,[2,26],{9:[1,30],11:[1,31],27:[1,29]}),e(E,[2,29]),e(E,[2,30]),e(E,[2,31]),e(x,[2,6]),{1:[2,1]},{4:32,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},{4:33,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},{4:34,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},{4:35,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},{4:36,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},{4:37,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},{4:38,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},{4:39,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},{4:40,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},{4:41,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},{4:42,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},{4:43,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},{4:44,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},{4:45,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},e(E,[2,21]),{13:c,14:l,15:h,16:p,17:d,18:f,19:g,20:m,21:v,22:y,23:b,24:_,25:k,26:S,28:[1,46]},{4:49,6:48,8:7,10:t,14:r,27:i,28:[1,47],31:n,32:s,33:o,34:a,35:u},{10:[1,50]},{4:51,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},e(w,[2,7],{15:h,16:p,17:d,18:f}),e(w,[2,8],{15:h,16:p,17:d,18:f}),e(C,[2,9],{18:f}),e(C,[2,10],{18:f}),e([5,7,12,13,14,17,19,20,21,22,23,24,25,26,28,30],[2,11],{15:h,16:p,18:f}),e(E,[2,12]),e(M,[2,13],{13:c,14:l,15:h,16:p,17:d,18:f}),e(M,[2,14],{13:c,14:l,15:h,16:p,17:d,18:f}),e(M,[2,15],{13:c,14:l,15:h,16:p,17:d,18:f}),e(M,[2,16],{13:c,14:l,15:h,16:p,17:d,18:f}),e(M,[2,17],{13:c,14:l,15:h,16:p,17:d,18:f}),e(M,[2,18],{13:c,14:l,15:h,16:p,17:d,18:f}),e(O,[2,19],{13:c,14:l,15:h,16:p,17:d,18:f,19:g,20:m,21:v,22:y,23:b,24:_}),e(O,[2,20],{13:c,14:l,15:h,16:p,17:d,18:f,19:g,20:m,21:v,22:y,23:b,24:_}),e(E,[2,22],{29:[1,52]}),e(E,[2,27]),{7:[1,54],28:[1,53]},e(P,[2,3],{13:c,14:l,15:h,16:p,17:d,18:f,19:g,20:m,21:v,22:y,23:b,24:_,25:k,26:S}),e(x,[2,4]),{12:[1,55],13:c,14:l,15:h,16:p,17:d,18:f,19:g,20:m,21:v,22:y,23:b,24:_,25:k,26:S},{4:56,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},e(E,[2,28]),{4:57,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},e(x,[2,5]),{13:c,14:l,15:h,16:p,17:d,18:f,19:g,20:m,21:v,22:y,23:b,24:_,25:k,26:S,30:[1,58]},e(P,[2,2],{13:c,14:l,15:h,16:p,17:d,18:f,19:g,20:m,21:v,22:y,23:b,24:_,25:k,26:S}),{4:59,8:7,10:t,14:r,27:i,31:n,32:s,33:o,34:a,35:u},e([5,7,12,28,30],[2,23],{13:c,14:l,15:h,16:p,17:d,18:f,19:g,20:m,21:v,22:y,23:b,24:_,25:k,26:S})],defaultActions:{12:[2,1]},parseError:function(e,t){if(!t.recoverable){var r=new Error(e);throw r.hash=t,r}this.trace(e)},parse:function(e){var t=this,r=[0],i=[null],n=[],s=this.table,o="",a=0,u=0,c=n.slice.call(arguments,1),l=Object.create(this.lexer),h={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(h.yy[p]=this.yy[p]);l.setInput(e,h.yy),h.yy.lexer=l,h.yy.parser=this,void 0===l.yylloc&&(l.yylloc={});var d=l.yylloc;n.push(d);var f=l.options&&l.options.ranges;"function"==typeof h.yy.parseError?this.parseError=h.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var g,m,v,y,b,_,k,S,E,x={};;){if(m=r[r.length-1],this.defaultActions[m]?v=this.defaultActions[m]:(null==g&&(E=void 0,"number"!=typeof(E=l.lex()||1)&&(E=t.symbols_[E]||E),g=E),v=s[m]&&s[m][g]),void 0===v||!v.length||!v[0]){var w="";for(b in S=[],s[m])this.terminals_[b]&&b>2&&S.push("'"+this.terminals_[b]+"'");w=l.showPosition?"Parse error on line "+(a+1)+":\n"+l.showPosition()+"\nExpecting "+S.join(", ")+", got '"+(this.terminals_[g]||g)+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==g?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(w,{text:l.match,token:this.terminals_[g]||g,line:l.yylineno,loc:d,expected:S})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+g);switch(v[0]){case 1:r.push(g),i.push(l.yytext),n.push(l.yylloc),r.push(v[1]),g=null,u=l.yyleng,o=l.yytext,a=l.yylineno,d=l.yylloc;break;case 2:if(_=this.productions_[v[1]][1],x.$=i[i.length-_],x._$={first_line:n[n.length-(_||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(_||1)].first_column,last_column:n[n.length-1].last_column},f&&(x._$.range=[n[n.length-(_||1)].range[0],n[n.length-1].range[1]]),void 0!==(y=this.performAction.apply(x,[o,u,a,h.yy,v[1],i,n].concat(c))))return y;_&&(r=r.slice(0,-1*_*2),i=i.slice(0,-1*_),n=n.slice(0,-1*_)),r.push(this.productions_[v[1]][0]),i.push(x.$),n.push(x._$),k=s[r[r.length-2]][r[r.length-1]],r.push(k);break;case 3:return!0}}return!0}};function A(e,t){return"function"==typeof e?e(t):e}function L(e,t){return e&&(e=e.map((function(e){return A(e,t)}))),e}function N(e,t,r,i){return e[r].apply(e,L(i,t))}function j(e,t,r,i,n){var s,o,a;if((s="string"==typeof r?n?r.split("."):[r]:r).length>1){var u=s.pop();o=(a=e.getDotProperty(t,s))[u]}else o=e.getProperty(t,r),a=e;return null==o&&(o=e.getProperty(t,"defaultHandler"),a=e),o.apply(a,L(i,t))}var I=function(){var e={EOF:1,parseError:function(e,t){if(!this.yy.parser)throw new Error(e);this.yy.parser.parseError(e,t)},setInput:function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,r=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),r.length-1&&(this.yylineno-=r.length-1);var n=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===i.length?this.yylloc.first_column:0)+i[i.length-r.length].length-r[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[n[0],n[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},test_match:function(e,t){var r,i,n;if(this.options.backtrack_lexer&&(n={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(n.yylloc.range=this.yylloc.range.slice(0))),(i=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],r=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),r)return r;if(this._backtrack){for(var s in n)this[s]=n[s];return!1}return!1},next:function(){if(this.done)return this.EOF;var e,t,r,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),s=0;s<n.length;s++)if((r=this._input.match(this.rules[n[s]]))&&(!t||r[0].length>t[0].length)){if(t=r,i=s,this.options.backtrack_lexer){if(!1!==(e=this.test_match(r,n[s])))return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?!1!==(e=this.test_match(t,n[i]))&&e:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return e||this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(e){return(e=this.conditionStack.length-1-Math.abs(e||0))>=0?this.conditionStack[e]:"INITIAL"},pushState:function(e){this.begin(e)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(e,t,r,i){switch(r){case 0:break;case 1:return 34;case 2:return 35;case 3:return 15;case 4:return 16;case 5:return 14;case 6:return 13;case 7:return 18;case 8:return 17;case 9:return">=";case 10:return"<=";case 11:return 19;case 12:return 20;case 13:return"==";case 14:return"!=";case 15:return"||";case 16:return"&&";case 17:return"?";case 18:return":";case 19:return 27;case 20:return 28;case 21:return 11;case 22:return 12;case 23:return 7;case 24:return 9;case 25:return 31;case 26:return 32;case 27:return 10;case 28:return 33;case 29:return 5;case 30:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:[0-9]+(\.[0-9]+)?\b)/,/^(?:\b0x[0-9A-Fa-f]+\b)/,/^(?:\*)/,/^(?:\/)/,/^(?:-)/,/^(?:\+)/,/^(?:\^)/,/^(?:%)/,/^(?:>=)/,/^(?:<=)/,/^(?:>)/,/^(?:<)/,/^(?:==)/,/^(?:!=)/,/^(?:\|\|)/,/^(?:&&)/,/^(?:\?)/,/^(?::)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?:\.)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:[^\s\*\/\-\+\^\%\>\=\<\!\|\&\?\:\(\)\[\]\,\.\"\']+)/,/^(?:"(\\.|[^\"\\])*"|'(\\.|[^\'\\])*')/,/^(?:$)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],inclusive:!0}}};return e}();function R(){this.yy={}}return T.lexer=I,R.prototype=T,T.Parser=R,new R}();void 0!==_&&(e.parser=t,e.Parser=t.Parser,e.parse=function(){return t.parse.apply(t,arguments)})}(k);var S=e(k),E=function(e,t,r,i){if(void 0===i&&(i=!0),e&&"number"!=typeof e&&"string"!=typeof e){if(t in e)return e[t];if(i&&(Array.isArray(t)||-1!==t.indexOf("."))){for(var n=Array.isArray(t)?t:t.split("."),s=e,o=0;o<n.length;o++){if(!((t=n[o])in s)){s=r;break}s=s[t]}return s}return r}return r};class x extends S.Parser{getProperty(e,t,r){var i=E(e,t,void 0,!1);return void 0!==i?i:E(this,t,r,!1)}getDotProperty(e,t,r){var i=E(e,t,void 0,!0);return void 0!==i?i:E(this,t,r,!0)}static GetProperty(e,t,r,i){return E(e,t,r,i)}_add(e,t){return e+t}_subtract(e,t){return e-t}_multiply(e,t){return e*t}_divide(e,t){return e/t}_mod(e,t){return e%t}_pow(e,t){return Math.pow(e,t)}_greaterThen(e,t){return e>t}_lessThen(e,t){return e<t}_equalTo(e,t){return e==t}_or(e,t){return e||t}_and(e,t){return e&&t}defaultHandler(e,t){return 0}compile(e){return this.parse(e)}exec(e,t){return"string"==typeof e&&(e=this.compile(e)),e(t)}}var w=new x,C=function(e){return w.compile(e)};class M extends b{constructor(e){var t;super(),t="number"==typeof e?function(){return e}:C(e),this.setExpressionHandler(t)}}class O extends M{eval(e){return!!super.eval(e)}}var P=new class{constructor(e){void 0===e&&(e={});var t=e.delimiters;void 0===t&&(t=["{{","}}"]),this.setDelimiters(t[0],t[1]);var r=e.expressionParser;void 0===r&&(r=new x),this.setExpressionParser(r)}setDelimiters(e,t){return void 0===t&&(t=e[1],e=e[0]),this.delimiterLeft=e,this.delimiterRight=t,this.reDelimiter=RegExp(`${e}|${t}`,"gi"),this.reSplit=RegExp(`${e}.*?${t}`,"gi"),this}setExpressionParser(e){return this.expressionParser=e,this}compile(e,t){var r,i,n;if(t)if(t instanceof x)(u=t)&&(n=this.expressionParser,this.setExpressionParser(u));else{var s=t.delimiters;s&&(r=this.delimiterLeft,i=this.delimiterRight,this.setDelimiters(s[0],s[1])),(u=t.expressionParser)&&(n=this.expressionParser,this.setExpressionParser(u))}for(var o=this.reDelimiter,a=this.reSplit,u=this.expressionParser,c=[],l=0;;){var h=a.exec(e);if(!h)break;var p=h[0],d=a.lastIndex,f=d-p.length;l<f&&c.push(e.substring(l,f));var g=e.substring(f,d).replace(o,"");c.push(u.compile(g)),l=d}var m=e.length;return l<m&&c.push(e.substring(l,m)),r&&this.setDelimiters(r,i),n&&this.setExpressionParser(n),function(e){return c.map((function(t){return"function"==typeof t&&(t=t(e)),t})).join("")}}render(e,t,r){return("string"==typeof e?this.compile(e,r):e)(t)}};class T extends b{constructor(e){super();var t,r,i=(t=e,P.compile(t,r));this.setExpressionHandler(i)}}class A{constructor({id:e,category:t,name:r,title:i,description:n,properties:s}={}){void 0===e&&(e=g()),this.parent=null,this.id=e,this.category=t||"",this.name=r||"",this.title=i||this.name,this.description=n||"",this.properties=s||{}}destroy(){this.parent=void 0,this.properties=void 0}setTitle(e){return this.title=e,this}setName(e){return this.name=e,this}setDescription(e){return this.description=e,this}setParent(e){return this.parent=e,this}getParent(){return this.parent}getTree(e){if(e)return e.tree;for(var t=this.parent;t;){if(t.category===s)return t;t=t.parent}return null}addExpression(e){return new M(e)}addBooleanExpression(e){return new O(e)}addStringTemplateExpression(e){return new T(e)}_execute(e){this._enter(e),this.getOpenState(e)||this._open(e);var t=this._tick(e);return 1!==t&&2!==t&&5!==t&&9!==t||this._close(e),this._exit(e),t}_enter(e){e._enterNode(this),this.enter(e)}_open(e){e._openNode(this),this.setOpenState(e,!0),this.open(e)}_tick(e){return e._tickNode(this),this.tick(e)}_close(e){e._closeNode(this),this.setOpenState(e,!1),this.close(e),this.abortChildren(e)}_exit(e){e._exitNode(this),this.exit(e)}_abort(e){this._close(e),this.abort(e)}enter(e){}open(e){}tick(e){}close(e){}exit(e){}abortChildren(e){}abort(e){}getNodeMemory(e){return e.getNodeMemory(this.id)}getOpenState(e){return this.getNodeMemory(e).$isOpen}setOpenState(e,t){return void 0===t&&(t=!0),this.getNodeMemory(e).$isOpen=t,this}get SUCCESS(){return 1}get FAILURE(){return 2}get RUNNING(){return 3}get ERROR(){return 9}}class L extends A{constructor({name:e="Action",title:t,properties:r,services:i}={},n){if(super({category:u,name:e,title:t,properties:r}),i)for(var s=0,o=i.length;s<o;s++)this.addService(i[s],n)}destroy(){if(this.services)for(var e=0,t=this.services.length;e<t;e++)this.services[e].destroy();this.services=void 0,super.destroy()}addService(e,t){return"string"==typeof e&&(e=t[e]),void 0===this.services&&(this.services=[]),-1===this.services.indexOf(e)&&(this.services.push(e),e.setParent(this)),this}_tick(e){if(e._tickNode(this),this.services)for(var t=0,r=this.services.length;t<r;t++)this.services[t]._tick(e);return this.tick(e)}}class N extends A{constructor({children:e=[],name:t="Composite",title:r,properties:i,services:n}={},s){super({category:o,name:t,title:r,properties:i}),this.children=[];for(var a=0,u=e.length;a<u;a++)this.addChild(e[a],s);if(n)for(a=0,u=n.length;a<u;a++)this.addService(n[a],s)}destroy(){for(var e=0,t=this.children.length;e<t;e++)this.children[e].destroy();if(this.services)for(e=0,t=this.services.length;e<t;e++)this.services[e].destroy();this.children=void 0,this.services=void 0,super.destroy()}insertChild(e,t,r){return"string"==typeof e&&(e=t[e]),-1===this.children.indexOf(e)&&(r<0&&(r=this.children.length+r),void 0===r||r>=this.children.length?this.children.push(e):this.children.splice(r,0,e),e.setParent(this)),this}addChild(e,t){return this.insertChild(e,t),this}addService(e,t){return"string"==typeof e&&(e=t[e]),void 0===this.services&&(this.services=[]),-1===this.services.indexOf(e)&&(this.services.push(e),e.setParent(this)),this}_tick(e){if(e._tickNode(this),this.services)for(var t=0,r=this.services.length;t<r;t++)this.services[t]._tick(e);return this.tick(e)}abortChildren(e){for(var t=0,r=this.children.length;t<r;t++){var i=this.children[t];i.getOpenState(e)&&i._abort(e)}}}class j extends A{constructor({child:e=null,name:t="Decorator",title:r,properties:i}={},n){super({category:a,name:t,title:r,properties:i}),this.child=null,e&&this.addChild(e,n)}destroy(){this.child&&this.child.destroy(),this.child=void 0,super.destroy()}addChild(e,t){return"string"==typeof e&&(e=t[e]),this.child=e,e.setParent(this),this}chainChild(e,t){for(var r=this;r.child instanceof j;)r=r.child;return r.addChild(e,t),this}isChildRunning(e){return this.child.getOpenState(e)}abortChildren(e){this.isChildRunning(e)&&this.child._abort(e)}openChild(e){return this.child.setOpenState(e,!0),this}}class I extends L{constructor({services:e,title:t,name:r="Succeeder"}={}){super({services:e,title:t,name:r})}tick(e){return 1}}class R extends L{constructor({services:e,title:t,name:r="Abort"}={}){super({services:e,title:t,name:r})}tick(e){return 5}}let G=class extends j{constructor({child:e=null,title:t,name:r="Break",tag:i}={},n){super({child:e,title:t,name:r,properties:{tag:i}},n),this.breakFlag=!1,this.tag=i}setBreakFlag(e){return void 0===e&&(e=!0),this.breakFlag=e,this}tick(e){if(!this.child)return 1;var t=this.child._execute(e);return this.breakFlag&&(t=1,this.breakFlag=!1),t}},B=class extends L{constructor({breakDecoratorTitle:e,tag:t,services:r,title:i,name:n="Break"}={}){super({name:n,title:i,properties:{breakDecoratorTitle:e,tag:t},services:r}),this.breakDecoratorTitle=e,this.tag=t}tick(e){for(var t,r=this.getParent();!(r instanceof G)||this.tag&&this.tag!==r.tag||this.breakDecoratorTitle&&this.breakDecoratorTitle!==r.title;){if(!r.getParent){r=null;break}r=r.getParent()}return r?(r.setBreakFlag(),t=5):(console.error("[EventSheet] Can't get responded BreakDecorator, ignore this break action node."),t=1),t}};class D extends N{constructor({children:e=[],services:t,title:r,name:i="Selector"}={},n){super({children:e,services:t,title:r,name:i},n)}open(e){this.getNodeMemory(e).$runningChild=-1}tick(e){if(0===this.children.length)return 9;var t,r=this.getNodeMemory(e),i=r.$runningChild;if(i<0){for(var n=0,s=this.children.length;n<s;n++)if(3===(t=this.children[n]._execute(e))||1===t||5===t){i=n;break}}else t=this.children[i]._execute(e);return r.$runningChild=3===t?i:-1,t}abortChildren(e){var t=this.getNodeMemory(e),r=this.children[t.$runningChild];r&&(r._abort(e),t.$runningChild=-1)}}class F extends N{constructor({children:e=[],services:t,title:r,name:i="Sequence"}={},n){super({children:e,services:t,title:r,name:i},n)}open(e){this.getNodeMemory(e).$runningChild=0}tick(e){if(0===this.children.length)return 9;for(var t,r=this.getNodeMemory(e),i=r.$runningChild,n=this.children.length;i<n&&3!==(t=this.children[i]._execute(e))&&2!==t&&5!==t;i++);return r.$runningChild=3===t?i:-1,t}abortChildren(e){var t=this.getNodeMemory(e),r=this.children[t.$runningChild];r&&(r._abort(e),t.$runningChild=-1)}}
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2018 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/var $=function(e,t){if(!(t>=e.length)){for(var r=e.length-1,i=e[t],n=t;n<r;n++)e[n]=e[n+1];return e.length=r,i}},U=function(e,t,r,i){var n;if(void 0===i&&(i=e),!Array.isArray(t))return-1!==(n=e.indexOf(t))?($(e,n),r&&r.call(i,t),t):null;for(var s=t.length-1;s>=0;){var o=t[s];-1!==(n=e.indexOf(o))?($(e,n),r&&r.call(i,o)):t.pop(),s--}return t};
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2019 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/class V extends N{constructor({expression:e="true",conditionEvalBreak:t=!1,children:r=[],services:i,title:n,name:s="IfSelector"}={},o){super({children:r,services:i,title:n,name:s,properties:{expression:e,conditionEvalBreak:t}},o),this.expression=this.addBooleanExpression(e),this.conditionEvalBreak=t,this.forceSelectChildIndex=void 0}open(e){this.getNodeMemory(e).$runningChild=-1}setSelectChildIndex(e){return this.forceSelectChildIndex=e,this}evalCondition(e){return void 0!==this.forceSelectChildIndex?this.forceSelectChildIndex:e.evalExpression(this.expression)?0:1}tick(e){if(0===this.children.length)return 9;var t=this.getNodeMemory(e),r=t.$runningChild;if(r<0&&(r=this.evalCondition(e),this.conditionEvalBreak))return t.$runningChild=r,3;var i=this.children[r]._execute(e);return t.$runningChild=3===i?r:-1,i}abortChildren(e){var t=this.getNodeMemory(e),r=this.children[t.$runningChild];r&&(r._abort(e),t.$runningChild=-1)}}class H extends j{constructor({child:e=null,title:t,name:r="ForceFailure"}={},i){super({child:e,title:t,name:r,properties:{}},i)}tick(e){if(!this.child)return 9;var t=this.child._execute(e);return 1===t?2:t}}class W extends j{constructor({maxLoop:e=-1,child:t=null,title:r,name:i="Repeat"}={},n){super({child:t,title:r,name:i,properties:{maxLoop:e}},n),this.maxLoopExpression=this.addExpression(e)}open(e){var t=this.getNodeMemory(e);t.$maxLoop=e.evalExpression(this.maxLoopExpression),t.$i=0}tick(e){if(!this.child)return 9;for(var t=this.getNodeMemory(e),r=t.$maxLoop,i=t.$i,n=1;(r<0||i<r)&&(1===(n=this.child._execute(e))||2===n);)i++;return t.$i=i,n}}class Y extends j{constructor({maxLoop:e=-1,returnSuccess:t=!1,child:r=null,title:i,name:n="RepeatUntilFailure"}={},s){super({child:r,title:i,name:n,properties:{returnSuccess:t,maxLoop:e}},s),this.maxLoopExpression=this.addExpression(e),this.returnSuccess=t}open(e){var t=this.getNodeMemory(e);t.$maxLoop=e.evalExpression(this.maxLoopExpression),t.$i=0}tick(e){if(!this.child)return 9;for(var t=this.getNodeMemory(e),r=t.$maxLoop,i=t.$i,n=9;(r<0||i<r)&&1===(n=this.child._execute(e));)i++;return t.$i=i,n===this.FAILURE&&this.returnSuccess&&(n=1),n}}class z extends j{constructor({expression:e="true",conditionEvalBreak:t=!1,onFailState:r=2,child:i=null,title:n,name:s="If"}={},o){super({child:i,title:n,name:s,properties:{expression:e,conditionEvalBreak:t,onFailState:r}},o),this.expression=this.addBooleanExpression(e),this.conditionEvalBreak=t,this.onFailState=r}tick(e){if(!this.child)return 9;if(!this.isChildRunning(e)){if(!e.evalExpression(this.expression))return this.onFailState;if(this.conditionEvalBreak)return this.openChild(),RUNNING}return this.child._execute(e)}}var K=Object.freeze({__proto__:null,Abort:R,AbortIf:class extends j{constructor({expression:e="true",returnSuccess:t=!0,child:r=null,title:i,name:n="AbortIf"}={},s){super({child:r,title:i,name:n,properties:{expression:e,returnSuccess:t}},s),this.expression=this.addBooleanExpression(e),this.returnSuccess=t}tick(e){return this.child?this.isChildRunning(e)&&e.evalExpression(this.expression)?this.returnSuccess?1:2:this.child._execute(e):9}},Action:L,BaseNode:A,BreakAction:B,BreakDecorator:G,Bypass:class extends j{constructor({child:e=null,title:t,name:r="Bypass"}={},i){super({child:e,title:t,name:r},i)}tick(e){return this.child?this.child._execute(e):9}},Composite:N,ContinueIf:class extends j{constructor({expression:e="true",returnSuccess:t=!0,child:r=null,title:i,name:n="ContinueIf"}={},s){super({child:r,title:i,name:n,properties:{expression:e,returnSuccess:t}},s),this.expression=this.addBooleanExpression(e),this.returnSuccess=t}tick(e){return this.child?this.isChildRunning(e)&&!e.evalExpression(this.expression)?this.returnSuccess?1:2:this.child._execute(e):9}},Cooldown:class extends j{constructor({duration:e=0,child:t=null,title:r,name:i="Cooldown"}={},n){super({child:t,title:r,name:i,properties:{duration:e}},n),this.durationExpression=this.addExpression(e)}open(e){this.getNodeMemory(e).$cooldownTime=e.evalExpression(this.durationExpression)}tick(e){if(!this.child)return 9;var t=this.getNodeMemory(e),r=e.currentTime,i=t.$lastEndTime,n=t.$cooldownTime;if(void 0!==i&&r-i<n)return 2;var s=this.child._execute(e);return 1!==s&&2!==s&&5!==s||(t.$lastEndTime=r),s}},Decorator:j,Error:class extends L{constructor({services:e,title:t,name:r="Error"}={}){super({services:e,title:t,name:r})}tick(e){return 9}},Failer:class extends L{constructor({services:e,title:t,name:r="Failer"}={}){super({services:e,title:t,name:r})}tick(e){return 2}},ForceFailure:H,ForceSuccess:class extends j{constructor({child:e=null,title:t,name:r="ForceSuccess"}={},i){super({child:e,title:t,name:r,properties:{}},i)}tick(e){if(!this.child)return 9;var t=this.child._execute(e);return 2===t?1:t}},If:z,IfSelector:V,Invert:class extends j{constructor({child:e=null,title:t,name:r="Invert"}={},i){super({child:e,title:t,name:r},i)}tick(e){if(!this.child)return 9;var t=this.child._execute(e);return 1===t?t=2:2===t&&(t=1),t}},Limiter:class extends j{constructor({maxLoop:e=1,child:t=null,title:r,name:i="Limiter"}={},n){super({child:t,title:r,name:i,properties:{maxLoop:e}},n),this.maxLoopExpression=this.addExpression(e)}open(e){var t=this.getNodeMemory(e);t.$maxLoop=e.evalExpression(this.maxLoopExpression),t.$i=0}tick(e){if(!this.child)return 9;var t=this.getNodeMemory(e),r=t.$maxLoop,i=t.$i;if(i>=r)return 2;var n=this.child._execute(e);return 1!==n&&2!==n||(t.$i=i+1),n}},Parallel:class extends N{constructor({finishMode:e=0,returnSuccess:t=!0,children:r=[],services:i,title:n,name:s="Parallel"}={},o){super({children:r,services:i,title:n,name:s,properties:{finishMode:e,returnSuccess:t}},o),this.finishMode=e,this.returnSuccess=t}open(e){this.getNodeMemory(e).$runningChildren=this.children.map(((e,t)=>t))}tick(e){if(0===this.children.length)return 9;for(var t=this.getNodeMemory(e),r=t.$runningChildren,i={},n=!1,s=!1,o=!1,a=!1,u=0,c=r.length;u<c;u++){var l=r[u],h=this.children[l]._execute(e);switch(i[l]=h,0===l&&(t.$mainTaskStatus=h),h){case 1:case 2:n=!0;break;case 3:s=!0;break;case 5:o=!0;break;case 9:a=!0}}if(n)for(var l in i)1!==(h=i[l])&&2!==h||U(r,parseInt(l));return 0===this.finishMode?t.$mainTaskStatus:a?9:o?5:s?3:this.returnSuccess?1:t.$mainTaskStatus}abortChildren(e){for(var t=this.getNodeMemory(e),r=t.$runningChildren,i=0,n=r.length;i<n;i++){var s=r[i];this.children[s]._abort(e)}t.$runningChildren.length=0}},RandomSelector:class extends N{constructor({children:e=[],services:t,title:r,name:i="RandomSelector"}={},n){super({children:e,services:t,title:r,name:i},n)}open(e){this.getNodeMemory(e).$runningChild=-1}tick(e){if(0===this.children.length)return ERROR;var t=this.getNodeMemory(e),r=t.$runningChild;r<0&&(r=Math.floor(Math.random()*this.children.length));var i=this.children[r]._execute(e);return t.$runningChild=i===RUNNING?r:-1,i}abortChildren(e){var t=this.getNodeMemory(e),r=this.children[t.$runningChild];r&&(r._abort(e),t.$runningChild=-1)}}
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2018 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/,Repeat:W,RepeatUntilFailure:Y,RepeatUntilSuccess:class extends j{constructor({maxLoop:e=-1,child:t=null,title:r,name:i="RepeatUntilSuccess"}={},n){super({child:t,title:r,name:i,properties:{maxLoop:e}},n),this.maxLoopExpression=this.addExpression(e)}open(e){var t=this.getNodeMemory(e);t.$maxLoop=e.evalExpression(this.maxLoopExpression),t.$i=0}tick(e){if(!this.child)return 9;for(var t=this.getNodeMemory(e),r=t.$maxLoop,i=t.$i,n=9;(r<0||i<r)&&2===(n=this.child._execute(e));)i++;return t.$i=i,n}},Runner:class extends L{constructor({services:e,title:t,name:r="Runner"}={}){super({services:e,title:t,name:r})}tick(e){return 3}},Selector:D,Sequence:F,Service:class extends A{constructor({interval:e=0,randomDeviation:t=0,name:r="Service",title:i,properties:n}={}){void 0===n&&(n={}),n.interval=e,n.randomDeviation=t,super({category:"service",name:r,title:i,properties:n}),this.intervalExpression=this.addExpression(e),this.randomDeviationExpression=this.addExpression(t)}_tick(e){this.canTick(e)&&this.tick(e)}canTick(e){var t=this.getNodeMemory(e),r=e.currentTime,i=t.$lastEndTime,n=t.$interval,s=void 0===i||r-i>=n;if(s){t.$lastEndTime=r,n=e.evalExpression(this.intervalExpression);var o=e.evalExpression(this.randomDeviationExpression);o>0&&(n+=(.5-Math.random())*o),t.$interval=n}return s}},ShuffleSelector:class extends N{constructor({children:e=[],services:t,title:r,name:i="ShuffleSelector"}={},n){super({children:e,services:t,title:r,name:i},n)}open(e){var t=this.getNodeMemory(e);t.$runningChild=0,t.$children||(t.$children=this.children.map(((e,t)=>t))),function(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),i=e[t];e[t]=e[r],e[r]=i}}(t.$children)}tick(e){if(0===this.children.length)return 9;for(var t,r=this.getNodeMemory(e),i=r.$runningChild,n=r.$children,s=i,o=n.length;s<o&&3!==(t=this.children[n[s]]._execute(e))&&1!==t&&5!==t;s++);return r.$runningChild=3===t?s:-1,t}abortChildren(e){var t=this.getNodeMemory(e),r=this.children[t.$runningChild];r&&(r._abort(e),t.$runningChild=-1)}},Succeeder:I,SwitchSelector:class extends N{constructor({expression:e=null,keys:t,conditionEvalBreak:r=!1,children:i={},services:n,title:s,name:o="SwitchSelector"}={},a){void 0===t&&(t=Object.keys(i),i=Object.values(i)),super({children:i,services:n,title:s,name:o,properties:{expression:e,keys:t,conditionEvalBreak:r}},a),this.expression=this.addExpression(e),this.keys=t,this.conditionEvalBreak=r,this.forceSelectChildIndex=void 0}open(e){this.getNodeMemory(e).$runningChild=-1}setSelectChildIndex(e){return this.forceSelectChildIndex=e,this}evalCondition(e){if(void 0!==this.forceSelectChildIndex)return"number"==typeof this.forceSelectChildIndex?this.forceSelectChildIndex:this.keys.indexOf(this.forceSelectChildIndex);var t=e.evalExpression(this.expression);return this.keys.indexOf(t)}tick(e){if(0===this.children.length)return 9;var t=this.getNodeMemory(e),r=t.$runningChild;if(r<0){if(-1===(r=this.evalCondition(e))&&(r=this.keys.indexOf("default")),-1===r)return 9;if(this.conditionEvalBreak)return t.$runningChild=r,3}var i=this.children[r]._execute(e);return t.$runningChild=3===i?r:-1,i}abortChildren(e){var t=this.getNodeMemory(e),r=this.children[t.$runningChild];r&&(r._abort(e),t.$runningChild=-1)}},TimeLimit:class extends j{constructor({duration:e=0,returnSuccess:t=!0,child:r=null,title:i,name:n="TimeLimit"}={},s){super({child:r,title:i,name:n,properties:{duration:e,returnSuccess:t}},s),this.durationExpression=this.addExpression(e),this.returnSuccess=t}open(e){var t=this.getNodeMemory(e);t.$startTime=e.currentTime,t.$duration=e.evalExpression(this.durationExpression)}tick(e){if(!this.child)return 9;var t=this.getNodeMemory(e);return e.currentTime-t.$startTime>=t.$duration?this.returnSuccess?SUCCESS:2:this.child._execute(e)}},Wait:class extends L{constructor({duration:e=0,services:t,title:r,name:i="Wait"}={}){super({title:r,name:i,properties:{duration:e},services:t}),this.durationExpression=this.addExpression(e)}open(e){var t=this.getNodeMemory(e);t.$startTime=e.currentTime,t.$duration=e.evalExpression(this.durationExpression)}tick(e){var t=this.getNodeMemory(e),r=e.currentTime,i=t.$startTime,n=t.$duration;if(n>0){if(r-i<n)return 3}else if(0===n&&r===i)return 3;return 1}},WeightSelector:class extends N{constructor({expression:e=null,weights:t,conditionEvalBreak:r=!1,children:i=[],services:n,title:s,name:o="WeightSelector"}={},a){if(void 0===t){t=[];for(var u=0,c=0,l=i.length;c<l;c++){var h,p=i[c];p instanceof A||"string"==typeof p?h=1:(h=p.weight,i[c]=p.node),t.push(h),u+=h}for(c=0,l=t.length;c<l;c++)t[c]/=u}super({children:i,services:n,title:s,name:o,properties:{expression:e,weights:t,conditionEvalBreak:r}},a),this.expression=e?this.addExpression(e):null,this.weights=t,this.conditionEvalBreak=r,this.forceSelectChildIndex=void 0}open(e){this.getNodeMemory(e).$runningChild=-1}setSelectChildIndex(e){return void 0!==this.forceSelectChildIndex?this.forceSelectChildIndex:(this.forceSelectChildIndex=e,this)}evalCondition(e){if(void 0!==this.forceSelectChildIndex)return this.forceSelectChildIndex;for(var t=this.expression?e.evalExpression(this.expression):Math.random(),r=0,i=this.weights.length;r<i;r++)if((t-=this.weights[r])<0)return r}tick(e){if(0===this.children.length)return 9;var t=this.getNodeMemory(e),r=t.$runningChild;if(r<0&&(void 0===(r=this.evalCondition(e))&&(r=this.children.length-1),this.conditionEvalBreak))return t.$runningChild=r,3;var i=this.children[r]._execute(e);return t.$runningChild=3===i?r:-1,i}abortChildren(e){var t=this.getNodeMemory(e),r=this.children[t.$runningChild];r&&(r._abort(e),t.$runningChild=-1)}}});class q{constructor(){this.tree=null,this.blackboard=null,this.target=null,this._openNodes=[],this._nodeCount=0,this._currentNode=null,this._currentTime=void 0}destroy(){this.tree=null,this.blackboard=null,this.target=null,this._openNodes.length=0}setTree(e){return this.tree=e,this}setBlackBoard(e){return this.blackboard=e,this}setTarget(e){return this.target=e,this}reset(){return this._openNodes.length=0,this._nodeCount=0,this._currentTime=void 0,this}getGlobalMemory(){return this.blackboard.getGlobalMemory()}getTreeMemory(){return this.blackboard.getTreeMemory(this.tree.id)}getNodeMemory(e){return this.blackboard.getNodeMemory(this.tree.id,e)}get currentTime(){return this.blackboard.hasValidCurrentTime()?this.blackboard.getCurrentTime():(void 0===this._currentTime&&(this._currentTime=(new Date).getTime()),this._currentTime)}evalExpression(e){return e.eval(this.blackboard.getGlobalMemory())}_enterNode(e){this._nodeCount++,this._openNodes.push(e),this._currentNode=e}_openNode(e){this._currentNode=e}_tickNode(e){this._currentNode=e}_closeNode(e){U(this._openNodes,e),this._currentNode=e}_exitNode(e){this._currentNode=e}}class X{constructor({id:e,title:t,description:r,properties:i,root:n=null}={}){void 0===e&&(e=g()),this.id=e,this.name="",this.category=s,this.title=t||"",this.description=r||"",this.properties=i||{},this._root=n,this.ticker=(new q).setTree(this)}destroy(){this._root.destroy(),this.ticker.destroy(),this._root=void 0,this.ticker=void 0}setTitle(e){return this.title=e,this}setName(e){return this.name=e,this}setDescription(e){return this.description=e,this}setRoot(e){return this.root=e,this}getRoot(){return this.root}get root(){return this._root}set root(e){e?(this._root=e,e.setParent(this)):(this._root&&this._root.setParent(null),this._root=null)}forEachNode(e,t){return v(this.root,e,t),this}getAllNodes(e){return void 0===e&&(e=[]),this.forEachNode((function(t){e.push(t)})),e}getChildrenNodes(e,t){return void 0===e&&(e=this.root),void 0===t&&(t=[]),v(e,(function(e){t.push(e)})),t}tick(e,t){if(!e)throw"The blackboard parameter is obligatory and must be an instance of Blackboard";var r=this.ticker;r.setBlackBoard(e).setTarget(t).reset();var i=this.root._execute(r);return e.set(c,i,this.id),i}abort(e,t){if(!e)throw"The blackboard parameter is obligatory and must be an instance of Blackboard";var r=this.ticker;return r.setBlackBoard(e).setTarget(t).reset(),this.root.abortChildren(r),e.set(c,0,this.id),0}static setStartIDValue(e){d(e)}static getSerialNumber(){return f()}static setSerialIDPrefix(e){!function(e){p=e}(e)}}var J={dump:function(){var e={sn:f(),id:this.id,title:this.title,description:this.description,root:this.root?this.root.id:null,properties:y(this.properties),nodes:[]};if(!this.root)return e;var t=[];v(this.root,(function(e){t.push(e)}));for(var r=0,i=t.length;r<i;r++){var n=t[r],s={id:n.id,name:n.name,title:n.title,description:n.description,properties:y(n.properties)};switch(n.category){case o:s.children=n.children.map((e=>e.id)),n.services&&(s.services=n.services.map((e=>e.id)));break;case a:n.child&&(s.child=n.child.id);break;case u:n.services&&(s.services=n.services.map((e=>e.id)))}e.nodes.push(s)}return e},load:function(e,t){var r=e.sn;null!=r&&d(Math.max(f(),r)),t=t||{},this.title=e.title||this.title,this.description=e.description||this.description,this.properties=e.properties||this.properties;for(var i=e.nodes,n={},s=i.length-1;s>=0;s--){var o,a=i[s],u=a.name;if(u in t)o=t[u];else{if(!(u in K))throw new EvalError(`BehaviorTree.load: Invalid node name "${u}".`);o=K[u]}var c={};a.hasOwnProperty("children")&&(c.children=a.children),a.hasOwnProperty("child")&&(c.child=a.child),a.hasOwnProperty("services")&&(c.services=a.services);var l=new o(c=Object.assign(c,a.properties),n);l.id=a.id||l.id,l.title=a.title||l.title,l.description=a.description||l.description,l.properties=a.properties||l.properties,n[l.id]=l}return this.root=n[e.root],this}};Object.assign(X.prototype,J,m);var Q=function(e){return null==e||""===e||0===e.length},Z=function(e,t,r,i){if(void 0===i&&(i="."),"object"==typeof e){if(Q(t)){if(null==r)return;"object"==typeof r&&(e=r)}else{"string"==typeof t&&(t=t.split(i));var n=t.pop(),s=function(e,t,r){var i=e;if(Q(t));else{var n;"string"==typeof t&&(t=t.split("."));for(var s=0,o=t.length;s<o;s++){var a;null!=i[n=t[s]]&&"object"==typeof i[n]||(a=s===o-1?void 0===r?{}:r:{},i[n]=a),i=i[n]}}return i}(e,t);s[n]=r}return e}},ee=function(e,t,r){if(!e||"number"==typeof e)return r;if("string"==typeof t){if(e.hasOwnProperty(t))return e[t];if(-1===t.indexOf("."))return r;t=t.split(".")}for(var i=t,n=e,s=r,o=0;o<i.length;o++){if(t=i[o],!n.hasOwnProperty(t)){s=r;break}n=s=n[t]}return s},te=function(e){return null==e||""===e||0===e.length},re=function(e,t,r){if(void 0===r&&(r="."),"object"==typeof e){if(te(t));else{"string"==typeof t&&(t=t.split(r));var i=t.pop(),n=function(e,t){var r=e;if(te(t));else{var i;"string"==typeof t&&(t=t.split("."));for(var n=0,s=t.length;n<s;n++){if(null==r[i=t[n]]||"object"!=typeof r[i])return;r=r[i]}}return r}(e,t);n&&delete n[i]}return e}};let ie=class{constructor(){this._baseMemory={},this._treeMemory={}}destroy(){this._baseMemory=void 0,this._treeMemory=void 0}_getTreeMemory(e){return this._treeMemory[e]||(this._treeMemory[e]={nodeMemory:{}}),this._treeMemory[e]}_getNodeMemory(e,t){var r=e.nodeMemory;return r[t]||(r[t]={}),r[t]}_getMemory(e,t){var r;return void 0!==e?(r=this._getTreeMemory(e),void 0!==t&&(r=this._getNodeMemory(r,t))):r=this._baseMemory,r}set(e,t,r,i){var n=this._getMemory(r,i);return Z(n,e,t),this}setData(e,t,r,i){return this.set(e,t,r,i)}get(e,t,r){var i=this._getMemory(t,r);return ee(i,e)}getData(e,t,r){return this.get(e,t,r)}has(e,t,r){var i;return void 0!==t?(i=this._treeMemory[t])&&void 0!==r&&(i=treeMemory.nodeMemory[r]):i=this._baseMemory,!!i&&function(e,t){if(e&&"number"!=typeof e){if(e.hasOwnProperty(t))return!0;if(-1!==t.indexOf(".")){for(var r=t.split("."),i=e,n=0;n<r.length;n++){if(!i.hasOwnProperty(r[n]))return!1;i=i[r[n]]}return!0}return!1}return!1}(i,e)}hasData(e,t,r){return this.has(e,t,r)}inc(e,t,r,i,n){var s;return this.has(e,r,i)?s=this.get(e,r,i)+t:(void 0===n&&(n=0),s=n),this.set(e,s,r,i),this}incData(e,t,r,i,n){return this.inc(e,t,r,i,n)}toggle(e,t,r,i){var n;return this.has(e,t,r)?n=!this.get(e,t,r):(void 0===i&&(i=!1),n=i),this.set(e,n,t,r),this}toggleData(e,t,r,i){return this.toggle(e,t,r,i)}removeData(e,t,r){var i=this._getMemory(t,r);re(i,e)}removeTree(e){return this._treeMemory[e]&&delete this._treeMemory[e],this}removeTreeData(e){return this.removeTree(e)}removeNode(e,t){var r=this._treeMemory[e];return r&&r.nodeMemory[t]&&delete r.nodeMemory[t],this}removeNodeData(e,t){return this.removeNode(e,t)}getGlobalMemory(){return this._baseMemory}getTreeMemory(e){return this._getTreeMemory(e)}getNodeMemory(e,t){return this._getNodeMemory(this._getTreeMemory(e),t)}dump(){return{base:y(this._baseMemory),tree:y(this._treeMemory)}}load(e){return this._baseMemory=y(e.base),this._treeMemory=y(e.tree),this}};class ne extends ie{constructor({currentTimeKey:e="$currentTime"}={}){super(),this.currentTimeKey=e}getTreeState(e){return this.get(c,e)}setTreeState(e,t){return this.set(c,t,e),this}hasValidCurrentTime(){return this.has(this.currentTimeKey)}setCurrentTime(e){return this.set(this.currentTimeKey,e),this}getCurrentTime(){return this.get(this.currentTimeKey)}incCurrentTime(e){return this.inc(this.currentTimeKey,e),this}}var se={bindTaskActionNode(e,t){this.__bindTick||(this.__bindTick=[],this.__bindNode=[]),this.__bindTick.push(e),this.__bindNode.push(t)},unBindTaskAction(){this.__bindTick&&(this.__bindTick.pop(),this.__bindNode.pop())},pauseEventSheet(){var e=this.__bindNode[this.__bindNode.length-1];if(!e)return null;var t=this.__bindTick[this.__bindTick.length-1];return e.pauseEventSheet(t)},pauseEventSheetUnitlEvent(e,t){var r=this.__bindNode[this.__bindNode.length-1];if(!r)return null;var i=this.__bindTick[this.__bindTick.length-1];return r.pauseEventSheetUnitlEvent(i,e,t),this}},oe={getTree(e){for(var t=this.trees,r=0,i=t.length;r<i;r++){var n=t[r];if(n.title===e)return n}},getTreeState(e){var t="string"==typeof e?e:e.id;return this.blackboard.getTreeState(t)},getEventSheetTitleList(e){return void 0===e&&(e=[]),this.trees.forEach((function(t){e.push(t.title)})),e}},ae={addTree(e){return this.trees.push(e),this}},ue={removeAllEventSheets(){return this.trees.forEach((function(e){this.blackboard.removeTree