main.829691c29843c4ed08fe.js 438 KB

12
  1. !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<s.length;d++)o=s[d],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&p.push(a[o][0]),a[o]=0;for(i in l)Object.prototype.hasOwnProperty.call(l,i)&&(e[i]=l[i]);for(u&&u(t);p.length;)p.shift()();return r.push.apply(r,c||[]),n()}function n(){for(var e,t=0;t<r.length;t++){for(var n=r[t],i=!0,s=1;s<n.length;s++){var l=n[s];0!==a[l]&&(i=!1)}i&&(r.splice(t--,1),e=o(o.s=n[0]))}return e}var i={},a={0:0},r=[];function o(t){if(i[t])return i[t].exports;var n=i[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=e,o.c=i,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="";var s=window.webpackJsonpivprogCore=window.webpackJsonpivprogCore||[],l=s.push.bind(s);s.push=t,s=s.slice();for(var c=0;c<s.length;c++)t(s[c]);var u=l;return r.push([109,1]),n()}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromOrdToType=t.Types=void 0;const i=n(90),a=n(13),r=n(45),o=new i.Type("integer",0),s=new i.Type("real",1),l=new i.Type("text",2),c=new i.Type("boolean",3),u=new i.Type("char",4),d=new i.Type("void",5),p=new i.Type("undefined",6),_=new a.MultiType([o,s,l,u,c]);t.Types=Object.freeze({INTEGER:o,REAL:s,STRING:l,CHAR:u,BOOLEAN:c,VOID:d,UNDEFINED:p,ALL:_}),t.fromOrdToType=function(e){const n=t.Types;for(const t in n)if(n[t].ord&&n[t].ord===e)return r.Maybe.some(n[t]);return r.Maybe.none()}},,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Modes=void 0,t.Modes=Object.freeze({RETURN:Symbol("mode:return"),BREAK:Symbol("mode:break"),PAUSE:Symbol("mode:pause"),RUN:Symbol("mode:run"),ABORT:Symbol("mode:abort")})},,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StoreValue=void 0;t.StoreValue=class{constructor(e,t,n,i=!1){this.type=e,this.id=n,this.isConst=i,this.value=t}get(){return this.value}inStore(){return null!=this.id}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertFromString=t.Operators=void 0,t.Operators=Object.freeze({ADD:{ord:0,value:"+"},SUB:{ord:1,value:"-"},MULT:{ord:2,value:"*"},DIV:{ord:3,value:"/"},MOD:{ord:4,value:"%"},GT:{ord:5,value:">"},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;t<this.types.length;t++){const n=this.types[t];e=e.concat(n.stringInfo())}return e}isCompatible(e){for(let t=0;t<this.types.length;t++){const n=this.types[t];if(e.isCompatible(n))return!0}return!1}}},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Store=void 0;const i=n(6),a=n(0),r=n(50),o=n(104),s=n(12),l=n(26),c=n(25),u=n(66),d=n(9),p=n(36),_=n(46),f=n(51),m=n(105);class v{constructor(e){this.name=e,this.store=new Map,this.mode=i.Modes.RUN}static canImplicitTypeCast(e,t){return!(!e.isCompatible(a.Types.INTEGER)&&!e.isCompatible(a.Types.REAL)||!t.isCompatible(a.Types.INTEGER)&&!t.isCompatible(a.Types.REAL))}static doImplicitCasting(e,t){if(!v.canImplicitTypeCast(e,t.type))throw new Error("!!!Critical error: attempted to type cast invalid types");return e.isCompatible(a.Types.INTEGER)?new d.StoreValue(a.Types.INTEGER,t.get().trunc()):new d.StoreValue(a.Types.REAL,t.get())}extendStore(e){this.nextStore=e}applyStore(e){if(!this.store.has(e)){if(null!=this.nextStore)return this.nextStore.applyStore(e);throw new Error(`Variable ${e} not found.`)}const t=this.store.get(e);let n=null;if(t.type instanceof s.ArrayType){const e=t,i=e.type;let a=0,r=0;const o=e.value.map(t=>e.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;e<t.lines;e+=1){const t=r[e];a.setAt(t,e,void 0)}else{if(a.isVector||null!=i||!t.isVector())throw new Error("Attempting to assign an invalid value to array "+e);for(let e=0;e<a.columns;e+=1){const t=r[e];a.setAt(t,n,e)}}}else{if(!a.isVector&&null==i)throw new Error("Attempting to assign an invalid value to array "+e);a.setAt(t,n,i)}return this}if(null!=this.nextStore)return this.nextStore.updateStoreArray(e,t,n,i),this;throw new Error(`Variable ${e} not found.`)}insertStore(e,t){if(this.store.has(e))throw new Error(e+" is already defined");let n;if(t instanceof _.StoreValueRef)n=new o.StoreObjectRef(t);else if(t instanceof f.ArrayStoreValueRef)n=new m.StoreObjectArrayRef(t,t.lines,t.columns);else if(t instanceof l.ArrayStoreValue){const e=t.isVector()?0:t.columns,i=[],a=t.get();if(a.length>0)for(let e=0;e<t.get().length;e+=1){const t=a[e].get();i.push(c.Location.allocate(t))}else{let n=t.lines;n=t.isVector()?n:n*e;for(let e=0;e<n;e+=1)i.push(c.Location.allocate(null))}n=new u.StoreObjectArray(t.type,t.lines,e,i,t.isConst)}else{const e=c.Location.allocate(t.get());n=new r.StoreObject(t.type,e,t.isConst)}return n.setID(e),this.store.set(e,n),this}getStoreObject(e){if(!this.store.has(e)){if(null!=this.nextStore)return this.nextStore.getStoreObject(e);throw new Error(`Variable ${e} not found.`)}return this.store.get(e)}destroy(){this.store.forEach(e=>e.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(;t<n;){const i=Math.floor((t+n)/2),a=this.getAddressAt(i);if(a.id===e)return a;e>a.id?t=i:n=i}}getAddressAt(e){return this.data[e]}findIndex(e){let t=0,n=this.data.length;for(;t<n;){const i=Math.floor((t+n)/2),a=this.getAddressAt(i);if(a.id===e)return i;e>a.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;e<this.data.length;e+=1)delete this.data[e];this.data=[],this.address_id=0}};t.Location=Object.freeze({allocate:a.allocate.bind(a),deallocate:a.deallocate.bind(a),find:a.find.bind(a),updateAddress:a.updateAddress.bind(a),clear:a.clear.bind(a),size:()=>a.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<this.columns;n+=1){const i=e*this.lines+n;t.push(this.values[i])}const n=this.type,a=new i.ArrayType(n.innerType,n.dimensions-1);return new r(a,t,this.columns,0,this.id,this.isConst)}const n=e*this.lines+t;return console.log("Get at: ",n),this.values[n]}setAt(e,t,n){let i=1;null!=n&&(i+=1);let o=t,s=n;if(!this.type.canAccept(e.type,i))throw new Error("!!!Internal Error: Attempting to insert an invalid value inside array "+this.id);if(this.isVector()){if(null!=n)throw new Error(this.id+" is not a matrix!");s=o,o=0}else if(null==n){if(!(e instanceof r))throw new Error("Attempting to insert a single value as a line of matrix "+this.id);const t=e.get();for(let n=0;n<this.columns;n+=1){const i=o*this.columns+n,r=t[n];this.values[i]=new a.StoreValueAddress(e.type,r.get(),o,n,this.id,this.isConst)}}const l=o*(null==this.columns?0:this.columns)+s;this.values[l]=new a.StoreValueAddress(e.type,e.get(),t,n,this.id,this.isConst)}inStore(){return null!=this.id}isVector(){return 1==this.type.dimensions}}t.ArrayStoreValue=r},,,,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StoreValueAddress=void 0;const i=n(9);class a extends i.StoreValue{constructor(e,t,n,i,a,r=!1){super(e,t,a,r),this.line=n,this.column=i}}t.StoreValueAddress=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resultTypeAfterUnaryOp=t.resultTypeAfterInfixOp=void 0;const i=n(0),a=n(10),r=n(13),o=n(11);function s(){const e=[[],[]];return e[i.Types.INTEGER.ord][i.Types.INTEGER.ord]=i.Types.INTEGER,e[i.Types.INTEGER.ord][i.Types.REAL.ord]=i.Types.REAL,e[i.Types.REAL.ord][i.Types.INTEGER.ord]=i.Types.REAL,e[i.Types.REAL.ord][i.Types.REAL.ord]=i.Types.REAL,e}function l(){const e=[[],[],[],[],[]];return e[i.Types.INTEGER.ord][i.Types.INTEGER.ord]=i.Types.BOOLEAN,e[i.Types.REAL.ord][i.Types.REAL.ord]=i.Types.BOOLEAN,e[i.Types.BOOLEAN.ord][i.Types.BOOLEAN.ord]=i.Types.BOOLEAN,e[i.Types.STRING.ord][i.Types.STRING.ord]=i.Types.BOOLEAN,e[i.Types.CHAR.ord][i.Types.CHAR.ord]=i.Types.BOOLEAN,e}function c(){const e=[[],[],[],[],[]];return e[i.Types.INTEGER.ord][i.Types.INTEGER.ord]=i.Types.BOOLEAN,e[i.Types.REAL.ord][i.Types.REAL.ord]=i.Types.BOOLEAN,e[i.Types.STRING.ord][i.Types.STRING.ord]=i.Types.BOOLEAN,e[i.Types.CHAR.ord][i.Types.CHAR.ord]=i.Types.BOOLEAN,e}function u(){const e=[[],[],[],[]];return e[i.Types.BOOLEAN.ord][i.Types.BOOLEAN.ord]=i.Types.BOOLEAN,e}function d(){const e=[];return e[i.Types.INTEGER.ord]=i.Types.INTEGER,e[i.Types.REAL.ord]=i.Types.REAL,e}const p=function(){const e=new WeakMap;return e.set(a.Operators.ADD,function(){const e=[[],[],[],[],[]];return e[i.Types.INTEGER.ord][i.Types.INTEGER.ord]=i.Types.INTEGER,e[i.Types.INTEGER.ord][i.Types.REAL.ord]=i.Types.REAL,e[i.Types.INTEGER.ord][i.Types.STRING.ord]=i.Types.STRING,e[i.Types.REAL.ord][i.Types.INTEGER.ord]=i.Types.REAL,e[i.Types.REAL.ord][i.Types.REAL.ord]=i.Types.REAL,e[i.Types.REAL.ord][i.Types.STRING.ord]=i.Types.STRING,e[i.Types.STRING.ord][i.Types.INTEGER.ord]=i.Types.STRING,e[i.Types.STRING.ord][i.Types.REAL.ord]=i.Types.STRING,e[i.Types.STRING.ord][i.Types.STRING.ord]=i.Types.STRING,e[i.Types.STRING.ord][i.Types.BOOLEAN.ord]=i.Types.STRING,e[i.Types.STRING.ord][i.Types.CHAR.ord]=i.Types.STRING,e[i.Types.CHAR.ord][i.Types.CHAR.ord]=i.Types.STRING,e[i.Types.CHAR.ord][i.Types.STRING.ord]=i.Types.STRING,e}()),e.set(a.Operators.SUB,s()),e.set(a.Operators.MULT,s()),e.set(a.Operators.DIV,s()),e.set(a.Operators.EQ,l()),e.set(a.Operators.NEQ,l()),e.set(a.Operators.GE,c()),e.set(a.Operators.GT,c()),e.set(a.Operators.LE,c()),e.set(a.Operators.LT,c()),e.set(a.Operators.OR,u()),e.set(a.Operators.AND,u()),e.set(a.Operators.MOD,function(){const e=[[]];return e[i.Types.INTEGER.ord][i.Types.INTEGER.ord]=i.Types.INTEGER,e}()),e}(),_=function(){const e=new WeakMap;return e.set(a.Operators.ADD,d()),e.set(a.Operators.SUB,d()),e.set(a.Operators.NOT,function(){const e=[];return e[i.Types.BOOLEAN.ord]=i.Types.BOOLEAN,e}()),e}();t.resultTypeAfterInfixOp=function e(t,n,s){try{if(n instanceof r.MultiType&&s instanceof r.MultiType){let a=[];for(let i=0;i<n.types.length;++i){const r=n.types[i];for(let n=0;n<s.types.length;++i){const i=s.types[n];a.push(e(t,r,i))}}return a=a.filter(e=>!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<n.types.length;++i){const r=n.types[i];a.push(e(t,r))}return a=a.filter(e=>!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<this.addresses.length;t+=1){const n=r.Location.find(this.addresses[t]);if(null==n)throw new Error("!!!Critical Error: variable "+this.id+" does not have a valid address. Loc-Address "+this.locAddress);e.push(n.value)}return e}destroy(){let e=!0;for(let t=0;t<this.addresses.length;t+=1)e=e&&r.Location.deallocate(this.addresses[t]);return e}get locAddress(){throw new Error("!!!Internal Error: Cannot invoke locAddress on StoreObjectArray")}get addresses(){return this.loc_addresses}getAt(e,t){if(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<this.columns;n+=1){const i=this.getIndexOf(e,n),a=r.Location.find(this.addresses[i]);t.push(a.value)}return t}const n=this.getIndexOf(e,t);return r.Location.find(this.addresses[n]).value}setAt(e,t,n){let i=1;if(null!=n&&(i+=1),!this.type.canAccept(e.type,i))throw new Error("!!!Internal Error: Attempting to insert an invalid value inside array "+this.id);if(this.isVector){if(null!=n)throw new Error(this.id+" is not a matrix!");n=t,t=0}else if(null==n)throw new Error("!!!Internal Error: Attempting to insert a line into matrix "+this.id);const a=this.getIndexOf(t,n);r.Location.updateAddress(this.addresses[a],e.get())}getIndexOf(e,t){return e*this.columns+t}getLocAddressOf(e,t){if(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<this.columns;n+=1){const i=this.getIndexOf(e,n);t.push(this.addresses[i])}return t}const n=this.getIndexOf(e,t);return this.addresses[n]}}t.StoreObjectArray=o},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\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:"<div class='assessment-div-detail' onClick='ivprogCore.openAssessmentDetail(event)' data-page=\"$1\"><span>Caso de teste $0</span>: OK</div>",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:"<div class='assessment-div-detail' onClick='ivprogCore.openAssessmentDetail(event)' data-page=\"$1\"><span>Test case $0</span>: OK</div>",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. <br> 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.<br> 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:"<div class='assessment-div-detail' onClick='ivprogCore.openAssessmentDetail(event)' data-page=\"$1\"> <span>Caso de teste $0 não executou com sucesso.</span></div>",test_case_failed_exception:"<div class='assessment-div-detail' onClick='ivprogCore.openAssessmentDetail(event)' data-page=\"$2\"> <span>Caso de teste $0 falhou</span>: $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 <span class='ivprog-error-varname'>$3</span>.",invalid_read_type_array:"Erro na linha $0: A entrada \"$1\" não é do tipo $2, que é o tipo aceito pela variável <span class='ivprog-error-varname'>$3</span> 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 <span class='ivprog-error-varname'>$0</span>, você precisa de nomes distintos.",inform_valid_variable_duplicated:"Já existe uma variável com o nome <span class='ivprog-error-varname'>$0</span> na função <span class='ivprog-error-varname'>$1</span>, você precisa de nomes distintos.",inform_valid_function_duplicated:"Já existe uma função com o nome <span class='ivprog-error-varname'>$0</span>, você precisa de nomes distintos.",inform_valid_param_duplicated:"Já existe um parâmetro com o nome <span class='ivprog-error-varname'>$0</span> na função <span class='ivprog-error-varname'>$1</span>, 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:"<div class='assessment-div-detail' onClick='ivprogCore.openAssessmentDetail(event)' data-page=\"$1\"> <span>Test case $0 did not executed successfully.</span></div>",test_case_failed_exception:"<div class='assessment-div-detail' onClick='ivprogCore.openAssessmentDetail(event)' data-page=\"$2\"> <span>Test case $0 failed</span>: $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 <span class='ivprog-error-varname'>$3</span>.",invalid_read_type_array:"Error at line $0: The input \"$1\" is not of type $2 which is the type accepted by the variable <span class='ivprog-error-varname'>$3</span> 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 <span class='ivprog-error-varname'>$0</span> already exists, you need distinct names for each gloval variable.",inform_valid_variable_duplicated:"A variable named <span class='ivprog-error-varname'>$0</span> already exists, you need distinct names for each variable.",inform_valid_function_duplicated:"A function named <span class='ivprog-error-varname'>$0</span> already exists, you need distinct names for each function.",inform_valid_param_duplicated:"A parameter named <span class='ivprog-error-varname'>$0</span> already exists in function <span class='ivprog-error-varname'>$1</span>, 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;o<i;o++)r[o]=arguments[o];return e=t.call.apply(t,[this].concat(r)),Error.captureStackTrace&&Error.captureStackTrace(me()(e),n),e}return n}(he()(Error));function xe(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 be=function(e){c()(n,e);var t=xe(n);function n(){var e;a()(this,n);for(var i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];return e=t.call.apply(t,[this].concat(r)),Error.captureStackTrace&&Error.captureStackTrace(me()(e),n),e}return n}(he()(Error)),we=n(52),Ee=n.n(we),Re=n(10);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 Ae=function(e){c()(n,e);var t=Te(n);function n(e,i){var r=arguments.length>2&&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<a;r+=1)o=t.applyStore("p1.".concat(r)),this.output.sendOutput(_e(o.get(),o.type));return t.mode=re.Modes.RETURN,e.abrupt("return",t);case 5:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$write",j.Types.VOID,[new ae(j.Types.ALL,"p1",!1,!0)],e)}()},$strLib:{$substring:function(){var e=new W([],[new ie(function(){var e=k()(T.a.mark((function e(t,n){var i,a,r,o,s;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.applyStore("str"),a=t.applyStore("start"),r=t.applyStore("end"),o=i.get().substring(a.get(),r.get()),s=new $e.StoreValue(j.Types.STRING,o),t.insertStore("$",s),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("$substring",j.Types.STRING,[new ae(j.Types.STRING,"str",!1),new ae(j.Types.INTEGER,"start",!1),new ae(j.Types.INTEGER,"end",!1)],e)}(),$length: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("str"),a=new $e.StoreValue(j.Types.INTEGER,le(i.value.length)),t.insertStore("$",a),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$length",j.Types.INTEGER,[new ae(j.Types.STRING,"str",!1)],e)}(),$uppercase: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("str"),a=new $e.StoreValue(j.Types.STRING,i.get().toUpperCase()),t.insertStore("$",a),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$uppercase",j.Types.STRING,[new ae(j.Types.STRING,"str",!1)],e)}(),$lowercase: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("str"),a=new $e.StoreValue(j.Types.STRING,i.get().toLowerCase()),t.insertStore("$",a),t.mode=re.Modes.RETURN,e.abrupt("return",t);case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}())]);return new z("$lowercase",j.Types.STRING,[new ae(j.Types.STRING,"str",!1)],e)}(),$charAt: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("str"),!((a=t.applyStore("index")).get().toNumber()<0||a.get().toNumber()>=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;t<arguments.length;t++){var n=t<0||arguments.length<=t?void 0:arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}(Ve.$ioLib,Ve.$langLib,Ve.$strLib,Ve.$arrayLib),qe=Object.freeze({getMainFunctionName:function(){return E.getCurrentLangFuncs().main_function},getInternalName:function(e){if(-1!==e.indexOf(".")){var t=e.split("."),n=Pe(t[0],E.getCurrentLangLibs()),i=Pe(t[1],E.getCurrentLangFuncs());return null===n||null===i?null:n+"."+i}var a=Pe(e,E.getCurrentLangFuncs());return null!==a&&He[a]?a:null},getFunction:function(e){if(-1!==e.indexOf(".")){var t=e.split("."),n=t[0],i=t[1];return Ve[n][i]}return He[e]},getLocalName:function(e){if(-1!==e.indexOf(".")){var t=e.split("."),n=E.getCurrentLangLibs()[t[0]],i=E.getCurrentLangFuncs()[t[1]];return"".concat(n,".").concat(i)}return E.getCurrentLangFuncs()[e]?E.getCurrentLangFuncs()[e]:e}});function je(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 ze=function(e){c()(n,e);var t=je(n);function n(e,i){var r;return a()(this,n),(r=t.call(this)).id=e,r.actualParameters=i,r}return o()(n,[{key:"toString",value:function(){var e=null;e=this.isMainCall?qe.getMainFunctionName():qe.getLocalName(this.id);var t=null;0==this.actualParameters.length?t="()":t="("+this.actualParameters.map((function(e){return e.toString()})).join(",")+")";return this.parenthesis?"(".concat(e+t,")"):e+t}},{key:"isMainCall",get:function(){return null===this.id}},{key:"parametersSize",get:function(){return this.actualParameters.length}}]),n}(f);function Xe(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 Qe=function(e){c()(n,e);var t=Xe(n);function n(e){var i;return a()(this,n),(i=t.call(this)).type=e,i}return n}(f);function We(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=We(n);function n(e){var i;return a()(this,n),(i=t.call(this,j.Types.INTEGER)).value=e,i}return o()(n,[{key:"toString",value:function(){var e=_e(this.value,this.type);return this.parenthesis?"(".concat(e,")"):e}}]),n}(Qe);function Je(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 Ze=function(e){c()(n,e);var t=Je(n);function n(e){var i;return a()(this,n),(i=t.call(this,j.Types.REAL)).value=e,i}return o()(n,[{key:"toString",value:function(){var e=_e(this.value,this.type);return this.parenthesis?"(".concat(e,")"):e}}]),n}(Qe);function et(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 tt=function(e){c()(n,e);var t=et(n);function n(e){var i;return a()(this,n),(i=t.call(this,j.Types.BOOLEAN)).value=e,i}return o()(n,[{key:"toString",value:function(){var e=pe(this.value);return this.parenthesis?"(".concat(e,")"):e}}]),n}(Qe);function nt(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 it=function(e){c()(n,e);var t=nt(n);function n(e){var i;return a()(this,n),(i=t.call(this,j.Types.CHAR)).value=e,i}return o()(n,[{key:"toString",value:function(){var e="'".concat(this.value,"'");return this.parenthesis?"(".concat(e,")"):e}}]),n}(Qe);function at(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 rt=function(e){c()(n,e);var t=at(n);function n(e){var i;return a()(this,n),(i=t.call(this,j.Types.STRING)).value=e,i}return o()(n,[{key:"toString",value:function(){var e='"'+this.value+'"';return this.parenthesis?"(".concat(e,")"):e}}]),n}(Qe);function ot(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 st=function(e){c()(n,e);var t=ot(n);function n(e,i){var r;return a()(this,n),(r=t.call(this,e)).value=i,r}return o()(n,[{key:"validateType",value:function(){return!0}},{key:"validateSize",value:function(){return!0}},{key:"toString",value:function(){var e="{"+this.value.map((function(e){return e.toString()})).join(",")+"}";return this.parenthesis?"(".concat(e,")"):e}},{key:"subtype",get:function(){var e=this.value[0];return e instanceof n?e.value[0].type:e.type}},{key:"lines",get:function(){return this.value.length}},{key:"columns",get:function(){var e=this.value[0];return e instanceof n?e.value.length:null}},{key:"isVector",get:function(){return null===this.columns}},{key:"isValid",get:function(){return this.validateSize()&&this.validateType()}}]),n}(Qe);function lt(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 ct=function(e){c()(n,e);var t=lt(n);function n(e){var i;return a()(this,n),(i=t.call(this,j.Types.UNDEFINED)).id=e,i}return o()(n,[{key:"toString",value:function(){return this.parenthesis?"(".concat(this.id,")"):this.id}}]),n}(Qe);function ut(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 dt=function(e){c()(n,e);var t=ut(n);function n(e,i,r){var o;return a()(this,n),(o=t.call(this)).op=e,o.left=i,o.right=r,o}return o()(n,[{key:"toString",value:function(){var e=this.left.toString(),t=this.op.value,n=this.right.toString();return this.parenthesis?"(".concat(e+t+n,")"):e+t+n}}]),n}(f);function pt(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 _t=function(e){c()(n,e);var t=pt(n);function n(e,i){return a()(this,n),t.call(this,e,i,null)}return o()(n,[{key:"toString",value:function(){var e=this.left.toString(),t=this.op.value;return this.parenthesis?"(".concat(t+e,")"):t+e}}]),n}(dt);function ft(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 mt=function(e){c()(n,e);var t=ft(n);function n(){var e;a()(this,n);for(var i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];return e=t.call.apply(t,[this].concat(r)),Error.captureStackTrace&&Error.captureStackTrace(me()(e),n),e}return n}(he()(Error)),vt=Ce();function ht(e){var t=arguments.length>1&&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;i<e.length;++i){var a=e[i],r=n.literalNames[t[a]];kt.push(r.substring(1,r.length-1))}}if(null==It){It=[];for(var o=[Re.Operators.AND.value,Re.Operators.OR.value,Re.Operators.NOT.value],s=0;s<o.length;++s){var l="logic_operator_".concat(o[s]);It.push(ke.getUI(l))}}}();for(var t=0;t<kt.length;++t){if(kt[t]==e)return!0}for(var n=0;n<It.length;n++){if(It[n]==e)return!0}return!1}function Ot(e){return!!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)&&!Ct(e)}var Nt=null;function Lt(e){e.preventDefault();var t=e.currentTarget.dataset.page;null!=Nt&&Nt.close(),(Nt=window.open("","DetailWindow","width=550,height=600")).document.open(),Nt.document.write(t),Nt.document.close()}function St(e){return $t.apply(this,arguments)}function $t(){return($t=k()(T.a.mark((function e(t){return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){return setTimeout(e,t)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ut=n(25),Mt=n(46),Ft=n(26),Dt=n(51),Bt=n(36),Gt=function(){function e(t){a()(this,e),this.ast=t,this.globalStore=new Rt.Store("$global"),this.stores=[this.globalStore],this.context=[Tt.Context.BASE],this.input=null,this.forceKill=!1,this.output=null,this.mode=re.Modes.RUN,this.function_call_stack=[],this.instruction_count=0,this.function_call_count=0}var t,n,i,r,s,l,c,u,d,p,_,f,m,h,g,y,x,w,E,R,A,I,C,N,S,$,M,D,G,K,H;return o()(e,null,[{key:"MAIN_INTERNAL_ID",get:function(){return"$main"}}]),o()(e,[{key:"registerInput",value:function(e){null!==this.input&&(this.input=null),this.input=e}},{key:"registerOutput",value:function(e){null!==this.output&&(this.output=null),this.output=e}},{key:"checkContext",value:function(e){return this.context[this.context.length-1]===e}},{key:"ignoreSwitchCases",value:function(e){return e.mode===re.Modes.RETURN||e.mode===re.Modes.BREAK}},{key:"prepareState",value:function(){if(null!==this.stores){for(var e=0;e<this.stores.length;e++)delete this.stores[e];this.stores=null}null!==this.globalStore&&(this.globalStore=null),this.globalStore=new Rt.Store("$global"),this.stores=[this.globalStore],this.context=[Tt.Context.BASE],this.instruction_count=0,this.mode=re.Modes.RUN}},{key:"interpretAST",value:(H=k()(T.a.mark((function e(){var t;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.prepareState(),Ut.Location.clear(),e.next=4,this.initGlobal();case 4:if(null!==(t=this.findMainFunction())){e.next=7;break}throw Se.main_missing();case 7:return e.abrupt("return",this.runFunction(t,[],this.globalStore));case 8:case"end":return e.stop()}}),e,this)}))),function(){return H.apply(this,arguments)})},{key:"initGlobal",value:(K=k()(T.a.mark((function e(){return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.checkContext(Tt.Context.BASE)){e.next=2;break}return e.abrupt("return",Se.invalid_global_var());case 2:return e.abrupt("return",this.executeCommands(this.globalStore,this.ast.global));case 3:case"end":return e.stop()}}),e,this)}))),function(){return K.apply(this,arguments)})},{key:"findMainFunction",value:function(){return this.ast.functions.find((function(e){return e.isMain}))}},{key:"findFunction",value:function(t){if(t.match(/^\$.+$/)){if(t===e.MAIN_INTERNAL_ID)return this.findMainFunction();var n=qe.getFunction(t);if(!n)throw Se.not_implemented(t);return n}var i=this.ast.functions.find((function(e){return e.name===t}));if(!i)throw Se.function_missing(t);return i}},{key:"runFunction",value:(G=k()(T.a.mark((function t(n,i,a){var r,o,s,l;return T.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n.isMain?e.MAIN_INTERNAL_ID:n.name,(o=new Rt.Store(r)).extendStore(this.globalStore),t.next=5,this.associateParameters(n.formalParameters,i,a,o);case 5:return this.context.push(Tt.Context.FUNCTION),this.stores.push(o),t.next=9,this.executeCommands(o,n.variablesDeclarations);case 9:return s=t.sent,l=this.executeCommands(s,n.commands),this.stores.pop(),this.context.pop(),t.abrupt("return",l);case 14:case"end":return t.stop()}}),t,this)}))),function(e,t,n){return G.apply(this,arguments)})},{key:"associateParameters",value:(D=k()(T.a.mark((function t(n,i,a,r){var o,s,l,c,u,d,p,_;return T.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=r.name===e.MAIN_INTERNAL_ID?qe.getMainFunctionName():r.name,s=n.some((function(e){return e.variadic})),!(n.length!=i.length&&!s||n.length>i.length)){t.next=4;break}throw Se.invalid_parameters_size(o,n.length,i.length);case 4:l=0,c=0;case 5:if(!(l<n.length&&c<i.length)){t.next=23;break}if(!(u=n[l]).variadic){t.next=16;break}return t.next=10,this.associateVariadicParameter(o,u,c,i,a,r);case 10:d=t.sent,p=Et()(d,2),c=p[0],r=p[1],t.next=20;break;case 16:return _=i[l],t.next=19,this.associateParameter(o,u,_,a,r);case 19:r=t.sent;case 20:l+=1,c+=1,t.next=5;break;case 23:return t.abrupt("return",r);case 24:case"end":return t.stop()}}),t,this)}))),function(e,t,n,i){return D.apply(this,arguments)})},{key:"associateVariadicParameter",value:(M=k()(T.a.mark((function e(t,n,i,a,r,o){var s,l,c,u;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l=1,s=i;case 2:if(!(s<a.length)){e.next=11;break}return c=a[s],e.next=6,this.associateParameter(t,n,c,r,o,l);case 6:o=e.sent,l+=1;case 8:s+=1,e.next=2;break;case 11:return u=new $e.StoreValue(j.Types.INTEGER,l,void 0,!0),o.insertStore("".concat(n.id,".0"),u),e.abrupt("return",[s-1,o]);case 14:case"end":return e.stop()}}),e,this)}))),function(e,t,n,i,a,r){return M.apply(this,arguments)})},{key:"associateParameter",value:($=k()(T.a.mark((function e(t,n,i,a,r){var o,s,l,c,u,d,p,_,f,m,v,h,g,y,x=arguments;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=x.length>5&&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<n.length)){e.next=9;break}return e.next=5,this.executeCommand(i,n[a]);case 5:i=e.sent;case 6:a+=1,e.next=2;break;case 9:return e.abrupt("return",i);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"executeCommand",value:(N=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.instruction_count>=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.length)||this.ignoreSwitchCases(a)){e.next=26;break}if(s=i[o],!r&&!s.isDefault){e.next=13;break}return e.next=10,this.executeCommands(a,s.commands);case 10:a=e.sent,e.next=23;break;case 13:return(l=new dt(Re.Operators.EQ,n.expression,s.expression)).sourceInfo=s.sourceInfo,e.next=17,this.evaluateExpression(a,l);case 17:if(!(c=e.sent).get()){e.next=22;break}return e.next=21,this.executeCommands(a,s.commands);case 21:a=e.sent;case 22:r=c.get();case 23:o+=1,e.next=5;break;case 26:return this.context.pop(),a.mode===re.Modes.BREAK&&(a.mode=re.Modes.RUN),e.abrupt("return",a);case 29:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"executeFor",value:(R=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=new U(n.for_id.id,n.for_from)).sourceInfo=n.sourceInfo,a=n.for_pass,r=new dt(Re.Operators.LT,n.for_id,n.for_to),null!=n.for_pass){e.next=12;break}return a=new Ye(le(1)),e.next=8,this.evaluateExpression(t,new dt(Re.Operators.GE,n.for_to,n.for_from));case 8:e.sent.get()||(a=new Ye(le(-1)),r=new dt(Re.Operators.GT,n.for_id,n.for_to)),e.next=16;break;case 12:return e.next=14,this.evaluateExpression(t,new dt(Re.Operators.GE,n.for_pass,new Ye(le(0))));case 14:e.sent.get()||(r=new dt(Re.Operators.GT,n.for_id,n.for_to));case 16:return r.sourceInfo=n.sourceInfo,(o=new U(n.for_id.id,new dt(Re.Operators.ADD,n.for_id,a))).sourceInfo=n.sourceInfo,s=new W([],n.commands.concat(o)),(l=new V(r,s)).sourceInfo=n.sourceInfo,c=[i,l],e.abrupt("return",this.executeCommands(t,c));case 24:case"end":return e.stop()}}),e,this)}))),function(e,t){return R.apply(this,arguments)})},{key:"executeRepeatUntil",value:(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 this.context.push(Tt.Context.BREAKABLE),e.next=3,this.executeCommands(t,n.commands);case 3:if((i=e.sent).mode!==re.Modes.BREAK){e.next=8;break}return this.context.pop(),i.mode=re.Modes.RUN,e.abrupt("return",i);case 8:return e.next=10,this.evaluateExpression(i,n.expression);case 10:if((a=e.sent).type.isCompatible(j.Types.BOOLEAN)){e.next=13;break}throw Se.loop_condition_type_full(n.sourceInfo);case 13:if(this.context.pop(),!a.get()){e.next=18;break}return e.abrupt("return",i);case 18:return e.abrupt("return",this.executeCommand(i,n));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return E.apply(this,arguments)})},{key:"executeWhile",value:(w=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 this.context.push(Tt.Context.BREAKABLE),e.next=3,this.evaluateExpression(t,n.expression);case 3:if((i=e.sent).type.isCompatible(j.Types.BOOLEAN)){e.next=6;break}throw Se.loop_condition_type_full(n.expression.toString(),n.sourceInfo);case 6:if(!i.get()){e.next=17;break}return e.next=9,this.executeCommands(t,n.commands);case 9:if(a=e.sent,this.context.pop(),a.mode!==re.Modes.BREAK){e.next=14;break}return a.mode=re.Modes.RUN,e.abrupt("return",a);case 14:return e.abrupt("return",this.executeCommand(a,n));case 17:return this.context.pop(),e.abrupt("return",t);case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"executeIfThenElse",value:(x=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 e.next=2,this.evaluateExpression(t,n.condition);case 2:if((i=e.sent).type.isCompatible(j.Types.BOOLEAN)){e.next=5;break}throw Se.if_condition_type_full(n.condition.toString(),n.sourceInfo);case 5:if(!i.get()){e.next=9;break}return e.abrupt("return",this.executeCommands(t,n.ifTrue.commands));case 9:if(null===n.ifFalse){e.next=17;break}if(!(n.ifFalse instanceof Q)){e.next=14;break}return e.abrupt("return",this.executeCommand(t,n.ifFalse));case 14:return e.abrupt("return",this.executeCommands(t,n.ifFalse.commands));case 15:e.next=18;break;case 17:return e.abrupt("return",t);case 18:case"end":return e.stop()}}),e,this)}))),function(e,t){return x.apply(this,arguments)})},{key:"executeReturn",value:(y=k()(T.a.mark((function t(n,i){var a,r,o,s,l,c,u;return T.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=n.name===e.MAIN_INTERNAL_ID?qe.getMainFunctionName():n.name,r=this.findFunction(n.name),o=r.returnType,t.next=5,this.evaluateExpression(n,i.expression);case 5:if(null!==(s=t.sent)||!o.isCompatible(j.Types.VOID)){t.next=9;break}return n.mode=re.Modes.RETURN,t.abrupt("return",n);case 9:if(l=s,null!==s&&o.isCompatible(s.type)){t.next=16;break}if(b.Config.enable_type_casting&&Rt.Store.canImplicitTypeCast(o,s.type)){t.next=15;break}throw c=o.stringInfo(),u=c[0],Se.invalid_return_type_full(a,u.type,u.dim,i.sourceInfo);case 15:l=Rt.Store.doImplicitCasting(o,s);case 16:return n.insertStore("$",l),n.mode=re.Modes.RETURN,t.abrupt("return",n);case 19:case"end":return t.stop()}}),t,this)}))),function(e,t){return y.apply(this,arguments)})},{key:"executeBreak",value:(g=k()(T.a.mark((function e(t,n){return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.checkContext(Tt.Context.BREAKABLE)){e.next=5;break}return t.mode=re.Modes.BREAK,e.abrupt("return",t);case 5:throw Se.unexpected_break_command_full(n.sourceInfo);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return g.apply(this,arguments)})},{key:"executeAssign",value:(h=k()(T.a.mark((function e(t,n){var i,a,r,o,s,l,c,u,d,p;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=t.applyStore(n.id)).isConst){e.next=3;break}throw Se.invalid_const_assignment_full(n.id,n.sourceInfo);case 3:return e.next=5,this.evaluateExpression(t,n.expression);case 5:if(a=e.sent,r=a,i.type.isCompatible(r.type)){e.next=18;break}if(!b.Config.enable_type_casting||!Rt.Store.canImplicitTypeCast(i.type,a.type)){e.next=12;break}r=Rt.Store.doImplicitCasting(i.type,r),e.next=18;break;case 12:throw o=i.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 18:if(!(i instanceof Ft.ArrayStoreValue)){e.next=27;break}if(d=null==r.columns?0:r.columns,i.lines===r.lines&&i.columns===d){e.next=27;break}if(p=n.expression.toString(),!i.isVector()){e.next=26;break}throw Se.invalid_vector_assignment_full(n.id,i.lines,p,r.lines,n.sourceInfo);case 26:throw Se.invalid_matrix_assignment_full(n.id,i.lines,i.columns,p,r.lines,r.columns,n.sourceInfo);case 27:return t.updateStore(n.id,r),e.abrupt("return",t);case 29:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"executeArrayIndexAssign",value:(m=k()(T.a.mark((function e(t,n){var i,a,r,o,s,l,c,u,d,p,_,f,m,v,h,g;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.applyStore(n.id),a=0,!i.isConst){e.next=4;break}throw Se.invalid_const_assignment_full(n.id,n.sourceInfo);case 4:if(i.type instanceof Ue.ArrayType){e.next=6;break}throw Se.invalid_array_access_full(n.id,n.sourceInfo);case 6:return e.next=8,this.evaluateExpression(t,n.line);case 8:if(r=e.sent,j.Types.INTEGER.isCompatible(r.type)){e.next=11;break}throw Se.array_dimension_not_int_full(n.sourceInfo);case 11:return a+=1,o=r.get().toNumber(),e.next=15,this.evaluateExpression(t,n.column);case 15:if(s=e.sent,l=null,null==s){e.next=22;break}if(j.Types.INTEGER.isCompatible(s.type)){e.next=20;break}throw Se.array_dimension_not_int_full(n.sourceInfo);case 20:l=s.get().toNumber(),a+=1;case 22:return e.next=24,this.evaluateExpression(t,n.expression);case 24:if(c=e.sent,u=c,!(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.length<R.length:j.Types.CHAR.isCompatible(i.type)?d=E.charCodeAt(0)<R.charCodeAt(0):(r&&(o=j.Types.BOOLEAN,E=E.trunc(),R=R.trunc()),d=E.lt(R)),e.abrupt("return",new $e.StoreValue(o,d));case 63:return A=i.get(),k=a.get(),j.Types.STRING.isCompatible(i.type)?d=A.length<=k.length:j.Types.CHAR.isCompatible(i.type)?d=A.charCodeAt(0)<=k.charCodeAt(0):(r&&(o=j.Types.BOOLEAN,A=A.trunc(),k=k.trunc()),d=A.lte(k)),e.abrupt("return",new $e.StoreValue(o,d));case 67:return I=i.get(),C=a.get(),j.Types.INTEGER.isCompatible(i.type)||j.Types.REAL.isCompatible(i.type)?(r&&(o=j.Types.BOOLEAN,I=I.trunc(),C=C.trunc()),d=I.eq(C)):d=I===C,e.abrupt("return",new $e.StoreValue(o,d));case 71:return O=i.get(),N=a.get(),j.Types.INTEGER.isCompatible(i.type)||j.Types.REAL.isCompatible(i.type)?(r&&(o=j.Types.BOOLEAN,O=O.trunc(),N=N.trunc()),d=!O.eq(N)):d=O!==N,e.abrupt("return",new $e.StoreValue(o,d));case 75:return e.abrupt("return",new $e.StoreValue(o,i.get()&&a.get()));case 76:return e.abrupt("return",new $e.StoreValue(o,i.get()||a.get()));case 77:throw new ye("!!!Critical Invalid InfixApp "+n.op);case 78:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})}]),e}(),Pt=function(){function e(t){var n=arguments.length>1&&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 <div class="bash-title">\n <i id="ivprog-console-clearbtn" class="icon eraser" style="float:left;padding-left: 5px"></i>\n <span>Terminal</span>\n <i id="ivprog-console-showbtn" class="icon window maximize outline" style="float:right"></i>\n <i id="ivprog-console-hidebtn" class="icon window minimize outline" style="float:right"></i>\n </div>\n <div id=\'ivprog-term\' class="bash-body"></div>'}},{key:"INPUT_CARET_TEMPLATE",get:function(){return'\n <div id="cmd">\n <span></span>\n <div id="cursor"></div>\n </div>'}},{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):"<span>".concat(t,"</span>"),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,"&#160;"),"<span>".concat(e,"</span>")}},{key:"getUserInputText",value:function(e){return 0==e.trim().length&&(e="&nbsp;"),'<i class="icon keyboard outline" style="float:left"></i><span>'.concat(e,"</span>")}},{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;i<n.length-1;i+=1){var a=n[i];0==(a=(a=a.replace(/\t/g,"&#x0020;&#x0020;")).replace(/\s/g,"&#x0020;")).length?this.currentLine=null:this.write(a,!0)}var r=n[i];0!=(r=(r=r.replace(/\t/g,"&#x0020;&#x0020;")).replace(/\s/g,"&#x0020;")).length&&this.write(r)}else t=(t=t.replace(/\t/g,"&#x0020;&#x0020;")).replace(/\s/g,"&#x0020;"),this.write(t)}},{key:"clearPendingWrites",value:function(){this.last_clear=Date.now()}},{key:"clear",value:function(){for(this.clearPendingWrites();this.inputDiv.parentElement.childNodes.length>1;)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;n<t.length;n++){var i=t[n];this.assertFunction(i)}return this.ast}},{key:"assertDeclarations",value:function(e){for(var t=0;t<e.length;t++)this.assertDeclaration(e[t])}},{key:"assertDeclaration",value:function(e){if(e instanceof P)this.assertArrayDeclaration(e),this.insertSymbol(e.id,{id:e.id,lines:e.lines,columns:e.columns,type:e.type,isConst:e.isConst});else{if(null===e.initial)return void this.insertSymbol(e.id,{id:e.id,type:e.type,isConst:e.isConst});var t=this.evaluateExpressionType(e.initial);if(t instanceof Me.MultiType){if(!t.isCompatible(e.type)){var n=e.type.stringInfo()[0],i=t.stringInfo()[0],a=e.initial;throw Se.incompatible_types_full(n.type,n.dim,i.type,i.dim,a.toString(),e.sourceInfo)}this.insertSymbol(e.id,{id:e.id,type:e.type,isConst:e.isConst})}else{if(!e.type.isCompatible(t)&&!b.Config.enable_type_casting||!e.type.isCompatible(t)&&b.Config.enable_type_casting&&!Rt.Store.canImplicitTypeCast(e.type,t)){var r=e.type.stringInfo()[0],o=t.stringInfo()[0],s=e.initial;throw Se.incompatible_types_full(r.type,r.dim,o.type,o.dim,s.toString(),e.sourceInfo)}this.insertSymbol(e.id,{id:e.id,type:e.type,isConst:e.isConst})}}}},{key:"assertArrayDeclaration",value:function(e){if(null===e.initial){if(!this.evaluateExpressionType(e.lines).isCompatible(j.Types.INTEGER))throw Se.array_dimension_not_int_full(e.sourceInfo);if(null!==e.columns)if(!this.evaluateExpressionType(e.columns).isCompatible(j.Types.INTEGER))throw Se.array_dimension_not_int_full(e.sourceInfo)}else this.evaluateArrayLiteral(e);this.insertSymbol(e.id,{id:e.id,lines:e.lines,columns:e.columns,type:e.type})}},{key:"evaluateExpressionType",value:function(e){if(e instanceof _t){var t=e.op,n=this.evaluateExpressionType(e.left),i=Object(At.resultTypeAfterUnaryOp)(t,n);if(j.Types.UNDEFINED.isCompatible(i)){var a=n.stringInfo()[0],r=e.toString();throw Se.invalid_unary_op_full(r,t,a.type,a.dim,e.sourceInfo)}return i}if(e instanceof dt){var o=e.op,s=this.evaluateExpressionType(e.left),l=this.evaluateExpressionType(e.right),c=Object(At.resultTypeAfterInfixOp)(o,s,l);if(j.Types.UNDEFINED.isCompatible(c)){var u=s.stringInfo()[0],d=l.stringInfo()[0],p=e.toString();throw Se.invalid_infix_op_full(p,o,u.type,u.dim,d.type,d.dim,e.sourceInfo)}return c}if(e instanceof Qe)return this.evaluateLiteralType(e);if(e instanceof ze){if(e.isMainCall)throw Se.void_in_expression_full(qe.getMainFunctionName(),e.sourceInfo);var _=this.findFunction(e.id);if(null===_)throw Se.function_missing_full(e.id,e.sourceInfo);if(_.returnType.isCompatible(j.Types.VOID))throw Se.void_in_expression_full(e.id,e.sourceInfo);return this.assertParameters(_,e.actualParameters),_.returnType}if(e instanceof v){var f=this.findSymbol(e.id,this.symbolMap);if(null===f)throw Se.symbol_not_found_full(e.id,e.sourceInfo);if(!(f.type instanceof Ue.ArrayType))throw Se.invalid_array_access_full(e.id,e.sourceInfo);if(!this.evaluateExpressionType(e.line).isCompatible(j.Types.INTEGER))throw Se.array_dimension_not_int_full(e.sourceInfo);if(null!==e.column){if(null===f.columns)throw Se.invalid_matrix_access_full(e.id,e.sourceInfo);if(!this.evaluateExpressionType(e.column).isCompatible(j.Types.INTEGER))throw Se.array_dimension_not_int_full(e.sourceInfo)}var m=f.type;return null!==e.column||null===f.columns?m.innerType:new Ue.ArrayType(m.innerType,1)}}},{key:"evaluateLiteralType",value:function(e){if(e instanceof Ye)return e.type;if(e instanceof Ze)return e.type;if(e instanceof rt)return e.type;if(e instanceof tt)return e.type;if(e instanceof it)return e.type;if(e instanceof ct){var t=this.findSymbol(e.id,this.symbolMap);if(null===t)throw Se.symbol_not_found_full(e.id,e.sourceInfo);return t.type,Ue.ArrayType,t.type}var n=null;if(1===e.value.length)n=this.evaluateExpressionType(e.value[0]);else for(var i=0;i<e.value.length;i++){var a=this.evaluateExpressionType(e.value[i]);if(null===n)n=a;else if(!n.isCompatible(a)){var r=n.stringInfo()[0],o=e.toString();throw Se.incompatible_types_array_full(o,r.type,r.dim,e.sourceInfo)}}return n instanceof Ue.ArrayType?new Ue.ArrayType(n.innerType,n.dimensions+1):new Ue.ArrayType(n,1)}},{key:"evaluateArrayLiteral",value:function(e){var t=e.type,n=e.initial;if(e.isVector)this.evaluateVectorLiteralType(n,t);else for(var i=0;i<n.lines;++i){var a=n.value[i];this.evaluateVectorLiteralType(a,new Ue.ArrayType(t.innerType,1))}return!0}},{key:"assertFunction",value:function(e){var t=this;this.pushMap(),this.currentFunction=e,e.formalParameters.forEach((function(e){e.type instanceof Ue.ArrayType?e.type.dimensions>1?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;o<t.cases.length;o++){var s=t.cases[o];if(null!==s.expression){var l=this.evaluateExpressionType(s.expression);if(!i.isCompatible(l)){var c=i.stringInfo()[0],u=s.expression.toString();throw Se.invalid_case_type_full(u,c.type,c.dim,s.sourceInfo)}}else r=!0;a=a&&this.checkCommands(e,s.commands,a)}return a&&r}if(t instanceof F){var d=0,p=this.findSymbol(t.id,this.symbolMap);if(null===p)throw Se.symbol_not_found_full(t.id,t.sourceInfo);if(p.isConst)throw Se.invalid_const_assignment_full(t.id,t.sourceInfo);if(!(p.type instanceof Ue.ArrayType))throw Se.invalid_array_access_full(t.id,t.sourceInfo);var _=t.expression,f=t.line;if(!this.evaluateExpressionType(f).isCompatible(j.Types.INTEGER))throw Se.array_dimension_not_int_full(t.sourceInfo);d+=1;var m=t.column;if(null===p.columns&&null!==m)throw Se.invalid_matrix_access_full(t.id,t.sourceInfo);if(null!==m){if(!this.evaluateExpressionType(m).isCompatible(j.Types.INTEGER))throw Se.array_dimension_not_int_full(t.sourceInfo);d+=1}var v=this.evaluateExpressionType(_),h=p.type,g=!1;if(v instanceof Me.MultiType){var y=h;y=h.dimensions-d==0?h.innerType:new Ue.ArrayType(h.innerType,Math.max(0,h.dimensions-d)),g=v.isCompatible(y)}else g=h.canAccept(v,d);if(!(g||b.Config.enable_type_casting&&Rt.Store.canImplicitTypeCast(h,v))){var x=h.stringInfo()[0],w=v.stringInfo()[0];throw Se.incompatible_types_full(x.type,x.dim-d,w.type,w.dim,_.toString(),t.sourceInfo)}return n}if(t instanceof U){var E=this.findSymbol(t.id,this.symbolMap);if(null===E)throw Se.symbol_not_found_full(t.id,t.sourceInfo);if(E.isConst)throw Se.invalid_const_assignment_full(t.id,t.sourceInfo);var R=t.expression,T=this.evaluateExpressionType(R);if(T instanceof Ue.ArrayType){if(!(E.type instanceof Ue.ArrayType))throw new Error("Cannot assign an array to a non-array variable ");if(!T.isCompatible(E.type))if(T.dimensions!==E.type.dimensions||T.innerType.isCompatible(E.type.innerType))switch(T.dimensions){case 1:throw Se.vector_to_matrix_attr(t.id,R.toString(),t.sourceInfo);case 2:throw Se.matrix_to_vector_attr(t.id,R.toString(),t.sourceInfo)}else if(!b.Config.enable_type_casting||!Rt.Store.canImplicitTypeCast(E.type.innerType,T.innerType)){var A=E.type.stringInfo()[0],k=T.stringInfo()[0];throw Se.incompatible_types_full(A.type,A.dim,k.type,k.dim,R.toString(),t.sourceInfo)}}else if(!(T.isCompatible(E.type)||b.Config.enable_type_casting&&Rt.Store.canImplicitTypeCast(E.type,T))){var I=E.type.stringInfo()[0],C=T.stringInfo()[0];throw Se.incompatible_types_full(I.type,I.dim,C.type,C.dim,R.toString(),t.sourceInfo)}return n}if(t instanceof O)return n;if(t instanceof Q){if(!this.evaluateExpressionType(t.condition).isCompatible(j.Types.BOOLEAN))throw Se.if_condition_type_full(t.condition.toString(),t.sourceInfo);return t.ifFalse instanceof Q?this.checkCommands(e,t.ifTrue.commands,n)&&this.checkCommand(e,t.ifFalse,n):null!=t.ifFalse?this.checkCommands(e,t.ifTrue.commands,n)&&this.checkCommands(e,t.ifFalse.commands,n):this.checkCommands(e,t.ifTrue.commands,n)}if(t instanceof ze){var N=null;if(null===(N=t.isMainCall?this.getMainFunction():this.findFunction(t.id)))throw Se.function_missing_full(t.id,t.sourceInfo);return this.assertParameters(N,t.actualParameters),n}if(t instanceof L){var S=this.currentFunction.isMain?qe.getMainFunctionName():this.currentFunction.name;if(null!==t.expression||e.isCompatible(j.Types.VOID)){if(null!==t.expression){var $=this.evaluateExpressionType(t.expression);if(!(e.isCompatible($)||b.Config.enable_type_casting&&Rt.Store.canImplicitTypeCast(e,$))){var M=e.stringInfo()[0];throw Se.invalid_return_type_full(S,M.type,M.dim,t.sourceInfo)}return!0}return!0}var D=e.stringInfo()[0];throw Se.invalid_void_return_full(S,D.type,D.dim,t.sourceInfo)}}},{key:"checkCommands",value:function(e,t,n){var i=this;return t.reduce((function(t,a){return i.checkCommand(e,a,n)||t}),n)}},{key:"assertParameters",value:function(e,t){var n=e.formalParameters;if(n.length>t.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<n.length&&a<t.length;i+=1,a+=1){var r=n[i];if(r.variadic&&i+1!==n.length)throw"A function variadic parameter must be its last parameter!";if(r.variadic)a=this.assertVariadicParameter(e,r,a,t);else{var o=t[a];this.assertParameter(e,r,o)}}}},{key:"evaluateVectorLiteralType",value:function(e,t){for(var n=0;n<e.value.length;n+=1){var i=e.value[n],a=this.evaluateExpressionType(i);if(!((a instanceof Me.MultiType?a.isCompatible(t.innerType):t.canAccept(a,1))||b.Config.enable_type_casting&&Rt.Store.canImplicitTypeCast(t.innerType,a))){var r=t.stringInfo()[0],o=a.stringInfo()[0];throw Se.incompatible_types_full(r.type,0,o.type,o.dim,i.toString(),e.sourceInfo)}}return t}},{key:"assertVariadicParameter",value:function(e,t,n,i){var a;for(a=n;a<i.length;a+=1)this.assertParameter(e,t,i[a]);return a-1}},{key:"assertParameter",value:function(e,t,n){if(t.byRef)if(n instanceof ct){if(this.findSymbol(n.id,this.symbolMap).isConst)throw Se.invalid_const_ref_full(e.name,n.toString(),n.sourceInfo)}else if(!(n instanceof ct||n instanceof v))throw Se.invalid_parameter_type_full(e.name,n.toString(),n.sourceInfo);var i=this.evaluateExpressionType(n);if(i instanceof Me.MultiType&&t.type instanceof Me.MultiType){for(var a=0,r=0;r<i.types.length;++r){var o=i.types[r];-1!==t.type.types.indexOf(o)&&(a+=1)}if(a<=0&&b.Config.enable_type_casting&&!t.byRef&&(!i.isCompatible(j.Types.INTEGER)&&!i.isCompatible(j.Types.REAL)||t.type.isCompatible(j.Types.INTEGER)||t.type.isCompatible(j.Types.REAL)))throw Se.invalid_parameter_type_full(e.name,n.toString(),n.sourceInfo)}else if(i instanceof Me.MultiType){if(!i.isCompatible(t.type)&&b.Config.enable_type_casting&&!t.byRef&&(!i.isCompatible(j.Types.INTEGER)&&!i.isCompatible(j.Types.REAL)||t.type.isCompatible(j.Types.INTEGER)||t.type.isCompatible(j.Types.REAL)))throw Se.invalid_parameter_type_full(e.name,n.toString(),n.sourceInfo)}else if(!t.type.isCompatible(i)&&b.Config.enable_type_casting&&!t.byRef&&!Rt.Store.canImplicitTypeCast(t.type,i))throw Se.invalid_parameter_type_full(e.name,n.toString(),n.sourceInfo)}}]),e}();function Vt(){var e=E.getCurrentLexer(),t=new window.JsonEditor("#json-renderer",{}),n=new Pt("#console",!0);n.hide();try{window.$("#btn").click((function(){var i=window.$("#input").val(),a=new bt(i,e);try{var r=a.parseTree(),o=new Kt(r),s=new Gt(o.analyseTree());s.registerInput(n),n.clear(),s.registerOutput(n),s.interpretAST().then((function(e){console.log(e),t.load(e.store),console.log(Ut.Location.size())})).catch((function(e){alert(e),console.log(e),console.log(Ut.Location.size())}))}catch(e){alert(e),console.log(e),console.log(Ut.Location.size())}}))}catch(e){console.log(e)}}var Ht=Object.freeze({INTEGER:"integer",REAL:"real",TEXT:"text",CHAR:"char",BOOLEAN:"boolean",VOID:"void"}),qt=n(19),jt=n.n(qt);function zt(e,t){e.popup({html:'<i class="ui icon inverted exclamation triangle yellow"></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;a<n;a++)i[a-2]=arguments[a];en("user_event",e,t,i)}function Zt(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];en("system_event",e,t,i)}function en(e,t,n,i){if(!Qt){var a={context:t,action:n,params:i};Xt.push([e,Date.now(),a])}}function tn(){return Xt}function nn(){return JSON.stringify(Xt)}function an(e){Xt=JSON.parse(e)}var rn=0;function on(e,t,n){e.name!=t&&(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)?!function(e){for(var t=0;t<window.program_obj.globals.length;t++)if(window.program_obj.globals[t].name==e)return!0;return!1}(t)?(Jt(e.name,Wt.RENAME_GLOBAL_VAR,t),e.name=t):zt(n.find(".editing_name_var"),ke.getUI("inform_valid_global_duplicated")):zt(n.find(".editing_name_var"),ke.getUI("inform_valid_name")))}function sn(e,t){var n=arguments.length>2&&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+='<div class="created_div_valor_var"><span class="span_value_variable simple_var">'+e.value.toFixed(1)+"</span> </div> ":e.type==Ht.BOOLEAN?n+='<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">'+ke.getUI("logic_value_".concat(e.value))+"</span> </div> ":n+='<div class="created_div_valor_var"><span class="span_value_variable simple_var">'+e.value+"</span> </div> ";else{if(n+='<table class="tabela_var">',1==e.dimensions){if(n+="<tr>",e.type==Ht.REAL)for(var i=0;i<e.columns;i++)n+='<td><span class="span_value_variable vector_var" data-index="'+i+'">'+e.value[i].toFixed(1)+"</span></td>";else for(i=0;i<e.columns;i++)e.type==Ht.BOOLEAN?n+='<td><span class="span_value_variable boolean_vector_var" data-index="'+i+'">'+ke.getUI("logic_value_".concat(e.value[i]))+"</span></td>":n+='<td><span class="span_value_variable vector_var" data-index="'+i+'">'+e.value[i]+"</span></td>";n+="</tr>",n+="</table>",n+='<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_vector_column"></i> <i class="ui icon plus square outline add_global_vector_column"></i></div>'}if(2==e.dimensions){if(e.type==Ht.REAL)for(var a=0;a<e.rows;a++){n+="<tr>";for(i=0;i<e.columns;i++)n+='<td><span class="span_value_variable matrix_var" data-index="'+i+'" data-row="'+a+'">'+e.value[a][i].toFixed(1)+"</span></td>";n+="</tr>"}else for(a=0;a<e.rows;a++){n+="<tr>";for(i=0;i<e.columns;i++)e.type==Ht.BOOLEAN?n+='<td><span class="span_value_variable boolean_matrix_var" data-index="'+i+'" data-row="'+a+'">'+ke.getUI("logic_value_".concat(e.value[a][i]))+"</span></td>":n+='<td><span class="span_value_variable matrix_var" data-index="'+i+'" data-row="'+a+'">'+e.value[a][i]+"</span></td>";n+="</tr>"}0==e.rows&&(n+="<tr><td></td></tr>"),n+='<tr><td colspan="'+e.columns+'" class="tr_manage_lines"><i class="ui icon minus square outline remove_global_matrix_line"></i> <i class="ui icon plus square outline add_global_matrix_line"></i></td></tr>',n+="</table>",n+='<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_matrix_column"></i> <i class="ui icon plus square outline add_global_matrix_column"></i></div>'}}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=$("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+e.value.toFixed(1)+"' />")).insertBefore(t.find(".span_value_variable")):(n=$("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+e.value+"' />")).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=$("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+e.value[t].toFixed(1)+"' />")).insertBefore(n.find(".span_value_variable")):(i=$("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+e.value[t]+"' />")).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<e.rows;t++)e.value[t].splice(e.value[t].length-1,1)}}(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(".add_global_matrix_column").on("click",(function(n){!function(e){if(e.columns++,e.type==Ht.INTEGER)for(var t=0;t<e.rows;t++)e.value[t].push(0);if(e.type==Ht.REAL)for(t=0;t<e.rows;t++)e.value[t].push(0);if(e.type==Ht.TEXT)for(t=0;t<e.rows;t++)e.value[t].push(ke.getUI("textvar_default_value"));if(e.type==Ht.BOOLEAN)for(t=0;t<e.rows;t++)e.value[t].push(!0);if(e.type==Ht.CHAR)for(t=0;t<e.rows;t++)e.value[t].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_line").on("click",(function(n){!function(e){0!=e.rows&&(e.rows--,e.value.splice(e.value.length-1,1))}(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(".add_global_matrix_line").on("click",(function(n){!function(e){if(e.rows++,e.type==Ht.INTEGER){for(var t=[],n=0;n<e.columns;n++)t.push(0);e.value.push(t)}if(e.type==Ht.REAL){t=[];for(n=0;n<e.columns;n++)t.push(0);e.value.push(t)}if(e.type==Ht.TEXT){t=[];for(n=0;n<e.columns;n++)t.push(ke.getUI("textvar_default_value"));e.value.push(t)}if(e.type==Ht.BOOLEAN){t=[];for(n=0;n<e.columns;n++)t.push(!0);e.value.push(t)}if(e.type==Ht.CHAR){t=[];for(n=0;n<e.columns;n++)t.push(ke.getUI("charvar_default_value"));e.value.push(t)}}(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(".boolean_matrix_var").on("click",(function(t){!function(e,t,n,i){e.value[t][n]=!e.value[t][n],$(i).find(".span_value_variable").text(ke.getUI("logic_value_".concat(e.value[t][n])))}(e,$(this).data("row"),$(this).data("index"),this.parentNode),Jt(e.name,Wt.CHANGE_GLOBAL_VALUE,e.value)})),n.find(".matrix_var").on("click",(function(t){Jt(e.name,Wt.ENTER_CHANGE_GLOBAL_VALUE),function(e,t,n,i){if(pn)return void _n.focus();var a;i=$(i),pn=!0,i.find(".span_value_variable").text(""),e.type==Ht.REAL?(a=$("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+e.value[t][n].toFixed(1)+"' />")).insertBefore(i.find(".span_value_variable")):(a=$("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+e.value[t][n]+"' />")).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=$("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+t.name+"' />");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='<div class="ui label global_container pink"><i class="ui icon ellipsis vertical inverted"></i><div class="global_const">const: ';for(var n in t+='<i class="ui icon toggle '+(e.is_constant?"on":"off")+' alternate_constant"></i></div>',t+='<div class="ui dropdown global_type">',1==e.dimensions?(t+='<div class="text">'+ke.getUI("vector")+": "+ke.getUI("type_".concat(e.type)),t+=' [ <span class="dimensions_0"></span> ] ',t+="</div>"):2==e.dimensions?(t+='<div class="text">'+ke.getUI("matrix")+": "+ke.getUI("type_".concat(e.type)),t+=' [ <span class="dimensions_0"></span> ] [ <span class="dimensions_1"></span> ] ',t+="</div>"):t+='<div class="text">'+ke.getUI("type_".concat(e.type.toLowerCase()))+"</div>",t+='<div class="menu">',Ht)n!=Ht.VOID.toUpperCase()&&(t+='<div class="item '+(e.type==n.toLowerCase()&&0==e.dimensions?" selected ":"")+'" data-type="'+n+'" >'+ke.getUI("type_".concat(n.toLowerCase()))+"</div>");for(var n in t+='<div class="item '+(1==e.dimensions?" selected ":"")+'"><i class="dropdown icon"></i>'+ke.getUI("vector")+'<div class="menu">',Ht)n!=Ht.VOID.toUpperCase()&&(t+='<div class="item '+(e.type==n.toLowerCase()&&1==e.dimensions?" selected ":"")+'" data-text="'+ke.getUI("vector")+":"+ke.getUI("type_".concat(n.toLowerCase()))+' [ ] " data-type="'+n+'" data-dimensions="1"> '+ke.getUI("type_".concat(n.toLowerCase()))+"</div>");for(var n in t+="</div></div>",t+='<div class="item '+(2==e.dimensions?" selected ":"")+'"><i class="dropdown icon"></i>'+ke.getUI("matrix")+'<div class="menu">',Ht)n!=Ht.VOID.toUpperCase()&&(t+='<div class="item '+(e.type==n.toLowerCase()&&2==e.dimensions?" selected ":"")+'" data-text="'+ke.getUI("matrix")+":"+ke.getUI("type_".concat(n.toLowerCase()))+' [ ] " data-type="'+n+'" data-dimensions="2"> '+ke.getUI("type_".concat(n.toLowerCase()))+"</div>");t+="</div></div>",t+='</div></div> <div class="editing_name_var"> <span class="span_name_variable enable_edit_name_parameter">'+e.name+'</span> </div> <span class="character_equals"> <&#8212; </span> ',t+='<div class="ui div_valor_var">'+e.value+"</div>",t+=' <i class="yellow inverted icon times remove_global"></i></div>';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<window.program_obj.functions.length;e++)Tr(window.program_obj.functions[e]);for(e=0;e<window.program_obj.globals.length;e++)dn(window.program_obj.globals[e]);setTimeout((function(){window.block_render=!1}),100),console.log("fim do render"),settingsFilter&&settingsFilter[0]&&blockAllEditingOptions()}}$.fn.textWidth=function(e,t){return $.fn.textWidth.fakeEl||($.fn.textWidth.fakeEl=$("<span>").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;n<t.parameters_list.length;n++)if(t.parameters_list[n].name==e)return!0;if(t.variables_list)for(n=0;n<t.variables_list.length;n++)if(t.variables_list[n].name==e)return!0;return!1}(t,i)?(Jt(i.name,Wt.RENAME_FUNCTION_VAR,e.name,t),e.name=t):zt(n.find(".editing_name_var"),ke.getError("inform_valid_variable_duplicated",[t,i.name])):zt(n.find(".editing_name_var"),ke.getError("inform_valid_identifier")))}function Yn(e,t,n){var i=arguments.length>3&&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=$("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+e.name+"' />")).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='<div class="ui label variable_container pink"><i class="ui icon ellipsis vertical inverted"></i>';for(var a in i+='<div class="ui dropdown variable_type">',1==t.dimensions?(i+='<div class="text">'+ke.getUI("vector")+": "+ke.getUI("type_".concat(t.type.toLowerCase())),i+=" [ ] </div>"):2==t.dimensions?(i+='<div class="text">'+ke.getUI("matrix")+": "+ke.getUI("type_".concat(t.type.toLowerCase())),i+=" [ ] [ ] </div>"):i+='<div class="text">'+ke.getUI("type_".concat(t.type.toLowerCase()))+"</div>",i+='<div class="menu">',Ht)a!=Ht.VOID.toUpperCase()&&(i+='<div class="item '+(t.type==a.toLowerCase()&&0==t.dimensions?" selected ":"")+'" data-type="'+a+'" >'+ke.getUI("type_".concat(a.toLowerCase()))+"</div>");for(var a in i+='<div class="item '+(1==t.dimensions?" selected ":"")+'"><i class="dropdown icon"></i>'+ke.getUI("vector")+'<div class="menu">',Ht)a!=Ht.VOID.toUpperCase()&&(i+='<div class="item '+(t.type==a.toLowerCase()&&1==t.dimensions?" selected ":"")+'" data-text="'+ke.getUI("vector")+":"+ke.getUI("type_".concat(a.toLowerCase()))+' [ ] " data-type="'+a+'" data-dimensions="1"> '+ke.getUI("type_".concat(a.toLowerCase()))+"</div>");for(var a in i+="</div></div>",i+='<div class="item '+(2==t.dimensions?" selected ":"")+'"><i class="dropdown icon"></i>'+ke.getUI("matrix")+'<div class="menu">',Ht)a!=Ht.VOID.toUpperCase()&&(i+='<div class="item '+(t.type==a.toLowerCase()&&2==t.dimensions?" selected ":"")+'" data-text="'+ke.getUI("matrix")+":"+ke.getUI("type_".concat(a.toLowerCase()))+' [ ] " data-type="'+a+'" data-dimensions="2"> '+ke.getUI("type_".concat(a.toLowerCase()))+"</div>");return i+="</div></div>",i+="</div></div> ",i+='<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">'+t.name+"</span> </div>",i+=' <span class="character_equals"> <&#8212; </span> <div class="ui div_valor_var">'+t.value+"</div>",i+=' <i class="yellow inverted icon times remove_variable"></i></div>',(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+='<div class="created_div_valor_var"><span class="span_value_variable simple_var">'+e.value.toFixed(1)+"</span> </div> ":e.type==Ht.BOOLEAN?i+='<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">'+ke.getUI("logic_value_".concat(e.value))+"</span> </div> ":i+='<div class="created_div_valor_var"><span class="span_value_variable simple_var">'+e.value+"</span> </div> ";else{if(i+='<table class="tabela_var">',1==e.dimensions){if(i+="<tr>",e.type==Ht.REAL)for(var a=0;a<e.columns;a++)i+='<td><span class="span_value_variable vector_var" data-index="'+a+'">'+e.value[a].toFixed(1)+"</span></td>";else for(a=0;a<e.columns;a++)e.type==Ht.BOOLEAN?i+='<td><span class="span_value_variable boolean_vector_var" data-index="'+a+'">'+ke.getUI("logic_value_".concat(e.value[a]))+"</span></td>":i+='<td><span class="span_value_variable vector_var" data-index="'+a+'">'+e.value[a]+"</span></td>";i+="</tr>",i+="</table>",i+='<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_vector_column"></i> <i class="ui icon plus square outline add_global_vector_column"></i></div>'}if(2==e.dimensions){if(e.type==Ht.REAL)for(var r=0;r<e.rows;r++){i+="<tr>";for(a=0;a<e.columns;a++)i+='<td><span class="span_value_variable matrix_var" data-index="'+a+'" data-row="'+r+'">'+e.value[r][a].toFixed(1)+"</span></td>";i+="</tr>"}else for(r=0;r<e.rows;r++){i+="<tr>";for(a=0;a<e.columns;a++)e.type==Ht.BOOLEAN?i+='<td><span class="span_value_variable boolean_matrix_var" data-index="'+a+'" data-row="'+r+'">'+ke.getUI("logic_value_".concat(e.value[r][a]))+"</span></td>":i+='<td><span class="span_value_variable matrix_var" data-index="'+a+'" data-row="'+r+'">'+e.value[r][a]+"</span></td>";i+="</tr>"}0==e.rows&&(i+="<tr><td></td></tr>"),i+='<tr><td colspan="'+e.columns+'" class="tr_manage_lines"><i class="ui icon minus square outline remove_global_matrix_line"></i> <i class="ui icon plus square outline add_global_matrix_line"></i></td></tr>',i+="</table>",i+='<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_matrix_column"></i> <i class="ui icon plus square outline add_global_matrix_column"></i></div>'}}$(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=$("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+e.value.toFixed(1)+"' />")).insertBefore(t.find(".span_value_variable")):(i=$("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+e.value+"' />")).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=$("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+e.value[t].toFixed(1)+"' />")).insertBefore(n.find(".span_value_variable")):(a=$("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+e.value[t]+"' />")).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<e.rows;t++)e.value[t].splice(e.value[t].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_matrix_column").on("click",(function(i){!function(e){if(e.columns++,e.type==Ht.INTEGER)for(var t=0;t<e.rows;t++)e.value[t].push(0);if(e.type==Ht.REAL)for(t=0;t<e.rows;t++)e.value[t].push(0);if(e.type==Ht.TEXT)for(t=0;t<e.rows;t++)e.value[t].push(ke.getUI("textvar_default_value"));if(e.type==Ht.BOOLEAN)for(t=0;t<e.rows;t++)e.value[t].push(!0);if(e.type==Ht.CHAR)for(t=0;t<e.rows;t++)e.value[t].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_line").on("click",(function(i){!function(e){if(0==e.rows)return;e.rows--,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_matrix_line").on("click",(function(i){!function(e){if(e.rows++,e.type==Ht.INTEGER){for(var t=[],n=0;n<e.columns;n++)t.push(0);e.value.push(t)}if(e.type==Ht.REAL){t=[];for(n=0;n<e.columns;n++)t.push(0);e.value.push(t)}if(e.type==Ht.TEXT){t=[];for(n=0;n<e.columns;n++)t.push(ke.getUI("textvar_default_value"));e.value.push(t)}if(e.type==Ht.BOOLEAN){t=[];for(n=0;n<e.columns;n++)t.push(!0);e.value.push(t)}if(e.type==Ht.CHAR){t=[];for(n=0;n<e.columns;n++)t.push(ke.getUI("charvar_default_value"));e.value.push(t)}}(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(".boolean_matrix_var").on("click",(function(t){!function(e,t,n,i){e.value[t][n]=!e.value[t][n],$(i).find(".span_value_variable").text(ke.getUI("logic_value_".concat(e.value[t][n])))}(e,$(this).data("row"),$(this).data("index"),this.parentNode),Jt(n,Wt.CHANGE_VAR_VALUE,e.name,e.value)})),$(i).find(".matrix_var").on("click",(function(t){Jt(n,Wt.ENTER_CHANGE_VAR_VALUE,e.name),function(e,t,n,i,a){if(li)return void ci.focus();var r;i=$(i),li=!0,i.find(".span_value_variable").text(""),e.type==Ht.REAL?(r=$("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+e.value[t][n].toFixed(1)+"' />")).insertBefore(i.find(".span_value_variable")):(r=$("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+e.value[t][n]+"' />")).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=$('<div class="lixeira" draggable="true"></div>');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<t.length&&"("==t[n-2]&&t[n+1].type_op&&t.splice(n+1,1),t.splice(n,1),t.splice(n-1,1),n-2<t.length&&"("==t[n-2]&&")"==t[n-1]&&(t.splice(n-1,1),t.splice(n-2,1),n-3>=0&&n-3<t.length&&t[n-3].type_op&&t.splice(n-3,1))):n<t.length-1&&t[n+1].type_op?(t.splice(n+1,1),t.splice(n,1)):n<t.length-1&&n>0&&"("==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<t.length-2&&t[n+2].type_op,t.splice(n+1,1),t.splice(n,1),t.splice(n-1,1))));else if(t[n].type_op);else{var a=-1,r=-1;if("("==t[n]){a=n;for(var o=n+1;o<t.length;o++)if(")"==t[o]){r=o;break}}else{r=n;for(o=n-1;o>=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<i.length;r++)if("var_value"==i[r].type){var o=$('<div class="single_element_expression" data-index="'+r+'"></div>');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=$('<div class="single_element_expression add_parentheses not_allowed"><img style="width: 15px; position: relative; top: 3px; left: 1px; height: 15px;" src="data:image/png;base64,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"></div>');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=$('<div class="floating_parenthesis"> ( </div>');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&&r<window.inserir_open)return;if(0==r){if("var_value"==a[r].type){"open"==window.open_or_close&&(window.open_parentheses.insertBefore(e),window.inserir_open=r);for(var o=0,s=0,l=0;l<a.length;l++)if("("==a[l]&&o++,")"==a[l]&&s++,o!=s);else{if(o>0){"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;l<a.length;l++)if("("==a[l]&&o++,")"==a[l]&&s++,o!=s);else{if(o>0){"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;c<a.length;c++)if("("==a[c]&&o++,")"==a[c]&&s++,o!=s);else if(o>0){"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=$('<div class="floating_parenthesis"> ) </div>')).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=$('<div class="single_element_expression parentheses_in_expression" data-index="'+a+'">'+t+"</div>");e.append(o)}function _i(e,t,n,i,a,r){var o='<div class="ui dropdown disabled usepointer"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';t.indexOf(Rn.exp_arithmetic)>=0&&(t.length>1?(o+='<div class="item"><i class="dropdown icon"></i>'+ke.getUI("text_arithmetic_expression")+'<div class="menu">',o+=vi(),o+="</div></div>"):o+=vi()),t.indexOf(Rn.exp_logic)>=0&&(t.length>1?(o+='<div class="item"><i class="dropdown icon"></i>'+ke.getUI("text_logic_expression")+'<div class="menu">',o+=hi(),o+="</div></div>"):o+=hi()),t.indexOf(Rn.exp_conditional)>=0&&(t.length>1?(o+='<div class="item"><i class="dropdown icon"></i>'+ke.getUI("text_relational_expression")+'<div class="menu">',o+=gi(),o+="</div></div>"):o+=gi()),o+="</div></div>",o=$(o);var s=$('<div class="single_element_expression ghost_element mouse_distance"></div>');s.append(o);var l=$('<div class="higher_element"></div>');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='<div class="ui dropdown disabled usepointer"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';t.indexOf(Rn.exp_arithmetic)>=0&&(t.length>1?(s+='<div class="item"><i class="dropdown icon"></i>'+ke.getUI("text_arithmetic_expression")+'<div class="menu">',s+=vi(),s+="</div></div>"):s+=vi()),t.indexOf(Rn.exp_logic)>=0&&(t.length>1?(s+='<div class="item"><i class="dropdown icon"></i>'+ke.getUI("text_logic_expression")+'<div class="menu">',s+=hi(),s+="</div></div>"):s+=hi()),t.indexOf(Rn.exp_conditional)>=0&&(t.length>1?(s+='<div class="item"><i class="dropdown icon"></i>'+ke.getUI("text_relational_expression")+'<div class="menu">',s+=gi(),s+="</div></div>"):s+=gi()),s+="</div></div>",s=$(s);var l=$('<div class="simple_add mouse_distance"></div>'),c=$('<div class="higher_element"></div>'),u=$('<button class="ui button green add_expression"><i class="plus circle inverted icon"></i></button>');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='<div class="ui dropdown"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';a.indexOf(Rn.exp_arithmetic)>=0&&(a.length>1?(s+='<div class="item"><i class="dropdown icon"></i>'+ke.getUI("text_arithmetic_expression")+'<div class="menu">',s+=vi(),s+="</div></div>"):s+=vi()),a.indexOf(Rn.write_sep)>=0&&(s+='<div class="item" data-type="'.concat(Rn.write_sep,'" data-value="').concat(Rn.write_sep,'">,</div>')),a.indexOf(Rn.exp_logic)>=0&&(a.length>1?(s+='<div class="item"><i class="dropdown icon"></i>'+ke.getUI("text_logic_expression")+'<div class="menu">',s+=hi(),s+="</div></div>"):s+=hi()),a.indexOf(Rn.exp_conditional)>=0&&(a.length>1?(s+='<div class="item"><i class="dropdown icon"></i>'+ke.getUI("text_relational_expression")+'<div class="menu">',s+=gi(),s+="</div></div>"):s+=gi()),s+="</div></div>",s=$(s);var l=$('<div class="single_element_expression not_allowed" data-index="'+r+'"></div>');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='<div class="item" data-type="'+Rn.exp_arithmetic+'" data-value="'+wn.plus+'">+</div>',e+='<div class="item" data-type="'+Rn.exp_arithmetic+'" data-value="'+wn.minus+'">-</div>',e+='<div class="item" data-type="'+Rn.exp_arithmetic+'" data-value="'+wn.multiplication+'">*</div>',e+='<div class="item" data-type="'+Rn.exp_arithmetic+'" data-value="'+wn.division+'">/</div>',e+='<div class="item" data-type="'+Rn.exp_arithmetic+'" data-value="'+wn.module+'">%</div>'}function hi(){var e;return e='<div class="item" data-type="'+Rn.exp_logic+'" data-value="'+An.equals_to+'">==</div>',e+='<div class="item" data-type="'+Rn.exp_logic+'" data-value="'+An.not_equals_to+'">!=</div>',e+='<div class="item" data-type="'+Rn.exp_logic+'" data-value="'+An.and+'">'+ke.getUI("logic_operator_and")+"</div>",e+='<div class="item" data-type="'+Rn.exp_logic+'" data-value="'+An.or+'">'+ke.getUI("logic_operator_or")+"</div>",e+='<div class="item" data-type="'+Rn.exp_logic+'" data-value="'+An.not+'">'+ke.getUI("logic_operator_not")+"</div>"}function gi(){var e;return e='<div class="item" data-type="'+Rn.exp_conditional+'" data-value="'+Tn.greater_than+'">></div>',e+='<div class="item" data-type="'+Rn.exp_conditional+'" data-value="'+Tn.less_than+'"><</div>',e+='<div class="item" data-type="'+Rn.exp_conditional+'" data-value="'+Tn.equals_to+'">==</div>',e+='<div class="item" data-type="'+Rn.exp_conditional+'" data-value="'+Tn.not_equals_to+'">!=</div>',e+='<div class="item" data-type="'+Rn.exp_conditional+'" data-value="'+Tn.greater_than_or_equals_to+'">>=</div>',e+='<div class="item" data-type="'+Rn.exp_conditional+'" data-value="'+Tn.less_than_or_equals_to+'"><=</div>'}function yi(e,t){var n=$('<div class="ui attribution command_container"><i class="ui icon small arrow left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_attributed"></div> <span class="text_attr_receives span_command_spec">'+ke.getUI("text_receives")+'</span> <div class="expression_elements"></div> </div>');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<r.length;o++){if($(r[o]).hasClass("command_container")){i=$(r[o]);break}if($(r[o]).hasClass("expression_elements")){a=$(r[o]);break}}i&&(a=i.find(".expression_elements")),a.text("");for(o=0;o<e.expression.length;o++){var s=$('<div class="expression_element"></div>');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='<div class="ui dropdown"><div class="text">';switch(i.itens[a]){case wn.plus:r+="+";break;case wn.minus:r+="-";break;case wn.multiplication:r+="*";break;case wn.division:r+="/";break;case wn.module:r+="%";break;case wn.none:r+="..."}r+='</div><div class="menu">',r+='<div class="item" data-value="'+wn.plus+'">+</div>',r+='<div class="item" data-value="'+wn.minus+'">-</div>',r+='<div class="item" data-value="'+wn.multiplication+'">*</div>',r+='<div class="item" data-value="'+wn.division+'">/</div>',r+='<div class="item" data-value="'+wn.module+'">%</div>',r+='<div class="item" data-value="'+wn.none+'" data-text="...">Nenhum</div>',r+="</div></div>",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=$('<div class="component_element"></div>'),r=$('<div class="component_element"></div>'),o=$('<div class="component_element"></div>');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=$('<div class="component_element"></div>');var s=$('<div class="component_element"></div>');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=$('<div class="component_element"> ( </div>'),c=(s=$('<div class="component_element"></div>'),$('<div class="component_element"> ) </div>'));n.append(l),n.append(s);for(var u=0;u<i.itens.length;u++)i.itens[u].type?Ni(e,i.itens[u],s,t,2,i):Ei(e,t,s,i.itens[u]);n.append(c)}}function Ri(e,t){var n="";n+='<div class="ui switch command_container"> <i class="ui icon small random command_drag" ></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span> '+ke.getUI("text_code_switch")+' ( <div class="ui variable_to_switch"></div> ) <div class="ui all_cases_div"></div></span>',n+="</div>";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<e.cases.length;a++)Ti(e.cases[a],e,t,i.find(".all_cases_div"));return i}function Ti(e,t,n,i){var a=$('<div class="ui case_div"><i class="ui icon times red button_remove_command"></i><span>'+ke.getUI("text_code_case")+'</span> <div class="ui variable_case"></div>: <div class="case_commands_block"></div></div>');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<e.commands_block.length;r++)aa(e.commands_block[r],$(a.find(".case_commands_block")[0]),3,n);a.find(".button_remove_command").on("click",(function(){for(var n=0;n<t.cases.length;n++)if(e==t.cases[n]){delete t.cases[n],t.cases.splice(n,1),a.remove();break}}))}function Ai(e,t,n,i){var a='<div class="ui dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';e.type==bn.repeatNtimes||e.type==bn.whiletrue||e.type==bn.dowhiletrue?a+='<a class="item" data-command="'+bn.break+'"><i class="download icon"></i> '+ke.getUI("btn_break")+" </a>":(a+='<a class="item" data-command="'+bn.break+'"><i class="download icon"></i> '+ke.getUI("btn_break")+" </a>",a+='<a class="item" data-command="'+bn.switchcase+'"><i class="download icon"></i> '+ke.getUI("btn_case")+" </a>"),a+="</div></div>",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='<div class="ui repeatNtimes command_container"> \n\t\t<i class="ui icon small sync command_drag"></i>\n\t\t<i class="ui icon times red button_remove_command"></i>\n\t\t<div class="ui context_menu"></div> <span class="span_command_spec"> '.concat(ke.getUI("text_for"),'\n\t\t</span> <div class="ui attribution_expression">\n\t\t<div class="ui variable_attribution"></div>\n\t\t<span class="text_receives span_command_spec" style="margin-left: 10px;margin-right: 20px;"></span>\n\t\t<div class="ui var_value_expression div_expression_st"></div>\n\t\t</div>\n\t\t<span class="span_command_spec separator_character" style="margin-left: 25px; margin-right: 15px;">\n\t\t').concat(ke.getUI("text_for_to"),' </span>\n\t\t<div class="conditional_expression"></div> <div class="pass_button"></div> \n\t\t<div class="ui incrementation_field"><span class="text_inc_receives span_command_spec"></span>\n\t\t<div class="ui first_operand"></div><div class="ui operator"></div>\n\t\t<div class="ui second_operand"></div></div> <span class="span_command_spec"> </span>\'');n+='<div class="ui block_commands">',n+="</div>",n+="<span> </span>",n+="</div>";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('<button class="ui">'+ke.getUI("text_for_pass")+'<i class="ui icon angle double left"></i></button>'),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('<button class="ui">'+ke.getUI("text_for_pass")+'<i class="ui icon angle double right"></i></button>'),i.find(".pass_button").find("button").on("click",(function(){Ii(e)}))),e.commands_block)for(var a=0;a<e.commands_block.length;a++)aa(e.commands_block[a],$(i.find(".block_commands")[0]),3,t);return i}function Ii(e){if(e.expression3)e.expression3=null;else{var t=new Fn(En.exp_op_exp,[e.var_attribution,wn.plus,new zn(Oi.all,"1",null,null,!0)]);e.expression3=t,e.var_incrementation=e.var_attribution}renderAlgorithm()}function Ci(e,t,n,i,a){var r=$('<div class="ui dropdown"><div class="text"></div></div>');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=$('<div class="parentheses_ghost">(</div>'),window.close_parentheses=$('<div class="parentheses_ghost">)</div>'),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='<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';if(t.variable_and_value==Oi.only_variable&&(o='<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_vars">',o+="</div>"),t.variable_and_value!=Oi.variable_and_function&&t.variable_and_value!=Oi.variable_and_value_opt&&t.variable_and_value!=Oi.all||(o+='<div class="item" data-option="'+Oi.only_variable+'"><i class="dropdown icon"></i>'+ke.getUI("variable"),o+='<div class="menu menu_only_vars">',o+="</div></div>"),t.variable_and_value==Oi.only_value&&(o='<input type="text" class="width-dynamic" size="'+a+'" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />'),t.variable_and_value!=Oi.variable_and_value_opt&&t.variable_and_value!=Oi.value_and_function&&t.variable_and_value!=Oi.all||(o+='<div class="item" data-option="'+Oi.only_value+'">'+ke.getUI("text_value")+"</div>"),t.variable_and_value==Oi.only_function&&(o='<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_functions">',o+="</div>"),t.variable_and_value!=Oi.variable_and_function&&t.variable_and_value!=Oi.value_and_function&&t.variable_and_value!=Oi.all||(o+='<div class="item" data-option="'+Oi.only_function+'"><i class="dropdown icon"></i>'+ke.getUI("btn_function"),o+='<div class="menu menu_only_functions">',o+="</div></div>"),o+="</div></div>",o=$(o),n.append(o),t.dom_object=o,Gi(e,t,n,o,i,r),Bi(i,o,t,r),Di(i,o,t,r),Fi(i,o,t,r),t.content||t.function_called){if(t.content){var s=$i(t.content,i);s?(t.content=s,Ui(i,o,t,n,e,r)):t.content&&t.content.type?(t.content=null,Li(t,o)):Ui(i,o,t,n,e,r)}else if(t.function_called){var l=Si(t.function_called);l?(t.function_called=l,Ui(i,o,t,n,e,r)):(t.content=null,t.row=null,t.column=null,delete t.function_called,delete t.parameters_list,Li(t,o))}}else Li(t,o)}function Li(e,t){switch(e.variable_and_value){case Oi.only_variable:t.find(".text").append("<i>"+ke.getUI("var_menu_select_var")+"</i>");break;case Oi.all:case Oi.variable_and_function:t.find(".text").append("<i>"+ke.getUI("var_menu_select_all")+"</i>");break;case Oi.only_function:t.find(".text").append("<i>"+ke.getUI("var_menu_select_function")+"</i>")}}function Si(e){if(e.name){if(window.program_obj.functions){for(var t=0;t<window.program_obj.functions.length;t++)if(window.program_obj.functions[t]==e)return window.program_obj.functions[t];for(t=0;t<window.program_obj.functions.length;t++)if(window.program_obj.functions[t].name==e.name)return window.program_obj.functions[t]}}else if(e.identifier)for(t=0;t<window.system_functions.length;t++)if(window.system_functions[t].identifier==e.identifier)return window.system_functions[t];return null}function $i(e,t){if(t.variables_list)for(var n=0;n<t.variables_list.length;n++)if(t.variables_list[n]==e)return t.variables_list[n];if(t.parameters_list)for(n=0;n<t.parameters_list.length;n++)if(t.parameters_list[n]==e)return t.parameters_list[n];if(window.program_obj.globals)for(n=0;n<window.program_obj.globals.length;n++)if(window.program_obj.globals[n]==e)return window.program_obj.globals[n];if(e){if(t.variables_list)for(n=0;n<t.variables_list.length;n++)if(t.variables_list[n].name==e.name)return t.variables_list[n];if(t.parameters_list)for(n=0;n<t.parameters_list.length;n++)if(t.parameters_list[n].name==e.name)return t.parameters_list[n];if(window.program_obj.globals)for(n=0;n<window.program_obj.globals.length;n++)if(window.program_obj.globals[n].name==e.name)return window.program_obj.globals[n]}return null}function Ui(e,t,n,i,a,r){n.function_called?(t.remove(),Mi(a,n,i,e,t,r)):(n.content.type,t.remove(),Mi(a,n,i,e,t,r))}function Mi(e,t,n,i,a,r){if(t.content||t.function_called){var o=$i(t.content,i);o?t.content=o:t.content&&t.content.type&&(t.content=null,Li(t,a))}else Li(t,a);if(null!=t.content||null!=t.function_called){if(t.function_called)if(null==t.function_called.parameters_list||0==t.function_called.length){a.find(".text").text(" "),n.find(".menu_var_or_value_dom").remove(),l=t.function_called.name?'<div class="parameters_function_called"> '+t.function_called.name+" <span> ( </span>":'<div class="parameters_function_called"> <i>'+ke.translateInternalFunction(t.function_called.identifier,t.function_called.category)+"</i> <span> ( </span>",l+="<span> ) </span></div>",l=$(l),n.append(l);var s='<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';s+='<div class="item" data-clear="true">'+ke.getUI("btn_clear")+"</div>",s+="</div></div>",(s=$(s)).insertAfter(n.find(".parameters_function_called")),s.dropdown({onChange:function(a,o,s){console.log("S1"),s.data("clear")&&(console.log("PP1"),n.text(""),t.content=null,t.row=null,t.column=null,delete t.function_called,delete t.parameters_list,Ni(e,t,n,i,2,r)),s.data("exp")&&xi(e,t,n,0,i,s,r)},selectOnKeydown:!1})}else{var l;a.find(".text").text(" "),n.find(".menu_var_or_value_dom").remove(),l=t.function_called.name?'<div class="parameters_function_called"> '+t.function_called.name+" <span> ( </span>":'<div class="parameters_function_called"> <i>'+ke.translateInternalFunction(t.function_called.identifier,t.function_called.category)+"</i> <span> ( </span>";for(var c=0;c<t.function_called.parameters_list.length;c++)l+='<div class="render_style_param parameter_'+c+'"></div>',c+1!=t.function_called.parameters_list.length&&(l+=" , ");l+="<span> ) </span></div>",l=$(l),n.append(l);for(c=0;c<t.function_called.parameters_list.length;c++)Ni(e,t.parameters_list[c],l.find(".parameter_"+c),i,2,r);s='<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';s+='<div class="item" data-clear="true">'+ke.getUI("btn_clear")+"</div>",s+="</div></div>",(s=$(s)).insertAfter(l),s.dropdown({onChange:function(a,o,s){console.log("S2"),s.data("clear")&&(console.log("PP2"),n.text(""),t.content=null,t.row=null,t.column=null,delete t.function_called,delete t.parameters_list,Ni(e,t,n,i,2,r)),s.data("exp")&&xi(e,t,n,0,i,s,r)},selectOnKeydown:!1})}else if(t.content.type){var u="";if(1==t.content.dimensions&&1!=t.dimensions){u='<div class="variable_rendered"> <span class="var_name">'+t.content.name+"</span>",u+=' <span>[ </span> <div class="column_container"></div> <span> ]</span>',u+="</div>",u=$(u),n.append(u);s='<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';s+='<div class="item" data-clear="true">'+ke.getUI("btn_clear")+"</div>",s+="</div></div>",s=$(s),u.append(s),s.dropdown({onChange:function(a,o,s){console.log("S3"),s.data("clear")&&(console.log("PP3"),n.text(""),t.content=null,t.row=null,t.column=null,delete t.function_called,delete t.parameters_list,Ni(e,t,n,i,2,r)),s.data("exp")&&xi(e,t,n,0,i,s,r)},selectOnKeydown:!1}),t.column||(t.column=new zn(Oi.all,null,null,null,!0)),Mi(e,t.column,$(u.find(".column_container")),i,a,r)}else if(2==t.content.dimensions&&2!=t.dimensions){u='<div class="variable_rendered"> <span class="var_name">'+t.content.name+"</span>",u+=' <span>[ </span> <div class="row_container"></div> <span> ]</span>',u+=' <span>[ </span> <div class="column_container"></div> <span> ] </span>',u+="</div>",u=$(u),n.append(u);s='<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';s+='<div class="item" data-clear="true">'+ke.getUI("btn_clear")+"</div>",s+="</div></div>",s=$(s),u.append(s),s.dropdown({onChange:function(a,o,s){console.log("S4"),s.data("clear")&&(console.log("PP4"),n.text(""),t.content=null,t.row=null,t.column=null,delete t.function_called,delete t.parameters_list,Ni(e,t,n,i,2,r)),s.data("exp")&&xi(e,t,n,0,i,s,r)},selectOnKeydown:!1}),t.column||(t.column=new zn(Oi.all,null,null,null,!0)),t.row||(t.row=new zn(Oi.all,null,null,null,!0)),Mi(e,t.row,$(u.find(".row_container")),i,a,r),Mi(e,t.column,$(u.find(".column_container")),i,a,r)}else{u='<div class="variable_rendered"> <span class="var_name">'+t.content.name+"</span>",u+="</div>",u=$(u),n.append(u);s='<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';s+='<div class="item" data-clear="true">'+ke.getUI("btn_clear")+"</div>",s+="</div></div>",s=$(s),u.append(s),s.dropdown({onChange:function(a,o,s){console.log("S5"),s.data("clear")&&(console.log("PP5"),n.text(""),t.content=null,t.row=null,t.column=null,delete t.function_called,delete t.parameters_list,Ni(e,t,n,i,2,r)),s.data("exp")&&xi(e,t,n,0,i,s,r)},selectOnKeydown:!1})}}else{u='<div class="variable_rendered"> <span class="var_name">'+t.content+"</span>";u+="</div>",u=$(u),n.append(u);s='<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';s+='<div class="item" data-clear="true">'+ke.getUI("btn_clear")+"</div>",s+="</div></div>",s=$(s),t.variable_and_value!=Oi.only_value&&s.insertAfter(u),s.dropdown({onChange:function(a,o,s){console.log("S6"),s.data("clear")&&(console.log("PP6"),n.text(""),t.content=null,t.row=null,t.column=null,delete t.function_called,delete t.parameters_list,n.find(".value_rendered").remove(),n.find(".context_menu_clear").remove(),n.find(".width-dynamic-minus").remove(),Ni(e,t,n,i,2,r)),s.data("exp")&&xi(e,t,n,0,i,s,r)},selectOnKeydown:!1}),u.on("click",(function(o){u.remove(),u.empty(),u.remove(),n.empty(),n.append('<span class="menu_var_or_value_dom"> </span>'),Pi(e,t,n,a,i,r)}))}}else Ni(e,t,n,i,2,r)}function Fi(e,t,n,i){var a=t.find(".menu_only_functions");a.append('<div class="divider"></div><div class="header">'+ke.getUI("text_header_ivprog_functions")+"</div>"),a.append('<div class="item"><i class="dropdown icon"></i>'+ke.getUI("text_menu_functions_math")+'<div class="menu menu_math_functions"></div></div>'),a.append('<div class="item"><i class="dropdown icon"></i>'+ke.getUI("text_menu_functions_text")+'<div class="menu menu_text_functions"></div></div>'),a.append('<div class="item"><i class="dropdown icon"></i>'+ke.getUI("text_menu_functions_array")+'<div class="menu menu_arrangement_functions"></div></div>'),a.append('<div class="item"><i class="dropdown icon"></i>'+ke.getUI("text_menu_functions_conversion")+'<div class="menu menu_conversion_functions"></div></div>');for(var r=0;r<window.system_functions.length;r++){var o=$('<div class="item"></div>');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.length;r++){var o=$('<div class="item" data-option="'+Oi.only_function+'">'+window.program_obj.functions[r].name+" </div>");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.length;o++){(s=$('<div class="item" data-option="'+Oi.only_variable+'">'+window.program_obj.globals[o].name+" </div>")).data("variable_reference",window.program_obj.globals[o]),a.append(s),r=!0}else for(o=0;o<window.program_obj.globals.length;o++){if(!window.program_obj.globals[o].is_constant)(s=$('<div class="item" data-option="'+Oi.only_variable+'">'+window.program_obj.globals[o].name+" </div>")).data("variable_reference",window.program_obj.globals[o]),a.append(s),r=!0}if(e.parameters_list)for(o=0;o<e.parameters_list.length;o++){(s=$('<div class="item" data-option="'+Oi.only_variable+'">'+e.parameters_list[o].name+" </div>")).data("variable_reference",e.parameters_list[o]),a.append(s),r=!0}if(e.variables_list)for(o=0;o<e.variables_list.length;o++){var s;(s=$('<div class="item" data-option="'+Oi.only_variable+'">'+e.variables_list[o].name+" </div>")).data("variable_reference",e.variables_list[o]),a.append(s),r=!0}r||(a.append($('<div class="header">'+ke.getUI("text_no_variable")+"</div>")),a.append($('<div class="item disabled">'+ke.getUI("text_no_variable_instruction")+"</div>")))}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?'<div class="parameters_function_called"> '+r.name+" <span> ( </span>":'<div class="parameters_function_called"> <i>'+ke.translateInternalFunction(r.identifier,r.category)+"</i> <span> ( </span>";for(var s=0;s<r.parameters_list.length;s++)u+='<div class="render_style_param parameter_'+s+'"></div>',s+1!=r.parameters_list.length&&(u+=" , ");u+="<span> ) </span></div>",u=$(u),n.append(u);for(s=0;s<r.parameters_list.length;s++){var l;l=r.parameters_list[s].dimensions>0?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='<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';c+='<div class="item" data-clear="true">'+ke.getUI("btn_clear")+"</div>",c+="</div></div>",(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?'<div class="parameters_function_called"> '+r.name+" <span> ( </span>":'<div class="parameters_function_called"> <i>'+ke.translateInternalFunction(r.identifier,r.category)+"</i> <span> ( </span>",u+="<span> ) </span></div>",u=$(u),n.append(u);c='<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';c+='<div class="item" data-clear="true">'+ke.getUI("btn_clear")+"</div>",c+="</div></div>",(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='<div class="variable_rendered"> <span class="var_name">'+r.name+"</span>";1==r.dimensions&&1!=t.dimensions&&(s+=' <span>[ </span> <div class="column_container"></div> <span> ]</span>');2==r.dimensions&&2!=t.dimensions&&(s+=' <span>[ </span> <div class="row_container"></div> <span> ]</span> ',s+=' <span>[ </span> <div class="column_container"></div> <span> ]</span>');s+="</div>",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='<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';l+='<div class="item" data-clear="true">'+ke.getUI("btn_clear")+"</div>",l+="</div></div>",(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('<span class="menu_var_or_value_dom"> </span>'),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=$('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');o.insertBefore(n.find(".menu_var_or_value_dom"));var s=$('<div class="value_rendered"></div>');s.insertBefore(o),o.focus(),o.val(t.content);var l='<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';l+='<div class="item" data-clear="true">'+ke.getUI("btn_clear")+"</div>",l+="</div></div>",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('<span class="menu_var_or_value_dom"> </span>'),Pi(e,t,n,i,a,r)}))}function Ki(e,t){var n=$('<div class="ui comment command_container"> <i class="ui icon small quote left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> <div class="div_comment_text"></div> </div>');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='<div class="ui reader command_container"> <i class="ui icon small download command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec">'+ke.getUI("text_command_read")+' ( </span> <div class="var_value_menu_div"></div> <span class="close_parentheses span_command_spec">)</span> </div>';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='<div class="ui writer command_container">\n <i class="ui icon small upload command_drag"></i>\n <i class="ui icon times red button_remove_command"></i>\n <span class="span_command_spec">'.concat(ke.getUI("text_command_write"),'\n ( </span><div class="all_elements_write"></div>\n <span class="close_parentheses span_command_spec">)</span>\n <img data-state="').concat(e.newline?"on":"false",'" src="').concat(e.newline?"img/new_line.svg":"img/no_new_line.svg",'" class="ivprog_newline_btn"/>\n </div>'),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+='<div class="ui iftrue command_container"><div class="ui data_block_if" data-if="true"> <i class="ui icon small random command_drag"></i> <i class="ui icon times red button_remove_command"></i>',n+='<span class="span_command_spec"> '+ke.getUI("text_if")+"</span>",n+=' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>',n+="<span> </span> ",n+='<div class="ui block_commands commands_if conditional_comands_block" data-if="true">',n+="</div></div>",n+='<div class="ui data_block_else" data-else="true"> <span class="span_command_spec"> '+ke.getUI("text_else")+" </span>",n+='<div class="ui block_commands commands_else conditional_comands_block" data-else="true">',n+="</div>",n+="<span></span></div>",n+="</div>";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<e.commands_block.length;a++)aa(e.commands_block[a],$(i.find(".commands_if")[0]),3,t);if(e.commands_else)for(a=0;a<e.commands_else.length;a++)aa(e.commands_else[a],$(i.find(".commands_else")[0]),3,t);return i}function zi(e,t){var n="";n+='<div class="ui whiletrue command_container"> <i class="ui icon small sync command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> '+ke.getUI("text_command_while")+" </span>",n+='<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>',n+=" </span>",n+='<div class="ui block_commands">',n+="</div>",n+="<span> </span>",n+="</div>";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<e.commands_block.length;a++)aa(e.commands_block[a],$(i.find(".block_commands")[0]),3,t);return i}function Xi(e,t){var n="";n+='<div class="ui dowhiletrue command_container"> <i class="ui icon small sync command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> '+ke.getUI("text_command_do")+" </span>",n+='<div class="ui block_commands" data-subblock="" data-idcommand="">',n+="</div>",n+=' <span class="span_command_spec"> '+ke.getUI("text_command_do_until")+' </span> <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>',n+="</div>";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<e.commands_block.length;a++)aa(e.commands_block[a],$(i.find(".block_commands")[0]),3,t);return i}function Qi(e,t){var n=$('<div class="ui functioncall command_container"> <i class="hand point right icon command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> </div>');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=$('<div class="ui comment command_container"> <i class="ui icon small quote left"></i> <i class="ui icon times red button_remove_command"></i> <span>'+ke.getUI("text_break")+"</span> </div>");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=$('<div class="ui return command_container"> <i class="ui icon small reply command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec"> '+ke.getUI("text_return")+' </span> <div class="expression_elements"></div></div>');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=$('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span> '+ke.getUI("text_break")+" </span></div>");break;case bn.comment:a=$('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span class="span_comment_text" "> '+ke.getUI("text_comment")+" </span></div>");break;case bn.reader:a=$('<div class="ui reader created_element"> <i class="ui icon small download"></i> <span> '+ke.getUI("text_command_read")+" var </span></div>");break;case bn.writer:a=$('<div class="ui writer created_element"> <i class="ui icon small upload"></i> <span> '+ke.getUI("text_command_write")+" var </span></div>");break;case bn.attribution:a=$('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x <&#8212; 1 + 1 </span></div>');break;case bn.iftrue:a=$('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');break;case bn.repeatNtimes:a=$('<div class="ui repeatNtimes created_element"> <i class="ui icon small sync"></i> <span> repita_para i de 0 ate 10 passo 1 <br> </span></div>');break;case bn.whiletrue:a=$('<div class="ui whiletrue created_element"> <i class="ui icon small sync"></i> <span> '+ke.getUI("text_command_while")+" ( x < 10 ) <br> </span></div>");break;case bn.dowhiletrue:a=$('<div class="ui dowhiletrue created_element"> <i class="ui icon small sync"></i> <span> '+ke.getUI("text_command_do")+" <br> "+ke.getUI("text_command_do_until")+"(x < 10) </span></div>");break;case bn.switch:a=$('<div class="ui switch created_element"> <i class="ui icon small random"></i> <span> '+ke.getUI("text_code_switch")+" ( x ) { <br> "+ke.getUI("text_code_case")+" 1: <br> "+ke.getUI("text_code_case")+" 2: <br> } </span></div>");break;case bn.functioncall:a=$('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');break;case bn.return:a=$('<div class="ui return created_element"> <i class="ui icon small reply"></i> <span> '+ke.getUI("text_return")+" </span></div>")}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<r.length;l++){var c=$(r[l]);if(c.hasClass("commands_list_div")&&(s=!0),c.data("fun")==e){o=!0;break}}if(!o)return void oa(n);if(!s)return void oa(n);var u=null;if(console.log("ev0"),void 0!==a.data("fun"))if(null==a.data("fun").commands||0==a.data("fun").commands.length){a.data("fun").commands=[];var d=ra(i);Jt(e.name,Wt.INSERT_COMMAND,i,"/",0),a.data("fun").commands.push(d),aa(d,$(t).find(".commands_list_div"),3,e)}else!function(e,t,n,i,a){for(var r,o=$(n).find("div.command_container"),s=999999999,l=null,c=0;c<o.length;c++)r=o[c].getBoundingClientRect().top,o[c].getBoundingClientRect().top+o[c].getBoundingClientRect().height,r-t.clientY<s&&(s=t.clientY-r,l=o[c]);if(l.parentNode.getBoundingClientRect().top+l.parentNode.getBoundingClientRect().height-t.clientY<s){var u=ra(a);i.commands.push(u),aa(u,n,3,i),Jt(i.name,Wt.INSERT_COMMAND,a,"/",i.commands.length-1)}else{u=ra(a);var d=i.commands.indexOf($(l).data("command"));d>-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;l<p.length;l++)void 0!==$(p[l]).data("command")&&u.push($(p[l]).data("command"));console.log("comando em que soltou: "),console.log(u[0]),console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");for(l=0;l<u.length;l++)console.log(u[l]);var _=!1;if(i==bn.break){for(l=0;l<u.length;l++)if(u[l].type==bn.repeatNtimes||u[l].type==bn.whiletrue||u[l].type==bn.dowhiletrue||u[l].type==bn.switch){_=!0;break}if(!_)return void console.error("Context not allowed to insert BREAK COMMAND!")}if(1==u.length){console.log("QQ1");var f=!1;for(l=0;l<p.length;l++)if(void 0!==$(p[l]).data("command")){console.log("QQ2"),da(p[l],n,e,i),f=!0;break}f||(console.log("QQ3"),da(a[0],n,e,i))}else if(console.log("QQ4"),void 0!==$(a).data("command"))console.log("QQ5"),console.log("PPP1"),la(a[0],n,e,i,p,u);else{console.log("QQ6");for(f=!1,l=0;l<p.length;l++)if(void 0!==$(p[l]).data("command")){console.log("QQ7"),la(p[l],n,e,i,p,u),f=!0;break}}}if(u){console.log("\n\n:::índices::\n\n");l=u.length-1;var m=window.program_obj.functions[window.program_obj.functions.indexOf(e)].commands.indexOf(u[l]),v=m+"-"+function(e,t,n){for(var i="",a=0;a<=t.length;a++)console.log("\n\n:: ",a,":\n",t[a]),i+=sa(t[a],t[a+1])+"-";return i}(m,u,e);Jt(e.name,Wt.INSERT_COMMAND,i,"/",v),console.log("\n\nfull path: \n\n",v),console.log("fim dos índices")}renderAlgorithm()}(e,t,i,n),$("body").off("mouseup"),$("body").off("mouseover")})),(!t.hasClass("function_div")||t.length<1)&&(window.mouse_event=i,t=$(i.originalEvent.srcElement.closest(".function_div"))),console.log("function_container",t),function_container_active=t,t.find(".commands_list_div").on("mousemove",(function(e){ia(e)})),t.find(".commands_list_div").find("*").on("mousemove",(function(e){ia(e)})),t.on("mouseout",(function(e){$(document.elementFromPoint(e.clientX,e.clientY)).closest(".commands_list_div").length<1&&window.ghostDiv.remove()})),a.css("position","absolute"),i.type="mousedown.draggable",i.target=a[0],a.css("left",i.pageX-window.divx),a.css("top",i.pageY),a.trigger(i)}function ea(e,t){$(".ghost_div").remove();var n=e.closest(".command_container");if(n.hasClass("switch")&&(n=$(t.target).closest(".case_div")),n.hasClass("dowhiletrue")||n.hasClass("iftrue")||n.hasClass("repeatNtimes")||n.hasClass("case_div")||n.hasClass("whiletrue"))if(null!=window.active_container&&(window.active_container.is(n)?console.log("é o mesmo, não mudou!"):n.length<1?(n=e.closest(".commands_list_div"),window.active_container.is(n)?console.log("é o mesmo command list"):(console.log("mudou para um command list"),window.active_container=n)):console.log("mudou para um outro container?")),window.active_container=n,n.hasClass("iftrue")){var i=n.find(".commands_if").get(0),a=n.find(".commands_else").get(0),r=Math.abs(t.clientY-i.getBoundingClientRect().top),o=(Math.abs(i.getBoundingClientRect().top+i.getBoundingClientRect().height-t.clientY),Math.abs(t.clientY-a.getBoundingClientRect().top)),s=Math.abs(a.getBoundingClientRect().top+a.getBoundingClientRect().height-t.clientY);r<o&&r<s?$(i).append(window.ghostDiv):$(a).append(window.ghostDiv)}else n.hasClass("case_div")?n.find(".case_commands_block").append(window.ghostDiv):n.find(".block_commands").append(window.ghostDiv);else ta(e,t)}function ta(e,t){$(".ghost_div").remove();var n,i=e.closest(".dowhiletrue, .iftrue, .repeatNtimes, .case_div, .whiletrue");if(i.length<1&&(i=e.closest(".commands_list_div"),window.active_container=i,na(e,t)),window.active_container=i,console.log("olha o container: ",i),i.hasClass("iftrue"))if($(t.target).closest(".data_block_if").length>0)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=o<s&&o<l?$(a).children(".command_container"):$(r).children(".command_container")}else n=i.hasClass("case_div")?i.children(".case_commands_block").children(".command_container"):i.hasClass("commands_list_div")?i.children(".command_container"):i.children(".block_commands").children(".command_container");for(var c=[],u=[],d=0;d<n.length;d++){var p=Math.abs(t.clientY-n.get(d).getBoundingClientRect().top);c.push(p);var _=Math.abs(n.get(d).getBoundingClientRect().top+n.get(d).getBoundingClientRect().height-t.clientY);u.push(_)}console.log("topDistances\n",c,"\nbottomDistances\n",u);var f=Math.min.apply(null,c),m=c.indexOf(f),v=Math.min.apply(null,u),h=u.indexOf(v);f<v?window.ghostDiv.insertBefore($(n.get(m))):window.ghostDiv.insertAfter($(n.get(h))),console.log("distancias: menorTop ",f," menorBot ",v)}function na(e,t){$(".ghost_div").remove();for(var n=e.closest(".commands_list_div").children(".command_container"),i=[],a=[],r=0;r<n.length;r++){var o=Math.abs(t.clientY-n.get(r).getBoundingClientRect().top);i.push(o);var s=Math.abs(n.get(r).getBoundingClientRect().top+n.get(r).getBoundingClientRect().height-t.clientY);a.push(s)}var l=Math.min.apply(null,i),c=i.indexOf(l),u=Math.min.apply(null,a),d=a.indexOf(u);l<u?window.ghostDiv.insertBefore($(n.get(c))):window.ghostDiv.insertAfter($(n.get(d)))}function ia(e){var t=$(e.target);t.hasClass("ghost_div")||(t.hasClass("commands_list_div")?na(t,e):t.hasClass("block_commands")?t.find(".command_container").length>0?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=$('<i class="ui icon trash alternate outline"></i>');$("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<e.cases.length;n++)if(e.cases[n].commands_block.indexOf(t)>=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<s.length;u++)o=s[u].getBoundingClientRect().top,s[u].getBoundingClientRect().top+s[u].getBoundingClientRect().height,o-t.clientY<l&&(l=t.clientY-o,c=s[u]);if(c.parentNode.getBoundingClientRect().top+c.parentNode.getBoundingClientRect().height-t.clientY<l){var d=ra(a);r.commands_block.push(d),aa(d,n,3,i)}else{d=ra(a);var p=r.commands_block.indexOf($(c).data("command"));p>-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<c.length;u++){void 0!==(d=$(c[u])).data("else")&&(l=!0),void 0!==d.data("command")&&(r=d.data("command"),s=d)}}for(c=a.parentsUntil(".command_container"),u=0;u<c.length;u++){void 0!==(d=$(c[u])).data("else")&&(l=!0)}if(r==o)for(c=a.parentsUntil(".command_container"),u=0;u<c.length;u++){if(void 0!==(d=$(c[u])).data("else")){l=!0;break}}if(r.type!=bn.iftrue&&r.type!=bn.switch){c=s.parentsUntil(".all_cases_div");console.log("vou procurar!!");for(u=0;u<c.length;u++){var d;if(console.log("estou vasculhando..."),void 0!==(d=$(c[u])).data("switchcase")){console.log("encontrei"),r=d.data("switchcase"),l=!1;break}}}console.log("debugging:"),console.log("el_jq"),console.log(a),console.log("command_parent"),console.log(r),console.log("command_target"),console.log(o);var p,_;_=e.getBoundingClientRect().top,p=e.getBoundingClientRect().top+e.getBoundingClientRect().height;var f=t.clientY-_,m=p-t.clientY;if(f<m){var v=ra(i);if(console.log("MMM1"),l){if(console.log("MMM2"),r==o){if(console.log("MMM3"),null==r.commands_else||0==r.commands_else.length){r.commands_else=[];v=ra(i);r.commands_else.push(v),aa(v,a,3,n)}else ua(a,t,n,i,!0);return}console.log("MMM7"),(h=r.commands_else.indexOf(o))>-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<o.length;s++)if(void 0!==$(o[s]).data("switchcase")){a=$(o[s]).data("switchcase"),r=$(o[s]);break}if(null==a.commands_block||a.commands_block.length<1){a.commands_block=[];var l=ra(n);a.commands_block.push(l),aa(l,r.find(".case_commands_block"),3,t)}else!function(e,t,n,i,a){for(var r,o=t.find("div.command_container"),s=999999999,l=null,c=0;c<o.length;c++)r=o[c].getBoundingClientRect().top,o[c].getBoundingClientRect().top+o[c].getBoundingClientRect().height,r-n.clientY<s&&(s=n.clientY-r,l=o[c]);if(l.parentNode.getBoundingClientRect().top+l.parentNode.getBoundingClientRect().height-n.clientY<s){var u=ra(a);e.commands_block.push(u),aa(u,$(t.find(".case_commands_block")[0]),3,i)}else{u=ra(a);var d=e.commands_block.indexOf($(l).data("command"));d>-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<s.length;u++)a=s[u].getBoundingClientRect().top,s[u].getBoundingClientRect().top+s[u].getBoundingClientRect().height,a-t.clientY<l&&(l=t.clientY-a,c=s[u]);var d=c.parentNode.getBoundingClientRect().top+c.parentNode.getBoundingClientRect().height;if(console.log("menor_distancia: "),console.log(c),d-t.clientY<l){console.log("QQ11");var p=ra(i),_=o.data("command");r?(console.log("QQ15"),_.commands_else.push(p),console.log("el_jq"),console.log(o),console.log("$(el_jq.find('.commands_else')[0]):: "),console.log($(o.find(".commands_else")[0])),aa(p,o,3,n)):(console.log("QQ16"),_.commands_block.push(p),aa(p,$(o.find(".block_commands")[0]),3,n))}else{console.log("QQ12");var f;p=ra(i),_=o.data("command");if(r)(f=_.commands_else.indexOf($(c).data("command")))>-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<c.length;u++){var d=$(c[u]);if(void 0!==d.data("if")){l=!0;break}if(void 0!==d.data("else")){l=!1;break}}if(l)if(null==r.commands_block||0==r.commands_block.length){r.commands_block=[];o=ra(i);r.commands_block.push(o),aa(o,a.find(".commands_if"),3,n)}else ua(a.find(".commands_if"),t,n,i);else if(null==r.commands_else||0==r.commands_else.length){r.commands_else=[];o=ra(i);r.commands_else.push(o),aa(o,a.find(".commands_else"),3,n)}else ua(a.find(".commands_else"),t,n,i,!0)}else console.log("está tentando inserir em um switch que está na raiz!"),ca(t,n,i)}(e,t,n,i)}var a,r;if(r=e.getBoundingClientRect().top,a=e.getBoundingClientRect().top+e.getBoundingClientRect().height,t.clientY-r<a-t.clientY){var o=ra(i);(s=n.commands.indexOf($(e).data("command")))>-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;t<window.program_obj.globals.length;t++){var n=window.program_obj.globals[t];switch(e+="\n\t",n.is_constant&&(e+="const "),n.type){case Ht.INTEGER:e+=ke.getUI("type_integer");break;case Ht.REAL:e+=ke.getUI("type_real");break;case Ht.TEXT:e+=ke.getUI("type_text");break;case Ht.BOOLEAN:e+=ke.getUI("type_boolean");break;case Ht.CHAR:e+=ke.getUI("type_char")}if(e+=" "+n.name+" ",1==n.dimensions)switch(e+="["+n.columns+"] ",n.type){case Ht.INTEGER:e+="<- {";for(var i=0;i<n.value.length;i++)e+=n.value[i],i+1<n.value.length&&(e+=", ");e+="}";break;case Ht.REAL:e+="<- {";for(var a=0;a<n.value.length;a++)e+=n.value[a].toFixed(2),a+1<n.value.length&&(e+=", ");e+="}";break;case Ht.TEXT:e+="<- {";for(var r=0;r<n.value.length;r++)e+='"'+n.value[r]+'"',r+1<n.value.length&&(e+=", ");e+="}";break;case Ht.BOOLEAN:e+="<- {";for(var o=0;o<n.value.length;o++)n.value[o]?e+=ke.getUI("logic_value_true"):e+=ke.getUI("logic_value_false"),o+1<n.value.length&&(e+=", ");e+="}";break;case Ht.CHAR:e+="<- {";for(var s=0;s<n.value.length;s++)e+="'"+n.value[s]+"'",s+1<n.value.length&&(e+=", ");e+="}"}else if(2==n.dimensions)switch(e+="["+n.rows+"]["+n.columns+"] ",n.type){case Ht.INTEGER:e+="<- {";for(var l=0;l<n.rows;l++){e+="{";for(var c=0;c<n.columns;c++)e+=n.value[l][c],c+1<n.columns&&(e+=", ");e+="}",l+1<n.rows&&(e+=", ")}e+="}";break;case Ht.REAL:e+="<- {";for(var u=0;u<n.rows;u++){e+="{";for(var d=0;d<n.columns;d++)e+=n.value[u][d].toFixed(2),d+1<n.columns&&(e+=", ");e+="}",u+1<n.rows&&(e+=", ")}e+="}";break;case Ht.TEXT:e+="<- {";for(var p=0;p<n.rows;p++){e+="{";for(var _=0;_<n.columns;_++)e+='"'+n.value[p][_]+'"',_+1<n.columns&&(e+=", ");e+="}",p+1<n.rows&&(e+=", ")}e+="}";break;case Ht.BOOLEAN:e+="<- {";for(var f=0;f<n.rows;f++){e+="{";for(var m=0;m<n.columns;m++)n.value[f][m]?e+=ke.getUI("logic_value_true"):e+=ke.getUI("logic_value_false"),m+1<n.columns&&(e+=", ");e+="}",f+1<n.rows&&(e+=", ")}e+="}";break;case Ht.CHAR:e+="<- {";for(var v=0;v<n.rows;v++){e+="{";for(var h=0;h<n.columns;h++)e+="'"+n.value[v][h]+"'",h+1<n.columns&&(e+=", ");e+="}",v+1<n.rows&&(e+=", ")}e+="}"}else switch(n.type){case Ht.INTEGER:e+="<- "+n.value;break;case Ht.REAL:e+="<- "+n.value.toFixed(2);break;case Ht.TEXT:e+='<- "'+n.value+'"';break;case Ht.BOOLEAN:e+="<- ",n.value?e+=ke.getUI("logic_value_true"):e+=ke.getUI("logic_value_false");break;case Ht.CHAR:e+="<- '"+n.value+"'"}}return e}(),e+="\n";for(var t=!1,n=0;n<window.program_obj.functions.length;n++){var i=_a(window.program_obj.functions[n]);null==i&&(t=!0),e+=i,e+="\n"}return e+="\n}",t?null:e}function _a(e){var t="\n\t"+ke.getUI("function")+" ";switch(e.return_type){case Ht.INTEGER:t+=ke.getUI("type_integer");break;case Ht.REAL:t+=ke.getUI("type_real");break;case Ht.TEXT:t+=ke.getUI("type_text");break;case Ht.BOOLEAN:t+=ke.getUI("type_boolean");break;case Ht.CHAR:t+=ke.getUI("type_char");break;case Ht.VOID:t+=ke.getUI("type_void")}t+=" ",1==e.return_dimensions?t+="[] ":2==e.return_dimensions&&(t+="[][] "),e.is_main?t+=ke.getUI("start"):t+=e.name,t+=" ( ";for(var n=0;n<e.parameters_list.length;n++)t+=Oa(e.parameters_list[n]),n+1<e.parameters_list.length&&(t+=", ");t+=" ) {";for(var i=0;i<e.variables_list.length;i++)t+=Na(e.variables_list[i]);for(var a=0;a<e.commands.length;a++)t+=fa(e.commands[a]);return t+="\n\t}"}function fa(e){var t=arguments.length>1&&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;i<t;i++)n+="\t";if(n+=ke.getUI("text_return"),e.variable_value_menu)try{n+=" "+Ra(e.variable_value_menu)}catch(e){}return n}function va(e,t){for(var n="\n",i=0;i<t;i++)n+="\t";return n+=ke.getUI("text_break")}function ha(e,t){for(var n="\n",i=0;i<t;i++)n+="\t";if(n+=ke.getUI("text_code_switch")+" ( ",n+=ka(e.variable),n+=" ) { ",e.cases)for(var a=0;a<e.cases.length;a++)n+=ga(e.cases[a],t+1);n+="\n";for(var r=0;r<t;r++)n+="\t";return n+="} "}function ga(e,t){for(var n="\n",i=0;i<t;i++)n+="\t";if(n+=ke.getUI("text_code_case")+" ",n+=ka(e.variable_value_menu),n+=" :",e.commands_block)for(var a=0;a<e.commands_block.length;a++)n+=fa(e.commands_block[a],t+1);return n}function ya(e,t){for(var n="\n",i=0;i<t;i++)n+="\t";if(n+=ke.getUI("text_for")+" ",e.var_attribution&&(n+=ka(e.var_attribution),n+=" ".concat(ke.getUI("text_code_for_from")," "),n+=ka(e.expression1)),e.expression2&&(n+=" ".concat(ke.getUI("text_code_for_to")," "),n+=ka(e.expression2)),e.expression3){switch(n+=" ".concat(ke.getUI("text_code_for_pass")," "),e.expression3.itens[1]){case wn.plus:n+=" +";break;case wn.minus:n+=" -"}n+=ka(e.expression3.itens[2])}if(n+=" { ",e.commands_block)for(var a=0;a<e.commands_block.length;a++)n+=fa(e.commands_block[a],t+1);n+="\n";for(var r=0;r<t;r++)n+="\t";return n+="}"}function xa(e,t){for(var n="\n",i=0;i<t;i++)n+="\t";if(n+=ke.getUI("text_if"),e.expression?(n+=" ( ",n+=Ra(e.expression),n+=" ) "):zt(e.expression.dom_object,ke.getUI("inform_valid_expression")),n+=" { ",e.commands_block)for(var a=0;a<e.commands_block.length;a++)n+=fa(e.commands_block[a],t+1);n+="\n";for(var r=0;r<t;r++)n+="\t";if(n+="} "+ke.getUI("text_else")+" {",e.commands_else)for(var o=0;o<e.commands_else.length;o++)n+=fa(e.commands_else[o],t+1);n+="\n";for(var s=0;s<t;s++)n+="\t";return n+="}"}function ba(e,t){for(var n="\n",i=0;i<t;i++)n+="\t";if(n+=ke.getUI("text_code_do")+" { ",e.commands_block)for(var a=0;a<e.commands_block.length;a++)n+=fa(e.commands_block[a],t+1);n+="\n";for(var r=0;r<t;r++)n+="\t";return n+="} "+ke.getUI("text_code_do_until"),e.expression||zt(e.expression.dom_object,ke.getUI("inform_valid_expression")),e.expression&&(n+=" ( ",n+=Ra(e.expression),n+=" ) "),n}function wa(e,t){for(var n="\n",i=0;i<t;i++)n+="\t";if(n+=ke.getUI("text_code_while"),e.expression||zt(e.expression.dom_object,ke.getUI("inform_valid_expression")),e.expression&&(n+=" ( ",n+=Ra(e.expression),n+=" ) "),n+=" { ",e.commands_block)for(var a=0;a<e.commands_block.length;a++)n+=fa(e.commands_block[a],t+1);n+="\n";for(var r=0;r<t;r++)n+="\t";return n+="}"}function Ea(e,t){for(var n="\n",i=0;i<t;i++)n+="\t";return n+=ka(e.variable)+" <- ",n+=Ra(e.expression)}function Ra(e){for(var t="",n=0;n<e.length;n++)if(e[n].type)t+=ka(e[n]);else if(e[n].type_op)switch(e[n].item){case wn.plus:t+=" + ";break;case wn.minus:t+=" - ";break;case wn.multiplication:t+=" * ";break;case wn.division:t+=" / ";break;case wn.module:t+=" % ";break;case An.equals_to:t+=" == ";break;case An.not_equals_to:t+=" != ";break;case An.and:t+=" "+ke.getUI("logic_operator_and")+" ";break;case An.or:t+=" "+ke.getUI("logic_operator_or")+" ";break;case An.not:t+=" "+ke.getUI("logic_operator_not")+" ";break;case Tn.greater_than:t+=" > ";break;case Tn.less_than:t+=" < ";break;case Tn.greater_than_or_equals_to:t+=" >= ";break;case Tn.less_than_or_equals_to:t+=" <= ";break;case Rn.write_sep:t+=", "}else t+=" "+e[n]+" ";return t}function Ta(e,t){for(var n="\n",i=0;i<t;i++)n+="\t";return n+=ka(e.function_called)}function Aa(e,t){for(var n="\n",i=0;i<t;i++)n+="\t";return n+=ke.getUI("text_command_read")+" ( ",n+=ka(e.variable_value_menu),n+=" ) "}function ka(e){var t=arguments.length>1&&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<e.parameters_list.length;i++)n+=ka(e.parameters_list[i]),i+1<e.parameters_list.length&&(n+=", ");n+=" )"}else e.content.type?(n+=e.content.name,1==e.content.dimensions&&1!=e.dimensions&&(n+=" [ "+ka(e.column)+" ] "),2==e.content.dimensions&&2!=e.dimensions&&(n+=" [ "+ka(e.row)+" ] ",n+=" [ "+ka(e.column)+" ] ")):isNaN(e.content)?n+='"'+e.content+'"':n+=e.content}catch(n){if(!t)throw zt(e.dom_object,ke.getUI("inform_valid_content")),n}return n}function Ia(e,t){for(var n="\n",i=0;i<t;i++)n+="\t";return n+=ke.getUI("text_command_write")+" ( ",n+=Ra(e.content),e.newline&&(n+=', "\\n"'),n+=" ) "}function Ca(e,t){for(var n="\n",i=0;i<t;i++)n+="\t";return n+="// ",n+=e.comment_text.content}function Oa(e){var t="";switch(e.type){case Ht.INTEGER:t+=" "+ke.getUI("type_integer")+" ";break;case Ht.REAL:t+=" "+ke.getUI("type_real")+" ";break;case Ht.TEXT:t+=" "+ke.getUI("type_text")+" ";break;case Ht.BOOLEAN:t+=" "+ke.getUI("type_boolean")+" ";break;case Ht.CHAR:t+=" "+ke.getUI("type_char")+" "}return t+=e.name+"",1==e.dimensions?t+=" []":2==e.dimensions&&(t+=" [][]"),t}function Na(e){var t="",n=e;switch(t+="\n\t\t",n.is_constant&&(t+="const "),n.type){case Ht.INTEGER:t+=ke.getUI("type_integer")+" ";break;case Ht.REAL:t+=ke.getUI("type_real")+" ";break;case Ht.TEXT:t+=ke.getUI("type_text")+" ";break;case Ht.BOOLEAN:t+=ke.getUI("type_boolean")+" ";break;case Ht.CHAR:t+=ke.getUI("type_char")+" "}if(t+=n.name+" ",1==n.dimensions)switch(t+="["+n.columns+"] ",n.type){case Ht.INTEGER:t+="<- {";for(var i=0;i<n.value.length;i++)t+=n.value[i],i+1<n.value.length&&(t+=", ");t+="}";break;case Ht.REAL:t+="<- {";for(var a=0;a<n.value.length;a++)t+=n.value[a].toFixed(2),a+1<n.value.length&&(t+=", ");t+="}";break;case Ht.TEXT:t+="<- {";for(var r=0;r<n.value.length;r++)t+='"'+n.value[r]+'"',r+1<n.value.length&&(t+=", ");t+="}";break;case Ht.BOOLEAN:t+="<- {";for(var o=0;o<n.value.length;o++)n.value[o]?t+=ke.getUI("logic_value_true"):t+=ke.getUI("logic_value_false"),o+1<n.value.length&&(t+=", ");t+="}";break;case Ht.CHAR:t+="<- {";for(var s=0;s<n.value.length;s++)t+="'"+n.value[s]+"'",s+1<n.value.length&&(t+=", ");t+="}"}else if(2==n.dimensions)switch(t+="["+n.rows+"]["+n.columns+"] ",n.type){case Ht.INTEGER:t+="<- {";for(var l=0;l<n.rows;l++){t+="{";for(var c=0;c<n.columns;c++)t+=n.value[l][c],c+1<n.columns&&(t+=", ");t+="}",l+1<n.rows&&(t+=", ")}t+="}";break;case Ht.REAL:t+="<- {";for(var u=0;u<n.rows;u++){t+="{";for(var d=0;d<n.columns;d++)t+=n.value[u][d].toFixed(2),d+1<n.columns&&(t+=", ");t+="}",u+1<n.rows&&(t+=", ")}t+="}";break;case Ht.TEXT:t+="<- {";for(var p=0;p<n.rows;p++){t+="{";for(var _=0;_<n.columns;_++)t+='"'+n.value[p][_]+'"',_+1<n.columns&&(t+=", ");t+="}",p+1<n.rows&&(t+=", ")}t+="}";break;case Ht.BOOLEAN:t+="<- {";for(var f=0;f<n.rows;f++){t+="{";for(var m=0;m<n.columns;m++)n.value[f][m]?t+=ke.getUI("logic_value_true"):t+=ke.getUI("logic_value_false"),m+1<n.columns&&(t+=", ");t+="}",f+1<n.rows&&(t+=", ")}t+="}";break;case Ht.CHAR:t+="<- {";for(var v=0;v<n.rows;v++){t+="{";for(var h=0;h<n.columns;h++)t+="'"+n.value[v][h]+"'",h+1<n.columns&&(t+=", ");t+="}",v+1<n.rows&&(t+=", ")}t+="}"}else switch(n.type){case Ht.INTEGER:t+="<- "+n.value;break;case Ht.REAL:t+="<- "+n.value.toFixed(2);break;case Ht.TEXT:t+='<- "'+n.value+'"';break;case Ht.BOOLEAN:t+="<- ",n.value?t+=ke.getUI("logic_value_true"):t+=ke.getUI("logic_value_false");break;case Ht.CHAR:t+="<- '"+n.value+"'"}return t}$.fn.textWidth=function(e,t){return $.fn.textWidth.fakeEl||($.fn.textWidth.fakeEl=$("<span>").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=$('<div class="ghost_div">'),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.index<e.input_list.length){var i=e.input_list[e.index];i.read=!0,e.index+=1,t(i.value)}else n(new Error(ke.getError("exceeded_input_request")))}))}},{key:"isInputAvailable",value:function(){return this.index<this.input_list.length}}]),n}(La);function Ua(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 Ma=function(e){c()(n,e);var t=Ua(n);function n(){var e;return a()(this,n),(e=t.call(this)).list=[],e.currentLine=null,e}return o()(n,[{key:"write",value:function(e){var t=arguments.length>1&&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,"&#x0020;&#x0020;")).replace(/\s/g,"&#x0020;")).length?t.currentLine=null:t.write(e,!0)})),0!=(a=(a=a.replace(/\t/g,"&#x0020;&#x0020;")).replace(/\s/g,"&#x0020;")).length&&this.write(a)}else n=(n=n.replace(/\t/g,"&#x0020;&#x0020;")).replace(/\s/g,"&#x0020;"),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(!(o<I+C)){var O=t.slice(0,I),N=t.slice(o-C);if(A===O&&k===N){var L=e.slice(I,r-C),S=t.slice(I,o-C);return qa(A,L,S,k)}}}return null}(e,t,n);if(a)return a}var r=Ba(e,t),o=e.substring(0,r);r=Ga(e=e.substring(r),t=t.substring(r));var s=e.substring(e.length-r),l=function(e,t){var n;if(!e)return[[1,t]];if(!t)return[[-1,e]];var i=e.length>t.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<n.length)return null;function a(e,t,n){for(var i,a,r,o,s=e.substring(n,n+Math.floor(e.length/4)),l=-1,c="";-1!==(l=t.indexOf(s,l+1));){var u=Ba(e.substring(n),t.substring(l)),d=Ga(e.substring(0,n),t.substring(0,l));c.length<d+u&&(c=t.substring(l-d,l)+t.substring(l,l+u),i=e.substring(0,n-d),a=e.substring(n+u),r=t.substring(0,l-d),o=t.substring(l+u))}return 2*c.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;c<o;c++)s[c]=-1,l[c]=-1;s[r+1]=0,l[r+1]=0;for(var u=n-i,d=u%2!=0,p=0,_=0,f=0,m=0,v=0;v<a;v++){for(var h=-v+p;h<=v-_;h+=2){for(var g=r+h,y=void 0,x=(y=h===-v||h!==v&&s[g-1]<s[g+1]?s[g+1]:s[g-1]+1)-h;y<n&&x<i&&e.charAt(y)===t.charAt(x);)y++,x++;if(s[g]=y,y>n)_+=2;else if(x>i)p+=2;else if(d){var b=r+u-h;if(b>=0&&b<o&&-1!==l[b]){var w=n-l[b];if(y>=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]<l[R+1]?l[R+1]:l[R-1]+1)-E;T<n&&A<i&&e.charAt(n-T-1)===t.charAt(i-A-1);)T++,A++;if(l[R]=T,T>n)m+=2;else if(A>i)f+=2;else if(!d){var k=r+u-E;if(k>=0&&k<o&&-1!==s[k]){var I=s[k],C=r+I-k;if(I>=(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<t.length;)if(r<t.length-1&&!t[r][1])t.splice(r,1);else switch(t[r][0]){case 1:s++,c+=t[r][1],r++;break;case-1:o++,l+=t[r][1],r++;break;case 0:if(a=r-s-o-1,n){if(a>=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(r<t.length-1&&!t[r][1]){t.splice(r,1);break}if(l.length>0||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<t.length-1;)0===t[r-1][0]&&0===t[r+1][0]&&(t[r][1].substring(t[r][1].length-t[r-1][1].length)===t[r-1][1]?(t[r][1]=t[r-1][1]+t[r][1].substring(0,t[r][1].length-t[r-1][1].length),t[r+1][1]=t[r-1][1]+t[r+1][1],t.splice(r-1,1),f=!0):t[r][1].substring(0,t[r+1][1].length)==t[r+1][1]&&(t[r-1][1]+=t[r+1][1],t[r][1]=t[r][1].substring(t[r+1][1].length)+t[r+1][1],t.splice(r+1,1),f=!0)),r++;f&&e(t,n)}(l,i),l}function Da(e,t,n,i){var a=e.substring(0,n),r=t.substring(0,i),o=e.substring(n),s=t.substring(i),l=Fa(a,r),c=Fa(o,s);return l.concat(c)}function Ba(e,t){if(!e||!t||e.charAt(0)!==t.charAt(0))return 0;for(var n=0,i=Math.min(e.length,t.length),a=i,r=0;n<a;)e.substring(r,a)==t.substring(r,a)?r=n=a:i=a,a=Math.floor((i-n)/2+n);return Pa(e.charCodeAt(a-1))&&a--,a}function Ga(e,t){if(!e||!t||e.slice(-1)!==t.slice(-1))return 0;for(var n=0,i=Math.min(e.length,t.length),a=i,r=0;n<a;)e.substring(e.length-a,e.length-r)==t.substring(t.length-a,t.length-r)?r=n=a:i=a,a=Math.floor((i-n)/2+n);return Ka(e.charCodeAt(e.length-a))&&a--,a}function Pa(e){return e>=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;n<e.length;n++)e[n][1].length>0&&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"<!DOCTYPE html>\n <html>\n <head>\n <meta http-equiv='content-type' content='text/html; charset=UTF-8'>\n <link rel='stylesheet' href='css/ivprog-assessment.css' type='text/css'/>\n </head>\n <body>\n :assessment-result:\n </body>\n </html>"}},{key:"DETAIL_TEMPLATE",get:function(){return"<div class='details-body'>\n <div class='details-header'>\n <h2>:test-name:</h2>\n <p>:time-label:: <span>:time:ms</span></p>\n <p>:grade-label:: <span>:grade:%</span></p>\n </div>\n <div>\n <h3>:input-label:</h3>\n <ul>\n <li>:input-list:</li>\n </ul>\n </div>\n <div>\n <h3>:output-label:</h3>\n :output-result:\n </div>\n </div>"}},{key:"OUPUT_TABLE_TEMPLATE",get:function(){return"<div class='detaisl-div-table'>\n <table class='assessment-output-table'>\n <tr>\n <th>:expected-label:</th>\n <th>:generated-label:</th>\n <th>:result-label:</th>\n </tr>\n :results:\n </table>\n </div>"}},{key:"OUTPUT_TEMPLATE",get:function(){return"<tr><td class=':class-expected:'>$0</td>\n <td class=':class-generated:'>$1</td>\n <td class=':class-result:'>$2</td></tr>"}},{key:"EMPTY_OUTPUT_TEMPLATE",get:function(){return"<div class='assessment-popup'><img class='assessment-empty-output' src='img/empty.svg'>\n <span class='assessment-popuptext'>$0</span></div>"}},{key:"FAILED_TEMPLATE",get:function(){return"<p class='assessment-failed-execution'><span class='assessment-failed-case'>✗</span>$0</p>"}},{key:"INPUT_INFO_TEMPLATE",get:function(){return"<span class='$0'>$1</span>"}}]),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(/> *</g,"><")}},{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","<span class='assessment-failed-case'>✗</span>"+l)).replace(":class-result:","assessment-string-diff")}return i}},{key:"getDiffStringStyle",value:function(e,t){var n="<span class='$0'>$1</span>";switch(e=e.replace(/\s/g,"&#160;"),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<e.expected_output.length;++l){var c=e.expected_output[l];s.push(new Ya(c,null,0,e.getPotentialOutputType(c)))}}else 0==e.expected_output.length&&e.expected_output.length==i.list.length&&s.push(new Ya("","",1,"string"));return new Xa(e.name,0,n.input_list,s,r,o)})).catch((function(i){return new Xa(e.name,1,n.input_list,null,null,null,t.getErrorMessage("test_case_exception",e.name+1,i.message))}))}},{key:"getPotentialOutputType",value:function(t){return e.NUM_REGEX.test(t)?"number":e.BOOLEAN_REGEX.test(t)?"bool":"string"}},{key:"outputMatch",value:function(t,n){if(e.NUM_REGEX.test(n)){if(!e.NUM_REGEX.test(t))return this.checkStrings(t,n);var i=new oe.Decimal(t),a=new oe.Decimal(n);return this.checkNumbers(i,a)}if(e.BOOLEAN_REGEX.test(n)){if(!e.BOOLEAN_REGEX.test(t))return this.checkStrings(t,n);var r=de(t),o=de(n);return this.checkBoolean(r,o)}return this.checkStrings(t,n)}},{key:"checkNumbers",value:function(e,t){var n=Math.min(t.dp(),b.Config.decimalPlaces);e=new oe.Decimal(e.toFixed(n,oe.Decimal.ROUND_FLOOR)),t=new oe.Decimal(t.toFixed(n,oe.Decimal.ROUND_FLOOR));var i=e.eq(t)?1:0;return Qa(t.toNumber(),e.toNumber(),i)}},{key:"checkBoolean",value:function(e,t){var n=e==t?1:0,i=pe(e);return Wa(pe(t),i,n)}},{key:"checkStrings",value:function(t,n){var i=this,a=[],r=n.trim(),o=t.trim();if(e.NUM_IN_STRING_REGEX.test(n)){var s=n.match(e.NUM_IN_STRING_REGEX),l=t.match(e.NUM_IN_STRING_REGEX)||[],c=l.map((function(e,t){if(t>=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<s.length;++u)c.push(Qa(s[u],null,0));r=r.replace(e.NUM_IN_STRING_REGEX,""),o=o.replace(e.NUM_IN_STRING_REGEX,"");var d=c.reduce((function(e,t){return e+t.grade}),0)/c.length;a.push(d)}if(e.BOOLEAN_IN_STRING_REGEX.test(n)){var p=n.match(e.BOOLEAN_IN_STRING_REGEX),_=t.match(e.BOOLEAN_IN_STRING_REGEX)||[],f=_.map((function(e,t){if(t>=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;m<p.length;++m)f.push(Wa(p[m],null,0));r=r.replace(e.BOOLEAN_IN_STRING_REGEX,""),o=o.replace(e.BOOLEAN_IN_STRING_REGEX,"");var v=f.reduce((function(e,t){return e+t.grade}),0)/f.length;a.push(v)}var h=function(e,t){if(0==e.length)return t.length;if(0==t.length)return e.length;var n,i,a=[];for(n=0;n<=t.length;n++)a[n]=[n];for(i=0;i<=e.length;i++)a[0][i]=i;for(n=1;n<=t.length;n++)for(i=1;i<=e.length;i++)t.charCodeAt(n-1)==e.charCodeAt(i-1)?a[n][i]=a[n-1][i-1]:a[n][i]=Math.min(a[n-1][i-1]+1,Math.min(a[n][i-1]+1,a[n-1][i]+1));return a[t.length][e.length]}(o,r),g=Math.max(0,r.length-h)/r.length;g=Number.isNaN(g)?0:g;var y=a.length+1,x=a.reduce((function(e,t){return e+t/y}),0);return new Ya(n,t,1*(g/y+x),"string")}},{key:"getErrorMessage",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Ja.getError(e,n)}}]),e}(),er=Ce(),tr=x.a.StringTypes,nr={max_instruction_count:350250,suspend_threshold:200},ir=function(){function e(t,n,i){a()(this,e),this.ast_code=t,this.testCases=n,this.domConsole=i,this.old_config=JSON.parse(JSON.stringify(b.Config)),b.Config.setConfig(nr)}return o()(e,[{key:"runTest",value:function(){var e=this;try{var t=this.testCases.map((function(t,n){return new Za(new Gt(e.ast_code),t.input,t.output,n)})).map((function(e){return e.eval()}));return Promise.all(t).then((function(t){for(var n=0,i=0;i<t.length;i+=1){var a=t[i];n+=a.grade,1==a.grade?e.writeToConsole(Pt.INFO,tr.MESSAGE,"test_case_success",a.name+1,a.generateOutput()):1==a.status?e.writeToConsole(Pt.ERR,tr.ERROR,"test_case_failed_exception",a.name+1,a.error_msg,a.generateOutput()):e.writeToConsole(Pt.ERR,tr.ERROR,"test_case_failed",a.name+1,a.generateOutput())}var r=1==(n/=t.length)?Pt.INFO:Pt.ERR;return e.writeToConsole(r,tr.MESSAGE,"test_suite_grade",(100*n).toFixed(2)),n}))}catch(e){return this.showErrorMessage(Pt.ERR,tr.MESSAGE,"unexpected_execution_error"),this.domConsole.err(e.message),Promise.resolve(0)}finally{b.Config.setConfig(this.old_config)}}},{key:"showErrorMessage",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];this.domConsole.err(er.getError(e,n))}},{key:"showInfoMessage",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];this.domConsole.info(er.getMessage(e,n))}},{key:"writeToConsole",value:function(e,t,n){for(var i=er.getString(n,t),a=arguments.length,r=new Array(a>3?a-3:0),o=3;o<a;o++)r[o-3]=arguments[o];i=er.processString(i,r),this.domConsole.writeRawHTML(i,e)}}]),e}(),ar=n(70),rr=n(34);n(106),n(107),n(108);!function(e){function t(e,t,n,i,a,r){this.indented=e,this.column=t,this.type=n,this.info=i,this.align=a,this.prev=r}function n(e,n,i,a){var r=e.indented;return e.context&&"statement"==e.context.type&&"statement"!=i&&(r=e.context.indented),e.context=new t(r,n,i,a,null,e.context)}function i(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}function a(e,t,n){return"variable"==t.prevToken||"type"==t.prevToken||(!!/\S(?:[^- ]>|[*\]])\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.length;++i)t[n[i]]=!0;return t}e.defineMode("ivprog",(function(l,c){var u,d,p=l.indentUnit,_=c.statementIndentUnit||p,f=c.dontAlignCalls,m=c.keywords||{},v=c.switchKeyword,h=c.caseKeyword,g=c.defaultKeyword,y=new RegExp("^\\s*(?:".concat(h," .*?:|").concat(g,":|\\{\\}?|\\})$")),x=c.types||{},b=c.builtin||{},w=c.blockKeywords||{},E=c.defKeywords||{},R=c.atoms||{},T=c.hooks||{},A=c.multiLineStrings,k=/[[\]{}(),;:\n]/,I=/[\d.]/,C=/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)$/i,O=/[+\-*%=<>!/&]/,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;c<l.length;++c){var u="logic_operator_".concat(l[c]),d=ke.getUI(u);It.push(d),n.push(d)}return{case_default:e,atoms:a,keywords:n,switchString:r,types:i,blocks:t}}(),u=c.keywords.join(" "),d=l(c.types.join(" ")),p=c.blocks.join(" ");!function(t,n){"string"==typeof t&&(t=[t]);var i=[];function a(e){if(e)for(var t in e)Object.hasOwnProperty.call(e,t)&&i.push(t)}a(n.keywords),a(n.types),a(n.builtin),a(n.atoms),i.length&&(n.helperType=t[0],e.registerHelper("hintWords",t[0],i));for(var r=0;r<t.length;++r)e.defineMIME(t[r],n)}(["text/x-ivprog"],{name:"ivprog",keywords:l(u),types:function(e){return o(d,e)},blockKeywords:l(p),defKeywords:l("funcao const"),typeFirstDefinitions:!0,atoms:l(c.atoms.join(" ")),switchKeyword:c.switchString,caseKeyword:c.case_default[0],defaultKeyword:c.case_default[1],modeProps:{fold:["brace"]}})}(rr);var or=null;function sr(){or.refresh()}function lr(e){or.setValue(e)}function cr(){return or.getValue()}var ur=0,dr=0,pr=ar.version,_r=[],fr=[],mr=null,vr=null,hr=[],gr=!1;window.studentGrade=null,window.LocalizedStrings=ke;var yr=new Xn;window.system_functions=[],window.system_functions.push(new On("$sin",Ht.REAL,0,[new zn(Oi.all,null,null,null,!0)],null,kn.math)),window.system_functions.push(new On("$cos",Ht.REAL,0,[new zn(Oi.all,null,null,null,!0)],null,kn.math)),window.system_functions.push(new On("$tan",Ht.REAL,0,[new zn(Oi.all,null,null,null,!0)],null,kn.math)),window.system_functions.push(new On("$sqrt",Ht.REAL,0,[new zn(Oi.all,null,null,null,!0)],null,kn.math)),window.system_functions.push(new On("$pow",Ht.REAL,0,[new zn(Oi.all,null,null,null,!0),new zn(Oi.all,null,null,null,!0)],null,kn.math)),window.system_functions.push(new On("$log",Ht.REAL,0,[new zn(Oi.all,null,null,null,!0)],null,kn.math)),window.system_functions.push(new On("$abs",Ht.REAL,0,[new zn(Oi.all,null,null,null,!0)],null,kn.math)),window.system_functions.push(new On("$negate",Ht.REAL,0,[new zn(Oi.all,null,null,null,!0)],null,kn.math)),window.system_functions.push(new On("$invert",Ht.REAL,0,[new zn(Oi.all,null,null,null,!0)],null,kn.math)),window.system_functions.push(new On("$max",Ht.REAL,0,[new zn(Oi.all,null,null,null,!0)],null,kn.math)),window.system_functions.push(new On("$min",Ht.REAL,0,[new zn(Oi.all,null,null,null,!0)],null,kn.math)),window.system_functions.push(new On("$rand",Ht.REAL,0,[],null,kn.math)),window.system_functions.push(new On("$substring",Ht.TEXT,0,[new zn(Oi.all,null,null,null,!0),new zn(Oi.all,null,null,null,!0),new zn(Oi.all,null,null,null,!0)],null,kn.text)),window.system_functions.push(new On("$length",Ht.INTEGER,0,[new zn(Oi.all,null,null,null,!0)],null,kn.text)),window.system_functions.push(new On("$uppercase",Ht.TEXT,0,[new zn(Oi.all,null,null,null,!0)],null,kn.text)),window.system_functions.push(new On("$lowercase",Ht.TEXT,0,[new zn(Oi.all,null,null,null,!0)],null,kn.text)),window.system_functions.push(new On("$charAt",Ht.CHAR,0,[new zn(Oi.all,null,null,null,!0),new zn(Oi.all,null,null,null,!0)],null,kn.text)),window.system_functions.push(new On("$numElements",Ht.INTEGER,0,[new zn(Oi.variable_and_function,null,null,null,!0,1)],null,kn.arrangement)),window.system_functions.push(new On("$matrixLines",Ht.INTEGER,0,[new zn(Oi.variable_and_function,null,null,null,!0,2)],null,kn.arrangement)),window.system_functions.push(new On("$matrixColumns",Ht.INTEGER,0,[new zn(Oi.variable_and_function,null,null,null,!0,2)],null,kn.arrangement)),window.system_functions.push(new On("$isReal",Ht.BOOLEAN,0,[new zn(Oi.all,null,null,null,!0)],null,kn.conversion)),window.system_functions.push(new On("$isInt",Ht.BOOLEAN,0,[new zn(Oi.all,null,null,null,!0)],null,kn.conversion)),window.system_functions.push(new On("$isBool",Ht.BOOLEAN,0,[new zn(Oi.all,null,null,null,!0)],null,kn.conversion)),window.system_functions.push(new On("$castReal",Ht.REAL,0,[new zn(Oi.all,null,null,null,!0)],null,kn.conversion)),window.system_functions.push(new On("$castInt",Ht.INTEGER,0,[new zn(Oi.all,null,null,null,!0)],null,kn.conversion)),window.system_functions.push(new On("$castBool",Ht.BOOLEAN,0,[new zn(Oi.all,null,null,null,!0)],null,kn.conversion)),window.system_functions.push(new On("$castString",Ht.TEXT,0,[new zn(Oi.all,null,null,null,!0)],null,kn.conversion)),window.system_functions.push(new On("$castChar",Ht.CHAR,0,[new zn(Oi.all,null,null,null,!0)],null,kn.conversion)),console.log(" ___ ___ ________ \n / / / / / ____/ \n / / / / / / \n / / / / ______ ___ / /__ \n / / / / / \\ / / / ___/ \n / /______ / / / /\\ \\/ / / / \n / / / / / / \\ / / /____ \n/__________/ /___/ /___/ \\___/ /________/ \n\n Laboratório de Informática na Educação\n http://line.ime.usp.br");var xr=new Cn(ke.getUI("start"),Ht.VOID,0,[],!0,!1);function br(e,t){var n=arguments.length>2&&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=$("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+e.name+"' />")).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='<div class="ui secondary segment function_div list-group-item function_cont_'+Rr+'">';e.function_comment,t+='<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>',t+=(e.is_main?'<div class="div_start_minimize_v"> </div>':'<button class="ui icon button large remove_function_button"><i class="red icon times"></i></button>')+'<button class="ui icon button tiny minimize_function_button"><i class="icon window minimize"></i></button>',t+='<div class="function_signature_div">'+ke.getUI("function")+" ",e.is_main?t+='<div class="function_name_div"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '+ke.getUI("type_void")+' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="span_name_function" >'+e.name+'</span> </div> <span class="parethesis_function">( </span> <div class="ui large labels parameters_list">':(t+='<div class="ui function_return"></div>',t+='<div class="function_name_div function_name_div_updated"><span class="span_name_function name_function_updated">'+e.name+'</span> </div> <span class="parethesis_function"> ( </span> <i class="ui icon plus square outline add_parameter_button"></i> <div class="ui large labels parameters_list container_parameters_list">'),t+='</div> <span class="parethesis_function"> ) </span> </div>'+(e.is_hidden?' <div class="function_area" style="display: none;"> ':' <div class="function_area"> '),t+='<div class="ui add_var_context add_var_button_function" style="float: left;"> <div class="ui icon button purple"> ',t+='<i class="icons"><i class="icon superscript" style="margin-top: -2px;margin-bottom: 2px;margin-left: 1px;margin-right: 1px;"></i><i class="corner add icon inverted" style="font-size: 9px;padding-top: 6px;padding-left: 9px;"></i></i>',t+="</div></div>",t+='<div class="ui top attached segment variables_list_div"></div>',t+='<div class="ui bottom attached segment commands_list_div commands_cont_'+Rr+'"><div class="ui rail" style="width: 35px; margin-left: -36px;"><div class="ui sticky sticky_cont_'+Rr+'" style="top: 50px !important;">',t+='<div class="ui icon button dropdown menu_commands orange" > <i class="icons"><i class="icon code" style="margin-top: -1px;margin-bottom: 1px;margin-right: 0px;"></i><i class="corner add icon inverted" style="font-size: 9px;padding-top: 6px;padding-left: 9px;"></i></i><div class="menu"> ',t+='<a class="item" data-command="'+bn.reader+'"><i class="download icon"></i> '+ke.getUI("text_read_var")+'</a><a class="item" data-command="'+bn.writer+'"><i class="upload icon"></i> '+ke.getUI("text_write_var")+'</a><a class="item" data-command="'+bn.comment+'"><i class="quote left icon"></i> '+ke.getUI("text_comment")+'</a><a class="item" data-command="'+bn.attribution+'"><i class="arrow left icon"></i> '+ke.getUI("text_attribution")+'</a><a class="item" data-command="'+bn.functioncall+'"><i class="hand point right icon"></i> '+ke.getUI("text_functioncall")+'</a><a class="item" data-command="'+bn.iftrue+'" ><i class="random icon"></i> '+ke.getUI("text_iftrue")+'</a><a class="item" data-command="'+bn.repeatNtimes+'"><i class="sync icon"></i> '+ke.getUI("text_repeatNtimes")+'</a><a class="item" data-command="'+bn.whiletrue+'"><i class="sync icon"></i> '+ke.getUI("text_whiletrue")+'</a><a class="item" data-command="'+bn.dowhiletrue+'"><i class="sync icon"></i> '+ke.getUI("text_dowhiletrue")+'</a><a class="item" data-command="'+bn.switch+'"><i class="list icon"></i> '+ke.getUI("text_switch")+'</a><a class="item" data-command="'+bn.return+'"><i class="reply icon"></i> '+ke.getUI("text_btn_return")+"</a></div></div>",t+="</div></div></div>",t+="</div></div>",t=$(t),$(".all_functions").append(t),t.data("fun",e),t.find(".commands_list_div").data("fun",e),function(e,t){var n='<div class="ui dropdown function_return">';for(var i in 1==e.return_dimensions?(n+='<div class="text">'+ke.getUI("vector")+": "+ke.getUI("type_".concat(e.return_type.toLowerCase())),n+=" [ ] </div>"):2==e.return_dimensions?(n+='<div class="text">'+ke.getUI("matrix")+": "+ke.getUI("type_".concat(e.return_type.toLowerCase())),n+=" [ ] [ ] </div>"):n+='<div class="text">'+ke.getUI("type_".concat(e.return_type.toLowerCase()))+"</div>",n+='<div class="menu">',Ht)n+='<div class="item '+(e.return_type==i.toLowerCase()&&e.return_dimensions<1?" selected ":"")+'" data-type="'+i+'" >'+ke.getUI("type_".concat(i.toLowerCase()))+"</div>";for(var i in n+='<div class="item '+(1==e.return_dimensions?" selected ":"")+'"><i class="dropdown icon"></i>'+ke.getUI("vector")+'<div class="menu">',Ht)i!=Ht.VOID.toUpperCase()&&(n+='<div class="item '+(e.return_type==i.toLowerCase()&&1==e.return_dimensions?" selected ":"")+'" data-text="'+ke.getUI("vector")+":"+ke.getUI("type_".concat(i.toLowerCase()))+' [ ] " data-type="'+i+'" data-dimensions="1"> '+ke.getUI("type_".concat(i.toLowerCase()))+"</div>");for(var i in n+="</div></div>",n+='<div class="item '+(2==e.return_dimensions?" selected ":"")+'"><i class="dropdown icon"></i>'+ke.getUI("matrix")+'<div class="menu">',Ht)i!=Ht.VOID.toUpperCase()&&(n+='<div class="item '+(e.return_type==i.toLowerCase()&&2==e.return_dimensions?" selected ":"")+'" data-text="'+ke.getUI("matrix")+":"+ke.getUI("type_".concat(i.toLowerCase()))+' [ ] " data-type="'+i+'" data-dimensions="2"> '+ke.getUI("type_".concat(i.toLowerCase()))+"</div>");n+="</div></div>",n+="</div></div>",n=$(n),t.find(".function_return").append(n)}(e,t),wr(e,t);for(var n=0;n<e.parameters_list.length;n++)Lr(e,e.parameters_list[n],t);for(n=0;n<e.variables_list.length;n++)Zn(t,e.variables_list[n],e);for(n=0;n<e.commands.length;n++)aa(e.commands[n],$(t.find(".commands_list_div")[0]),3,e);$(".minimize_function_button").popup({content:ke.getUI("tooltip_hide_function"),delay:{show:750,hide:0}});var i=yr.functions.indexOf(e);if(Sortable.create(t.find(".variables_list_div")[0],{handle:".ellipsis",animation:100,ghostClass:"ghost",group:"local_vars_drag_"+i,onEnd:function(t){!function(e,t,n){n.variables_list.splice(t,0,n.variables_list.splice(e,1)[0])}(t.oldIndex,t.newIndex,e)}}),function e(t,n){var i="commands_drag_"+n;Sortable.create(t,{handle:".command_drag",ghostClass:"ghost",animation:300,group:{name:i},onEnd:function(e){var t,n,i=Array.prototype.slice.call($(".all_functions").children());$(e.item).parentsUntil(".all_functions").each((function(e){$(this).hasClass("function_div")&&(t=i.indexOf(this),n=window.program_obj.functions[t])})),Jt(n.name,Wt.MOVE_COMMAND,$(e.item).data("command").type,"/","from: "+e.oldIndex+" to: "+e.newIndex);e.item;e.to,e.from,e.oldIndex,e.newIndex,window.evento_drag=e;try{!function(){var e,t,n=Array.prototype.slice.call($(".all_functions").children());$(evento_drag.item).parentsUntil(".all_functions").each((function(i){var a=$(this);a.hasClass("function_div")&&(e=n.indexOf(this),i,t=a)}));var i=[];$(evento_drag.item).parentsUntil(".all_functions").each((function(){$(this).hasClass("command_container")&&i.push(this)})),i.length;for(var a=[],r=[],o=i.length-1;o>=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<a.length;o++)"else"==r[o]?u=u.commands_else[a[o]]:"switch"==r[o]||(u=u.commands_block[a[o]]);0==i.length?window.program_obj.functions[e].commands.splice(evento_drag.newIndex-1,0,Er):l?u.commands_else?u.commands_else.splice(evento_drag.newIndex,0,Er):(u.commands_else=[],u.commands_else.push(Er)):c||(u.commands_block?(console.log("existe alguma coisa dentro do bloco, index: ",evento_drag.newIndex),u.commands_block.splice(evento_drag.newIndex,0,Er)):(u.commands_block=[],u.commands_block.push(Er)));window.draging=!1,renderAlgorithm()}()}catch(e){console.error(e),window.draging=!1}},onStart:function(e){try{!function(e){window.draging=!0;var t,n,i=Array.prototype.slice.call($(".all_functions").children());$(e.item).parentsUntil(".all_functions").each((function(e){$(this).hasClass("function_div")&&(t=i.indexOf(this),n=window.program_obj.functions[t])})),Er=$(e.item).data("command"),$(e.item).parent().hasClass("commands_list_div")?n.commands.indexOf(Er)>-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-o<s||$(a).removeClass("fixed")},onTop:function(e){$(a).css("top","20px","important")}})}return Rr++,t}function Ar(){(vr=new Pt("ivprog-term-div")).hide(),$(document.getElementById("ivprog-term-div")).draggable(),$(".add_function_button").on("click",(function(){var e;e=new Cn(ke.getUI("new_function")+"_"+ur,Ht.VOID,0,[],!1,!1,[],new Nn(ke.getUI("text_comment_start"))),yr.addFunction(e),ur++,window.insertContext=!0,Jt(e.name,Wt.INSERT_FUNCTION),Tr(e)})),$(".add_global_button").on("click",(function(){window.insertContext=!0,function(e){var t=arguments.length>1&&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+='<div class="ui label function_name_parameter pink"><i class="ui icon ellipsis vertical inverted"></i>',i+='<div class="ui dropdown parameter_type">',t.dimensions>0?(i+='<div class="text">'+ke.getUI("vector")+":"+ke.getUI("type_".concat(t.type.toLowerCase())),1==t.dimensions?i+=" [ ] ":i+=" [ ] [ ] ",i+="</div>"):i+='<div class="text">'+ke.getUI("type_".concat(t.type.toLowerCase()))+"</div>",i+='<div class="menu">',Ht)a!=Ht.VOID.toUpperCase()&&(i+='<div class="item '+(t.type==a.toLowerCase()&&0==t.dimensions?" selected ":"")+'" data-type="'+a+'" >'+ke.getUI("type_".concat(a.toLowerCase()))+"</div>");for(var r in i+='<div class="item '+(1==t.dimensions?" selected ":"")+'"><i class="dropdown icon"></i>'+ke.getUI("vector")+'<div class="menu">',Ht)r!=Ht.VOID.toUpperCase()&&(i+='<div class="item '+(t.type==r.toLowerCase()&&1==t.dimensions?" selected ":"")+'" data-text="'+ke.getUI("vector")+":"+ke.getUI("type_".concat(r.toLowerCase()))+' [ ] " data-type="'+r+'" data-dimensions="1"> '+ke.getUI("type_".concat(r.toLowerCase()))+"</div>");for(var r in i+="</div></div>",i+='<div class="item '+(2==t.dimensions?" selected ":"")+'"><i class="dropdown icon"></i>'+ke.getUI("matrix")+'<div class="menu">',Ht)r!=Ht.VOID.toUpperCase()&&(i+='<div class="item '+(t.type==r.toLowerCase()&&2==t.dimensions?" selected ":"")+'" data-text="'+ke.getUI("matrix")+":"+ke.getUI("type_".concat(r.toLowerCase()))+' [ ] " data-type="'+r+'" data-dimensions="2"> '+ke.getUI("type_".concat(r.toLowerCase()))+"</div>");return i+="</div></div>",i+="</div></div>",i+='<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">'+t.name+"</span></div> ",i+=' <i class="yellow inverted icon times remove_parameter"></i></div>',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=$("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+e.name+"' />")).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<t.parameters_list.length;n++)if(t.parameters_list[n].name==e)return!0;if(t.variables_list)for(n=0;n<t.variables_list.length;n++)if(t.variables_list[n].name==e)return!0;return!1}(t,i)?(Jt(i.name,Wt.RENAME_FUNCTION_PARAM,e.name,t),e.name=t):zt(n.find(".parameter_div_edit"),ke.getError("inform_valid_param_duplicated",[t,i.name])):zt(n.find(".parameter_div_edit"),ke.getError("inform_valid_identifier")))}function $r(e,t,n){e.name!=t&&(Ot(t)?!function(e){for(var t=0;t<window.program_obj.functions.length;t++)if(window.program_obj.functions[t].name==e)return!0;return!1}(t)?(Jt(e.name,Wt.RENAME_FUNCTION,t),e.name=t):zt(n.find(".function_name_div"),ke.getError("inform_valid_function_duplicated",[t])):zt(n.find(".function_name_div"),ke.getError("inform_valid_identifier")))}var Ur=!1,Mr=null;var Fr=!1,Dr=null,Br=null;function Gr(e){return fr.push(e),fr.length-1}function Pr(e){return _r.push(e),_r.length-1}function Kr(e){_r.splice(e,1)}function Vr(e){fr.splice(e)}function Hr(e,t){var n;n=setInterval((function(){e()&&clearInterval(n)}),t)}function qr(){document.getElementById("run_button").style.display="inline",document.getElementById("stop_button").style.display="none"}var jr=x.a.StringTypes,zr=Object.freeze({i18n:function(e){var t=e.split(":"),n=t[0].toLowerCase(),i=t[1];return jr.ERROR===n?ke.getError(i):jr.MESSAGE===n?ke.getMessage(i):jr.UI===n?ke.getUI(i):(console.warn("A string has been passed to the i18n helper function that was not in the form type:id -> "+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<e.inputList.length?(t(e.inputList[e.index]),e.index++):n(new Error(Xr.getError("exceeded_input_request")))}))}},{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,"&#x0020;&#x0020;")).replace(/\s/g,"&#x0020;")).length?t.currentLine=null:t.write(e,!0)})),0!=(a=(a=a.replace(/\t/g,"&#x0020;&#x0020;")).replace(/\s/g,"&#x0020;")).length&&this.write(a)}else n=(n=n.replace(/\t/g,"&#x0020;&#x0020;")).replace(/\s/g,"&#x0020;"),this.write(n)}}]),e}(),Wr=n(45);function Yr(e){var t,n=null;if(e.split("\n::algorithm::")[1]){n=e.split("\n::algorithm::")[1].split("\n::logs::")[0];var i=e.split("\n::algorithm::")[1].split("\n::logs::")[1];null!=i&&an(i)}try{(t=JSON.parse(e.split("\n::algorithm::")[0])).algorithm_in_ilm=n}catch(e){return console.error(e),Wr.Maybe.none()}return Wr.Maybe.some(t)}function Jr(e){return Yr(e).map((function(e){!function(e){hr=e}(e.testcases);return{settingsProgrammingType:e.settings_programming_type?e.settings_programming_type[0].value:"visual",settingsDataTypes:e.settings_data_types,settingsCommands:e.settings_commands,settingsFunctions:e.settings_functions,algorithmInIlm:e.algorithm_in_ilm,settingsFilter:e.settings_filter}}))}function Zr(e,t){for(var n=0;n<e.length;++n){if(e[n]!=t[n])return!1}return!0}function eo(e,t){var n=pa(),i=Yr(e).getOrElse(void 0);if(null==i)return alert("iAssign did not provide the original activity data!"),t(null);if(null==n)return t(-1);if(!function(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;++n){var i=e[n],a=t[n];if(!Zr(i.input,a.input))return!1;if(!Zr(i.output,a.output))return!1}return!0}(i.testcases,kr()))return t(-2);try{var a=Kt.analyseFromSource(n),r=new Qr([]);new ir(a,i.testcases,r).runTest().then((function(e){return t(e)})).catch((function(e){console.log(e),t(-5)}))}catch(e){console.error(e),t(-5)}}function to(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 no=function(e){c()(n,e);var t=to(n);function n(e){var i;return a()(this,n),(i=t.call(this)).index=0,i.inputList=e,i}return o()(n,[{key:"requestInput",value:function(){var e=this;return new Promise((function(t,n){e.index<e.inputList.length?(t(e.inputList[e.index]),e.index++):n(new Error(ke.getError("exceeded_input_request")))}))}}]),n}(La);function io(e,t){var n=t.map((function(e){return Object.assign({},e)}));try{var i=Kt.analyseFromSource(e),a=t.map((function(e,t){var n=new no(e.input),a=new Ma,r=new Gt(i);return r.registerInput(n),r.registerOutput(a),r.interpretAST().then((function(e){return{id:t,program:r}}))}));return Promise.all(a).then((function(e){for(var t=0;t<e.length;++t){var i=e[t],a=i.program.output.list,r=i.program.input;if(r.index!=r.inputList.length)return window.showAlert(ke.getMessage("testcase_autogen_unused_input",[i.id+1])),Promise.resolve(!1);0==a.length&&window.showAlert(ke.getMessage("testcase_autogen_empty",[i.id+1])),n[i.id].output=a}return window.outputGenerated(n),Promise.resolve(!0)}))}catch(e){return Promise.reject(e)}}var ao={initTextEditor:function(e){var t=e;"#"==e[0]&&(t=e.substring(1)),or=rr.fromTextArea(document.getElementById(t),{theme:"ttcn",value:"",mode:"text/x-ivprog",indentUnit:4,lineNumbers:!0,matchBrackets:!0,autoCloseBrackets:!0,fixedGutter:!0,styleActiveLine:!0,readOnly:!0})},setCode:lr,getCode:cr,updateEditor:sr,disable:function(e){or.setOption("readOnly",e),sr()}},ro=zr.i18n,oo=Ce()}])}));
  2. //# sourceMappingURL=main.829691c29843c4ed08fe.js.map