blockly 12.2.0-beta.0 → 12.3.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/blockly.min.js +933 -904
  2. package/blockly_compressed.js +839 -809
  3. package/blockly_compressed.js.map +1 -1
  4. package/blocks_compressed.js +57 -58
  5. package/blocks_compressed.js.map +1 -1
  6. package/core/block.d.ts +1 -1
  7. package/core/block_svg.d.ts +4 -1
  8. package/core/bubbles/bubble.d.ts +17 -2
  9. package/core/bubbles/textinput_bubble.d.ts +14 -17
  10. package/core/clipboard.d.ts +76 -15
  11. package/core/comments/collapse_comment_bar_button.d.ts +52 -0
  12. package/core/comments/comment_bar_button.d.ts +62 -0
  13. package/core/comments/comment_view.d.ts +13 -25
  14. package/core/comments/delete_comment_bar_button.d.ts +52 -0
  15. package/core/comments.d.ts +3 -0
  16. package/core/field_input.d.ts +3 -3
  17. package/core/icons/comment_icon.d.ts +3 -3
  18. package/core/insertion_marker_previewer.d.ts +11 -0
  19. package/core/interfaces/i_variable_map.d.ts +1 -1
  20. package/core/keyboard_nav/block_comment_navigation_policy.d.ts +56 -0
  21. package/core/keyboard_nav/block_navigation_policy.d.ts +7 -6
  22. package/core/keyboard_nav/comment_bar_button_navigation_policy.d.ts +56 -0
  23. package/core/keyboard_nav/comment_editor_navigation_policy.d.ts +34 -0
  24. package/core/keyboard_nav/line_cursor.d.ts +8 -8
  25. package/core/keyboard_nav/workspace_comment_navigation_policy.d.ts +56 -0
  26. package/core/marker_manager.d.ts +2 -2
  27. package/core/registry.d.ts +1 -1
  28. package/core/utils/focusable_tree_traverser.d.ts +2 -2
  29. package/core/utils/rect.d.ts +9 -0
  30. package/core/workspace.d.ts +10 -0
  31. package/core/workspace_svg.d.ts +19 -4
  32. package/dart_compressed.js +38 -38
  33. package/dart_compressed.js.map +1 -1
  34. package/javascript_compressed.js +37 -37
  35. package/javascript_compressed.js.map +1 -1
  36. package/lua_compressed.js +30 -30
  37. package/lua_compressed.js.map +1 -1
  38. package/package.json +8 -7
  39. package/php_compressed.js +39 -39
  40. package/php_compressed.js.map +1 -1
  41. package/python_compressed.js +32 -32
  42. package/python_compressed.js.map +1 -1
@@ -14,38 +14,38 @@
14
14
  var $=__parent__.__namespace__;
15
15
  var lists_create_empty$$module$build$src$generators$dart$lists=function(a,b){return["[]",Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},lists_create_with$$module$build$src$generators$dart$lists=function(a,b){const c=Array(a.itemCount_);for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Order$$module$build$src$generators$dart$dart_generator.NONE)||"null";return["["+c.join(", ")+"]",Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},lists_repeat$$module$build$src$generators$dart$lists=
16
16
  function(a,b){const c=b.valueToCode(a,"ITEM",Order$$module$build$src$generators$dart$dart_generator.NONE)||"null";return["new List.filled("+(b.valueToCode(a,"NUM",Order$$module$build$src$generators$dart$dart_generator.NONE)||"0")+", "+c+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},lists_length$$module$build$src$generators$dart$lists=function(a,b){return[(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"[]")+".length",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},
17
- lists_isEmpty$$module$build$src$generators$dart$lists=function(a,b){return[(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"[]")+".isEmpty",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},lists_indexOf$$module$build$src$generators$dart$lists=function(a,b){const c="FIRST"===a.getFieldValue("END")?"indexOf":"lastIndexOf",d=b.valueToCode(a,"FIND",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";b=(b.valueToCode(a,
17
+ lists_isEmpty$$module$build$src$generators$dart$lists=function(a,b){return[(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"[]")+".isEmpty",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},lists_indexOf$$module$build$src$generators$dart$lists=function(a,b){const c=a.getFieldValue("END")==="FIRST"?"indexOf":"lastIndexOf",d=b.valueToCode(a,"FIND",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";b=(b.valueToCode(a,
18
18
  "VALUE",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"[]")+"."+c+"("+d+")";return a.workspace.options.oneBasedIndex?[b+" + 1",Order$$module$build$src$generators$dart$dart_generator.ADDITIVE]:[b,Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},lists_getIndex$$module$build$src$generators$dart$lists=function(a,b){function c(){const g=b.nameDB_.getDistinctName("tmp_list",$.NameType$$module$build$src$core$names.VARIABLE),h="List "+g+" = "+f+";\n";f=g;return h}
19
- var d=a.getFieldValue("MODE")||"GET";const e=a.getFieldValue("WHERE")||"FROM_START";let f=b.valueToCode(a,"VALUE","RANDOM"===e||"FROM_END"===e?Order$$module$build$src$generators$dart$dart_generator.NONE:Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"[]";if(("RANDOM"!==e||"REMOVE"!==d)&&"FROM_END"!==e||f.match(/^\w+$/))switch(e){case "FIRST":if("GET"===d)return[f+".first",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];if("GET_REMOVE"===d)return[f+".removeAt(0)",
20
- Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];if("REMOVE"===d)return f+".removeAt(0);\n";break;case "LAST":if("GET"===d)return[f+".last",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];if("GET_REMOVE"===d)return[f+".removeLast()",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];if("REMOVE"===d)return f+".removeLast();\n";break;case "FROM_START":a=b.getAdjusted(a,"AT");if("GET"===d)return[f+"["+a+"]",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];
21
- if("GET_REMOVE"===d)return[f+".removeAt("+a+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];if("REMOVE"===d)return f+".removeAt("+a+");\n";break;case "FROM_END":a=b.getAdjusted(a,"AT",1,!1,Order$$module$build$src$generators$dart$dart_generator.ADDITIVE);if("GET"===d)return[f+"["+f+".length - "+a+"]",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];if("GET_REMOVE"===d||"REMOVE"===d){a=f+".removeAt("+f+".length - "+a+")";if("GET_REMOVE"===d)return[a,Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];
22
- if("REMOVE"===d)return a+";\n"}break;case "RANDOM":b.definitions_.import_dart_math="import 'dart:math' as Math;";if("REMOVE"===d)return d=b.nameDB_.getDistinctName("tmp_x",$.NameType$$module$build$src$core$names.VARIABLE),"int "+d+" = new Math.Random().nextInt("+f+".length);\n"+(f+".removeAt("+d+");\n");if("GET"===d)return[b.provideFunction_("lists_get_random_item",`
19
+ var d=a.getFieldValue("MODE")||"GET";const e=a.getFieldValue("WHERE")||"FROM_START";let f=b.valueToCode(a,"VALUE",e==="RANDOM"||e==="FROM_END"?Order$$module$build$src$generators$dart$dart_generator.NONE:Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"[]";if((e!=="RANDOM"||d!=="REMOVE")&&e!=="FROM_END"||f.match(/^\w+$/))switch(e){case "FIRST":if(d==="GET")return[f+".first",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];if(d==="GET_REMOVE")return[f+".removeAt(0)",
20
+ Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];if(d==="REMOVE")return f+".removeAt(0);\n";break;case "LAST":if(d==="GET")return[f+".last",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];if(d==="GET_REMOVE")return[f+".removeLast()",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];if(d==="REMOVE")return f+".removeLast();\n";break;case "FROM_START":a=b.getAdjusted(a,"AT");if(d==="GET")return[f+"["+a+"]",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];
21
+ if(d==="GET_REMOVE")return[f+".removeAt("+a+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];if(d==="REMOVE")return f+".removeAt("+a+");\n";break;case "FROM_END":a=b.getAdjusted(a,"AT",1,!1,Order$$module$build$src$generators$dart$dart_generator.ADDITIVE);if(d==="GET")return[f+"["+f+".length - "+a+"]",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];if(d==="GET_REMOVE"||d==="REMOVE"){a=f+".removeAt("+f+".length - "+a+")";if(d==="GET_REMOVE")return[a,Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];
22
+ if(d==="REMOVE")return a+";\n"}break;case "RANDOM":b.definitions_.import_dart_math="import 'dart:math' as Math;";if(d==="REMOVE")return d=b.nameDB_.getDistinctName("tmp_x",$.NameType$$module$build$src$core$names.VARIABLE),"int "+d+" = new Math.Random().nextInt("+f+".length);\n"+(f+".removeAt("+d+");\n");if(d==="GET")return[b.provideFunction_("lists_get_random_item",`
23
23
  dynamic ${b.FUNCTION_NAME_PLACEHOLDER_}(List my_list) {
24
24
  int x = new Math.Random().nextInt(my_list.length);
25
25
  return my_list[x];
26
26
  }
27
- `)+"("+f+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];if("GET_REMOVE"===d)return[b.provideFunction_("lists_remove_random_item",`
27
+ `)+"("+f+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];if(d==="GET_REMOVE")return[b.provideFunction_("lists_remove_random_item",`
28
28
  dynamic ${b.FUNCTION_NAME_PLACEHOLDER_}(List my_list) {
29
29
  int x = new Math.Random().nextInt(my_list.length);
30
30
  return my_list.removeAt(x);
31
31
  }
32
- `)+"("+f+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]}else{if("RANDOM"===e)return b.definitions_.import_dart_math="import 'dart:math' as Math;",d=c(),a=b.nameDB_.getDistinctName("tmp_x",$.NameType$$module$build$src$core$names.VARIABLE),d+("int "+a+" = new Math.Random().nextInt("+f+".length);\n")+(f+".removeAt("+a+");\n");if("REMOVE"===d)return d=b.getAdjusted(a,"AT",1,!1,Order$$module$build$src$generators$dart$dart_generator.ADDITIVE),c()+(f+".removeAt("+f+".length - "+
33
- d+");\n");if("GET"===d)return d=b.getAdjusted(a,"AT",1),[b.provideFunction_("lists_get_from_end",`
32
+ `)+"("+f+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]}else{if(e==="RANDOM")return b.definitions_.import_dart_math="import 'dart:math' as Math;",d=c(),a=b.nameDB_.getDistinctName("tmp_x",$.NameType$$module$build$src$core$names.VARIABLE),d+("int "+a+" = new Math.Random().nextInt("+f+".length);\n")+(f+".removeAt("+a+");\n");if(d==="REMOVE")return d=b.getAdjusted(a,"AT",1,!1,Order$$module$build$src$generators$dart$dart_generator.ADDITIVE),c()+(f+".removeAt("+f+".length - "+
33
+ d+");\n");if(d==="GET")return d=b.getAdjusted(a,"AT",1),[b.provideFunction_("lists_get_from_end",`
34
34
  dynamic ${b.FUNCTION_NAME_PLACEHOLDER_}(List my_list, num x) {
35
35
  x = my_list.length - x;
36
36
  return my_list[x];
37
37
  }
38
- `)+"("+f+", "+d+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];if("GET_REMOVE"===d)return d=b.getAdjusted(a,"AT",1),[b.provideFunction_("lists_remove_from_end",`
38
+ `)+"("+f+", "+d+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];if(d==="GET_REMOVE")return d=b.getAdjusted(a,"AT",1),[b.provideFunction_("lists_remove_from_end",`
39
39
  dynamic ${b.FUNCTION_NAME_PLACEHOLDER_}(List my_list, num x) {
40
40
  x = my_list.length - x;
41
41
  return my_list.removeAt(x);
42
42
  }
43
43
  `)+"("+f+", "+d+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]}throw Error("Unhandled combination (lists_getIndex).");},lists_setIndex$$module$build$src$generators$dart$lists=function(a,b){function c(){if(f.match(/^\w+$/))return"";const h=b.nameDB_.getDistinctName("tmp_list",$.NameType$$module$build$src$core$names.VARIABLE),k="List "+h+" = "+f+";\n";f=h;return k}const d=a.getFieldValue("MODE")||"GET";var e=a.getFieldValue("WHERE")||"FROM_START";let f=b.valueToCode(a,"LIST",
44
- Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"[]";const g=b.valueToCode(a,"TO",Order$$module$build$src$generators$dart$dart_generator.ASSIGNMENT)||"null";switch(e){case "FIRST":if("SET"===d)return f+"[0] = "+g+";\n";if("INSERT"===d)return f+".insert(0, "+g+");\n";break;case "LAST":if("SET"===d)return c()+(f+"["+f+".length - 1] = "+g+";\n");if("INSERT"===d)return f+".add("+g+");\n";break;case "FROM_START":a=b.getAdjusted(a,"AT");if("SET"===d)return f+"["+a+"] = "+g+";\n";
45
- if("INSERT"===d)return f+".insert("+a+", "+g+");\n";break;case "FROM_END":a=b.getAdjusted(a,"AT",1,!1,Order$$module$build$src$generators$dart$dart_generator.ADDITIVE);e=c();if("SET"===d)return e+(f+"["+f+".length - "+a+"] = "+g+";\n");if("INSERT"===d)return e+(f+".insert("+f+".length - "+a+", "+g+");\n");break;case "RANDOM":b.definitions_.import_dart_math="import 'dart:math' as Math;";a=c();e=b.nameDB_.getDistinctName("tmp_x",$.NameType$$module$build$src$core$names.VARIABLE);a+="int "+e+" = new Math.Random().nextInt("+
46
- f+".length);\n";if("SET"===d)return a+(f+"["+e+"] = "+g+";\n");if("INSERT"===d)return a+(f+".insert("+e+", "+g+");\n")}throw Error("Unhandled combination (lists_setIndex).");},lists_getSublist$$module$build$src$generators$dart$lists=function(a,b){const c=b.valueToCode(a,"LIST",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"[]";var d=a.getFieldValue("WHERE1");const e=a.getFieldValue("WHERE2");if(c.match(/^\w+$/)||"FROM_END"!==d&&"FROM_START"===e){switch(d){case "FROM_START":d=
44
+ Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"[]";const g=b.valueToCode(a,"TO",Order$$module$build$src$generators$dart$dart_generator.ASSIGNMENT)||"null";switch(e){case "FIRST":if(d==="SET")return f+"[0] = "+g+";\n";if(d==="INSERT")return f+".insert(0, "+g+");\n";break;case "LAST":if(d==="SET")return c()+(f+"["+f+".length - 1] = "+g+";\n");if(d==="INSERT")return f+".add("+g+");\n";break;case "FROM_START":a=b.getAdjusted(a,"AT");if(d==="SET")return f+"["+a+"] = "+g+";\n";
45
+ if(d==="INSERT")return f+".insert("+a+", "+g+");\n";break;case "FROM_END":a=b.getAdjusted(a,"AT",1,!1,Order$$module$build$src$generators$dart$dart_generator.ADDITIVE);e=c();if(d==="SET")return e+(f+"["+f+".length - "+a+"] = "+g+";\n");if(d==="INSERT")return e+(f+".insert("+f+".length - "+a+", "+g+");\n");break;case "RANDOM":b.definitions_.import_dart_math="import 'dart:math' as Math;";a=c();e=b.nameDB_.getDistinctName("tmp_x",$.NameType$$module$build$src$core$names.VARIABLE);a+="int "+e+" = new Math.Random().nextInt("+
46
+ f+".length);\n";if(d==="SET")return a+(f+"["+e+"] = "+g+";\n");if(d==="INSERT")return a+(f+".insert("+e+", "+g+");\n")}throw Error("Unhandled combination (lists_setIndex).");},lists_getSublist$$module$build$src$generators$dart$lists=function(a,b){const c=b.valueToCode(a,"LIST",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"[]";var d=a.getFieldValue("WHERE1");const e=a.getFieldValue("WHERE2");if(c.match(/^\w+$/)||d!=="FROM_END"&&e==="FROM_START"){switch(d){case "FROM_START":d=
47
47
  b.getAdjusted(a,"AT1");break;case "FROM_END":d=b.getAdjusted(a,"AT1",1,!1,Order$$module$build$src$generators$dart$dart_generator.ADDITIVE);d=c+".length - "+d;break;case "FIRST":d="0";break;default:throw Error("Unhandled option (lists_getSublist).");}switch(e){case "FROM_START":var f=b.getAdjusted(a,"AT2",1);break;case "FROM_END":f=b.getAdjusted(a,"AT2",0,!1,Order$$module$build$src$generators$dart$dart_generator.ADDITIVE);f=c+".length - "+f;break;case "LAST":break;default:throw Error("Unhandled option (lists_getSublist).");
48
- }b="LAST"===e?c+".sublist("+d+")":c+".sublist("+d+", "+f+")"}else f=b.getAdjusted(a,"AT1"),a=b.getAdjusted(a,"AT2"),b=b.provideFunction_("lists_get_sublist",`
48
+ }b=e==="LAST"?c+".sublist("+d+")":c+".sublist("+d+", "+f+")"}else f=b.getAdjusted(a,"AT1"),a=b.getAdjusted(a,"AT2"),b=b.provideFunction_("lists_get_sublist",`
49
49
  List ${b.FUNCTION_NAME_PLACEHOLDER_}(List list, String where1, num at1, String where2, num at2) {
50
50
  int getAt(String where, num at) {
51
51
  if (where == 'FROM_END') {
@@ -63,7 +63,7 @@ List ${b.FUNCTION_NAME_PLACEHOLDER_}(List list, String where1, num at1, String w
63
63
  at2 = getAt(where2, at2) + 1;
64
64
  return list.sublist(at1, at2);
65
65
  }
66
- `)+"("+c+", '"+d+"', "+f+", '"+e+"', "+a+")";return[b,Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},lists_sort$$module$build$src$generators$dart$lists=function(a,b){const c=b.valueToCode(a,"LIST",Order$$module$build$src$generators$dart$dart_generator.NONE)||"[]",d="1"===a.getFieldValue("DIRECTION")?1:-1;a=a.getFieldValue("TYPE");return[b.provideFunction_("lists_sort",`
66
+ `)+"("+c+", '"+d+"', "+f+", '"+e+"', "+a+")";return[b,Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},lists_sort$$module$build$src$generators$dart$lists=function(a,b){const c=b.valueToCode(a,"LIST",Order$$module$build$src$generators$dart$dart_generator.NONE)||"[]",d=a.getFieldValue("DIRECTION")==="1"?1:-1;a=a.getFieldValue("TYPE");return[b.provideFunction_("lists_sort",`
67
67
  List ${b.FUNCTION_NAME_PLACEHOLDER_}(List list, String type, int direction) {
68
68
  var compareFuncs = {
69
69
  'NUMERIC': (a, b) => (direction * a.compareTo(b)).toInt(),
@@ -77,29 +77,29 @@ List ${b.FUNCTION_NAME_PLACEHOLDER_}(List list, String type, int direction) {
77
77
  list.sort(compare);
78
78
  return list;
79
79
  }
80
- `)+"("+c+', "'+a+'", '+d+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},lists_split$$module$build$src$generators$dart$lists=function(a,b){let c=b.valueToCode(a,"INPUT",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX);b=b.valueToCode(a,"DELIM",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";a=a.getFieldValue("MODE");if("SPLIT"===a)c||(c="''"),a="split";else if("JOIN"===a)c||(c="[]"),a="join";else throw Error("Unknown mode: "+a);return[c+
80
+ `)+"("+c+', "'+a+'", '+d+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},lists_split$$module$build$src$generators$dart$lists=function(a,b){let c=b.valueToCode(a,"INPUT",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX);b=b.valueToCode(a,"DELIM",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";a=a.getFieldValue("MODE");if(a==="SPLIT")c||(c="''"),a="split";else if(a==="JOIN")c||(c="[]"),a="join";else throw Error("Unknown mode: "+a);return[c+
81
81
  "."+a+"("+b+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},lists_reverse$$module$build$src$generators$dart$lists=function(a,b){return["new List.from("+(b.valueToCode(a,"LIST",Order$$module$build$src$generators$dart$dart_generator.NONE)||"[]")+".reversed)",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},controls_if$$module$build$src$generators$dart$logic=function(a,b){let c=0,d="",e,f;b.STATEMENT_PREFIX&&(d+=b.injectId(b.STATEMENT_PREFIX,a));do f=
82
- b.valueToCode(a,"IF"+c,Order$$module$build$src$generators$dart$dart_generator.NONE)||"false",e=b.statementToCode(a,"DO"+c),b.STATEMENT_SUFFIX&&(e=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+e),d+=(0<c?"else ":"")+"if ("+f+") {\n"+e+"}",c++;while(a.getInput("IF"+c));if(a.getInput("ELSE")||b.STATEMENT_SUFFIX)e=a.getInput("ELSE")?b.statementToCode(a,"ELSE"):"",b.STATEMENT_SUFFIX&&(e=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+e),d+=" else {\n"+e+"}";return d+"\n"},logic_compare$$module$build$src$generators$dart$logic=
83
- function(a,b){const c={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[a.getFieldValue("OP")],d="=="===c||"!="===c?Order$$module$build$src$generators$dart$dart_generator.EQUALITY:Order$$module$build$src$generators$dart$dart_generator.RELATIONAL,e=b.valueToCode(a,"A",d)||"0";a=b.valueToCode(a,"B",d)||"0";return[e+" "+c+" "+a,d]},logic_operation$$module$build$src$generators$dart$logic=function(a,b){const c="AND"===a.getFieldValue("OP")?"&&":"||",d="&&"===c?Order$$module$build$src$generators$dart$dart_generator.LOGICAL_AND:
84
- Order$$module$build$src$generators$dart$dart_generator.LOGICAL_OR;let e=b.valueToCode(a,"A",d);a=b.valueToCode(a,"B",d);e||a?(b="&&"===c?"true":"false",e||(e=b),a||(a=b)):a=e="false";return[e+" "+c+" "+a,d]},logic_negate$$module$build$src$generators$dart$logic=function(a,b){const c=Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX;return["!"+(b.valueToCode(a,"BOOL",c)||"true"),c]},logic_boolean$$module$build$src$generators$dart$logic=function(a,b){return["TRUE"===a.getFieldValue("BOOL")?
85
- "true":"false",Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},logic_null$$module$build$src$generators$dart$logic=function(a,b){return["null",Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},logic_ternary$$module$build$src$generators$dart$logic=function(a,b){const c=b.valueToCode(a,"IF",Order$$module$build$src$generators$dart$dart_generator.CONDITIONAL)||"false",d=b.valueToCode(a,"THEN",Order$$module$build$src$generators$dart$dart_generator.CONDITIONAL)||"null";a=b.valueToCode(a,
86
- "ELSE",Order$$module$build$src$generators$dart$dart_generator.CONDITIONAL)||"null";return[c+" ? "+d+" : "+a,Order$$module$build$src$generators$dart$dart_generator.CONDITIONAL]},controls_repeat_ext$$module$build$src$generators$dart$loops=function(a,b){let c;c=a.getField("TIMES")?String(Number(a.getFieldValue("TIMES"))):b.valueToCode(a,"TIMES",Order$$module$build$src$generators$dart$dart_generator.ASSIGNMENT)||"0";let d=b.statementToCode(a,"DO");d=b.addLoopTrap(d,a);a="";const e=b.nameDB_.getDistinctName("count",
87
- $.NameType$$module$build$src$core$names.VARIABLE);let f=c;c.match(/^\w+$/)||$.isNumber$$module$build$src$core$utils$string(c)||(f=b.nameDB_.getDistinctName("repeat_end",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+f+" = "+c+";\n");return a+("for (int "+e+" = 0; "+e+" < "+f+"; "+e+"++) {\n"+d+"}\n")},controls_whileUntil$$module$build$src$generators$dart$loops=function(a,b){const c="UNTIL"===a.getFieldValue("MODE");let d=b.valueToCode(a,"BOOL",c?Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX:
82
+ b.valueToCode(a,"IF"+c,Order$$module$build$src$generators$dart$dart_generator.NONE)||"false",e=b.statementToCode(a,"DO"+c),b.STATEMENT_SUFFIX&&(e=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+e),d+=(c>0?"else ":"")+"if ("+f+") {\n"+e+"}",c++;while(a.getInput("IF"+c));if(a.getInput("ELSE")||b.STATEMENT_SUFFIX)e=a.getInput("ELSE")?b.statementToCode(a,"ELSE"):"",b.STATEMENT_SUFFIX&&(e=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+e),d+=" else {\n"+e+"}";return d+"\n"},logic_compare$$module$build$src$generators$dart$logic=
83
+ function(a,b){const c={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[a.getFieldValue("OP")],d=c==="=="||c==="!="?Order$$module$build$src$generators$dart$dart_generator.EQUALITY:Order$$module$build$src$generators$dart$dart_generator.RELATIONAL,e=b.valueToCode(a,"A",d)||"0";a=b.valueToCode(a,"B",d)||"0";return[e+" "+c+" "+a,d]},logic_operation$$module$build$src$generators$dart$logic=function(a,b){const c=a.getFieldValue("OP")==="AND"?"&&":"||",d=c==="&&"?Order$$module$build$src$generators$dart$dart_generator.LOGICAL_AND:
84
+ Order$$module$build$src$generators$dart$dart_generator.LOGICAL_OR;let e=b.valueToCode(a,"A",d);a=b.valueToCode(a,"B",d);e||a?(b=c==="&&"?"true":"false",e||(e=b),a||(a=b)):a=e="false";return[e+" "+c+" "+a,d]},logic_negate$$module$build$src$generators$dart$logic=function(a,b){const c=Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX;return["!"+(b.valueToCode(a,"BOOL",c)||"true"),c]},logic_boolean$$module$build$src$generators$dart$logic=function(a,b){return[a.getFieldValue("BOOL")===
85
+ "TRUE"?"true":"false",Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},logic_null$$module$build$src$generators$dart$logic=function(a,b){return["null",Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},logic_ternary$$module$build$src$generators$dart$logic=function(a,b){const c=b.valueToCode(a,"IF",Order$$module$build$src$generators$dart$dart_generator.CONDITIONAL)||"false",d=b.valueToCode(a,"THEN",Order$$module$build$src$generators$dart$dart_generator.CONDITIONAL)||"null";
86
+ a=b.valueToCode(a,"ELSE",Order$$module$build$src$generators$dart$dart_generator.CONDITIONAL)||"null";return[c+" ? "+d+" : "+a,Order$$module$build$src$generators$dart$dart_generator.CONDITIONAL]},controls_repeat_ext$$module$build$src$generators$dart$loops=function(a,b){let c;c=a.getField("TIMES")?String(Number(a.getFieldValue("TIMES"))):b.valueToCode(a,"TIMES",Order$$module$build$src$generators$dart$dart_generator.ASSIGNMENT)||"0";let d=b.statementToCode(a,"DO");d=b.addLoopTrap(d,a);a="";const e=b.nameDB_.getDistinctName("count",
87
+ $.NameType$$module$build$src$core$names.VARIABLE);let f=c;c.match(/^\w+$/)||$.isNumber$$module$build$src$core$utils$string(c)||(f=b.nameDB_.getDistinctName("repeat_end",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+f+" = "+c+";\n");return a+("for (int "+e+" = 0; "+e+" < "+f+"; "+e+"++) {\n"+d+"}\n")},controls_whileUntil$$module$build$src$generators$dart$loops=function(a,b){const c=a.getFieldValue("MODE")==="UNTIL";let d=b.valueToCode(a,"BOOL",c?Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX:
88
88
  Order$$module$build$src$generators$dart$dart_generator.NONE)||"false",e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a);c&&(d="!"+d);return"while ("+d+") {\n"+e+"}\n"},controls_for$$module$build$src$generators$dart$loops=function(a,b){var c=b.getVariableName(a.getFieldValue("VAR")),d=b.valueToCode(a,"FROM",Order$$module$build$src$generators$dart$dart_generator.ASSIGNMENT)||"0",e=b.valueToCode(a,"TO",Order$$module$build$src$generators$dart$dart_generator.ASSIGNMENT)||"0";const f=b.valueToCode(a,"BY",
89
- Order$$module$build$src$generators$dart$dart_generator.ASSIGNMENT)||"1";let g=b.statementToCode(a,"DO");g=b.addLoopTrap(g,a);if($.isNumber$$module$build$src$core$utils$string(d)&&$.isNumber$$module$build$src$core$utils$string(e)&&$.isNumber$$module$build$src$core$utils$string(f))b=Number(d)<=Number(e),a="for ("+c+" = "+d+"; "+c+(b?" <= ":" >= ")+e+"; "+c,c=Math.abs(Number(f)),a=1===c?a+(b?"++":"--"):a+((b?" += ":" -= ")+c),a+=") {\n"+g+"}\n";else{a="";let h=d;d.match(/^\w+$/)||$.isNumber$$module$build$src$core$utils$string(d)||
89
+ Order$$module$build$src$generators$dart$dart_generator.ASSIGNMENT)||"1";let g=b.statementToCode(a,"DO");g=b.addLoopTrap(g,a);if($.isNumber$$module$build$src$core$utils$string(d)&&$.isNumber$$module$build$src$core$utils$string(e)&&$.isNumber$$module$build$src$core$utils$string(f))b=Number(d)<=Number(e),a="for ("+c+" = "+d+"; "+c+(b?" <= ":" >= ")+e+"; "+c,c=Math.abs(Number(f)),a=c===1?a+(b?"++":"--"):a+((b?" += ":" -= ")+c),a+=") {\n"+g+"}\n";else{a="";let h=d;d.match(/^\w+$/)||$.isNumber$$module$build$src$core$utils$string(d)||
90
90
  (h=b.nameDB_.getDistinctName(c+"_start",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+h+" = "+d+";\n");d=e;e.match(/^\w+$/)||$.isNumber$$module$build$src$core$utils$string(e)||(d=b.nameDB_.getDistinctName(c+"_end",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+d+" = "+e+";\n");e=b.nameDB_.getDistinctName(c+"_inc",$.NameType$$module$build$src$core$names.VARIABLE);a+="num "+e+" = ";a=$.isNumber$$module$build$src$core$utils$string(f)?a+(Math.abs(Number(f))+";\n"):a+("("+f+
91
91
  ").abs();\n");a+="if ("+h+" > "+d+") {\n";a+=b.INDENT+e+" = -"+e+";\n";a=a+"}\nfor ("+(c+" = "+h+"; "+e+" >= 0 ? "+c+" <= "+d+" : "+c+" >= "+d+"; "+c+" += "+e+") {\n"+g+"}\n")}return a},controls_forEach$$module$build$src$generators$dart$loops=function(a,b){const c=b.getVariableName(a.getFieldValue("VAR")),d=b.valueToCode(a,"LIST",Order$$module$build$src$generators$dart$dart_generator.ASSIGNMENT)||"[]";let e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a);return"for (var "+c+" in "+d+") {\n"+e+"}\n"},
92
92
  controls_flow_statements$$module$build$src$generators$dart$loops=function(a,b){let c="";b.STATEMENT_PREFIX&&(c+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(c+=b.injectId(b.STATEMENT_SUFFIX,a));if(b.STATEMENT_PREFIX){const d=a.getSurroundLoop();d&&!d.suppressPrefixSuffix&&(c+=b.injectId(b.STATEMENT_PREFIX,d))}switch(a.getFieldValue("FLOW")){case "BREAK":return c+"break;\n";case "CONTINUE":return c+"continue;\n"}throw Error("Unknown flow statement.");},math_number$$module$build$src$generators$dart$math=
93
- function(a,b){a=Number(a.getFieldValue("NUM"));return Infinity===a?["double.infinity",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]:-Infinity===a?["-double.infinity",Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX]:[String(a),0>a?Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX:Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},math_arithmetic$$module$build$src$generators$dart$math=function(a,b){var c={ADD:[" + ",Order$$module$build$src$generators$dart$dart_generator.ADDITIVE],
93
+ function(a,b){a=Number(a.getFieldValue("NUM"));return a===Infinity?["double.infinity",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]:a===-Infinity?["-double.infinity",Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX]:[String(a),a<0?Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX:Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},math_arithmetic$$module$build$src$generators$dart$math=function(a,b){var c={ADD:[" + ",Order$$module$build$src$generators$dart$dart_generator.ADDITIVE],
94
94
  MINUS:[" - ",Order$$module$build$src$generators$dart$dart_generator.ADDITIVE],MULTIPLY:[" * ",Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE],DIVIDE:[" / ",Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE],POWER:[null,Order$$module$build$src$generators$dart$dart_generator.NONE]}[a.getFieldValue("OP")];const d=c[0];c=c[1];const e=b.valueToCode(a,"A",c)||"0";a=b.valueToCode(a,"B",c)||"0";return d?[e+d+a,c]:(b.definitions_.import_dart_math="import 'dart:math' as Math;",
95
- ["Math.pow("+e+", "+a+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX])},math_single$$module$build$src$generators$dart$math=function(a,b){const c=a.getFieldValue("OP");let d;if("NEG"===c)return a=b.valueToCode(a,"NUM",Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX)||"0","-"===a[0]&&(a=" "+a),["-"+a,Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX];b.definitions_.import_dart_math="import 'dart:math' as Math;";a="ABS"===c||"ROUND"===c.substring(0,
96
- 5)?b.valueToCode(a,"NUM",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"0":"SIN"===c||"COS"===c||"TAN"===c?b.valueToCode(a,"NUM",Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE)||"0":b.valueToCode(a,"NUM",Order$$module$build$src$generators$dart$dart_generator.NONE)||"0";switch(c){case "ABS":d=a+".abs()";break;case "ROOT":d="Math.sqrt("+a+")";break;case "LN":d="Math.log("+a+")";break;case "EXP":d="Math.exp("+a+")";break;case "POW10":d="Math.pow(10,"+a+
97
- ")";break;case "ROUND":d=a+".round()";break;case "ROUNDUP":d=a+".ceil()";break;case "ROUNDDOWN":d=a+".floor()";break;case "SIN":d="Math.sin("+a+" / 180 * Math.pi)";break;case "COS":d="Math.cos("+a+" / 180 * Math.pi)";break;case "TAN":d="Math.tan("+a+" / 180 * Math.pi)"}if(d)return[d,Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];switch(c){case "LOG10":d="Math.log("+a+") / Math.log(10)";break;case "ASIN":d="Math.asin("+a+") / Math.pi * 180";break;case "ACOS":d="Math.acos("+a+
98
- ") / Math.pi * 180";break;case "ATAN":d="Math.atan("+a+") / Math.pi * 180";break;default:throw Error("Unknown math operator: "+c);}return[d,Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE]},math_constant$$module$build$src$generators$dart$math=function(a,b){const c={PI:["Math.pi",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX],E:["Math.e",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE],
99
- SQRT2:["Math.sqrt2",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX],SQRT1_2:["Math.sqrt1_2",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX],INFINITY:["double.infinity",Order$$module$build$src$generators$dart$dart_generator.ATOMIC]};a=a.getFieldValue("CONSTANT");"INFINITY"!==a&&(b.definitions_.import_dart_math="import 'dart:math' as Math;");return c[a]},math_number_property$$module$build$src$generators$dart$math=function(a,b){var c={EVEN:[" % 2 == 0",Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE,
95
+ ["Math.pow("+e+", "+a+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX])},math_single$$module$build$src$generators$dart$math=function(a,b){const c=a.getFieldValue("OP");let d;if(c==="NEG")return a=b.valueToCode(a,"NUM",Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX)||"0",a[0]==="-"&&(a=" "+a),["-"+a,Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX];b.definitions_.import_dart_math="import 'dart:math' as Math;";a=c==="ABS"||c.substring(0,
96
+ 5)==="ROUND"?b.valueToCode(a,"NUM",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"0":c==="SIN"||c==="COS"||c==="TAN"?b.valueToCode(a,"NUM",Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE)||"0":b.valueToCode(a,"NUM",Order$$module$build$src$generators$dart$dart_generator.NONE)||"0";switch(c){case "ABS":d=a+".abs()";break;case "ROOT":d="Math.sqrt("+a+")";break;case "LN":d="Math.log("+a+")";break;case "EXP":d="Math.exp("+a+")";break;case "POW10":d="Math.pow(10,"+
97
+ a+")";break;case "ROUND":d=a+".round()";break;case "ROUNDUP":d=a+".ceil()";break;case "ROUNDDOWN":d=a+".floor()";break;case "SIN":d="Math.sin("+a+" / 180 * Math.pi)";break;case "COS":d="Math.cos("+a+" / 180 * Math.pi)";break;case "TAN":d="Math.tan("+a+" / 180 * Math.pi)"}if(d)return[d,Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];switch(c){case "LOG10":d="Math.log("+a+") / Math.log(10)";break;case "ASIN":d="Math.asin("+a+") / Math.pi * 180";break;case "ACOS":d="Math.acos("+
98
+ a+") / Math.pi * 180";break;case "ATAN":d="Math.atan("+a+") / Math.pi * 180";break;default:throw Error("Unknown math operator: "+c);}return[d,Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE]},math_constant$$module$build$src$generators$dart$math=function(a,b){const c={PI:["Math.pi",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX],E:["Math.e",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE],
99
+ SQRT2:["Math.sqrt2",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX],SQRT1_2:["Math.sqrt1_2",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX],INFINITY:["double.infinity",Order$$module$build$src$generators$dart$dart_generator.ATOMIC]};a=a.getFieldValue("CONSTANT");a!=="INFINITY"&&(b.definitions_.import_dart_math="import 'dart:math' as Math;");return c[a]},math_number_property$$module$build$src$generators$dart$math=function(a,b){var c={EVEN:[" % 2 == 0",Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE,
100
100
  Order$$module$build$src$generators$dart$dart_generator.EQUALITY],ODD:[" % 2 == 1",Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE,Order$$module$build$src$generators$dart$dart_generator.EQUALITY],WHOLE:[" % 1 == 0",Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE,Order$$module$build$src$generators$dart$dart_generator.EQUALITY],POSITIVE:[" > 0",Order$$module$build$src$generators$dart$dart_generator.RELATIONAL,Order$$module$build$src$generators$dart$dart_generator.RELATIONAL],
101
101
  NEGATIVE:[" < 0",Order$$module$build$src$generators$dart$dart_generator.RELATIONAL,Order$$module$build$src$generators$dart$dart_generator.RELATIONAL],DIVISIBLE_BY:[null,Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE,Order$$module$build$src$generators$dart$dart_generator.EQUALITY],PRIME:[null,Order$$module$build$src$generators$dart$dart_generator.NONE,Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]};const d=a.getFieldValue("PROPERTY"),[e,f,g]=c[d];c=b.valueToCode(a,
102
- "NUMBER_TO_CHECK",f)||"0";if("PRIME"===d)b.definitions_.import_dart_math="import 'dart:math' as Math;",a=b.provideFunction_("math_isPrime",`
102
+ "NUMBER_TO_CHECK",f)||"0";if(d==="PRIME")b.definitions_.import_dart_math="import 'dart:math' as Math;",a=b.provideFunction_("math_isPrime",`
103
103
  bool ${b.FUNCTION_NAME_PLACEHOLDER_}(n) {
104
104
  // https://en.wikipedia.org/wiki/Primality_test#Naive_methods
105
105
  if (n == 2 || n == 3) {
@@ -118,7 +118,7 @@ bool ${b.FUNCTION_NAME_PLACEHOLDER_}(n) {
118
118
  }
119
119
  return true;
120
120
  }
121
- `)+"("+c+")";else if("DIVISIBLE_BY"===d){a=b.valueToCode(a,"DIVISOR",Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE)||"0";if("0"===a)return["false",Order$$module$build$src$generators$dart$dart_generator.ATOMIC];a=c+" % "+a+" == 0"}else a=c+e;return[a,g]},math_change$$module$build$src$generators$dart$math=function(a,b){const c=b.valueToCode(a,"DELTA",Order$$module$build$src$generators$dart$dart_generator.ADDITIVE)||"0";a=b.getVariableName(a.getFieldValue("VAR"));return a+" = ("+
121
+ `)+"("+c+")";else if(d==="DIVISIBLE_BY"){a=b.valueToCode(a,"DIVISOR",Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE)||"0";if(a==="0")return["false",Order$$module$build$src$generators$dart$dart_generator.ATOMIC];a=c+" % "+a+" == 0"}else a=c+e;return[a,g]},math_change$$module$build$src$generators$dart$math=function(a,b){const c=b.valueToCode(a,"DELTA",Order$$module$build$src$generators$dart$dart_generator.ADDITIVE)||"0";a=b.getVariableName(a.getFieldValue("VAR"));return a+" = ("+
122
122
  a+" is num ? "+a+" : 0) + "+c+";\n"},math_on_list$$module$build$src$generators$dart$math=function(a,b){const c=a.getFieldValue("OP");a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$dart$dart_generator.NONE)||"[]";switch(c){case "SUM":b=b.provideFunction_("math_sum",`
123
123
  num ${b.FUNCTION_NAME_PLACEHOLDER_}(List<num> myList) {
124
124
  num sumVal = 0;
@@ -232,9 +232,9 @@ b)[0]+";\n"},procedures_ifreturn$$module$build$src$generators$dart$procedures=fu
232
232
  function(a,b){return[b.quote_(a.getFieldValue("TEXT")),Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},text_join$$module$build$src$generators$dart$text=function(a,b){switch(a.itemCount_){case 0:return["''",Order$$module$build$src$generators$dart$dart_generator.ATOMIC];case 1:return[(b.valueToCode(a,"ADD0",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+".toString()",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];default:const c=Array(a.itemCount_);
233
233
  for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";return["["+c.join(",")+"].join()",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]}},text_append$$module$build$src$generators$dart$text=function(a,b){const c=b.getVariableName(a.getFieldValue("VAR"));a=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";return c+" = ["+c+", "+a+"].join();\n"},text_length$$module$build$src$generators$dart$text=
234
234
  function(a,b){return[(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+".length",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},text_isEmpty$$module$build$src$generators$dart$text=function(a,b){return[(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+".isEmpty",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},text_indexOf$$module$build$src$generators$dart$text=
235
- function(a,b){const c="FIRST"===a.getFieldValue("END")?"indexOf":"lastIndexOf",d=b.valueToCode(a,"FIND",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";b=(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+"."+c+"("+d+")";return a.workspace.options.oneBasedIndex?[b+" + 1",Order$$module$build$src$generators$dart$dart_generator.ADDITIVE]:[b,Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},text_charAt$$module$build$src$generators$dart$text=
236
- function(a,b){const c=a.getFieldValue("WHERE")||"FROM_START",d=b.valueToCode(a,"VALUE","FIRST"===c||"FROM_START"===c?Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX:Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";switch(c){case "FIRST":return[d+"[0]",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];case "FROM_START":return a=b.getAdjusted(a,"AT"),[d+"["+a+"]",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];case "LAST":case "FROM_END":return a=
237
- "LAST"===c?1:b.getAdjusted(a,"AT",1),[`${b.provideFunction_("text_get_from_end",`
235
+ function(a,b){const c=a.getFieldValue("END")==="FIRST"?"indexOf":"lastIndexOf",d=b.valueToCode(a,"FIND",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";b=(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+"."+c+"("+d+")";return a.workspace.options.oneBasedIndex?[b+" + 1",Order$$module$build$src$generators$dart$dart_generator.ADDITIVE]:[b,Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},text_charAt$$module$build$src$generators$dart$text=
236
+ function(a,b){const c=a.getFieldValue("WHERE")||"FROM_START",d=b.valueToCode(a,"VALUE",c==="FIRST"||c==="FROM_START"?Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX:Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";switch(c){case "FIRST":return[d+"[0]",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];case "FROM_START":return a=b.getAdjusted(a,"AT"),[d+"["+a+"]",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];case "LAST":case "FROM_END":return a=
237
+ c==="LAST"?1:b.getAdjusted(a,"AT",1),[`${b.provideFunction_("text_get_from_end",`
238
238
  String ${b.FUNCTION_NAME_PLACEHOLDER_}(String text, num x) {
239
239
  return text[text.length - x];
240
240
  }
@@ -243,9 +243,9 @@ String ${b.FUNCTION_NAME_PLACEHOLDER_}(String text) {
243
243
  int x = new Math.Random().nextInt(text.length);
244
244
  return text[x];
245
245
  }
246
- `)+"("+d+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]}throw Error("Unhandled option (text_charAt).");},text_getSubstring$$module$build$src$generators$dart$text=function(a,b){var c=a.getFieldValue("WHERE1");const d=a.getFieldValue("WHERE2"),e="FROM_END"!==c&&"FROM_START"===d,f=b.valueToCode(a,"STRING",e?Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX:Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";if("FIRST"===c&&"LAST"===d)return[f,
246
+ `)+"("+d+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]}throw Error("Unhandled option (text_charAt).");},text_getSubstring$$module$build$src$generators$dart$text=function(a,b){var c=a.getFieldValue("WHERE1");const d=a.getFieldValue("WHERE2"),e=c!=="FROM_END"&&d==="FROM_START",f=b.valueToCode(a,"STRING",e?Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX:Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";if(c==="FIRST"&&d==="LAST")return[f,
247
247
  Order$$module$build$src$generators$dart$dart_generator.NONE];if(f.match(/^'?\w+'?$/)||e){switch(c){case "FROM_START":c=b.getAdjusted(a,"AT1");break;case "FROM_END":c=b.getAdjusted(a,"AT1",1,!1,Order$$module$build$src$generators$dart$dart_generator.ADDITIVE);c=f+".length - "+c;break;case "FIRST":c="0";break;default:throw Error("Unhandled option (text_getSubstring).");}switch(d){case "FROM_START":var g=b.getAdjusted(a,"AT2",1);break;case "FROM_END":g=b.getAdjusted(a,"AT2",0,!1,Order$$module$build$src$generators$dart$dart_generator.ADDITIVE);
248
- g=f+".length - "+g;break;case "LAST":break;default:throw Error("Unhandled option (text_getSubstring).");}b="LAST"===d?f+".substring("+c+")":f+".substring("+c+", "+g+")"}else g=b.getAdjusted(a,"AT1"),a=b.getAdjusted(a,"AT2"),b=b.provideFunction_("text_get_substring",`
248
+ g=f+".length - "+g;break;case "LAST":break;default:throw Error("Unhandled option (text_getSubstring).");}b=d==="LAST"?f+".substring("+c+")":f+".substring("+c+", "+g+")"}else g=b.getAdjusted(a,"AT1"),a=b.getAdjusted(a,"AT2"),b=b.provideFunction_("text_get_substring",`
249
249
  String ${b.FUNCTION_NAME_PLACEHOLDER_}(String text, String where1, num at1, String where2, num at2) {
250
250
  int getAt(String where, num at) {
251
251
  if (where == 'FROM_END') {
@@ -280,7 +280,7 @@ String ${b.FUNCTION_NAME_PLACEHOLDER_}(String str) {
280
280
  return title.toString();
281
281
  }
282
282
  `)+"("+a+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},text_trim$$module$build$src$generators$dart$text=function(a,b){const c={LEFT:".replaceFirst(new RegExp(r'^\\s+'), '')",RIGHT:".replaceFirst(new RegExp(r'\\s+$'), '')",BOTH:".trim()"}[a.getFieldValue("MODE")];return[(b.valueToCode(a,"TEXT",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+c,Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},text_print$$module$build$src$generators$dart$text=
283
- function(a,b){return"print("+(b.valueToCode(a,"TEXT",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''")+");\n"},text_prompt_ext$$module$build$src$generators$dart$text=function(a,b){b.definitions_.import_dart_html="import 'dart:html' as Html;";let c="Html.window.prompt("+(a.getField("TEXT")?b.quote_(a.getFieldValue("TEXT")):b.valueToCode(a,"TEXT",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''")+", '')";"NUMBER"===a.getFieldValue("TYPE")&&(b.definitions_.import_dart_math=
283
+ function(a,b){return"print("+(b.valueToCode(a,"TEXT",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''")+");\n"},text_prompt_ext$$module$build$src$generators$dart$text=function(a,b){b.definitions_.import_dart_html="import 'dart:html' as Html;";let c="Html.window.prompt("+(a.getField("TEXT")?b.quote_(a.getFieldValue("TEXT")):b.valueToCode(a,"TEXT",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''")+", '')";a.getFieldValue("TYPE")==="NUMBER"&&(b.definitions_.import_dart_math=
284
284
  "import 'dart:math' as Math;",c="Math.parseDouble("+c+")");return[c,Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},text_count$$module$build$src$generators$dart$text=function(a,b){const c=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";a=b.valueToCode(a,"SUB",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";return[b.provideFunction_("text_count",`
285
285
  int ${b.FUNCTION_NAME_PLACEHOLDER_}(String haystack, String needle) {
286
286
  if (needle.length == 0) {
@@ -302,12 +302,12 @@ text_reverse$$module$build$src$generators$dart$text=function(a,b){return["new St
302
302
  function(a,b){const c=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.ASSIGNMENT)||"0";return b.getVariableName(a.getFieldValue("VAR"))+" = "+c+";\n"},Order$$module$build$src$generators$dart$dart_generator;
303
303
  (function(a){a[a.ATOMIC=0]="ATOMIC";a[a.UNARY_POSTFIX=1]="UNARY_POSTFIX";a[a.UNARY_PREFIX=2]="UNARY_PREFIX";a[a.MULTIPLICATIVE=3]="MULTIPLICATIVE";a[a.ADDITIVE=4]="ADDITIVE";a[a.SHIFT=5]="SHIFT";a[a.BITWISE_AND=6]="BITWISE_AND";a[a.BITWISE_XOR=7]="BITWISE_XOR";a[a.BITWISE_OR=8]="BITWISE_OR";a[a.RELATIONAL=9]="RELATIONAL";a[a.EQUALITY=10]="EQUALITY";a[a.LOGICAL_AND=11]="LOGICAL_AND";a[a.LOGICAL_OR=12]="LOGICAL_OR";a[a.IF_NULL=13]="IF_NULL";a[a.CONDITIONAL=14]="CONDITIONAL";a[a.CASCADE=15]="CASCADE";
304
304
  a[a.ASSIGNMENT=16]="ASSIGNMENT";a[a.NONE=99]="NONE"})(Order$$module$build$src$generators$dart$dart_generator||(Order$$module$build$src$generators$dart$dart_generator={}));
305
- var DartGenerator$$module$build$src$generators$dart$dart_generator=class extends $.CodeGenerator$$module$build$src$core$generator{constructor(a="Dart"){super(a);this.isInitialized=!1;for(const b in Order$$module$build$src$generators$dart$dart_generator)a=Order$$module$build$src$generators$dart$dart_generator[b],"string"!==typeof a&&(this["ORDER_"+b]=a);this.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")}init(a){super.init(a);
305
+ var DartGenerator$$module$build$src$generators$dart$dart_generator=class extends $.CodeGenerator$$module$build$src$core$generator{constructor(a="Dart"){super(a);this.isInitialized=!1;for(const b in Order$$module$build$src$generators$dart$dart_generator)a=Order$$module$build$src$generators$dart$dart_generator[b],typeof a!=="string"&&(this["ORDER_"+b]=a);this.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")}init(a){super.init(a);
306
306
  this.nameDB_?this.nameDB_.reset():this.nameDB_=new $.Names$$module$build$src$core$names(this.RESERVED_WORDS_);this.nameDB_.setVariableMap(a.getVariableMap());this.nameDB_.populateVariables(a);this.nameDB_.populateProcedures(a);const b=[];var c=$.allDeveloperVariables$$module$build$src$core$variables(a);for(let d=0;d<c.length;d++)b.push(this.nameDB_.getName(c[d],$.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE));a=$.allUsedVarModels$$module$build$src$core$variables(a);for(c=0;c<a.length;c++)b.push(this.nameDB_.getName(a[c].getId(),
307
307
  $.NameType$$module$build$src$core$names.VARIABLE));b.length&&(this.definitions_.variables="var "+b.join(", ")+";");this.isInitialized=!0}finish(a){a&&(a=this.prefixLines(a,this.INDENT));a="main() {\n"+a+"}";const b=[],c=[];for(let d in this.definitions_){const e=this.definitions_[d];e.match(/^import\s/)?b.push(e):c.push(e)}a=super.finish(a);this.isInitialized=!1;this.nameDB_.reset();return(b.join("\n")+"\n\n"+c.join("\n\n")).replace(/\n\n+/g,"\n\n").replace(/\n*$/,"\n\n\n")+a}scrubNakedValue(a){return a+
308
308
  ";\n"}quote_(a){a=a.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n").replace(/\$/g,"\\$").replace(/'/g,"\\'");return"'"+a+"'"}multiline_quote_(a){return a.split(/\n/g).map(this.quote_).join(" + '\\n' + \n")}scrub_(a,b,c=!1){let d="";if(!a.outputConnection||!a.outputConnection.targetConnection){var e=a.getCommentText();e&&(e=$.wrap$$module$build$src$core$utils$string(e,this.COMMENT_WRAP-3),d=a.getProcedureDef?d+this.prefixLines(e+"\n","/// "):d+this.prefixLines(e+"\n","// "));for(let f=0;f<a.inputList.length;f++)a.inputList[f].type===
309
309
  $.inputTypes$$module$build$src$core$inputs$input_types.VALUE&&(e=a.inputList[f].connection.targetBlock())&&(e=this.allNestedComments(e))&&(d+=this.prefixLines(e,"// "))}a=a.nextConnection&&a.nextConnection.targetBlock();c=c?"":this.blockToCode(a);return d+b+c}getAdjusted(a,b,c=0,d=!1,e=Order$$module$build$src$generators$dart$dart_generator.NONE){a.workspace.options.oneBasedIndex&&c--;const f=a.workspace.options.oneBasedIndex?"1":"0";let g=e;c?g=Order$$module$build$src$generators$dart$dart_generator.ADDITIVE:
310
- d&&(g=Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX);a=this.valueToCode(a,b,g)||f;if(0===c&&!d)return a;if($.isNumber$$module$build$src$core$utils$string(a))return a=String(Number(a)+c),d&&(a=String(-Number(a))),a;0<c?a=`${a} + ${c}`:0>c&&(a=`${a} - ${-c}`);d&&(a=c?`-(${a})`:`-${a}`);Math.floor(e)>=Math.floor(g)&&(a=`(${a})`);return a}},module$build$src$generators$dart$dart_generator={};module$build$src$generators$dart$dart_generator.DartGenerator=DartGenerator$$module$build$src$generators$dart$dart_generator;
310
+ d&&(g=Order$$module$build$src$generators$dart$dart_generator.UNARY_PREFIX);a=this.valueToCode(a,b,g)||f;if(c===0&&!d)return a;if($.isNumber$$module$build$src$core$utils$string(a))return a=String(Number(a)+c),d&&(a=String(-Number(a))),a;c>0?a=`${a} + ${c}`:c<0&&(a=`${a} - ${-c}`);d&&(a=c?`-(${a})`:`-${a}`);Math.floor(e)>=Math.floor(g)&&(a=`(${a})`);return a}},module$build$src$generators$dart$dart_generator={};module$build$src$generators$dart$dart_generator.DartGenerator=DartGenerator$$module$build$src$generators$dart$dart_generator;
311
311
  module$build$src$generators$dart$dart_generator.Order=Order$$module$build$src$generators$dart$dart_generator;var module$build$src$generators$dart$lists={};module$build$src$generators$dart$lists.lists_create_empty=lists_create_empty$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_create_with=lists_create_with$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_getIndex=lists_getIndex$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_getSublist=lists_getSublist$$module$build$src$generators$dart$lists;
312
312
  module$build$src$generators$dart$lists.lists_indexOf=lists_indexOf$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_isEmpty=lists_isEmpty$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_length=lists_length$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_repeat=lists_repeat$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_reverse=lists_reverse$$module$build$src$generators$dart$lists;
313
313
  module$build$src$generators$dart$lists.lists_setIndex=lists_setIndex$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_sort=lists_sort$$module$build$src$generators$dart$lists;module$build$src$generators$dart$lists.lists_split=lists_split$$module$build$src$generators$dart$lists;var controls_ifelse$$module$build$src$generators$dart$logic=controls_if$$module$build$src$generators$dart$logic,module$build$src$generators$dart$logic={};module$build$src$generators$dart$logic.controls_if=controls_if$$module$build$src$generators$dart$logic;module$build$src$generators$dart$logic.controls_ifelse=controls_if$$module$build$src$generators$dart$logic;module$build$src$generators$dart$logic.logic_boolean=logic_boolean$$module$build$src$generators$dart$logic;