// Do not edit this file; automatically generated. /* eslint-disable */ ;(function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD define(["./blockly_compressed.js"], factory); } else if (typeof exports === 'object') { // Node.js module.exports = factory(require("./blockly_compressed.js")); } else { // Browser var factoryExports = factory(root.Blockly); root.Blockly.Dart = factoryExports.dartGenerator; root.Blockly.Dart.__namespace__ = factoryExports.__namespace__; } }(this, function(__parent__) { var $=__parent__.__namespace__; var module$exports$Blockly$Dart={},module$contents$Blockly$Dart_Variables=$.module$build$src$core$variables,module$contents$Blockly$Dart_stringUtils=$.module$build$src$core$utils$string,module$contents$Blockly$Dart_Generator=$.Generator$$module$build$src$core$generator,module$contents$Blockly$Dart_Names=$.module$build$src$core$names.Names,module$contents$Blockly$Dart_NameType=$.NameType$$module$build$src$core$names,module$contents$Blockly$Dart_inputTypes=$.module$build$src$core$input_types.inputTypes; module$exports$Blockly$Dart.dartGenerator=new $.Generator$$module$build$src$core$generator("Dart");module$exports$Blockly$Dart.dartGenerator.addReservedWords("assert,break,case,catch,class,const,continue,default,do,else,enum,extends,false,final,finally,for,if,in,is,new,null,rethrow,return,super,switch,this,throw,true,try,var,void,while,with,print,identityHashCode,identical,BidirectionalIterator,Comparable,double,Function,int,Invocation,Iterable,Iterator,List,Map,Match,num,Pattern,RegExp,Set,StackTrace,String,StringSink,Type,bool,DateTime,Deprecated,Duration,Expando,Null,Object,RuneIterator,Runes,Stopwatch,StringBuffer,Symbol,Uri,Comparator,AbstractClassInstantiationError,ArgumentError,AssertionError,CastError,ConcurrentModificationError,CyclicInitializationError,Error,Exception,FallThroughError,FormatException,IntegerDivisionByZeroException,NoSuchMethodError,NullThrownError,OutOfMemoryError,RangeError,StackOverflowError,StateError,TypeError,UnimplementedError,UnsupportedError"); module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC=0;module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX=1;module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_PREFIX=2;module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE=3;module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE=4;module$exports$Blockly$Dart.dartGenerator.ORDER_SHIFT=5;module$exports$Blockly$Dart.dartGenerator.ORDER_BITWISE_AND=6;module$exports$Blockly$Dart.dartGenerator.ORDER_BITWISE_XOR=7; module$exports$Blockly$Dart.dartGenerator.ORDER_BITWISE_OR=8;module$exports$Blockly$Dart.dartGenerator.ORDER_RELATIONAL=9;module$exports$Blockly$Dart.dartGenerator.ORDER_EQUALITY=10;module$exports$Blockly$Dart.dartGenerator.ORDER_LOGICAL_AND=11;module$exports$Blockly$Dart.dartGenerator.ORDER_LOGICAL_OR=12;module$exports$Blockly$Dart.dartGenerator.ORDER_IF_NULL=13;module$exports$Blockly$Dart.dartGenerator.ORDER_CONDITIONAL=14;module$exports$Blockly$Dart.dartGenerator.ORDER_CASCADE=15; module$exports$Blockly$Dart.dartGenerator.ORDER_ASSIGNMENT=16;module$exports$Blockly$Dart.dartGenerator.ORDER_NONE=99;module$exports$Blockly$Dart.dartGenerator.isInitialized=!1; module$exports$Blockly$Dart.dartGenerator.init=function(a){Object.getPrototypeOf(this).init.call(this);this.nameDB_?this.nameDB_.reset():this.nameDB_=new $.module$build$src$core$names.Names(this.RESERVED_WORDS_);this.nameDB_.setVariableMap(a.getVariableMap());this.nameDB_.populateVariables(a);this.nameDB_.populateProcedures(a);const b=[];var c=$.module$build$src$core$variables.allDeveloperVariables(a);for(let d=0;dc&&(a=a+" - "+-c),d&&(a=c?"-("+a+")":"-"+a),h=Math.floor(h),e=Math.floor(e),h&&e>=h&&(a="("+a+")"));return a};var module$exports$Blockly$Dart$variables={},module$contents$Blockly$Dart$variables_NameType=$.NameType$$module$build$src$core$names;module$exports$Blockly$Dart.dartGenerator.variables_get=function(a){return[module$exports$Blockly$Dart.dartGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE),module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC]}; module$exports$Blockly$Dart.dartGenerator.variables_set=function(a){const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"VALUE",module$exports$Blockly$Dart.dartGenerator.ORDER_ASSIGNMENT)||"0";return module$exports$Blockly$Dart.dartGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE)+" = "+b+";\n"};var module$exports$Blockly$Dart$variablesDynamic={};module$exports$Blockly$Dart.dartGenerator.variables_get_dynamic=module$exports$Blockly$Dart.dartGenerator.variables_get;module$exports$Blockly$Dart.dartGenerator.variables_set_dynamic=module$exports$Blockly$Dart.dartGenerator.variables_set;var module$exports$Blockly$Dart$texts={},module$contents$Blockly$Dart$texts_NameType=$.NameType$$module$build$src$core$names;module$exports$Blockly$Dart.dartGenerator.addReservedWords("Html,Math");module$exports$Blockly$Dart.dartGenerator.text=function(a){return[module$exports$Blockly$Dart.dartGenerator.quote_(a.getFieldValue("TEXT")),module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC]}; module$exports$Blockly$Dart.dartGenerator.text_multiline=function(a){a=module$exports$Blockly$Dart.dartGenerator.multiline_quote_(a.getFieldValue("TEXT"));const b=-1!==a.indexOf("+")?module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE:module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC;return[a,b]}; module$exports$Blockly$Dart.dartGenerator.text_join=function(a){switch(a.itemCount_){case 0:return["''",module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC];case 1:return[(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"ADD0",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||"''")+".toString()",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX];default:const b=Array(a.itemCount_);for(let c=0;c list = str.split(exp); final title = new StringBuffer(); for (String part in list) { if (part.length > 0) { title.write(part[0].toUpperCase()); if (part.length > 0) { title.write(part.substring(1).toLowerCase()); } } } return title.toString(); } `)+"("+a+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};module$exports$Blockly$Dart.dartGenerator.text_trim=function(a){const b={LEFT:".replaceFirst(new RegExp(r'^\\s+'), '')",RIGHT:".replaceFirst(new RegExp(r'\\s+$'), '')",BOTH:".trim()"}[a.getFieldValue("MODE")];return[(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TEXT",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||"''")+b,module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]}; module$exports$Blockly$Dart.dartGenerator.text_print=function(a){return"print("+(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TEXT",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''")+");\n"}; module$exports$Blockly$Dart.dartGenerator.text_prompt_ext=function(a){module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_html="import 'dart:html' as Html;";let b="Html.window.prompt("+(a.getField("TEXT")?module$exports$Blockly$Dart.dartGenerator.quote_(a.getFieldValue("TEXT")):module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TEXT",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''")+", '')";"NUMBER"===a.getFieldValue("TYPE")&&(module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math= "import 'dart:math' as Math;",b="Math.parseDouble("+b+")");return[b,module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};module$exports$Blockly$Dart.dartGenerator.text_prompt=module$exports$Blockly$Dart.dartGenerator.text_prompt_ext; module$exports$Blockly$Dart.dartGenerator.text_count=function(a){const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TEXT",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''";a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"SUB",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''";return[module$exports$Blockly$Dart.dartGenerator.provideFunction_("text_count",` int ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(String haystack, String needle) { if (needle.length == 0) { return haystack.length + 1; } int index = 0; int count = 0; while (index != -1) { index = haystack.indexOf(needle, index); if (index != -1) { count++; index += needle.length; } } return count; } `)+"("+b+", "+a+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]}; module$exports$Blockly$Dart.dartGenerator.text_replace=function(a){const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TEXT",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||"''",c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"FROM",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''";a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TO",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''";return[b+".replaceAll("+c+", "+a+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]}; module$exports$Blockly$Dart.dartGenerator.text_reverse=function(a){return["new String.fromCharCodes("+(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TEXT",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||"''")+".runes.toList().reversed)",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_PREFIX]};var module$exports$Blockly$Dart$procedures={},module$contents$Blockly$Dart$procedures_NameType=$.NameType$$module$build$src$core$names; module$exports$Blockly$Dart.dartGenerator.procedures_defreturn=function(a){const b=module$exports$Blockly$Dart.dartGenerator.nameDB_.getName(a.getFieldValue("NAME"),$.NameType$$module$build$src$core$names.PROCEDURE);var c="";module$exports$Blockly$Dart.dartGenerator.STATEMENT_PREFIX&&(c+=module$exports$Blockly$Dart.dartGenerator.injectId(module$exports$Blockly$Dart.dartGenerator.STATEMENT_PREFIX,a));module$exports$Blockly$Dart.dartGenerator.STATEMENT_SUFFIX&&(c+=module$exports$Blockly$Dart.dartGenerator.injectId(module$exports$Blockly$Dart.dartGenerator.STATEMENT_SUFFIX, a));c&&(c=module$exports$Blockly$Dart.dartGenerator.prefixLines(c,module$exports$Blockly$Dart.dartGenerator.INDENT));let d="";module$exports$Blockly$Dart.dartGenerator.INFINITE_LOOP_TRAP&&(d=module$exports$Blockly$Dart.dartGenerator.prefixLines(module$exports$Blockly$Dart.dartGenerator.injectId(module$exports$Blockly$Dart.dartGenerator.INFINITE_LOOP_TRAP,a),module$exports$Blockly$Dart.dartGenerator.INDENT));const e=module$exports$Blockly$Dart.dartGenerator.statementToCode(a,"STACK");let f=module$exports$Blockly$Dart.dartGenerator.valueToCode(a, "RETURN",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"",g="";e&&f&&(g=c);f&&(f=module$exports$Blockly$Dart.dartGenerator.INDENT+"return "+f+";\n");const h=f?"dynamic":"void",k=[],l=a.getVars();for(let m=0;ma?module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_PREFIX:module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC;return[a,b]}; module$exports$Blockly$Dart.dartGenerator.math_arithmetic=function(a){var b={ADD:[" + ",module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE],MINUS:[" - ",module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE],MULTIPLY:[" * ",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE],DIVIDE:[" / ",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE],POWER:[null,module$exports$Blockly$Dart.dartGenerator.ORDER_NONE]}[a.getFieldValue("OP")];const c=b[0];b=b[1];const d=module$exports$Blockly$Dart.dartGenerator.valueToCode(a, "A",b)||"0";a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"B",b)||"0";return c?[d+c+a,b]:(module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;",["Math.pow("+d+", "+a+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX])}; module$exports$Blockly$Dart.dartGenerator.math_single=function(a){const b=a.getFieldValue("OP");let c;if("NEG"===b)return a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"NUM",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_PREFIX)||"0","-"===a[0]&&(a=" "+a),["-"+a,module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_PREFIX];module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";a="ABS"===b||"ROUND"===b.substring(0,5)?module$exports$Blockly$Dart.dartGenerator.valueToCode(a, "NUM",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX)||"0":"SIN"===b||"COS"===b||"TAN"===b?module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"NUM",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE)||"0":module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"NUM",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"0";switch(b){case "ABS":c=a+".abs()";break;case "ROOT":c="Math.sqrt("+a+")";break;case "LN":c="Math.log("+a+")";break;case "EXP":c="Math.exp("+a+")"; break;case "POW10":c="Math.pow(10,"+a+")";break;case "ROUND":c=a+".round()";break;case "ROUNDUP":c=a+".ceil()";break;case "ROUNDDOWN":c=a+".floor()";break;case "SIN":c="Math.sin("+a+" / 180 * Math.pi)";break;case "COS":c="Math.cos("+a+" / 180 * Math.pi)";break;case "TAN":c="Math.tan("+a+" / 180 * Math.pi)"}if(c)return[c,module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX];switch(b){case "LOG10":c="Math.log("+a+") / Math.log(10)";break;case "ASIN":c="Math.asin("+a+") / Math.pi * 180";break; case "ACOS":c="Math.acos("+a+") / Math.pi * 180";break;case "ATAN":c="Math.atan("+a+") / Math.pi * 180";break;default:throw Error("Unknown math operator: "+b);}return[c,module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE]}; module$exports$Blockly$Dart.dartGenerator.math_constant=function(a){const b={PI:["Math.pi",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX],E:["Math.e",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE],SQRT2:["Math.sqrt2",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX],SQRT1_2:["Math.sqrt1_2",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX], INFINITY:["double.infinity",module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC]};a=a.getFieldValue("CONSTANT");"INFINITY"!==a&&(module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;");return b[a]}; module$exports$Blockly$Dart.dartGenerator.math_number_property=function(a){var b={EVEN:[" % 2 == 0",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE,module$exports$Blockly$Dart.dartGenerator.ORDER_EQUALITY],ODD:[" % 2 == 1",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE,module$exports$Blockly$Dart.dartGenerator.ORDER_EQUALITY],WHOLE:[" % 1 == 0",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE,module$exports$Blockly$Dart.dartGenerator.ORDER_EQUALITY],POSITIVE:[" > 0", module$exports$Blockly$Dart.dartGenerator.ORDER_RELATIONAL,module$exports$Blockly$Dart.dartGenerator.ORDER_RELATIONAL],NEGATIVE:[" < 0",module$exports$Blockly$Dart.dartGenerator.ORDER_RELATIONAL,module$exports$Blockly$Dart.dartGenerator.ORDER_RELATIONAL],DIVISIBLE_BY:[null,module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE,module$exports$Blockly$Dart.dartGenerator.ORDER_EQUALITY],PRIME:[null,module$exports$Blockly$Dart.dartGenerator.ORDER_NONE,module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]}; const c=a.getFieldValue("PROPERTY"),[d,e,f]=b[c];b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"NUMBER_TO_CHECK",e)||"0";if("PRIME"===c)module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;",a=module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_isPrime",` bool ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(n) { // https://en.wikipedia.org/wiki/Primality_test#Naive_methods if (n == 2 || n == 3) { return true; } // False if n is null, negative, is 1, or not whole. // And false if n is divisible by 2 or 3. if (n == null || n <= 1 || n % 1 != 0 || n % 2 == 0 || n % 3 == 0) { return false; } // Check all the numbers of form 6k +/- 1, up to sqrt(n). for (var x = 6; x <= Math.sqrt(n) + 1; x += 6) { if (n % (x - 1) == 0 || n % (x + 1) == 0) { return false; } } return true; } `)+"("+b+")";else if("DIVISIBLE_BY"===c){a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"DIVISOR",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE)||"0";if("0"===a)return["false",module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC];a=b+" % "+a+" == 0"}else a=b+d;return[a,f]}; module$exports$Blockly$Dart.dartGenerator.math_change=function(a){const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"DELTA",module$exports$Blockly$Dart.dartGenerator.ORDER_ADDITIVE)||"0";a=module$exports$Blockly$Dart.dartGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE);return a+" = ("+a+" is num ? "+a+" : 0) + "+b+";\n"};module$exports$Blockly$Dart.dartGenerator.math_round=module$exports$Blockly$Dart.dartGenerator.math_single; module$exports$Blockly$Dart.dartGenerator.math_trig=module$exports$Blockly$Dart.dartGenerator.math_single;module$exports$Blockly$Dart.dartGenerator.math_on_list=function(a){var b=a.getFieldValue("OP");a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"LIST",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"[]";switch(b){case "SUM":b=module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_sum",` num ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List myList) { num sumVal = 0; myList.forEach((num entry) {sumVal += entry;}); return sumVal; } `)+"("+a+")";break;case "MIN":module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";b=module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_min",` num ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List myList) { if (myList.isEmpty) return null; num minVal = myList[0]; myList.forEach((num entry) {minVal = Math.min(minVal, entry);}); return minVal; } `)+"("+a+")";break;case "MAX":module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";b=module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_max",` num ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List myList) { if (myList.isEmpty) return null; num maxVal = myList[0]; myList.forEach((num entry) {maxVal = Math.max(maxVal, entry);}); return maxVal; } `)+"("+a+")";break;case "AVERAGE":b=module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_mean",` num ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List myList) { // First filter list for numbers only. List localList = new List.from(myList); localList.removeWhere((a) => a is! num); if (localList.isEmpty) return null; num sumVal = 0; localList.forEach((var entry) {sumVal += entry;}); return sumVal / localList.length; } `)+"("+a+")";break;case "MEDIAN":b=module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_median",` num ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List myList) { // First filter list for numbers only, then sort, then return middle value // or the average of two middle values if list has an even number of elements. List localList = new List.from(myList); localList.removeWhere((a) => a is! num); if (localList.isEmpty) return null; localList.sort((a, b) => (a - b)); int index = localList.length ~/ 2; if (localList.length % 2 == 1) { return localList[index]; } else { return (localList[index - 1] + localList[index]) / 2; } } `)+"("+a+")";break;case "MODE":module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";b=module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_modes",` List ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List values) { List modes = []; List counts = []; int maxCount = 0; for (int i = 0; i < values.length; i++) { var value = values[i]; bool found = false; int thisCount; for (int j = 0; j < counts.length; j++) { if (counts[j][0] == value) { thisCount = ++counts[j][1]; found = true; break; } } if (!found) { counts.add([value, 1]); thisCount = 1; } maxCount = Math.max(thisCount, maxCount); } for (int j = 0; j < counts.length; j++) { if (counts[j][1] == maxCount) { modes.add(counts[j][0]); } } return modes; } `)+"("+a+")";break;case "STD_DEV":module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";b=module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_standard_deviation",` num ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List myList) { // First filter list for numbers only. List numbers = new List.from(myList); numbers.removeWhere((a) => a is! num); if (numbers.isEmpty) return null; num n = numbers.length; num sum = 0; numbers.forEach((x) => sum += x); num mean = sum / n; num sumSquare = 0; numbers.forEach((x) => sumSquare += Math.pow(x - mean, 2)); return Math.sqrt(sumSquare / n); } `)+"("+a+")";break;case "RANDOM":module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";b=module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_random_item",` dynamic ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(List myList) { int x = new Math.Random().nextInt(myList.length); return myList[x]; } `)+"("+a+")";break;default:throw Error("Unknown operator: "+b);}return[b,module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]}; module$exports$Blockly$Dart.dartGenerator.math_modulo=function(a){const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"DIVIDEND",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE)||"0";a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"DIVISOR",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE)||"0";return[b+" % "+a,module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE]}; module$exports$Blockly$Dart.dartGenerator.math_constrain=function(a){module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"VALUE",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"0",c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"LOW",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"0";a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"HIGH",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)|| "double.infinity";return["Math.min(Math.max("+b+", "+c+"), "+a+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]}; module$exports$Blockly$Dart.dartGenerator.math_random_int=function(a){module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"FROM",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"0";a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TO",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"0";return[module$exports$Blockly$Dart.dartGenerator.provideFunction_("math_random_int", ` int ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(num a, num b) { if (a > b) { // Swap a and b to ensure a is smaller. num c = a; a = b; b = c; } return new Math.Random().nextInt(b - a + 1) + a; } `)+"("+b+", "+a+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};module$exports$Blockly$Dart.dartGenerator.math_random_float=function(a){module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";return["new Math.Random().nextDouble()",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]}; module$exports$Blockly$Dart.dartGenerator.math_atan2=function(a){module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"X",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"0";return["Math.atan2("+(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"Y",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"0")+", "+b+") / Math.pi * 180",module$exports$Blockly$Dart.dartGenerator.ORDER_MULTIPLICATIVE]};var module$exports$Blockly$Dart$loops={},module$contents$Blockly$Dart$loops_stringUtils=$.module$build$src$core$utils$string,module$contents$Blockly$Dart$loops_NameType=$.NameType$$module$build$src$core$names; module$exports$Blockly$Dart.dartGenerator.controls_repeat_ext=function(a){let b;b=a.getField("TIMES")?String(Number(a.getFieldValue("TIMES"))):module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TIMES",module$exports$Blockly$Dart.dartGenerator.ORDER_ASSIGNMENT)||"0";let c=module$exports$Blockly$Dart.dartGenerator.statementToCode(a,"DO");c=module$exports$Blockly$Dart.dartGenerator.addLoopTrap(c,a);a="";const d=module$exports$Blockly$Dart.dartGenerator.nameDB_.getDistinctName("count",$.NameType$$module$build$src$core$names.VARIABLE); let e=b;b.match(/^\w+$/)||$.module$build$src$core$utils$string.isNumber(b)||(e=module$exports$Blockly$Dart.dartGenerator.nameDB_.getDistinctName("repeat_end",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+e+" = "+b+";\n");return a+("for (int "+d+" = 0; "+d+" < "+e+"; "+d+"++) {\n"+c+"}\n")};module$exports$Blockly$Dart.dartGenerator.controls_repeat=module$exports$Blockly$Dart.dartGenerator.controls_repeat_ext; module$exports$Blockly$Dart.dartGenerator.controls_whileUntil=function(a){const b="UNTIL"===a.getFieldValue("MODE");let c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"BOOL",b?module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_PREFIX:module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"false",d=module$exports$Blockly$Dart.dartGenerator.statementToCode(a,"DO");d=module$exports$Blockly$Dart.dartGenerator.addLoopTrap(d,a);b&&(c="!"+c);return"while ("+c+") {\n"+d+"}\n"}; module$exports$Blockly$Dart.dartGenerator.controls_for=function(a){var b=module$exports$Blockly$Dart.dartGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE),c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"FROM",module$exports$Blockly$Dart.dartGenerator.ORDER_ASSIGNMENT)||"0",d=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"TO",module$exports$Blockly$Dart.dartGenerator.ORDER_ASSIGNMENT)||"0";const e=module$exports$Blockly$Dart.dartGenerator.valueToCode(a, "BY",module$exports$Blockly$Dart.dartGenerator.ORDER_ASSIGNMENT)||"1";let f=module$exports$Blockly$Dart.dartGenerator.statementToCode(a,"DO");f=module$exports$Blockly$Dart.dartGenerator.addLoopTrap(f,a);if($.module$build$src$core$utils$string.isNumber(c)&&$.module$build$src$core$utils$string.isNumber(d)&&$.module$build$src$core$utils$string.isNumber(e)){var g=Number(c)<=Number(d);a="for ("+b+" = "+c+"; "+b+(g?" <= ":" >= ")+d+"; "+b;b=Math.abs(Number(e));a=1===b?a+(g?"++":"--"):a+((g?" += ":" -= ")+ b);a+=") {\n"+f+"}\n"}else a="",g=c,c.match(/^\w+$/)||$.module$build$src$core$utils$string.isNumber(c)||(g=module$exports$Blockly$Dart.dartGenerator.nameDB_.getDistinctName(b+"_start",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+g+" = "+c+";\n"),c=d,d.match(/^\w+$/)||$.module$build$src$core$utils$string.isNumber(d)||(c=module$exports$Blockly$Dart.dartGenerator.nameDB_.getDistinctName(b+"_end",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+c+" = "+d+";\n"),d=module$exports$Blockly$Dart.dartGenerator.nameDB_.getDistinctName(b+ "_inc",$.NameType$$module$build$src$core$names.VARIABLE),a+="num "+d+" = ",a=$.module$build$src$core$utils$string.isNumber(e)?a+(Math.abs(e)+";\n"):a+("("+e+").abs();\n"),a+="if ("+g+" > "+c+") {\n",a+=module$exports$Blockly$Dart.dartGenerator.INDENT+d+" = -"+d+";\n",a=a+"}\nfor ("+(b+" = "+g+"; "+d+" >= 0 ? "+b+" <= "+c+" : "+b+" >= "+c+"; "+b+" += "+d+") {\n"+f+"}\n");return a}; module$exports$Blockly$Dart.dartGenerator.controls_forEach=function(a){const b=module$exports$Blockly$Dart.dartGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE),c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"LIST",module$exports$Blockly$Dart.dartGenerator.ORDER_ASSIGNMENT)||"[]";let d=module$exports$Blockly$Dart.dartGenerator.statementToCode(a,"DO");d=module$exports$Blockly$Dart.dartGenerator.addLoopTrap(d,a);return"for (var "+b+" in "+ c+") {\n"+d+"}\n"}; module$exports$Blockly$Dart.dartGenerator.controls_flow_statements=function(a){let b="";module$exports$Blockly$Dart.dartGenerator.STATEMENT_PREFIX&&(b+=module$exports$Blockly$Dart.dartGenerator.injectId(module$exports$Blockly$Dart.dartGenerator.STATEMENT_PREFIX,a));module$exports$Blockly$Dart.dartGenerator.STATEMENT_SUFFIX&&(b+=module$exports$Blockly$Dart.dartGenerator.injectId(module$exports$Blockly$Dart.dartGenerator.STATEMENT_SUFFIX,a));if(module$exports$Blockly$Dart.dartGenerator.STATEMENT_PREFIX){const c=a.getSurroundLoop(); c&&!c.suppressPrefixSuffix&&(b+=module$exports$Blockly$Dart.dartGenerator.injectId(module$exports$Blockly$Dart.dartGenerator.STATEMENT_PREFIX,c))}switch(a.getFieldValue("FLOW")){case "BREAK":return b+"break;\n";case "CONTINUE":return b+"continue;\n"}throw Error("Unknown flow statement.");};var module$exports$Blockly$Dart$logic={}; module$exports$Blockly$Dart.dartGenerator.controls_if=function(a){let b=0,c="",d,e;module$exports$Blockly$Dart.dartGenerator.STATEMENT_PREFIX&&(c+=module$exports$Blockly$Dart.dartGenerator.injectId(module$exports$Blockly$Dart.dartGenerator.STATEMENT_PREFIX,a));do e=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"IF"+b,module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"false",d=module$exports$Blockly$Dart.dartGenerator.statementToCode(a,"DO"+b),module$exports$Blockly$Dart.dartGenerator.STATEMENT_SUFFIX&& (d=module$exports$Blockly$Dart.dartGenerator.prefixLines(module$exports$Blockly$Dart.dartGenerator.injectId(module$exports$Blockly$Dart.dartGenerator.STATEMENT_SUFFIX,a),module$exports$Blockly$Dart.dartGenerator.INDENT)+d),c+=(0",GTE:">="}[a.getFieldValue("OP")],c="=="===b||"!="===b?module$exports$Blockly$Dart.dartGenerator.ORDER_EQUALITY:module$exports$Blockly$Dart.dartGenerator.ORDER_RELATIONAL,d=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"A",c)||"0";a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"B",c)||"0";return[d+" "+b+" "+a,c]}; module$exports$Blockly$Dart.dartGenerator.logic_operation=function(a){const b="AND"===a.getFieldValue("OP")?"&&":"||",c="&&"===b?module$exports$Blockly$Dart.dartGenerator.ORDER_LOGICAL_AND:module$exports$Blockly$Dart.dartGenerator.ORDER_LOGICAL_OR;let d=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"A",c);a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"B",c);if(d||a){const e="&&"===b?"true":"false";d||(d=e);a||(a=e)}else a=d="false";return[d+" "+b+" "+a,c]}; module$exports$Blockly$Dart.dartGenerator.logic_negate=function(a){const b=module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_PREFIX;return["!"+(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"BOOL",b)||"true"),b]};module$exports$Blockly$Dart.dartGenerator.logic_boolean=function(a){return["TRUE"===a.getFieldValue("BOOL")?"true":"false",module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC]};module$exports$Blockly$Dart.dartGenerator.logic_null=function(a){return["null",module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC]}; module$exports$Blockly$Dart.dartGenerator.logic_ternary=function(a){const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"IF",module$exports$Blockly$Dart.dartGenerator.ORDER_CONDITIONAL)||"false",c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"THEN",module$exports$Blockly$Dart.dartGenerator.ORDER_CONDITIONAL)||"null";a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"ELSE",module$exports$Blockly$Dart.dartGenerator.ORDER_CONDITIONAL)||"null";return[b+" ? "+c+" : "+a,module$exports$Blockly$Dart.dartGenerator.ORDER_CONDITIONAL]};var module$exports$Blockly$Dart$lists={},module$contents$Blockly$Dart$lists_NameType=$.NameType$$module$build$src$core$names;module$exports$Blockly$Dart.dartGenerator.addReservedWords("Math");module$exports$Blockly$Dart.dartGenerator.lists_create_empty=function(a){return["[]",module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC]}; module$exports$Blockly$Dart.dartGenerator.lists_create_with=function(a){const b=Array(a.itemCount_);for(let c=0;c (direction * a.compareTo(b)).toInt(), 'TEXT': (a, b) => direction * a.toString().compareTo(b.toString()), 'IGNORE_CASE': (a, b) => direction * a.toString().toLowerCase().compareTo(b.toString().toLowerCase()) }; list = new List.from(list); var compare = compareFuncs[type]; list.sort(compare); return list; } `)+"("+b+', "'+a+'", '+c+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]}; module$exports$Blockly$Dart.dartGenerator.lists_split=function(a){let b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"INPUT",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX);const c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"DELIM",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"''";a=a.getFieldValue("MODE");if("SPLIT"===a)b||(b="''"),a="split";else if("JOIN"===a)b||(b="[]"),a="join";else throw Error("Unknown mode: "+a);return[b+"."+a+"("+c+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]}; module$exports$Blockly$Dart.dartGenerator.lists_reverse=function(a){return["new List.from("+(module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"LIST",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"[]")+".reversed)",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};var module$exports$Blockly$Dart$colour={};module$exports$Blockly$Dart.dartGenerator.addReservedWords("Math");module$exports$Blockly$Dart.dartGenerator.colour_picker=function(a){return[module$exports$Blockly$Dart.dartGenerator.quote_(a.getFieldValue("COLOUR")),module$exports$Blockly$Dart.dartGenerator.ORDER_ATOMIC]}; module$exports$Blockly$Dart.dartGenerator.colour_random=function(a){module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math="import 'dart:math' as Math;";return[module$exports$Blockly$Dart.dartGenerator.provideFunction_("colour_random",` String ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}() { String hex = '0123456789abcdef'; var rnd = new Math.Random(); return '#\${hex[rnd.nextInt(16)]}\${hex[rnd.nextInt(16)]}' '\${hex[rnd.nextInt(16)]}\${hex[rnd.nextInt(16)]}' '\${hex[rnd.nextInt(16)]}\${hex[rnd.nextInt(16)]}'; } `)+"()",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]}; module$exports$Blockly$Dart.dartGenerator.colour_rgb=function(a){const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"RED",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||0,c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"GREEN",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||0;a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"BLUE",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||0;module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math= "import 'dart:math' as Math;";return[module$exports$Blockly$Dart.dartGenerator.provideFunction_("colour_rgb",` String ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(num r, num g, num b) { num rn = (Math.max(Math.min(r, 100), 0) * 2.55).round(); String rs = rn.toInt().toRadixString(16); rs = '0$rs'; rs = rs.substring(rs.length - 2); num gn = (Math.max(Math.min(g, 100), 0) * 2.55).round(); String gs = gn.toInt().toRadixString(16); gs = '0$gs'; gs = gs.substring(gs.length - 2); num bn = (Math.max(Math.min(b, 100), 0) * 2.55).round(); String bs = bn.toInt().toRadixString(16); bs = '0$bs'; bs = bs.substring(bs.length - 2); return '#$rs$gs$bs'; } `)+"("+b+", "+c+", "+a+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]}; module$exports$Blockly$Dart.dartGenerator.colour_blend=function(a){const b=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"COLOUR1",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"'#000000'",c=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"COLOUR2",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||"'#000000'";a=module$exports$Blockly$Dart.dartGenerator.valueToCode(a,"RATIO",module$exports$Blockly$Dart.dartGenerator.ORDER_NONE)||.5;module$exports$Blockly$Dart.dartGenerator.definitions_.import_dart_math= "import 'dart:math' as Math;";return[module$exports$Blockly$Dart.dartGenerator.provideFunction_("colour_blend",` String ${module$exports$Blockly$Dart.dartGenerator.FUNCTION_NAME_PLACEHOLDER_}(String c1, String c2, num ratio) { ratio = Math.max(Math.min(ratio, 1), 0); int r1 = int.parse('0x\${c1.substring(1, 3)}'); int g1 = int.parse('0x\${c1.substring(3, 5)}'); int b1 = int.parse('0x\${c1.substring(5, 7)}'); int r2 = int.parse('0x\${c2.substring(1, 3)}'); int g2 = int.parse('0x\${c2.substring(3, 5)}'); int b2 = int.parse('0x\${c2.substring(5, 7)}'); num rn = (r1 * (1 - ratio) + r2 * ratio).round(); String rs = rn.toInt().toRadixString(16); num gn = (g1 * (1 - ratio) + g2 * ratio).round(); String gs = gn.toInt().toRadixString(16); num bn = (b1 * (1 - ratio) + b2 * ratio).round(); String bs = bn.toInt().toRadixString(16); rs = '0$rs'; rs = rs.substring(rs.length - 2); gs = '0$gs'; gs = gs.substring(gs.length - 2); bs = '0$bs'; bs = bs.substring(bs.length - 2); return '#$rs$gs$bs'; } `)+"("+b+", "+c+", "+a+")",module$exports$Blockly$Dart.dartGenerator.ORDER_UNARY_POSTFIX]};var module$exports$Blockly$Dart$all=module$exports$Blockly$Dart; module$exports$Blockly$Dart.__namespace__=$; return module$exports$Blockly$Dart; })); //# sourceMappingURL=dart_compressed.js.map