blockly 9.0.0-beta.0 → 9.0.0-beta.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.
- package/blockly.min.js +401 -405
- package/blockly_compressed.js +398 -402
- package/blockly_compressed.js.map +1 -1
- package/blocks.d.ts +0 -5
- package/blocks_compressed.js +3 -3
- package/blocks_compressed.js.map +1 -1
- package/closure/goog/base.d.ts +1 -0
- package/closure/goog/base_minimal.d.ts +1 -0
- package/closure/goog/goog.d.ts +1 -0
- package/core/any_aliases.d.ts +1 -0
- package/core/block.d.ts +145 -53
- package/core/block_animations.d.ts +5 -0
- package/core/block_drag_surface.d.ts +18 -5
- package/core/block_dragger.d.ts +20 -5
- package/core/block_svg.d.ts +89 -21
- package/core/blockly.d.ts +29 -8
- package/core/blockly_options.d.ts +2 -0
- package/core/blocks.d.ts +2 -0
- package/core/browser_events.d.ts +16 -7
- package/core/bubble.d.ts +42 -12
- package/core/bubble_dragger.d.ts +9 -2
- package/core/bump_objects.d.ts +6 -2
- package/core/clipboard.d.ts +6 -2
- package/core/comment.d.ts +13 -3
- package/core/common.d.ts +35 -9
- package/core/component_manager.d.ts +16 -6
- package/core/config.d.ts +1 -0
- package/core/connection.d.ts +48 -18
- package/core/connection_checker.d.ts +16 -7
- package/core/connection_db.d.ts +17 -6
- package/core/connection_type.d.ts +2 -0
- package/core/constants.d.ts +3 -0
- package/core/contextmenu.d.ts +15 -5
- package/core/contextmenu_items.d.ts +15 -0
- package/core/contextmenu_registry.d.ts +12 -7
- package/core/css.d.ts +3 -0
- package/core/delete_area.d.ts +5 -1
- package/core/dialog.d.ts +14 -7
- package/core/drag_target.d.ts +10 -2
- package/core/dropdowndiv.d.ts +42 -10
- package/core/events/events.d.ts +1 -0
- package/core/events/events_abstract.d.ts +10 -3
- package/core/events/events_block_base.d.ts +5 -1
- package/core/events/events_block_change.d.ts +10 -3
- package/core/events/events_block_create.d.ts +6 -1
- package/core/events/events_block_delete.d.ts +6 -1
- package/core/events/events_block_drag.d.ts +5 -1
- package/core/events/events_block_move.d.ts +10 -3
- package/core/events/events_bubble_open.d.ts +6 -2
- package/core/events/events_click.d.ts +5 -1
- package/core/events/events_comment_base.d.ts +6 -1
- package/core/events/events_comment_change.d.ts +8 -2
- package/core/events/events_comment_create.d.ts +6 -1
- package/core/events/events_comment_delete.d.ts +6 -1
- package/core/events/events_comment_move.d.ts +9 -2
- package/core/events/events_marker_move.d.ts +5 -1
- package/core/events/events_selected.d.ts +5 -1
- package/core/events/events_theme_change.d.ts +5 -1
- package/core/events/events_toolbox_item_select.d.ts +5 -1
- package/core/events/events_trashcan_open.d.ts +5 -1
- package/core/events/events_ui.d.ts +5 -1
- package/core/events/events_ui_base.d.ts +2 -0
- package/core/events/events_var_base.d.ts +5 -1
- package/core/events/events_var_create.d.ts +6 -1
- package/core/events/events_var_delete.d.ts +6 -1
- package/core/events/events_var_rename.d.ts +6 -1
- package/core/events/events_viewport.d.ts +5 -1
- package/core/events/utils.d.ts +50 -7
- package/core/events/workspace_events.d.ts +5 -1
- package/core/extensions.d.ts +14 -4
- package/core/field.d.ts +93 -34
- package/core/field_angle.d.ts +14 -3
- package/core/field_checkbox.d.ts +20 -7
- package/core/field_colour.d.ts +22 -6
- package/core/field_dropdown.d.ts +28 -8
- package/core/field_image.d.ts +15 -4
- package/core/field_label.d.ts +8 -2
- package/core/field_label_serializable.d.ts +4 -1
- package/core/field_multilineinput.d.ts +21 -6
- package/core/field_number.d.ts +22 -6
- package/core/field_registry.d.ts +8 -2
- package/core/field_textinput.d.ts +28 -8
- package/core/field_variable.d.ts +36 -13
- package/core/flyout_base.d.ts +70 -24
- package/core/flyout_button.d.ts +12 -5
- package/core/flyout_horizontal.d.ts +14 -6
- package/core/flyout_metrics_manager.d.ts +6 -3
- package/core/flyout_vertical.d.ts +14 -6
- package/core/generator.d.ts +39 -20
- package/core/gesture.d.ts +48 -13
- package/core/grid.d.ts +19 -15
- package/core/icon.d.ts +12 -3
- package/core/inject.d.ts +3 -1
- package/core/input.d.ts +25 -10
- package/core/input_types.d.ts +2 -0
- package/core/insertion_marker_manager.d.ts +27 -9
- package/core/interfaces/i_ast_node_location.d.ts +2 -0
- package/core/interfaces/i_ast_node_location_svg.d.ts +4 -0
- package/core/interfaces/i_ast_node_location_with_block.d.ts +4 -1
- package/core/interfaces/i_autohideable.d.ts +3 -0
- package/core/interfaces/i_block_dragger.d.ts +7 -1
- package/core/interfaces/i_bounded_element.d.ts +5 -1
- package/core/interfaces/i_bubble.d.ts +11 -2
- package/core/interfaces/i_collapsible_toolbox_item.d.ts +6 -2
- package/core/interfaces/i_component.d.ts +2 -0
- package/core/interfaces/i_connection_checker.d.ts +14 -6
- package/core/interfaces/i_contextmenu.d.ts +2 -0
- package/core/interfaces/i_copyable.d.ts +3 -1
- package/core/interfaces/i_deletable.d.ts +4 -1
- package/core/interfaces/i_delete_area.d.ts +4 -1
- package/core/interfaces/i_drag_target.d.ts +10 -2
- package/core/interfaces/i_draggable.d.ts +2 -0
- package/core/interfaces/i_flyout.d.ts +27 -11
- package/core/interfaces/i_keyboard_accessible.d.ts +4 -1
- package/core/interfaces/i_metrics_manager.d.ts +24 -12
- package/core/interfaces/i_movable.d.ts +4 -1
- package/core/interfaces/i_positionable.d.ts +5 -1
- package/core/interfaces/i_registrable.d.ts +2 -0
- package/core/interfaces/i_registrable_field.d.ts +2 -0
- package/core/interfaces/i_selectable.d.ts +2 -0
- package/core/interfaces/i_selectable_toolbox_item.d.ts +10 -3
- package/core/interfaces/i_serializer.d.ts +6 -1
- package/core/interfaces/i_styleable.d.ts +4 -0
- package/core/interfaces/i_toolbox.d.ts +17 -6
- package/core/interfaces/i_toolbox_item.d.ts +17 -7
- package/core/internal_constants.d.ts +6 -0
- package/core/keyboard_nav/ast_node.d.ts +55 -28
- package/core/keyboard_nav/basic_cursor.d.ts +20 -9
- package/core/keyboard_nav/cursor.d.ts +11 -5
- package/core/keyboard_nav/marker.d.ts +9 -2
- package/core/keyboard_nav/tab_navigate_cursor.d.ts +4 -1
- package/core/main.d.ts +1 -0
- package/core/marker_manager.d.ts +13 -2
- package/core/menu.d.ts +23 -5
- package/core/menuitem.d.ts +22 -7
- package/core/metrics_manager.d.ts +30 -15
- package/core/msg.d.ts +1 -0
- package/core/mutator.d.ts +19 -7
- package/core/names.d.ts +20 -8
- package/core/options.d.ts +12 -6
- package/core/positionable_helpers.d.ts +11 -3
- package/core/procedures.d.ts +27 -10
- package/core/registry.d.ts +19 -8
- package/core/rendered_connection.d.ts +28 -7
- package/core/renderers/common/block_rendering.d.ts +9 -2
- package/core/renderers/common/constants.d.ts +49 -17
- package/core/renderers/common/debug.d.ts +5 -1
- package/core/renderers/common/debugger.d.ts +12 -1
- package/core/renderers/common/drawer.d.ts +12 -0
- package/core/renderers/common/i_path_object.d.ts +15 -0
- package/core/renderers/common/info.d.ts +25 -8
- package/core/renderers/common/marker_svg.d.ts +35 -6
- package/core/renderers/common/path_object.d.ts +20 -0
- package/core/renderers/common/renderer.d.ts +33 -12
- package/core/renderers/geras/constants.d.ts +2 -0
- package/core/renderers/geras/drawer.d.ts +2 -0
- package/core/renderers/geras/geras.d.ts +3 -2
- package/core/renderers/geras/highlight_constants.d.ts +9 -6
- package/core/renderers/geras/highlighter.d.ts +12 -1
- package/core/renderers/geras/info.d.ts +4 -1
- package/core/renderers/geras/measurables/inline_input.d.ts +2 -0
- package/core/renderers/geras/measurables/statement_input.d.ts +2 -0
- package/core/renderers/geras/path_object.d.ts +4 -0
- package/core/renderers/geras/renderer.d.ts +16 -6
- package/core/renderers/measurables/base.d.ts +2 -0
- package/core/renderers/measurables/bottom_row.d.ts +9 -3
- package/core/renderers/measurables/connection.d.ts +2 -0
- package/core/renderers/measurables/external_value_input.d.ts +2 -1
- package/core/renderers/measurables/field.d.ts +2 -1
- package/core/renderers/measurables/hat.d.ts +2 -1
- package/core/renderers/measurables/icon.d.ts +3 -1
- package/core/renderers/measurables/in_row_spacer.d.ts +2 -1
- package/core/renderers/measurables/inline_input.d.ts +2 -1
- package/core/renderers/measurables/input_connection.d.ts +2 -0
- package/core/renderers/measurables/input_row.d.ts +4 -1
- package/core/renderers/measurables/jagged_edge.d.ts +2 -1
- package/core/renderers/measurables/next_connection.d.ts +2 -1
- package/core/renderers/measurables/output_connection.d.ts +2 -1
- package/core/renderers/measurables/previous_connection.d.ts +2 -1
- package/core/renderers/measurables/round_corner.d.ts +2 -1
- package/core/renderers/measurables/row.d.ts +27 -5
- package/core/renderers/measurables/spacer_row.d.ts +2 -1
- package/core/renderers/measurables/square_corner.d.ts +2 -1
- package/core/renderers/measurables/statement_input.d.ts +2 -1
- package/core/renderers/measurables/top_row.d.ts +7 -3
- package/core/renderers/measurables/types.d.ts +54 -25
- package/core/renderers/minimalist/constants.d.ts +2 -0
- package/core/renderers/minimalist/drawer.d.ts +2 -0
- package/core/renderers/minimalist/info.d.ts +4 -1
- package/core/renderers/minimalist/minimalist.d.ts +2 -1
- package/core/renderers/minimalist/renderer.d.ts +8 -3
- package/core/renderers/thrasos/info.d.ts +4 -1
- package/core/renderers/thrasos/renderer.d.ts +4 -1
- package/core/renderers/thrasos/thrasos.d.ts +2 -1
- package/core/renderers/zelos/constants.d.ts +11 -3
- package/core/renderers/zelos/drawer.d.ts +3 -0
- package/core/renderers/zelos/info.d.ts +10 -5
- package/core/renderers/zelos/marker_svg.d.ts +5 -0
- package/core/renderers/zelos/measurables/bottom_row.d.ts +2 -0
- package/core/renderers/zelos/measurables/inputs.d.ts +2 -0
- package/core/renderers/zelos/measurables/row_elements.d.ts +2 -0
- package/core/renderers/zelos/measurables/top_row.d.ts +2 -0
- package/core/renderers/zelos/path_object.d.ts +8 -1
- package/core/renderers/zelos/renderer.d.ts +14 -6
- package/core/renderers/zelos/zelos.d.ts +3 -2
- package/core/scrollbar.d.ts +41 -9
- package/core/scrollbar_pair.d.ts +20 -6
- package/core/serialization/blocks.d.ts +10 -4
- package/core/serialization/exceptions.d.ts +5 -0
- package/core/serialization/priorities.d.ts +3 -0
- package/core/serialization/registry.d.ts +3 -0
- package/core/serialization/variables.d.ts +2 -0
- package/core/serialization/workspaces.d.ts +4 -1
- package/core/shortcut_items.d.ts +10 -0
- package/core/shortcut_registry.d.ts +25 -9
- package/core/sprites.d.ts +2 -4
- package/core/theme/classic.d.ts +2 -0
- package/core/theme/themes.d.ts +1 -0
- package/core/theme/zelos.d.ts +2 -0
- package/core/theme.d.ts +14 -3
- package/core/theme_manager.d.ts +10 -1
- package/core/toolbox/category.d.ts +42 -15
- package/core/toolbox/collapsible_category.d.ts +10 -3
- package/core/toolbox/separator.d.ts +4 -1
- package/core/toolbox/toolbox.d.ts +70 -22
- package/core/toolbox/toolbox_item.d.ts +17 -7
- package/core/tooltip.d.ts +22 -1
- package/core/touch.d.ts +18 -6
- package/core/touch_gesture.d.ts +16 -2
- package/core/trashcan.d.ts +27 -6
- package/core/utils/aria.d.ts +4 -0
- package/core/utils/array.d.ts +4 -2
- package/core/utils/colour.d.ts +24 -13
- package/core/utils/coordinate.d.ts +18 -8
- package/core/utils/deprecation.d.ts +6 -4
- package/core/utils/dom.d.ts +32 -12
- package/core/utils/idgenerator.d.ts +13 -3
- package/core/utils/keycodes.d.ts +1 -0
- package/core/utils/math.d.ts +7 -3
- package/core/utils/metrics.d.ts +1 -0
- package/core/utils/object.d.ts +7 -2
- package/core/utils/parsing.d.ts +9 -4
- package/core/utils/rect.d.ts +5 -3
- package/core/utils/sentinel.d.ts +2 -0
- package/core/utils/size.d.ts +4 -2
- package/core/utils/string.d.ts +13 -6
- package/core/utils/style.d.ts +14 -33
- package/core/utils/svg.d.ts +5 -2
- package/core/utils/svg_math.d.ts +15 -7
- package/core/utils/svg_paths.d.ts +20 -10
- package/core/utils/toolbox.d.ts +26 -5
- package/core/utils/useragent.d.ts +1 -12
- package/core/utils/xml.d.ts +13 -5
- package/core/utils.d.ts +43 -21
- package/core/variable_map.d.ts +26 -9
- package/core/variable_model.d.ts +5 -2
- package/core/variables.d.ts +33 -18
- package/core/variables_dynamic.d.ts +25 -5
- package/core/warning.d.ts +8 -3
- package/core/widgetdiv.d.ts +15 -6
- package/core/workspace.d.ts +80 -30
- package/core/workspace_audio.d.ts +6 -0
- package/core/workspace_comment.d.ts +33 -11
- package/core/workspace_comment_svg.d.ts +52 -9
- package/core/workspace_drag_surface_svg.d.ts +20 -14
- package/core/workspace_dragger.d.ts +6 -0
- package/core/workspace_svg.d.ts +174 -62
- package/core/xml.d.ts +26 -11
- package/core/zoom_controls.d.ts +16 -6
- package/core.d.ts +0 -5
- package/dart.d.ts +0 -5
- package/dart_compressed.js.map +1 -1
- package/index.d.ts +2 -6
- package/javascript.d.ts +0 -5
- package/javascript_compressed.js.map +1 -1
- package/lua.d.ts +0 -5
- package/lua_compressed.js.map +1 -1
- package/package.json +6 -3
- package/php.d.ts +0 -5
- package/php_compressed.js.map +1 -1
- package/python.d.ts +0 -5
- package/python_compressed.js.map +1 -1
- package/blocks/blocks.js +0 -48
- package/blocks/colour.js +0 -121
- package/blocks/lists.js +0 -996
- package/blocks/logic.js +0 -665
- package/blocks/loops.js +0 -375
- package/blocks/math.js +0 -594
- package/blocks/procedures.js +0 -1196
- package/blocks/text.js +0 -1000
- package/blocks/variables.js +0 -176
- package/blocks/variables_dynamic.js +0 -192
- package/core/any_aliases.ts +0 -1
- package/core/block.ts +0 -2102
- package/core/block_animations.ts +0 -202
- package/core/block_drag_surface.ts +0 -237
- package/core/block_dragger.ts +0 -447
- package/core/block_svg.ts +0 -1758
- package/core/blockly.js +0 -890
- package/core/blockly.ts +0 -749
- package/core/blockly_options.ts +0 -81
- package/core/blocks.ts +0 -29
- package/core/browser_events.ts +0 -289
- package/core/bubble.ts +0 -892
- package/core/bubble_dragger.ts +0 -229
- package/core/bump_objects.ts +0 -182
- package/core/clipboard.ts +0 -91
- package/core/comment.ts +0 -398
- package/core/common.ts +0 -288
- package/core/component_manager.ts +0 -211
- package/core/config.ts +0 -80
- package/core/connection.ts +0 -692
- package/core/connection_checker.ts +0 -301
- package/core/connection_db.ts +0 -289
- package/core/connection_type.ts +0 -32
- package/core/constants.ts +0 -29
- package/core/contextmenu.ts +0 -363
- package/core/contextmenu_items.ts +0 -576
- package/core/contextmenu_registry.ts +0 -179
- package/core/css.ts +0 -560
- package/core/delete_area.ts +0 -82
- package/core/dialog.ts +0 -127
- package/core/drag_target.ts +0 -94
- package/core/dropdowndiv.ts +0 -683
- package/core/events/events.ts +0 -123
- package/core/events/events_abstract.ts +0 -112
- package/core/events/events_block_base.ts +0 -65
- package/core/events/events_block_change.ts +0 -176
- package/core/events/events_block_create.ts +0 -114
- package/core/events/events_block_delete.ts +0 -126
- package/core/events/events_block_drag.ts +0 -82
- package/core/events/events_block_move.ts +0 -206
- package/core/events/events_bubble_open.ts +0 -82
- package/core/events/events_click.ts +0 -84
- package/core/events/events_comment_base.ts +0 -107
- package/core/events/events_comment_change.ts +0 -108
- package/core/events/events_comment_create.ts +0 -82
- package/core/events/events_comment_delete.ts +0 -77
- package/core/events/events_comment_move.ts +0 -154
- package/core/events/events_marker_move.ts +0 -99
- package/core/events/events_selected.ts +0 -78
- package/core/events/events_theme_change.ts +0 -67
- package/core/events/events_toolbox_item_select.ts +0 -79
- package/core/events/events_trashcan_open.ts +0 -68
- package/core/events/events_ui.ts +0 -89
- package/core/events/events_ui_base.ts +0 -54
- package/core/events/events_var_base.ts +0 -65
- package/core/events/events_var_create.ts +0 -88
- package/core/events/events_var_delete.ts +0 -88
- package/core/events/events_var_rename.ts +0 -89
- package/core/events/events_viewport.ts +0 -100
- package/core/events/utils.ts +0 -529
- package/core/events/workspace_events.ts +0 -86
- package/core/extensions.ts +0 -504
- package/core/field.ts +0 -1206
- package/core/field_angle.ts +0 -563
- package/core/field_checkbox.ts +0 -243
- package/core/field_colour.ts +0 -632
- package/core/field_dropdown.ts +0 -773
- package/core/field_image.ts +0 -282
- package/core/field_label.ts +0 -152
- package/core/field_label_serializable.ts +0 -76
- package/core/field_multilineinput.ts +0 -466
- package/core/field_number.ts +0 -327
- package/core/field_registry.ts +0 -87
- package/core/field_textinput.ts +0 -591
- package/core/field_variable.ts +0 -545
- package/core/flyout_base.ts +0 -1165
- package/core/flyout_button.ts +0 -292
- package/core/flyout_horizontal.ts +0 -381
- package/core/flyout_metrics_manager.ts +0 -94
- package/core/flyout_vertical.ts +0 -384
- package/core/generator.ts +0 -539
- package/core/gesture.ts +0 -946
- package/core/grid.ts +0 -192
- package/core/icon.ts +0 -189
- package/core/inject.ts +0 -390
- package/core/input.ts +0 -309
- package/core/input_types.ts +0 -32
- package/core/insertion_marker_manager.ts +0 -788
- package/core/interfaces/i_ast_node_location.ts +0 -23
- package/core/interfaces/i_ast_node_location_svg.ts +0 -37
- package/core/interfaces/i_ast_node_location_with_block.ts +0 -38
- package/core/interfaces/i_autohideable.ts +0 -34
- package/core/interfaces/i_block_dragger.ts +0 -67
- package/core/interfaces/i_bounded_element.ts +0 -42
- package/core/interfaces/i_bubble.ts +0 -88
- package/core/interfaces/i_collapsible_toolbox_item.ts +0 -47
- package/core/interfaces/i_component.ts +0 -32
- package/core/interfaces/i_connection_checker.ts +0 -102
- package/core/interfaces/i_contextmenu.ts +0 -26
- package/core/interfaces/i_copyable.ts +0 -40
- package/core/interfaces/i_deletable.ts +0 -29
- package/core/interfaces/i_delete_area.ts +0 -46
- package/core/interfaces/i_drag_target.ts +0 -84
- package/core/interfaces/i_draggable.ts +0 -25
- package/core/interfaces/i_flyout.ts +0 -186
- package/core/interfaces/i_keyboard_accessible.ts +0 -35
- package/core/interfaces/i_metrics_manager.ts +0 -151
- package/core/interfaces/i_movable.ts +0 -29
- package/core/interfaces/i_positionable.ts +0 -50
- package/core/interfaces/i_registrable.ts +0 -25
- package/core/interfaces/i_registrable_field.ts +0 -31
- package/core/interfaces/i_selectable.ts +0 -34
- package/core/interfaces/i_selectable_toolbox_item.ts +0 -64
- package/core/interfaces/i_serializer.ts +0 -65
- package/core/interfaces/i_styleable.ts +0 -35
- package/core/interfaces/i_toolbox.ts +0 -127
- package/core/interfaces/i_toolbox_item.ts +0 -84
- package/core/internal_constants.ts +0 -67
- package/core/keyboard_nav/ast_node.ts +0 -717
- package/core/keyboard_nav/basic_cursor.ts +0 -214
- package/core/keyboard_nav/cursor.ts +0 -134
- package/core/keyboard_nav/marker.ts +0 -115
- package/core/keyboard_nav/tab_navigate_cursor.ts +0 -48
- package/core/main.js +0 -303
- package/core/marker_manager.ts +0 -181
- package/core/menu.ts +0 -449
- package/core/menuitem.ts +0 -240
- package/core/metrics_manager.ts +0 -456
- package/core/msg.ts +0 -20
- package/core/mutator.ts +0 -560
- package/core/names.ts +0 -267
- package/core/options.ts +0 -365
- package/core/positionable_helpers.ts +0 -181
- package/core/procedures.ts +0 -443
- package/core/registry.ts +0 -339
- package/core/rendered_connection.ts +0 -568
- package/core/renderers/common/block_rendering.ts +0 -164
- package/core/renderers/common/constants.ts +0 -1124
- package/core/renderers/common/debug.ts +0 -61
- package/core/renderers/common/debugger.ts +0 -433
- package/core/renderers/common/drawer.ts +0 -450
- package/core/renderers/common/i_path_object.ts +0 -161
- package/core/renderers/common/info.ts +0 -718
- package/core/renderers/common/marker_svg.ts +0 -680
- package/core/renderers/common/path_object.ts +0 -272
- package/core/renderers/common/renderer.ts +0 -271
- package/core/renderers/geras/constants.ts +0 -61
- package/core/renderers/geras/drawer.ts +0 -176
- package/core/renderers/geras/geras.ts +0 -37
- package/core/renderers/geras/highlight_constants.ts +0 -337
- package/core/renderers/geras/highlighter.ts +0 -306
- package/core/renderers/geras/info.ts +0 -450
- package/core/renderers/geras/measurables/inline_input.ts +0 -51
- package/core/renderers/geras/measurables/statement_input.ts +0 -50
- package/core/renderers/geras/path_object.ts +0 -138
- package/core/renderers/geras/renderer.ts +0 -126
- package/core/renderers/measurables/base.ts +0 -53
- package/core/renderers/measurables/bottom_row.ts +0 -120
- package/core/renderers/measurables/connection.ts +0 -52
- package/core/renderers/measurables/external_value_input.ts +0 -65
- package/core/renderers/measurables/field.ts +0 -63
- package/core/renderers/measurables/hat.ts +0 -48
- package/core/renderers/measurables/icon.ts +0 -54
- package/core/renderers/measurables/in_row_spacer.ts +0 -44
- package/core/renderers/measurables/inline_input.ts +0 -76
- package/core/renderers/measurables/input_connection.ts +0 -66
- package/core/renderers/measurables/input_row.ts +0 -82
- package/core/renderers/measurables/jagged_edge.ts +0 -43
- package/core/renderers/measurables/next_connection.ts +0 -47
- package/core/renderers/measurables/output_connection.ts +0 -56
- package/core/renderers/measurables/previous_connection.ts +0 -47
- package/core/renderers/measurables/round_corner.ts +0 -49
- package/core/renderers/measurables/row.ts +0 -225
- package/core/renderers/measurables/spacer_row.ts +0 -55
- package/core/renderers/measurables/square_corner.ts +0 -47
- package/core/renderers/measurables/statement_input.ts +0 -55
- package/core/renderers/measurables/top_row.ts +0 -122
- package/core/renderers/measurables/types.ts +0 -332
- package/core/renderers/minimalist/constants.ts +0 -32
- package/core/renderers/minimalist/drawer.ts +0 -38
- package/core/renderers/minimalist/info.ts +0 -52
- package/core/renderers/minimalist/minimalist.ts +0 -22
- package/core/renderers/minimalist/renderer.ts +0 -71
- package/core/renderers/thrasos/info.ts +0 -338
- package/core/renderers/thrasos/renderer.ts +0 -48
- package/core/renderers/thrasos/thrasos.ts +0 -20
- package/core/renderers/zelos/constants.ts +0 -858
- package/core/renderers/zelos/drawer.ts +0 -228
- package/core/renderers/zelos/info.ts +0 -593
- package/core/renderers/zelos/marker_svg.ts +0 -151
- package/core/renderers/zelos/measurables/bottom_row.ts +0 -53
- package/core/renderers/zelos/measurables/inputs.ts +0 -56
- package/core/renderers/zelos/measurables/row_elements.ts +0 -45
- package/core/renderers/zelos/measurables/top_row.ts +0 -58
- package/core/renderers/zelos/path_object.ts +0 -215
- package/core/renderers/zelos/renderer.ts +0 -142
- package/core/renderers/zelos/zelos.ts +0 -39
- package/core/scrollbar.ts +0 -870
- package/core/scrollbar_pair.ts +0 -321
- package/core/serialization/blocks.ts +0 -706
- package/core/serialization/exceptions.ts +0 -98
- package/core/serialization/priorities.ts +0 -32
- package/core/serialization/registry.ts +0 -43
- package/core/serialization/variables.ts +0 -96
- package/core/serialization/workspaces.ts +0 -106
- package/core/shortcut_items.ts +0 -266
- package/core/shortcut_registry.ts +0 -355
- package/core/sprites.ts +0 -29
- package/core/theme/classic.ts +0 -54
- package/core/theme/themes.ts +0 -22
- package/core/theme/zelos.ts +0 -91
- package/core/theme.ts +0 -221
- package/core/theme_manager.ts +0 -186
- package/core/toolbox/category.ts +0 -679
- package/core/toolbox/collapsible_category.ts +0 -273
- package/core/toolbox/separator.ts +0 -105
- package/core/toolbox/toolbox.ts +0 -1044
- package/core/toolbox/toolbox_item.ts +0 -147
- package/core/tooltip.ts +0 -463
- package/core/touch.ts +0 -306
- package/core/touch_gesture.ts +0 -295
- package/core/trashcan.ts +0 -671
- package/core/utils/aria.ts +0 -160
- package/core/utils/array.ts +0 -32
- package/core/utils/colour.ts +0 -276
- package/core/utils/coordinate.ts +0 -124
- package/core/utils/deprecation.ts +0 -41
- package/core/utils/dom.ts +0 -408
- package/core/utils/idgenerator.ts +0 -80
- package/core/utils/keycodes.ts +0 -169
- package/core/utils/math.ts +0 -61
- package/core/utils/metrics.ts +0 -97
- package/core/utils/object.ts +0 -95
- package/core/utils/parsing.ts +0 -261
- package/core/utils/rect.ts +0 -62
- package/core/utils/sentinel.ts +0 -23
- package/core/utils/size.ts +0 -51
- package/core/utils/string.ts +0 -308
- package/core/utils/style.ts +0 -306
- package/core/utils/svg.ts +0 -88
- package/core/utils/svg_math.ts +0 -269
- package/core/utils/svg_paths.ts +0 -140
- package/core/utils/toolbox.ts +0 -433
- package/core/utils/useragent.ts +0 -135
- package/core/utils/xml.ts +0 -97
- package/core/utils.ts +0 -428
- package/core/variable_map.ts +0 -392
- package/core/variable_model.ts +0 -82
- package/core/variables.ts +0 -596
- package/core/variables_dynamic.ts +0 -133
- package/core/warning.ts +0 -161
- package/core/widgetdiv.ts +0 -257
- package/core/workspace.ts +0 -801
- package/core/workspace_audio.ts +0 -156
- package/core/workspace_comment.ts +0 -398
- package/core/workspace_comment_svg.ts +0 -1127
- package/core/workspace_drag_surface_svg.ts +0 -187
- package/core/workspace_dragger.ts +0 -104
- package/core/workspace_svg.ts +0 -2655
- package/core/xml.ts +0 -1023
- package/core/zoom_controls.ts +0 -441
- package/generators/dart/all.js +0 -27
- package/generators/dart/colour.js +0 -105
- package/generators/dart/lists.js +0 -431
- package/generators/dart/logic.js +0 -123
- package/generators/dart/loops.js +0 -161
- package/generators/dart/math.js +0 -446
- package/generators/dart/procedures.js +0 -105
- package/generators/dart/text.js +0 -338
- package/generators/dart/variables.js +0 -32
- package/generators/dart/variables_dynamic.js +0 -21
- package/generators/dart.js +0 -303
- package/generators/javascript/all.js +0 -27
- package/generators/javascript/colour.js +0 -85
- package/generators/javascript/lists.js +0 -405
- package/generators/javascript/logic.js +0 -127
- package/generators/javascript/loops.js +0 -180
- package/generators/javascript/math.js +0 -401
- package/generators/javascript/procedures.js +0 -110
- package/generators/javascript/text.js +0 -371
- package/generators/javascript/variables.js +0 -32
- package/generators/javascript/variables_dynamic.js +0 -21
- package/generators/javascript.js +0 -322
- package/generators/lua/all.js +0 -27
- package/generators/lua/colour.js +0 -71
- package/generators/lua/lists.js +0 -348
- package/generators/lua/logic.js +0 -112
- package/generators/lua/loops.js +0 -168
- package/generators/lua/math.js +0 -406
- package/generators/lua/procedures.js +0 -106
- package/generators/lua/text.js +0 -327
- package/generators/lua/variables.js +0 -31
- package/generators/lua/variables_dynamic.js +0 -21
- package/generators/lua.js +0 -206
- package/generators/php/all.js +0 -27
- package/generators/php/colour.js +0 -81
- package/generators/php/lists.js +0 -481
- package/generators/php/logic.js +0 -119
- package/generators/php/loops.js +0 -161
- package/generators/php/math.js +0 -349
- package/generators/php/procedures.js +0 -125
- package/generators/php/text.js +0 -255
- package/generators/php/variables.js +0 -32
- package/generators/php/variables_dynamic.js +0 -21
- package/generators/php.js +0 -303
- package/generators/python/all.js +0 -27
- package/generators/python/colour.js +0 -67
- package/generators/python/lists.js +0 -346
- package/generators/python/logic.js +0 -120
- package/generators/python/loops.js +0 -206
- package/generators/python/math.js +0 -373
- package/generators/python/procedures.js +0 -129
- package/generators/python/text.js +0 -291
- package/generators/python/variables.js +0 -32
- package/generators/python/variables_dynamic.js +0 -21
- package/generators/python.js +0 -333
package/blockly.min.js
CHANGED
|
@@ -29,164 +29,162 @@ fireInternal$$module$build$src$core$events$utils=function(a){isEnabled$$module$b
|
|
|
29
29
|
f.index===g-1)e=h,k.newParentId=e.newParentId,k.newInputName=e.newInputName,k.newCoordinate=e.newCoordinate,f.index=g;else if(h.type===CHANGE$$module$build$src$core$events$utils&&h.element===k.element&&h.name===k.name)k.newValue=h.newValue;else if(h.type===VIEWPORT_CHANGE$$module$build$src$core$events$utils)f=h,k.viewTop=f.viewTop,k.viewLeft=f.viewLeft,k.scale=f.scale,k.oldScale=f.oldScale;else if(h.type!==CLICK$$module$build$src$core$events$utils||k.type!==BUBBLE_OPEN$$module$build$src$core$events$utils)d[e]=
|
|
30
30
|
{event:h,index:g},c.push(h)}a=c.filter(function(g){return!g.isNull()});b||a.reverse();for(let g=1,h;h=a[g];g++)h.type===CHANGE$$module$build$src$core$events$utils&&"mutation"===h.element&&a.unshift(a.splice(g,1)[0]);return a},clearPendingUndo$$module$build$src$core$events$utils=function(){for(let a=0,b;b=FIRE_QUEUE$$module$build$src$core$events$utils[a];a++)b.recordUndo=!1},disable$$module$build$src$core$events$utils=function(){disabled$$module$build$src$core$events$utils++},enable$$module$build$src$core$events$utils=
|
|
31
31
|
function(){disabled$$module$build$src$core$events$utils--},isEnabled$$module$build$src$core$events$utils=function(){return 0===disabled$$module$build$src$core$events$utils},getGroup$$module$build$src$core$events$utils=function(){return group$$module$build$src$core$events$utils},setGroup$$module$build$src$core$events$utils=function(a){TEST_ONLY$$module$build$src$core$events$utils.setGroupInternal(a)},setGroupInternal$$module$build$src$core$events$utils=function(a){group$$module$build$src$core$events$utils=
|
|
32
|
-
"boolean"===typeof a?a?genUid$$module$build$src$core$utils$idgenerator():"":a},getDescendantIds$$module$build$src$core$events$utils=function(a){const b=[];a=a.getDescendants(!1);for(let c=0,d;d=a[c];c++)b[c]=d.id;return b},fromJson$$module$build$src$core$events$utils=function(a,b){var c=get$$module$build$src$core$events$utils(a.type);if(!c)throw Error("Unknown event type.");c=new c;c.fromJson(a);c.workspaceId=b.id;return c},get$$module$build$src$core$events$utils=function(a){
|
|
33
|
-
a)},disableOrphans$$module$build$src$core$events$utils=function(a){if((a.type===MOVE$$module$build$src$core$events$utils||a.type===CREATE$$module$build$src$core$events$utils)&&a.workspaceId){var b=getWorkspaceById$$module$build$src$core$common(a.workspaceId);if(a=b.getBlockById(a.blockId)){const c=recordUndo$$module$build$src$core$events$utils;try{recordUndo$$module$build$src$core$events$utils=!1;const d=a.getParent();if(d&&d.isEnabled()){const e=
|
|
34
|
-
a.previousConnection)&&!b.isDragging()){do a.setEnabled(!1),a=a.getNextBlock();while(a)}}finally{recordUndo$$module$build$src$core$events$utils=c}}}},longStart$$module$build$src$core$touch=function(a,b){longStop$$module$build$src$core$touch();a
|
|
35
|
-
LONGPRESS$$module$build$src$core$touch))},longStop$$module$build$src$core$touch=function(){longPid_$$module$build$src$core$touch&&(clearTimeout(longPid_$$module$build$src$core$touch),longPid_$$module$build$src$core$touch=0)},clearTouchIdentifier$$module$build$src$core$touch=function(){touchIdentifier_$$module$build$src$core$touch=null},shouldHandleEvent$$module$build$src$core$touch=function(a){return!isMouseOrTouchEvent$$module$build$src$core$touch(a)||
|
|
36
|
-
getTouchIdentifierFromEvent$$module$build$src$core$touch=function(a){return a instanceof MouseEvent?"mouse":a instanceof PointerEvent?String(a.pointerId):a.changedTouches&&a.changedTouches[0]&&void 0!==a.changedTouches[0].identifier&&null!==a.changedTouches[0].identifier?String(a.changedTouches[0].identifier):"mouse"},checkTouchIdentifier$$module$build$src$core$touch=function(a){const b=getTouchIdentifierFromEvent$$module$build$src$core$touch(a);
|
|
37
|
-
null!==touchIdentifier_$$module$build$src$core$touch?touchIdentifier_$$module$build$src$core$touch===b:"mousedown"===a.type||"touchstart"===a.type||"pointerdown"===a.type?(touchIdentifier_$$module$build$src$core$touch=b,!0):!1},setClientFromTouch$$module$build$src$core$touch=function(a){if(a.type.startsWith("touch")&&a.changedTouches){const b=a.changedTouches[0];a.clientX=b.clientX;a.clientY=b.clientY}},isMouseOrTouchEvent$$module$build$src$core$touch=
|
|
38
|
-
a.type.startsWith("mouse")||a.type.startsWith("pointer")},isTouchEvent$$module$build$src$core$touch=function(a){return a.type.startsWith("touch")||a.type.startsWith("pointer")},splitEventByTouches$$module$build$src$core$touch=function(a){const b=[];if(a
|
|
39
|
-
function(a,b,c,d,e,f){function g(n){const p=!e;n=splitEventByTouches$$module$build$src$core$touch(n);for(let r=0;r<n.length;r++){const q=n[r];if(!p||shouldHandleEvent$$module$build$src$core$touch(q))setClientFromTouch$$module$build$src$core$touch(q),c?d.call(c,q):d(q),h=!0}}let h=!1;const k=[];if(globalThis.PointerEvent&&b in TOUCH_MAP$$module$build$src$core$touch)for(var l=0;l<TOUCH_MAP$$module$build$src$core$touch[b].length;l++){var m=
|
|
40
|
-
g,!1);k.push([a,m,g])}else if(a.addEventListener(b,g,!1),k.push([a,b,g]),b in TOUCH_MAP$$module$build$src$core$touch)for(l=n=>{g(n);const p=!f;h&&p&&n.preventDefault()},m=0;m<TOUCH_MAP$$module$build$src$core$touch[b].length;m++){const n=TOUCH_MAP$$module$build$src$core$touch[b][m];a.addEventListener(n,l,!1);k.push([a,n,l])}return k},bind$$module$build$src$core$browser_events=function(a,b,c,d){function e(k){c?d.call(c,k):d(k)}const f=
|
|
41
|
-
0;g<TOUCH_MAP$$module$build$src$core$touch[b].length;g++){var h=TOUCH_MAP$$module$build$src$core$touch[b][g];a.addEventListener(h,e,!1);f.push([a,h,e])}else if(a.addEventListener(b,e,!1),f.push([a,b,e]),b in TOUCH_MAP$$module$build$src$core$touch)for(g=k=>{if(k instanceof TouchEvent&&k.changedTouches&&1===k.changedTouches.length){const l=k.changedTouches[0];k.clientX=l.clientX;k.clientY=l.clientY}e(k);k.preventDefault()},
|
|
42
|
-
a.addEventListener(k,g,!1);f.push([a,k,g])}return f},unbind$$module$build$src$core$browser_events=function(a){
|
|
43
|
-
"email"===a.type||"password"===a.type||"search"===a.type||"tel"===a.type||"url"===a.type;if(a.target instanceof HTMLTextAreaElement)return!0}return!1},isRightButton$$module$build$src$core$browser_events=function(a){return a.ctrlKey&&MAC$$module$build$src$core$utils$useragent?!0:2===a.button},mouseToSvg$$module$build$src$core$browser_events=function(a,b,c){const d=b.createSVGPoint();d.x=a.clientX;d.y=a.clientY;
|
|
44
|
-
function(a){switch(a.deltaMode){default:return{x:a.deltaX,y:a.deltaY};case 1:return{x:a.deltaX*LINE_MODE_MULTIPLIER$$module$build$src$core$browser_events,y:a.deltaY*LINE_MODE_MULTIPLIER$$module$build$src$core$browser_events};case 2:return{x:a.deltaX*PAGE_MODE_MULTIPLIER$$module$build$src$core$browser_events,y:a.deltaY*PAGE_MODE_MULTIPLIER$$module$build$src$core$browser_events}}},
|
|
45
|
-
function(a,b,c){a=document.createElementNS(SVG_NS$$module$build$src$core$utils$dom,String(a));for(const d in b)a.setAttribute(d,b[d]);
|
|
46
|
-
0;c<b.length;c++)removeClass$$module$build$src$core$utils$dom(a,b[c])},removeClass$$module$build$src$core$utils$dom=function(a,b){var c=a.getAttribute("class");if(-1===(" "+c+" ").indexOf(" "+b+" "))return!1;c=c.split(/\s+/);for(let d=0;d<c.length;d++)c[d]&&c[d]!==b||(c.splice(d,1),d--);c.length?a.setAttribute("class",c.join(" ")):a.removeAttribute("class");return!0},hasClass$$module$build$src$core$utils$dom=
|
|
47
|
-
function(a){return a&&a.parentNode?a.parentNode.removeChild(a):null},insertAfter$$module$build$src$core$utils$dom=function(a,b){const c=b.nextSibling;b=b.parentNode;if(!b)throw Error("Reference node has no parent.");c?b.insertBefore(a,c):b.appendChild(a)},containsNode$$module$build$src$core$utils$dom=function(a,b){return!!(a.compareDocumentPosition(b)&NodeType$$module$build$src$core$utils$dom.DOCUMENT_POSITION_CONTAINED_BY)},
|
|
48
|
-
b;a.style["-webkit-transform"]=b},startTextWidthCache$$module$build$src$core$utils$dom=function(){cacheReference$$module$build$src$core$utils$dom++;cacheWidths$$module$build$src$core$utils$dom||(cacheWidths$$module$build$src$core$utils$dom=Object.create(null))},stopTextWidthCache$$module$build$src$core$utils$dom=function(){cacheReference$$module$build$src$core$utils$dom--;cacheReference$$module$build$src$core$utils$dom||
|
|
49
|
-
function(a){const b=a.textContent+"\n"+a.className.baseVal;let c;if(cacheWidths$$module$build$src$core$utils$dom&&(c=cacheWidths$$module$build$src$core$utils$dom[b]))return c;try{c=
|
|
32
|
+
"boolean"===typeof a?a?genUid$$module$build$src$core$utils$idgenerator():"":a},getDescendantIds$$module$build$src$core$events$utils=function(a){const b=[];a=a.getDescendants(!1);for(let c=0,d;d=a[c];c++)b[c]=d.id;return b},fromJson$$module$build$src$core$events$utils=function(a,b){var c=get$$module$build$src$core$events$utils(a.type);if(!c)throw Error("Unknown event type.");c=new c;c.fromJson(a);c.workspaceId=b.id;return c},get$$module$build$src$core$events$utils=function(a){const b=getClass$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,
|
|
33
|
+
a);if(!b)throw Error(`Event type ${a} not found in registry.`);return b},disableOrphans$$module$build$src$core$events$utils=function(a){if((a.type===MOVE$$module$build$src$core$events$utils||a.type===CREATE$$module$build$src$core$events$utils)&&a.workspaceId){var b=getWorkspaceById$$module$build$src$core$common(a.workspaceId);if(a=b.getBlockById(a.blockId)){const c=recordUndo$$module$build$src$core$events$utils;try{recordUndo$$module$build$src$core$events$utils=!1;const d=a.getParent();if(d&&d.isEnabled()){const e=
|
|
34
|
+
a.getDescendants(!1);for(let f=0,g;g=e[f];f++)g.setEnabled(!0)}else if((a.outputConnection||a.previousConnection)&&!b.isDragging()){do a.setEnabled(!1),a=a.getNextBlock();while(a)}}finally{recordUndo$$module$build$src$core$events$utils=c}}}},longStart$$module$build$src$core$touch=function(a,b){longStop$$module$build$src$core$touch();a.changedTouches&&1!==a.changedTouches.length||(longPid_$$module$build$src$core$touch=setTimeout(function(){a.changedTouches&&(a.button=2,a.clientX=a.changedTouches[0].clientX,
|
|
35
|
+
a.clientY=a.changedTouches[0].clientY);b&&b.handleRightClick(a)},LONGPRESS$$module$build$src$core$touch))},longStop$$module$build$src$core$touch=function(){longPid_$$module$build$src$core$touch&&(clearTimeout(longPid_$$module$build$src$core$touch),longPid_$$module$build$src$core$touch=0)},clearTouchIdentifier$$module$build$src$core$touch=function(){touchIdentifier_$$module$build$src$core$touch=null},shouldHandleEvent$$module$build$src$core$touch=function(a){return!isMouseOrTouchEvent$$module$build$src$core$touch(a)||
|
|
36
|
+
checkTouchIdentifier$$module$build$src$core$touch(a)},getTouchIdentifierFromEvent$$module$build$src$core$touch=function(a){return a instanceof MouseEvent?"mouse":a instanceof PointerEvent?String(a.pointerId):a.changedTouches&&a.changedTouches[0]&&void 0!==a.changedTouches[0].identifier&&null!==a.changedTouches[0].identifier?String(a.changedTouches[0].identifier):"mouse"},checkTouchIdentifier$$module$build$src$core$touch=function(a){const b=getTouchIdentifierFromEvent$$module$build$src$core$touch(a);
|
|
37
|
+
return void 0!==touchIdentifier_$$module$build$src$core$touch&&null!==touchIdentifier_$$module$build$src$core$touch?touchIdentifier_$$module$build$src$core$touch===b:"mousedown"===a.type||"touchstart"===a.type||"pointerdown"===a.type?(touchIdentifier_$$module$build$src$core$touch=b,!0):!1},setClientFromTouch$$module$build$src$core$touch=function(a){if(a.type.startsWith("touch")&&a.changedTouches){const b=a.changedTouches[0];a.clientX=b.clientX;a.clientY=b.clientY}},isMouseOrTouchEvent$$module$build$src$core$touch=
|
|
38
|
+
function(a){return a.type.startsWith("touch")||a.type.startsWith("mouse")||a.type.startsWith("pointer")},isTouchEvent$$module$build$src$core$touch=function(a){return a.type.startsWith("touch")||a.type.startsWith("pointer")},splitEventByTouches$$module$build$src$core$touch=function(a){const b=[];if(a.changedTouches)for(let c=0;c<a.changedTouches.length;c++)b[c]={type:a.type,changedTouches:[a.changedTouches[c]],target:a.target,stopPropagation(){a.stopPropagation()},preventDefault(){a.preventDefault()}};
|
|
39
|
+
else b.push(a);return b},conditionalBind$$module$build$src$core$browser_events=function(a,b,c,d,e,f){function g(n){const p=!e;n=splitEventByTouches$$module$build$src$core$touch(n);for(let r=0;r<n.length;r++){const q=n[r];if(!p||shouldHandleEvent$$module$build$src$core$touch(q))setClientFromTouch$$module$build$src$core$touch(q),c?d.call(c,q):d(q),h=!0}}let h=!1;const k=[];if(globalThis.PointerEvent&&b in TOUCH_MAP$$module$build$src$core$touch)for(var l=0;l<TOUCH_MAP$$module$build$src$core$touch[b].length;l++){var m=
|
|
40
|
+
TOUCH_MAP$$module$build$src$core$touch[b][l];a.addEventListener(m,g,!1);k.push([a,m,g])}else if(a.addEventListener(b,g,!1),k.push([a,b,g]),b in TOUCH_MAP$$module$build$src$core$touch)for(l=n=>{g(n);const p=!f;h&&p&&n.preventDefault()},m=0;m<TOUCH_MAP$$module$build$src$core$touch[b].length;m++){const n=TOUCH_MAP$$module$build$src$core$touch[b][m];a.addEventListener(n,l,!1);k.push([a,n,l])}return k},bind$$module$build$src$core$browser_events=function(a,b,c,d){function e(k){c?d.call(c,k):d(k)}const f=
|
|
41
|
+
[];if(globalThis.PointerEvent&&b in TOUCH_MAP$$module$build$src$core$touch)for(var g=0;g<TOUCH_MAP$$module$build$src$core$touch[b].length;g++){var h=TOUCH_MAP$$module$build$src$core$touch[b][g];a.addEventListener(h,e,!1);f.push([a,h,e])}else if(a.addEventListener(b,e,!1),f.push([a,b,e]),b in TOUCH_MAP$$module$build$src$core$touch)for(g=k=>{if(k instanceof TouchEvent&&k.changedTouches&&1===k.changedTouches.length){const l=k.changedTouches[0];k.clientX=l.clientX;k.clientY=l.clientY}e(k);k.preventDefault()},
|
|
42
|
+
h=0;h<TOUCH_MAP$$module$build$src$core$touch[b].length;h++){const k=TOUCH_MAP$$module$build$src$core$touch[b][h];a.addEventListener(k,g,!1);f.push([a,k,g])}return f},unbind$$module$build$src$core$browser_events=function(a){const b=a[a.length-1][2];for(;a.length;){const c=a.pop();c[0].removeEventListener(c[1],c[2],!1)}return b},isTargetInput$$module$build$src$core$browser_events=function(a){if(a.target instanceof HTMLElement){if(a.target.isContentEditable||"true"===a.target.getAttribute("data-is-text-input"))return!0;
|
|
43
|
+
if(a.target instanceof HTMLInputElement)return a=a.target,"text"===a.type||"number"===a.type||"email"===a.type||"password"===a.type||"search"===a.type||"tel"===a.type||"url"===a.type;if(a.target instanceof HTMLTextAreaElement)return!0}return!1},isRightButton$$module$build$src$core$browser_events=function(a){return a.ctrlKey&&MAC$$module$build$src$core$utils$useragent?!0:2===a.button},mouseToSvg$$module$build$src$core$browser_events=function(a,b,c){const d=b.createSVGPoint();d.x=a.clientX;d.y=a.clientY;
|
|
44
|
+
c||(c=b.getScreenCTM().inverse());return d.matrixTransform(c)},getScrollDeltaPixels$$module$build$src$core$browser_events=function(a){switch(a.deltaMode){default:return{x:a.deltaX,y:a.deltaY};case 1:return{x:a.deltaX*LINE_MODE_MULTIPLIER$$module$build$src$core$browser_events,y:a.deltaY*LINE_MODE_MULTIPLIER$$module$build$src$core$browser_events};case 2:return{x:a.deltaX*PAGE_MODE_MULTIPLIER$$module$build$src$core$browser_events,y:a.deltaY*PAGE_MODE_MULTIPLIER$$module$build$src$core$browser_events}}},
|
|
45
|
+
removeElem$$module$build$src$core$utils$array=function(a,b){b=a.indexOf(b);if(-1===b)return!1;a.splice(b,1);return!0},createSvgElement$$module$build$src$core$utils$dom=function(a,b,c){a=document.createElementNS(SVG_NS$$module$build$src$core$utils$dom,String(a));for(const d in b)a.setAttribute(d,b[d]);c&&c.appendChild(a);return a},addClass$$module$build$src$core$utils$dom=function(a,b){let c=a.getAttribute("class")||"";if(-1!==(" "+c+" ").indexOf(" "+b+" "))return!1;c&&(c+=" ");a.setAttribute("class",
|
|
46
|
+
c+b);return!0},removeClasses$$module$build$src$core$utils$dom=function(a,b){b=b.split(" ");for(let c=0;c<b.length;c++)removeClass$$module$build$src$core$utils$dom(a,b[c])},removeClass$$module$build$src$core$utils$dom=function(a,b){var c=a.getAttribute("class");if(-1===(" "+c+" ").indexOf(" "+b+" "))return!1;c=c.split(/\s+/);for(let d=0;d<c.length;d++)c[d]&&c[d]!==b||(c.splice(d,1),d--);c.length?a.setAttribute("class",c.join(" ")):a.removeAttribute("class");return!0},hasClass$$module$build$src$core$utils$dom=
|
|
47
|
+
function(a,b){return-1!==(" "+a.getAttribute("class")+" ").indexOf(" "+b+" ")},removeNode$$module$build$src$core$utils$dom=function(a){return a&&a.parentNode?a.parentNode.removeChild(a):null},insertAfter$$module$build$src$core$utils$dom=function(a,b){const c=b.nextSibling;b=b.parentNode;if(!b)throw Error("Reference node has no parent.");c?b.insertBefore(a,c):b.appendChild(a)},containsNode$$module$build$src$core$utils$dom=function(a,b){return!!(a.compareDocumentPosition(b)&NodeType$$module$build$src$core$utils$dom.DOCUMENT_POSITION_CONTAINED_BY)},
|
|
48
|
+
setCssTransform$$module$build$src$core$utils$dom=function(a,b){a.style.transform=b;a.style["-webkit-transform"]=b},startTextWidthCache$$module$build$src$core$utils$dom=function(){cacheReference$$module$build$src$core$utils$dom++;cacheWidths$$module$build$src$core$utils$dom||(cacheWidths$$module$build$src$core$utils$dom=Object.create(null))},stopTextWidthCache$$module$build$src$core$utils$dom=function(){cacheReference$$module$build$src$core$utils$dom--;cacheReference$$module$build$src$core$utils$dom||
|
|
49
|
+
(cacheWidths$$module$build$src$core$utils$dom=null)},getTextWidth$$module$build$src$core$utils$dom=function(a){const b=a.textContent+"\n"+a.className.baseVal;let c;if(cacheWidths$$module$build$src$core$utils$dom&&(c=cacheWidths$$module$build$src$core$utils$dom[b]))return c;try{c=a.getComputedTextLength()}catch(d){return 8*a.textContent.length}cacheWidths$$module$build$src$core$utils$dom&&(cacheWidths$$module$build$src$core$utils$dom[b]=c);return c},getFastTextWidth$$module$build$src$core$utils$dom=
|
|
50
50
|
function(a,b,c,d){return getFastTextWidthWithSizeString$$module$build$src$core$utils$dom(a,b+"pt",c,d)},getFastTextWidthWithSizeString$$module$build$src$core$utils$dom=function(a,b,c,d){const e=a.textContent;a=e+"\n"+a.className.baseVal;var f;if(cacheWidths$$module$build$src$core$utils$dom&&(f=cacheWidths$$module$build$src$core$utils$dom[a]))return f;canvasContext$$module$build$src$core$utils$dom||(f=document.createElement("canvas"),f.className="blocklyComputeCanvas",document.body.appendChild(f),
|
|
51
51
|
canvasContext$$module$build$src$core$utils$dom=f.getContext("2d"));canvasContext$$module$build$src$core$utils$dom.font=c+" "+b+" "+d;f=canvasContext$$module$build$src$core$utils$dom.measureText(e).width;cacheWidths$$module$build$src$core$utils$dom&&(cacheWidths$$module$build$src$core$utils$dom[a]=f);return f},measureFontMetrics$$module$build$src$core$utils$dom=function(a,b,c,d){const e=document.createElement("span");e.style.font=c+" "+b+" "+d;e.textContent=a;a=document.createElement("div");a.style.width=
|
|
52
52
|
"1px";a.style.height=0;b=document.createElement("div");b.setAttribute("style","position: fixed; top: 0; left: 0; display: flex;");b.appendChild(e);b.appendChild(a);document.body.appendChild(b);c={height:0,baseline:0};try{b.style.alignItems="baseline",c.baseline=a.offsetTop-e.offsetTop,b.style.alignItems="flex-end",c.height=a.offsetTop-e.offsetTop}finally{document.body.removeChild(b)}return c},getDocument$$module$build$src$core$utils$xml=function(){return xmlDocument$$module$build$src$core$utils$xml},
|
|
53
53
|
setDocument$$module$build$src$core$utils$xml=function(a){xmlDocument$$module$build$src$core$utils$xml=a},createElement$$module$build$src$core$utils$xml=function(a){return xmlDocument$$module$build$src$core$utils$xml.createElementNS(NAME_SPACE$$module$build$src$core$utils$xml,a)},createTextNode$$module$build$src$core$utils$xml=function(a){return xmlDocument$$module$build$src$core$utils$xml.createTextNode(a)},textToDomDocument$$module$build$src$core$utils$xml=function(a){return(new DOMParser).parseFromString(a,
|
|
54
54
|
"text/xml")},domToText$$module$build$src$core$utils$xml=function(a){return(new XMLSerializer).serializeToString(a)},alert$$module$build$src$core$dialog=function(a,b){alertImplementation$$module$build$src$core$dialog(a,b)},setAlert$$module$build$src$core$dialog=function(a){alertImplementation$$module$build$src$core$dialog=a},confirm$$module$build$src$core$dialog=function(a,b){TEST_ONLY$$module$build$src$core$dialog.confirmInternal(a,b)},confirmInternal$$module$build$src$core$dialog=function(a,b){confirmImplementation$$module$build$src$core$dialog(a,
|
|
55
55
|
b)},setConfirm$$module$build$src$core$dialog=function(a){confirmImplementation$$module$build$src$core$dialog=a},prompt$$module$build$src$core$dialog=function(a,b,c){promptImplementation$$module$build$src$core$dialog(a,b,c)},setPrompt$$module$build$src$core$dialog=function(a){promptImplementation$$module$build$src$core$dialog=a},allUsedVarModels$$module$build$src$core$variables=function(a){a=a.getAllBlocks(!1);const b=new Set;for(let c=0;c<a.length;c++){const d=a[c].getVarModels();if(d)for(let e=0;e<
|
|
56
|
-
d.length;e++){const f=d[e];f.getId()&&b.add(f)}}return Array.from(b.values())},allDeveloperVariables$$module$build$src$core$variables=function(a){a=a.getAllBlocks(!1);const b=new Set;for(let d=0,e;e=a[d];d++){var c=e.getDeveloperVariables
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
function(){const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
function(){
|
|
79
|
-
|
|
80
|
-
a.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
a.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
c.
|
|
90
|
-
function(a,b){
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
f
|
|
96
|
-
b)
|
|
97
|
-
b
|
|
98
|
-
|
|
99
|
-
e,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
e
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
(b
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
function(){
|
|
129
|
-
|
|
130
|
-
a,c,d)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
"
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
(c=
|
|
146
|
-
|
|
147
|
-
a
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
""
|
|
162
|
-
function(){
|
|
163
|
-
|
|
164
|
-
a
|
|
165
|
-
|
|
166
|
-
c
|
|
167
|
-
|
|
168
|
-
"string"===typeof
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
(
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
(
|
|
188
|
-
function(a,b){if("string"!==typeof a||""===a.trim())throw Error('Error: Invalid extension name "'+a+'"');if(allExtensions$$module$build$src$core$extensions[a])throw Error('Error: Extension "'+a+'" is already registered.');if("function"!==typeof b)throw Error('Error: Extension "'+a+'" must be a function');allExtensions$$module$build$src$core$extensions[a]=b},registerMixin$$module$build$src$core$extensions=function(a,b){if(!b||"object"!==typeof b)throw Error('Error: Mixin "'+a+'" must be a object');
|
|
189
|
-
register$$module$build$src$core$extensions(a,function(){this.mixin(b)})},registerMutator$$module$build$src$core$extensions=function(a,b,c,d){const e='Error when registering mutator "'+a+'": ';checkHasMutatorProperties$$module$build$src$core$extensions(e,b);const f=checkMutatorDialog$$module$build$src$core$extensions(b,e);if(c&&"function"!==typeof c)throw Error(e+'Extension "'+a+'" is not a function');register$$module$build$src$core$extensions(a,function(){f&&this.setMutator(new $.Mutator$$module$build$src$core$mutator(this,
|
|
56
|
+
d.length;e++){const f=d[e];f.getId()&&b.add(f)}}return Array.from(b.values())},allDeveloperVariables$$module$build$src$core$variables=function(a){a=a.getAllBlocks(!1);const b=new Set;for(let d=0,e;e=a[d];d++){var c=e.getDeveloperVariables;if(c){c=c();for(let f=0;f<c.length;f++)b.add(c[f])}}return Array.from(b.values())},flyoutCategory$$module$build$src$core$variables=function(a){let b=[];const c=document.createElement("button");c.setAttribute("text","%{BKY_NEW_VARIABLE}");c.setAttribute("callbackKey",
|
|
57
|
+
"CREATE_VARIABLE");a.registerButtonCallback("CREATE_VARIABLE",function(d){createVariableButtonHandler$$module$build$src$core$variables(d.getTargetWorkspace())});b.push(c);a=flyoutCategoryBlocks$$module$build$src$core$variables(a);return b=b.concat(a)},flyoutCategoryBlocks$$module$build$src$core$variables=function(a){a=a.getVariablesOfType("");const b=[];if(0<a.length){var c=a[a.length-1];if(Blocks$$module$build$src$core$blocks.variables_set){var d=createElement$$module$build$src$core$utils$xml("block");
|
|
58
|
+
d.setAttribute("type","variables_set");d.setAttribute("gap",Blocks$$module$build$src$core$blocks.math_change?"8":"24");d.appendChild(generateVariableFieldDom$$module$build$src$core$variables(c));b.push(d)}Blocks$$module$build$src$core$blocks.math_change&&(d=createElement$$module$build$src$core$utils$xml("block"),d.setAttribute("type","math_change"),d.setAttribute("gap",Blocks$$module$build$src$core$blocks.variables_get?"20":"8"),d.appendChild(generateVariableFieldDom$$module$build$src$core$variables(c)),
|
|
59
|
+
c=textToDom$$module$build$src$core$xml('<value name="DELTA"><shadow type="math_number"><field name="NUM">1</field></shadow></value>'),d.appendChild(c),b.push(d));if(Blocks$$module$build$src$core$blocks.variables_get){a.sort(VariableModel$$module$build$src$core$variable_model.compareByName);for(let e=0,f;f=a[e];e++)c=createElement$$module$build$src$core$utils$xml("block"),c.setAttribute("type","variables_get"),c.setAttribute("gap","8"),c.appendChild(generateVariableFieldDom$$module$build$src$core$variables(f)),
|
|
60
|
+
b.push(c)}}return b},generateUniqueName$$module$build$src$core$variables=function(a){return TEST_ONLY$$module$build$src$core$variables.generateUniqueNameInternal(a)},generateUniqueNameInternal$$module$build$src$core$variables=function(a){return generateUniqueNameFromOptions$$module$build$src$core$variables(VAR_LETTER_OPTIONS$$module$build$src$core$variables.charAt(0),a.getAllVariableNames())},generateUniqueNameFromOptions$$module$build$src$core$variables=function(a,b){if(!b.length)return a;const c=
|
|
61
|
+
VAR_LETTER_OPTIONS$$module$build$src$core$variables;let d="",e=c.indexOf(a);for(;;){let f=!1;for(let g=0;g<b.length;g++)if(b[g].toLowerCase()===a){f=!0;break}if(!f)return a;e++;e===c.length&&(e=0,d=`${Number(d)+1}`);a=c.charAt(e)+d}},createVariableButtonHandler$$module$build$src$core$variables=function(a,b,c){function d(f){promptName$$module$build$src$core$variables(Msg$$module$build$src$core$msg.NEW_VARIABLE_TITLE,f,function(g){if(g){const h=nameUsedWithAnyType$$module$build$src$core$variables(g,
|
|
62
|
+
a);if(h){let k;h.type===e?k=Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS.replace("%1",h.name):(k=Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE,k=k.replace("%1",h.name).replace("%2",h.type));alert$$module$build$src$core$dialog(k,function(){d(g)})}else a.createVariable(g,e),b&&b(g)}else b&&b(null)})}const e=c||"";d("")},renameVariable$$module$build$src$core$variables=function(a,b,c){function d(e){const f=Msg$$module$build$src$core$msg.RENAME_VARIABLE_TITLE.replace("%1",
|
|
63
|
+
b.name);promptName$$module$build$src$core$variables(f,e,function(g){if(g){var h=nameUsedWithOtherType$$module$build$src$core$variables(g,b.type,a);h?(h=Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE.replace("%1",h.name).replace("%2",h.type),alert$$module$build$src$core$dialog(h,function(){d(g)})):(a.renameVariableById(b.getId(),g),c&&c(g))}else c&&c(null)})}d("")},promptName$$module$build$src$core$variables=function(a,b,c){prompt$$module$build$src$core$dialog(a,b,function(d){d&&
|
|
64
|
+
(d=d.replace(/[\s\xa0]+/g," ").trim(),d===Msg$$module$build$src$core$msg.RENAME_VARIABLE||d===Msg$$module$build$src$core$msg.NEW_VARIABLE)&&(d=null);c(d)})},nameUsedWithOtherType$$module$build$src$core$variables=function(a,b,c){c=c.getVariableMap().getAllVariables();a=a.toLowerCase();for(let d=0,e;e=c[d];d++)if(e.name.toLowerCase()===a&&e.type!==b)return e;return null},nameUsedWithAnyType$$module$build$src$core$variables=function(a,b){b=b.getVariableMap().getAllVariables();a=a.toLowerCase();for(let c=
|
|
65
|
+
0,d;d=b[c];c++)if(d.name.toLowerCase()===a)return d;return null},generateVariableFieldDom$$module$build$src$core$variables=function(a){const b=createElement$$module$build$src$core$utils$xml("field");b.setAttribute("name","VAR");b.setAttribute("id",a.getId());b.setAttribute("variabletype",a.type);a=createTextNode$$module$build$src$core$utils$xml(a.name);b.appendChild(a);return b},getOrCreateVariablePackage$$module$build$src$core$variables=function(a,b,c,d){let e=getVariable$$module$build$src$core$variables(a,
|
|
66
|
+
b,c,d);e||(e=createVariable$$module$build$src$core$variables(a,b,c,d));return e},getVariable$$module$build$src$core$variables=function(a,b,c,d){const e=a.getPotentialVariableMap();let f=null;if(b&&(f=a.getVariableById(b),!f&&e&&(f=e.getVariableById(b)),f))return f;if(c){if(void 0===d)throw Error("Tried to look up a variable by name without a type");f=a.getVariable(c,d);!f&&e&&(f=e.getVariable(c,d))}return f},createVariable$$module$build$src$core$variables=function(a,b,c,d){const e=a.getPotentialVariableMap();
|
|
67
|
+
c||(c=generateUniqueName$$module$build$src$core$variables(a.isFlyout?a.targetWorkspace:a));return e?e.createVariable(c,d,b):a.createVariable(c,d,b)},getAddedVariables$$module$build$src$core$variables=function(a,b){a=a.getAllVariables();const c=[];if(b.length!==a.length)for(let d=0;d<a.length;d++){const e=a[d];-1===b.indexOf(e)&&c.push(e)}return c},warn$$module$build$src$core$utils$deprecation=function(a,b,c,d){a=a+" was deprecated in "+b+" and will be deleted in "+c+".";d&&(a+="\nUse "+d+" instead.");
|
|
68
|
+
console.warn(a)},register$$module$build$src$core$css=function(a){if(injected$$module$build$src$core$css)throw Error("CSS already injected");Array.isArray(a)?(warn$$module$build$src$core$utils$deprecation("Registering CSS by passing an array of strings","September 2021","September 2022","css.register passing a multiline string"),content$$module$build$src$core$css+="\n"+a.join("\n")):content$$module$build$src$core$css+="\n"+a},inject$$module$build$src$core$css=function(a,b){injected$$module$build$src$core$css||
|
|
69
|
+
(injected$$module$build$src$core$css=!0,a&&(a=b.replace(/[\\/]$/,""),b=content$$module$build$src$core$css.replace(/<<<PATH>>>/g,a),content$$module$build$src$core$css="",a=document.createElement("style"),a.id="blockly-common-style",b=document.createTextNode(b),a.appendChild(b),document.head.insertBefore(a,document.head.firstChild)))},getSize$$module$build$src$core$utils$style=function(a){return TEST_ONLY$$module$build$src$core$utils$style.getSizeInternal(a)},getSizeInternal$$module$build$src$core$utils$style=
|
|
70
|
+
function(a){if("none"!==getComputedStyle$$module$build$src$core$utils$style(a,"display"))return getSizeWithDisplay$$module$build$src$core$utils$style(a);const b=a.style,c=b.display,d=b.visibility,e=b.position;b.visibility="hidden";b.position="absolute";b.display="inline";const f=a.offsetWidth;a=a.offsetHeight;b.display=c;b.position=e;b.visibility=d;return new Size$$module$build$src$core$utils$size(f,a)},getSizeWithDisplay$$module$build$src$core$utils$style=function(a){return new Size$$module$build$src$core$utils$size(a.offsetWidth,
|
|
71
|
+
a.offsetHeight)},getComputedStyle$$module$build$src$core$utils$style=function(a,b){a=window.getComputedStyle(a);return a[b]||a.getPropertyValue(b)},getCascadedStyle$$module$build$src$core$utils$style=function(a,b){warn$$module$build$src$core$utils$deprecation("Blockly.utils.style.getCascadedStyle","version 9.0.0","version 10.0.0");return a.currentStyle?a.currentStyle[b]:""},getPageOffset$$module$build$src$core$utils$style=function(a){const b=new Coordinate$$module$build$src$core$utils$coordinate(0,
|
|
72
|
+
0);a=a.getBoundingClientRect();var c=document.documentElement;c=new Coordinate$$module$build$src$core$utils$coordinate(window.pageXOffset||c.scrollLeft,window.pageYOffset||c.scrollTop);b.x=a.left+c.x;b.y=a.top+c.y;return b},getViewportPageOffset$$module$build$src$core$utils$style=function(){const a=document.body,b=document.documentElement;return new Coordinate$$module$build$src$core$utils$coordinate(a.scrollLeft||b.scrollLeft,a.scrollTop||b.scrollTop)},getBorderBox$$module$build$src$core$utils$style=
|
|
73
|
+
function(a){const b=parseFloat(getComputedStyle$$module$build$src$core$utils$style(a,"borderLeftWidth")),c=parseFloat(getComputedStyle$$module$build$src$core$utils$style(a,"borderRightWidth")),d=parseFloat(getComputedStyle$$module$build$src$core$utils$style(a,"borderTopWidth"));a=parseFloat(getComputedStyle$$module$build$src$core$utils$style(a,"borderBottomWidth"));return new Rect$$module$build$src$core$utils$rect(d,a,b,c)},scrollIntoContainerView$$module$build$src$core$utils$style=function(a,b,c){a=
|
|
74
|
+
getContainerOffsetToScrollInto$$module$build$src$core$utils$style(a,b,c);b.scrollLeft=a.x;b.scrollTop=a.y},getContainerOffsetToScrollInto$$module$build$src$core$utils$style=function(a,b,c){var d=getPageOffset$$module$build$src$core$utils$style(a),e=getPageOffset$$module$build$src$core$utils$style(b),f=getBorderBox$$module$build$src$core$utils$style(b);const g=d.x-e.x-f.left;d=d.y-e.y-f.top;e=getSizeWithDisplay$$module$build$src$core$utils$style(a);a=b.clientWidth-e.width;e=b.clientHeight-e.height;
|
|
75
|
+
f=b.scrollLeft;b=b.scrollTop;c?(f+=g-a/2,b+=d-e/2):(f+=Math.min(g,Math.max(g-a,0)),b+=Math.min(d,Math.max(d-e,0)));return new Coordinate$$module$build$src$core$utils$coordinate(f,b)},getRelativeXY$$module$build$src$core$utils$svg_math=function(a){const b=new Coordinate$$module$build$src$core$utils$coordinate(0,0);var c=a.x&&a.getAttribute("x");const d=a.y&&a.getAttribute("y");c&&(b.x=parseInt(c,10));d&&(b.y=parseInt(d,10));if(c=(c=a.getAttribute("transform"))&&c.match(XY_REGEX$$module$build$src$core$utils$svg_math))b.x+=
|
|
76
|
+
Number(c[1]),c[3]&&(b.y+=Number(c[3]));(a=a.getAttribute("style"))&&-1<a.indexOf("translate")&&(a=a.match(XY_STYLE_REGEX$$module$build$src$core$utils$svg_math))&&(b.x+=Number(a[1]),a[3]&&(b.y+=Number(a[3])));return b},getInjectionDivXY$$module$build$src$core$utils$svg_math=function(a){let b=0,c=0;for(;a;){const d=getRelativeXY$$module$build$src$core$utils$svg_math(a);b+=d.x;c+=d.y;if(-1!==(" "+(a.getAttribute("class")||"")+" ").indexOf(" injectionDiv "))break;a=a.parentNode}return new Coordinate$$module$build$src$core$utils$coordinate(b,
|
|
77
|
+
c)},is3dSupported$$module$build$src$core$utils$svg_math=function(){warn$$module$build$src$core$utils$deprecation("Blockly.utils.svgMath.is3dSupported","version 9.0.0","version 10.0.0");return!0},getViewportBBox$$module$build$src$core$utils$svg_math=function(){const a=getViewportPageOffset$$module$build$src$core$utils$style();return new Rect$$module$build$src$core$utils$rect(a.y,document.documentElement.clientHeight+a.y,a.x,document.documentElement.clientWidth+a.x)},getDocumentScroll$$module$build$src$core$utils$svg_math=
|
|
78
|
+
function(){const a=document.documentElement,b=window;return new Coordinate$$module$build$src$core$utils$coordinate(b.pageXOffset||a.scrollLeft,b.pageYOffset||a.scrollTop)},screenToWsCoordinates$$module$build$src$core$utils$svg_math=function(a,b){var c=b.x;b=b.y;const d=a.getInjectionDiv().getBoundingClientRect();c=new Coordinate$$module$build$src$core$utils$coordinate(c-d.left,b-d.top);b=a.getOriginOffsetInPixels();return Coordinate$$module$build$src$core$utils$coordinate.difference(c,b).scale(1/
|
|
79
|
+
a.scale)},svgSize$$module$build$src$core$utils$svg_math=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.svgSize","March 2021","March 2022","workspace.getCachedParentSvgSize");return new Size$$module$build$src$core$utils$size(Number(a.getAttribute("data-cached-width")),Number(a.getAttribute("data-cached-height")))},workspaceToDom$$module$build$src$core$xml=function(a,b){const c=createElement$$module$build$src$core$utils$xml("xml");var d=variablesToDom$$module$build$src$core$xml(allUsedVarModels$$module$build$src$core$variables(a));
|
|
80
|
+
d.hasChildNodes()&&c.appendChild(d);d=a.getTopComments(!0);for(let e=0;e<d.length;e++)c.appendChild(d[e].toXmlWithXY(b));a=a.getTopBlocks(!0);for(d=0;d<a.length;d++)c.appendChild(blockToDomWithXY$$module$build$src$core$xml(a[d],b));return c},variablesToDom$$module$build$src$core$xml=function(a){const b=createElement$$module$build$src$core$utils$xml("variables");for(let c=0;c<a.length;c++){const d=a[c],e=createElement$$module$build$src$core$utils$xml("variable");e.appendChild(createTextNode$$module$build$src$core$utils$xml(d.name));
|
|
81
|
+
d.type&&e.setAttribute("type",d.type);e.id=d.getId();b.appendChild(e)}return b},blockToDomWithXY$$module$build$src$core$xml=function(a,b){if(a.isInsertionMarker()&&(a=a.getChildren(!1)[0],!a))return new DocumentFragment;let c=0;a.workspace.RTL&&(c=a.workspace.getWidth());b=blockToDom$$module$build$src$core$xml(a,b);const d=a.getRelativeToSurfaceXY();b.setAttribute("x",Math.round(a.workspace.RTL?c-d.x:d.x));b.setAttribute("y",Math.round(d.y));return b},fieldToDom$$module$build$src$core$xml=function(a){if(a.isSerializable()){const b=
|
|
82
|
+
createElement$$module$build$src$core$utils$xml("field");b.setAttribute("name",a.name||"");return a.toXml(b)}return null},allFieldsToDom$$module$build$src$core$xml=function(a,b){for(let c=0;c<a.inputList.length;c++){const d=a.inputList[c];for(let e=0;e<d.fieldRow.length;e++){const f=fieldToDom$$module$build$src$core$xml(d.fieldRow[e]);f&&b.appendChild(f)}}},blockToDom$$module$build$src$core$xml=function(a,b){if(a.isInsertionMarker())return(b=a.getChildren(!1)[0])?blockToDom$$module$build$src$core$xml(b):
|
|
83
|
+
new DocumentFragment;const c=createElement$$module$build$src$core$utils$xml(a.isShadow()?"shadow":"block");c.setAttribute("type",a.type);b||c.setAttribute("id",a.id);if(a.mutationToDom){var d=a.mutationToDom();d&&(d.hasChildNodes()||d.hasAttributes())&&c.appendChild(d)}allFieldsToDom$$module$build$src$core$xml(a,c);if(d=a.getCommentText()){var e=a.commentModel.size,f=a.commentModel.pinned,g=createElement$$module$build$src$core$utils$xml("comment");g.appendChild(createTextNode$$module$build$src$core$utils$xml(d));
|
|
84
|
+
g.setAttribute("pinned",f);g.setAttribute("h",e.height);g.setAttribute("w",e.width);c.appendChild(g)}a.data&&(d=createElement$$module$build$src$core$utils$xml("data"),d.appendChild(createTextNode$$module$build$src$core$utils$xml(a.data)),c.appendChild(d));for(d=0;d<a.inputList.length;d++){e=a.inputList[d];var h=void 0;f=!0;if(e.type!==inputTypes$$module$build$src$core$input_types.DUMMY){g=e.connection.targetBlock();e.type===inputTypes$$module$build$src$core$input_types.VALUE?h=createElement$$module$build$src$core$utils$xml("value"):
|
|
85
|
+
e.type===inputTypes$$module$build$src$core$input_types.STATEMENT&&(h=createElement$$module$build$src$core$utils$xml("statement"));const l=e.connection.getShadowDom();!l||g&&g.isShadow()||h.appendChild(cloneShadow$$module$build$src$core$xml(l,b));g&&(g=blockToDom$$module$build$src$core$xml(g,b),g.nodeType===NodeType$$module$build$src$core$utils$dom.ELEMENT_NODE&&(h.appendChild(g),f=!1));h.setAttribute("name",e.name);f||c.appendChild(h)}}void 0!==a.inputsInline&&a.inputsInline!==a.inputsInlineDefault&&
|
|
86
|
+
c.setAttribute("inline",a.inputsInline.toString());a.isCollapsed()&&c.setAttribute("collapsed","true");a.isEnabled()||c.setAttribute("disabled","true");a.isDeletable()||a.isShadow()||c.setAttribute("deletable","false");a.isMovable()||a.isShadow()||c.setAttribute("movable","false");a.isEditable()||c.setAttribute("editable","false");h=a.getNextBlock();let k;h&&(d=blockToDom$$module$build$src$core$xml(h,b),d.nodeType===NodeType$$module$build$src$core$utils$dom.ELEMENT_NODE&&(k=createElement$$module$build$src$core$utils$xml("next"),
|
|
87
|
+
k.appendChild(d),c.appendChild(k)));a=a.nextConnection&&a.nextConnection.getShadowDom();!a||h&&h.isShadow()||k.appendChild(cloneShadow$$module$build$src$core$xml(a,b));return c},cloneShadow$$module$build$src$core$xml=function(a,b){let c=a=a.cloneNode(!0),d;for(;c;)if(b&&"shadow"===c.nodeName&&c.removeAttribute("id"),c.firstChild)c=c.firstChild;else{for(;c&&!c.nextSibling;){d=c;c=c.parentNode;let e;d.nodeType===NodeType$$module$build$src$core$utils$dom.TEXT_NODE&&""===d.data.trim()&&(null==(e=c)?void 0:
|
|
88
|
+
e.firstChild)!==d&&removeNode$$module$build$src$core$utils$dom(d)}c&&(d=c,c=c.nextSibling,d.nodeType===NodeType$$module$build$src$core$utils$dom.TEXT_NODE&&""===d.data.trim()&&removeNode$$module$build$src$core$utils$dom(d))}return a},domToText$$module$build$src$core$xml=function(a){return domToText$$module$build$src$core$utils$xml(a).replace(/<(\w+)([^<]*)\/>/g,"<$1$2></$1>")},domToPrettyText$$module$build$src$core$xml=function(a){a=domToText$$module$build$src$core$xml(a).split("<");let b="";for(let c=
|
|
89
|
+
1;c<a.length;c++){const d=a[c];"/"===d[0]&&(b=b.substring(2));a[c]=b+"<"+d;"/"!==d[0]&&"/>"!==d.slice(-2)&&(b+=" ")}a=a.join("\n");a=a.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1</$2>");return a.replace(/^\n/,"")},textToDom$$module$build$src$core$xml=function(a){const b=textToDomDocument$$module$build$src$core$utils$xml(a);if(!b||!b.documentElement||b.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+a);return b.documentElement},clearWorkspaceAndLoadFromXml$$module$build$src$core$xml=
|
|
90
|
+
function(a,b){b.setResizesEnabled(!1);b.clear();a=domToWorkspace$$module$build$src$core$xml(a,b);b.setResizesEnabled(!0);return a},domToWorkspace$$module$build$src$core$xml=function(a,b){let c=0;b.RTL&&(c=b.getWidth());const d=[];startTextWidthCache$$module$build$src$core$utils$dom();const e=getGroup$$module$build$src$core$events$utils();e||setGroup$$module$build$src$core$events$utils(!0);b.setResizesEnabled&&b.setResizesEnabled(!1);let f=!0;try{for(let g=0,h;h=a.childNodes[g];g++){const k=h.nodeName.toLowerCase(),
|
|
91
|
+
l=h;if("block"===k||"shadow"===k&&!getRecordUndo$$module$build$src$core$events$utils()){const m=domToBlock$$module$build$src$core$xml(l,b);d.push(m.id);const n=l.hasAttribute("x")?parseInt(l.getAttribute("x"),10):10,p=l.hasAttribute("y")?parseInt(l.getAttribute("y"),10):10;isNaN(n)||isNaN(p)||m.moveBy(b.RTL?c-n:n,p);f=!1}else{if("shadow"===k)throw TypeError("Shadow block cannot be a top-level block.");if("comment"===k)b.rendered?WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg.fromXmlRendered(l,
|
|
92
|
+
b,c):WorkspaceComment$$module$build$src$core$workspace_comment.fromXml(l,b);else if("variables"===k){if(f)domToVariables$$module$build$src$core$xml(l,b);else throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");f=!1}}}}finally{e||setGroup$$module$build$src$core$events$utils(!1),stopTextWidthCache$$module$build$src$core$utils$dom()}b.setResizesEnabled&&b.setResizesEnabled(!0);fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(FINISHED_LOADING$$module$build$src$core$events$utils))(b));
|
|
93
|
+
return d},appendDomToWorkspace$$module$build$src$core$xml=function(a,b){if(!b.getBlocksBoundingBox)return domToWorkspace$$module$build$src$core$xml(a,b);var c=b.getBlocksBoundingBox();a=domToWorkspace$$module$build$src$core$xml(a,b);if(c&&c.top!==c.bottom){var d=c.bottom;c=b.RTL?c.right:c.left;var e=Infinity;let f=-Infinity,g=Infinity;for(let h=0;h<a.length;h++){const k=b.getBlockById(a[h]).getRelativeToSurfaceXY();k.y<g&&(g=k.y);k.x<e&&(e=k.x);k.x>f&&(f=k.x)}d=d-g+10;c=b.RTL?c-f:c-e;for(e=0;e<a.length;e++)b.getBlockById(a[e]).moveBy(c,
|
|
94
|
+
d)}return a},domToBlock$$module$build$src$core$xml=function(a,b){disable$$module$build$src$core$events$utils();var c=b.getAllVariables();let d;try{if(d=domToBlockHeadless$$module$build$src$core$xml(a,b),b.rendered){const e=d,f=d.getDescendants(!1);e.setConnectionTracking(!1);for(let g=f.length-1;0<=g;g--)f[g].initSvg();for(let g=f.length-1;0<=g;g--)f[g].render(!1);setTimeout(function(){e.disposed||e.setConnectionTracking(!0)},1);e.updateDisabled();b.resizeContents()}else{const e=d.getDescendants(!1);
|
|
95
|
+
for(let f=e.length-1;0<=f;f--)e[f].initModel()}}finally{enable$$module$build$src$core$events$utils()}if(isEnabled$$module$build$src$core$events$utils()){a=getAddedVariables$$module$build$src$core$variables(b,c);for(b=0;b<a.length;b++)c=a[b],fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(VAR_CREATE$$module$build$src$core$events$utils))(c));fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CREATE$$module$build$src$core$events$utils))(d))}return d},
|
|
96
|
+
domToVariables$$module$build$src$core$xml=function(a,b){for(let c=0;c<a.children.length;c++){const d=a.children[c],e=d.getAttribute("type"),f=d.getAttribute("id");b.createVariable(d.textContent,e,f)}},mapSupportedXmlTags$$module$build$src$core$xml=function(a){const b={mutation:[],comment:[],data:[],field:[],input:[],next:[]};for(let c=0;c<a.children.length;c++){const d=a.children[c];if(d.nodeType!==NodeType$$module$build$src$core$utils$dom.TEXT_NODE)switch(d.nodeName.toLowerCase()){case "mutation":b.mutation.push(d);
|
|
97
|
+
break;case "comment":b.comment.push(d);break;case "data":b.data.push(d);break;case "title":case "field":b.field.push(d);break;case "value":case "statement":b.input.push(d);break;case "next":b.next.push(d);break;default:console.warn("Ignoring unknown tag: "+d.nodeName)}}return b},applyMutationTagNodes$$module$build$src$core$xml=function(a,b){let c=!1;for(let d=0;d<a.length;d++){const e=a[d];b.domToMutation&&(b.domToMutation(e),b.initSvg&&(c=!0))}return c},applyCommentTagNodes$$module$build$src$core$xml=
|
|
98
|
+
function(a,b){for(let d=0;d<a.length;d++){var c=a[d];const e=c.textContent,f="true"===c.getAttribute("pinned"),g=parseInt(c.getAttribute("w"),10);c=parseInt(c.getAttribute("h"),10);b.setCommentText(e);b.commentModel.pinned=f;isNaN(g)||isNaN(c)||(b.commentModel.size=new Size$$module$build$src$core$utils$size(g,c));if(f&&b.getCommentIcon&&!b.isInFlyout){const h=b;setTimeout(function(){h.getCommentIcon().setVisible(!0)},1)}}},applyDataTagNodes$$module$build$src$core$xml=function(a,b){for(let c=0;c<a.length;c++)b.data=
|
|
99
|
+
a[c].textContent},applyFieldTagNodes$$module$build$src$core$xml=function(a,b){for(let c=0;c<a.length;c++){const d=a[c],e=d.getAttribute("name");domToField$$module$build$src$core$xml(b,e,d)}},findChildBlocks$$module$build$src$core$xml=function(a){const b={childBlockElement:null,childShadowElement:null};for(let c=0;c<a.childNodes.length;c++){const d=a.childNodes[c];d.nodeType===NodeType$$module$build$src$core$utils$dom.ELEMENT_NODE&&("block"===d.nodeName.toLowerCase()?b.childBlockElement=d:"shadow"===
|
|
100
|
+
d.nodeName.toLowerCase()&&(b.childShadowElement=d))}return b},applyInputTagNodes$$module$build$src$core$xml=function(a,b,c,d){for(let f=0;f<a.length;f++){var e=a[f];const g=e.getAttribute("name"),h=c.getInput(g);if(!h){console.warn("Ignoring non-existent input "+g+" in block "+d);break}e=findChildBlocks$$module$build$src$core$xml(e);if(e.childBlockElement){if(!h.connection)throw TypeError("Input connection does not exist.");domToBlockHeadless$$module$build$src$core$xml(e.childBlockElement,b,h.connection,
|
|
101
|
+
!1)}if(e.childShadowElement){let k;null==(k=h.connection)||k.setShadowDom(e.childShadowElement)}}},applyNextTagNodes$$module$build$src$core$xml=function(a,b,c){for(let d=0;d<a.length;d++){const e=findChildBlocks$$module$build$src$core$xml(a[d]);if(e.childBlockElement){if(!c.nextConnection)throw TypeError("Next statement does not exist.");if(c.nextConnection.isConnected())throw TypeError("Next statement is already connected.");domToBlockHeadless$$module$build$src$core$xml(e.childBlockElement,b,c.nextConnection,
|
|
102
|
+
!0)}e.childShadowElement&&c.nextConnection&&c.nextConnection.setShadowDom(e.childShadowElement)}},domToBlockHeadless$$module$build$src$core$xml=function(a,b,c,d){const e=a.getAttribute("type");if(!e)throw TypeError("Block type unspecified: "+a.outerHTML);var f=a.getAttribute("id");f=b.newBlock(e,f);const g=mapSupportedXmlTags$$module$build$src$core$xml(a),h=applyMutationTagNodes$$module$build$src$core$xml(g.mutation,f);applyCommentTagNodes$$module$build$src$core$xml(g.comment,f);applyDataTagNodes$$module$build$src$core$xml(g.data,
|
|
103
|
+
f);if(c)if(d)if(f.previousConnection)c.connect(f.previousConnection);else throw TypeError("Next block does not have previous statement.");else if(f.outputConnection)c.connect(f.outputConnection);else if(f.previousConnection)c.connect(f.previousConnection);else throw TypeError("Child block does not have output or previous statement.");applyFieldTagNodes$$module$build$src$core$xml(g.field,f);applyInputTagNodes$$module$build$src$core$xml(g.input,b,f,e);applyNextTagNodes$$module$build$src$core$xml(g.next,
|
|
104
|
+
b,f);h&&f.initSvg();(b=a.getAttribute("inline"))&&f.setInputsInline("true"===b);(b=a.getAttribute("disabled"))&&f.setEnabled("true"!==b&&"disabled"!==b);(b=a.getAttribute("deletable"))&&f.setDeletable("true"===b);(b=a.getAttribute("movable"))&&f.setMovable("true"===b);(b=a.getAttribute("editable"))&&f.setEditable("true"===b);(b=a.getAttribute("collapsed"))&&f.setCollapsed("true"===b);if("shadow"===a.nodeName.toLowerCase()){a=f.getChildren(!1);for(b=0;b<a.length;b++)if(!a[b].isShadow())throw TypeError("Shadow block not allowed non-shadow child.");
|
|
105
|
+
if(f.getVarModels().length)throw TypeError("Shadow blocks cannot have variable references.");f.setShadow(!0)}return f},domToField$$module$build$src$core$xml=function(a,b,c){const d=a.getField(b);d?d.fromXml(c):console.warn("Ignoring non-existent field "+b+" in block "+a.type)},deleteNext$$module$build$src$core$xml=function(a){for(let b=0;b<a.childNodes.length;b++){const c=a.childNodes[b];if("next"===c.nodeName.toLowerCase()){a.removeChild(c);break}}},register$$module$build$src$core$serialization$registry=
|
|
106
|
+
function(a,b){register$$module$build$src$core$registry(Type$$module$build$src$core$registry.SERIALIZER,a,b)},unregister$$module$build$src$core$serialization$registry=function(a){unregister$$module$build$src$core$registry(Type$$module$build$src$core$registry.SERIALIZER,a)},save$$module$build$src$core$serialization$blocks=function(a,{addCoordinates:b=!1,addInputBlocks:c=!0,addNextBlocks:d=!0,doFullSerialization:e=!0}={}){if(a.isInsertionMarker())return null;const f={type:a.type,id:a.id};b&&saveCoords$$module$build$src$core$serialization$blocks(a,
|
|
107
|
+
f);saveAttributes$$module$build$src$core$serialization$blocks(a,f);saveExtraState$$module$build$src$core$serialization$blocks(a,f);saveIcons$$module$build$src$core$serialization$blocks(a,f);saveFields$$module$build$src$core$serialization$blocks(a,f,e);c&&saveInputBlocks$$module$build$src$core$serialization$blocks(a,f,e);d&&saveNextBlocks$$module$build$src$core$serialization$blocks(a,f,e);return f},saveAttributes$$module$build$src$core$serialization$blocks=function(a,b){a.isCollapsed()&&(b.collapsed=
|
|
108
|
+
!0);a.isEnabled()||(b.enabled=!1);void 0!==a.inputsInline&&a.inputsInline!==a.inputsInlineDefault&&(b.inline=a.inputsInline);a.data&&(b.data=a.data)},saveCoords$$module$build$src$core$serialization$blocks=function(a,b){const c=a.workspace;a=a.getRelativeToSurfaceXY();b.x=Math.round(c.RTL?c.getWidth()-a.x:a.x);b.y=Math.round(a.y)},saveExtraState$$module$build$src$core$serialization$blocks=function(a,b){a.saveExtraState?(a=a.saveExtraState(),null!==a&&(b.extraState=a)):a.mutationToDom&&(a=a.mutationToDom(),
|
|
109
|
+
null!==a&&(b.extraState=domToText$$module$build$src$core$xml(a).replace(' xmlns="https://developers.google.com/blockly/xml"',"")))},saveIcons$$module$build$src$core$serialization$blocks=function(a,b){a.getCommentText()&&(b.icons={comment:{text:a.getCommentText(),pinned:a.commentModel.pinned,height:Math.round(a.commentModel.size.height),width:Math.round(a.commentModel.size.width)}})},saveFields$$module$build$src$core$serialization$blocks=function(a,b,c){const d=Object.create(null);for(let e=0;e<a.inputList.length;e++){const f=
|
|
110
|
+
a.inputList[e];for(let g=0;g<f.fieldRow.length;g++){const h=f.fieldRow[g];h.isSerializable()&&(d[h.name]=h.saveState(c))}}Object.keys(d).length&&(b.fields=d)},saveInputBlocks$$module$build$src$core$serialization$blocks=function(a,b,c){const d=Object.create(null);for(let e=0;e<a.inputList.length;e++){const f=a.inputList[e];if(f.type===inputTypes$$module$build$src$core$input_types.DUMMY)continue;const g=saveConnection$$module$build$src$core$serialization$blocks(f.connection,c);g&&(d[f.name]=g)}Object.keys(d).length&&
|
|
111
|
+
(b.inputs=d)},saveNextBlocks$$module$build$src$core$serialization$blocks=function(a,b,c){a.nextConnection&&(a=saveConnection$$module$build$src$core$serialization$blocks(a.nextConnection,c))&&(b.next=a)},saveConnection$$module$build$src$core$serialization$blocks=function(a,b){const c=a.getShadowState(!0);a=a.targetBlock();if(!c&&!a)return null;const d=Object.create(null);c&&(d.shadow=c);a&&!a.isShadow()&&(d.block=save$$module$build$src$core$serialization$blocks(a,{doFullSerialization:b}));return d},
|
|
112
|
+
append$$module$build$src$core$serialization$blocks=function(a,b,{recordUndo:c=!1}={}){return appendInternal$$module$build$src$core$serialization$blocks(a,b,{recordUndo:c})},appendInternal$$module$build$src$core$serialization$blocks=function(a,b,{parentConnection:c,isShadow:d=!1,recordUndo:e=!1}={}){const f=getRecordUndo$$module$build$src$core$events$utils();setRecordUndo$$module$build$src$core$events$utils(e);(e=getGroup$$module$build$src$core$events$utils())||setGroup$$module$build$src$core$events$utils(!0);
|
|
113
|
+
disable$$module$build$src$core$events$utils();const g=appendPrivate$$module$build$src$core$serialization$blocks(a,b,{parentConnection:c,isShadow:d});enable$$module$build$src$core$events$utils();fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CREATE$$module$build$src$core$events$utils))(g));setGroup$$module$build$src$core$events$utils(e);setRecordUndo$$module$build$src$core$events$utils(f);b.rendered&&setTimeout(()=>{g.disposed||g.setConnectionTracking(!0)},1);
|
|
114
|
+
return g},appendPrivate$$module$build$src$core$serialization$blocks=function(a,b,{parentConnection:c,isShadow:d=!1}={}){if(!a.type)throw new MissingBlockType$$module$build$src$core$serialization$exceptions(a);const e=b.newBlock(a.type,a.id);e.setShadow(d);loadCoords$$module$build$src$core$serialization$blocks(e,a);loadAttributes$$module$build$src$core$serialization$blocks(e,a);loadExtraState$$module$build$src$core$serialization$blocks(e,a);tryToConnectParent$$module$build$src$core$serialization$blocks(c,
|
|
115
|
+
e,a);loadIcons$$module$build$src$core$serialization$blocks(e,a);loadFields$$module$build$src$core$serialization$blocks(e,a);loadInputBlocks$$module$build$src$core$serialization$blocks(e,a);loadNextBlocks$$module$build$src$core$serialization$blocks(e,a);initBlock$$module$build$src$core$serialization$blocks(e,b.rendered);return e},loadCoords$$module$build$src$core$serialization$blocks=function(a,b){let c=void 0===b.x?0:b.x;b=void 0===b.y?0:b.y;const d=a.workspace;c=d.RTL?d.getWidth()-c:c;a.moveBy(c,
|
|
116
|
+
b)},loadAttributes$$module$build$src$core$serialization$blocks=function(a,b){b.collapsed&&a.setCollapsed(!0);!1===b.enabled&&a.setEnabled(!1);void 0!==b.inline&&a.setInputsInline(b.inline);void 0!==b.data&&(a.data=b.data)},loadExtraState$$module$build$src$core$serialization$blocks=function(a,b){b.extraState&&(a.loadExtraState?a.loadExtraState(b.extraState):a.domToMutation&&a.domToMutation(textToDom$$module$build$src$core$xml(b.extraState)))},tryToConnectParent$$module$build$src$core$serialization$blocks=
|
|
117
|
+
function(a,b,c){if(a){if(a.getSourceBlock().isShadow()&&!b.isShadow())throw new RealChildOfShadow$$module$build$src$core$serialization$exceptions(c);if(a.type===inputTypes$$module$build$src$core$input_types.VALUE){var d=b.outputConnection;if(!d)throw new MissingConnection$$module$build$src$core$serialization$exceptions("output",b,c);}else if(d=b.previousConnection,!d)throw new MissingConnection$$module$build$src$core$serialization$exceptions("previous",b,c);if(!a.connect(d)){const e=b.workspace.connectionChecker;
|
|
118
|
+
throw new BadConnectionCheck$$module$build$src$core$serialization$exceptions(e.getErrorMessage(e.canConnectWithReason(d,a,!1),d,a),a.type===inputTypes$$module$build$src$core$input_types.VALUE?"output connection":"previous connection",b,c);}}},loadIcons$$module$build$src$core$serialization$blocks=function(a,b){b.icons&&(b=b.icons.comment)&&(a.setCommentText(b.text),"pinned"in b&&(a.commentModel.pinned=b.pinned),"width"in b&&"height"in b&&(a.commentModel.size=new Size$$module$build$src$core$utils$size(b.width,
|
|
119
|
+
b.height)),b.pinned&&a.rendered&&!a.isInFlyout&&setTimeout(()=>a.getCommentIcon().setVisible(!0),1))},loadFields$$module$build$src$core$serialization$blocks=function(a,b){if(b.fields){var c=Object.keys(b.fields);for(let d=0;d<c.length;d++){const e=c[d],f=b.fields[e],g=a.getField(e);g?g.loadState(f):console.warn(`Ignoring non-existant field ${e} in block ${a.type}`)}}},loadInputBlocks$$module$build$src$core$serialization$blocks=function(a,b){if(b.inputs){var c=Object.keys(b.inputs);for(let d=0;d<c.length;d++){const e=
|
|
120
|
+
c[d],f=a.getInput(e);if(!f||!f.connection)throw new MissingConnection$$module$build$src$core$serialization$exceptions(e,a,b);loadConnection$$module$build$src$core$serialization$blocks(f.connection,b.inputs[e])}}},loadNextBlocks$$module$build$src$core$serialization$blocks=function(a,b){if(b.next){if(!a.nextConnection)throw new MissingConnection$$module$build$src$core$serialization$exceptions("next",a,b);loadConnection$$module$build$src$core$serialization$blocks(a.nextConnection,b.next)}},loadConnection$$module$build$src$core$serialization$blocks=
|
|
121
|
+
function(a,b){b.shadow&&a.setShadowState(b.shadow);b.block&&appendPrivate$$module$build$src$core$serialization$blocks(b.block,a.getSourceBlock().workspace,{parentConnection:a})},initBlock$$module$build$src$core$serialization$blocks=function(a,b){if(b)for(a.setConnectionTracking(!1),a.initSvg(),a.render(!1),a=a.getIcons(),b=0;b<a.length;b++)a[b].computeIconLocation();else a.initModel()},connectReciprocally$$module$build$src$core$connection=function(a,b){if(!a||!b)throw Error("Cannot connect null connections.");
|
|
122
|
+
a.targetConnection=b;b.targetConnection=a},getSingleConnection$$module$build$src$core$connection=function(a,b){let c=null;b=b.outputConnection;const d=b.getConnectionChecker();for(let e=0,f;f=a.inputList[e];e++){const g=f.connection;if(g&&d.canConnect(b,g,!1)){if(c)return null;c=g}}return c},getConnectionForOrphanedOutput$$module$build$src$core$connection=function(a,b){let c;for(;c=getSingleConnection$$module$build$src$core$connection(a,b);)if(a=c.targetBlock(),!a||a.isShadow())return c;return null},
|
|
123
|
+
toRadians$$module$build$src$core$utils$math=function(a){return a*Math.PI/180},toDegrees$$module$build$src$core$utils$math=function(a){return 180*a/Math.PI},clamp$$module$build$src$core$utils$math=function(a,b,c){if(c<a){const d=c;c=a;a=d}return Math.max(a,Math.min(b,c))},createDom$$module$build$src$core$dropdowndiv=function(){div$$module$build$src$core$dropdowndiv||(div$$module$build$src$core$dropdowndiv=document.createElement("div"),div$$module$build$src$core$dropdowndiv.className="blocklyDropDownDiv",
|
|
124
|
+
(getParentContainer$$module$build$src$core$common()||document.body).appendChild(div$$module$build$src$core$dropdowndiv),content$$module$build$src$core$dropdowndiv=document.createElement("div"),content$$module$build$src$core$dropdowndiv.className="blocklyDropDownContent",div$$module$build$src$core$dropdowndiv.appendChild(content$$module$build$src$core$dropdowndiv),arrow$$module$build$src$core$dropdowndiv=document.createElement("div"),arrow$$module$build$src$core$dropdowndiv.className="blocklyDropDownArrow",
|
|
125
|
+
div$$module$build$src$core$dropdowndiv.appendChild(arrow$$module$build$src$core$dropdowndiv),div$$module$build$src$core$dropdowndiv.style.opacity="0",div$$module$build$src$core$dropdowndiv.style.transition="transform "+ANIMATION_TIME$$module$build$src$core$dropdowndiv+"s, opacity "+ANIMATION_TIME$$module$build$src$core$dropdowndiv+"s",div$$module$build$src$core$dropdowndiv.addEventListener("focusin",function(){addClass$$module$build$src$core$utils$dom(div$$module$build$src$core$dropdowndiv,"blocklyFocused")}),
|
|
126
|
+
div$$module$build$src$core$dropdowndiv.addEventListener("focusout",function(){removeClass$$module$build$src$core$utils$dom(div$$module$build$src$core$dropdowndiv,"blocklyFocused")}))},setBoundsElement$$module$build$src$core$dropdowndiv=function(a){boundsElement$$module$build$src$core$dropdowndiv=a},getContentDiv$$module$build$src$core$dropdowndiv=function(){return content$$module$build$src$core$dropdowndiv},clearContent$$module$build$src$core$dropdowndiv=function(){content$$module$build$src$core$dropdowndiv.textContent=
|
|
127
|
+
"";content$$module$build$src$core$dropdowndiv.style.width=""},setColour$$module$build$src$core$dropdowndiv=function(a,b){div$$module$build$src$core$dropdowndiv.style.backgroundColor=a;div$$module$build$src$core$dropdowndiv.style.borderColor=b},showPositionedByBlock$$module$build$src$core$dropdowndiv=function(a,b,c,d){return showPositionedByRect$$module$build$src$core$dropdowndiv(getScaledBboxOfBlock$$module$build$src$core$dropdowndiv(b),a,c,d)},showPositionedByField$$module$build$src$core$dropdowndiv=
|
|
128
|
+
function(a,b,c){positionToField$$module$build$src$core$dropdowndiv=!0;return showPositionedByRect$$module$build$src$core$dropdowndiv(getScaledBboxOfField$$module$build$src$core$dropdowndiv(a),a,b,c)},getScaledBboxOfBlock$$module$build$src$core$dropdowndiv=function(a){var b=a.getSvgRoot();const c=a.workspace.scale,d=a.height*c;a=a.width*c;b=getPageOffset$$module$build$src$core$utils$style(b);return new Rect$$module$build$src$core$utils$rect(b.y,b.y+d,b.x,b.x+a)},getScaledBboxOfField$$module$build$src$core$dropdowndiv=
|
|
129
|
+
function(a){a=a.getScaledBBox();return new Rect$$module$build$src$core$utils$rect(a.top,a.bottom,a.left,a.right)},showPositionedByRect$$module$build$src$core$dropdowndiv=function(a,b,c,d){const e=a.left+(a.right-a.left)/2,f=a.bottom;a=a.top;d&&(a+=d);d=b.getSourceBlock();let g=d.workspace;for(;g.options.parentWorkspace;)g=g.options.parentWorkspace;setBoundsElement$$module$build$src$core$dropdowndiv(g.getParentSvg().parentNode);return show$$module$build$src$core$dropdowndiv(b,d.RTL,e,f,e,a,c)},show$$module$build$src$core$dropdowndiv=
|
|
130
|
+
function(a,b,c,d,e,f,g){owner$$module$build$src$core$dropdowndiv=a;onHide$$module$build$src$core$dropdowndiv=g||null;div$$module$build$src$core$dropdowndiv.style.direction=b?"rtl":"ltr";a=getMainWorkspace$$module$build$src$core$common();renderedClassName$$module$build$src$core$dropdowndiv=a.getRenderer().getClassName();themeClassName$$module$build$src$core$dropdowndiv=a.getTheme().getClassName();addClass$$module$build$src$core$utils$dom(div$$module$build$src$core$dropdowndiv,renderedClassName$$module$build$src$core$dropdowndiv);
|
|
131
|
+
addClass$$module$build$src$core$utils$dom(div$$module$build$src$core$dropdowndiv,themeClassName$$module$build$src$core$dropdowndiv);return positionInternal$$module$build$src$core$dropdowndiv(c,d,e,f)},getPositionBelowMetrics$$module$build$src$core$dropdowndiv=function(a,b,c,d){a=getPositionX$$module$build$src$core$dropdowndiv(a,c.left,c.right,d.width);return{initialX:a.divX,initialY:b,finalX:a.divX,finalY:b+PADDING_Y$$module$build$src$core$dropdowndiv,arrowX:a.arrowX,arrowY:-(ARROW_SIZE$$module$build$src$core$dropdowndiv/
|
|
132
|
+
2+BORDER_SIZE$$module$build$src$core$dropdowndiv),arrowAtTop:!0,arrowVisible:!0}},getPositionAboveMetrics$$module$build$src$core$dropdowndiv=function(a,b,c,d){a=getPositionX$$module$build$src$core$dropdowndiv(a,c.left,c.right,d.width);return{initialX:a.divX,initialY:b-d.height,finalX:a.divX,finalY:b-d.height-PADDING_Y$$module$build$src$core$dropdowndiv,arrowX:a.arrowX,arrowY:d.height-2*BORDER_SIZE$$module$build$src$core$dropdowndiv-ARROW_SIZE$$module$build$src$core$dropdowndiv/2,arrowAtTop:!1,arrowVisible:!0}},
|
|
133
|
+
getPositionTopOfPageMetrics$$module$build$src$core$dropdowndiv=function(a,b,c){a=getPositionX$$module$build$src$core$dropdowndiv(a,b.left,b.right,c.width);return{initialX:a.divX,initialY:0,finalX:a.divX,finalY:0,arrowAtTop:null,arrowX:null,arrowY:null,arrowVisible:!1}},getPositionX$$module$build$src$core$dropdowndiv=function(a,b,c,d){b=clamp$$module$build$src$core$utils$math(b,a-d/2,c-d);a=a-ARROW_SIZE$$module$build$src$core$dropdowndiv/2-b;c=ARROW_HORIZONTAL_PADDING$$module$build$src$core$dropdowndiv;
|
|
134
|
+
a=clamp$$module$build$src$core$utils$math(c,a,d-c-ARROW_SIZE$$module$build$src$core$dropdowndiv);return{arrowX:a,divX:b}},isVisible$$module$build$src$core$dropdowndiv=function(){return!!owner$$module$build$src$core$dropdowndiv},hideIfOwner$$module$build$src$core$dropdowndiv=function(a,b){return owner$$module$build$src$core$dropdowndiv===a?(b?hideWithoutAnimation$$module$build$src$core$dropdowndiv():hide$$module$build$src$core$dropdowndiv(),!0):!1},hide$$module$build$src$core$dropdowndiv=function(){div$$module$build$src$core$dropdowndiv.style.transform=
|
|
135
|
+
"translate(0, 0)";div$$module$build$src$core$dropdowndiv.style.opacity="0";animateOutTimer$$module$build$src$core$dropdowndiv=setTimeout(function(){hideWithoutAnimation$$module$build$src$core$dropdowndiv()},1E3*ANIMATION_TIME$$module$build$src$core$dropdowndiv);onHide$$module$build$src$core$dropdowndiv&&(onHide$$module$build$src$core$dropdowndiv(),onHide$$module$build$src$core$dropdowndiv=null)},hideWithoutAnimation$$module$build$src$core$dropdowndiv=function(){isVisible$$module$build$src$core$dropdowndiv()&&
|
|
136
|
+
(animateOutTimer$$module$build$src$core$dropdowndiv&&clearTimeout(animateOutTimer$$module$build$src$core$dropdowndiv),div$$module$build$src$core$dropdowndiv.style.transform="",div$$module$build$src$core$dropdowndiv.style.left="",div$$module$build$src$core$dropdowndiv.style.top="",div$$module$build$src$core$dropdowndiv.style.opacity="0",div$$module$build$src$core$dropdowndiv.style.display="none",div$$module$build$src$core$dropdowndiv.style.backgroundColor="",div$$module$build$src$core$dropdowndiv.style.borderColor=
|
|
137
|
+
"",onHide$$module$build$src$core$dropdowndiv&&(onHide$$module$build$src$core$dropdowndiv(),onHide$$module$build$src$core$dropdowndiv=null),clearContent$$module$build$src$core$dropdowndiv(),owner$$module$build$src$core$dropdowndiv=null,renderedClassName$$module$build$src$core$dropdowndiv&&(removeClass$$module$build$src$core$utils$dom(div$$module$build$src$core$dropdowndiv,renderedClassName$$module$build$src$core$dropdowndiv),renderedClassName$$module$build$src$core$dropdowndiv=""),themeClassName$$module$build$src$core$dropdowndiv&&
|
|
138
|
+
(removeClass$$module$build$src$core$utils$dom(div$$module$build$src$core$dropdowndiv,themeClassName$$module$build$src$core$dropdowndiv),themeClassName$$module$build$src$core$dropdowndiv=""),getMainWorkspace$$module$build$src$core$common().markFocused())},positionInternal$$module$build$src$core$dropdowndiv=function(a,b,c,d){a=internal$$module$build$src$core$dropdowndiv.getPositionMetrics(a,b,c,d);a.arrowVisible?(arrow$$module$build$src$core$dropdowndiv.style.display="",arrow$$module$build$src$core$dropdowndiv.style.transform=
|
|
139
|
+
"translate("+a.arrowX+"px,"+a.arrowY+"px) rotate(45deg)",arrow$$module$build$src$core$dropdowndiv.setAttribute("class",a.arrowAtTop?"blocklyDropDownArrow blocklyArrowTop":"blocklyDropDownArrow blocklyArrowBottom")):arrow$$module$build$src$core$dropdowndiv.style.display="none";b=Math.floor(a.initialX);c=Math.floor(a.initialY);d=Math.floor(a.finalX);const e=Math.floor(a.finalY);div$$module$build$src$core$dropdowndiv.style.left=b+"px";div$$module$build$src$core$dropdowndiv.style.top=c+"px";div$$module$build$src$core$dropdowndiv.style.display=
|
|
140
|
+
"block";div$$module$build$src$core$dropdowndiv.style.opacity="1";div$$module$build$src$core$dropdowndiv.style.transform="translate("+(d-b)+"px,"+(e-c)+"px)";return!!a.arrowAtTop},repositionForWindowResize$$module$build$src$core$dropdowndiv=function(){if(owner$$module$build$src$core$dropdowndiv){var a=owner$$module$build$src$core$dropdowndiv.getSourceBlock();a=positionToField$$module$build$src$core$dropdowndiv?getScaledBboxOfField$$module$build$src$core$dropdowndiv(owner$$module$build$src$core$dropdowndiv):
|
|
141
|
+
getScaledBboxOfBlock$$module$build$src$core$dropdowndiv(a);const b=a.left+(a.right-a.left)/2;positionInternal$$module$build$src$core$dropdowndiv(b,a.bottom,b,a.top)}else hide$$module$build$src$core$dropdowndiv()},startsWith$$module$build$src$core$utils$string=function(a,b){warn$$module$build$src$core$utils$deprecation("Blockly.utils.string.startsWith()","April 2022","April 2023","Use built-in string.startsWith");return a.startsWith(b)},shortestStringLength$$module$build$src$core$utils$string=function(a){return a.length?
|
|
142
|
+
a.reduce(function(b,c){return b.length<c.length?b:c}).length:0},commonWordPrefix$$module$build$src$core$utils$string=function(a,b){if(!a.length)return 0;if(1===a.length)return a[0].length;let c=0;b=b||shortestStringLength$$module$build$src$core$utils$string(a);let d;for(d=0;d<b;d++){var e=a[0][d];for(var f=1;f<a.length;f++)if(e!==a[f][d])return c;" "===e&&(c=d+1)}for(e=1;e<a.length;e++)if((f=a[e][d])&&" "!==f)return c;return b},commonWordSuffix$$module$build$src$core$utils$string=function(a,b){if(!a.length)return 0;
|
|
143
|
+
if(1===a.length)return a[0].length;let c=0;b=b||shortestStringLength$$module$build$src$core$utils$string(a);let d;for(d=0;d<b;d++){var e=a[0].substr(-d-1,1);for(var f=1;f<a.length;f++)if(e!==a[f].substr(-d-1,1))return c;" "===e&&(c=d+1)}for(e=1;e<a.length;e++)if((f=a[e].charAt(a[e].length-d-1))&&" "!==f)return c;return b},wrap$$module$build$src$core$utils$string=function(a,b){a=a.split("\n");for(let c=0;c<a.length;c++)a[c]=wrapLine$$module$build$src$core$utils$string(a[c],b);return a.join("\n")},
|
|
144
|
+
wrapLine$$module$build$src$core$utils$string=function(a,b){if(a.length<=b)return a;const c=a.trim().split(/\s+/);for(var d=0;d<c.length;d++)c[d].length>b&&(b=c[d].length);var e=-Infinity;let f,g=1;do{d=e;f=a;a=[];e=c.length/g;let h=1;for(let k=0;k<c.length-1;k++)h<(k+1.5)/e?(h++,a[k]=!0):a[k]=!1;a=wrapMutate$$module$build$src$core$utils$string(c,a,b);e=wrapScore$$module$build$src$core$utils$string(c,a,b);a=wrapToText$$module$build$src$core$utils$string(c,a);g++}while(e>d);return f},wrapScore$$module$build$src$core$utils$string=
|
|
145
|
+
function(a,b,c){const d=[0],e=[];for(var f=0;f<a.length;f++)d[d.length-1]+=a[f].length,!0===b[f]?(d.push(0),e.push(a[f].charAt(a[f].length-1))):!1===b[f]&&d[d.length-1]++;a=Math.max(...d);b=0;for(f=0;f<d.length;f++)b-=2*Math.pow(Math.abs(c-d[f]),1.5),b-=Math.pow(a-d[f],1.5),-1!==".?!".indexOf(e[f])?b+=c/3:-1!==",;)]}".indexOf(e[f])&&(b+=c/4);1<d.length&&d[d.length-1]<=d[d.length-2]&&(b+=.5);return b},wrapMutate$$module$build$src$core$utils$string=function(a,b,c){let d=wrapScore$$module$build$src$core$utils$string(a,
|
|
146
|
+
b,c),e;for(let f=0;f<b.length-1;f++){if(b[f]===b[f+1])continue;const g=[].concat(b);g[f]=!g[f];g[f+1]=!g[f+1];const h=wrapScore$$module$build$src$core$utils$string(a,g,c);h>d&&(d=h,e=g)}return e?wrapMutate$$module$build$src$core$utils$string(a,e,c):b},wrapToText$$module$build$src$core$utils$string=function(a,b){const c=[];for(let d=0;d<a.length;d++)c.push(a[d]),void 0!==b[d]&&c.push(b[d]?"\n":" ");return c.join("")},isNumber$$module$build$src$core$utils$string=function(a){return/^\s*-?\d+(\.\d+)?\s*$/.test(a)},
|
|
147
|
+
setCustomTooltip$$module$build$src$core$tooltip=function(a){customTooltip$$module$build$src$core$tooltip=a},getCustomTooltip$$module$build$src$core$tooltip=function(){return customTooltip$$module$build$src$core$tooltip},isVisible$$module$build$src$core$tooltip=function(){return visible$$module$build$src$core$tooltip},getDiv$$module$build$src$core$tooltip=function(){return containerDiv$$module$build$src$core$tooltip},getTooltipOfObject$$module$build$src$core$tooltip=function(a){if(a=getTargetObject$$module$build$src$core$tooltip(a)){for(a=
|
|
148
|
+
a.tooltip;"function"===typeof a;)a=a();if("string"!==typeof a)throw Error("Tooltip function must return a string.");return a}return""},getTargetObject$$module$build$src$core$tooltip=function(a){for(;a&&a.tooltip;){if("string"===typeof a.tooltip||"function"===typeof a.tooltip)return a;a=a.tooltip}return null},createDom$$module$build$src$core$tooltip=function(){containerDiv$$module$build$src$core$tooltip||(containerDiv$$module$build$src$core$tooltip=document.createElement("div"),containerDiv$$module$build$src$core$tooltip.className=
|
|
149
|
+
"blocklyTooltipDiv",(getParentContainer$$module$build$src$core$common()||document.body).appendChild(containerDiv$$module$build$src$core$tooltip))},bindMouseEvents$$module$build$src$core$tooltip=function(a){a.mouseOverWrapper_=bind$$module$build$src$core$browser_events(a,"mouseover",null,onMouseOver$$module$build$src$core$tooltip);a.mouseOutWrapper_=bind$$module$build$src$core$browser_events(a,"mouseout",null,onMouseOut$$module$build$src$core$tooltip);a.addEventListener("mousemove",onMouseMove$$module$build$src$core$tooltip,
|
|
150
|
+
!1)},unbindMouseEvents$$module$build$src$core$tooltip=function(a){a&&(unbind$$module$build$src$core$browser_events(a.mouseOverWrapper_),unbind$$module$build$src$core$browser_events(a.mouseOutWrapper_),a.removeEventListener("mousemove",onMouseMove$$module$build$src$core$tooltip))},onMouseOver$$module$build$src$core$tooltip=function(a){blocked$$module$build$src$core$tooltip||(a=getTargetObject$$module$build$src$core$tooltip(a.currentTarget),element$$module$build$src$core$tooltip!==a&&(hide$$module$build$src$core$tooltip(),
|
|
151
|
+
poisonedElement$$module$build$src$core$tooltip=null,element$$module$build$src$core$tooltip=a),clearTimeout(mouseOutPid$$module$build$src$core$tooltip))},onMouseOut$$module$build$src$core$tooltip=function(a){blocked$$module$build$src$core$tooltip||(mouseOutPid$$module$build$src$core$tooltip=setTimeout(function(){poisonedElement$$module$build$src$core$tooltip=element$$module$build$src$core$tooltip=null;hide$$module$build$src$core$tooltip()},1),clearTimeout(showPid$$module$build$src$core$tooltip))},
|
|
152
|
+
onMouseMove$$module$build$src$core$tooltip=function(a){if(element$$module$build$src$core$tooltip&&element$$module$build$src$core$tooltip.tooltip&&!blocked$$module$build$src$core$tooltip)if(visible$$module$build$src$core$tooltip){const b=lastX$$module$build$src$core$tooltip-a.pageX;a=lastY$$module$build$src$core$tooltip-a.pageY;Math.sqrt(b*b+a*a)>RADIUS_OK$$module$build$src$core$tooltip&&hide$$module$build$src$core$tooltip()}else poisonedElement$$module$build$src$core$tooltip!==element$$module$build$src$core$tooltip&&
|
|
153
|
+
(clearTimeout(showPid$$module$build$src$core$tooltip),lastX$$module$build$src$core$tooltip=a.pageX,lastY$$module$build$src$core$tooltip=a.pageY,showPid$$module$build$src$core$tooltip=setTimeout(show$$module$build$src$core$tooltip,HOVER_MS$$module$build$src$core$tooltip))},dispose$$module$build$src$core$tooltip=function(){poisonedElement$$module$build$src$core$tooltip=element$$module$build$src$core$tooltip=null;hide$$module$build$src$core$tooltip()},hide$$module$build$src$core$tooltip=function(){visible$$module$build$src$core$tooltip&&
|
|
154
|
+
(visible$$module$build$src$core$tooltip=!1,containerDiv$$module$build$src$core$tooltip&&(containerDiv$$module$build$src$core$tooltip.style.display="none"));showPid$$module$build$src$core$tooltip&&clearTimeout(showPid$$module$build$src$core$tooltip)},block$$module$build$src$core$tooltip=function(){hide$$module$build$src$core$tooltip();blocked$$module$build$src$core$tooltip=!0},unblock$$module$build$src$core$tooltip=function(){blocked$$module$build$src$core$tooltip=!1},renderContent$$module$build$src$core$tooltip=
|
|
155
|
+
function(){containerDiv$$module$build$src$core$tooltip&&element$$module$build$src$core$tooltip&&("function"===typeof customTooltip$$module$build$src$core$tooltip?customTooltip$$module$build$src$core$tooltip(containerDiv$$module$build$src$core$tooltip,element$$module$build$src$core$tooltip):renderDefaultContent$$module$build$src$core$tooltip())},renderDefaultContent$$module$build$src$core$tooltip=function(){var a=getTooltipOfObject$$module$build$src$core$tooltip(element$$module$build$src$core$tooltip);
|
|
156
|
+
a=wrap$$module$build$src$core$utils$string(a,LIMIT$$module$build$src$core$tooltip);a=a.split("\n");for(let b=0;b<a.length;b++){const c=document.createElement("div");c.appendChild(document.createTextNode(a[b]));containerDiv$$module$build$src$core$tooltip.appendChild(c)}},getPosition$$module$build$src$core$tooltip=function(a){const b=document.documentElement.clientWidth,c=document.documentElement.clientHeight;let d=lastX$$module$build$src$core$tooltip;d=a?d-(OFFSET_X$$module$build$src$core$tooltip+
|
|
157
|
+
containerDiv$$module$build$src$core$tooltip.offsetWidth):d+OFFSET_X$$module$build$src$core$tooltip;let e=lastY$$module$build$src$core$tooltip+OFFSET_Y$$module$build$src$core$tooltip;e+containerDiv$$module$build$src$core$tooltip.offsetHeight>c+window.scrollY&&(e-=containerDiv$$module$build$src$core$tooltip.offsetHeight+2*OFFSET_Y$$module$build$src$core$tooltip);a?d=Math.max(MARGINS$$module$build$src$core$tooltip-window.scrollX,d):d+containerDiv$$module$build$src$core$tooltip.offsetWidth>b+window.scrollX-
|
|
158
|
+
2*MARGINS$$module$build$src$core$tooltip&&(d=b-containerDiv$$module$build$src$core$tooltip.offsetWidth-2*MARGINS$$module$build$src$core$tooltip);return{x:d,y:e}},show$$module$build$src$core$tooltip=function(){if(!blocked$$module$build$src$core$tooltip&&(poisonedElement$$module$build$src$core$tooltip=element$$module$build$src$core$tooltip,containerDiv$$module$build$src$core$tooltip)){containerDiv$$module$build$src$core$tooltip.textContent="";renderContent$$module$build$src$core$tooltip();var a=element$$module$build$src$core$tooltip.RTL;
|
|
159
|
+
containerDiv$$module$build$src$core$tooltip.style.direction=a?"rtl":"ltr";containerDiv$$module$build$src$core$tooltip.style.display="block";visible$$module$build$src$core$tooltip=!0;var {x:b,y:c}=getPosition$$module$build$src$core$tooltip(a);containerDiv$$module$build$src$core$tooltip.style.left=b+"px";containerDiv$$module$build$src$core$tooltip.style.top=c+"px"}},getHsvSaturation$$module$build$src$core$utils$colour=function(){return hsvSaturation$$module$build$src$core$utils$colour},setHsvSaturation$$module$build$src$core$utils$colour=
|
|
160
|
+
function(a){hsvSaturation$$module$build$src$core$utils$colour=a},getHsvValue$$module$build$src$core$utils$colour=function(){return hsvValue$$module$build$src$core$utils$colour},setHsvValue$$module$build$src$core$utils$colour=function(a){hsvValue$$module$build$src$core$utils$colour=a},parse$$module$build$src$core$utils$colour=function(a){a=String(a).toLowerCase().trim();var b=names$$module$build$src$core$utils$colour[a];if(b)return b;b="0x"===a.substring(0,2)?"#"+a.substring(2):a;b="#"===b[0]?b:"#"+
|
|
161
|
+
b;if(/^#[0-9a-f]{6}$/.test(b))return b;if(/^#[0-9a-f]{3}$/.test(b))return["#",b[1],b[1],b[2],b[2],b[3],b[3]].join("");var c=a.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return c&&(a=Number(c[1]),b=Number(c[2]),c=Number(c[3]),0<=a&&256>a&&0<=b&&256>b&&0<=c&&256>c)?rgbToHex$$module$build$src$core$utils$colour(a,b,c):null},rgbToHex$$module$build$src$core$utils$colour=function(a,b,c){b=a<<16|b<<8|c;return 16>a?"#"+(16777216|b).toString(16).substr(1):"#"+b.toString(16)},hexToRgb$$module$build$src$core$utils$colour=
|
|
162
|
+
function(a){a=parse$$module$build$src$core$utils$colour(a);if(!a)return[0,0,0];a=parseInt(a.substr(1),16);return[a>>16,a>>8&255,a&255]},hsvToHex$$module$build$src$core$utils$colour=function(a,b,c){let d=0,e=0,f=0;if(0===b)f=e=d=c;else{const g=Math.floor(a/60),h=a/60-g;a=c*(1-b);const k=c*(1-b*h);b=c*(1-b*(1-h));switch(g){case 1:d=k;e=c;f=a;break;case 2:d=a;e=c;f=b;break;case 3:d=a;e=k;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c;e=a;f=k;break;case 6:case 0:d=c,e=b,f=a}}return rgbToHex$$module$build$src$core$utils$colour(Math.floor(d),
|
|
163
|
+
Math.floor(e),Math.floor(f))},blend$$module$build$src$core$utils$colour=function(a,b,c){a=parse$$module$build$src$core$utils$colour(a);if(!a)return null;b=parse$$module$build$src$core$utils$colour(b);if(!b)return null;a=hexToRgb$$module$build$src$core$utils$colour(a);b=hexToRgb$$module$build$src$core$utils$colour(b);return rgbToHex$$module$build$src$core$utils$colour(Math.round(b[0]+c*(a[0]-b[0])),Math.round(b[1]+c*(a[1]-b[1])),Math.round(b[2]+c*(a[2]-b[2])))},hueToHex$$module$build$src$core$utils$colour=
|
|
164
|
+
function(a){return hsvToHex$$module$build$src$core$utils$colour(a,hsvSaturation$$module$build$src$core$utils$colour,255*hsvValue$$module$build$src$core$utils$colour)},tokenizeInterpolationInternal$$module$build$src$core$utils$parsing=function(a,b){const c=[];var d=a.split("");d.push("");var e=0;a=[];let f=null;for(let k=0;k<d.length;k++){var g=d[k];if(0===e)"%"===g?((e=a.join(""))&&c.push(e),a.length=0,e=1):a.push(g);else if(1===e)"%"===g?(a.push(g),e=0):b&&"0"<=g&&"9">=g?(e=2,f=g,(g=a.join(""))&&
|
|
165
|
+
c.push(g),a.length=0):"{"===g?e=3:(a.push("%",g),e=0);else if(2===e)if("0"<=g&&"9">=g)f+=g;else{var h=void 0;c.push(parseInt(null!=(h=f)?h:"",10));k--;e=0}else 3===e&&(""===g?(a.splice(0,0,"%{"),k--,e=0):"}"!==g?a.push(g):(e=a.join(""),/[A-Z]\w*/i.test(e)?(g=e.toUpperCase(),(g=g.startsWith("BKY_")?g.substring(4):null)&&g in Msg$$module$build$src$core$msg?(e=Msg$$module$build$src$core$msg[g],"string"===typeof e?Array.prototype.push.apply(c,tokenizeInterpolationInternal$$module$build$src$core$utils$parsing(e,
|
|
166
|
+
b)):b?c.push(String(e)):c.push(e)):c.push("%{"+e+"}")):c.push("%{"+e+"}"),e=a.length=0))}(b=a.join(""))&&c.push(b);h=[];a.length=0;for(d=0;d<c.length;d++)"string"===typeof c[d]?a.push(c[d]):((b=a.join(""))&&h.push(b),a.length=0,h.push(c[d]));(b=a.join(""))&&h.push(b);a.length=0;return h},tokenizeInterpolation$$module$build$src$core$utils$parsing=function(a){return tokenizeInterpolationInternal$$module$build$src$core$utils$parsing(a,!0)},replaceMessageReferences$$module$build$src$core$utils$parsing=
|
|
167
|
+
function(a){if("string"!==typeof a)return a;a=tokenizeInterpolationInternal$$module$build$src$core$utils$parsing(a,!1);return a.length?String(a[0]):""},checkMessageReferences$$module$build$src$core$utils$parsing=function(a){let b=!0;const c=Msg$$module$build$src$core$msg,d=a.match(/%{BKY_[A-Z]\w*}/ig);if(d)for(let e=0;e<d.length;e++){const f=d[e].toUpperCase();void 0===c[f.slice(6,-1)]&&(console.warn("No message string for "+d[e]+" in "+a),b=!1)}return b},parseBlockColour$$module$build$src$core$utils$parsing=
|
|
168
|
+
function(a){const b="string"===typeof a?replaceMessageReferences$$module$build$src$core$utils$parsing(a):a;var c=Number(b);if(!isNaN(c)&&0<=c&&360>=c)return{hue:c,hex:hsvToHex$$module$build$src$core$utils$colour(c,getHsvSaturation$$module$build$src$core$utils$colour(),255*getHsvValue$$module$build$src$core$utils$colour())};if(c=parse$$module$build$src$core$utils$colour(b))return{hue:null,hex:c};c='Invalid colour: "'+b+'"';a!==b&&(c+=' (from "'+a+'")');throw Error(c);},getDiv$$module$build$src$core$widgetdiv=
|
|
169
|
+
function(){return containerDiv$$module$build$src$core$widgetdiv},testOnly_setDiv$$module$build$src$core$widgetdiv=function(a){containerDiv$$module$build$src$core$widgetdiv=a},createDom$$module$build$src$core$widgetdiv=function(){containerDiv$$module$build$src$core$widgetdiv||(containerDiv$$module$build$src$core$widgetdiv=document.createElement("div"),containerDiv$$module$build$src$core$widgetdiv.className="blocklyWidgetDiv",(getParentContainer$$module$build$src$core$common()||document.body).appendChild(containerDiv$$module$build$src$core$widgetdiv))},
|
|
170
|
+
show$$module$build$src$core$widgetdiv=function(a,b,c){hide$$module$build$src$core$widgetdiv();owner$$module$build$src$core$widgetdiv=a;dispose$$module$build$src$core$widgetdiv=c;if(a=containerDiv$$module$build$src$core$widgetdiv)a.style.direction=b?"rtl":"ltr",a.style.display="block",b=getMainWorkspace$$module$build$src$core$common(),rendererClassName$$module$build$src$core$widgetdiv=b.getRenderer().getClassName(),themeClassName$$module$build$src$core$widgetdiv=b.getTheme().getClassName(),addClass$$module$build$src$core$utils$dom(a,
|
|
171
|
+
rendererClassName$$module$build$src$core$widgetdiv),addClass$$module$build$src$core$utils$dom(a,themeClassName$$module$build$src$core$widgetdiv)},hide$$module$build$src$core$widgetdiv=function(){if(isVisible$$module$build$src$core$widgetdiv()){owner$$module$build$src$core$widgetdiv=null;var a=containerDiv$$module$build$src$core$widgetdiv;a&&(a.style.display="none",a.style.left="",a.style.top="",dispose$$module$build$src$core$widgetdiv&&dispose$$module$build$src$core$widgetdiv(),dispose$$module$build$src$core$widgetdiv=
|
|
172
|
+
null,a.textContent="",rendererClassName$$module$build$src$core$widgetdiv&&(removeClass$$module$build$src$core$utils$dom(a,rendererClassName$$module$build$src$core$widgetdiv),rendererClassName$$module$build$src$core$widgetdiv=""),themeClassName$$module$build$src$core$widgetdiv&&(removeClass$$module$build$src$core$utils$dom(a,themeClassName$$module$build$src$core$widgetdiv),themeClassName$$module$build$src$core$widgetdiv=""),getMainWorkspace$$module$build$src$core$common().markFocused())}},isVisible$$module$build$src$core$widgetdiv=
|
|
173
|
+
function(){return!!owner$$module$build$src$core$widgetdiv},hideIfOwner$$module$build$src$core$widgetdiv=function(a){owner$$module$build$src$core$widgetdiv===a&&hide$$module$build$src$core$widgetdiv()},positionInternal$$module$build$src$core$widgetdiv=function(a,b,c){containerDiv$$module$build$src$core$widgetdiv.style.left=a+"px";containerDiv$$module$build$src$core$widgetdiv.style.top=b+"px";containerDiv$$module$build$src$core$widgetdiv.style.height=c+"px"},positionWithAnchor$$module$build$src$core$widgetdiv=
|
|
174
|
+
function(a,b,c,d){const e=calculateY$$module$build$src$core$widgetdiv(a,b,c);a=calculateX$$module$build$src$core$widgetdiv(a,b,c,d);0>e?positionInternal$$module$build$src$core$widgetdiv(a,0,c.height+e):positionInternal$$module$build$src$core$widgetdiv(a,e,c.height)},calculateX$$module$build$src$core$widgetdiv=function(a,b,c,d){return d?Math.min(Math.max(b.right-c.width,a.left),a.right-c.width):Math.max(Math.min(b.left,a.right-c.width),a.left)},calculateY$$module$build$src$core$widgetdiv=function(a,
|
|
175
|
+
b,c){return b.bottom+c.height>=a.bottom?b.top-c.height:b.bottom},register$$module$build$src$core$field_registry=function(a,b){register$$module$build$src$core$registry(Type$$module$build$src$core$registry.FIELD,a,b)},unregister$$module$build$src$core$field_registry=function(a){unregister$$module$build$src$core$registry(Type$$module$build$src$core$registry.FIELD,a)},fromJson$$module$build$src$core$field_registry=function(a){return TEST_ONLY$$module$build$src$core$field_registry.fromJsonInternal(a)},
|
|
176
|
+
fromJsonInternal$$module$build$src$core$field_registry=function(a){const b=getObject$$module$build$src$core$registry(Type$$module$build$src$core$registry.FIELD,a.type);return b?b.fromJson(a):(console.warn("Blockly could not create a field of type "+a.type+". The field is probably not being registered. This could be because the file is not loaded, the field does not register itself (Issue #1584), or the registration is not being reached."),null)},setRole$$module$build$src$core$utils$aria=function(a,
|
|
177
|
+
b){a.setAttribute(ROLE_ATTRIBUTE$$module$build$src$core$utils$aria,b)},setState$$module$build$src$core$utils$aria=function(a,b,c){Array.isArray(c)&&(c=c.join(" "));a.setAttribute(ARIA_PREFIX$$module$build$src$core$utils$aria+b,`${c}`)},validateOptions$$module$build$src$core$field_dropdown=function(a){if(!Array.isArray(a))throw TypeError("FieldDropdown options must be an array.");if(!a.length)throw TypeError("FieldDropdown options must not be an empty array.");let b=!1;for(let c=0;c<a.length;c++){const d=
|
|
178
|
+
a[c];Array.isArray(d)?"string"!==typeof d[1]?(b=!0,console.error("Invalid option["+c+"]: Each FieldDropdown option id must be a string. Found "+d[1]+" in: ",d)):d[0]&&"string"!==typeof d[0]&&"string"!==typeof d[0].src&&(b=!0,console.error("Invalid option["+c+"]: Each FieldDropdown option must have a string label or image description. Found"+d[0]+" in: ",d)):(b=!0,console.error("Invalid option["+c+"]: Each FieldDropdown option must be an array. Found: ",d))}if(b)throw TypeError("Found invalid FieldDropdown options.");
|
|
179
|
+
},inherits$$module$build$src$core$utils$object=function(a,b){warn$$module$build$src$core$utils$deprecation("Blockly.utils.object.inherits","version 9.0.0","version 10.0.0");a.superClass_=b.prototype;Object.setPrototypeOf(a,b);a.prototype=Object.create(b.prototype);a.prototype.constructor=a},mixin$$module$build$src$core$utils$object=function(a,b){warn$$module$build$src$core$utils$deprecation("Blockly.utils.object.mixin","May 2022","May 2023","Object.assign");for(const c in b)a[c]=b[c]},deepMerge$$module$build$src$core$utils$object=
|
|
180
|
+
function(a,b){for(const c in b)a[c]=null!==b[c]&&"object"===typeof b[c]?deepMerge$$module$build$src$core$utils$object(a[c]||Object.create(null),b[c]):b[c];return a},values$$module$build$src$core$utils$object=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.utils.object.values","version 9.0.0","version 10.0.0","Object.values");return Object.values(a)},convertToolboxDefToJson$$module$build$src$core$utils$toolbox=function(a){if(!a)return null;if(a instanceof Element||"string"===typeof a)a=
|
|
181
|
+
parseToolboxTree$$module$build$src$core$utils$toolbox(a),a=convertToToolboxJson$$module$build$src$core$utils$toolbox(a);validateToolbox$$module$build$src$core$utils$toolbox(a);return a},validateToolbox$$module$build$src$core$utils$toolbox=function(a){const b=a.kind;a=a.contents;if(b&&b!==FLYOUT_TOOLBOX_KIND$$module$build$src$core$utils$toolbox&&b!==CATEGORY_TOOLBOX_KIND$$module$build$src$core$utils$toolbox)throw Error("Invalid toolbox kind "+b+". Please supply either "+FLYOUT_TOOLBOX_KIND$$module$build$src$core$utils$toolbox+
|
|
182
|
+
" or "+CATEGORY_TOOLBOX_KIND$$module$build$src$core$utils$toolbox);if(!a)throw Error("Toolbox must have a contents attribute.");},convertFlyoutDefToJsonArray$$module$build$src$core$utils$toolbox=function(a){return a?a.contents?a.contents:Array.isArray(a)&&0<a.length&&!a[0].nodeType?a:xmlToJsonArray$$module$build$src$core$utils$toolbox(a):[]},hasCategories$$module$build$src$core$utils$toolbox=function(a){return TEST_ONLY$$module$build$src$core$utils$toolbox.hasCategoriesInternal(a)},hasCategoriesInternal$$module$build$src$core$utils$toolbox=
|
|
183
|
+
function(a){if(!a)return!1;const b=a.kind;return b?b===CATEGORY_TOOLBOX_KIND$$module$build$src$core$utils$toolbox:!!a.contents.filter(function(c){return"CATEGORY"===c.kind.toUpperCase()}).length},isCategoryCollapsible$$module$build$src$core$utils$toolbox=function(a){return a&&a.contents?!!a.contents.filter(function(b){return"CATEGORY"===b.kind.toUpperCase()}).length:!1},convertToToolboxJson$$module$build$src$core$utils$toolbox=function(a){const b={contents:xmlToJsonArray$$module$build$src$core$utils$toolbox(a)};
|
|
184
|
+
a instanceof Node&&addAttributes$$module$build$src$core$utils$toolbox(a,b);return b},xmlToJsonArray$$module$build$src$core$utils$toolbox=function(a){const b=[];let c=a.childNodes;c||(c=a);for(let d=0,e;e=c[d];d++){if(!e.tagName)continue;a={};const f=e.tagName.toUpperCase();a.kind=f;"BLOCK"===f?a.blockxml=e:e.childNodes&&0<e.childNodes.length&&(a.contents=xmlToJsonArray$$module$build$src$core$utils$toolbox(e));addAttributes$$module$build$src$core$utils$toolbox(e,a);b.push(a)}return b},addAttributes$$module$build$src$core$utils$toolbox=
|
|
185
|
+
function(a,b){for(let c=0;c<a.attributes.length;c++){const d=a.attributes[c];-1<d.nodeName.indexOf("css-")?(b.cssconfig=b.cssconfig||{},b.cssconfig[d.nodeName.replace("css-","")]=d.value):b[d.nodeName]=d.value}},parseToolboxTree$$module$build$src$core$utils$toolbox=function(a){if(a){if("string"===typeof a||a instanceof Element||(a=null),"string"===typeof a&&(a=textToDom$$module$build$src$core$xml(a),"xml"!==a.nodeName.toLowerCase()))throw TypeError("Toolbox should be an <xml> document.");}else a=
|
|
186
|
+
null;return a},register$$module$build$src$core$extensions=function(a,b){if("string"!==typeof a||""===a.trim())throw Error('Error: Invalid extension name "'+a+'"');if(allExtensions$$module$build$src$core$extensions[a])throw Error('Error: Extension "'+a+'" is already registered.');if("function"!==typeof b)throw Error('Error: Extension "'+a+'" must be a function');allExtensions$$module$build$src$core$extensions[a]=b},registerMixin$$module$build$src$core$extensions=function(a,b){if(!b||"object"!==typeof b)throw Error('Error: Mixin "'+
|
|
187
|
+
a+'" must be a object');register$$module$build$src$core$extensions(a,function(){this.mixin(b)})},registerMutator$$module$build$src$core$extensions=function(a,b,c,d){const e='Error when registering mutator "'+a+'": ';checkHasMutatorProperties$$module$build$src$core$extensions(e,b);const f=checkMutatorDialog$$module$build$src$core$extensions(b,e);if(c&&"function"!==typeof c)throw Error(e+'Extension "'+a+'" is not a function');register$$module$build$src$core$extensions(a,function(){f&&this.setMutator(new $.Mutator$$module$build$src$core$mutator(this,
|
|
190
188
|
d||[]));this.mixin(b);c&&c.apply(this)})},unregister$$module$build$src$core$extensions=function(a){isRegistered$$module$build$src$core$extensions(a)?delete allExtensions$$module$build$src$core$extensions[a]:console.warn('No extension mapping for name "'+a+'" found to unregister')},isRegistered$$module$build$src$core$extensions=function(a){return!!allExtensions$$module$build$src$core$extensions[a]},apply$$module$build$src$core$extensions=function(a,b,c){const d=allExtensions$$module$build$src$core$extensions[a];
|
|
191
189
|
if("function"!==typeof d)throw Error('Error: Extension "'+a+'" not found.');let e;c?checkNoMutatorProperties$$module$build$src$core$extensions(a,b):e=getMutatorProperties$$module$build$src$core$extensions(b);d.apply(b);if(c)checkHasMutatorProperties$$module$build$src$core$extensions('Error after applying mutator "'+a+'": ',b);else if(!mutatorPropertiesMatch$$module$build$src$core$extensions(e,b))throw Error('Error when applying extension "'+a+'": mutation properties changed when applying a non-mutator extension.');
|
|
192
190
|
},checkNoMutatorProperties$$module$build$src$core$extensions=function(a,b){if(getMutatorProperties$$module$build$src$core$extensions(b).length)throw Error('Error: tried to apply mutation "'+a+'" to a block that already has mutator functions. Block id: '+b.id);},checkXmlHooks$$module$build$src$core$extensions=function(a,b){return checkHasFunctionPair$$module$build$src$core$extensions(a.mutationToDom,a.domToMutation,b+" mutationToDom/domToMutation")},checkJsonHooks$$module$build$src$core$extensions=
|
|
@@ -202,8 +200,8 @@ function(a,b,c,d,e){const f=((new Date).getTime()-d.getTime())/150;1<f?removeNod
|
|
|
202
200
|
(d.x+=(a.RTL?3:-3)*c,d.y+=13*c):a.previousConnection&&(d.x+=(a.RTL?-23:23)*c,d.y+=3*c);a=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.CIRCLE,{cx:d.x,cy:d.y,r:0,fill:"none",stroke:"#888","stroke-width":10},b.getParentSvg());connectionUiStep$$module$build$src$core$block_animations(a,new Date,c)}},connectionUiStep$$module$build$src$core$block_animations=function(a,b,c){const d=((new Date).getTime()-b.getTime())/150;1<d?removeNode$$module$build$src$core$utils$dom(a):
|
|
203
201
|
(a.setAttribute("r",(25*d*c).toString()),a.style.opacity=(1-d).toString(),disconnectPid$$module$build$src$core$block_animations=setTimeout(connectionUiStep$$module$build$src$core$block_animations,10,a,b,c))},disconnectUiEffect$$module$build$src$core$block_animations=function(a){disconnectUiStop$$module$build$src$core$block_animations();a.workspace.getAudioManager().play("disconnect");if(!(1>a.workspace.scale)){var b=a.getHeightWidth().height;b=Math.atan(10/b)/Math.PI*180;a.RTL||(b*=-1);disconnectGroup$$module$build$src$core$block_animations=
|
|
204
202
|
a.getSvgRoot();disconnectUiStep$$module$build$src$core$block_animations(disconnectGroup$$module$build$src$core$block_animations,b,new Date)}},disconnectUiStep$$module$build$src$core$block_animations=function(a,b,c){const d=((new Date).getTime()-c.getTime())/200;let e="";1>=d&&(e=`skewX(${Math.round(Math.sin(d*Math.PI*3)*(1-d)*b)})`,disconnectPid$$module$build$src$core$block_animations=setTimeout(disconnectUiStep$$module$build$src$core$block_animations,10,a,b,c));a.setAttribute("transform",e)},disconnectUiStop$$module$build$src$core$block_animations=
|
|
205
|
-
function(){disconnectGroup$$module$build$src$core$block_animations&&(clearTimeout(disconnectPid$$module$build$src$core$block_animations),disconnectGroup$$module$build$src$core$block_animations.setAttribute("transform",""),disconnectGroup$$module$build$src$core$block_animations=null)},copy$$module$build$src$core$clipboard=function(a){TEST_ONLY$$module$build$src$core$clipboard.copyInternal(a)},copyInternal$$module$build$src$core$clipboard=function(a){copyData$$module$build$src$core$clipboard=
|
|
206
|
-
paste$$module$build$src$core$clipboard=function(){if(!copyData$$module$build$src$core$clipboard)return null;let a=copyData$$module$build$src$core$clipboard.source;a.isFlyout&&(a=a.targetWorkspace);return copyData$$module$build$src$core$clipboard.typeCounts&&a.isCapacityAvailable(copyData$$module$build$src$core$clipboard.typeCounts)?a.paste(copyData$$module$build$src$core$clipboard.saveInfo):null},duplicate$$module$build$src$core$clipboard=function(a){return TEST_ONLY$$module$build$src$core$clipboard.duplicateInternal(a)},
|
|
203
|
+
function(){disconnectGroup$$module$build$src$core$block_animations&&(disconnectPid$$module$build$src$core$block_animations&&clearTimeout(disconnectPid$$module$build$src$core$block_animations),disconnectGroup$$module$build$src$core$block_animations.setAttribute("transform",""),disconnectGroup$$module$build$src$core$block_animations=null)},copy$$module$build$src$core$clipboard=function(a){TEST_ONLY$$module$build$src$core$clipboard.copyInternal(a)},copyInternal$$module$build$src$core$clipboard=function(a){copyData$$module$build$src$core$clipboard=
|
|
204
|
+
a.toCopyData()},paste$$module$build$src$core$clipboard=function(){if(!copyData$$module$build$src$core$clipboard)return null;let a=copyData$$module$build$src$core$clipboard.source;a.isFlyout&&(a=a.targetWorkspace);return copyData$$module$build$src$core$clipboard.typeCounts&&a.isCapacityAvailable(copyData$$module$build$src$core$clipboard.typeCounts)?a.paste(copyData$$module$build$src$core$clipboard.saveInfo):null},duplicate$$module$build$src$core$clipboard=function(a){return TEST_ONLY$$module$build$src$core$clipboard.duplicateInternal(a)},
|
|
207
205
|
duplicateInternal$$module$build$src$core$clipboard=function(a){const b=copyData$$module$build$src$core$clipboard;copy$$module$build$src$core$clipboard(a);let c,d,e;a=null!=(e=null==(c=a.toCopyData())?void 0:null==(d=c.source)?void 0:d.paste(copyData$$module$build$src$core$clipboard.saveInfo))?e:null;copyData$$module$build$src$core$clipboard=b;return a},getCurrentBlock$$module$build$src$core$contextmenu=function(){return currentBlock$$module$build$src$core$contextmenu},setCurrentBlock$$module$build$src$core$contextmenu=
|
|
208
206
|
function(a){currentBlock$$module$build$src$core$contextmenu=a},show$$module$build$src$core$contextmenu=function(a,b,c){show$$module$build$src$core$widgetdiv(dummyOwner$$module$build$src$core$contextmenu,c,dispose$$module$build$src$core$contextmenu);if(b.length){var d=populate_$$module$build$src$core$contextmenu(b,c);menu_$$module$build$src$core$contextmenu=d;position_$$module$build$src$core$contextmenu(d,a,c);setTimeout(function(){d.focus()},1);currentBlock$$module$build$src$core$contextmenu=null}else hide$$module$build$src$core$contextmenu()},
|
|
209
207
|
populate_$$module$build$src$core$contextmenu=function(a,b){const c=new Menu$$module$build$src$core$menu;c.setRole(Role$$module$build$src$core$utils$aria.MENU);for(let d=0;d<a.length;d++){const e=a[d],f=new MenuItem$$module$build$src$core$menuitem(e.text);f.setRightToLeft(b);f.setRole(Role$$module$build$src$core$utils$aria.MENUITEM);c.addChild(f);f.setEnabled(e.enabled);if(e.enabled)f.onAction(function(){hide$$module$build$src$core$contextmenu();e.callback(e.scope)},{})}return c},position_$$module$build$src$core$contextmenu=
|
|
@@ -211,8 +209,8 @@ function(a,b,c){const d=getViewportBBox$$module$build$src$core$utils$svg_math();
|
|
|
211
209
|
if(!b)throw Error("Attempting to create a context menu when widget div is null");a.render(b);b=a.getElement();addClass$$module$build$src$core$utils$dom(b,"blocklyContextMenu");conditionalBind$$module$build$src$core$browser_events(b,"contextmenu",null,haltPropagation$$module$build$src$core$contextmenu);a.focus()},haltPropagation$$module$build$src$core$contextmenu=function(a){a.preventDefault();a.stopPropagation()},hide$$module$build$src$core$contextmenu=function(){hideIfOwner$$module$build$src$core$widgetdiv(dummyOwner$$module$build$src$core$contextmenu);
|
|
212
210
|
currentBlock$$module$build$src$core$contextmenu=null},dispose$$module$build$src$core$contextmenu=function(){menu_$$module$build$src$core$contextmenu&&(menu_$$module$build$src$core$contextmenu.dispose(),menu_$$module$build$src$core$contextmenu=null)},callbackFactory$$module$build$src$core$contextmenu=function(a,b){return()=>{disable$$module$build$src$core$events$utils();let c;try{c=domToBlock$$module$build$src$core$xml(b,a.workspace);const d=a.getRelativeToSurfaceXY();d.x=a.RTL?d.x-$.config$$module$build$src$core$config.snapRadius:
|
|
213
211
|
d.x+$.config$$module$build$src$core$config.snapRadius;d.y+=2*$.config$$module$build$src$core$config.snapRadius;c.moveBy(d.x,d.y)}finally{enable$$module$build$src$core$events$utils()}isEnabled$$module$build$src$core$events$utils()&&!c.isShadow()&&fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CREATE$$module$build$src$core$events$utils))(c));c.select()}},commentDeleteOption$$module$build$src$core$contextmenu=function(a){return{text:Msg$$module$build$src$core$msg.REMOVE_COMMENT,
|
|
214
|
-
enabled:!0,callback:function(){setGroup$$module$build$src$core$events$utils(!0);a.dispose();setGroup$$module$build$src$core$events$utils(!1)}}},commentDuplicateOption$$module$build$src$core$contextmenu=function(a){return{text:Msg$$module$build$src$core$msg.DUPLICATE_COMMENT,enabled:!0,callback:function(){duplicate$$module$build$src$core$clipboard(a)}}},workspaceCommentOption$$module$build$src$core$contextmenu=function(a,b){const c={enabled:!
|
|
215
|
-
|
|
212
|
+
enabled:!0,callback:function(){setGroup$$module$build$src$core$events$utils(!0);a.dispose();setGroup$$module$build$src$core$events$utils(!1)}}},commentDuplicateOption$$module$build$src$core$contextmenu=function(a){return{text:Msg$$module$build$src$core$msg.DUPLICATE_COMMENT,enabled:!0,callback:function(){duplicate$$module$build$src$core$clipboard(a)}}},workspaceCommentOption$$module$build$src$core$contextmenu=function(a,b){const c={enabled:!0};c.text=Msg$$module$build$src$core$msg.ADD_COMMENT;c.callback=
|
|
213
|
+
function(){const d=new WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg(a,Msg$$module$build$src$core$msg.WORKSPACE_COMMENT_DEFAULT_TEXT,WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg.DEFAULT_SIZE,WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg.DEFAULT_SIZE);var e=a.getInjectionDiv().getBoundingClientRect();e=new Coordinate$$module$build$src$core$utils$coordinate(b.clientX-e.left,b.clientY-e.top);const f=a.getOriginOffsetInPixels();e=Coordinate$$module$build$src$core$utils$coordinate.difference(e,
|
|
216
214
|
f);e.scale(1/a.scale);d.moveBy(e.x,e.y);a.rendered&&(d.initSvg(),d.render(),d.select())};return c},point$$module$build$src$core$utils$svg_paths=function(a,b){return" "+a+","+b+" "},curve$$module$build$src$core$utils$svg_paths=function(a,b){return" "+a+b.join("")},moveTo$$module$build$src$core$utils$svg_paths=function(a,b){return" M "+a+","+b+" "},moveBy$$module$build$src$core$utils$svg_paths=function(a,b){return" m "+a+","+b+" "},lineTo$$module$build$src$core$utils$svg_paths=function(a,b){return" l "+
|
|
217
215
|
a+","+b+" "},line$$module$build$src$core$utils$svg_paths=function(a){return" l"+a.join("")},lineOnAxis$$module$build$src$core$utils$svg_paths=function(a,b){return" "+a+" "+b+" "},arc$$module$build$src$core$utils$svg_paths=function(a,b,c,d){return a+" "+c+" "+c+" "+b+d},getStartPositionRect$$module$build$src$core$positionable_helpers=function(a,b,c,d,e,f){const g=f.scrollbar&&f.scrollbar.canScrollVertically();a.horizontal===horizontalPosition$$module$build$src$core$positionable_helpers.LEFT?(c=e.absoluteMetrics.left+
|
|
218
216
|
c,g&&f.RTL&&(c+=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness)):(c=e.absoluteMetrics.left+e.viewMetrics.width-b.width-c,g&&!f.RTL&&(c-=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness));a.vertical===verticalPosition$$module$build$src$core$positionable_helpers.TOP?a=e.absoluteMetrics.top+d:(a=e.absoluteMetrics.top+e.viewMetrics.height-b.height-d,f.scrollbar&&f.scrollbar.canScrollHorizontally()&&(a-=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness));return new Rect$$module$build$src$core$utils$rect(a,
|
|
@@ -233,10 +231,10 @@ preconditionFn(e){return!Gesture$$module$build$src$core$gesture.inProgress()&&!e
|
|
|
233
231
|
registerUndo$$module$build$src$core$shortcut_items();registerRedo$$module$build$src$core$shortcut_items()},allProcedures$$module$build$src$core$procedures=function(a){const b=a.getBlocksByType("procedures_defnoreturn",!1).map(function(c){return c.getProcedureDef()});a=a.getBlocksByType("procedures_defreturn",!1).map(function(c){return c.getProcedureDef()});b.sort(procTupleComparator$$module$build$src$core$procedures);a.sort(procTupleComparator$$module$build$src$core$procedures);return[b,a]},procTupleComparator$$module$build$src$core$procedures=
|
|
234
232
|
function(a,b){return a[0].localeCompare(b[0],void 0,{sensitivity:"base"})},findLegalName$$module$build$src$core$procedures=function(a,b){if(b.isInFlyout)return a;for(a=a||Msg$$module$build$src$core$msg.UNNAMED_KEY||"unnamed";!isLegalName$$module$build$src$core$procedures(a,b.workspace,b);){const c=a.match(/^(.*?)(\d+)$/);a=c?c[1]+(parseInt(c[2],10)+1):a+"2"}return a},isLegalName$$module$build$src$core$procedures=function(a,b,c){return!isNameUsed$$module$build$src$core$procedures(a,b,c)},isNameUsed$$module$build$src$core$procedures=
|
|
235
233
|
function(a,b,c){b=b.getAllBlocks(!1);for(let e=0;e<b.length;e++)if(b[e]!==c){var d=b[e];if(d.getProcedureDef&&(d=d.getProcedureDef(),Names$$module$build$src$core$names.equals(d[0],a)))return!0}return!1},rename$$module$build$src$core$procedures=function(a){a=a.trim();const b=findLegalName$$module$build$src$core$procedures(a,this.getSourceBlock()),c=this.getValue();if(c!==a&&c!==b){a=this.getSourceBlock().workspace.getAllBlocks(!1);for(let d=0;d<a.length;d++){const e=a[d];e.renameProcedure&&e.renameProcedure(c,
|
|
236
|
-
b)}}return b},flyoutCategory$$module$build$src$core$procedures=function(a){function b(f,g){for(let k=0;k<f.length;k++){var h=f[k][0];const l=f[k][1],m=createElement$$module$build$src$core$utils$xml("block");m.setAttribute("type",g);m.setAttribute("gap",16);const n=createElement$$module$build$src$core$utils$xml("mutation");n.setAttribute("name",h);m.appendChild(n);for(h=0;h<l.length;h++){const p=createElement$$module$build$src$core$utils$xml("arg");p.setAttribute("name",l[h]);n.appendChild(p)}c.push(m)}}
|
|
237
|
-
const c=[];if(Blocks$$module$build$src$core$blocks.procedures_defnoreturn){var d=createElement$$module$build$src$core$utils$xml("block");d.setAttribute("type","procedures_defnoreturn");d.setAttribute("gap",16);var e=createElement$$module$build$src$core$utils$xml("field");e.setAttribute("name","NAME");e.appendChild(createTextNode$$module$build$src$core$utils$xml(Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_PROCEDURE));d.appendChild(e);c.push(d)}Blocks$$module$build$src$core$blocks.procedures_defreturn&&
|
|
238
|
-
(d=createElement$$module$build$src$core$utils$xml("block"),d.setAttribute("type","procedures_defreturn"),d.setAttribute("gap",16),e=createElement$$module$build$src$core$utils$xml("field"),e.setAttribute("name","NAME"),e.appendChild(createTextNode$$module$build$src$core$utils$xml(Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_PROCEDURE)),d.appendChild(e),c.push(d));Blocks$$module$build$src$core$blocks.procedures_ifreturn&&(d=createElement$$module$build$src$core$utils$xml("block"),d.setAttribute("type",
|
|
239
|
-
"procedures_ifreturn"),d.setAttribute("gap",16),c.push(d));c.length&&c[c.length-1].setAttribute("gap",24);a=allProcedures$$module$build$src$core$procedures(a);b(a[0],"procedures_callnoreturn");b(a[1],"procedures_callreturn");return c},updateMutatorFlyout$$module$build$src$core$procedures=function(a){var b=[],c=a.getBlocksByType("procedures_mutatorarg",!1);for(let f=0,g;g=c[f];f++)b.push(g.getFieldValue("NAME"));c=createElement$$module$build$src$core$utils$xml("xml");const d=createElement$$module$build$src$core$utils$xml("block");
|
|
234
|
+
b)}}return b},flyoutCategory$$module$build$src$core$procedures=function(a){function b(f,g){for(let k=0;k<f.length;k++){var h=f[k][0];const l=f[k][1],m=createElement$$module$build$src$core$utils$xml("block");m.setAttribute("type",g);m.setAttribute("gap","16");const n=createElement$$module$build$src$core$utils$xml("mutation");n.setAttribute("name",h);m.appendChild(n);for(h=0;h<l.length;h++){const p=createElement$$module$build$src$core$utils$xml("arg");p.setAttribute("name",l[h]);n.appendChild(p)}c.push(m)}}
|
|
235
|
+
const c=[];if(Blocks$$module$build$src$core$blocks.procedures_defnoreturn){var d=createElement$$module$build$src$core$utils$xml("block");d.setAttribute("type","procedures_defnoreturn");d.setAttribute("gap","16");var e=createElement$$module$build$src$core$utils$xml("field");e.setAttribute("name","NAME");e.appendChild(createTextNode$$module$build$src$core$utils$xml(Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_PROCEDURE));d.appendChild(e);c.push(d)}Blocks$$module$build$src$core$blocks.procedures_defreturn&&
|
|
236
|
+
(d=createElement$$module$build$src$core$utils$xml("block"),d.setAttribute("type","procedures_defreturn"),d.setAttribute("gap","16"),e=createElement$$module$build$src$core$utils$xml("field"),e.setAttribute("name","NAME"),e.appendChild(createTextNode$$module$build$src$core$utils$xml(Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_PROCEDURE)),d.appendChild(e),c.push(d));Blocks$$module$build$src$core$blocks.procedures_ifreturn&&(d=createElement$$module$build$src$core$utils$xml("block"),d.setAttribute("type",
|
|
237
|
+
"procedures_ifreturn"),d.setAttribute("gap","16"),c.push(d));c.length&&c[c.length-1].setAttribute("gap","24");a=allProcedures$$module$build$src$core$procedures(a);b(a[0],"procedures_callnoreturn");b(a[1],"procedures_callreturn");return c},updateMutatorFlyout$$module$build$src$core$procedures=function(a){var b=[],c=a.getBlocksByType("procedures_mutatorarg",!1);for(let f=0,g;g=c[f];f++)b.push(g.getFieldValue("NAME"));c=createElement$$module$build$src$core$utils$xml("xml");const d=createElement$$module$build$src$core$utils$xml("block");
|
|
240
238
|
d.setAttribute("type","procedures_mutatorarg");const e=createElement$$module$build$src$core$utils$xml("field");e.setAttribute("name","NAME");b=generateUniqueNameFromOptions$$module$build$src$core$variables(DEFAULT_ARG$$module$build$src$core$procedures,b);b=createTextNode$$module$build$src$core$utils$xml(b);e.appendChild(b);d.appendChild(e);c.appendChild(d);a.updateToolbox(c)},mutatorOpenListener$$module$build$src$core$procedures=function(a){if(a.type===BUBBLE_OPEN$$module$build$src$core$events$utils&&
|
|
241
239
|
"mutator"===a.bubbleType&&a.isOpen&&a.blockId){a=getWorkspaceById$$module$build$src$core$common(a.workspaceId).getBlockById(a.blockId);var b=a.type;if("procedures_defnoreturn"===b||"procedures_defreturn"===b)a=a.mutator.getWorkspace(),updateMutatorFlyout$$module$build$src$core$procedures(a),a.addChangeListener(mutatorChangeListener$$module$build$src$core$procedures)}},mutatorChangeListener$$module$build$src$core$procedures=function(a){if(a.type===CREATE$$module$build$src$core$events$utils||a.type===
|
|
242
240
|
DELETE$$module$build$src$core$events$utils||a.type===CHANGE$$module$build$src$core$events$utils)a=getWorkspaceById$$module$build$src$core$common(a.workspaceId),updateMutatorFlyout$$module$build$src$core$procedures(a)},getCallers$$module$build$src$core$procedures=function(a,b){const c=[];b=b.getAllBlocks(!1);for(let e=0;e<b.length;e++){var d=b[e];d.getProcedureCall&&(d=d.getProcedureCall())&&Names$$module$build$src$core$names.equals(d,a)&&c.push(b[e])}return c},mutateCallers$$module$build$src$core$procedures=
|
|
@@ -259,8 +257,8 @@ b)},parseBlockColour$$module$build$src$core$utils=function(a){warn$$module$build
|
|
|
259
257
|
stringButtonClickHandler$$module$build$src$core$variables_dynamic=function(a){createVariableButtonHandler$$module$build$src$core$variables(a.getTargetWorkspace(),void 0,"String")},numberButtonClickHandler$$module$build$src$core$variables_dynamic=function(a){createVariableButtonHandler$$module$build$src$core$variables(a.getTargetWorkspace(),void 0,"Number")},colourButtonClickHandler$$module$build$src$core$variables_dynamic=function(a){createVariableButtonHandler$$module$build$src$core$variables(a.getTargetWorkspace(),
|
|
260
258
|
void 0,"Colour")},flyoutCategory$$module$build$src$core$variables_dynamic=function(a){let b=[],c=document.createElement("button");c.setAttribute("text",Msg$$module$build$src$core$msg.NEW_STRING_VARIABLE);c.setAttribute("callbackKey","CREATE_VARIABLE_STRING");b.push(c);c=document.createElement("button");c.setAttribute("text",Msg$$module$build$src$core$msg.NEW_NUMBER_VARIABLE);c.setAttribute("callbackKey","CREATE_VARIABLE_NUMBER");b.push(c);c=document.createElement("button");c.setAttribute("text",Msg$$module$build$src$core$msg.NEW_COLOUR_VARIABLE);
|
|
261
259
|
c.setAttribute("callbackKey","CREATE_VARIABLE_COLOUR");b.push(c);a.registerButtonCallback("CREATE_VARIABLE_STRING",stringButtonClickHandler$$module$build$src$core$variables_dynamic);a.registerButtonCallback("CREATE_VARIABLE_NUMBER",numberButtonClickHandler$$module$build$src$core$variables_dynamic);a.registerButtonCallback("CREATE_VARIABLE_COLOUR",colourButtonClickHandler$$module$build$src$core$variables_dynamic);a=flyoutCategoryBlocks$$module$build$src$core$variables_dynamic(a);return b=b.concat(a)},
|
|
262
|
-
flyoutCategoryBlocks$$module$build$src$core$variables_dynamic=function(a){a=a.getAllVariables();const b=[];if(0<a.length){if(Blocks$$module$build$src$core$blocks.variables_set_dynamic){var c=a[a.length-1];const d=createElement$$module$build$src$core$utils$xml("block");d.setAttribute("type","variables_set_dynamic");d.setAttribute("gap",24);d.appendChild(generateVariableFieldDom$$module$build$src$core$variables(c));b.push(d)}if(Blocks$$module$build$src$core$blocks.variables_get_dynamic){a.sort(VariableModel$$module$build$src$core$variable_model.compareByName);
|
|
263
|
-
for(let d=0,e;e=a[d];d++)c=createElement$$module$build$src$core$utils$xml("block"),c.setAttribute("type","variables_get_dynamic"),c.setAttribute("gap",8),c.appendChild(generateVariableFieldDom$$module$build$src$core$variables(e)),b.push(c)}}return b},resizeSvgContents$$module$build$src$core$workspace_svg=function(a){a.resizeContents()},save$$module$build$src$core$serialization$workspaces=function(a){const b=Object.create(null),c=getAllItems$$module$build$src$core$registry(Type$$module$build$src$core$registry.SERIALIZER,
|
|
260
|
+
flyoutCategoryBlocks$$module$build$src$core$variables_dynamic=function(a){a=a.getAllVariables();const b=[];if(0<a.length){if(Blocks$$module$build$src$core$blocks.variables_set_dynamic){var c=a[a.length-1];const d=createElement$$module$build$src$core$utils$xml("block");d.setAttribute("type","variables_set_dynamic");d.setAttribute("gap","24");d.appendChild(generateVariableFieldDom$$module$build$src$core$variables(c));b.push(d)}if(Blocks$$module$build$src$core$blocks.variables_get_dynamic){a.sort(VariableModel$$module$build$src$core$variable_model.compareByName);
|
|
261
|
+
for(let d=0,e;e=a[d];d++)c=createElement$$module$build$src$core$utils$xml("block"),c.setAttribute("type","variables_get_dynamic"),c.setAttribute("gap","8"),c.appendChild(generateVariableFieldDom$$module$build$src$core$variables(e)),b.push(c)}}return b},resizeSvgContents$$module$build$src$core$workspace_svg=function(a){a.resizeContents()},save$$module$build$src$core$serialization$workspaces=function(a){const b=Object.create(null),c=getAllItems$$module$build$src$core$registry(Type$$module$build$src$core$registry.SERIALIZER,
|
|
264
262
|
!0);for(const d in c){let e;const f=null==(e=c[d])?void 0:e.save(a);f&&(b[d]=f)}return b},load$$module$build$src$core$serialization$workspaces=function(a,b,{recordUndo:c=!1}={}){var d=getAllItems$$module$build$src$core$registry(Type$$module$build$src$core$registry.SERIALIZER,!0);if(d){d=Object.entries(d).sort((f,g)=>g[1].priority-f[1].priority);var e=getRecordUndo$$module$build$src$core$events$utils();setRecordUndo$$module$build$src$core$events$utils(c);(c=getGroup$$module$build$src$core$events$utils())||
|
|
265
263
|
setGroup$$module$build$src$core$events$utils(!0);startTextWidthCache$$module$build$src$core$utils$dom();b instanceof WorkspaceSvg$$module$build$src$core$workspace_svg&&b.setResizesEnabled(!1);for(const [,f]of d.reverse()){let g;null==(g=f)||g.clear(b)}for(let [f,g]of d.reverse())if(a[f]){let h;null==(h=g)||h.load(a[f],b)}b instanceof WorkspaceSvg$$module$build$src$core$workspace_svg&&b.setResizesEnabled(!0);stopTextWidthCache$$module$build$src$core$utils$dom();fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(FINISHED_LOADING$$module$build$src$core$events$utils))(b));
|
|
266
264
|
setGroup$$module$build$src$core$events$utils(c);setRecordUndo$$module$build$src$core$events$utils(e)}},bumpObjectIntoBounds$$module$build$src$core$bump_objects=function(a,b,c){const d=c.getBoundingRectangle(),e=d.right-d.left,f=clamp$$module$build$src$core$utils$math(b.top,d.top,b.top+b.height-(d.bottom-d.top))-d.top;let g=b.left;b=b.left+b.width-e;a.RTL?g=Math.min(b,g):b=Math.max(g,b);return(a=clamp$$module$build$src$core$utils$math(g,d.left,b)-d.left)||f?(c.moveBy(a,f),!0):!1},bumpIntoBoundsHandler$$module$build$src$core$bump_objects=
|
|
@@ -289,28 +287,29 @@ function(){ContextMenuRegistry$$module$build$src$core$contextmenu_registry.regis
|
|
|
289
287
|
var b=getDeletableBlocks_$$module$build$src$core$contextmenu_items(a.workspace),c=genUid$$module$build$src$core$utils$idgenerator();2>b.length?deleteNext_$$module$build$src$core$contextmenu_items(b,c):confirm$$module$build$src$core$dialog(Msg$$module$build$src$core$msg.DELETE_ALL_BLOCKS.replace("%1",String(b.length)),function(d){d&&deleteNext_$$module$build$src$core$contextmenu_items(b,c)})}},scopeType:ContextMenuRegistry$$module$build$src$core$contextmenu_registry.ScopeType.WORKSPACE,id:"workspaceDelete",
|
|
290
288
|
weight:6})},registerWorkspaceOptions_$$module$build$src$core$contextmenu_items=function(){registerUndo$$module$build$src$core$contextmenu_items();registerRedo$$module$build$src$core$contextmenu_items();registerCleanup$$module$build$src$core$contextmenu_items();registerCollapse$$module$build$src$core$contextmenu_items();registerExpand$$module$build$src$core$contextmenu_items();registerDeleteAll$$module$build$src$core$contextmenu_items()},registerDuplicate$$module$build$src$core$contextmenu_items=function(){ContextMenuRegistry$$module$build$src$core$contextmenu_registry.registry.register({displayText(){return Msg$$module$build$src$core$msg.DUPLICATE_BLOCK},
|
|
291
289
|
preconditionFn(a){a=a.block;return!a.isInFlyout&&a.isDeletable()&&a.isMovable()?a.isDuplicatable()?"enabled":"disabled":"hidden"},callback(a){a.block&&duplicate$$module$build$src$core$clipboard(a.block)},scopeType:ContextMenuRegistry$$module$build$src$core$contextmenu_registry.ScopeType.BLOCK,id:"blockDuplicate",weight:1})},registerComment$$module$build$src$core$contextmenu_items=function(){ContextMenuRegistry$$module$build$src$core$contextmenu_registry.registry.register({displayText(a){return a.block.getCommentIcon()?
|
|
292
|
-
Msg$$module$build$src$core$msg.REMOVE_COMMENT:Msg$$module$build$src$core$msg.ADD_COMMENT},preconditionFn(a){a=a.block;return
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
a.block.
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
function(){warn$$module$build$src$core$utils$deprecation("Blockly.
|
|
303
|
-
"December 2021","December 2022","Blockly.utils.
|
|
304
|
-
"December 2022","Blockly.browserEvents.
|
|
305
|
-
|
|
306
|
-
$jscomp.
|
|
307
|
-
$jscomp.
|
|
308
|
-
$jscomp.
|
|
290
|
+
Msg$$module$build$src$core$msg.REMOVE_COMMENT:Msg$$module$build$src$core$msg.ADD_COMMENT},preconditionFn(a){a=a.block;return!a.isInFlyout&&a.workspace.options.comments&&!a.isCollapsed()&&a.isEditable()?"enabled":"hidden"},callback(a){a=a.block;a.getCommentIcon()?a.setCommentText(null):a.setCommentText("")},scopeType:ContextMenuRegistry$$module$build$src$core$contextmenu_registry.ScopeType.BLOCK,id:"blockComment",weight:2})},registerInline$$module$build$src$core$contextmenu_items=function(){ContextMenuRegistry$$module$build$src$core$contextmenu_registry.registry.register({displayText(a){return a.block.getInputsInline()?
|
|
291
|
+
Msg$$module$build$src$core$msg.EXTERNAL_INPUTS:Msg$$module$build$src$core$msg.INLINE_INPUTS},preconditionFn(a){a=a.block;if(!a.isInFlyout&&a.isMovable()&&!a.isCollapsed())for(let b=1;b<a.inputList.length;b++)if(a.inputList[b-1].type!==inputTypes$$module$build$src$core$input_types.STATEMENT&&a.inputList[b].type!==inputTypes$$module$build$src$core$input_types.STATEMENT)return"enabled";return"hidden"},callback(a){a.block.setInputsInline(!a.block.getInputsInline())},scopeType:ContextMenuRegistry$$module$build$src$core$contextmenu_registry.ScopeType.BLOCK,
|
|
292
|
+
id:"blockInline",weight:3})},registerCollapseExpandBlock$$module$build$src$core$contextmenu_items=function(){ContextMenuRegistry$$module$build$src$core$contextmenu_registry.registry.register({displayText(a){return a.block.isCollapsed()?Msg$$module$build$src$core$msg.EXPAND_BLOCK:Msg$$module$build$src$core$msg.COLLAPSE_BLOCK},preconditionFn(a){a=a.block;return!a.isInFlyout&&a.isMovable()&&a.workspace.options.collapse?"enabled":"hidden"},callback(a){a.block.setCollapsed(!a.block.isCollapsed())},scopeType:ContextMenuRegistry$$module$build$src$core$contextmenu_registry.ScopeType.BLOCK,
|
|
293
|
+
id:"blockCollapseExpand",weight:4})},registerDisable$$module$build$src$core$contextmenu_items=function(){ContextMenuRegistry$$module$build$src$core$contextmenu_registry.registry.register({displayText(a){return a.block.isEnabled()?Msg$$module$build$src$core$msg.DISABLE_BLOCK:Msg$$module$build$src$core$msg.ENABLE_BLOCK},preconditionFn(a){a=a.block;return!a.isInFlyout&&a.workspace.options.disable&&a.isEditable()?a.getInheritedDisabled()?"disabled":"enabled":"hidden"},callback(a){a=a.block;const b=getGroup$$module$build$src$core$events$utils();
|
|
294
|
+
b||setGroup$$module$build$src$core$events$utils(!0);a.setEnabled(!a.isEnabled());b||setGroup$$module$build$src$core$events$utils(!1)},scopeType:ContextMenuRegistry$$module$build$src$core$contextmenu_registry.ScopeType.BLOCK,id:"blockDisable",weight:5})},registerDelete$$module$build$src$core$contextmenu_items=function(){ContextMenuRegistry$$module$build$src$core$contextmenu_registry.registry.register({displayText(a){var b=a.block;a=b.getDescendants(!1).length;(b=b.getNextBlock())&&(a-=b.getDescendants(!1).length);
|
|
295
|
+
return 1===a?Msg$$module$build$src$core$msg.DELETE_BLOCK:Msg$$module$build$src$core$msg.DELETE_X_BLOCKS.replace("%1",String(a))},preconditionFn(a){return!a.block.isInFlyout&&a.block.isDeletable()?"enabled":"hidden"},callback(a){a.block&&a.block.checkAndDelete()},scopeType:ContextMenuRegistry$$module$build$src$core$contextmenu_registry.ScopeType.BLOCK,id:"blockDelete",weight:6})},registerHelp$$module$build$src$core$contextmenu_items=function(){ContextMenuRegistry$$module$build$src$core$contextmenu_registry.registry.register({displayText(){return Msg$$module$build$src$core$msg.HELP},
|
|
296
|
+
preconditionFn(a){a=a.block;return("function"===typeof a.helpUrl?a.helpUrl():a.helpUrl)?"enabled":"hidden"},callback(a){a.block.showHelp()},scopeType:ContextMenuRegistry$$module$build$src$core$contextmenu_registry.ScopeType.BLOCK,id:"blockHelp",weight:7})},registerBlockOptions_$$module$build$src$core$contextmenu_items=function(){registerDuplicate$$module$build$src$core$contextmenu_items();registerComment$$module$build$src$core$contextmenu_items();registerInline$$module$build$src$core$contextmenu_items();
|
|
297
|
+
registerCollapseExpandBlock$$module$build$src$core$contextmenu_items();registerDisable$$module$build$src$core$contextmenu_items();registerDelete$$module$build$src$core$contextmenu_items();registerHelp$$module$build$src$core$contextmenu_items()},registerDefaultOptions$$module$build$src$core$contextmenu_items=function(){registerWorkspaceOptions_$$module$build$src$core$contextmenu_items();registerBlockOptions_$$module$build$src$core$contextmenu_items()},initIconData$$module$build$src$core$block_dragger=
|
|
298
|
+
function(a){const b=[];a=a.getDescendants(!1);for(let c=0,d;d=a[c];c++){const e=d.getIcons();for(let f=0;f<e.length;f++){const g={location:e[f].getIconLocation(),icon:e[f]};b.push(g)}}return b},hideChaff$$module$build$src$core$blockly=function(a){getMainWorkspace$$module$build$src$core$common().hideChaff(a)},resizeSvgContentsLocal$$module$build$src$core$blockly=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.resizeSvgContents","December 2021","December 2022","Blockly.WorkspaceSvg.resizeSvgContents");
|
|
299
|
+
resizeSvgContents$$module$build$src$core$workspace_svg(a)},copy$$module$build$src$core$blockly=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.copy","December 2021","December 2022","Blockly.clipboard.copy");copy$$module$build$src$core$clipboard(a)},paste$$module$build$src$core$blockly=function(){warn$$module$build$src$core$utils$deprecation("Blockly.paste","December 2021","December 2022","Blockly.clipboard.paste");return!!paste$$module$build$src$core$clipboard()},duplicate$$module$build$src$core$blockly=
|
|
300
|
+
function(a){warn$$module$build$src$core$utils$deprecation("Blockly.duplicate","December 2021","December 2022","Blockly.clipboard.duplicate");duplicate$$module$build$src$core$clipboard(a)},isNumber$$module$build$src$core$blockly=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.isNumber","December 2021","December 2022","Blockly.utils.string.isNumber");return isNumber$$module$build$src$core$utils$string(a)},hueToHex$$module$build$src$core$blockly=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.hueToHex",
|
|
301
|
+
"December 2021","December 2022","Blockly.utils.colour.hueToHex");return hueToHex$$module$build$src$core$utils$colour(a)},bindEvent_$$module$build$src$core$blockly=function(a,b,c,d){warn$$module$build$src$core$utils$deprecation("Blockly.bindEvent_","December 2021","December 2022","Blockly.browserEvents.bind");return bind$$module$build$src$core$browser_events(a,b,c,d)},unbindEvent_$$module$build$src$core$blockly=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.unbindEvent_","December 2021",
|
|
302
|
+
"December 2022","Blockly.browserEvents.unbind");return unbind$$module$build$src$core$browser_events(a)},bindEventWithChecks_$$module$build$src$core$blockly=function(a,b,c,d,e,f){warn$$module$build$src$core$utils$deprecation("Blockly.bindEventWithChecks_","December 2021","December 2022","Blockly.browserEvents.conditionalBind");return conditionalBind$$module$build$src$core$browser_events(a,b,c,d,e,f)},$jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;
|
|
303
|
+
$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};
|
|
304
|
+
$jscomp.getGlobal=function(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};
|
|
305
|
+
$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(a,b){var c=$jscomp.propertyToPolyfillSymbol[b];if(null==c)return a[b];c=a[c];return void 0!==c?c:a[b]};$jscomp.polyfill=function(a,b,c,d){b&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(a,b,c,d):$jscomp.polyfillUnisolated(a,b,c,d))};
|
|
306
|
+
$jscomp.polyfillUnisolated=function(a,b,c,d){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))return;c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})};
|
|
309
307
|
$jscomp.polyfillIsolated=function(a,b,c,d){var e=a.split(".");a=1===e.length;d=e[0];d=!a&&d in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var f=0;f<e.length-1;f++){var g=e[f];if(!(g in d))return;d=d[g]}e=e[e.length-1];c=$jscomp.IS_SYMBOL_NATIVE&&"es6"===c?d[e]:null;b=b(c);null!=b&&(a?$jscomp.defineProperty($jscomp.polyfills,e,{configurable:!0,writable:!0,value:b}):b!==c&&(void 0===$jscomp.propertyToPolyfillSymbol[e]&&(c=1E9*Math.random()>>>0,$jscomp.propertyToPolyfillSymbol[e]=$jscomp.IS_SYMBOL_NATIVE?
|
|
310
308
|
$jscomp.global.Symbol(e):$jscomp.POLYFILL_PREFIX+c+"$"+e),$jscomp.defineProperty(d,$jscomp.propertyToPolyfillSymbol[e],{configurable:!0,writable:!0,value:b})))};$jscomp.polyfill("globalThis",function(a){return a||$jscomp.global},"es_2020","es3");$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.initSymbol=function(){};
|
|
311
309
|
$jscomp.iteratorPrototype=function(a){a={next:a};a[Symbol.iterator]=function(){return this};return a};$jscomp.iteratorFromArray=function(a,b){a instanceof String&&(a+="");var c=0,d=!1,e={next:function(){if(!d&&c<a.length){var f=c++;return{value:b(f,a[f]),done:!1}}d=!0;return{done:!0,value:void 0}}};e[Symbol.iterator]=function(){return e};return e};$jscomp.polyfill("Array.prototype.values",function(a){return a?a:function(){return $jscomp.iteratorFromArray(this,function(b,c){return c})}},"es8","es3");
|
|
312
|
-
$jscomp.polyfill("Array.prototype.flat",function(a){return a?a:function(b){b=void 0===b?1:b;for(var c=[],d=0;d<this.length;d++){var e=this[d];Array.isArray(e)&&0<b?(e=Array.prototype.flat.call(e,b-1),c.push.apply(c,e)):c.push(e)}return c}},"es9","es5")
|
|
313
|
-
var global$$module$build$src$closure$goog$goog=globalThis,declareModuleId$$module$build$src$closure$goog$goog=function(a){window.goog&&window.goog.declareModuleId&&window.goog.declareModuleId.call(this,a)},module$build$src$closure$goog$goog={};module$build$src$closure$goog$goog.declareModuleId=declareModuleId$$module$build$src$closure$goog$goog;
|
|
310
|
+
$jscomp.owns=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};$jscomp.polyfill("Object.values",function(a){return a?a:function(b){var c=[],d;for(d in b)$jscomp.owns(b,d)&&c.push(b[d]);return c}},"es8","es3");$jscomp.polyfill("Array.prototype.flat",function(a){return a?a:function(b){b=void 0===b?1:b;for(var c=[],d=0;d<this.length;d++){var e=this[d];Array.isArray(e)&&0<b?(e=Array.prototype.flat.call(e,b-1),c.push.apply(c,e)):c.push(e)}return c}},"es9","es5");
|
|
311
|
+
$jscomp.polyfill("Object.entries",function(a){return a?a:function(b){var c=[],d;for(d in b)$jscomp.owns(b,d)&&c.push([d,b[d]]);return c}},"es8","es3");var global$$module$build$src$closure$goog$goog=globalThis,declareModuleId$$module$build$src$closure$goog$goog=function(a){window.goog&&window.goog.declareModuleId&&window.goog.declareModuleId.call(this,a)},module$build$src$closure$goog$goog={};module$build$src$closure$goog$goog.declareModuleId=declareModuleId$$module$build$src$closure$goog$goog;
|
|
312
|
+
module$build$src$closure$goog$goog.global=global$$module$build$src$closure$goog$goog;/*
|
|
314
313
|
|
|
315
314
|
Copyright The Closure Library Authors.
|
|
316
315
|
SPDX-License-Identifier: Apache-2.0
|
|
@@ -324,9 +323,8 @@ module$build$src$core$registry.register=register$$module$build$src$core$registry
|
|
|
324
323
|
$.module$build$src$core$common={};$.module$build$src$core$common.TEST_ONLY=TEST_ONLY$$module$build$src$core$common;$.module$build$src$core$common.createBlockDefinitionsFromJsonArray=createBlockDefinitionsFromJsonArray$$module$build$src$core$common;$.module$build$src$core$common.defineBlocks=defineBlocks$$module$build$src$core$common;$.module$build$src$core$common.defineBlocksWithJsonArray=defineBlocksWithJsonArray$$module$build$src$core$common;$.module$build$src$core$common.draggingConnections=draggingConnections$$module$build$src$core$common;
|
|
325
324
|
$.module$build$src$core$common.getAllWorkspaces=getAllWorkspaces$$module$build$src$core$common;$.module$build$src$core$common.getBlockTypeCounts=getBlockTypeCounts$$module$build$src$core$common;$.module$build$src$core$common.getMainWorkspace=getMainWorkspace$$module$build$src$core$common;$.module$build$src$core$common.getParentContainer=getParentContainer$$module$build$src$core$common;$.module$build$src$core$common.getSelected=getSelected$$module$build$src$core$common;
|
|
326
325
|
$.module$build$src$core$common.getWorkspaceById=getWorkspaceById$$module$build$src$core$common;$.module$build$src$core$common.registerWorkspace=registerWorkspace$$module$build$src$core$common;$.module$build$src$core$common.setMainWorkspace=setMainWorkspace$$module$build$src$core$common;$.module$build$src$core$common.setParentContainer=setParentContainer$$module$build$src$core$common;$.module$build$src$core$common.setSelected=setSelected$$module$build$src$core$common;
|
|
327
|
-
$.module$build$src$core$common.svgResize=svgResize$$module$build$src$core$common;$.module$build$src$core$common.unregisterWorkpace=unregisterWorkpace$$module$build$src$core$common;var
|
|
328
|
-
internal$$module$build$src$core$utils$idgenerator.genUid=
|
|
329
|
-
module$build$src$core$utils$idgenerator.getNextUniqueId=getNextUniqueId$$module$build$src$core$utils$idgenerator;var group$$module$build$src$core$events$utils="",recordUndo$$module$build$src$core$events$utils=!0,disabled$$module$build$src$core$events$utils=0,CREATE$$module$build$src$core$events$utils="create",BLOCK_CREATE$$module$build$src$core$events$utils=CREATE$$module$build$src$core$events$utils,DELETE$$module$build$src$core$events$utils="delete",BLOCK_DELETE$$module$build$src$core$events$utils=DELETE$$module$build$src$core$events$utils,CHANGE$$module$build$src$core$events$utils="change",BLOCK_CHANGE$$module$build$src$core$events$utils=
|
|
326
|
+
$.module$build$src$core$common.svgResize=svgResize$$module$build$src$core$common;$.module$build$src$core$common.unregisterWorkpace=unregisterWorkpace$$module$build$src$core$common;var soup$$module$build$src$core$utils$idgenerator="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",internal$$module$build$src$core$utils$idgenerator={genUid:()=>{const a=soup$$module$build$src$core$utils$idgenerator.length,b=[];for(let c=0;20>c;c++)b[c]=soup$$module$build$src$core$utils$idgenerator.charAt(Math.random()*a);return b.join("")}},TEST_ONLY$$module$build$src$core$utils$idgenerator=internal$$module$build$src$core$utils$idgenerator,nextId$$module$build$src$core$utils$idgenerator=
|
|
327
|
+
0,module$build$src$core$utils$idgenerator={};module$build$src$core$utils$idgenerator.TEST_ONLY=internal$$module$build$src$core$utils$idgenerator;module$build$src$core$utils$idgenerator.genUid=genUid$$module$build$src$core$utils$idgenerator;module$build$src$core$utils$idgenerator.getNextUniqueId=getNextUniqueId$$module$build$src$core$utils$idgenerator;var group$$module$build$src$core$events$utils="",recordUndo$$module$build$src$core$events$utils=!0,disabled$$module$build$src$core$events$utils=0,CREATE$$module$build$src$core$events$utils="create",BLOCK_CREATE$$module$build$src$core$events$utils=CREATE$$module$build$src$core$events$utils,DELETE$$module$build$src$core$events$utils="delete",BLOCK_DELETE$$module$build$src$core$events$utils=DELETE$$module$build$src$core$events$utils,CHANGE$$module$build$src$core$events$utils="change",BLOCK_CHANGE$$module$build$src$core$events$utils=
|
|
330
328
|
CHANGE$$module$build$src$core$events$utils,MOVE$$module$build$src$core$events$utils="move",BLOCK_MOVE$$module$build$src$core$events$utils=MOVE$$module$build$src$core$events$utils,VAR_CREATE$$module$build$src$core$events$utils="var_create",VAR_DELETE$$module$build$src$core$events$utils="var_delete",VAR_RENAME$$module$build$src$core$events$utils="var_rename",UI$$module$build$src$core$events$utils="ui",BLOCK_DRAG$$module$build$src$core$events$utils="drag",SELECTED$$module$build$src$core$events$utils=
|
|
331
329
|
"selected",CLICK$$module$build$src$core$events$utils="click",MARKER_MOVE$$module$build$src$core$events$utils="marker_move",BUBBLE_OPEN$$module$build$src$core$events$utils="bubble_open",TRASHCAN_OPEN$$module$build$src$core$events$utils="trashcan_open",TOOLBOX_ITEM_SELECT$$module$build$src$core$events$utils="toolbox_item_select",THEME_CHANGE$$module$build$src$core$events$utils="theme_change",VIEWPORT_CHANGE$$module$build$src$core$events$utils="viewport_change",COMMENT_CREATE$$module$build$src$core$events$utils=
|
|
332
330
|
"comment_create",COMMENT_DELETE$$module$build$src$core$events$utils="comment_delete",COMMENT_CHANGE$$module$build$src$core$events$utils="comment_change",COMMENT_MOVE$$module$build$src$core$events$utils="comment_move",FINISHED_LOADING$$module$build$src$core$events$utils="finished_loading",BUMP_EVENTS$$module$build$src$core$events$utils=[CREATE$$module$build$src$core$events$utils,MOVE$$module$build$src$core$events$utils,COMMENT_CREATE$$module$build$src$core$events$utils,COMMENT_MOVE$$module$build$src$core$events$utils],
|
|
@@ -343,17 +341,13 @@ if(!a)throw Error("Workspace is null. Event must have been generated from real B
|
|
|
343
341
|
var module$build$src$core$events$events_trashcan_open={};module$build$src$core$events$events_trashcan_open.TrashcanOpen=TrashcanOpen$$module$build$src$core$events$events_trashcan_open;var LONGPRESS$$module$build$src$core$touch=750,TOUCH_ENABLED$$module$build$src$core$touch="ontouchstart"in globalThis||!!(globalThis.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!globalThis.navigator||!globalThis.navigator.maxTouchPoints&&!globalThis.navigator.msMaxTouchPoints),touchIdentifier_$$module$build$src$core$touch=null,TOUCH_MAP$$module$build$src$core$touch=globalThis.PointerEvent?{mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],
|
|
344
342
|
mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]}:{mousedown:["touchstart"],mousemove:["touchmove"],mouseup:["touchend","touchcancel"]},longPid_$$module$build$src$core$touch=0,module$build$src$core$touch={};module$build$src$core$touch.TOUCH_ENABLED=TOUCH_ENABLED$$module$build$src$core$touch;module$build$src$core$touch.TOUCH_MAP=TOUCH_MAP$$module$build$src$core$touch;
|
|
345
343
|
module$build$src$core$touch.checkTouchIdentifier=checkTouchIdentifier$$module$build$src$core$touch;module$build$src$core$touch.clearTouchIdentifier=clearTouchIdentifier$$module$build$src$core$touch;module$build$src$core$touch.getTouchIdentifierFromEvent=getTouchIdentifierFromEvent$$module$build$src$core$touch;module$build$src$core$touch.isMouseOrTouchEvent=isMouseOrTouchEvent$$module$build$src$core$touch;module$build$src$core$touch.isTouchEvent=isTouchEvent$$module$build$src$core$touch;
|
|
346
|
-
module$build$src$core$touch.longStart=longStart$$module$build$src$core$touch;module$build$src$core$touch.longStop=longStop$$module$build$src$core$touch;module$build$src$core$touch.setClientFromTouch=setClientFromTouch$$module$build$src$core$touch;module$build$src$core$touch.shouldHandleEvent=shouldHandleEvent$$module$build$src$core$touch;module$build$src$core$touch.splitEventByTouches=splitEventByTouches$$module$build$src$core$touch;var rawUserAgent$$module$build$src$core$utils$useragent,
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
isIPhone$$module$build$src$core$utils$useragent
|
|
352
|
-
|
|
353
|
-
isWebKit$$module$build$src$core$utils$useragent,GECKO$$module$build$src$core$utils$useragent=isGecko$$module$build$src$core$utils$useragent,ANDROID$$module$build$src$core$utils$useragent=isAndroid$$module$build$src$core$utils$useragent,IPAD$$module$build$src$core$utils$useragent=isIPad$$module$build$src$core$utils$useragent,IPOD$$module$build$src$core$utils$useragent=isIPod$$module$build$src$core$utils$useragent,IPHONE$$module$build$src$core$utils$useragent=isIPhone$$module$build$src$core$utils$useragent,
|
|
354
|
-
MAC$$module$build$src$core$utils$useragent=isMac$$module$build$src$core$utils$useragent,TABLET$$module$build$src$core$utils$useragent=isTablet$$module$build$src$core$utils$useragent,MOBILE$$module$build$src$core$utils$useragent=isMobile$$module$build$src$core$utils$useragent,module$build$src$core$utils$useragent={};module$build$src$core$utils$useragent.ANDROID=ANDROID$$module$build$src$core$utils$useragent;module$build$src$core$utils$useragent.CHROME=CHROME$$module$build$src$core$utils$useragent;
|
|
355
|
-
module$build$src$core$utils$useragent.EDGE=EDGE$$module$build$src$core$utils$useragent;module$build$src$core$utils$useragent.GECKO=GECKO$$module$build$src$core$utils$useragent;module$build$src$core$utils$useragent.IE=IE$$module$build$src$core$utils$useragent;module$build$src$core$utils$useragent.IPAD=IPAD$$module$build$src$core$utils$useragent;module$build$src$core$utils$useragent.IPHONE=IPHONE$$module$build$src$core$utils$useragent;module$build$src$core$utils$useragent.IPOD=IPOD$$module$build$src$core$utils$useragent;
|
|
356
|
-
module$build$src$core$utils$useragent.JavaFx=JavaFx$$module$build$src$core$utils$useragent;module$build$src$core$utils$useragent.MAC=MAC$$module$build$src$core$utils$useragent;module$build$src$core$utils$useragent.MOBILE=MOBILE$$module$build$src$core$utils$useragent;module$build$src$core$utils$useragent.TABLET=TABLET$$module$build$src$core$utils$useragent;module$build$src$core$utils$useragent.WEBKIT=WEBKIT$$module$build$src$core$utils$useragent;module$build$src$core$utils$useragent.raw=raw$$module$build$src$core$utils$useragent;var LINE_MODE_MULTIPLIER$$module$build$src$core$browser_events=40,PAGE_MODE_MULTIPLIER$$module$build$src$core$browser_events=125,module$build$src$core$browser_events={};module$build$src$core$browser_events.bind=bind$$module$build$src$core$browser_events;module$build$src$core$browser_events.conditionalBind=conditionalBind$$module$build$src$core$browser_events;module$build$src$core$browser_events.getScrollDeltaPixels=getScrollDeltaPixels$$module$build$src$core$browser_events;
|
|
344
|
+
module$build$src$core$touch.longStart=longStart$$module$build$src$core$touch;module$build$src$core$touch.longStop=longStop$$module$build$src$core$touch;module$build$src$core$touch.setClientFromTouch=setClientFromTouch$$module$build$src$core$touch;module$build$src$core$touch.shouldHandleEvent=shouldHandleEvent$$module$build$src$core$touch;module$build$src$core$touch.splitEventByTouches=splitEventByTouches$$module$build$src$core$touch;var rawUserAgent$$module$build$src$core$utils$useragent,isJavaFx$$module$build$src$core$utils$useragent,isWebKit$$module$build$src$core$utils$useragent,isGecko$$module$build$src$core$utils$useragent,isAndroid$$module$build$src$core$utils$useragent,isIPad$$module$build$src$core$utils$useragent,isIPhone$$module$build$src$core$utils$useragent,isMac$$module$build$src$core$utils$useragent,isTablet$$module$build$src$core$utils$useragent,isMobile$$module$build$src$core$utils$useragent;
|
|
345
|
+
(function(a){function b(d){return-1!==c.indexOf(d.toUpperCase())}rawUserAgent$$module$build$src$core$utils$useragent=a;const c=rawUserAgent$$module$build$src$core$utils$useragent.toUpperCase();isJavaFx$$module$build$src$core$utils$useragent=b("JavaFX");isWebKit$$module$build$src$core$utils$useragent=b("WebKit");isGecko$$module$build$src$core$utils$useragent=b("Gecko")&&!isWebKit$$module$build$src$core$utils$useragent;isAndroid$$module$build$src$core$utils$useragent=b("Android");a=globalThis.navigator&&
|
|
346
|
+
globalThis.navigator.maxTouchPoints;isIPad$$module$build$src$core$utils$useragent=b("iPad")||b("Macintosh")&&0<a;isIPhone$$module$build$src$core$utils$useragent=b("iPhone")&&!isIPad$$module$build$src$core$utils$useragent;isMac$$module$build$src$core$utils$useragent=b("Macintosh");isTablet$$module$build$src$core$utils$useragent=isIPad$$module$build$src$core$utils$useragent||isAndroid$$module$build$src$core$utils$useragent&&!b("Mobile")||b("Silk");isMobile$$module$build$src$core$utils$useragent=!isTablet$$module$build$src$core$utils$useragent&&
|
|
347
|
+
(isIPhone$$module$build$src$core$utils$useragent||isAndroid$$module$build$src$core$utils$useragent)})(globalThis.navigator&&globalThis.navigator.userAgent||"");
|
|
348
|
+
var raw$$module$build$src$core$utils$useragent=rawUserAgent$$module$build$src$core$utils$useragent,JavaFx$$module$build$src$core$utils$useragent=isJavaFx$$module$build$src$core$utils$useragent,GECKO$$module$build$src$core$utils$useragent=isGecko$$module$build$src$core$utils$useragent,ANDROID$$module$build$src$core$utils$useragent=isAndroid$$module$build$src$core$utils$useragent,IPAD$$module$build$src$core$utils$useragent=isIPad$$module$build$src$core$utils$useragent,IPHONE$$module$build$src$core$utils$useragent=
|
|
349
|
+
isIPhone$$module$build$src$core$utils$useragent,MAC$$module$build$src$core$utils$useragent=isMac$$module$build$src$core$utils$useragent,MOBILE$$module$build$src$core$utils$useragent=isMobile$$module$build$src$core$utils$useragent,module$build$src$core$utils$useragent={};module$build$src$core$utils$useragent.ANDROID=ANDROID$$module$build$src$core$utils$useragent;module$build$src$core$utils$useragent.GECKO=GECKO$$module$build$src$core$utils$useragent;module$build$src$core$utils$useragent.IPAD=IPAD$$module$build$src$core$utils$useragent;
|
|
350
|
+
module$build$src$core$utils$useragent.IPHONE=IPHONE$$module$build$src$core$utils$useragent;module$build$src$core$utils$useragent.JavaFx=JavaFx$$module$build$src$core$utils$useragent;module$build$src$core$utils$useragent.MAC=MAC$$module$build$src$core$utils$useragent;module$build$src$core$utils$useragent.MOBILE=MOBILE$$module$build$src$core$utils$useragent;module$build$src$core$utils$useragent.raw=raw$$module$build$src$core$utils$useragent;var LINE_MODE_MULTIPLIER$$module$build$src$core$browser_events=40,PAGE_MODE_MULTIPLIER$$module$build$src$core$browser_events=125,module$build$src$core$browser_events={};module$build$src$core$browser_events.bind=bind$$module$build$src$core$browser_events;module$build$src$core$browser_events.conditionalBind=conditionalBind$$module$build$src$core$browser_events;module$build$src$core$browser_events.getScrollDeltaPixels=getScrollDeltaPixels$$module$build$src$core$browser_events;
|
|
357
351
|
module$build$src$core$browser_events.isRightButton=isRightButton$$module$build$src$core$browser_events;module$build$src$core$browser_events.isTargetInput=isTargetInput$$module$build$src$core$browser_events;module$build$src$core$browser_events.mouseToSvg=mouseToSvg$$module$build$src$core$browser_events;module$build$src$core$browser_events.unbind=unbind$$module$build$src$core$browser_events;var module$build$src$core$utils$array={};module$build$src$core$utils$array.removeElem=removeElem$$module$build$src$core$utils$array;var Capability$$module$build$src$core$component_manager=class{constructor(a){this.name_=a}toString(){return this.name_}};Capability$$module$build$src$core$component_manager.POSITIONABLE=new Capability$$module$build$src$core$component_manager("positionable");Capability$$module$build$src$core$component_manager.DRAG_TARGET=new Capability$$module$build$src$core$component_manager("drag_target");Capability$$module$build$src$core$component_manager.DELETE_AREA=new Capability$$module$build$src$core$component_manager("delete_area");
|
|
358
352
|
Capability$$module$build$src$core$component_manager.AUTOHIDEABLE=new Capability$$module$build$src$core$component_manager("autohideable");
|
|
359
353
|
var ComponentManager$$module$build$src$core$component_manager=class{constructor(){this.componentData=new Map;this.capabilityToComponentIds=new Map}addComponent(a,b){const c=a.component.id;if(!b&&this.componentData.has(c)){var d;throw Error('Plugin "'+c+'" with capabilities "'+(null==(d=this.componentData.get(c))?void 0:d.capabilities)+'" already added.');}this.componentData.set(c,a);b=[];for(d=0;d<a.capabilities.length;d++){const e=String(a.capabilities[d]).toLowerCase();b.push(e);if(this.capabilityToComponentIds.has(e)){let f;
|
|
@@ -371,8 +365,8 @@ module$build$src$core$utils$dom.setCssTransform=setCssTransform$$module$build$sr
|
|
|
371
365
|
$.module$build$src$core$utils$xml.createTextNode=createTextNode$$module$build$src$core$utils$xml;$.module$build$src$core$utils$xml.domToText=domToText$$module$build$src$core$utils$xml;$.module$build$src$core$utils$xml.getDocument=getDocument$$module$build$src$core$utils$xml;$.module$build$src$core$utils$xml.setDocument=setDocument$$module$build$src$core$utils$xml;$.module$build$src$core$utils$xml.textToDomDocument=textToDomDocument$$module$build$src$core$utils$xml;var alertImplementation$$module$build$src$core$dialog=function(a,b){window.alert(a);b&&b()},confirmImplementation$$module$build$src$core$dialog=function(a,b){b(window.confirm(a))},promptImplementation$$module$build$src$core$dialog=function(a,b,c){c(window.prompt(a,b))},TEST_ONLY$$module$build$src$core$dialog={confirmInternal:confirmInternal$$module$build$src$core$dialog},module$build$src$core$dialog={};module$build$src$core$dialog.TEST_ONLY=TEST_ONLY$$module$build$src$core$dialog;
|
|
372
366
|
module$build$src$core$dialog.alert=alert$$module$build$src$core$dialog;module$build$src$core$dialog.confirm=confirm$$module$build$src$core$dialog;module$build$src$core$dialog.prompt=prompt$$module$build$src$core$dialog;module$build$src$core$dialog.setAlert=setAlert$$module$build$src$core$dialog;module$build$src$core$dialog.setConfirm=setConfirm$$module$build$src$core$dialog;module$build$src$core$dialog.setPrompt=setPrompt$$module$build$src$core$dialog;var Msg$$module$build$src$core$msg;Msg$$module$build$src$core$msg=Object.create(null);$.module$build$src$core$msg={};$.module$build$src$core$msg.Msg=Msg$$module$build$src$core$msg;var VarBase$$module$build$src$core$events$events_var_base=class extends Abstract$$module$build$src$core$events$events_abstract{constructor(a){super();this.varId=(this.isBlank="undefined"===typeof a)?"":a.getId();this.workspaceId=this.isBlank?"":a.workspace.id}toJson(){const a=super.toJson();a.varId=this.varId;return a}fromJson(a){super.fromJson(a);this.varId=a.varId}},module$build$src$core$events$events_var_base={};module$build$src$core$events$events_var_base.VarBase=VarBase$$module$build$src$core$events$events_var_base;var VarCreate$$module$build$src$core$events$events_var_create=class extends VarBase$$module$build$src$core$events$events_var_base{constructor(a){super(a);this.type=VAR_CREATE$$module$build$src$core$events$utils;a&&(this.varType=a.type,this.varName=a.name)}toJson(){const a=super.toJson();a.varType=this.varType;a.varName=this.varName;return a}fromJson(a){super.fromJson(a);this.varType=a.varType;this.varName=a.varName}run(a){const b=this.getEventWorkspace_();a?b.createVariable(this.varName,this.varType,
|
|
373
367
|
this.varId):b.deleteVariableById(this.varId)}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,VAR_CREATE$$module$build$src$core$events$utils,VarCreate$$module$build$src$core$events$events_var_create);var module$build$src$core$events$events_var_create={};module$build$src$core$events$events_var_create.VarCreate=VarCreate$$module$build$src$core$events$events_var_create;var VariableModel$$module$build$src$core$variable_model=class{constructor(a,b,c,d){this.workspace=a;this.name=b;this.type=c||"";this.id_=d||genUid$$module$build$src$core$utils$idgenerator();fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(VAR_CREATE$$module$build$src$core$events$utils))(this))}getId(){return this.id_}static compareByName(a,b){return a.name.localeCompare(b.name,void 0,{sensitivity:"base"})}},module$build$src$core$variable_model={};
|
|
374
|
-
module$build$src$core$variable_model.VariableModel=VariableModel$$module$build$src$core$variable_model;var CATEGORY_NAME$$module$build$src$core$variables,
|
|
375
|
-
$.module$build$src$core$variables
|
|
368
|
+
module$build$src$core$variable_model.VariableModel=VariableModel$$module$build$src$core$variable_model;var CATEGORY_NAME$$module$build$src$core$variables,VAR_LETTER_OPTIONS$$module$build$src$core$variables,TEST_ONLY$$module$build$src$core$variables;CATEGORY_NAME$$module$build$src$core$variables="VARIABLE";VAR_LETTER_OPTIONS$$module$build$src$core$variables="ijkmnopqrstuvwxyzabcdefgh";TEST_ONLY$$module$build$src$core$variables={generateUniqueNameInternal:generateUniqueNameInternal$$module$build$src$core$variables};$.module$build$src$core$variables={};
|
|
369
|
+
$.module$build$src$core$variables.CATEGORY_NAME=CATEGORY_NAME$$module$build$src$core$variables;$.module$build$src$core$variables.TEST_ONLY=TEST_ONLY$$module$build$src$core$variables;$.module$build$src$core$variables.VAR_LETTER_OPTIONS=VAR_LETTER_OPTIONS$$module$build$src$core$variables;$.module$build$src$core$variables.allDeveloperVariables=allDeveloperVariables$$module$build$src$core$variables;$.module$build$src$core$variables.allUsedVarModels=allUsedVarModels$$module$build$src$core$variables;
|
|
376
370
|
$.module$build$src$core$variables.createVariableButtonHandler=createVariableButtonHandler$$module$build$src$core$variables;$.module$build$src$core$variables.flyoutCategory=flyoutCategory$$module$build$src$core$variables;$.module$build$src$core$variables.flyoutCategoryBlocks=flyoutCategoryBlocks$$module$build$src$core$variables;$.module$build$src$core$variables.generateUniqueName=generateUniqueName$$module$build$src$core$variables;$.module$build$src$core$variables.generateUniqueNameFromOptions=generateUniqueNameFromOptions$$module$build$src$core$variables;
|
|
377
371
|
$.module$build$src$core$variables.generateVariableFieldDom=generateVariableFieldDom$$module$build$src$core$variables;$.module$build$src$core$variables.getAddedVariables=getAddedVariables$$module$build$src$core$variables;$.module$build$src$core$variables.getOrCreateVariablePackage=getOrCreateVariablePackage$$module$build$src$core$variables;$.module$build$src$core$variables.getVariable=getVariable$$module$build$src$core$variables;$.module$build$src$core$variables.nameUsedWithAnyType=nameUsedWithAnyType$$module$build$src$core$variables;
|
|
378
372
|
$.module$build$src$core$variables.promptName=promptName$$module$build$src$core$variables;$.module$build$src$core$variables.renameVariable=renameVariable$$module$build$src$core$variables;var Coordinate$$module$build$src$core$utils$coordinate=class{constructor(a,b){this.x=a;this.y=b}clone(){return new Coordinate$$module$build$src$core$utils$coordinate(this.x,this.y)}scale(a){this.x*=a;this.y*=a;return this}translate(a,b){this.x+=a;this.y+=b;return this}static equals(a,b){return a===b?!0:a&&b?a.x===b.x&&a.y===b.y:!1}static distance(a,b){const c=a.x-b.x;a=a.y-b.y;return Math.sqrt(c*c+a*a)}static magnitude(a){return Math.sqrt(a.x*a.x+a.y*a.y)}static difference(a,b){return new Coordinate$$module$build$src$core$utils$coordinate(a.x-
|
|
@@ -388,14 +382,13 @@ Svg$$module$build$src$core$utils$svg.FECOMPOSITE=new Svg$$module$build$src$core$
|
|
|
388
382
|
Svg$$module$build$src$core$utils$svg.FEPOINTLIGHT=new Svg$$module$build$src$core$utils$svg("fePointLight");Svg$$module$build$src$core$utils$svg.FESPECULARLIGHTING=new Svg$$module$build$src$core$utils$svg("feSpecularLighting");Svg$$module$build$src$core$utils$svg.FILTER=new Svg$$module$build$src$core$utils$svg("filter");Svg$$module$build$src$core$utils$svg.FOREIGNOBJECT=new Svg$$module$build$src$core$utils$svg("foreignObject");Svg$$module$build$src$core$utils$svg.G=new Svg$$module$build$src$core$utils$svg("g");
|
|
389
383
|
Svg$$module$build$src$core$utils$svg.IMAGE=new Svg$$module$build$src$core$utils$svg("image");Svg$$module$build$src$core$utils$svg.LINE=new Svg$$module$build$src$core$utils$svg("line");Svg$$module$build$src$core$utils$svg.PATH=new Svg$$module$build$src$core$utils$svg("path");Svg$$module$build$src$core$utils$svg.PATTERN=new Svg$$module$build$src$core$utils$svg("pattern");Svg$$module$build$src$core$utils$svg.POLYGON=new Svg$$module$build$src$core$utils$svg("polygon");
|
|
390
384
|
Svg$$module$build$src$core$utils$svg.RECT=new Svg$$module$build$src$core$utils$svg("rect");Svg$$module$build$src$core$utils$svg.SVG=new Svg$$module$build$src$core$utils$svg("svg");Svg$$module$build$src$core$utils$svg.TEXT=new Svg$$module$build$src$core$utils$svg("text");Svg$$module$build$src$core$utils$svg.TSPAN=new Svg$$module$build$src$core$utils$svg("tspan");var module$build$src$core$utils$svg={};module$build$src$core$utils$svg.Svg=Svg$$module$build$src$core$utils$svg;var TEST_ONLY$$module$build$src$core$utils$style={getSizeInternal:getSizeInternal$$module$build$src$core$utils$style},module$build$src$core$utils$style={};module$build$src$core$utils$style.TEST_ONLY=TEST_ONLY$$module$build$src$core$utils$style;module$build$src$core$utils$style.getBorderBox=getBorderBox$$module$build$src$core$utils$style;module$build$src$core$utils$style.getCascadedStyle=getCascadedStyle$$module$build$src$core$utils$style;module$build$src$core$utils$style.getComputedStyle=getComputedStyle$$module$build$src$core$utils$style;
|
|
391
|
-
module$build$src$core$utils$style.getContainerOffsetToScrollInto=getContainerOffsetToScrollInto$$module$build$src$core$utils$style;module$build$src$core$utils$style.getPageOffset=getPageOffset$$module$build$src$core$utils$style;module$build$src$core$utils$style.getSize=getSize$$module$build$src$core$utils$style;module$build$src$core$utils$style.getViewportPageOffset=getViewportPageOffset$$module$build$src$core$utils$style;module$build$src$core$utils$style.
|
|
392
|
-
module$build$src$core$utils$style.scrollIntoContainerView=scrollIntoContainerView$$module$build$src$core$utils$style;module$build$src$core$utils$style.setElementShown=setElementShown$$module$build$src$core$utils$style;var XY_REGEX$$module$build$src$core$utils$svg_math=/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*)?/,XY_STYLE_REGEX$$module$build$src$core$utils$svg_math=/transform:\s*translate(?:3d)?\(\s*([-+\d.e]+)\s*px([ ,]\s*([-+\d.e]+)\s*px)?/,TEST_ONLY$$module$build$src$core$utils$svg_math={XY_REGEX:XY_REGEX$$module$build$src$core$utils$svg_math,XY_STYLE_REGEX:XY_STYLE_REGEX$$module$build$src$core$utils$svg_math},module$build$src$core$utils$svg_math={};module$build$src$core$utils$svg_math.TEST_ONLY=TEST_ONLY$$module$build$src$core$utils$svg_math;
|
|
385
|
+
module$build$src$core$utils$style.getContainerOffsetToScrollInto=getContainerOffsetToScrollInto$$module$build$src$core$utils$style;module$build$src$core$utils$style.getPageOffset=getPageOffset$$module$build$src$core$utils$style;module$build$src$core$utils$style.getSize=getSize$$module$build$src$core$utils$style;module$build$src$core$utils$style.getViewportPageOffset=getViewportPageOffset$$module$build$src$core$utils$style;module$build$src$core$utils$style.scrollIntoContainerView=scrollIntoContainerView$$module$build$src$core$utils$style;var XY_REGEX$$module$build$src$core$utils$svg_math=/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*)?/,XY_STYLE_REGEX$$module$build$src$core$utils$svg_math=/transform:\s*translate(?:3d)?\(\s*([-+\d.e]+)\s*px([ ,]\s*([-+\d.e]+)\s*px)?/,TEST_ONLY$$module$build$src$core$utils$svg_math={XY_REGEX:XY_REGEX$$module$build$src$core$utils$svg_math,XY_STYLE_REGEX:XY_STYLE_REGEX$$module$build$src$core$utils$svg_math},module$build$src$core$utils$svg_math={};module$build$src$core$utils$svg_math.TEST_ONLY=TEST_ONLY$$module$build$src$core$utils$svg_math;
|
|
393
386
|
module$build$src$core$utils$svg_math.getDocumentScroll=getDocumentScroll$$module$build$src$core$utils$svg_math;module$build$src$core$utils$svg_math.getInjectionDivXY=getInjectionDivXY$$module$build$src$core$utils$svg_math;module$build$src$core$utils$svg_math.getRelativeXY=getRelativeXY$$module$build$src$core$utils$svg_math;module$build$src$core$utils$svg_math.getViewportBBox=getViewportBBox$$module$build$src$core$utils$svg_math;module$build$src$core$utils$svg_math.is3dSupported=is3dSupported$$module$build$src$core$utils$svg_math;
|
|
394
387
|
module$build$src$core$utils$svg_math.screenToWsCoordinates=screenToWsCoordinates$$module$build$src$core$utils$svg_math;module$build$src$core$utils$svg_math.svgSize=svgSize$$module$build$src$core$utils$svg_math;var RESIZE_SIZE$$module$build$src$core$workspace_comment_svg=8,BORDER_RADIUS$$module$build$src$core$workspace_comment_svg=3,TEXTAREA_OFFSET$$module$build$src$core$workspace_comment_svg=2,WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg=class extends WorkspaceComment$$module$build$src$core$workspace_comment{constructor(a,b,c,d,e){super(a,b,c,d,e);this.onMouseMoveWrapper_=this.onMouseUpWrapper_=null;this.eventsInit_=!1;this.deleteIconBorder_=this.deleteGroup_=this.resizeGroup_=this.foreignObject_=
|
|
395
388
|
this.svgHandleTarget_=this.svgRectTarget_=this.textarea_=null;this.rendered_=this.autoLayout_=this.focused_=!1;this.svgGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{"class":"blocklyComment"});this.svgGroup_.translate_="";this.workspace=a;this.svgRect_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"blocklyCommentRect",x:0,y:0,rx:BORDER_RADIUS$$module$build$src$core$workspace_comment_svg,ry:BORDER_RADIUS$$module$build$src$core$workspace_comment_svg});
|
|
396
|
-
this.svgGroup_.appendChild(this.svgRect_);this.useDragSurface_
|
|
397
|
-
|
|
398
|
-
|
|
389
|
+
this.svgGroup_.appendChild(this.svgRect_);this.useDragSurface_=!!a.getBlockDragSurface();this.render()}dispose(){this.disposed_||(getSelected$$module$build$src$core$common()===this&&(this.unselect(),this.workspace.cancelCurrentGesture()),isEnabled$$module$build$src$core$events$utils()&&fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(COMMENT_DELETE$$module$build$src$core$events$utils))(this)),removeNode$$module$build$src$core$utils$dom(this.svgGroup_),this.disposeInternal_(),
|
|
390
|
+
disable$$module$build$src$core$events$utils(),super.dispose(),enable$$module$build$src$core$events$utils())}initSvg(a){if(!this.workspace.rendered)throw TypeError("Workspace is headless.");this.workspace.options.readOnly||this.eventsInit_||(conditionalBind$$module$build$src$core$browser_events(this.svgRectTarget_,"mousedown",this,this.pathMouseDown_),conditionalBind$$module$build$src$core$browser_events(this.svgHandleTarget_,"mousedown",this,this.pathMouseDown_));this.eventsInit_=!0;this.updateMovable();
|
|
391
|
+
this.getSvgRoot().parentNode||this.workspace.getBubbleCanvas().appendChild(this.getSvgRoot());!a&&this.textarea_&&this.textarea_.select()}pathMouseDown_(a){const b=this.workspace.getGesture(a);b&&b.handleBubbleStart(a,this)}showContextMenu(a){throw Error("The implementation of showContextMenu should be monkey-patched in by blockly.ts");}select(){if(getSelected$$module$build$src$core$common()!==this){var a=null;if(getSelected$$module$build$src$core$common()){a=getSelected$$module$build$src$core$common().id;
|
|
399
392
|
disable$$module$build$src$core$events$utils();try{getSelected$$module$build$src$core$common().unselect()}finally{enable$$module$build$src$core$events$utils()}}a=new (get$$module$build$src$core$events$utils(SELECTED$$module$build$src$core$events$utils))(a,this.id,this.workspace.id);fire$$module$build$src$core$events$utils(a);setSelected$$module$build$src$core$common(this);this.addSelect()}}unselect(){if(getSelected$$module$build$src$core$common()===this){var a=new (get$$module$build$src$core$events$utils(SELECTED$$module$build$src$core$events$utils))(this.id,
|
|
400
393
|
null,this.workspace.id);fire$$module$build$src$core$events$utils(a);setSelected$$module$build$src$core$common(null);this.removeSelect();this.blurFocus()}}addSelect(){addClass$$module$build$src$core$utils$dom(this.svgGroup_,"blocklySelected");this.setFocus()}removeSelect(){removeClass$$module$build$src$core$utils$dom(this.svgGroup_,"blocklySelected");this.blurFocus()}addFocus(){addClass$$module$build$src$core$utils$dom(this.svgGroup_,"blocklyFocused")}removeFocus(){removeClass$$module$build$src$core$utils$dom(this.svgGroup_,
|
|
401
394
|
"blocklyFocused")}getRelativeToSurfaceXY(){let a=0,b=0;const c=this.useDragSurface_?this.workspace.getBlockDragSurface().getGroup():null;let d=this.getSvgRoot();if(d){do{var e=getRelativeXY$$module$build$src$core$utils$svg_math(d);a+=e.x;b+=e.y;this.useDragSurface_&&this.workspace.getBlockDragSurface().getCurrentBlock()===d&&(e=this.workspace.getBlockDragSurface().getSurfaceTranslation(),a+=e.x,b+=e.y);d=d.parentNode}while(d&&d!==this.workspace.getBubbleCanvas()&&d!==c)}return this.xy_=new Coordinate$$module$build$src$core$utils$coordinate(a,
|
|
@@ -418,9 +411,9 @@ this.unbindDragEvents_()}resizeMouseMove_(a){this.autoLayout_=!1;a=this.workspac
|
|
|
418
411
|
this.textarea_.style.width=a.width-c+"px";this.textarea_.style.height=a.height-c-b+"px"}setSize_(a,b){a=Math.max(a,45);b=Math.max(b,20+WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg.TOP_OFFSET);this.width_=a;this.height_=b;this.svgRect_.setAttribute("width",a);this.svgRect_.setAttribute("height",b);this.svgRectTarget_.setAttribute("width",a);this.svgRectTarget_.setAttribute("height",b);this.svgHandleTarget_.setAttribute("width",a);this.svgHandleTarget_.setAttribute("height",WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg.TOP_OFFSET);
|
|
419
412
|
this.RTL&&(this.svgRect_.setAttribute("transform","scale(-1 1)"),this.svgRectTarget_.setAttribute("transform","scale(-1 1)"));this.resizeGroup_&&(this.RTL?(this.resizeGroup_.setAttribute("transform","translate("+(-a+RESIZE_SIZE$$module$build$src$core$workspace_comment_svg)+","+(b-RESIZE_SIZE$$module$build$src$core$workspace_comment_svg)+") scale(-1 1)"),this.deleteGroup_.setAttribute("transform","translate("+(-a+RESIZE_SIZE$$module$build$src$core$workspace_comment_svg)+","+-RESIZE_SIZE$$module$build$src$core$workspace_comment_svg+
|
|
420
413
|
") scale(-1 1)")):(this.resizeGroup_.setAttribute("transform","translate("+(a-RESIZE_SIZE$$module$build$src$core$workspace_comment_svg)+","+(b-RESIZE_SIZE$$module$build$src$core$workspace_comment_svg)+")"),this.deleteGroup_.setAttribute("transform","translate("+(a-RESIZE_SIZE$$module$build$src$core$workspace_comment_svg)+","+-RESIZE_SIZE$$module$build$src$core$workspace_comment_svg+")")));this.resizeComment_()}disposeInternal_(){this.svgHandleTarget_=this.svgRectTarget_=this.foreignObject_=this.textarea_=
|
|
421
|
-
null;this.disposed_=!0}setFocus(){
|
|
422
|
-
|
|
423
|
-
|
|
414
|
+
null;this.disposed_=!0}setFocus(){this.focused_=!0;setTimeout(()=>{this.disposed_||(this.textarea_.focus(),this.addFocus(),addClass$$module$build$src$core$utils$dom(this.svgRectTarget_,"blocklyCommentTargetFocused"),addClass$$module$build$src$core$utils$dom(this.svgHandleTarget_,"blocklyCommentHandleTargetFocused"))},0)}blurFocus(){this.focused_=!1;setTimeout(()=>{this.disposed_||(this.textarea_.blur(),this.removeFocus(),removeClass$$module$build$src$core$utils$dom(this.svgRectTarget_,"blocklyCommentTargetFocused"),
|
|
415
|
+
removeClass$$module$build$src$core$utils$dom(this.svgHandleTarget_,"blocklyCommentHandleTargetFocused"))},0)}static fromXmlRendered(a,b,c){disable$$module$build$src$core$events$utils();let d;try{const e=WorkspaceComment$$module$build$src$core$workspace_comment.parseAttributes(a);d=new WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg(b,e.content,e.h,e.w,e.id);b.rendered&&(d.initSvg(!0),d.render());if(!isNaN(e.x)&&!isNaN(e.y))if(b.RTL){const f=c||b.getWidth();d.moveBy(f-e.x,e.y)}else d.moveBy(e.x,
|
|
416
|
+
e.y)}finally{enable$$module$build$src$core$events$utils()}WorkspaceComment$$module$build$src$core$workspace_comment.fireCreateEvent(d);return d}};WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg.DEFAULT_SIZE=100;WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg.TOP_OFFSET=10;register$$module$build$src$core$css("\n.blocklyCommentForeignObject {\n position: relative;\n z-index: 0;\n}\n\n.blocklyCommentRect {\n fill: #E7DE8E;\n stroke: #bcA903;\n stroke-width: 1px;\n}\n\n.blocklyCommentTarget {\n fill: transparent;\n stroke: #bcA903;\n}\n\n.blocklyCommentTargetFocused {\n fill: none;\n}\n\n.blocklyCommentHandleTarget {\n fill: none;\n}\n\n.blocklyCommentHandleTargetFocused {\n fill: transparent;\n}\n\n.blocklyFocused>.blocklyCommentRect {\n fill: #B9B272;\n stroke: #B9B272;\n}\n\n.blocklySelected>.blocklyCommentTarget {\n stroke: #fc3;\n stroke-width: 3px;\n}\n\n.blocklyCommentDeleteIcon {\n cursor: pointer;\n fill: #000;\n display: none;\n}\n\n.blocklySelected > .blocklyCommentDeleteIcon {\n display: block;\n}\n\n.blocklyDeleteIconShape {\n fill: #000;\n stroke: #000;\n stroke-width: 1px;\n}\n\n.blocklyDeleteIconShape.blocklyDeleteIconHighlighted {\n stroke: #fc3;\n}\n");
|
|
424
417
|
var module$build$src$core$workspace_comment_svg={};module$build$src$core$workspace_comment_svg.WorkspaceCommentSvg=WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg;$.module$build$src$core$xml={};$.module$build$src$core$xml.appendDomToWorkspace=appendDomToWorkspace$$module$build$src$core$xml;$.module$build$src$core$xml.blockToDom=blockToDom$$module$build$src$core$xml;$.module$build$src$core$xml.blockToDomWithXY=blockToDomWithXY$$module$build$src$core$xml;$.module$build$src$core$xml.clearWorkspaceAndLoadFromXml=clearWorkspaceAndLoadFromXml$$module$build$src$core$xml;$.module$build$src$core$xml.deleteNext=deleteNext$$module$build$src$core$xml;
|
|
425
418
|
$.module$build$src$core$xml.domToBlock=domToBlock$$module$build$src$core$xml;$.module$build$src$core$xml.domToPrettyText=domToPrettyText$$module$build$src$core$xml;$.module$build$src$core$xml.domToText=domToText$$module$build$src$core$xml;$.module$build$src$core$xml.domToVariables=domToVariables$$module$build$src$core$xml;$.module$build$src$core$xml.domToWorkspace=domToWorkspace$$module$build$src$core$xml;$.module$build$src$core$xml.textToDom=textToDom$$module$build$src$core$xml;
|
|
426
419
|
$.module$build$src$core$xml.variablesToDom=variablesToDom$$module$build$src$core$xml;$.module$build$src$core$xml.workspaceToDom=workspaceToDom$$module$build$src$core$xml;var BlockBase$$module$build$src$core$events$events_block_base=class extends Abstract$$module$build$src$core$events$events_abstract{constructor(a){super();this.blockId=(this.isBlank="undefined"===typeof a)?"":a.id;this.workspaceId=this.isBlank?"":a.workspace.id}toJson(){const a=super.toJson();a.blockId=this.blockId;return a}fromJson(a){super.fromJson(a);this.blockId=a.blockId}},module$build$src$core$events$events_block_base={};module$build$src$core$events$events_block_base.BlockBase=BlockBase$$module$build$src$core$events$events_block_base;var BlockChange$$module$build$src$core$events$events_block_change=class extends BlockBase$$module$build$src$core$events$events_block_base{constructor(a,b,c,d,e){super(a);this.type=CHANGE$$module$build$src$core$events$utils;a&&(this.element="undefined"===typeof b?"":b,this.name="undefined"===typeof c?"":c,this.oldValue="undefined"===typeof d?"":d,this.newValue="undefined"===typeof e?"":e)}toJson(){const a=super.toJson();a.element=this.element;this.name&&(a.name=this.name);a.oldValue=this.oldValue;
|
|
@@ -483,13 +476,13 @@ a){this.visible_=a;var b=this.getSvgRoot();b&&(b.style.display=a?"block":"none")
|
|
|
483
476
|
let c=2*a,d=b.FIELD_TEXT_HEIGHT,e=0;this.textElement_&&(e=getFastTextWidth$$module$build$src$core$utils$dom(this.textElement_,b.FIELD_TEXT_FONTSIZE,b.FIELD_TEXT_FONTWEIGHT,b.FIELD_TEXT_FONTFAMILY),c+=e);this.borderRect_&&(d=Math.max(d,b.FIELD_BORDER_RECT_HEIGHT));this.size_.height=d;this.size_.width=c;this.positionTextElement_(a,e);this.positionBorderRect_()}positionTextElement_(a,b){if(this.textElement_){var c=this.getConstants(),d=this.size_.height/2;this.textElement_.setAttribute("x",this.sourceBlock_.RTL?
|
|
484
477
|
this.size_.width-b-a:a);this.textElement_.setAttribute("y",c.FIELD_TEXT_BASELINE_CENTER?d:d-c.FIELD_TEXT_HEIGHT/2+c.FIELD_TEXT_BASELINE)}}positionBorderRect_(){this.borderRect_&&(this.borderRect_.setAttribute("width",this.size_.width),this.borderRect_.setAttribute("height",this.size_.height),this.borderRect_.setAttribute("rx",this.getConstants().FIELD_BORDER_RECT_RADIUS),this.borderRect_.setAttribute("ry",this.getConstants().FIELD_BORDER_RECT_RADIUS))}getSize(){if(!this.isVisible())return new Size$$module$build$src$core$utils$size(0,
|
|
485
478
|
0);this.isDirty_?(this.render_(),this.isDirty_=!1):this.visible_&&0===this.size_.width&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.render_());return this.size_}getScaledBBox(){let a;let b;if(this.borderRect_){var c=this.borderRect_.getBoundingClientRect();b=getPageOffset$$module$build$src$core$utils$style(this.borderRect_);a=c.width;var d=c.height}else d=this.sourceBlock_.getHeightWidth(),c=this.sourceBlock_.workspace.scale,
|
|
486
|
-
b=this.getAbsoluteXY_(),a=d.width*c,d=d.height*c,GECKO$$module$build$src$core$utils$useragent?(b.x+=1.5*c,b.y+=1.5*c):
|
|
487
|
-
|
|
488
|
-
b)
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
Field$$module$build$src$core$field.
|
|
479
|
+
b=this.getAbsoluteXY_(),a=(d.width+1)*c,d=(d.height+1)*c,GECKO$$module$build$src$core$utils$useragent?(b.x+=1.5*c,b.y+=1.5*c):(b.x-=.5*c,b.y-=.5*c);return new Rect$$module$build$src$core$utils$rect(b.y,b.y+d,b.x,b.x+a)}getDisplayText_(){let a=this.getText();if(!a)return Field$$module$build$src$core$field.NBSP;a.length>this.maxDisplayLength&&(a=a.substring(0,this.maxDisplayLength-2)+"\u2026");a=a.replace(/\s/g,Field$$module$build$src$core$field.NBSP);this.sourceBlock_&&this.sourceBlock_.RTL&&(a+="\u200f");
|
|
480
|
+
return a}getText(){const a=this.getText_();return null!==a?String(a):String(this.getValue())}getText_(){return null}markDirty(){this.isDirty_=!0;this.constants_=null}forceRerender(){this.isDirty_=!0;this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours(),this.updateMarkers_())}setValue(a){if(null!==a){var b=this.doClassValidation_(a);a=this.processValidation_(a,b);if(!(a instanceof Error)){if(b=this.getValidator())if(b=b.call(this,a),a=this.processValidation_(a,
|
|
481
|
+
b),a instanceof Error)return;b=this.sourceBlock_;if(!b||!b.disposed){var c=this.getValue();c===a?this.doValueUpdate_(a):(this.doValueUpdate_(a),b&&isEnabled$$module$build$src$core$events$utils()&&fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CHANGE$$module$build$src$core$events$utils))(b,"field",this.name||null,c,a)),this.isDirty_&&this.forceRerender())}}}}processValidation_(a,b){if(null===b)return this.doValueInvalid_(a),this.isDirty_&&this.forceRerender(),
|
|
482
|
+
Error();void 0!==b&&(a=b);return a}getValue(){return this.value_}doClassValidation_(a){return null===a||void 0===a?null:a}doValueUpdate_(a){this.value_=a;this.isDirty_=!0}doValueInvalid_(a){}onMouseDown_(a){this.sourceBlock_&&!this.sourceBlock_.disposed&&(a=this.sourceBlock_.workspace.getGesture(a))&&a.setStartField(this)}setTooltip(a){a||""===a||(a=this.sourceBlock_);const b=this.getClickTarget_();b?b.tooltip=a:this.tooltip_=a}getTooltip(){const a=this.getClickTarget_();return a?getTooltipOfObject$$module$build$src$core$tooltip(a):
|
|
483
|
+
getTooltipOfObject$$module$build$src$core$tooltip({tooltip:this.tooltip_})}getClickTarget_(){return this.clickTarget_||this.getSvgRoot()}getAbsoluteXY_(){return getPageOffset$$module$build$src$core$utils$style(this.getClickTarget_())}referencesVariables(){return!1}refreshVariableName(){}getParentInput(){let a=null;const b=this.sourceBlock_,c=b.inputList;for(let d=0;d<b.inputList.length;d++){const e=c[d],f=e.fieldRow;for(let g=0;g<f.length;g++)if(f[g]===this){a=e;break}}return a}getFlipRtl(){return!1}isTabNavigable(){return!1}onShortcut(a){return!1}setCursorSvg(a){a?
|
|
484
|
+
(this.fieldGroup_.appendChild(a),this.cursorSvg_=a):this.cursorSvg_=null}setMarkerSvg(a){a?(this.fieldGroup_.appendChild(a),this.markerSvg_=a):this.markerSvg_=null}updateMarkers_(){const a=this.sourceBlock_.workspace;a.keyboardAccessibilityMode&&this.cursorSvg_&&a.getCursor().draw();a.keyboardAccessibilityMode&&this.markerSvg_&&a.getMarker(MarkerManager$$module$build$src$core$marker_manager.LOCAL_MARKER).draw()}};Field$$module$build$src$core$field.NBSP="\u00a0";
|
|
485
|
+
Field$$module$build$src$core$field.SKIP_SETUP=new Sentinel$$module$build$src$core$utils$sentinel;var module$build$src$core$field={};module$build$src$core$field.Field=Field$$module$build$src$core$field;var TEST_ONLY$$module$build$src$core$field_registry={fromJsonInternal:fromJsonInternal$$module$build$src$core$field_registry},module$build$src$core$field_registry={};module$build$src$core$field_registry.TEST_ONLY=TEST_ONLY$$module$build$src$core$field_registry;module$build$src$core$field_registry.fromJson=fromJson$$module$build$src$core$field_registry;module$build$src$core$field_registry.register=register$$module$build$src$core$field_registry;module$build$src$core$field_registry.unregister=unregister$$module$build$src$core$field_registry;var ARIA_PREFIX$$module$build$src$core$utils$aria="aria-",ROLE_ATTRIBUTE$$module$build$src$core$utils$aria="role",Role$$module$build$src$core$utils$aria;(function(a){a.GRID="grid";a.GRIDCELL="gridcell";a.GROUP="group";a.LISTBOX="listbox";a.MENU="menu";a.MENUITEM="menuitem";a.MENUITEMCHECKBOX="menuitemcheckbox";a.OPTION="option";a.PRESENTATION="presentation";a.ROW="row";a.TREE="tree";a.TREEITEM="treeitem"})(Role$$module$build$src$core$utils$aria||(Role$$module$build$src$core$utils$aria={}));var State$$module$build$src$core$utils$aria;
|
|
493
486
|
(function(a){a.ACTIVEDESCENDANT="activedescendant";a.COLCOUNT="colcount";a.DISABLED="disabled";a.EXPANDED="expanded";a.INVALID="invalid";a.LABEL="label";a.LABELLEDBY="labelledby";a.LEVEL="level";a.ORIENTATION="orientation";a.POSINSET="posinset";a.ROWCOUNT="rowcount";a.SELECTED="selected";a.SETSIZE="setsize";a.VALUEMAX="valuemax";a.VALUEMIN="valuemin"})(State$$module$build$src$core$utils$aria||(State$$module$build$src$core$utils$aria={}));var module$build$src$core$utils$aria={};
|
|
494
487
|
module$build$src$core$utils$aria.Role=Role$$module$build$src$core$utils$aria;module$build$src$core$utils$aria.State=State$$module$build$src$core$utils$aria;module$build$src$core$utils$aria.setRole=setRole$$module$build$src$core$utils$aria;module$build$src$core$utils$aria.setState=setState$$module$build$src$core$utils$aria;var KeyCodes$$module$build$src$core$utils$keycodes;
|
|
495
488
|
(function(a){a[a.WIN_KEY_FF_LINUX=0]="WIN_KEY_FF_LINUX";a[a.MAC_ENTER=3]="MAC_ENTER";a[a.BACKSPACE=8]="BACKSPACE";a[a.TAB=9]="TAB";a[a.NUM_CENTER=12]="NUM_CENTER";a[a.ENTER=13]="ENTER";a[a.SHIFT=16]="SHIFT";a[a.CTRL=17]="CTRL";a[a.ALT=18]="ALT";a[a.PAUSE=19]="PAUSE";a[a.CAPS_LOCK=20]="CAPS_LOCK";a[a.ESC=27]="ESC";a[a.SPACE=32]="SPACE";a[a.PAGE_UP=33]="PAGE_UP";a[a.PAGE_DOWN=34]="PAGE_DOWN";a[a.END=35]="END";a[a.HOME=36]="HOME";a[a.LEFT=37]="LEFT";a[a.UP=38]="UP";a[a.RIGHT=39]="RIGHT";a[a.DOWN=40]=
|
|
@@ -503,13 +496,14 @@ b;for(let c=0,d;d=this.menuItems_[c];c++)b.appendChild(d.createDom());this.mouse
|
|
|
503
496
|
"mouseleave",this,this.handleMouseLeave_,!0);this.onKeyDownHandler_=conditionalBind$$module$build$src$core$browser_events(b,"keydown",this,this.handleKeyEvent_);a.appendChild(b)}getElement(){return this.element_}focus(){const a=this.getElement();a&&(a.focus({preventScroll:!0}),addClass$$module$build$src$core$utils$dom(a,"blocklyFocused"))}blur_(){const a=this.getElement();a&&(a.blur(),removeClass$$module$build$src$core$utils$dom(a,"blocklyFocused"))}setRole(a){this.roleName_=a}dispose(){this.mouseOverHandler_&&
|
|
504
497
|
(unbind$$module$build$src$core$browser_events(this.mouseOverHandler_),this.mouseOverHandler_=null);this.clickHandler_&&(unbind$$module$build$src$core$browser_events(this.clickHandler_),this.clickHandler_=null);this.mouseEnterHandler_&&(unbind$$module$build$src$core$browser_events(this.mouseEnterHandler_),this.mouseEnterHandler_=null);this.mouseLeaveHandler_&&(unbind$$module$build$src$core$browser_events(this.mouseLeaveHandler_),this.mouseLeaveHandler_=null);this.onKeyDownHandler_&&(unbind$$module$build$src$core$browser_events(this.onKeyDownHandler_),
|
|
505
498
|
this.onKeyDownHandler_=null);for(let a=0,b;b=this.menuItems_[a];a++)b.dispose();this.element_=null}getMenuItem_(a){const b=this.getElement();for(;a&&a!==b;){if(hasClass$$module$build$src$core$utils$dom(a,"blocklyMenuItem"))for(let c=0,d;d=this.menuItems_[c];c++)if(d.getElement()===a)return d;a=a.parentElement}return null}setHighlighted(a){var b=this.highlightedItem_;b&&(b.setHighlighted(!1),this.highlightedItem_=null);a&&(a.setHighlighted(!0),this.highlightedItem_=a,b=this.getElement(),scrollIntoContainerView$$module$build$src$core$utils$style(a.getElement(),
|
|
506
|
-
b),setState$$module$build$src$core$utils$aria(b,State$$module$build$src$core$utils$aria.ACTIVEDESCENDANT,a.getId()))}highlightNext(){const a=this.menuItems_.indexOf(this.highlightedItem_);this.highlightHelper_(a,1)}highlightPrevious(){const a=this.menuItems_.indexOf(this.highlightedItem_);this.highlightHelper_(0>a?this.menuItems_.length:a,-1)}highlightFirst_(){this.highlightHelper_(-1,1)}highlightLast_(){this.highlightHelper_(this.menuItems_.length
|
|
507
|
-
break}a+=b}}handleMouseOver_(a){(a=this.getMenuItem_(a.target))&&(a.isEnabled()?this.highlightedItem_!==a&&this.setHighlighted(a):this.setHighlighted(null))}handleClick_(a){const b=this.openingCoords;this.openingCoords=null;if(b&&"number"===typeof a.clientX){const c=new Coordinate$$module$build$src$core$utils$coordinate(a.clientX,a.clientY);if(1>Coordinate$$module$build$src$core$utils$coordinate.distance(b,
|
|
508
|
-
(this.blur_(),this.setHighlighted(null))}handleKeyEvent_(a){if(this.menuItems_.length&&!(a.shiftKey||a.ctrlKey||a.metaKey||a.altKey)){var b=this.highlightedItem_;switch(a.keyCode){case KeyCodes$$module$build$src$core$utils$keycodes.ENTER:case KeyCodes$$module$build$src$core$utils$keycodes.SPACE:b&&b.performAction();break;case KeyCodes$$module$build$src$core$utils$keycodes.UP:this.highlightPrevious();
|
|
509
|
-
break;case KeyCodes$$module$build$src$core$utils$keycodes.
|
|
499
|
+
b),setState$$module$build$src$core$utils$aria(b,State$$module$build$src$core$utils$aria.ACTIVEDESCENDANT,a.getId()))}highlightNext(){const a=this.highlightedItem_?this.menuItems_.indexOf(this.highlightedItem_):-1;this.highlightHelper_(a,1)}highlightPrevious(){const a=this.highlightedItem_?this.menuItems_.indexOf(this.highlightedItem_):-1;this.highlightHelper_(0>a?this.menuItems_.length:a,-1)}highlightFirst_(){this.highlightHelper_(-1,1)}highlightLast_(){this.highlightHelper_(this.menuItems_.length,
|
|
500
|
+
-1)}highlightHelper_(a,b){a+=b;let c;for(;c=this.menuItems_[a];){if(c.isEnabled()){this.setHighlighted(c);break}a+=b}}handleMouseOver_(a){(a=this.getMenuItem_(a.target))&&(a.isEnabled()?this.highlightedItem_!==a&&this.setHighlighted(a):this.setHighlighted(null))}handleClick_(a){const b=this.openingCoords;this.openingCoords=null;if(b&&"number"===typeof a.clientX){const c=new Coordinate$$module$build$src$core$utils$coordinate(a.clientX,a.clientY);if(1>Coordinate$$module$build$src$core$utils$coordinate.distance(b,
|
|
501
|
+
c))return}(a=this.getMenuItem_(a.target))&&a.performAction()}handleMouseEnter_(a){this.focus()}handleMouseLeave_(a){this.getElement()&&(this.blur_(),this.setHighlighted(null))}handleKeyEvent_(a){if(this.menuItems_.length&&!(a.shiftKey||a.ctrlKey||a.metaKey||a.altKey)){var b=this.highlightedItem_;switch(a.keyCode){case KeyCodes$$module$build$src$core$utils$keycodes.ENTER:case KeyCodes$$module$build$src$core$utils$keycodes.SPACE:b&&b.performAction();break;case KeyCodes$$module$build$src$core$utils$keycodes.UP:this.highlightPrevious();
|
|
502
|
+
break;case KeyCodes$$module$build$src$core$utils$keycodes.DOWN:this.highlightNext();break;case KeyCodes$$module$build$src$core$utils$keycodes.PAGE_UP:case KeyCodes$$module$build$src$core$utils$keycodes.HOME:this.highlightFirst_();break;case KeyCodes$$module$build$src$core$utils$keycodes.PAGE_DOWN:case KeyCodes$$module$build$src$core$utils$keycodes.END:this.highlightLast_();break;default:return}a.preventDefault();a.stopPropagation()}}getSize(){const a=this.getElement(),b=getSize$$module$build$src$core$utils$style(a);
|
|
503
|
+
b.height=a.scrollHeight;return b}},module$build$src$core$menu={};module$build$src$core$menu.Menu=Menu$$module$build$src$core$menu;var MenuItem$$module$build$src$core$menuitem=class{constructor(a,b){this.content=a;this.opt_value=b;this.enabled_=!0;this.element_=null;this.rightToLeft_=!1;this.roleName_=null;this.highlight_=this.checked_=this.checkable_=!1;this.actionHandler_=null}createDom(){const a=document.createElement("div");a.id=getNextUniqueId$$module$build$src$core$utils$idgenerator();this.element_=a;a.className="blocklyMenuItem goog-menuitem "+(this.enabled_?"":"blocklyMenuItemDisabled goog-menuitem-disabled ")+(this.checked_?
|
|
510
504
|
"blocklyMenuItemSelected goog-option-selected ":"")+(this.highlight_?"blocklyMenuItemHighlight goog-menuitem-highlight ":"")+(this.rightToLeft_?"blocklyMenuItemRtl goog-menuitem-rtl ":"");const b=document.createElement("div");b.className="blocklyMenuItemContent goog-menuitem-content";if(this.checkable_){var c=document.createElement("div");c.className="blocklyMenuItemCheckbox goog-menuitem-checkbox";b.appendChild(c)}c=this.content;"string"===typeof this.content&&(c=document.createTextNode(this.content));
|
|
511
|
-
b.appendChild(c);a.appendChild(b);this.roleName_&&setRole$$module$build$src$core$utils$aria(a,this.roleName_);setState$$module$build$src$core$utils$aria(a,State$$module$build$src$core$utils$aria.SELECTED,this.checkable_&&this.checked_||!1);setState$$module$build$src$core$utils$aria(a,State$$module$build$src$core$utils$aria.DISABLED,!this.enabled_);return a}dispose(){this.element_=null}getElement(){return this.element_}getId(){return this.element_.id}getValue(){return this.opt_value
|
|
512
|
-
a}setRole(a){this.roleName_=a}setCheckable(a){this.checkable_=a}setChecked(a){this.checked_=a}setHighlighted(a){this.highlight_=a;const b=this.getElement();b&&this.isEnabled()&&(a?(addClass$$module$build$src$core$utils$dom(b,"blocklyMenuItemHighlight"),addClass$$module$build$src$core$utils$dom(b,"goog-menuitem-highlight")):(removeClass$$module$build$src$core$utils$dom(b,"blocklyMenuItemHighlight"),removeClass$$module$build$src$core$utils$dom(b,"goog-menuitem-highlight")))}isEnabled(){return this.enabled_}setEnabled(a){this.enabled_=
|
|
505
|
+
b.appendChild(c);a.appendChild(b);this.roleName_&&setRole$$module$build$src$core$utils$aria(a,this.roleName_);setState$$module$build$src$core$utils$aria(a,State$$module$build$src$core$utils$aria.SELECTED,this.checkable_&&this.checked_||!1);setState$$module$build$src$core$utils$aria(a,State$$module$build$src$core$utils$aria.DISABLED,!this.enabled_);return a}dispose(){this.element_=null}getElement(){return this.element_}getId(){return this.element_.id}getValue(){let a;return null!=(a=this.opt_value)?
|
|
506
|
+
a:null}setRightToLeft(a){this.rightToLeft_=a}setRole(a){this.roleName_=a}setCheckable(a){this.checkable_=a}setChecked(a){this.checked_=a}setHighlighted(a){this.highlight_=a;const b=this.getElement();b&&this.isEnabled()&&(a?(addClass$$module$build$src$core$utils$dom(b,"blocklyMenuItemHighlight"),addClass$$module$build$src$core$utils$dom(b,"goog-menuitem-highlight")):(removeClass$$module$build$src$core$utils$dom(b,"blocklyMenuItemHighlight"),removeClass$$module$build$src$core$utils$dom(b,"goog-menuitem-highlight")))}isEnabled(){return this.enabled_}setEnabled(a){this.enabled_=
|
|
513
507
|
a}performAction(){this.isEnabled()&&this.actionHandler_&&this.actionHandler_(this)}onAction(a,b){this.actionHandler_=a.bind(b)}},module$build$src$core$menuitem={};module$build$src$core$menuitem.MenuItem=MenuItem$$module$build$src$core$menuitem;var FieldDropdown$$module$build$src$core$field_dropdown=class extends Field$$module$build$src$core$field{constructor(a,b,c){super(Field$$module$build$src$core$field.SKIP_SETUP);this.svgArrow_=this.arrow_=this.imageElement_=this.menu_=this.selectedMenuItem_=null;this.SERIALIZABLE=!0;this.CURSOR="default";this.suffixField=this.prefixField=this.generatedOptions_=null;a!==Field$$module$build$src$core$field.SKIP_SETUP&&(Array.isArray(a)&&validateOptions$$module$build$src$core$field_dropdown(a),this.menuGenerator_=
|
|
514
508
|
a,this.trimOptions_(),this.selectedOption_=this.getOptions(!1)[0],c&&this.configure_(c),this.setValue(this.selectedOption_[1]),b&&this.setValidator(b))}fromXml(a){this.isOptionListDynamic()&&this.getOptions(!1);this.setValue(a.textContent)}loadState(a){this.loadLegacyState(FieldDropdown$$module$build$src$core$field_dropdown,a)||(this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(a))}initView(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot();
|
|
515
509
|
this.createTextElement_();this.imageElement_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.IMAGE,{},this.fieldGroup_);this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_();this.borderRect_&&addClass$$module$build$src$core$utils$dom(this.borderRect_,"blocklyDropdownRect")}shouldAddBorderRect_(){return!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&!this.sourceBlock_.isShadow()}createTextArrow_(){this.arrow_=
|
|
@@ -529,26 +523,25 @@ this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAM
|
|
|
529
523
|
e=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE;this.svgArrow_.setAttribute("transform","translate("+(this.sourceBlock_.RTL?c:a+d)+","+b+")");return e+d}getText_(){if(!this.selectedOption_)return null;const a=this.selectedOption_[0];return"object"===typeof a?a.alt:a}static fromJson(a){if(!a.options)throw Error("options are required for the dropdown field. The options property must be assigned an array of [humanReadableValue, languageNeutralValue] tuples.");return new this(a.options,void 0,a)}static applyTrim_(a,
|
|
530
524
|
b,c){const d=[];for(let e=0;e<a.length;e++){let f=a[e][0];const g=a[e][1];f=f.substring(b,f.length-c);d[e]=[f,g]}return d}};FieldDropdown$$module$build$src$core$field_dropdown.CHECKMARK_OVERHANG=25;FieldDropdown$$module$build$src$core$field_dropdown.MAX_MENU_HEIGHT_VH=.45;var IMAGE_Y_OFFSET$$module$build$src$core$field_dropdown=5,IMAGE_Y_PADDING$$module$build$src$core$field_dropdown=2*IMAGE_Y_OFFSET$$module$build$src$core$field_dropdown;
|
|
531
525
|
FieldDropdown$$module$build$src$core$field_dropdown.ARROW_CHAR=ANDROID$$module$build$src$core$utils$useragent?"\u25bc":"\u25be";register$$module$build$src$core$field_registry("field_dropdown",FieldDropdown$$module$build$src$core$field_dropdown);$.module$build$src$core$field_dropdown={};$.module$build$src$core$field_dropdown.FieldDropdown=FieldDropdown$$module$build$src$core$field_dropdown;var BubbleOpen$$module$build$src$core$events$events_bubble_open=class extends UiBase$$module$build$src$core$events$events_ui_base{constructor(a,b,c){super(a?a.workspace.id:void 0);this.blockId=a?a.id:null;this.isOpen=b;this.bubbleType=c;this.type=BUBBLE_OPEN$$module$build$src$core$events$utils}toJson(){const a=super.toJson();a.isOpen=this.isOpen;a.bubbleType=this.bubbleType;a.blockId=this.blockId;return a}fromJson(a){super.fromJson(a);this.isOpen=a.isOpen;this.bubbleType=a.bubbleType;this.blockId=
|
|
532
|
-
a.blockId}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,BUBBLE_OPEN$$module$build$src$core$events$utils,BubbleOpen$$module$build$src$core$events$events_bubble_open);var module$build$src$core$events$events_bubble_open={};module$build$src$core$events$events_bubble_open.BubbleOpen=BubbleOpen$$module$build$src$core$events$events_bubble_open;var Scrollbar$$module$build$src$core$scrollbar=class{constructor(a,b,c,d,e){this.workspace=a;this.horizontal=b;this.oldHostMetrics_=null;this.ratio=1;this.startDragHandle=this.handlePosition_=this.handleLength_=this.scrollbarLength_=this.startDragMouse_=0;this.containerVisible_=this.isVisible_=!0;this.svgGroup_=this.outerSvg_=this.svgHandle_=this.svgBackground_=null;this.lengthAttribute_="width";this.positionAttribute_="x";this.pair_=c||!1;this.margin_=
|
|
533
|
-
this.origin_=new Coordinate$$module$build$src$core$utils$coordinate(0,0);this.createDom_(d);this.position=new Coordinate$$module$build$src$core$utils$coordinate(0,0);a=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness;b?(this.svgBackground_.setAttribute("height",a
|
|
534
|
-
this.
|
|
535
|
-
unbind$$module$build$src$core$browser_events(this.onMouseDownBarWrapper_)
|
|
536
|
-
0:Math.min(a,this.scrollbarLength_)}setHandleLength_(a){this.handleLength_=a;this.svgHandle_.setAttribute(this.lengthAttribute_,this.handleLength_)}constrainHandlePosition_(a){return a=0>=a||isNaN(a)?0:Math.min(a,this.scrollbarLength_-this.handleLength_)}setHandlePosition(a){this.handlePosition_=a;this.svgHandle_.setAttribute(this.positionAttribute_,this.handlePosition_)}setScrollbarLength_(a){this.scrollbarLength_=
|
|
537
|
-
this.scrollbarLength_)}setPosition(a,b){this.position.x=a;this.position.y=b;setCssTransform$$module$build$src$core$utils$dom(this.outerSvg_,"translate("+(this.position.x+this.origin_.x)+"px,"+(this.position.y+this.origin_.y)+"px)")}resize(a){if(!a&&(a=this.workspace.getMetrics(),!a))return;this.oldHostMetrics_&&Scrollbar$$module$build$src$core$scrollbar.metricsAreEquivalent_(a,
|
|
538
|
-
this.oldHostMetrics_.viewWidth!==a.viewWidth||this.oldHostMetrics_.viewHeight!==a.viewHeight||this.oldHostMetrics_.absoluteLeft!==a.absoluteLeft||this.oldHostMetrics_.absoluteTop!==a.absoluteTop:!0}resizeHorizontal_(a){this.requiresViewResize_(a)?this.resizeViewHorizontal(a):this.resizeContentHorizontal(a)}resizeViewHorizontal(a){var b=
|
|
539
|
-
this.margin_;this.pair_&&this.workspace.RTL&&(b+=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness);this.setPosition(b,a.absoluteTop+a.viewHeight-Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness-this.margin_);this.resizeContentHorizontal(a)}resizeContentHorizontal(a){if(a.viewWidth>=a.scrollWidth)this.setHandleLength_(this.scrollbarLength_),
|
|
540
|
-
a.scrollWidth;b=this.constrainHandleLength_(b);this.setHandleLength_(b);b=a.scrollWidth-a.viewWidth;var c=this.scrollbarLength_-this.handleLength_;a=(a.viewLeft-a.scrollLeft)/b*c;a=this.constrainHandlePosition_(a);this.setHandlePosition(a);this.ratio=c/b}}resizeVertical_(a){this.requiresViewResize_(a)?this.resizeViewVertical(a):this.resizeContentVertical(a)}resizeViewVertical(a){let b=
|
|
541
|
-
b));this.setPosition(this.workspace.RTL?a.absoluteLeft+this.margin_:a.absoluteLeft+a.viewWidth-Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness-this.margin_,a.absoluteTop+this.margin_);this.resizeContentVertical(a)}resizeContentVertical(a){if(a.viewHeight>=a.scrollHeight)this.setHandleLength_(this.scrollbarLength_),this.setHandlePosition(0),this.pair_||
|
|
542
|
-
this.setHandleLength_(b);b=a.scrollHeight-a.viewHeight;var c=this.scrollbarLength_-this.handleLength_;a=(a.viewTop-a.scrollTop)/b*c;a=this.constrainHandlePosition_(a);this.setHandlePosition(a);this.ratio=c/b}}createDom_(a){let b="blocklyScrollbar"+(this.horizontal?"Horizontal":"Vertical");a&&(b+=" "+a);this.outerSvg_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.SVG,
|
|
543
|
-
{},this.outerSvg_);this.svgBackground_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"blocklyScrollbarBackground"},this.svgGroup_);a=Math.floor((Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness-5)/2);this.svgHandle_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"blocklyScrollbarHandle",
|
|
544
|
-
"fill");this.workspace.getThemeManager().subscribe(this.svgHandle_,"scrollbarOpacity","fill-opacity");insertAfter$$module$build$src$core$utils$dom(this.outerSvg_,this.workspace.getParentSvg())}isVisible(){return this.isVisible_}setContainerVisible(a){const b=a!==this.containerVisible_;this.containerVisible_=a;b&&this.updateDisplay_()}setVisible(a){const b=a!==this.isVisible();if(this.pair_)throw Error("Unable to toggle visibility of paired scrollbars.");
|
|
545
|
-
this.isVisible()?this.outerSvg_.setAttribute("display","block"):this.outerSvg_.setAttribute("display","none")}onMouseDownBar_(a){this.workspace.markFocused();clearTouchIdentifier$$module$build$src$core$touch();this.cleanUp_();if(isRightButton$$module$build$src$core$browser_events(a))a.stopPropagation();else{var b=mouseToSvg$$module$build$src$core$browser_events(a,this.workspace.getParentSvg(),this.workspace.getInverseScreenCTM());
|
|
546
|
-
c=this.horizontal?c.x:c.y;var d=this.handlePosition_,e=.95*this.handleLength_;b<=c?d-=e:b>=c+this.handleLength_&&(d+=e);this.setHandlePosition(this.constrainHandlePosition_(d));this.updateMetrics_();a.stopPropagation();a.preventDefault()}}onMouseDownHandle_(a){this.workspace.markFocused();this.cleanUp_();isRightButton$$module$build$src$core$browser_events(a)?a.stopPropagation():(this.startDragHandle=
|
|
547
|
-
a.clientY,
|
|
548
|
-
a.clientY)-this.startDragMouse_)));this.updateMetrics_()}onMouseUpHandle_(){this.workspace.resetDragSurface();clearTouchIdentifier$$module$build$src$core$touch();this.cleanUp_()}cleanUp_(){this.workspace.hideChaff(!0);
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness=TOUCH_ENABLED$$module$build$src$core$touch?25:15;Scrollbar$$module$build$src$core$scrollbar.DEFAULT_SCROLLBAR_MARGIN=.5;var module$build$src$core$scrollbar={};module$build$src$core$scrollbar.Scrollbar=Scrollbar$$module$build$src$core$scrollbar;var Bubble$$module$build$src$core$bubble=class{constructor(a,b,c,d,e,f){this.resizeGroup_=this.bubbleBack_=this.bubbleArrow_=this.bubbleGroup_=null;this.height_=this.width_=this.relativeTop_=this.relativeLeft_=0;this.autoLayout_=!0;this.onMouseDownResizeWrapper_=this.onMouseDownBubbleWrapper_=this.moveCallback_=this.resizeCallback_=null;this.rendered_=this.disposed=!1;this.workspace_=a;this.content_=b;this.shape_=c;c=Bubble$$module$build$src$core$bubble.ARROW_ANGLE;this.workspace_.RTL&&(c=-c);this.arrow_radians_=
|
|
526
|
+
a.blockId}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,BUBBLE_OPEN$$module$build$src$core$events$utils,BubbleOpen$$module$build$src$core$events$events_bubble_open);var module$build$src$core$events$events_bubble_open={};module$build$src$core$events$events_bubble_open.BubbleOpen=BubbleOpen$$module$build$src$core$events$events_bubble_open;var Scrollbar$$module$build$src$core$scrollbar=class{constructor(a,b,c,d,e){this.workspace=a;this.horizontal=b;this.oldHostMetrics_=null;this.ratio=1;this.startDragHandle=this.handlePosition_=this.handleLength_=this.scrollbarLength_=this.startDragMouse_=0;this.containerVisible_=this.isVisible_=!0;this.svgGroup_=this.outerSvg_=this.svgHandle_=this.svgBackground_=null;this.lengthAttribute_="width";this.positionAttribute_="x";this.onMouseMoveWrapper_=this.onMouseUpWrapper_=null;this.pair_=c||!1;this.margin_=
|
|
527
|
+
void 0!==e?e:Scrollbar$$module$build$src$core$scrollbar.DEFAULT_SCROLLBAR_MARGIN;this.origin_=new Coordinate$$module$build$src$core$utils$coordinate(0,0);this.createDom_(d);this.position=new Coordinate$$module$build$src$core$utils$coordinate(0,0);a=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness;b?(this.svgBackground_.setAttribute("height",String(a)),this.outerSvg_.setAttribute("height",String(a)),this.svgHandle_.setAttribute("height",String(a-5)),this.svgHandle_.setAttribute("y","2.5")):
|
|
528
|
+
(this.svgBackground_.setAttribute("width",String(a)),this.outerSvg_.setAttribute("width",String(a)),this.svgHandle_.setAttribute("width",String(a-5)),this.svgHandle_.setAttribute("x","2.5"),this.lengthAttribute_="height",this.positionAttribute_="y");this.onMouseDownBarWrapper_=conditionalBind$$module$build$src$core$browser_events(this.svgBackground_,"mousedown",this,this.onMouseDownBar_);this.onMouseDownHandleWrapper_=conditionalBind$$module$build$src$core$browser_events(this.svgHandle_,"mousedown",
|
|
529
|
+
this,this.onMouseDownHandle_)}dispose(){this.cleanUp_();this.onMouseDownBarWrapper_&&(unbind$$module$build$src$core$browser_events(this.onMouseDownBarWrapper_),this.onMouseDownBarWrapper_=null);this.onMouseDownHandleWrapper_&&(unbind$$module$build$src$core$browser_events(this.onMouseDownHandleWrapper_),this.onMouseDownHandleWrapper_=null);removeNode$$module$build$src$core$utils$dom(this.outerSvg_);this.svgBackground_=this.svgGroup_=this.outerSvg_=null;this.svgHandle_&&(this.workspace.getThemeManager().unsubscribe(this.svgHandle_),
|
|
530
|
+
this.svgHandle_=null)}constrainHandleLength_(a){return a=0>=a||isNaN(a)?0:Math.min(a,this.scrollbarLength_)}setHandleLength_(a){this.handleLength_=a;this.svgHandle_.setAttribute(this.lengthAttribute_,String(this.handleLength_))}constrainHandlePosition_(a){return a=0>=a||isNaN(a)?0:Math.min(a,this.scrollbarLength_-this.handleLength_)}setHandlePosition(a){this.handlePosition_=a;this.svgHandle_.setAttribute(this.positionAttribute_,String(this.handlePosition_))}setScrollbarLength_(a){this.scrollbarLength_=
|
|
531
|
+
a;this.outerSvg_.setAttribute(this.lengthAttribute_,String(this.scrollbarLength_));this.svgBackground_.setAttribute(this.lengthAttribute_,String(this.scrollbarLength_))}setPosition(a,b){this.position.x=a;this.position.y=b;setCssTransform$$module$build$src$core$utils$dom(this.outerSvg_,"translate("+(this.position.x+this.origin_.x)+"px,"+(this.position.y+this.origin_.y)+"px)")}resize(a){if(!a&&(a=this.workspace.getMetrics(),!a))return;this.oldHostMetrics_&&Scrollbar$$module$build$src$core$scrollbar.metricsAreEquivalent_(a,
|
|
532
|
+
this.oldHostMetrics_)||(this.horizontal?this.resizeHorizontal_(a):this.resizeVertical_(a),this.oldHostMetrics_=a,this.updateMetrics_())}requiresViewResize_(a){return this.oldHostMetrics_?this.oldHostMetrics_.viewWidth!==a.viewWidth||this.oldHostMetrics_.viewHeight!==a.viewHeight||this.oldHostMetrics_.absoluteLeft!==a.absoluteLeft||this.oldHostMetrics_.absoluteTop!==a.absoluteTop:!0}resizeHorizontal_(a){this.requiresViewResize_(a)?this.resizeViewHorizontal(a):this.resizeContentHorizontal(a)}resizeViewHorizontal(a){var b=
|
|
533
|
+
a.viewWidth-2*this.margin_;this.pair_&&(b-=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness);this.setScrollbarLength_(Math.max(0,b));b=a.absoluteLeft+this.margin_;this.pair_&&this.workspace.RTL&&(b+=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness);this.setPosition(b,a.absoluteTop+a.viewHeight-Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness-this.margin_);this.resizeContentHorizontal(a)}resizeContentHorizontal(a){if(a.viewWidth>=a.scrollWidth)this.setHandleLength_(this.scrollbarLength_),
|
|
534
|
+
this.setHandlePosition(0),this.pair_||this.setVisible(!1);else{this.pair_||this.setVisible(!0);var b=this.scrollbarLength_*a.viewWidth/a.scrollWidth;b=this.constrainHandleLength_(b);this.setHandleLength_(b);b=a.scrollWidth-a.viewWidth;var c=this.scrollbarLength_-this.handleLength_;a=(a.viewLeft-a.scrollLeft)/b*c;a=this.constrainHandlePosition_(a);this.setHandlePosition(a);this.ratio=c/b}}resizeVertical_(a){this.requiresViewResize_(a)?this.resizeViewVertical(a):this.resizeContentVertical(a)}resizeViewVertical(a){let b=
|
|
535
|
+
a.viewHeight-2*this.margin_;this.pair_&&(b-=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness);this.setScrollbarLength_(Math.max(0,b));this.setPosition(this.workspace.RTL?a.absoluteLeft+this.margin_:a.absoluteLeft+a.viewWidth-Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness-this.margin_,a.absoluteTop+this.margin_);this.resizeContentVertical(a)}resizeContentVertical(a){if(a.viewHeight>=a.scrollHeight)this.setHandleLength_(this.scrollbarLength_),this.setHandlePosition(0),this.pair_||
|
|
536
|
+
this.setVisible(!1);else{this.pair_||this.setVisible(!0);var b=this.scrollbarLength_*a.viewHeight/a.scrollHeight;b=this.constrainHandleLength_(b);this.setHandleLength_(b);b=a.scrollHeight-a.viewHeight;var c=this.scrollbarLength_-this.handleLength_;a=(a.viewTop-a.scrollTop)/b*c;a=this.constrainHandlePosition_(a);this.setHandlePosition(a);this.ratio=c/b}}createDom_(a){let b="blocklyScrollbar"+(this.horizontal?"Horizontal":"Vertical");a&&(b+=" "+a);this.outerSvg_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.SVG,
|
|
537
|
+
{"class":b});this.svgGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{},this.outerSvg_);this.svgBackground_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"blocklyScrollbarBackground"},this.svgGroup_);a=Math.floor((Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness-5)/2);this.svgHandle_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"blocklyScrollbarHandle",
|
|
538
|
+
rx:a,ry:a},this.svgGroup_);this.workspace.getThemeManager().subscribe(this.svgHandle_,"scrollbarColour","fill");this.workspace.getThemeManager().subscribe(this.svgHandle_,"scrollbarOpacity","fill-opacity");insertAfter$$module$build$src$core$utils$dom(this.outerSvg_,this.workspace.getParentSvg())}isVisible(){return this.isVisible_}setContainerVisible(a){const b=a!==this.containerVisible_;this.containerVisible_=a;b&&this.updateDisplay_()}setVisible(a){const b=a!==this.isVisible();if(this.pair_)throw Error("Unable to toggle visibility of paired scrollbars.");
|
|
539
|
+
this.isVisible_=a;b&&this.updateDisplay_()}updateDisplay_(){this.containerVisible_&&this.isVisible()?this.outerSvg_.setAttribute("display","block"):this.outerSvg_.setAttribute("display","none")}onMouseDownBar_(a){this.workspace.markFocused();clearTouchIdentifier$$module$build$src$core$touch();this.cleanUp_();if(isRightButton$$module$build$src$core$browser_events(a))a.stopPropagation();else{var b=mouseToSvg$$module$build$src$core$browser_events(a,this.workspace.getParentSvg(),this.workspace.getInverseScreenCTM());
|
|
540
|
+
b=this.horizontal?b.x:b.y;var c=getInjectionDivXY$$module$build$src$core$utils$svg_math(this.svgHandle_);c=this.horizontal?c.x:c.y;var d=this.handlePosition_,e=.95*this.handleLength_;b<=c?d-=e:b>=c+this.handleLength_&&(d+=e);this.setHandlePosition(this.constrainHandlePosition_(d));this.updateMetrics_();a.stopPropagation();a.preventDefault()}}onMouseDownHandle_(a){this.workspace.markFocused();this.cleanUp_();isRightButton$$module$build$src$core$browser_events(a)?a.stopPropagation():(this.startDragHandle=
|
|
541
|
+
this.handlePosition_,this.workspace.setupDragSurface(),this.startDragMouse_=this.horizontal?a.clientX:a.clientY,this.onMouseUpWrapper_=conditionalBind$$module$build$src$core$browser_events(document,"mouseup",this,this.onMouseUpHandle_),this.onMouseMoveWrapper_=conditionalBind$$module$build$src$core$browser_events(document,"mousemove",this,this.onMouseMoveHandle_),a.stopPropagation(),a.preventDefault())}onMouseMoveHandle_(a){this.setHandlePosition(this.constrainHandlePosition_(this.startDragHandle+
|
|
542
|
+
((this.horizontal?a.clientX:a.clientY)-this.startDragMouse_)));this.updateMetrics_()}onMouseUpHandle_(){this.workspace.resetDragSurface();clearTouchIdentifier$$module$build$src$core$touch();this.cleanUp_()}cleanUp_(){this.workspace.hideChaff(!0);this.onMouseUpWrapper_&&(unbind$$module$build$src$core$browser_events(this.onMouseUpWrapper_),this.onMouseUpWrapper_=null);this.onMouseMoveWrapper_&&(unbind$$module$build$src$core$browser_events(this.onMouseMoveWrapper_),this.onMouseMoveWrapper_=null)}getRatio_(){let a=
|
|
543
|
+
this.handlePosition_/(this.scrollbarLength_-this.handleLength_);isNaN(a)&&(a=0);return a}updateMetrics_(){const a=this.getRatio_();this.horizontal?this.workspace.setMetrics({x:a}):this.workspace.setMetrics({y:a})}set(a,b){this.setHandlePosition(this.constrainHandlePosition_(a*this.ratio));(b||void 0===b)&&this.updateMetrics_()}setOrigin(a,b){this.origin_=new Coordinate$$module$build$src$core$utils$coordinate(a,b)}static metricsAreEquivalent_(a,b){return a.viewWidth===b.viewWidth&&a.viewHeight===b.viewHeight&&
|
|
544
|
+
a.viewLeft===b.viewLeft&&a.viewTop===b.viewTop&&a.absoluteTop===b.absoluteTop&&a.absoluteLeft===b.absoluteLeft&&a.scrollWidth===b.scrollWidth&&a.scrollHeight===b.scrollHeight&&a.scrollLeft===b.scrollLeft&&a.scrollTop===b.scrollTop}};Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness=TOUCH_ENABLED$$module$build$src$core$touch?25:15;Scrollbar$$module$build$src$core$scrollbar.DEFAULT_SCROLLBAR_MARGIN=.5;var module$build$src$core$scrollbar={};module$build$src$core$scrollbar.Scrollbar=Scrollbar$$module$build$src$core$scrollbar;var Bubble$$module$build$src$core$bubble=class{constructor(a,b,c,d,e,f){this.resizeGroup_=this.bubbleBack_=this.bubbleArrow_=this.bubbleGroup_=null;this.height_=this.width_=this.relativeTop_=this.relativeLeft_=0;this.autoLayout_=!0;this.onMouseDownResizeWrapper_=this.onMouseDownBubbleWrapper_=this.moveCallback_=this.resizeCallback_=null;this.rendered_=this.disposed=!1;this.workspace_=a;this.content_=b;this.shape_=c;c=Bubble$$module$build$src$core$bubble.ARROW_ANGLE;this.workspace_.RTL&&(c=-c);this.arrow_radians_=
|
|
552
545
|
toRadians$$module$build$src$core$utils$math(c);a.getBubbleCanvas().appendChild(this.createDom_(b,!(!e||!f)));this.setAnchorLocation(d);e&&f||(a=this.content_.getBBox(),e=a.width+2*Bubble$$module$build$src$core$bubble.BORDER_WIDTH,f=a.height+2*Bubble$$module$build$src$core$bubble.BORDER_WIDTH);this.setBubbleSize(e,f);this.positionBubble_();this.renderArrow_();this.rendered_=!0}createDom_(a,b){this.bubbleGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,
|
|
553
546
|
{});var c={filter:"url(#"+this.workspace_.getRenderer().getConstants().embossFilterId+")"};JavaFx$$module$build$src$core$utils$useragent&&(c={});c=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,c,this.bubbleGroup_);this.bubbleArrow_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.PATH,{},c);this.bubbleBack_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"blocklyDraggable",
|
|
554
547
|
x:0,y:0,rx:Bubble$$module$build$src$core$bubble.BORDER_WIDTH,ry:Bubble$$module$build$src$core$bubble.BORDER_WIDTH},c);b?(this.resizeGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{"class":this.workspace_.RTL?"blocklyResizeSW":"blocklyResizeSE"},this.bubbleGroup_),b=2*Bubble$$module$build$src$core$bubble.BORDER_WIDTH,createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.POLYGON,{points:"0,x x,x x,0".replace(/x/g,b.toString())},
|
|
@@ -570,8 +563,8 @@ Bubble$$module$build$src$core$bubble.onMouseUpWrapper_=null);Bubble$$module$buil
|
|
|
570
563
|
{"class":"blocklyText blocklyBubbleText blocklyNoPointerEvents",y:Bubble$$module$build$src$core$bubble.BORDER_WIDTH});a=a.split("\n");for(let c=0;c<a.length;c++){const d=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.TSPAN,{dy:"1em",x:Bubble$$module$build$src$core$bubble.BORDER_WIDTH},b),e=document.createTextNode(a[c]);d.appendChild(e)}return b}static createNonEditableBubble(a,b,c){c=new Bubble$$module$build$src$core$bubble(b.workspace,a,b.pathObject.svgPath,
|
|
571
564
|
c,null,null);c.setSvgId(b.id);if(b.RTL){b=a.getBBox().width;for(let d=0,e;e=a.childNodes[d];d++)e.setAttribute("text-anchor","end"),e.setAttribute("x",(b+Bubble$$module$build$src$core$bubble.BORDER_WIDTH).toString())}return c}};Bubble$$module$build$src$core$bubble.BORDER_WIDTH=6;Bubble$$module$build$src$core$bubble.ARROW_THICKNESS=5;Bubble$$module$build$src$core$bubble.ARROW_ANGLE=20;Bubble$$module$build$src$core$bubble.ARROW_BEND=4;Bubble$$module$build$src$core$bubble.ANCHOR_RADIUS=8;
|
|
572
565
|
Bubble$$module$build$src$core$bubble.onMouseUpWrapper_=null;Bubble$$module$build$src$core$bubble.onMouseMoveWrapper_=null;var module$build$src$core$bubble={};module$build$src$core$bubble.Bubble=Bubble$$module$build$src$core$bubble;var DEFAULT_SNAP_RADIUS$$module$build$src$core$config,module$build$src$core$config;DEFAULT_SNAP_RADIUS$$module$build$src$core$config=28;$.config$$module$build$src$core$config={dragRadius:5,flyoutDragRadius:10,snapRadius:DEFAULT_SNAP_RADIUS$$module$build$src$core$config,connectingSnapRadius:DEFAULT_SNAP_RADIUS$$module$build$src$core$config,currentConnectionPreference:8,bumpDelay:250};module$build$src$core$config={};module$build$src$core$config.config=$.config$$module$build$src$core$config;var Icon$$module$build$src$core$icon=class{constructor(a){this.iconGroup_=null;this.collapseHidden=!0;this.SIZE=17;this.iconXY_=this.bubble_=null;this.block_=a}createIcon(){this.iconGroup_||(this.iconGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{"class":"blocklyIconGroup"}),this.block_.isInFlyout&&addClass$$module$build$src$core$utils$dom(this.iconGroup_,"blocklyIconGroupReadonly"),this.drawIcon_(this.iconGroup_),this.block_.getSvgRoot().appendChild(this.iconGroup_),
|
|
573
|
-
conditionalBind$$module$build$src$core$browser_events(this.iconGroup_,"mouseup",this,this.iconClick_),this.updateEditable())}dispose(){removeNode$$module$build$src$core$utils$dom(this.iconGroup_);this.
|
|
574
|
-
|
|
566
|
+
conditionalBind$$module$build$src$core$browser_events(this.iconGroup_,"mouseup",this,this.iconClick_),this.updateEditable())}dispose(){removeNode$$module$build$src$core$utils$dom(this.iconGroup_);this.setVisible(!1)}updateEditable(){}isVisible(){return!!this.bubble_}iconClick_(a){this.block_.workspace.isDragging()||this.block_.isInFlyout||isRightButton$$module$build$src$core$browser_events(a)||this.setVisible(!this.isVisible())}applyColour(){this.isVisible()&&this.bubble_.setColour(this.block_.style.colourPrimary)}setIconLocation(a){this.iconXY_=
|
|
567
|
+
a;this.isVisible()&&this.bubble_.setAnchorLocation(a)}computeIconLocation(){var a=this.block_.getRelativeToSurfaceXY();const b=getRelativeXY$$module$build$src$core$utils$svg_math(this.iconGroup_);a=new Coordinate$$module$build$src$core$utils$coordinate(a.x+b.x+this.SIZE/2,a.y+b.y+this.SIZE/2);Coordinate$$module$build$src$core$utils$coordinate.equals(this.getIconLocation(),a)||this.setIconLocation(a)}getIconLocation(){return this.iconXY_}getCorrectedSize(){return new Size$$module$build$src$core$utils$size(this.SIZE,
|
|
575
568
|
this.SIZE-2)}drawIcon_(a){}setVisible(a){}},module$build$src$core$icon={};module$build$src$core$icon.Icon=Icon$$module$build$src$core$icon;$.module$build$src$core$utils$object={};$.module$build$src$core$utils$object.deepMerge=deepMerge$$module$build$src$core$utils$object;$.module$build$src$core$utils$object.inherits=inherits$$module$build$src$core$utils$object;$.module$build$src$core$utils$object.mixin=mixin$$module$build$src$core$utils$object;$.module$build$src$core$utils$object.values=values$$module$build$src$core$utils$object;var Theme$$module$build$src$core$theme=class{constructor(a,b,c,d){this.name=a;this.startHats=null;this.blockStyles=b||Object.create(null);this.categoryStyles=c||Object.create(null);this.componentStyles=d||Object.create(null);this.fontStyle=Object.create(null);register$$module$build$src$core$registry(Type$$module$build$src$core$registry.THEME,a,this)}getClassName(){return this.name+"-theme"}setBlockStyle(a,b){this.blockStyles[a]=b}setCategoryStyle(a,b){this.categoryStyles[a]=b}getComponentStyle(a){return(a=
|
|
576
569
|
this.componentStyles[a])&&"string"===typeof a&&this.getComponentStyle(a)?this.getComponentStyle(a):a?String(a):null}setComponentStyle(a,b){this.componentStyles[a]=b}setFontStyle(a){this.fontStyle=a}setStartHats(a){this.startHats=a}static defineTheme(a,b){a=a.toLowerCase();const c=new Theme$$module$build$src$core$theme(a);let d=b.base;if(d){if("string"===typeof d){let e;d=null!=(e=getObject$$module$build$src$core$registry(Type$$module$build$src$core$registry.THEME,d))?e:void 0}d instanceof Theme$$module$build$src$core$theme&&
|
|
577
570
|
(deepMerge$$module$build$src$core$utils$object(c,d),c.name=a)}deepMerge$$module$build$src$core$utils$object(c.blockStyles,b.blockStyles);deepMerge$$module$build$src$core$utils$object(c.categoryStyles,b.categoryStyles);deepMerge$$module$build$src$core$utils$object(c.componentStyles,b.componentStyles);deepMerge$$module$build$src$core$utils$object(c.fontStyle,b.fontStyle);null!==b.startHats&&(c.startHats=b.startHats);return c}},module$build$src$core$theme={};module$build$src$core$theme.Theme=Theme$$module$build$src$core$theme;var defaultBlockStyles$$module$build$src$core$theme$classic={colour_blocks:{colourPrimary:"20"},list_blocks:{colourPrimary:"260"},logic_blocks:{colourPrimary:"210"},loop_blocks:{colourPrimary:"120"},math_blocks:{colourPrimary:"230"},procedure_blocks:{colourPrimary:"290"},text_blocks:{colourPrimary:"160"},variable_blocks:{colourPrimary:"330"},variable_dynamic_blocks:{colourPrimary:"310"},hat_blocks:{colourPrimary:"330",hat:"cap"}},categoryStyles$$module$build$src$core$theme$classic={colour_category:{colour:"20"},
|
|
@@ -586,17 +579,17 @@ null!=(w=a.parentWorkspace)?w:null;this.plugins=y}static parseMoveOptions_(a,b){
|
|
|
586
579
|
"object"===typeof d.scrollbars;d.drag=d.scrollbars?void 0===c.drag?!0:!!c.drag:!1;return d}static parseZoomOptions_(a){a=a.zoom||{};const b={};b.controls=void 0===a.controls?!1:!!a.controls;b.wheel=void 0===a.wheel?!1:!!a.wheel;b.startScale=void 0===a.startScale?1:Number(a.startScale);b.maxScale=void 0===a.maxScale?3:Number(a.maxScale);b.minScale=void 0===a.minScale?.3:Number(a.minScale);b.scaleSpeed=void 0===a.scaleSpeed?1.2:Number(a.scaleSpeed);b.pinch=void 0===a.pinch?b.wheel||b.controls:!!a.pinch;
|
|
587
580
|
return b}static parseGridOptions_(a){a=a.grid||{};const b={};b.spacing=Number(a.spacing)||0;b.colour=a.colour||"#888";b.length=void 0===a.length?1:Number(a.length);b.snap=0<b.spacing&&!!a.snap;return b}static parseThemeOptions_(a){a=a.theme||Classic$$module$build$src$core$theme$classic;return"string"===typeof a?getObject$$module$build$src$core$registry(Type$$module$build$src$core$registry.THEME,a):a instanceof Theme$$module$build$src$core$theme?a:Theme$$module$build$src$core$theme.defineTheme(a.name||
|
|
588
581
|
"builtin"+getNextUniqueId$$module$build$src$core$utils$idgenerator(),a)}},module$build$src$core$options={};module$build$src$core$options.Options=Options$$module$build$src$core$options;var module$build$src$core$mutator;
|
|
589
|
-
$.Mutator$$module$build$src$core$mutator=class extends Icon$$module$build$src$core$icon{constructor(a,b){super(a);this.workspace_=null;this.workspaceHeight_=this.workspaceWidth_=0;this.sourceListener_=this.rootBlock_=this.svgDialog_=null;this.
|
|
582
|
+
$.Mutator$$module$build$src$core$mutator=class extends Icon$$module$build$src$core$icon{constructor(a,b){super(a);this.workspace_=null;this.workspaceHeight_=this.workspaceWidth_=0;this.updateWorkspacePid_=this.sourceListener_=this.rootBlock_=this.svgDialog_=null;this.quarkNames_=b}setBlock(a){this.block_=a}getWorkspace(){return this.workspace_}drawIcon_(a){createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"blocklyIconShape",rx:"4",ry:"4",height:"16",
|
|
590
583
|
width:"16"},a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.PATH,{"class":"blocklyIconSymbol",d:"m4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 -0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z"},
|
|
591
584
|
a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.CIRCLE,{"class":"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},a)}iconClick_(a){this.block_.isEditable()&&super.iconClick_(a)}createEditor_(){this.svgDialog_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.SVG,{x:Bubble$$module$build$src$core$bubble.BORDER_WIDTH,y:Bubble$$module$build$src$core$bubble.BORDER_WIDTH});if(this.quarkNames_.length){var a=createElement$$module$build$src$core$utils$xml("xml");
|
|
592
585
|
for(let d=0,e;e=this.quarkNames_[d];d++){var b=createElement$$module$build$src$core$utils$xml("block");b.setAttribute("type",e);a.appendChild(b)}}else a=null;b=new Options$$module$build$src$core$options({disable:!1,parentWorkspace:this.block_.workspace,media:this.block_.workspace.options.pathToMedia,rtl:this.block_.RTL,horizontalLayout:!1,renderer:this.block_.workspace.options.renderer,rendererOverrides:this.block_.workspace.options.rendererOverrides});b.toolboxPosition=this.block_.RTL?Position$$module$build$src$core$utils$toolbox.RIGHT:
|
|
593
586
|
Position$$module$build$src$core$utils$toolbox.LEFT;const c=!!a;c&&(b.languageTree=convertToolboxDefToJson$$module$build$src$core$utils$toolbox(a));this.workspace_=this.newWorkspaceSvg(b);this.workspace_.internalIsMutator=!0;this.workspace_.addChangeListener(disableOrphans$$module$build$src$core$events$utils);a=c?this.workspace_.addFlyout(Svg$$module$build$src$core$utils$svg.G):null;b=this.workspace_.createDom("blocklyMutatorBackground");a&&b.insertBefore(a,this.workspace_.svgBlockCanvas_);this.svgDialog_.appendChild(b);
|
|
594
587
|
return this.svgDialog_}newWorkspaceSvg(a){throw Error("The implementation of newWorkspaceSvg should be monkey-patched in by blockly.ts");}updateEditable(){super.updateEditable();this.block_.isInFlyout||(this.block_.isEditable()?this.iconGroup_&&removeClass$$module$build$src$core$utils$dom(this.iconGroup_,"blocklyIconGroupReadonly"):(this.setVisible(!1),this.iconGroup_&&addClass$$module$build$src$core$utils$dom(this.iconGroup_,"blocklyIconGroupReadonly")))}resizeBubble_(){var a=2*Bubble$$module$build$src$core$bubble.BORDER_WIDTH;
|
|
595
|
-
const b=this.workspace_.getCanvas().getBBox();let c=b.width+b.x,d=b.height+3*a;const e=this.workspace_.getFlyout();if(e){const f=e.getWorkspace().getMetricsManager().getScrollMetrics();d=Math.max(d,f.height+20);c+=e.getWidth()}this.block_.RTL&&(c=-b.x);c+=3*a;if(Math.abs(this.workspaceWidth_-c)>a||Math.abs(this.workspaceHeight_-d)>a)this.workspaceWidth_=c,this.workspaceHeight_=d,this.bubble_.setBubbleSize(c+a,d+a),this.svgDialog_.setAttribute("width"
|
|
596
|
-
this.workspaceHeight_),this.workspace_.setCachedParentSvgSize(this.workspaceWidth_,this.workspaceHeight_);this.block_.RTL&&(a="translate("+this.workspaceWidth_+",0)",this.workspace_.getCanvas().setAttribute("transform",a));this.workspace_.resize()}onBubbleMove_(){this.workspace_&&this.workspace_.recordDragTargets()}setVisible(a){if(a!==this.isVisible())if(fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(BUBBLE_OPEN$$module$build$src$core$events$utils))(this.block_,
|
|
588
|
+
const b=this.workspace_.getCanvas().getBBox();let c=b.width+b.x,d=b.height+3*a;const e=this.workspace_.getFlyout();if(e){const f=e.getWorkspace().getMetricsManager().getScrollMetrics();d=Math.max(d,f.height+20);c+=e.getWidth()}this.block_.RTL&&(c=-b.x);c+=3*a;if(Math.abs(this.workspaceWidth_-c)>a||Math.abs(this.workspaceHeight_-d)>a)this.workspaceWidth_=c,this.workspaceHeight_=d,this.bubble_.setBubbleSize(c+a,d+a),this.svgDialog_.setAttribute("width",`${this.workspaceWidth_}`),this.svgDialog_.setAttribute("height",
|
|
589
|
+
`${this.workspaceHeight_}`),this.workspace_.setCachedParentSvgSize(this.workspaceWidth_,this.workspaceHeight_);this.block_.RTL&&(a="translate("+this.workspaceWidth_+",0)",this.workspace_.getCanvas().setAttribute("transform",a));this.workspace_.resize()}onBubbleMove_(){this.workspace_&&this.workspace_.recordDragTargets()}setVisible(a){if(a!==this.isVisible())if(fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(BUBBLE_OPEN$$module$build$src$core$events$utils))(this.block_,
|
|
597
590
|
a,"mutator")),a){this.bubble_=new Bubble$$module$build$src$core$bubble(this.block_.workspace,this.createEditor_(),this.block_.pathObject.svgPath,this.iconXY_,null,null);this.bubble_.setSvgId(this.block_.id);this.bubble_.registerMoveEvent(this.onBubbleMove_.bind(this));var b=this.workspace_.options.languageTree;a=this.workspace_.getFlyout();b&&(a.init(this.workspace_),a.show(b));this.rootBlock_=this.block_.decompose(this.workspace_);b=this.rootBlock_.getDescendants(!1);for(let c=0,d;d=b[c];c++)d.render();
|
|
598
591
|
this.rootBlock_.setMovable(!1);this.rootBlock_.setDeletable(!1);a?(b=2*a.CORNER_RADIUS,a=this.rootBlock_.RTL?a.getWidth()+b:b):a=b=16;this.block_.RTL&&(a=-a);this.rootBlock_.moveBy(a,b);if(this.block_.saveConnections){const c=this.rootBlock_;this.block_.saveConnections(c);this.sourceListener_=()=>{this.block_&&this.block_.saveConnections&&this.block_.saveConnections(c)};this.block_.workspace.addChangeListener(this.sourceListener_)}this.resizeBubble_();this.workspace_.addChangeListener(this.workspaceChanged_.bind(this));
|
|
599
|
-
this.updateWorkspace_();this.applyColour()}else this.svgDialog_=null,this.workspace_.dispose(),this.rootBlock_=this.workspace_=null,null==(b=this.bubble_)||b.dispose(),this.bubble_=null,this.workspaceHeight_=this.workspaceWidth_=0,this.sourceListener_&&(this.block_.workspace.removeChangeListener(this.sourceListener_),this.sourceListener_=null)}workspaceChanged_(a){this.shouldIgnoreMutatorEvent_(a)||this.updateWorkspacePid_||(this.updateWorkspacePid_=setTimeout(()=>{this.updateWorkspacePid_=
|
|
592
|
+
this.updateWorkspace_();this.applyColour()}else this.svgDialog_=null,this.workspace_.dispose(),this.rootBlock_=this.workspace_=null,null==(b=this.bubble_)||b.dispose(),this.bubble_=null,this.workspaceHeight_=this.workspaceWidth_=0,this.sourceListener_&&(this.block_.workspace.removeChangeListener(this.sourceListener_),this.sourceListener_=null)}workspaceChanged_(a){this.shouldIgnoreMutatorEvent_(a)||this.updateWorkspacePid_||(this.updateWorkspacePid_=setTimeout(()=>{this.updateWorkspacePid_=null;this.updateWorkspace_()},
|
|
600
593
|
0))}shouldIgnoreMutatorEvent_(a){return a.isUiEvent||a.type===CREATE$$module$build$src$core$events$utils||a.type===CHANGE$$module$build$src$core$events$utils&&"disabled"===a.element}updateWorkspace_(){if(!this.workspace_.isDragging()){var a=this.workspace_.getTopBlocks(!1);for(let d=0,e;e=a[d];d++){var b=e.getRelativeToSurfaceXY();20>b.y&&e.moveBy(0,20-b.y);if(e.RTL){var c=-20;const f=this.workspace_.getFlyout();f&&(c-=f.getWidth());b.x>c&&e.moveBy(c-b.x,0)}else 20>b.x&&e.moveBy(20-b.x,0)}}if(this.rootBlock_&&
|
|
601
594
|
this.rootBlock_.workspace===this.workspace_){(a=getGroup$$module$build$src$core$events$utils())||setGroup$$module$build$src$core$events$utils(!0);const d=this.block_;b=BlockChange$$module$build$src$core$events$events_block_change.getExtraBlockState_(d);c=d.rendered;d.rendered=!1;d.compose(this.rootBlock_);d.rendered=c;d.initSvg();d.rendered&&d.render();c=BlockChange$$module$build$src$core$events$events_block_change.getExtraBlockState_(d);if(b!==c){fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CHANGE$$module$build$src$core$events$utils))(d,
|
|
602
595
|
"mutation",null,b,c));const e=getGroup$$module$build$src$core$events$utils();setTimeout(function(){const f=getGroup$$module$build$src$core$events$utils();setGroup$$module$build$src$core$events$utils(e);d.bumpNeighbours();setGroup$$module$build$src$core$events$utils(f)},$.config$$module$build$src$core$config.bumpDelay)}this.workspace_.isDragging()||setTimeout(()=>this.resizeBubble_(),0);setGroup$$module$build$src$core$events$utils(a)}}dispose(){this.block_.mutator=null;super.dispose()}updateBlockStyle(){var a=
|
|
@@ -635,7 +628,7 @@ module$build$src$core$keyboard_nav$ast_node.ASTNode=ASTNode$$module$build$src$co
|
|
|
635
628
|
!0;this.parentBlock_=null;this.childBlocks_=[];this.editable_=this.movable_=this.deletable_=!0;this.collapsed_=this.isShadow_=!1;this.comment=this.outputShape_=null;this.isInsertionMarker_=!1;this.hat=void 0;this.onchangeWrapper_=this.helpUrl=this.rendered=null;this.statementInputCount=0;this.workspace=a;this.id=c&&!a.getBlockById(c)?c:genUid$$module$build$src$core$utils$idgenerator();a.setBlockById(this.id,this);this.commentModel={text:null,pinned:!1,size:new Size$$module$build$src$core$utils$size(160,
|
|
636
629
|
80)};this.xy_=new Coordinate$$module$build$src$core$utils$coordinate(0,0);this.isInFlyout=a.isFlyout;this.isInMutator=a.isMutator;this.RTL=a.RTL;if(b){this.type=b;c=Blocks$$module$build$src$core$blocks[b];if(!c||"object"!==typeof c)throw TypeError("Invalid block definition for type: "+b);Object.assign(this,c)}a.addTopBlock(this);a.addTypedBlock(this);new.target===Block$$module$build$src$core$block&&this.doInit_()}doInit_(){const a=getGroup$$module$build$src$core$events$utils();a||setGroup$$module$build$src$core$events$utils(!0);
|
|
637
630
|
const b=getRecordUndo$$module$build$src$core$events$utils();try{"function"===typeof this.init&&(setRecordUndo$$module$build$src$core$events$utils(!1),this.init(),setRecordUndo$$module$build$src$core$events$utils(b)),isEnabled$$module$build$src$core$events$utils()&&fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CREATE$$module$build$src$core$events$utils))(this))}finally{a||setGroup$$module$build$src$core$events$utils(!1),setRecordUndo$$module$build$src$core$events$utils(b)}this.inputsInlineDefault=
|
|
638
|
-
this.inputsInline;"function"===typeof this.onchange&&this.setOnChange(this.onchange)}dispose(a){if(!this.disposed){this.
|
|
631
|
+
this.inputsInline;"function"===typeof this.onchange&&this.setOnChange(this.onchange)}dispose(a){if(!this.disposed){this.unplug(a);isEnabled$$module$build$src$core$events$utils()&&fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(DELETE$$module$build$src$core$events$utils))(this));this.onchangeWrapper_&&this.workspace.removeChangeListener(this.onchangeWrapper_);disable$$module$build$src$core$events$utils();try{this.workspace.removeTopBlock(this);this.workspace.removeTypedBlock(this);
|
|
639
632
|
this.workspace.removeBlockById(this.id);for(let c=this.childBlocks_.length-1;0<=c;c--)this.childBlocks_[c].dispose(!1);for(let c=0,d;d=this.inputList[c];c++)d.dispose();this.inputList.length=0;const b=this.getConnections_(!0);for(let c=0,d;d=b[c];c++)d.dispose()}finally{enable$$module$build$src$core$events$utils(),this.disposed=!0}}}initModel(){for(let a=0,b;b=this.inputList[a];a++)for(let c=0,d;d=b.fieldRow[c];c++)d.initModel&&d.initModel()}unplug(a){this.outputConnection&&this.unplugFromRow_(a);
|
|
640
633
|
this.previousConnection&&this.unplugFromStack_(a)}unplugFromRow_(a){let b=null;this.outputConnection.isConnected()&&(b=this.outputConnection.targetConnection,this.outputConnection.disconnect());b&&a&&(a=this.getOnlyValueConnection_())&&a.isConnected()&&!a.targetBlock().isShadow()&&(a=a.targetConnection,null==a||a.disconnect(),this.workspace.connectionChecker.canConnect(a,b,!1)?b.connect(a):null==a||a.onFailedConnect(b))}getOnlyValueConnection_(){let a=null;for(let b=0;b<this.inputList.length;b++){const c=
|
|
641
634
|
this.inputList[b].connection;if(c&&c.type===ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE&&c.targetConnection){if(a)return null;a=c}}return a}unplugFromStack_(a){let b=null;this.previousConnection.isConnected()&&(b=this.previousConnection.targetConnection,this.previousConnection.disconnect());const c=this.getNextBlock();a&&c&&!c.isShadow()&&(a=this.nextConnection.targetConnection,null==a||a.disconnect(),b&&this.workspace.connectionChecker.canConnect(b,a,!1)&&b.connect(a))}getConnections_(a){a=
|
|
@@ -643,7 +636,7 @@ this.inputList[b].connection;if(c&&c.type===ConnectionType$$module$build$src$cor
|
|
|
643
636
|
c.connection.targetBlock()===a)return c;return null}getSurroundParent(){let a=this,b;do if(b=a,a=a.getParent(),!a)return null;while(a.getNextBlock()===b);return a}getNextBlock(){return this.nextConnection&&this.nextConnection.targetBlock()}getPreviousBlock(){return this.previousConnection&&this.previousConnection.targetBlock()}getFirstStatementConnection(){for(let a=0,b;b=this.inputList[a];a++)if(b.connection&&b.connection.type===ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT)return b.connection;
|
|
644
637
|
return null}getRootBlock(){let a,b=this;do a=b,b=a.parentBlock_;while(b);return a}getTopStackBlock(){let a=this,b;do b=a.getPreviousBlock();while(b&&b.getNextBlock()===a&&(a=b));return a}getChildren(a){if(!a)return this.childBlocks_;a=[];for(let c=0,d;d=this.inputList[c];c++)if(d.connection){var b=d.connection.targetBlock();b&&a.push(b)}(b=this.getNextBlock())&&a.push(b);return a}setParent(a){if(a!==this.parentBlock_){var b=this.previousConnection&&this.previousConnection.targetBlock()||this.outputConnection&&
|
|
645
638
|
this.outputConnection.targetBlock(),c=!!b;if(c&&a&&b!==a)throw Error("Block connected to superior one that is not new parent.");if(!c&&a)throw Error("Block not connected to new parent.");if(c&&!a)throw Error("Cannot set parent to null while block is still connected to superior block.");this.parentBlock_?removeElem$$module$build$src$core$utils$array(this.parentBlock_.childBlocks_,this):this.workspace.removeTopBlock(this);(this.parentBlock_=a)?a.childBlocks_.push(this):this.workspace.addTopBlock(this)}}getDescendants(a){const b=
|
|
646
|
-
[this],c=this.getChildren(a);for(let d,e=0;d=c[e];e++)b.push
|
|
639
|
+
[this],c=this.getChildren(a);for(let d,e=0;d=c[e];e++)b.push(...d.getDescendants(a));return b}isDeletable(){return this.deletable_&&!this.isShadow_&&!this.disposed&&!this.workspace.options.readOnly}setDeletable(a){this.deletable_=a}isMovable(){return this.movable_&&!this.isShadow_&&!this.disposed&&!this.workspace.options.readOnly}setMovable(a){this.movable_=a}isDuplicatable(){return this.workspace.hasBlockLimits()?this.workspace.isCapacityAvailable(getBlockTypeCounts$$module$build$src$core$common(this,
|
|
647
640
|
!0)):!0}isShadow(){return this.isShadow_}setShadow(a){this.isShadow_=a}isInsertionMarker(){return this.isInsertionMarker_}setInsertionMarker(a){this.isInsertionMarker_=a}isEditable(){return this.editable_&&!this.disposed&&!this.workspace.options.readOnly}setEditable(a){this.editable_=a;for(let b=0,c;c=this.inputList[b];b++)for(let d=0,e;e=c.fieldRow[d];d++)e.updateEditable()}isDisposed(){return this.disposed}getMatchingConnection(a,b){const c=this.getConnections_(!0);a=a.getConnections_(!0);if(c.length!==
|
|
648
641
|
a.length)throw Error("Connection lists did not match in length.");for(let d=0;d<a.length;d++)if(a[d]===b)return c[d];return null}setHelpUrl(a){this.helpUrl=a}setTooltip(a){this.tooltip=a}getTooltip(){return getTooltipOfObject$$module$build$src$core$tooltip(this)}getColour(){return this.colour_}getStyleName(){return this.styleName_}getHue(){return this.hue_}setColour(a){a=parseBlockColour$$module$build$src$core$utils$parsing(a);this.hue_=a.hue;this.colour_=a.hex}setStyle(a){this.styleName_=a}setOnChange(a){if(a&&
|
|
649
642
|
"function"!==typeof a)throw Error("onchange must be a function.");this.onchangeWrapper_&&this.workspace.removeChangeListener(this.onchangeWrapper_);this.onchange=a;this.onchangeWrapper_=a.bind(this);this.workspace.addChangeListener(this.onchangeWrapper_)}getField(a){if("string"!==typeof a)throw TypeError("Block.prototype.getField expects a string with the field name but received "+(void 0===a?"nothing":a+" of type "+typeof a)+" instead");for(let b=0,c;c=this.inputList[b];b++)for(let d=0,e;e=c.fieldRow[d];d++)if(e.name===
|
|
@@ -670,16 +663,16 @@ f.name===b&&(d=e,-1!==c))break;if(-1===c)throw Error('Named input "'+a+'" not fo
|
|
|
670
663
|
0,c)}removeInput(a,b){for(let c=0,d;d=this.inputList[c];c++)if(d.name===a)return d.type===inputTypes$$module$build$src$core$input_types.STATEMENT&&this.statementInputCount--,d.dispose(),this.inputList.splice(c,1),!0;if(b)return!1;throw Error("Input not found: "+a);}getInput(a){for(let b=0,c;c=this.inputList[b];b++)if(c.name===a)return c;return null}getInputTargetBlock(a){return(a=this.getInput(a))&&a.connection&&a.connection.targetBlock()}getCommentText(){return this.commentModel.text}setCommentText(a){this.commentModel.text!==
|
|
671
664
|
a&&(fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CHANGE$$module$build$src$core$events$utils))(this,"comment",null,this.commentModel.text,a)),this.comment=this.commentModel.text=a)}setWarningText(a,b){}setMutator(a){}getRelativeToSurfaceXY(){return this.xy_}moveBy(a,b){if(this.parentBlock_)throw Error("Block has parent.");const c=new (get$$module$build$src$core$events$utils(MOVE$$module$build$src$core$events$utils))(this);this.xy_.translate(a,b);c.recordNew();
|
|
672
665
|
fire$$module$build$src$core$events$utils(c)}makeConnection_(a){return new Connection$$module$build$src$core$connection(this,a)}allInputsFilled(a){void 0===a&&(a=!0);if(!a&&this.isShadow())return!1;for(let c=0,d;d=this.inputList[c];c++)if(d.connection){var b=d.connection.targetBlock();if(!b||!b.allInputsFilled(a))return!1}return(b=this.getNextBlock())?b.allInputsFilled(a):!0}toDevString(){let a=this.type?'"'+this.type+'" block':"Block";this.id&&(a+=' (id="'+this.id+'")');return a}};
|
|
673
|
-
Block$$module$build$src$core$block.COLLAPSED_INPUT_NAME=COLLAPSED_INPUT_NAME$$module$build$src$core$constants;Block$$module$build$src$core$block.COLLAPSED_FIELD_NAME=COLLAPSED_FIELD_NAME$$module$build$src$core$constants;var module$build$src$core$block={};module$build$src$core$block.Block=Block$$module$build$src$core$block;var disconnectPid$$module$build$src$core$block_animations=
|
|
666
|
+
Block$$module$build$src$core$block.COLLAPSED_INPUT_NAME=COLLAPSED_INPUT_NAME$$module$build$src$core$constants;Block$$module$build$src$core$block.COLLAPSED_FIELD_NAME=COLLAPSED_FIELD_NAME$$module$build$src$core$constants;var module$build$src$core$block={};module$build$src$core$block.Block=Block$$module$build$src$core$block;var disconnectPid$$module$build$src$core$block_animations=null,disconnectGroup$$module$build$src$core$block_animations=null,module$build$src$core$block_animations={};module$build$src$core$block_animations.connectionUiEffect=connectionUiEffect$$module$build$src$core$block_animations;module$build$src$core$block_animations.disconnectUiEffect=disconnectUiEffect$$module$build$src$core$block_animations;module$build$src$core$block_animations.disconnectUiStop=disconnectUiStop$$module$build$src$core$block_animations;
|
|
674
667
|
module$build$src$core$block_animations.disposeUiEffect=disposeUiEffect$$module$build$src$core$block_animations;var Comment$$module$build$src$core$comment=class extends Icon$$module$build$src$core$icon{constructor(a){super(a);this.cachedText_="";this.paragraphElement_=this.textarea_=this.foreignObject_=this.onInputWrapper_=this.onChangeWrapper_=this.onWheelWrapper_=this.onMouseUpWrapper_=null;this.model_=a.commentModel;let b;this.model_.text=null!=(b=this.model_.text)?b:"";this.createIcon()}drawIcon_(a){createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.CIRCLE,{"class":"blocklyIconShape",
|
|
675
668
|
r:"8",cx:"8",cy:"8"},a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.PATH,{"class":"blocklyIconSymbol",d:"m6.8,10h2c0.003,-0.617 0.271,-0.962 0.633,-1.266 2.875,-2.4050.607,-5.534 -3.765,-3.874v1.7c3.12,-1.657 3.698,0.118 2.336,1.25-1.201,0.998 -1.201,1.528 -1.204,2.19z"},a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},a)}createEditor_(){this.foreignObject_=
|
|
676
669
|
createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FOREIGNOBJECT,{x:Bubble$$module$build$src$core$bubble.BORDER_WIDTH,y:Bubble$$module$build$src$core$bubble.BORDER_WIDTH});const a=document.createElementNS(HTML_NS$$module$build$src$core$utils$dom,"body");a.setAttribute("xmlns",HTML_NS$$module$build$src$core$utils$dom);a.className="blocklyMinimalBody";const b=this.textarea_=document.createElementNS(HTML_NS$$module$build$src$core$utils$dom,"textarea");b.className=
|
|
677
670
|
"blocklyCommentTextarea";b.setAttribute("dir",this.block_.RTL?"RTL":"LTR");let c;b.value=null!=(c=this.model_.text)?c:"";this.resizeTextarea_();a.appendChild(b);this.foreignObject_.appendChild(a);this.onMouseUpWrapper_=conditionalBind$$module$build$src$core$browser_events(b,"mouseup",this,this.startEdit_,!0,!0);this.onWheelWrapper_=conditionalBind$$module$build$src$core$browser_events(b,"wheel",this,function(d){d.stopPropagation()});this.onChangeWrapper_=conditionalBind$$module$build$src$core$browser_events(b,
|
|
678
671
|
"change",this,function(d){this.cachedText_!==this.model_.text&&fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CHANGE$$module$build$src$core$events$utils))(this.block_,"comment",null,this.cachedText_,this.model_.text))});this.onInputWrapper_=conditionalBind$$module$build$src$core$browser_events(b,"input",this,function(d){this.model_.text=b.value});setTimeout(b.focus.bind(b),0);return this.foreignObject_}updateEditable(){super.updateEditable();this.isVisible()&&
|
|
679
|
-
(this.disposeBubble_(),this.createBubble_())}onBubbleResize_(){this.isVisible()&&(this.model_.size=this.bubble_.getBubbleSize(),this.resizeTextarea_())}resizeTextarea_(){var a=this.model_.size;const b=2*Bubble$$module$build$src$core$bubble.BORDER_WIDTH,c=a.width-b;a=a.height-b;this.foreignObject_.setAttribute("width"
|
|
680
|
-
a,"comment")),(this.model_.pinned=a)?this.createBubble_():this.disposeBubble_())}createBubble_(){
|
|
681
|
-
this.
|
|
682
|
-
this.
|
|
672
|
+
(this.disposeBubble_(),this.createBubble_())}onBubbleResize_(){this.isVisible()&&this.bubble_&&(this.model_.size=this.bubble_.getBubbleSize(),this.resizeTextarea_())}resizeTextarea_(){var a=this.model_.size;const b=2*Bubble$$module$build$src$core$bubble.BORDER_WIDTH,c=a.width-b;a=a.height-b;this.foreignObject_.setAttribute("width",`${c}`);this.foreignObject_.setAttribute("height",`${a}`);this.textarea_.style.width=c-4+"px";this.textarea_.style.height=a-4+"px"}setVisible(a){a!==this.isVisible()&&(fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(BUBBLE_OPEN$$module$build$src$core$events$utils))(this.block_,
|
|
673
|
+
a,"comment")),(this.model_.pinned=a)?this.createBubble_():this.disposeBubble_())}createBubble_(){this.block_.isEditable()?this.createEditableBubble_():this.createNonEditableBubble_()}createEditableBubble_(){this.bubble_=new Bubble$$module$build$src$core$bubble(this.block_.workspace,this.createEditor_(),this.block_.pathObject.svgPath,this.iconXY_,this.model_.size.width,this.model_.size.height);this.bubble_.setSvgId(this.block_.id);this.bubble_.registerResizeEvent(this.onBubbleResize_.bind(this));this.applyColour()}createNonEditableBubble_(){let a;
|
|
674
|
+
this.paragraphElement_=Bubble$$module$build$src$core$bubble.textToDom(null!=(a=this.model_.text)?a:"");this.bubble_=Bubble$$module$build$src$core$bubble.createNonEditableBubble(this.paragraphElement_,this.block_,this.iconXY_);this.applyColour()}disposeBubble_(){this.onMouseUpWrapper_&&(unbind$$module$build$src$core$browser_events(this.onMouseUpWrapper_),this.onMouseUpWrapper_=null);this.onWheelWrapper_&&(unbind$$module$build$src$core$browser_events(this.onWheelWrapper_),this.onWheelWrapper_=null);
|
|
675
|
+
this.onChangeWrapper_&&(unbind$$module$build$src$core$browser_events(this.onChangeWrapper_),this.onChangeWrapper_=null);this.onInputWrapper_&&(unbind$$module$build$src$core$browser_events(this.onInputWrapper_),this.onInputWrapper_=null);this.bubble_&&(this.bubble_.dispose(),this.bubble_=null);this.paragraphElement_=this.foreignObject_=this.textarea_=null}startEdit_(a){let b;(null==(b=this.bubble_)?0:b.promote())&&this.textarea_.focus();this.cachedText_=this.model_.text}getBubbleSize(){return this.model_.size}setBubbleSize(a,
|
|
683
676
|
b){this.bubble_?this.bubble_.setBubbleSize(a,b):(this.model_.size.width=a,this.model_.size.height=b)}updateText(){if(this.textarea_){let a;this.textarea_.value=null!=(a=this.model_.text)?a:""}else this.paragraphElement_&&(this.paragraphElement_.firstChild.textContent=this.model_.text)}dispose(){this.block_.comment=null;super.dispose()}};register$$module$build$src$core$css("\n.blocklyCommentTextarea {\n background-color: #fef49c;\n border: 0;\n display: block;\n margin: 0;\n outline: 0;\n padding: 3px;\n resize: none;\n text-overflow: hidden;\n}\n");
|
|
684
677
|
var module$build$src$core$comment={};module$build$src$core$comment.Comment=Comment$$module$build$src$core$comment;var copyData$$module$build$src$core$clipboard=null,TEST_ONLY$$module$build$src$core$clipboard={duplicateInternal:duplicateInternal$$module$build$src$core$clipboard,copyInternal:copyInternal$$module$build$src$core$clipboard},module$build$src$core$clipboard={};module$build$src$core$clipboard.TEST_ONLY=TEST_ONLY$$module$build$src$core$clipboard;module$build$src$core$clipboard.copy=copy$$module$build$src$core$clipboard;module$build$src$core$clipboard.duplicate=duplicate$$module$build$src$core$clipboard;
|
|
685
678
|
module$build$src$core$clipboard.paste=paste$$module$build$src$core$clipboard;var currentBlock$$module$build$src$core$contextmenu,dummyOwner$$module$build$src$core$contextmenu,menu_$$module$build$src$core$contextmenu;currentBlock$$module$build$src$core$contextmenu=null;dummyOwner$$module$build$src$core$contextmenu={};menu_$$module$build$src$core$contextmenu=null;$.module$build$src$core$contextmenu={};$.module$build$src$core$contextmenu.callbackFactory=callbackFactory$$module$build$src$core$contextmenu;$.module$build$src$core$contextmenu.commentDeleteOption=commentDeleteOption$$module$build$src$core$contextmenu;
|
|
@@ -707,16 +700,16 @@ a)+b.pathDown+lineOnAxis$$module$build$src$core$utils$svg_paths("v",a)):(a=a.NOT
|
|
|
707
700
|
d:b,transform:"translate("+(this.x-a.x)+","+(this.y-a.y)+")"+(this.sourceBlock_.RTL?" scale(-1 1)":"")},this.sourceBlock_.getSvgRoot())}unhighlight(){removeNode$$module$build$src$core$utils$dom(Connection$$module$build$src$core$connection.highlightedPath_);delete Connection$$module$build$src$core$connection.highlightedPath_}setTracking(a){a&&this.trackedState_===RenderedConnection$$module$build$src$core$rendered_connection.TrackedState.TRACKED||!a&&this.trackedState_===RenderedConnection$$module$build$src$core$rendered_connection.TrackedState.UNTRACKED||
|
|
708
701
|
this.sourceBlock_.isInFlyout||(a?(this.db_.addConnection(this,this.y),this.trackedState_=RenderedConnection$$module$build$src$core$rendered_connection.TrackedState.TRACKED):(this.trackedState_===RenderedConnection$$module$build$src$core$rendered_connection.TrackedState.TRACKED&&this.db_.removeConnection(this,this.y),this.trackedState_=RenderedConnection$$module$build$src$core$rendered_connection.TrackedState.UNTRACKED))}stopTrackingAll(){this.setTracking(!1);if(this.targetConnection){const c=this.targetBlock().getDescendants(!1);
|
|
709
702
|
for(let d=0;d<c.length;d++){var a=c[d],b=a.getConnections_(!0);for(let e=0;e<b.length;e++)b[e].setTracking(!1);a=a.getIcons();for(b=0;b<a.length;b++)a[b].setVisible(!1)}}}startTrackingAll(){this.setTracking(!0);let a=[];if(this.type!==ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE&&this.type!==ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT)return a;const b=this.targetBlock();if(b){let c;b.isCollapsed()?(c=[],b.outputConnection&&c.push(b.outputConnection),b.nextConnection&&
|
|
710
|
-
c.push(b.nextConnection),b.previousConnection&&c.push(b.previousConnection)):c=b.getConnections_(!0);for(let d=0;d<c.length;d++)a.push
|
|
703
|
+
c.push(b.nextConnection),b.previousConnection&&c.push(b.previousConnection)):c=b.getConnections_(!0);for(let d=0;d<c.length;d++)a.push(...c[d].startTrackingAll());a.length||(a=[b])}return a}onFailedConnect(a){const b=this.getSourceBlock();if(getRecordUndo$$module$build$src$core$events$utils()){const c=getGroup$$module$build$src$core$events$utils();setTimeout(function(){b.isDisposed()||b.getParent()||(setGroup$$module$build$src$core$events$utils(c),this.bumpAwayFrom(a),setGroup$$module$build$src$core$events$utils(!1))}.bind(this),
|
|
711
704
|
$.config$$module$build$src$core$config.bumpDelay)}}disconnectInternal_(a,b){super.disconnectInternal_(a,b);a.rendered&&a.render();b.rendered&&(b.updateDisabled(),b.render(),b.getSvgRoot().style.display="block")}respawnShadow_(){super.respawnShadow_();var a=this.targetBlock();a&&(a.initSvg(),a.render(!1),a=this.getSourceBlock(),a.rendered&&a.render())}neighbours(a){return this.dbOpposite_.getNeighbours(this,a)}connect_(a){super.connect_(a);var b=this.getSourceBlock();a=a.getSourceBlock();const c=b.rendered,
|
|
712
705
|
d=a.rendered;c&&b.updateDisabled();d&&a.updateDisabled();c&&d&&(this.type===ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT||this.type===ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT?a.render():b.render());if(b=b.getInputWithBlock(a))b=b.isVisible(),a.getSvgRoot().style.display=b?"block":"none"}onCheckChanged_(){!this.isConnected()||this.targetConnection&&this.getConnectionChecker().canConnect(this,this.targetConnection,!1)||((this.isSuperior()?this.targetBlock():
|
|
713
706
|
this.sourceBlock_).unplug(),this.sourceBlock_.bumpNeighbours())}};(function(a){a=a.TrackedState||(a.TrackedState={});a[a.WILL_TRACK=-1]="WILL_TRACK";a[a.UNTRACKED=0]="UNTRACKED";a[a.TRACKED=1]="TRACKED"})(RenderedConnection$$module$build$src$core$rendered_connection||(RenderedConnection$$module$build$src$core$rendered_connection={}));
|
|
714
707
|
var TrackedState$$module$build$src$core$rendered_connection=RenderedConnection$$module$build$src$core$rendered_connection.TrackedState,module$build$src$core$rendered_connection={};module$build$src$core$rendered_connection.RenderedConnection=RenderedConnection$$module$build$src$core$rendered_connection;module$build$src$core$rendered_connection.TrackedState=TrackedState$$module$build$src$core$rendered_connection;var Warning$$module$build$src$core$warning=class extends Icon$$module$build$src$core$icon{constructor(a){super(a);this.paragraphElement_=null;this.collapseHidden=!1;this.createIcon();this.text_=Object.create(null)}drawIcon_(a){createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.PATH,{"class":"blocklyIconShape",d:"M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z"},a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.PATH,
|
|
715
708
|
{"class":"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},a)}setVisible(a){a!==this.isVisible()&&(fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(BUBBLE_OPEN$$module$build$src$core$events$utils))(this.block_,a,"warning")),a?this.createBubble_():this.disposeBubble_())}createBubble_(){this.paragraphElement_=
|
|
716
|
-
Bubble$$module$build$src$core$bubble.textToDom(this.getText());this.bubble_=Bubble$$module$build$src$core$bubble.createNonEditableBubble(this.paragraphElement_,this.block_,this.iconXY_);this.applyColour()}disposeBubble_(){this.bubble_.dispose()
|
|
717
|
-
null;super.dispose()}},module$build$src$core$warning={};module$build$src$core$warning.Warning=Warning$$module$build$src$core$warning;var BlockSvg$$module$build$src$core$block_svg=class extends Block$$module$build$src$core$block{constructor(a,b,c){super(a,b,c);this.renderingDebugger=null;this.width=this.height=0;this.warningTextDb=new Map;this.warning=this.commentIcon_=this.mutator=null;this.eventsInit_=this.renderIsInProgress_=this.rendered=!1;this.workspace=a;this.decompose=this.decompose;this.compose=this.compose;this.saveConnections=this.saveConnections;this.customContextMenu=this.customContextMenu;this.svgGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,
|
|
718
|
-
{});this.svgGroup_.translate_="";this.style=a.getRenderer().getConstants().getBlockStyle(null);this.pathObject=a.getRenderer().makePathObject(this.svgGroup_,this.style);this.useDragSurface_
|
|
719
|
-
|
|
709
|
+
Bubble$$module$build$src$core$bubble.textToDom(this.getText());this.bubble_=Bubble$$module$build$src$core$bubble.createNonEditableBubble(this.paragraphElement_,this.block_,this.iconXY_);this.applyColour()}disposeBubble_(){this.bubble_&&(this.bubble_.dispose(),this.bubble_=null);this.paragraphElement_=null}setText(a,b){this.text_[b]!==a&&(a?this.text_[b]=a:delete this.text_[b],this.isVisible()&&(this.setVisible(!1),this.setVisible(!0)))}getText(){const a=[];for(const b in this.text_)a.push(this.text_[b]);
|
|
710
|
+
return a.join("\n")}dispose(){this.block_.warning=null;super.dispose()}},module$build$src$core$warning={};module$build$src$core$warning.Warning=Warning$$module$build$src$core$warning;var BlockSvg$$module$build$src$core$block_svg=class extends Block$$module$build$src$core$block{constructor(a,b,c){super(a,b,c);this.renderingDebugger=null;this.width=this.height=0;this.warningTextDb=new Map;this.warning=this.commentIcon_=this.mutator=null;this.eventsInit_=this.renderIsInProgress_=this.rendered=!1;this.workspace=a;this.decompose=this.decompose;this.compose=this.compose;this.saveConnections=this.saveConnections;this.customContextMenu=this.customContextMenu;this.svgGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,
|
|
711
|
+
{});this.svgGroup_.translate_="";this.style=a.getRenderer().getConstants().getBlockStyle(null);this.pathObject=a.getRenderer().makePathObject(this.svgGroup_,this.style);this.useDragSurface_=!!a.getBlockDragSurface();a=this.pathObject.svgPath;a.tooltip=this;bindMouseEvents$$module$build$src$core$tooltip(a);this.svgGroup_.setAttribute("data-id",this.id);this.doInit_()}initSvg(){if(!this.workspace.rendered)throw TypeError("Workspace is headless.");for(let b=0,c;c=this.inputList[b];b++)c.init();var a=
|
|
712
|
+
this.getIcons();for(let b=0;b<a.length;b++)a[b].createIcon();this.applyColour();this.pathObject.updateMovable(this.isMovable());a=this.getSvgRoot();this.workspace.options.readOnly||this.eventsInit_||!a||conditionalBind$$module$build$src$core$browser_events(a,"mousedown",this,this.onMouseDown_);this.eventsInit_=!0;a.parentNode||this.workspace.getCanvas().appendChild(a)}getColourSecondary(){return this.style.colourSecondary}getColourTertiary(){return this.style.colourTertiary}select(){if(this.isShadow()&&
|
|
720
713
|
this.getParent())this.getParent().select();else if(getSelected$$module$build$src$core$common()!==this){var a=null;if(getSelected$$module$build$src$core$common()){a=getSelected$$module$build$src$core$common().id;disable$$module$build$src$core$events$utils();try{getSelected$$module$build$src$core$common().unselect()}finally{enable$$module$build$src$core$events$utils()}}a=new (get$$module$build$src$core$events$utils(SELECTED$$module$build$src$core$events$utils))(a,this.id,this.workspace.id);fire$$module$build$src$core$events$utils(a);
|
|
721
714
|
setSelected$$module$build$src$core$common(this);this.addSelect()}}unselect(){if(getSelected$$module$build$src$core$common()===this){var a=new (get$$module$build$src$core$events$utils(SELECTED$$module$build$src$core$events$utils))(this.id,null,this.workspace.id);a.workspaceId=this.workspace.id;fire$$module$build$src$core$events$utils(a);setSelected$$module$build$src$core$common(null);this.removeSelect()}}getIcons(){const a=[];this.mutator&&a.push(this.mutator);this.commentIcon_&&a.push(this.commentIcon_);
|
|
722
715
|
this.warning&&a.push(this.warning);return a}setParent(a){const b=this.parentBlock_;if(a!==b){startTextWidthCache$$module$build$src$core$utils$dom();super.setParent(a);stopTextWidthCache$$module$build$src$core$utils$dom();var c=this.getSvgRoot();if(!this.workspace.isClearing&&c){var d=this.getRelativeToSurfaceXY();a?(a.getSvgRoot().appendChild(c),a=this.getRelativeToSurfaceXY(),this.moveConnections(a.x-d.x,a.y-d.y)):b&&(this.workspace.getCanvas().appendChild(c),this.translate(d.x,d.y));this.applyColour()}}}getRelativeToSurfaceXY(){let a=
|
|
@@ -743,7 +736,7 @@ this.bumpNeighbours())}setOutput(a,b){super.setOutput(a,b);this.rendered&&(this.
|
|
|
743
736
|
this.bumpNeighbours());return a}setConnectionTracking(a){this.previousConnection&&this.previousConnection.setTracking(a);this.outputConnection&&this.outputConnection.setTracking(a);if(this.nextConnection){this.nextConnection.setTracking(a);var b=this.nextConnection.targetBlock();b&&b.setConnectionTracking(a)}if(!this.collapsed_)for(b=0;b<this.inputList.length;b++){var c=this.inputList[b].connection;c&&(c.setTracking(a),(c=c.targetBlock())&&c.setConnectionTracking(a))}}getConnections_(a){const b=[];
|
|
744
737
|
if(a||this.rendered)if(this.outputConnection&&b.push(this.outputConnection),this.previousConnection&&b.push(this.previousConnection),this.nextConnection&&b.push(this.nextConnection),a||!this.collapsed_)for(let c=0,d;d=this.inputList[c];c++)d.connection&&b.push(d.connection);return b}lastConnectionInStack(a){return super.lastConnectionInStack(a)}getMatchingConnection(a,b){return super.getMatchingConnection(a,b)}makeConnection_(a){return new RenderedConnection$$module$build$src$core$rendered_connection(this,
|
|
745
738
|
a)}getNextBlock(){return super.getNextBlock()}getPreviousBlock(){return super.getPreviousBlock()}bumpNeighbours(){if(!this.disposed&&!this.workspace.isDragging()){var a=this.getRootBlock();if(!a.isInFlyout){var b=this.getConnections_(!1);for(let c=0,d;d=b[c];c++){const e=d;e.isConnected()&&e.isSuperior()&&e.targetBlock().bumpNeighbours();const f=d.neighbours($.config$$module$build$src$core$config.snapRadius);for(let g=0,h;h=f[g];g++){const k=h;e.isConnected()&&k.isConnected()||k.getSourceBlock().getRootBlock()!==
|
|
746
|
-
a&&(e.isSuperior()?k.bumpAwayFrom(e):e.bumpAwayFrom(k))}}}}}scheduleSnapAndBump(){const a=
|
|
739
|
+
a&&(e.isSuperior()?k.bumpAwayFrom(e):e.bumpAwayFrom(k))}}}}}scheduleSnapAndBump(){const a=getGroup$$module$build$src$core$events$utils();setTimeout(()=>{setGroup$$module$build$src$core$events$utils(a);this.snapToGrid();setGroup$$module$build$src$core$events$utils(!1)},$.config$$module$build$src$core$config.bumpDelay/2);setTimeout(()=>{setGroup$$module$build$src$core$events$utils(a);this.bumpNeighbours();setGroup$$module$build$src$core$events$utils(!1)},$.config$$module$build$src$core$config.bumpDelay)}positionNearConnection(a,
|
|
747
740
|
b){a.type!==ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT&&a.type!==ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE||this.moveBy(b.x-a.x,b.y-a.y)}getFirstStatementConnection(){return super.getFirstStatementConnection()}getChildren(a){return super.getChildren(a)}render(a){if(!this.renderIsInProgress_){this.renderIsInProgress_=!0;try{this.rendered=!0;startTextWidthCache$$module$build$src$core$utils$dom();this.isCollapsed()&&this.updateCollapsed_();this.workspace.getRenderer().render(this);
|
|
748
741
|
this.updateConnectionLocations_();if(!1!==a){const b=this.getParent();b?b.render(!0):this.workspace.resizeContents()}stopTextWidthCache$$module$build$src$core$utils$dom();this.updateMarkers_()}finally{this.renderIsInProgress_=!1}}}updateMarkers_(){this.workspace.keyboardAccessibilityMode&&this.pathObject.cursorSvg&&this.workspace.getCursor().draw();this.workspace.keyboardAccessibilityMode&&this.pathObject.markerSvg&&this.workspace.getMarker(MarkerManager$$module$build$src$core$marker_manager.LOCAL_MARKER).draw()}updateConnectionLocations_(){const a=
|
|
749
742
|
this.getRelativeToSurfaceXY();this.previousConnection&&this.previousConnection.moveToOffset(a);this.outputConnection&&this.outputConnection.moveToOffset(a);for(let b=0;b<this.inputList.length;b++){const c=this.inputList[b].connection;c&&(c.moveToOffset(a),c.isConnected()&&c.tighten())}this.nextConnection&&(this.nextConnection.moveToOffset(a),this.nextConnection.isConnected()&&this.nextConnection.tighten())}setCursorSvg(a){this.pathObject.setCursorSvg(a)}setMarkerSvg(a){this.pathObject.setMarkerSvg(a)}getHeightWidth(){let a=
|
|
@@ -757,8 +750,8 @@ this.workspace.options,!0))(a)):(a.toolboxPosition=this.workspace.toolboxPositio
|
|
|
757
750
|
{width:SPRITE$$module$build$src$core$sprites.width,x:-SPRITE_LEFT$$module$build$src$core$trashcan,height:SPRITE$$module$build$src$core$sprites.height,y:-SPRITE_TOP$$module$build$src$core$trashcan,"clip-path":"url(#blocklyTrashBodyClipPath"+b+")"},this.svgGroup_);c.setAttributeNS(XLINK_NS$$module$build$src$core$utils$dom,"xlink:href",this.workspace.options.pathToMedia+SPRITE$$module$build$src$core$sprites.url);a=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.CLIPPATH,
|
|
758
751
|
{id:"blocklyTrashLidClipPath"+b},this.svgGroup_);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{width:WIDTH$$module$build$src$core$trashcan,height:LID_HEIGHT$$module$build$src$core$trashcan},a);this.svgLid_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.IMAGE,{width:SPRITE$$module$build$src$core$sprites.width,x:-SPRITE_LEFT$$module$build$src$core$trashcan,height:SPRITE$$module$build$src$core$sprites.height,y:-SPRITE_TOP$$module$build$src$core$trashcan,
|
|
759
752
|
"clip-path":"url(#blocklyTrashLidClipPath"+b+")"},this.svgGroup_);this.svgLid_.setAttributeNS(XLINK_NS$$module$build$src$core$utils$dom,"xlink:href",this.workspace.options.pathToMedia+SPRITE$$module$build$src$core$sprites.url);bind$$module$build$src$core$browser_events(this.svgGroup_,"mousedown",this,this.blockMouseDownWhenOpenable_);bind$$module$build$src$core$browser_events(this.svgGroup_,"mouseup",this,this.click);bind$$module$build$src$core$browser_events(c,"mouseover",this,this.mouseOver_);bind$$module$build$src$core$browser_events(c,
|
|
760
|
-
"mouseout",this,this.mouseOut_);this.animateLid_();return this.svgGroup_}init(){
|
|
761
|
-
ComponentManager$$module$build$src$core$component_manager.Capability.
|
|
753
|
+
"mouseout",this,this.mouseOut_);this.animateLid_();return this.svgGroup_}init(){0<this.workspace.options.maxTrashcanContents&&(insertAfter$$module$build$src$core$utils$dom(this.flyout.createDom(Svg$$module$build$src$core$utils$svg.SVG),this.workspace.getParentSvg()),this.flyout.init(this.workspace));this.workspace.getComponentManager().addComponent({component:this,weight:1,capabilities:[ComponentManager$$module$build$src$core$component_manager.Capability.AUTOHIDEABLE,ComponentManager$$module$build$src$core$component_manager.Capability.DELETE_AREA,
|
|
754
|
+
ComponentManager$$module$build$src$core$component_manager.Capability.DRAG_TARGET,ComponentManager$$module$build$src$core$component_manager.Capability.POSITIONABLE]});this.initialized_=!0;this.setLidOpen(!1)}dispose(){this.workspace.getComponentManager().removeComponent("trashcan");this.svgGroup_&&(removeNode$$module$build$src$core$utils$dom(this.svgGroup_),this.svgGroup_=null);this.svgLid_=null;this.lidTask_&&clearTimeout(this.lidTask_)}hasContents_(){return!!this.contents_.length}contentsIsOpen(){return!!this.flyout&&
|
|
762
755
|
this.flyout.isVisible()}openFlyout(){if(!this.contentsIsOpen()){var a=this.contents_.map(function(c){return JSON.parse(c)}),b;null==(b=this.flyout)||b.show(a);this.fireUiEvent_(!0)}}closeFlyout(){if(this.contentsIsOpen()){var a;null==(a=this.flyout)||a.hide();this.fireUiEvent_(!1);this.workspace.recordDragTargets()}}autoHide(a){!a&&this.flyout&&this.closeFlyout()}emptyContents(){this.hasContents_()&&(this.contents_.length=0,this.setMinOpenness_(0),this.closeFlyout())}position(a,b){if(this.initialized_){var c=
|
|
763
756
|
getCornerOppositeToolbox$$module$build$src$core$positionable_helpers(this.workspace,a);a=getStartPositionRect$$module$build$src$core$positionable_helpers(c,new Size$$module$build$src$core$utils$size(WIDTH$$module$build$src$core$trashcan,BODY_HEIGHT$$module$build$src$core$trashcan+LID_HEIGHT$$module$build$src$core$trashcan),MARGIN_HORIZONTAL$$module$build$src$core$trashcan,MARGIN_VERTICAL$$module$build$src$core$trashcan,a,this.workspace);b=bumpPositionRect$$module$build$src$core$positionable_helpers(a,
|
|
764
757
|
MARGIN_VERTICAL$$module$build$src$core$trashcan,c.vertical===verticalPosition$$module$build$src$core$positionable_helpers.TOP?bumpDirection$$module$build$src$core$positionable_helpers.DOWN:bumpDirection$$module$build$src$core$positionable_helpers.UP,b);this.top_=b.top;this.left_=b.left;var d;null==(d=this.svgGroup_)||d.setAttribute("transform","translate("+this.left_+","+this.top_+")")}}getBoundingRectangle(){return new Rect$$module$build$src$core$utils$rect(this.top_,this.top_+BODY_HEIGHT$$module$build$src$core$trashcan+
|
|
@@ -817,12 +810,12 @@ register$$module$build$src$core$registry(Type$$module$build$src$core$registry.TO
|
|
|
817
810
|
procedure_blocks:{colourPrimary:"#FF6680",colourSecondary:"#FF4D6A",colourTertiary:"#FF3355"},text_blocks:{colourPrimary:"#FFBF00",colourSecondary:"#E6AC00",colourTertiary:"#CC9900"},variable_blocks:{colourPrimary:"#FF8C1A",colourSecondary:"#FF8000",colourTertiary:"#DB6E00"},variable_dynamic_blocks:{colourPrimary:"#FF8C1A",colourSecondary:"#FF8000",colourTertiary:"#DB6E00"},hat_blocks:{colourPrimary:"#4C97FF",colourSecondary:"#4280D7",colourTertiary:"#3373CC",hat:"cap"}},categoryStyles$$module$build$src$core$theme$zelos=
|
|
818
811
|
{colour_category:{colour:"#CF63CF"},list_category:{colour:"#9966FF"},logic_category:{colour:"#4C97FF"},loop_category:{colour:"#0fBD8C"},math_category:{colour:"#59C059"},procedure_category:{colour:"#FF6680"},text_category:{colour:"#FFBF00"},variable_category:{colour:"#FF8C1A"},variable_dynamic_category:{colour:"#FF8C1A"}},Zelos$$module$build$src$core$theme$zelos=new Theme$$module$build$src$core$theme("zelos",defaultBlockStyles$$module$build$src$core$theme$zelos,categoryStyles$$module$build$src$core$theme$zelos),
|
|
819
812
|
module$build$src$core$theme$zelos={};module$build$src$core$theme$zelos.Zelos=Zelos$$module$build$src$core$theme$zelos;var module$build$src$core$theme$themes={};module$build$src$core$theme$themes.Classic=Classic$$module$build$src$core$theme$classic;module$build$src$core$theme$themes.Zelos=Zelos$$module$build$src$core$theme$zelos;var Click$$module$build$src$core$events$events_click=class extends UiBase$$module$build$src$core$events$events_ui_base{constructor(a,b,c){b=a?a.workspace.id:b;null===b&&(b=void 0);super(b);this.blockId=a?a.id:null;this.targetType=c;this.type=CLICK$$module$build$src$core$events$utils}toJson(){const a=super.toJson();a.targetType=this.targetType;this.blockId&&(a.blockId=this.blockId);return a}fromJson(a){super.fromJson(a);this.targetType=a.targetType;this.blockId=a.blockId}};
|
|
820
|
-
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,CLICK$$module$build$src$core$events$utils,Click$$module$build$src$core$events$events_click);var module$build$src$core$events$events_click={};module$build$src$core$events$events_click.Click=Click$$module$build$src$core$events$events_click;var BubbleDragger$$module$build$src$core$bubble_dragger=class{constructor(a,b){this.bubble=a;this.workspace=b;this.dragTarget_=null;this.wouldDeleteBubble_=!1;this.startXY_=this.bubble.getRelativeToSurfaceXY();this.dragSurface_=
|
|
821
|
-
this.
|
|
822
|
-
this.
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
this.workspace.
|
|
813
|
+
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,CLICK$$module$build$src$core$events$utils,Click$$module$build$src$core$events$events_click);var module$build$src$core$events$events_click={};module$build$src$core$events$events_click.Click=Click$$module$build$src$core$events$events_click;var BubbleDragger$$module$build$src$core$bubble_dragger=class{constructor(a,b){this.bubble=a;this.workspace=b;this.dragTarget_=null;this.wouldDeleteBubble_=!1;this.startXY_=this.bubble.getRelativeToSurfaceXY();this.dragSurface_=b.getBlockDragSurface()}startBubbleDrag(){getGroup$$module$build$src$core$events$utils()||setGroup$$module$build$src$core$events$utils(!0);this.workspace.setResizesEnabled(!1);this.bubble.setAutoLayout(!1);this.dragSurface_&&(this.bubble.moveTo(0,0),this.dragSurface_.translateSurface(this.startXY_.x,
|
|
814
|
+
this.startXY_.y),this.dragSurface_.setBlocksAndShow(this.bubble.getSvgRoot()));this.bubble.setDragging&&this.bubble.setDragging(!0)}dragBubble(a,b){b=this.pixelsToWorkspaceUnits_(b);b=Coordinate$$module$build$src$core$utils$coordinate.sum(this.startXY_,b);this.bubble.moveDuringDrag(this.dragSurface_,b);b=this.dragTarget_;this.dragTarget_=this.workspace.getDragTarget(a);a=this.wouldDeleteBubble_;this.wouldDeleteBubble_=this.shouldDelete_(this.dragTarget_);a!==this.wouldDeleteBubble_&&this.updateCursorDuringBubbleDrag_();
|
|
815
|
+
this.dragTarget_!==b&&(b&&b.onDragExit(this.bubble),this.dragTarget_&&this.dragTarget_.onDragEnter(this.bubble));this.dragTarget_&&this.dragTarget_.onDragOver(this.bubble)}shouldDelete_(a){return a&&this.workspace.getComponentManager().hasCapability(a.id,ComponentManager$$module$build$src$core$component_manager.Capability.DELETE_AREA)?a.wouldDelete(this.bubble,!1):!1}updateCursorDuringBubbleDrag_(){this.bubble.setDeleteStyle(this.wouldDeleteBubble_)}endBubbleDrag(a,b){this.dragBubble(a,b);this.dragTarget_&&
|
|
816
|
+
this.dragTarget_.shouldPreventMove(this.bubble)?a=this.startXY_:(a=this.pixelsToWorkspaceUnits_(b),a=Coordinate$$module$build$src$core$utils$coordinate.sum(this.startXY_,a));this.bubble.moveTo(a.x,a.y);if(this.dragTarget_)this.dragTarget_.onDrop(this.bubble);this.wouldDeleteBubble_?(this.fireMoveEvent_(),this.bubble.dispose()):(this.dragSurface_&&this.dragSurface_.clearAndHide(this.workspace.getBubbleCanvas()),this.bubble.setDragging&&this.bubble.setDragging(!1),this.fireMoveEvent_());this.workspace.setResizesEnabled(!0);
|
|
817
|
+
setGroup$$module$build$src$core$events$utils(!1)}fireMoveEvent_(){if(this.bubble instanceof WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg){const a=new (get$$module$build$src$core$events$utils(COMMENT_MOVE$$module$build$src$core$events$utils))(this.bubble);a.setOldCoordinate(this.startXY_);a.recordNew();fire$$module$build$src$core$events$utils(a)}}pixelsToWorkspaceUnits_(a){a=new Coordinate$$module$build$src$core$utils$coordinate(a.x/this.workspace.scale,a.y/this.workspace.scale);
|
|
818
|
+
this.workspace.isMutator&&a.scale(1/this.workspace.options.parentWorkspace.scale);return a}},module$build$src$core$bubble_dragger={};module$build$src$core$bubble_dragger.BubbleDragger=BubbleDragger$$module$build$src$core$bubble_dragger;var WorkspaceDragger$$module$build$src$core$workspace_dragger=class{constructor(a){this.workspace=a;this.horizontalScrollEnabled_=this.workspace.isMovableHorizontally();this.verticalScrollEnabled_=this.workspace.isMovableVertically();this.startScrollXY_=new Coordinate$$module$build$src$core$utils$coordinate(a.scrollX,a.scrollY)}dispose(){this.workspace=null}startDrag(){getSelected$$module$build$src$core$common()&&getSelected$$module$build$src$core$common().unselect();this.workspace.setupDragSurface()}endDrag(a){this.drag(a);
|
|
826
819
|
this.workspace.resetDragSurface()}drag(a){a=Coordinate$$module$build$src$core$utils$coordinate.sum(this.startScrollXY_,a);if(this.horizontalScrollEnabled_&&this.verticalScrollEnabled_)this.workspace.scroll(a.x,a.y);else if(this.horizontalScrollEnabled_)this.workspace.scroll(a.x,this.workspace.scrollY);else if(this.verticalScrollEnabled_)this.workspace.scroll(this.workspace.scrollX,a.y);else throw new TypeError("Invalid state.");}},module$build$src$core$workspace_dragger={};
|
|
827
820
|
module$build$src$core$workspace_dragger.WorkspaceDragger=WorkspaceDragger$$module$build$src$core$workspace_dragger;var Gesture$$module$build$src$core$gesture=class{constructor(a,b){this.creatorWorkspace=b;this.startWorkspace_=this.targetBlock_=this.startBlock_=this.startField_=this.startBubble_=this.mouseDownXY_=null;this.isDraggingBubble_=this.isDraggingBlock_=this.isDraggingWorkspace_=this.hasExceededDragRadius_=!1;this.flyout_=this.workspaceDragger_=this.blockDragger_=this.bubbleDragger_=this.onUpWrapper_=this.onMoveWrapper_=null;this.isEnding_=this.hasStarted_=this.calledUpdateIsDragging_=!1;this.mostRecentEvent_=
|
|
828
821
|
a;this.currentDragDeltaXY_=new Coordinate$$module$build$src$core$utils$coordinate(0,0);this.healStack_=!DRAG_STACK$$module$build$src$core$internal_constants}dispose(){clearTouchIdentifier$$module$build$src$core$touch();unblock$$module$build$src$core$tooltip();this.creatorWorkspace.clearGesture();this.onMoveWrapper_&&unbind$$module$build$src$core$browser_events(this.onMoveWrapper_);this.onUpWrapper_&&unbind$$module$build$src$core$browser_events(this.onUpWrapper_);this.blockDragger_&&this.blockDragger_.dispose();
|
|
@@ -847,8 +840,8 @@ this.isDraggingWorkspace_?this.workspaceDragger_:this.isDraggingBubble_?this.bub
|
|
|
847
840
|
a+'" not found.'),!1;this.removeAllKeyMappings(a);this.shortcuts.delete(a);return!0}addKeyMapping(a,b,c){a=String(a);const d=this.keyMap.get(a);if(d&&!c)throw Error('Shortcut with name "'+b+'" collides with shortcuts '+d.toString());d&&c?d.unshift(b):this.keyMap.set(a,[b])}removeKeyMapping(a,b,c){const d=this.keyMap.get(a);if(!d)return c||console.warn('No keyboard shortcut with name "'+b+'" registered with key code "'+a+'"'),!1;const e=d.indexOf(b);if(-1<e)return d.splice(e,1),0===d.length&&this.keyMap.delete(a),
|
|
848
841
|
!0;c||console.warn('No keyboard shortcut with name "'+b+'" registered with key code "'+a+'"');return!1}removeAllKeyMappings(a){for(const b of this.keyMap.keys())this.removeKeyMapping(b,a,!0)}setKeyMap(a){this.keyMap.clear();for(const b in a)this.keyMap.set(b,a[b])}getKeyMap(){const a=Object.create(null);for(const [b,c]of this.keyMap)a[b]=c;return a}getRegistry(){const a=Object.create(null);for(const [b,c]of this.shortcuts)a[b]=c;return deepMerge$$module$build$src$core$utils$object(Object.create(null),
|
|
849
842
|
a)}onKeyDown(a,b){var c=this.serializeKeyEvent_(b);c=this.getShortcutNamesByKeyCode(c);if(!c)return!1;for(let d=0,e;e=c[d];d++){const f=this.shortcuts.get(e);let g,h;if(null==(g=f)||!g.preconditionFn||(null==(h=f)?0:h.preconditionFn(a))){let k,l;if((null==(k=f)?0:k.callback)&&(null==(l=f)?0:l.callback(a,b,f)))return!0}}return!1}getShortcutNamesByKeyCode(a){return this.keyMap.get(a)||[]}getKeyCodesByShortcutName(a){const b=[];for(const [c,d]of this.keyMap)-1<d.indexOf(a)&&b.push(c);return b}serializeKeyEvent_(a){let b=
|
|
850
|
-
"";for(const c in ShortcutRegistry$$module$build$src$core$shortcut_registry.modifierKeys)a.getModifierState(c)&&(""!==b&&(b+="+"),b+=c);""!==b&&a.keyCode?b=b+"+"+a.keyCode:a.keyCode&&(b=a.keyCode.toString());return b}checkModifiers_(a){
|
|
851
|
-
|
|
843
|
+
"";for(const c in ShortcutRegistry$$module$build$src$core$shortcut_registry.modifierKeys)a.getModifierState(c)&&(""!==b&&(b+="+"),b+=c);""!==b&&a.keyCode?b=b+"+"+a.keyCode:a.keyCode&&(b=a.keyCode.toString());return b}checkModifiers_(a){for(let b=0,c;c=a[b];b++)if(!(c in ShortcutRegistry$$module$build$src$core$shortcut_registry.modifierKeys))throw Error(c+" is not a valid modifier key.");}createSerializedKey(a,b){let c="";if(b){this.checkModifiers_(b);for(const d in ShortcutRegistry$$module$build$src$core$shortcut_registry.modifierKeys)-1<
|
|
844
|
+
b.indexOf(ShortcutRegistry$$module$build$src$core$shortcut_registry.modifierKeys[d])&&(""!==c&&(c+="+"),c+=d)}""!==c&&a?c=c+"+"+a:a&&(c=a.toString());return c}};ShortcutRegistry$$module$build$src$core$shortcut_registry.registry=new ShortcutRegistry$$module$build$src$core$shortcut_registry;
|
|
852
845
|
(function(a){a=a.modifierKeys||(a.modifierKeys={});a[a.Shift=16]="Shift";a[a.Control=17]="Control";a[a.Alt=18]="Alt";a[a.Meta=91]="Meta"})(ShortcutRegistry$$module$build$src$core$shortcut_registry||(ShortcutRegistry$$module$build$src$core$shortcut_registry={}));var module$build$src$core$shortcut_registry={};module$build$src$core$shortcut_registry.ShortcutRegistry=ShortcutRegistry$$module$build$src$core$shortcut_registry;var names$$module$build$src$core$shortcut_items;(function(a){a.ESCAPE="escape";a.DELETE="delete";a.COPY="copy";a.CUT="cut";a.PASTE="paste";a.UNDO="undo";a.REDO="redo"})(names$$module$build$src$core$shortcut_items||(names$$module$build$src$core$shortcut_items={}));registerDefaultShortcuts$$module$build$src$core$shortcut_items();var module$build$src$core$shortcut_items={};module$build$src$core$shortcut_items.names=names$$module$build$src$core$shortcut_items;
|
|
853
846
|
module$build$src$core$shortcut_items.registerCopy=registerCopy$$module$build$src$core$shortcut_items;module$build$src$core$shortcut_items.registerCut=registerCut$$module$build$src$core$shortcut_items;module$build$src$core$shortcut_items.registerDefaultShortcuts=registerDefaultShortcuts$$module$build$src$core$shortcut_items;module$build$src$core$shortcut_items.registerDelete=registerDelete$$module$build$src$core$shortcut_items;module$build$src$core$shortcut_items.registerEscape=registerEscape$$module$build$src$core$shortcut_items;
|
|
854
847
|
module$build$src$core$shortcut_items.registerPaste=registerPaste$$module$build$src$core$shortcut_items;module$build$src$core$shortcut_items.registerRedo=registerRedo$$module$build$src$core$shortcut_items;module$build$src$core$shortcut_items.registerUndo=registerUndo$$module$build$src$core$shortcut_items;var ThemeChange$$module$build$src$core$events$events_theme_change=class extends UiBase$$module$build$src$core$events$events_ui_base{constructor(a,b){super(b);this.themeName=a;this.type=THEME_CHANGE$$module$build$src$core$events$utils}toJson(){const a=super.toJson();a.themeName=this.themeName;return a}fromJson(a){super.fromJson(a);this.themeName=a.themeName}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,THEME_CHANGE$$module$build$src$core$events$utils,ThemeChange$$module$build$src$core$events$events_theme_change);
|
|
@@ -857,10 +850,10 @@ a.scale;this.oldScale=a.oldScale}};register$$module$build$src$core$registry(Type
|
|
|
857
850
|
b;){if(this.connections_[d]===a)return d;d++}return-1}calculateIndexForYPos_(a){if(!this.connections_.length)return 0;let b=0,c=this.connections_.length;for(;b<c;){const d=Math.floor((b+c)/2);if(this.connections_[d].y<a)b=d+1;else if(this.connections_[d].y>a)c=d;else{b=d;break}}return b}removeConnection(a,b){a=this.findIndexOfConnection_(a,b);if(-1===a)throw Error("Unable to find connection in connectionDB.");this.connections_.splice(a,1)}getNeighbours(a,b){function c(l){const m=e-d[l].x,n=f-d[l].y;
|
|
858
851
|
Math.sqrt(m*m+n*n)<=b&&k.push(d[l]);return n<b}const d=this.connections_,e=a.x,f=a.y;a=0;let g=d.length-2,h=g;for(;a<h;)d[h].y<f?a=h:g=h,h=Math.floor((a+g)/2);const k=[];g=a=h;if(d.length){for(;0<=a&&c(a);)a--;do g++;while(g<d.length&&c(g))}return k}isInYRange_(a,b,c){return Math.abs(this.connections_[a].y-b)<=c}searchForClosest(a,b,c){if(!this.connections_.length)return{connection:null,radius:b};const d=a.y,e=a.x;a.x=e+c.x;a.y=d+c.y;var f=this.calculateIndexForYPos_(a.y);c=null;let g=b,h,k=f-1;for(;0<=
|
|
859
852
|
k&&this.isInYRange_(k,a.y,b);)h=this.connections_[k],this.connectionChecker.canConnect(a,h,!0,g)&&(c=h,g=h.distanceFrom(a)),k--;for(;f<this.connections_.length&&this.isInYRange_(f,a.y,b);)h=this.connections_[f],this.connectionChecker.canConnect(a,h,!0,g)&&(c=h,g=h.distanceFrom(a)),f++;a.x=e;a.y=d;return{connection:c,radius:g}}static init(a){const b=[];b[ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE]=new ConnectionDB$$module$build$src$core$connection_db(a);b[ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE]=
|
|
860
|
-
new ConnectionDB$$module$build$src$core$connection_db(a);b[ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT]=new ConnectionDB$$module$build$src$core$connection_db(a);b[ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT]=new ConnectionDB$$module$build$src$core$connection_db(a);return b}},module$build$src$core$connection_db={};module$build$src$core$connection_db.ConnectionDB=ConnectionDB$$module$build$src$core$connection_db;var Grid$$module$build$src$core$grid=class{constructor(a,b){this.pattern=a;
|
|
861
|
-
b
|
|
862
|
-
b
|
|
863
|
-
|
|
853
|
+
new ConnectionDB$$module$build$src$core$connection_db(a);b[ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT]=new ConnectionDB$$module$build$src$core$connection_db(a);b[ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT]=new ConnectionDB$$module$build$src$core$connection_db(a);return b}},module$build$src$core$connection_db={};module$build$src$core$connection_db.ConnectionDB=ConnectionDB$$module$build$src$core$connection_db;var Grid$$module$build$src$core$grid=class{constructor(a,b){this.pattern=a;let c;this.spacing=null!=(c=b.spacing)?c:0;let d;this.length=null!=(d=b.length)?d:1;this.line2=(this.line1=a.firstChild)&&this.line1.nextSibling;let e;this.snapToGrid=null!=(e=b.snap)?e:!1}shouldSnap(){return this.snapToGrid}getSpacing(){return this.spacing}getPatternId(){return this.pattern.id}update(a){var b=this.spacing*a||100;this.pattern.setAttribute("width",b.toString());this.pattern.setAttribute("height",b.toString());
|
|
854
|
+
b=Math.floor(this.spacing/2)+.5;let c=b-this.length/2,d=b+this.length/2;b*=a;c*=a;d*=a;this.setLineAttributes(this.line1,a,c,d,b,b);this.setLineAttributes(this.line2,a,b,b,c,d)}setLineAttributes(a,b,c,d,e,f){a&&(a.setAttribute("stroke-width",b.toString()),a.setAttribute("x1",c.toString()),a.setAttribute("y1",e.toString()),a.setAttribute("x2",d.toString()),a.setAttribute("y2",f.toString()))}moveTo(a,b){this.pattern.setAttribute("x",a.toString());this.pattern.setAttribute("y",b.toString())}static createDom(a,
|
|
855
|
+
b,c){a=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.PATTERN,{id:"blocklyGridPattern"+a,patternUnits:"userSpaceOnUse"},c);let d,e;if(0<(null!=(d=b.length)?d:1)&&0<(null!=(e=b.spacing)?e:0)){createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.LINE,{stroke:b.colour},a);let f;null!=(f=b.length)&&f&&createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.LINE,{stroke:b.colour},a)}else createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.LINE,
|
|
856
|
+
{},a);return a}},module$build$src$core$grid={};module$build$src$core$grid.Grid=Grid$$module$build$src$core$grid;var Names$$module$build$src$core$names=class{constructor(a,b){this.db=new Map;this.dbReverse=new Set;this.variableMap_=null;this.variablePrefix_=b||"";this.reservedWords=new Set(a?a.split(","):[])}reset(){this.db.clear();this.dbReverse.clear();this.variableMap_=null}setVariableMap(a){this.variableMap_=a}getNameForUserVariable_(a){return this.variableMap_?(a=this.variableMap_.getVariableById(a))?a.name:null:(console.warn("Deprecated call to Names.prototype.getName without defining a variable map. To fix, add the following code in your generator's init() function:\nBlockly.YourGeneratorName.nameDB_.setVariableMap(workspace.getVariableMap());"),
|
|
864
857
|
null)}populateVariables(a){a=allUsedVarModels$$module$build$src$core$variables(a);for(let b=0;b<a.length;b++)this.getName(a[b].getId(),$.NameType$$module$build$src$core$names.VARIABLE)}populateProcedures(a){throw Error("The implementation of populateProcedures should be monkey-patched in by blockly.ts");}getName(a,b){let c=a;b===$.NameType$$module$build$src$core$names.VARIABLE&&(a=this.getNameForUserVariable_(a))&&(c=a);a=c.toLowerCase();const d=b===$.NameType$$module$build$src$core$names.VARIABLE||
|
|
865
858
|
b===$.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE?this.variablePrefix_:"";this.db.has(b)||this.db.set(b,new Map);const e=this.db.get(b);if(e.has(a))return d+e.get(a);b=this.getDistinctName(c,b);e.set(a,b.substr(d.length));return b}getUserNames(a){let b;return(a=null==(b=this.db.get(a))?void 0:b.keys())?Array.from(a):[]}getDistinctName(a,b){a=this.safeName_(a);let c="";for(;this.dbReverse.has(a+c)||this.reservedWords.has(a+c);)c=c?c+1:2;a+=c;this.dbReverse.add(a);return(b===$.NameType$$module$build$src$core$names.VARIABLE||
|
|
866
859
|
b===$.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE?this.variablePrefix_:"")+a}safeName_(a){a?(a=encodeURI(a.replace(/ /g,"_")).replace(/[^\w]/g,"_"),-1!=="0123456789".indexOf(a[0])&&(a="my_"+a)):a=Msg$$module$build$src$core$msg.UNNAMED_KEY||"unnamed";return a}static equals(a,b){return a.toLowerCase()===b.toLowerCase()}};
|
|
@@ -894,8 +887,8 @@ this.ascenderHeight=c;this.widthWithConnectedBlocks=this.width}startsWithElemSpa
|
|
|
894
887
|
20;this.BETWEEN_STATEMENT_PADDING_Y=4;this.ADD_START_HATS=!1;this.START_HAT_HEIGHT=15;this.START_HAT_WIDTH=100;this.SPACER_DEFAULT_HEIGHT=15;this.MIN_BLOCK_HEIGHT=24;this.EMPTY_INLINE_INPUT_PADDING=14.5;this.EXTERNAL_VALUE_INPUT_PADDING=2;this.JAGGED_TEETH_HEIGHT=12;this.JAGGED_TEETH_WIDTH=6;this.FIELD_TEXT_FONTSIZE=11;this.FIELD_TEXT_FONTWEIGHT="normal";this.FIELD_TEXT_FONTFAMILY="sans-serif";this.FIELD_TEXT_BASELINE=this.FIELD_TEXT_HEIGHT=-1;this.FIELD_BORDER_RECT_RADIUS=4;this.FIELD_BORDER_RECT_HEIGHT=
|
|
895
888
|
16;this.FIELD_BORDER_RECT_X_PADDING=5;this.FIELD_BORDER_RECT_Y_PADDING=3;this.FIELD_BORDER_RECT_COLOUR="#fff";this.FIELD_DROPDOWN_SVG_ARROW=this.FIELD_DROPDOWN_COLOURED_DIV=this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW=!1;this.FIELD_DROPDOWN_SVG_ARROW_SIZE=12;this.FIELD_COLOUR_FULL_BLOCK=this.FIELD_TEXTINPUT_BOX_SHADOW=!1;this.FIELD_COLOUR_DEFAULT_WIDTH=26;this.defs_=null;this.embossFilterId="";this.embossFilter_=null;this.disabledPatternId="";this.disabledPattern_=null;this.debugFilterId="";this.cssNode_=
|
|
896
889
|
this.debugFilter_=null;this.CURSOR_COLOUR="#cc0a0a";this.MARKER_COLOUR="#4286f4";this.CURSOR_WS_WIDTH=100;this.WS_CURSOR_HEIGHT=5;this.CURSOR_STACK_PADDING=10;this.CURSOR_BLOCK_PADDING=2;this.CURSOR_STROKE_WIDTH=4;this.FULL_BLOCK_FIELDS=!1;this.INSERTION_MARKER_COLOUR="#000000";this.INSERTION_MARKER_OPACITY=.2;this.SHAPES={PUZZLE:1,NOTCH:2};this.TALL_INPUT_FIELD_OFFSET_Y=this.MEDIUM_PADDING;this.DUMMY_INPUT_SHADOW_MIN_HEIGHT=this.DUMMY_INPUT_MIN_HEIGHT=this.TAB_HEIGHT;this.STATEMENT_INPUT_NOTCH_OFFSET=
|
|
897
|
-
this.NOTCH_OFFSET_LEFT;this.TOP_ROW_MIN_HEIGHT=this.MEDIUM_PADDING;this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING;this.BOTTOM_ROW_MIN_HEIGHT=this.MEDIUM_PADDING;this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING;this.EMPTY_INLINE_INPUT_HEIGHT=this.TAB_HEIGHT+11;this.EMPTY_STATEMENT_INPUT_HEIGHT=this.MIN_BLOCK_HEIGHT;this.START_POINT=moveBy$$module$build$src$core$utils$svg_paths(0,0);this.FIELD_TEXT_BASELINE_CENTER=!
|
|
898
|
-
this.
|
|
890
|
+
this.NOTCH_OFFSET_LEFT;this.TOP_ROW_MIN_HEIGHT=this.MEDIUM_PADDING;this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING;this.BOTTOM_ROW_MIN_HEIGHT=this.MEDIUM_PADDING;this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING;this.EMPTY_INLINE_INPUT_HEIGHT=this.TAB_HEIGHT+11;this.EMPTY_STATEMENT_INPUT_HEIGHT=this.MIN_BLOCK_HEIGHT;this.START_POINT=moveBy$$module$build$src$core$utils$svg_paths(0,0);this.FIELD_TEXT_BASELINE_CENTER=!0;this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT;
|
|
891
|
+
this.FIELD_DROPDOWN_SVG_ARROW_PADDING=this.FIELD_BORDER_RECT_X_PADDING;this.FIELD_DROPDOWN_SVG_ARROW_DATAURI="data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMi43MSIgaGVpZ2h0PSI4Ljc5IiB2aWV3Qm94PSIwIDAgMTIuNzEgOC43OSI+PHRpdGxlPmRyb3Bkb3duLWFycm93PC90aXRsZT48ZyBvcGFjaXR5PSIwLjEiPjxwYXRoIGQ9Ik0xMi43MSwyLjQ0QTIuNDEsMi40MSwwLDAsMSwxMiw0LjE2TDguMDgsOC4wOGEyLjQ1LDIuNDUsMCwwLDEtMy40NSwwTDAuNzIsNC4xNkEyLjQyLDIuNDIsMCwwLDEsMCwyLjQ0LDIuNDgsMi40OCwwLDAsMSwuNzEuNzFDMSwwLjQ3LDEuNDMsMCw2LjM2LDBTMTEuNzUsMC40NiwxMiwuNzFBMi40NCwyLjQ0LDAsMCwxLDEyLjcxLDIuNDRaIiBmaWxsPSIjMjMxZjIwIi8+PC9nPjxwYXRoIGQ9Ik02LjM2LDcuNzlhMS40MywxLjQzLDAsMCwxLTEtLjQyTDEuNDIsMy40NWExLjQ0LDEuNDQsMCwwLDEsMC0yYzAuNTYtLjU2LDkuMzEtMC41Niw5Ljg3LDBhMS40NCwxLjQ0LDAsMCwxLDAsMkw3LjM3LDcuMzdBMS40MywxLjQzLDAsMCwxLDYuMzYsNy43OVoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=";
|
|
899
892
|
this.FIELD_COLOUR_DEFAULT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT;this.FIELD_CHECKBOX_X_OFFSET=this.FIELD_BORDER_RECT_X_PADDING-3;this.randomIdentifier=String(Math.random()).substring(2)}init(){this.JAGGED_TEETH=this.makeJaggedTeeth();this.NOTCH=this.makeNotch();this.START_HAT=this.makeStartHat();this.PUZZLE_TAB=this.makePuzzleTab();this.INSIDE_CORNERS=this.makeInsideCorners();this.OUTSIDE_CORNERS=this.makeOutsideCorners()}setTheme(a){this.blockStyles=Object.create(null);const b=a.blockStyles;for(const c in b)this.blockStyles[c]=
|
|
900
893
|
this.validatedBlockStyle_(b[c]);this.setDynamicProperties_(a)}setDynamicProperties_(a){this.setFontConstants_(a);this.setComponentConstants_(a);this.ADD_START_HATS=null!==a.startHats?a.startHats:this.ADD_START_HATS}setFontConstants_(a){a.fontStyle&&a.fontStyle.family&&(this.FIELD_TEXT_FONTFAMILY=a.fontStyle.family);a.fontStyle&&a.fontStyle.weight&&(this.FIELD_TEXT_FONTWEIGHT=a.fontStyle.weight);a.fontStyle&&a.fontStyle.size&&(this.FIELD_TEXT_FONTSIZE=a.fontStyle.size);a=measureFontMetrics$$module$build$src$core$utils$dom("Hg",
|
|
901
894
|
this.FIELD_TEXT_FONTSIZE+"pt",this.FIELD_TEXT_FONTWEIGHT,this.FIELD_TEXT_FONTFAMILY);this.FIELD_TEXT_HEIGHT=a.height;this.FIELD_TEXT_BASELINE=a.baseline}setComponentConstants_(a){this.CURSOR_COLOUR=a.getComponentStyle("cursorColour")||this.CURSOR_COLOUR;this.MARKER_COLOUR=a.getComponentStyle("markerColour")||this.MARKER_COLOUR;this.INSERTION_MARKER_COLOUR=a.getComponentStyle("insertionMarkerColour")||this.INSERTION_MARKER_COLOUR;this.INSERTION_MARKER_OPACITY=Number(a.getComponentStyle("insertionMarkerOpacity"))||
|
|
@@ -912,10 +905,10 @@ a));return{width:a,height:a,pathTop:b,pathBottom:c}}makeOutsideCorners(){const a
|
|
|
912
905
|
{"in":"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},a);this.embossFilterId=a.id;this.embossFilter_=a;a=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.PATTERN,{id:"blocklyDisabledPattern"+this.randomIdentifier,patternUnits:"userSpaceOnUse",width:10,height:10},this.defs_);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{width:10,height:10,fill:"#aaa"},a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.PATH,
|
|
913
906
|
{d:"M 0 0 L 10 10 M 10 0 L 0 10",stroke:"#cc0"},a);this.disabledPatternId=a.id;this.disabledPattern_=a;this.createDebugFilter()}createDebugFilter(){if(!this.debugFilter_){const a=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FILTER,{id:"blocklyDebugFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},this.defs_),b=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FECOMPONENTTRANSFER,{result:"outBlur"},
|
|
914
907
|
a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},b);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FEFLOOD,{"flood-color":"#ff0000","flood-opacity":.5,result:"outColor"},a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FECOMPOSITE,{"in":"outColor",in2:"outBlur",operator:"in",result:"outGlow"},a);this.debugFilterId=
|
|
915
|
-
a.id;this.debugFilter_=a}}injectCSS_(a,b){b=this.getCSS_(b);a="blockly-renderer-style-"+a;this.cssNode_=document.getElementById(a);const c=b.join("\n");this.cssNode_?this.cssNode_.firstChild.textContent=c:(b=document.createElement("style"),b.id=a,a=document.createTextNode(c),b.appendChild(a),document.head.insertBefore(b,document.head.firstChild),this.cssNode_=b)}getCSS_(a){return[a
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
"
|
|
908
|
+
a.id;this.debugFilter_=a}}injectCSS_(a,b){b=this.getCSS_(b);a="blockly-renderer-style-"+a;this.cssNode_=document.getElementById(a);const c=b.join("\n");this.cssNode_?this.cssNode_.firstChild.textContent=c:(b=document.createElement("style"),b.id=a,a=document.createTextNode(c),b.appendChild(a),document.head.insertBefore(b,document.head.firstChild),this.cssNode_=b)}getCSS_(a){return[`${a} .blocklyText, `,`${a} .blocklyFlyoutLabelText {`,`font: ${this.FIELD_TEXT_FONTWEIGHT} `+`${this.FIELD_TEXT_FONTSIZE}pt ${this.FIELD_TEXT_FONTFAMILY};`,
|
|
909
|
+
"}",`${a} .blocklyText {`,"fill: #fff;","}",`${a} .blocklyNonEditableText>rect,`,`${a} .blocklyEditableText>rect {`,`fill: ${this.FIELD_BORDER_RECT_COLOUR};`,"fill-opacity: .6;","stroke: none;","}",`${a} .blocklyNonEditableText>text,`,`${a} .blocklyEditableText>text {`,"fill: #000;","}",`${a} .blocklyFlyoutLabelText {`,"fill: #000;","}",`${a} .blocklyText.blocklyBubbleText {`,"fill: #000;","}",`${a} .blocklyEditableText:not(.editing):hover>rect {`,"stroke: #fff;","stroke-width: 2;","}",`${a} .blocklyHtmlInput {`,
|
|
910
|
+
`font-family: ${this.FIELD_TEXT_FONTFAMILY};`,`font-weight: ${this.FIELD_TEXT_FONTWEIGHT};`,"}",`${a} .blocklySelected>.blocklyPath {`,"stroke: #fc3;","stroke-width: 3px;","}",`${a} .blocklyHighlightedConnectionPath {`,"stroke: #fc3;","}",`${a} .blocklyReplaceable .blocklyPath {`,"fill-opacity: .5;","}",`${a} .blocklyReplaceable .blocklyPathLight,`,`${a} .blocklyReplaceable .blocklyPathDark {`,"display: none;","}",`${a} .blocklyInsertionMarker>.blocklyPath {`,`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,
|
|
911
|
+
"stroke: none;","}"]}},module$build$src$core$renderers$common$constants={};module$build$src$core$renderers$common$constants.ConstantProvider=ConstantProvider$$module$build$src$core$renderers$common$constants;var useDebugger$$module$build$src$core$renderers$common$debug=!1,module$build$src$core$renderers$common$debug={};module$build$src$core$renderers$common$debug.isDebuggerEnabled=isDebuggerEnabled$$module$build$src$core$renderers$common$debug;module$build$src$core$renderers$common$debug.startDebugger=startDebugger$$module$build$src$core$renderers$common$debug;module$build$src$core$renderers$common$debug.stopDebugger=stopDebugger$$module$build$src$core$renderers$common$debug;var Debug$$module$build$src$core$renderers$common$debugger=class{constructor(a){this.constants=a;this.debugElements_=[];this.svgRoot_=null;this.randomColour_=""}clearElems(){for(let a=0;a<this.debugElements_.length;a++)removeNode$$module$build$src$core$utils$dom(this.debugElements_[a]);this.debugElements_=[]}drawSpacerRow(a,b,c){if(Debug$$module$build$src$core$renderers$common$debugger.config.rowSpacers){var d=Math.abs(a.height),e=0>a.height;e&&(b-=d);this.debugElements_.push(createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,
|
|
919
912
|
{"class":"rowSpacerRect blockRenderDebug",x:c?-(a.xPos+a.width):a.xPos,y:b,width:a.width,height:d,stroke:e?"black":"blue",fill:"blue","fill-opacity":"0.5","stroke-width":"1px"},this.svgRoot_))}}drawSpacerElem(a,b,c){if(Debug$$module$build$src$core$renderers$common$debugger.config.elemSpacers){b=Math.abs(a.width);var d=0>a.width,e=d?a.xPos-b:a.xPos;c&&(e=-(e+b));this.debugElements_.push(createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"elemSpacerRect blockRenderDebug",
|
|
920
913
|
x:e,y:a.centerline-a.height/2,width:b,height:a.height,stroke:"pink",fill:d?"black":"pink","fill-opacity":"0.5","stroke-width":"1px"},this.svgRoot_))}}drawRenderedElem(a,b){if(Debug$$module$build$src$core$renderers$common$debugger.config.elems){let c=a.xPos;b&&(c=-(c+a.width));b=a.centerline-a.height/2;this.debugElements_.push(createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"rowRenderingRect blockRenderDebug",x:c,y:b,width:a.width,height:a.height,
|
|
921
914
|
stroke:"black",fill:"none","stroke-width":"1px"},this.svgRoot_));Types$$module$build$src$core$renderers$measurables$types.isField(a)&&a instanceof Field$$module$build$src$core$renderers$measurables$field&&a.field instanceof $.FieldLabel$$module$build$src$core$field_label&&this.debugElements_.push(createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"rowRenderingRect blockRenderDebug",x:c,y:b+this.constants.FIELD_TEXT_BASELINE,width:a.width,height:"0.1px",
|
|
@@ -985,20 +978,23 @@ null}setMarkerSvg(a){a?(this.cursorSvg?this.svgRoot.insertBefore(a,this.cursorSv
|
|
|
985
978
|
a)}updateHighlighted(a){a?this.svgPath.setAttribute("filter","url(#"+this.constants.embossFilterId+")"):this.svgPath.setAttribute("filter","none")}updateShadow_(a){a&&(this.svgPath.setAttribute("stroke","none"),this.svgPath.setAttribute("fill",this.style.colourSecondary))}updateDisabled_(a){this.setClass_("blocklyDisabled",a);a&&this.svgPath.setAttribute("fill","url(#"+this.constants.disabledPatternId+")")}updateSelected(a){this.setClass_("blocklySelected",a)}updateDraggingDelete(a){this.setClass_("blocklyDraggingDelete",
|
|
986
979
|
a)}updateInsertionMarker(a){this.setClass_("blocklyInsertionMarker",a)}updateMovable(a){this.setClass_("blocklyDraggable",a)}updateReplacementFade(a){this.setClass_("blocklyReplaceable",a)}updateShapeForInputHighlight(a,b){}},module$build$src$core$renderers$common$path_object={};module$build$src$core$renderers$common$path_object.PathObject=PathObject$$module$build$src$core$renderers$common$path_object;var DUPLICATE_BLOCK_ERROR$$module$build$src$core$insertion_marker_manager="The insertion marker manager tried to create a marker but the result is missing %1. If you are using a mutator, make sure your domToMutation method is properly defined.",InsertionMarkerManager$$module$build$src$core$insertion_marker_manager=class{constructor(a){this.localConnection_=this.closestConnection_=this.lastMarker_=this.lastOnStack_=null;this.wouldDeleteBlock_=!1;this.fadedBlock_=this.highlightedBlock_=this.markerConnection_=
|
|
987
980
|
null;setSelected$$module$build$src$core$common(a);this.topBlock_=a;this.workspace_=a.workspace;this.firstMarker_=this.createMarkerBlock_(this.topBlock_);this.availableConnections_=this.initAvailableConnections_()}dispose(){this.availableConnections_.length=0;disable$$module$build$src$core$events$utils();try{this.firstMarker_&&this.firstMarker_.dispose(),this.lastMarker_&&this.lastMarker_.dispose()}finally{enable$$module$build$src$core$events$utils()}}updateAvailableConnections(){this.availableConnections_=
|
|
988
|
-
this.initAvailableConnections_()}wouldDeleteBlock(){return this.wouldDeleteBlock_}wouldConnectBlock(){return!!this.closestConnection_}applyConnections(){if(this.closestConnection_
|
|
989
|
-
this.topBlock_.getRootBlock().bringToFront()}}update(a,b){const c=this.getCandidate_(a);if((this.wouldDeleteBlock_=this.shouldDelete_(c,b))||this.shouldUpdatePreviews_(c,a))disable$$module$build$src$core$events$utils(),this.maybeHidePreview_(c),this.maybeShowPreview_(c),enable$$module$build$src$core$events$utils()}createMarkerBlock_(a){var b=a.type;disable$$module$build$src$core$events$utils();
|
|
990
|
-
d&&c.loadExtraState&&c.loadExtraState(d)}else if(a.mutationToDom){const e=a.mutationToDom();e&&c.domToMutation&&c.domToMutation(e)}for(b=0;b<a.inputList.length;b++){const e=a.inputList[b];if(e.name===COLLAPSED_INPUT_NAME$$module$build$src$core$constants)continue;const f=c.inputList[b];if(!f)throw Error(DUPLICATE_BLOCK_ERROR$$module$build$src$core$insertion_marker_manager.replace("%1","an input"));
|
|
991
|
-
"a field"));h.setValue(g.getValue())}}c.setCollapsed(a.isCollapsed());c.setInputsInline(a.getInputsInline());c.initSvg();c.getSvgRoot().setAttribute("visibility","hidden")}finally{enable$$module$build$src$core$events$utils()}return c}initAvailableConnections_(){const a=this.topBlock_.getConnections_(!1),b=this.topBlock_.lastConnectionInStack(!0);
|
|
992
|
-
this.createMarkerBlock_(b.getSourceBlock())}return a}shouldUpdatePreviews_(a,b){var c=a.local;const d=a.closest;a=a.radius;if(c&&d){if(this.localConnection_&&this.closestConnection_){if(this.closestConnection_===d&&this.localConnection_===c)return!1;c=this.localConnection_.x+
|
|
993
|
-
else return!0}else return!(!this.localConnection_||!this.closestConnection_);console.error("Returning true from shouldUpdatePreviews, but it's not clear why.");return!0}getCandidate_(a){let b=
|
|
994
|
-
radius:b}}getStartRadius_(){return this.closestConnection_&&this.localConnection_?$.config$$module$build$src$core$config.connectingSnapRadius:$.config$$module$build$src$core$config.snapRadius}shouldDelete_(a,
|
|
995
|
-
b.getSourceBlock().isInsertionMarker()?console.log("Trying to connect to an insertion marker"):(this.closestConnection_=b,this.localConnection_=a,this.showPreview_()))}}showPreview_(){
|
|
981
|
+
this.initAvailableConnections_()}wouldDeleteBlock(){return this.wouldDeleteBlock_}wouldConnectBlock(){return!!this.closestConnection_}applyConnections(){if(this.closestConnection_){if(!this.localConnection_)throw Error("Cannot apply connections because there is no local connection");disable$$module$build$src$core$events$utils();this.hidePreview_();enable$$module$build$src$core$events$utils();this.localConnection_.connect(this.closestConnection_);if(this.topBlock_.rendered){const a=this.localConnection_.isSuperior()?
|
|
982
|
+
this.closestConnection_:this.localConnection_;connectionUiEffect$$module$build$src$core$block_animations(a.getSourceBlock());this.topBlock_.getRootBlock().bringToFront()}}}update(a,b){const c=this.getCandidate_(a);if((this.wouldDeleteBlock_=this.shouldDelete_(c,b))||this.shouldUpdatePreviews_(c,a))disable$$module$build$src$core$events$utils(),this.maybeHidePreview_(c),this.maybeShowPreview_(c),enable$$module$build$src$core$events$utils()}createMarkerBlock_(a){var b=a.type;disable$$module$build$src$core$events$utils();
|
|
983
|
+
let c;try{c=this.workspace_.newBlock(b);c.setInsertionMarker(!0);if(a.saveExtraState){var d=a.saveExtraState();d&&c.loadExtraState&&c.loadExtraState(d)}else if(a.mutationToDom){const e=a.mutationToDom();e&&c.domToMutation&&c.domToMutation(e)}for(b=0;b<a.inputList.length;b++){const e=a.inputList[b];if(e.name===COLLAPSED_INPUT_NAME$$module$build$src$core$constants)continue;const f=c.inputList[b];if(!f)throw Error(DUPLICATE_BLOCK_ERROR$$module$build$src$core$insertion_marker_manager.replace("%1","an input"));
|
|
984
|
+
for(d=0;d<e.fieldRow.length;d++){const g=e.fieldRow[d],h=f.fieldRow[d];if(!h)throw Error(DUPLICATE_BLOCK_ERROR$$module$build$src$core$insertion_marker_manager.replace("%1","a field"));h.setValue(g.getValue())}}c.setCollapsed(a.isCollapsed());c.setInputsInline(a.getInputsInline());c.initSvg();c.getSvgRoot().setAttribute("visibility","hidden")}finally{enable$$module$build$src$core$events$utils()}return c}initAvailableConnections_(){const a=this.topBlock_.getConnections_(!1),b=this.topBlock_.lastConnectionInStack(!0);
|
|
985
|
+
if(b&&b!==this.topBlock_.nextConnection){a.push(b);this.lastOnStack_=b;if(this.lastMarker_){disable$$module$build$src$core$events$utils();try{this.lastMarker_.dispose()}finally{enable$$module$build$src$core$events$utils()}}this.lastMarker_=this.createMarkerBlock_(b.getSourceBlock())}return a}shouldUpdatePreviews_(a,b){var c=a.local;const d=a.closest;a=a.radius;if(c&&d){if(this.localConnection_&&this.closestConnection_){if(this.closestConnection_===d&&this.localConnection_===c)return!1;c=this.localConnection_.x+
|
|
986
|
+
b.x-this.closestConnection_.x;b=this.localConnection_.y+b.y-this.closestConnection_.y;b=Math.sqrt(c*c+b*b);return!(d&&a>b-$.config$$module$build$src$core$config.currentConnectionPreference)}if(this.localConnection_||this.closestConnection_)console.error("Only one of localConnection_ and closestConnection_ was set.");else return!0}else return!(!this.localConnection_||!this.closestConnection_);console.error("Returning true from shouldUpdatePreviews, but it's not clear why.");return!0}getCandidate_(a){let b=
|
|
987
|
+
this.getStartRadius_(),c=null,d=null;this.markerConnection_&&this.markerConnection_.isConnected()||this.updateAvailableConnections();for(let e=0;e<this.availableConnections_.length;e++){const f=this.availableConnections_[e],g=f.closest(b,a);g.connection&&(c=g.connection,d=f,b=g.radius)}return{closest:c,local:d,radius:b}}getStartRadius_(){return this.closestConnection_&&this.localConnection_?$.config$$module$build$src$core$config.connectingSnapRadius:$.config$$module$build$src$core$config.snapRadius}shouldDelete_(a,
|
|
988
|
+
b){return b&&this.workspace_.getComponentManager().hasCapability(b.id,ComponentManager$$module$build$src$core$component_manager.Capability.DELETE_AREA)?b.wouldDelete(this.topBlock_,a&&!!a.closest):!1}maybeShowPreview_(a){if(!this.wouldDeleteBlock_){var b=a.closest;a=a.local;b&&(b===this.closestConnection_||b.getSourceBlock().isInsertionMarker()?console.log("Trying to connect to an insertion marker"):(this.closestConnection_=b,this.localConnection_=a,this.showPreview_()))}}showPreview_(){if(!this.closestConnection_)throw Error("Cannot show the preview because there is no closest connection");
|
|
989
|
+
if(!this.localConnection_)throw Error("Cannot show the preview because there is no local connection");const a=this.closestConnection_,b=this.workspace_.getRenderer();switch(b.getConnectionPreviewMethod(a,this.localConnection_,this.topBlock_)){case InsertionMarkerManager$$module$build$src$core$insertion_marker_manager.PREVIEW_TYPE.INPUT_OUTLINE:this.showInsertionInputOutline_();break;case InsertionMarkerManager$$module$build$src$core$insertion_marker_manager.PREVIEW_TYPE.INSERTION_MARKER:this.showInsertionMarker_();
|
|
996
990
|
break;case InsertionMarkerManager$$module$build$src$core$insertion_marker_manager.PREVIEW_TYPE.REPLACEMENT_FADE:this.showReplacementFade_()}a&&b.shouldHighlightConnection(a)&&a.highlight()}maybeHidePreview_(a){if(a.closest){const b=this.closestConnection_!==a.closest;a=this.localConnection_!==a.local;this.closestConnection_&&this.localConnection_&&(b||a||this.wouldDeleteBlock_)&&this.hidePreview_()}else this.hidePreview_();this.localConnection_=this.closestConnection_=this.markerConnection_=null}hidePreview_(){this.closestConnection_&&
|
|
997
|
-
this.closestConnection_.targetBlock()&&this.workspace_.getRenderer().shouldHighlightConnection(this.closestConnection_)&&this.closestConnection_.unhighlight();this.fadedBlock_?this.hideReplacementFade_():this.highlightedBlock_?this.hideInsertionInputOutline_():this.markerConnection_&&this.hideInsertionMarker_()}showInsertionMarker_(){
|
|
998
|
-
a
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
this.
|
|
991
|
+
this.closestConnection_.targetBlock()&&this.workspace_.getRenderer().shouldHighlightConnection(this.closestConnection_)&&this.closestConnection_.unhighlight();this.fadedBlock_?this.hideReplacementFade_():this.highlightedBlock_?this.hideInsertionInputOutline_():this.markerConnection_&&this.hideInsertionMarker_()}showInsertionMarker_(){if(!this.localConnection_)throw Error("Cannot show the insertion marker because there is no local connection");if(!this.closestConnection_)throw Error("Cannot show the insertion marker because there is no closest connection");
|
|
992
|
+
const a=this.localConnection_,b=this.closestConnection_,c=this.lastOnStack_&&a===this.lastOnStack_;let d=c?this.lastMarker_:this.firstMarker_;if(!d)throw Error("Cannot show the insertion marker because there is no insertion marker block");let e;try{e=d.getMatchingConnection(a.getSourceBlock(),a)}catch(f){this.firstMarker_=this.createMarkerBlock_(this.topBlock_);d=c?this.lastMarker_:this.firstMarker_;if(!d)throw Error("Cannot show the insertion marker because there is no insertion marker block");e=
|
|
993
|
+
d.getMatchingConnection(a.getSourceBlock(),a)}if(!e)throw Error("Cannot show the insertion marker because there is no associated connection");if(e===this.markerConnection_)throw Error("Made it to showInsertionMarker_ even though the marker isn't changing");d.render();d.rendered=!0;d.getSvgRoot().setAttribute("visibility","visible");e&&b&&d.positionNearConnection(e,b);b&&e.connect(b);this.markerConnection_=e}hideInsertionMarker_(){if(this.markerConnection_){var a=this.markerConnection_,b=a.getSourceBlock(),
|
|
994
|
+
c=b.nextConnection,d=b.previousConnection,e=b.outputConnection;e=a.type===ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE&&!(e&&e.targetConnection);!(a!==c||d&&d.targetConnection)||e?a.targetBlock().unplug(!1):a.type===ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT&&a!==c?((c=a.targetConnection)&&c.getSourceBlock().unplug(!1),d=d?d.targetConnection:null,b.unplug(!0),d&&c&&d.connect(c)):b.unplug(!0);if(a.targetConnection)throw Error("markerConnection_ still connected at the end of disconnectInsertionMarker");
|
|
995
|
+
this.markerConnection_=null;(a=b.getSvgRoot())&&a.setAttribute("visibility","hidden")}else console.log("No insertion marker connection to disconnect")}showInsertionInputOutline_(){if(!this.closestConnection_)throw Error("Cannot show the insertion marker outline because there is no closest connection");const a=this.closestConnection_;this.highlightedBlock_=a.getSourceBlock();this.highlightedBlock_.highlightShapeForInput(a,!0)}hideInsertionInputOutline_(){if(!this.highlightedBlock_)throw Error("Cannot hide the insertion marker outline because there is no highlighted block");
|
|
996
|
+
if(!this.closestConnection_)throw Error("Cannot hide the insertion marker outline because there is no closest connection");this.highlightedBlock_.highlightShapeForInput(this.closestConnection_,!1);this.highlightedBlock_=null}showReplacementFade_(){if(!this.closestConnection_)throw Error("Cannot show the replacement fade because there is no closest connection");this.fadedBlock_=this.closestConnection_.targetBlock();if(!this.fadedBlock_)throw Error("Cannot show the replacement fade because the closest connection does not have a target block");
|
|
997
|
+
this.fadedBlock_.fadeForReplacement(!0)}hideReplacementFade_(){if(!this.fadedBlock_)throw Error("Cannot hide the replacement because there is no faded block");this.fadedBlock_.fadeForReplacement(!1);this.fadedBlock_=null}getInsertionMarkers(){const a=[];this.firstMarker_&&a.push(this.firstMarker_);this.lastMarker_&&a.push(this.lastMarker_);return a}};
|
|
1002
998
|
(function(a){a=a.PREVIEW_TYPE||(a.PREVIEW_TYPE={});a[a.INSERTION_MARKER=0]="INSERTION_MARKER";a[a.INPUT_OUTLINE=1]="INPUT_OUTLINE";a[a.REPLACEMENT_FADE=2]="REPLACEMENT_FADE"})(InsertionMarkerManager$$module$build$src$core$insertion_marker_manager||(InsertionMarkerManager$$module$build$src$core$insertion_marker_manager={}));
|
|
1003
999
|
var PreviewType$$module$build$src$core$insertion_marker_manager=InsertionMarkerManager$$module$build$src$core$insertion_marker_manager.PREVIEW_TYPE,module$build$src$core$insertion_marker_manager={};module$build$src$core$insertion_marker_manager.InsertionMarkerManager=InsertionMarkerManager$$module$build$src$core$insertion_marker_manager;module$build$src$core$insertion_marker_manager.PreviewType=PreviewType$$module$build$src$core$insertion_marker_manager;var Renderer$$module$build$src$core$renderers$common$renderer=class{constructor(a){this.overrides=null;this.name=a}getClassName(){return this.name+"-renderer"}init(a,b){this.constants_=this.makeConstants_();b&&(this.overrides=b,Object.assign(this.constants_,b));this.constants_.setTheme(a);this.constants_.init()}createDom(a,b){this.constants_.createDom(a,this.name+"-"+b.name,"."+this.getClassName()+"."+b.getClassName())}refreshDom(a,b){const c=this.getConstants();c.dispose();this.constants_=this.makeConstants_();
|
|
1004
1000
|
this.overrides&&Object.assign(this.constants_,this.overrides);this.constants_.randomIdentifier=c.randomIdentifier;this.constants_.setTheme(b);this.constants_.init();this.createDom(a,b)}dispose(){this.constants_&&this.constants_.dispose()}makeConstants_(){return new ConstantProvider$$module$build$src$core$renderers$common$constants}makeRenderInfo_(a){return new RenderInfo$$module$build$src$core$renderers$common$info(this,a)}makeDrawer_(a,b){return new Drawer$$module$build$src$core$renderers$common$drawer(a,
|
|
@@ -1042,8 +1038,8 @@ this.varType,this.varId)}};register$$module$build$src$core$registry(Type$$module
|
|
|
1042
1038
|
this.newName):b.renameVariableById(this.varId,this.oldName)}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,VAR_RENAME$$module$build$src$core$events$utils,VarRename$$module$build$src$core$events$events_var_rename);var module$build$src$core$events$events_var_rename={};module$build$src$core$events$events_var_rename.VarRename=VarRename$$module$build$src$core$events$events_var_rename;var VariableMap$$module$build$src$core$variable_map=class{constructor(a){this.workspace=a;this.variableMap=new Map}clear(){this.variableMap.clear()}renameVariable(a,b){const c=this.getVariable(b,a.type),d=this.workspace.getAllBlocks(!1);setGroup$$module$build$src$core$events$utils(!0);try{c&&c.getId()!==a.getId()?this.renameVariableWithConflict_(a,b,c,d):this.renameVariableAndUses_(a,b,d)}finally{setGroup$$module$build$src$core$events$utils(!1)}}renameVariableById(a,b){const c=this.getVariableById(a);
|
|
1043
1039
|
if(!c)throw Error("Tried to rename a variable that didn't exist. ID: "+a);this.renameVariable(c,b)}renameVariableAndUses_(a,b,c){fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(VAR_RENAME$$module$build$src$core$events$utils))(a,b));a.name=b;for(b=0;b<c.length;b++)c[b].updateVarName(a)}renameVariableWithConflict_(a,b,c,d){const e=a.type;b!==c.name&&this.renameVariableAndUses_(c,b,d);for(b=0;b<d.length;b++)d[b].renameVarById(a.getId(),c.getId());fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(VAR_DELETE$$module$build$src$core$events$utils))(a));
|
|
1044
1040
|
removeElem$$module$build$src$core$utils$array(this.variableMap.get(e),a)}createVariable(a,b,c){var d=this.getVariable(a,b);if(d){if(c&&d.getId()!==c)throw Error('Variable "'+a+'" is already in use and its id is "'+d.getId()+'" which conflicts with the passed in id, "'+c+'".');return d}if(c&&this.getVariableById(c))throw Error('Variable id, "'+c+'", is already in use.');d=c||genUid$$module$build$src$core$utils$idgenerator();b=b||"";d=new VariableModel$$module$build$src$core$variable_model(this.workspace,
|
|
1045
|
-
a,b,d);a=this.variableMap.get(b)||[];a.push(d);this.variableMap.delete(b);this.variableMap.set(b,a);return d}deleteVariable(a){const b=a.getId(),c=this.variableMap.get(a.type);if(c)for(let d=0;d<c.length;d++)if(c[d].getId()===b){c.splice(d,1);fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(VAR_DELETE$$module$build$src$core$events$utils))(a));break}}deleteVariableById(a){const b=this.getVariableById(a);if(b){var c=b.name;const d=this.getVariableUsesById(a);for(let
|
|
1046
|
-
0,
|
|
1041
|
+
a,b,d);a=this.variableMap.get(b)||[];a.push(d);this.variableMap.delete(b);this.variableMap.set(b,a);return d}deleteVariable(a){const b=a.getId(),c=this.variableMap.get(a.type);if(c)for(let d=0;d<c.length;d++)if(c[d].getId()===b){c.splice(d,1);fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(VAR_DELETE$$module$build$src$core$events$utils))(a));break}}deleteVariableById(a){const b=this.getVariableById(a);if(b){var c=b.name;const d=this.getVariableUsesById(a);for(let e=
|
|
1042
|
+
0,f;f=d[e];e++)if("procedures_defnoreturn"===f.type||"procedures_defreturn"===f.type){a=String(f.getFieldValue("NAME"));c=Msg$$module$build$src$core$msg.CANNOT_DELETE_VARIABLE_PROCEDURE.replace("%1",c).replace("%2",a);alert$$module$build$src$core$dialog(c);return}1<d.length?(c=Msg$$module$build$src$core$msg.DELETE_VARIABLE_CONFIRMATION.replace("%1",String(d.length)).replace("%2",c),confirm$$module$build$src$core$dialog(c,e=>{e&&b&&this.deleteVariableInternal(b,d)})):this.deleteVariableInternal(b,
|
|
1047
1043
|
d)}else console.warn("Can't delete non-existent variable: "+a)}deleteVariableInternal(a,b){const c=getGroup$$module$build$src$core$events$utils();c||setGroup$$module$build$src$core$events$utils(!0);try{for(let d=0;d<b.length;d++)b[d].dispose(!0);this.deleteVariable(a)}finally{c||setGroup$$module$build$src$core$events$utils(!1)}}getVariable(a,b){if(b=this.variableMap.get(b||""))for(let c=0,d;d=b[c];c++)if(Names$$module$build$src$core$names.equals(d.name,a))return d;return null}getVariableById(a){for(const [,
|
|
1048
1044
|
b]of this.variableMap)for(const c of b)if(c.getId()===a)return c;return null}getVariablesOfType(a){return(a=this.variableMap.get(a||""))?a.slice():[]}getVariableTypes(a){const b=new Set(this.variableMap.keys());if(a&&a.getPotentialVariableMap())for(const c of a.getPotentialVariableMap().variableMap.keys())b.add(c);b.has("")||b.add("");return Array.from(b.values())}getAllVariables(){let a=[];for(const b of this.variableMap.values())a=a.concat(b);return a}getAllVariableNames(){return Array.from(this.variableMap.values()).flat().map(a=>
|
|
1049
1045
|
a.name)}getVariableUsesById(a){const b=[],c=this.workspace.getAllBlocks(!1);for(let d=0;d<c.length;d++){const e=c[d].getVarModels();if(e)for(let f=0;f<e.length;f++)e[f].getId()===a&&b.push(c[d])}return b}},module$build$src$core$variable_map={};module$build$src$core$variable_map.VariableMap=VariableMap$$module$build$src$core$variable_map;var Workspace$$module$build$src$core$workspace=class{constructor(a){this.isClearing=this.internalIsMutator=this.internalIsFlyout=this.rendered=!1;this.MAX_UNDO=1024;this.connectionDBList=[];this.topBlocks_=[];this.topComments_=[];this.commentDB=new Map;this.listeners_=[];this.undoStack_=[];this.redoStack_=[];this.blockDB=new Map;this.typedBlocksDB=new Map;this.potentialVariableMap_=null;this.id=genUid$$module$build$src$core$utils$idgenerator();registerWorkspace$$module$build$src$core$common(this);
|
|
@@ -1052,82 +1048,81 @@ this.options=a||new Options$$module$build$src$core$options({});this.RTL=!!this.o
|
|
|
1052
1048
|
}getTopBlocks(a){const b=[].concat(this.topBlocks_);a&&1<b.length&&(this.sortObjects_.offset=Math.sin(toRadians$$module$build$src$core$utils$math(Workspace$$module$build$src$core$workspace.SCAN_ANGLE)),this.RTL&&(this.sortObjects_.offset*=-1),b.sort(this.sortObjects_));return b}addTypedBlock(a){this.typedBlocksDB.has(a.type)||this.typedBlocksDB.set(a.type,[]);this.typedBlocksDB.get(a.type).push(a)}removeTypedBlock(a){removeElem$$module$build$src$core$utils$array(this.typedBlocksDB.get(a.type),a);
|
|
1053
1049
|
this.typedBlocksDB.get(a.type).length||this.typedBlocksDB.delete(a.type)}getBlocksByType(a,b){if(!this.typedBlocksDB.has(a))return[];a=this.typedBlocksDB.get(a).slice(0);b&&a&&1<a.length&&(this.sortObjects_.offset=Math.sin(toRadians$$module$build$src$core$utils$math(Workspace$$module$build$src$core$workspace.SCAN_ANGLE)),this.RTL&&(this.sortObjects_.offset*=-1),a.sort(this.sortObjects_));return a.filter(function(c){return!c.isInsertionMarker()})}addTopComment(a){this.topComments_.push(a);this.commentDB.has(a.id)&&
|
|
1054
1050
|
console.warn('Overriding an existing comment on this workspace, with id "'+a.id+'"');this.commentDB.set(a.id,a)}removeTopComment(a){if(!removeElem$$module$build$src$core$utils$array(this.topComments_,a))throw Error("Comment not present in workspace's list of top-most comments.");this.commentDB.delete(a.id)}getTopComments(a){const b=[].concat(this.topComments_);a&&1<b.length&&(this.sortObjects_.offset=Math.sin(toRadians$$module$build$src$core$utils$math(Workspace$$module$build$src$core$workspace.SCAN_ANGLE)),
|
|
1055
|
-
this.RTL&&(this.sortObjects_.offset*=-1),b.sort(this.sortObjects_));return b}getAllBlocks(a){if(a){var b=this.getTopBlocks(!0);a=[];for(let c=0;c<b.length;c++)a.push
|
|
1051
|
+
this.RTL&&(this.sortObjects_.offset*=-1),b.sort(this.sortObjects_));return b}getAllBlocks(a){if(a){var b=this.getTopBlocks(!0);a=[];for(let c=0;c<b.length;c++)a.push(...b[c].getDescendants(!0))}else for(a=this.getTopBlocks(!1),b=0;b<a.length;b++)a.push(...a[b].getChildren(!1));return a.filter(function(c){return!c.isInsertionMarker()})}clear(){this.isClearing=!0;try{const a=getGroup$$module$build$src$core$events$utils();for(a||setGroup$$module$build$src$core$events$utils(!0);this.topBlocks_.length;)this.topBlocks_[0].dispose(!1);
|
|
1056
1052
|
for(;this.topComments_.length;)this.topComments_[this.topComments_.length-1].dispose();a||setGroup$$module$build$src$core$events$utils(!1);this.variableMap_.clear();this.potentialVariableMap_&&this.potentialVariableMap_.clear()}finally{this.isClearing=!1}}renameVariableById(a,b){this.variableMap_.renameVariableById(a,b)}createVariable(a,b,c){return this.variableMap_.createVariable(a,b,c)}getVariableUsesById(a){return this.variableMap_.getVariableUsesById(a)}deleteVariableById(a){this.variableMap_.deleteVariableById(a)}getVariable(a,
|
|
1057
1053
|
b){return this.variableMap_.getVariable(a,b)}getVariableById(a){return this.variableMap_.getVariableById(a)}getVariablesOfType(a){return this.variableMap_.getVariablesOfType(a)}getVariableTypes(){return this.variableMap_.getVariableTypes(this)}getAllVariables(){return this.variableMap_.getAllVariables()}getAllVariableNames(){return this.variableMap_.getAllVariableNames()}getWidth(){return 0}newBlock(a,b){throw Error("The implementation of newBlock should be monkey-patched in by blockly.ts");}remainingCapacity(){return isNaN(this.options.maxBlocks)?
|
|
1058
1054
|
Infinity:this.options.maxBlocks-this.getAllBlocks(!1).length}remainingCapacityOfType(a){return this.options.maxInstances?(void 0!==this.options.maxInstances[a]?this.options.maxInstances[a]:Infinity)-this.getBlocksByType(a,!1).length:Infinity}isCapacityAvailable(a){if(!this.hasBlockLimits())return!0;let b=0;for(const c in a){if(a[c]>this.remainingCapacityOfType(c))return!1;b+=a[c]}return b>this.remainingCapacity()?!1:!0}hasBlockLimits(){return Infinity!==this.options.maxBlocks||!!this.options.maxInstances}getUndoStack(){return this.undoStack_}getRedoStack(){return this.redoStack_}undo(a){var b=
|
|
1059
1055
|
a?this.redoStack_:this.undoStack_,c=a?this.undoStack_:this.redoStack_;const d=b.pop();if(d){for(var e=[d];b.length&&d.group&&d.group===b[b.length-1].group;)e.push(b.pop());for(b=0;b<e.length;b++)c.push(e[b]);e=filter$$module$build$src$core$events$utils(e,a);setRecordUndo$$module$build$src$core$events$utils(!1);try{for(c=0;c<e.length;c++)e[c].run(a)}finally{setRecordUndo$$module$build$src$core$events$utils(!0)}}}clearUndo(){this.undoStack_.length=0;this.redoStack_.length=0;clearPendingUndo$$module$build$src$core$events$utils()}addChangeListener(a){this.listeners_.push(a);
|
|
1060
1056
|
return a}removeChangeListener(a){removeElem$$module$build$src$core$utils$array(this.listeners_,a)}fireChangeListener(a){if(a.recordUndo)for(this.undoStack_.push(a),this.redoStack_.length=0;this.undoStack_.length>this.MAX_UNDO&&0<=this.MAX_UNDO;)this.undoStack_.shift();for(let b=0;b<this.listeners_.length;b++)(0,this.listeners_[b])(a)}getBlockById(a){return this.blockDB.get(a)||null}setBlockById(a,b){this.blockDB.set(a,b)}removeBlockById(a){this.blockDB.delete(a)}getCommentById(a){let b;return null!=
|
|
1061
1057
|
(b=this.commentDB.get(a))?b:null}allInputsFilled(a){const b=this.getTopBlocks(!1);for(let c=0;c<b.length;c++)if(!b[c].allInputsFilled(a))return!1;return!0}getPotentialVariableMap(){return this.potentialVariableMap_}createPotentialVariableMap(){this.potentialVariableMap_=new VariableMap$$module$build$src$core$variable_map(this)}getVariableMap(){return this.variableMap_}setVariableMap(a){this.variableMap_=a}static getById(a){return getWorkspaceById$$module$build$src$core$common(a)}static getAll(){return getAllWorkspaces$$module$build$src$core$common()}};
|
|
1062
|
-
Workspace$$module$build$src$core$workspace.SCAN_ANGLE=3;var module$build$src$core$workspace={};module$build$src$core$workspace.Workspace=Workspace$$module$build$src$core$workspace;var SOUND_LIMIT$$module$build$src$core$workspace_audio=100,WorkspaceAudio$$module$build$src$core$workspace_audio=class{constructor(a){this.parentWorkspace=a;this.sounds=new Map;this.lastSound_=null}dispose(){this.
|
|
1058
|
+
Workspace$$module$build$src$core$workspace.SCAN_ANGLE=3;var module$build$src$core$workspace={};module$build$src$core$workspace.Workspace=Workspace$$module$build$src$core$workspace;var SOUND_LIMIT$$module$build$src$core$workspace_audio=100,WorkspaceAudio$$module$build$src$core$workspace_audio=class{constructor(a){this.parentWorkspace=a;this.sounds=new Map;this.lastSound_=null}dispose(){this.sounds.clear()}load(a,b){if(a.length){try{var c=new globalThis.Audio}catch(e){return}for(let e=0;e<a.length;e++){const f=a[e],g=f.match(/\.(\w+)$/);if(g&&c.canPlayType("audio/"+g[1])){var d=new globalThis.Audio(f);break}}d&&this.sounds.set(b,d)}}preload(){for(const a of this.sounds.values()){a.volume=
|
|
1063
1059
|
.01;const b=a.play();void 0!==b?b.then(a.pause).catch(function(){}):a.pause();if(IPAD$$module$build$src$core$utils$useragent||IPHONE$$module$build$src$core$utils$useragent)break}}play(a,b){var c=this.sounds.get(a);c?(a=new Date,null!==this.lastSound_&&a.getTime()-this.lastSound_.getTime()<SOUND_LIMIT$$module$build$src$core$workspace_audio||(this.lastSound_=a,c=IPAD$$module$build$src$core$utils$useragent||ANDROID$$module$build$src$core$utils$useragent?c:c.cloneNode(),c.volume=void 0===b?1:b,c.play())):
|
|
1064
|
-
this.parentWorkspace&&this.parentWorkspace.getAudioManager().play(a,b)}},module$build$src$core$workspace_audio={};module$build$src$core$workspace_audio.WorkspaceAudio=WorkspaceAudio$$module$build$src$core$workspace_audio;var ZoomControls$$module$build$src$core$zoom_controls=class{constructor(a){this.workspace=a;this.id="zoomControls";this.
|
|
1065
|
-
{});const a=String(Math.random()).substring(2);this.createZoomOutSvg_(a);this.createZoomInSvg_(a);this.workspace.isMovable()&&this.createZoomResetSvg_(a);return this.
|
|
1066
|
-
this.onZoomResetWrapper_&&unbind$$module$build$src$core$browser_events(this.onZoomResetWrapper_);this.onZoomInWrapper_&&unbind$$module$build$src$core$browser_events(this.onZoomInWrapper_);this.onZoomOutWrapper_&&unbind$$module$build$src$core$browser_events(this.onZoomOutWrapper_)}getBoundingRectangle(){let a=this.SMALL_SPACING_+2*this.HEIGHT_;this.
|
|
1067
|
-
b){if(this.initialized_){var c=getCornerOppositeToolbox$$module$build$src$core$positionable_helpers(this.workspace,a),d=this.SMALL_SPACING_+2*this.HEIGHT_;this.
|
|
1068
|
-
c===verticalPosition$$module$build$src$core$positionable_helpers.TOP?bumpDirection$$module$build$src$core$positionable_helpers.DOWN:bumpDirection$$module$build$src$core$positionable_helpers.UP,b);c===verticalPosition$$module$build$src$core$positionable_helpers.TOP
|
|
1069
|
-
this.LARGE_SPACING_+this.HEIGHT_:0
|
|
1070
|
-
{id:"blocklyZoomoutClipPath"+a},this.
|
|
1071
|
-
"xlink:href",this.workspace.options.pathToMedia+SPRITE$$module$build$src$core$sprites.url);this.onZoomOutWrapper_=conditionalBind$$module$build$src$core$browser_events(this.
|
|
1072
|
-
{id:"blocklyZoominClipPath"+a},this.
|
|
1073
|
-
this.workspace.options.pathToMedia+SPRITE$$module$build$src$core$sprites.url);this.onZoomInWrapper_=conditionalBind$$module$build$src$core$browser_events(this.
|
|
1074
|
-
{"class":"blocklyZoom"},this.
|
|
1075
|
-
y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+a+")"},this.
|
|
1076
|
-
this.workspace.beginCanvasTransition();this.workspace.zoomCenter(b);this.workspace.scrollCenter();setTimeout(this.workspace.endCanvasTransition.bind(this.workspace),500);this.fireZoomEvent_();clearTouchIdentifier$$module$build$src$core$touch();a.stopPropagation();a.preventDefault()}fireZoomEvent_(){const a=new (get$$module$build$src$core$events$utils(CLICK$$module$build$src$core$events$utils))(null,this.workspace.id,"zoom_controls");
|
|
1077
|
-
var module$build$src$core$zoom_controls={};module$build$src$core$zoom_controls.ZoomControls=ZoomControls$$module$build$src$core$zoom_controls;var ZOOM_TO_FIT_MARGIN$$module$build$src$core$workspace_svg=20,WorkspaceSvg$$module$build$src$core$workspace_svg=class extends Workspace$$module$build$src$core$workspace{constructor(a,b,c){super(a);this.resizeHandlerWrapper_=null;this.resizesEnabled_=this.isVisible_=this.rendered=!0;this.startScrollY=this.startScrollX=this.scrollY=this.scrollX=0;this.dragDeltaXY_=null;this.oldScale_=this.scale=1;this.oldLeft_=this.oldTop_=0;this.workspaceDragSurface_=this.blockDragSurface_=this.currentGesture_=this.toolbox_=
|
|
1078
|
-
this.flyout_=this.scrollbar=this.trashcan=null;this.isDragSurfaceActive_=!1;this.inverseScreenCTM_=this.targetWorkspace=this.lastRecordedPageScroll_=this.injectionDiv_=null;this.inverseScreenCTMDirty_=!0;this.highlightedBlocks_=[];this.cachedParentSvg_=null;this.keyboardAccessibilityMode=!1;this.topBoundedElements_=[];this.dragTargetAreas_=[];this.metricsManager_=new (getClassFromOptions$$module$build$src$core$registry(Type$$module$build$src$core$registry.METRICS_MANAGER,
|
|
1079
|
-
a.getMetrics||this.metricsManager_.getMetrics.bind(this.metricsManager_);this.setMetrics=a.setMetrics||WorkspaceSvg$$module$build$src$core$workspace_svg.setTopLevelWorkspaceMetrics_;this.componentManager_=new ComponentManager$$module$build$src$core$component_manager;this.connectionDBList=ConnectionDB$$module$build$src$core$connection_db.init(this.connectionChecker);b&&(this.blockDragSurface_=b);c&&(this.workspaceDragSurface_=c);this.useWorkspaceDragSurface_=!!this.workspaceDragSurface_
|
|
1080
|
-
this.audioManager_=new WorkspaceAudio$$module$build$src$core$workspace_audio(a.parentWorkspace);this.grid_=this.options.gridPattern?new Grid$$module$build$src$core$grid(this.options.gridPattern,a.gridOptions):null;this.markerManager_=new MarkerManager$$module$build$src$core$marker_manager(this)
|
|
1081
|
-
|
|
1082
|
-
this.
|
|
1083
|
-
|
|
1084
|
-
null}
|
|
1085
|
-
this.
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
a
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
this.
|
|
1092
|
-
this.
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
this.
|
|
1097
|
-
|
|
1098
|
-
a)
|
|
1099
|
-
|
|
1100
|
-
this.
|
|
1101
|
-
this.
|
|
1102
|
-
this.
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
!
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
this.options.
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
this.
|
|
1120
|
-
|
|
1121
|
-
"blocklyCanvasTransitioning")
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
this.
|
|
1125
|
-
|
|
1126
|
-
a
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
module$build$src$core$workspace_svg.resizeSvgContents=resizeSvgContents$$module$build$src$core$workspace_svg;var module$build$src$core$serialization$workspaces={};module$build$src$core$serialization$workspaces.load=load$$module$build$src$core$serialization$workspaces;module$build$src$core$serialization$workspaces.save=save$$module$build$src$core$serialization$workspaces;var VariableSerializer$$module$build$src$core$serialization$variables=class{constructor(){this.priority=VARIABLES$$module$build$src$core$serialization$priorities}save(a){const b=[];for(const c of a.getAllVariables())a={name:c.name,id:c.getId()},c.type&&(a.type=c.type),b.push(a);return b.length?b:null}load(a,b){for(const c of a)b.createVariable(c.name,c.type,c.id)}clear(a){a.getVariableMap().clear()}};register$$module$build$src$core$serialization$registry("variables",new VariableSerializer$$module$build$src$core$serialization$variables);
|
|
1060
|
+
this.parentWorkspace&&this.parentWorkspace.getAudioManager().play(a,b)}},module$build$src$core$workspace_audio={};module$build$src$core$workspace_audio.WorkspaceAudio=WorkspaceAudio$$module$build$src$core$workspace_audio;var ZoomControls$$module$build$src$core$zoom_controls=class{constructor(a){this.workspace=a;this.id="zoomControls";this.zoomResetGroup=this.zoomOutGroup=this.zoomInGroup=this.onZoomOutWrapper_=this.onZoomInWrapper_=this.onZoomResetWrapper_=null;this.HEIGHT_=this.WIDTH_=32;this.SMALL_SPACING_=2;this.LARGE_SPACING_=11;this.MARGIN_HORIZONTAL_=this.MARGIN_VERTICAL_=20;this.svgGroup=null;this.top_=this.left_=0;this.initialized_=!1}createDom(){this.svgGroup=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,
|
|
1061
|
+
{});const a=String(Math.random()).substring(2);this.createZoomOutSvg_(a);this.createZoomInSvg_(a);this.workspace.isMovable()&&this.createZoomResetSvg_(a);return this.svgGroup}init(){this.workspace.getComponentManager().addComponent({component:this,weight:2,capabilities:[ComponentManager$$module$build$src$core$component_manager.Capability.POSITIONABLE]});this.initialized_=!0}dispose(){this.workspace.getComponentManager().removeComponent("zoomControls");this.svgGroup&&removeNode$$module$build$src$core$utils$dom(this.svgGroup);
|
|
1062
|
+
this.onZoomResetWrapper_&&unbind$$module$build$src$core$browser_events(this.onZoomResetWrapper_);this.onZoomInWrapper_&&unbind$$module$build$src$core$browser_events(this.onZoomInWrapper_);this.onZoomOutWrapper_&&unbind$$module$build$src$core$browser_events(this.onZoomOutWrapper_)}getBoundingRectangle(){let a=this.SMALL_SPACING_+2*this.HEIGHT_;this.zoomResetGroup&&(a+=this.LARGE_SPACING_+this.HEIGHT_);return new Rect$$module$build$src$core$utils$rect(this.top_,this.top_+a,this.left_,this.left_+this.WIDTH_)}position(a,
|
|
1063
|
+
b){if(this.initialized_){var c=getCornerOppositeToolbox$$module$build$src$core$positionable_helpers(this.workspace,a),d=this.SMALL_SPACING_+2*this.HEIGHT_;this.zoomResetGroup&&(d+=this.LARGE_SPACING_+this.HEIGHT_);a=getStartPositionRect$$module$build$src$core$positionable_helpers(c,new Size$$module$build$src$core$utils$size(this.WIDTH_,d),this.MARGIN_HORIZONTAL_,this.MARGIN_VERTICAL_,a,this.workspace);c=c.vertical;b=bumpPositionRect$$module$build$src$core$positionable_helpers(a,this.MARGIN_VERTICAL_,
|
|
1064
|
+
c===verticalPosition$$module$build$src$core$positionable_helpers.TOP?bumpDirection$$module$build$src$core$positionable_helpers.DOWN:bumpDirection$$module$build$src$core$positionable_helpers.UP,b);if(c===verticalPosition$$module$build$src$core$positionable_helpers.TOP){var e=this.SMALL_SPACING_+this.HEIGHT_,f;null==(f=this.zoomInGroup)||f.setAttribute("transform","translate(0, "+e+")");this.zoomResetGroup&&this.zoomResetGroup.setAttribute("transform","translate(0, "+(e+this.LARGE_SPACING_+this.HEIGHT_)+
|
|
1065
|
+
")")}else{f=this.zoomResetGroup?this.LARGE_SPACING_+this.HEIGHT_:0;let h;null==(h=this.zoomInGroup)||h.setAttribute("transform","translate(0, "+f+")");f=f+this.SMALL_SPACING_+this.HEIGHT_;null==(e=this.zoomOutGroup)||e.setAttribute("transform","translate(0, "+f+")")}this.top_=b.top;this.left_=b.left;var g;null==(g=this.svgGroup)||g.setAttribute("transform","translate("+this.left_+","+this.top_+")")}}createZoomOutSvg_(a){this.zoomOutGroup=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,
|
|
1066
|
+
{"class":"blocklyZoom"},this.svgGroup);const b=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.CLIPPATH,{id:"blocklyZoomoutClipPath"+a},this.zoomOutGroup);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{width:32,height:32},b);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.IMAGE,{width:SPRITE$$module$build$src$core$sprites.width,height:SPRITE$$module$build$src$core$sprites.height,
|
|
1067
|
+
x:-64,y:-92,"clip-path":"url(#blocklyZoomoutClipPath"+a+")"},this.zoomOutGroup).setAttributeNS(XLINK_NS$$module$build$src$core$utils$dom,"xlink:href",this.workspace.options.pathToMedia+SPRITE$$module$build$src$core$sprites.url);this.onZoomOutWrapper_=conditionalBind$$module$build$src$core$browser_events(this.zoomOutGroup,"mousedown",null,this.zoom_.bind(this,-1))}createZoomInSvg_(a){this.zoomInGroup=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{"class":"blocklyZoom"},
|
|
1068
|
+
this.svgGroup);const b=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.CLIPPATH,{id:"blocklyZoominClipPath"+a},this.zoomInGroup);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{width:32,height:32},b);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.IMAGE,{width:SPRITE$$module$build$src$core$sprites.width,height:SPRITE$$module$build$src$core$sprites.height,x:-32,y:-92,"clip-path":"url(#blocklyZoominClipPath"+
|
|
1069
|
+
a+")"},this.zoomInGroup).setAttributeNS(XLINK_NS$$module$build$src$core$utils$dom,"xlink:href",this.workspace.options.pathToMedia+SPRITE$$module$build$src$core$sprites.url);this.onZoomInWrapper_=conditionalBind$$module$build$src$core$browser_events(this.zoomInGroup,"mousedown",null,this.zoom_.bind(this,1))}zoom_(a,b){this.workspace.markFocused();this.workspace.zoomCenter(a);this.fireZoomEvent_();clearTouchIdentifier$$module$build$src$core$touch();b.stopPropagation();b.preventDefault()}createZoomResetSvg_(a){this.zoomResetGroup=
|
|
1070
|
+
createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{"class":"blocklyZoom"},this.svgGroup);const b=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.CLIPPATH,{id:"blocklyZoomresetClipPath"+a},this.zoomResetGroup);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{width:32,height:32},b);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.IMAGE,{width:SPRITE$$module$build$src$core$sprites.width,
|
|
1071
|
+
height:SPRITE$$module$build$src$core$sprites.height,y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+a+")"},this.zoomResetGroup).setAttributeNS(XLINK_NS$$module$build$src$core$utils$dom,"xlink:href",this.workspace.options.pathToMedia+SPRITE$$module$build$src$core$sprites.url);this.onZoomResetWrapper_=conditionalBind$$module$build$src$core$browser_events(this.zoomResetGroup,"mousedown",null,this.resetZoom_.bind(this))}resetZoom_(a){this.workspace.markFocused();const b=Math.log(this.workspace.options.zoomOptions.startScale/
|
|
1072
|
+
this.workspace.scale)/Math.log(this.workspace.options.zoomOptions.scaleSpeed);this.workspace.beginCanvasTransition();this.workspace.zoomCenter(b);this.workspace.scrollCenter();setTimeout(this.workspace.endCanvasTransition.bind(this.workspace),500);this.fireZoomEvent_();clearTouchIdentifier$$module$build$src$core$touch();a.stopPropagation();a.preventDefault()}fireZoomEvent_(){const a=new (get$$module$build$src$core$events$utils(CLICK$$module$build$src$core$events$utils))(null,this.workspace.id,"zoom_controls");
|
|
1073
|
+
fire$$module$build$src$core$events$utils(a)}};register$$module$build$src$core$css("\n.blocklyZoom>image, .blocklyZoom>svg>image {\n opacity: .4;\n}\n\n.blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {\n opacity: .6;\n}\n\n.blocklyZoom>image:active, .blocklyZoom>svg>image:active {\n opacity: .8;\n}\n");var module$build$src$core$zoom_controls={};module$build$src$core$zoom_controls.ZoomControls=ZoomControls$$module$build$src$core$zoom_controls;var ZOOM_TO_FIT_MARGIN$$module$build$src$core$workspace_svg=20,WorkspaceSvg$$module$build$src$core$workspace_svg=class extends Workspace$$module$build$src$core$workspace{constructor(a,b,c){super(a);this.resizeHandlerWrapper_=null;this.resizesEnabled_=this.isVisible_=this.rendered=!0;this.startScrollY=this.startScrollX=this.scrollY=this.scrollX=0;this.dragDeltaXY_=null;this.oldScale_=this.scale=1;this.oldLeft_=this.oldTop_=0;this.workspaceDragSurface_=this.blockDragSurface_=this.currentGesture_=this.toolbox_=
|
|
1074
|
+
this.flyout_=this.scrollbar=this.trashcan=null;this.isDragSurfaceActive_=!1;this.inverseScreenCTM_=this.targetWorkspace=this.configureContextMenu=this.lastRecordedPageScroll_=this.injectionDiv_=null;this.inverseScreenCTMDirty_=!0;this.highlightedBlocks_=[];this.toolboxCategoryCallbacks=new Map;this.flyoutButtonCallbacks=new Map;this.cachedParentSvg_=null;this.keyboardAccessibilityMode=!1;this.topBoundedElements_=[];this.dragTargetAreas_=[];this.zoomControls_=null;this.metricsManager_=new (getClassFromOptions$$module$build$src$core$registry(Type$$module$build$src$core$registry.METRICS_MANAGER,
|
|
1075
|
+
a,!0))(this);this.getMetrics=a.getMetrics||this.metricsManager_.getMetrics.bind(this.metricsManager_);this.setMetrics=a.setMetrics||WorkspaceSvg$$module$build$src$core$workspace_svg.setTopLevelWorkspaceMetrics_;this.componentManager_=new ComponentManager$$module$build$src$core$component_manager;this.connectionDBList=ConnectionDB$$module$build$src$core$connection_db.init(this.connectionChecker);b&&(this.blockDragSurface_=b);c&&(this.workspaceDragSurface_=c);this.useWorkspaceDragSurface_=!!this.workspaceDragSurface_;
|
|
1076
|
+
this.audioManager_=new WorkspaceAudio$$module$build$src$core$workspace_audio(a.parentWorkspace);this.grid_=this.options.gridPattern?new Grid$$module$build$src$core$grid(this.options.gridPattern,a.gridOptions):null;this.markerManager_=new MarkerManager$$module$build$src$core$marker_manager(this);$.module$build$src$core$variables&&flyoutCategory$$module$build$src$core$variables&&this.registerToolboxCategoryCallback(CATEGORY_NAME$$module$build$src$core$variables,flyoutCategory$$module$build$src$core$variables);
|
|
1077
|
+
module$build$src$core$variables_dynamic&&flyoutCategory$$module$build$src$core$variables_dynamic&&this.registerToolboxCategoryCallback(CATEGORY_NAME$$module$build$src$core$variables_dynamic,flyoutCategory$$module$build$src$core$variables_dynamic);$.module$build$src$core$procedures&&flyoutCategory$$module$build$src$core$procedures&&(this.registerToolboxCategoryCallback(CATEGORY_NAME$$module$build$src$core$procedures,flyoutCategory$$module$build$src$core$procedures),this.addChangeListener(mutatorOpenListener$$module$build$src$core$procedures));
|
|
1078
|
+
this.themeManager_=this.options.parentWorkspace?this.options.parentWorkspace.getThemeManager():new ThemeManager$$module$build$src$core$theme_manager(this,this.options.theme||Classic$$module$build$src$core$theme$classic);this.themeManager_.subscribeWorkspace(this);let d;this.renderer_=init$$module$build$src$core$renderers$common$block_rendering(this.options.renderer||"geras",this.getTheme(),null!=(d=this.options.rendererOverrides)?d:void 0);this.cachedParentSvgSize_=new Size$$module$build$src$core$utils$size(0,
|
|
1079
|
+
0)}getMarkerManager(){return this.markerManager_}getMetricsManager(){return this.metricsManager_}setMetricsManager(a){this.metricsManager_=a;this.getMetrics=this.metricsManager_.getMetrics.bind(this.metricsManager_)}getComponentManager(){return this.componentManager_}setCursorSvg(a){this.markerManager_.setCursorSvg(a)}setMarkerSvg(a){this.markerManager_.setMarkerSvg(a)}getMarker(a){return this.markerManager_?this.markerManager_.getMarker(a):null}getCursor(){return this.markerManager_?this.markerManager_.getCursor():
|
|
1080
|
+
null}getRenderer(){return this.renderer_}getThemeManager(){return this.themeManager_}getTheme(){return this.themeManager_.getTheme()}setTheme(a){a||(a=Classic$$module$build$src$core$theme$classic);this.themeManager_.setTheme(a)}refreshTheme(){this.svgGroup_&&this.renderer_.refreshDom(this.svgGroup_,this.getTheme());this.updateBlockStyles_(this.getAllBlocks(!1).filter(function(b){return!!b.getStyleName()}));this.refreshToolboxSelection();this.toolbox_&&this.toolbox_.refreshTheme();this.isVisible()&&
|
|
1081
|
+
this.setVisible(!0);const a=new (get$$module$build$src$core$events$utils(THEME_CHANGE$$module$build$src$core$events$utils))(this.getTheme().name,this.id);fire$$module$build$src$core$events$utils(a)}updateBlockStyles_(a){for(let b=0,c;c=a[b];b++){const d=c.getStyleName();if(d){const e=c;e.setStyle(d);e.mutator&&e.mutator.updateBlockStyle()}}}getInverseScreenCTM(){if(this.inverseScreenCTMDirty_){const a=this.getParentSvg().getScreenCTM();a&&(this.inverseScreenCTM_=a.inverse(),this.inverseScreenCTMDirty_=
|
|
1082
|
+
!1)}return this.inverseScreenCTM_}updateInverseScreenCTM(){this.inverseScreenCTMDirty_=!0}isVisible(){return this.isVisible_}getSvgXY(a){let b=0,c=0,d=1;if(containsNode$$module$build$src$core$utils$dom(this.getCanvas(),a)||containsNode$$module$build$src$core$utils$dom(this.getBubbleCanvas(),a))d=this.scale;do{const e=getRelativeXY$$module$build$src$core$utils$svg_math(a);if(a===this.getCanvas()||a===this.getBubbleCanvas())d=1;b+=e.x*d;c+=e.y*d;a=a.parentNode}while(a&&a!==this.getParentSvg());return new Coordinate$$module$build$src$core$utils$coordinate(b,
|
|
1083
|
+
c)}getCachedParentSvgSize(){const a=this.cachedParentSvgSize_;return new Size$$module$build$src$core$utils$size(a.width,a.height)}getOriginOffsetInPixels(){return getInjectionDivXY$$module$build$src$core$utils$svg_math(this.getCanvas())}getInjectionDiv(){if(!this.injectionDiv_){let a=this.svgGroup_;for(;a;){if(-1!==(" "+(a.getAttribute("class")||"")+" ").indexOf(" injectionDiv ")){this.injectionDiv_=a;break}a=a.parentNode}}return this.injectionDiv_}getBlockCanvas(){return this.svgBlockCanvas_}setResizeHandlerWrapper(a){this.resizeHandlerWrapper_=
|
|
1084
|
+
a}createDom(a){this.svgGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{"class":"blocklyWorkspace"});a&&(this.svgBackground_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{height:"100%",width:"100%","class":a},this.svgGroup_),"blocklyMainBackground"===a&&this.grid_?this.svgBackground_.style.fill="url(#"+this.grid_.getPatternId()+")":this.themeManager_.subscribe(this.svgBackground_,"workspaceBackgroundColour",
|
|
1085
|
+
"fill"));this.svgBlockCanvas_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{"class":"blocklyBlockCanvas"},this.svgGroup_);this.svgBubbleCanvas_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{"class":"blocklyBubbleCanvas"},this.svgGroup_);this.isFlyout||(conditionalBind$$module$build$src$core$browser_events(this.svgGroup_,"mousedown",this,this.onMouseDown_,!1,!0),document.body.addEventListener("wheel",function(){}),
|
|
1086
|
+
conditionalBind$$module$build$src$core$browser_events(this.svgGroup_,"wheel",this,this.onMouseWheel_));this.options.hasCategories&&(this.toolbox_=new (getClassFromOptions$$module$build$src$core$registry(Type$$module$build$src$core$registry.TOOLBOX,this.options,!0))(this));this.grid_&&this.grid_.update(this.scale);this.recordDragTargets();(a=getClassFromOptions$$module$build$src$core$registry(Type$$module$build$src$core$registry.CURSOR,this.options))&&this.markerManager_.setCursor(new a);this.renderer_.createDom(this.svgGroup_,
|
|
1087
|
+
this.getTheme());return this.svgGroup_}dispose(){this.rendered=!1;this.currentGesture_&&this.currentGesture_.cancel();this.svgGroup_&&removeNode$$module$build$src$core$utils$dom(this.svgGroup_);this.toolbox_&&(this.toolbox_.dispose(),this.toolbox_=null);this.flyout_&&(this.flyout_.dispose(),this.flyout_=null);this.trashcan&&(this.trashcan.dispose(),this.trashcan=null);this.scrollbar&&(this.scrollbar.dispose(),this.scrollbar=null);this.zoomControls_&&this.zoomControls_.dispose();this.audioManager_&&
|
|
1088
|
+
this.audioManager_.dispose();this.grid_&&(this.grid_=null);this.renderer_.dispose();this.markerManager_&&this.markerManager_.dispose();super.dispose();this.themeManager_&&(this.themeManager_.unsubscribeWorkspace(this),this.themeManager_.unsubscribe(this.svgBackground_),this.options.parentWorkspace||this.themeManager_.dispose());this.connectionDBList.length=0;this.toolboxCategoryCallbacks.clear();this.flyoutButtonCallbacks.clear();if(!this.options.parentWorkspace){const a=this.getParentSvg();a&&a.parentNode&&
|
|
1089
|
+
removeNode$$module$build$src$core$utils$dom(a.parentNode)}this.resizeHandlerWrapper_&&(unbind$$module$build$src$core$browser_events(this.resizeHandlerWrapper_),this.resizeHandlerWrapper_=null)}addTrashcan(){this.trashcan=WorkspaceSvg$$module$build$src$core$workspace_svg.newTrashcan(this);const a=this.trashcan.createDom();this.svgGroup_.insertBefore(a,this.svgBlockCanvas_)}static newTrashcan(a){throw Error("The implementation of newTrashcan should be monkey-patched in by blockly.ts");}addZoomControls(){this.zoomControls_=
|
|
1090
|
+
new ZoomControls$$module$build$src$core$zoom_controls(this);const a=this.zoomControls_.createDom();this.svgGroup_.appendChild(a)}addFlyout(a){const b=new Options$$module$build$src$core$options({parentWorkspace:this,rtl:this.RTL,oneBasedIndex:this.options.oneBasedIndex,horizontalLayout:this.horizontalLayout,renderer:this.options.renderer,rendererOverrides:this.options.rendererOverrides,move:{scrollbars:!0}});b.toolboxPosition=this.options.toolboxPosition;this.flyout_=this.horizontalLayout?new (getClassFromOptions$$module$build$src$core$registry(Type$$module$build$src$core$registry.FLYOUTS_HORIZONTAL_TOOLBOX,
|
|
1091
|
+
this.options,!0))(b):new (getClassFromOptions$$module$build$src$core$registry(Type$$module$build$src$core$registry.FLYOUTS_VERTICAL_TOOLBOX,this.options,!0))(b);this.flyout_.autoClose=!1;this.flyout_.getWorkspace().setVisible(!0);return this.flyout_.createDom(a)}getFlyout(a){return this.flyout_||a?this.flyout_:this.toolbox_?this.toolbox_.getFlyout():null}getToolbox(){return this.toolbox_}updateScreenCalculations_(){this.updateInverseScreenCTM();this.recordDragTargets()}resizeContents(){this.resizesEnabled_&&
|
|
1092
|
+
this.rendered&&(this.scrollbar&&this.scrollbar.resize(),this.updateInverseScreenCTM())}resize(){this.toolbox_&&this.toolbox_.position();this.flyout_&&this.flyout_.position();const a=this.componentManager_.getComponents(ComponentManager$$module$build$src$core$component_manager.Capability.POSITIONABLE,!0),b=this.getMetricsManager().getUiMetrics(),c=[];for(let d=0,e;e=a[d];d++){e.position(b,c);const f=e.getBoundingRectangle();f&&c.push(f)}this.scrollbar&&this.scrollbar.resize();this.updateScreenCalculations_()}updateScreenCalculationsIfScrolled(){const a=
|
|
1093
|
+
getDocumentScroll$$module$build$src$core$utils$svg_math();Coordinate$$module$build$src$core$utils$coordinate.equals(this.lastRecordedPageScroll_,a)||(this.lastRecordedPageScroll_=a,this.updateScreenCalculations_())}getCanvas(){return this.svgBlockCanvas_}setCachedParentSvgSize(a,b){const c=this.getParentSvg();null!=a&&(this.cachedParentSvgSize_.width=a,c.setAttribute("data-cached-width",a.toString()));null!=b&&(this.cachedParentSvgSize_.height=b,c.setAttribute("data-cached-height",b.toString()))}getBubbleCanvas(){return this.svgBubbleCanvas_}getParentSvg(){if(!this.cachedParentSvg_){let a=
|
|
1094
|
+
this.svgGroup_;for(;a;){if("svg"===a.tagName){this.cachedParentSvg_=a;break}a=a.parentNode}}return this.cachedParentSvg_}maybeFireViewportChangeEvent(){if(isEnabled$$module$build$src$core$events$utils()){var a=this.scale,b=-this.scrollY,c=-this.scrollX;if(!(a===this.oldScale_&&1>Math.abs(b-this.oldTop_)&&1>Math.abs(c-this.oldLeft_))){var d=new (get$$module$build$src$core$events$utils(VIEWPORT_CHANGE$$module$build$src$core$events$utils))(b,c,a,this.id,this.oldScale_);this.oldScale_=a;this.oldTop_=
|
|
1095
|
+
b;this.oldLeft_=c;fire$$module$build$src$core$events$utils(d)}}}translate(a,b){if(this.useWorkspaceDragSurface_&&this.isDragSurfaceActive_){var c;null==(c=this.workspaceDragSurface_)||c.translateSurface(a,b)}else c="translate("+a+","+b+") scale("+this.scale+")",this.svgBlockCanvas_.setAttribute("transform",c),this.svgBubbleCanvas_.setAttribute("transform",c);this.blockDragSurface_&&this.blockDragSurface_.translateAndScaleGroup(a,b,this.scale);this.grid_&&this.grid_.moveTo(a,b);this.maybeFireViewportChangeEvent()}resetDragSurface(){if(this.useWorkspaceDragSurface_){this.isDragSurfaceActive_=
|
|
1096
|
+
!1;var a=this.workspaceDragSurface_.getSurfaceTranslation();this.workspaceDragSurface_.clearAndHide(this.svgGroup_);a="translate("+a.x+","+a.y+") scale("+this.scale+")";this.svgBlockCanvas_.setAttribute("transform",a);this.svgBubbleCanvas_.setAttribute("transform",a)}}setupDragSurface(){if(this.useWorkspaceDragSurface_&&!this.isDragSurfaceActive_){this.isDragSurfaceActive_=!0;var a=this.svgBlockCanvas_.previousSibling,b,c=parseInt(null!=(b=this.getParentSvg().getAttribute("width"))?b:"0",10),d;b=
|
|
1097
|
+
parseInt(null!=(d=this.getParentSvg().getAttribute("height"))?d:"0",10);d=getRelativeXY$$module$build$src$core$utils$svg_math(this.getCanvas());this.workspaceDragSurface_.setContentsAndShow(this.getCanvas(),this.getBubbleCanvas(),a,c,b,this.scale);this.workspaceDragSurface_.translateSurface(d.x,d.y)}}getBlockDragSurface(){return this.blockDragSurface_}getWidth(){const a=this.getMetrics();return a?a.viewWidth/this.scale:0}setVisible(a){this.isVisible_=a;if(this.svgGroup_)if(this.scrollbar&&this.scrollbar.setContainerVisible(a),
|
|
1098
|
+
this.getFlyout()&&this.getFlyout().setContainerVisible(a),this.getParentSvg().style.display=a?"block":"none",this.toolbox_&&this.toolbox_.setVisible(a),a){a=this.getAllBlocks(!1);for(let b=a.length-1;0<=b;b--)a[b].markDirty();this.render();this.toolbox_&&this.toolbox_.position()}else this.hideChaff(!0)}render(){var a=this.getAllBlocks(!1);for(var b=a.length-1;0<=b;b--)a[b].render(!1);if(this.currentGesture_)for(a=this.currentGesture_.getInsertionMarkers(),b=0;b<a.length;b++)a[b].render(!1);this.markerManager_.updateMarkers()}highlightBlock(a,
|
|
1099
|
+
b){if(void 0===b){for(let c=0,d;d=this.highlightedBlocks_[c];c++)d.setHighlighted(!1);this.highlightedBlocks_.length=0}if(a=a?this.getBlockById(a):null)(b=void 0===b||b)?-1===this.highlightedBlocks_.indexOf(a)&&this.highlightedBlocks_.push(a):removeElem$$module$build$src$core$utils$array(this.highlightedBlocks_,a),a.setHighlighted(b)}paste(a){if(!this.rendered||!a.type&&!a.tagName)return null;this.currentGesture_&&this.currentGesture_.cancel();const b=getGroup$$module$build$src$core$events$utils();
|
|
1100
|
+
b||setGroup$$module$build$src$core$events$utils(!0);a=a.type?this.pasteBlock_(null,a):"comment"===a.tagName.toLowerCase()?this.pasteWorkspaceComment_(a):this.pasteBlock_(a,null);setGroup$$module$build$src$core$events$utils(b);return a}pasteBlock_(a,b){disable$$module$build$src$core$events$utils();let c;try{let d=0,e=0;if(a){c=domToBlock$$module$build$src$core$xml(a,this);let f;d=parseInt(null!=(f=a.getAttribute("x"))?f:"0",10);this.RTL&&(d=-d);let g;e=parseInt(null!=(g=a.getAttribute("y"))?g:"0",
|
|
1101
|
+
10)}else b&&(c=append$$module$build$src$core$serialization$blocks(b,this),d=b.x||10,this.RTL&&(d=this.getWidth()-d),e=b.y||10);if(!isNaN(d)&&!isNaN(e)){let f;do{f=!1;const g=this.getAllBlocks(!1);for(let h=0,k;k=g[h];h++){const l=k.getRelativeToSurfaceXY();if(1>=Math.abs(d-l.x)&&1>=Math.abs(e-l.y)){f=!0;break}}if(!f){const h=c.getConnections_(!1);for(let k=0,l;l=h[k];k++)if(l.closest($.config$$module$build$src$core$config.snapRadius,new Coordinate$$module$build$src$core$utils$coordinate(d,e)).connection){f=
|
|
1102
|
+
!0;break}}f&&(d=this.RTL?d-$.config$$module$build$src$core$config.snapRadius:d+$.config$$module$build$src$core$config.snapRadius,e+=2*$.config$$module$build$src$core$config.snapRadius)}while(f);c.moveTo(new Coordinate$$module$build$src$core$utils$coordinate(d,e))}}finally{enable$$module$build$src$core$events$utils()}isEnabled$$module$build$src$core$events$utils()&&!c.isShadow()&&fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CREATE$$module$build$src$core$events$utils))(c));
|
|
1103
|
+
c.select();return c}pasteWorkspaceComment_(a){disable$$module$build$src$core$events$utils();let b;try{b=WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg.fromXmlRendered(a,this);let c,d=parseInt(null!=(c=a.getAttribute("x"))?c:"0",10),e,f=parseInt(null!=(e=a.getAttribute("y"))?e:"0",10);isNaN(d)||isNaN(f)||(this.RTL&&(d=-d),b.moveBy(d+50,f+50))}finally{enable$$module$build$src$core$events$utils()}isEnabled$$module$build$src$core$events$utils()&&WorkspaceComment$$module$build$src$core$workspace_comment.fireCreateEvent(b);
|
|
1104
|
+
b.select();return b}refreshToolboxSelection(){const a=this.isFlyout?this.targetWorkspace:this;a&&!a.currentGesture_&&a.toolbox_&&a.toolbox_.getFlyout()&&a.toolbox_.refreshSelection()}renameVariableById(a,b){super.renameVariableById(a,b);this.refreshToolboxSelection()}deleteVariableById(a){super.deleteVariableById(a);this.refreshToolboxSelection()}createVariable(a,b,c){a=super.createVariable(a,b,c);this.refreshToolboxSelection();return a}recordDeleteAreas(){warn$$module$build$src$core$utils$deprecation("WorkspaceSvg.prototype.recordDeleteAreas",
|
|
1105
|
+
"June 2021","June 2022","WorkspaceSvg.prototype.recordDragTargets");this.recordDragTargets()}recordDragTargets(){const a=this.componentManager_.getComponents(ComponentManager$$module$build$src$core$component_manager.Capability.DRAG_TARGET,!0);this.dragTargetAreas_=[];for(let b=0,c;c=a[b];b++){const d=c.getClientRect();d&&this.dragTargetAreas_.push({component:c,clientRect:d})}}newBlock(a,b){throw Error("The implementation of newBlock should be monkey-patched in by blockly.ts");}getDragTarget(a){for(let b=
|
|
1106
|
+
0,c;c=this.dragTargetAreas_[b];b++)if(c.clientRect.contains(a.clientX,a.clientY))return c.component;return null}onMouseDown_(a){const b=this.getGesture(a);b&&b.handleWsStart(a,this)}startDrag(a,b){a=mouseToSvg$$module$build$src$core$browser_events(a,this.getParentSvg(),this.getInverseScreenCTM());a.x/=this.scale;a.y/=this.scale;this.dragDeltaXY_=Coordinate$$module$build$src$core$utils$coordinate.difference(b,a)}moveDrag(a){a=mouseToSvg$$module$build$src$core$browser_events(a,this.getParentSvg(),this.getInverseScreenCTM());
|
|
1107
|
+
a.x/=this.scale;a.y/=this.scale;return Coordinate$$module$build$src$core$utils$coordinate.sum(this.dragDeltaXY_,a)}isDragging(){return null!==this.currentGesture_&&this.currentGesture_.isDragging()}isDraggable(){return this.options.moveOptions&&this.options.moveOptions.drag}isMovable(){return this.options.moveOptions&&!!this.options.moveOptions.scrollbars||this.options.moveOptions&&this.options.moveOptions.wheel||this.options.moveOptions&&this.options.moveOptions.drag||this.options.zoomOptions&&this.options.zoomOptions.wheel||
|
|
1108
|
+
this.options.zoomOptions&&this.options.zoomOptions.pinch}isMovableHorizontally(){const a=!!this.scrollbar;return this.isMovable()&&(!a||a&&this.scrollbar.canScrollHorizontally())}isMovableVertically(){const a=!!this.scrollbar;return this.isMovable()&&(!a||a&&this.scrollbar.canScrollVertically())}onMouseWheel_(a){if(Gesture$$module$build$src$core$gesture.inProgress())a.preventDefault(),a.stopPropagation();else{var b=this.options.zoomOptions&&this.options.zoomOptions.wheel,c=this.options.moveOptions&&
|
|
1109
|
+
this.options.moveOptions.wheel;if(b||c){var d=getScrollDeltaPixels$$module$build$src$core$browser_events(a);if(MAC$$module$build$src$core$utils$useragent)var e=a.metaKey;b&&(a.ctrlKey||e||!c)?(d=-d.y/50,b=mouseToSvg$$module$build$src$core$browser_events(a,this.getParentSvg(),this.getInverseScreenCTM()),this.zoom(b.x,b.y,d)):(b=this.scrollX-d.x,c=this.scrollY-d.y,a.shiftKey&&!d.x&&(b=this.scrollX-d.y,c=this.scrollY),this.scroll(b,c));a.preventDefault()}}}getBlocksBoundingBox(){const a=this.getTopBoundedElements();
|
|
1110
|
+
if(!a.length)return new Rect$$module$build$src$core$utils$rect(0,0,0,0);const b=a[0].getBoundingRectangle();for(let d=1;d<a.length;d++){var c=a[d];c.isInsertionMarker&&c.isInsertionMarker()||(c=c.getBoundingRectangle(),c.top<b.top&&(b.top=c.top),c.bottom>b.bottom&&(b.bottom=c.bottom),c.left<b.left&&(b.left=c.left),c.right>b.right&&(b.right=c.right))}return b}cleanUp(){this.setResizesEnabled(!1);setGroup$$module$build$src$core$events$utils(!0);const a=this.getTopBlocks(!0);let b=0;for(let c=0,d;d=
|
|
1111
|
+
a[c];c++){if(!d.isMovable())continue;const e=d.getRelativeToSurfaceXY();d.moveBy(-e.x,b-e.y);d.snapToGrid();b=d.getRelativeToSurfaceXY().y+d.getHeightWidth().height+this.renderer_.getConstants().MIN_BLOCK_HEIGHT}setGroup$$module$build$src$core$events$utils(!1);this.setResizesEnabled(!0)}showContextMenu(a){if(!this.options.readOnly&&!this.isFlyout){var b=ContextMenuRegistry$$module$build$src$core$contextmenu_registry.registry.getContextMenuOptions(ContextMenuRegistry$$module$build$src$core$contextmenu_registry.ScopeType.WORKSPACE,
|
|
1112
|
+
{workspace:this});this.configureContextMenu&&this.configureContextMenu(b,a);show$$module$build$src$core$contextmenu(a,b,this.RTL)}}updateToolbox(a){if(a=convertToolboxDefToJson$$module$build$src$core$utils$toolbox(a)){if(!this.options.languageTree)throw Error("Existing toolbox is null. Can't create new toolbox.");if(hasCategories$$module$build$src$core$utils$toolbox(a)){if(!this.toolbox_)throw Error("Existing toolbox has no categories. Can't change mode.");this.options.languageTree=a;this.toolbox_.render(a)}else{if(!this.flyout_)throw Error("Existing toolbox has categories. Can't change mode.");
|
|
1113
|
+
this.options.languageTree=a;this.flyout_.show(a)}}else if(this.options.languageTree)throw Error("Can't nullify an existing toolbox.");}markFocused(){this.options.parentWorkspace?this.options.parentWorkspace.markFocused():(setMainWorkspace$$module$build$src$core$common(this),this.setBrowserFocus())}setBrowserFocus(){document.activeElement&&document.activeElement instanceof HTMLElement&&document.activeElement.blur();try{this.getParentSvg().focus({preventScroll:!0})}catch(a){try{this.getParentSvg().parentElement.setActive()}catch(b){this.getParentSvg().parentElement.focus({preventScroll:!0})}}}zoom(a,
|
|
1114
|
+
b,c){c=Math.pow(this.options.zoomOptions.scaleSpeed,c);const d=this.scale*c;if(this.scale!==d){d>this.options.zoomOptions.maxScale?c=this.options.zoomOptions.maxScale/this.scale:d<this.options.zoomOptions.minScale&&(c=this.options.zoomOptions.minScale/this.scale);var e=this.getCanvas().getCTM(),f=this.getParentSvg().createSVGPoint();f.x=a;f.y=b;f=f.matrixTransform(e.inverse());a=f.x;b=f.y;e=e.translate(a*(1-c),b*(1-c)).scale(c);this.scrollX=e.e;this.scrollY=e.f;this.setScale(d)}}zoomCenter(a){var b=
|
|
1115
|
+
this.getMetrics();let c;this.flyout_?(c=b.svgWidth?b.svgWidth/2:0,b=b.svgHeight?b.svgHeight/2:0):(c=b.viewWidth/2+b.absoluteLeft,b=b.viewHeight/2+b.absoluteTop);this.zoom(c,b,a)}zoomToFit(){if(this.isMovable()){var a=this.getMetrics(),b=a.viewWidth;a=a.viewHeight;var c=this.getBlocksBoundingBox(),d=2*ZOOM_TO_FIT_MARGIN$$module$build$src$core$workspace_svg,e=c.right-c.left+d;c=c.bottom-c.top+d;if(e){this.flyout_&&(this.horizontalLayout?(a+=this.flyout_.getHeight(),c+=this.flyout_.getHeight()/this.scale):
|
|
1116
|
+
(b+=this.flyout_.getWidth(),e+=this.flyout_.getWidth()/this.scale));b/=e;a/=c;disable$$module$build$src$core$events$utils();try{this.setScale(Math.min(b,a)),this.scrollCenter()}finally{enable$$module$build$src$core$events$utils()}this.maybeFireViewportChangeEvent()}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")}beginCanvasTransition(){addClass$$module$build$src$core$utils$dom(this.svgBlockCanvas_,"blocklyCanvasTransitioning");addClass$$module$build$src$core$utils$dom(this.svgBubbleCanvas_,
|
|
1117
|
+
"blocklyCanvasTransitioning")}endCanvasTransition(){removeClass$$module$build$src$core$utils$dom(this.svgBlockCanvas_,"blocklyCanvasTransitioning");removeClass$$module$build$src$core$utils$dom(this.svgBubbleCanvas_,"blocklyCanvasTransitioning")}scrollCenter(){if(this.isMovable()){var a=this.getMetrics(),b=(a.scrollWidth-a.viewWidth)/2,c=(a.scrollHeight-a.viewHeight)/2;b=-b-a.scrollLeft;c=-c-a.scrollTop;this.scroll(b,c)}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")}centerOnBlock(a){if(this.isMovable()){if(a=
|
|
1118
|
+
a?this.getBlockById(a):null){var b=a.getRelativeToSurfaceXY(),c=a.getHeightWidth(),d=this.scale;a=(b.x+(this.RTL?-1:1)*c.width/2)*d;b=(b.y+c.height/2)*d;c=this.getMetrics();this.scroll(-(a-c.viewWidth/2),-(b-c.viewHeight/2))}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")}setScale(a){this.options.zoomOptions.maxScale&&a>this.options.zoomOptions.maxScale?a=this.options.zoomOptions.maxScale:this.options.zoomOptions.minScale&&a<this.options.zoomOptions.minScale&&
|
|
1119
|
+
(a=this.options.zoomOptions.minScale);this.scale=a;this.hideChaff(!1);(a=this.getFlyout(!1))&&a.isVisible()&&(a.reflow(),this.recordDragTargets());this.grid_&&this.grid_.update(this.scale);a=this.getMetrics();this.scrollX-=a.absoluteLeft;this.scrollY-=a.absoluteTop;a.viewLeft+=a.absoluteLeft;a.viewTop+=a.absoluteTop;this.scroll(this.scrollX,this.scrollY);this.scrollbar&&(this.flyout_?this.scrollbar.resizeView(a):this.scrollbar.resizeContent(a))}getScale(){return this.options.parentWorkspace?this.options.parentWorkspace.getScale():
|
|
1120
|
+
this.scale}scroll(a,b){this.hideChaff(!0);const c=this.getMetrics();a=Math.min(a,-c.scrollLeft);b=Math.min(b,-c.scrollTop);const d=c.scrollTop+Math.max(0,c.scrollHeight-c.viewHeight);a=Math.max(a,-(c.scrollLeft+Math.max(0,c.scrollWidth-c.viewWidth)));b=Math.max(b,-d);this.scrollX=a;this.scrollY=b;this.scrollbar&&this.scrollbar.set(-(a+c.scrollLeft),-(b+c.scrollTop),!1);a+=c.absoluteLeft;b+=c.absoluteTop;this.translate(a,b)}getBlockById(a){return super.getBlockById(a)}getAllBlocks(a){return super.getAllBlocks(a)}getTopBlocks(a){return super.getTopBlocks(a)}addTopBlock(a){this.addTopBoundedElement(a);
|
|
1121
|
+
super.addTopBlock(a)}removeTopBlock(a){this.removeTopBoundedElement(a);super.removeTopBlock(a)}addTopComment(a){this.addTopBoundedElement(a);super.addTopComment(a)}removeTopComment(a){this.removeTopBoundedElement(a);super.removeTopComment(a)}addTopBoundedElement(a){this.topBoundedElements_.push(a)}removeTopBoundedElement(a){removeElem$$module$build$src$core$utils$array(this.topBoundedElements_,a)}getTopBoundedElements(){return[].concat(this.topBoundedElements_)}setResizesEnabled(a){const b=!this.resizesEnabled_&&
|
|
1122
|
+
a;this.resizesEnabled_=a;b&&this.resizeContents()}clear(){this.setResizesEnabled(!1);super.clear();this.topBoundedElements_=[];this.setResizesEnabled(!0)}registerButtonCallback(a,b){if("function"!==typeof b)throw TypeError("Button callbacks must be functions.");this.flyoutButtonCallbacks.set(a,b)}getButtonCallback(a){let b;return null!=(b=this.flyoutButtonCallbacks.get(a))?b:null}removeButtonCallback(a){this.flyoutButtonCallbacks.delete(a)}registerToolboxCategoryCallback(a,b){if("function"!==typeof b)throw TypeError("Toolbox category callbacks must be functions.");
|
|
1123
|
+
this.toolboxCategoryCallbacks.set(a,b)}getToolboxCategoryCallback(a){return this.toolboxCategoryCallbacks.get(a)||null}removeToolboxCategoryCallback(a){this.toolboxCategoryCallbacks.delete(a)}getGesture(a){const b="mousedown"===a.type||"touchstart"===a.type||"pointerdown"===a.type,c=this.currentGesture_;return c?b&&c.hasStarted()?(console.warn("Tried to start the same gesture twice."),c.cancel(),null):c:b?this.currentGesture_=new TouchGesture$$module$build$src$core$touch_gesture(a,this):null}clearGesture(){this.currentGesture_=
|
|
1124
|
+
null}cancelCurrentGesture(){this.currentGesture_&&this.currentGesture_.cancel()}getAudioManager(){return this.audioManager_}getGrid(){return this.grid_}hideChaff(a){hide$$module$build$src$core$tooltip();hide$$module$build$src$core$widgetdiv();hideWithoutAnimation$$module$build$src$core$dropdowndiv();const b=!!a;this.getComponentManager().getComponents(ComponentManager$$module$build$src$core$component_manager.Capability.AUTOHIDEABLE,!0).forEach(c=>c.autoHide(b))}static setTopLevelWorkspaceMetrics_(a){const b=
|
|
1125
|
+
this.getMetrics();"number"===typeof a.x&&(this.scrollX=-(b.scrollLeft+(b.scrollWidth-b.viewWidth)*a.x));"number"===typeof a.y&&(this.scrollY=-(b.scrollTop+(b.scrollHeight-b.viewHeight)*a.y));this.translate(this.scrollX+b.absoluteLeft,this.scrollY+b.absoluteTop)}},module$build$src$core$workspace_svg={};module$build$src$core$workspace_svg.WorkspaceSvg=WorkspaceSvg$$module$build$src$core$workspace_svg;module$build$src$core$workspace_svg.resizeSvgContents=resizeSvgContents$$module$build$src$core$workspace_svg;var module$build$src$core$serialization$workspaces={};module$build$src$core$serialization$workspaces.load=load$$module$build$src$core$serialization$workspaces;module$build$src$core$serialization$workspaces.save=save$$module$build$src$core$serialization$workspaces;var VariableSerializer$$module$build$src$core$serialization$variables=class{constructor(){this.priority=VARIABLES$$module$build$src$core$serialization$priorities}save(a){const b=[];for(const c of a.getAllVariables())a={name:c.name,id:c.getId()},c.type&&(a.type=c.type),b.push(a);return b.length?b:null}load(a,b){for(const c of a)b.createVariable(c.name,c.type,c.id)}clear(a){a.getVariableMap().clear()}};register$$module$build$src$core$serialization$registry("variables",new VariableSerializer$$module$build$src$core$serialization$variables);
|
|
1131
1126
|
var module$build$src$core$serialization$variables={};var ConstantProvider$$module$build$src$core$renderers$zelos$constants=class extends ConstantProvider$$module$build$src$core$renderers$common$constants{constructor(){super();this.GRID_UNIT=4;this.TAB_OFFSET_FROM_TOP=0;this.CURSOR_COLOUR="#ffa200";this.CURSOR_RADIUS=5;this.JAGGED_TEETH_WIDTH=this.JAGGED_TEETH_HEIGHT=0;this.START_HAT_HEIGHT=22;this.START_HAT_WIDTH=96;this.SHAPES={HEXAGONAL:1,ROUND:2,SQUARE:3,PUZZLE:4,NOTCH:5};this.FULL_BLOCK_FIELDS=!0;this.FIELD_TEXT_FONTWEIGHT="bold";this.FIELD_TEXT_FONTFAMILY=
|
|
1132
1127
|
'"Helvetica Neue", "Segoe UI", Helvetica, sans-serif';this.FIELD_COLOUR_FULL_BLOCK=this.FIELD_TEXTINPUT_BOX_SHADOW=this.FIELD_DROPDOWN_SVG_ARROW=this.FIELD_DROPDOWN_COLOURED_DIV=this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW=!0;this.SELECTED_GLOW_COLOUR="#fff200";this.SELECTED_GLOW_SIZE=.5;this.REPLACEMENT_GLOW_COLOUR="#fff200";this.REPLACEMENT_GLOW_SIZE=2;this.selectedGlowFilterId="";this.selectedGlowFilter_=null;this.replacementGlowFilterId="";this.SQUARED=this.ROUNDED=this.HEXAGONAL=this.replacementGlowFilter_=
|
|
1133
1128
|
null;this.SMALL_PADDING=this.GRID_UNIT;this.MEDIUM_PADDING=2*this.GRID_UNIT;this.MEDIUM_LARGE_PADDING=3*this.GRID_UNIT;this.LARGE_PADDING=4*this.GRID_UNIT;this.CORNER_RADIUS=1*this.GRID_UNIT;this.NOTCH_WIDTH=9*this.GRID_UNIT;this.NOTCH_HEIGHT=2*this.GRID_UNIT;this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT=3*this.GRID_UNIT;this.MIN_BLOCK_WIDTH=2*this.GRID_UNIT;this.MIN_BLOCK_HEIGHT=12*this.GRID_UNIT;this.EMPTY_STATEMENT_INPUT_HEIGHT=6*this.GRID_UNIT;this.TOP_ROW_MIN_HEIGHT=this.CORNER_RADIUS;
|
|
@@ -1150,10 +1145,10 @@ a)),e=arc$$module$build$src$core$utils$svg_paths("a","0 0,1",a,point$$module$bui
|
|
|
1150
1145
|
createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},c);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FEFLOOD,{"flood-color":this.SELECTED_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},b);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FECOMPOSITE,{"in":"outColor",in2:"outBlur",operator:"in",result:"outGlow"},b);
|
|
1151
1146
|
this.selectedGlowFilterId=b.id;this.selectedGlowFilter_=b;a=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FILTER,{id:"blocklyReplacementGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FEGAUSSIANBLUR,{"in":"SourceGraphic",stdDeviation:this.REPLACEMENT_GLOW_SIZE},a);b=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FECOMPONENTTRANSFER,
|
|
1152
1147
|
{result:"outBlur"},a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},b);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FEFLOOD,{"flood-color":this.REPLACEMENT_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FECOMPOSITE,{"in":"outColor",in2:"outBlur",operator:"in",
|
|
1153
|
-
result:"outGlow"},a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FECOMPOSITE,{"in":"SourceGraphic",in2:"outGlow",operator:"over"},a);this.replacementGlowFilterId=a.id;this.replacementGlowFilter_=a}getCSS_(a){return[a
|
|
1154
|
-
a
|
|
1155
|
-
" .blocklyEditableText:not(.editing):hover>.blocklyPath {","stroke: #fff;","stroke-width: 2;","}"
|
|
1156
|
-
|
|
1148
|
+
result:"outGlow"},a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FECOMPOSITE,{"in":"SourceGraphic",in2:"outGlow",operator:"over"},a);this.replacementGlowFilterId=a.id;this.replacementGlowFilter_=a}getCSS_(a){return[`${a} .blocklyText,`,`${a} .blocklyFlyoutLabelText {`,`font: ${this.FIELD_TEXT_FONTWEIGHT} ${this.FIELD_TEXT_FONTSIZE}`+`pt ${this.FIELD_TEXT_FONTFAMILY};`,"}",`${a} .blocklyText {`,"fill: #fff;","}",`${a} .blocklyNonEditableText>rect:not(.blocklyDropdownRect),`,
|
|
1149
|
+
`${a} .blocklyEditableText>rect:not(.blocklyDropdownRect) {`,`fill: ${this.FIELD_BORDER_RECT_COLOUR};`,"}",`${a} .blocklyNonEditableText>text,`,`${a} .blocklyEditableText>text,`,`${a} .blocklyNonEditableText>g>text,`,`${a} .blocklyEditableText>g>text {`,"fill: #575E75;","}",`${a} .blocklyFlyoutLabelText {`,"fill: #575E75;","}",`${a} .blocklyText.blocklyBubbleText {`,"fill: #575E75;","}",`${a} .blocklyDraggable:not(.blocklyDisabled)`," .blocklyEditableText:not(.editing):hover>rect,",`${a} .blocklyDraggable:not(.blocklyDisabled)`,
|
|
1150
|
+
" .blocklyEditableText:not(.editing):hover>.blocklyPath {","stroke: #fff;","stroke-width: 2;","}",`${a} .blocklyHtmlInput {`,`font-family: ${this.FIELD_TEXT_FONTFAMILY};`,`font-weight: ${this.FIELD_TEXT_FONTWEIGHT};`,"color: #575E75;","}",`${a} .blocklyDropdownText {`,"fill: #fff !important;","}",`${a}.blocklyWidgetDiv .goog-menuitem,`,`${a}.blocklyDropDownDiv .goog-menuitem {`,`font-family: ${this.FIELD_TEXT_FONTFAMILY};`,"}",`${a}.blocklyDropDownDiv .goog-menuitem-content {`,"color: #fff;","}",
|
|
1151
|
+
`${a} .blocklyHighlightedConnectionPath {`,`stroke: ${this.SELECTED_GLOW_COLOUR};`,"}",`${a} .blocklyDisabled > .blocklyOutlinePath {`,`fill: url(#blocklyDisabledPattern${this.randomIdentifier})`,"}",`${a} .blocklyInsertionMarker>.blocklyPath {`,`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,"stroke: none;","}"]}},module$build$src$core$renderers$zelos$constants={};module$build$src$core$renderers$zelos$constants.ConstantProvider=ConstantProvider$$module$build$src$core$renderers$zelos$constants;var Drawer$$module$build$src$core$renderers$zelos$drawer=class extends Drawer$$module$build$src$core$renderers$common$drawer{constructor(a,b){super(a,b)}draw(){const a=this.block_.pathObject;a.beginDrawing();this.hideHiddenIcons_();this.drawOutline_();this.drawInternals_();a.setPath(this.outlinePath_+"\n"+this.inlinePath_);this.info_.RTL&&a.flipRTL();isDebuggerEnabled$$module$build$src$core$renderers$common$debug()&&this.block_.renderingDebugger.drawDebug(this.block_,this.info_);this.recordSizeOnBlock_();
|
|
1157
1152
|
this.info_.outputConnection&&(a.outputShapeType=this.info_.outputConnection.shape.type);a.endDrawing()}drawOutline_(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape&&!this.info_.hasStatementInput&&!this.info_.bottomRow.hasNextConnection?(this.drawFlatTop_(),this.drawRightDynamicConnection_(),this.drawFlatBottom_(),this.drawLeftDynamicConnection_()):super.drawOutline_()}drawLeft_(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape?this.drawLeftDynamicConnection_():
|
|
1158
1153
|
super.drawLeft_()}drawRightSideRow_(a){if(!(0>=a.height))if(Types$$module$build$src$core$renderers$measurables$types.isSpacer(a)&&(a.precedesStatement||a.followsStatement)){var b=this.constants_.INSIDE_CORNERS.rightHeight;b=a.height-(a.precedesStatement?b:0);this.outlinePath_+=(a.followsStatement?this.constants_.INSIDE_CORNERS.pathBottomRight:"")+(0<b?lineOnAxis$$module$build$src$core$utils$svg_paths("V",a.yPos+b):"")+(a.precedesStatement?this.constants_.INSIDE_CORNERS.pathTopRight:"")}else this.outlinePath_+=
|
|
1159
1154
|
lineOnAxis$$module$build$src$core$utils$svg_paths("V",a.yPos+a.height)}drawRightDynamicConnection_(){this.outlinePath_+=this.info_.outputConnection.shape.pathRightDown(this.info_.outputConnection.height)}drawLeftDynamicConnection_(){this.positionOutputConnection_();this.outlinePath_+=this.info_.outputConnection.shape.pathUp(this.info_.outputConnection.height);this.outlinePath_+="z"}drawFlatTop_(){const a=this.info_.topRow;this.positionPreviousConnection_();this.outlinePath_+=moveBy$$module$build$src$core$utils$svg_paths(a.xPos,
|
|
@@ -1226,7 +1221,7 @@ b){if(Types$$module$build$src$core$renderers$measurables$types.isSpacer(b))retur
|
|
|
1226
1221
|
this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(a=Math.max(a,this.block_.nextConnection.targetBlock().getHeightWidth().width));this.bottomRow.baseline=b-this.bottomRow.descenderHeight;this.widthWithChildren=a+this.startX;this.height=b;this.startY=this.topRow.capline}},module$build$src$core$renderers$thrasos$info={};module$build$src$core$renderers$thrasos$info.RenderInfo=RenderInfo$$module$build$src$core$renderers$thrasos$info;var Renderer$$module$build$src$core$renderers$thrasos$renderer=class extends Renderer$$module$build$src$core$renderers$common$renderer{constructor(a){super(a)}makeRenderInfo_(a){return new RenderInfo$$module$build$src$core$renderers$thrasos$info(this,a)}};register$$module$build$src$core$renderers$common$block_rendering("thrasos",Renderer$$module$build$src$core$renderers$thrasos$renderer);var module$build$src$core$renderers$thrasos$renderer={};
|
|
1227
1222
|
module$build$src$core$renderers$thrasos$renderer.Renderer=Renderer$$module$build$src$core$renderers$thrasos$renderer;var module$build$src$core$renderers$thrasos$thrasos={};module$build$src$core$renderers$thrasos$thrasos.RenderInfo=RenderInfo$$module$build$src$core$renderers$thrasos$info;module$build$src$core$renderers$thrasos$thrasos.Renderer=Renderer$$module$build$src$core$renderers$thrasos$renderer;var ConstantProvider$$module$build$src$core$renderers$minimalist$constants=class extends ConstantProvider$$module$build$src$core$renderers$common$constants{constructor(){super()}},module$build$src$core$renderers$minimalist$constants={};module$build$src$core$renderers$minimalist$constants.ConstantProvider=ConstantProvider$$module$build$src$core$renderers$minimalist$constants;var Drawer$$module$build$src$core$renderers$minimalist$drawer=class extends Drawer$$module$build$src$core$renderers$common$drawer{constructor(a,b){super(a,b)}},module$build$src$core$renderers$minimalist$drawer={};module$build$src$core$renderers$minimalist$drawer.Drawer=Drawer$$module$build$src$core$renderers$minimalist$drawer;var RenderInfo$$module$build$src$core$renderers$minimalist$info=class extends RenderInfo$$module$build$src$core$renderers$common$info{constructor(a,b){super(a,b)}getRenderer(){return this.renderer_}},module$build$src$core$renderers$minimalist$info={};module$build$src$core$renderers$minimalist$info.RenderInfo=RenderInfo$$module$build$src$core$renderers$minimalist$info;var Renderer$$module$build$src$core$renderers$minimalist$renderer=class extends Renderer$$module$build$src$core$renderers$common$renderer{constructor(a){super(a)}makeConstants_(){return new ConstantProvider$$module$build$src$core$renderers$minimalist$constants}makeRenderInfo_(a){return new RenderInfo$$module$build$src$core$renderers$minimalist$info(this,a)}makeDrawer_(a,b){return new Drawer$$module$build$src$core$renderers$minimalist$drawer(a,b)}};
|
|
1228
1223
|
register$$module$build$src$core$renderers$common$block_rendering("minimalist",Renderer$$module$build$src$core$renderers$minimalist$renderer);var module$build$src$core$renderers$minimalist$renderer={};module$build$src$core$renderers$minimalist$renderer.Renderer=Renderer$$module$build$src$core$renderers$minimalist$renderer;var module$build$src$core$renderers$minimalist$minimalist={};module$build$src$core$renderers$minimalist$minimalist.ConstantProvider=ConstantProvider$$module$build$src$core$renderers$minimalist$constants;module$build$src$core$renderers$minimalist$minimalist.Drawer=Drawer$$module$build$src$core$renderers$minimalist$drawer;module$build$src$core$renderers$minimalist$minimalist.RenderInfo=RenderInfo$$module$build$src$core$renderers$minimalist$info;
|
|
1229
|
-
module$build$src$core$renderers$minimalist$minimalist.Renderer=Renderer$$module$build$src$core$renderers$minimalist$renderer;var ConstantProvider$$module$build$src$core$renderers$geras$constants=class extends ConstantProvider$$module$build$src$core$renderers$common$constants{constructor(){super();this.FIELD_TEXT_BASELINE_CENTER=!1;this.DARK_PATH_OFFSET=1;this.MAX_BOTTOM_WIDTH=30;this.STATEMENT_BOTTOM_SPACER=-this.NOTCH_HEIGHT/2}getCSS_(a){return super.getCSS_(a).concat([a
|
|
1224
|
+
module$build$src$core$renderers$minimalist$minimalist.Renderer=Renderer$$module$build$src$core$renderers$minimalist$renderer;var ConstantProvider$$module$build$src$core$renderers$geras$constants=class extends ConstantProvider$$module$build$src$core$renderers$common$constants{constructor(){super();this.FIELD_TEXT_BASELINE_CENTER=!1;this.DARK_PATH_OFFSET=1;this.MAX_BOTTOM_WIDTH=30;this.STATEMENT_BOTTOM_SPACER=-this.NOTCH_HEIGHT/2}getCSS_(a){return super.getCSS_(a).concat([`${a} .blocklyInsertionMarker>.blocklyPathLight,`,`${a} .blocklyInsertionMarker>.blocklyPathDark {`,`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,"stroke: none;",
|
|
1230
1225
|
"}"])}},module$build$src$core$renderers$geras$constants={};module$build$src$core$renderers$geras$constants.ConstantProvider=ConstantProvider$$module$build$src$core$renderers$geras$constants;var Highlighter$$module$build$src$core$renderers$geras$highlighter=class{constructor(a){this.inlineSteps_=this.steps_="";this.info_=a;this.RTL_=this.info_.RTL;a=a.getRenderer();this.constants_=a.getConstants();this.highlightConstants_=a.getHighlightConstants();this.highlightOffset_=this.highlightConstants_.OFFSET;this.outsideCornerPaths_=this.highlightConstants_.OUTSIDE_CORNER;this.insideCornerPaths_=this.highlightConstants_.INSIDE_CORNER;this.puzzleTabPaths_=this.highlightConstants_.PUZZLE_TAB;this.notchPaths_=
|
|
1231
1226
|
this.highlightConstants_.NOTCH;this.startPaths_=this.highlightConstants_.START_HAT;this.jaggedTeethPaths_=this.highlightConstants_.JAGGED_TEETH}getPath(){return this.steps_+"\n"+this.inlineSteps_}drawTopCorner(a){this.steps_+=moveBy$$module$build$src$core$utils$svg_paths(a.xPos,this.info_.startY);for(let b=0,c;c=a.elements[b];b++)Types$$module$build$src$core$renderers$measurables$types.isLeftSquareCorner(c)?this.steps_+=this.highlightConstants_.START_POINT:Types$$module$build$src$core$renderers$measurables$types.isLeftRoundedCorner(c)?
|
|
1232
1227
|
this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):Types$$module$build$src$core$renderers$measurables$types.isPreviousConnection(c)?this.steps_+=this.notchPaths_.pathLeft:Types$$module$build$src$core$renderers$measurables$types.isHat(c)?this.steps_+=this.startPaths_.path(this.RTL_):Types$$module$build$src$core$renderers$measurables$types.isSpacer(c)&&0!==c.width&&(this.steps_+=lineOnAxis$$module$build$src$core$utils$svg_paths("H",c.xPos+c.width-this.highlightOffset_));this.steps_+=lineOnAxis$$module$build$src$core$utils$svg_paths("H",
|
|
@@ -1272,29 +1267,30 @@ this.svgPathDark.setAttribute("fill",this.colourDark);super.applyColour(a);this.
|
|
|
1272
1267
|
a)}makeDrawer_(a,b){return new Drawer$$module$build$src$core$renderers$geras$drawer(a,b)}makePathObject(a,b){return new PathObject$$module$build$src$core$renderers$geras$path_object(a,b,this.getConstants())}makeHighlightConstants_(){return new HighlightConstantProvider$$module$build$src$core$renderers$geras$highlight_constants(this.getConstants())}getHighlightConstants(){return this.highlightConstants_}};register$$module$build$src$core$renderers$common$block_rendering("geras",Renderer$$module$build$src$core$renderers$geras$renderer);
|
|
1273
1268
|
var module$build$src$core$renderers$geras$renderer={};module$build$src$core$renderers$geras$renderer.Renderer=Renderer$$module$build$src$core$renderers$geras$renderer;var module$build$src$core$renderers$geras$geras={};module$build$src$core$renderers$geras$geras.ConstantProvider=ConstantProvider$$module$build$src$core$renderers$geras$constants;module$build$src$core$renderers$geras$geras.Drawer=Drawer$$module$build$src$core$renderers$geras$drawer;module$build$src$core$renderers$geras$geras.HighlightConstantProvider=HighlightConstantProvider$$module$build$src$core$renderers$geras$highlight_constants;module$build$src$core$renderers$geras$geras.Highlighter=Highlighter$$module$build$src$core$renderers$geras$highlighter;
|
|
1274
1269
|
module$build$src$core$renderers$geras$geras.InlineInput=InlineInput$$module$build$src$core$renderers$geras$measurables$inline_input;module$build$src$core$renderers$geras$geras.PathObject=PathObject$$module$build$src$core$renderers$geras$path_object;module$build$src$core$renderers$geras$geras.RenderInfo=RenderInfo$$module$build$src$core$renderers$geras$info;module$build$src$core$renderers$geras$geras.Renderer=Renderer$$module$build$src$core$renderers$geras$renderer;
|
|
1275
|
-
module$build$src$core$renderers$geras$geras.StatementInput=StatementInput$$module$build$src$core$renderers$geras$measurables$statement_input;var WorkspaceDragSurfaceSvg$$module$build$src$core$workspace_drag_surface_svg=class{constructor(a){this.container=a;this.
|
|
1276
|
-
this.container.appendChild(this.
|
|
1277
|
-
"blocklyBlockCanvas")&&hasClass$$module$build$src$core$utils$dom(c,"blocklyBubbleCanvas")))throw Error("Couldn't clear and hide the drag surface. A node was missing.");null!==this.
|
|
1278
|
-
"");this.
|
|
1270
|
+
module$build$src$core$renderers$geras$geras.StatementInput=StatementInput$$module$build$src$core$renderers$geras$measurables$statement_input;var WorkspaceDragSurfaceSvg$$module$build$src$core$workspace_drag_surface_svg=class{constructor(a){this.container=a;this.previousSibling=null;this.createDom()}createDom(){this.SVG||(this.SVG=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.SVG,{xmlns:SVG_NS$$module$build$src$core$utils$dom,"xmlns:html":HTML_NS$$module$build$src$core$utils$dom,"xmlns:xlink":XLINK_NS$$module$build$src$core$utils$dom,version:"1.1","class":"blocklyWsDragSurface blocklyOverflowVisible"}),
|
|
1271
|
+
this.container.appendChild(this.SVG))}translateSurface(a,b){a=Math.round(a);b=Math.round(b);this.SVG.style.display="block";setCssTransform$$module$build$src$core$utils$dom(this.SVG,"translate3d("+a+"px, "+b+"px, 0)")}getSurfaceTranslation(){return getRelativeXY$$module$build$src$core$utils$svg_math(this.SVG)}clearAndHide(a){if(!a)throw Error("Couldn't clear and hide the drag surface: missing new surface.");const b=this.SVG.childNodes[0],c=this.SVG.childNodes[1];if(!(b&&c&&hasClass$$module$build$src$core$utils$dom(b,
|
|
1272
|
+
"blocklyBlockCanvas")&&hasClass$$module$build$src$core$utils$dom(c,"blocklyBubbleCanvas")))throw Error("Couldn't clear and hide the drag surface. A node was missing.");null!==this.previousSibling?insertAfter$$module$build$src$core$utils$dom(b,this.previousSibling):a.insertBefore(b,a.firstChild);insertAfter$$module$build$src$core$utils$dom(c,b);this.SVG.style.display="none";if(this.SVG.childNodes.length)throw Error("Drag surface was not cleared.");setCssTransform$$module$build$src$core$utils$dom(this.SVG,
|
|
1273
|
+
"");this.previousSibling=null}setContentsAndShow(a,b,c,d,e,f){if(this.SVG.childNodes.length)throw Error("Already dragging a block.");this.previousSibling=c;a.setAttribute("transform","translate(0, 0) scale("+f+")");b.setAttribute("transform","translate(0, 0) scale("+f+")");this.SVG.setAttribute("width",String(d));this.SVG.setAttribute("height",String(e));this.SVG.appendChild(a);this.SVG.appendChild(b);this.SVG.style.display="block"}},module$build$src$core$workspace_drag_surface_svg={};
|
|
1279
1274
|
module$build$src$core$workspace_drag_surface_svg.WorkspaceDragSurfaceSvg=WorkspaceDragSurfaceSvg$$module$build$src$core$workspace_drag_surface_svg;var BlockDragSurfaceSvg$$module$build$src$core$block_drag_surface=class{constructor(a){this.container=a;this.scale_=1;this.surfaceXY_=new Coordinate$$module$build$src$core$utils$coordinate(0,0);this.childSurfaceXY_=new Coordinate$$module$build$src$core$utils$coordinate(0,0);this.svg_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.SVG,{xmlns:SVG_NS$$module$build$src$core$utils$dom,"xmlns:html":HTML_NS$$module$build$src$core$utils$dom,"xmlns:xlink":XLINK_NS$$module$build$src$core$utils$dom,
|
|
1280
1275
|
version:"1.1","class":"blocklyBlockDragSurface"},this.container);this.dragGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{},this.svg_)}createDom(){warn$$module$build$src$core$utils$deprecation("BlockDragSurfaceSvg createDom","June 2022","June 2023")}setBlocksAndShow(a){if(this.dragGroup_.childNodes.length)throw Error("Already dragging a block.");this.dragGroup_.appendChild(a);this.svg_.style.display="block";this.surfaceXY_=new Coordinate$$module$build$src$core$utils$coordinate(0,
|
|
1281
1276
|
0)}translateAndScaleGroup(a,b,c){this.scale_=c;a=Math.round(a);b=Math.round(b);this.childSurfaceXY_.x=a;this.childSurfaceXY_.y=b;this.dragGroup_.setAttribute("transform","translate("+a+","+b+") scale("+c+")")}translateSurfaceInternal_(){let a=this.surfaceXY_.x,b=this.surfaceXY_.y;a=Math.round(a);b=Math.round(b);this.svg_.style.display="block";setCssTransform$$module$build$src$core$utils$dom(this.svg_,"translate3d("+a+"px, "+b+"px, 0)")}translateBy(a,b){this.surfaceXY_=new Coordinate$$module$build$src$core$utils$coordinate(this.surfaceXY_.x+
|
|
1282
1277
|
a,this.surfaceXY_.y+b);this.translateSurfaceInternal_()}translateSurface(a,b){this.surfaceXY_=new Coordinate$$module$build$src$core$utils$coordinate(a*this.scale_,b*this.scale_);this.translateSurfaceInternal_()}getSurfaceTranslation(){const a=getRelativeXY$$module$build$src$core$utils$svg_math(this.svg_);return new Coordinate$$module$build$src$core$utils$coordinate(a.x/this.scale_,a.y/this.scale_)}getGroup(){return this.dragGroup_}getSvgRoot(){return this.svg_}getCurrentBlock(){return this.dragGroup_.firstChild}getWsTranslation(){return this.childSurfaceXY_.clone()}clearAndHide(a){const b=
|
|
1283
|
-
this.getCurrentBlock();b&&(a?a.appendChild(b):this.dragGroup_.removeChild(b));this.svg_.style.display="none";if(this.dragGroup_.childNodes.length)throw Error("Drag group was not cleared.");this.surfaceXY_=new Coordinate$$module$build$src$core$utils$coordinate(0,0)}},module$build$src$core$block_drag_surface={};module$build$src$core$block_drag_surface.BlockDragSurfaceSvg=BlockDragSurfaceSvg$$module$build$src$core$block_drag_surface;var bumpIntoBounds$$module$build$src$core$bump_objects=bumpObjectIntoBounds$$module$build$src$core$bump_objects,module$build$src$core$bump_objects={};module$build$src$core$bump_objects.bumpIntoBounds=bumpObjectIntoBounds$$module$build$src$core$bump_objects;module$build$src$core$bump_objects.bumpIntoBoundsHandler=bumpIntoBoundsHandler$$module$build$src$core$bump_objects;module$build$src$core$bump_objects.bumpTopObjectsIntoBounds=bumpTopObjectsIntoBounds$$module$build$src$core$bump_objects;var ScrollbarPair$$module$build$src$core$scrollbar_pair=class{constructor(a,b,c,d,e){this.workspace=a;this.oldHostMetrics_=null;b=void 0===b?!0:b;c=void 0===c?!0:c;const f=b&&c;b&&(this.hScroll=new Scrollbar$$module$build$src$core$scrollbar(a,!0,f,d,e));c&&(this.vScroll=new Scrollbar$$module$build$src$core$scrollbar(a,!1,f,d,e));f&&(this.corner_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{height:Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness,
|
|
1284
|
-
width:Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness,"class":"blocklyScrollbarBackground"}),insertAfter$$module$build$src$core$utils$dom(this.corner_,a.getBubbleCanvas()))}dispose(){removeNode$$module$build$src$core$utils$dom(this.corner_);this.oldHostMetrics_=this.
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
a.viewHeight
|
|
1288
|
-
this.vScroll.getRatio_()),this.workspace.setMetrics(a)}setX(a){this.hScroll&&this.hScroll.set(a,!0)}setY(a){this.vScroll&&this.vScroll.set(a,!0)}setContainerVisible(a){this.hScroll&&this.hScroll.setContainerVisible(a);this.vScroll&&this.vScroll.setContainerVisible(a)}isVisible(){let a=!1;this.hScroll&&(a=this.hScroll.isVisible());this.vScroll&&(a=a||this.vScroll.isVisible());return a}resizeContent(a){this.hScroll&&this.hScroll.resizeContentHorizontal(a);
|
|
1289
|
-
this.hScroll.resizeViewHorizontal(a);this.vScroll&&this.vScroll.resizeViewVertical(a)}},module$build$src$core$scrollbar_pair={};module$build$src$core$scrollbar_pair.ScrollbarPair=ScrollbarPair$$module$build$src$core$scrollbar_pair;var documentEventsBound$$module$build$src$core$inject=!1,module$build$src$core$inject={};module$build$src$core$inject.inject=inject$$module$build$src$core$inject;$.Generator$$module$build$src$core$generator=class{constructor(a){this.FUNCTION_NAME_PLACEHOLDER_="{leCUI8hutHZI4480Dc}";this.STATEMENT_SUFFIX=this.STATEMENT_PREFIX=this.INFINITE_LOOP_TRAP=null;this.INDENT=" ";this.COMMENT_WRAP=60;this.ORDER_OVERRIDES=[];this.isInitialized=null;this.RESERVED_WORDS_="";this.
|
|
1290
|
-
a=getMainWorkspace$$module$build$src$core$common());
|
|
1291
|
-
return b=b.replace(/[ \t]+\n/g,"\n")}prefixLines(a,b){return b+a.replace(/(?!\n$)\n/g,"\n"+b)}allNestedComments(a){const b=[];a=a.getDescendants(!0);for(let c=0;c<a.length;c++){const d=a[c].getCommentText();d&&b.push(d)}b.length&&b.push("");return b.join("\n")}blockToCode(a,b){!1===this.isInitialized&&console.warn("Generator init was not called before blockToCode was called.");if(!a)return"";if(!a.isEnabled())return b?"":this.blockToCode(a.getNextBlock());
|
|
1292
|
-
var c=this[a.type];if("function"!==typeof c)throw Error('Language "'+this.name_+'" does not know how to generate code for block type "'+a.type+'".');c=c.call(a,a);if(Array.isArray(c)){if(!a.outputConnection)throw TypeError("Expecting string from statement block: "+a.type);return[this.scrub_(a,c[0],b),c[1]]}if("string"===typeof c)return this.STATEMENT_PREFIX&&!a.suppressPrefixSuffix&&(c=this.injectId(this.STATEMENT_PREFIX,
|
|
1293
|
-
a)),this.scrub_(a,c,b);if(null===c)return"";throw SyntaxError("Invalid code generated: "+c);}valueToCode(a,b,c){if(isNaN(c))throw TypeError("Expecting valid order from block: "+a.type);var d=a.getInputTargetBlock(b);if(!d)return"";b=this.blockToCode(d);if(""===b)return"";if(!Array.isArray(b))throw TypeError("Expecting tuple from value block: "+d.type);a=b[0];b=b[1];if(isNaN(b))throw TypeError("Expecting valid order from value block: "+
|
|
1294
|
-
if(e<=f&&(e!==f||0!==e&&99!==e))for(d=!0,e=0;e<this.ORDER_OVERRIDES.length;e++)if(this.ORDER_OVERRIDES[e][0]===c&&this.ORDER_OVERRIDES[e][1]===b){d=!1;break}d&&(a="("+a+")");return a}statementToCode(a,b){a=a.getInputTargetBlock(b);b=this.blockToCode(a);if("string"!==typeof b)throw TypeError("Expecting code from statement block: "+(a&&a.type));b&&(b=this.prefixLines(b,this.INDENT));return b}addLoopTrap(a,b){this.INFINITE_LOOP_TRAP&&
|
|
1295
|
-
a);this.STATEMENT_SUFFIX&&!b.suppressPrefixSuffix&&(a=this.prefixLines(this.injectId(this.STATEMENT_SUFFIX,b),this.INDENT)+a);this.STATEMENT_PREFIX&&!b.suppressPrefixSuffix&&(a+=this.prefixLines(this.injectId(this.STATEMENT_PREFIX,b),this.INDENT));return a}injectId(a,b){b=b.id.replace(/\$/g,"$$$$");return a.replace(/%1/g,"'"+b+"'")}addReservedWords(a){this.RESERVED_WORDS_+=a+","}provideFunction_(a,b){if(!this.definitions_[a]){const c=
|
|
1296
|
-
this.functionNames_[a]=c;Array.isArray(b)&&(b=b.join("\n"));b=b.trim().replace(this.FUNCTION_NAME_PLACEHOLDER_REGEXP_,c);let d;for(;d!==b;)d=b,b=b.replace(/^(( {2})*) {2}/gm,"$1\x00");b=b.replace(/\0/g,this.INDENT);this.definitions_[a]=b}return this.functionNames_[a]}init(a){this.definitions_=Object.create(null);this.functionNames_=Object.create(null)}scrub_(a,b,c){return b}finish(a){
|
|
1297
|
-
Object.defineProperties($.Generator$$module$build$src$core$generator.prototype,{variableDB_:{get(){warn$$module$build$src$core$utils$deprecation("variableDB_","May 2021","September 2022","nameDB_");return this.nameDB_},set(a){warn$$module$build$src$core$utils$deprecation("variableDB_","May 2021","September2022","nameDB_");this.nameDB_=a}}});var module$build$src$core$generator={};
|
|
1278
|
+
this.getCurrentBlock();b&&(a?a.appendChild(b):this.dragGroup_.removeChild(b));this.svg_.style.display="none";if(this.dragGroup_.childNodes.length)throw Error("Drag group was not cleared.");this.surfaceXY_=new Coordinate$$module$build$src$core$utils$coordinate(0,0)}},module$build$src$core$block_drag_surface={};module$build$src$core$block_drag_surface.BlockDragSurfaceSvg=BlockDragSurfaceSvg$$module$build$src$core$block_drag_surface;var bumpIntoBounds$$module$build$src$core$bump_objects=bumpObjectIntoBounds$$module$build$src$core$bump_objects,module$build$src$core$bump_objects={};module$build$src$core$bump_objects.bumpIntoBounds=bumpObjectIntoBounds$$module$build$src$core$bump_objects;module$build$src$core$bump_objects.bumpIntoBoundsHandler=bumpIntoBoundsHandler$$module$build$src$core$bump_objects;module$build$src$core$bump_objects.bumpTopObjectsIntoBounds=bumpTopObjectsIntoBounds$$module$build$src$core$bump_objects;var ScrollbarPair$$module$build$src$core$scrollbar_pair=class{constructor(a,b,c,d,e){this.workspace=a;this.oldHostMetrics_=this.corner_=this.vScroll=this.hScroll=null;b=void 0===b?!0:b;c=void 0===c?!0:c;const f=b&&c;b&&(this.hScroll=new Scrollbar$$module$build$src$core$scrollbar(a,!0,f,d,e));c&&(this.vScroll=new Scrollbar$$module$build$src$core$scrollbar(a,!1,f,d,e));f&&(this.corner_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{height:Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness,
|
|
1279
|
+
width:Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness,"class":"blocklyScrollbarBackground"}),insertAfter$$module$build$src$core$utils$dom(this.corner_,a.getBubbleCanvas()))}dispose(){removeNode$$module$build$src$core$utils$dom(this.corner_);this.oldHostMetrics_=this.corner_=null;this.hScroll&&(this.hScroll.dispose(),this.hScroll=null);this.vScroll&&(this.vScroll.dispose(),this.vScroll=null)}resize(){const a=this.workspace.getMetrics();if(a){var b=!1,c=!1;this.oldHostMetrics_&&this.oldHostMetrics_.viewWidth===
|
|
1280
|
+
a.viewWidth&&this.oldHostMetrics_.viewHeight===a.viewHeight&&this.oldHostMetrics_.absoluteTop===a.absoluteTop&&this.oldHostMetrics_.absoluteLeft===a.absoluteLeft?(this.oldHostMetrics_&&this.oldHostMetrics_.scrollWidth===a.scrollWidth&&this.oldHostMetrics_.viewLeft===a.viewLeft&&this.oldHostMetrics_.scrollLeft===a.scrollLeft||(b=!0),this.oldHostMetrics_&&this.oldHostMetrics_.scrollHeight===a.scrollHeight&&this.oldHostMetrics_.viewTop===a.viewTop&&this.oldHostMetrics_.scrollTop===a.scrollTop||(c=!0)):
|
|
1281
|
+
c=b=!0;if(b||c){try{disable$$module$build$src$core$events$utils(),this.hScroll&&b&&this.hScroll.resize(a),this.vScroll&&c&&this.vScroll.resize(a)}finally{enable$$module$build$src$core$events$utils()}this.workspace.maybeFireViewportChangeEvent()}if(this.hScroll&&this.vScroll){if(!this.oldHostMetrics_||this.oldHostMetrics_.viewWidth!==a.viewWidth||this.oldHostMetrics_.absoluteLeft!==a.absoluteLeft){let d;null==(d=this.corner_)||d.setAttribute("x",String(this.vScroll.position.x))}if(!this.oldHostMetrics_||
|
|
1282
|
+
this.oldHostMetrics_.viewHeight!==a.viewHeight||this.oldHostMetrics_.absoluteTop!==a.absoluteTop){let d;null==(d=this.corner_)||d.setAttribute("y",String(this.hScroll.position.y))}}this.oldHostMetrics_=a}}canScrollHorizontally(){return!!this.hScroll}canScrollVertically(){return!!this.vScroll}setOrigin(a,b){this.hScroll&&this.hScroll.setOrigin(a,b);this.vScroll&&this.vScroll.setOrigin(a,b)}set(a,b,c){this.hScroll&&this.hScroll.set(a,!1);this.vScroll&&this.vScroll.set(b,!1);if(c||void 0===c)a={},this.hScroll&&
|
|
1283
|
+
(a.x=this.hScroll.getRatio_()),this.vScroll&&(a.y=this.vScroll.getRatio_()),this.workspace.setMetrics(a)}setX(a){this.hScroll&&this.hScroll.set(a,!0)}setY(a){this.vScroll&&this.vScroll.set(a,!0)}setContainerVisible(a){this.hScroll&&this.hScroll.setContainerVisible(a);this.vScroll&&this.vScroll.setContainerVisible(a)}isVisible(){let a=!1;this.hScroll&&(a=this.hScroll.isVisible());this.vScroll&&(a=a||this.vScroll.isVisible());return a}resizeContent(a){this.hScroll&&this.hScroll.resizeContentHorizontal(a);
|
|
1284
|
+
this.vScroll&&this.vScroll.resizeContentVertical(a)}resizeView(a){this.hScroll&&this.hScroll.resizeViewHorizontal(a);this.vScroll&&this.vScroll.resizeViewVertical(a)}},module$build$src$core$scrollbar_pair={};module$build$src$core$scrollbar_pair.ScrollbarPair=ScrollbarPair$$module$build$src$core$scrollbar_pair;var documentEventsBound$$module$build$src$core$inject=!1,module$build$src$core$inject={};module$build$src$core$inject.inject=inject$$module$build$src$core$inject;$.Generator$$module$build$src$core$generator=class{constructor(a){this.FUNCTION_NAME_PLACEHOLDER_="{leCUI8hutHZI4480Dc}";this.STATEMENT_SUFFIX=this.STATEMENT_PREFIX=this.INFINITE_LOOP_TRAP=null;this.INDENT=" ";this.COMMENT_WRAP=60;this.ORDER_OVERRIDES=[];this.isInitialized=null;this.RESERVED_WORDS_="";this.definitions_=Object.create(null);this.functionNames_=Object.create(null);this.nameDB_=void 0;this.name_=a;this.FUNCTION_NAME_PLACEHOLDER_REGEXP_=new RegExp(this.FUNCTION_NAME_PLACEHOLDER_,"g")}workspaceToCode(a){a||
|
|
1285
|
+
(console.warn("No workspace specified in workspaceToCode call. Guessing."),a=getMainWorkspace$$module$build$src$core$common());var b=[];this.init(a);a=a.getTopBlocks(!0);for(let c=0,d;d=a[c];c++){let e=this.blockToCode(d);Array.isArray(e)&&(e=e[0]);e&&(d.outputConnection&&(e=this.scrubNakedValue(e),this.STATEMENT_PREFIX&&!d.suppressPrefixSuffix&&(e=this.injectId(this.STATEMENT_PREFIX,d)+e),this.STATEMENT_SUFFIX&&!d.suppressPrefixSuffix&&(e+=this.injectId(this.STATEMENT_SUFFIX,d))),b.push(e))}b=b.join("\n");
|
|
1286
|
+
b=this.finish(b);b=b.replace(/^\s+\n/,"");b=b.replace(/\n\s+$/,"\n");return b=b.replace(/[ \t]+\n/g,"\n")}prefixLines(a,b){return b+a.replace(/(?!\n$)\n/g,"\n"+b)}allNestedComments(a){const b=[];a=a.getDescendants(!0);for(let c=0;c<a.length;c++){const d=a[c].getCommentText();d&&b.push(d)}b.length&&b.push("");return b.join("\n")}blockToCode(a,b){!1===this.isInitialized&&console.warn("Generator init was not called before blockToCode was called.");if(!a)return"";if(!a.isEnabled())return b?"":this.blockToCode(a.getNextBlock());
|
|
1287
|
+
if(a.isInsertionMarker())return b?"":this.blockToCode(a.getChildren(!1)[0]);var c=this[a.type];if("function"!==typeof c)throw Error('Language "'+this.name_+'" does not know how to generate code for block type "'+a.type+'".');c=c.call(a,a);if(Array.isArray(c)){if(!a.outputConnection)throw TypeError("Expecting string from statement block: "+a.type);return[this.scrub_(a,c[0],b),c[1]]}if("string"===typeof c)return this.STATEMENT_PREFIX&&!a.suppressPrefixSuffix&&(c=this.injectId(this.STATEMENT_PREFIX,
|
|
1288
|
+
a)+c),this.STATEMENT_SUFFIX&&!a.suppressPrefixSuffix&&(c+=this.injectId(this.STATEMENT_SUFFIX,a)),this.scrub_(a,c,b);if(null===c)return"";throw SyntaxError("Invalid code generated: "+c);}valueToCode(a,b,c){if(isNaN(c))throw TypeError("Expecting valid order from block: "+a.type);var d=a.getInputTargetBlock(b);if(!d)return"";b=this.blockToCode(d);if(""===b)return"";if(!Array.isArray(b))throw TypeError("Expecting tuple from value block: "+d.type);a=b[0];b=b[1];if(isNaN(b))throw TypeError("Expecting valid order from value block: "+
|
|
1289
|
+
d.type);if(!a)return"";d=!1;var e=Math.floor(c);const f=Math.floor(b);if(e<=f&&(e!==f||0!==e&&99!==e))for(d=!0,e=0;e<this.ORDER_OVERRIDES.length;e++)if(this.ORDER_OVERRIDES[e][0]===c&&this.ORDER_OVERRIDES[e][1]===b){d=!1;break}d&&(a="("+a+")");return a}statementToCode(a,b){a=a.getInputTargetBlock(b);b=this.blockToCode(a);if("string"!==typeof b)throw TypeError("Expecting code from statement block: "+(a&&a.type));b&&(b=this.prefixLines(b,this.INDENT));return b}addLoopTrap(a,b){this.INFINITE_LOOP_TRAP&&
|
|
1290
|
+
(a=this.prefixLines(this.injectId(this.INFINITE_LOOP_TRAP,b),this.INDENT)+a);this.STATEMENT_SUFFIX&&!b.suppressPrefixSuffix&&(a=this.prefixLines(this.injectId(this.STATEMENT_SUFFIX,b),this.INDENT)+a);this.STATEMENT_PREFIX&&!b.suppressPrefixSuffix&&(a+=this.prefixLines(this.injectId(this.STATEMENT_PREFIX,b),this.INDENT));return a}injectId(a,b){b=b.id.replace(/\$/g,"$$$$");return a.replace(/%1/g,"'"+b+"'")}addReservedWords(a){this.RESERVED_WORDS_+=a+","}provideFunction_(a,b){if(!this.definitions_[a]){const c=
|
|
1291
|
+
this.nameDB_.getDistinctName(a,$.NameType$$module$build$src$core$names.PROCEDURE);this.functionNames_[a]=c;Array.isArray(b)&&(b=b.join("\n"));b=b.trim().replace(this.FUNCTION_NAME_PLACEHOLDER_REGEXP_,c);let d;for(;d!==b;)d=b,b=b.replace(/^(( {2})*) {2}/gm,"$1\x00");b=b.replace(/\0/g,this.INDENT);this.definitions_[a]=b}return this.functionNames_[a]}init(a){this.definitions_=Object.create(null);this.functionNames_=Object.create(null)}scrub_(a,b,c){return b}finish(a){this.definitions_=Object.create(null);
|
|
1292
|
+
this.functionNames_=Object.create(null);return a}scrubNakedValue(a){return a}};Object.defineProperties($.Generator$$module$build$src$core$generator.prototype,{variableDB_:{get(){warn$$module$build$src$core$utils$deprecation("variableDB_","May 2021","September 2022","nameDB_");return this.nameDB_},set(a){warn$$module$build$src$core$utils$deprecation("variableDB_","May 2021","September2022","nameDB_");this.nameDB_=a}}});var module$build$src$core$generator={};
|
|
1293
|
+
module$build$src$core$generator.Generator=$.Generator$$module$build$src$core$generator;var FlyoutButton$$module$build$src$core$flyout_button=class{constructor(a,b,c,d){this.workspace=a;this.targetWorkspace=b;this.isLabel_=d;this.onMouseUpWrapper_=null;this.height=this.width=0;this.svgText_=this.svgGroup_=null;this.text_=c.text;this.position_=new Coordinate$$module$build$src$core$utils$coordinate(0,0);this.callbackKey_=c.callbackKey||c.callbackkey;this.cssClass_=c["web-class"]||null;this.info=c}createDom(){var a=this.isLabel_?"blocklyFlyoutLabel":"blocklyFlyoutButton";this.cssClass_&&
|
|
1298
1294
|
(a+=" "+this.cssClass_);this.svgGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{"class":a},this.workspace.getCanvas());let b;this.isLabel_||(b=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"blocklyFlyoutButtonShadow",rx:4,ry:4,x:1,y:1},this.svgGroup_));a=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":this.isLabel_?"blocklyFlyoutLabelBackground":
|
|
1299
1295
|
"blocklyFlyoutButtonBackground",rx:4,ry:4},this.svgGroup_);const c=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.TEXT,{"class":this.isLabel_?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.svgGroup_);var d=replaceMessageReferences$$module$build$src$core$utils$parsing(this.text_);this.workspace.RTL&&(d+="\u200f");c.textContent=d;this.isLabel_&&(this.svgText_=c,this.workspace.getThemeManager().subscribe(this.svgText_,"flyoutForegroundColour",
|
|
1300
1296
|
"fill"));const e=getComputedStyle$$module$build$src$core$utils$style(c,"fontSize"),f=getComputedStyle$$module$build$src$core$utils$style(c,"fontWeight"),g=getComputedStyle$$module$build$src$core$utils$style(c,"fontFamily");this.width=getFastTextWidthWithSizeString$$module$build$src$core$utils$dom(c,e,f,g);d=measureFontMetrics$$module$build$src$core$utils$dom(d,e,f,g);this.height=d.height;if(!this.isLabel_){this.width+=2*FlyoutButton$$module$build$src$core$flyout_button.TEXT_MARGIN_X;this.height+=
|
|
@@ -1318,8 +1314,8 @@ this.rectMap_=new WeakMap;this.MARGIN=this.CORNER_RADIUS;this.GAP_X=3*this.MARGI
|
|
|
1318
1314
|
"wheel",this,this.wheel_));this.autoClose||(this.filterWrapper_=this.filterForCapacity_.bind(this),this.targetWorkspace.addChangeListener(this.filterWrapper_));Array.prototype.push.apply(this.eventWrappers_,conditionalBind$$module$build$src$core$browser_events(this.svgBackground_,"mousedown",this,this.onMouseDown_));this.workspace_.getGesture=this.targetWorkspace.getGesture.bind(this.targetWorkspace);this.workspace_.setVariableMap(this.targetWorkspace.getVariableMap());this.workspace_.createPotentialVariableMap();
|
|
1319
1315
|
a.getComponentManager().addComponent({component:this,weight:1,capabilities:[ComponentManager$$module$build$src$core$component_manager.Capability.DELETE_AREA,ComponentManager$$module$build$src$core$component_manager.Capability.DRAG_TARGET]})}dispose(){this.hide();this.workspace_.getComponentManager().removeComponent(this.id);unbind$$module$build$src$core$browser_events(this.eventWrappers_);this.filterWrapper_&&(this.targetWorkspace.removeChangeListener(this.filterWrapper_),this.filterWrapper_=null);
|
|
1320
1316
|
this.workspace_&&(this.workspace_.getThemeManager().unsubscribe(this.svgBackground_),this.workspace_.dispose());this.svgGroup_&&(removeNode$$module$build$src$core$utils$dom(this.svgGroup_),this.svgGroup_=null);this.svgBackground_=null}getWidth(){return this.width_}getHeight(){return this.height_}getFlyoutScale(){return this.targetWorkspace.scale}getWorkspace(){return this.workspace_}isVisible(){return this.isVisible_}setVisible(a){const b=a!==this.isVisible();this.isVisible_=a;b&&(this.autoClose||
|
|
1321
|
-
this.workspace_.recordDragTargets(),this.updateDisplay_())}setContainerVisible(a){const b=a!==this.containerVisible_;this.containerVisible_=a;b&&this.updateDisplay_()}updateDisplay_(){let a;a=this.containerVisible_?this.isVisible():!1;this.svgGroup_&&(this.svgGroup_.style.display=a?"block":"none");this.workspace_.scrollbar.setContainerVisible(a)}positionAt_(a,b,c,d){let e;null==(e=this.svgGroup_)||e.setAttribute("width",a.toString());let f;null==(f=this.svgGroup_)||f.setAttribute("height",
|
|
1322
|
-
this.workspace_.setCachedParentSvgSize(a,b);let g;if("svg"===(null==(g=this.svgGroup_)?void 0:g.tagName))setCssTransform$$module$build$src$core$utils$dom(this.svgGroup_,"translate("+c+"px,"+d+"px)");else{let h;null==(h=this.svgGroup_)||h.setAttribute("transform","translate("+c+","+d+")")}if(a=this.workspace_.scrollbar)a.setOrigin(c,d),a.resize(),a.hScroll&&a.hScroll.setPosition(a.hScroll.position.x,a.hScroll.position.y),a.vScroll&&a.vScroll.setPosition(a.vScroll.position.x,a.vScroll.position.y)}hide(){if(this.isVisible()){this.setVisible(!1);
|
|
1317
|
+
this.workspace_.recordDragTargets(),this.updateDisplay_())}setContainerVisible(a){const b=a!==this.containerVisible_;this.containerVisible_=a;b&&this.updateDisplay_()}updateDisplay_(){let a;a=this.containerVisible_?this.isVisible():!1;this.svgGroup_&&(this.svgGroup_.style.display=a?"block":"none");let b;null==(b=this.workspace_.scrollbar)||b.setContainerVisible(a)}positionAt_(a,b,c,d){let e;null==(e=this.svgGroup_)||e.setAttribute("width",a.toString());let f;null==(f=this.svgGroup_)||f.setAttribute("height",
|
|
1318
|
+
b.toString());this.workspace_.setCachedParentSvgSize(a,b);let g;if("svg"===(null==(g=this.svgGroup_)?void 0:g.tagName))setCssTransform$$module$build$src$core$utils$dom(this.svgGroup_,"translate("+c+"px,"+d+"px)");else{let h;null==(h=this.svgGroup_)||h.setAttribute("transform","translate("+c+","+d+")")}if(a=this.workspace_.scrollbar)a.setOrigin(c,d),a.resize(),a.hScroll&&a.hScroll.setPosition(a.hScroll.position.x,a.hScroll.position.y),a.vScroll&&a.vScroll.setPosition(a.vScroll.position.x,a.vScroll.position.y)}hide(){if(this.isVisible()){this.setVisible(!1);
|
|
1323
1319
|
for(let a=0,b;b=this.listeners_[a];a++)unbind$$module$build$src$core$browser_events(b);this.listeners_.length=0;this.reflowWrapper_&&(this.workspace_.removeChangeListener(this.reflowWrapper_),this.reflowWrapper_=null)}}show(a){this.workspace_.setResizesEnabled(!1);this.hide();this.clearOldBlocks_();"string"===typeof a&&(a=this.getDynamicCategoryContents_(a));this.setVisible(!0);a=convertFlyoutDefToJsonArray$$module$build$src$core$utils$toolbox(a);a=this.createFlyoutInfo_(a);this.layout_(a.contents,
|
|
1324
1320
|
a.gaps);this.listeners_.push(conditionalBind$$module$build$src$core$browser_events(this.svgBackground_,"mouseover",this,function(){const b=this.workspace_.getTopBlocks(!1);for(let c=0,d;d=b[c];c++)d.removeSelect()}));this.horizontalLayout?this.height_=0:this.width_=0;this.workspace_.setResizesEnabled(!0);this.reflow();this.filterForCapacity_();this.position();this.reflowWrapper_=this.reflow.bind(this);this.workspace_.addChangeListener(this.reflowWrapper_);this.emptyRecycledBlocks_()}createFlyoutInfo_(a){const b=
|
|
1325
1321
|
[],c=[];this.permanentlyDisabled_.length=0;const d=this.horizontalLayout?this.GAP_X:this.GAP_Y;for(let f=0,g;g=a[f];f++){if("custom"in g){var e=this.getDynamicCategoryContents_(g.custom);e=convertFlyoutDefToJsonArray$$module$build$src$core$utils$toolbox(e);a.splice.apply(a,[f,1,...e]);g=a[f]}switch(g.kind.toUpperCase()){case "BLOCK":e=g;const h=this.createFlyoutBlock_(e);b.push({type:FlyoutItemType$$module$build$src$core$flyout_base.BLOCK,block:h});this.addBlockGap_(e,c,d);break;case "SEP":this.addSeparatorGap_(g,
|
|
@@ -1328,8 +1324,8 @@ return a(this.workspace_.targetWorkspace)}createButton_(a,b){return new FlyoutBu
|
|
|
1328
1324
|
a.disabled),b=append$$module$build$src$core$serialization$blocks(a,this.workspace_)));b.isEnabled()||this.permanentlyDisabled_.push(b);return b}getRecycledBlock_(a){let b=-1;for(let c=0;c<this.recycledBlocks_.length;c++)if(this.recycledBlocks_[c].type===a){b=c;break}return-1===b?void 0:this.recycledBlocks_.splice(b,1)[0]}addBlockGap_(a,b,c){let d;a.gap?d=parseInt(a.gap.toString(),10):a.blockxml&&(a="string"===typeof a.blockxml?textToDom$$module$build$src$core$xml(a.blockxml):a.blockxml,d=parseInt(a.getAttribute("gap"),
|
|
1329
1325
|
10));b.push(!d||isNaN(d)?c:d)}addSeparatorGap_(a,b,c){a=parseInt(a.gap.toString(),10);!isNaN(a)&&0<b.length?b[b.length-1]=a:b.push(c)}clearOldBlocks_(){var a=this.workspace_.getTopBlocks(!1);for(let c=0,d;d=a[c];c++)this.blockIsRecyclable_(d)?this.recycleBlock_(d):d.dispose(!1,!1);for(a=0;a<this.mats_.length;a++){const c=this.mats_[a];c&&(unbindMouseEvents$$module$build$src$core$tooltip(c),removeNode$$module$build$src$core$utils$dom(c))}this.mats_.length=0;for(let c=0,d;d=this.buttons_[c];c++)d.dispose();
|
|
1330
1326
|
this.buttons_.length=0;let b;null==(b=this.workspace_.getPotentialVariableMap())||b.clear()}emptyRecycledBlocks_(){for(let a=0;a<this.recycledBlocks_.length;a++)this.recycledBlocks_[a].dispose();this.recycledBlocks_=[]}blockIsRecyclable_(a){return!1}recycleBlock_(a){const b=a.getRelativeToSurfaceXY();a.moveBy(-b.x,-b.y);this.recycledBlocks_.push(a)}addBlockListeners_(a,b,c){this.listeners_.push(conditionalBind$$module$build$src$core$browser_events(a,"mousedown",null,this.blockMouseDown_(b)));this.listeners_.push(conditionalBind$$module$build$src$core$browser_events(c,
|
|
1331
|
-
"mousedown",null,this.blockMouseDown_(b)));this.listeners_.push(bind$$module$build$src$core$browser_events(a,"mouseenter",b,b.addSelect));this.listeners_.push(bind$$module$build$src$core$browser_events(a,"mouseleave",b,b.removeSelect));this.listeners_.push(bind$$module$build$src$core$browser_events(c,"mouseenter",b,b.addSelect));this.listeners_.push(bind$$module$build$src$core$browser_events(c,"mouseleave",b,b.removeSelect))}blockMouseDown_(a){
|
|
1332
|
-
|
|
1327
|
+
"mousedown",null,this.blockMouseDown_(b)));this.listeners_.push(bind$$module$build$src$core$browser_events(a,"mouseenter",b,b.addSelect));this.listeners_.push(bind$$module$build$src$core$browser_events(a,"mouseleave",b,b.removeSelect));this.listeners_.push(bind$$module$build$src$core$browser_events(c,"mouseenter",b,b.addSelect));this.listeners_.push(bind$$module$build$src$core$browser_events(c,"mouseleave",b,b.removeSelect))}blockMouseDown_(a){return b=>{const c=this.targetWorkspace.getGesture(b);
|
|
1328
|
+
c&&(c.setStartBlock(a),c.handleFlyoutStart(b,this))}}onMouseDown_(a){const b=this.targetWorkspace.getGesture(a);b&&b.handleFlyoutStart(a,this)}isBlockCreatable(a){return a.isEnabled()}createBlock(a){let b=null;disable$$module$build$src$core$events$utils();var c=this.targetWorkspace.getAllVariables();this.targetWorkspace.setResizesEnabled(!1);try{b=this.placeNewBlock_(a)}finally{enable$$module$build$src$core$events$utils()}this.targetWorkspace.hideChaff();a=getAddedVariables$$module$build$src$core$variables(this.targetWorkspace,
|
|
1333
1329
|
c);if(isEnabled$$module$build$src$core$events$utils()){setGroup$$module$build$src$core$events$utils(!0);for(c=0;c<a.length;c++){const d=a[c];fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(VAR_CREATE$$module$build$src$core$events$utils))(d))}fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CREATE$$module$build$src$core$events$utils))(b))}this.autoClose?this.hide():this.filterForCapacity_();return b}initFlyoutButton_(a,b,c){const d=
|
|
1334
1330
|
a.createDom();a.moveTo(b,c);a.show();this.listeners_.push(conditionalBind$$module$build$src$core$browser_events(d,"mousedown",this,this.onMouseDown_));this.buttons_.push(a)}createRect_(a,b,c,d,e){b=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"fill-opacity":0,x:b,y:c,height:d.height,width:d.width});b.tooltip=a;bindMouseEvents$$module$build$src$core$tooltip(b);this.workspace_.getCanvas().insertBefore(b,a.getSvgRoot());this.rectMap_.set(a,b);return this.mats_[e]=
|
|
1335
1331
|
b}moveRectToBlock_(a,b){const c=b.getHeightWidth();a.setAttribute("width",c.width.toString());a.setAttribute("height",c.height.toString());b=b.getRelativeToSurfaceXY();a.setAttribute("y",b.y.toString());a.setAttribute("x",(this.RTL?b.x-c.width:b.x).toString())}filterForCapacity_(){const a=this.workspace_.getTopBlocks(!1);for(let b=0,c;c=a[b];b++)if(-1===this.permanentlyDisabled_.indexOf(c)){const d=this.targetWorkspace.isCapacityAvailable(getBlockTypeCounts$$module$build$src$core$common(c));for(;c;)c.setEnabled(d),
|
|
@@ -1338,21 +1334,21 @@ b);this.positionNewBlock_(a,b);return b}positionNewBlock_(a,b){const c=this.targ
|
|
|
1338
1334
|
Flyout$$module$build$src$core$flyout_base.FlyoutItemType=FlyoutItemType$$module$build$src$core$flyout_base;var module$build$src$core$flyout_base={};module$build$src$core$flyout_base.Flyout=Flyout$$module$build$src$core$flyout_base;var VerticalFlyout$$module$build$src$core$flyout_vertical=class extends Flyout$$module$build$src$core$flyout_base{constructor(a){super(a)}setMetrics_(a){if(this.isVisible()){var b=this.workspace_.getMetricsManager(),c=b.getScrollMetrics(),d=b.getViewMetrics();b=b.getAbsoluteMetrics();"number"===typeof a.y&&(this.workspace_.scrollY=-(c.top+(c.height-d.height)*a.y));this.workspace_.translate(this.workspace_.scrollX+b.left,this.workspace_.scrollY+b.top)}}getX(){if(!this.isVisible())return 0;var a=this.targetWorkspace.getMetricsManager();
|
|
1339
1335
|
const b=a.getAbsoluteMetrics(),c=a.getViewMetrics();a=a.getToolboxMetrics();return this.targetWorkspace.toolboxPosition===this.toolboxPosition_?this.targetWorkspace.getToolbox()?this.toolboxPosition_===Position$$module$build$src$core$utils$toolbox.LEFT?a.width:c.width-this.width_:this.toolboxPosition_===Position$$module$build$src$core$utils$toolbox.LEFT?0:c.width:this.toolboxPosition_===Position$$module$build$src$core$utils$toolbox.LEFT?0:c.width+b.left-this.width_}getY(){return 0}position(){if(this.isVisible()&&
|
|
1340
1336
|
this.targetWorkspace.isVisible()){var a=this.targetWorkspace.getMetricsManager().getViewMetrics();this.height_=a.height;this.setBackgroundPath_(this.width_-this.CORNER_RADIUS,a.height-2*this.CORNER_RADIUS);a=this.getX();var b=this.getY();this.positionAt_(this.width_,this.height_,a,b)}}setBackgroundPath_(a,b){const c=this.toolboxPosition_===Position$$module$build$src$core$utils$toolbox.RIGHT;var d=a+this.CORNER_RADIUS;d=["M "+(c?d:0)+",0"];d.push("h",c?-a:a);d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,
|
|
1341
|
-
0,0,c?0:1,c?-this.CORNER_RADIUS:this.CORNER_RADIUS,this.CORNER_RADIUS);d.push("v",Math.max(0,b));d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,c?0:1,c?this.CORNER_RADIUS:-this.CORNER_RADIUS,this.CORNER_RADIUS);d.push("h",c?a:-a);d.push("z");this.svgBackground_.setAttribute("d",d.join(" "))}scrollToStart(){this.workspace_.scrollbar.setY(0)}wheel_(a){var b=getScrollDeltaPixels$$module$build$src$core$browser_events(a);if(b.y){const c=this.workspace_.getMetricsManager(),d=c.getScrollMetrics();
|
|
1342
|
-
b=c.getViewMetrics().top-d.top+b.y;this.workspace_.scrollbar.setY(b);hide$$module$build$src$core$widgetdiv();hideWithoutAnimation$$module$build$src$core$dropdowndiv()}a.preventDefault();a.stopPropagation()}layout_(a,b){this.workspace_.scale=this.targetWorkspace.scale;var c=this.MARGIN;const d=this.RTL?c:c+this.tabWidth_;for(let h=0,k;k=a[h];h++)if("block"===k.type){var e=k.block,f=e.getDescendants(!1);for(let m=0,n;n=f[m];m++)n.isInFlyout=!0;e.render();f=e.getSvgRoot();const l=
|
|
1343
|
-
var g=e.outputConnection?d-this.tabWidth_:d;e.moveBy(g,c);g=this.createRect_(e,this.RTL?g-l.width:g,c,l,h);this.addBlockListeners_(f,e,g);c+=l.height+b[h]}else"button"===k.type&&(e=k.button,this.initFlyoutButton_(e,d,c),c+=e.height+b[h])}isDragTowardWorkspace(a){a=Math.atan2(a.y,a.x)/Math.PI*180;const b=this.dragAngleRange_;return a<b&&a>-b||a<-180+b||a>180-b?!0:!1}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;const a=this.svgGroup_.getBoundingClientRect(),
|
|
1344
|
-
return this.toolboxPosition_===Position$$module$build$src$core$utils$toolbox.LEFT?new Rect$$module$build$src$core$utils$rect(-1E9,1E9,-1E9,b+a.width):new Rect$$module$build$src$core$utils$rect(-1E9,1E9,b,1E9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let a=0;var b=this.workspace_.getTopBlocks(!1);for(let d=0,e;e=b[d];d++){var c=e.getHeightWidth().width;e.outputConnection&&(c-=this.tabWidth_);a=Math.max(a,c)}for(let d=0,e;e=this.buttons_[d];d++)a=Math.max(a,e.width);a+=
|
|
1345
|
-
this.tabWidth_;a*=this.workspace_.scale;a+=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness;if(this.width_!==a){for(let d=0,e;e=b[d];d++){if(this.RTL){c=e.getRelativeToSurfaceXY().x;let f=a/this.workspace_.scale-this.MARGIN;e.outputConnection||(f-=this.tabWidth_);e.moveBy(f-c,0)}this.rectMap_.has(e)&&this.moveRectToBlock_(this.rectMap_.get(e),e)}if(this.RTL)for(let d=0,e;e=this.buttons_[d];d++)b=e.getPosition().y,e.moveTo(a/this.workspace_.scale-e.width-this.MARGIN-this.tabWidth_,
|
|
1346
|
-
this.targetWorkspace.toolboxPosition!==this.toolboxPosition_||this.toolboxPosition_!==Position$$module$build$src$core$utils$toolbox.LEFT||this.targetWorkspace.getToolbox()||this.targetWorkspace.translate(this.targetWorkspace.scrollX+a,this.targetWorkspace.scrollY);this.width_=a;this.position();this.targetWorkspace.recordDragTargets()}}};VerticalFlyout$$module$build$src$core$flyout_vertical.registryName="verticalFlyout";
|
|
1337
|
+
0,0,c?0:1,c?-this.CORNER_RADIUS:this.CORNER_RADIUS,this.CORNER_RADIUS);d.push("v",Math.max(0,b));d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,c?0:1,c?this.CORNER_RADIUS:-this.CORNER_RADIUS,this.CORNER_RADIUS);d.push("h",c?a:-a);d.push("z");this.svgBackground_.setAttribute("d",d.join(" "))}scrollToStart(){let a;null==(a=this.workspace_.scrollbar)||a.setY(0)}wheel_(a){var b=getScrollDeltaPixels$$module$build$src$core$browser_events(a);if(b.y){const c=this.workspace_.getMetricsManager(),d=c.getScrollMetrics();
|
|
1338
|
+
b=c.getViewMetrics().top-d.top+b.y;let e;null==(e=this.workspace_.scrollbar)||e.setY(b);hide$$module$build$src$core$widgetdiv();hideWithoutAnimation$$module$build$src$core$dropdowndiv()}a.preventDefault();a.stopPropagation()}layout_(a,b){this.workspace_.scale=this.targetWorkspace.scale;var c=this.MARGIN;const d=this.RTL?c:c+this.tabWidth_;for(let h=0,k;k=a[h];h++)if("block"===k.type){var e=k.block,f=e.getDescendants(!1);for(let m=0,n;n=f[m];m++)n.isInFlyout=!0;e.render();f=e.getSvgRoot();const l=
|
|
1339
|
+
e.getHeightWidth();var g=e.outputConnection?d-this.tabWidth_:d;e.moveBy(g,c);g=this.createRect_(e,this.RTL?g-l.width:g,c,l,h);this.addBlockListeners_(f,e,g);c+=l.height+b[h]}else"button"===k.type&&(e=k.button,this.initFlyoutButton_(e,d,c),c+=e.height+b[h])}isDragTowardWorkspace(a){a=Math.atan2(a.y,a.x)/Math.PI*180;const b=this.dragAngleRange_;return a<b&&a>-b||a<-180+b||a>180-b?!0:!1}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;const a=this.svgGroup_.getBoundingClientRect(),
|
|
1340
|
+
b=a.left;return this.toolboxPosition_===Position$$module$build$src$core$utils$toolbox.LEFT?new Rect$$module$build$src$core$utils$rect(-1E9,1E9,-1E9,b+a.width):new Rect$$module$build$src$core$utils$rect(-1E9,1E9,b,1E9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let a=0;var b=this.workspace_.getTopBlocks(!1);for(let d=0,e;e=b[d];d++){var c=e.getHeightWidth().width;e.outputConnection&&(c-=this.tabWidth_);a=Math.max(a,c)}for(let d=0,e;e=this.buttons_[d];d++)a=Math.max(a,e.width);a+=
|
|
1341
|
+
1.5*this.MARGIN+this.tabWidth_;a*=this.workspace_.scale;a+=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness;if(this.width_!==a){for(let d=0,e;e=b[d];d++){if(this.RTL){c=e.getRelativeToSurfaceXY().x;let f=a/this.workspace_.scale-this.MARGIN;e.outputConnection||(f-=this.tabWidth_);e.moveBy(f-c,0)}this.rectMap_.has(e)&&this.moveRectToBlock_(this.rectMap_.get(e),e)}if(this.RTL)for(let d=0,e;e=this.buttons_[d];d++)b=e.getPosition().y,e.moveTo(a/this.workspace_.scale-e.width-this.MARGIN-this.tabWidth_,
|
|
1342
|
+
b);this.targetWorkspace.toolboxPosition!==this.toolboxPosition_||this.toolboxPosition_!==Position$$module$build$src$core$utils$toolbox.LEFT||this.targetWorkspace.getToolbox()||this.targetWorkspace.translate(this.targetWorkspace.scrollX+a,this.targetWorkspace.scrollY);this.width_=a;this.position();this.targetWorkspace.recordDragTargets()}}};VerticalFlyout$$module$build$src$core$flyout_vertical.registryName="verticalFlyout";
|
|
1347
1343
|
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.FLYOUTS_VERTICAL_TOOLBOX,DEFAULT$$module$build$src$core$registry,VerticalFlyout$$module$build$src$core$flyout_vertical);var module$build$src$core$flyout_vertical={};module$build$src$core$flyout_vertical.VerticalFlyout=VerticalFlyout$$module$build$src$core$flyout_vertical;var HorizontalFlyout$$module$build$src$core$flyout_horizontal=class extends Flyout$$module$build$src$core$flyout_base{constructor(a){super(a);this.horizontalLayout=!0}setMetrics_(a){if(this.isVisible()){var b=this.workspace_.getMetricsManager(),c=b.getScrollMetrics(),d=b.getViewMetrics();b=b.getAbsoluteMetrics();"number"===typeof a.x&&(this.workspace_.scrollX=-(c.left+(c.width-d.width)*a.x));this.workspace_.translate(this.workspace_.scrollX+b.left,this.workspace_.scrollY+b.top)}}getX(){return 0}getY(){if(!this.isVisible())return 0;
|
|
1348
1344
|
var a=this.targetWorkspace.getMetricsManager();const b=a.getAbsoluteMetrics(),c=a.getViewMetrics();a=a.getToolboxMetrics();const d=this.toolboxPosition_===Position$$module$build$src$core$utils$toolbox.TOP;return this.targetWorkspace.toolboxPosition===this.toolboxPosition_?this.targetWorkspace.getToolbox()?d?a.height:c.height-this.height_:d?0:c.height:d?0:c.height+b.top-this.height_}position(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var a=this.targetWorkspace.getMetricsManager().getViewMetrics();
|
|
1349
1345
|
this.width_=a.width;this.setBackgroundPath_(a.width-2*this.CORNER_RADIUS,this.height_-this.CORNER_RADIUS);a=this.getX();var b=this.getY();this.positionAt_(this.width_,this.height_,a,b)}}setBackgroundPath_(a,b){const c=this.toolboxPosition_===Position$$module$build$src$core$utils$toolbox.TOP,d=["M 0,"+(c?0:this.CORNER_RADIUS)];c?(d.push("h",a+2*this.CORNER_RADIUS),d.push("v",b),d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,this.CORNER_RADIUS),d.push("h",-a),d.push("a",
|
|
1350
|
-
this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,-this.CORNER_RADIUS)):(d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,-this.CORNER_RADIUS),d.push("h",a),d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,this.CORNER_RADIUS),d.push("v",b),d.push("h",-a-2*this.CORNER_RADIUS));d.push("z");this.svgBackground_.setAttribute("d",d.join(" "))}scrollToStart(){this.workspace_.scrollbar.setX(this.RTL?Infinity:0)}wheel_(a){var b=
|
|
1351
|
-
if(b=b.x||b.y){const c=this.workspace_.getMetricsManager(),d=c.getScrollMetrics();b=c.getViewMetrics().left-d.left+b;this.workspace_.scrollbar.setX(b);hide$$module$build$src$core$widgetdiv();hideWithoutAnimation$$module$build$src$core$dropdowndiv()}a.preventDefault();a.stopPropagation()}layout_(a,b){this.workspace_.scale=this.targetWorkspace.scale;const c=this.MARGIN;let d=c+this.tabWidth_;this.RTL&&(a=a.reverse());for(let h=
|
|
1352
|
-
for(let m=0,n;n=f[m];m++)n.isInFlyout=!0;e.render();f=e.getSvgRoot();const l=e.getHeightWidth();var g=e.outputConnection?this.tabWidth_:0;g=this.RTL?d+l.width:d-g;e.moveBy(g,c);g=this.createRect_(e,g,c,l,h);d+=l.width+b[h];this.addBlockListeners_(f,e,g)}else"button"===k.type&&(e=k.button,this.initFlyoutButton_(e,d,c),d+=e.width+b[h])}isDragTowardWorkspace(a){a=Math.atan2(a.y,a.x)/Math.PI*180;const b=this.dragAngleRange_;return a<
|
|
1353
|
-
this.autoClose||!this.isVisible())return null;const a=this.svgGroup_.getBoundingClientRect(),b=a.top;return this.toolboxPosition_===Position$$module$build$src$core$utils$toolbox.TOP?new Rect$$module$build$src$core$utils$rect(-1E9,b+a.height,-1E9,1E9):new Rect$$module$build$src$core$utils$rect(b,1E9,-1E9,1E9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let a=0;const b=this.workspace_.getTopBlocks(!1);for(let d=
|
|
1354
|
-
for(let d=0,e;e=c[d];d++)a=Math.max(a,e.height);a+=1.5*this.MARGIN;a*=this.workspace_.scale;a+=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness;if(this.height_!==a){for(let d=0,e;e=b[d];d++)this.rectMap_.has(e)&&this.moveRectToBlock_(this.rectMap_.get(e),e);this.targetWorkspace.toolboxPosition!==this.toolboxPosition_||this.toolboxPosition_!==Position$$module$build$src$core$utils$toolbox.TOP||this.targetWorkspace.getToolbox()||
|
|
1355
|
-
this.targetWorkspace.scrollY+a);this.height_=a;this.position();this.targetWorkspace.recordDragTargets()}}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.FLYOUTS_HORIZONTAL_TOOLBOX,DEFAULT$$module$build$src$core$registry,HorizontalFlyout$$module$build$src$core$flyout_horizontal);var module$build$src$core$flyout_horizontal={};module$build$src$core$flyout_horizontal.HorizontalFlyout=HorizontalFlyout$$module$build$src$core$flyout_horizontal;var FieldVariable$$module$build$src$core$field_variable=class extends FieldDropdown$$module$build$src$core$field_dropdown{constructor(a,b,c,d,e){super(Field$$module$build$src$core$field.SKIP_SETUP);this.defaultType_="";this.variableTypes=[];this.variable_=null;this.SERIALIZABLE=!0;this.menuGenerator_=FieldVariable$$module$build$src$core$field_variable.dropdownCreate;this.defaultVariableName="string"===typeof a?a:"";this.size_=new Size$$module$build$src$core$utils$size(0,0);a!==Field$$module$build$src$core$field.SKIP_SETUP&&
|
|
1346
|
+
this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,-this.CORNER_RADIUS)):(d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,-this.CORNER_RADIUS),d.push("h",a),d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,this.CORNER_RADIUS),d.push("v",b),d.push("h",-a-2*this.CORNER_RADIUS));d.push("z");this.svgBackground_.setAttribute("d",d.join(" "))}scrollToStart(){let a;null==(a=this.workspace_.scrollbar)||a.setX(this.RTL?Infinity:0)}wheel_(a){var b=
|
|
1347
|
+
getScrollDeltaPixels$$module$build$src$core$browser_events(a);if(b=b.x||b.y){const c=this.workspace_.getMetricsManager(),d=c.getScrollMetrics();b=c.getViewMetrics().left-d.left+b;let e;null==(e=this.workspace_.scrollbar)||e.setX(b);hide$$module$build$src$core$widgetdiv();hideWithoutAnimation$$module$build$src$core$dropdowndiv()}a.preventDefault();a.stopPropagation()}layout_(a,b){this.workspace_.scale=this.targetWorkspace.scale;const c=this.MARGIN;let d=c+this.tabWidth_;this.RTL&&(a=a.reverse());for(let h=
|
|
1348
|
+
0,k;k=a[h];h++)if("block"===k.type){var e=k.block,f=e.getDescendants(!1);for(let m=0,n;n=f[m];m++)n.isInFlyout=!0;e.render();f=e.getSvgRoot();const l=e.getHeightWidth();var g=e.outputConnection?this.tabWidth_:0;g=this.RTL?d+l.width:d-g;e.moveBy(g,c);g=this.createRect_(e,g,c,l,h);d+=l.width+b[h];this.addBlockListeners_(f,e,g)}else"button"===k.type&&(e=k.button,this.initFlyoutButton_(e,d,c),d+=e.width+b[h])}isDragTowardWorkspace(a){a=Math.atan2(a.y,a.x)/Math.PI*180;const b=this.dragAngleRange_;return a<
|
|
1349
|
+
90+b&&a>90-b||a>-90-b&&a<-90+b?!0:!1}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;const a=this.svgGroup_.getBoundingClientRect(),b=a.top;return this.toolboxPosition_===Position$$module$build$src$core$utils$toolbox.TOP?new Rect$$module$build$src$core$utils$rect(-1E9,b+a.height,-1E9,1E9):new Rect$$module$build$src$core$utils$rect(b,1E9,-1E9,1E9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let a=0;const b=this.workspace_.getTopBlocks(!1);for(let d=
|
|
1350
|
+
0,e;e=b[d];d++)a=Math.max(a,e.getHeightWidth().height);const c=this.buttons_;for(let d=0,e;e=c[d];d++)a=Math.max(a,e.height);a+=1.5*this.MARGIN;a*=this.workspace_.scale;a+=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness;if(this.height_!==a){for(let d=0,e;e=b[d];d++)this.rectMap_.has(e)&&this.moveRectToBlock_(this.rectMap_.get(e),e);this.targetWorkspace.toolboxPosition!==this.toolboxPosition_||this.toolboxPosition_!==Position$$module$build$src$core$utils$toolbox.TOP||this.targetWorkspace.getToolbox()||
|
|
1351
|
+
this.targetWorkspace.translate(this.targetWorkspace.scrollX,this.targetWorkspace.scrollY+a);this.height_=a;this.position();this.targetWorkspace.recordDragTargets()}}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.FLYOUTS_HORIZONTAL_TOOLBOX,DEFAULT$$module$build$src$core$registry,HorizontalFlyout$$module$build$src$core$flyout_horizontal);var module$build$src$core$flyout_horizontal={};module$build$src$core$flyout_horizontal.HorizontalFlyout=HorizontalFlyout$$module$build$src$core$flyout_horizontal;var FieldVariable$$module$build$src$core$field_variable=class extends FieldDropdown$$module$build$src$core$field_dropdown{constructor(a,b,c,d,e){super(Field$$module$build$src$core$field.SKIP_SETUP);this.defaultType_="";this.variableTypes=[];this.variable_=null;this.SERIALIZABLE=!0;this.menuGenerator_=FieldVariable$$module$build$src$core$field_variable.dropdownCreate;this.defaultVariableName="string"===typeof a?a:"";this.size_=new Size$$module$build$src$core$utils$size(0,0);a!==Field$$module$build$src$core$field.SKIP_SETUP&&
|
|
1356
1352
|
(e?this.configure_(e):this.setTypes_(c,d),b&&this.setValidator(b))}configure_(a){super.configure_(a);this.setTypes_(a.variableTypes,a.defaultType)}initModel(){if(!this.variable_){var a=getOrCreateVariablePackage$$module$build$src$core$variables(this.sourceBlock_.workspace,null,this.defaultVariableName,this.defaultType_);this.doValueUpdate_(a.getId())}}shouldAddBorderRect_(){return super.shouldAddBorderRect_()&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||"variables_get"!==this.sourceBlock_.type)}fromXml(a){var b=
|
|
1357
1353
|
a.getAttribute("id");const c=a.textContent,d=a.getAttribute("variabletype")||a.getAttribute("variableType")||"";b=getOrCreateVariablePackage$$module$build$src$core$variables(this.sourceBlock_.workspace,b,c,d);if(null!==d&&d!==b.type)throw Error("Serialized variable type with id '"+b.getId()+"' had type "+b.type+", and does not match variable field that references it: "+domToText$$module$build$src$core$xml(a)+".");this.setValue(b.getId())}toXml(a){this.initModel();a.id=this.variable_.getId();a.textContent=
|
|
1358
1354
|
this.variable_.name;this.variable_.type&&a.setAttribute("variabletype",this.variable_.type);return a}saveState(a){var b=this.saveLegacyState(FieldVariable$$module$build$src$core$field_variable);if(null!==b)return b;this.initModel();b={id:this.variable_.getId()};a&&(b.name=this.variable_.name,b.type=this.variable_.type);return b}loadState(a){this.loadLegacyState(FieldVariable$$module$build$src$core$field_variable,a)||(a=getOrCreateVariablePackage$$module$build$src$core$variables(this.sourceBlock_.workspace,
|
|
@@ -1466,7 +1462,7 @@ this.pixelsToWorkspaceUnits_(a);const b=Coordinate$$module$build$src$core$utils$
|
|
|
1466
1462
|
this.draggingBlock_.render();this.draggingBlock_.scheduleSnapAndBump()}fireDragEndEvent_(){const a=new (get$$module$build$src$core$events$utils(BLOCK_DRAG$$module$build$src$core$events$utils))(this.draggingBlock_,!1,this.draggingBlock_.getDescendants(!1));fire$$module$build$src$core$events$utils(a)}updateToolboxStyle_(a){const b=this.workspace_.getToolbox();if(b){const c=this.draggingBlock_.isDeletable()?"blocklyToolboxDelete":"blocklyToolboxGrab";a&&"function"===typeof b.removeStyle?b.removeStyle(c):
|
|
1467
1463
|
a||"function"!==typeof b.addStyle||b.addStyle(c)}}fireMoveEvent_(){const a=new (get$$module$build$src$core$events$utils(MOVE$$module$build$src$core$events$utils))(this.draggingBlock_);a.oldCoordinate=this.startXY_;a.recordNew();fire$$module$build$src$core$events$utils(a)}updateCursorDuringBlockDrag_(){this.draggingBlock_.setDeleteStyle(this.wouldDeleteBlock_)}pixelsToWorkspaceUnits_(a){a=new Coordinate$$module$build$src$core$utils$coordinate(a.x/this.workspace_.scale,a.y/this.workspace_.scale);this.workspace_.isMutator&&
|
|
1468
1464
|
a.scale(1/this.workspace_.options.parentWorkspace.scale);return a}dragIcons_(a){for(let b=0;b<this.dragIconData_.length;b++){const c=this.dragIconData_[b];c.icon.setIconLocation(Coordinate$$module$build$src$core$utils$coordinate.sum(c.location,a))}}getInsertionMarkers(){return this.draggedConnectionManager_&&this.draggedConnectionManager_.getInsertionMarkers?this.draggedConnectionManager_.getInsertionMarkers():[]}};
|
|
1469
|
-
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.BLOCK_DRAGGER,DEFAULT$$module$build$src$core$registry,BlockDragger$$module$build$src$core$block_dragger);var module$build$src$core$block_dragger={};module$build$src$core$block_dragger.BlockDragger=BlockDragger$$module$build$src$core$block_dragger;var VERSION$$module$build$src$core$blockly="9.0.0-beta.
|
|
1465
|
+
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.BLOCK_DRAGGER,DEFAULT$$module$build$src$core$registry,BlockDragger$$module$build$src$core$block_dragger);var module$build$src$core$block_dragger={};module$build$src$core$block_dragger.BlockDragger=BlockDragger$$module$build$src$core$block_dragger;var VERSION$$module$build$src$core$blockly="9.0.0-beta.1",ALIGN_LEFT$$module$build$src$core$blockly=$.Align$$module$build$src$core$input.LEFT,ALIGN_CENTRE$$module$build$src$core$blockly=$.Align$$module$build$src$core$input.CENTRE,ALIGN_RIGHT$$module$build$src$core$blockly=$.Align$$module$build$src$core$input.RIGHT,INPUT_VALUE$$module$build$src$core$blockly=ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE,OUTPUT_VALUE$$module$build$src$core$blockly=ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE,
|
|
1470
1466
|
NEXT_STATEMENT$$module$build$src$core$blockly=ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT,PREVIOUS_STATEMENT$$module$build$src$core$blockly=ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT,DUMMY_INPUT$$module$build$src$core$blockly=inputTypes$$module$build$src$core$input_types.DUMMY,TOOLBOX_AT_TOP$$module$build$src$core$blockly=Position$$module$build$src$core$utils$toolbox.TOP,TOOLBOX_AT_BOTTOM$$module$build$src$core$blockly=Position$$module$build$src$core$utils$toolbox.BOTTOM,
|
|
1471
1467
|
TOOLBOX_AT_LEFT$$module$build$src$core$blockly=Position$$module$build$src$core$utils$toolbox.LEFT,TOOLBOX_AT_RIGHT$$module$build$src$core$blockly=Position$$module$build$src$core$utils$toolbox.RIGHT,svgResize$$module$build$src$core$blockly=svgResize$$module$build$src$core$common,getMainWorkspace$$module$build$src$core$blockly=getMainWorkspace$$module$build$src$core$common,getSelected$$module$build$src$core$blockly=getSelected$$module$build$src$core$common,defineBlocksWithJsonArray$$module$build$src$core$blockly=
|
|
1472
1468
|
defineBlocksWithJsonArray$$module$build$src$core$common,setParentContainer$$module$build$src$core$blockly=setParentContainer$$module$build$src$core$common,svgSize$$module$build$src$core$blockly=svgSize$$module$build$src$core$utils$svg_math,resizeSvgContents$$module$build$src$core$blockly=resizeSvgContentsLocal$$module$build$src$core$blockly,COLLAPSE_CHARS$$module$build$src$core$blockly=COLLAPSE_CHARS$$module$build$src$core$internal_constants,DRAG_STACK$$module$build$src$core$blockly=DRAG_STACK$$module$build$src$core$internal_constants,
|
|
@@ -2052,9 +2048,9 @@ a.setAttribute("name",this.getProcedureCall());for(let b=0;b<this.arguments_.len
|
|
|
2052
2048
|
c)},saveExtraState:function(){const a=Object.create(null);a.name=this.getProcedureCall();this.arguments_.length&&(a.params=this.arguments_);return a},loadExtraState:function(a){this.renameProcedure(this.getProcedureCall(),a.name);if(a=a.params){const b=[];b.length=a.length;b.fill(null);this.setProcedureParameters_(a,b)}},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},onchange:function(a){if(this.workspace&&!this.workspace.isFlyout&&a.recordUndo)if(a.type===
|
|
2053
2049
|
$.module$build$src$core$events$events.BLOCK_CREATE&&-1!==a.ids.indexOf(this.id)){var b=this.getProcedureCall();b=$.module$build$src$core$procedures.getDefinition(b,this.workspace);!b||b.type===this.defType_&&JSON.stringify(b.getVars())===JSON.stringify(this.arguments_)||(b=null);if(!b){$.module$build$src$core$events$events.setGroup(a.group);a=$.module$build$src$core$utils$xml.createElement("xml");b=$.module$build$src$core$utils$xml.createElement("block");b.setAttribute("type",this.defType_);var c=
|
|
2054
2050
|
this.getRelativeToSurfaceXY(),d=c.y+2*$.config$$module$build$src$core$config.snapRadius;b.setAttribute("x",c.x+$.config$$module$build$src$core$config.snapRadius*(this.RTL?-1:1));b.setAttribute("y",d);c=this.mutationToDom();b.appendChild(c);c=$.module$build$src$core$utils$xml.createElement("field");c.setAttribute("name","NAME");d=this.getProcedureCall();const e=$.module$build$src$core$procedures.findLegalName(d,this);d!==e&&this.renameProcedure(d,e);c.appendChild($.module$build$src$core$utils$xml.createTextNode(d));
|
|
2055
|
-
b.appendChild(c);a.appendChild(b);$.module$build$src$core$xml.domToWorkspace(a,this.workspace);$.module$build$src$core$events$events.setGroup(!1)}}else a.type===$.module$build$src$core$events$events.BLOCK_DELETE?(b=this.getProcedureCall(),$.module$build$src$core$procedures.getDefinition(b,this.workspace)||($.module$build$src$core$events$events.setGroup(a.group),this.dispose(!0),$.module$build$src$core$events$events.setGroup(!1))):a.type===$.module$build$src$core$events$events.CHANGE&&
|
|
2056
|
-
a.element&&(b=this.getProcedureCall(),(b=$.module$build$src$core$procedures.getDefinition(b,this.workspace))&&b.id===a.blockId&&((b=$.module$build$src$core$events$events.getGroup())&&console.log("Saw an existing group while responding to a definition change"),$.module$build$src$core$events$events.setGroup(a.group),a.newValue?(this.previousEnabledState_=this.isEnabled(),this.setEnabled(!1)):this.setEnabled(this.previousEnabledState_),$.module$build$src$core$events$events.setGroup(b)))},
|
|
2057
|
-
{enabled:!0};b.text=module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_HIGHLIGHT_DEF;var c=this.getProcedureCall(),d=this.workspace;b.callback=function(){const e=$.module$build$src$core$procedures.getDefinition(c,d);e&&(d.centerOnBlock(e.id),e.select())};a.push(b)}}};
|
|
2051
|
+
b.appendChild(c);a.appendChild(b);$.module$build$src$core$xml.domToWorkspace(a,this.workspace);$.module$build$src$core$events$events.setGroup(!1)}}else a.type===$.module$build$src$core$events$events.BLOCK_DELETE&&a.blockId!=this.id?(b=this.getProcedureCall(),$.module$build$src$core$procedures.getDefinition(b,this.workspace)||($.module$build$src$core$events$events.setGroup(a.group),this.dispose(!0),$.module$build$src$core$events$events.setGroup(!1))):a.type===$.module$build$src$core$events$events.CHANGE&&
|
|
2052
|
+
"disabled"===a.element&&(b=this.getProcedureCall(),(b=$.module$build$src$core$procedures.getDefinition(b,this.workspace))&&b.id===a.blockId&&((b=$.module$build$src$core$events$events.getGroup())&&console.log("Saw an existing group while responding to a definition change"),$.module$build$src$core$events$events.setGroup(a.group),a.newValue?(this.previousEnabledState_=this.isEnabled(),this.setEnabled(!1)):this.setEnabled(this.previousEnabledState_),$.module$build$src$core$events$events.setGroup(b)))},
|
|
2053
|
+
customContextMenu:function(a){if(this.workspace.isMovable()){var b={enabled:!0};b.text=module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_HIGHLIGHT_DEF;var c=this.getProcedureCall(),d=this.workspace;b.callback=function(){const e=$.module$build$src$core$procedures.getDefinition(c,d);e&&(d.centerOnBlock(e.id),e.select())};a.push(b)}}};
|
|
2058
2054
|
module$exports$Blockly$libraryBlocks$procedures.blocks.procedures_callnoreturn=Object.assign({},module$contents$Blockly$libraryBlocks$procedures_PROCEDURE_CALL_COMMON,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setStyle("procedure_blocks");this.setHelpUrl(module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_CALLNORETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.quarkConnections_={};
|
|
2059
2055
|
this.quarkIds_=null;this.previousEnabledState_=!0},defType_:"procedures_defnoreturn"});
|
|
2060
2056
|
module$exports$Blockly$libraryBlocks$procedures.blocks.procedures_callreturn=Object.assign({},module$contents$Blockly$libraryBlocks$procedures_PROCEDURE_CALL_COMMON,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME");this.setOutput(!0);this.setStyle("procedure_blocks");this.setHelpUrl(module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_CALLRETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.quarkConnections_={};this.quarkIds_=null;this.previousEnabledState_=
|