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.
- package/blockly.min.js +933 -904
- package/blockly_compressed.js +839 -809
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +57 -58
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +1 -1
- package/core/block_svg.d.ts +4 -1
- package/core/bubbles/bubble.d.ts +17 -2
- package/core/bubbles/textinput_bubble.d.ts +14 -17
- package/core/clipboard.d.ts +76 -15
- package/core/comments/collapse_comment_bar_button.d.ts +52 -0
- package/core/comments/comment_bar_button.d.ts +62 -0
- package/core/comments/comment_view.d.ts +13 -25
- package/core/comments/delete_comment_bar_button.d.ts +52 -0
- package/core/comments.d.ts +3 -0
- package/core/field_input.d.ts +3 -3
- package/core/icons/comment_icon.d.ts +3 -3
- package/core/insertion_marker_previewer.d.ts +11 -0
- package/core/interfaces/i_variable_map.d.ts +1 -1
- package/core/keyboard_nav/block_comment_navigation_policy.d.ts +56 -0
- package/core/keyboard_nav/block_navigation_policy.d.ts +7 -6
- package/core/keyboard_nav/comment_bar_button_navigation_policy.d.ts +56 -0
- package/core/keyboard_nav/comment_editor_navigation_policy.d.ts +34 -0
- package/core/keyboard_nav/line_cursor.d.ts +8 -8
- package/core/keyboard_nav/workspace_comment_navigation_policy.d.ts +56 -0
- package/core/marker_manager.d.ts +2 -2
- package/core/registry.d.ts +1 -1
- package/core/utils/focusable_tree_traverser.d.ts +2 -2
- package/core/utils/rect.d.ts +9 -0
- package/core/workspace.d.ts +10 -0
- package/core/workspace_svg.d.ts +19 -4
- package/dart_compressed.js +38 -38
- package/dart_compressed.js.map +1 -1
- package/javascript_compressed.js +37 -37
- package/javascript_compressed.js.map +1 -1
- package/lua_compressed.js +30 -30
- package/lua_compressed.js.map +1 -1
- package/package.json +8 -7
- package/php_compressed.js +39 -39
- package/php_compressed.js.map +1 -1
- package/python_compressed.js +32 -32
- package/python_compressed.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blockly",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.3.0-beta.0",
|
|
4
4
|
"description": "Blockly is a library for building visual programming editors.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"blockly"
|
|
@@ -67,24 +67,25 @@
|
|
|
67
67
|
},
|
|
68
68
|
"license": "Apache-2.0",
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@blockly/block-test": "^
|
|
71
|
-
"@blockly/dev-tools": "^9.0.
|
|
72
|
-
"@blockly/theme-modern": "^
|
|
70
|
+
"@blockly/block-test": "^7.0.2",
|
|
71
|
+
"@blockly/dev-tools": "^9.0.2",
|
|
72
|
+
"@blockly/theme-modern": "^7.0.1",
|
|
73
73
|
"@hyperjump/browser": "^1.1.4",
|
|
74
74
|
"@hyperjump/json-schema": "^1.5.0",
|
|
75
|
-
"@microsoft/api-documenter": "
|
|
75
|
+
"@microsoft/api-documenter": "7.22.4",
|
|
76
76
|
"@microsoft/api-extractor": "^7.29.5",
|
|
77
|
+
"ajv": "^8.17.1",
|
|
77
78
|
"async-done": "^2.0.0",
|
|
78
79
|
"chai": "^5.1.1",
|
|
79
80
|
"concurrently": "^9.0.1",
|
|
80
81
|
"eslint": "^9.15.0",
|
|
81
82
|
"eslint-config-google": "^0.14.0",
|
|
82
83
|
"eslint-config-prettier": "^10.1.1",
|
|
83
|
-
"eslint-plugin-jsdoc": "^
|
|
84
|
+
"eslint-plugin-jsdoc": "^52.0.2",
|
|
84
85
|
"eslint-plugin-prettier": "^5.2.1",
|
|
85
86
|
"glob": "^11.0.1",
|
|
86
87
|
"globals": "^16.0.0",
|
|
87
|
-
"google-closure-compiler": "^
|
|
88
|
+
"google-closure-compiler": "^20250709.0.0",
|
|
88
89
|
"gulp": "^5.0.0",
|
|
89
90
|
"gulp-concat": "^2.6.1",
|
|
90
91
|
"gulp-gzip": "^1.4.2",
|
package/php_compressed.js
CHANGED
|
@@ -30,7 +30,7 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($value) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
`);a=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"''";return[c+"("+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_isEmpty$$module$build$src$generators$php$lists=function(a,b){return["empty("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL)||"array()")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_indexOf$$module$build$src$generators$php$lists=function(a,
|
|
33
|
-
b){const c=b.valueToCode(a,"FIND",Order$$module$build$src$generators$php$php_generator.NONE)||"''",d=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.MEMBER)||"[]";let e=" -1",f="";a.workspace.options.oneBasedIndex&&(e=" 0",f=" + 1");return[(
|
|
33
|
+
b){const c=b.valueToCode(a,"FIND",Order$$module$build$src$generators$php$php_generator.NONE)||"''",d=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.MEMBER)||"[]";let e=" -1",f="";a.workspace.options.oneBasedIndex&&(e=" 0",f=" + 1");return[(a.getFieldValue("END")==="FIRST"?b.provideFunction_("indexOf",`
|
|
34
34
|
function ${b.FUNCTION_NAME_PLACEHOLDER_}($haystack, $needle) {
|
|
35
35
|
for ($index = 0; $index < count($haystack); $index++) {
|
|
36
36
|
if ($haystack[$index] == $needle) return $index${f};
|
|
@@ -45,41 +45,41 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($haystack, $needle) {
|
|
|
45
45
|
}
|
|
46
46
|
return $last;
|
|
47
47
|
}
|
|
48
|
-
`))+"("+d+", "+c+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_getIndex$$module$build$src$generators$php$lists=function(a,b){var c=a.getFieldValue("MODE")||"GET";switch(a.getFieldValue("WHERE")||"FROM_START"){case "FIRST":if("GET"
|
|
49
|
-
Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if("REMOVE"
|
|
50
|
-
|
|
51
|
-
d+"]",Order$$module$build$src$generators$php$php_generator.MEMBER];if("GET_REMOVE"
|
|
52
|
-
"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()",b=b.getAdjusted(a,"AT",1,!0),["array_slice("+c+", "+b+", 1)[0]",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if("GET_REMOVE"===
|
|
53
|
-
|
|
48
|
+
`))+"("+d+", "+c+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_getIndex$$module$build$src$generators$php$lists=function(a,b){var c=a.getFieldValue("MODE")||"GET";switch(a.getFieldValue("WHERE")||"FROM_START"){case "FIRST":if(c==="GET")return[(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.MEMBER)||"array()")+"[0]",Order$$module$build$src$generators$php$php_generator.MEMBER];if(c==="GET_REMOVE")return["array_shift("+(b.valueToCode(a,"VALUE",
|
|
49
|
+
Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if(c==="REMOVE")return"array_shift("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+");\n";break;case "LAST":if(c==="GET")return["end("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if(c===
|
|
50
|
+
"GET_REMOVE")return["array_pop("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if(c==="REMOVE")return"array_pop("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+");\n";break;case "FROM_START":var d=b.getAdjusted(a,"AT");if(c==="GET")return[(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.MEMBER)||"array()")+
|
|
51
|
+
"["+d+"]",Order$$module$build$src$generators$php$php_generator.MEMBER];if(c==="GET_REMOVE")return["array_splice("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+", "+d+", 1)[0]",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if(c==="REMOVE")return"array_splice("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+", "+d+", 1);\n";break;case "FROM_END":if(c==="GET")return c=b.valueToCode(a,
|
|
52
|
+
"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()",b=b.getAdjusted(a,"AT",1,!0),["array_slice("+c+", "+b+", 1)[0]",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if(c==="GET_REMOVE"||c==="REMOVE"){d=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()";b=b.getAdjusted(a,"AT",1,!1,Order$$module$build$src$generators$php$php_generator.SUBTRACTION);b="array_splice("+d+", count("+d+") - "+b+", 1)[0]";if(c==="GET_REMOVE")return[b,
|
|
53
|
+
Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if(c==="REMOVE")return b+";\n"}break;case "RANDOM":a=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"array()";if(c==="GET")return[b.provideFunction_("lists_get_random_item",`
|
|
54
54
|
function ${b.FUNCTION_NAME_PLACEHOLDER_}($list) {
|
|
55
55
|
return $list[rand(0,count($list)-1)];
|
|
56
56
|
}
|
|
57
|
-
`)+"("+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if("GET_REMOVE"
|
|
57
|
+
`)+"("+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if(c==="GET_REMOVE")return[b.provideFunction_("lists_get_remove_random_item",`
|
|
58
58
|
function ${b.FUNCTION_NAME_PLACEHOLDER_}(&$list) {
|
|
59
59
|
$x = rand(0,count($list)-1);
|
|
60
60
|
unset($list[$x]);
|
|
61
61
|
return array_values($list);
|
|
62
62
|
}
|
|
63
|
-
`)+"("+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if("REMOVE"
|
|
63
|
+
`)+"("+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];if(c==="REMOVE")return b.provideFunction_("lists_remove_random_item",`
|
|
64
64
|
function ${b.FUNCTION_NAME_PLACEHOLDER_}(&$list) {
|
|
65
65
|
unset($list[rand(0,count($list)-1)]);
|
|
66
66
|
}
|
|
67
|
-
`)+"("+a+");\n"}throw Error("Unhandled combination (lists_getIndex).");},lists_setIndex$$module$build$src$generators$php$lists=function(a,b){const c=a.getFieldValue("MODE")||"GET";var d=a.getFieldValue("WHERE")||"FROM_START";const e=b.valueToCode(a,"TO",Order$$module$build$src$generators$php$php_generator.ASSIGNMENT)||"null";switch(d){case "FIRST":if("SET"
|
|
68
|
-
(b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+", "+e+");\n";break;case "LAST":a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"array()";if("SET"
|
|
67
|
+
`)+"("+a+");\n"}throw Error("Unhandled combination (lists_getIndex).");},lists_setIndex$$module$build$src$generators$php$lists=function(a,b){const c=a.getFieldValue("MODE")||"GET";var d=a.getFieldValue("WHERE")||"FROM_START";const e=b.valueToCode(a,"TO",Order$$module$build$src$generators$php$php_generator.ASSIGNMENT)||"null";switch(d){case "FIRST":if(c==="SET")return(b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.MEMBER)||"array()")+"[0] = "+e+";\n";if(c==="INSERT")return"array_unshift("+
|
|
68
|
+
(b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+", "+e+");\n";break;case "LAST":a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"array()";if(c==="SET")return b.provideFunction_("lists_set_last_item",`
|
|
69
69
|
function ${b.FUNCTION_NAME_PLACEHOLDER_}(&$list, $value) {
|
|
70
70
|
$list[count($list) - 1] = $value;
|
|
71
71
|
}
|
|
72
|
-
`)+"("+a+", "+e+");\n";if("INSERT"
|
|
73
|
-
"array()";a=b.getAdjusted(a,"AT",1);if("SET"
|
|
72
|
+
`)+"("+a+", "+e+");\n";if(c==="INSERT")return"array_push("+a+", "+e+");\n";break;case "FROM_START":d=b.getAdjusted(a,"AT");if(c==="SET")return(b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.MEMBER)||"array()")+"["+d+"] = "+e+";\n";if(c==="INSERT")return"array_splice("+(b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"array()")+", "+d+", 0, "+e+");\n";break;case "FROM_END":d=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||
|
|
73
|
+
"array()";a=b.getAdjusted(a,"AT",1);if(c==="SET")return b.provideFunction_("lists_set_from_end",`
|
|
74
74
|
function ${b.FUNCTION_NAME_PLACEHOLDER_}(&$list, $at, $value) {
|
|
75
75
|
$list[count($list) - $at] = $value;
|
|
76
76
|
}
|
|
77
|
-
`)+"("+d+", "+a+", "+e+");\n";if("INSERT"
|
|
77
|
+
`)+"("+d+", "+a+", "+e+");\n";if(c==="INSERT")return b.provideFunction_("lists_insert_from_end",`
|
|
78
78
|
function ${b.FUNCTION_NAME_PLACEHOLDER_}(&$list, $at, $value) {
|
|
79
79
|
return array_splice($list, count($list) - $at, 0, $value);
|
|
80
80
|
}
|
|
81
|
-
`)+"("+d+", "+a+", "+e+");\n";break;case "RANDOM":a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.REFERENCE)||"array()";if(a.match(/^\$\w+$/))d="";else{d=b.nameDB_.getDistinctName("tmp_list",$.NameType$$module$build$src$core$names.VARIABLE);var f=d+" = &"+a+";\n";a=d;d=f}b=b.nameDB_.getDistinctName("tmp_x",$.NameType$$module$build$src$core$names.VARIABLE);d+=b+" = rand(0, count("+a+")-1);\n";if("SET"
|
|
82
|
-
a+", "+b+", 0, "+e+");\n")}throw Error("Unhandled combination (lists_setIndex).");},lists_getSublist$$module$build$src$generators$php$lists=function(a,b){var c=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"array()",d=a.getFieldValue("WHERE1");const e=a.getFieldValue("WHERE2");if("FIRST"!==
|
|
81
|
+
`)+"("+d+", "+a+", "+e+");\n";break;case "RANDOM":a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.REFERENCE)||"array()";if(a.match(/^\$\w+$/))d="";else{d=b.nameDB_.getDistinctName("tmp_list",$.NameType$$module$build$src$core$names.VARIABLE);var f=d+" = &"+a+";\n";a=d;d=f}b=b.nameDB_.getDistinctName("tmp_x",$.NameType$$module$build$src$core$names.VARIABLE);d+=b+" = rand(0, count("+a+")-1);\n";if(c==="SET")return d+(a+"["+b+"] = "+e+";\n");if(c==="INSERT")return d+("array_splice("+
|
|
82
|
+
a+", "+b+", 0, "+e+");\n")}throw Error("Unhandled combination (lists_setIndex).");},lists_getSublist$$module$build$src$generators$php$lists=function(a,b){var c=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"array()",d=a.getFieldValue("WHERE1");const e=a.getFieldValue("WHERE2");if(d!=="FIRST"||e!=="LAST")if(c.match(/^\$\w+$/)||d!=="FROM_END"&&e==="FROM_START"){switch(d){case "FROM_START":d=b.getAdjusted(a,"AT1");break;case "FROM_END":d=b.getAdjusted(a,"AT1",1,!1,
|
|
83
83
|
Order$$module$build$src$generators$php$php_generator.SUBTRACTION);d="count("+c+") - "+d;break;case "FIRST":d="0";break;default:throw Error("Unhandled option (lists_getSublist).");}switch(e){case "FROM_START":b=b.getAdjusted(a,"AT2",0,!1,Order$$module$build$src$generators$php$php_generator.SUBTRACTION);b+=" - ";b=$.isNumber$$module$build$src$core$utils$string(String(d))||String(d).match(/^\(.+\)$/)?b+d:b+("("+d+")");b+=" + 1";break;case "FROM_END":b=b.getAdjusted(a,"AT2",0,!1,Order$$module$build$src$generators$php$php_generator.SUBTRACTION);
|
|
84
84
|
b="count("+c+") - "+b+" - ";b=$.isNumber$$module$build$src$core$utils$string(String(d))||String(d).match(/^\(.+\)$/)?b+d:b+("("+d+")");break;case "LAST":b="count("+c+") - ";b=$.isNumber$$module$build$src$core$utils$string(String(d))||String(d).match(/^\(.+\)$/)?b+d:b+("("+d+")");break;default:throw Error("Unhandled option (lists_getSublist).");}c="array_slice("+c+", "+d+", "+b+")"}else{const f=b.getAdjusted(a,"AT1");a=b.getAdjusted(a,"AT2");c=b.provideFunction_("lists_get_sublist",`
|
|
85
85
|
function ${b.FUNCTION_NAME_PLACEHOLDER_}($list, $where1, $at1, $where2, $at2) {
|
|
@@ -102,7 +102,7 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($list, $where1, $at1, $where2, $at2) {
|
|
|
102
102
|
}
|
|
103
103
|
return array_slice($list, $at1, $length);
|
|
104
104
|
}
|
|
105
|
-
`)+"("+c+", '"+d+"', "+f+", '"+e+"', "+a+")"}return[c,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_sort$$module$build$src$generators$php$lists=function(a,b){const c=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"array()",d=
|
|
105
|
+
`)+"("+c+", '"+d+"', "+f+", '"+e+"', "+a+")"}return[c,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_sort$$module$build$src$generators$php$lists=function(a,b){const c=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"array()",d=a.getFieldValue("DIRECTION")==="1"?1:-1;a=a.getFieldValue("TYPE");return[b.provideFunction_("lists_sort",`
|
|
106
106
|
function ${b.FUNCTION_NAME_PLACEHOLDER_}($list, $type, $direction) {
|
|
107
107
|
$sortCmpFuncs = array(
|
|
108
108
|
'NUMERIC' => 'strnatcasecmp',
|
|
@@ -117,27 +117,27 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($list, $type, $direction) {
|
|
|
117
117
|
}
|
|
118
118
|
return $list2;
|
|
119
119
|
}
|
|
120
|
-
`)+"("+c+', "'+a+'", '+d+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_split$$module$build$src$generators$php$lists=function(a,b){let c=b.valueToCode(a,"INPUT",Order$$module$build$src$generators$php$php_generator.NONE);b=b.valueToCode(a,"DELIM",Order$$module$build$src$generators$php$php_generator.NONE)||"''";a=a.getFieldValue("MODE");if("SPLIT"
|
|
120
|
+
`)+"("+c+', "'+a+'", '+d+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_split$$module$build$src$generators$php$lists=function(a,b){let c=b.valueToCode(a,"INPUT",Order$$module$build$src$generators$php$php_generator.NONE);b=b.valueToCode(a,"DELIM",Order$$module$build$src$generators$php$php_generator.NONE)||"''";a=a.getFieldValue("MODE");if(a==="SPLIT")c||(c="''"),a="explode";else if(a==="JOIN")c||(c="array()"),a="implode";else throw Error("Unknown mode: "+a);return[a+
|
|
121
121
|
"("+b+", "+c+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},lists_reverse$$module$build$src$generators$php$lists=function(a,b){return["array_reverse("+(b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.NONE)||"[]")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},controls_if$$module$build$src$generators$php$logic=function(a,b){let c=0,d="",e,f;b.STATEMENT_PREFIX&&(d+=b.injectId(b.STATEMENT_PREFIX,a));do f=b.valueToCode(a,
|
|
122
|
-
"IF"+c,Order$$module$build$src$generators$php$php_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
|
|
123
|
-
function(a,b){const c={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[a.getFieldValue("OP")],d="=="===
|
|
124
|
-
Order$$module$build$src$generators$php$php_generator.LOGICAL_OR;let e=b.valueToCode(a,"A",d);a=b.valueToCode(a,"B",d);e||a?(b="&&"
|
|
122
|
+
"IF"+c,Order$$module$build$src$generators$php$php_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$php$logic=
|
|
123
|
+
function(a,b){const c={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[a.getFieldValue("OP")],d=c==="=="||c==="!="?Order$$module$build$src$generators$php$php_generator.EQUALITY:Order$$module$build$src$generators$php$php_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$php$logic=function(a,b){const c=a.getFieldValue("OP")==="AND"?"&&":"||",d=c==="&&"?Order$$module$build$src$generators$php$php_generator.LOGICAL_AND:
|
|
124
|
+
Order$$module$build$src$generators$php$php_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$php$logic=function(a,b){const c=Order$$module$build$src$generators$php$php_generator.LOGICAL_NOT;return["!"+(b.valueToCode(a,"BOOL",c)||"true"),c]},logic_boolean$$module$build$src$generators$php$logic=function(a,b){return[a.getFieldValue("BOOL")==="TRUE"?
|
|
125
125
|
"true":"false",Order$$module$build$src$generators$php$php_generator.ATOMIC]},logic_null$$module$build$src$generators$php$logic=function(a,b){return["null",Order$$module$build$src$generators$php$php_generator.ATOMIC]},logic_ternary$$module$build$src$generators$php$logic=function(a,b){const c=b.valueToCode(a,"IF",Order$$module$build$src$generators$php$php_generator.CONDITIONAL)||"false",d=b.valueToCode(a,"THEN",Order$$module$build$src$generators$php$php_generator.CONDITIONAL)||"null";a=b.valueToCode(a,
|
|
126
126
|
"ELSE",Order$$module$build$src$generators$php$php_generator.CONDITIONAL)||"null";return[c+" ? "+d+" : "+a,Order$$module$build$src$generators$php$php_generator.CONDITIONAL]},controls_repeat_ext$$module$build$src$generators$php$loops=function(a,b){let c;c=a.getField("TIMES")?String(Number(a.getFieldValue("TIMES"))):b.valueToCode(a,"TIMES",Order$$module$build$src$generators$php$php_generator.ASSIGNMENT)||"0";let d=b.statementToCode(a,"DO");d=b.addLoopTrap(d,a);a="";const e=b.nameDB_.getDistinctName("count",
|
|
127
|
-
$.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+=f+" = "+c+";\n");return a+("for ("+e+" = 0; "+e+" < "+f+"; "+e+"++) {\n"+d+"}\n")},controls_whileUntil$$module$build$src$generators$php$loops=function(a,b){const c=
|
|
127
|
+
$.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+=f+" = "+c+";\n");return a+("for ("+e+" = 0; "+e+" < "+f+"; "+e+"++) {\n"+d+"}\n")},controls_whileUntil$$module$build$src$generators$php$loops=function(a,b){const c=a.getFieldValue("MODE")==="UNTIL";let d=b.valueToCode(a,"BOOL",c?Order$$module$build$src$generators$php$php_generator.LOGICAL_NOT:
|
|
128
128
|
Order$$module$build$src$generators$php$php_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$php$loops=function(a,b){var c=b.getVariableName(a.getFieldValue("VAR")),d=b.valueToCode(a,"FROM",Order$$module$build$src$generators$php$php_generator.ASSIGNMENT)||"0",e=b.valueToCode(a,"TO",Order$$module$build$src$generators$php$php_generator.ASSIGNMENT)||"0";const f=b.valueToCode(a,"BY",Order$$module$build$src$generators$php$php_generator.ASSIGNMENT)||
|
|
129
|
-
"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
|
|
129
|
+
"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)||(h=b.nameDB_.getDistinctName(c+"_start",
|
|
130
130
|
$.NameType$$module$build$src$core$names.VARIABLE),a+=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+=d+" = "+e+";\n");e=b.nameDB_.getDistinctName(c+"_inc",$.NameType$$module$build$src$core$names.VARIABLE);a+=e+" = ";a=$.isNumber$$module$build$src$core$utils$string(f)?a+(Math.abs(Number(f))+";\n"):a+("abs("+f+");\n");a+="if ("+h+" > "+d+") {\n";a+=b.INDENT+e+" = -"+e+
|
|
131
131
|
";\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$php$loops=function(a,b){const c=b.getVariableName(a.getFieldValue("VAR")),d=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.ASSIGNMENT)||"[]";let e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a);return"foreach ("+d+" as "+c+") {\n"+e+"}\n"},controls_flow_statements$$module$build$src$generators$php$loops=function(a,
|
|
132
|
-
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$php$math=function(a,b){a=Number(a.getFieldValue("NUM"));return Infinity
|
|
133
|
-
|
|
134
|
-
MULTIPLY:[" * ",Order$$module$build$src$generators$php$php_generator.MULTIPLICATION],DIVIDE:[" / ",Order$$module$build$src$generators$php$php_generator.DIVISION],POWER:[" ** ",Order$$module$build$src$generators$php$php_generator.POWER]}[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[e+d+a,c]},math_single$$module$build$src$generators$php$math=function(a,b){const c=a.getFieldValue("OP");let d;if("NEG"
|
|
135
|
-
"NUM",Order$$module$build$src$generators$php$php_generator.UNARY_NEGATION)||"0",
|
|
132
|
+
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$php$math=function(a,b){a=Number(a.getFieldValue("NUM"));return a===Infinity?
|
|
133
|
+
["INF",Order$$module$build$src$generators$php$php_generator.ATOMIC]:a===-Infinity?["-INF",Order$$module$build$src$generators$php$php_generator.UNARY_NEGATION]:[String(a),a>=0?Order$$module$build$src$generators$php$php_generator.ATOMIC:Order$$module$build$src$generators$php$php_generator.UNARY_NEGATION]},math_arithmetic$$module$build$src$generators$php$math=function(a,b){var c={ADD:[" + ",Order$$module$build$src$generators$php$php_generator.ADDITION],MINUS:[" - ",Order$$module$build$src$generators$php$php_generator.SUBTRACTION],
|
|
134
|
+
MULTIPLY:[" * ",Order$$module$build$src$generators$php$php_generator.MULTIPLICATION],DIVIDE:[" / ",Order$$module$build$src$generators$php$php_generator.DIVISION],POWER:[" ** ",Order$$module$build$src$generators$php$php_generator.POWER]}[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[e+d+a,c]},math_single$$module$build$src$generators$php$math=function(a,b){const c=a.getFieldValue("OP");let d;if(c==="NEG")return a=b.valueToCode(a,
|
|
135
|
+
"NUM",Order$$module$build$src$generators$php$php_generator.UNARY_NEGATION)||"0",a[0]==="-"&&(a=" "+a),["-"+a,Order$$module$build$src$generators$php$php_generator.UNARY_NEGATION];a=c==="SIN"||c==="COS"||c==="TAN"?b.valueToCode(a,"NUM",Order$$module$build$src$generators$php$php_generator.DIVISION)||"0":b.valueToCode(a,"NUM",Order$$module$build$src$generators$php$php_generator.NONE)||"0";switch(c){case "ABS":d="abs("+a+")";break;case "ROOT":d="sqrt("+a+")";break;case "LN":d="log("+a+")";break;case "EXP":d=
|
|
136
136
|
"exp("+a+")";break;case "POW10":d="pow(10,"+a+")";break;case "ROUND":d="round("+a+")";break;case "ROUNDUP":d="ceil("+a+")";break;case "ROUNDDOWN":d="floor("+a+")";break;case "SIN":d="sin("+a+" / 180 * pi())";break;case "COS":d="cos("+a+" / 180 * pi())";break;case "TAN":d="tan("+a+" / 180 * pi())"}if(d)return[d,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL];switch(c){case "LOG10":d="log("+a+") / log(10)";break;case "ASIN":d="asin("+a+") / pi() * 180";break;case "ACOS":d="acos("+
|
|
137
137
|
a+") / pi() * 180";break;case "ATAN":d="atan("+a+") / pi() * 180";break;default:throw Error("Unknown math operator: "+c);}return[d,Order$$module$build$src$generators$php$php_generator.DIVISION]},math_constant$$module$build$src$generators$php$math=function(a,b){return{PI:["M_PI",Order$$module$build$src$generators$php$php_generator.ATOMIC],E:["M_E",Order$$module$build$src$generators$php$php_generator.ATOMIC],GOLDEN_RATIO:["(1 + sqrt(5)) / 2",Order$$module$build$src$generators$php$php_generator.DIVISION],
|
|
138
138
|
SQRT2:["M_SQRT2",Order$$module$build$src$generators$php$php_generator.ATOMIC],SQRT1_2:["M_SQRT1_2",Order$$module$build$src$generators$php$php_generator.ATOMIC],INFINITY:["INF",Order$$module$build$src$generators$php$php_generator.ATOMIC]}[a.getFieldValue("CONSTANT")]},math_number_property$$module$build$src$generators$php$math=function(a,b){var c={EVEN:[""," % 2 == 0",Order$$module$build$src$generators$php$php_generator.MODULUS,Order$$module$build$src$generators$php$php_generator.EQUALITY],ODD:["",
|
|
139
139
|
" % 2 == 1",Order$$module$build$src$generators$php$php_generator.MODULUS,Order$$module$build$src$generators$php$php_generator.EQUALITY],WHOLE:["is_int(",")",Order$$module$build$src$generators$php$php_generator.NONE,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL],POSITIVE:[""," > 0",Order$$module$build$src$generators$php$php_generator.RELATIONAL,Order$$module$build$src$generators$php$php_generator.RELATIONAL],NEGATIVE:[""," < 0",Order$$module$build$src$generators$php$php_generator.RELATIONAL,
|
|
140
|
-
Order$$module$build$src$generators$php$php_generator.RELATIONAL],DIVISIBLE_BY:[null,null,Order$$module$build$src$generators$php$php_generator.MODULUS,Order$$module$build$src$generators$php$php_generator.EQUALITY],PRIME:[null,null,Order$$module$build$src$generators$php$php_generator.NONE,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]};const d=a.getFieldValue("PROPERTY"),[e,f,g,h]=c[d];c=b.valueToCode(a,"NUMBER_TO_CHECK",g)||"0";if("PRIME"
|
|
140
|
+
Order$$module$build$src$generators$php$php_generator.RELATIONAL],DIVISIBLE_BY:[null,null,Order$$module$build$src$generators$php$php_generator.MODULUS,Order$$module$build$src$generators$php$php_generator.EQUALITY],PRIME:[null,null,Order$$module$build$src$generators$php$php_generator.NONE,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]};const d=a.getFieldValue("PROPERTY"),[e,f,g,h]=c[d];c=b.valueToCode(a,"NUMBER_TO_CHECK",g)||"0";if(d==="PRIME")a=b.provideFunction_("math_isPrime",
|
|
141
141
|
`
|
|
142
142
|
function ${b.FUNCTION_NAME_PLACEHOLDER_}($n) {
|
|
143
143
|
// https://en.wikipedia.org/wiki/Primality_test#Naive_methods
|
|
@@ -157,7 +157,7 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($n) {
|
|
|
157
157
|
}
|
|
158
158
|
return true;
|
|
159
159
|
}
|
|
160
|
-
`)+"("+c+")";else if("DIVISIBLE_BY"
|
|
160
|
+
`)+"("+c+")";else if(d==="DIVISIBLE_BY"){a=b.valueToCode(a,"DIVISOR",Order$$module$build$src$generators$php$php_generator.MODULUS)||"0";if(a==="0")return["false",Order$$module$build$src$generators$php$php_generator.ATOMIC];a=c+" % "+a+" == 0"}else a=e+c+f;return[a,h]},math_change$$module$build$src$generators$php$math=function(a,b){const c=b.valueToCode(a,"DELTA",Order$$module$build$src$generators$php$php_generator.ADDITION)||"0";return b.getVariableName(a.getFieldValue("VAR"))+" += "+c+";\n"},math_on_list$$module$build$src$generators$php$math=
|
|
161
161
|
function(a,b){var c=a.getFieldValue("OP");switch(c){case "SUM":a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL)||"array()";a="array_sum("+a+")";break;case "MIN":a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL)||"array()";a="min("+a+")";break;case "MAX":a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL)||"array()";a="max("+a+")";break;case "AVERAGE":c=b.provideFunction_("math_mean",
|
|
162
162
|
`
|
|
163
163
|
function ${b.FUNCTION_NAME_PLACEHOLDER_}($myList) {
|
|
@@ -204,8 +204,8 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($a, $b) {
|
|
|
204
204
|
d=c.length?b.INDENT+"global "+c.join(", ")+";\n":"";c=b.getProcedureName(a.getFieldValue("NAME"));f="";b.STATEMENT_PREFIX&&(f+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(f+=b.injectId(b.STATEMENT_SUFFIX,a));f&&(f=b.prefixLines(f,b.INDENT));e="";b.INFINITE_LOOP_TRAP&&(e=b.prefixLines(b.injectId(b.INFINITE_LOOP_TRAP,a),b.INDENT));let g="";a.getInput("STACK")&&(g=b.statementToCode(a,"STACK"));let h="";a.getInput("RETURN")&&(h=b.valueToCode(a,"RETURN",Order$$module$build$src$generators$php$php_generator.NONE)||
|
|
205
205
|
"");let k="";g&&h&&(k=f);h&&(h=b.INDENT+"return "+h+";\n");const l=[],m=a.getVars();for(let n=0;n<m.length;n++)l[n]=b.getVariableName(m[n]);d="function "+c+"("+l.join(", ")+") {\n"+d+f+e+g+k+h+"}";d=b.scrub_(a,d);b.definitions_["%"+c]=d;return null},procedures_callreturn$$module$build$src$generators$php$procedures=function(a,b){const c=b.getProcedureName(a.getFieldValue("NAME")),d=[],e=a.getVars();for(let f=0;f<e.length;f++)d[f]=b.valueToCode(a,"ARG"+f,Order$$module$build$src$generators$php$php_generator.NONE)||
|
|
206
206
|
"null";return[c+"("+d.join(", ")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},procedures_callnoreturn$$module$build$src$generators$php$procedures=function(a,b){return b.forBlock.procedures_callreturn(a,b)[0]+";\n"},procedures_ifreturn$$module$build$src$generators$php$procedures=function(a,b){let c="if ("+(b.valueToCode(a,"CONDITION",Order$$module$build$src$generators$php$php_generator.NONE)||"false")+") {\n";b.STATEMENT_SUFFIX&&(c+=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,
|
|
207
|
-
a),b.INDENT));a.hasReturnValue_?(a=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"null",c+=b.INDENT+"return "+a+";\n"):c+=b.INDENT+"return;\n";return c+"}\n"},text$$module$build$src$generators$php$text=function(a,b){return[b.quote_(a.getFieldValue("TEXT")),Order$$module$build$src$generators$php$php_generator.ATOMIC]},text_join$$module$build$src$generators$php$text=function(a,b){if(
|
|
208
|
-
if(
|
|
207
|
+
a),b.INDENT));a.hasReturnValue_?(a=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"null",c+=b.INDENT+"return "+a+";\n"):c+=b.INDENT+"return;\n";return c+"}\n"},text$$module$build$src$generators$php$text=function(a,b){return[b.quote_(a.getFieldValue("TEXT")),Order$$module$build$src$generators$php$php_generator.ATOMIC]},text_join$$module$build$src$generators$php$text=function(a,b){if(a.itemCount_===0)return["''",Order$$module$build$src$generators$php$php_generator.ATOMIC];
|
|
208
|
+
if(a.itemCount_===1)return[b.valueToCode(a,"ADD0",Order$$module$build$src$generators$php$php_generator.NONE)||"''",Order$$module$build$src$generators$php$php_generator.NONE];if(a.itemCount_===2){var c=b.valueToCode(a,"ADD0",Order$$module$build$src$generators$php$php_generator.STRING_CONCAT)||"''";a=b.valueToCode(a,"ADD1",Order$$module$build$src$generators$php$php_generator.STRING_CONCAT)||"''";return[c+" . "+a,Order$$module$build$src$generators$php$php_generator.STRING_CONCAT]}c=Array(a.itemCount_);
|
|
209
209
|
for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Order$$module$build$src$generators$php$php_generator.NONE)||"''";return["implode('', array("+c.join(",")+"))",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},text_append$$module$build$src$generators$php$text=function(a,b){const c=b.getVariableName(a.getFieldValue("VAR"));a=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$php$php_generator.ASSIGNMENT)||"''";return c+" .= "+a+";\n"},text_length$$module$build$src$generators$php$text=
|
|
210
210
|
function(a,b){const c=b.provideFunction_("length",`
|
|
211
211
|
function ${b.FUNCTION_NAME_PLACEHOLDER_}($value) {
|
|
@@ -214,8 +214,8 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($value) {
|
|
|
214
214
|
}
|
|
215
215
|
return count($value);
|
|
216
216
|
}
|
|
217
|
-
`);a=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"''";return[c+"("+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},text_isEmpty$$module$build$src$generators$php$text=function(a,b){return["empty("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"''")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},text_indexOf$$module$build$src$generators$php$text=function(a,b){const c="
|
|
218
|
-
|
|
217
|
+
`);a=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"''";return[c+"("+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},text_isEmpty$$module$build$src$generators$php$text=function(a,b){return["empty("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"''")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},text_indexOf$$module$build$src$generators$php$text=function(a,b){const c=a.getFieldValue("END")===
|
|
218
|
+
"FIRST"?"strpos":"strrpos",d=b.valueToCode(a,"FIND",Order$$module$build$src$generators$php$php_generator.NONE)||"''",e=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.NONE)||"''";let f=" -1",g="";a.workspace.options.oneBasedIndex&&(f=" 0",g=" + 1");return[b.provideFunction_(a.getFieldValue("END")==="FIRST"?"text_indexOf":"text_lastIndexOf",`
|
|
219
219
|
function ${b.FUNCTION_NAME_PLACEHOLDER_}($text, $search) {
|
|
220
220
|
$pos = ${c}($text, $search);
|
|
221
221
|
return $pos === false ? ${f} : $pos${g};
|
|
@@ -225,7 +225,7 @@ case "FROM_START":return a=b.getAdjusted(a,"AT"),["substr("+d+", "+a+", 1)",Orde
|
|
|
225
225
|
function ${b.FUNCTION_NAME_PLACEHOLDER_}($text) {
|
|
226
226
|
return $text[rand(0, strlen($text) - 1)];
|
|
227
227
|
}
|
|
228
|
-
`)+"("+d+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]}throw Error("Unhandled option (text_charAt).");},text_getSubstring$$module$build$src$generators$php$text=function(a,b){const c=a.getFieldValue("WHERE1"),d=a.getFieldValue("WHERE2"),e=b.valueToCode(a,"STRING",Order$$module$build$src$generators$php$php_generator.NONE)||"''";if("FIRST"===
|
|
228
|
+
`)+"("+d+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]}throw Error("Unhandled option (text_charAt).");},text_getSubstring$$module$build$src$generators$php$text=function(a,b){const c=a.getFieldValue("WHERE1"),d=a.getFieldValue("WHERE2"),e=b.valueToCode(a,"STRING",Order$$module$build$src$generators$php$php_generator.NONE)||"''";if(c==="FIRST"&&d==="LAST")return[e,Order$$module$build$src$generators$php$php_generator.NONE];const f=b.getAdjusted(a,"AT1");a=b.getAdjusted(a,"AT2");
|
|
229
229
|
return[b.provideFunction_("text_get_substring",`
|
|
230
230
|
function ${b.FUNCTION_NAME_PLACEHOLDER_}($text, $where1, $at1, $where2, $at2) {
|
|
231
231
|
if ($where1 == 'FROM_END') {
|
|
@@ -247,9 +247,9 @@ function ${b.FUNCTION_NAME_PLACEHOLDER_}($text, $where1, $at1, $where2, $at2) {
|
|
|
247
247
|
}
|
|
248
248
|
return substr($text, $at1, $length);
|
|
249
249
|
}
|
|
250
|
-
`)+"("+e+", '"+c+"', "+f+", '"+d+"', "+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},text_changeCase$$module$build$src$generators$php$text=function(a,b){b=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$php$php_generator.NONE)||"''";let c;
|
|
250
|
+
`)+"("+e+", '"+c+"', "+f+", '"+d+"', "+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},text_changeCase$$module$build$src$generators$php$text=function(a,b){b=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$php$php_generator.NONE)||"''";let c;a.getFieldValue("CASE")==="UPPERCASE"?c="strtoupper("+b+")":a.getFieldValue("CASE")==="LOWERCASE"?c="strtolower("+b+")":a.getFieldValue("CASE")==="TITLECASE"&&(c="ucwords(strtolower("+b+"))");return[c,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},
|
|
251
251
|
text_trim$$module$build$src$generators$php$text=function(a,b){const c={LEFT:"ltrim",RIGHT:"rtrim",BOTH:"trim"}[a.getFieldValue("MODE")];a=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$php$php_generator.NONE)||"''";return[c+"("+a+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},text_print$$module$build$src$generators$php$text=function(a,b){return"print("+(b.valueToCode(a,"TEXT",Order$$module$build$src$generators$php$php_generator.NONE)||"''")+");\n"},text_prompt_ext$$module$build$src$generators$php$text=
|
|
252
|
-
function(a,b){b="readline("+(a.getField("TEXT")?b.quote_(a.getFieldValue("TEXT")):b.valueToCode(a,"TEXT",Order$$module$build$src$generators$php$php_generator.NONE)||"''")+")";
|
|
252
|
+
function(a,b){b="readline("+(a.getField("TEXT")?b.quote_(a.getFieldValue("TEXT")):b.valueToCode(a,"TEXT",Order$$module$build$src$generators$php$php_generator.NONE)||"''")+")";a.getFieldValue("TYPE")==="NUMBER"&&(b="floatval("+b+")");return[b,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},text_count$$module$build$src$generators$php$text=function(a,b){const c=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$php$php_generator.NONE)||"''";a=b.valueToCode(a,"SUB",Order$$module$build$src$generators$php$php_generator.NONE)||
|
|
253
253
|
"''";return["strlen("+a+") === 0 ? strlen("+c+") + 1 : substr_count("+c+", "+a+")",Order$$module$build$src$generators$php$php_generator.CONDITIONAL]},text_replace$$module$build$src$generators$php$text=function(a,b){const c=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$php$php_generator.NONE)||"''",d=b.valueToCode(a,"FROM",Order$$module$build$src$generators$php$php_generator.NONE)||"''";a=b.valueToCode(a,"TO",Order$$module$build$src$generators$php$php_generator.NONE)||"''";return["str_replace("+
|
|
254
254
|
d+", "+a+", "+c+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},text_reverse$$module$build$src$generators$php$text=function(a,b){return["strrev("+(b.valueToCode(a,"TEXT",Order$$module$build$src$generators$php$php_generator.NONE)||"''")+")",Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL]},variables_get$$module$build$src$generators$php$variables=function(a,b){return[b.getVariableName(a.getFieldValue("VAR")),Order$$module$build$src$generators$php$php_generator.ATOMIC]},
|
|
255
255
|
variables_set$$module$build$src$generators$php$variables=function(a,b){const c=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$php$php_generator.ASSIGNMENT)||"0";return b.getVariableName(a.getFieldValue("VAR"))+" = "+c+";\n"},Order$$module$build$src$generators$php$php_generator;
|
|
@@ -258,11 +258,11 @@ variables_set$$module$build$src$generators$php$variables=function(a,b){const c=b
|
|
|
258
258
|
20]="ASSIGNMENT";a[a.LOGICAL_AND_WEAK=21]="LOGICAL_AND_WEAK";a[a.LOGICAL_XOR=22]="LOGICAL_XOR";a[a.LOGICAL_OR_WEAK=23]="LOGICAL_OR_WEAK";a[a.NONE=99]="NONE"})(Order$$module$build$src$generators$php$php_generator||(Order$$module$build$src$generators$php$php_generator={}));
|
|
259
259
|
var PhpGenerator$$module$build$src$generators$php$php_generator=class extends $.CodeGenerator$$module$build$src$core$generator{constructor(a="PHP"){super(a);this.ORDER_OVERRIDES=[[Order$$module$build$src$generators$php$php_generator.MEMBER,Order$$module$build$src$generators$php$php_generator.FUNCTION_CALL],[Order$$module$build$src$generators$php$php_generator.MEMBER,Order$$module$build$src$generators$php$php_generator.MEMBER],[Order$$module$build$src$generators$php$php_generator.LOGICAL_NOT,Order$$module$build$src$generators$php$php_generator.LOGICAL_NOT],
|
|
260
260
|
[Order$$module$build$src$generators$php$php_generator.MULTIPLICATION,Order$$module$build$src$generators$php$php_generator.MULTIPLICATION],[Order$$module$build$src$generators$php$php_generator.ADDITION,Order$$module$build$src$generators$php$php_generator.ADDITION],[Order$$module$build$src$generators$php$php_generator.LOGICAL_AND,Order$$module$build$src$generators$php$php_generator.LOGICAL_AND],[Order$$module$build$src$generators$php$php_generator.LOGICAL_OR,Order$$module$build$src$generators$php$php_generator.LOGICAL_OR]];
|
|
261
|
-
this.isInitialized=!1;for(const b in Order$$module$build$src$generators$php$php_generator)a=Order$$module$build$src$generators$php$php_generator[b],"string"
|
|
261
|
+
this.isInitialized=!1;for(const b in Order$$module$build$src$generators$php$php_generator)a=Order$$module$build$src$generators$php$php_generator[b],typeof a!=="string"&&(this["ORDER_"+b]=a);this.addReservedWords("__halt_compiler,abstract,and,array,as,break,callable,case,catch,class,clone,const,continue,declare,default,die,do,echo,else,elseif,empty,enddeclare,endfor,endforeach,endif,endswitch,endwhile,eval,exit,extends,final,for,foreach,function,global,goto,if,implements,include,include_once,instanceof,insteadof,interface,isset,list,namespace,new,or,print,private,protected,public,require,require_once,return,static,switch,throw,trait,try,unset,use,var,while,xor,PHP_VERSION,PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,PHP_VERSION_ID,PHP_EXTRA_VERSION,PHP_ZTS,PHP_DEBUG,PHP_MAXPATHLEN,PHP_OS,PHP_SAPI,PHP_EOL,PHP_INT_MAX,PHP_INT_SIZE,DEFAULT_INCLUDE_PATH,PEAR_INSTALL_DIR,PEAR_EXTENSION_DIR,PHP_EXTENSION_DIR,PHP_PREFIX,PHP_BINDIR,PHP_BINARY,PHP_MANDIR,PHP_LIBDIR,PHP_DATADIR,PHP_SYSCONFDIR,PHP_LOCALSTATEDIR,PHP_CONFIG_FILE_PATH,PHP_CONFIG_FILE_SCAN_DIR,PHP_SHLIB_SUFFIX,E_ERROR,E_WARNING,E_PARSE,E_NOTICE,E_CORE_ERROR,E_CORE_WARNING,E_COMPILE_ERROR,E_COMPILE_WARNING,E_USER_ERROR,E_USER_WARNING,E_USER_NOTICE,E_DEPRECATED,E_USER_DEPRECATED,E_ALL,E_STRICT,__COMPILER_HALT_OFFSET__,TRUE,FALSE,NULL,__CLASS__,__DIR__,__FILE__,__FUNCTION__,__LINE__,__METHOD__,__NAMESPACE__,__TRAIT__")}init(a){super.init(a);
|
|
262
262
|
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);this.isInitialized=!0}finish(a){const b=Object.values(this.definitions_);a=super.finish(a);this.isInitialized=!1;this.nameDB_.reset();return b.join("\n\n")+"\n\n\n"+a}scrubNakedValue(a){return a+";\n"}quote_(a){a=a.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n").replace(/'/g,
|
|
263
263
|
"\\'");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+=this.prefixLines(e,"// ")+"\n");for(let f=0;f<a.inputList.length;f++)a.inputList[f].type===$.inputTypes$$module$build$src$core$inputs$input_types.VALUE&&(e=a.inputList[f].connection.targetBlock())&&(e=this.allNestedComments(e))&&
|
|
264
|
-
(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$php$php_generator.NONE){a.workspace.options.oneBasedIndex&&c--;let f=a.workspace.options.oneBasedIndex?"1":"0",g=e;0
|
|
265
|
-
a=this.valueToCode(a,b,g)||f;if(0
|
|
264
|
+
(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$php$php_generator.NONE){a.workspace.options.oneBasedIndex&&c--;let f=a.workspace.options.oneBasedIndex?"1":"0",g=e;c>0?g=Order$$module$build$src$generators$php$php_generator.ADDITION:c<0?g=Order$$module$build$src$generators$php$php_generator.SUBTRACTION:d&&(g=Order$$module$build$src$generators$php$php_generator.UNARY_NEGATION);
|
|
265
|
+
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$php$php_generator={};module$build$src$generators$php$php_generator.Order=Order$$module$build$src$generators$php$php_generator;module$build$src$generators$php$php_generator.PhpGenerator=PhpGenerator$$module$build$src$generators$php$php_generator;var module$build$src$generators$php$lists={};module$build$src$generators$php$lists.lists_create_empty=lists_create_empty$$module$build$src$generators$php$lists;module$build$src$generators$php$lists.lists_create_with=lists_create_with$$module$build$src$generators$php$lists;module$build$src$generators$php$lists.lists_getIndex=lists_getIndex$$module$build$src$generators$php$lists;module$build$src$generators$php$lists.lists_getSublist=lists_getSublist$$module$build$src$generators$php$lists;
|
|
266
266
|
module$build$src$generators$php$lists.lists_indexOf=lists_indexOf$$module$build$src$generators$php$lists;module$build$src$generators$php$lists.lists_isEmpty=lists_isEmpty$$module$build$src$generators$php$lists;module$build$src$generators$php$lists.lists_length=lists_length$$module$build$src$generators$php$lists;module$build$src$generators$php$lists.lists_repeat=lists_repeat$$module$build$src$generators$php$lists;module$build$src$generators$php$lists.lists_reverse=lists_reverse$$module$build$src$generators$php$lists;
|
|
267
267
|
module$build$src$generators$php$lists.lists_setIndex=lists_setIndex$$module$build$src$generators$php$lists;module$build$src$generators$php$lists.lists_sort=lists_sort$$module$build$src$generators$php$lists;module$build$src$generators$php$lists.lists_split=lists_split$$module$build$src$generators$php$lists;var controls_ifelse$$module$build$src$generators$php$logic=controls_if$$module$build$src$generators$php$logic,module$build$src$generators$php$logic={};module$build$src$generators$php$logic.controls_if=controls_if$$module$build$src$generators$php$logic;module$build$src$generators$php$logic.controls_ifelse=controls_if$$module$build$src$generators$php$logic;module$build$src$generators$php$logic.logic_boolean=logic_boolean$$module$build$src$generators$php$logic;
|
|
268
268
|
module$build$src$generators$php$logic.logic_compare=logic_compare$$module$build$src$generators$php$logic;module$build$src$generators$php$logic.logic_negate=logic_negate$$module$build$src$generators$php$logic;module$build$src$generators$php$logic.logic_null=logic_null$$module$build$src$generators$php$logic;module$build$src$generators$php$logic.logic_operation=logic_operation$$module$build$src$generators$php$logic;module$build$src$generators$php$logic.logic_ternary=logic_ternary$$module$build$src$generators$php$logic;var controls_repeat$$module$build$src$generators$php$loops=controls_repeat_ext$$module$build$src$generators$php$loops,module$build$src$generators$php$loops={};module$build$src$generators$php$loops.controls_flow_statements=controls_flow_statements$$module$build$src$generators$php$loops;module$build$src$generators$php$loops.controls_for=controls_for$$module$build$src$generators$php$loops;module$build$src$generators$php$loops.controls_forEach=controls_forEach$$module$build$src$generators$php$loops;
|