!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ivprogCore=t():e.ivprogCore=t()}(window,(function(){return function(e){function t(t){for(var i,o,s=t[0],l=t[1],c=t[2],d=0,p=[];d"},GE:{ord:6,value:">="},LT:{ord:7,value:"<"},LE:{ord:8,value:"<="},EQ:{ord:9,value:"=="},NEQ:{ord:10,value:"!="},AND:{ord:11,value:"and"},OR:{ord:12,value:"or"},NOT:{ord:13,value:"not"}}),t.convertFromString=function(e){switch(e){case"+":return t.Operators.ADD;case"-":return t.Operators.SUB;case"*":return t.Operators.MULT;case"/":return t.Operators.DIV;case"%":return t.Operators.MOD;case">":return t.Operators.GT;case">=":return t.Operators.GE;case"<":return t.Operators.LT;case"<=":return t.Operators.LE;case"==":return t.Operators.EQ;case"!=":return t.Operators.NEQ;case"and":return t.Operators.AND;case"or":return t.Operators.OR;case"not":return t.Operators.NOT}return null}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Config=void 0;const i=new class{constructor(){this.decimalPlaces=8,this.intConvertRoundMode=2,this.default_lang="pt",this.enable_type_casting=!0,this.idle_input_interval=5e3,this.suspend_threshold=100,this.max_instruction_count=Number.MAX_SAFE_INTEGER}setConfig(e){const t=e;for(const e in t)Object.prototype.hasOwnProperty.call(this,e)&&(this[e]=t[e])}};t.Config=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArrayType=void 0;class i{constructor(e,t){this.dimensions=t,this.innerType=e}get isVector(){return 1==this.dimensions}isCompatible(e){return e instanceof i&&(this.dimensions===e.dimensions&&this.innerType.isCompatible(e.innerType))}stringInfo(){const e=this.innerType.stringInfo();return e.forEach(e=>{e.dim=this.dimensions}),e}get value(){}get ord(){}canAccept(e,t){const n=this.dimensions-t;return e instanceof i?n==e.dimensions&&this.innerType.isCompatible(e.innerType):0==n&&this.innerType.isCompatible(e)}}t.ArrayType=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MultiType=void 0;t.MultiType=class{constructor(e){this.types=e}get value(){}get ord(){}stringInfo(){let e=[];for(let t=0;te.isVector?new p.StoreValueAddress(i.innerType,t,a++,void 0,e.id,e.readOnly):(r>=e.columns&&(r=0,a+=1),new p.StoreValueAddress(i.innerType,t,a,r++,e.id,e.readOnly)));n=new l.ArrayStoreValue(i,o,e.lines,e.columns,t.id,t.readOnly)}else n=new d.StoreValue(t.type,t.value,t.id,t.readOnly);return n}updateStore(e,t){if(this.store.has(e)){const n=this.store.get(e);if(n.readOnly)throw new Error("Cannot change value of a read only variable: "+e);if(n instanceof u.StoreObjectArray){const e=t;if(n.isCompatible(e)){if(n.isVector)e.get().forEach((e,t)=>{n.setAt(e,t,void 0)});else{let t=0,i=0;e.get().forEach(e=>{n.setAt(e,t,i),i+=1,i>=n.columns&&(t+=1,i=0)})}return this}}else if(n.isCompatible(t)){const e=n.locAddress;return c.Location.updateAddress(e,t.get()),this}const i=n.type,a=t.type;throw new Error(`${i.value} is not compatible with type ${a.value} given`)}if(null!=this.nextStore)return this.nextStore.updateStore(e,t),this;throw new Error(`Variable ${e} not found.`)}updateStoreArray(e,t,n,i){if(this.store.has(e)){const a=this.store.get(e);if(a.readOnly)throw new Error("Cannot change value of a read only variable: "+e);if(!(a instanceof u.StoreObjectArray))throw new Error("Cannot update a non-array variable using updateStoreArray");if(t instanceof l.ArrayStoreValue){const r=t.get();if(a.isVector&&t.isVector())for(let e=0;e0)for(let e=0;ee.destroy(),this)}isDefined(e){return!!this.store.has(e)||null!=this.nextStore&&this.nextStore.isDefined(e)}}t.Store=v},,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Context=void 0,t.Context=Object.freeze({BASE:Symbol("context:base"),BREAKABLE:Symbol("context:breakable"),FUNCTION:Symbol("context:function")})},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Location=void 0;const i=n(103);const a=new class{constructor(){this.data=[],this.address_id=0}allocate(e){const t=this.address_id,n=new i.Address(t,e);return this.data.push(n),this.address_id+=1,t}deallocate(e){const t=this.findIndex(e);return-1!==t&&(this.data.splice(t,1),!0)}find(e){let t=0,n=this.data.length;for(;ta.id?t=i:n=i}}getAddressAt(e){return this.data[e]}findIndex(e){let t=0,n=this.data.length;for(;ta.id?t=i:n=i}return-1}updateAddress(e,t){const n=this.findIndex(e);if(-1===n)throw new Error("Invalid address..."+e);this.data[n].value=t}clear(){for(let e=0;ea.data.length})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArrayStoreValue=void 0;const i=n(12),a=n(36);class r{constructor(e,t,n,i,a,r=!1){this.type=e,this.id=a,this.isConst=r,this.values=t,this.lines=n,this.columns=i}get(){return this.values}getAt(e,t){if(console.log("Column ",t),this.isVector()){if(null!=t)throw new Error(this.id+" is not a matrix!");t=e,e=0}else if(null==t){const t=[];for(let n=0;n!e.isCompatible(i.Types.UNDEFINED)),a.length<=0?o.Config.enable_type_casting&&(n.isCompatible(i.Types.INTEGER)||n.isCompatible(i.Types.REAL))&&(s.isCompatible(i.Types.INTEGER)||s.isCompatible(i.Types.REAL))?new r.MultiType([i.Types.INTEGER,i.Types.REAL]):i.Types.UNDEFINED:new r.MultiType(a)}if(n instanceof r.MultiType)return n.isCompatible(s)?e(t,s,s):o.Config.enable_type_casting&&(n.isCompatible(i.Types.INTEGER)||n.isCompatible(i.Types.REAL))&&(s.isCompatible(i.Types.INTEGER)||s.isCompatible(i.Types.REAL))?s:i.Types.UNDEFINED;if(s instanceof r.MultiType)return s.isCompatible(n)?e(t,n,n):o.Config.enable_type_casting&&(n.isCompatible(i.Types.INTEGER)||n.isCompatible(i.Types.REAL))&&(s.isCompatible(i.Types.INTEGER)||s.isCompatible(i.Types.REAL))?n:i.Types.UNDEFINED;const l=(p.get(t)||[])[n.ord][s.ord];if(null==l){if(o.Config.enable_type_casting&&(n.isCompatible(i.Types.INTEGER)||n.isCompatible(i.Types.REAL))&&(s.isCompatible(i.Types.INTEGER)||s.isCompatible(i.Types.REAL))){if(t===a.Operators.MOD)return i.Types.INTEGER;if(t.ord>=5&&t.ord<=10)return i.Types.BOOLEAN}return i.Types.UNDEFINED}return l}catch(e){if(e instanceof TypeError)return i.Types.UNDEFINED;throw e}},t.resultTypeAfterUnaryOp=function e(t,n){try{if(n instanceof r.MultiType){let a=[];for(let i=0;i!e.isCompatible(i.Types.UNDEFINED)),a.length<=0?i.Types.UNDEFINED:new r.MultiType(a)}const a=(_.get(t)||[])[n.ord];return null==a?i.Types.UNDEFINED:a}catch(e){if(e instanceof TypeError)return i.Types.UNDEFINED;throw e}}},,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Maybe=void 0;class i{constructor(e){this.value=e}static some(e){if(!e)throw Error("Provided value must not be empty");return new i(e)}static none(){return new i(null)}static fromValue(e){return e?i.some(e):i.none()}getOrElse(e){return null===this.value?e:this.value}map(e){return null===this.value?i.none():i.fromValue(e(this.value))}}t.Maybe=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StoreValueRef=void 0;t.StoreValueRef=class{constructor(e,t,n,i){this.type=e,this.value=t,this.loc_address=n,this.id=i,this.isConst=!1,this.reference_dimesion=0}get(){return this.value}getRefAddress(){return this.loc_address}inStore(){return null!=this.id}getReferenceDimension(){return this.reference_dimesion}setReferenceDimension(e){this.reference_dimesion=e}}},,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StoreObject=void 0;const i=n(25);t.StoreObject=class{constructor(e,t,n=!1){this._loc_address=t,this._type=e,this._readOnly=n,this._id=void 0}setID(e){this._id=e}get id(){return this._id}get inStore(){return null!==this.id}get type(){return this._type}get value(){const e=i.Location.find(this._loc_address);if(null!=e)return e.value;throw new Error("!!!Critical Error: variable "+this.id+" does not have a valid address. Loc-Address "+this.locAddress)}get number(){throw new Error("DOT NOT USE THIS PROPERTY!")}get readOnly(){return this._readOnly}set readOnly(e){this._readOnly=e}isCompatible(e){return this.type.isCompatible(e.type)}destroy(){return i.Location.deallocate(this._loc_address)}get locAddress(){return this._loc_address}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArrayStoreValueRef=void 0;t.ArrayStoreValueRef=class{constructor(e,t,n,i,a,r){this.type=e,this.values=t,this.addresses=n,this.lines=i,this.columns=a,this.id=r,this.isConst=!1}get(){return this.values}getAddresses(){return this.addresses}inStore(){return null!=this.id}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(94),a=n(95),r=n(96),o={};for(const e in a){const t={};t.error=r[e],t.message=i[e],t.ui=a[e],o[e]=t}t.default=o},,,,,,,,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StoreObjectArray=void 0;const i=n(50),a=n(26),r=n(25);class o extends i.StoreObject{constructor(e,t,n,i,a=!1){super(e,-1,a),this._lines=t,this._columns=n,this.loc_addresses=i}get lines(){return this._lines}get columns(){return this._columns}isCompatible(e){if(e instanceof a.ArrayStoreValue){const t=null==e.columns?0:e.columns;if(this.lines===e.lines&&this.columns===t)return super.isCompatible(e)}return!1}get isVector(){return 1===this.type.dimensions}get value(){const e=[];for(let t=0;t\t>","?\t?@\t@","","","","","","","\b\b\b\b\b\b","\b\b\b\b\t\t\t\t\t","\t\t\t\n\n\n\n\n\v","\v\v\v\v\v\v","\v\v\v\f\f\f\f","\f\f\r\r\r\r\r\r","\r","","","","","","","","","","","","","","","","","",""," ",' !!""##$$%',"%&&''(((((","(ť\n())**++,,","----------Ÿ","\n-..//000ƀ\n0\f0","0ƃ\v0111122Ɗ\n2\r","22Ƌ22222ƒ\n22","2ƕ\n2\r22Ɩ22222Ɲ","\n222Ơ\n2\r22ơ2Ƥ\n23","3Ƨ\n3\r33ƨ333ƭ\n3\r33Ʈ","33Ʋ\n3\r33Ƴ333Ƹ\n","3\f33ƻ\v333ƾ\n344","4ǂ\n444Dž\n4\r44dž55","5Nj\n5\f55ǎ\v55566","6ǔ\n67777Ǚ\n777","888899::Ǥ\n:\r:",":ǥ::ǩ\n:;;<<=","====dz\n=>>>>>",">>>>>>>Ȁ\n>??","?????@@@@@ȍ","\n@\f@@Ȑ\v@@@ȓ\n@@@","@@@@Ț\n@\f@@ȝ\v@@","@@ȡ\n@@@țA","\t\v\r\b\t\n\v","\f\r!","#%')+-/135","79;=?AC E!G\"I#K$M%O&Q'S(U)W*Y","+[,]-_.a/c0e1gi2km3o4qs5uwy{","}6--//'',,1","1>>@@C\\aac|2;C\\aac|","2;23GGgg\f\f$$^^",'\f\f))^^\v\v""\f',"\f2;CHch29\n$$))^^ddhhppt","tvv25ȹ","","\t\v","\r","","","","","!#%","')","+-","/1","35","7?A","CE","GI","KM","OQ","SUW","Y[","]_","ac","ei","mos","","Š","\t•\vœ","\r£«","µ½","ÂÌ","ÒÙ","áæ","!ò#õ","%ù'ÿ",")Ą+ċ","-ē/Ĝ1Ĭ","3į5ĵ","7Ļ9ņ",";Ŋ=Ō","?ŏAő","CœEŕGŗ","IřKś","MŝOŤ","QŦSŨ","UŪWŬ","Yŷ[Ź]Ż","_ŽaƄ","cƣeƽ","gƿiLj","kǓmǕ","oǜqǠsǨ","uǪwǬ","yDz{ǿ","}ȁȠ","‚r‚ƒt","ƒ„q„…i","…†t†‡c‡","ˆoˆ‰c‰","Š‹t‹Œ","gŒcŽ","nŽ","x‘c‘’|","’“k“”q","”\b•–n–","—q—˜i˜™","k™šeš›","q›\nœe","žcžŸf","Ÿ g ¡k¡","¢c¢\f£¤","k¤¥p¥¦","v¦§g§¨k","¨©t©ªq","ª«¬e","¬­c­®t®","¯c¯°e°±","v±²g²³","t³´g´","µ¶g¶·u","·¸e¸¹q","¹ºnº»j»","¼c¼½","¾e¾¿c¿À","uÀÁqÁ","ÂÃeÃÄ","qÄÅpÅÆv","ÆÇtÇÈc","ÈÉtÉÊkÊ","ËqËÌ","ÍeÍÎqÎÏ","pÏÐuÐÑ","vÑÒÓ","hÓÔwÔÕp","ÕÖeÖ×c","×ØqØ","ÙÚfÚÛgÛ","ÜxÜÝqÝÞ","nÞßxßà","càáâ","râãcãät","äåcå","æçtçèg","èéréêkê","ëvëìcìí","aíîrîï","cïðtðñc","ñ òóf",'óôgô"õ',"öcö÷v÷ø","gø$ùú","rúûcûüu","üýuýþq","þ&ÿĀrĀ","ācāĂtĂă","gă(Ąą","tąĆgĆćr","ćĈkĈĉv","ĉĊcĊ*ċ","ČcČčvčĎ","gĎďaďĐ","sĐđwđĒg","Ē,ēĔg","ĔĕpĕĖsĖ","ėwėĘcĘę","pęĚvĚě","qě.Ĝĝt","ĝĞgĞğr","ğĠkĠġvġ","ĢcĢģaģĤ","gĤĥpĥĦ","sĦħwħĨc","ĨĩpĩĪv","Īīqī0Ĭ","ĭuĭĮgĮ2","įİuİı","gıIJpIJijc","ijĴqĴ4","ĵĶhĶķcķ","ĸnĸĹuĹĺ","qĺ6Ļļ","xļĽgĽľt","ľĿfĿŀc","ŀŁfŁłgł","ŃkŃńtńŅ","qŅ8ņŇ","pŇňcňʼnq","ʼn:ŊŋG","ŋ<ŌōQō","ŎWŎ>ŏŐ","(Ő@őŒ","*ŒBœŔ+","ŔDŕŖ]","ŖFŗŘ_Ř","HřŚ}ŚJ","śŜŜL","ŝŞ.ŞN","şŠ>Šť/","šŢ￿Ţţ￿","ţť￿Ťş","ŤšťP","Ŧŧ\tŧR","Ũũ\tũTŪ","ū;ūVŬŭ","=ŭXŮů","@ůŸ?Űű?","űŸ?Ųų>","ųŸ?ŴŸ\tŵ","Ŷ#ŶŸ?ŷŮ","ŷŰŷŲ","ŷŴŷŵ","ŸZŹź","<ź\\Żż","9ż^ŽƁ\t","žƀ\tſž","ƀƃƁſ","ƁƂƂ`","ƃƁƄƅ_0","ƅƆ0ƆƇ_0Ƈb","ƈƊ\tƉƈ","ƊƋƋƉ","ƋƌƌƤ","ƍƎ2Ǝƒ","zƏƐ2ƐƒZ","ƑƍƑƏ","ƒƔƓƕu;","ƔƓƕƖ","ƖƔƖƗ","ƗƤƘƙ2","ƙƝdƚƛ2ƛ","ƝDƜƘƜ","ƚƝƟƞ","Ơ\t\bƟƞƠơ","ơƟơƢ","ƢƤƣƉ","ƣƑƣƜ","ƤdƥƧ","\tƦƥƧƨ","ƨƦƨƩ","ƩƪƪƬ","0ƫƭ\tƬƫ","ƭƮƮƬ","ƮƯƯƾ","ưƲ\tƱư","ƲƳƳƱ","ƳƴƴƵ","Ƶƹ0ƶƸ\t","ƷƶƸƻ","ƹƷƹƺ","ƺƼƻƹ","Ƽƾg4ƽƦ","ƽƱƾf","ƿǁ\t\tǀǂ\tǁ","ǀǁǂǂ","DŽǃDž\tDŽ","ǃDždždž","DŽdžLJLJ","hLjnj$ljNj","k6NJljNjǎ","njNJnjǍ","ǍǏǎnj","Ǐǐ$ǐj","Ǒǔ\n\nǒǔy=Ǔ","ǑǓǒǔ","lǕǘ)ǖǙ","y=ǗǙ\n\vǘǖ","ǘǗǙǚ","ǚǛ)Ǜn","ǜǝ\t\fǝǞ","Ǟǟ\b8ǟpǠǡ","=ǡrǢǤ\t\r","ǣǢǤǥ","ǥǣǥǦ","Ǧǩǧǩq9","ǨǣǨǧ","ǩtǪǫ\tǫ","vǬǭ\tǭx","Ǯǯ^ǯdz\t","ǰdz}?DZdz{>Dz","ǮDzǰDz","DZdzzǴ","ǵ^ǵǶ\tǶǷ","w<ǷǸw<ǸȀ","ǹǺ^Ǻǻw<ǻ","Ǽw<ǼȀǽǾ","^ǾȀw<ǿǴ","ǿǹǿǽ","Ȁ|ȁȂ^","ȂȃwȃȄu;Ȅ","ȅu;ȅȆu;Ȇȇu;","ȇ~Ȉȉ1ȉ","Ȋ1ȊȎȋ","ȍ\n\rȌȋȍȐ","ȎȌȎȏ","ȏȒȐȎ","ȑȓȒȑ","ȒȓȓȔ","Ȕȡ\fȕȖ","1Ȗȗ,ȗț","ȘȚ\vșȘ","ȚȝțȜ","țșȜȞ","ȝțȞȟ",",ȟȡ1ȠȈ","ȠȕȡȢ","Ȣȣ\b@ȣ€","ŤŷƁƋƑƖƜơƣ","ƨƮƳƹƽǁdžnjǓǘǥǨ","DzǿȎȒțȠ\b",""].join(""),r=(new i.atn.ATNDeserializer).deserialize(a),o=r.decisionToState.map((function(e,t){return new i.dfa.DFA(e,t)}));function s(e){return i.Lexer.call(this,e),this._interp=new i.atn.LexerATNSimulator(this,r,o,new i.PredictionContextCache),this}s.prototype=Object.create(i.Lexer.prototype),s.prototype.constructor=s,s.EOF=i.Token.EOF,s.RK_PROGRAM=1,s.RK_REAL=2,s.RK_VOID=3,s.RK_BOOLEAN=4,s.RK_STRING=5,s.RK_INTEGER=6,s.RK_CHARACTER=7,s.RK_SWITCH=8,s.RK_CASE=9,s.RK_DEFAULT=10,s.RK_CONST=11,s.RK_FUNCTION=12,s.RK_RETURN=13,s.RK_FOR=14,s.RK_FOR_ALT=15,s.RK_FOR_FROM=16,s.RK_FOR_TO=17,s.RK_FOR_PASS=18,s.RK_BREAK=19,s.RK_DO=20,s.RK_DO_UNTIL=21,s.RK_WHILE=22,s.RK_WHILE_ALT=23,s.RK_IF=24,s.RK_ELSE=25,s.RK_FALSE=26,s.RK_TRUE=27,s.RK_REFERENCE=28,s.OPEN_PARENTHESIS=29,s.CLOSE_PARENTHESIS=30,s.OPEN_BRACE=31,s.CLOSE_BRACE=32,s.OPEN_CURLY=33,s.CLOSE_CURLY=34,s.COMMA=35,s.EQUAL=36,s.SUM_OP=37,s.MULTI_OP=38,s.AND_OPERATOR=39,s.OR_OPERATOR=40,s.RELATIONAL_OPERATOR=41,s.COLON=42,s.NOT_OPERATOR=43,s.ID=44,s.LIB_ID=45,s.INTEGER=46,s.REAL=47,s.STRING=48,s.CHARACTER=49,s.WHITESPACE=50,s.EOS=51,s.COMMENTS=52,s.prototype.channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"],s.prototype.modeNames=["DEFAULT_MODE"],s.prototype.literalNames=[null,"'programa'","'real'","'vazio'","'logico'","'cadeia'","'inteiro'","'caractere'","'escolha'","'caso'","'contrario'","'const'","'funcao'","'devolva'","'para'","'repita_para'","'de'","'ate'","'passo'","'pare'","'repita'","'ate_que'","'enquanto'","'repita_enquanto'","'se'","'senao'","'falso'","'verdadeiro'","'&'","'('","')'","'['","']'","'{'","'}'","','",null,null,null,null,null,null,"':'"],s.prototype.symbolicNames=[null,"RK_PROGRAM","RK_REAL","RK_VOID","RK_BOOLEAN","RK_STRING","RK_INTEGER","RK_CHARACTER","RK_SWITCH","RK_CASE","RK_DEFAULT","RK_CONST","RK_FUNCTION","RK_RETURN","RK_FOR","RK_FOR_ALT","RK_FOR_FROM","RK_FOR_TO","RK_FOR_PASS","RK_BREAK","RK_DO","RK_DO_UNTIL","RK_WHILE","RK_WHILE_ALT","RK_IF","RK_ELSE","RK_FALSE","RK_TRUE","RK_REFERENCE","OPEN_PARENTHESIS","CLOSE_PARENTHESIS","OPEN_BRACE","CLOSE_BRACE","OPEN_CURLY","CLOSE_CURLY","COMMA","EQUAL","SUM_OP","MULTI_OP","AND_OPERATOR","OR_OPERATOR","RELATIONAL_OPERATOR","COLON","NOT_OPERATOR","ID","LIB_ID","INTEGER","REAL","STRING","CHARACTER","WHITESPACE","EOS","COMMENTS"],s.prototype.ruleNames=["RK_PROGRAM","RK_REAL","RK_VOID","RK_BOOLEAN","RK_STRING","RK_INTEGER","RK_CHARACTER","RK_SWITCH","RK_CASE","RK_DEFAULT","RK_CONST","RK_FUNCTION","RK_RETURN","RK_FOR","RK_FOR_ALT","RK_FOR_FROM","RK_FOR_TO","RK_FOR_PASS","RK_BREAK","RK_DO","RK_DO_UNTIL","RK_WHILE","RK_WHILE_ALT","RK_IF","RK_ELSE","RK_FALSE","RK_TRUE","RK_LOGICAL_NOT","RK_LOGICAL_AND","RK_LOGICAL_OR","RK_REFERENCE","OPEN_PARENTHESIS","CLOSE_PARENTHESIS","OPEN_BRACE","CLOSE_BRACE","OPEN_CURLY","CLOSE_CURLY","COMMA","EQUAL","SUM_OP","MULTI_OP","AND_OPERATOR","OR_OPERATOR","RELATIONAL_OPERATOR","COLON","NOT_OPERATOR","ID","LIB_ID","INTEGER","REAL","ExponentPart","STRING","STRING_CHARACTER","CHARACTER","WHITESPACE","SEMICOLON","EOS","HEX_DIGIT","OCTAL_DIGIT","ESC_SEQ","ESC_OCTAL","ESC_UNICODE","COMMENTS"],s.prototype.grammarFileName="ivprog.g4",t.ivprog=s},function(e,t,n){e.exports={ivprog:n(0).ivprog}},function(e,t){e.exports=n(38)}])},function(e,t,n){e.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){var i=n(2),a=["悋Ꜫ脳맭䅼㯧瞆奤","6ȉ\b\t\t","\t\t\t\t","\b\t\b\t\t\t\n\t\n\v\t\v","\f\t\f\r\t\r\t\t","\t\t\t\t","\t\t\t","\t\t\t\t","\t\t\t",'\t\t \t !\t!"\t"#',"\t#$\t$%\t%&\t&'\t'(\t()\t)","*\t*+\t+,\t,-\t-.\t./\t/0\t0","1\t12\t23\t34\t45\t56\t67\t7","8\t89\t9:\t:;\t;<\t<=\t=>\t>","?\t?@\t@","","","","","","\b\b\b\b\b\t\t\t\t","\t\t\t\n\n\n\n\n\v","\v\v\v\v\v\v","\v\v\v\f\f\f\f","\f\f\r\r\r\r\r\r","\r\r\r","","","","","","","","","","","","","","","","",'  !!"',"\"##$$%%&&'","'((((((Ŋ\n())","**++,,---","-------ŝ\n-..","//000ť\n0\f00Ũ\v0","111122ů\n2\r22Ű","22222ŷ\n222ź\n2\r2","2Ż22222Ƃ\n222ƅ","\n2\r22Ɔ2Ɖ\n233ƌ\n3\r3","3ƍ333ƒ\n3\r33Ɠ33","Ɨ\n3\r33Ƙ333Ɲ\n3\f33Ơ","\v333ƣ\n3444Ƨ\n44","4ƪ\n4\r44ƫ555ư\n5\f5","5Ƴ\v555666ƹ\n67","777ƾ\n7778888","99::lj\n:\r::NJ::ǎ","\n:;;<<=====ǘ","\n=>>>>>>>>>",">>>ǥ\n>??????","?@@@@@Dz\n@\f@@ǵ\v","@@@Ǹ\n@@@@@@@ǿ","\n@\f@@Ȃ\v@@@@Ȇ\n@@","@ȀA\t\v","\r\b\t\n\v\f\r","!#%')+","-/13579;=","?AC E!G\"I#K$M%O&Q'S(U)W*Y+[,]-_.a/c0e1gi2k","m3o4qs5uwy{}6","--//'',,11>>@@","C\\aac|2;C\\aac|2;23","GGgg\f\f$$^^\f\f))^",'^\v\v""\f\f',"2;CHch29\n$$))^^ddhhppttvv25Ȟ","","\t","\v\r","","","","","!","#%","')+","-/","13","57","?A","CEG","IK","MO","QS","UW","Y[]","_a","ce","im","os","","‰Ž\t","“\v˜\r","Ÿ£","¨¯","´¾","ÄÍ","ÔØ!","ã#è%ë","'ð)ö","+ý-ă","/ĉ1Ė","3ę5Ğ","7Ĥ9ĩ;ĭ","=ı?Ĵ","AĶCĸ","EĺGļ","IľKŀ","MłOʼnQŋ","SōUŏ","WőYŜ","[Ş]Š","_Ţaũ","cƈeƢgƤ","iƭkƸ","mƺoǁ","qDžsǍ","uǏwǑ","yǗ{Ǥ}Ǧ","ȅ‚","r‚ƒtƒ„","q„…i…†t","†‡c‡ˆo","ˆ‰Št","Š‹g‹ŒcŒ","nŽ","xq‘","k‘’f’\b","“”d”•q","•–q–—n","—\n˜™u™","švš›t›œ","kœpž","iž\fŸ k"," ¡p¡¢v","¢£¤e","¤¥j¥¦c¦","§t§¨","©u©ªyª«","k«¬v¬­","e­®j®","¯°e°±c","±²u²³g","³´µq","µ¶v¶·j·","¸g¸¹t¹º","yº»k»¼","u¼½g½","¾¿e¿Àq","ÀÁpÁÂu","ÂÃvÃ","ÄÅhÅÆwÆ","ÇpÇÈeÈÉ","vÉÊkÊË","qËÌpÌ","ÍÎtÎÏg","ÏÐvÐÑw","ÑÒtÒÓpÓ","ÔÕhÕ","ÖqÖ×t×","ØÙtÙÚ","gÚÛrÛÜ","gÜÝcÝÞv","Þßaßàh","àáqáâtâ"," ãähäå","tåæqæç",'oç"èév',"éêqê$","ëìrìící","îuîïuï&","ðñdñò","tòógóôc","ôõmõ(","ö÷t÷øgø","ùrùúgúû","cûüvü*","ýþwþÿp","ÿĀvĀāk","āĂnĂ,ă","ĄyĄąjąĆ","kĆćnćĈ","gĈ.ĉĊt","ĊċgċČr","ČčgčĎcĎ","ďvďĐaĐđ","yđĒjĒē","kēĔnĔĕg","ĕ0Ėėk","ėĘhĘ2ę","ĚgĚěněĜ","uĜĝgĝ4","ĞğhğĠc","ĠġnġĢu","Ģģgģ6Ĥ","ĥvĥĦtĦħ","wħĨgĨ8","ĩĪpĪīq","īĬvĬ:","ĭĮCĮįPį","İFİ<ıIJ","QIJijTij>","Ĵĵ(ĵ@","Ķķ*ķB","ĸĹ+ĹDĺ","Ļ]ĻFļĽ","_ĽHľĿ","}ĿJŀŁ","ŁLłŃ.","ŃNńŅ>","ŅŊ/ņŇ￿","Ňň￿ňŊ￿","ʼnńʼnņ","ŊPŋŌ\tŌ","RōŎ\tŎT","ŏŐ;ŐV","őŒ=ŒX","œŔ@Ŕŝ?","ŕŖ?Ŗŝ?ŗ","Ř>Řŝ?řŝ","\tŚś#śŝ","?ŜœŜŕ","ŜŗŜř","ŜŚŝZ","Şş<ş\\","Šš9š^","ŢŦ\tţť\t","ŤţťŨ","ŦŤŦŧ","ŧ`ŨŦ","ũŪ_0Ūū0ūŬ","_0Ŭbŭů\t","ŮŭůŰ","ŰŮŰű","űƉŲų2","ųŷzŴŵ2","ŵŷZŶŲ","ŶŴŷŹ","Ÿźu;ŹŸź","ŻŻŹŻ","żżƉŽ","ž2žƂdſƀ","2ƀƂDƁŽ","ƁſƂƄ","ƃƅ\t\bƄƃ","ƅƆƆƄ","ƆƇƇƉ","ƈŮƈŶ","ƈƁƉd","Ɗƌ\tƋƊ","ƌƍƍƋ","ƍƎƎƏ","ƏƑ0Ɛƒ\t","ƑƐƒƓ","ƓƑƓƔ","ƔƣƕƗ\t","ƖƕƗƘ","ƘƖƘƙ","ƙƚƚƞ0","ƛƝ\tƜƛ","ƝƠƞƜ","ƞƟƟơ","Ơƞơƣg4","ƢƋƢƖ","ƣfƤƦ\t\tƥƧ","\tƦƥƦƧ","ƧƩƨƪ","\tƩƨƪƫ","ƫƩƫƬ","ƬhƭƱ","$Ʈưk6ƯƮ","ưƳƱƯ","ƱƲƲƴ","ƳƱƴƵ$","Ƶjƶƹ\n\n","Ʒƹy=ƸƶƸ","Ʒƹlƺ","ƽ)ƻƾy=Ƽƾ\n\v","ƽƻƽƼ","ƾƿƿǀ)","ǀnǁǂ\t\f","ǂǃǃDŽ\b8DŽ","pDždž=džr","LJlj\t\rLjLJ","ljNJNJLj","NJNjNjǎ","njǎq9ǍLj","Ǎnjǎt","Ǐǐ\tǐv","Ǒǒ\tǒxǓ","ǔ^ǔǘ\tǕǘ","}?ǖǘ{>ǗǓ","ǗǕǗǖ","ǘzǙǚ^","ǚǛ\tǛǜw<ǜǝ","w<ǝǥǞǟ","^ǟǠw<Ǡǡw<ǡ","ǥǢǣ^ǣ","ǥw<ǤǙǤǞ","ǤǢǥ|","Ǧǧ^ǧǨ","wǨǩu;ǩǪu;","Ǫǫu;ǫǬu;Ǭ~","ǭǮ1Ǯǯ1","ǯdzǰDz\n\r","DZǰDzǵ","dzDZdzǴ","ǴǷǵdz","ǶǸǷǶ","ǷǸǸǹ","ǹȆ\fǺǻ1ǻ","Ǽ,ǼȀǽ","ǿ\vǾǽǿ","ȂȀȁȀ","ǾȁȃȂ","ȀȃȄ,Ȅ","Ȇ1ȅǭȅ","ǺȆȇȇ","Ȉ\b@Ȉ€","ʼnŜŦŰŶŻƁƆƈƍƓƘ","ƞƢƦƫƱƸƽNJǍǗǤdz","ǷȀȅ\b"].join(""),r=(new i.atn.ATNDeserializer).deserialize(a),o=r.decisionToState.map((function(e,t){return new i.dfa.DFA(e,t)}));function s(e){return i.Lexer.call(this,e),this._interp=new i.atn.LexerATNSimulator(this,r,o,new i.PredictionContextCache),this}s.prototype=Object.create(i.Lexer.prototype),s.prototype.constructor=s,s.EOF=i.Token.EOF,s.RK_PROGRAM=1,s.RK_REAL=2,s.RK_VOID=3,s.RK_BOOLEAN=4,s.RK_STRING=5,s.RK_INTEGER=6,s.RK_CHARACTER=7,s.RK_SWITCH=8,s.RK_CASE=9,s.RK_DEFAULT=10,s.RK_CONST=11,s.RK_FUNCTION=12,s.RK_RETURN=13,s.RK_FOR=14,s.RK_FOR_ALT=15,s.RK_FOR_FROM=16,s.RK_FOR_TO=17,s.RK_FOR_PASS=18,s.RK_BREAK=19,s.RK_DO=20,s.RK_DO_UNTIL=21,s.RK_WHILE=22,s.RK_WHILE_ALT=23,s.RK_IF=24,s.RK_ELSE=25,s.RK_FALSE=26,s.RK_TRUE=27,s.RK_REFERENCE=28,s.OPEN_PARENTHESIS=29,s.CLOSE_PARENTHESIS=30,s.OPEN_BRACE=31,s.CLOSE_BRACE=32,s.OPEN_CURLY=33,s.CLOSE_CURLY=34,s.COMMA=35,s.EQUAL=36,s.SUM_OP=37,s.MULTI_OP=38,s.AND_OPERATOR=39,s.OR_OPERATOR=40,s.RELATIONAL_OPERATOR=41,s.COLON=42,s.NOT_OPERATOR=43,s.ID=44,s.LIB_ID=45,s.INTEGER=46,s.REAL=47,s.STRING=48,s.CHARACTER=49,s.WHITESPACE=50,s.EOS=51,s.COMMENTS=52,s.prototype.channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"],s.prototype.modeNames=["DEFAULT_MODE"],s.prototype.literalNames=[null,"'program'","'real'","'void'","'bool'","'string'","'int'","'char'","'switch'","'case'","'otherwise'","'const'","'function'","'return'","'for'","'repeat_for'","'from'","'to'","'pass'","'break'","'repeat'","'until'","'while'","'repeat_while'","'if'","'else'","'false'","'true'","'&'","'('","')'","'['","']'","'{'","'}'","','",null,null,null,null,null,null,"':'"],s.prototype.symbolicNames=[null,"RK_PROGRAM","RK_REAL","RK_VOID","RK_BOOLEAN","RK_STRING","RK_INTEGER","RK_CHARACTER","RK_SWITCH","RK_CASE","RK_DEFAULT","RK_CONST","RK_FUNCTION","RK_RETURN","RK_FOR","RK_FOR_ALT","RK_FOR_FROM","RK_FOR_TO","RK_FOR_PASS","RK_BREAK","RK_DO","RK_DO_UNTIL","RK_WHILE","RK_WHILE_ALT","RK_IF","RK_ELSE","RK_FALSE","RK_TRUE","RK_REFERENCE","OPEN_PARENTHESIS","CLOSE_PARENTHESIS","OPEN_BRACE","CLOSE_BRACE","OPEN_CURLY","CLOSE_CURLY","COMMA","EQUAL","SUM_OP","MULTI_OP","AND_OPERATOR","OR_OPERATOR","RELATIONAL_OPERATOR","COLON","NOT_OPERATOR","ID","LIB_ID","INTEGER","REAL","STRING","CHARACTER","WHITESPACE","EOS","COMMENTS"],s.prototype.ruleNames=["RK_PROGRAM","RK_REAL","RK_VOID","RK_BOOLEAN","RK_STRING","RK_INTEGER","RK_CHARACTER","RK_SWITCH","RK_CASE","RK_DEFAULT","RK_CONST","RK_FUNCTION","RK_RETURN","RK_FOR","RK_FOR_ALT","RK_FOR_FROM","RK_FOR_TO","RK_FOR_PASS","RK_BREAK","RK_DO","RK_DO_UNTIL","RK_WHILE","RK_WHILE_ALT","RK_IF","RK_ELSE","RK_FALSE","RK_TRUE","RK_LOGICAL_NOT","RK_LOGICAL_AND","RK_LOGICAL_OR","RK_REFERENCE","OPEN_PARENTHESIS","CLOSE_PARENTHESIS","OPEN_BRACE","CLOSE_BRACE","OPEN_CURLY","CLOSE_CURLY","COMMA","EQUAL","SUM_OP","MULTI_OP","AND_OPERATOR","OR_OPERATOR","RELATIONAL_OPERATOR","COLON","NOT_OPERATOR","ID","LIB_ID","INTEGER","REAL","ExponentPart","STRING","STRING_CHARACTER","CHARACTER","WHITESPACE","SEMICOLON","EOS","HEX_DIGIT","OCTAL_DIGIT","ESC_SEQ","ESC_OCTAL","ESC_UNICODE","COMMENTS"],s.prototype.grammarFileName="ivprog.g4",t.ivprog=s},function(e,t,n){e.exports={ivprog:n(0).ivprog}},function(e,t){e.exports=n(38)}])},,function(e){e.exports=JSON.parse('{"version":"2020_06_20 20_49"}')},,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Type=void 0;t.Type=class{constructor(e,t){this.value=e,this.ord=t}stringInfo(){return[{type:this.value,dim:0}]}isCompatible(e){return this.value===e.value&&this.ord===e.ord}}},,,,function(e,t){e.exports={pt:{test_case_success:"
Caso de teste $0: OK
",test_case_duration:"Levou $0ms",test_suite_grade:"A sua solução alcançou $0% da nota.",awaiting_input_message:"O seu programa está em execução e aguardando uma entrada! Digite algo e pressione ENTER...","assessment-empty-expected-tooltip":"A saída gerada foi além do esperado","assessment-empty-generated-tooltip":"O programa não gerou saídas suficientes",testcase_autogen_unused_input:"O caso de teste $0 possui mais entradas do que as leituras feitas no programa.",testcase_autogen_empty:"O caso de teste $0 não gerou qualquer saída.",success_execution:"Execução do programa finalizada!",aborted_execution:"A execução do programa foi interrompida!",unexpected_execution_error:"Erro inesperado durante a execução do programa."},en:{test_case_success:"
Test case $0: OK
",test_case_duration:"Took $0ms",test_suite_grade:"Your solution scored $0% of the grade.",awaiting_input_message:"Your program is running and awaiting for an input. Type something and press ENTER…","assessment-empty-expected-tooltip":"The generated output was beyond the amount expected","assessment-empty-generated-tooltip":"The program did not generate enough outputs",testcase_autogen_unused_input:"The test case $0 has more inputs than output than the number of reads present in the algorithm.",testcase_autogen_empty:"The test case $0 did not generate any output.",success_execution:"Program execution finished!",aborted_execution:"Program execution was aborted!",unexpected_execution_error:"Unexpected error during program execution."},_disabled_es:{test_case_success:" ",test_case_duration:" ",test_suite_grade:" ",awaiting_input_message:" ","assessment-empty-expected-tooltip":" ","assessment-empty-generated-tooltip":" ",testcase_autogen_unused_input:" ",testcase_autogen_empty:" ",success_execution:"",aborted_execution:"",unexpected_execution_error:""}}},function(e,t){e.exports={pt:{function:"funcao",btn_clear:"Limpar",btn_function:"Função",btn_arithmetic_plus:"Adição",btn_arithmetic_minus:"Subtração",btn_arithmetic_multiplication:"Multiplicação",btn_arithmetic_division:"Divisão",btn_arithmetic_module:"Módulo",btn_break:"Pare",btn_case:"Caso",start:"inicio",type_void:"vazio",type_integer:"inteiro",logic_operator_and:"E",logic_operator_or:"OU",logic_operator_not:"nao",type_real:"real",program:"programa",type_text:"cadeia",textvar_default_value:"texto",type_boolean:"logico",logic_value_true:"verdadeiro",logic_value_false:"falso",variable:"Variável",command:"Comando",new_parameter:"parametro",new_variable:"variavel",new_global:"global",new_function:"nova_funcao",matrix:"matriz",vector:"vetor",text_comment_start:"Comentário inicial da função...",text_comment_main:"Esta é a função principal...",text_read_var:"Entrada/Leitura de dados",text_write_var:"Saída/Escrita de dados",text_command_read:"leia",text_command_write:"escreva",text_return:"devolva",text_btn_return:"Devolver",text_comment:"Comentário",string_join_or:"ou",matrix_info_string:"matriz de $0",vector_info_string:"vetor de $0",text_attribution:"Atribuição",text_if:"se",text_break:"pare",text_else:"senao",text_for:"repita_para",text_code_while:"repita_enquanto",text_code_do:"repita",text_code_do_until:"ate_que",text_command_do:"repita",text_command_while:"repita enquanto",text_command_do_until:"até que",text_code_switch:"escolha",text_code_case:"caso",text_config_programming:"Programação",text_config_programming_both:"Visual e textual",text_config_programming_textual:"Textual",text_config_programming_visual:"Visual",text_logic_expression:"Lógicos",text_arithmetic_expression:"Aritméticos",text_iftrue:"Se verdadeiro então",text_message_error_activity_file:"Aconteceu um erro ao processar a atividade.
Recarregue a página para tentar novamente.",text_message_error_activity_reload:"Recarregar",text_repeatNtimes:"Repita N vezes",text_receives:"recebe",text_whiletrue:"Enquanto verdadeiro",text_dowhiletrue:"Repita até que verdadeiro",text_switch:"Escolha",text_functioncall:"Chamada de função",text_value:"Valor",text_operator:"Operador",text_parentheses:"Parênteses",text_change:"Alterar",text_teacher_algorithm:"Algoritmo",text_teacher_algorithm_include:"Incluir o algoritmo abaixo no exercício",text_teacher_test_case:"Casos de teste",text_teacher_config:"Configurações",text_teacher_data_types:"Tipos de dados",text_teacher_commands:"Comandos",text_teacher_functions:"Funções",text_teacher_create_functions:"Criar novas funções",text_teacher_create_movement_functions:"Movimentar funções",text_teacher_test_case_input:"Entrada",text_teacher_test_case_output:"Saída",text_teacher_test_case_actions:"Ações",text_teacher_test_case_add:"Adicionar caso de teste",text_header_ivprog_functions:"Funções do iVProg",text_menu_functions_math:"Matemática",text_menu_functions_text:"Texto",text_menu_functions_array:"Arranjo",text_menu_functions_conversion:"Conversão",text_no_variable:"Nenhuma variável declarada",text_no_variable_instruction:"Antes de utilizar uma variável, é necessário criá-la",text_ivprog_description:"Programação Visual interativa na Internet",tooltip_visual:"Programação visual",tooltip_textual:"Programação textual",tooltip_upload:"Upload de código fonte",tooltip_download:"Download do código fonte",tooltip_undo:"Desfazer",tooltip_redo:"Refazer",tooltip_run:"Executar o programa",tooltip_evaluate:"Avaliar o programa",tooltip_help:"Ajuda",tooltip_add_global:"Adicionar variável global",tooltip_hide_function:"Ocultar os elementos da função",var_menu_select_var:"Selecione uma variável",var_menu_select_all:"Selecione",var_menu_select_function:"Selecione uma função",expression_menu_select:"Construir uma expressão lógica",inform_valid_content:"Informe o conteúdo!",inform_valid_expression:"Construa uma expressão lógica!",tooltip_terminal_clear:"Limpa o terminal removendo todos os textos já escritos e os pendentes.",tooltip_terminal_show:"Exibe o terminal caso esteja escondido",tooltip_terminal_hide:"Esconde o terminal caso não esteja escondido",text_ivprog_version:"Versão",text_teacher_filter:"Filtro",text_teacher_filter_active:"Ativado",text_teacher_filter_help:"Ao ativar o filtro, as modificações do iVProg estarão bloqueadas.",text_join_assessment_outputs:" ; ","assessment-detail-time-label":"Duração","assessment-detail-grade-label":"Nota","assessment-detail-input-label":"Entradas","assessment-detail-output-label":"Saídas","assessment-detail-expected-label":"Esperava","assessment-detail-generated-label":"Gerou","assessment-detail-result-label":"Resultado","assessment-detail-title":"Caso de Teste $0",text_teacher_generate_outputs:"Gerar saídas",text_teacher_generate_outputs_algorithm:"Antes de gerar as saídas, elabore um algoritmo!",text_code_for_from:"de",text_code_for_to:"ate",text_code_for_pass:"passo",text_for_from:"de",text_for_to:"até",text_for_pass:"passo",text_relational_expression:"Relacionais",write_command_newline_on:"Quebra de linha ativada",write_command_newline_off:" Quebra de linha desativada",write_seprator_menu_text:"Vírgula",initial_program_code:"programa {\\n\\n\\t\\tfuncao vazio inicio () {\\n\\t\\t\\t// Inicie seu codigo aqui!\\n\\t\\t}\\n}",type_char:"caractere",charvar_default_value:"A"},en:{function:"function",btn_clear:"Clean",btn_function:"Function",btn_arithmetic_plus:"Addition",btn_arithmetic_minus:"Subtraction",btn_arithmetic_multiplication:"Multiplication",btn_arithmetic_division:"Division",btn_arithmetic_module:"Remainder",btn_break:"break",btn_case:"Case",start:"main",type_void:"void",type_integer:"int",logic_operator_and:"AND",logic_operator_or:"OR",logic_operator_not:"not",type_real:"real",program:"program",type_text:"string",textvar_default_value:"text",type_boolean:"bool",logic_value_true:"true",logic_value_false:"false",variable:"Variable",command:"Command",new_parameter:"parameter",new_variable:"variable",new_global:"global",new_function:"new_function",matrix:"matrix",vector:"vector",text_comment_start:"Function initial comment",text_comment_main:"This is the main funcion",text_read_var:"Input/Read data",text_write_var:"Output/Write data",text_command_read:"read",text_command_write:"write",text_return:"return",text_btn_return:"Return",text_comment:"Comment",string_join_or:"or",matrix_info_string:"matrix of $0",vector_info_string:"vector of $0",text_attribution:"Assignment",text_if:"if",text_break:"break",text_else:"else",text_for:"repeat_for",text_code_while:"repeat_while",text_code_do:"repeat",text_code_do_until:"until",text_command_do:"repeat",text_command_while:"repeat while",text_command_do_until:"until",text_code_switch:"switch",text_code_case:"case",text_config_programming:"Programming",text_config_programming_both:"Visual & Textual",text_config_programming_textual:"Textual",text_config_programming_visual:"Visual",text_logic_expression:"Logic",text_arithmetic_expression:"Arithmetics",text_iftrue:"If true then",text_message_error_activity_file:"There was an error processing the activity.
Reload the page to try again.",text_message_error_activity_reload:"Reload",text_repeatNtimes:"Repeat N times",text_receives:"receives",text_whiletrue:"While true",text_dowhiletrue:"Repeat until true",text_switch:"Switch",text_functioncall:"Function call",text_value:"Value",text_operator:"Operator",text_parentheses:"Parentheses",text_change:"Modify",text_teacher_algorithm:"Algorithm",text_teacher_algorithm_include:"Include the algorithm below in the activity",text_teacher_test_case:"Test cases",text_teacher_config:"Configurations",text_teacher_data_types:"Data types",text_teacher_commands:"Commands",text_teacher_functions:"Functions",text_teacher_create_functions:"Create new functions",text_teacher_create_movement_functions:"Move functions",text_teacher_test_case_input:"Input",text_teacher_test_case_output:"Output",text_teacher_test_case_actions:"Actions",text_teacher_test_case_add:"Add test case",text_header_ivprog_functions:"iVProg Functions",text_menu_functions_math:"Math",text_menu_functions_text:"Text",text_menu_functions_array:"Array",text_menu_functions_conversion:"Conversion",text_no_variable:"No variable declared",text_no_variable_instruction:"Before using a variable, you need to create it",text_ivprog_description:"Interactive and Visual Programming on the Internet",tooltip_visual:"Visual programming",tooltip_textual:"Textual programming",tooltip_upload:"Upload source code",tooltip_download:"Download source code",tooltip_undo:"Undo",tooltip_redo:"Redo",tooltip_run:"Run the program",tooltip_evaluate:"Evaluate the program",tooltip_help:"Help",tooltip_add_global:"Add a global variable",tooltip_hide_function:"Hide function elements",var_menu_select_var:"Select a variable",var_menu_select_all:"Select",var_menu_select_function:"Select a function",expression_menu_select:"Construct a logic expression",inform_valid_content:"Provide some data",inform_valid_expression:"Construct a logic expression",tooltip_terminal_clear:"Clears the terminal by removing all wrriten and pending text.",tooltip_terminal_show:"Shows the terminal if it is hidden",tooltip_terminal_hide:"Hides the terminal if it is not on display",text_ivprog_version:"Version",text_teacher_filter:"Filter",text_teacher_filter_active:"Activated",text_teacher_filter_help:"By activating the filter modifications in iVProg will be blocked",text_join_assessment_outputs:" ; ","assessment-detail-time-label":"Duration","assessment-detail-grade-label":"Grade","assessment-detail-input-label":"Inputs","assessment-detail-output-label":"Outputs","assessment-detail-expected-label":"Expected","assessment-detail-generated-label":"Generated","assessment-detail-result-label":"Result","assessment-detail-title":"Test Case $0",text_teacher_generate_outputs:"Generate outputs",text_teacher_generate_outputs_algorithm:"Before generating the outputs you need to create an algorithm",text_code_for_from:"from",text_code_for_to:"to",text_code_for_pass:"pass",text_for_from:"from",text_for_to:"to",text_for_pass:"pass",text_relational_expression:"Relational",write_command_newline_on:" Line break is on",write_command_newline_off:" Line break is off",write_seprator_menu_text:"Comma",initial_program_code:"program {\\n\\n\\t\\tfunction void main () {\\n\\t\\t\\t// Start your code here!\\n\\t\\t}\\n}",type_char:"char",charvar_default_value:"A"},_disabled_es:{function:"funccion",btn_clear:"",btn_function:"",btn_arithmetic_plus:"",btn_arithmetic_minus:"",btn_arithmetic_multiplication:"",btn_arithmetic_division:"",btn_arithmetic_module:"",btn_break:"",btn_case:"",start:"",type_void:"",type_integer:"",logic_operator_and:"",logic_operator_or:"",logic_operator_not:"",type_real:"",program:"",type_text:"",textvar_default_value:"",type_boolean:"",logic_value_true:"",logic_value_false:"",variable:"",command:"",new_parameter:"",new_variable:"",new_global:"",new_function:"",matrix:"",vector:"",text_comment_start:"",text_comment_main:"",text_read_var:"",text_write_var:"",text_command_read:"",text_command_write:"",text_return:"",text_btn_return:"",text_comment:"",string_join_or:"",matrix_info_string:"",vector_info_string:"",text_attribution:"",text_if:"",text_break:"",text_else:"",text_for:"",text_code_while:"",text_code_do:"",text_code_do_until:"",text_command_do:"",text_command_while:"",text_command_do_until:"",text_code_switch:"",text_code_case:"",text_config_programming:"",text_config_programming_both:"",text_config_programming_textual:"",text_config_programming_visual:"",text_logic_expression:"",text_arithmetic_expression:"",text_iftrue:"",text_message_error_activity_file:"",text_message_error_activity_reload:"",text_repeatNtimes:"",text_receives:"",text_whiletrue:"",text_dowhiletrue:"",text_switch:"",text_functioncall:"",text_value:"",text_operator:"",text_parentheses:"",text_change:"",text_teacher_algorithm:"",text_teacher_algorithm_include:"",text_teacher_test_case:"",text_teacher_config:"",text_teacher_data_types:"",text_teacher_commands:"",text_teacher_functions:"",text_teacher_create_functions:"",text_teacher_create_movement_functions:"",text_teacher_test_case_input:"",text_teacher_test_case_output:"",text_teacher_test_case_actions:"",text_teacher_test_case_add:"",text_header_ivprog_functions:"",text_menu_functions_math:"",text_menu_functions_text:"",text_menu_functions_array:"",text_menu_functions_conversion:"",text_no_variable:"",text_no_variable_instruction:"",text_ivprog_description:"",tooltip_visual:"",tooltip_textual:"",tooltip_upload:"",tooltip_download:"",tooltip_undo:"",tooltip_redo:"",tooltip_run:"",tooltip_evaluate:"",tooltip_help:"",tooltip_add_global:"",tooltip_hide_function:"",var_menu_select_var:"",var_menu_select_all:"",var_menu_select_function:"",expression_menu_select:"",inform_valid_content:"",inform_valid_expression:"",tooltip_terminal_clear:"",tooltip_terminal_show:"",tooltip_terminal_hide:"",text_ivprog_version:"",text_teacher_filter:"",text_teacher_filter_active:"",text_teacher_filter_help:"",text_join_assessment_outputs:"","assessment-detail-time-label":"","assessment-detail-grade-label":"","assessment-detail-input-label":"","assessment-detail-output-label":"","assessment-detail-expected-label":"","assessment-detail-generated-label":"","assessment-detail-result-label":"","assessment-detail-title":"",text_teacher_generate_outputs:"",text_teacher_generate_outputs_algorithm:"",text_code_for_from:"",text_code_for_to:"",text_code_for_pass:"",text_for_from:"",text_for_to:"",text_for_pass:"",text_relational_expression:"",write_command_newline_on:"",write_command_newline_off:"",write_seprator_menu_text:"",initial_program_code:"",type_char:"",charvar_default_value:"A"}}},function(e,t){e.exports={pt:{token_missing_one:"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3",token_missing_two:"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4",eos_missing:"Falta uma nova linha ou ; na linha: $0, coluna: $1",invalid_type:"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3",invalid_array_dimension:"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.",invalid_array_size:"O tamnho do vetor/matriz excede o máximo de 2 na linha $0",extra_lines:"Nenhum texto é permitido após '}' em 'programa {...}'",invalid_main_return:"A função $0 declarada na linha $2 deve retornar $1.",invalid_var_declaration:"Erro na linha $0: variáveis só podem ser declaradas no corpo principal da função e nas primeiras linhas, antes de qualquer comando.",invalid_break_command:"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'",invalid_terminal:"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.",const_not_init:"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada",id_missing:"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2",invalid_id_format:"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.",main_missing:"A função principal não foi encontrada",invalid_global_var:"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE",not_implemented:"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.",function_missing:"A função $0 não foi encontrada",function_missing_full:"A função $0 na linha: $1, coluna: $2 não foi encontrada",invalid_parameters_size_full:"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.",invalid_parameters_size:"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2",invalid_ref_full:"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.",invalid_ref:"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.",invalid_parameter_type_full:"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.",invalid_parameter_type:"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.",unknown_command_full:"Erro interno crítico: comando desconhecido encontrado na linha $0",unknown_command:"Erro interno crítico: comando desconhecido encontrado!",loop_condition_type_full:"Erro na linha: $0, coluna $1: a condição $2 do laço de repetição deve ser do tipo lógico",loop_condition_type:"A condição $0 do laço de repetição deve ser do tipo lógico",endless_loop_full:"Possível laço infinito detectado no seu código. Verifique a linha $0",endless_loop:"Possível laço infinito detectado no seu código.",for_condition_type_full:"Erro na linha: $0, coluna $1: a condição de parada $2 do comando para(...) deve ser do tipo lógico",for_condition_type:"A condição de parada $0 do comando para(...) deve ser do tipo lógico",if_condition_type_full:"Erro na linha: $0, coluna $1: a condição $2 do comando se...senao deve ser do tipo lógico",if_condition_type:"A condição $0 do comando se...senao deve ser do tipo lógico",invalid_return_type_full:"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.",invalid_return_type:"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.",invalid_void_return_full:"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2",invalid_void_return:"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1",unexpected_break_command_full:"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0",unexpected_break_command:"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso",invalid_dimension:"As dimensões de um vetor/matriz devem ser do tipo inteiro",void_in_expression_full:"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio",void_in_expression:"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio",invalid_array_access_full:"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido",invalid_array_access:"Identificador $0 não se refere a um vetor/matriz válido",invalid_matrix_access_full:"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida",invalid_matrix_access:"Identificador $0 não se refere a uma matriz válida",matrix_column_outbounds_full:"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas",matrix_column_outbounds:"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas",matrix_line_outbounds_full:"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas",matrix_line_outbounds:"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas",vector_line_outbounds_full:"Erro na linha $0: O número de elementos $1 é inválido para a vetor $2 que possui $3 elementos.",vector_line_outbounds:"O número de elementos $1 é inválido para a vetor $2 que possui $3 elementos.",vector_not_matrix_full:"Erro na linha $0: $1 não é uma matriz",vector_not_matrix:"$0 não é uma matriz",invalid_infix_op_full:"Erro na linha $0: a expressão $1 é inválida, pois o operador $2 não pode ser aplicado aos tipos $3 e $4",invalid_infix_op:"A expressão $0 é inválida, pois o operador $1 não pode ser aplicado aos tipos $2 e $3",invalid_unary_op_full:"Erro na linha $0: a expressão $1 é inválida, pois o operador $2 não pode ser aplicado ao tipo $3",invalid_unary_op:"A expressão $0 é inválida, pois o operador $1 não pode ser aplicado ao tipo $2",unknown_op:"Erro interno crítico: Operação $0 desconhecida",duplicate_function:"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.",duplicate_variable:"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.",main_parameters:"A função inicio não pode ter parâmetros.",symbol_not_found_full:"A variável $0 na linha: $1, coluna: $2 não foi declarada",symbol_not_found:"A variável $0 não foi declarada",array_dimension_not_int_full:"As dimensões do arranjo (vetor ou matriz) na linha $0 devem ser do tipo inteiro.",array_dimension_not_int:"As dimensões de um arranjo (vetor ou matriz) devem ser do tipo inteiro.",array_dimension_not_positive_full:"As dimensões do arranjo (vetor ou matriz) na linha $0 devem ser valores positivos.",array_dimension_not_positive:"As dimensões de um arranjo (vetor ou matriz) devem ser valores positivos.",incompatible_types_full:"Era esperado um $0 mas a expressão $1 na linha $2 resulta em $3.",incompatible_types:"Era esperado um $0 mas a expressão $1 resulta em $2.",incompatible_types_array_full:"A expressão $0 na linha $2 é incompatível com o tipo $1.",incompatible_types_array:"A expressão $0 é incompatível com o tipo $1.",invalid_case_type_full:"O caso $0 na linha $1 é incompatível com o tipo $2.",invalid_case_type:"O caso $0 é incompatível com o tipo $1.",function_no_return:"A função $0 não possui um comando de devolução acessível. Toda função deve ter ao menos um comando 'devolva' no seu corpo principal.",invalid_array_literal_type_full:"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.",invalid_array_literal_type:"A expressão $0 não resulta em um tipo compatível.",invalid_array_literal_line_full:"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.",invalid_array_literal_line:"Esperava-se $0 linhas mas encontrou $1.",invalid_array_literal_column_full:"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.",invalid_array_literal_column:"Esperava-se $0 colunas mas encontrou $1.",exceeded_input_request:"A quantidade de leituras requisitadas execedeu a quantidade de entradas disponíveis.",test_case_few_reads:"Caso de teste $0 falhou: ainda restam entradas!",test_case_failed:"
Caso de teste $0 não executou com sucesso.
",test_case_failed_exception:"
Caso de teste $0 falhou: $1",test_case_exception:"Ocorreu uma exceção no caso de teste $0: $1",invalid_type_conversion:"O valor $0 não pode ser convertido para o tipo $1",invalid_read_type:"Erro na linha $0: A entrada \"$1\" não é do tipo $2, que é o tipo da variável $3.",invalid_read_type_array:"Erro na linha $0: A entrada \"$1\" não é do tipo $2, que é o tipo aceito pela variável $3 que é um $4.",inform_valid_identifier:"Informe um nome válido! O nome não pode ser uma palavra reservadas e deve começar com letras ou _ e conter apenas letras, números e _.",inform_valid_global_duplicated:"Já existe uma variável global com o nome $0, você precisa de nomes distintos.",inform_valid_variable_duplicated:"Já existe uma variável com o nome $0 na função $1, você precisa de nomes distintos.",inform_valid_function_duplicated:"Já existe uma função com o nome $0, você precisa de nomes distintos.",inform_valid_param_duplicated:"Já existe um parâmetro com o nome $0 na função $1, você precisa de nomes distintos.",invalid_character:"O caractere $0 na linha $1 não pode ser utilizado neste contexto.",annonymous_array_literal:"Erro na linha $0: a notação de vetor/matriz só permitida durante a inicialização de uma variável desse tipo. Ex: inteiro vec[3] ← {1,2,3}.",invalid_matrix_literal_line:"A expressão $0 na linha $1 não possui um número de elementos igual a linha anterior. Todas as linhas de uma matriz devem ter a mesma quantidade de elementos.",cannot_infer_matrix_line:"Não é possível inferir o número de linhas da matriz $0 na linha $1. É necessário que ela seja inicializada ou que o valor seja informado de forma explícita.",cannot_infer_matrix_column:"Não é possível inferir o número de colunas da matriz $0 na linha $1. É necessário que ela seja inicializada ou que o valor seja informado de forma explícita.",cannot_infer_vector_size:"Não é possível inferir o número de elementos do vetor $0 na linha $1. É necessário que ele seja inicializado ou que o valor seja informado de forma explícita",matrix_to_vector_literal_attr:"Erro na linha $0: A expressão $1 representa uma matriz e não pode ser atribuída ao vetor $2.",vector_to_matrix_literal_attr:"Erro na linha $0: A expressão $1 representa um vetor e não pode ser atribuído a matriz $2.",invalid_const_ref_full:"A variável $0 fornecida como parâmetro para a função $1 na linha $2 é uma constante e não pode ser usada neste contexto. Use uma variável ou posição de vetor.",invalid_const_ref:"A variável $0 fornecida como parâmetro para a função $1 é uma constante e não pode ser usada neste contexto. Use uma variável ou posição de vetor.",invalid_const_assignment_full:"Erro na linha $0: $1 é uma constante e portanto não pode ter seu valor alterado",invalid_const_assignment:"$0 é uma constante e portanto não pode ter seu valor alterado",array_init_not_literal:"Erro na linha $0: Vetor/Matriz só pode ser inicializado por literal. Ex: real vetor[] <- {1,2,3}",array_exceeds_2d:"Erro na linha $0: O número máximo de dimensões que um arranjo pode ter é 2. Elemento de 3 ou mais dimensões encontrado!",invalid_matrix_id_dimension:"Erro na linha $0: Você deve definir todas as dimensões da matriz quando uma delas é definida por uma variável! Ex: real mat1[var][5], mat2[5][var]",invalid_vector_init:"Erro na linha $0: Não se pode inicializar um vetor que teve seu tamanho declarado utilizando uma variável! Utilize uma atribuição de vetores ou use um laço de repetição.",invalid_matrix_init:"Erro na linha $0: Não se pode inicializar uma matrix que teve ao menos uma das suas dimensões declaradas utilizando uma variável! Utilize uma atribuição de matrizes ou use um laço de repetição.",invalid_vector_assignment_full:"Erro na linha $0: Só se pode atribuir um vetor a outro desde que eles comportem o mesmo número de elementos. $1 comporta $2 e $3 comporta $4!",invalid_vector_assignment:"Só se pode atribuir um vetor a outro desde que eles comportem o mesmo número de elementos. $0 comporta $1 e $2 comporta $3!",invalid_matrix_assignment_full:"Erro na linha $0: Só se pode atribuir uma matriz a outra desde que ambas possuam dimensões de mesmo tamanho. $1 tem $2 linhas e $3 colunas, enquanto $4 possui $5 linhas e $6 colunas!",invalid_matrix_assignment:"Só se pode atribuir uma matriz a outra desde que ambas possuam dimensões de mesmo tamanho. $0 tem $1 linhas e $2 colunas, enquanto $3 possui $4 linhas e $5 colunas!",matrix_to_vector_attr:"Erro na linha $0: $1 representa uma matriz e não pode ser atribuída ao vetor $2.",vector_to_matrix_attr:"Erro na linha $0: $1 representa um vetor e não pode ser atribuído a matriz $2.",invalid_matrix_index_assign_full:"Erro na linha $0: A posição $1 da matriz $2 aceita apenas vetores de tamanho $3, mas $4 tem tamanho $5",invalid_matrix_index_assign:"A linha $0 da matriz $1 aceita apenas vetores de tamanho $2, mas $3 tem tamanho $4",invalid_number_elements_vector:"Esperava-se por $0 elementos na linha $1 mas a expressão $2 possui $3 elementos.",invalid_number_lines_matrix:"Esperava-se por uma matriz com $0 linhas na linha $1 mas a expressão $2 possui $3 linhas",divsion_by_zero_full:"Erro na linha $0: A expressão $1 resulta em uma divisão por 0.",divsion_by_zero:"A expressão $0 resulta em uma divisão por 0.",undefined_tanget_value:"Erro na linha $0: A tangente de $1° não é indefinida.",negative_log_value:"Erro na linha $0: Não se pode calcular o log de um valor negativo.",invalid_string_index:"Erro na linha $0 durante a execução da função $1: $2 é um índice inválido para a cadeia de texto $3. Os valores válidos vão de 0 à $4",negative_sqrt_value:"Erro na linha $0: Não é permitido calcular a raiz quadrada de um número negativo.",exceeded_recursive_calls:"Erro na execução da linha $0: Número de chamadas recursivas execedeu o limite máximo definido!",invalid_for_variable:"Erro na linha $0: A variavel $1 utilizada no comando repita_para deve ser do tipo inteiro.",invalid_for_from:"Erro na linha $0: O valor $1 passado para o parâmetro 'de' do comando repita_para deve ser do tipo inteiro.",invalid_for_to:"Erro na linha $0: O valor $1 passado para o parâmetro 'para' do comando repita_para deve ser do tipo inteiro.",invalid_for_pass:"Erro na linha $0: O valor $1 passado para o parâmetro 'passo' do comando repita_para deve ser do tipo inteiro.",exceed_max_instructions:"Número de instruções excedeu o limite definido. Certifique-se que seu código não possui laços infinitos ou muitas chamadas de funções recursivas."},en:{token_missing_one:"Syntax error: Expected $0 but found $1 at line:$2, column:$3",token_missing_two:"Syntax error: Expected $0 or $1 but found $2 at line:$3, column: $4",eos_missing:"A new line or a ‘;’ is missing at line: $0, column: $1",invalid_type:"$0 at line: $1, column: $2 is a invalid type. The valid types are: $3",invalid_array_dimension:"Invalid dimension at line: $0, column: $1. Insert a $2 or a valid identifier of the same type.",invalid_array_size:"The array at line $0 exceeds the maximum size of 2.",extra_lines:"No text is allowed after '}' in 'program { … }'",invalid_main_return:"The function $0 declared at line $2 must return $1.",invalid_var_declaration:"Error at line $0: Variables can only be declared in the main body of a function and at the first lines, before any command.",invalid_break_command:"Error at line $0. The command $1 cannot be used outside a loop command or ‘switch ...case’ structure.",invalid_terminal:"It is not possible to use $0 in the expression at line: $1, column: $2. Try a numeric value, variable or function call.",const_not_init:"Error at line: $0, column: $1. A variable declared as const must be initialized.",id_missing:"Expected an identifier but found $0 at line: $1, column: $2.",invalid_id_format:"$0 at line: $1, column: $2 is not a valid identifier. The symbol '.' is not permitted in this context.",main_missing:"The main function was not found. You need to declare a function of return type void named main.",invalid_global_var:"Critical Error: Invalid call of the function IVProgProcessor.initGlobal outside the BASE context.",not_implemented:"Critial internal error: The system defined function $0 was not found.",function_missing:"The function $0 was not found.",function_missing_full:"The function $0 at line: $1, column: $2 was not found.",invalid_parameters_size_full:"Error at line $0: The number of parameters provided to the function $1 is incorrect. It expected $2 but found $3.",invalid_parameters_size:"The number of parameters provided to the function $0 is incorrect. It expected $1 but found $2.",invalid_ref_full:"The expression $0 provided as a parameter to the function $1 at line $2 is not valid in this context. Use a variable or a position of a vector.",invalid_ref:"The expression $0 provided as a parameter to the function $1 is not valid in this context. Use a variable or a position of a vector.",invalid_parameter_type_full:"The expression $0 provided as a parameter to the function $1 at line $2 is not of the expected type.",invalid_parameter_type:"The expression $0 provided as a parameter to the function $1 is not of the expected type.",unknown_command_full:"Internal error: an unknown command found at line $0.",unknown_command:"Internal error: an unknown command found.",loop_condition_type_full:"Error at line: $0, column $1: the condition $2 of the loop must be of type bool (true or false).",loop_condition_type:"The condition $0 of the loop must be of type bool (true or false).",endless_loop_full:"Possible infinite loop detected in your code. Check line $0.",endless_loop:"Possible infinite loop detected in your code.",for_condition_type_full:"Erro na linha: $0, coluna $1: a condição de parada $2 do comando para(...) deve ser do tipo lógico",for_condition_type:"A condição de parada $0 do comando para(...) deve ser do tipo lógico",if_condition_type_full:"Error at line: $0, column $1: the condition $2 in the if … else command must result in a bool (true or false).",if_condition_type:"The condition $0 in the if … else command must result in a bool (true or false).",invalid_return_type_full:"Error at line $0: The expression doest not result in a type compatible with the function $1. Expected type: $2.",invalid_return_type:"The expression doest not result in a type compatible with the function $0. Expected type: $1.",invalid_void_return_full:"Error at line $0: The function $1 cannot return an empty expression, use an expression that results in a $2",invalid_void_return:"The function $0 cannot return an empty expression, use an expression that results in a $1",unexpected_break_command_full:"Critical error at line $0: a break command was found outside a valid context: loop or switch … case structure.",unexpected_break_command:"Critical error: a break command was found outside a valid context: loop or switch … case structure.",invalid_dimension:"Array (vector or matrix) dimensions must be of type int.",void_in_expression_full:"Error at line: $0, column: $1: The function $2 cannot be used inside an expression since its return type is void.",void_in_expression:"The function $0 cannot be used inside an expression since its return type is void.",invalid_array_access_full:"Identifier $0 at line: $1, column: $2 does not identify a valid vector or matrix.",invalid_array_access:"Identifier $0 does not identify a valid vector or matrix.",invalid_matrix_access_full:"Identifier $0 at line: $1, column: $2 does not identify a valid matrix.",invalid_matrix_access:"Identifier $0 does not identify a valid matrix.",matrix_column_outbounds_full:"Error at line $0: The number of columns $1 is invalid for the matrix $2 which has $3 columns.",matrix_column_outbounds:"The number of columns $0 is invalid for the matrix $1 which has $2 columns.",matrix_line_outbounds_full:"Error at line $0: The number of lines $1 is invalid for matrix $2 which has $3 lines.",matrix_line_outbounds:"The number of lines $0 is invalid for matrix $1 which has $2 lines.",vector_line_outbounds_full:"Error at line $0: The number of elements $1 is invalid for vector $2 which has $3 elements.",vector_line_outbounds:"Error at line $0: The number of elements $1 is invalid for vector $2 which has $3 elements.",vector_not_matrix_full:"Error at line $0: $1 is not a matrix.",vector_not_matrix:"$0 is not a matrix.",invalid_infix_op_full:"Error at line $0: The expression $1 is not valid because the operator $2 cannot be applied to the types $3 and $4.",invalid_infix_op:"The expression $0 is not valid because the operator $1 cannot be applied to the types $2 and $3.",invalid_unary_op_full:"Error at line $0: The expression $1 is not valid because the operator $2 cannot be applied to the type $3.",invalid_unary_op:"The expression $0 is not valid because the operator $1 cannot be applied to the type $2.",unknown_op:"Critical error: Unknown operator $0.",duplicate_function:"The function $0 at line: $1, column: $2 has already been declared.",duplicate_variable:"The variable $0 at line: $1, column: $2 has already been declared.",main_parameters:"The main function cannot have parameters.",symbol_not_found_full:"The variable $0 at line: $1, column: $2 has not been declared.",symbol_not_found:"The variable $0 has not been declared.",array_dimension_not_int_full:"The array (vector or matrix) dimensions at line $0 must be of type int.",array_dimension_not_int:"An array (vector or matrix) dimensions must be of type int.",array_dimension_not_positive_full:"The array (vector or matrix) dimensions at line $0 must be positive.",array_dimension_not_positive:"An array (vector or matrix) dimensions must be positive.",incompatible_types_full:"It expected $0 but the expression $1 at line $2 results in $3.",incompatible_types:"It expected $0 but the expression $1 results in $2.",incompatible_types_array_full:"The expression $0 at line $2 is not compatible with type $1.",incompatible_types_array:"The expression $0 is not compatible with type $1.",invalid_case_type_full:"The case expression $0 at line $1 is not compatible with type $2.",invalid_case_type:"The case expression $0 is not compatible with type $1.",function_no_return:"The function $0 does not have a reacheable return command. Every function must have at least one return command in its main body.",invalid_array_literal_type_full:"Error at line $0: the expression $1 does not result in a compatible type.",invalid_array_literal_type:"The expression $0 does not result in a compatible type.",invalid_array_literal_line_full:"Error at line $0: it expected $1 lines but found $2.",invalid_array_literal_line:"It expected $0 lines but found $1.",invalid_array_literal_column_full:"Error at line $0: it expected $1 column but found $2.",invalid_array_literal_column:"It expected $0 column but found $1.",exceeded_input_request:"The amount of reads requested exceeded the amount of inputs available.",test_case_few_reads:"Teste case $0 failed: there are available inputs remaining.",test_case_failed:"
Test case $0 did not executed successfully.
",test_case_failed_exception:"
Test case $0 failed: $1",test_case_exception:"An exception has ocurred during the execution of test case $0: $1",invalid_type_conversion:"The value $0 cannot be converted to type $1.",invalid_read_type:"Error at line $0: The input \"$1\" is not of type $2 which is the type of the variable $3.",invalid_read_type_array:"Error at line $0: The input \"$1\" is not of type $2 which is the type accepted by the variable $3 of type $4.",inform_valid_identifier:"Enter a valid identifier! The identifier cannot be a reserved word and it must begin with a letter or _, followed by numbers, letters and _ only.",inform_valid_global_duplicated:"A global variable named $0 already exists, you need distinct names for each gloval variable.",inform_valid_variable_duplicated:"A variable named $0 already exists, you need distinct names for each variable.",inform_valid_function_duplicated:"A function named $0 already exists, you need distinct names for each function.",inform_valid_param_duplicated:"A parameter named $0 already exists in function $1, you need distinc names for each parameter.",invalid_character:"The character $0 at line $1 cannot be used in this context.",annonymous_array_literal:"Error at line $0: the array notation is only permitted during initialization of an array variable. i. e.: int vec[3] ← {1, 2, 3}.",invalid_matrix_literal_line:"The expression $0 at line $1 does not have the same number of elements as the last line. All lines of a matrix must have the same number of elements.",cannot_infer_matrix_line:"It is not possible to infer the number of lines of matrix $0 at line $1. It must be initialized or have its lines explicitly declared.",cannot_infer_matrix_column:"It is not possible to infer the number of columns of matrix $0 at line $1. It must be initialized or have its columns explicitly declared.",cannot_infer_vector_size:"It is not possible to infer the number of elements of vector $0 at line $1. It must be initialized or have its size explicitly declard.",matrix_to_vector_literal_attr:"Error at line $0: The expression $1 represents a matrix and cannot be assigned to the vector $2.",vector_to_matrix_literal_attr:"Error at line $0: The expression $1 represents a vector and cannot be assigned to the matrix $2.",invalid_const_ref_full:"The variable $0 provided as a parameter to the function $1 at line $2 is a constant and cannot be used in this context. Use a non-constant variable or vector position.",invalid_const_ref:"The variable $0 provided as a parameter to the function $1 is a constant and cannot be used in this context. Use a non-constant variable or vector position.",invalid_const_assignment_full:"Error at line $0: $1 is a constant e therefore cannot have its value changed.",invalid_const_assignment:"$0 is a constant e therefore cannot have its value changed.",array_init_not_literal:"Error at line $0: An array (vector or matrix) can only be initialized by an array literal. i.e : real vector[] <- {1,2,3}",array_exceeds_2d:"Error at line $0: The maximum number of dimensions an array can have is 2. An element of 3 or dimensions was found.",invalid_matrix_id_dimension:"Error at line $0: You must define all dimensions of the matrix when one of them is defined by a variable! i.e: real mat1[var][5], mat2[5][var]",invalid_vector_init:"Error at line $0: You cannot initialize a vector when its size is defined by a variable. Use a vector assignment or loop command.",invalid_matrix_init:"Error at line $0: You cannot initialize a matrix when one of its dimensions is defined by a variable. Use a matrix assignment or loop command.",invalid_vector_assignment_full:"Error at line $0: You can only assign a vector to another when both have the same number of elements. $1 has $2 and $3 has $4 elements!",invalid_vector_assignment:"You can only assign a vector to another when both have the same number of elements. $0 has $1 and $2 has $3 elements!",invalid_matrix_assignment_full:"Error at line $0: You can only assign a matrix to another when both have dimensions of the same size. $1 has $2 lines e $3 columns while $4 has $5 lines and $6 columns!",invalid_matrix_assignment:"You can only assign a matrix to another when both have dimensions of the same size. $0 has $1 lines e $2 columns while $3 has $4 lines and $5 columns!",matrix_to_vector_attr:"Error at line $0: $1 represents a matrix and cannot be assigned to the vector $2.",vector_to_matrix_attr:"Error at line $0: $1 represents a vector and cannot be assigned to the matrix $2.",invalid_matrix_index_assign_full:"Error at line $0: The position $1 of the matrix $2 only accepts vectors of size $3 but $4 has size $5.",invalid_matrix_index_assign:"The position $0 of the matrix $1 only accepts vectors of size $2 but $3 has size $4.",invalid_number_elements_vector:"It expected $0 elements at line $1 but the expression $2 has $3 elements.",invalid_number_lines_matrix:"It expected a matrix with $0 lines at line $1 but the expression $2 has $3 lines.",divsion_by_zero_full:"Error at line $0: The expression $1 resuts in a division by zero.",divsion_by_zero:"The expression $0 resuts in a division by zero.",undefined_tanget_value:"Error at line $0: The tangent of $1° is undefined.",negative_log_value:"Error at line $0: You cannot calculate the logarithm of a negative value.",invalid_string_index:"Error at line $0 during the execution of the function $1: $2 is an invalid index for the text string $3. The valid indexes go from 0 to $4.",negative_sqrt_value:"Error at line $0: It is not allowd to calculate the square root of a negative number.",exceeded_recursive_calls:"Error during the execution of line $0: The number of recursive calls exceeded the allowed number of calls.",invalid_for_variable:"Error at line $0: The variable $1 used in the repeat_for command must be of type int.",invalid_for_from:"Error at line $0: The value $1 passed to the parameter 'from' of the repeat_for command must be of type int.",invalid_for_to:"Error at line $0: The value $1 passed to the parameter 'to' of the repeat_for command must be of type int.",invalid_for_pass:"Error at line $0: The value $1 passed to the parameter 'pass' of the repeat_for command must be of type int.",exceed_max_instructions:"The number of instructions executed by your program exceed the defined limit. Check your code for infinite loops or excessive recursive functions calls."},_disabled_es:{token_missing_one:" ",token_missing_two:" ",eos_missing:" ",invalid_type:" ",invalid_array_dimension:" ",invalid_array_size:" ",extra_lines:" ",invalid_main_return:" ",invalid_var_declaration:" ",invalid_break_command:" ",invalid_terminal:" ",const_not_init:" ",id_missing:" ",invalid_id_format:" ",main_missing:" ",invalid_global_var:" ",not_implemented:" ",function_missing:" ",function_missing_full:" ",invalid_parameters_size_full:" ",invalid_parameters_size:" ",invalid_ref_full:" ",invalid_ref:" ",invalid_parameter_type_full:" ",invalid_parameter_type:" ",unknown_command_full:" ",unknown_command:" ",loop_condition_type_full:" ",loop_condition_type:" ",endless_loop_full:" ",endless_loop:" ",for_condition_type_full:" ",for_condition_type:" ",if_condition_type_full:" ",if_condition_type:" ",invalid_return_type_full:" ",invalid_return_type:" ",invalid_void_return_full:" ",invalid_void_return:" ",unexpected_break_command_full:" ",unexpected_break_command:" ",invalid_dimension:" ",void_in_expression_full:" ",void_in_expression:" ",invalid_array_access_full:" ",invalid_array_access:" ",invalid_matrix_access_full:" ",invalid_matrix_access:" ",matrix_column_outbounds_full:" ",matrix_column_outbounds:" ",matrix_line_outbounds_full:" ",matrix_line_outbounds:" ",vector_line_outbounds_full:" ",vector_line_outbounds:" ",vector_not_matrix_full:" ",vector_not_matrix:" ",invalid_infix_op_full:" ",invalid_infix_op:" ",invalid_unary_op_full:" ",invalid_unary_op:" ",unknown_op:" ",duplicate_function:" ",duplicate_variable:" ",main_parameters:" ",symbol_not_found_full:" ",symbol_not_found:" ",array_dimension_not_int_full:" ",array_dimension_not_int:" ",array_dimension_not_positive_full:" ",array_dimension_not_positive:" ",incompatible_types_full:" ",incompatible_types:" ",incompatible_types_array_full:" ",incompatible_types_array:" ",invalid_case_type_full:" ",invalid_case_type:" ",function_no_return:" ",invalid_array_literal_type_full:" ",invalid_array_literal_type:" ",invalid_array_literal_line_full:" ",invalid_array_literal_line:" ",invalid_array_literal_column_full:" ",invalid_array_literal_column:" ",exceeded_input_request:" ",test_case_few_reads:" ",test_case_failed:" ",test_case_failed_exception:" ",test_case_exception:" ",invalid_type_conversion:" ",invalid_read_type:" ",invalid_read_type_array:" ",inform_valid_identifier:" ",inform_valid_global_duplicated:" ",inform_valid_variable_duplicated:" ",inform_valid_function_duplicated:" ",inform_valid_param_duplicated:" ",invalid_character:" ",annonymous_array_literal:" ",invalid_matrix_literal_line:" ",cannot_infer_matrix_line:" ",cannot_infer_matrix_column:" ",cannot_infer_vector_size:" ",matrix_to_vector_literal_attr:" ",vector_to_matrix_literal_attr:" ",invalid_const_ref_full:" ",invalid_const_ref:" ",invalid_const_assignment_full:" ",invalid_const_assignment:" ",array_init_not_literal:" ",array_exceeds_2d:" ",invalid_matrix_id_dimension:" ",invalid_vector_init:" ",invalid_matrix_init:" ",invalid_vector_assignment_full:" ",invalid_vector_assignment:" ",invalid_matrix_assignment_full:" ",invalid_matrix_assignment:" ",matrix_to_vector_attr:" ",vector_to_matrix_attr:" ",invalid_matrix_index_assign_full:" ",invalid_matrix_index_assign:" ",invalid_number_elements_vector:" ",invalid_number_lines_matrix:" ",divsion_by_zero_full:" ",divsion_by_zero:" ",undefined_tanget_value:" ",negative_log_value:" ",invalid_string_index:" ",negative_sqrt_value:" ",exceeded_recursive_calls:" ",invalid_for_variable:"",invalid_for_from:"",invalid_for_to:"",invalid_for_pass:"",exceed_max_instructions:""}}},,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Address=void 0;t.Address=class{constructor(e,t){this.id=e,this.value=t}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StoreObjectRef=void 0;const i=n(50);class a extends i.StoreObject{constructor(e){super(e.type,e.getRefAddress(),!1),this.refObj=e.id,this.reference_dimension=e.getReferenceDimension()}get isRef(){return!0}getRefObj(){return this.refObj}getReferenceDimension(){return this.reference_dimension}destroy(){return!1}}t.StoreObjectRef=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StoreObjectArrayRef=void 0;const i=n(66);class a extends i.StoreObjectArray{constructor(e,t,n){super(e.type,t,n,e.getAddresses(),!1),this.refObj=e.id}get isRef(){return!0}getRefObj(){return this.refObj}destroy(){return!1}}t.StoreObjectArrayRef=a},,,,function(e,t,n){"use strict";n.r(t),n.d(t,"runner",(function(){return Vt})),n.d(t,"initVisualUI",(function(){return Ar})),n.d(t,"addFunctionChangeListener",(function(){return Gr})),n.d(t,"addGlobalChangeListener",(function(){return Pr})),n.d(t,"removeFunctionListener",(function(){return Vr})),n.d(t,"removeGlobalListener",(function(){return Kr})),n.d(t,"getTestCases",(function(){return kr})),n.d(t,"autoEval",(function(){return eo})),n.d(t,"prepareActivityToStudentHelper",(function(){return Jr})),n.d(t,"LocalizedStrings",(function(){return oo})),n.d(t,"i18n",(function(){return ro})),n.d(t,"getLogs",(function(){return tn})),n.d(t,"getLogsAsString",(function(){return nn})),n.d(t,"registerClick",(function(){return Yt})),n.d(t,"registerUserEvent",(function(){return Jt})),n.d(t,"parseLogs",(function(){return an})),n.d(t,"ActionTypes",(function(){return Wt})),n.d(t,"CodeEditor",(function(){return ao})),n.d(t,"openAssessmentDetail",(function(){return Lt})),n.d(t,"autoGenerateTestCaseOutput",(function(){return io})),n.d(t,"Config",(function(){return b.Config}));var i=n(2),a=n.n(i),r=n(4),o=n.n(r),s=n(38),l=n(7),c=n.n(l),u=n(8),d=n.n(u),p=n(3),_=n.n(p),f=function(){function e(){a()(this,e),this._sourceInfo=null,this._parenthesis=!1}return o()(e,[{key:"sourceInfo",set:function(e){this._sourceInfo=e},get:function(){return this._sourceInfo}},{key:"parenthesis",set:function(e){this._parenthesis=e},get:function(){return this._parenthesis}}]),e}();function m(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=_()(e);if(t){var a=_()(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return d()(this,n)}}var v=function(e){c()(n,e);var t=m(n);function n(e,i,r){var o;return a()(this,n),(o=t.call(this)).id=e,o.line=i,o.column=r,o}return o()(n,[{key:"toString",value:function(){var e=this.line.toString(),t=null;this.column&&(t=this.column.toString());var n=null;return n=t?"".concat(this.id,"[").concat(e,"][").concat(t,"]"):"".concat(this.id,"[").concat(e,"]"),this.parenthesis?"(".concat(n,")"):n}}]),n}(f),h=n(67),g=n(68),y={pt:{lexer:h.ivprog,langFuncs:{main_function:"inicio",$read:"leia",$write:"escreva",$numElements:"total_de_elementos",$matrixLines:"total_de_linhas",$matrixColumns:"total_de_colunas",$substring:"subcadeia",$length:"comprimento",$uppercase:"caixa_alta",$lowercase:"caixa_baixa",$charAt:"caractere_na_posicao",$isReal:"e_real",$isInt:"e_inteiro",$isBool:"e_logico",$castReal:"como_real",$castInt:"como_inteiro",$castBool:"como_logico",$castString:"como_cadeia",$castChar:"como_caractere",$sin:"seno",$cos:"cosseno",$tan:"tangente",$sqrt:"raiz_quadrada",$pow:"potencia",$log:"logaritmo",$abs:"modulo",$negate:"trocar_sinal",$invert:"inverter_valor",$max:"maximo",$min:"minimo",$rand:"numero_aleatorio"},langLibs:{$mathLib:"Matematica",$ioLib:"ES",$strLib:"Texto",$arrayLib:"Arranjo",$langLib:"Conversao"}},en:{lexer:g.ivprog,langFuncs:{main_function:"main",$read:"read",$write:"write",$numElements:"total_of_elements",$matrixLines:"total_of_lines",$matrixColumns:"total_of_columns",$substring:"substring",$length:"length",$uppercase:"uppercase",$lowercase:"lowercase",$charAt:"char_at",$isReal:"is_real",$isInt:"is_integer",$isBool:"is_logic",$castReal:"to_real",$castInt:"to_integer",$castBool:"to_logic",$castString:"to_string",$sin:"sin",$cos:"cos",$tan:"tan",$sqrt:"sqrt",$pow:"pow",$log:"log",$abs:"abs",$negate:"negate",$invert:"invert",$max:"maximum",$min:"minimum",$rand:"random"},langLibs:{$mathLib:"Mathematic",$ioLib:"IO",$strLib:"Text",$arrayLib:"Array",$langLib:"Conversion"}}},x=n(29),b=n(11);function w(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=_()(e);if(t){var a=_()(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return d()(this,n)}}var E=new(function(e){c()(n,e);var t=w(n);function n(){return a()(this,n),t.call(this,"undefined"==typeof iLMparameters?b.Config.default_lang:iLMparameters.lang)}return o()(n,[{key:"getDefaultLang",value:function(){return"en"}},{key:"getCurrentLexer",value:function(){var e=y[this.getLang()];return null==e?y[this.getDefaultLang()].lexer:e.lexer}},{key:"getCurrentLangFuncs",value:function(){var e=y[this.getLang()];return null==e?y[this.getDefaultLang()].langFuncs:e.langFuncs}},{key:"getCurrentLangLibs",value:function(){var e=y[this.getLang()];return null==e?y[this.getDefaultLang()].langLibs:e.langLibs}}]),n}(x.a.LanguageServiceNoLS)),R=n(1),T=n.n(R),A=n(5),k=n.n(A),I=function(){function e(){a()(this,e),this._sourceInfo=null}return o()(e,[{key:"sourceInfo",set:function(e){this._sourceInfo=e},get:function(){return this._sourceInfo}}]),e}();function C(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=_()(e);if(t){var a=_()(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return d()(this,n)}}var O=function(e){c()(n,e);var t=C(n);function n(){return a()(this,n),t.call(this)}return n}(I);function N(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=_()(e);if(t){var a=_()(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return d()(this,n)}}var L=function(e){c()(n,e);var t=N(n);function n(e){var i;return a()(this,n),(i=t.call(this)).expression=e,i}return n}(I);function S(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=_()(e);if(t){var a=_()(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return d()(this,n)}}var U=function(e){c()(n,e);var t=S(n);function n(e,i){var r;return a()(this,n),(r=t.call(this)).id=e,r.expression=i,r}return n}(I);function M(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=_()(e);if(t){var a=_()(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return d()(this,n)}}var F=function(e){c()(n,e);var t=M(n);function n(e,i,r,o){var s;return a()(this,n),(s=t.call(this,e,o)).line=i,s.column=r,s}return n}(U);function D(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=_()(e);if(t){var a=_()(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return d()(this,n)}}var B=function(e){c()(n,e);var t=D(n);function n(e,i,r,o){var s;return a()(this,n),(s=t.call(this)).id=e,s.type=i,s.initial=r,s.isConst=o,s}return n}(I);function G(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=_()(e);if(t){var a=_()(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return d()(this,n)}}var P=function(e){c()(n,e);var t=G(n);function n(e,i,r,o,s,l){var c;return a()(this,n),(c=t.call(this,e,i,s,l)).lines=r,c.columns=o,c}return o()(n,[{key:"isVector",get:function(){return null==this.columns}}]),n}(B);function K(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=_()(e);if(t){var a=_()(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return d()(this,n)}}var V=function(e){c()(n,e);var t=K(n);function n(e,i){var r;return a()(this,n),(r=t.call(this)).expression=e,r.commandBlock=i,r}return o()(n,[{key:"commands",get:function(){return this.commandBlock.commands}},{key:"testFirst",get:function(){return!0}}]),n}(I);function H(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=_()(e);if(t){var a=_()(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return d()(this,n)}}var q=function(e){c()(n,e);var t=H(n);function n(e,i,r,o,s){var l;return a()(this,n),(l=t.call(this)).for_id=e,l.for_from=i,l.for_to=r,l.for_pass=o,l.commandBlock=s,l}return o()(n,[{key:"commands",get:function(){return this.commandBlock.commands}}]),n}(I),j=n(0),z=function(){function e(t,n,i,r){a()(this,e),this.name=t,this.returnType=n,this.formalParameters=i,this.commandBlock=r,this._sourceInfo=null}return o()(e,[{key:"hasVariadic",value:function(){return this.formalParameters.some((function(e){return e.variadic}))}},{key:"isMain",get:function(){return null===this.name&&this.returnType.isCompatible(j.Types.VOID)}},{key:"commands",get:function(){return this.commandBlock.commands}},{key:"variablesDeclarations",get:function(){return this.commandBlock.variables}},{key:"sourceInfo",set:function(e){this._sourceInfo=e},get:function(){return this._sourceInfo}}]),e}();function X(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=_()(e);if(t){var a=_()(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return d()(this,n)}}var Q=function(e){c()(n,e);var t=X(n);function n(e,i,r){var o;return a()(this,n),(o=t.call(this)).condition=e,o.ifTrue=i,o.ifFalse=r,o}return n}(I),W=function(){function e(t,n){a()(this,e),this.variables=t,this.commands=n,this._sourceInfo=null}return o()(e,[{key:"sourceInfo",set:function(e){this._sourceInfo=e},get:function(){return this._sourceInfo}}]),e}();function Y(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=_()(e);if(t){var a=_()(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return d()(this,n)}}var J=function(e){c()(n,e);var t=Y(n);function n(e,i){return a()(this,n),t.call(this,e,i)}return o()(n,[{key:"testFirst",get:function(){return!1}}]),n}(V);function Z(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=_()(e);if(t){var a=_()(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return d()(this,n)}}var ee=function(e){c()(n,e);var t=Z(n);function n(e,i){var r;return a()(this,n),(r=t.call(this)).expression=e,r.cases=i,r}return n}(I);function te(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=_()(e);if(t){var a=_()(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return d()(this,n)}}var ne=function(e){c()(n,e);var t=te(n);function n(e){var i;return a()(this,n),(i=t.call(this)).expression=e,i.commands=[],i}return o()(n,[{key:"setCommands",value:function(e){this.commands=e}},{key:"isDefault",get:function(){return null===this.expression}}]),n}(I),ie=function e(t){a()(this,e),this.langFunc=t},ae=function(){function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];a()(this,e),this.type=t,this.id=n,this.byRef=i,this.variadic=r,this._sourceInfo=null}return o()(e,[{key:"sourceInfo",set:function(e){this._sourceInfo=e},get:function(){return this._sourceInfo}}]),e}(),re=n(6),oe=n(14),se=n.n(oe);function le(e){return new se.a(e)}function ce(e){var t=e.replace(/^"/,"");return t=(t=(t=(t=(t=(t=(t=(t=t.replace(/"$/,"")).replace(/\\b/g,"\b")).replace(/\\t/g,"\t")).replace(/\\n/g,"\n")).replace(/\\r/g,"\r")).replace(/\\"/g,'"')).replace(/\\'/g,"'")).replace(/\\\\/g,"\\")}function ue(e){return new se.a(e)}function de(e){var t="'"+e+"'",n=E.getCurrentLexer(),i=new n(null);if(i.literalNames[n.RK_TRUE]===t)return!0;if(i.literalNames[n.RK_FALSE]===t)return!1;throw new Error(e+"not a valid boolean")}function pe(e){var t=E.getCurrentLexer(),n=new t(null);return(e?n.literalNames[t.RK_TRUE]:n.literalNames[t.RK_FALSE]).replace(/'/g,"")}function _e(e,t){switch(t.ord){case j.Types.INTEGER.ord:return e.toString();case j.Types.REAL.ord:return e.dp()<=0?e.toFixed(1):e.toFixed(b.Config.decimalPlaces);case j.Types.BOOLEAN.ord:return pe(e);default:return e}}var fe=n(31),me=n.n(fe),ve=n(35),he=n.n(ve);function ge(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=_()(e);if(t){var a=_()(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return d()(this,n)}}var ye=function(e){c()(n,e);var t=ge(n);function n(){var e;a()(this,n);for(var i=arguments.length,r=new Array(i),o=0;o2&&void 0!==arguments[2]&&arguments[2];return a()(this,n),t.call(this,e,i,r)}return o()(n,[{key:"translateType",value:function(e,t){var n=this.getUI("type_".concat(e));switch(t){case 0:return n;default:return t>1?this.getUI("matrix_info_string",[n]):this.getUI("vector_info_string",[n])}}},{key:"translateOp",value:function(e){switch(e.ord){case Re.Operators.AND.ord:case Re.Operators.OR.ord:case Re.Operators.NOT.ord:return this.getUI("logic_operator_".concat(e.value));default:return e.value}}},{key:"translateInternalFunction",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return null==t?qe.getLocalName(e):qe.getLocalName("".concat(t,".").concat(e))}}]),n}(x.a.LocalizedStrings),ke=Object.freeze(new Ae(E,Ee.a,!0)),Ie=null;function Ce(){return null==Ie&&(Ie=new Ae(E,Ee.a)),Ie}var Oe=Ce();function Ne(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return new ye(Oe.getError(e,t))}function Le(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return new be(Oe.getError(e,t))}var Se=Object.freeze({symbol_not_found_full:function(e,t){return t?Le("symbol_not_found_full",[e,t.line,t.column]):Se.symbol_not_found(e)},symbol_not_found:function(e){return Le("symbol_not_found",[e])},function_missing_full:function(e,t){return t?Le("function_missing_full",[e,t.line,t.column]):Se.function_missing(e)},function_missing:function(e){return Le("function_missing",[e])},main_missing:function(){return Le("main_missing")},array_dimension_not_int_full:function(e){return e?Le("array_dimension_not_int_full",[e.line]):Se.array_dimension_not_int()},array_dimension_not_int:function(){return Le("array_dimension_not_int")},unknown_command_full:function(e){return e?Ne("unknown_command_full",[e.line]):Se.unknown_command()},unknown_command:function(){return Ne("unknown_command")},incompatible_types_full:function(e,t,n,i,a,r){return r?Le("incompatible_types_full",[Oe.translateType(e,t),a,r.line,Oe.translateType(n,i)]):Se.incompatible_types(e,t,n,i,a)},incompatible_types:function(e,t,n,i,a){return Le("incompatible_types",[Oe.translateType(e,t),a,Oe.translateType(n,i)])},incompatible_types_array_full:function(e,t,n,i){return i?Le("incompatible_types_array_full",[e,Oe.translateType(t,n),i.line,i.column]):Se.incompatible_types_array(e,t,n)},incompatible_types_array:function(e,t,n){return Le("incompatible_types_array",[e,Oe.translateType(t,n)])},loop_condition_type_full:function(e,t){return t?Le("loop_condition_type_full",[t.line,t.column,e]):Se.loop_condition_type(e)},loop_condition_type:function(e){return Le("loop_condition_type",[e])},endless_loop_full:function(e){return e?Le("endless_loop_full",[e.line]):Se.endless_loop()},endless_loop:function(){return Le("endless_loop")},if_condition_type_full:function(e,t){return t?Le("if_condition_type_full",[t.line,t.column,e]):Se.if_condition_type(e)},if_condition_type:function(e){return Le("if_condition_type",[e])},invalid_global_var:function(){return Ne("invalid_global_var")},not_implemented:function(e){return Ne("not_implemented",[e])},invalid_case_type_full:function(e,t,n,i){return i?Le("invalid_case_type_full",[e,Oe.translateType(t,n),i.line,i.column]):Se.invalid_case_type(e,t,n)},invalid_case_type:function(e,t,n){return Le("invalid_case_type",[e,Oe.translateType(t,n)])},void_in_expression_full:function(e,t){return t?Le("void_in_expression_full",[t.line,t.column,e]):Se.void_in_expression(e)},void_in_expression:function(e){return Le("void_in_expression",[e])},invalid_array_access_full:function(e,t){return t?Le("invalid_array_access_full",[e,t.line,t.column]):Se.invalid_array_access(e)},invalid_array_access:function(e){return Le("invalid_array_access",[e])},invalid_matrix_access_full:function(e,t){return t?Le("invalid_matrix_access_full",[e,t.line,t.column]):Se.invalid_matrix_access(e)},invalid_matrix_access:function(e){return Le("invalid_matrix_access",[e])},matrix_column_outbounds_full:function(e,t,n,i){return i?Ne("matrix_column_outbounds_full",[i.line,t,e,n]):Se.matrix_column_outbounds(e,t,n)},matrix_column_outbounds:function(e,t,n){return Ne("matrix_column_outbounds",[t,e,n])},matrix_line_outbounds_full:function(e,t,n,i){return i?Ne("matrix_line_outbounds_full",[i.line,t,e,n]):Se.matrix_line_outbounds(e,t,n)},matrix_line_outbounds:function(e,t,n){return Ne("matrix_line_outbounds",[t,e,n])},vector_line_outbounds_full:function(e,t,n,i){return i?Ne("vector_line_outbounds_full",[i.line,t,e,n]):Se.vector_line_outbounds(e,t,n)},vector_line_outbounds:function(e,t,n){return Ne("vector_line_outbounds",[t,e,n])},vector_not_matrix_full:function(e,t){return t?Ne("vector_not_matrix_full",[t.line,e]):Se.vector_not_matrix(e)},vector_not_matrix:function(e){return Ne("vector_not_matrix",[e])},function_no_return:function(e){return Le("function_no_return",[e])},invalid_void_return_full:function(e,t,n,i){return i?Le("invalid_void_return_full",[i.line,e,Oe.translateType(t,n)]):Se.invalid_void_return(e,t,n)},invalid_void_return:function(e,t,n){return Le("invalid_void_return_full",[e,Oe.translateType(t,n)])},invalid_return_type_full:function(e,t,n,i){return i?Le("invalid_return_type_full",[i.line,e,Oe.translateType(t,n)]):Se.invalid_return_type(e,t,n)},invalid_return_type:function(e,t,n){return Le("invalid_return_type",[e,Oe.translateType(t,n)])},invalid_parameters_size_full:function(e,t,n,i){return i?Le("invalid_parameters_size_full",[i.line,e,t,n]):Se.invalid_parameters_size(e,t,n)},invalid_parameters_size:function(e,t,n){return Le("invalid_parameters_size",[e,t,n])},invalid_parameter_type_full:function(e,t,n){return n?Le("invalid_parameter_type_full",[t,qe.getLocalName(e),n.line]):Se.invalid_parameter_type(e,t)},invalid_parameter_type:function(e,t){return Le("invalid_parameter_type_full",[t,qe.getLocalName(e)])},invalid_ref_full:function(e,t,n){return n?Le("invalid_ref_full",[t,e,n.line]):Se.invalid_ref(e,t)},invalid_ref:function(e,t){return Le("invalid_ref",[t,e])},unexpected_break_command_full:function(e){return e?Ne("unexpected_break_command_full",[e.line]):Se.unexpected_break_command()},unexpected_break_command:function(){return Ne("unexpected_break_command")},invalid_array_literal_type_full:function(e,t){return t?Ne("invalid_array_literal_type_full",[t.line,e]):Se.invalid_array_literal_type(e)},invalid_array_literal_type:function(e){return Ne("invalid_array_literal_type",[e])},invalid_array_literal_line_full:function(e,t,n){return n?Ne("invalid_array_literal_line_full",[n.line,e,t]):Se.invalid_array_literal_type(e,t)},invalid_array_literal_line:function(e,t){return Ne("invalid_array_literal_line",[e,t])},invalid_array_literal_column_full:function(e,t,n){return n?Ne("invalid_array_literal_column_full",[n.line,e,t]):Se.invalid_array_literal_column(e,t)},invalid_array_literal_column:function(e,t){return Ne("invalid_array_literal_column",[e,t])},invalid_unary_op_full:function(e,t,n,i,a){return a?Ne("invalid_unary_op_full",[a.line,e,Oe.translateOp(t),Oe.translateType(n,i)]):Se.invalid_unary_op(t,n,i)},invalid_unary_op:function(e,t,n,i){return Ne("invalid_unary_op",[e,Oe.translateOp(t),Oe.translateType(n,i)])},invalid_infix_op_full:function(e,t,n,i,a,r,o){return o?Ne("invalid_infix_op_full",[o.line,e,Oe.translateOp(t),Oe.translateType(n,i),Oe.translateType(a,r)]):Se.invalid_infix_op(t,n,i,a,r)},invalid_infix_op:function(e,t,n,i,a,r){return Ne("invalid_infix_op",[e,Oe.translateOp(t),Oe.translateType(n,i),Oe.translateType(a,r)])},array_dimension_not_positive_full:function(e){return e?Le("array_dimension_not_positive_full",[e.line]):Se.array_dimension_not_positive()},array_dimension_not_positive:function(){return Le("array_dimension_not_positive")},invalid_type_conversion:function(e,t,n){return Ne("invalid_type_conversion",[e,Oe.translateType(t,n)])},invalid_read_type:function(e,t,n,i,a){return Ne("invalid_read_type",[a.line,e,Oe.translateType(t,n),i])},invalid_read_type_array:function(e,t,n,i,a,r,o){return Ne("invalid_read_type_array",[o.line,e,Oe.translateType(t,n),i,Oe.translateType(a,r)])},invalid_const_ref_full:function(e,t,n){return n?Le("invalid_const_ref_full",[t,qe.getLocalName(e),n.line]):Se.invalid_const_ref(e,t)},invalid_const_ref:function(e,t){return Le("invalid_const_ref",[t,qe.getLocalName(e)])},invalid_const_assignment_full:function(e,t){return t?Le("invalid_const_assignment_full",[t.line,e]):Se.invalid_const_assignment(e)},invalid_const_assignment:function(e){return Le("invalid_const_assignment",[e])},invalid_vector_assignment_full:function(e,t,n,i,a){return a?Ne("invalid_vector_assignment_full",[a.line,e,t,n,i]):Se.invalid_vector_assignment(e,t,n,i)},invalid_vector_assignment:function(e,t,n,i){return Ne("invalid_vector_assignment",[e,t,n,i])},invalid_matrix_assignment_full:function(e,t,n,i,a,r,o){return o?Ne("invalid_matrix_assignment_full",[o.line,e,t,n,i,a,r]):Se.invalid_matrix_assignment(e,t,n,i,a,r)},invalid_matrix_assignment:function(e,t,n,i,a,r){return Ne("invalid_matrix_assignment",[e,t,n,i,a,r])},matrix_to_vector_attr:function(e,t,n){return Le("matrix_to_vector_attr",[n.line,t,e])},vector_to_matrix_attr:function(e,t,n){return Le("vector_to_matrix_attr",[n.line,t,e])},invalid_matrix_index_assign_full:function(e,t,n,i,a,r){return r?Ne("invalid_matrix_index_assign_full",[r.line,t,e,n,i,a]):Se.invalid_matrix_index_assign(e,t,n,i,a)},invalid_matrix_index_assign:function(e,t,n,i,a){return Ne("invalid_matrix_index_assign",[t,e,n,i,a])},invalid_number_elements_vector:function(e,t,n,i){return Ne("invalid_number_elements_vector",[e,i.line,t,n])},invalid_number_lines_matrix:function(e,t,n,i){return Ne("invalid_number_lines_matrix",[e,i.line,t,n])},divsion_by_zero_full:function(e,t){return t?Ne("divsion_by_zero_full",[t.line,e]):Se.divsion_by_zero(e)},divsion_by_zero:function(e){return Ne("divsion_by_zero",[e])},undefined_tanget_value:function(e,t){return Ne("undefined_tanget_value",[t.line,e])},negative_log_value:function(e){return Ne("negative_log_value",[e.line])},invalid_string_index:function(e,t,n){var i=qe.getLocalName("$charAt");return Ne("invalid_string_index",[n.line,i,e,t,t.length-1])},negative_sqrt_value:function(e){return Ne("negative_sqrt_value",[e.line])},exceeded_recursive_calls:function(e){return Ne("exceeded_recursive_calls",[e.line])},invalid_for_variable:function(e,t){return Le("invalid_for_variable",[t.line,e])},invalid_for_from:function(e,t){return Le("invalid_for_from",[t.line,e])},invalid_for_to:function(e,t){return Le("invalid_for_to",[t.line,e])},invalid_for_pass:function(e,t){return Le("invalid_for_pass",[t.line,e])},exceed_max_instructions:function(){return Ne("exceed_max_instructions")}}),$e=n(9);var Ue=n(12);var Me=n(13);var Fe=n(39),De=n.n(Fe);function Be(e){return e.times(oe.Decimal.acos(-1)).div(180)}var Ge=Date.now();function Pe(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&t[n]===e)return n;return null}var Ke,Ve={$mathLib:{$sin:(Ke=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a,r,o;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.applyStore("x"),a=i.get().mod(360),r=null,r=a.eq(90)?new oe.Decimal(1):a.eq(180)?new oe.Decimal(0):a.eq(270)?new oe.Decimal(-1):oe.Decimal.sin(Be(a)),o=new $e.StoreValue(j.Types.REAL,r),t.insertStore("$",o),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 8:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}())]),new z("$sin",j.Types.REAL,[new ae(new Me.MultiType([j.Types.INTEGER,j.Types.REAL]),"x",!1)],Ke)),$cos:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a,r,o;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.applyStore("x"),a=i.get().mod(360),r=null,a.eq(90)?r=new oe.Decimal(0):a.eq(180)?r=new oe.Decimal(-1):a.eq(270)&&(r=new oe.Decimal(0)),r=oe.Decimal.cos(Be(a)),o=new $e.StoreValue(j.Types.REAL,r),t.insertStore("$",o),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 9:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$cos",j.Types.REAL,[new ae(new Me.MultiType([j.Types.INTEGER,j.Types.REAL]),"x",!1)],e)}(),$tan:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a,r,o;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.applyStore("x"),!(a=i.get().mod(360)).eq(90)&&!a.eq(270)){e.next=4;break}throw Se.undefined_tanget_value(i.get().toNumber(),this.function_call_stack.pop());case 4:return r=oe.Decimal.tan(Be(a)),o=new $e.StoreValue(j.Types.REAL,r),t.insertStore("$",o),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 9:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$tan",j.Types.REAL,[new ae(new Me.MultiType([j.Types.INTEGER,j.Types.REAL]),"x",!1)],e)}(),$sqrt:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a,r;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=t.applyStore("x")).get().isNeg()){e.next=3;break}return e.abrupt("return",Promise.reject(Se.negative_sqrt_value(this.function_call_stack.pop())));case 3:return a=i.get().sqrt(),r=new $e.StoreValue(j.Types.REAL,a),t.insertStore("$",r),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 8:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$sqrt",j.Types.REAL,[new ae(new Me.MultiType([j.Types.INTEGER,j.Types.REAL]),"x",!1)],e)}(),$pow:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a,r,o;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.applyStore("x"),a=t.applyStore("y"),r=i.get().pow(a.get()),o=new $e.StoreValue(j.Types.REAL,r),t.insertStore("$",o),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$pow",j.Types.REAL,[new ae(new Me.MultiType([j.Types.INTEGER,j.Types.REAL]),"x",!1),new ae(new Me.MultiType([j.Types.INTEGER,j.Types.REAL]),"y",!1)],e)}(),$log:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a,r;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=t.applyStore("x")).get().isNegative()){e.next=3;break}return e.abrupt("return",Promise.reject(Se.negative_log_value(this.function_call_stack.pop())));case 3:return a=oe.Decimal.log10(i.get()),r=new $e.StoreValue(j.Types.REAL,a),t.insertStore("$",r),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 8:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$log",j.Types.REAL,[new ae(new Me.MultiType([j.Types.INTEGER,j.Types.REAL]),"x",!1)],e)}(),$abs:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a,r;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.applyStore("x"),a=i.get().abs(),r=new $e.StoreValue(i.type,a),t.insertStore("$",r),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$abs",new Me.MultiType([j.Types.INTEGER,j.Types.REAL]),[new ae(new Me.MultiType([j.Types.INTEGER,j.Types.REAL]),"x",!1)],e)}(),$negate:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a,r;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.applyStore("x"),a=i.get().negated(),r=new $e.StoreValue(i.type,a),t.insertStore("$",r),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$negate",new Me.MultiType([j.Types.INTEGER,j.Types.REAL]),[new ae(new Me.MultiType([j.Types.INTEGER,j.Types.REAL]),"x",!1)],e)}(),$invert:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a,r;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.applyStore("x"),a=ue(1).dividedBy(i.get()),r=new $e.StoreValue(j.Types.REAL,a),t.insertStore("$",r),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$invert",j.Types.REAL,[new ae(new Me.MultiType([j.Types.INTEGER,j.Types.REAL]),"x",!1)],e)}(),$max:function(){var e=function(){var e=k()(T.a.mark((function e(t,n){var i,a,r,o;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.applyStore("x"),a=i.get().map((function(e){return e.get()})),r=oe.Decimal.max.apply(oe.Decimal,De()(a)),o=new $e.StoreValue(i.type.innerType,r),t.insertStore("$",o),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),t=new Ue.ArrayType(new Me.MultiType([j.Types.INTEGER,j.Types.REAL]),1),n=new W([],[new ie(e)]);return new z("$max",new Me.MultiType([j.Types.INTEGER,j.Types.REAL]),[new ae(t,"x",!1)],n)}(),$min:function(){var e=function(){var e=k()(T.a.mark((function e(t,n){var i,a,r,o;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.applyStore("x"),a=i.get().map((function(e){return e.get()})),r=oe.Decimal.min.apply(oe.Decimal,De()(a)),o=new $e.StoreValue(i.type.innerType,r),t.insertStore("$",o),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),t=new Ue.ArrayType(new Me.MultiType([j.Types.INTEGER,j.Types.REAL]),1),n=new W([],[new ie(e)]);return new z("$min",new Me.MultiType([j.Types.INTEGER,j.Types.REAL]),[new ae(t,"x",!1)],n)}(),$rand:function(){var e=2147483647,t=new W([],[new ie(function(){var t=k()(T.a.mark((function t(n,i){var a,r;return T.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=(Ge=(16807*Ge+12345)%e)/(e-1),r=new $e.StoreValue(j.Types.REAL,new oe.Decimal(a)),n.insertStore("$",r),n.mode=re.Modes.RETURN,t.abrupt("return",n);case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())]);return new z("$rand",j.Types.REAL,[],t)}()},$ioLib:{$read:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a,r,o,s,l,c,u,d;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.input.requestInput();case 2:if(i=e.sent,a=t.applyStore("p1").type,r=null,o=null,e.prev=6,!a.isCompatible(j.Types.INTEGER)){e.next=12;break}o=le(i.trim()).trunc(),r=j.Types.INTEGER,e.next=28;break;case 12:if(!a.isCompatible(j.Types.REAL)){e.next=17;break}o=ue(i.trim()),r=j.Types.REAL,e.next=28;break;case 17:if(!a.isCompatible(j.Types.BOOLEAN)){e.next=22;break}o=de(i.trim()),r=j.Types.BOOLEAN,e.next=28;break;case 22:if(!a.isCompatible(j.Types.STRING)){e.next=27;break}o=ce(i),r=j.Types.STRING,e.next=28;break;case 27:throw new Error("!!!!Critical error: Unknown type in readFunction!!!!");case 28:e.next=42;break;case 30:if(e.prev=30,e.t0=e.catch(6),this.mode!=re.Modes.ABORT){e.next=35;break}return t.mode=re.Modes.RETURN,e.abrupt("return",t);case 35:if(s=a.stringInfo()[0],!((l=t.getStoreObject("p1")).getReferenceDimension()>0)){e.next=41;break}throw c=l.type.stringInfo()[0],u=l.getReferenceDimension(),Se.invalid_read_type_array(i,s.type,s.dim,l.getRefObj(),c.type,u,this.function_call_stack.pop());case 41:throw Se.invalid_read_type(i,s.type,s.dim,l.getRefObj(),this.function_call_stack.pop());case 42:return d=new $e.StoreValue(r,o),t.updateStore("p1",d),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 46:case"end":return e.stop()}}),e,this,[[6,30]])})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$read",j.Types.VOID,[new ae(j.Types.ALL,"p1",!0)],e)}(),$write:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a,r,o;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(i=t.applyStore("p1.0"),a=i.get(),r=1;r=i.get().length)){e.next=4;break}throw Se.invalid_string_index(a.get().toNumber(),i.get(),this.function_call_stack.pop());case 4:return r=new $e.StoreValue(j.Types.CHAR,i.get().charAt(a.get().toNumber())),t.insertStore("$",r),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 8:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$charAt",j.Types.CHAR,[new ae(j.Types.STRING,"str",!1),new ae(j.Types.INTEGER,"index",!1)],e)}()},$arrayLib:{$numElements:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.applyStore("vector"),a=new $e.StoreValue(j.Types.INTEGER,le(i.lines)),t.mode=re.Modes.RETURN,t.insertStore("$",a),e.abrupt("return",t);case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$numElements",j.Types.INTEGER,[new ae(new Ue.ArrayType(j.Types.ALL,1),"vector",!1)],e)}(),$matrixLines:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.applyStore("matrix"),a=new $e.StoreValue(j.Types.INTEGER,le(i.lines)),t.mode=re.Modes.RETURN,t.insertStore("$",a),e.abrupt("return",t);case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$matrixLines",j.Types.INTEGER,[new ae(new Ue.ArrayType(j.Types.ALL,2),"matrix",!1)],e)}(),$matrixColumns:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.applyStore("matrix"),a=new $e.StoreValue(j.Types.INTEGER,le(i.columns)),t.mode=re.Modes.RETURN,t.insertStore("$",a),e.abrupt("return",t);case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$matrixColumns",j.Types.INTEGER,[new ae(new Ue.ArrayType(j.Types.ALL,2),"matrix",!1)],e)}()},$langLib:{$isReal:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a,r,o;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=t.applyStore("str"),a=bt.createParser(i.get()),r=!1;try{a.parseTerm()instanceof Ze&&(r=!0)}catch(e){}return o=new $e.StoreValue(j.Types.BOOLEAN,r),t.insertStore("$",o),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 8:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$isReal",j.Types.BOOLEAN,[new ae(j.Types.STRING,"str",!1)],e)}(),$isInt:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a,r,o;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=t.applyStore("str"),a=bt.createParser(i.get()),r=!1;try{a.parseTerm()instanceof Ye&&(r=!0)}catch(e){}return o=new $e.StoreValue(j.Types.BOOLEAN,r),t.insertStore("$",o),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 8:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$isInt",j.Types.BOOLEAN,[new ae(j.Types.STRING,"str",!1)],e)}(),$isBool:function(){var e=new W([],[new ie((function(e,t){var n=e.applyStore("str"),i=bt.createParser(n.get()),a=!1;try{i.parseTerm()instanceof tt&&(a=!0)}catch(e){}var r=new $e.StoreValue(j.Types.BOOLEAN,a);return e.insertStore("$",r),e.mode=re.Modes.RETURN,e}))]);return new z("$isBool",j.Types.BOOLEAN,[new ae(j.Types.STRING,"str",!1)],e)}(),$castReal:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a,r,o,s,l,c,u;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=t.applyStore("val"),a=i.get(),e.t0=i.type.ord,e.next=e.t0===j.Types.INTEGER.ord?5:e.t0===j.Types.STRING.ord?10:22;break;case 5:return a=a.toNumber(),r=new $e.StoreValue(j.Types.REAL,ue(a)),t.insertStore("$",r),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 10:if(o=bt.createParser(a),e.prev=11,!((s=o.parseTerm())instanceof Ze)){e.next=18;break}return l=new $e.StoreValue(j.Types.REAL,s.value),t.insertStore("$",l),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 18:e.next=22;break;case 20:e.prev=20,e.t1=e.catch(11);case 22:throw c=j.Types.REAL.stringInfo(),u=c[0],Se.invalid_type_conversion(a,u.type,u.dim);case 25:case"end":return e.stop()}}),e,null,[[11,20]])})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$castReal",j.Types.REAL,[new ae(new Me.MultiType([j.Types.INTEGER,j.Types.STRING]),"val",!1)],e)}(),$castInt:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a,r,o,s,l,c,u,d;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=t.applyStore("val"),a=i.get(),e.t0=i.type.ord,e.next=e.t0===j.Types.REAL.ord?5:e.t0===j.Types.CHAR.ord?10:e.t0===j.Types.STRING.ord?14:26;break;case 5:return a=a.toNumber(),r=new $e.StoreValue(j.Types.INTEGER,Math.floor(a)),t.insertStore("$",r),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 10:return o=new $e.StoreValue(j.Types.INTEGER,a.charCodeAt(0)),t.insertStore("$",o),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 14:if(s=bt.createParser(a),e.prev=15,!((l=s.parseTerm())instanceof Ye)){e.next=22;break}return c=new $e.StoreValue(j.Types.INTEGER,l.value),t.insertStore("$",c),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 22:e.next=26;break;case 24:e.prev=24,e.t1=e.catch(15);case 26:throw u=j.Types.INTEGER.stringInfo(),d=u[0],Se.invalid_type_conversion(a,d.type,d.dim);case 29:case"end":return e.stop()}}),e,null,[[15,24]])})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$castInt",j.Types.INTEGER,[new ae(new Me.MultiType([j.Types.REAL,j.Types.STRING]),"val",!1)],e)}(),$castBool:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a,r,o,s,l,c;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.applyStore("str"),a=i.get(),r=bt.createParser(a),e.prev=3,!((o=r.parseTerm())instanceof tt)){e.next=10;break}return s=new $e.StoreValue(j.Types.BOOLEAN,o.value),t.insertStore("$",s),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 10:e.next=14;break;case 12:e.prev=12,e.t0=e.catch(3);case 14:throw l=j.Types.BOOLEAN.stringInfo(),c=l[0],Se.invalid_type_conversion(a,c.type,c.dim);case 17:case"end":return e.stop()}}),e,null,[[3,12]])})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$castBool",j.Types.BOOLEAN,[new ae(j.Types.STRING,"str",!1)],e)}(),$castString:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a,r;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.applyStore("str"),a=_e(i.get(),i.type),r=new $e.StoreValue(j.Types.STRING,a),t.insertStore("$",r),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$castString",j.Types.STRING,[new ae(j.Types.ALL,"str",!1)],e)}(),$castChar:function(){var e=new W([],[new ie((function(e,t){var n=255&e.applyStore("charCode").get().toNumber(),i=String.fromCharCode(n),a=new $e.StoreValue(j.Types.CHAR,i);return e.insertStore("$",a),e.mode=re.Modes.RETURN,e}))]);return new z("$castChar",j.Types.CHAR,[new ae(j.Types.INTEGER,"charCode",!1)],e)}()}},He=function(){for(var e={},t=0;t1&&void 0!==arguments[1]?arguments[1]:[];return new mt(vt.getError(e,t))}var gt=Object.freeze({extra_lines:function(){return new mt(vt.getError("extra_lines"))},token_missing_one:function(e,t){return ht("token_missing_one",[e,t.text,t.line,t.column])},token_missing_list:function(e,t){var n=e.join(vt.getOR());return gt.token_missing_one(n,t)},id_missing:function(e){return ht("id_missing",[e.text,e.line,e.column])},eos_missing:function(e){return ht("eos_missing",[e.line,e.column])},invalid_array_dimension:function(e,t){return ht("invalid_array_dimension",[t.line,t.column,e])},invalid_array_size:function(e){return ht("invalid_array_size",[e.line])},invalid_main_return:function(e,t,n){return ht("invalid_main_return",[e,t,n.line])},invalid_var_declaration:function(e){return ht("invalid_var_declaration",[e.line])},invalid_break_command:function(e,t){return ht("invalid_break_command",[t.line,e])},invalid_terminal:function(e){return ht("invalid_terminal",[e.text,e.line,e.column])},invalid_type:function(e,t){var n=e.join(vt.getOR());return ht("invalid_type",[t.text,t.line,t.column,n])},const_not_init:function(e){return ht("const_not_init",[e.line,e.column])},invalid_id_format:function(e){return ht("invalid_id_format",[e.text,e.line,e.column])},duplicate_function:function(e){return ht("duplicate_function",[e.text,e.line,e.column])},main_parameters:function(){return ht("main_parameters")},duplicate_variable:function(e){return ht("duplicate_variable",[e.text,e.line,e.column])},invalid_character:function(e,t,n){return ht("invalid_character",[e,t])},annonymous_array_literal:function(e){return ht("annonymous_array_literal",[e.line])},invalid_matrix_literal_line:function(e,t){return ht("invalid_matrix_literal_line",[e,t.line])},cannot_infer_matrix_line:function(e,t){return ht("cannot_infer_matrix_line",[e,t.line])},cannot_infer_matrix_column:function(e,t){return ht("cannot_infer_matrix_column",[e,t.line])},cannot_infer_vector_size:function(e,t){return ht("cannot_infer_vector_size",[e,t.line])},matrix_to_vector_literal_attr:function(e,t,n){return ht("matrix_to_vector_literal_attr",[n.line,t,e])},vector_to_matrix_literal_attr:function(e,t,n){return ht("vector_to_matrix_literal_attr",[n.line,t,e])},array_init_not_literal:function(e){return ht("array_init_not_literal",[e.line])},array_exceeds_2d:function(e){return ht("array_exceeds_2d",[e.line])},invalid_matrix_id_dimension:function(e){return ht("invalid_matrix_id_dimension",[e.line])},invalid_vector_init:function(e){return ht("invalid_vector_init",[e.line])},invalid_matrix_init:function(e){return ht("invalid_matrix_init",[e.line])}});function yt(e){var t=this._tokenStartCharIndex,n=this._input.index,i=this._input.getText(t,n);i=this.getErrorDisplay(i);var a=this._tokenStartLine,r=this._tokenStartColumn;throw gt.invalid_character(i,a,r)}var xt=function(){function e(t,n,i,r){a()(this,e),this.line=t,this.column=n,this.text=i,this.size=r}return o()(e,null,[{key:"createSourceInfo",value:function(t){return new e(t.line,t.column,t.text,t.text.length)}},{key:"createSourceInfoFromList",value:function(t,n){return new e(t.line,t.column,"",n.tokenIndex+1-t.tokenIndex)}}]),e}(),bt=function(){function e(t,n){a()(this,e),this.lexerClass=n,this.inputStream=new s.InputStream(t),this.lexer=new n(this.inputStream),this.lexer.recover=yt.bind(this.lexer),this.tokenStream=new s.CommonTokenStream(this.lexer),this.tokenStream.fill(),this.pos=1,this.variableTypes=[this.lexerClass.RK_INTEGER,this.lexerClass.RK_REAL,this.lexerClass.RK_BOOLEAN,this.lexerClass.RK_STRING,this.lexerClass.RK_CHARACTER],this.functionTypes=this.variableTypes.concat(this.lexerClass.RK_VOID),this.parsingArrayDimension=0,this.scope=[],this.langFuncs=E.getCurrentLangFuncs(),this.definedFuncsNameList=[],this.definedVariablesStack=[]}return o()(e,null,[{key:"createParser",value:function(t){return new e(t,E.getCurrentLexer())}},{key:"BASE",get:function(){return 0}},{key:"FUNCTION",get:function(){return 1}},{key:"COMMAND",get:function(){return 2}},{key:"BREAKABLE",get:function(){return 4}}]),o()(e,[{key:"parseTree",value:function(){return this.parseProgram()}},{key:"getToken",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.pos;return this.tokenStream.LT(e)}},{key:"insideScope",value:function(t){return this.scope.length<=0?e.BASE===t:this.scope[this.scope.length-1]===t}},{key:"pushScope",value:function(e){this.scope.push(e)}},{key:"pushVariableStack",value:function(){this.definedVariablesStack.push([])}},{key:"popScope",value:function(){return this.scope.pop()}},{key:"popVariableStack",value:function(){return this.definedVariablesStack.pop()}},{key:"getCurrentVariableStack",value:function(){return this.definedVariablesStack[this.definedVariablesStack.length-1]}},{key:"isEOF",value:function(){return this.getToken(this.pos),this.tokenStream.fetchedEOF}},{key:"parseProgram",value:function(){this.consumeNewLines();var e=this.getToken(),t=[],n=[];if(this.lexerClass.RK_PROGRAM===e.type){for(this.pos++,this.consumeNewLines(),this.checkOpenCurly(),this.pos++,this.pushVariableStack();;){this.consumeNewLines();var i=this.getToken();if(i.type===this.lexerClass.RK_CONST||this.isVariableType(i))t=t.concat(this.parseGlobalVariables());else{if(i.type!==this.lexerClass.RK_FUNCTION)break;this.pushVariableStack(),n=n.concat(this.parseFunction()),this.popVariableStack()}}if(this.consumeNewLines(),this.checkCloseCurly(),this.pos++,this.consumeNewLines(),!this.isEOF())throw gt.extra_lines();return this.popVariableStack(),{global:t,functions:n}}throw gt.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_PROGRAM],e)}},{key:"checkOpenCurly",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.getToken();if(this.lexerClass.OPEN_CURLY!==t.type){if(e)return!1;throw gt.token_missing_one("{",t)}return!0}},{key:"checkCloseCurly",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.getToken();if(this.lexerClass.CLOSE_CURLY!==t.type){if(e)return!1;throw gt.token_missing_one("}",t)}return!0}},{key:"checkOpenBrace",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.getToken();if(this.lexerClass.OPEN_BRACE!==t.type){if(e)return!1;throw gt.token_missing_one("[",t)}return!0}},{key:"checkCloseBrace",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.getToken();if(this.lexerClass.CLOSE_BRACE!==t.type){if(e)return!1;throw gt.token_missing_one("]",t)}return!0}},{key:"checkOpenParenthesis",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.getToken();if(this.lexerClass.OPEN_PARENTHESIS!==t.type){if(e)return!1;throw gt.token_missing_one("(",t)}return!0}},{key:"checkCloseParenthesis",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.getToken();if(this.lexerClass.CLOSE_PARENTHESIS!==t.type){if(e)return!1;throw gt.token_missing_one(")",t)}return!0}},{key:"checkEOS",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.getToken();if(t.type!==this.lexerClass.EOS){if(e)return!1;throw gt.eos_missing(t)}return!0}},{key:"checkFunctionDuplicate",value:function(e,t){var n=null===e?"$main":e;if(-1!==this.definedFuncsNameList.indexOf(n))throw gt.duplicate_function(t);this.definedFuncsNameList.push(n)}},{key:"checkVariableDuplicate",value:function(e,t){if(-1!==this.getCurrentVariableStack().indexOf(e))throw gt.duplicate_variable(t);this.getCurrentVariableStack().push(e)}},{key:"consumeForSemiColon",value:function(){var e=this.getToken();if(e.type!==this.lexerClass.EOS||!e.text.match(";"))throw gt.token_missing_one(";",e);this.pos++}},{key:"parseGlobalVariables",value:function(){var e=this.parseMaybeConst();return this.checkEOS(),this.pos++,e}},{key:"parseMaybeConst",value:function(){var e=this.getToken();if(e.type===this.lexerClass.RK_CONST){this.pos++;var t=this.parseType();return this.parseDeclaration(t,!0)}if(this.isVariableType(e)){var n=this.parseType();return this.parseDeclaration(n)}throw gt.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_CONST]].concat(this.getTypeArray()),e)}},{key:"parseDeclaration",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=null,i=null,a=null,r=0,o=xt.createSourceInfo(this.getToken()),s=this.parseID();if(this.checkVariableDuplicate(s,o),this.checkOpenBrace(!0))return this.pos+=1,this.consumeNewLines(),i=this.parseArrayDimension(),this.consumeNewLines(),this.checkCloseBrace(),this.pos+=1,r+=1,this.checkOpenBrace(!0)&&(this.pos+=1,this.consumeNewLines(),a=this.parseArrayDimension(),this.consumeNewLines(),this.checkCloseBrace(),this.pos+=1,r+=1),this.parseArrayDeclaration(e,t,s,o,r,i,a);var l=this.getToken();if(t&&l.type!==this.lexerClass.EQUAL)throw gt.const_not_init(o);l.type===this.lexerClass.EQUAL&&(this.pos++,n=this.parseExpressionOR());var c=new B(s,e,n,t);c.sourceInfo=o;var u=this.getToken();return u.type===this.lexerClass.COMMA?(this.pos++,this.consumeNewLines(),[c].concat(this.parseDeclaration(e,t))):[c]}},{key:"parseArrayDeclaration",value:function(e,t,n,i,a,r,o){var s=this.getToken(),l=r,c=o,u=null,d=!1;if((r instanceof ct||o instanceof ct)&&(d=!0,a>1&&(null==r||null==o)))throw gt.invalid_matrix_id_dimension(xt.createSourceInfo(s));if(t&&s.type!==this.lexerClass.EQUAL)throw gt.const_not_init(i);if(s.type===this.lexerClass.EQUAL){if(d)throw 1==a?gt.invalid_vector_init(xt.createSourceInfo(s)):gt.invalid_matrix_init(xt.createSourceInfo(s));this.pos+=1,u=this.parseArrayLiteral(e)}if(null==u&&null==r){if(a>1)throw gt.cannot_infer_matrix_line(n,i);throw gt.cannot_infer_vector_size(n,i)}if(a>1&&null==u&&null==o)throw gt.cannot_infer_matrix_column(n,i);if(1===a&&null!=u&&!u.isVector){var p=u.toString();throw gt.matrix_to_vector_literal_attr(n,p,u.sourceInfo)}if(a>1&&null!=u&&u.isVector){var _=u.toString();throw gt.vector_to_matrix_literal_attr(n,_,u.sourceInfo)}null==r&&((l=new Ye(le(u.lines))).sourceInfo=i),a>1&&null==o&&((c=new Ye(le(u.columns))).sourceInfo=i);var f=new P(n,new Ue.ArrayType(e,a),l,c,u,t);return f.sourceInfo=i,this.getToken().type===this.lexerClass.COMMA?(this.pos++,this.consumeNewLines(),[f].concat(this.parseDeclaration(e,t))):[f]}},{key:"consumeNewLines",value:function(){for(var e=this.getToken();e.type===this.lexerClass.EOS&&e.text.match("[\r\n]+");)this.pos++,e=this.getToken()}},{key:"isVariableType",value:function(e){return this.variableTypes.find((function(t){return t===e.type}))}},{key:"parseArrayDimension",value:function(){var e=this.getToken();if(e.type===this.lexerClass.INTEGER)return this.pos++,this.getIntLiteral(e);if(e.type===this.lexerClass.ID)return this.pos++,this.parseVariable(e);if(e.type===this.lexerClass.CLOSE_BRACE)return null;throw gt.invalid_array_dimension(this.lexer.literalNames[this.lexerClass.RK_INTEGER],e)}},{key:"getIntLiteral",value:function(e){var t=e.text,n=xt.createSourceInfo(e),i=new Ye(le(t));return i.sourceInfo=n,i}},{key:"getRealLiteral",value:function(e){var t=xt.createSourceInfo(e),n=new Ze(ue(e.text));return n.sourceInfo=t,n}},{key:"getStringLiteral",value:function(e){var t=e.text,n=xt.createSourceInfo(e),i=new rt(ce(t));return i.sourceInfo=n,i}},{key:"getCharLiteral",value:function(e){var t=e.text,n=new it(t.replace(/^'/,"").replace(/'$/,""));return n.sourceInfo=xt.createSourceInfo(e),n}},{key:"getBoolLiteral",value:function(e){var t=de(e.text),n=new tt(t);return n.sourceInfo=xt.createSourceInfo(e),n}},{key:"parseArrayLiteral",value:function(e){if(!this.checkOpenCurly(!0)){var t=this.getToken();throw gt.array_init_not_literal(xt.createSourceInfo(t))}var n=this.getToken();if(this.parsingArrayDimension>=2)throw gt.array_exceeds_2d(xt.createSourceInfo(n));this.pos+=1,this.parsingArrayDimension+=1,this.consumeNewLines();var i=null;i=this.checkOpenCurly(!0)?this.parseVectorList(e):this.parseExpressionList(),this.consumeNewLines(),this.checkCloseCurly();var a=this.getToken();this.pos+=1,this.parsingArrayDimension-=1;var r=xt.createSourceInfoFromList(n,a),o=1;i[0]instanceof st?o+=1:1==i.length&&console.log("Talvez uma variável seja uma melhor opção");var s=new Ue.ArrayType(e,o),l=new st(s,i);return l.sourceInfo=r,l}},{key:"parseVectorList",value:function(e){for(var t=[],n=null;;){this.checkOpenCurly();var i=this.getToken();if(this.parsingArrayDimension>=2)throw gt.array_exceeds_2d(xt.createSourceInfo(i));this.pos+=1,this.parsingArrayDimension+=1,this.consumeNewLines();var a=this.parseExpressionList();this.consumeNewLines(),this.checkCloseCurly();var r=this.getToken();this.pos+=1,this.parsingArrayDimension-=1;var o=xt.createSourceInfoFromList(i,r);if(null==n)n=a.length;else if(n!==a.length){var s=this.inputStream.getText(i.start,r.stop);throw gt.invalid_matrix_literal_line(s,o)}var l=new Ue.ArrayType(e,1),c=new st(l,a);if(c.sourceInfo=o,t.push(c),this.getToken().type!==this.lexerClass.COMMA)break;this.pos+=1,this.consumeNewLines()}return 1==t.length&&console.log("Talvez um vetor seja uma melhor opção"),t}},{key:"parseVariable",value:function(e){var t=xt.createSourceInfo(e),n=new ct(e.text);return n.sourceInfo=t,n}},{key:"parseFunction",value:function(){this.pushScope(e.FUNCTION);var t=[],n=this.getToken();if(n.type!==this.lexerClass.RK_FUNCTION)return null;this.pos++;var i=this.parseType(),a=0;this.checkOpenBrace(!0)&&(this.pos++,this.checkCloseBrace(),this.pos++,a++,this.checkOpenBrace(!0)&&(this.pos++,this.checkCloseBrace(),this.pos++,a++));var r=this.getToken(),o=this.parseID();this.checkFunctionDuplicate(o,r),this.checkOpenParenthesis(),this.pos++,this.consumeNewLines(),this.checkCloseParenthesis(!0)||(t=this.parseFormalParameters(),this.consumeNewLines(),this.checkCloseParenthesis()),this.pos++,this.consumeNewLines();var s=this.parseCommandBlock(),l=i;a>0&&(l=new Ue.ArrayType(i,a));var c=new z(o,l,t,s);if(null===o&&!c.isMain)throw gt.invalid_main_return(qe.getMainFunctionName(),this.lexer.literalNames[this.lexerClass.RK_VOID],n.line);if(c.isMain&&0!==t.length)throw gt.main_parameters();return this.popScope(),c}},{key:"parseFormalParameters",value:function(){for(var e=[];;){var t=0,n=!1,i=this.parseType(),a=this.getToken();a.type===this.lexerClass.RK_REFERENCE&&(n=!0,this.pos+=1,a=this.getToken());var r=this.parseID();this.checkVariableDuplicate(r,a),this.checkOpenBrace(!0)&&(this.pos+=1,t+=1,this.checkCloseBrace(),this.pos+=1,this.checkOpenBrace(!0)&&(this.pos+=1,t+=1,this.checkCloseBrace(),this.pos+=1));var o=null;o=t>0?new Ue.ArrayType(i,t):i;var s=new ae(o,r,n);if(s.sourceInfo=xt.createSourceInfo(a),e.push(s),this.getToken().type!==this.lexerClass.COMMA)break;this.pos++,this.consumeNewLines()}return e}},{key:"parseID",value:function(){var t=this.getToken();if(t.type!==this.lexerClass.ID)throw gt.id_missing(t);return this.pos++,this.insideScope(e.FUNCTION)&&t.text===qe.getMainFunctionName()?null:t.text}},{key:"parseMaybeLibID",value:function(){var e=this.getToken();if(e.type!==this.lexerClass.ID&&e.type!==this.lexerClass.LIB_ID)throw gt.id_missing(e);return this.pos++,e.text}},{key:"parseType",value:function(){var t=this.getToken();if(t.type===this.lexerClass.ID&&this.insideScope(e.FUNCTION))return j.Types.VOID;if(t.type===this.lexerClass.RK_VOID&&this.insideScope(e.FUNCTION))return this.pos++,j.Types.VOID;if(this.isVariableType(t))switch(this.pos++,t.type){case this.lexerClass.RK_INTEGER:return j.Types.INTEGER;case this.lexerClass.RK_BOOLEAN:return j.Types.BOOLEAN;case this.lexerClass.RK_REAL:return j.Types.REAL;case this.lexerClass.RK_STRING:return j.Types.STRING;case this.lexerClass.RK_CHARACTER:return j.Types.CHAR}throw gt.invalid_type(this.getTypeArray(),t)}},{key:"parseCommandBlock",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=[],n=[],i=!1;this.checkOpenCurly(e)&&(this.pos++,i=!0),this.consumeNewLines();for(var a=!1;;){var r=this.parseCommand();if(null===r)break;if(-1!==r)if(r instanceof Array){if(a){var o=this.getToken(this.pos-1);throw gt.invalid_var_declaration(o)}t=t.concat(r)}else a=!0,n.push(r)}return this.consumeNewLines(),i&&(this.checkCloseCurly(),this.pos++,this.consumeNewLines()),new W(t,n)}},{key:"parseCommand",value:function(){var t=this.getToken();if(this.isVariableType(t)){if(!this.insideScope(e.FUNCTION))throw gt.invalid_var_declaration(t);this.pushScope(e.BASE);var n=this.parseType();this.popScope();var i=this.parseDeclaration(n);return this.checkEOS(),this.pos++,i}if(t.type===this.lexerClass.ID)return this.parseIDCommand();if(t.type===this.lexerClass.LIB_ID)return this.parseIDCommand();if(t.type===this.lexerClass.RK_RETURN)return this.parseReturn();if(t.type===this.lexerClass.RK_WHILE||t.type===this.lexerClass.RK_WHILE_ALT)return this.parseWhile();if(t.type===this.lexerClass.RK_FOR||t.type===this.lexerClass.RK_FOR_ALT)return this.parseFor();if(t.type===this.lexerClass.RK_BREAK){if(!this.insideScope(e.BREAKABLE))throw gt.invalid_break_command(this.lexer.literalNames[this.lexerClass.RK_BREAK],t);return this.parseBreak()}return t.type===this.lexerClass.RK_SWITCH?this.parseSwitchCase():t.type===this.lexerClass.RK_DO?this.parseRepeatUntil():t.type===this.lexerClass.RK_IF?this.parseIfThenElse():this.checkEOS(!0)?(this.pos++,-1):null}},{key:"parseSwitchCase",value:function(){this.pushScope(e.BREAKABLE),this.pos++,this.checkOpenParenthesis(),this.pos++,this.consumeNewLines();var t=this.parseExpressionOR();this.consumeNewLines(),this.checkCloseParenthesis(),this.pos++,this.consumeNewLines(),this.checkOpenCurly(),this.pos++,this.consumeNewLines();var n=this.parseCases();return this.consumeNewLines(),this.checkCloseCurly(),this.pos++,this.consumeNewLines(),this.popScope(),new ee(t,n)}},{key:"parseRepeatUntil",value:function(){this.pos++,this.consumeNewLines(),this.pushScope(e.BREAKABLE);var t=this.parseCommandBlock();this.consumeNewLines();var n=this.getToken();if(n.type!==this.lexerClass.RK_DO_UNTIL)throw gt.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_DO_UNTIL],n);this.pos++,this.checkOpenParenthesis(),this.pos++,this.consumeNewLines();var i=this.parseExpressionOR();return this.consumeNewLines(),this.checkCloseParenthesis(),this.pos++,this.checkEOS(),this.popScope(),new J(i,t)}},{key:"parseIfThenElse",value:function(){this.insideScope(e.BREAKABLE)?this.pushScope(e.BREAKABLE):this.pushScope(e.COMMAND);var t=this.getToken();this.pos++,this.checkOpenParenthesis(),this.pos++,this.consumeNewLines();var n=this.parseExpressionOR();this.consumeNewLines(),this.checkCloseParenthesis(),this.pos++,this.consumeNewLines();var i=this.parseCommandBlock();if(this.getToken().type===this.lexerClass.RK_ELSE){this.pos++,this.consumeNewLines();var a=this.getToken(),r=null;if(this.checkOpenCurly(!0))r=this.parseCommandBlock();else{if(a.type!==this.lexerClass.RK_IF)throw gt.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_IF],"{"],a);r=this.parseIfThenElse()}this.popScope();var o=new Q(n,i,r);return o.sourceInfo=xt.createSourceInfo(t),o}this.popScope();var s=new Q(n,i,null);return s.sourceInfo=xt.createSourceInfo(t),s}},{key:"parseFor",value:function(){this.pushScope(e.BREAKABLE);var t=this.getToken();this.pos+=1;var n=this.getToken(),i=this.parseID(),a=new ct(i);a.sourceInfo=xt.createSourceInfo(n);var r=this.parseForParameters(this.lexerClass.RK_FOR_FROM),o=this.parseForParameters(this.lexerClass.RK_FOR_TO),s=this.parseForParameters(this.lexerClass.RK_FOR_PASS);this.consumeNewLines();var l=this.parseCommandBlock();this.popScope();var c=new q(a,r,o,s,l);return c.sourceInfo=xt.createSourceInfo(t),c}},{key:"parseWhile",value:function(){this.pushScope(e.BREAKABLE);var t=this.getToken();this.pos++,this.checkOpenParenthesis(),this.pos++,this.consumeNewLines();var n=this.parseExpressionOR();this.consumeNewLines(),this.checkCloseParenthesis(),this.pos++,this.consumeNewLines();var i=this.parseCommandBlock();this.popScope();var a=new V(n,i);return a.sourceInfo=xt.createSourceInfo(t),a}},{key:"parseBreak",value:function(){return this.pos++,this.checkEOS(),this.pos++,new O}},{key:"parseReturn",value:function(){this.pos++;var e=null;return this.checkEOS(!0)||(e=this.parseExpressionOR(),this.checkEOS()),this.pos++,new L(e)}},{key:"parseIDCommand",value:function(){var e=this.getToken(),t=e.type===this.lexerClass.ID,n=this.parseMaybeLibID();if(this.checkOpenBrace(!0)){this.pos++;var i,a=null;this.consumeNewLines(),i=this.parseExpression(),this.consumeNewLines(),this.checkCloseBrace(),this.pos++,this.checkOpenBrace(!0)&&(this.pos++,this.consumeNewLines(),a=this.parseExpression(),this.consumeNewLines(),this.checkCloseBrace(),this.pos++);var r=this.getToken();if(r.type!==this.lexerClass.EQUAL)throw gt.token_missing_one("=",r);this.pos++;var o=this.parseExpressionOR();this.checkEOS(),this.pos++;var s=new F(n,i,a,o);return s.sourceInfo=xt.createSourceInfo(r),s}var l=this.getToken();if(t&&l.type===this.lexerClass.EQUAL){this.pos++;var c=this.parseExpressionOR();this.checkEOS(),this.pos++;var u=new U(n,c);return u.sourceInfo=xt.createSourceInfo(l),u}if(l.type===this.lexerClass.OPEN_PARENTHESIS){var d=this.parseFunctionCallCommand(n);return this.checkEOS(),this.pos++,d}throw t?gt.token_missing_list(["=","("],l):gt.invalid_id_format(e)}},{key:"parseForParameters",value:function(e){if(e===this.lexerClass.RK_FOR_PASS&&this.checkOpenCurly(!0))return null;var t=this.getToken();if(t.type!==e){var n=this.lexer.literalNames[e];throw new Error("Error de sintaxe no comando repita_para: esperava-se "+n+" mas encontrou "+t.text)}this.pos+=1;var i=this.getToken(),a=!1,r=null;i.type===this.lexerClass.SUM_OP&&(a=!0,r=i.text,this.pos+=1,i=this.getToken());var o=null;if(i.type===this.lexerClass.ID?(o=new ct(this.parseID())).sourceInfo=xt.createSourceInfo(i):i.type===this.lexerClass.INTEGER&&(this.pos+=1,o=this.getIntLiteral(i)),null==o){var s=this.lexer.literalNames[e];throw new Error("Error de sintaxe no comando repeita_para: "+i.text+" não é compativel com o esperado para o paramentro "+s+". O valor deve ser um inteiro ou variável.")}return a&&(o=new _t(Object(Re.convertFromString)(r),o)),o}},{key:"parseCases",value:function(){var e=this.getToken();if(e.type!==this.lexerClass.RK_CASE)throw gt.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_CASE],e);if(this.pos++,this.getToken().type===this.lexerClass.RK_DEFAULT){this.pos++;var t=this.getToken();if(t.type!==this.lexerClass.COLON)throw gt.token_missing_one(":",t);this.pos++,this.consumeNewLines();var n=this.parseCommandBlock(!0),i=new ne(null);return i.setCommands(n.commands),[i]}var a=this.parseExpressionOR(),r=this.getToken();if(r.type!==this.lexerClass.COLON)throw gt.token_missing_one(":",r);this.pos++,this.consumeNewLines();var o=this.parseCommandBlock(!0),s=new ne(a);return s.setCommands(o.commands),this.getToken().type===this.lexerClass.RK_CASE?[s].concat(this.parseCases()):[s]}},{key:"parseExpressionOR",value:function(){for(var e=this.parseExpressionAND();this.getToken().type===this.lexerClass.OR_OPERATOR;){var t=this.getToken();this.pos++;var n=Object(Re.convertFromString)("or");this.consumeNewLines();var i=this.parseExpressionAND(),a=new dt(n,e,i);a.sourceInfo=xt.createSourceInfo(t),e=a}return e}},{key:"parseExpressionAND",value:function(){for(var e=this.parseExpressionNot();this.getToken().type===this.lexerClass.AND_OPERATOR;){var t=this.getToken();this.pos++;var n=Object(Re.convertFromString)("and");this.consumeNewLines();var i=this.parseExpressionNot(),a=new dt(n,e,i);a.sourceInfo=xt.createSourceInfo(t),e=a}return e}},{key:"parseExpressionNot",value:function(){if(this.getToken().type===this.lexerClass.NOT_OPERATOR){var e=this.getToken();this.pos++;var t=Object(Re.convertFromString)("not"),n=this.parseExpressionRel(),i=new _t(t,n);return i.sourceInfo=xt.createSourceInfo(e),i}return this.parseExpressionRel()}},{key:"parseExpressionRel",value:function(){for(var e=this.parseExpression();this.getToken().type===this.lexerClass.RELATIONAL_OPERATOR;){var t=this.getToken();this.pos++;var n=Object(Re.convertFromString)(t.text),i=this.parseExpression(),a=new dt(n,e,i);a.sourceInfo=xt.createSourceInfo(t),e=a}return e}},{key:"parseExpression",value:function(){for(var e=this.parseFactor();this.getToken().type===this.lexerClass.SUM_OP;){var t=this.getToken();this.pos++;var n=Object(Re.convertFromString)(t.text),i=this.parseFactor(),a=new dt(n,e,i);a.sourceInfo=xt.createSourceInfo(t),e=a}return e}},{key:"parseFactor",value:function(){for(var e=this.parseTerm();this.getToken().type===this.lexerClass.MULTI_OP;){var t=this.getToken();this.pos++;var n=Object(Re.convertFromString)(t.text),i=this.parseTerm(),a=new dt(n,e,i);a.sourceInfo=xt.createSourceInfo(t),e=a}return e}},{key:"parseTerm",value:function(){var e=this.getToken(),t=null,n=null;switch(e.type){case this.lexerClass.SUM_OP:return this.pos++,t=xt.createSourceInfo(e),(n=new _t(Object(Re.convertFromString)(e.text),this.parseTerm())).sourceInfo=t,n;case this.lexerClass.INTEGER:return this.pos++,this.getIntLiteral(e);case this.lexerClass.REAL:return this.pos++,this.getRealLiteral(e);case this.lexerClass.STRING:return this.pos++,this.getStringLiteral(e);case this.lexerClass.CHARACTER:return this.pos++,this.getCharLiteral(e);case this.lexerClass.RK_TRUE:case this.lexerClass.RK_FALSE:return this.pos++,this.getBoolLiteral(e);case this.lexerClass.OPEN_CURLY:throw gt.annonymous_array_literal(e);case this.lexerClass.ID:case this.lexerClass.LIB_ID:return this.parseIDTerm();case this.lexerClass.OPEN_PARENTHESIS:return this.parseParenthesisExp();default:throw gt.invalid_terminal(e)}}},{key:"parseIDTerm",value:function(){var e=this.getToken(),t=this.parseMaybeLibID(),n=e.type===this.lexerClass.ID;if(n&&this.checkOpenBrace(!0)){var i=null;this.pos++;var a=this.parseExpression(),r=null;this.consumeNewLines(),this.checkCloseBrace(),i=this.getToken(),this.pos++,this.checkOpenBrace(!0)&&(this.pos++,r=this.parseExpression(),this.consumeNewLines(),this.checkCloseBrace(),i=this.getToken(),this.pos++);var o=xt.createSourceInfoFromList(e,i),s=new v(t,a,r);return s.sourceInfo=o,s}if(this.checkOpenParenthesis(!0))return this.parseFunctionCallExpression(t);if(n){var l=xt.createSourceInfo(e),c=new ct(t);return c.sourceInfo=l,c}throw gt.invalid_id_format(e)}},{key:"getFunctionName",value:function(e){var t=qe.getInternalName(e);return null===t?e===qe.getMainFunctionName()?null:e:t}},{key:"parseFunctionCallExpression",value:function(e){var t=this.getToken(this.pos-1),n=this.parseActualParameters(),i=this.getToken(this.pos-1),a=this.getFunctionName(e),r=xt.createSourceInfoFromList(t,i),o=new ze(a,n);return o.sourceInfo=r,o}},{key:"parseFunctionCallCommand",value:function(e){return this.parseFunctionCallExpression(e)}},{key:"parseParenthesisExp",value:function(){this.checkOpenParenthesis();var e=this.getToken();this.pos+=1,this.consumeNewLines();var t=this.parseExpressionOR();this.consumeNewLines(),this.checkCloseParenthesis();var n=this.getToken();return this.pos+=1,t.sourceInfo=xt.createSourceInfoFromList(e,n),t.parenthesis=!0,t}},{key:"parseActualParameters",value:function(){if(this.checkOpenParenthesis(),this.pos++,this.checkCloseParenthesis(!0))return this.pos++,[];this.consumeNewLines();var e=this.parseExpressionList();return this.consumeNewLines(),this.checkCloseParenthesis(),this.pos++,e}},{key:"parseExpressionList",value:function(){for(var e=[];;){var t=this.parseExpressionOR();if(e.push(t),this.getToken().type!==this.lexerClass.COMMA)break;this.pos++,this.consumeNewLines()}return e}},{key:"getTypeArray",value:function(){var t=this;return(this.insideScope(e.FUNCTION)?this.functionTypes:this.variableTypes).map((function(e){return t.lexer.literalNames[e]}))}}]),e}(),wt=n(69),Et=n.n(wt),Rt=n(15),Tt=n(23),At=n(37);var kt=null,It=null;function Ct(e){!function(){if(null==kt){kt=[];for(var e=["RK_PROGRAM","RK_REAL","RK_VOID","RK_BOOLEAN","RK_STRING","RK_INTEGER","RK_CHARACTER","RK_SWITCH","RK_CASE","RK_DEFAULT","RK_CONST","RK_FUNCTION","RK_RETURN","RK_FOR","RK_BREAK","RK_DO","RK_WHILE","RK_IF","RK_ELSE","RK_FALSE","RK_TRUE"],t=E.getCurrentLexer(),n=new t,i=0;ii.length)){t.next=4;break}throw Se.invalid_parameters_size(o,n.length,i.length);case 4:l=0,c=0;case 5:if(!(l5&&void 0!==x[5]?x[5]:0,e.next=3,this.evaluateExpression(a,i);case 3:if(s=e.sent,l=!1,n.type.isCompatible(s.type)){e.next=11;break}if(!b.Config.enable_type_casting||n.byRef||!Rt.Store.canImplicitTypeCast(n.type,s.type)){e.next=10;break}l=!0,e.next=11;break;case 10:throw Se.invalid_parameter_type(t,i.toString());case 11:if(!n.byRef||s.inStore()){e.next=13;break}throw Se.invalid_ref(t,i.toString());case 13:return n.byRef?(c=a.getStoreObject(s.id),u=null,s instanceof Ft.ArrayStoreValue?(d=s.get(),p=s.type,_=d.map((function(e){return c.getLocAddressOf(e.line,e.column)})),f=s.isVector()?0:s.columns,u=new Dt.ArrayStoreValueRef(p,d,_,s.lines,f,c.id)):s instanceof Bt.StoreValueAddress?(m=s.line,v=s.column,(u=new Mt.StoreValueRef(s.type,s.get(),c.getLocAddressOf(m,v),c.id)).setReferenceDimension(c.type.dimensions)):u=new Mt.StoreValueRef(s.type,s.get(),c.locAddress,c.id),h=n.id,n.variadic&&(h="".concat(h,".").concat(o)),r.insertStore(h,u)):(g=s,l&&(g=Rt.Store.doImplicitCasting(n.type,g)),y=n.id,n.variadic&&(y="".concat(y,".").concat(o)),r.insertStore(y,g)),e.abrupt("return",r);case 15:case"end":return e.stop()}}),e,this)}))),function(e,t,n,i,a){return $.apply(this,arguments)})},{key:"executeCommands",value:(S=k()(T.a.mark((function e(t,n){var i,a;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=t,a=0;case 2:if(!(a=b.Config.max_instruction_count)){e.next=8;break}throw Se.exceed_max_instructions();case 8:if(!this.forceKill){e.next=12;break}throw"FORCED_KILL!";case 12:if(t.mode!==re.Modes.PAUSE){e.next=16;break}return e.abrupt("return",this.executeCommand(t,n));case 16:if(t.mode!==re.Modes.RETURN){e.next=20;break}return e.abrupt("return",t);case 20:if(!this.checkContext(Tt.Context.BREAKABLE)||t.mode!==re.Modes.BREAK){e.next=24;break}return e.abrupt("return",t);case 24:if(this.mode!==re.Modes.ABORT){e.next=26;break}throw ke.getMessage("aborted_execution");case 26:if(!(n instanceof B)){e.next=30;break}return e.abrupt("return",this.executeDeclaration(t,n));case 30:if(!(n instanceof F)){e.next=34;break}return e.abrupt("return",this.executeArrayIndexAssign(t,n));case 34:if(!(n instanceof U)){e.next=38;break}return e.abrupt("return",this.executeAssign(t,n));case 38:if(!(n instanceof O)){e.next=42;break}return e.abrupt("return",this.executeBreak(t,n));case 42:if(!(n instanceof L)){e.next=46;break}return e.abrupt("return",this.executeReturn(t,n));case 46:if(!(n instanceof Q)){e.next=50;break}return e.abrupt("return",this.executeIfThenElse(t,n));case 50:if(!(n instanceof J)){e.next=54;break}return e.abrupt("return",this.executeRepeatUntil(t,n));case 54:if(!(n instanceof V)){e.next=58;break}return e.abrupt("return",this.executeWhile(t,n));case 58:if(!(n instanceof q)){e.next=62;break}return e.abrupt("return",this.executeFor(t,n));case 62:if(!(n instanceof ee)){e.next=66;break}return e.abrupt("return",this.executeSwitch(t,n));case 66:if(!(n instanceof ze)){e.next=70;break}return e.abrupt("return",this.executeFunctionCall(t,n));case 70:if(!(n instanceof ie)){e.next=74;break}return e.abrupt("return",this.executeSysCall(t,n));case 74:throw Se.unknown_command(n.sourceInfo);case 75:case"end":return e.stop()}}),e,this)}))),function(e,t){return N.apply(this,arguments)})},{key:"executeSysCall",value:(C=k()(T.a.mark((function e(t,n){var i;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.langFunc.bind(this),e.abrupt("return",i(t,n));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return C.apply(this,arguments)})},{key:"executeFunctionCall",value:(I=k()(T.a.mark((function t(n,i){var a,r,o;return T.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=null,a=i.isMainCall?this.findMainFunction():this.findFunction(i.id),this.function_call_stack.push(i.sourceInfo),t.next=5,this.runFunction(a,i.actualParameters,n);case 5:if((r=t.sent).destroy(),j.Types.VOID.isCompatible(a.returnType)||r.mode===re.Modes.RETURN){t.next=12;break}throw o=a.name===e.MAIN_INTERNAL_ID?qe.getMainFunctionName():a.name,Se.function_no_return(o);case 12:return this.function_call_stack.pop(),t.abrupt("return",n);case 14:case"end":return t.stop()}}),t,this)}))),function(e,t){return I.apply(this,arguments)})},{key:"executeSwitch",value:(A=k()(T.a.mark((function e(t,n){var i,a,r,o,s,l,c;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.context.push(Tt.Context.BREAKABLE),i=n.cases,a=t,r=!1,o=0;case 5:if(!(o=i.lines)){e.next=34;break}if(!i.isVector){e.next=31;break}throw Se.vector_line_outbounds_full(n.id,o,i.lines,n.sourceInfo);case 31:throw Se.matrix_line_outbounds_full(n.id,o,i.lines,n.sourceInfo);case 32:e.next=36;break;case 34:if(!(o<0)){e.next=36;break}throw Se.array_dimension_not_positive_full(n.sourceInfo);case 36:if(null==l||0!==i.columns){e.next=38;break}throw Se.vector_not_matrix_full(n.id,n.sourceInfo);case 38:if(null==l){e.next=45;break}if(!(l>=i.columns)){e.next=43;break}throw Se.matrix_column_outbounds_full(n.id,l,i.columns,n.sourceInfo);case 43:if(!(l<0)){e.next=45;break}throw Se.array_dimension_not_positive_full(n.sourceInfo);case 45:if(i.type.canAccept(c.type,a)){e.next=55;break}if(b.Config.enable_type_casting&&Rt.Store.canImplicitTypeCast(i.type.innerType,c.type)){e.next=54;break}throw d=i.type.innerType,p=d.stringInfo(),_=p[0],f=c.type.stringInfo(),m=f[0],v=n.expression.toString(),Se.incompatible_types_full(_.type,_.dim,m.type,m.dim,v,n.sourceInfo);case 54:u=Rt.Store.doImplicitCasting(i.type.innerType,c);case 55:if(!((h=i.getAt(o,l))instanceof Ft.ArrayStoreValue)){e.next=60;break}if(h.lines===u.lines&&h.columns===u.columns){e.next=60;break}throw g=n.expression.toString(),Se.invalid_matrix_index_assign_full(n.id,o,h.lines,g,u.lines,n.sourceInfo);case 60:return e.abrupt("return",t.updateStoreArray(n.id,u,o,l));case 61:case"end":return e.stop()}}),e,this)}))),function(e,t){return m.apply(this,arguments)})},{key:"executeDeclaration",value:(f=k()(T.a.mark((function e(t,n){var i,a,r,o,s,l,c,u;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n instanceof P)){e.next=4;break}return e.abrupt("return",this.executeArrayDeclaration(t,n));case 4:if(i=new $e.StoreValue(n.type,null,null,n.isConst),null===n.initial){e.next=22;break}return e.next=8,this.evaluateExpression(t,n.initial);case 8:if(a=e.sent,r=a,a.type.isCompatible(n.type)){e.next=21;break}if(!b.Config.enable_type_casting||!Rt.Store.canImplicitTypeCast(n.type,a.type)){e.next=15;break}r=Rt.Store.doImplicitCasting(n.type,r),e.next=21;break;case 15:throw o=a.type.stringInfo(),s=o[0],l=a.type.stringInfo(),c=l[0],u=n.expression.toString(),Se.incompatible_types_full(s.type,s.dim,c.type,c.dim,u,n.sourceInfo);case 21:i=new $e.StoreValue(n.type,r.get(),null,n.isConst);case 22:return t.insertStore(n.id,i),e.abrupt("return",t);case 24:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"executeArrayDeclaration",value:(_=k()(T.a.mark((function e(t,n){var i,a,r,o,s,l;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.evaluateExpression(t,n.lines);case 2:if(i=e.sent,j.Types.INTEGER.isCompatible(i.type)){e.next=5;break}throw Se.array_dimension_not_int_full(n.sourceInfo);case 5:return a=i.get().toNumber(),e.next=8,this.evaluateExpression(t,n.columns);case 8:if(r=e.sent,o=null,null===r){e.next=16;break}if(j.Types.INTEGER.isCompatible(r.type)){e.next=13;break}throw Se.array_dimension_not_int_full(n.sourceInfo);case 13:if(!((o=r.get().toNumber())<0)){e.next=16;break}throw Se.array_dimension_not_positive_full(n.sourceInfo);case 16:if(s=new Ft.ArrayStoreValue(n.type,[],a,o,null,n.isConst),null===n.initial){e.next=22;break}return e.next=20,this.evaluateArrayLiteral(t,n.initial,n.type,a,o);case 20:l=e.sent,s=new Ft.ArrayStoreValue(n.type,l,a,o,null,n.isConst);case 22:return t.insertStore(n.id,s),e.abrupt("return",t);case 24:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"evaluateExpression",value:(p=k()(T.a.mark((function e(t,n){return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.instruction_count+=1,this.instruction_count%b.Config.suspend_threshold!=0){e.next=4;break}return e.next=4,St(5);case 4:if(this.mode!==re.Modes.ABORT){e.next=6;break}throw ke.getMessage("aborted_execution");case 6:if(!(this.instruction_count>=b.Config.max_instruction_count)){e.next=8;break}throw new Error("Número de instruções excedeu o limite definido. Verifique se seu código não possui laços infinitos ou muitas chamadas de funções recursivas.");case 8:if(!(n instanceof _t)){e.next=12;break}return e.abrupt("return",this.evaluateUnaryApp(t,n));case 12:if(!(n instanceof dt)){e.next=16;break}return e.abrupt("return",this.evaluateInfixApp(t,n));case 16:if(!(n instanceof v)){e.next=20;break}return e.abrupt("return",this.evaluateArrayAccess(t,n));case 20:if(!(n instanceof ct)){e.next=24;break}return e.abrupt("return",this.evaluateVariableLiteral(t,n));case 24:if(!(n instanceof Ye)){e.next=28;break}return e.abrupt("return",this.evaluateLiteral(t,n));case 28:if(!(n instanceof Ze)){e.next=32;break}return e.abrupt("return",this.evaluateLiteral(t,n));case 32:if(!(n instanceof tt)){e.next=36;break}return e.abrupt("return",this.evaluateLiteral(t,n));case 36:if(!(n instanceof rt)){e.next=40;break}return e.abrupt("return",this.evaluateLiteral(t,n));case 40:if(!(n instanceof it)){e.next=44;break}return e.abrupt("return",this.evaluateLiteral(t,n));case 44:if(!(n instanceof st)){e.next=48;break}throw new Error("Internal Error: The system should not eval an array literal.");case 48:if(!(n instanceof ze)){e.next=50;break}return e.abrupt("return",this.evaluateFunctionCall(t,n));case 50:return e.abrupt("return",null);case 51:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"evaluateFunctionCall",value:(d=k()(T.a.mark((function e(t,n){var i,a,r;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n.isMainCall){e.next=2;break}throw Se.void_in_expression_full(qe.getMainFunctionName(),n.sourceInfo);case 2:if(i=this.findFunction(n.id),!j.Types.VOID.isCompatible(i.returnType)){e.next=5;break}throw Se.void_in_expression_full(n.id,n.sourceInfo);case 5:if(!(this.function_call_stack.length>=b.Config.max_call_stack)){e.next=7;break}throw Se.exceeded_recursive_calls(n.sourceInfo);case 7:return this.function_call_stack.push(n.sourceInfo),e.next=10,this.runFunction(i,n.actualParameters,t);case 10:if((a=e.sent).mode===re.Modes.RETURN){e.next=13;break}throw new Error("!!!Internal error: the function that was called did not have a return command or did not set the store mode properly -> "+n.id);case 13:return r=a.applyStore("$"),a.destroy(),this.function_call_stack.pop(),e.abrupt("return",r);case 17:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"evaluateArrayLiteral",value:(u=k()(T.a.mark((function e(t,n,i,a,r){var o;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.isVector){e.next=9;break}if(null!=r){e.next=3;break}throw new Error("This should never happen: Vector cannot be initialized by a matrix");case 3:return e.next=5,this.evaluateMatrix(t,n,i,a,r);case 5:return o=e.sent,e.abrupt("return",o.reduce((function(e,t){return e.concat(t)}),[]));case 9:if(null==r){e.next=11;break}throw new Error("This should never happen: Matrix cannot be initialized by a vector");case 11:return e.abrupt("return",this.evaluateVector(t,n,i,a));case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n,i,a){return u.apply(this,arguments)})},{key:"evaluateVector",value:(c=k()(T.a.mark((function e(t,n,i,a){var r,o,s=this;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.value,a===r.length){e.next=3;break}throw Se.invalid_number_elements_vector(a,n.toString(),r.length,n.sourceInfo);case 3:return e.next=5,Promise.all(r.map((function(e){return s.evaluateExpression(t,e)})));case 5:return o=e.sent,e.abrupt("return",o.map((function(e,t){if(!i.canAccept(e.type,1)){if(!b.Config.enable_type_casting||!Rt.Store.canImplicitTypeCast(i.innerType,e.type)){var n=r[t].toString();throw Se.invalid_array_literal_type_full(n,r[t].sourceInfo)}return Rt.Store.doImplicitCasting(i.innerType,e)}return e})));case 7:case"end":return e.stop()}}),e)}))),function(e,t,n,i){return c.apply(this,arguments)})},{key:"evaluateMatrix",value:(l=k()(T.a.mark((function e(t,n,i,a,r){var o,s,l=this;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((o=n.value).length===a){e.next=3;break}throw Se.invalid_number_lines_matrix(a,n.toString(),o.length,n.sourceInfo);case 3:return s=o.map((function(e){var n=new Ue.ArrayType(i.innerType,1);return l.evaluateVector(t,e,n,r)})),e.next=6,Promise.all(s);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)}))),function(e,t,n,i,a){return l.apply(this,arguments)})},{key:"evaluateLiteral",value:(s=k()(T.a.mark((function e(t,n){return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new $e.StoreValue(n.type,n.value));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return s.apply(this,arguments)})},{key:"evaluateVariableLiteral",value:(r=k()(T.a.mark((function e(t,n){var i;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.applyStore(n.id),e.abrupt("return",i);case 2:case"end":return e.stop()}}),e)}))),function(e,t){return r.apply(this,arguments)})},{key:"evaluateArrayAccess",value:(i=k()(T.a.mark((function e(t,n){var i,a,r,o,s,l,c,u;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((i=t.getStoreObject(n.id)).type instanceof Ue.ArrayType){e.next=3;break}throw Se.invalid_array_access_full(n.id,n.sourceInfo);case 3:return e.next=5,this.evaluateExpression(t,n.line);case 5:if(a=e.sent,j.Types.INTEGER.isCompatible(a.type)){e.next=8;break}throw Se.array_dimension_not_int_full(n.sourceInfo);case 8:return r=a.get().toNumber(),e.next=11,this.evaluateExpression(t,n.column);case 11:if(o=e.sent,s=null,null===o){e.next=17;break}if(j.Types.INTEGER.isCompatible(o.type)){e.next=16;break}throw Se.array_dimension_not_int_full(n.sourceInfo);case 16:s=o.get().toNumber();case 17:if(!(r>=i.lines)){e.next=25;break}if(!i.isVector){e.next=22;break}throw Se.vector_line_outbounds_full(n.id,r,i.lines,n.sourceInfo);case 22:throw Se.matrix_line_outbounds_full(n.id,r,i.lines,n.sourceInfo);case 23:e.next=27;break;case 25:if(!(r<0)){e.next=27;break}throw Se.array_dimension_not_positive_full(n.sourceInfo);case 27:if(null===s||0!==i.columns){e.next=29;break}throw Se.vector_not_matrix_full(n.id,n.sourceInfo);case 29:if(null===s){e.next=36;break}if(!(s>=i.columns)){e.next=34;break}throw Se.matrix_column_outbounds_full(n.id,s,i.columns,n.sourceInfo);case 34:if(!(s<0)){e.next=36;break}throw Se.array_dimension_not_positive_full(n.sourceInfo);case 36:if(l=i.getAt(r,s),c=i.type.innerType,!Array.isArray(l)){e.next=43;break}return u=l.map((function(e,t){return new Bt.StoreValueAddress(c,e,r,t,i.id,i.readOnly)})),e.abrupt("return",new Ft.ArrayStoreValue(new Ue.ArrayType(c,1),u,i.columns,null,i.id,i.readOnly));case 43:return e.abrupt("return",new Bt.StoreValueAddress(c,l,r,s,i.id,i.readOnly));case 44:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"evaluateUnaryApp",value:(n=k()(T.a.mark((function e(t,n){var i,a,r,o;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.evaluateExpression(t,n.left);case 2:if(i=e.sent,a=Object(At.resultTypeAfterUnaryOp)(n.op,i.type),!j.Types.UNDEFINED.isCompatible(a)){e.next=8;break}throw r=i.type.stringInfo(),o=r[0],Se.invalid_unary_op_full(n.op,o.type,o.dim,n.sourceInfo);case 8:e.t0=n.op.ord,e.next=e.t0===Re.Operators.ADD.ord?11:e.t0===Re.Operators.SUB.ord?12:e.t0===Re.Operators.NOT.ord?13:14;break;case 11:return e.abrupt("return",new $e.StoreValue(a,i.get()));case 12:return e.abrupt("return",new $e.StoreValue(a,i.get().negated()));case 13:return e.abrupt("return",new $e.StoreValue(a,!i.get()));case 14:throw new ye("!!!Critical Invalid UnaryApp "+n.op);case 15:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"evaluateInfixApp",value:(t=k()(T.a.mark((function e(t,n){var i,a,r,o,s,l,c,u,d,p,_,f,m,v,h,g,y,x,w,E,R,A,k,I,C,O,N;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.evaluateExpression(t,n.left);case 2:return i=e.sent,e.next=5,this.evaluateExpression(t,n.right);case 5:if(a=e.sent,r=!1,o=Object(At.resultTypeAfterInfixOp)(n.op,i.type,a.type),!j.Types.UNDEFINED.isCompatible(o)){e.next=18;break}if(!b.Config.enable_type_casting||!Rt.Store.canImplicitTypeCast(i.type,a.type)){e.next=13;break}r=!0,e.next=18;break;case 13:throw s=i.type.stringInfo(),l=s[0],c=a.type.stringInfo(),u=c[0],Se.invalid_infix_op_full(n.op,l.type,l.dim,u.type,u.dim,n.sourceInfo);case 18:d=null,e.t0=n.op.ord,e.next=e.t0===Re.Operators.ADD.ord?22:e.t0===Re.Operators.SUB.ord?39:e.t0===Re.Operators.MULT.ord?40:e.t0===Re.Operators.DIV.ord?42:e.t0===Re.Operators.MOD.ord?46:e.t0===Re.Operators.GT.ord?51:e.t0===Re.Operators.GE.ord?55:e.t0===Re.Operators.LT.ord?59:e.t0===Re.Operators.LE.ord?63:e.t0===Re.Operators.EQ.ord?67:e.t0===Re.Operators.NEQ.ord?71:e.t0===Re.Operators.AND.ord?75:e.t0===Re.Operators.OR.ord?76:77;break;case 22:if(!j.Types.STRING.isCompatible(i.type)){e.next=27;break}return p=_e(a.get(),a.type),e.abrupt("return",new $e.StoreValue(o,i.get()+p));case 27:if(!j.Types.STRING.isCompatible(a.type)){e.next=32;break}return _=_e(i.get(),i.type),e.abrupt("return",new $e.StoreValue(o,_+a.get()));case 32:if(!j.Types.CHAR.isCompatible(i.type)){e.next=38;break}return f=_e(i.get(),i.type),m=_e(a.get(),a.type),e.abrupt("return",new $e.StoreValue(o,f+m));case 38:return e.abrupt("return",new $e.StoreValue(o,i.get().plus(a.get())));case 39:return e.abrupt("return",new $e.StoreValue(o,i.get().minus(a.get())));case 40:return d=i.get().times(a.get()),e.abrupt("return",new $e.StoreValue(o,d));case 42:if(0!=a.get()){e.next=44;break}throw Se.divsion_by_zero_full(n.toString(),n.sourceInfo);case 44:return d=j.Types.INTEGER.isCompatible(o)?i.get().divToInt(a.get()):i.get().div(a.get()),e.abrupt("return",new $e.StoreValue(o,d));case 46:return v=i.get(),h=a.get(),r&&(o=j.Types.INTEGER,v=v.trunc(),h=h.trunc()),d=v.modulo(h),e.abrupt("return",new $e.StoreValue(o,d));case 51:return g=i.get(),y=a.get(),j.Types.STRING.isCompatible(i.type)?d=g.length>y.length:j.Types.CHAR.isCompatible(i.type)?d=g.charCodeAt(0)>y.charCodeAt(0):(r&&(o=j.Types.BOOLEAN,g=g.trunc(),y=y.trunc()),d=g.gt(y)),e.abrupt("return",new $e.StoreValue(o,d));case 55:return x=i.get(),w=a.get(),j.Types.STRING.isCompatible(i.type)?d=x.length>=w.length:j.Types.CHAR.isCompatible(i.type)?d=x.charCodeAt(0)>=w.charCodeAt(0):(r&&(o=j.Types.BOOLEAN,x=x.trunc(),w=w.trunc()),d=x.gte(w)),e.abrupt("return",new $e.StoreValue(o,d));case 59:return E=i.get(),R=a.get(),j.Types.STRING.isCompatible(i.type)?d=E.length1&&void 0!==arguments[1]&&arguments[1];a()(this,e),this.disableMarginTop=n,this.input=null,this.cursorInterval=null,this.idleInterval=null,this.inputDiv=null,this.inputCMD=null,this.inputSpan=null,this.cursorRef=null,this.needInput=!1,this.clearBtn=null,this.hideBtn=null,this.showBtn=null,this.termDiv=null,this.anyKey=!1;var i=t;"#"===t[0]&&(i=t.substring(1)),this.parent=document.getElementById(i),this.setup(),this.inputListeners=[],this.hideInput(),this.pending_writes=[],this.last_clear=-1}var t,n,i;return o()(e,null,[{key:"BASH_TEMPLATE",get:function(){return'\n
\n \n Terminal\n \n \n
\n
'}},{key:"INPUT_CARET_TEMPLATE",get:function(){return'\n
\n \n
\n
'}},{key:"USER",get:function(){return 0}},{key:"INFO",get:function(){return 1}},{key:"ERR",get:function(){return 2}},{key:"INPUT",get:function(){return 3}}]),o()(e,[{key:"setup",value:function(){this._setupDom(),this._setupEvents()}},{key:"_setupEvents",value:function(){this.input.addEventListener("keydown",this.registerInput.bind(this)),this.clearBtn.addEventListener("click",this.clearBtnClick.bind(this)),this.hideBtn.addEventListener("click",this.hideBtnClick.bind(this)),this.showBtn.addEventListener("click",this.showBtnClick.bind(this))}},{key:"registerInput",value:function(e){if(this.needInput&&(13===e.which||this.anyKey)){null!=this.idleInterval&&(clearInterval(this.idleInterval),this.idleInterval=null);var t=this.input.value;t=t.replace("[\n\r]+",""),this.notifyListeners(t),this._appendUserInput(t),this.input.value="",this.inputSpan.innerHTML="",this.currentLine=null}}},{key:"_setupDom",value:function(){var t=document.createElement("div");t.classList.add("bash"),t.innerHTML=e.BASH_TEMPLATE,this.termDiv=t.querySelector("#ivprog-term"),this.termDiv.classList.add("ivprog-term-div"),this.inputDiv=document.createElement("div"),this.inputDiv.id="ivprog-terminal-inputdiv",this.inputDiv.innerHTML=e.INPUT_CARET_TEMPLATE,this.input=document.createElement("input"),this.input.setAttribute("name","command"),this.input.setAttribute("value",""),this.input.setAttribute("type","text"),this.inputDiv.append(this.input),this.termDiv.append(this.inputDiv),t.append(this.termDiv),this.parent.append(t),this.inputCMD=this.inputDiv.querySelector("#cmd"),this.cursorRef=this.inputCMD.querySelector("#cursor"),this.inputSpan=this.inputCMD.querySelector("span"),this.clearBtn=t.querySelector("#ivprog-console-clearbtn"),this.hideBtn=t.querySelector("#ivprog-console-hidebtn"),this.showBtn=t.querySelector("#ivprog-console-showbtn"),this._setupCursor(),window.$(this.clearBtn).popup({content:ke.getUI("tooltip_terminal_clear")}),window.$(this.showBtn).popup({content:ke.getUI("tooltip_terminal_show")}),window.$(this.hideBtn).popup({content:ke.getUI("tooltip_terminal_hide")})}},{key:"_setupCursor",value:function(){this.inputCMD.addEventListener("click",this.blinkCaretAndFocus.bind(this)),this.input.addEventListener("keyup",this.updateSpanText.bind(this)),this.input.addEventListener("blur",this.stopBlinkCaret.bind(this))}},{key:"blinkCaretAndFocus",value:function(){var e=this;null==this.cursorInterval&&(this.input.focus(),this.cursorInterval=window.setInterval((function(){"visible"===e.cursorRef.style.visibility?e.cursorRef.style.visibility="hidden":e.cursorRef.style.visibility="visible"}),500))}},{key:"updateSpanText",value:function(){this.inputSpan.innerHTML=this.input.value,null!=this.idleInterval&&window.clearInterval(this.idleInterval),this.scheduleNotify()}},{key:"stopBlinkCaret",value:function(){clearInterval(this.cursorInterval),this.cursorInterval=null,this.cursorRef.style.visibility="visible"}},{key:"notifyListeners",value:function(e){this.inputListeners.forEach((function(t){return t(e)})),this.inputListeners.splice(0,this.inputListeners.length),this.hideInput(),this.anyKey=!1}},{key:"writeRawHTML",value:function(e,t){this._appendTextLn(e,t,!1)}},{key:"write",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._appendText(t,e.USER,n)}},{key:"info",value:function(t){this._appendTextLn(t,e.INFO)}},{key:"err",value:function(t){this._appendTextLn(t,e.ERR)}},{key:"_appendText",value:(i=k()(T.a.mark((function e(t,n){var i,a,r,o,s=arguments;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=s.length>2&&void 0!==s[2]&&s[2],console.debug("Caling appendText"),a=Date.now(),this.pending_writes.push(0),e.next=6,St(5);case 6:if(this.pending_writes.pop(),!(this.last_clear>=a)){e.next=9;break}return e.abrupt("return");case 9:null==this.currentLine&&(r=this.getClassForType(n),(o=document.createElement("div")).classList.add(r),this.termDiv.insertBefore(o,this.inputDiv),this.currentLine=o),this.currentLine.innerHTML+=this.getOutputText(t),i&&(console.debug("append newline"),this.currentLine=null),this.scrollTerm();case 13:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"_appendTextLn",value:(n=k()(T.a.mark((function e(t,n){var i,a,r,o,s=arguments;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=!(s.length>2&&void 0!==s[2])||s[2],a=Date.now(),this.pending_writes.push(0),e.next=5,St(5);case 5:if(this.pending_writes.pop(),!(this.last_clear>=a)){e.next=8;break}return e.abrupt("return");case 8:r=this.getClassForType(n),(o=document.createElement("div")).classList.add(r),o.innerHTML=i?this.getOutputText(t):"".concat(t,""),this.termDiv.insertBefore(o,this.inputDiv),this.currentLine=null,this.scrollTerm();case 15:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"_appendUserInput",value:(t=k()(T.a.mark((function t(n){var i,a,r;return T.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=Date.now(),this.pending_writes.push(0),t.next=4,St(5);case 4:if(this.pending_writes.pop(),!(this.last_clear>=i)){t.next=7;break}return t.abrupt("return");case 7:a=this.getClassForType(e.INPUT),(r=document.createElement("div")).innerHTML=this.getUserInputText(n),r.classList.add(a),this.termDiv.insertBefore(r,this.inputDiv),this.currentLine=null,this.scrollTerm();case 14:case"end":return t.stop()}}),t,this)}))),function(e){return t.apply(this,arguments)})},{key:"getOutputText",value:function(e){return e=e.replace(/\s/g," "),"".concat(e,"")}},{key:"getUserInputText",value:function(e){return 0==e.trim().length&&(e=" "),''.concat(e,"")}},{key:"scrollTerm",value:function(){this.termDiv.scrollTop=this.termDiv.scrollHeight}},{key:"focus",value:function(){var e,t;this.termDiv.style.display="block",this.disableMarginTop||0!=this.parent.style.top.length||(this.parent.style.marginTop="-160px"),this.needInput&&(this.showInput(),this.scheduleNotify()),e=this.termDiv,(t=e.getBoundingClientRect()).bottom>0&&t.right>0&&t.left<(window.innerWidth||document.documentElement.clientWidth)&&t.top<(window.innerHeight||document.documentElement.clientHeight)||this.termDiv.scrollIntoView(!1),this.scrollTerm()}},{key:"hide",value:function(){this.needInput&&(clearInterval(this.idleInterval),this.hideInput(),this.needInput=!0),this.disableMarginTop||0!=this.parent.style.top.length||(this.parent.style.marginTop="0"),this.termDiv.style.display="none"}},{key:"getClassForType",value:function(t){switch(t){case e.INPUT:return"ivprog-term-userInput";case e.USER:return"ivprog-term-userText";case e.INFO:return"ivprog-term-info";case e.ERR:return"ivprog-term-error"}}},{key:"dispose",value:function(){this.input.removeEventListener("keyup",this.updateSpanText.bind(this)),this.input.removeEventListener("blur",this.stopBlinkCaret.bind(this)),this.input.removeEventListener("keydown",this.registerInput.bind(this)),this.inputCMD.removeEventListener("click",this.blinkCaretAndFocus.bind(this)),this.clearBtn.removeEventListener("click",this.clearBtnClick.bind(this)),this.hideBtn.removeEventListener("click",this.hideBtnClick.bind(this)),this.showBtn.removeEventListener("click",this.showBtnClick.bind(this)),this.input=null,this.inputCMD=null,this.inputDiv=null,this.termDiv=null,this.inputSpan=null,this.cursorRef=null,this.clearBtn=null,this.hideBtn=null,this.showBtn=null,this.currentLine=null;var e=this.parent.cloneNode(!1);this.parent.parentNode.replaceChild(e,this.parent),null!=this.cursorInterval&&clearInterval(this.cursorInterval),null!=this.idleInterval&&clearInterval(this.idleInterval)}},{key:"showInput",value:function(){this.needInput=!0,this.inputDiv.style.display="block",this.inputCMD.click(),this.scrollTerm()}},{key:"hideInput",value:function(){this.needInput=!1,this.inputDiv.style.display=" none",clearInterval(this.cursorInterval),this.cursorInterval=null}},{key:"requestInput",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=new Promise((function(n,i){e.inputListeners.push(n),e.anyKey=t,null==e.idleInterval&&e.scheduleNotify(),e.showInput()}));return n}},{key:"sendOutput",value:function(e){var t=""+e;if(-1!==t.indexOf("\n")){for(var n=t.split("\n"),i=0;i1;)this.inputDiv.parentElement.removeChild(this.inputDiv.parentElement.firstChild);this.input.value="",this.inputSpan.innerHTML="",this.currentLine=null}},{key:"clearBtnClick",value:function(){this.clear()}},{key:"showBtnClick",value:function(){this.focus()}},{key:"hideBtnClick",value:function(){this.hide()}},{key:"notifyIdle",value:function(){this.info(ke.getMessage("awaiting_input_message")),this.inputCMD.click()}},{key:"scheduleNotify",value:function(){this.idleInterval=window.setInterval(this.notifyIdle.bind(this),b.Config.idle_input_interval)}},{key:"cancelPendingInputRequests",value:function(){this.inputListeners.forEach((function(e){return e("")})),this.inputListeners.splice(0,this.inputListeners.length),null!=this.idleInterval&&(clearInterval(this.idleInterval),this.idleInterval=null),this.input.value="",this.inputSpan.innerHTML="",this.currentLine=null,this.hideInput(),this.anyKey=!1}}]),e}(),Kt=function(){function e(t){a()(this,e),this.ast=t,this.lexerClass=E.getCurrentLexer();var n=new this.lexerClass(null);this.literalNames=n.literalNames,this.symbolMap=null,this.currentFunction=null}return o()(e,null,[{key:"analyseFromSource",value:function(t){return new e(bt.createParser(t).parseTree()).analyseTree()}}]),o()(e,[{key:"pushMap",value:function(){if(null===this.symbolMap)this.symbolMap={map:{},next:null};else{var e={map:{},next:this.symbolMap};this.symbolMap=e}}},{key:"popMap",value:function(){null!==this.symbolMap&&(this.symbolMap=this.symbolMap.next)}},{key:"insertSymbol",value:function(e,t){this.symbolMap.map[e]=t}},{key:"findSymbol",value:function(e,t){return t.map[e]?t.map[e]:t.next?this.findSymbol(e,t.next):null}},{key:"getMainFunction",value:function(){return this.ast.functions.find((function(e){return e.isMain}))}},{key:"findFunction",value:function(e){if(e.match(/^\$.+$/)){var t=qe.getFunction(e);if(!t)throw Se.not_implemented(e);return t}var n=this.ast.functions.find((function(t){return t.name===e}));return n||null}},{key:"analyseTree",value:function(){var e=this.ast.global;this.pushMap(),this.assertDeclarations(e);var t=this.ast.functions;if(t.filter((function(e){return null===e.name})).length<=0)throw Se.main_missing();for(var n=0;n1?t.insertSymbol(e.id,{id:e.id,lines:-1,columns:-1,type:e.type}):t.insertSymbol(e.id,{id:e.id,lines:-1,columns:null,type:e.type}):t.insertSymbol(e.id,{id:e.id,type:e.type})})),this.assertDeclarations(e.variablesDeclarations);var n=e.returnType.isCompatible(j.Types.VOID);if(!this.assertReturn(e,n))throw Se.function_no_return(e.name);this.popMap()}},{key:"assertReturn",value:function(e,t){var n=this;return e.commands.reduce((function(i,a){return n.checkCommand(e.returnType,a,t)||i}),t)}},{key:"checkCommand",value:function(e,t,n){if(t instanceof V){if(!this.evaluateExpressionType(t.expression).isCompatible(j.Types.BOOLEAN))throw Se.loop_condition_type_full(t.expression.toString(),t.sourceInfo);return this.checkCommands(e,t.commands,n),!1}if(t instanceof q){if(!this.evaluateExpressionType(t.for_id).isCompatible(j.Types.INTEGER))throw Se.invalid_for_variable(t.for_id,t.sourceInfo);if(!this.evaluateExpressionType(t.for_from).isCompatible(j.Types.INTEGER))throw Se.invalid_for_from(t.for_from,t.sourceInfo);if(!this.evaluateExpressionType(t.for_to).isCompatible(j.Types.INTEGER))throw Se.invalid_for_to(t.for_to,t.sourceInfo);if(null!=t.for_pass)if(!this.evaluateExpressionType(t.for_pass).isCompatible(j.Types.INTEGER))throw Se.invalid_for_pass(t.for_pass,t.sourceInfo);return this.checkCommands(e,t.commands,n),!1}if(t instanceof ee){for(var i=this.evaluateExpressionType(t.expression),a=n,r=!1,o=0;ot.length||n.length!==t.length&&!e.hasVariadic())throw Se.invalid_parameters_size_full(e.name,t.length,e.formalParameters.length,null);for(var i=0,a=0;i'+t,transition:"fade up",on:"click",closable:!0,movePopup:!0,boundary:window,preserve:!1,target:!1,className:{popup:"ui popup invalid-identifier"},onHidden:function(t){e.popup("destroy")}}).popup("toggle")}var Xt=[],Qt=!1,Wt=Object.freeze({INSERT_FUNCTION:"INSERT_FUNCTION",REMOVE_FUNCTION:"REMOVE_FUNCTION",INSERT_GLOBAL_VAR:"INSERT_GLOBAL_VAR",REMOVE_GLOBAL_VAR:"REMOVE_GLOBAL_VAR",RENAME_FUNCTION:"RENAME_FUNCTION",RENAME_GLOBAL_VAR:"RENAME_GLOBAL_VAR",SET_GLOBAL_CONST:"SET_GLOBAL_CONST",CHANGE_FUNCTION_RETURN:"CHANGE_FUNCTION_RETURN",CHANGE_GLOBAL_TYPE:"CHANGE_GLOBAL_TYPE",CHANGE_GLOBAL_VALUE:"CHANGE_GLOBAL_VALUE",INSERT_FUNCTION_PARAM:"INSERT_FUNCTION_PARAM",REMOVE_FUNCTION_PARAM:"REMOVE_FUNCTION_PARAM",CHANGE_PARAM_TYPE:"CHANGE_PARAM_TYPE",RENAME_FUNCTION_PARAM:"RENAME_FUNCTION_PARAM",INSERT_FUNCTION_VAR:"INSERT_FUCNTION_VAR",REMOVE_FUNCTION_VAR:"REMOVE_FUNCTION_VAR",RENAME_FUNCTION_VAR:"RENAME_FUNCTION_VAR",CHANGE_VAR_TYPE:"CHANGE_VAR_TYPE",CHANGE_VAR_VALUE:"CHANGE_VAR_VALUE",INSERT_COMMAND:"INSERT_COMMAND",REMOVE_COMMAND:"REMOVE_COMMAND",CHANGE_COMMAND_EXP:"CHANGE_COMMAND_EXP",CHANGE_ATTRIB_EXP:"CHANGE_ATTRIB_EXP",CHANGE_ATTRIB_VAR:"CHANGE_ATTRIB_VAR",MOVE_COMMAND:"MOVE_COMMAND",ENTER_CHANGE_VAR_NAME:"ENTER_CHANGE_VAR_NAME",ENTER_CHANGE_VAR_VALUE:"ENTER_CHANGE_VAR_VALUE",ENTER_CHANGE_GLOBAL_NAME:"ENTER_CHANGE_GLOBAL_NAME",ENTER_CHANGE_GLOBAL_VALUE:"ENTER_CHANGE_GLOBAL_VALUE",ENTER_CHANGE_PARAM_NAME:"ENTER_CHANGE_PARAM_NAME"});function Yt(e,t,n){Qt||Xt.push([e,t,Date.now(),n])}function Jt(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a2?n-2:0),a=2;a2&&void 0!==arguments[2]?arguments[2]:0;e.type=t,e.dimensions=n,n>0&&(e.rows=n,e.columns=2),Jt(e.name,Wt.CHANGE_VAR_TYPE,t,n,e.rows,e.columns),ln(e)}function ln(e){e.type==Ht.INTEGER&&(0==e.dimensions&&(e.value=0),1==e.dimensions&&(e.value=[0,0]),2==e.dimensions&&(e.value=[[0,0],[0,0]])),e.type==Ht.REAL&&(0==e.dimensions&&(e.value=0),1==e.dimensions&&(e.value=[0,0]),2==e.dimensions&&(e.value=[[0,0],[0,0]])),e.type==Ht.TEXT&&(0==e.dimensions&&(e.value=ke.getUI("textvar_default_value")),1==e.dimensions&&(e.value=[ke.getUI("textvar_default_value"),ke.getUI("textvar_default_value")]),2==e.dimensions&&(e.value=[[ke.getUI("textvar_default_value"),ke.getUI("textvar_default_value")],[ke.getUI("textvar_default_value"),ke.getUI("textvar_default_value")]])),e.type==Ht.BOOLEAN&&(0==e.dimensions&&(e.value=!0),1==e.dimensions&&(e.value=[!0,!0]),2==e.dimensions&&(e.value=[[!0,!0],[!0,!0]])),e.type==Ht.CHAR&&(0==e.dimensions&&(e.value="A"),1==e.dimensions&&(e.value=["A","A"]),2==e.dimensions&&(e.value=[["A","A"],["A","A"]])),Zt(e.name,Wt.CHANGE_GLOBAL_VALUE,e.name,e.value)}function cn(e,t){var n="";if(0==e.dimensions)e.type==Ht.REAL?n+='
'+e.value.toFixed(1)+"
":e.type==Ht.BOOLEAN?n+='
'+ke.getUI("logic_value_".concat(e.value))+"
":n+='
'+e.value+"
";else{if(n+='',1==e.dimensions){if(n+="",e.type==Ht.REAL)for(var i=0;i'+e.value[i].toFixed(1)+"";else for(i=0;i'+ke.getUI("logic_value_".concat(e.value[i]))+"":n+='";n+="",n+="
'+e.value[i]+"
",n+='
'}if(2==e.dimensions){if(e.type==Ht.REAL)for(var a=0;a";for(i=0;i'+e.value[a][i].toFixed(1)+"";n+=""}else for(a=0;a";for(i=0;i'+ke.getUI("logic_value_".concat(e.value[a][i]))+"":n+=''+e.value[a][i]+"";n+=""}0==e.rows&&(n+=""),n+=' ',n+="",n+='
'}}t.find(".div_valor_var").html(""),(n=$(n)).find(".span_value_variable").data("associatedOject",e),n.find(".boolean_simple_type").on("click",(function(t){!function(e,t){e.value=!e.value,$(t).find(".span_value_variable").text(ke.getUI("logic_value_".concat(e.value)))}(e,this.parentNode),Jt(e.name,Wt.CHANGE_GLOBAL_VALUE,e.value)})),n.find(".simple_var").on("click",(function(t){Jt(e.name,Wt.ENTER_CHANGE_GLOBAL_VALUE),function(e,t){if(fn)return void mn.focus();var n;t=$(t),fn=!0,t.find(".span_value_variable").text(""),e.type==Ht.REAL?(n=$("")).insertBefore(t.find(".span_value_variable")):(n=$("")).insertBefore(t.find(".span_value_variable"));n.on("input",(function(){var e=n.textWidth()+10;mn=n,n.focus();var t=n.val();n.val(""),n.val(t),n.css({width:e})})).trigger("input"),n.focusout((function(){var i=!1;n.val().trim()?(e.type==Ht.REAL?(e.value=parseFloat(n.val().trim()),t.find(".span_value_variable").text(e.value.toFixed(1))):(e.type==Ht.INTEGER?e.value=parseInt(n.val().trim()):var_obj.type==Ht.CHAR?var_obj.value=n.val().charAt(0):e.value=n.val().trim(),t.find(".span_value_variable").text(e.value)),i=!0):e.type==Ht.REAL?t.find(".span_value_variable").text(e.value.toFixed(1)):t.find(".span_value_variable").text(e.value),e.type==Ht.TEXT&&(e.value=n.val(),i=!0,t.find(".span_value_variable").text(e.value)),i&&Jt(e.name,Wt.CHANGE_GLOBAL_VALUE,e.value),n.off(),n.remove(),fn=!1,mn=!1})),n.on("keydown",(function(i){var a=i.keyCode||i.which,r=!0;13==a&&(n.val().trim()?(e.type==Ht.REAL?(e.value=parseFloat(n.val().trim()),t.find(".span_value_variable").text(e.value.toFixed(1))):(e.type==Ht.INTEGER?e.value=parseInt(n.val().trim()):var_obj.type==Ht.CHAR?var_obj.value=n.val().charAt(0):e.value=n.val().trim(),t.find(".span_value_variable").text(e.value)),r=!0):e.type==Ht.REAL?t.find(".span_value_variable").text(e.value.toFixed(1)):t.find(".span_value_variable").text(e.value),e.type==Ht.TEXT&&(e.value=n.val(),r=!0,t.find(".span_value_variable").text(e.value)),r&&Jt(e.name,Wt.CHANGE_GLOBAL_VALUE,e.value),n.off(),n.remove(),fn=!1,mn=!1),27==a&&(e.type==Ht.REAL?t.find(".span_value_variable").text(e.value.toFixed(1)):t.find(".span_value_variable").text(e.value),n.off(),n.remove(),fn=!1,mn=!1)})),n.select()}(e,this.parentNode)})),n.find(".boolean_vector_var").on("click",(function(t){!function(e,t,n){e.value[t]=!e.value[t],$(n).find(".span_value_variable").text(ke.getUI("logic_value_".concat(e.value[t])))}(e,$(this).data("index"),this.parentNode),Jt(e.name,Wt.CHANGE_GLOBAL_VALUE,e.value)})),n.find(".vector_var").on("click",(function(t){Jt(e.name,Wt.ENTER_CHANGE_GLOBAL_VALUE),function(e,t,n){if(gn)return void yn.focus();var i;n=$(n),gn=!0,n.find(".span_value_variable").text(""),e.type==Ht.REAL?(i=$("")).insertBefore(n.find(".span_value_variable")):(i=$("")).insertBefore(n.find(".span_value_variable"));i.on("input",(function(){var e=i.textWidth()+10;yn=i,i.focus();var t=i.val();i.val(""),i.val(t),i.css({width:e})})).trigger("input"),i.focusout((function(){var a=!1;i.val().trim()?(e.type==Ht.REAL?(e.value[t]=parseFloat(i.val().trim()),n.find(".span_value_variable").text(e.value[t].toFixed(1))):(e.type==Ht.INTEGER?e.value[t]=parseInt(i.val().trim()):e.value[t]=i.val().trim(),n.find(".span_value_variable").text(e.value[t])),a=!0):e.type==Ht.REAL?n.find(".span_value_variable").text(e.value[t].toFixed(1)):n.find(".span_value_variable").text(e.value[t]),e.type==Ht.TEXT&&(e.value[t]=i.val(),a=!0,n.find(".span_value_variable").text(e.value[t])),a&&Jt(e.name,Wt.CHANGE_GLOBAL_VALUE,e.value),i.off(),i.remove(),gn=!1,yn=!1})),i.on("keydown",(function(a){var r=a.keyCode||a.which,o=!1;13==r&&(i.val().trim()?(e.type==Ht.REAL?(e.value[t]=parseFloat(i.val().trim()),n.find(".span_value_variable").text(e.value[t].toFixed(1))):(e.type==Ht.INTEGER?e.value[t]=parseInt(i.val().trim()):e.value[t]=i.val().trim(),n.find(".span_value_variable").text(e.value[t])),o=!0):e.type==Ht.REAL?n.find(".span_value_variable").text(e.value[t].toFixed(1)):n.find(".span_value_variable").text(e.value[t]),e.type==Ht.TEXT&&(e.value[t]=i.val(),o=!0,n.find(".span_value_variable").text(e.value[t])),o&&Jt(e.name,Wt.CHANGE_GLOBAL_VALUE,e.value),i.off(),i.remove(),gn=!1,yn=!1),27==r&&(e.type==Ht.REAL?n.find(".span_value_variable").text(e.value[t].toFixed(1)):n.find(".span_value_variable").text(e.value[t]),i.off(),i.remove(),gn=!1,yn=!1)})),i.select()}(e,$(this).data("index"),this.parentNode)})),n.find(".remove_global_vector_column").on("click",(function(n){!function(e){0!=e.columns&&(e.columns--,e.value.splice(e.value.length-1,1))}(e),t.find(".div_valor_var").html(""),Jt(e.name,Wt.CHANGE_GLOBAL_TYPE,e.type,e.dimensions,e.rows,e.columns),Zt(e.name,Wt.CHANGE_GLOBAL_VALUE,e.value),cn(e,t)})),n.find(".add_global_vector_column").on("click",(function(n){!function(e){e.columns++,e.type==Ht.INTEGER&&e.value.push(0),e.type==Ht.REAL&&e.value.push(0),e.type==Ht.TEXT&&e.value.push(ke.getUI("textvar_default_value")),e.type==Ht.BOOLEAN&&e.value.push(!0),e.type==Ht.CHAR&&e.value.push(ke.getUI("charvar_default_value"))}(e),Jt(e.name,Wt.CHANGE_GLOBAL_TYPE,e.type,e.dimensions,e.rows,e.columns),Zt(e.name,Wt.CHANGE_GLOBAL_VALUE,e.value),t.find(".div_valor_var").html(""),cn(e,t)})),n.find(".remove_global_matrix_column").on("click",(function(n){!function(e){if(0!=e.columns){e.columns--;for(var t=0;t")).insertBefore(i.find(".span_value_variable")):(a=$("")).insertBefore(i.find(".span_value_variable"));a.on("input",(function(){var e=a.textWidth()+10;_n=a,a.focus();var t=a.val();a.val(""),a.val(t),a.css({width:e})})).trigger("input"),a.focusout((function(){a.val().trim()?(e.type==Ht.REAL?(e.value[t][n]=parseFloat(a.val().trim()),i.find(".span_value_variable").text(e.value[t][n].toFixed(1))):(e.type==Ht.INTEGER?e.value[t][n]=parseInt(a.val().trim()):e.value[t][n]=a.val().trim(),i.find(".span_value_variable").text(e.value[t][n])),Jt(e.name,Wt.CHANGE_GLOBAL_VALUE,e.value)):e.type==Ht.REAL?i.find(".span_value_variable").text(e.value[t][n].toFixed(1)):i.find(".span_value_variable").text(e.value[t][n]),e.type==Ht.TEXT&&(e.value[t][n]=a.val(),i.find(".span_value_variable").text(e.value[t][n])),a.off(),a.remove(),pn=!1,_n=!1})),a.on("keydown",(function(r){var o=r.keyCode||r.which;13==o&&(a.val().trim()?(e.type==Ht.REAL?(e.value[t][n]=parseFloat(a.val().trim()),i.find(".span_value_variable").text(e.value[t][n].toFixed(1))):(e.type==Ht.INTEGER?e.value[t][n]=parseInt(a.val().trim()):e.value[t][n]=a.val().trim(),i.find(".span_value_variable").text(e.value[t][n])),Jt(e.name,Wt.CHANGE_GLOBAL_VALUE,e.value)):e.type==Ht.REAL?i.find(".span_value_variable").text(e.value[t][n].toFixed(1)):i.find(".span_value_variable").text(e.value[t][n]),e.type==Ht.TEXT&&(e.value[t][n]=a.val(),Jt(e.name,Wt.CHANGE_GLOBAL_VALUE,e.value),i.find(".span_value_variable").text(e.value[t][n])),a.off(),a.remove(),pn=!1,_n=!1),27==o&&(e.type==Ht.REAL?i.find(".span_value_variable").text(e.value[t][n].toFixed(1)):i.find(".span_value_variable").text(e.value[t][n]),a.off(),a.remove(),pn=!1,_n=!1)})),a.select()}(e,$(this).data("row"),$(this).data("index"),this.parentNode)})),t.find(".div_valor_var").append(n),function(e,t){var n=e.find(".text").text().split("[");if(2==n.length){var i=n[0]+"[ "+t.columns+" ] ";e.find(".text").empty(),e.find(".text").text(i)}if(3==n.length){i=n[0]+"[ "+t.columns+" ] [ "+t.rows+" ] ";e.find(".text").empty(),e.find(".text").text(i)}}(t,e)}function un(e){var t=e.data("associatedOject");e.find(".alternate_constant").on("click",(function(e){!function(e){e.is_constant=!e.is_constant,Jt(e.name,Wt.SET_GLOBAL_CONST)}(t),$(this).removeClass("on off"),t.is_constant?$(this).addClass("on"):$(this).addClass("off")})),e.find(".editing_name_var").on("click",(function(n){Jt(t.name,Wt.ENTER_CHANGE_GLOBAL_NAME),function(e){var t=e.data("associatedOject");if(vn)return void hn.focus();vn=!0,e.find(".span_name_variable").text("");var n=$("");n.insertBefore(e.find(".span_name_variable")),n.on("input",(function(){var e=n.textWidth()+10;(hn=n).focus(),hn.css({width:e})})).trigger("input"),n.focusout((function(){n.val().trim().length>0?(on(t,n.val().trim(),e),e.find(".span_name_variable").text(t.name)):e.find(".span_name_variable").text(t.name),n.off(),n.remove(),vn=!1,hn=!1})),n.on("keydown",(function(i){var a=i.keyCode||i.which;13==a&&(n.val().trim()?(on(t,n.val().trim(),e),e.find(".span_name_variable").text(t.name)):e.find(".span_name_variable").text(t.name),n.off(),n.remove(),vn=!1,hn=!1),27==a&&(e.find(".span_name_variable").text(t.name),n.off(),n.remove(),vn=!1,hn=!1)})),n.select()}(e)})),e.find(".ui.dropdown.global_type").dropdown({onChange:function(n,i,a){a.data("dimensions")?sn(t,Ht[a.data("type")],a.data("dimensions")):sn(t,Ht[a.data("type")]),cn(t,e)},selectOnKeydown:!1}),e.find(".remove_global").on("click",(function(n){!function(e,t){var n=window.program_obj.globals.indexOf(e);n>-1&&(window.insertContext=!0,window.program_obj.globals.splice(n,1)),Jt(e.name,Wt.REMOVE_GLOBAL_VAR),t.children().off(),t.off(),t.fadeOut()}(t,e)}))}function dn(e){var t='
const: ';for(var n in t+='
',t+='
'+e.name+'
<— ',t+='
'+e.value+"
",t+='
';var i=$(t);return i.data("associatedOject",e),$(".list_globals").append(i),un(i),cn(e,i),1==e.dimensions&&i.find(".dimensions_0").text(e.columns),2==e.dimensions&&(i.find(".dimensions_0").text(e.columns),i.find(".dimensions_1").text(e.rows)),i}var pn=!1,_n=null;var fn=!1,mn=null;var vn=!1,hn=null;var gn=!1,yn=null;function xn(){if(!window.block_render&&!window.draging){window.block_render=!0,console.log("rendering algorithm"),$(".all_functions").children().off(),$(".all_functions").empty(),$(".list_globals").children().off(),$(".list_globals").empty();for(var e=0;e").hide().appendTo(document.body)),$.fn.textWidth.fakeEl.text(e||this.val()||this.text()||this.attr("placeholder")).css("font",t||this.css("font")),$.fn.textWidth.fakeEl.width()},window.block_render=!1;var bn=Object.freeze({function:"function",comment:"comment",reader:"reader",writer:"writer",attribution:"attribution",iftrue:"iftrue",repeatNtimes:"repeatNtimes",whiletrue:"whiletrue",dowhiletrue:"dowhiletrue",switch:"switch",switchcase:"switchcase",functioncall:"functioncall",break:"break",return:"return"}),wn=Object.freeze({plus:"plus",minus:"minus",multiplication:"multiplication",division:"division",module:"module",none:"none"}),En=Object.freeze({exp_op_exp:"exp_op_exp",op_exp:"op_exp",par_exp_par:"par_exp_par",start_point:"start_point"}),Rn=Object.freeze({exp_conditional:"exp_conditional",exp_logic:"exp_logic",exp_arithmetic:"exp_arithmetic",write_sep:"write_separator"}),Tn=Object.freeze({greater_than:"greater_than",less_than:"less_than",equals_to:"equals_to",not_equals_to:"not_equals_to",greater_than_or_equals_to:"greater_than_or_equals_to",less_than_or_equals_to:"less_than_or_equals_to"}),An=Object.freeze({equals_to:"equals_to",not_equals_to:"not_equals_to",and:"and",or:"or",not:"not"}),kn=Object.freeze({math:"$mathLib",text:"$strLib",arrangement:"$arrayLib",conversion:"$langLib"}),In=function e(t,n,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0;a()(this,e),this.type=t,this.name=n,this.value=i,this.dimensions=r,this.is_constant=o,this.rows=s,this.columns=l},Cn=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ht.VOID,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:[],c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null,u=arguments.length>8&&void 0!==arguments[8]?arguments[8]:[];a()(this,e),this.type=bn.function,this.name=t,this.return_type=n,this.return_dimensions=i,this.parameters_list=r,this.is_main=o,this.is_hidden=s,this.variables_list=l,this.function_comment=c,this.commands=u},On=function e(t,n,i,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5?arguments[5]:void 0;a()(this,e),this.type=bn.function,this.identifier=t,this.return_type=n,this.return_dimensions=i,this.parameters_list=r,this.function_comment=o,this.category=s},Nn=function e(t){a()(this,e),this.type=bn.comment,this.comment_text=t},Ln=function e(){a()(this,e),this.type=bn.break},Sn=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new zn;a()(this,e),this.type=bn.reader,this.variable_value_menu=t},$n=function e(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];a()(this,e),this.type=bn.writer,this.content=t,this.newline=n},Un=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];a()(this,e),this.type=bn.attribution,this.variable=t,this.expression=n},Mn=function e(t,n){a()(this,e),this.type_op=t,this.item=n},Fn=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];a()(this,e),this.type_exp=t,this.itens=n},Dn=function e(t,n,i){a()(this,e),this.type=Rn.exp_arithmetic,this.first_operand=t,this.second_operand=n,this.operator=i},Bn=function e(t,n,i){a()(this,e),this.type=bn.iftrue,this.expression=t,this.commands_block=n,this.commands_else=i},Gn=function e(t,n,i,r,o,s){a()(this,e),this.type=bn.repeatNtimes,this.var_attribution=t,this.var_incrementation=n,this.expression1=i,this.expression2=r,this.expression3=o,this.commands_block=s},Pn=function e(t,n){a()(this,e),this.type=bn.whiletrue,this.expression=t,this.commands_block=n},Kn=function e(t,n){a()(this,e),this.type=bn.dowhiletrue,this.expression=t,this.commands_block=n},Vn=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];a()(this,e),this.type=bn.switch,this.variable=t,this.cases=n},Hn=function e(t){a()(this,e),this.type=bn.return,this.variable_value_menu=t},qn=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];a()(this,e),this.type=bn.switchcase,this.variable_value_menu=t,this.commands_block=n},jn=function e(t,n){a()(this,e),this.type=bn.functioncall,this.function_called=t,this.parameters_list=n},zn=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;a()(this,e),this.type="var_value",this.variable_and_value=t,this.content=n,this.row=i,this.column=r,this.include_constant=o,this.dimensions=s},Xn=function(){function e(){a()(this,e),this.functions=[],this.globals=[]}return o()(e,[{key:"addFunction",value:function(e){jt.a.watch(e.parameters_list,(function(){window.insertContext?(setTimeout((function(){xn()}),300),window.insertContext=!1):xn()}),1),jt.a.watch(e.variables_list,(function(){window.insertContext?(setTimeout((function(){xn()}),300),window.insertContext=!1):xn()}),1),this.functions.push(e)}},{key:"addVariable",value:function(e,t){null===this.functions[e].variable&&(this.functions[e].variables_list=[]),this.functions[e].variables_list.push(t)}},{key:"addGlobal",value:function(e){this.globals.push(e)}}]),e}(),Qn=0;function Wn(e,t,n,i){e.name!=t&&(Ot(t)?!function(e,t){if(t.parameters_list)for(var n=0;n3&&void 0!==arguments[3]?arguments[3]:0;e.type=t,e.dimensions=i,i>0&&(e.rows=i,e.columns=2),Jt(n,Wt.CHANGE_VAR_TYPE,e.name,t,i,e.rows,e.columns),ti(e,n)}function Jn(e,t,n){t.find(".editing_name_var").on("click",(function(i){Jt(n.name,Wt.ENTER_CHANGE_VAR_NAME,e.name),function(e,t,n){if(oi)return void si.focus();var i;oi=!0,t.find(".span_name_variable").text(""),(i=$("")).insertBefore(t.find(".span_name_variable")),i.on("input",(function(){var e=i.textWidth()+10;si=i,i.focus();var t=i.val();i.val(""),i.val(t),i.css({width:e})})).trigger("input"),i.focusout((function(){i.val().trim().length>0?(Wn(e,i.val().trim(),t,n),t.find(".span_name_variable").text(e.name)):t.find(".span_name_variable").text(e.name),i.off(),i.remove(),oi=!1,si=!1})),i.on("keydown",(function(a){var r=a.keyCode||a.which;13==r&&(i.val().trim().length>0?(Wn(e,i.val().trim(),t,n),t.find(".span_name_variable").text(e.name)):t.find(".span_name_variable").text(e.name),i.off(),i.remove(),oi=!1,si=!1),27==r&&(t.find(".span_name_variable").text(e.name),i.off(),i.remove(),oi=!1,si=!1)})),i.select()}(e,t,n)})),t.find(".ui.dropdown.variable_type").dropdown({onChange:function(i,a,r){r.data("dimensions")?Yn(e,Ht[r.data("type")],n.name,r.data("dimensions")):Yn(e,Ht[r.data("type")],n.name),ei(e,t,n.name)},selectOnKeydown:!1}),t.find(".remove_variable").on("click",(function(i){!function(e,t,n){var i=t.data("associatedFunction");Jt(n,Wt.REMOVE_FUNCTION_VAR,e.name);var a=i.variables_list.indexOf(e);a>-1&&(window.insertContext=!0,delete i.variables_list[a],i.variables_list.splice(a,1)),t.children().off(),t.off(),t.fadeOut()}(e,t,n.name)}))}function Zn(e,t,n){var i='
';for(var a in i+=' ",i+='
'+t.name+"
",i+=' <—
'+t.value+"
",i+='
',(i=$(i)).data("associatedFunction",n),e.find(".variables_list_div").append(i),Jn(t,i,n),ei(t,i,n.name),i}function ei(e,t,n){var i="";if(0==e.dimensions)e.type==Ht.REAL?i+='
'+e.value.toFixed(1)+"
":e.type==Ht.BOOLEAN?i+='
'+ke.getUI("logic_value_".concat(e.value))+"
":i+='
'+e.value+"
";else{if(i+='',1==e.dimensions){if(i+="",e.type==Ht.REAL)for(var a=0;a'+e.value[a].toFixed(1)+"";else for(a=0;a'+ke.getUI("logic_value_".concat(e.value[a]))+"":i+='";i+="",i+="
'+e.value[a]+"
",i+='
'}if(2==e.dimensions){if(e.type==Ht.REAL)for(var r=0;r";for(a=0;a'+e.value[r][a].toFixed(1)+"";i+=""}else for(r=0;r";for(a=0;a'+ke.getUI("logic_value_".concat(e.value[r][a]))+"":i+=''+e.value[r][a]+"";i+=""}0==e.rows&&(i+=""),i+=' ',i+="",i+='
'}}$(t).find(".div_valor_var").html(""),i=$(i),$(i).find(".span_value_variable").data("associatedOject",e),$(i).find(".boolean_simple_type").on("click",(function(t){Jt(n,Wt.CHANGE_VAR_VALUE,e.name,e.value),function(e,t){e.value=!e.value,$(t).find(".span_value_variable").text(ke.getUI("logic_value_".concat(e.value)))}(e,this.parentNode)})),$(i).find(".simple_var").on("click",(function(t){Jt(n,Wt.ENTER_CHANGE_VAR_VALUE,e.name),function(e,t,n){if(ai)return void ri.focus();var i;t=$(t),ai=!0,t.find(".span_value_variable").text(""),e.type==Ht.REAL?(i=$("")).insertBefore(t.find(".span_value_variable")):(i=$("")).insertBefore(t.find(".span_value_variable"));i.on("input",(function(){var e=i.textWidth()+10;ri=i,i.focus();var t=i.val();i.val(""),i.val(t),i.css({width:e})})).trigger("input"),i.focusout((function(){var a=!1;i.val().trim()?(e.type==Ht.REAL?(e.value=parseFloat(i.val().trim()),t.find(".span_value_variable").text(e.value.toFixed(1))):(e.type==Ht.INTEGER?e.value=parseInt(i.val().trim()):e.type==Ht.CHAR?e.value=i.val().charAt(0):e.value=i.val().trim(),t.find(".span_value_variable").text(e.value)),a=!0):e.type==Ht.REAL?t.find(".span_value_variable").text(e.value.toFixed(1)):t.find(".span_value_variable").text(e.value),e.type==Ht.TEXT&&(e.value=i.val(),a=!0,t.find(".span_value_variable").text(e.value)),a&&Jt(n,Wt.CHANGE_VAR_VALUE,e.name,e.value),i.off(),i.remove(),ai=!1,ri=!1})),i.on("keydown",(function(a){var r=a.keyCode||a.which,o=!1;13==r&&(i.val().trim()?(e.type==Ht.REAL?(e.value=parseFloat(i.val().trim()),t.find(".span_value_variable").text(e.value.toFixed(1))):(e.type==Ht.INTEGER?e.value=parseInt(i.val().trim()):e.type==Ht.CHAR?e.value=i.val().charAt(0):e.value=i.val().trim(),t.find(".span_value_variable").text(e.value)),o=!0):e.type==Ht.REAL?t.find(".span_value_variable").text(e.value.toFixed(1)):t.find(".span_value_variable").text(e.value),e.type==Ht.TEXT&&(e.value=i.val(),o=!0,t.find(".span_value_variable").text(e.value)),o&&Jt(n,Wt.CHANGE_VAR_VALUE,e.name,e.value),i.off(),i.remove(),ai=!1,ri=!1),27==r&&(e.type==Ht.REAL?t.find(".span_value_variable").text(e.value.toFixed(1)):t.find(".span_value_variable").text(e.value),i.off(),i.remove(),ai=!1,ri=!1)})),i.select()}(e,this.parentNode,n)})),$(i).find(".boolean_vector_var").on("click",(function(t){!function(e,t,n){e.value[t]=!e.value[t],$(n).find(".span_value_variable").text(ke.getUI("logic_value_".concat(e.value[t])))}(e,$(this).data("index"),this.parentNode),Jt(n,Wt.CHANGE_VAR_VALUE,e.name,e.value)})),$(i).find(".vector_var").on("click",(function(t){!function(e,t,n,i){if(ni)return void ii.focus();var a;n=$(n),ni=!0,n.find(".span_value_variable").text(""),e.type==Ht.REAL?(a=$("")).insertBefore(n.find(".span_value_variable")):(a=$("")).insertBefore(n.find(".span_value_variable"));a.on("input",(function(){var e=a.textWidth()+10;ii=a,a.focus();var t=a.val();a.val(""),a.val(t),a.css({width:e})})).trigger("input"),a.focusout((function(){var r=!1;a.val().trim()?(e.type==Ht.REAL?(e.value[t]=parseFloat(a.val().trim()),n.find(".span_value_variable").text(e.value[t].toFixed(1))):(e.type==Ht.INTEGER?e.value[t]=parseInt(a.val().trim()):e.value[t]=a.val().trim(),n.find(".span_value_variable").text(e.value[t])),r=!0):e.type==Ht.REAL?n.find(".span_value_variable").text(e.value[t].toFixed(1)):n.find(".span_value_variable").text(e.value[t]),e.type==Ht.TEXT&&(e.value[t]=a.val(),r=!0,n.find(".span_value_variable").text(e.value[t])),r&&Jt(i,Wt.CHANGE_VAR_VALUE,e.name,e.value),a.off(),a.remove(),ni=!1,ii=!1})),a.on("keydown",(function(r){var o=r.keyCode||r.which,s=!1;13==o&&(a.val().trim()?(e.type==Ht.REAL?(e.value[t]=parseFloat(a.val().trim()),n.find(".span_value_variable").text(e.value[t].toFixed(1))):(e.type==Ht.INTEGER?e.value[t]=parseInt(a.val().trim()):e.value[t]=a.val().trim(),n.find(".span_value_variable").text(e.value[t])),s=!0):e.type==Ht.REAL?n.find(".span_value_variable").text(e.value[t].toFixed(1)):n.find(".span_value_variable").text(e.value[t]),e.type==Ht.TEXT&&(e.value[t]=a.val(),s=!0,n.find(".span_value_variable").text(e.value[t])),s&&Jt(i,Wt.CHANGE_VAR_VALUE,e.name,e.value),a.off(),a.remove(),ni=!1,ii=!1),27==o&&(e.type==Ht.REAL?n.find(".span_value_variable").text(e.value[t].toFixed(1)):n.find(".span_value_variable").text(e.value[t]),a.off(),a.remove(),ni=!1,ii=!1)})),a.select()}(e,$(this).data("index"),this.parentNode,n)})),$(i).find(".remove_global_vector_column").on("click",(function(i){!function(e){if(0==e.columns)return;e.columns--,e.value.splice(e.value.length-1,1)}(e),Jt(n,Wt.CHANGE_VAR_TYPE,e.name,e.type,e.dimensions,e.rows,e.columns),Zt(n,Wt.CHANGE_VAR_VALUE,e.name,e.value),$(t).find(".div_valor_var").html(""),ei(e,t,n)})),$(i).find(".add_global_vector_column").on("click",(function(i){!function(e){e.columns++,e.type==Ht.INTEGER&&e.value.push(0);e.type==Ht.REAL&&e.value.push(0);e.type==Ht.TEXT&&e.value.push(ke.getUI("textvar_default_value"));e.type==Ht.BOOLEAN&&e.value.push(!0);e.type==Ht.CHAR&&e.value.push(ke.getUI("charvar_default_value"))}(e),Jt(n,Wt.CHANGE_VAR_TYPE,e.name,e.type,e.dimensions,e.rows,e.columns),Zt(n,Wt.CHANGE_VAR_VALUE,e.name,e.value),$(t).find(".div_valor_var").html(""),ei(e,t,n)})),$(i).find(".remove_global_matrix_column").on("click",(function(i){!function(e){if(0==e.columns)return;e.columns--;for(var t=0;t")).insertBefore(i.find(".span_value_variable")):(r=$("")).insertBefore(i.find(".span_value_variable"));r.on("input",(function(){var e=r.textWidth()+10;ci=r,r.focus();var t=r.val();r.val(""),r.val(t),r.css({width:e})})).trigger("input"),r.focusout((function(){var o=!1;r.val().trim()?(e.type==Ht.REAL?(e.value[t][n]=parseFloat(r.val().trim()),i.find(".span_value_variable").text(e.value[t][n].toFixed(1))):(e.type==Ht.INTEGER?e.value[t][n]=parseInt(r.val().trim()):e.value[t][n]=r.val().trim(),i.find(".span_value_variable").text(e.value[t][n])),o=!0):e.type==Ht.REAL?i.find(".span_value_variable").text(e.value[t][n].toFixed(1)):i.find(".span_value_variable").text(e.value[t][n]),e.type==Ht.TEXT&&(e.value[t][n]=r.val(),o=!0,i.find(".span_value_variable").text(e.value[t][n])),o&&Jt(a,Wt.CHANGE_VAR_VALUE,e.name,e.value),r.off(),r.remove(),li=!1,ci=!1})),r.on("keydown",(function(o){var s=o.keyCode||o.which,l=!1;13==s&&(r.val().trim()?(e.type==Ht.REAL?(e.value[t][n]=parseFloat(r.val().trim()),i.find(".span_value_variable").text(e.value[t][n].toFixed(1))):(e.type==Ht.INTEGER?e.value[t][n]=parseInt(r.val().trim()):e.value[t][n]=r.val().trim(),i.find(".span_value_variable").text(e.value[t][n])),l=!0):e.type==Ht.REAL?i.find(".span_value_variable").text(e.value[t][n].toFixed(1)):i.find(".span_value_variable").text(e.value[t][n]),e.type==Ht.TEXT&&(e.value[t][n]=r.val(),l=!0,i.find(".span_value_variable").text(e.value[t][n])),l&&Jt(a,Wt.CHANGE_VAR_VALUE,e.name,e.value),r.off(),r.remove(),li=!1,ci=!1),27==s&&(e.type==Ht.REAL?i.find(".span_value_variable").text(e.value[t][n].toFixed(1)):i.find(".span_value_variable").text(e.value[t][n]),r.off(),r.remove(),li=!1,ci=!1)})),r.select()}(e,$(this).data("row"),$(this).data("index"),this.parentNode,n)})),$(t).find(".div_valor_var").append(i),function(e,t){var n=e.find(".text").text().split("[");if(2==n.length){var i=n[0]+"[ "+t.columns+" ] ";e.find(".text").empty(),e.find(".text").text(i)}if(3==n.length){i=n[0]+"[ "+t.columns+" ] [ "+t.rows+" ] ";e.find(".text").empty(),e.find(".text").text(i)}}(t,e)}function ti(e,t){e.type==Ht.INTEGER&&(0==e.dimensions&&(e.value=0),1==e.dimensions&&(e.value=[0,0]),2==e.dimensions&&(e.value=[[0,0],[0,0]])),e.type==Ht.REAL&&(0==e.dimensions&&(e.value=0),1==e.dimensions&&(e.value=[0,0]),2==e.dimensions&&(e.value=[[0,0],[0,0]])),e.type==Ht.TEXT&&(0==e.dimensions&&(e.value=ke.getUI("textvar_default_value")),1==e.dimensions&&(e.value=[ke.getUI("textvar_default_value"),ke.getUI("textvar_default_value")]),2==e.dimensions&&(e.value=[[ke.getUI("textvar_default_value"),ke.getUI("textvar_default_value")],[ke.getUI("textvar_default_value"),ke.getUI("textvar_default_value")]])),e.type==Ht.BOOLEAN&&(0==e.dimensions&&(e.value=!0),1==e.dimensions&&(e.value=[!0,!0]),2==e.dimensions&&(e.value=[[!0,!0],[!0,!0]])),e.type==Ht.CHAR&&(0==e.dimensions&&(e.value="A"),1==e.dimensions&&(e.value=["A","A"]),2==e.dimensions&&(e.value=[["A","A"],["A","A"]])),Zt(t,Wt.CHANGE_VAR_VALUE,e.name,e.value)}var ni=!1,ii=null;var ai=!1,ri=null;var oi=!1,si=null;var li=!1,ci=null;function ui(e,t,n,i){if(n.empty(),jt.a.unwatch(e,"expression"),jt.a.watch(e,"expression",(function(){if(!window.timer){var i=n.find(".single_element_expression").not(".mouse_distance").not(".add_parentheses"),a="";i.each((function(e){$(this).hasClass("parentheses_in_expression")?a+=$(this).text()+" ":(a+=$(this).find(".text").text(),a+=$(this).find(".var_name").text(),a+=$(this).find(".parameters_function_called").text(),a+=$(this).find(".value_rendered").text(),a+=" ")})),a&&(window.timer=!0,Jt(t.name,Wt.CHANGE_COMMAND_EXP,e.type,"/",a),setTimeout((function(){window.timer=!1}),200))}}),20,!0),e.type===bn.attribution)if(jt.a.unwatch(e.variable),jt.a.watch(e.variable,(function(){ui(e,t,n,i)}),0),e.variable.content){var a=[];e.variable.content.type==Ht.INTEGER||e.variable.content.type==Ht.REAL?a.push(Rn.exp_arithmetic):e.variable.content.type==Ht.BOOLEAN||e.variable.content.type==Ht.TEXT?(a.push(Rn.exp_conditional),a.push(Rn.exp_logic),a.push(Rn.exp_arithmetic)):console.log("NÃO RECONHECI! VEJA: ",e.variable.content.type),di(e,t,n,i,a)}else n.text(ke.getUI("var_menu_select_var").toLowerCase());else{var r=[];r.push(Rn.exp_conditional),r.push(Rn.exp_logic),e.type===bn.writer&&r.push(Rn.write_sep),r.push(Rn.exp_arithmetic),di(e,t,n,i,r)}n.children(".mouse_distance").addClass("mouse_distance_hidden"),n.children(".higher_element").on("mousemove",(function(e){window.open_or_close||($(this).css("position","relative","!important"),$(this).children(".mouse_distance").css("opacity","1"))})),n.children(".higher_element").on("mouseout",(function(e){window.open_or_close||($(this).css("position","absolute","!important"),$(this).children(".mouse_distance").css("opacity","0"))}));var o=$('
');n.find(".single_element_expression").on("mousedown",(function(e){window.posX=e.clientX,window.posY=e.clientY})),Sortable.create(n[0],{animation:100,ghostClass:"ghost",group:{name:"shared",put:!1},draggable:".single_element_expression",sort:!1,filter:".not_allowed",onStart:function(){$("body").append(o),o.css("display","block"),o.css("top",window.posY+70,"!important"),o.css("left",window.posX-20,"!important")},onMove:function(){o.addClass("color_test")},onEnd:function(){o.remove(),n.find(".ghost").removeClass("ghost")}}),new Sortable(o[0],{group:"shared",animation:150,onAdd:function(a){o.css("display","none"),o.find(".single_element_expression").remove(),o.css("background-color",""),o.remove(),function(e,t){var n=$(e.item).data("index"),i=t[0];if(console.log("indice: ",n),t[n].type)1==t.length?t.splice(0,1):t.length>1&&(n>0&&t[n-1].type_op?(n=0&&n-30&&"("==t[n-1]&&")"==t[n+1]&&(n>1&&t[n-2].type_op?(t.splice(n+1,1),t.splice(n,1),t.splice(n-1,1),t.splice(n-2,1)):(n=0;o--)if("("==t[o]){a=o;break}}t[a+1].type_op?(t.splice(r,1),t.splice(a+1,1),t.splice(a,1)):(t.splice(r,1),t.splice(a,1))}0==t.length&&t.push(new zn(Oi.all,null,null,null,!0));i!=t[0]&&t[0].type_op&&t.splice(0,1)}(a,i),ui(e,t,n,i)}})}function di(e,t,n,i,a){var r=0;for(r=0;r
');0==r&&i.length>0&&i[0].type_op,Ni(e,i[r],o,t),n.append(o)}else"("==i[r]||")"==i[r]?")"==i[r]?(fi(n,a,i,e,t,r),pi(n,i[r],e,t,r,i)):"("!=i[r]||i[r+1].type_op?pi(n,i[r],e,t,r,i):(pi(n,i[r],e,t,r,i),_i(n,a,i,e,t,r+1)):(0==r?console.log("NEGAÇÃO NO PRIMEIRO ELEMENTO"):"("==i[r-1]&&console.log("NEGAÇÃO APÓS O PARÊNTESES"),mi(e,t,n,i[r],a,r,i));fi(n,a,i,e,t,r,!0),function(e,t,n,i,a){var r=$('
');n.append(r),r.popup({content:"Adicionar parênteses",delay:{show:750,hide:0}}),r.on("click",(function(a){if(!window.parentheses_activate){n.find(".usepointer").off("click"),window.parentheses_activate=!0,window.open_or_close="open",n.find(".dropdown").addClass("disabled"),n.find(".ghost_element").addClass("temp_class"),n.find(".ghost_element").removeClass("ghost_element");var r,o=$('
(
');o.draggable().appendTo("body"),o.css("position","absolute"),a.type="mousedown.draggable",a.target=o[0],o.css("left",a.pageX+10),o.css("top",a.pageY+10),o.trigger(a),n.on("mousemove",(function(e){var t=null;t=$(e.target).hasClass("single_element_expression")?$(e.target):$(e.target).closest(".single_element_expression"),$(e.target).hasClass("temp_class")||t.length<1||t.hasClass("add_parentheses")||t.hasClass("rendered_parentheses")||$(e.target).hasClass("expression_elements")||function(e,t,n,i,a){var r=e.data("index");if("("==a[r]||")"==a[r])return;if("close"==window.open_or_close&&r0){"close"==window.open_or_close&&(window.close_parentheses.insertAfter(i.find('.single_element_expression[data-index="'+l+'"]')),window.inserir_close=l+2);break}if("var_value"==a[l].type){"close"==window.open_or_close&&(window.close_parentheses.insertAfter(i.find('.single_element_expression[data-index="'+l+'"]')),window.inserir_close=l+2);break}}}else if(a[r].type_op){"open"==window.open_or_close&&(window.open_parentheses.insertBefore(e),window.inserir_open=r);for(o=0,s=0,l=1;l0){"var_value"==a[l].type&&(window.close_parentheses.insertAfter(i.find('.single_element_expression[data-index="'+l+'"]')),window.inserir_close=l+2);break}if("var_value"==a[l].type){"var_value"==a[l].type&&(window.close_parentheses.insertAfter(i.find('.single_element_expression[data-index="'+l+'"]')),window.inserir_close=l+2);break}}}return}if("var_value"==a[r].type)return"open"==window.open_or_close&&(window.open_parentheses.insertBefore(e),window.inserir_open=r),void("close"==window.open_or_close&&(window.close_parentheses.insertAfter(e),window.inserir_close=r+2));if(a[r].type_op){if("("==a[r-1])"open"==window.open_or_close&&(window.open_parentheses.insertBefore(e),window.inserir_open=r);else if(")"==a[r-1]){o=0,s=0;for(var c=r-1;c>=0;c--)if("("==a[c]&&o++,")"==a[c]&&s++,o!=s);else if(s>0){"open"==window.open_or_close&&(window.open_parentheses.insertBefore(i.find('.single_element_expression[data-index="'+c+'"]')),window.inserir_open=c);break}}else"var_value"==a[r-1].type&&"open"==window.open_or_close&&(window.open_parentheses.insertBefore(i.find('.single_element_expression[data-index="'+(r-1)+'"]')),window.inserir_open=r-1);if("("==a[r+1]){for(o=0,s=0,c=r+1;c0){"close"==window.open_or_close&&(window.close_parentheses.insertAfter(i.find('.single_element_expression[data-index="'+c+'"]')),window.inserir_close=c+2);break}}else"var_value"==a[r+1].type&&"close"==window.open_or_close&&(window.close_parentheses.insertAfter(i.find('.single_element_expression[data-index="'+(r+1)+'"]')),window.inserir_close=r+3)}}(t,0,0,n,i)})),n.on("mouseleave",(function(){})),$("body").on("mouseup",(function(a){if("open"==window.open_or_close){window.open_or_close="close",o.remove();var s=$(a.target).closest(".command_container"),l=n.closest(".command_container");if(!s.is(l))return window.parentheses_activate=!1,n.find(".temp_class").addClass("ghost_element"),n.find(".temp_class").removeClass("temp_class"),n.off("mousemove"),n.off("mouseleave"),$("body").off("mouseup"),window.open_parentheses.remove(),window.close_parentheses.remove(),window.inserir_open=-1,window.inserir_close=-1,window.open_or_close=null,void ui(e,t,n,i);window.open_parentheses.addClass("parentheses_fixed"),(r=$('
)
')).draggable().appendTo("body"),r.css("position","absolute"),r.css("left",a.pageX+10),r.css("top",a.pageY+10),$("body").on("mousemove",(function(e){r.css("left",e.pageX+10),r.css("top",e.pageY+10)}))}else{r.remove(),window.open_parentheses.removeClass("parentheses_fixed"),n.off("mousemove"),n.off("mouseleave"),$("body").off("mouseup"),setTimeout((function(){window.parentheses_activate=!1}),50);s=$(a.target).closest(".command_container"),l=n.closest(".command_container");var c=!1;s.is(l)&&(c=!0),c&&(i.splice(window.inserir_open,0,"("),i.splice(window.inserir_close,0,")")),window.inserir_open=-1,window.inserir_close=-1,window.open_or_close=null,ui(e,t,n,i)}}))}}))}(e,t,n,i)}function pi(e,t,n,i,a,r){var o=$('
'+t+"
");e.append(o)}function _i(e,t,n,i,a,r){var o='",o=$(o);var s=$('
');s.append(o);var l=$('
');l.append(s),e.append(l),o.dropdown("set selected",wn.minus),s.on("click",(function(){if(!window.open_or_close){var o=r;t.indexOf(Rn.exp_arithmetic)>=0?(console.log("p1"),n.splice(o,0,new Mn(Rn.exp_arithmetic,wn.minus))):t.indexOf(Rn.exp_logic)>=0?(console.log("p2"),n.splice(o,0,new Mn(Rn.exp_logic,An.equals_to))):t.indexOf(Rn.exp_conditional)>=0&&(console.log("p3"),n.splice(o,0,new Mn(Rn.exp_conditional,Tn.greater_than))),ui(i,a,e,n)}}))}function fi(e,t,n,i,a,r){var o=arguments.length>6&&void 0!==arguments[6]&&arguments[6],s='",s=$(s);var l=$('
'),c=$('
'),u=$('');l.append(u),o?(l.removeClass("mouse_distance"),l.css("opacity","1","!important"),e.append(l)):(c.append(l),e.append(c),l.css("opacity","0","!important")),s.dropdown("set selected",wn.plus),l.on("click",(function(){var o=r;if(")"==n[o]&&"("==n[o-1])return n.splice(o,0,new zn(Oi.all,null,null,null,!0)),void ui(i,a,e,n);t.indexOf(Rn.exp_arithmetic)>=0?(n.splice(o,0,new Mn(Rn.exp_arithmetic,wn.plus)),n.splice(o+1,0,new zn(Oi.all,null,null,null,!0))):t.indexOf(Rn.exp_logic)>=0?(n.splice(o,0,new Mn(Rn.exp_logic,An.equals_to)),n.splice(o+1,0,new zn(Oi.all,null,null,null,!0))):t.indexOf(Rn.exp_conditional)>=0&&(n.splice(o,0,new Mn(Rn.exp_conditional,Tn.greater_than)),n.splice(o+1,0,new zn(Oi.all,null,null,null,!0))),ui(i,a,e,n)}))}function mi(e,t,n,i,a,r,o){var s='",s=$(s);var l=$('
');l.append(s),n.append(l),s.dropdown({onChange:function(e,t,n){i.item=n.data("value"),i.type_op=n.data("type")}}),s.dropdown("set selected",i.item)}function vi(){var e;return e='
+
',e+='
-
',e+='
*
',e+='
/
',e+='
%
'}function hi(){var e;return e='
==
',e+='
!=
',e+='
'+ke.getUI("logic_operator_and")+"
",e+='
'+ke.getUI("logic_operator_or")+"
",e+='
'+ke.getUI("logic_operator_not")+"
"}function gi(){var e;return e='
>
',e+='
<
',e+='
==
',e+='
!=
',e+='
>=
',e+='
<=
'}function yi(e,t){var n=$('
'+ke.getUI("text_receives")+'
');if(n.data("command",e),Ni(e,e.variable,n.find(".var_attributed"),t),!e.expression||e.expression.length<1){var i=new zn(Oi.all,null,null,null,!0);e.expression.push(i)}return function(e,t,n){n.find(".button_remove_command").on("click",(function(){Ji(e,t,n)&&n.fadeOut(400,(function(){n.remove()}))})),n.find(".button_refresh_attribution").on("click",(function(){bi(e,t,n)}))}(e,t,n),ui(e,t,n.find(".expression_elements"),e.expression),n}function xi(e,t,n,i,a,r,o){var s=o.itens.indexOf(t);switch(r.data("exp")){case En.exp_op_exp:var l=new Fn(En.exp_op_exp,[o.itens[s],wn.plus,new zn(Oi.all,null,null,null,!0)]);o.itens[s]=l;break;case En.op_exp:l=new Fn(En.op_exp,[wn.plus,o.itens[s]]);o.itens[s]=l;break;case En.par_exp_par:l=new Fn(En.par_exp_par,[o.itens[s]]);o.itens[s]=l}bi(e,a,n)}function bi(e,t,n){var i,a=n.find(".expression_elements");if(0==n.hasClass("command_container"))for(var r=n.parentsUntil(".command_container"),o=0;o
');s.data("ref_element",e.expression[o]),s.data("ref_index",o),a.append(s),Ei(e,t,s,e.expression[o])}}function wi(e,t,n,i,a){var r='",r=$(r),n.append(r),r.dropdown({onChange:function(e,t,n){i.itens[a]=e}})}function Ei(e,t,n,i){switch(i.type_exp){case En.exp_op_exp:var a=$('
'),r=$('
'),o=$('
');n.append(r),n.append(a),n.append(o),i.itens[0].type?Ni(e,i.itens[0],r,t,2,i):Ei(e,t,r,i.itens[0]),wi(0,0,a,i,1),i.itens[2].type?Ni(e,i.itens[2],o,t,2,i):Ei(e,t,o,i.itens[2]);break;case En.op_exp:a=$('
');var s=$('
');n.append(a),n.append(s),wi(0,0,a,i,0),i.itens[1].type?Ni(e,i.itens[1],s,t,2,i):Ei(e,t,s,i.itens[1]);break;case En.par_exp_par:var l=$('
(
'),c=(s=$('
'),$('
)
'));n.append(l),n.append(s);for(var u=0;u )
',n+="";var i=$(n);if(i.data("command",e),function(e,t,n){n.find(".button_remove_command").on("click",(function(){Ji(e,t,n)&&n.fadeOut(400,(function(){n.remove()}))}))}(e,t,i),Ai(e,i.find(".context_menu"),t,i),Ni(e,e.variable,i.find(".variable_to_switch"),t),e.cases)for(var a=0;a'+ke.getUI("text_code_case")+'
:
');if(Ni(t,e.variable_value_menu,a.find(".variable_case"),n),a.data("switchcase",e),a.find(".case_commands_block").data("switchcase",e),i.append(a),e.commands_block)for(var r=0;r '+ke.getUI("btn_break")+" ":(a+=' '+ke.getUI("btn_break")+" ",a+=' '+ke.getUI("btn_case")+" "),a+="",a=$(a),t.append(a),function(e,t,n,i){t.find(".menu_commands").dropdown({on:"hover"}),t.find(".menu_commands a").on("click",(function(t){if(e.type==bn.repeatNtimes||e.type==bn.whiletrue||e.type==bn.dowhiletrue)if(null==e.commands_block||0==e.commands_block.length){e.commands_block=[];var a=ra($(this).data("command"));e.commands_block.push(a),aa(a,i.find(".block_commands"),3,n)}else Zi(n,i.find(".block_commands"),$(this).data("command"),t);else switch($(this).data("command")){case bn.break:Zi(n,i.find(".block_commands"),$(this).data("command"),t);break;case bn.switchcase:!function(e,t,n,i){null==e.cases&&(e.cases=[]);var a=new qn(new zn(Oi.all,null,null,null,!0));e.cases.push(a),Ti(a,e,n,i.find(".all_cases_div"))}(e,0,n,i)}}))}(e,t,n,i)}function ki(e,t){var n='
\n\t\t\n\t\t\n\t\t
'.concat(ke.getUI("text_for"),'\n\t\t
\n\t\t
\n\t\t\n\t\t
\n\t\t
\n\t\t\n\t\t').concat(ke.getUI("text_for_to"),' \n\t\t
\n\t\t
\n\t\t
\n\t\t
\'');n+='
',n+="
",n+=" ",n+="
";var i=$(n);if(i.data("command",e),i.find(".block_commands").data("command",e),function(e,t,n){n.find(".button_remove_command").on("click",(function(){Ji(e,t,n)&&n.fadeOut(400,(function(){n.remove()}))}))}(e,t,i),Ai(e,i.find(".context_menu"),t,i),Ni(e,e.var_attribution,i.find(".variable_attribution"),t),Ni(e,e.expression2,i.find(".conditional_expression"),t),e.expression1||(e.expression1=new zn(Oi.all,"0",null,null,!0)),i.find(".text_receives").text(ke.getUI("text_for_from")),Ni(e,e.expression1,i.find(".var_value_expression"),t),e.expression3?(i.find(".pass_button").html(''),i.find(".pass_button").find("button").on("click",(function(){Ii(e)})),Ci(e,t,i.find(".operator"),e.expression3,1),Ni(e,e.expression3.itens[2],i.find(".second_operand"),t)):(i.find(".pass_button").html(''),i.find(".pass_button").find("button").on("click",(function(){Ii(e)}))),e.commands_block)for(var a=0;a
');r.dropdown({values:[{name:"+",value:wn.plus,selected:i.itens[a]==wn.plus},{name:"-",value:wn.minus,selected:i.itens[a]==wn.minus}],onChange:function(e,t,n){i.itens[a]=e}}),n.append(r)}window.timer=!1,window.parentheses_activate=!1,window.open_or_close=null,window.open_parentheses=$('
(
'),window.close_parentheses=$('
)
'),window.inserir_open=-1,window.inserir_close=-1;var Oi=Object.freeze({only_variable:1,only_value:2,only_function:3,variable_and_function:4,variable_and_value_opt:5,value_and_function:6,all:7});function Ni(e,t,n,i){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2,r=arguments.length>5?arguments[5]:void 0;if(t.function_called&&t.function_called.parameters_list)for(;t.function_called.parameters_list.length!=t.parameters_list.length;)t.parameters_list.length>t.function_called.parameters_list.length?t.parameters_list.pop():t.parameters_list.push(new zn(Oi.all,null,null,null,!0));var o='');switch(o.data("function_reference",window.system_functions[r]),o.data("option",Oi.only_function),o.text(ke.translateInternalFunction(window.system_functions[r].identifier)),window.system_functions[r].category){case kn.math:a.find(".menu_math_functions").append(o);break;case kn.text:a.find(".menu_text_functions").append(o);break;case kn.arrangement:a.find(".menu_arrangement_functions").append(o);break;case kn.conversion:a.find(".menu_conversion_functions").append(o)}}}function Di(e,t,n,i){var a=t.find(".menu_only_functions");a.text("");for(var r=0;r'+window.program_obj.functions[r].name+" ");o.data("function_reference",window.program_obj.functions[r]),a.append(o)}}function Bi(e,t,n,i){var a=t.find(".menu_only_vars");a.text("");var r=!1;if(window.program_obj.globals)if(n.include_constant)for(var o=0;o'+window.program_obj.globals[o].name+" ")).data("variable_reference",window.program_obj.globals[o]),a.append(s),r=!0}else for(o=0;o'+window.program_obj.globals[o].name+" ")).data("variable_reference",window.program_obj.globals[o]),a.append(s),r=!0}if(e.parameters_list)for(o=0;o'+e.parameters_list[o].name+" ")).data("variable_reference",e.parameters_list[o]),a.append(s),r=!0}if(e.variables_list)for(o=0;o'+e.variables_list[o].name+" ")).data("variable_reference",e.variables_list[o]),a.append(s),r=!0}r||(a.append($('
'+ke.getUI("text_no_variable")+"
")),a.append($('
'+ke.getUI("text_no_variable_instruction")+"
")))}function Gi(e,t,n,i,a,r){t.variable_and_value!=Oi.only_value&&i.dropdown({onChange:function(o,s,l){switch(console.log("S7"),n.find(".var_name").remove(),l.data("option")){case Oi.only_function:!function(e,t,n,i,a,r,o){if(t.function_called=r,t.parameters_list=[],null!=r.parameters_list&&r.parameters_list.length>0){i.find(".text").text(" "),n.find(".menu_var_or_value_dom").remove(),u=r.name?'
'+r.name+" ( ":'
'+ke.translateInternalFunction(r.identifier,r.category)+" ( ";for(var s=0;s
',s+1!=r.parameters_list.length&&(u+=" , ");u+=" )
",u=$(u),n.append(u);for(s=0;s0?new zn(Oi.variable_and_function,null,null,null,!0,r.parameters_list[s].dimensions):new zn(Oi.all,null,null,null,!0),t.parameters_list.push(l),Ni(e,l,u.find(".parameter_"+s),a,2,o)}var c='",(c=$(c)).insertAfter(n.find(".parameters_function_called")),c.dropdown({onChange:function(i,r,s){console.log("S8"),s.data("clear")&&(console.log("PP7"),n.text(""),t.content=null,t.row=null,t.column=null,delete t.function_called,delete t.parameters_list,Ni(e,t,n,a,2,o)),s.data("exp")&&xi(e,t,n,0,a,s,o)},selectOnKeydown:!1})}else{var u;i.find(".text").text(" "),n.find(".menu_var_or_value_dom").remove(),u=r.name?'
'+r.name+" ( ":'
'+ke.translateInternalFunction(r.identifier,r.category)+" ( ",u+=" )
",u=$(u),n.append(u);c='",(c=$(c)).insertAfter(n.find(".parameters_function_called")),c.dropdown({onChange:function(i,r,s){console.log("S9"),s.data("clear")&&(console.log("PP8"),n.text(""),t.content=null,t.row=null,t.column=null,delete t.function_called,delete t.parameters_list,Ni(e,t,n,a,2,o)),s.data("exp")&&xi(e,t,n,0,a,s,o)},selectOnKeydown:!1})}}(e,t,n,i,a,$(l).data("function_reference"),r);break;case Oi.only_value:Pi(e,t,n,i,a,r);break;case Oi.only_variable:!function(e,t,n,i,a,r,o){t.content=r,i.find(".text").text(" "),n.find(".menu_var_or_value_dom").remove();var s='
'+r.name+"";1==r.dimensions&&1!=t.dimensions&&(s+=' [
]');2==r.dimensions&&2!=t.dimensions&&(s+=' [
] ',s+=' [
]');s+="
",s=$(s),n.append(s),1==r.dimensions&&1!=t.dimensions&&(t.column=new zn(Oi.all,null,null,null,!0),Ni(e,t.column,s.find(".column_container"),a,2,o));2==r.dimensions&&2!=t.dimensions&&(t.row=new zn(Oi.all,null,null,null,!0),Ni(e,t.row,s.find(".row_container"),a,2,o),t.column=new zn(Oi.all,null,null,null,!0),Ni(e,t.column,s.find(".column_container"),a,2,o));var l='",(l=$(l)).insertAfter(n.find(".variable_rendered")),l.dropdown({onChange:function(i,r,s){console.log("S10"),s.data("clear")&&(console.log("PP9"),n.text(""),t.content=null,t.row=null,t.column=null,delete t.function_called,delete t.parameters_list,Ni(e,t,n,a,2,o)),s.data("exp")&&xi(e,t,n,0,a,s,o),e.type==bn.repeatNtimes&&function(e,t,n,i,a,r,o){n.hasClass("variable_attribution")&&($(n).parent().find(".text_receives").text(""),e.expression1=null,$(n).parent().find(".var_value_expression").empty()),n.hasClass("incrementation_variable")&&($(n).parent().find(".text_inc_receives").text(""),e.expression3=null,$(n).parent().find(".first_operand").empty(),$(n).parent().find(".operator").empty(),$(n).parent().find(".second_operand").empty())}(e,0,n)},selectOnKeydown:!1})}(e,t,n,i,a,$(l).data("variable_reference"),r)}l.data("exp")&&xi(e,t,n,0,a,l,r),e.type==bn.repeatNtimes&&function(e,t,n,i,a,r,o){if(n.hasClass("variable_attribution")){if(!e.expression3){var s=new Fn(En.exp_op_exp,[e.var_attribution,wn.plus,new zn(Oi.all,"1",null,null,!0)]);e.expression3=s,e.var_incrementation=e.var_attribution;var l=new Dn(e.var_attribution,new zn(Oi.all,null,null,null,!0),Tn.less_than);e.expression2.expression=l}n.parent().find(".text_receives").text("de"),e.expression1=new zn(Oi.all,"0",null,null,!0),n.parent().find(".var_value_expression").empty(),Ni(e,e.expression1,n.parent().find(".var_value_expression"),a),renderAlgorithm()}if(n.hasClass("incrementation_variable")){n.parent().find(".text_inc_receives").text("de");s=new Fn(En.exp_op_exp,[new zn(Oi.all,null,null,null,!0),wn.plus,new zn(Oi.all,null,null,null,!0)]);e.expression3=s,Ni(e,e.expression3.itens[0],n.parent().find(".first_operand"),a),Ci(e,a,n.parent().find(".operator"),e.expression3,1),Ni(e,e.expression3.itens[2],n.parent().find(".second_operand"),a)}}(e,0,n,0,a)},selectOnKeydown:!1}),n.find(".width-dynamic").on("input",(function(){var e=$(this).textWidth()+10;$(this).focus();var t=$(this).val();$(this).val(""),$(this).val(t),$(this).css({width:e})})).trigger("input"),e.type==bn.comment&&n.parent().on("click",(function(o){n.find(".value_rendered").remove(),n.find(".value_rendered").empty(),n.find(".value_rendered").remove(),n.empty(),n.append(' '),Pi(e,t,n,i,a,r)}))}function Pi(e,t,n,i,a,r){null==t.content&&(t.content=""),i.find(".text").text(" ");var o=$('');o.insertBefore(n.find(".menu_var_or_value_dom"));var s=$('
');s.insertBefore(o),o.focus(),o.val(t.content);var l='",l=$(l),n.find(".menu_var_or_value_dom").remove(),t.variable_and_value!=Oi.only_value&&l.insertAfter(o),l.dropdown({onChange:function(i,o,s){console.log("S11"),s.data("clear")&&(console.log("PP10"),n.text(""),n.find(".value_rendered").remove(),n.find(".context_menu_clear").remove(),n.find(".width-dynamic-minus").remove(),t.content=null,t.row=null,t.column=null,delete t.function_called,delete t.parameters_list,Ni(e,t,n,a,2,r)),s.data("exp")&&xi(e,t,n,0,a,s,r)},selectOnKeydown:!1}),n.find(".width-dynamic-minus").focusout((function(){$(this).val().trim()&&(t.content=$(this).val().trim()),s.text(t.content),$(this).remove()})),n.find(".width-dynamic-minus").on("keydown",(function(e){var n=e.keyCode||e.which;13==n&&($(this).val().trim()&&(t.content=$(this).val().trim()),s.text(t.content),$(this).remove()),27==n&&(s.text(t.content),$(this).remove())})),e.type,bn.comment,s.on("click",(function(o){console.log("TTT2"),s.remove(),s.empty(),s.remove(),n.empty(),n.append(' '),Pi(e,t,n,i,a,r)}))}function Ki(e,t){var n=$('
');return n.data("command",e),function(e,t,n){n.find(".button_remove_command").on("click",(function(){Ji(e,t,n)&&n.fadeOut(400,(function(){n.remove()}))}))}(e,t,n),function(e,t,n){Ni(e,e.comment_text,n.find(".var_value_menu_div"),t,20)}(e,t,n),n}function Vi(e,t){var n='
'+ke.getUI("text_command_read")+' (
)
';return(n=$(n)).data("command",e),Ni(e,e.variable_value_menu,n.find(".var_value_menu_div"),t),function(e,t,n){n.find(".button_remove_command").on("click",(function(){Ji(e,t,n)&&n.fadeOut(400,(function(){n.remove()}))}))}(e,t,n),n}function Hi(e,t){var n='
\n \n \n '.concat(ke.getUI("text_command_write"),'\n (
\n )\n \n
'),i=$(n);return i.data("command",e),ui(e,t,i.find(".all_elements_write"),e.content),function(e,t,n){n.find(".button_remove_command").on("click",(function(){Ji(e,t,n)&&n.fadeOut(400,(function(){n.remove()}))})),Sortable.create(n.find(".all_elements_write")[0],{handle:".ellipsis",animation:100,ghostClass:"ghost",group:"writer_"+Math.floor(1e7*Math.random()),draggable:".div_parent_handler",onEnd:function(i){e.content.splice(i.newIndex,0,e.content.splice(i.oldIndex,1)[0]),n.empty(),n.replaceWith(Hi(e,t))}});var i=n.find(".ivprog_newline_btn");i.on("click",(function(){"on"===this.dataset.state?(this.dataset.state="off",e.newline=!1,this.setAttribute("src","img/no_new_line.svg")):(this.dataset.state="on",e.newline=!0,this.setAttribute("src","img/new_line.svg")),n.data("command",e),qi(i,e.newline)})),qi(i,e.newline)}(e,t,i),i}function qi(e,t){e.popup("exists")&&e.popup("destroy");var n=t?ke.getUI("write_command_newline_on"):ke.getUI("write_command_newline_off");e.popup({content:n,delay:{show:750,hide:0}})}function ji(e,t){var n="";n+='
',n+=' '+ke.getUI("text_if")+"",n+=' (
) ',n+=" ",n+='
',n+="
",n+='
'+ke.getUI("text_else")+" ",n+='
',n+="
",n+="
",n+="
";var i=$(n);if(i.data("command",e),i.find(".block_commands").data("command",e),i.find(".data_block_if").data("command",e),i.find(".data_block_else").data("command",e),i.find(".commands_if").data("command",e),function(e,t,n){n.find(".button_remove_command").on("click",(function(){Ji(e,t,n)&&n.fadeOut(400,(function(){n.remove()}))}))}(e,t,i),ui(e,t,i.find(".conditional_expression"),e.expression),e.commands_block)for(var a=0;a",n+=' (
) ',n+=" ",n+='
',n+="
",n+=" ",n+="
";var i=$(n);if(i.data("command",e),i.find(".block_commands").data("command",e),function(e,t,n){n.find(".button_remove_command").on("click",(function(){Ji(e,t,n)&&n.fadeOut(400,(function(){n.remove()}))}))}(e,t,i),Ai(e,i.find(".context_menu"),t,i),ui(e,t,i.find(".conditional_expression"),e.expression),e.commands_block)for(var a=0;a",n+='
',n+="
",n+=' '+ke.getUI("text_command_do_until")+' (
) ',n+="";var i=$(n);if(i.data("command",e),i.find(".block_commands").data("command",e),function(e,t,n){n.find(".button_remove_command").on("click",(function(){Ji(e,t,n)&&n.fadeOut(400,(function(){n.remove()}))}))}(e,t,i),Ai(e,i.find(".context_menu"),t,i),e.expression&&ui(e,t,i.find(".conditional_expression"),e.expression),e.commands_block)for(var a=0;a
');return n.data("command",e),Ni(e,e.function_called,n.find(".var_value_menu_div"),t),function(e,t,n){n.find(".button_remove_command").on("click",(function(){Ji(e,t,n)&&n.fadeOut(400,(function(){n.remove()}))}))}(e,t,n),n}function Wi(e,t){var n=$('
'+ke.getUI("text_break")+"
");return n.data("command",e),function(e,t,n){n.find(".button_remove_command").on("click",(function(){Ji(e,t,n)&&n.fadeOut(400,(function(){n.remove()}))}))}(e,t,n),n}function Yi(e,t){var n=$('
'+ke.getUI("text_return")+'
');return n.data("command",e),function(e,t,n){n.find(".button_remove_command").on("click",(function(){Ji(e,t,n)&&n.fadeOut(400,(function(){n.remove()}))}))}(e,t,n),t.return_type!=Ht.VOID?(e.variable_value_menu||(e.variable_value_menu=[new zn(Oi.all,null,null,null,!0)]),ui(e,t,n.find(".expression_elements"),e.variable_value_menu)):(n.find(".expression_elements").remove(),e.variable_value_menu=null),n}function Ji(e,t,n){if(Jt(t.name,Wt.REMOVE_COMMAND,e.type,"/",0),t.commands.indexOf(e)>-1)return t.commands.splice(t.commands.indexOf(e),1),!0;try{if(n.parent().parent().data("command").commands_block.indexOf(e)>-1)return n.parent().parent().data("command").commands_block.splice(n.parent().parent().data("command").commands_block.indexOf(e),1),!0}catch(e){}try{if(n.parent().parent().data("command").type==bn.iftrue&&n.parent().parent().data("command").commands_else.indexOf(e)>-1)return n.parent().parent().data("command").commands_else.splice(n.parent().parent().data("command").commands_else.indexOf(e),1),!0}catch(e){}return!!n.parent().data("switchcase")&&(console.log("o que encontrei: "),console.log(n.parent().data("switchcase")),n.parent().data("switchcase").commands_block.splice(n.parent().data("switchcase").commands_block.indexOf(e),1),!0)}function Zi(e,t,n,i){var a;switch(n){case bn.break:a=$('
'+ke.getUI("text_break")+"
");break;case bn.comment:a=$('
'+ke.getUI("text_comment")+"
");break;case bn.reader:a=$('
'+ke.getUI("text_command_read")+" var
");break;case bn.writer:a=$('
'+ke.getUI("text_command_write")+" var
");break;case bn.attribution:a=$('
x <— 1 + 1
');break;case bn.iftrue:a=$('
if (x < 1) { }
');break;case bn.repeatNtimes:a=$('
repita_para i de 0 ate 10 passo 1
');break;case bn.whiletrue:a=$('
'+ke.getUI("text_command_while")+" ( x < 10 )
");break;case bn.dowhiletrue:a=$('
'+ke.getUI("text_command_do")+"
"+ke.getUI("text_command_do_until")+"(x < 10)
");break;case bn.switch:a=$('
'+ke.getUI("text_code_switch")+" ( x ) {
"+ke.getUI("text_code_case")+" 1:
"+ke.getUI("text_code_case")+" 2:
}
");break;case bn.functioncall:a=$('
funcao()
');break;case bn.return:a=$('
'+ke.getUI("text_return")+"
")}a.draggable().appendTo("body"),$("body").mouseup((function(i){!function(e,t,n,i){$(".created_element").each((function(e){$(this).remove()}));var a=$(document.elementFromPoint(n.clientX,n.clientY));a.hasClass("ghost_div")&&a.closest(".command_container").length<1&&(console.log("\n\nvou tentar!!!!"),console.log(a.closest(".commands_list_div"),"\n\n"),a.closest(".commands_list_div").css("height",a.closest(".commands_list_div").css("height")+30),a=a.closest(".commands_list_div"));console.log("soltou no: "),console.log(a),console.log(a.data("fun"));var r=a.parentsUntil(".all_functions"),o=!1,s=!1;a.hasClass("commands_list_div")&&(s=!0);for(var l=0;l-1&&i.commands.splice(d,0,u),aa(u,l,1,i),Jt(i.name,Wt.INSERT_COMMAND,a,"/",d)}}(0,n,$(t).find(".commands_list_div"),e,i);else{console.log("soltou em um comando");var p=a.parentsUntil(".commands_list_div");u=[],void 0!==a.data("command")&&u.push(a.data("command"));for(l=0;l0)n=i.find(".commands_if").children(".command_container");else if($(t.target).closest(".data_block_else").length>0)n=i.find(".commands_else").children(".command_container");else{var a=i.find(".commands_if").get(0),r=i.find(".commands_else").get(0),o=Math.abs(t.clientY-a.getBoundingClientRect().top),s=(Math.abs(a.getBoundingClientRect().top+a.getBoundingClientRect().height-t.clientY),Math.abs(t.clientY-r.getBoundingClientRect().top)),l=Math.abs(r.getBoundingClientRect().top+r.getBoundingClientRect().height-t.clientY);n=o0?ta(t,e):ea(t,e):t.hasClass("case_div")?t.find(".case_commands_block").find(".command_container").length>0?ta(t,e):ea(t,e):ta(t,e))}function aa(e,t,n,i){var a;switch(e.type){case bn.comment:a=Ki(e,i);break;case bn.break:a=Wi(e,i);break;case bn.reader:a=Vi(e,i);break;case bn.writer:a=Hi(e,i);break;case bn.attribution:a=yi(e,i);break;case bn.functioncall:a=Qi(e,i);break;case bn.iftrue:a=ji(e,i);break;case bn.repeatNtimes:a=ki(e,i);break;case bn.whiletrue:a=zi(e,i);break;case bn.dowhiletrue:a=Xi(e,i);break;case bn.switch:a=Ri(e,i);break;case bn.return:a=Yi(e,i)}switch(n){case 1:a.insertBefore(t);break;case 2:a.insertAfter(t);break;case 3:t.append(a)}}function ra(e){switch(e){case bn.break:return new Ln;case bn.comment:return new Nn(new zn(Oi.only_value,ke.getUI("text_comment"),null,null,!1));case bn.reader:return new Sn(new zn(Oi.only_variable,null,null,null,!1));case bn.writer:return new $n([new zn(Oi.all,null,null,null,!0)]);case bn.attribution:return new Un(new zn(Oi.only_variable,null,null,null,!1),[]);case bn.functioncall:return new jn(new zn(Oi.only_function,null,null,null,!1),null);case bn.iftrue:return new Bn([new zn(Oi.all,null,null,null,!0)]);case bn.repeatNtimes:return new Gn(new zn(Oi.only_variable,null,null,null,!1),new zn(Oi.only_variable,null,null,null,!1),null,new zn(Oi.all,null,null,null,!0),null,null);case bn.whiletrue:return new Pn([new zn(Oi.all,null,null,null,!0)],null);case bn.dowhiletrue:return new Kn([new zn(Oi.all,null,null,null,!0)],null);case bn.switch:var t=[new qn(new zn(Oi.all,null,null,null,!0))];return new Vn(new zn(Oi.variable_and_function,null,null,null,!0),t);case bn.return:return new Hn([new zn(Oi.all,null,null,null,!0)])}}function oa(e){$(".ghost_div").remove();var t=$('');$("body").append(t),t.css("position","absolute"),t.css("top",e.clientY),t.css("left",e.clientX-20),t.css("font-size","3em"),t.css("display","none"),function_container_active.find(".commands_list_div").off("mousemove"),function_container_active.find(".commands_list_div").find("*").off("mousemove"),t.fadeIn(200,(function(){t.fadeOut(200,(function(){t.remove()}))}))}function sa(e,t){if(!e||!t)return"";if(e.type==bn.repeatNtimes||e.type==bn.whiletrue||e.type==bn.dowhiletrue)return e.commands_block?""+e.commands_block.indexOf(t):"0";if(e.type==bn.iftrue)return null==e.commands_block&&(e.commands_block=[]),null==e.commands_else&&(e.commands_else=[]),console.log("\n\nveja onde: ",e.commands_block," \n\nquery: ",t),e.commands_block.indexOf(t)>=0?"if["+e.commands_block.indexOf(t)+"]":"else["+e.commands_else.indexOf(t)+"]";if(e.type==bn.switch)for(var n=0;n=0)return"case["+e.cases[n].commands_block.indexOf(t)+"]"}function la(e,t,n,i,a,r){var o=$(e),s=o.data("command");if(o.data("command").type==bn.repeatNtimes||o.data("command").type==bn.whiletrue||o.data("command").type==bn.dowhiletrue||o.data("command").type==bn.switch)if(console.log("QQ17"),o.data("command").type==bn.repeatNtimes||o.data("command").type==bn.whiletrue||o.data("command").type==bn.dowhiletrue)if(console.log("QQ18"),null==s.commands_block||0==s.commands_block.length){s.commands_block=[];var l=ra(i);s.commands_block.push(l),Jt(n.name,Wt.INSERT_COMMAND,i,"/"+o.data("command").type,0),aa(l,o.find(".block_commands"),3,n)}else!function(e,t,n,i,a,r){console.log("\n\n\n::COMANDOS:\n\n",e,t,n,i,a,r);for(var o,s=$(n).find("div.command_container"),l=999999999,c=null,u=0;u-1&&r.commands_block.splice(p,0,d),aa(d,c,1,i)}}(e,t,e,n,i,s);else ca(t,n,i);else console.log("QQ19"),function(e,t,n,i){var a=$(e),r=$(e.parentNode.parentNode).data("command"),o=a.data("command"),s=$(e.parentNode.parentNode),l=!1;if(!r){r=a.data("command"),s=a;for(var c=a.parentsUntil(".command_container"),u=0;u-1&&r.commands_else.splice(h,0,v),aa(v,e,1,n)}else{if(console.log("MMM4"),r==o){if(console.log("Nxxxx5"),null==r.commands_block||0==r.commands_block.length){r.commands_block=[],console.log("SSS4");v=ra(i);r.commands_block.push(v),aa(v,a,3,n)}else console.log("SSS5"),ua(a,t,n,i);return}console.log("MMM6"),(h=r.commands_block.indexOf(o))>-1&&r.commands_block.splice(h,0,v),aa(v,e,1,n)}}else{console.log("XXX1");v=ra(i);if(l){if(r==o){if(console.log("MMM3"),null==r.commands_else||0==r.commands_else.length){r.commands_else=[],console.log("SSS1");v=ra(i);r.commands_else.push(v),aa(v,a,3,n)}else console.log("SSS2"),ua(a,t,n,i,!0);return}console.log("XXX2"),(h=r.commands_else.indexOf(o))>-1&&r.commands_else.splice(h+1,0,v),aa(v,e,2,n)}else{if(r==o){if(console.log("Nxxxx78"),null==r.commands_block||0==r.commands_block.length){r.commands_block=[];v=ra(i);r.commands_block.push(v),console.log("SSS6"),aa(v,a,3,n)}else console.log("SSS7"),ua(a,t,n,i);return}var h;console.log("XXX3"),(h=r.commands_block.indexOf(o))>-1&&r.commands_block.splice(h+1,0,v),aa(v,e,2,n)}}}(e,t,n,i)}function ca(e,t,n){var i=$(document.elementFromPoint(e.clientX,e.clientY)),a=i.data("switchcase"),r=i;if(!a)for(var o=i.parentsUntil(".all_cases_div"),s=0;s-1&&(e.commands_block.splice(d,0,u),aa(u,l,1,i))}}(a,r,e,t,n)}function ua(e,t,n,i){for(var a,r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=$(e),s=o.find("div.command_container"),l=999999999,c=null,u=0;u-1&&(_.commands_else.splice(f,0,p),aa(p,c,1,n));else(f=_.commands_block.indexOf($(c).data("command")))>-1&&(_.commands_block.splice(f,0,p),aa(p,c,1,n))}}function da(e,t,n,i){switch($(e).data("command").type){case bn.iftrue:case bn.switch:case bn.repeatNtimes:case bn.whiletrue:case bn.dowhiletrue:return void function(e,t,n,i){var a=$(e),r=a.data("command");if(a.data("command").type==bn.repeatNtimes||a.data("command").type==bn.whiletrue||a.data("command").type==bn.dowhiletrue)if(null==r.commands_block||0==r.commands_block.length){r.commands_block=[];var o=ra(i);r.commands_block.push(o),aa(o,a.find(".block_commands"),3,n)}else ua(e,t,n,i);else if(a.data("command").type==bn.iftrue){console.log("QQ9");var s=$(document.elementFromPoint(t.pageX,t.pageY)),l=!0;if(s.data("if"))l=!0;else if(s.data("else"))l=!1;else for(var c=s.parentsUntil(".command_container"),u=0;u-1&&n.commands.splice(s,0,o),aa(o,e,1,n),Jt(n.name,Wt.INSERT_COMMAND,i,"/",s)}else{var s;o=ra(i);(s=n.commands.indexOf($(e).data("command")))>-1&&n.commands.splice(s+1,0,o),aa(o,e,2,n),Jt(n.name,Wt.INSERT_COMMAND,i,"/",s)}}function pa(){$(".ivprog_visual_panel").find(".error_icon").remove();var e=ke.getUI("program")+" { ";e+=function(){var e="";if(window.program_obj.globals)for(var t=0;t1&&void 0!==arguments[1]?arguments[1]:2;switch(e.type){case bn.break:return va(e,t);case bn.comment:return Ca(e,t);case bn.reader:return Aa(e,t);case bn.writer:return Ia(e,t);case bn.functioncall:return Ta(e,t);case bn.attribution:return Ea(e,t);case bn.whiletrue:return wa(e,t);case bn.dowhiletrue:return ba(e,t);case bn.iftrue:return xa(e,t);case bn.repeatNtimes:return ya(e,t);case bn.switch:return ha(e,t);case bn.return:return ma(e,t)}}function ma(e,t){for(var n="\n",i=0;i1&&void 0!==arguments[1]&&arguments[1],n="";try{if(e.function_called){if(e.function_called.name?n+=e.function_called.name+" ( ":n+=ke.translateInternalFunction(e.function_called.identifier,e.function_called.category)+" ( ",e.parameters_list)for(var i=0;i").hide().appendTo(document.body)),$.fn.textWidth.fakeEl.text(e||this.val()||this.text()||this.attr("placeholder")).css("font",t||this.css("font")),$.fn.textWidth.fakeEl.width()},window.function_container_active=null,window.divx=100,window.ghostDiv=$('
'),window.active_container=null;var La=function(){function e(){a()(this,e)}return o()(e,[{key:"requestInput",value:function(){throw new Error("Must be implemented")}},{key:"cancelPendingInputRequests",value:function(){throw new Error("Must be implemented")}}]),e}();function Sa(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=_()(e);if(t){var a=_()(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return d()(this,n)}}var $a=function(e){c()(n,e);var t=Sa(n);function n(e){var i;return a()(this,n),(i=t.call(this)).index=0,i.input_list=e.map((function(e){return{value:e,read:!1}})),i}return o()(n,[{key:"requestInput",value:function(){var e=this;return new Promise((function(t,n){if(e.index1&&void 0!==arguments[1]&&arguments[1];null==this.currentLine&&(this.currentLine=this.list.push("")-1),this.list[this.currentLine]+=e,t&&(this.currentLine=null)}},{key:"sendOutput",value:function(e){var t=this,n=""+e;if(-1!==n.indexOf("\n")){var i=n.split("\n"),a=i.pop();i.forEach((function(e){0==(e=(e=e.replace(/\t/g," ")).replace(/\s/g," ")).length?t.currentLine=null:t.write(e,!0)})),0!=(a=(a=a.replace(/\t/g," ")).replace(/\s/g," ")).length&&this.write(a)}else n=(n=n.replace(/\t/g," ")).replace(/\s/g," "),this.write(n)}}]),n}(function(){function e(){a()(this,e)}return o()(e,[{key:"sendOutput",value:function(e){throw new Error("Must be implemented")}}]),e}());function Fa(e,t,n,i){if(e===t)return e?[[0,e]]:[];if(null!=n){var a=function(e,t,n){var i="number"==typeof n?{index:n,length:0}:n.oldRange,a="number"==typeof n?null:n.newRange,r=e.length,o=t.length;if(0===i.length&&(null===a||0===a.length)){var s=i.index,l=e.slice(0,s),c=e.slice(s),u=a?a.index:null,d=s+o-r;if((null===u||u===d)&&!(d<0||d>o)){var p=t.slice(0,d);if(t.slice(d)===c){var _=Math.min(s,d),f=l.slice(0,_),m=p.slice(0,_);if(f===m){var v=l.slice(_),h=p.slice(_);return qa(f,v,h,c)}}}if(null===u||u===s){var g=s,y=t.slice(0,g),x=t.slice(g);if(y===l){var b=Math.min(r-g,o-g),w=c.slice(c.length-b),E=x.slice(x.length-b);if(w===E){var R=c.slice(0,c.length-b),T=x.slice(0,x.length-b);return qa(l,R,T,w)}}}}if(i.length>0&&a&&0===a.length){var A=e.slice(0,i.index),k=e.slice(i.index+i.length),I=A.length,C=k.length;if(!(ot.length?e:t,a=e.length>t.length?t:e,r=i.indexOf(a);if(-1!==r)return n=[[1,i.substring(0,r)],[0,a],[1,i.substring(r+a.length)]],e.length>t.length&&(n[0][0]=n[2][0]=-1),n;if(1===a.length)return[[-1,e],[1,t]];var o=function(e,t){var n=e.length>t.length?e:t,i=e.length>t.length?t:e;if(n.length<4||2*i.length=e.length?[i,a,r,o,c]:null}var r,o,s,l,c,u=a(n,i,Math.ceil(n.length/4)),d=a(n,i,Math.ceil(n.length/2));if(!u&&!d)return null;r=d?u&&u[4].length>d[4].length?u:d:u;e.length>t.length?(o=r[0],s=r[1],l=r[2],c=r[3]):(l=r[0],c=r[1],o=r[2],s=r[3]);var p=r[4];return[o,s,l,c,p]}(e,t);if(o){var s=o[0],l=o[1],c=o[2],u=o[3],d=o[4],p=Fa(s,c),_=Fa(l,u);return p.concat([[0,d]],_)}return function(e,t){for(var n=e.length,i=t.length,a=Math.ceil((n+i)/2),r=a,o=2*a,s=new Array(o),l=new Array(o),c=0;cn)_+=2;else if(x>i)p+=2;else if(d){var b=r+u-h;if(b>=0&&b=w)return Da(e,t,y,x)}}}for(var E=-v+f;E<=v-m;E+=2){for(var R=r+E,T=void 0,A=(T=E===-v||E!==v&&l[R-1]n)m+=2;else if(A>i)f+=2;else if(!d){var k=r+u-E;if(k>=0&&k=(T=n-T))return Da(e,t,I,C)}}}}return[[-1,e],[1,t]]}(e,t)}(e=e.substring(0,e.length-r),t=t.substring(0,t.length-r));return o&&l.unshift([0,o]),s&&l.push([0,s]),function e(t,n){t.push([0,""]);var i,a,r=0,o=0,s=0,l="",c="";for(;r=0&&Ha(t[a][1])){var u=t[a][1].slice(-1);if(t[a][1]=t[a][1].slice(0,-1),l=u+l,c=u+c,!t[a][1]){t.splice(a,1),r--;var d=a-1;t[d]&&1===t[d][0]&&(s++,c=t[d][1]+c,d--),t[d]&&-1===t[d][0]&&(o++,l=t[d][1]+l,d--),a=d}}if(Va(t[r][1])){var p=t[r][1].charAt(0);t[r][1]=t[r][1].slice(1),l+=p,c+=p}}if(r0||c.length>0){l.length>0&&c.length>0&&(0!==(i=Ba(c,l))&&(a>=0?t[a][1]+=c.substring(0,i):(t.splice(0,0,[0,c.substring(0,i)]),r++),c=c.substring(i),l=l.substring(i)),0!==(i=Ga(c,l))&&(t[r][1]=c.substring(c.length-i)+t[r][1],c=c.substring(0,c.length-i),l=l.substring(0,l.length-i)));var _=s+o;0===l.length&&0===c.length?(t.splice(r-_,_),r-=_):0===l.length?(t.splice(r-_,_,[1,c]),r=r-_+1):0===c.length?(t.splice(r-_,_,[-1,l]),r=r-_+1):(t.splice(r-_,_,[-1,l],[1,c]),r=r-_+2)}0!==r&&0===t[r-1][0]?(t[r-1][1]+=t[r][1],t.splice(r,1)):r++,s=0,o=0,l="",c=""}""===t[t.length-1][1]&&t.pop();var f=!1;r=1;for(;r=55296&&e<=56319}function Ka(e){return e>=56320&&e<=57343}function Va(e){return Ka(e.charCodeAt(0))}function Ha(e){return Pa(e.charCodeAt(e.length-1))}function qa(e,t,n,i){return Ha(e)||Va(i)?null:function(e){for(var t=[],n=0;n0&&t.push(e[n]);return t}([[0,e],[-1,t],[1,n],[0,i]])}function ja(e,t,n){return Fa(e,t,n,!0)}ja.INSERT=1,ja.DELETE=-1,ja.EQUAL=0;var za=ja,Xa=function(){function e(t,n,i,r,o,s){var l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"";a()(this,e),this.name=t,this.status=n,this.inputs=i,this.results=r,this.store=o,this.time=s,this.error_msg=l}return o()(e,null,[{key:"PAGE_TEMPLATE",get:function(){return"\n \n \n \n \n \n \n :assessment-result:\n \n "}},{key:"DETAIL_TEMPLATE",get:function(){return"
\n
\n

:test-name:

\n

:time-label:: :time:ms

\n

:grade-label:: :grade:%

\n
\n
\n

:input-label:

\n
    \n
  • :input-list:
  • \n
\n
\n
\n

:output-label:

\n :output-result:\n
\n
"}},{key:"OUPUT_TABLE_TEMPLATE",get:function(){return"
\n \n \n \n \n \n \n :results:\n
:expected-label::generated-label::result-label:
\n
"}},{key:"OUTPUT_TEMPLATE",get:function(){return"$0\n $1\n $2"}},{key:"EMPTY_OUTPUT_TEMPLATE",get:function(){return"
\n $0
"}},{key:"FAILED_TEMPLATE",get:function(){return"

$0

"}},{key:"INPUT_INFO_TEMPLATE",get:function(){return"$1"}}]),o()(e,[{key:"prepareResults",value:function(){var t=this,n=e.DETAIL_TEMPLATE,i=(100*this.grade).toFixed(2),a=this.time||"-";n=(n=(n=(n=(n=n.replace(":test-name:",ke.getUI("assessment-detail-title",[this.name+1]))).replace(":time-label:",ke.getUI("assessment-detail-time-label"))).replace(":time:",a)).replace(":grade-label:",ke.getUI("assessment-detail-grade-label"))).replace(":grade:",i);var r=this.prepareInputList(this.inputs);if(n=(n=(n=n.replace(":input-label:",ke.getUI("assessment-detail-input-label"))).replace(":input-list:",r)).replace(":output-label:",ke.getUI("assessment-detail-output-label")),0==this.status){var o=this.results.map((function(e){return"string"==e.type?t.formatString(e):"number"==e.type?t.formatNumber(e):t.formatBool(e)}),this);n=n.replace(":output-result:",this.prepareOutputTable(o))}else{var s=e.FAILED_TEMPLATE;s=s.replace("$0",this.error_msg),n=n.replace(":output-result:",s)}return n}},{key:"prepareInputList",value:function(t){return t.map((function(t){var n=e.INPUT_INFO_TEMPLATE;return n=n.replace("$1",t.value),n=t.read?n.replace("$0","assessment-input-read"):n.replace("$0","assessment-input-unread")}),this).join(ke.getUI("text_join_assessment_outputs"))}},{key:"prepareOutputTable",value:function(t){var n=e.OUPUT_TABLE_TEMPLATE;return n=(n=(n=(n=n.replace(":expected-label:",ke.getUI("assessment-detail-expected-label"))).replace(":generated-label:",ke.getUI("assessment-detail-generated-label"))).replace(":result-label:",ke.getUI("assessment-detail-result-label"))).replace(":results:",t.join(""))}},{key:"generateOutput",value:function(){var t=this.prepareResults(),n=e.PAGE_TEMPLATE;return n=(n=n.replace(":assessment-result:",t)).replace(/(\r|\n|\t)/gm,"").replace(/> *<")}},{key:"formatNumber",value:function(e){var t=1==e.grade?"assessment-number-result":"assessment-number-result-failed";return this.formatOutput("assessment-number-expected","assessment-number-generated",t,e)}},{key:"formatBool",value:function(e){var t=1==e.grade?"assessment-bool-result":"assessment-bool-result-failed";return this.formatOutput("assessment-bool-expected","assessment-bool-generated",t,e)}},{key:"formatOutput",value:function(t,n,i,a){var r=e.OUTPUT_TEMPLATE;r=(r=(r=r.replace(":class-expected:",t)).replace(":class-generated:",n)).replace(":class-result:",i);var o=a.expected,s=a.generated;null==o?o=e.EMPTY_OUTPUT_TEMPLATE.replace("$0",ke.getMessage("assessment-empty-expected-tooltip")):null==s&&(s=e.EMPTY_OUTPUT_TEMPLATE.replace("$0",ke.getMessage("assessment-empty-generated-tooltip"))),r=(r=r.replace("$0",o)).replace("$1",s);var l=1==a.grade?"✓":"✗";return r=r.replace("$2",l)}},{key:"formatString",value:function(t){var n=this,i=e.OUTPUT_TEMPLATE;i=(i=i.replace(":class-expected:","assessment-string-expected")).replace(":class-generated:","assessment-string-generated");var a=t.generated||"",r=t.expected||"",o=a,s=r;if(null==t.generated?o=e.EMPTY_OUTPUT_TEMPLATE.replace("$0",ke.getMessage("assessment-empty-generated-tooltip")):null==t.expected&&(s=e.EMPTY_OUTPUT_TEMPLATE.replace("$0",ke.getMessage("assessment-empty-expected-tooltip"))),i=(i=i.replace("$0",s)).replace("$1",o),1==t.grade)i=(i=i.replace("$2","✓")).replace(":class-result:","assessment-string-result");else{var l=za(a,r).map((function(e){return n.getDiffStringStyle(e[1],e[0])}),this).reduce((function(e,t){return e+t}),"");i=(i=i.replace("$2",""+l)).replace(":class-result:","assessment-string-diff")}return i}},{key:"getDiffStringStyle",value:function(e,t){var n="$1";switch(e=e.replace(/\s/g," "),t){case za.INSERT:return n.replace("$0","stringdiff-insert").replace("$1",e);case za.DELETE:return n.replace("$0","stringdiff-delete").replace("$1",e);case za.EQUAL:return n.replace("$0","stringdiff-equal").replace("$1",e)}}},{key:"grade",get:function(){return null==this.results?0:this.results.reduce((function(e,t){return e+t.grade}),0)/this.results.length}}]),e}();function Qa(e,t,n){return new Ya(e,t,n,"number")}function Wa(e,t,n){return new Ya(e,t,n,"bool")}var Ya=function e(t,n,i,r){a()(this,e),this.expected=t,this.generated=n,this.grade=i,this.type=r},Ja=Ce(),Za=function(){function e(t,n,i,r){a()(this,e),this.program=t,this.name=r,this.input_list=n,this.expected_output=i}return o()(e,null,[{key:"NUM_REGEX",get:function(){return/^[+-]?([0-9]+([.][0-9]*)?(e[+-]?[0-9]+)?)$/}},{key:"NUM_IN_STRING_REGEX",get:function(){return/[+-]?([0-9]+([.][0-9]*)?(e[+-]?[0-9]+)?)/g}},{key:"BOOLEAN_REGEX",get:function(){var e="^(".concat(Ja.getUI("logic_value_true"),"|").concat(Ja.getUI("logic_value_false"),")$");return new RegExp(e)}},{key:"BOOLEAN_IN_STRING_REGEX",get:function(){var e="(".concat(Ja.getUI("logic_value_true"),"|").concat(Ja.getUI("logic_value_false"),")");return new RegExp(e,"g")}}]),o()(e,[{key:"eval",value:function(){var e=this,t=this,n=new $a(this.input_list),i=new Ma;this.program.registerInput(n),this.program.registerOutput(i);var a=Date.now();return this.program.interpretAST().then((function(r){var o=Date.now()-a;if(n.isInputAvailable())return new Xa(e.name,1,n.input_list,null,r,o,t.getErrorMessage("test_case_few_reads",e.name+1));var s=i.list.map((function(t,n){return n>=e.expected_output.length?new Ya(null,t,0,e.getPotentialOutputType(t)):e.outputMatch(t,e.expected_output[n])}),e);if(e.expected_output.length>i.list.length){console.log("Saída insuficientes!",e.expected_output.length,i.list.length);for(var l=i.list.length;l=s.length)return Qa(null,e,0);var n=new oe.Decimal(e),a=new oe.Decimal(s[t]);return i.checkNumbers(n,a)}),this);if(s.length>l.length)for(var u=l.length;u=p.length)return Wa(null,e,0);var n=de(e),a=de(p[t]);return i.checkBoolean(n,a)}),this);if(p.length>_.length)for(var m=_.length;m1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i3?a-3:0),o=3;o|[*\]])\s*$|\*$/.test(e.string.slice(0,n))||(!(!t.typeAtEndOfLine||e.column()!=e.indentation())||void 0))}function r(e){for(;;){if(!e||"top"==e.type)return!0;if("}"==e.type&&"namespace"!=e.prev.info)return!1;e=e.prev}}function o(e,t){return"function"==typeof e?e(t):Object.propertyIsEnumerable.call(e,t)}function s(e,t){for(var n,i=!1;n=e.next();){if("/"==n&&i){t.tokenize=null;break}i="*"==n}return"comment"}function l(e){for(var t={},n=e.split(" "),i=0;i!/&]/,N=/[a-zA-Z0-9_]/,L=c.isReservedIdentifier||!1,S=function(){};function $(e,t){var n=e.next();if(T[n]){var i=T[n](e,t);if(!1!==i)return i}if('"'==n)return t.tokenize=S(n),t.tokenize(e,t);if(k.test(n))return u=n,null;if(I.test(n)){if(e.backUp(1),e.match(C))return"number";e.next()}if("/"==n){if(e.eat("*"))return t.tokenize=s,s(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(O.test(n)){for(;!e.match(/^\/[/*]/,!1)&&e.eat(O););return"operator"}e.eatWhile(N);var a=e.current();return o(m,a)?(o(w,a)&&(u="newstatement"),o(E,a)&&(d=!0),"keyword"):o(x,a)?"type":o(b,a)||L&&L(a)?(o(w,a)&&(u="newstatement"),"builtin"):o(R,a)?"atom":"variable"}function U(e,t){c.typeFirstDefinitions&&e.eol()&&r(t.context)&&(t.typeAtEndOfLine=a(e,t,e.pos))}return S=function(e){return function(t,n){for(var i,a=!1,r=!1;null!=(i=t.next());){if(i==e&&!a){r=!0;break}a=!a&&"\\"==i}return(r||!a&&!A)&&(n.tokenize=null),"string"}},{startState:function(e){return{tokenize:null,context:new t((e||0)-p,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var o=t.context;if(e.sol()&&(null==o.align&&(o.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return U(e,t),null;u=d=null;var s=(t.tokenize||$)(e,t);if("comment"==s||"meta"==s)return s;if(null==o.align&&(o.align=!0),";"==u||":"==u||","==u&&e.match(/^\s*(?:\/\/.*)?$/,!1))for(;"statement"==t.context.type;)i(t);else if("{"==u)n(t,e.column(),"}");else if("["==u)n(t,e.column(),"]");else if("("==u)n(t,e.column(),")");else if("}"==u){for(;"statement"==o.type;)o=i(t);for("}"==o.type&&(o=i(t));"statement"==o.type;)o=i(t)}else u==o.type&&i(t);if("variable"==s&&("def"==t.prevToken||c.typeFirstDefinitions&&a(e,t,e.start)&&r(t.context)&&e.match(/^\s*\(/,!1))&&(s="def"),T.token){var l=T.token(e,t,s);void 0!==l&&(s=l)}return"def"==s&&!1===c.styleDefs&&(s="variable"),t.startOfLine=!1,t.prevToken=d?"def":s||u,U(e,t),s},indent:function(t,n){if(t.tokenize!=$&&null!=t.tokenize||t.typeAtEndOfLine)return e.Pass;var i=t.context,a=n&&n.charAt(0),r=a==i.type;if("statement"==i.type&&"}"==a&&(i=i.prev),c.dontIndentStatements)for(;"statement"==i.type&&c.dontIndentStatements.test(i.info);)i=i.prev;if(T.indent){var o=T.indent(t,i,n,p);if("number"==typeof o)return o}var s=i.prev&&i.prev.info==v;if(c.allmanIndentation&&/[{(]/.test(a)){for(;"top"!=i.type&&"}"!=i.type;)i=i.prev;return i.indented}if("statement"==i.type)return i.indented+("{"==a?0:_);if(i.align&&(!f||")"!=i.type))return i.column+(r?0:1);if(")"==i.type&&!r)return i.indented+_;var l=new RegExp("^(?:".concat(h,"|").concat(g,")\b"));return i.indented+(r?0:p)+(r||!s||l.test(n)?0:p)},electricInput:y,blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:"//",fold:"brace"}}));var c=function(){var e=[],t=[],n=[],i=[],a=[],r="";kt=[];var o=E.getCurrentLexer(),s=new o;["RK_SWITCH","RK_PROGRAM","RK_CASE","RK_DEFAULT","RK_FOR","RK_FOR_ALT","RK_FUNCTION","RK_DO","RK_WHILE","RK_WHILE_ALT","RK_IF","RK_ELSE"].forEach((function(i){var a=s.literalNames[o[i]],l=a.substring(1,a.length-1);kt.push(l),n.push(l),t.push(l),"RK_SWITCH"==i?r=l:"RK_CASE"!=i&&"RK_DEFAULT"!=i||e.push(l)})),["RK_CONST","RK_RETURN","RK_BREAK","RK_FOR_FROM","RK_FOR_TO","RK_FOR_PASS","RK_DO_UNTIL"].forEach((function(e){var t=s.literalNames[o[e]],i=t.substring(1,t.length-1);kt.push(i),n.push(i)})),["RK_REAL","RK_VOID","RK_BOOLEAN","RK_STRING","RK_INTEGER","RK_CHARACTER"].forEach((function(e){var t=s.literalNames[o[e]],n=t.substring(1,t.length-1);kt.push(n),i.push(n)})),["RK_FALSE","RK_TRUE"].forEach((function(e){var t=s.literalNames[o[e]],n=t.substring(1,t.length-1);kt.push(n),a.push(n)})),It=[];for(var l=[Re.Operators.AND.value,Re.Operators.OR.value,Re.Operators.NOT.value],c=0;c2&&void 0!==arguments[2]?arguments[2]:0;Jt(e.name,Wt.CHANGE_FUNCTION_RETURN,t,n),e.return_type=t,e.return_dimensions=n}function wr(e,t){t.find(".ui.dropdown.function_return").dropdown({onChange:function(t,n,i){i.data("dimensions")?br(e,Ht[i.data("type")],i.data("dimensions")):br(e,Ht[i.data("type")])},selectOnKeydown:!1}),t.find(".name_function_updated").on("click",(function(n){!function(e,t){if(Fr)return void Dr.focus();var n;(t=$(t)).find(".span_name_function").text(""),Br||(Br=t.find(".span_name_function").css("padding-left"));t.find(".span_name_function").css("padding-left","0"),t.find(".span_name_function").css("padding-right","0"),(n=$("")).insertBefore(t.find(".span_name_function")),n.on("input",(function(){var e=n.textWidth()+10;Dr=n,n.focus();var t=n.val();n.val(""),n.val(t),n.css({width:e})})).trigger("input"),n.focusout((function(){n.val().trim()&&$r(e,n.val().trim(),t),n.off(),n.remove(),t.find(".span_name_function").css("padding-left",Br),t.find(".span_name_function").css("padding-right",Br),t.find(".span_name_function").text(e.name),Fr=!1,Dr=!1})),n.on("keydown",(function(i){var a=i.keyCode||i.which;13==a&&(n.val().trim()&&$r(e,n.val().trim(),t),n.off(),n.remove(),t.find(".span_name_function").css("padding-left",Br),t.find(".span_name_function").css("padding-right",Br),t.find(".span_name_function").text(e.name),Fr=!1,Dr=!1),27==a&&(n.off(),n.remove(),t.find(".span_name_function").css("padding-left",Br),t.find(".span_name_function").css("padding-right",Br),t.find(".span_name_function").text(e.name),Fr=!1,Dr=!1)})),n.select()}(e,t)})),t.find(".add_parameter_button").on("click",(function(n){window.insertContext=!0,function(e,t){null==e.parameters_list&&(e.parameters_list=[]);var n=new In(Ht.INTEGER,ke.getUI("new_parameter")+"_"+dr);e.parameters_list.push(n),dr++,Jt(e.name,Wt.INSERT_FUNCTION_PARAM,n.name,Ht.INTEGER,0),Lr(e,n,t)}(e,t)})),t.find(".menu_commands").dropdown({on:"hover"}),t.find(".menu_commands a").on("click",(function(n){if(null==e.commands||0==e.commands.length){e.commands=[];var i=ra($(this).data("command"));e.commands.push(i),aa(i,t.find(".commands_list_div"),3,e),Jt(e.name,Wt.INSERT_COMMAND,$(this).data("command"),"/",0)}else Zi(e,t,$(this).data("command"),n)})),t.find(".add_var_button_function").on("click",(function(n){window.insertContext=!0,function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=new In(Ht.INTEGER,ke.getUI("new_variable")+"_"+Qn,0);null==e.variables_list&&(e.variables_list=[]),e.variables_list.push(i),Qn++,Jt(e.name,Wt.INSERT_FUNCTION_VAR,i.name,Ht.INTEGER,0);var a=Zn(t,i,e);n&&(a.css("display","none"),a.fadeIn())}(e,t,!0)})),t.find(".remove_function_button").on("click",(function(n){!function(e){var t=yr.functions.indexOf(e);t>-1&&(Jt(e.name,Wt.REMOVE_FUNCTION),yr.functions.splice(t,1))}(e),t.fadeOut()})),t.find(".minimize_function_button").on("click",(function(n){!function(e){e.is_hidden=!e.is_hidden}(e),e.is_hidden?(t.find(".add_var_button_function").toggle(),t.find(".inline_add_command").toggle(),t.find(".function_area").slideToggle()):t.find(".function_area").slideToggle((function(){t.find(".add_var_button_function").toggle(),t.find(".inline_add_command").toggle()}))}))}xr.function_comment=new Nn(ke.getUI("text_comment_main")),yr.addFunction(xr),window.program_obj=yr,window.generator=pa,window.runCodeAssessment=Cr,window.renderAlgorithm=xn,window.insertContext=!1,window.watchW=jt.a,jt.a.watch(window.program_obj.globals,(function(){window.insertContext?(setTimeout((function(){xn(),_r.forEach((function(e){return e()}))}),300),window.insertContext=!1):(xn(),_r.forEach((function(e){return e()})))}),1),jt.a.watch(window.program_obj.functions,(function(){window.insertContext?(setTimeout((function(){xn(),fr.forEach((function(e){return e()}))}),300),window.insertContext=!1):(xn(),fr.forEach((function(e){return e()})))}),1);var Er,Rr=0;function Tr(e){var t='
';e.function_comment,t+='',t+=(e.is_main?'
':'')+'',t+='
'+ke.getUI("function")+" ",e.is_main?t+='
      '+ke.getUI("type_void")+'       '+e.name+'
(
':(t+='
',t+='
'+e.name+'
(
'),t+='
)
'+(e.is_hidden?' ",t=$(t),$(".all_functions").append(t),t.data("fun",e),t.find(".commands_list_div").data("fun",e),function(e,t){var n='",n=$(n),t.find(".function_return").append(n)}(e,t),wr(e,t);for(var n=0;n=0;o--)if(console.log("da vez",$(i[o+1])),o==i.length-1){var s=t.find(".command_container").index(i[o]);console.log("índice na raiz: ",s)}else $(i[o+1]).hasClass("iftrue")?$(i[o]).parent().hasClass("commands_if")?(r.push("if"),a.push($(i[o]).parent().find(".command_container").index(i[o]))):(r.push("else"),a.push($(i[o]).parent().find(".command_container").index(i[o]))):$(i[o+1]).hasClass("dowhiletrue")?(r.push("dowhiletrue"),a.push($(i[o+1]).find(".command_container").index(i[o]))):$(i[o+1]).hasClass("repeatNtimes")?(r.push("repeatNtimes"),a.push($(i[o+1]).find(".command_container").index(i[o]))):$(i[o+1]).hasClass("whiletrue")?(r.push("whiletrue"),a.push($(i[o+1]).find(".command_container").index(i[o]))):$(i[o+1]).hasClass("switch")&&r.push("switch");var l=$(evento_drag.item).parent().hasClass("commands_else"),c=$(evento_drag.item).parent().hasClass("case_commands_block"),u=window.program_obj.functions[e].commands[s];for(o=0;o-1&&n.commands.splice(n.commands.indexOf(Er),1):$(e.item).parent().hasClass("commands_else")?$(e.item).parent().data("command").commands_else.indexOf(Er)>-1&&$(e.item).parent().data("command").commands_else.splice($(e.item).parent().data("command").commands_else.indexOf(Er),1):$(e.item).parent().hasClass("case_commands_block")||$(e.item).parent().data("command").commands_block.indexOf(Er)>-1&&$(e.item).parent().data("command").commands_block.splice($(e.item).parent().data("command").commands_block.indexOf(Er),1)}(e)}catch(e){window.draging=!1}}}),(t=$(t)).find(".iftrue").each((function(t){e($(this).find(".block_commands")[0],n),e($(this).find(".block_commands")[1],n)})),t.find(".repeatNtimes").each((function(t){e($(this).find(".block_commands")[0],n)})),t.find(".dowhiletrue").each((function(t){e($(this).find(".block_commands")[0],n)})),t.find(".whiletrue").each((function(t){e($(this).find(".block_commands")[0],n)})),t.find(".switch").each((function(t){$(this).find(".case_div").each((function(t){e($(this).find(".case_commands_block")[0],n)}))}))}(t.find(".commands_list_div")[0],i),e.is_main||Sortable.create(t.find(".container_parameters_list")[0],{handle:".ellipsis",animation:100,ghostClass:"ghost",group:"parameters_drag_"+yr.functions.indexOf(e),onEnd:function(t){!function(e,t,n){n.parameters_list.splice(t,0,n.parameters_list.splice(e,1)[0])}(t.oldIndex,t.newIndex,e)}}),e.commands.length>0){var a=".ui.sticky.sticky_cont_"+Rr;$(a).sticky({context:".ui.bottom.attached.segment.commands_list_div.commands_cont_"+Rr,scrollContext:".ivprog_visual_panel",observeChanges:!0,offset:40,onStick:function(e){$(a).css("top","20px","important")},onBottom:function(e){$(a).css("top","20px","important")},onUnstick:function(e){$(a).css("top","20px","important")},onReposition:function(e){$(a).css("top","20px","important")},onScroll:function(e){var t,n,i,r,o,s;$(a).css("top","20px","important"),t=$(a),n=$(a).parent(),i=$(t).offset().top,r=$(t).height(),o=$(n).offset().top,s=$(n).height()-30,i-o+r>0&&i-o1&&void 0!==arguments[1]&&arguments[1],n=new In(Ht.INTEGER,ke.getUI("new_global")+"_"+rn,0);rn++,e.addGlobal(n),Jt(n.name,Wt.INSERT_GLOBAL_VAR);var i=dn(n);t&&(i.css("display","none"),i.fadeIn())}(yr,!0)})),$("#run_button").on("click",(function(){document.getElementById("run_button").style.display="none",document.getElementById("stop_button").style.display="inline",function(){if(gr)return;var e=null;e="textual"==settingsProgrammingTypes?cr():pa();if(null==e)return;Or(!0);try{var t=Kt.analyseFromSource(e);(mr=new Gt(t)).registerInput(vr),mr.registerOutput(vr),$("#ivprog-term").addClass("ivprog-term-active"),gr=!0,mr.interpretAST().then((function(e){Hr((function(){return 0==vr.pending_writes.length&&(mr.mode===re.Modes.ABORT?vr.info(ke.getMessage("aborted_execution")):vr.info(ke.getMessage("success_execution")),$("#ivprog-term").removeClass("ivprog-term-active"),gr=!1,mr=null,qr(),!0)}),100)})).catch((function(e){Hr((function(){return 0==vr.pending_writes.length&&(e instanceof Error?vr.err(e.message):vr.err(e),$("#ivprog-term").removeClass("ivprog-term-active"),gr=!1,mr=null,qr(),!0)}),100)}))}catch(e){Hr((function(){return 0==vr.pending_writes.length&&(gr=!1,mr=null,qr(),vr.err(e.message),console.log(e),!0)}),100)}}()})),$("#stop_button").on("click",(function(){qr(),function(){if(vr.clearPendingWrites(),vr.cancelPendingInputRequests(),!gr)return;mr.mode=re.Modes.ABORT}()})),$(".visual_coding_button").on("click",(function(){$(".ivprog_textual_panel").addClass("loading"),$(".ivprog_textual_panel").css("display","none"),$(".ivprog_visual_panel").css("display","block"),$(".textual_coding_button").removeClass("active"),$(".visual_coding_button").addClass("active")})),$(".textual_coding_button").on("click",(function(){!function(){var e=null;if("textual"!=settingsProgrammingTypes&&null==(e=pa()))return;$(".ivprog_visual_panel").css("display","none"),$(".ivprog_textual_panel").css("display","block"),$(".ivprog_textual_panel").removeClass("loading"),sr(),null!=e&&lr(e);$(".visual_coding_button").removeClass("active"),$(".textual_coding_button").addClass("active")}()})),$(".assessment").on("click",(function(){Ir=!0,Cr()})),$(".div_toggle_console").on("click",(function(){Or()})),$(".expand_button").on("click",(function(){full_screen()})),$(".help_button").on("click",(function(){window.open("https://www.usp.br/line/ivprog/","_blank")})),$(".main_title h2").prop("title",ke.getUI("text_ivprog_description"));$(".visual_coding_button").popup({content:ke.getUI("tooltip_visual"),delay:{show:750,hide:0}}),$(".textual_coding_button").popup({content:ke.getUI("tooltip_textual"),delay:{show:750,hide:0}}),$(".upload_file_button").popup({content:ke.getUI("tooltip_upload"),delay:{show:750,hide:0}}),$(".download_file_button").popup({content:ke.getUI("tooltip_download"),delay:{show:750,hide:0}}),$(".undo_button").popup({content:ke.getUI("tooltip_undo"),delay:{show:750,hide:0}}),$(".redo_button").popup({content:ke.getUI("tooltip_redo"),delay:{show:750,hide:0}}),$(".run_button").popup({content:ke.getUI("tooltip_run"),delay:{show:750,hide:0}}),$(".assessment_button").popup({content:ke.getUI("tooltip_evaluate"),delay:{show:750,hide:0}}),$(".help_button").popup({content:ke.getUI("tooltip_help")+" - "+ke.getUI("text_ivprog_version")+" "+pr,delay:{show:750,hide:0}}),$(".add_global_button").popup({content:ke.getUI("tooltip_add_global"),delay:{show:750,hide:0}}),$(".div_toggle_console").popup({content:ke.getUI("tooltip_console"),delay:{show:750,hide:0}}),Sortable.create(listWithHandle,{handle:".glyphicon-move",animation:100,ghostClass:"ghost",group:"functions_divs_drag",onEnd:function(e){var t,n;t=e.oldIndex,n=e.newIndex,program_obj.functions.splice(n,0,program_obj.functions.splice(t,1)[0])}});var e=document.getElementById("listGlobalsHandle");Sortable.create(e,{handle:".ellipsis",animation:100,ghostClass:"ghost",group:"globals_divs_drag",onEnd:function(e){var t,n;t=e.oldIndex,n=e.newIndex,program_obj.globals.splice(n,0,program_obj.globals.splice(t,1)[0])}})}function kr(){return JSON.parse(JSON.stringify(hr))}window.evento_drag;var Ir=!1;function Cr(){if(gr)return-1;var e=null;if(window.studentGrade=null,null==(e="textual"==settingsProgrammingTypes?cr():pa()))return-1;Or(!0);try{var t=Kt.analyseFromSource(e);gr=!0,new ir(t,hr,vr).runTest().then((function(e){Ir?Ir=!1:parent.getEvaluationCallback(e),gr=!1})).catch((function(e){console.log(e),gr=!1}))}catch(e){gr=!1,vr.err(e.message),console.log(e),Ir?Ir=!1:parent.getEvaluationCallback(0)}return 0}function Or(e){return e?($(".ivprog-term-div").css("display","block"),$("#ivprog-term").css("min-height","160px"),void(null!=vr&&vr.focus())):void vr.hide()}function Nr(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;Jt(e.name,Wt.CHANGE_PARAM_TYPE,n,t,i),e.type=t,e.dimensions=i,i>0&&(e.rows=i,e.columns=2)}function Lr(e,t,n){var i="";for(var a in i+='
',i+='",i+='
'+t.name+"
",i+='
',i=$(i),n.find(".container_parameters_list").append(i),i.find(".remove_parameter").on("click",(function(n){!function(e,t,n){Jt(t.name,Wt.REMOVE_FUNCTION_PARAM,e.name);var i=e.parameters_list.indexOf(t);i>-1&&(window.insertContext=!0,e.parameters_list.splice(i,1)),$(n).fadeOut()}(e,t,i)})),i.find(".ui.dropdown.parameter_type").dropdown({onChange:function(n,i,a){a.data("dimensions")?Nr(t,Ht[a.data("type")],e.name,a.data("dimensions")):Nr(t,Ht[a.data("type")],e.name)},selectOnKeydown:!1}),i.find(".parameter_div_edit").on("click",(function(n){Jt(e.name,Wt.ENTER_CHANGE_PARAM_NAME,t.name),function(e,t,n){if(Ur)return void Mr.focus();var i;Ur=!0,(t=$(t)).find(".span_name_parameter").text(""),(i=$("")).insertBefore(t.find(".span_name_parameter")),i.on("input",(function(){var e=i.textWidth()+10;Mr=i,i.focus();var t=i.val();i.val(""),i.val(t),i.css({width:e})})).trigger("input"),i.focusout((function(){i.val().trim()&&(Sr(e,i.val().trim(),t,n),t.find(".span_name_parameter").text(e.name)),i.off(),i.remove(),Ur=!1,Mr=!1})),i.on("keydown",(function(a){var r=a.keyCode||a.which;13==r&&(i.val().trim()&&(Sr(e,i.val().trim(),t,n),t.find(".span_name_parameter").text(e.name)),i.off(),i.remove(),Ur=!1,Mr=!1),27==r&&(t.find(".span_name_parameter").text(e.name),i.off(),i.remove(),Ur=!1,Mr=!1)})),i.select()}(t,i,e)})),i}function Sr(e,t,n,i){e.name!=t&&(Ot(t)?!function(e,t){if(t.parameters_list)for(var n=0;n "+e),ke.getString(e,n))}}),Xr=Ce(),Qr=function(){function e(t){a()(this,e),this.index=0,this.inputList=t,this.list=[],this.currentLine=null}return o()(e,[{key:"writeRawHTML",value:function(e){this._appendTextLn(e)}},{key:"write",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._appendText(e,Pt.USER,t)}},{key:"info",value:function(e){this._appendTextLn(e,Pt.INFO)}},{key:"err",value:function(e){this._appendTextLn(e,Pt.ERR)}},{key:"_appendText",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];null==this.currentLine&&(this.currentLine=this.list.push("")-1),this.list[this.currentLine]+=e,n&&(this.currentLine=null)}},{key:"_appendTextLn",value:function(e){this.list.push(e),this.currentLine=null}},{key:"getClassForType",value:function(e){switch(e){case Pt.USER:return"ivprog-term-userText";case Pt.INFO:return"ivprog-term-info";case Pt.ERR:return"ivprog-term-error"}}},{key:"requestInput",value:function(){var e=this;return new Promise((function(t,n){e.index