blockly 9.3.0-beta.0 → 9.3.1

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 (282) hide show
  1. package/blockly.min.js +1674 -1520
  2. package/blockly_compressed.js +1313 -1152
  3. package/blockly_compressed.js.map +1 -1
  4. package/blocks_compressed.js +166 -173
  5. package/blocks_compressed.js.map +1 -1
  6. package/core/any_aliases.d.ts +5 -0
  7. package/core/block.d.ts +49 -17
  8. package/core/block_animations.d.ts +0 -4
  9. package/core/block_drag_surface.d.ts +135 -0
  10. package/core/block_dragger.d.ts +2 -7
  11. package/core/block_svg.d.ts +72 -9
  12. package/core/blockly.d.ts +29 -58
  13. package/core/blockly_options.d.ts +0 -2
  14. package/core/blocks.d.ts +0 -2
  15. package/core/browser_events.d.ts +0 -9
  16. package/core/bubble.d.ts +6 -4
  17. package/core/bubble_dragger.d.ts +2 -3
  18. package/core/bump_objects.d.ts +0 -3
  19. package/core/clipboard.d.ts +0 -3
  20. package/core/comment.d.ts +6 -10
  21. package/core/common.d.ts +0 -12
  22. package/core/component_manager.d.ts +0 -2
  23. package/core/connection.d.ts +19 -6
  24. package/core/connection_checker.d.ts +1 -3
  25. package/core/connection_db.d.ts +0 -2
  26. package/core/connection_type.d.ts +0 -2
  27. package/core/constants.d.ts +0 -4
  28. package/core/contextmenu.d.ts +0 -11
  29. package/core/contextmenu_items.d.ts +0 -27
  30. package/core/contextmenu_registry.d.ts +0 -2
  31. package/core/css.d.ts +0 -2
  32. package/core/delete_area.d.ts +0 -2
  33. package/core/dialog.d.ts +0 -6
  34. package/core/drag_target.d.ts +0 -2
  35. package/core/events/events_abstract.d.ts +0 -3
  36. package/core/events/events_block_base.d.ts +0 -2
  37. package/core/events/events_block_change.d.ts +0 -2
  38. package/core/events/events_block_create.d.ts +0 -2
  39. package/core/events/events_block_delete.d.ts +0 -2
  40. package/core/events/events_block_drag.d.ts +0 -2
  41. package/core/events/events_block_move.d.ts +0 -2
  42. package/core/events/events_bubble_open.d.ts +0 -2
  43. package/core/events/events_click.d.ts +0 -2
  44. package/core/events/events_comment_base.d.ts +0 -2
  45. package/core/events/events_comment_change.d.ts +0 -2
  46. package/core/events/events_comment_create.d.ts +0 -2
  47. package/core/events/events_comment_delete.d.ts +0 -2
  48. package/core/events/events_comment_move.d.ts +0 -2
  49. package/core/events/events_marker_move.d.ts +0 -2
  50. package/core/events/events_selected.d.ts +0 -2
  51. package/core/events/events_theme_change.d.ts +0 -2
  52. package/core/events/events_toolbox_item_select.d.ts +0 -2
  53. package/core/events/events_trashcan_open.d.ts +0 -2
  54. package/core/events/events_ui.d.ts +0 -1
  55. package/core/events/events_ui_base.d.ts +0 -2
  56. package/core/events/events_var_base.d.ts +0 -2
  57. package/core/events/events_var_create.d.ts +0 -2
  58. package/core/events/events_viewport.d.ts +0 -2
  59. package/core/events/utils.d.ts +0 -73
  60. package/core/events/workspace_events.d.ts +0 -2
  61. package/core/extensions.d.ts +0 -8
  62. package/core/field.d.ts +16 -15
  63. package/core/field_angle.d.ts +60 -50
  64. package/core/field_checkbox.d.ts +22 -10
  65. package/core/field_colour.d.ts +55 -42
  66. package/core/field_dropdown.d.ts +34 -18
  67. package/core/field_image.d.ts +9 -12
  68. package/core/field_input.d.ts +34 -11
  69. package/core/field_label.d.ts +7 -10
  70. package/core/field_label_serializable.d.ts +4 -6
  71. package/core/field_multilineinput.d.ts +34 -12
  72. package/core/field_number.d.ts +27 -19
  73. package/core/field_registry.d.ts +0 -3
  74. package/core/field_textinput.d.ts +28 -12
  75. package/core/field_variable.d.ts +28 -16
  76. package/core/flyout_base.d.ts +5 -6
  77. package/core/flyout_button.d.ts +2 -2
  78. package/core/flyout_horizontal.d.ts +0 -2
  79. package/core/flyout_metrics_manager.d.ts +0 -2
  80. package/core/flyout_vertical.d.ts +0 -2
  81. package/core/generator.d.ts +0 -1
  82. package/core/gesture.d.ts +4 -17
  83. package/core/grid.d.ts +0 -2
  84. package/core/icon.d.ts +0 -2
  85. package/core/inject.d.ts +0 -1
  86. package/core/input.d.ts +0 -3
  87. package/core/input_types.d.ts +0 -2
  88. package/core/insertion_marker_manager.d.ts +6 -6
  89. package/core/interfaces/i_ast_node_location.d.ts +0 -2
  90. package/core/interfaces/i_ast_node_location_svg.d.ts +0 -2
  91. package/core/interfaces/i_ast_node_location_with_block.d.ts +0 -2
  92. package/core/interfaces/i_autohideable.d.ts +0 -2
  93. package/core/interfaces/i_block_dragger.d.ts +1 -3
  94. package/core/interfaces/i_bounded_element.d.ts +0 -2
  95. package/core/interfaces/i_bubble.d.ts +6 -4
  96. package/core/interfaces/i_collapsible_toolbox_item.d.ts +0 -2
  97. package/core/interfaces/i_component.d.ts +0 -2
  98. package/core/interfaces/i_connection_checker.d.ts +0 -2
  99. package/core/interfaces/i_contextmenu.d.ts +0 -1
  100. package/core/interfaces/i_copyable.d.ts +3 -2
  101. package/core/interfaces/i_deletable.d.ts +0 -2
  102. package/core/interfaces/i_delete_area.d.ts +0 -2
  103. package/core/interfaces/i_drag_target.d.ts +0 -2
  104. package/core/interfaces/i_draggable.d.ts +0 -2
  105. package/core/interfaces/i_flyout.d.ts +0 -2
  106. package/core/interfaces/i_keyboard_accessible.d.ts +0 -2
  107. package/core/interfaces/i_legacy_procedure_blocks.d.ts +34 -0
  108. package/core/interfaces/i_metrics_manager.d.ts +0 -2
  109. package/core/interfaces/i_movable.d.ts +0 -2
  110. package/core/interfaces/i_positionable.d.ts +0 -2
  111. package/core/interfaces/i_procedure_model.d.ts +0 -5
  112. package/core/interfaces/i_registrable.d.ts +0 -2
  113. package/core/interfaces/i_selectable.d.ts +0 -2
  114. package/core/interfaces/i_selectable_toolbox_item.d.ts +4 -2
  115. package/core/interfaces/i_serializer.d.ts +0 -2
  116. package/core/interfaces/i_styleable.d.ts +0 -2
  117. package/core/interfaces/i_toolbox.d.ts +0 -2
  118. package/core/interfaces/i_toolbox_item.d.ts +0 -2
  119. package/core/interfaces/i_variable_backed_parameter_model.d.ts +17 -0
  120. package/core/internal_constants.d.ts +0 -5
  121. package/core/keyboard_nav/ast_node.d.ts +0 -3
  122. package/core/keyboard_nav/basic_cursor.d.ts +0 -3
  123. package/core/keyboard_nav/cursor.d.ts +0 -3
  124. package/core/keyboard_nav/marker.d.ts +0 -2
  125. package/core/keyboard_nav/tab_navigate_cursor.d.ts +0 -2
  126. package/core/marker_manager.d.ts +0 -2
  127. package/core/menu.d.ts +0 -2
  128. package/core/menuitem.d.ts +0 -2
  129. package/core/metrics_manager.d.ts +0 -2
  130. package/core/mutator.d.ts +0 -2
  131. package/core/names.d.ts +0 -3
  132. package/core/options.d.ts +0 -2
  133. package/core/positionable_helpers.d.ts +0 -7
  134. package/core/procedures.d.ts +2 -25
  135. package/core/registry.d.ts +0 -11
  136. package/core/render_management.d.ts +15 -0
  137. package/core/rendered_connection.d.ts +22 -9
  138. package/core/renderers/common/block_rendering.d.ts +0 -3
  139. package/core/renderers/common/constants.d.ts +6 -51
  140. package/core/renderers/common/debug.d.ts +0 -3
  141. package/core/renderers/common/debugger.d.ts +9 -23
  142. package/core/renderers/common/drawer.d.ts +0 -5
  143. package/core/renderers/common/i_path_object.d.ts +0 -17
  144. package/core/renderers/common/info.d.ts +2 -12
  145. package/core/renderers/common/marker_svg.d.ts +2 -4
  146. package/core/renderers/common/path_object.d.ts +0 -24
  147. package/core/renderers/common/renderer.d.ts +5 -20
  148. package/core/renderers/geras/constants.d.ts +0 -5
  149. package/core/renderers/geras/drawer.d.ts +2 -4
  150. package/core/renderers/geras/highlight_constants.d.ts +6 -17
  151. package/core/renderers/geras/highlighter.d.ts +0 -13
  152. package/core/renderers/geras/info.d.ts +2 -5
  153. package/core/renderers/geras/measurables/inline_input.d.ts +0 -3
  154. package/core/renderers/geras/measurables/statement_input.d.ts +0 -3
  155. package/core/renderers/geras/path_object.d.ts +0 -8
  156. package/core/renderers/geras/renderer.d.ts +5 -7
  157. package/core/renderers/measurables/base.d.ts +0 -3
  158. package/core/renderers/measurables/bottom_row.d.ts +0 -9
  159. package/core/renderers/measurables/connection.d.ts +0 -3
  160. package/core/renderers/measurables/external_value_input.d.ts +0 -3
  161. package/core/renderers/measurables/field.d.ts +0 -3
  162. package/core/renderers/measurables/hat.d.ts +0 -3
  163. package/core/renderers/measurables/icon.d.ts +2 -5
  164. package/core/renderers/measurables/in_row_spacer.d.ts +0 -3
  165. package/core/renderers/measurables/inline_input.d.ts +1 -4
  166. package/core/renderers/measurables/input_connection.d.ts +1 -4
  167. package/core/renderers/measurables/input_row.d.ts +0 -7
  168. package/core/renderers/measurables/jagged_edge.d.ts +2 -5
  169. package/core/renderers/measurables/next_connection.d.ts +0 -3
  170. package/core/renderers/measurables/output_connection.d.ts +0 -3
  171. package/core/renderers/measurables/previous_connection.d.ts +0 -3
  172. package/core/renderers/measurables/round_corner.d.ts +0 -3
  173. package/core/renderers/measurables/row.d.ts +0 -39
  174. package/core/renderers/measurables/spacer_row.d.ts +0 -3
  175. package/core/renderers/measurables/square_corner.d.ts +0 -3
  176. package/core/renderers/measurables/statement_input.d.ts +0 -3
  177. package/core/renderers/measurables/top_row.d.ts +0 -6
  178. package/core/renderers/measurables/types.d.ts +0 -31
  179. package/core/renderers/minimalist/constants.d.ts +2 -4
  180. package/core/renderers/minimalist/drawer.d.ts +0 -3
  181. package/core/renderers/minimalist/info.d.ts +0 -4
  182. package/core/renderers/minimalist/renderer.d.ts +0 -3
  183. package/core/renderers/thrasos/info.d.ts +0 -4
  184. package/core/renderers/thrasos/renderer.d.ts +3 -3
  185. package/core/renderers/zelos/constants.d.ts +3 -17
  186. package/core/renderers/zelos/drawer.d.ts +0 -3
  187. package/core/renderers/zelos/info.d.ts +0 -4
  188. package/core/renderers/zelos/marker_svg.d.ts +0 -2
  189. package/core/renderers/zelos/measurables/bottom_row.d.ts +0 -3
  190. package/core/renderers/zelos/measurables/inputs.d.ts +0 -3
  191. package/core/renderers/zelos/measurables/row_elements.d.ts +0 -3
  192. package/core/renderers/zelos/measurables/top_row.d.ts +0 -3
  193. package/core/renderers/zelos/path_object.d.ts +0 -9
  194. package/core/renderers/zelos/renderer.d.ts +3 -5
  195. package/core/scrollbar.d.ts +0 -2
  196. package/core/scrollbar_pair.d.ts +0 -2
  197. package/core/serialization/blocks.d.ts +3 -9
  198. package/core/serialization/exceptions.d.ts +0 -8
  199. package/core/serialization/priorities.d.ts +0 -4
  200. package/core/serialization/registry.d.ts +0 -2
  201. package/core/serialization/variables.d.ts +0 -4
  202. package/core/serialization/workspaces.d.ts +0 -2
  203. package/core/shortcut_items.d.ts +0 -17
  204. package/core/shortcut_registry.d.ts +0 -2
  205. package/core/sprites.d.ts +0 -2
  206. package/core/theme/classic.d.ts +0 -2
  207. package/core/theme/zelos.d.ts +0 -2
  208. package/core/theme.d.ts +0 -2
  209. package/core/theme_manager.d.ts +3 -6
  210. package/core/toolbox/category.d.ts +5 -7
  211. package/core/toolbox/collapsible_category.d.ts +0 -4
  212. package/core/toolbox/separator.d.ts +0 -2
  213. package/core/toolbox/toolbox.d.ts +2 -5
  214. package/core/toolbox/toolbox_item.d.ts +0 -2
  215. package/core/tooltip.d.ts +0 -29
  216. package/core/touch.d.ts +0 -13
  217. package/core/trashcan.d.ts +0 -2
  218. package/core/utils/aria.d.ts +0 -6
  219. package/core/utils/array.d.ts +0 -1
  220. package/core/utils/colour.d.ts +0 -12
  221. package/core/utils/coordinate.d.ts +0 -2
  222. package/core/utils/deprecation.d.ts +0 -1
  223. package/core/utils/dom.d.ts +0 -25
  224. package/core/utils/idgenerator.d.ts +0 -2
  225. package/core/utils/keycodes.d.ts +0 -2
  226. package/core/utils/math.d.ts +0 -3
  227. package/core/utils/metrics.d.ts +0 -1
  228. package/core/utils/object.d.ts +0 -4
  229. package/core/utils/parsing.d.ts +0 -4
  230. package/core/utils/rect.d.ts +0 -2
  231. package/core/utils/size.d.ts +0 -2
  232. package/core/utils/string.d.ts +0 -6
  233. package/core/utils/style.d.ts +0 -8
  234. package/core/utils/svg.d.ts +0 -2
  235. package/core/utils/svg_math.d.ts +0 -6
  236. package/core/utils/svg_paths.d.ts +0 -8
  237. package/core/utils/toolbox.d.ts +2 -35
  238. package/core/utils/useragent.d.ts +0 -8
  239. package/core/utils/xml.d.ts +9 -8
  240. package/core/utils.d.ts +0 -12
  241. package/core/variable_map.d.ts +1 -3
  242. package/core/variable_model.d.ts +0 -1
  243. package/core/variables.d.ts +13 -17
  244. package/core/variables_dynamic.d.ts +0 -4
  245. package/core/warning.d.ts +0 -2
  246. package/core/widgetdiv.d.ts +0 -10
  247. package/core/workspace.d.ts +3 -3
  248. package/core/workspace_audio.d.ts +0 -2
  249. package/core/workspace_comment.d.ts +1 -3
  250. package/core/workspace_comment_svg.d.ts +16 -5
  251. package/core/workspace_drag_surface_svg.d.ts +74 -0
  252. package/core/workspace_dragger.d.ts +3 -2
  253. package/core/workspace_svg.d.ts +48 -8
  254. package/core/xml.d.ts +1 -13
  255. package/core/zoom_controls.d.ts +4 -15
  256. package/dart_compressed.js +199 -199
  257. package/dart_compressed.js.map +1 -1
  258. package/javascript_compressed.js +168 -168
  259. package/javascript_compressed.js.map +1 -1
  260. package/lua_compressed.js +211 -211
  261. package/lua_compressed.js.map +1 -1
  262. package/msg/bn.js +2 -2
  263. package/msg/bs.js +7 -7
  264. package/msg/de.js +1 -1
  265. package/msg/fi.js +1 -1
  266. package/msg/fr.js +3 -3
  267. package/msg/ia.js +5 -5
  268. package/msg/kn.js +5 -5
  269. package/msg/ko.js +1 -1
  270. package/msg/lb.js +22 -22
  271. package/msg/sd.js +9 -9
  272. package/msg/skr-arab.js +2 -2
  273. package/msg/sl.js +18 -18
  274. package/msg/sw.js +1 -1
  275. package/msg/zh-hans.js +6 -6
  276. package/msg/zh-hant.js +2 -2
  277. package/package.json +6 -6
  278. package/php_compressed.js +185 -185
  279. package/php_compressed.js.map +1 -1
  280. package/python_compressed.js +138 -138
  281. package/python_compressed.js.map +1 -1
  282. package/core/utils/sentinel.d.ts +0 -18
@@ -31,71 +31,123 @@ module$exports$Blockly$JavaScript.javascriptGenerator.scrubNakedValue=function(a
31
31
  module$exports$Blockly$JavaScript.javascriptGenerator.scrub_=function(a,b,c){let d="";if(!a.outputConnection||!a.outputConnection.targetConnection){var e=a.getCommentText();e&&(e=$.module$build$src$core$utils$string.wrap(e,this.COMMENT_WRAP-3),d+=this.prefixLines(e+"\n","// "));for(let f=0;f<a.inputList.length;f++)a.inputList[f].type===$.module$build$src$core$input_types.inputTypes.VALUE&&(e=a.inputList[f].connection.targetBlock())&&(e=this.allNestedComments(e))&&(d+=this.prefixLines(e,"// "))}a=
32
32
  a.nextConnection&&a.nextConnection.targetBlock();c=c?"":this.blockToCode(a);return d+b+c};
33
33
  module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted=function(a,b,c,d,e){c=c||0;e=e||this.ORDER_NONE;a.workspace.options.oneBasedIndex&&c--;const f=a.workspace.options.oneBasedIndex?"1":"0";let g,h=e;0<c?g=h=this.ORDER_ADDITION:0>c?g=h=this.ORDER_SUBTRACTION:d&&(g=h=this.ORDER_UNARY_NEGATION);a=this.valueToCode(a,b,h)||f;$.module$build$src$core$utils$string.isNumber(a)?(a=Number(a)+c,d&&(a=-a)):(0<c?a=a+" + "+c:0>c&&(a=a+" - "+-c),d&&(a=c?"-("+a+")":"-"+a),g=Math.floor(g),e=Math.floor(e),
34
- g&&e>=g&&(a="("+a+")"));return a};var module$exports$Blockly$JavaScript$variables={},module$contents$Blockly$JavaScript$variables_NameType=$.NameType$$module$build$src$core$names;module$exports$Blockly$JavaScript.javascriptGenerator.variables_get=function(a){return[module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE),module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC]};
35
- module$exports$Blockly$JavaScript.javascriptGenerator.variables_set=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ASSIGNMENT)||"0";return module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE)+" = "+b+";\n"};var module$exports$Blockly$JavaScript$variablesDynamic={};module$exports$Blockly$JavaScript.javascriptGenerator.variables_get_dynamic=module$exports$Blockly$JavaScript.javascriptGenerator.variables_get;module$exports$Blockly$JavaScript.javascriptGenerator.variables_set_dynamic=module$exports$Blockly$JavaScript.javascriptGenerator.variables_set;var module$exports$Blockly$JavaScript$texts={},module$contents$Blockly$JavaScript$texts_NameType=$.NameType$$module$build$src$core$names,module$contents$Blockly$JavaScript$texts_strRegExp=/^\s*'([^']|\\')*'\s*$/,module$contents$Blockly$JavaScript$texts_forceString=function(a){return module$contents$Blockly$JavaScript$texts_strRegExp.test(a)?[a,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC]:["String("+a+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]},
36
- module$contents$Blockly$JavaScript$texts_getSubstringIndex=function(a,b,c){return"FIRST"===b?"0":"FROM_END"===b?a+".length - 1 - "+c:"LAST"===b?a+".length - 1":c};module$exports$Blockly$JavaScript.javascriptGenerator.text=function(a){return[module$exports$Blockly$JavaScript.javascriptGenerator.quote_(a.getFieldValue("TEXT")),module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC]};
37
- module$exports$Blockly$JavaScript.javascriptGenerator.text_multiline=function(a){a=module$exports$Blockly$JavaScript.javascriptGenerator.multiline_quote_(a.getFieldValue("TEXT"));const b=-1!==a.indexOf("+")?module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ADDITION:module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC;return[a,b]};
38
- module$exports$Blockly$JavaScript.javascriptGenerator.text_join=function(a){switch(a.itemCount_){case 0:return["''",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC];case 1:return a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"ADD0",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''",module$contents$Blockly$JavaScript$texts_forceString(a);case 2:var b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"ADD0",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||
39
- "''";a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"ADD1",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";return[module$contents$Blockly$JavaScript$texts_forceString(b)[0]+" + "+module$contents$Blockly$JavaScript$texts_forceString(a)[0],module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ADDITION];default:b=Array(a.itemCount_);for(let c=0;c<a.itemCount_;c++)b[c]=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"ADD"+c,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||
40
- "''";return["["+b.join(",")+"].join('')",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]}};
41
- module$exports$Blockly$JavaScript.javascriptGenerator.text_append=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE);a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TEXT",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";return b+" += "+module$contents$Blockly$JavaScript$texts_forceString(a)[0]+";\n"};
42
- module$exports$Blockly$JavaScript.javascriptGenerator.text_length=function(a){return[(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"''")+".length",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER]};
43
- module$exports$Blockly$JavaScript.javascriptGenerator.text_isEmpty=function(a){return["!"+(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"''")+".length",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_LOGICAL_NOT]};
44
- module$exports$Blockly$JavaScript.javascriptGenerator.text_indexOf=function(a){var b="FIRST"===a.getFieldValue("END")?"indexOf":"lastIndexOf";const c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"FIND",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";b=(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"''")+"."+b+"("+c+")";return a.workspace.options.oneBasedIndex?
45
- [b+" + 1",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ADDITION]:[b,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
46
- module$exports$Blockly$JavaScript.javascriptGenerator.text_charAt=function(a){const b=a.getFieldValue("WHERE")||"FROM_START",c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE","RANDOM"===b?module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE:module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"''";switch(b){case "FIRST":return[c+".charAt(0)",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL];case "LAST":return[c+".slice(-1)",
47
- module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL];case "FROM_START":return a=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT"),[c+".charAt("+a+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL];case "FROM_END":return a=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT",1,!0),[c+".slice("+a+").charAt(0)",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL];case "RANDOM":return[module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("textRandomLetter",
48
- `
49
- function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(text) {
50
- var x = Math.floor(Math.random() * text.length);
51
- return text[x];
34
+ g&&e>=g&&(a="("+a+")"));return a};var module$exports$Blockly$JavaScript$colour={};module$exports$Blockly$JavaScript.javascriptGenerator.colour_picker=function(a){return[module$exports$Blockly$JavaScript.javascriptGenerator.quote_(a.getFieldValue("COLOUR")),module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC]};module$exports$Blockly$JavaScript.javascriptGenerator.colour_random=function(a){return[module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("colourRandom",`
35
+ function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}() {
36
+ var num = Math.floor(Math.random() * Math.pow(2, 24));
37
+ return '#' + ('00000' + num.toString(16)).substr(-6);
52
38
  }
53
- `)+"("+c+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]}throw Error("Unhandled option (text_charAt).");};
54
- module$exports$Blockly$JavaScript.javascriptGenerator.text_getSubstring=function(a){var b=a.getFieldValue("WHERE1"),c=a.getFieldValue("WHERE2"),d="FROM_END"!==b&&"LAST"!==b&&"FROM_END"!==c&&"LAST"!==c,e=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"STRING",d?module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER:module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";if("FIRST"===b&&"LAST"===c)return[e,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE];
55
- if(e.match(/^'?\w+'?$/)||d){switch(b){case "FROM_START":b=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT1");break;case "FROM_END":b=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT1",1,!1,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_SUBTRACTION);b=e+".length - "+b;break;case "FIRST":b="0";break;default:throw Error("Unhandled option (text_getSubstring).");}switch(c){case "FROM_START":c=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,
56
- "AT2",1);break;case "FROM_END":c=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT2",0,!1,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_SUBTRACTION);c=e+".length - "+c;break;case "LAST":c=e+".length";break;default:throw Error("Unhandled option (text_getSubstring).");}e=e+".slice("+b+", "+c+")"}else{d=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT1");a=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT2");const f={FIRST:"First",
57
- LAST:"Last",FROM_START:"FromStart",FROM_END:"FromEnd"};e=module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("subsequence"+f[b]+f[c],`
58
- function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(sequence${"FROM_END"===b||"FROM_START"===b?", at1":""}${"FROM_END"===c||"FROM_START"===c?", at2":""}) {
59
- var start = ${module$contents$Blockly$JavaScript$texts_getSubstringIndex("sequence",b,"at1")};
60
- var end = ${module$contents$Blockly$JavaScript$texts_getSubstringIndex("sequence",c,"at2")} + 1;
61
- return sequence.slice(start, end);
39
+ `)+"()",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
40
+ module$exports$Blockly$JavaScript.javascriptGenerator.colour_rgb=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"RED",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||0,c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"GREEN",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||0;a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"BLUE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||
41
+ 0;return[module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("colourRgb",`
42
+ function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(r, g, b) {
43
+ r = Math.max(Math.min(Number(r), 100), 0) * 2.55;
44
+ g = Math.max(Math.min(Number(g), 100), 0) * 2.55;
45
+ b = Math.max(Math.min(Number(b), 100), 0) * 2.55;
46
+ r = ('0' + (Math.round(r) || 0).toString(16)).slice(-2);
47
+ g = ('0' + (Math.round(g) || 0).toString(16)).slice(-2);
48
+ b = ('0' + (Math.round(b) || 0).toString(16)).slice(-2);
49
+ return '#' + r + g + b;
62
50
  }
63
- `)+"("+e+("FROM_END"===b||"FROM_START"===b?", "+d:"")+("FROM_END"===c||"FROM_START"===c?", "+a:"")+")"}return[e,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
64
- module$exports$Blockly$JavaScript.javascriptGenerator.text_changeCase=function(a){const b={UPPERCASE:".toUpperCase()",LOWERCASE:".toLowerCase()",TITLECASE:null}[a.getFieldValue("CASE")];a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TEXT",b?module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER:module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";return[b?a+b:module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("textToTitleCase",
65
- `
66
- function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(str) {
67
- return str.replace(/\\S+/g,
68
- function(txt) {return txt[0].toUpperCase() + txt.substring(1).toLowerCase();});
51
+ `)+"("+b+", "+c+", "+a+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
52
+ module$exports$Blockly$JavaScript.javascriptGenerator.colour_blend=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"COLOUR1",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"'#000000'",c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"COLOUR2",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"'#000000'";a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"RATIO",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||
53
+ .5;return[module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("colourBlend",`
54
+ function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(c1, c2, ratio) {
55
+ ratio = Math.max(Math.min(Number(ratio), 1), 0);
56
+ var r1 = parseInt(c1.substring(1, 3), 16);
57
+ var g1 = parseInt(c1.substring(3, 5), 16);
58
+ var b1 = parseInt(c1.substring(5, 7), 16);
59
+ var r2 = parseInt(c2.substring(1, 3), 16);
60
+ var g2 = parseInt(c2.substring(3, 5), 16);
61
+ var b2 = parseInt(c2.substring(5, 7), 16);
62
+ var r = Math.round(r1 * (1 - ratio) + r2 * ratio);
63
+ var g = Math.round(g1 * (1 - ratio) + g2 * ratio);
64
+ var b = Math.round(b1 * (1 - ratio) + b2 * ratio);
65
+ r = ('0' + (r || 0).toString(16)).slice(-2);
66
+ g = ('0' + (g || 0).toString(16)).slice(-2);
67
+ b = ('0' + (b || 0).toString(16)).slice(-2);
68
+ return '#' + r + g + b;
69
69
  }
70
- `)+"("+a+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};module$exports$Blockly$JavaScript.javascriptGenerator.text_trim=function(a){const b={LEFT:".replace(/^[\\s\\xa0]+/, '')",RIGHT:".replace(/[\\s\\xa0]+$/, '')",BOTH:".trim()"}[a.getFieldValue("MODE")];return[(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TEXT",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"''")+b,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
71
- module$exports$Blockly$JavaScript.javascriptGenerator.text_print=function(a){return"window.alert("+(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TEXT",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''")+");\n"};
72
- module$exports$Blockly$JavaScript.javascriptGenerator.text_prompt_ext=function(a){let b="window.prompt("+(a.getField("TEXT")?module$exports$Blockly$JavaScript.javascriptGenerator.quote_(a.getFieldValue("TEXT")):module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TEXT",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''")+")";"NUMBER"===a.getFieldValue("TYPE")&&(b="Number("+b+")");return[b,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
73
- module$exports$Blockly$JavaScript.javascriptGenerator.text_prompt=module$exports$Blockly$JavaScript.javascriptGenerator.text_prompt_ext;
74
- module$exports$Blockly$JavaScript.javascriptGenerator.text_count=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TEXT",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"SUB",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";return[module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("textCount",`
75
- function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(haystack, needle) {
76
- if (needle.length === 0) {
77
- return haystack.length + 1;
70
+ `)+"("+b+", "+c+", "+a+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};var module$exports$Blockly$JavaScript$lists={},module$contents$Blockly$JavaScript$lists_NameType=$.NameType$$module$build$src$core$names;module$exports$Blockly$JavaScript.javascriptGenerator.lists_create_empty=function(a){return["[]",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC]};
71
+ module$exports$Blockly$JavaScript.javascriptGenerator.lists_create_with=function(a){const b=Array(a.itemCount_);for(let c=0;c<a.itemCount_;c++)b[c]=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"ADD"+c,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"null";return["["+b.join(", ")+"]",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC]};
72
+ module$exports$Blockly$JavaScript.javascriptGenerator.lists_repeat=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("listsRepeat",`
73
+ function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(value, n) {
74
+ var array = [];
75
+ for (var i = 0; i < n; i++) {
76
+ array[i] = value;
77
+ }
78
+ return array;
79
+ }
80
+ `),c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"ITEM",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"null";a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"NUM",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"0";return[b+"("+c+", "+a+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
81
+ module$exports$Blockly$JavaScript.javascriptGenerator.lists_length=function(a){return[(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"[]")+".length",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER]};
82
+ module$exports$Blockly$JavaScript.javascriptGenerator.lists_isEmpty=function(a){return["!"+(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"[]")+".length",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_LOGICAL_NOT]};
83
+ module$exports$Blockly$JavaScript.javascriptGenerator.lists_indexOf=function(a){var b="FIRST"===a.getFieldValue("END")?"indexOf":"lastIndexOf";const c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"FIND",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";b=(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"[]")+"."+b+"("+c+")";return a.workspace.options.oneBasedIndex?
84
+ [b+" + 1",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ADDITION]:[b,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
85
+ module$exports$Blockly$JavaScript.javascriptGenerator.lists_getIndex=function(a){const b=a.getFieldValue("MODE")||"GET",c=a.getFieldValue("WHERE")||"FROM_START";var d=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE","RANDOM"===c?module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE:module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"[]";switch(c){case "FIRST":if("GET"===b)return[d+"[0]",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER];
86
+ if("GET_REMOVE"===b)return[d+".shift()",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER];if("REMOVE"===b)return d+".shift();\n";break;case "LAST":if("GET"===b)return[d+".slice(-1)[0]",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER];if("GET_REMOVE"===b)return[d+".pop()",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER];if("REMOVE"===b)return d+".pop();\n";break;case "FROM_START":a=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,
87
+ "AT");if("GET"===b)return[d+"["+a+"]",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER];if("GET_REMOVE"===b)return[d+".splice("+a+", 1)[0]",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+".splice("+a+", 1);\n";break;case "FROM_END":a=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT",1,!0);if("GET"===b)return[d+".slice("+a+")[0]",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL];if("GET_REMOVE"===
88
+ b)return[d+".splice("+a+", 1)[0]",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+".splice("+a+", 1);";break;case "RANDOM":d=module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("listsGetRandomItem",`
89
+ function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(list, remove) {
90
+ var x = Math.floor(Math.random() * list.length);
91
+ if (remove) {
92
+ return list.splice(x, 1)[0];
78
93
  } else {
79
- return haystack.split(needle).length - 1;
94
+ return list[x];
80
95
  }
81
96
  }
82
- `)+"("+b+", "+a+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
83
- module$exports$Blockly$JavaScript.javascriptGenerator.text_replace=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TEXT",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''",c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"FROM",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TO",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||
84
- "''";return[module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("textReplace",`
85
- function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(haystack, needle, replacement) {
86
- needle = needle.replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g, '\\\\$1')
87
- .replace(/\\x08/g, '\\\\x08');
88
- return haystack.replace(new RegExp(needle, 'g'), replacement);
97
+ `)+"("+d+", "+("GET"!==b)+")";if("GET"===b||"GET_REMOVE"===b)return[d,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+";\n"}throw Error("Unhandled combination (lists_getIndex).");};
98
+ module$exports$Blockly$JavaScript.javascriptGenerator.lists_setIndex=function(a){function b(){if(c.match(/^\w+$/))return"";const g=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getDistinctName("tmpList",$.NameType$$module$build$src$core$names.VARIABLE),h="var "+g+" = "+c+";\n";c=g;return h}let c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"LIST",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"[]";const d=a.getFieldValue("MODE")||"GET";
99
+ var e=a.getFieldValue("WHERE")||"FROM_START";const f=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TO",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ASSIGNMENT)||"null";switch(e){case "FIRST":if("SET"===d)return c+"[0] = "+f+";\n";if("INSERT"===d)return c+".unshift("+f+");\n";break;case "LAST":if("SET"===d)return b()+(c+"["+c+".length - 1] = "+f+";\n");if("INSERT"===d)return c+".push("+f+");\n";break;case "FROM_START":a=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,
100
+ "AT");if("SET"===d)return c+"["+a+"] = "+f+";\n";if("INSERT"===d)return c+".splice("+a+", 0, "+f+");\n";break;case "FROM_END":a=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT",1,!1,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_SUBTRACTION);e=b();if("SET"===d)return e+(c+"["+c+".length - "+a+"] = "+f+";\n");if("INSERT"===d)return e+(c+".splice("+c+".length - "+a+", 0, "+f+");\n");break;case "RANDOM":a=b();e=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getDistinctName("tmpX",
101
+ $.NameType$$module$build$src$core$names.VARIABLE);a+="var "+e+" = Math.floor(Math.random() * "+c+".length);\n";if("SET"===d)return a+(c+"["+e+"] = "+f+";\n");if("INSERT"===d)return a+(c+".splice("+e+", 0, "+f+");\n")}throw Error("Unhandled combination (lists_setIndex).");};var module$contents$Blockly$JavaScript$lists_getSubstringIndex=function(a,b,c){return"FIRST"===b?"0":"FROM_END"===b?a+".length - 1 - "+c:"LAST"===b?a+".length - 1":c};
102
+ module$exports$Blockly$JavaScript.javascriptGenerator.lists_getSublist=function(a){var b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"LIST",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"[]",c=a.getFieldValue("WHERE1"),d=a.getFieldValue("WHERE2");if("FIRST"===c&&"LAST"===d)b+=".slice(0)";else if(b.match(/^\w+$/)||"FROM_END"!==c&&"FROM_START"===d){switch(c){case "FROM_START":c=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT1");
103
+ break;case "FROM_END":c=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT1",1,!1,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_SUBTRACTION);c=b+".length - "+c;break;case "FIRST":c="0";break;default:throw Error("Unhandled option (lists_getSublist).");}switch(d){case "FROM_START":d=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT2",1);break;case "FROM_END":d=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT2",0,!1,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_SUBTRACTION);
104
+ d=b+".length - "+d;break;case "LAST":d=b+".length";break;default:throw Error("Unhandled option (lists_getSublist).");}b=b+".slice("+c+", "+d+")"}else{const e=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT1");a=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT2");const f={FIRST:"First",LAST:"Last",FROM_START:"FromStart",FROM_END:"FromEnd"};b=module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("subsequence"+f[c]+f[d],`
105
+ function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(sequence${"FROM_END"===c||"FROM_START"===c?", at1":""}${"FROM_END"===d||"FROM_START"===d?", at2":""}) {
106
+ var start = ${module$contents$Blockly$JavaScript$lists_getSubstringIndex("sequence",c,"at1")};
107
+ var end = ${module$contents$Blockly$JavaScript$lists_getSubstringIndex("sequence",d,"at2")} + 1;
108
+ return sequence.slice(start, end);
89
109
  }
90
- `)+"("+b+", "+c+", "+a+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};module$exports$Blockly$JavaScript.javascriptGenerator.text_reverse=function(a){return[(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TEXT",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"''")+".split('').reverse().join('')",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};var module$exports$Blockly$JavaScript$procedures={},module$contents$Blockly$JavaScript$procedures_NameType=$.NameType$$module$build$src$core$names;
91
- module$exports$Blockly$JavaScript.javascriptGenerator.procedures_defreturn=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getName(a.getFieldValue("NAME"),$.NameType$$module$build$src$core$names.PROCEDURE);var c="";module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_PREFIX&&(c+=module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_PREFIX,a));module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX&&
92
- (c+=module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX,a));c&&(c=module$exports$Blockly$JavaScript.javascriptGenerator.prefixLines(c,module$exports$Blockly$JavaScript.javascriptGenerator.INDENT));let d="";module$exports$Blockly$JavaScript.javascriptGenerator.INFINITE_LOOP_TRAP&&(d=module$exports$Blockly$JavaScript.javascriptGenerator.prefixLines(module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.INFINITE_LOOP_TRAP,
93
- a),module$exports$Blockly$JavaScript.javascriptGenerator.INDENT));const e=module$exports$Blockly$JavaScript.javascriptGenerator.statementToCode(a,"STACK");let f=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"RETURN",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"",g="";e&&f&&(g=c);f&&(f=module$exports$Blockly$JavaScript.javascriptGenerator.INDENT+"return "+f+";\n");const h=[],k=a.getVars();for(let l=0;l<k.length;l++)h[l]=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getName(k[l],
94
- $.NameType$$module$build$src$core$names.VARIABLE);c="function "+b+"("+h.join(", ")+") {\n"+c+d+e+g+f+"}";c=module$exports$Blockly$JavaScript.javascriptGenerator.scrub_(a,c);module$exports$Blockly$JavaScript.javascriptGenerator.definitions_["%"+b]=c;return null};module$exports$Blockly$JavaScript.javascriptGenerator.procedures_defnoreturn=module$exports$Blockly$JavaScript.javascriptGenerator.procedures_defreturn;
95
- module$exports$Blockly$JavaScript.javascriptGenerator.procedures_callreturn=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getName(a.getFieldValue("NAME"),$.NameType$$module$build$src$core$names.PROCEDURE),c=[],d=a.getVars();for(let e=0;e<d.length;e++)c[e]=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"ARG"+e,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"null";return[b+"("+c.join(", ")+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
96
- module$exports$Blockly$JavaScript.javascriptGenerator.procedures_callnoreturn=function(a){return module$exports$Blockly$JavaScript.javascriptGenerator.procedures_callreturn(a)[0]+";\n"};
97
- module$exports$Blockly$JavaScript.javascriptGenerator.procedures_ifreturn=function(a){let b="if ("+(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"CONDITION",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"false")+") {\n";module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX&&(b+=module$exports$Blockly$JavaScript.javascriptGenerator.prefixLines(module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX,
98
- a),module$exports$Blockly$JavaScript.javascriptGenerator.INDENT));a.hasReturnValue_?(a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"null",b+=module$exports$Blockly$JavaScript.javascriptGenerator.INDENT+"return "+a+";\n"):b+=module$exports$Blockly$JavaScript.javascriptGenerator.INDENT+"return;\n";return b+"}\n"};var module$exports$Blockly$JavaScript$math={},module$contents$Blockly$JavaScript$math_NameType=$.NameType$$module$build$src$core$names;module$exports$Blockly$JavaScript.javascriptGenerator.math_number=function(a){a=Number(a.getFieldValue("NUM"));return[a,0<=a?module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC:module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_UNARY_NEGATION]};
110
+ `)+"("+b+("FROM_END"===c||"FROM_START"===c?", "+e:"")+("FROM_END"===d||"FROM_START"===d?", "+a:"")+")"}return[b,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
111
+ module$exports$Blockly$JavaScript.javascriptGenerator.lists_sort=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"LIST",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL)||"[]",c="1"===a.getFieldValue("DIRECTION")?1:-1;a=a.getFieldValue("TYPE");const d=module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("listsGetSortCompare",`
112
+ function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(type, direction) {
113
+ var compareFuncs = {
114
+ 'NUMERIC': function(a, b) {
115
+ return Number(a) - Number(b); },
116
+ 'TEXT': function(a, b) {
117
+ return String(a) > String(b) ? 1 : -1; },
118
+ 'IGNORE_CASE': function(a, b) {
119
+ return String(a).toLowerCase() > String(b).toLowerCase() ? 1 : -1; },
120
+ };
121
+ var compare = compareFuncs[type];
122
+ return function(a, b) { return compare(a, b) * direction; };
123
+ }
124
+ `);return[b+".slice().sort("+d+'("'+a+'", '+c+"))",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
125
+ module$exports$Blockly$JavaScript.javascriptGenerator.lists_split=function(a){let b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"INPUT",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER);const c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"DELIM",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";a=a.getFieldValue("MODE");if("SPLIT"===a)b||(b="''"),a="split";else if("JOIN"===a)b||(b="[]"),a="join";else throw Error("Unknown mode: "+
126
+ a);return[b+"."+a+"("+c+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};module$exports$Blockly$JavaScript.javascriptGenerator.lists_reverse=function(a){return[(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"LIST",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL)||"[]")+".slice().reverse()",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};var module$exports$Blockly$JavaScript$logic={};
127
+ module$exports$Blockly$JavaScript.javascriptGenerator.controls_if=function(a){var b=0;let c="";module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_PREFIX&&(c+=module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_PREFIX,a));do{const d=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"IF"+b,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"false";let e=module$exports$Blockly$JavaScript.javascriptGenerator.statementToCode(a,
128
+ "DO"+b);module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX&&(e=module$exports$Blockly$JavaScript.javascriptGenerator.prefixLines(module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX,a),module$exports$Blockly$JavaScript.javascriptGenerator.INDENT)+e);c+=(0<b?" else ":"")+"if ("+d+") {\n"+e+"}";b++}while(a.getInput("IF"+b));if(a.getInput("ELSE")||module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX)b=
129
+ module$exports$Blockly$JavaScript.javascriptGenerator.statementToCode(a,"ELSE"),module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX&&(b=module$exports$Blockly$JavaScript.javascriptGenerator.prefixLines(module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX,a),module$exports$Blockly$JavaScript.javascriptGenerator.INDENT)+b),c+=" else {\n"+b+"}";return c+"\n"};
130
+ module$exports$Blockly$JavaScript.javascriptGenerator.controls_ifelse=module$exports$Blockly$JavaScript.javascriptGenerator.controls_if;
131
+ module$exports$Blockly$JavaScript.javascriptGenerator.logic_compare=function(a){const b={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[a.getFieldValue("OP")],c="=="===b||"!="===b?module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_EQUALITY:module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_RELATIONAL,d=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"A",c)||"0";a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"B",c)||"0";return[d+" "+b+
132
+ " "+a,c]};
133
+ module$exports$Blockly$JavaScript.javascriptGenerator.logic_operation=function(a){const b="AND"===a.getFieldValue("OP")?"&&":"||",c="&&"===b?module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_LOGICAL_AND:module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_LOGICAL_OR;let d=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"A",c);a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"B",c);if(d||a){const e="&&"===b?"true":"false";d||(d=e);a||(a=e)}else a=
134
+ d="false";return[d+" "+b+" "+a,c]};module$exports$Blockly$JavaScript.javascriptGenerator.logic_negate=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_LOGICAL_NOT;return["!"+(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"BOOL",b)||"true"),b]};module$exports$Blockly$JavaScript.javascriptGenerator.logic_boolean=function(a){return["TRUE"===a.getFieldValue("BOOL")?"true":"false",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC]};
135
+ module$exports$Blockly$JavaScript.javascriptGenerator.logic_null=function(a){return["null",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC]};
136
+ module$exports$Blockly$JavaScript.javascriptGenerator.logic_ternary=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"IF",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_CONDITIONAL)||"false",c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"THEN",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_CONDITIONAL)||"null";a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"ELSE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_CONDITIONAL)||
137
+ "null";return[b+" ? "+c+" : "+a,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_CONDITIONAL]};var module$exports$Blockly$JavaScript$loops={},module$contents$Blockly$JavaScript$loops_stringUtils=$.module$build$src$core$utils$string,module$contents$Blockly$JavaScript$loops_NameType=$.NameType$$module$build$src$core$names;
138
+ module$exports$Blockly$JavaScript.javascriptGenerator.controls_repeat_ext=function(a){let b;b=a.getField("TIMES")?String(Number(a.getFieldValue("TIMES"))):module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TIMES",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ASSIGNMENT)||"0";let c=module$exports$Blockly$JavaScript.javascriptGenerator.statementToCode(a,"DO");c=module$exports$Blockly$JavaScript.javascriptGenerator.addLoopTrap(c,a);a="";const d=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getDistinctName("count",
139
+ $.NameType$$module$build$src$core$names.VARIABLE);let e=b;b.match(/^\w+$/)||$.module$build$src$core$utils$string.isNumber(b)||(e=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getDistinctName("repeat_end",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+e+" = "+b+";\n");return a+("for (var "+d+" = 0; "+d+" < "+e+"; "+d+"++) {\n"+c+"}\n")};module$exports$Blockly$JavaScript.javascriptGenerator.controls_repeat=module$exports$Blockly$JavaScript.javascriptGenerator.controls_repeat_ext;
140
+ module$exports$Blockly$JavaScript.javascriptGenerator.controls_whileUntil=function(a){const b="UNTIL"===a.getFieldValue("MODE");let c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"BOOL",b?module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_LOGICAL_NOT:module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"false",d=module$exports$Blockly$JavaScript.javascriptGenerator.statementToCode(a,"DO");d=module$exports$Blockly$JavaScript.javascriptGenerator.addLoopTrap(d,
141
+ a);b&&(c="!"+c);return"while ("+c+") {\n"+d+"}\n"};
142
+ module$exports$Blockly$JavaScript.javascriptGenerator.controls_for=function(a){var b=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE),c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"FROM",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ASSIGNMENT)||"0",d=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TO",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ASSIGNMENT)||
143
+ "0";const e=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"BY",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ASSIGNMENT)||"1";let f=module$exports$Blockly$JavaScript.javascriptGenerator.statementToCode(a,"DO");f=module$exports$Blockly$JavaScript.javascriptGenerator.addLoopTrap(f,a);if($.module$build$src$core$utils$string.isNumber(c)&&$.module$build$src$core$utils$string.isNumber(d)&&$.module$build$src$core$utils$string.isNumber(e)){var g=Number(c)<=Number(d);a=
144
+ "for ("+b+" = "+c+"; "+b+(g?" <= ":" >= ")+d+"; "+b;b=Math.abs(Number(e));a=1===b?a+(g?"++":"--"):a+((g?" += ":" -= ")+b);a+=") {\n"+f+"}\n"}else a="",g=c,c.match(/^\w+$/)||$.module$build$src$core$utils$string.isNumber(c)||(g=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getDistinctName(b+"_start",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+g+" = "+c+";\n"),c=d,d.match(/^\w+$/)||$.module$build$src$core$utils$string.isNumber(d)||(c=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getDistinctName(b+
145
+ "_end",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+c+" = "+d+";\n"),d=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getDistinctName(b+"_inc",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+d+" = ",a=$.module$build$src$core$utils$string.isNumber(e)?a+(Math.abs(e)+";\n"):a+("Math.abs("+e+");\n"),a+="if ("+g+" > "+c+") {\n",a+=module$exports$Blockly$JavaScript.javascriptGenerator.INDENT+d+" = -"+d+";\n",a=a+"}\nfor ("+(b+" = "+g+"; "+d+" >= 0 ? "+b+" <= "+
146
+ c+" : "+b+" >= "+c+"; "+b+" += "+d+") {\n"+f+"}\n");return a};
147
+ module$exports$Blockly$JavaScript.javascriptGenerator.controls_forEach=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE);var c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"LIST",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ASSIGNMENT)||"[]";let d=module$exports$Blockly$JavaScript.javascriptGenerator.statementToCode(a,"DO");d=module$exports$Blockly$JavaScript.javascriptGenerator.addLoopTrap(d,
148
+ a);a="";let e=c;c.match(/^\w+$/)||(e=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getDistinctName(b+"_list",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+e+" = "+c+";\n");c=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getDistinctName(b+"_index",$.NameType$$module$build$src$core$names.VARIABLE);d=module$exports$Blockly$JavaScript.javascriptGenerator.INDENT+b+" = "+e+"["+c+"];\n"+d;return a+("for (var "+c+" in "+e+") {\n"+d+"}\n")};
149
+ module$exports$Blockly$JavaScript.javascriptGenerator.controls_flow_statements=function(a){let b="";module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_PREFIX&&(b+=module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_PREFIX,a));module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX&&(b+=module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX,
150
+ a));if(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_PREFIX){const c=a.getSurroundLoop();c&&!c.suppressPrefixSuffix&&(b+=module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_PREFIX,c))}switch(a.getFieldValue("FLOW")){case "BREAK":return b+"break;\n";case "CONTINUE":return b+"continue;\n"}throw Error("Unknown flow statement.");};var module$exports$Blockly$JavaScript$math={},module$contents$Blockly$JavaScript$math_NameType=$.NameType$$module$build$src$core$names;module$exports$Blockly$JavaScript.javascriptGenerator.math_number=function(a){a=Number(a.getFieldValue("NUM"));return[a,0<=a?module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC:module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_UNARY_NEGATION]};
99
151
  module$exports$Blockly$JavaScript.javascriptGenerator.math_arithmetic=function(a){var b={ADD:[" + ",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ADDITION],MINUS:[" - ",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_SUBTRACTION],MULTIPLY:[" * ",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MULTIPLICATION],DIVIDE:[" / ",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_DIVISION],POWER:[null,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE]}[a.getFieldValue("OP")];
100
152
  const c=b[0];b=b[1];const d=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"A",b)||"0";a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"B",b)||"0";return c?[d+c+a,b]:["Math.pow("+d+", "+a+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
101
153
  module$exports$Blockly$JavaScript.javascriptGenerator.math_single=function(a){const b=a.getFieldValue("OP");let c;if("NEG"===b)return a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"NUM",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_UNARY_NEGATION)||"0","-"===a[0]&&(a=" "+a),["-"+a,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_UNARY_NEGATION];a="SIN"===b||"COS"===b||"TAN"===b?module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"NUM",
@@ -205,123 +257,71 @@ function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_P
205
257
  return Math.floor(Math.random() * (b - a + 1) + a);
206
258
  }
207
259
  `)+"("+b+", "+a+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};module$exports$Blockly$JavaScript.javascriptGenerator.math_random_float=function(a){return["Math.random()",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
208
- module$exports$Blockly$JavaScript.javascriptGenerator.math_atan2=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"X",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"0";return["Math.atan2("+(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"Y",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"0")+", "+b+") / Math.PI * 180",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_DIVISION]};var module$exports$Blockly$JavaScript$loops={},module$contents$Blockly$JavaScript$loops_stringUtils=$.module$build$src$core$utils$string,module$contents$Blockly$JavaScript$loops_NameType=$.NameType$$module$build$src$core$names;
209
- module$exports$Blockly$JavaScript.javascriptGenerator.controls_repeat_ext=function(a){let b;b=a.getField("TIMES")?String(Number(a.getFieldValue("TIMES"))):module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TIMES",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ASSIGNMENT)||"0";let c=module$exports$Blockly$JavaScript.javascriptGenerator.statementToCode(a,"DO");c=module$exports$Blockly$JavaScript.javascriptGenerator.addLoopTrap(c,a);a="";const d=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getDistinctName("count",
210
- $.NameType$$module$build$src$core$names.VARIABLE);let e=b;b.match(/^\w+$/)||$.module$build$src$core$utils$string.isNumber(b)||(e=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getDistinctName("repeat_end",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+e+" = "+b+";\n");return a+("for (var "+d+" = 0; "+d+" < "+e+"; "+d+"++) {\n"+c+"}\n")};module$exports$Blockly$JavaScript.javascriptGenerator.controls_repeat=module$exports$Blockly$JavaScript.javascriptGenerator.controls_repeat_ext;
211
- module$exports$Blockly$JavaScript.javascriptGenerator.controls_whileUntil=function(a){const b="UNTIL"===a.getFieldValue("MODE");let c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"BOOL",b?module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_LOGICAL_NOT:module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"false",d=module$exports$Blockly$JavaScript.javascriptGenerator.statementToCode(a,"DO");d=module$exports$Blockly$JavaScript.javascriptGenerator.addLoopTrap(d,
212
- a);b&&(c="!"+c);return"while ("+c+") {\n"+d+"}\n"};
213
- module$exports$Blockly$JavaScript.javascriptGenerator.controls_for=function(a){var b=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE),c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"FROM",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ASSIGNMENT)||"0",d=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TO",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ASSIGNMENT)||
214
- "0";const e=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"BY",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ASSIGNMENT)||"1";let f=module$exports$Blockly$JavaScript.javascriptGenerator.statementToCode(a,"DO");f=module$exports$Blockly$JavaScript.javascriptGenerator.addLoopTrap(f,a);if($.module$build$src$core$utils$string.isNumber(c)&&$.module$build$src$core$utils$string.isNumber(d)&&$.module$build$src$core$utils$string.isNumber(e)){var g=Number(c)<=Number(d);a=
215
- "for ("+b+" = "+c+"; "+b+(g?" <= ":" >= ")+d+"; "+b;b=Math.abs(Number(e));a=1===b?a+(g?"++":"--"):a+((g?" += ":" -= ")+b);a+=") {\n"+f+"}\n"}else a="",g=c,c.match(/^\w+$/)||$.module$build$src$core$utils$string.isNumber(c)||(g=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getDistinctName(b+"_start",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+g+" = "+c+";\n"),c=d,d.match(/^\w+$/)||$.module$build$src$core$utils$string.isNumber(d)||(c=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getDistinctName(b+
216
- "_end",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+c+" = "+d+";\n"),d=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getDistinctName(b+"_inc",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+d+" = ",a=$.module$build$src$core$utils$string.isNumber(e)?a+(Math.abs(e)+";\n"):a+("Math.abs("+e+");\n"),a+="if ("+g+" > "+c+") {\n",a+=module$exports$Blockly$JavaScript.javascriptGenerator.INDENT+d+" = -"+d+";\n",a=a+"}\nfor ("+(b+" = "+g+"; "+d+" >= 0 ? "+b+" <= "+
217
- c+" : "+b+" >= "+c+"; "+b+" += "+d+") {\n"+f+"}\n");return a};
218
- module$exports$Blockly$JavaScript.javascriptGenerator.controls_forEach=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE);var c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"LIST",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ASSIGNMENT)||"[]";let d=module$exports$Blockly$JavaScript.javascriptGenerator.statementToCode(a,"DO");d=module$exports$Blockly$JavaScript.javascriptGenerator.addLoopTrap(d,
219
- a);a="";let e=c;c.match(/^\w+$/)||(e=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getDistinctName(b+"_list",$.NameType$$module$build$src$core$names.VARIABLE),a+="var "+e+" = "+c+";\n");c=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getDistinctName(b+"_index",$.NameType$$module$build$src$core$names.VARIABLE);d=module$exports$Blockly$JavaScript.javascriptGenerator.INDENT+b+" = "+e+"["+c+"];\n"+d;return a+("for (var "+c+" in "+e+") {\n"+d+"}\n")};
220
- module$exports$Blockly$JavaScript.javascriptGenerator.controls_flow_statements=function(a){let b="";module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_PREFIX&&(b+=module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_PREFIX,a));module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX&&(b+=module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX,
221
- a));if(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_PREFIX){const c=a.getSurroundLoop();c&&!c.suppressPrefixSuffix&&(b+=module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_PREFIX,c))}switch(a.getFieldValue("FLOW")){case "BREAK":return b+"break;\n";case "CONTINUE":return b+"continue;\n"}throw Error("Unknown flow statement.");};var module$exports$Blockly$JavaScript$logic={};
222
- module$exports$Blockly$JavaScript.javascriptGenerator.controls_if=function(a){var b=0;let c="";module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_PREFIX&&(c+=module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_PREFIX,a));do{const d=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"IF"+b,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"false";let e=module$exports$Blockly$JavaScript.javascriptGenerator.statementToCode(a,
223
- "DO"+b);module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX&&(e=module$exports$Blockly$JavaScript.javascriptGenerator.prefixLines(module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX,a),module$exports$Blockly$JavaScript.javascriptGenerator.INDENT)+e);c+=(0<b?" else ":"")+"if ("+d+") {\n"+e+"}";b++}while(a.getInput("IF"+b));if(a.getInput("ELSE")||module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX)b=
224
- module$exports$Blockly$JavaScript.javascriptGenerator.statementToCode(a,"ELSE"),module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX&&(b=module$exports$Blockly$JavaScript.javascriptGenerator.prefixLines(module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX,a),module$exports$Blockly$JavaScript.javascriptGenerator.INDENT)+b),c+=" else {\n"+b+"}";return c+"\n"};
225
- module$exports$Blockly$JavaScript.javascriptGenerator.controls_ifelse=module$exports$Blockly$JavaScript.javascriptGenerator.controls_if;
226
- module$exports$Blockly$JavaScript.javascriptGenerator.logic_compare=function(a){const b={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[a.getFieldValue("OP")],c="=="===b||"!="===b?module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_EQUALITY:module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_RELATIONAL,d=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"A",c)||"0";a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"B",c)||"0";return[d+" "+b+
227
- " "+a,c]};
228
- module$exports$Blockly$JavaScript.javascriptGenerator.logic_operation=function(a){const b="AND"===a.getFieldValue("OP")?"&&":"||",c="&&"===b?module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_LOGICAL_AND:module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_LOGICAL_OR;let d=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"A",c);a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"B",c);if(d||a){const e="&&"===b?"true":"false";d||(d=e);a||(a=e)}else a=
229
- d="false";return[d+" "+b+" "+a,c]};module$exports$Blockly$JavaScript.javascriptGenerator.logic_negate=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_LOGICAL_NOT;return["!"+(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"BOOL",b)||"true"),b]};module$exports$Blockly$JavaScript.javascriptGenerator.logic_boolean=function(a){return["TRUE"===a.getFieldValue("BOOL")?"true":"false",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC]};
230
- module$exports$Blockly$JavaScript.javascriptGenerator.logic_null=function(a){return["null",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC]};
231
- module$exports$Blockly$JavaScript.javascriptGenerator.logic_ternary=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"IF",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_CONDITIONAL)||"false",c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"THEN",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_CONDITIONAL)||"null";a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"ELSE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_CONDITIONAL)||
232
- "null";return[b+" ? "+c+" : "+a,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_CONDITIONAL]};var module$exports$Blockly$JavaScript$lists={},module$contents$Blockly$JavaScript$lists_NameType=$.NameType$$module$build$src$core$names;module$exports$Blockly$JavaScript.javascriptGenerator.lists_create_empty=function(a){return["[]",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC]};
233
- module$exports$Blockly$JavaScript.javascriptGenerator.lists_create_with=function(a){const b=Array(a.itemCount_);for(let c=0;c<a.itemCount_;c++)b[c]=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"ADD"+c,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"null";return["["+b.join(", ")+"]",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC]};
234
- module$exports$Blockly$JavaScript.javascriptGenerator.lists_repeat=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("listsRepeat",`
235
- function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(value, n) {
236
- var array = [];
237
- for (var i = 0; i < n; i++) {
238
- array[i] = value;
239
- }
240
- return array;
241
- }
242
- `),c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"ITEM",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"null";a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"NUM",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"0";return[b+"("+c+", "+a+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
243
- module$exports$Blockly$JavaScript.javascriptGenerator.lists_length=function(a){return[(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"[]")+".length",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER]};
244
- module$exports$Blockly$JavaScript.javascriptGenerator.lists_isEmpty=function(a){return["!"+(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"[]")+".length",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_LOGICAL_NOT]};
245
- module$exports$Blockly$JavaScript.javascriptGenerator.lists_indexOf=function(a){var b="FIRST"===a.getFieldValue("END")?"indexOf":"lastIndexOf";const c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"FIND",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";b=(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"[]")+"."+b+"("+c+")";return a.workspace.options.oneBasedIndex?
260
+ module$exports$Blockly$JavaScript.javascriptGenerator.math_atan2=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"X",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"0";return["Math.atan2("+(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"Y",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"0")+", "+b+") / Math.PI * 180",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_DIVISION]};var module$exports$Blockly$JavaScript$procedures={},module$contents$Blockly$JavaScript$procedures_NameType=$.NameType$$module$build$src$core$names;
261
+ module$exports$Blockly$JavaScript.javascriptGenerator.procedures_defreturn=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getName(a.getFieldValue("NAME"),$.NameType$$module$build$src$core$names.PROCEDURE);var c="";module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_PREFIX&&(c+=module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_PREFIX,a));module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX&&
262
+ (c+=module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX,a));c&&(c=module$exports$Blockly$JavaScript.javascriptGenerator.prefixLines(c,module$exports$Blockly$JavaScript.javascriptGenerator.INDENT));let d="";module$exports$Blockly$JavaScript.javascriptGenerator.INFINITE_LOOP_TRAP&&(d=module$exports$Blockly$JavaScript.javascriptGenerator.prefixLines(module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.INFINITE_LOOP_TRAP,
263
+ a),module$exports$Blockly$JavaScript.javascriptGenerator.INDENT));const e=module$exports$Blockly$JavaScript.javascriptGenerator.statementToCode(a,"STACK");let f=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"RETURN",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"",g="";e&&f&&(g=c);f&&(f=module$exports$Blockly$JavaScript.javascriptGenerator.INDENT+"return "+f+";\n");const h=[],k=a.getVars();for(let l=0;l<k.length;l++)h[l]=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getName(k[l],
264
+ $.NameType$$module$build$src$core$names.VARIABLE);c="function "+b+"("+h.join(", ")+") {\n"+c+d+e+g+f+"}";c=module$exports$Blockly$JavaScript.javascriptGenerator.scrub_(a,c);module$exports$Blockly$JavaScript.javascriptGenerator.definitions_["%"+b]=c;return null};module$exports$Blockly$JavaScript.javascriptGenerator.procedures_defnoreturn=module$exports$Blockly$JavaScript.javascriptGenerator.procedures_defreturn;
265
+ module$exports$Blockly$JavaScript.javascriptGenerator.procedures_callreturn=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getName(a.getFieldValue("NAME"),$.NameType$$module$build$src$core$names.PROCEDURE),c=[],d=a.getVars();for(let e=0;e<d.length;e++)c[e]=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"ARG"+e,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"null";return[b+"("+c.join(", ")+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
266
+ module$exports$Blockly$JavaScript.javascriptGenerator.procedures_callnoreturn=function(a){return module$exports$Blockly$JavaScript.javascriptGenerator.procedures_callreturn(a)[0]+";\n"};
267
+ module$exports$Blockly$JavaScript.javascriptGenerator.procedures_ifreturn=function(a){let b="if ("+(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"CONDITION",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"false")+") {\n";module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX&&(b+=module$exports$Blockly$JavaScript.javascriptGenerator.prefixLines(module$exports$Blockly$JavaScript.javascriptGenerator.injectId(module$exports$Blockly$JavaScript.javascriptGenerator.STATEMENT_SUFFIX,
268
+ a),module$exports$Blockly$JavaScript.javascriptGenerator.INDENT));a.hasReturnValue_?(a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"null",b+=module$exports$Blockly$JavaScript.javascriptGenerator.INDENT+"return "+a+";\n"):b+=module$exports$Blockly$JavaScript.javascriptGenerator.INDENT+"return;\n";return b+"}\n"};var module$exports$Blockly$JavaScript$texts={},module$contents$Blockly$JavaScript$texts_NameType=$.NameType$$module$build$src$core$names,module$contents$Blockly$JavaScript$texts_strRegExp=/^\s*'([^']|\\')*'\s*$/,module$contents$Blockly$JavaScript$texts_forceString=function(a){return module$contents$Blockly$JavaScript$texts_strRegExp.test(a)?[a,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC]:["String("+a+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]},
269
+ module$contents$Blockly$JavaScript$texts_getSubstringIndex=function(a,b,c){return"FIRST"===b?"0":"FROM_END"===b?a+".length - 1 - "+c:"LAST"===b?a+".length - 1":c};module$exports$Blockly$JavaScript.javascriptGenerator.text=function(a){return[module$exports$Blockly$JavaScript.javascriptGenerator.quote_(a.getFieldValue("TEXT")),module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC]};
270
+ module$exports$Blockly$JavaScript.javascriptGenerator.text_multiline=function(a){a=module$exports$Blockly$JavaScript.javascriptGenerator.multiline_quote_(a.getFieldValue("TEXT"));const b=-1!==a.indexOf("+")?module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ADDITION:module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC;return[a,b]};
271
+ module$exports$Blockly$JavaScript.javascriptGenerator.text_join=function(a){switch(a.itemCount_){case 0:return["''",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC];case 1:return a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"ADD0",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''",module$contents$Blockly$JavaScript$texts_forceString(a);case 2:var b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"ADD0",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||
272
+ "''";a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"ADD1",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";return[module$contents$Blockly$JavaScript$texts_forceString(b)[0]+" + "+module$contents$Blockly$JavaScript$texts_forceString(a)[0],module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ADDITION];default:b=Array(a.itemCount_);for(let c=0;c<a.itemCount_;c++)b[c]=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"ADD"+c,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||
273
+ "''";return["["+b.join(",")+"].join('')",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]}};
274
+ module$exports$Blockly$JavaScript.javascriptGenerator.text_append=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE);a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TEXT",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";return b+" += "+module$contents$Blockly$JavaScript$texts_forceString(a)[0]+";\n"};
275
+ module$exports$Blockly$JavaScript.javascriptGenerator.text_length=function(a){return[(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"''")+".length",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER]};
276
+ module$exports$Blockly$JavaScript.javascriptGenerator.text_isEmpty=function(a){return["!"+(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"''")+".length",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_LOGICAL_NOT]};
277
+ module$exports$Blockly$JavaScript.javascriptGenerator.text_indexOf=function(a){var b="FIRST"===a.getFieldValue("END")?"indexOf":"lastIndexOf";const c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"FIND",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";b=(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"''")+"."+b+"("+c+")";return a.workspace.options.oneBasedIndex?
246
278
  [b+" + 1",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ADDITION]:[b,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
247
- module$exports$Blockly$JavaScript.javascriptGenerator.lists_getIndex=function(a){const b=a.getFieldValue("MODE")||"GET",c=a.getFieldValue("WHERE")||"FROM_START";var d=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE","RANDOM"===c?module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE:module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"[]";switch(c){case "FIRST":if("GET"===b)return[d+"[0]",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER];
248
- if("GET_REMOVE"===b)return[d+".shift()",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER];if("REMOVE"===b)return d+".shift();\n";break;case "LAST":if("GET"===b)return[d+".slice(-1)[0]",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER];if("GET_REMOVE"===b)return[d+".pop()",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER];if("REMOVE"===b)return d+".pop();\n";break;case "FROM_START":a=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,
249
- "AT");if("GET"===b)return[d+"["+a+"]",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER];if("GET_REMOVE"===b)return[d+".splice("+a+", 1)[0]",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+".splice("+a+", 1);\n";break;case "FROM_END":a=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT",1,!0);if("GET"===b)return[d+".slice("+a+")[0]",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL];if("GET_REMOVE"===
250
- b)return[d+".splice("+a+", 1)[0]",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+".splice("+a+", 1);";break;case "RANDOM":d=module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("listsGetRandomItem",`
251
- function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(list, remove) {
252
- var x = Math.floor(Math.random() * list.length);
253
- if (remove) {
254
- return list.splice(x, 1)[0];
255
- } else {
256
- return list[x];
257
- }
279
+ module$exports$Blockly$JavaScript.javascriptGenerator.text_charAt=function(a){const b=a.getFieldValue("WHERE")||"FROM_START",c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE","RANDOM"===b?module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE:module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"''";switch(b){case "FIRST":return[c+".charAt(0)",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL];case "LAST":return[c+".slice(-1)",
280
+ module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL];case "FROM_START":return a=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT"),[c+".charAt("+a+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL];case "FROM_END":return a=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT",1,!0),[c+".slice("+a+").charAt(0)",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL];case "RANDOM":return[module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("textRandomLetter",
281
+ `
282
+ function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(text) {
283
+ var x = Math.floor(Math.random() * text.length);
284
+ return text[x];
258
285
  }
259
- `)+"("+d+", "+("GET"!==b)+")";if("GET"===b||"GET_REMOVE"===b)return[d,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL];if("REMOVE"===b)return d+";\n"}throw Error("Unhandled combination (lists_getIndex).");};
260
- module$exports$Blockly$JavaScript.javascriptGenerator.lists_setIndex=function(a){function b(){if(c.match(/^\w+$/))return"";const g=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getDistinctName("tmpList",$.NameType$$module$build$src$core$names.VARIABLE),h="var "+g+" = "+c+";\n";c=g;return h}let c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"LIST",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"[]";const d=a.getFieldValue("MODE")||"GET";
261
- var e=a.getFieldValue("WHERE")||"FROM_START";const f=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TO",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ASSIGNMENT)||"null";switch(e){case "FIRST":if("SET"===d)return c+"[0] = "+f+";\n";if("INSERT"===d)return c+".unshift("+f+");\n";break;case "LAST":if("SET"===d)return b()+(c+"["+c+".length - 1] = "+f+";\n");if("INSERT"===d)return c+".push("+f+");\n";break;case "FROM_START":a=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,
262
- "AT");if("SET"===d)return c+"["+a+"] = "+f+";\n";if("INSERT"===d)return c+".splice("+a+", 0, "+f+");\n";break;case "FROM_END":a=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT",1,!1,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_SUBTRACTION);e=b();if("SET"===d)return e+(c+"["+c+".length - "+a+"] = "+f+";\n");if("INSERT"===d)return e+(c+".splice("+c+".length - "+a+", 0, "+f+");\n");break;case "RANDOM":a=b();e=module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getDistinctName("tmpX",
263
- $.NameType$$module$build$src$core$names.VARIABLE);a+="var "+e+" = Math.floor(Math.random() * "+c+".length);\n";if("SET"===d)return a+(c+"["+e+"] = "+f+";\n");if("INSERT"===d)return a+(c+".splice("+e+", 0, "+f+");\n")}throw Error("Unhandled combination (lists_setIndex).");};var module$contents$Blockly$JavaScript$lists_getSubstringIndex=function(a,b,c){return"FIRST"===b?"0":"FROM_END"===b?a+".length - 1 - "+c:"LAST"===b?a+".length - 1":c};
264
- module$exports$Blockly$JavaScript.javascriptGenerator.lists_getSublist=function(a){var b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"LIST",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"[]",c=a.getFieldValue("WHERE1"),d=a.getFieldValue("WHERE2");if("FIRST"===c&&"LAST"===d)b+=".slice(0)";else if(b.match(/^\w+$/)||"FROM_END"!==c&&"FROM_START"===d){switch(c){case "FROM_START":c=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT1");
265
- break;case "FROM_END":c=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT1",1,!1,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_SUBTRACTION);c=b+".length - "+c;break;case "FIRST":c="0";break;default:throw Error("Unhandled option (lists_getSublist).");}switch(d){case "FROM_START":d=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT2",1);break;case "FROM_END":d=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT2",0,!1,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_SUBTRACTION);
266
- d=b+".length - "+d;break;case "LAST":d=b+".length";break;default:throw Error("Unhandled option (lists_getSublist).");}b=b+".slice("+c+", "+d+")"}else{const e=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT1");a=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT2");const f={FIRST:"First",LAST:"Last",FROM_START:"FromStart",FROM_END:"FromEnd"};b=module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("subsequence"+f[c]+f[d],`
267
- function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(sequence${"FROM_END"===c||"FROM_START"===c?", at1":""}${"FROM_END"===d||"FROM_START"===d?", at2":""}) {
268
- var start = ${module$contents$Blockly$JavaScript$lists_getSubstringIndex("sequence",c,"at1")};
269
- var end = ${module$contents$Blockly$JavaScript$lists_getSubstringIndex("sequence",d,"at2")} + 1;
286
+ `)+"("+c+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]}throw Error("Unhandled option (text_charAt).");};
287
+ module$exports$Blockly$JavaScript.javascriptGenerator.text_getSubstring=function(a){var b=a.getFieldValue("WHERE1"),c=a.getFieldValue("WHERE2"),d="FROM_END"!==b&&"LAST"!==b&&"FROM_END"!==c&&"LAST"!==c,e=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"STRING",d?module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER:module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";if("FIRST"===b&&"LAST"===c)return[e,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE];
288
+ if(e.match(/^'?\w+'?$/)||d){switch(b){case "FROM_START":b=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT1");break;case "FROM_END":b=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT1",1,!1,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_SUBTRACTION);b=e+".length - "+b;break;case "FIRST":b="0";break;default:throw Error("Unhandled option (text_getSubstring).");}switch(c){case "FROM_START":c=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,
289
+ "AT2",1);break;case "FROM_END":c=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT2",0,!1,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_SUBTRACTION);c=e+".length - "+c;break;case "LAST":c=e+".length";break;default:throw Error("Unhandled option (text_getSubstring).");}e=e+".slice("+b+", "+c+")"}else{d=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT1");a=module$exports$Blockly$JavaScript.javascriptGenerator.getAdjusted(a,"AT2");const f={FIRST:"First",
290
+ LAST:"Last",FROM_START:"FromStart",FROM_END:"FromEnd"};e=module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("subsequence"+f[b]+f[c],`
291
+ function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(sequence${"FROM_END"===b||"FROM_START"===b?", at1":""}${"FROM_END"===c||"FROM_START"===c?", at2":""}) {
292
+ var start = ${module$contents$Blockly$JavaScript$texts_getSubstringIndex("sequence",b,"at1")};
293
+ var end = ${module$contents$Blockly$JavaScript$texts_getSubstringIndex("sequence",c,"at2")} + 1;
270
294
  return sequence.slice(start, end);
271
295
  }
272
- `)+"("+b+("FROM_END"===c||"FROM_START"===c?", "+e:"")+("FROM_END"===d||"FROM_START"===d?", "+a:"")+")"}return[b,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
273
- module$exports$Blockly$JavaScript.javascriptGenerator.lists_sort=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"LIST",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL)||"[]",c="1"===a.getFieldValue("DIRECTION")?1:-1;a=a.getFieldValue("TYPE");const d=module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("listsGetSortCompare",`
274
- function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(type, direction) {
275
- var compareFuncs = {
276
- 'NUMERIC': function(a, b) {
277
- return Number(a) - Number(b); },
278
- 'TEXT': function(a, b) {
279
- return a.toString() > b.toString() ? 1 : -1; },
280
- 'IGNORE_CASE': function(a, b) {
281
- return a.toString().toLowerCase() > b.toString().toLowerCase() ? 1 : -1; },
282
- };
283
- var compare = compareFuncs[type];
284
- return function(a, b) { return compare(a, b) * direction; };
285
- }
286
- `);return[b+".slice().sort("+d+'("'+a+'", '+c+"))",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
287
- module$exports$Blockly$JavaScript.javascriptGenerator.lists_split=function(a){let b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"INPUT",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER);const c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"DELIM",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";a=a.getFieldValue("MODE");if("SPLIT"===a)b||(b="''"),a="split";else if("JOIN"===a)b||(b="[]"),a="join";else throw Error("Unknown mode: "+
288
- a);return[b+"."+a+"("+c+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};module$exports$Blockly$JavaScript.javascriptGenerator.lists_reverse=function(a){return[(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"LIST",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL)||"[]")+".slice().reverse()",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};var module$exports$Blockly$JavaScript$colour={};module$exports$Blockly$JavaScript.javascriptGenerator.colour_picker=function(a){return[module$exports$Blockly$JavaScript.javascriptGenerator.quote_(a.getFieldValue("COLOUR")),module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC]};module$exports$Blockly$JavaScript.javascriptGenerator.colour_random=function(a){return[module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("colourRandom",`
289
- function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}() {
290
- var num = Math.floor(Math.random() * Math.pow(2, 24));
291
- return '#' + ('00000' + num.toString(16)).substr(-6);
296
+ `)+"("+e+("FROM_END"===b||"FROM_START"===b?", "+d:"")+("FROM_END"===c||"FROM_START"===c?", "+a:"")+")"}return[e,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
297
+ module$exports$Blockly$JavaScript.javascriptGenerator.text_changeCase=function(a){const b={UPPERCASE:".toUpperCase()",LOWERCASE:".toLowerCase()",TITLECASE:null}[a.getFieldValue("CASE")];a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TEXT",b?module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER:module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";return[b?a+b:module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("textToTitleCase",
298
+ `
299
+ function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(str) {
300
+ return str.replace(/\\S+/g,
301
+ function(txt) {return txt[0].toUpperCase() + txt.substring(1).toLowerCase();});
292
302
  }
293
- `)+"()",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
294
- module$exports$Blockly$JavaScript.javascriptGenerator.colour_rgb=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"RED",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||0,c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"GREEN",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||0;a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"BLUE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||
295
- 0;return[module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("colourRgb",`
296
- function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(r, g, b) {
297
- r = Math.max(Math.min(Number(r), 100), 0) * 2.55;
298
- g = Math.max(Math.min(Number(g), 100), 0) * 2.55;
299
- b = Math.max(Math.min(Number(b), 100), 0) * 2.55;
300
- r = ('0' + (Math.round(r) || 0).toString(16)).slice(-2);
301
- g = ('0' + (Math.round(g) || 0).toString(16)).slice(-2);
302
- b = ('0' + (Math.round(b) || 0).toString(16)).slice(-2);
303
- return '#' + r + g + b;
303
+ `)+"("+a+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};module$exports$Blockly$JavaScript.javascriptGenerator.text_trim=function(a){const b={LEFT:".replace(/^[\\s\\xa0]+/, '')",RIGHT:".replace(/[\\s\\xa0]+$/, '')",BOTH:".trim()"}[a.getFieldValue("MODE")];return[(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TEXT",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"''")+b,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
304
+ module$exports$Blockly$JavaScript.javascriptGenerator.text_print=function(a){return"window.alert("+(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TEXT",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''")+");\n"};
305
+ module$exports$Blockly$JavaScript.javascriptGenerator.text_prompt_ext=function(a){let b="window.prompt("+(a.getField("TEXT")?module$exports$Blockly$JavaScript.javascriptGenerator.quote_(a.getFieldValue("TEXT")):module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TEXT",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''")+")";"NUMBER"===a.getFieldValue("TYPE")&&(b="Number("+b+")");return[b,module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
306
+ module$exports$Blockly$JavaScript.javascriptGenerator.text_prompt=module$exports$Blockly$JavaScript.javascriptGenerator.text_prompt_ext;
307
+ module$exports$Blockly$JavaScript.javascriptGenerator.text_count=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TEXT",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"SUB",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";return[module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("textCount",`
308
+ function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(haystack, needle) {
309
+ if (needle.length === 0) {
310
+ return haystack.length + 1;
311
+ } else {
312
+ return haystack.split(needle).length - 1;
313
+ }
304
314
  }
305
- `)+"("+b+", "+c+", "+a+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
306
- module$exports$Blockly$JavaScript.javascriptGenerator.colour_blend=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"COLOUR1",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"'#000000'",c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"COLOUR2",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"'#000000'";a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"RATIO",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||
307
- .5;return[module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("colourBlend",`
308
- function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(c1, c2, ratio) {
309
- ratio = Math.max(Math.min(Number(ratio), 1), 0);
310
- var r1 = parseInt(c1.substring(1, 3), 16);
311
- var g1 = parseInt(c1.substring(3, 5), 16);
312
- var b1 = parseInt(c1.substring(5, 7), 16);
313
- var r2 = parseInt(c2.substring(1, 3), 16);
314
- var g2 = parseInt(c2.substring(3, 5), 16);
315
- var b2 = parseInt(c2.substring(5, 7), 16);
316
- var r = Math.round(r1 * (1 - ratio) + r2 * ratio);
317
- var g = Math.round(g1 * (1 - ratio) + g2 * ratio);
318
- var b = Math.round(b1 * (1 - ratio) + b2 * ratio);
319
- r = ('0' + (r || 0).toString(16)).slice(-2);
320
- g = ('0' + (g || 0).toString(16)).slice(-2);
321
- b = ('0' + (b || 0).toString(16)).slice(-2);
322
- return '#' + r + g + b;
315
+ `)+"("+b+", "+a+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};
316
+ module$exports$Blockly$JavaScript.javascriptGenerator.text_replace=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TEXT",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''",c=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"FROM",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||"''";a=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TO",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_NONE)||
317
+ "''";return[module$exports$Blockly$JavaScript.javascriptGenerator.provideFunction_("textReplace",`
318
+ function ${module$exports$Blockly$JavaScript.javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(haystack, needle, replacement) {
319
+ needle = needle.replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g, '\\\\$1')
320
+ .replace(/\\x08/g, '\\\\x08');
321
+ return haystack.replace(new RegExp(needle, 'g'), replacement);
323
322
  }
324
- `)+"("+b+", "+c+", "+a+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};var module$exports$Blockly$JavaScript$all=module$exports$Blockly$JavaScript;
323
+ `)+"("+b+", "+c+", "+a+")",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};module$exports$Blockly$JavaScript.javascriptGenerator.text_reverse=function(a){return[(module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"TEXT",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_MEMBER)||"''")+".split('').reverse().join('')",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_FUNCTION_CALL]};var module$exports$Blockly$JavaScript$variables={},module$contents$Blockly$JavaScript$variables_NameType=$.NameType$$module$build$src$core$names;module$exports$Blockly$JavaScript.javascriptGenerator.variables_get=function(a){return[module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE),module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ATOMIC]};
324
+ module$exports$Blockly$JavaScript.javascriptGenerator.variables_set=function(a){const b=module$exports$Blockly$JavaScript.javascriptGenerator.valueToCode(a,"VALUE",module$exports$Blockly$JavaScript.javascriptGenerator.ORDER_ASSIGNMENT)||"0";return module$exports$Blockly$JavaScript.javascriptGenerator.nameDB_.getName(a.getFieldValue("VAR"),$.NameType$$module$build$src$core$names.VARIABLE)+" = "+b+";\n"};var module$exports$Blockly$JavaScript$variablesDynamic={};module$exports$Blockly$JavaScript.javascriptGenerator.variables_get_dynamic=module$exports$Blockly$JavaScript.javascriptGenerator.variables_get;module$exports$Blockly$JavaScript.javascriptGenerator.variables_set_dynamic=module$exports$Blockly$JavaScript.javascriptGenerator.variables_set;var module$exports$Blockly$JavaScript$all=module$exports$Blockly$JavaScript;
325
325
  module$exports$Blockly$JavaScript.__namespace__=$;
326
326
  return module$exports$Blockly$JavaScript;
327
327
  }));