blockly 9.0.0-beta.1 → 9.0.0-beta.3
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 +569 -542
- package/blockly_compressed.js +563 -536
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +6 -6
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +11 -0
- package/core/block_svg.d.ts +3 -3
- package/core/blockly.d.ts +2 -2
- package/core/events/events.d.ts +50 -24
- package/core/events/events_abstract.d.ts +8 -4
- package/core/events/events_block_base.d.ts +8 -6
- package/core/events/events_block_change.d.ts +14 -8
- package/core/events/events_block_create.d.ts +12 -6
- package/core/events/events_block_delete.d.ts +14 -7
- package/core/events/events_block_drag.d.ts +9 -3
- package/core/events/events_block_move.d.ts +15 -9
- package/core/events/events_bubble_open.d.ts +16 -5
- package/core/events/events_click.d.ts +15 -5
- package/core/events/events_comment_base.d.ts +7 -5
- package/core/events/events_comment_change.d.ts +9 -5
- package/core/events/events_comment_create.d.ts +7 -4
- package/core/events/events_comment_delete.d.ts +1 -13
- package/core/events/events_comment_move.d.ts +10 -6
- package/core/events/events_marker_move.d.ts +11 -4
- package/core/events/events_selected.d.ts +9 -4
- package/core/events/events_theme_change.d.ts +6 -2
- package/core/events/events_toolbox_item_select.d.ts +9 -4
- package/core/events/events_trashcan_open.d.ts +6 -2
- package/core/events/events_var_base.d.ts +8 -6
- package/core/events/events_var_create.d.ts +9 -5
- package/core/events/events_var_delete.d.ts +9 -5
- package/core/events/events_var_rename.d.ts +9 -5
- package/core/events/events_viewport.d.ts +9 -2
- package/core/events/workspace_events.d.ts +6 -5
- package/core/field.d.ts +0 -2
- package/core/gesture.d.ts +8 -9
- package/core/grid.d.ts +1 -1
- package/core/icon.d.ts +6 -2
- package/core/interfaces/i_component.d.ts +1 -1
- package/core/menu.d.ts +2 -1
- package/core/msg.d.ts +14 -0
- package/core/mutator.d.ts +1 -1
- package/core/rendered_connection.d.ts +1 -0
- package/core/renderers/common/constants.d.ts +8 -1
- package/core/renderers/common/drawer.d.ts +4 -3
- package/core/renderers/common/i_path_object.d.ts +22 -16
- package/core/renderers/common/info.d.ts +3 -3
- package/core/renderers/common/marker_svg.d.ts +7 -5
- package/core/renderers/common/path_object.d.ts +3 -3
- package/core/renderers/geras/constants.d.ts +4 -2
- package/core/renderers/geras/drawer.d.ts +2 -1
- package/core/renderers/geras/path_object.d.ts +0 -1
- package/core/renderers/measurables/icon.d.ts +1 -0
- package/core/renderers/measurables/row.d.ts +3 -3
- package/core/renderers/measurables/top_row.d.ts +0 -1
- package/core/renderers/minimalist/info.d.ts +1 -0
- package/core/renderers/thrasos/info.d.ts +1 -3
- package/core/renderers/zelos/constants.d.ts +20 -41
- package/core/renderers/zelos/measurables/inputs.d.ts +0 -1
- package/core/renderers/zelos/path_object.d.ts +1 -1
- package/core/theme.d.ts +27 -27
- package/core/toolbox/category.d.ts +18 -17
- package/core/toolbox/toolbox.d.ts +1 -1
- package/core/touch_gesture.d.ts +3 -2
- package/core/utils/coordinate.d.ts +1 -1
- package/core/utils/dom.d.ts +11 -8
- package/core/utils/idgenerator.d.ts +1 -1
- package/core/zoom_controls.d.ts +1 -1
- package/core-browser.js +0 -6
- package/core.js +0 -6
- package/dart.d.ts +1 -2
- package/javascript.d.ts +1 -2
- package/lua.d.ts +1 -2
- package/msg/ab.d.ts +8 -0
- package/msg/ace.d.ts +8 -0
- package/msg/af.d.ts +8 -0
- package/msg/am.d.ts +8 -0
- package/msg/ar.d.ts +8 -0
- package/msg/ast.d.ts +8 -0
- package/msg/az.d.ts +8 -0
- package/msg/ba.d.ts +8 -0
- package/msg/bcc.d.ts +8 -0
- package/msg/be-tarask.d.ts +8 -0
- package/msg/be.d.ts +8 -0
- package/msg/bg.d.ts +8 -0
- package/msg/bn.d.ts +8 -0
- package/msg/br.d.ts +8 -0
- package/msg/bs.d.ts +8 -0
- package/msg/ca.d.ts +8 -0
- package/msg/cdo.d.ts +8 -0
- package/msg/constants.d.ts +16 -0
- package/msg/cs.d.ts +8 -0
- package/msg/da.d.ts +8 -0
- package/msg/de.d.ts +8 -0
- package/msg/diq.d.ts +8 -0
- package/msg/dty.d.ts +8 -0
- package/msg/ee.d.ts +8 -0
- package/msg/el.d.ts +8 -0
- package/msg/en-gb.d.ts +8 -0
- package/msg/en.d.ts +8 -0
- package/msg/eo.d.ts +8 -0
- package/msg/es.d.ts +8 -0
- package/msg/et.d.ts +8 -0
- package/msg/eu.d.ts +8 -0
- package/msg/fa.d.ts +8 -0
- package/msg/fi.d.ts +8 -0
- package/msg/fo.d.ts +8 -0
- package/msg/fr.d.ts +8 -0
- package/msg/frr.d.ts +8 -0
- package/msg/gl.d.ts +8 -0
- package/msg/gn.d.ts +8 -0
- package/msg/gor.d.ts +8 -0
- package/msg/ha.d.ts +8 -0
- package/msg/hak.d.ts +8 -0
- package/msg/he.d.ts +8 -0
- package/msg/hi.d.ts +8 -0
- package/msg/hr.d.ts +8 -0
- package/msg/hrx.d.ts +8 -0
- package/msg/hu.d.ts +8 -0
- package/msg/hy.d.ts +8 -0
- package/msg/ia.d.ts +8 -0
- package/msg/id.d.ts +8 -0
- package/msg/ig.d.ts +8 -0
- package/msg/inh.d.ts +8 -0
- package/msg/is.d.ts +8 -0
- package/msg/it.d.ts +8 -0
- package/msg/ja.d.ts +8 -0
- package/msg/ka.d.ts +8 -0
- package/msg/kab.d.ts +8 -0
- package/msg/kbd-cyrl.d.ts +8 -0
- package/msg/km.d.ts +8 -0
- package/msg/kn.d.ts +8 -0
- package/msg/ko.d.ts +8 -0
- package/msg/ksh.d.ts +8 -0
- package/msg/ku-latn.d.ts +8 -0
- package/msg/ky.d.ts +8 -0
- package/msg/la.d.ts +8 -0
- package/msg/lb.d.ts +8 -0
- package/msg/lki.d.ts +8 -0
- package/msg/lo.d.ts +8 -0
- package/msg/lrc.d.ts +8 -0
- package/msg/lt.d.ts +8 -0
- package/msg/lv.d.ts +8 -0
- package/msg/mg.d.ts +8 -0
- package/msg/mk.d.ts +8 -0
- package/msg/ml.d.ts +8 -0
- package/msg/mnw.d.ts +8 -0
- package/msg/ms.d.ts +8 -0
- package/msg/msg.d.ts +429 -432
- package/msg/my.d.ts +8 -0
- package/msg/mzn.d.ts +8 -0
- package/msg/nb.d.ts +8 -0
- package/msg/ne.d.ts +8 -0
- package/msg/nl.d.ts +8 -0
- package/msg/oc.d.ts +8 -0
- package/msg/olo.d.ts +8 -0
- package/msg/pa.d.ts +8 -0
- package/msg/pl.d.ts +8 -0
- package/msg/pms.d.ts +8 -0
- package/msg/ps.d.ts +8 -0
- package/msg/pt-br.d.ts +8 -0
- package/msg/pt.d.ts +8 -0
- package/msg/qqq.d.ts +16 -0
- package/msg/ro.d.ts +8 -0
- package/msg/ru.d.ts +8 -0
- package/msg/sc.d.ts +8 -0
- package/msg/sco.d.ts +8 -0
- package/msg/sd.d.ts +8 -0
- package/msg/shn.d.ts +8 -0
- package/msg/si.d.ts +8 -0
- package/msg/sk.d.ts +8 -0
- package/msg/skr-arab.d.ts +8 -0
- package/msg/sl.d.ts +8 -0
- package/msg/smn.d.ts +8 -0
- package/msg/sq.d.ts +8 -0
- package/msg/sr-latn.d.ts +8 -0
- package/msg/sr.d.ts +8 -0
- package/msg/sv.d.ts +8 -0
- package/msg/sw.d.ts +8 -0
- package/msg/synonyms.d.ts +16 -0
- package/msg/ta.d.ts +8 -0
- package/msg/tcy.d.ts +8 -0
- package/msg/te.d.ts +8 -0
- package/msg/th.d.ts +8 -0
- package/msg/ti.d.ts +8 -0
- package/msg/tl.d.ts +8 -0
- package/msg/tlh.d.ts +8 -0
- package/msg/tr.d.ts +8 -0
- package/msg/ug-arab.d.ts +8 -0
- package/msg/uk.d.ts +8 -0
- package/msg/ur.d.ts +8 -0
- package/msg/uz.d.ts +8 -0
- package/msg/vi.d.ts +8 -0
- package/msg/xmf.d.ts +8 -0
- package/msg/yo.d.ts +8 -0
- package/msg/yue.d.ts +8 -0
- package/msg/zgh.d.ts +8 -0
- package/msg/zh-hans.d.ts +8 -0
- package/msg/zh-hant.d.ts +8 -0
- package/package.json +3 -3
- package/php.d.ts +1 -2
- package/python.d.ts +1 -2
package/blockly.min.js
CHANGED
|
@@ -30,9 +30,9 @@ f.index===g-1)e=h,k.newParentId=e.newParentId,k.newInputName=e.newInputName,k.ne
|
|
|
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
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
|
|
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&&
|
|
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)||
|
|
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.blockId)throw Error("Encountered a blockEvent without a proper blockId");if(a=b.getBlockById(a.blockId)){const c=recordUndo$$module$build$src$core$events$utils;try{recordUndo$$module$build$src$core$events$utils=
|
|
34
|
+
!1;const d=a.getParent();if(d&&d.isEnabled()){const e=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&&
|
|
35
|
+
(a.button=2,a.clientX=a.changedTouches[0].clientX,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
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
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
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()}};
|
|
@@ -42,180 +42,180 @@ TOUCH_MAP$$module$build$src$core$touch[b][l];a.addEventListener(m,g,!1);k.push([
|
|
|
42
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
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
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
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
c
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
b
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
b,c,d);
|
|
67
|
-
c
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
function(a){
|
|
71
|
-
a
|
|
72
|
-
|
|
73
|
-
function(a){
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
d.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
b
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
function(a,b){for(let
|
|
99
|
-
a[c].
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
f);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
f);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
a.inputList[e];
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
function(a,b){b.
|
|
122
|
-
a
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
div$$module$build$src$core$dropdowndiv.
|
|
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=
|
|
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){b=b.split(" ");if(b.every(c=>a.classList.contains(c)))return!1;a.classList.add(...b);return!0},removeClasses$$module$build$src$core$utils$dom=
|
|
46
|
+
function(a,b){a.classList.remove(...b.split(" "))},removeClass$$module$build$src$core$utils$dom=function(a,b){b=b.split(" ");if(b.every(c=>!a.classList.contains(c)))return!1;a.classList.remove(...b);return!0},hasClass$$module$build$src$core$utils$dom=function(a,b){return a.classList.contains(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;
|
|
47
|
+
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)},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||
|
|
48
|
+
(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||(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;
|
|
49
|
+
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=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&&
|
|
50
|
+
(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),canvasContext$$module$build$src$core$utils$dom=f.getContext("2d"));canvasContext$$module$build$src$core$utils$dom.font=c+" "+b+" "+d;f=e?canvasContext$$module$build$src$core$utils$dom.measureText(e).width:0;cacheWidths$$module$build$src$core$utils$dom&&(cacheWidths$$module$build$src$core$utils$dom[a]=
|
|
51
|
+
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="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=
|
|
52
|
+
"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},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=
|
|
53
|
+
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,"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=
|
|
54
|
+
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,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=
|
|
55
|
+
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<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=
|
|
56
|
+
function(a){let b=[];const c=document.createElement("button");c.setAttribute("text","%{BKY_NEW_VARIABLE}");c.setAttribute("callbackKey","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=
|
|
57
|
+
a[a.length-1];if(Blocks$$module$build$src$core$blocks.variables_set){var d=createElement$$module$build$src$core$utils$xml("block");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",
|
|
58
|
+
Blocks$$module$build$src$core$blocks.variables_get?"20":"8"),d.appendChild(generateVariableFieldDom$$module$build$src$core$variables(c)),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"),
|
|
59
|
+
c.setAttribute("type","variables_get"),c.setAttribute("gap","8"),c.appendChild(generateVariableFieldDom$$module$build$src$core$variables(f)),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),
|
|
60
|
+
a.getAllVariableNames())},generateUniqueNameFromOptions$$module$build$src$core$variables=function(a,b){if(!b.length)return a;const c=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,
|
|
61
|
+
f,function(g){if(g){const h=nameUsedWithAnyType$$module$build$src$core$variables(g,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=
|
|
62
|
+
Msg$$module$build$src$core$msg.RENAME_VARIABLE_TITLE.replace("%1",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=
|
|
63
|
+
function(a,b,c){prompt$$module$build$src$core$dialog(a,b,function(d){d&&(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,
|
|
64
|
+
b){b=b.getVariableMap().getAllVariables();a=a.toLowerCase();for(let c=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=
|
|
65
|
+
function(a,b,c,d){let e=getVariable$$module$build$src$core$variables(a,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=
|
|
66
|
+
function(a,b,c,d){const e=a.getPotentialVariableMap();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 "+
|
|
67
|
+
c+".";d&&(a+="\nUse "+d+" instead.");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,
|
|
68
|
+
b){injected$$module$build$src$core$css||(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)},
|
|
69
|
+
getSizeInternal$$module$build$src$core$utils$style=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=
|
|
70
|
+
function(a){return new Size$$module$build$src$core$utils$size(a.offsetWidth,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=
|
|
71
|
+
function(a){const b=new Coordinate$$module$build$src$core$utils$coordinate(0,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,
|
|
72
|
+
a.scrollTop||b.scrollTop)},getBorderBox$$module$build$src$core$utils$style=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)},
|
|
73
|
+
scrollIntoContainerView$$module$build$src$core$utils$style=function(a,b,c){a=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);
|
|
74
|
+
a=b.clientWidth-e.width;e=b.clientHeight-e.height;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));d&&(b.y=parseInt(d));if(c=(c=a.getAttribute("transform"))&&
|
|
75
|
+
c.match(XY_REGEX$$module$build$src$core$utils$svg_math))b.x+=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;
|
|
76
|
+
a=a.parentNode}return new Coordinate$$module$build$src$core$utils$coordinate(b,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,
|
|
77
|
+
a.x,document.documentElement.clientWidth+a.x)},getDocumentScroll$$module$build$src$core$utils$svg_math=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();
|
|
78
|
+
return Coordinate$$module$build$src$core$utils$coordinate.difference(c,b).scale(1/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");
|
|
79
|
+
var d=variablesToDom$$module$build$src$core$xml(allUsedVarModels$$module$build$src$core$variables(a));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=
|
|
80
|
+
a[c],e=createElement$$module$build$src$core$utils$xml("variable");e.appendChild(createTextNode$$module$build$src$core$utils$xml(d.name));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",
|
|
81
|
+
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=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]);
|
|
82
|
+
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):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=
|
|
83
|
+
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));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!==
|
|
84
|
+
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"):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===
|
|
85
|
+
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&&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",
|
|
86
|
+
"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"),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&&
|
|
87
|
+
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: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,
|
|
88
|
+
"<$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=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: "+
|
|
89
|
+
a);return b.documentElement},clearWorkspaceAndLoadFromXml$$module$build$src$core$xml=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);
|
|
90
|
+
let f=!0;try{for(let g=0,h;h=a.childNodes[g];g++){const k=h.nodeName.toLowerCase(),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,p=l.hasAttribute("y")?parseInt(l.getAttribute("y")):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?
|
|
91
|
+
WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg.fromXmlRendered(l,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&&
|
|
92
|
+
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));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;
|
|
93
|
+
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,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<=
|
|
94
|
+
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);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));
|
|
95
|
+
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},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=
|
|
96
|
+
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);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;
|
|
97
|
+
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=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"));c=parseInt(c.getAttribute("h"));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=
|
|
98
|
+
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=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=
|
|
99
|
+
a.childNodes[c];d.nodeType===NodeType$$module$build$src$core$utils$dom.ELEMENT_NODE&&("block"===d.nodeName.toLowerCase()?b.childBlockElement=d:"shadow"===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.");
|
|
100
|
+
domToBlockHeadless$$module$build$src$core$xml(e.childBlockElement,b,h.connection,!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.");
|
|
101
|
+
domToBlockHeadless$$module$build$src$core$xml(e.childBlockElement,b,c.nextConnection,!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,
|
|
102
|
+
f);applyCommentTagNodes$$module$build$src$core$xml(g.comment,f);applyDataTagNodes$$module$build$src$core$xml(g.data,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,
|
|
103
|
+
f);applyInputTagNodes$$module$build$src$core$xml(g.input,b,f,e);applyNextTagNodes$$module$build$src$core$xml(g.next,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);
|
|
104
|
+
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.");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=
|
|
105
|
+
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=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,
|
|
106
|
+
{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,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,
|
|
107
|
+
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=!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=
|
|
108
|
+
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(),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),
|
|
109
|
+
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=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=
|
|
110
|
+
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&&(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);
|
|
111
|
+
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},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=
|
|
112
|
+
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);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));
|
|
113
|
+
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);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,
|
|
114
|
+
a);loadExtraState$$module$build$src$core$serialization$blocks(e,a);tryToConnectParent$$module$build$src$core$serialization$blocks(c,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=
|
|
115
|
+
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,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)))},
|
|
116
|
+
tryToConnectParent$$module$build$src$core$serialization$blocks=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",
|
|
117
|
+
b,c);if(!a.connect(d)){const e=b.workspace.connectionChecker;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&&
|
|
118
|
+
(a.commentModel.size=new Size$$module$build$src$core$utils$size(b.width,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=
|
|
119
|
+
function(a,b){if(b.inputs){var c=Object.keys(b.inputs);for(let d=0;d<c.length;d++){const e=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,
|
|
120
|
+
b.next)}},loadConnection$$module$build$src$core$serialization$blocks=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=
|
|
121
|
+
function(a,b){if(!a||!b)throw Error("Cannot connect null connections.");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,
|
|
122
|
+
b);)if(a=c.targetBlock(),!a||a.isShadow())return c;return null},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"),
|
|
123
|
+
div$$module$build$src$core$dropdowndiv.className="blocklyDropDownDiv",(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"),
|
|
124
|
+
arrow$$module$build$src$core$dropdowndiv.className="blocklyDropDownArrow",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,
|
|
125
|
+
"blocklyFocused")}),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
126
|
"";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
127
|
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
128
|
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();
|
|
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,
|
|
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-
|
|
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,
|
|
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():
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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,
|
|
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);
|
|
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();
|
|
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()",
|
|
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!==
|
|
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;
|
|
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,
|
|
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])&&
|
|
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=
|
|
147
|
-
|
|
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;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
(
|
|
154
|
-
(
|
|
155
|
-
function(){
|
|
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=
|
|
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+
|
|
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,
|
|
159
|
-
containerDiv$$module$build$src$core$tooltip
|
|
160
|
-
|
|
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>
|
|
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/
|
|
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;
|
|
164
|
-
|
|
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("")
|
|
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=
|
|
167
|
-
|
|
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(),
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
b,c){return b.
|
|
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);
|
|
177
|
-
b)
|
|
178
|
-
a
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
function(a){
|
|
184
|
-
a
|
|
185
|
-
function(a
|
|
186
|
-
|
|
187
|
-
a+'"
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
function(a,b){return checkHasFunctionPair$$module$build$src$core$extensions(a.
|
|
192
|
-
|
|
193
|
-
b
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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,
|
|
201
|
-
|
|
202
|
-
a
|
|
203
|
-
function(){
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
a+","+b+" "},
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
129
|
+
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();renderedClassName$$module$build$src$core$dropdowndiv&&addClass$$module$build$src$core$utils$dom(div$$module$build$src$core$dropdowndiv,
|
|
130
|
+
renderedClassName$$module$build$src$core$dropdowndiv);themeClassName$$module$build$src$core$dropdowndiv&&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,
|
|
131
|
+
finalY:b+PADDING_Y$$module$build$src$core$dropdowndiv,arrowX:a.arrowX,arrowY:-(ARROW_SIZE$$module$build$src$core$dropdowndiv/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-
|
|
132
|
+
2*BORDER_SIZE$$module$build$src$core$dropdowndiv-ARROW_SIZE$$module$build$src$core$dropdowndiv/2,arrowAtTop:!1,arrowVisible:!0}},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,
|
|
133
|
+
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;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():
|
|
134
|
+
hide$$module$build$src$core$dropdowndiv(),!0):!1},hide$$module$build$src$core$dropdowndiv=function(){div$$module$build$src$core$dropdowndiv.style.transform="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(),
|
|
135
|
+
onHide$$module$build$src$core$dropdowndiv=null)},hideWithoutAnimation$$module$build$src$core$dropdowndiv=function(){isVisible$$module$build$src$core$dropdowndiv()&&(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",
|
|
136
|
+
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="",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,
|
|
137
|
+
renderedClassName$$module$build$src$core$dropdowndiv),renderedClassName$$module$build$src$core$dropdowndiv=""),themeClassName$$module$build$src$core$dropdowndiv&&(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,
|
|
138
|
+
b,c,d);a.arrowVisible?(arrow$$module$build$src$core$dropdowndiv.style.display="",arrow$$module$build$src$core$dropdowndiv.style.transform="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);
|
|
139
|
+
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="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();
|
|
140
|
+
a=positionToField$$module$build$src$core$dropdowndiv?getScaledBboxOfField$$module$build$src$core$dropdowndiv(owner$$module$build$src$core$dropdowndiv):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()",
|
|
141
|
+
"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?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!==
|
|
142
|
+
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;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;
|
|
143
|
+
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")},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,
|
|
144
|
+
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=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])&&
|
|
145
|
+
(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,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=
|
|
146
|
+
[];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)},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},
|
|
147
|
+
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=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;
|
|
148
|
+
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="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,
|
|
149
|
+
"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,!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))},
|
|
150
|
+
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(),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=
|
|
151
|
+
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))},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-
|
|
152
|
+
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&&(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=
|
|
153
|
+
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&&(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=
|
|
154
|
+
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=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):
|
|
155
|
+
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);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=
|
|
156
|
+
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+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+
|
|
157
|
+
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-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,
|
|
158
|
+
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;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";
|
|
159
|
+
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=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=
|
|
160
|
+
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:"#"+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>
|
|
161
|
+
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=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/
|
|
162
|
+
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),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;
|
|
163
|
+
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=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=
|
|
164
|
+
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(""))&&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(""),
|
|
165
|
+
/[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,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=
|
|
166
|
+
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=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=
|
|
167
|
+
!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=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(),
|
|
168
|
+
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=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||
|
|
169
|
+
(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))},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=
|
|
170
|
+
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(),rendererClassName$$module$build$src$core$widgetdiv&&addClass$$module$build$src$core$utils$dom(a,rendererClassName$$module$build$src$core$widgetdiv),themeClassName$$module$build$src$core$widgetdiv&&addClass$$module$build$src$core$utils$dom(a,themeClassName$$module$build$src$core$widgetdiv)},
|
|
171
|
+
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=null,a.textContent="",rendererClassName$$module$build$src$core$widgetdiv&&(removeClass$$module$build$src$core$utils$dom(a,rendererClassName$$module$build$src$core$widgetdiv),
|
|
172
|
+
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=function(){return!!owner$$module$build$src$core$widgetdiv},hideIfOwner$$module$build$src$core$widgetdiv=function(a){owner$$module$build$src$core$widgetdiv===
|
|
173
|
+
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=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,
|
|
174
|
+
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,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,
|
|
175
|
+
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)},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);if(b){if("function"!==typeof b.fromJson)throw new TypeError("returned Field was not a IRegistrableField");
|
|
176
|
+
return 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.");return null},setRole$$module$build$src$core$utils$aria=function(a,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(" "));
|
|
177
|
+
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=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: ",
|
|
178
|
+
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.");},inherits$$module$build$src$core$utils$object=function(a,b){warn$$module$build$src$core$utils$deprecation("Blockly.utils.object.inherits",
|
|
179
|
+
"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=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]||
|
|
180
|
+
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=parseToolboxTree$$module$build$src$core$utils$toolbox(a),a=convertToToolboxJson$$module$build$src$core$utils$toolbox(a);
|
|
181
|
+
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+" or "+CATEGORY_TOOLBOX_KIND$$module$build$src$core$utils$toolbox);if(!a)throw Error("Toolbox must have a contents attribute.");
|
|
182
|
+
},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=function(a){if(!a)return!1;const b=a.kind;return b?b===CATEGORY_TOOLBOX_KIND$$module$build$src$core$utils$toolbox:
|
|
183
|
+
!!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)};a instanceof Node&&addAttributes$$module$build$src$core$utils$toolbox(a,b);return b},xmlToJsonArray$$module$build$src$core$utils$toolbox=
|
|
184
|
+
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=function(a,b){for(let c=0;c<a.attributes.length;c++){const d=a.attributes[c];-1<d.nodeName.indexOf("css-")?
|
|
185
|
+
(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){let b=null;if(a)if("string"===typeof a){if(b=textToDom$$module$build$src$core$xml(a),"xml"!==b.nodeName.toLowerCase())throw TypeError("Toolbox should be an <xml> document.");}else a instanceof Element&&(b=a);return b},register$$module$build$src$core$extensions=function(a,b){if("string"!==typeof a||""===a.trim())throw Error('Error: Invalid extension name "'+
|
|
186
|
+
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');register$$module$build$src$core$extensions(a,function(){this.mixin(b)})},registerMutator$$module$build$src$core$extensions=
|
|
187
|
+
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(d||[],this));this.mixin(b);c&&c.apply(this)})},unregister$$module$build$src$core$extensions=function(a){isRegistered$$module$build$src$core$extensions(a)?
|
|
188
|
+
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];if("function"!==typeof d)throw Error('Error: Extension "'+a+'" not found.');let e;c?checkNoMutatorProperties$$module$build$src$core$extensions(a,
|
|
189
|
+
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.');},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 "'+
|
|
190
|
+
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=function(a,b){return checkHasFunctionPair$$module$build$src$core$extensions(a.saveExtraState,a.loadExtraState,b+" saveExtraState/loadExtraState")},checkMutatorDialog$$module$build$src$core$extensions=
|
|
191
|
+
function(a,b){return checkHasFunctionPair$$module$build$src$core$extensions(a.compose,a.decompose,b+" compose/decompose")},checkHasFunctionPair$$module$build$src$core$extensions=function(a,b,c){if(a&&b){if("function"!==typeof a||"function"!==typeof b)throw Error(c+" must be a function");return!0}if(!a&&!b)return!1;throw Error(c+"Must have both or neither functions");},checkHasMutatorProperties$$module$build$src$core$extensions=function(a,b){const c=checkXmlHooks$$module$build$src$core$extensions(b,
|
|
192
|
+
a),d=checkJsonHooks$$module$build$src$core$extensions(b,a);if(!c&&!d)throw Error(a+"Mutations must contain either XML hooks, or JSON hooks, or both");checkMutatorDialog$$module$build$src$core$extensions(b,a)},getMutatorProperties$$module$build$src$core$extensions=function(a){const b=[];void 0!==a.domToMutation&&b.push(a.domToMutation);void 0!==a.mutationToDom&&b.push(a.mutationToDom);void 0!==a.saveExtraState&&b.push(a.saveExtraState);void 0!==a.loadExtraState&&b.push(a.loadExtraState);void 0!==a.compose&&
|
|
193
|
+
b.push(a.compose);void 0!==a.decompose&&b.push(a.decompose);return b},mutatorPropertiesMatch$$module$build$src$core$extensions=function(a,b){b=getMutatorProperties$$module$build$src$core$extensions(b);if(b.length!==a.length)return!1;for(let c=0;c<b.length;c++)if(a[c]!==b[c])return!1;return!0},runAfterPageLoad$$module$build$src$core$extensions=function(a){if("object"!==typeof document)throw Error("runAfterPageLoad() requires browser document.");if("complete"===document.readyState)a();else{const b=
|
|
194
|
+
setInterval(function(){"complete"===document.readyState&&(clearInterval(b),a())},10)}},buildTooltipForDropdown$$module$build$src$core$extensions=function(a,b){const c=[];"object"===typeof document&&runAfterPageLoad$$module$build$src$core$extensions(function(){for(const d in b)checkMessageReferences$$module$build$src$core$utils$parsing(b[d])});return function(){this.type&&-1===c.indexOf(this.type)&&(checkDropdownOptionsInTable$$module$build$src$core$extensions(this,a,b),c.push(this.type));this.setTooltip(function(){var d=
|
|
195
|
+
String(this.getFieldValue(a));let e=b[d];null===e?-1===c.indexOf(this.type)&&(d="No tooltip mapping for value "+d+" of field "+a,null!==this.type&&(d+=" of block type "+this.type),console.warn(d+".")):e=replaceMessageReferences$$module$build$src$core$utils$parsing(e);return e}.bind(this))}},checkDropdownOptionsInTable$$module$build$src$core$extensions=function(a,b,c){var d=a.getField(b);if(d instanceof FieldDropdown$$module$build$src$core$field_dropdown&&!d.isOptionListDynamic()){d=d.getOptions();
|
|
196
|
+
for(let e=0;e<d.length;e++){const f=d[e][1];null===c[f]&&console.warn("No tooltip mapping for value "+f+" of field "+b+" of block type "+a.type)}}},buildTooltipWithFieldText$$module$build$src$core$extensions=function(a,b){"object"===typeof document&&runAfterPageLoad$$module$build$src$core$extensions(function(){checkMessageReferences$$module$build$src$core$utils$parsing(a)});return function(){this.setTooltip(function(){const c=this.getField(b);return replaceMessageReferences$$module$build$src$core$utils$parsing(a).replace("%1",
|
|
197
|
+
c?c.getText():"")}.bind(this))}},extensionParentTooltip$$module$build$src$core$extensions=function(){const a=this.tooltip;this.setTooltip(function(){const b=this.getParent();return b&&b.getInputsInline()&&b.tooltip||a}.bind(this))},getParentConnection$$module$build$src$core$keyboard_nav$ast_node=function(a){let b=a.outputConnection;if(!b||a.previousConnection&&a.previousConnection.isConnected())b=a.previousConnection;return b},disposeUiEffect$$module$build$src$core$block_animations=function(a){const b=
|
|
198
|
+
a.workspace;var c=a.getSvgRoot();b.getAudioManager().play("delete");const d=b.getSvgXY(c);c=c.cloneNode(!0);c.setAttribute("transform","translate("+d.x+","+d.y+")");b.getParentSvg().appendChild(c);disposeUiStep$$module$build$src$core$block_animations(c,{x:d.x,y:d.y,width:a.width,height:a.height},b.RTL,new Date,b.scale)},disposeUiStep$$module$build$src$core$block_animations=function(a,b,c,d,e){const f=((new Date).getTime()-d.getTime())/150;1<f?removeNode$$module$build$src$core$utils$dom(a):(a.setAttribute("transform",
|
|
199
|
+
"translate("+(b.x+(c?-1:1)*b.width*e/2*f)+","+(b.y+b.height*e*f)+") scale("+(1-f)*e+")"),setTimeout(disposeUiStep$$module$build$src$core$block_animations,10,a,b,c,d,e))},connectionUiEffect$$module$build$src$core$block_animations=function(a){const b=a.workspace,c=b.scale;b.getAudioManager().play("click");if(!(1>c)){var d=b.getSvgXY(a.getSvgRoot());a.outputConnection?(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,
|
|
200
|
+
{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):(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,
|
|
201
|
+
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=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=
|
|
202
|
+
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=function(){disconnectGroup$$module$build$src$core$block_animations&&(disconnectPid$$module$build$src$core$block_animations&&clearTimeout(disconnectPid$$module$build$src$core$block_animations),
|
|
203
|
+
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=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;
|
|
204
|
+
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)},duplicateInternal$$module$build$src$core$clipboard=function(a){const b=copyData$$module$build$src$core$clipboard;copy$$module$build$src$core$clipboard(a);
|
|
205
|
+
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=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,
|
|
206
|
+
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()},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);
|
|
207
|
+
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=function(a,b,c){const d=getViewportBBox$$module$build$src$core$utils$svg_math();b=new Rect$$module$build$src$core$utils$rect(b.clientY+
|
|
208
|
+
d.top,b.clientY+d.top,b.clientX+d.left,b.clientX+d.left);createWidget_$$module$build$src$core$contextmenu(a);const e=a.getSize();c&&(b.left+=e.width,b.right+=e.width,d.left+=e.width,d.right+=e.width);positionWithAnchor$$module$build$src$core$widgetdiv(d,b,e,c);a.focus()},createWidget_$$module$build$src$core$contextmenu=function(a){var b=getDiv$$module$build$src$core$widgetdiv();if(!b)throw Error("Attempting to create a context menu when widget div is null");b=a.render(b);addClass$$module$build$src$core$utils$dom(b,
|
|
209
|
+
"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);currentBlock$$module$build$src$core$contextmenu=null},dispose$$module$build$src$core$contextmenu=
|
|
210
|
+
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:d.x+$.config$$module$build$src$core$config.snapRadius;d.y+=2*$.config$$module$build$src$core$config.snapRadius;
|
|
211
|
+
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,enabled:!0,callback:function(){setGroup$$module$build$src$core$events$utils(!0);a.dispose();setGroup$$module$build$src$core$events$utils(!1)}}},
|
|
212
|
+
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=function(){const d=new WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg(a,Msg$$module$build$src$core$msg.WORKSPACE_COMMENT_DEFAULT_TEXT,
|
|
213
|
+
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,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=
|
|
214
|
+
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 "+a+","+b+" "},line$$module$build$src$core$utils$svg_paths=function(a){return" l"+a.join("")},lineOnAxis$$module$build$src$core$utils$svg_paths=
|
|
215
|
+
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+c,g&&f.RTL&&(c+=Scrollbar$$module$build$src$core$scrollbar.scrollbarThickness)):(c=e.absoluteMetrics.left+e.viewMetrics.width-
|
|
216
|
+
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,a+b.height,c,c+b.width)},getCornerOppositeToolbox$$module$build$src$core$positionable_helpers=
|
|
217
|
+
function(a,b){return{horizontal:b.toolboxMetrics.position===Position$$module$build$src$core$utils$toolbox.LEFT||a.horizontalLayout&&!a.RTL?horizontalPosition$$module$build$src$core$positionable_helpers.RIGHT:horizontalPosition$$module$build$src$core$positionable_helpers.LEFT,vertical:b.toolboxMetrics.position===Position$$module$build$src$core$utils$toolbox.BOTTOM?verticalPosition$$module$build$src$core$positionable_helpers.TOP:verticalPosition$$module$build$src$core$positionable_helpers.BOTTOM}},
|
|
218
|
+
bumpPositionRect$$module$build$src$core$positionable_helpers=function(a,b,c,d){const e=a.left,f=a.right-a.left,g=a.bottom-a.top;for(let h=0;h<d.length;h++){const k=d[h];a.intersects(k)&&(a=c===bumpDirection$$module$build$src$core$positionable_helpers.UP?k.top-g-b:k.bottom+b,a=new Rect$$module$build$src$core$utils$rect(a,a+g,e,e+f),h=-1)}return a},registerEscape$$module$build$src$core$shortcut_items=function(){ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.register({name:names$$module$build$src$core$shortcut_items.ESCAPE,
|
|
219
219
|
preconditionFn(a){return!a.options.readOnly},callback(a){a.hideChaff();return!0},keyCodes:[KeyCodes$$module$build$src$core$utils$keycodes.ESC]})},registerDelete$$module$build$src$core$shortcut_items=function(){ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.register({name:names$$module$build$src$core$shortcut_items.DELETE,preconditionFn(a){const b=getSelected$$module$build$src$core$common();return!a.options.readOnly&&null!=b&&b.isDeletable()},callback(a,b){b.preventDefault();if(Gesture$$module$build$src$core$gesture.inProgress())return!1;
|
|
220
220
|
getSelected$$module$build$src$core$common().checkAndDelete();return!0},keyCodes:[KeyCodes$$module$build$src$core$utils$keycodes.DELETE,KeyCodes$$module$build$src$core$utils$keycodes.BACKSPACE]})},registerCopy$$module$build$src$core$shortcut_items=function(){const a=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.C,[KeyCodes$$module$build$src$core$utils$keycodes.CTRL]),b=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.C,
|
|
221
221
|
[KeyCodes$$module$build$src$core$utils$keycodes.ALT]),c=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.C,[KeyCodes$$module$build$src$core$utils$keycodes.META]);ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.register({name:names$$module$build$src$core$shortcut_items.COPY,preconditionFn(d){const e=getSelected$$module$build$src$core$common();return!d.options.readOnly&&!Gesture$$module$build$src$core$gesture.inProgress()&&
|
|
@@ -229,7 +229,7 @@ d.undo(!1);return!0},keyCodes:[a,b,c]})},registerRedo$$module$build$src$core$sho
|
|
|
229
229
|
KeyCodes$$module$build$src$core$utils$keycodes.ALT]),c=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.Z,[KeyCodes$$module$build$src$core$utils$keycodes.SHIFT,KeyCodes$$module$build$src$core$utils$keycodes.META]),d=ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.createSerializedKey(KeyCodes$$module$build$src$core$utils$keycodes.Y,[KeyCodes$$module$build$src$core$utils$keycodes.CTRL]);ShortcutRegistry$$module$build$src$core$shortcut_registry.registry.register({name:names$$module$build$src$core$shortcut_items.REDO,
|
|
230
230
|
preconditionFn(e){return!Gesture$$module$build$src$core$gesture.inProgress()&&!e.options.readOnly},callback(e){e.hideChaff();e.undo(!0);return!0},keyCodes:[a,b,c,d]})},registerDefaultShortcuts$$module$build$src$core$shortcut_items=function(){registerEscape$$module$build$src$core$shortcut_items();registerDelete$$module$build$src$core$shortcut_items();registerCopy$$module$build$src$core$shortcut_items();registerCut$$module$build$src$core$shortcut_items();registerPaste$$module$build$src$core$shortcut_items();
|
|
231
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=
|
|
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]
|
|
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])+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=
|
|
233
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,
|
|
234
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
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&&
|
|
@@ -239,15 +239,15 @@ d.setAttribute("type","procedures_mutatorarg");const e=createElement$$module$bui
|
|
|
239
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===
|
|
240
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=
|
|
241
241
|
function(a){const b=getRecordUndo$$module$build$src$core$events$utils();var c=a.getProcedureDef()[0];const d=a.mutationToDom(!0);a=getCallers$$module$build$src$core$procedures(c,a.workspace);for(let f=0,g;g=a[f];f++){c=(c=g.mutationToDom())&&domToText$$module$build$src$core$xml(c);g.domToMutation&&g.domToMutation(d);var e=g.mutationToDom();e=e&&domToText$$module$build$src$core$xml(e);c!==e&&(setRecordUndo$$module$build$src$core$events$utils(!1),fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CHANGE$$module$build$src$core$events$utils))(g,
|
|
242
|
-
"mutation",null,c,e)),setRecordUndo$$module$build$src$core$events$utils(b))}},getDefinition$$module$build$src$core$procedures=function(a,b){b=b.getAllBlocks(!1);for(let d=0;d<b.length;d++){var c=b[d];if(c.getProcedureDef&&(c=c.getProcedureDef())&&Names$$module$build$src$core$names.equals(c[0],a))return b[d]}return null},
|
|
243
|
-
function(){warn$$module$build$src$core$utils$deprecation("Blockly.blockRendering.debug.startDebugger()","February 2022","September 2022","the debug renderer in @blockly/dev-tools (See https://www.npmjs.com/package/@blockly/dev-tools.)");useDebugger$$module$build$src$core$renderers$common$debug=!0},stopDebugger$$module$build$src$core$renderers$common$debug=function(){warn$$module$build$src$core$utils$deprecation("Blockly.blockRendering.debug.stopDebugger()",
|
|
244
|
-
useDebugger$$module$build$src$core$renderers$common$debug=!1},isDebuggerEnabled$$module$build$src$core$renderers$common$block_rendering=function(){warn$$module$build$src$core$utils$deprecation("Blockly.blockRendering.isDebuggerEnabled()","September 2021","September 2022","the debug renderer in @blockly/dev-tools (See https://www.npmjs.com/package/@blockly/dev-tools.)");
|
|
245
|
-
function(a,b){register$$module$build$src$core$registry(Type$$module$build$src$core$registry.RENDERER,a,b)},unregister$$module$build$src$core$renderers$common$block_rendering=function(a){unregister$$module$build$src$core$registry(Type$$module$build$src$core$registry.RENDERER,a)},startDebugger$$module$build$src$core$renderers$common$block_rendering=function(){warn$$module$build$src$core$utils$deprecation("Blockly.blockRendering.startDebugger()",
|
|
246
|
-
startDebugger$$module$build$src$core$renderers$common$debug()},stopDebugger$$module$build$src$core$renderers$common$block_rendering=function(){warn$$module$build$src$core$utils$deprecation("Blockly.blockRendering.stopDebugger()","September 2021","September 2022","the debug renderer in @blockly/dev-tools (See https://www.npmjs.com/package/@blockly/dev-tools.)");stopDebugger$$module$build$src$core$renderers$common$debug()},
|
|
247
|
-
new (getClass$$module$build$src$core$registry(Type$$module$build$src$core$registry.RENDERER,a))(a);a.init(b,c);return a},noEvent$$module$build$src$core$utils=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.utils.noEvent","September 2021","September 2022");a.preventDefault();a.stopPropagation()},isTargetInput$$module$build$src$core$utils=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.utils.isTargetInput",
|
|
248
|
-
return isTargetInput$$module$build$src$core$browser_events(a)},getRelativeXY$$module$build$src$core$utils=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.utils.getRelativeXY","December 2021","December 2022","Blockly.utils.svgMath.getRelativeXY");return getRelativeXY$$module$build$src$core$utils$svg_math(a)},getInjectionDivXY$$module$build$src$core$utils=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.utils.getInjectionDivXY_",
|
|
249
|
-
return getInjectionDivXY$$module$build$src$core$utils$svg_math(a)},isRightButton$$module$build$src$core$utils=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.utils.isRightButton","September 2021","September 2022","Blockly.browserEvents.isRightButton");return isRightButton$$module$build$src$core$browser_events(a)},mouseToSvg$$module$build$src$core$utils=function(a,b,c){warn$$module$build$src$core$utils$deprecation("Blockly.utils.mouseToSvg",
|
|
250
|
-
return mouseToSvg$$module$build$src$core$browser_events(a,b,c)},getScrollDeltaPixels$$module$build$src$core$utils=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.utils.getScrollDeltaPixels","September 2021","September 2022","Blockly.browserEvents.getScrollDeltaPixels");return getScrollDeltaPixels$$module$build$src$core$browser_events(a)},tokenizeInterpolation$$module$build$src$core$utils=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.utils.tokenizeInterpolation",
|
|
242
|
+
"mutation",null,c,e)),setRecordUndo$$module$build$src$core$events$utils(b))}},getDefinition$$module$build$src$core$procedures=function(a,b){b=b.getAllBlocks(!1);for(let d=0;d<b.length;d++){var c=b[d];if(c.getProcedureDef&&(c=c.getProcedureDef())&&Names$$module$build$src$core$names.equals(c[0],a))return b[d]}return null},isDynamicShape$$module$build$src$core$renderers$common$constants=function(a){return a.isDynamic},isDebuggerEnabled$$module$build$src$core$renderers$common$debug=function(){return useDebugger$$module$build$src$core$renderers$common$debug},
|
|
243
|
+
startDebugger$$module$build$src$core$renderers$common$debug=function(){warn$$module$build$src$core$utils$deprecation("Blockly.blockRendering.debug.startDebugger()","February 2022","September 2022","the debug renderer in @blockly/dev-tools (See https://www.npmjs.com/package/@blockly/dev-tools.)");useDebugger$$module$build$src$core$renderers$common$debug=!0},stopDebugger$$module$build$src$core$renderers$common$debug=function(){warn$$module$build$src$core$utils$deprecation("Blockly.blockRendering.debug.stopDebugger()",
|
|
244
|
+
"February 2022","September 2022","the debug renderer in @blockly/dev-tools (See https://www.npmjs.com/package/@blockly/dev-tools.)");useDebugger$$module$build$src$core$renderers$common$debug=!1},isDebuggerEnabled$$module$build$src$core$renderers$common$block_rendering=function(){warn$$module$build$src$core$utils$deprecation("Blockly.blockRendering.isDebuggerEnabled()","September 2021","September 2022","the debug renderer in @blockly/dev-tools (See https://www.npmjs.com/package/@blockly/dev-tools.)");
|
|
245
|
+
return isDebuggerEnabled$$module$build$src$core$renderers$common$debug()},register$$module$build$src$core$renderers$common$block_rendering=function(a,b){register$$module$build$src$core$registry(Type$$module$build$src$core$registry.RENDERER,a,b)},unregister$$module$build$src$core$renderers$common$block_rendering=function(a){unregister$$module$build$src$core$registry(Type$$module$build$src$core$registry.RENDERER,a)},startDebugger$$module$build$src$core$renderers$common$block_rendering=function(){warn$$module$build$src$core$utils$deprecation("Blockly.blockRendering.startDebugger()",
|
|
246
|
+
"September 2021","September 2022","the debug renderer in @blockly/dev-tools (See https://www.npmjs.com/package/@blockly/dev-tools.)");startDebugger$$module$build$src$core$renderers$common$debug()},stopDebugger$$module$build$src$core$renderers$common$block_rendering=function(){warn$$module$build$src$core$utils$deprecation("Blockly.blockRendering.stopDebugger()","September 2021","September 2022","the debug renderer in @blockly/dev-tools (See https://www.npmjs.com/package/@blockly/dev-tools.)");stopDebugger$$module$build$src$core$renderers$common$debug()},
|
|
247
|
+
init$$module$build$src$core$renderers$common$block_rendering=function(a,b,c){a=new (getClass$$module$build$src$core$registry(Type$$module$build$src$core$registry.RENDERER,a))(a);a.init(b,c);return a},noEvent$$module$build$src$core$utils=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.utils.noEvent","September 2021","September 2022");a.preventDefault();a.stopPropagation()},isTargetInput$$module$build$src$core$utils=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.utils.isTargetInput",
|
|
248
|
+
"September 2021","September 2022","Blockly.browserEvents.isTargetInput");return isTargetInput$$module$build$src$core$browser_events(a)},getRelativeXY$$module$build$src$core$utils=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.utils.getRelativeXY","December 2021","December 2022","Blockly.utils.svgMath.getRelativeXY");return getRelativeXY$$module$build$src$core$utils$svg_math(a)},getInjectionDivXY$$module$build$src$core$utils=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.utils.getInjectionDivXY_",
|
|
249
|
+
"December 2021","December 2022","Blockly.utils.svgMath.getInjectionDivXY");return getInjectionDivXY$$module$build$src$core$utils$svg_math(a)},isRightButton$$module$build$src$core$utils=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.utils.isRightButton","September 2021","September 2022","Blockly.browserEvents.isRightButton");return isRightButton$$module$build$src$core$browser_events(a)},mouseToSvg$$module$build$src$core$utils=function(a,b,c){warn$$module$build$src$core$utils$deprecation("Blockly.utils.mouseToSvg",
|
|
250
|
+
"September 2021","September 2022","Blockly.browserEvents.mouseToSvg");return mouseToSvg$$module$build$src$core$browser_events(a,b,c)},getScrollDeltaPixels$$module$build$src$core$utils=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.utils.getScrollDeltaPixels","September 2021","September 2022","Blockly.browserEvents.getScrollDeltaPixels");return getScrollDeltaPixels$$module$build$src$core$browser_events(a)},tokenizeInterpolation$$module$build$src$core$utils=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.utils.tokenizeInterpolation",
|
|
251
251
|
"December 2021","December 2022","Blockly.utils.parsing.tokenizeInterpolation");return tokenizeInterpolation$$module$build$src$core$utils$parsing(a)},replaceMessageReferences$$module$build$src$core$utils=function(a){warn$$module$build$src$core$utils$deprecation("Blockly.utils.replaceMessageReferences","December 2021","December 2022","Blockly.utils.parsing.replaceMessageReferences");return replaceMessageReferences$$module$build$src$core$utils$parsing(a)},checkMessageReferences$$module$build$src$core$utils=
|
|
252
252
|
function(a){warn$$module$build$src$core$utils$deprecation("Blockly.utils.checkMessageReferences","December 2021","December 2022","Blockly.utils.parsing.checkMessageReferences");return checkMessageReferences$$module$build$src$core$utils$parsing(a)},genUid$$module$build$src$core$utils=function(){warn$$module$build$src$core$utils$deprecation("Blockly.utils.genUid","September 2021","September 2022","Blockly.utils.idGenerator.genUid");return genUid$$module$build$src$core$utils$idgenerator()},is3dSupported$$module$build$src$core$utils=
|
|
253
253
|
function(){warn$$module$build$src$core$utils$deprecation("Blockly.utils.is3dSupported","December 2021","December 2022","Blockly.utils.svgMath.is3dSupported");return is3dSupported$$module$build$src$core$utils$svg_math()},getViewportBBox$$module$build$src$core$utils=function(){warn$$module$build$src$core$utils$deprecation("Blockly.utils.getViewportBBox","December 2021","December 2022","Blockly.utils.svgMath.getViewportBBox");return getViewportBBox$$module$build$src$core$utils$svg_math()},arrayRemove$$module$build$src$core$utils=
|
|
@@ -268,7 +268,7 @@ a.getCommentById(b.commentId)}return c},bumpTopObjectsIntoBounds$$module$build$s
|
|
|
268
268
|
a))throw Error("Error: container is not in current document.");b=new Options$$module$build$src$core$options(b||{});const c=document.createElement("div");c.className="injectionDiv";c.tabIndex=0;setState$$module$build$src$core$utils$aria(c,State$$module$build$src$core$utils$aria.LABEL,Msg$$module$build$src$core$msg.WORKSPACE_ARIA_LABEL);a.appendChild(c);a=createDom$$module$build$src$core$inject(c,b);const d=new BlockDragSurfaceSvg$$module$build$src$core$block_drag_surface(c),e=new WorkspaceDragSurfaceSvg$$module$build$src$core$workspace_drag_surface_svg(c),
|
|
269
269
|
f=createMainWorkspace$$module$build$src$core$inject(a,b,d,e);init$$module$build$src$core$inject(f);setMainWorkspace$$module$build$src$core$common(f);svgResize$$module$build$src$core$common(f);c.addEventListener("focusin",function(){setMainWorkspace$$module$build$src$core$common(f)});return f},createDom$$module$build$src$core$inject=function(a,b){a.setAttribute("dir","LTR");inject$$module$build$src$core$css(b.hasCss,b.pathToMedia);a=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.SVG,
|
|
270
270
|
{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":"blocklySvg",tabindex:"0"},a);const c=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.DEFS,{},a),d=String(Math.random()).substring(2);b.gridPattern=Grid$$module$build$src$core$grid.createDom(d,b.gridOptions,c);return a},createMainWorkspace$$module$build$src$core$inject=function(a,b,
|
|
271
|
-
c,d){b.parentWorkspace=null;b=new WorkspaceSvg$$module$build$src$core$workspace_svg(b,c,d);c=b.options;b.scale=c.zoomOptions.startScale;a.appendChild(b.createDom("blocklyMainBackground"));addClass$$module$build$src$core$utils$dom(
|
|
271
|
+
c,d){b.parentWorkspace=null;b=new WorkspaceSvg$$module$build$src$core$workspace_svg(b,c,d);c=b.options;b.scale=c.zoomOptions.startScale;a.appendChild(b.createDom("blocklyMainBackground"));d=b.getInjectionDiv();var e=b.getRenderer().getClassName();e&&addClass$$module$build$src$core$utils$dom(d,e);(e=b.getTheme().getClassName())&&addClass$$module$build$src$core$utils$dom(d,e);!c.hasCategories&&c.languageTree&&(d=b.addFlyout(Svg$$module$build$src$core$utils$svg.SVG),insertAfter$$module$build$src$core$utils$dom(d,
|
|
272
272
|
a));c.hasTrashcan&&b.addTrashcan();c.zoomOptions&&c.zoomOptions.controls&&b.addZoomControls();b.getThemeManager().subscribe(a,"workspaceBackgroundColour","background-color");b.translate(0,0);b.addChangeListener(bumpIntoBoundsHandler$$module$build$src$core$bump_objects(b));svgResize$$module$build$src$core$common(b);createDom$$module$build$src$core$widgetdiv();createDom$$module$build$src$core$dropdowndiv();createDom$$module$build$src$core$tooltip();return b},init$$module$build$src$core$inject=function(a){const b=
|
|
273
273
|
a.options;var c=a.getParentSvg();conditionalBind$$module$build$src$core$browser_events(c.parentNode,"contextmenu",null,function(d){isTargetInput$$module$build$src$core$browser_events(d)||d.preventDefault()});c=conditionalBind$$module$build$src$core$browser_events(window,"resize",null,function(){a.hideChaff(!0);svgResize$$module$build$src$core$common(a);bumpTopObjectsIntoBounds$$module$build$src$core$bump_objects(a)});a.setResizeHandlerWrapper(c);bindDocumentEvents$$module$build$src$core$inject();
|
|
274
274
|
if(b.languageTree){c=a.getToolbox();const d=a.getFlyout(!0);c?c.init():d&&(d.init(a),d.show(b.languageTree),"function"===typeof d.scrollToStart&&d.scrollToStart())}b.hasTrashcan&&a.trashcan.init();b.zoomOptions&&b.zoomOptions.controls&&a.zoomControls_.init();b.moveOptions&&b.moveOptions.scrollbars?(a.scrollbar=new ScrollbarPair$$module$build$src$core$scrollbar_pair(a,!0===b.moveOptions.scrollbars||!!b.moveOptions.scrollbars.horizontal,!0===b.moveOptions.scrollbars||!!b.moveOptions.scrollbars.vertical,
|
|
@@ -282,7 +282,7 @@ preconditionFn(a){return 0<a.workspace.getUndoStack().length?"enabled":"disabled
|
|
|
282
282
|
function(){ContextMenuRegistry$$module$build$src$core$contextmenu_registry.registry.register({displayText(){return Msg$$module$build$src$core$msg.COLLAPSE_ALL},preconditionFn(a){if(a.workspace.options.collapse){a=a.workspace.getTopBlocks(!1);for(let b=0;b<a.length;b++){let c=a[b];for(;c;){if(!c.isCollapsed())return"enabled";c=c.getNextBlock()}}return"disabled"}return"hidden"},callback(a){toggleOption_$$module$build$src$core$contextmenu_items(!0,a.workspace.getTopBlocks(!0))},scopeType:ContextMenuRegistry$$module$build$src$core$contextmenu_registry.ScopeType.WORKSPACE,
|
|
283
283
|
id:"collapseWorkspace",weight:4})},registerExpand$$module$build$src$core$contextmenu_items=function(){ContextMenuRegistry$$module$build$src$core$contextmenu_registry.registry.register({displayText(){return Msg$$module$build$src$core$msg.EXPAND_ALL},preconditionFn(a){if(a.workspace.options.collapse){a=a.workspace.getTopBlocks(!1);for(let b=0;b<a.length;b++){let c=a[b];for(;c;){if(c.isCollapsed())return"enabled";c=c.getNextBlock()}}return"disabled"}return"hidden"},callback(a){toggleOption_$$module$build$src$core$contextmenu_items(!1,
|
|
284
284
|
a.workspace.getTopBlocks(!0))},scopeType:ContextMenuRegistry$$module$build$src$core$contextmenu_registry.ScopeType.WORKSPACE,id:"expandWorkspace",weight:5})},addDeletableBlocks_$$module$build$src$core$contextmenu_items=function(a,b){if(a.isDeletable())Array.prototype.push.apply(b,a.getDescendants(!1));else{a=a.getChildren(!1);for(let c=0;c<a.length;c++)addDeletableBlocks_$$module$build$src$core$contextmenu_items(a[c],b)}},getDeletableBlocks_$$module$build$src$core$contextmenu_items=function(a){const b=
|
|
285
|
-
[];a=a.getTopBlocks(!0);for(let c=0;c<a.length;c++)addDeletableBlocks_$$module$build$src$core$contextmenu_items(a[c],b);return b},deleteNext_$$module$build$src$core$contextmenu_items=function(a,b){setGroup$$module$build$src$core$events$utils(b);const c=a.shift();c&&(c.
|
|
285
|
+
[];a=a.getTopBlocks(!0);for(let c=0;c<a.length;c++)addDeletableBlocks_$$module$build$src$core$contextmenu_items(a[c],b);return b},deleteNext_$$module$build$src$core$contextmenu_items=function(a,b){setGroup$$module$build$src$core$events$utils(b);const c=a.shift();c&&(c.isDeadOrDying()?deleteNext_$$module$build$src$core$contextmenu_items(a,b):(c.dispose(!1,!0),setTimeout(deleteNext_$$module$build$src$core$contextmenu_items,10,a,b)));setGroup$$module$build$src$core$events$utils(!1)},registerDeleteAll$$module$build$src$core$contextmenu_items=
|
|
286
286
|
function(){ContextMenuRegistry$$module$build$src$core$contextmenu_registry.registry.register({displayText(a){if(!a.workspace)return"";a=getDeletableBlocks_$$module$build$src$core$contextmenu_items(a.workspace).length;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.workspace?0<getDeletableBlocks_$$module$build$src$core$contextmenu_items(a.workspace).length?"enabled":"disabled":"disabled"},callback(a){if(a.workspace){a.workspace.cancelCurrentGesture();
|
|
287
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",
|
|
288
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},
|
|
@@ -336,9 +336,9 @@ module$build$src$core$events$utils.MARKER_MOVE=MARKER_MOVE$$module$build$src$cor
|
|
|
336
336
|
module$build$src$core$events$utils.TOOLBOX_ITEM_SELECT=TOOLBOX_ITEM_SELECT$$module$build$src$core$events$utils;module$build$src$core$events$utils.TRASHCAN_OPEN=TRASHCAN_OPEN$$module$build$src$core$events$utils;module$build$src$core$events$utils.UI=UI$$module$build$src$core$events$utils;module$build$src$core$events$utils.VAR_CREATE=VAR_CREATE$$module$build$src$core$events$utils;module$build$src$core$events$utils.VAR_DELETE=VAR_DELETE$$module$build$src$core$events$utils;
|
|
337
337
|
module$build$src$core$events$utils.VAR_RENAME=VAR_RENAME$$module$build$src$core$events$utils;module$build$src$core$events$utils.VIEWPORT_CHANGE=VIEWPORT_CHANGE$$module$build$src$core$events$utils;module$build$src$core$events$utils.clearPendingUndo=clearPendingUndo$$module$build$src$core$events$utils;module$build$src$core$events$utils.disable=disable$$module$build$src$core$events$utils;module$build$src$core$events$utils.disableOrphans=disableOrphans$$module$build$src$core$events$utils;
|
|
338
338
|
module$build$src$core$events$utils.enable=enable$$module$build$src$core$events$utils;module$build$src$core$events$utils.filter=filter$$module$build$src$core$events$utils;module$build$src$core$events$utils.fire=fire$$module$build$src$core$events$utils;module$build$src$core$events$utils.fromJson=fromJson$$module$build$src$core$events$utils;module$build$src$core$events$utils.get=get$$module$build$src$core$events$utils;module$build$src$core$events$utils.getDescendantIds=getDescendantIds$$module$build$src$core$events$utils;
|
|
339
|
-
module$build$src$core$events$utils.getGroup=getGroup$$module$build$src$core$events$utils;module$build$src$core$events$utils.getRecordUndo=getRecordUndo$$module$build$src$core$events$utils;module$build$src$core$events$utils.isEnabled=isEnabled$$module$build$src$core$events$utils;module$build$src$core$events$utils.setGroup=setGroup$$module$build$src$core$events$utils;module$build$src$core$events$utils.setRecordUndo=setRecordUndo$$module$build$src$core$events$utils;var Abstract$$module$build$src$core$events$events_abstract=class{constructor(){this.
|
|
340
|
-
|
|
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"],
|
|
339
|
+
module$build$src$core$events$utils.getGroup=getGroup$$module$build$src$core$events$utils;module$build$src$core$events$utils.getRecordUndo=getRecordUndo$$module$build$src$core$events$utils;module$build$src$core$events$utils.isEnabled=isEnabled$$module$build$src$core$events$utils;module$build$src$core$events$utils.setGroup=setGroup$$module$build$src$core$events$utils;module$build$src$core$events$utils.setRecordUndo=setRecordUndo$$module$build$src$core$events$utils;var Abstract$$module$build$src$core$events$events_abstract=class{constructor(){this.workspaceId=void 0;this.isUiEvent=!1;this.type="";this.group=getGroup$$module$build$src$core$events$utils();this.recordUndo=getRecordUndo$$module$build$src$core$events$utils()}toJson(){return{type:this.type,group:this.group}}fromJson(a){this.isBlank=!1;this.group=a.group||""}isNull(){return!1}run(a){}getEventWorkspace_(){let a;this.workspaceId&&(a=getWorkspaceById$$module$build$src$core$common(this.workspaceId));if(!a)throw Error("Workspace is null. Event must have been generated from real Blockly events.");
|
|
340
|
+
return a}},module$build$src$core$events$events_abstract={};module$build$src$core$events$events_abstract.Abstract=Abstract$$module$build$src$core$events$events_abstract;var UiBase$$module$build$src$core$events$events_ui_base=class extends Abstract$$module$build$src$core$events$events_abstract{constructor(a){super();this.isBlank=!0;this.recordUndo=!1;this.isUiEvent=!0;this.isBlank="undefined"===typeof a;this.workspaceId=a?a:""}},module$build$src$core$events$events_ui_base={};module$build$src$core$events$events_ui_base.UiBase=UiBase$$module$build$src$core$events$events_ui_base;var TrashcanOpen$$module$build$src$core$events$events_trashcan_open=class extends UiBase$$module$build$src$core$events$events_ui_base{constructor(a,b){super(b);this.type=TRASHCAN_OPEN$$module$build$src$core$events$utils;this.isOpen=a}toJson(){const a=super.toJson();if(void 0===this.isOpen)throw Error("Whether this is already open or not is undefined. Either pass a value to the constructor, or call fromJson");a.isOpen=this.isOpen;return a}fromJson(a){super.fromJson(a);this.isOpen=a.isOpen}};
|
|
341
|
+
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,TRASHCAN_OPEN$$module$build$src$core$events$utils,TrashcanOpen$$module$build$src$core$events$events_trashcan_open);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"],
|
|
342
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;
|
|
343
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;
|
|
344
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;
|
|
@@ -355,7 +355,7 @@ null==(f=this.capabilityToComponentIds.get(e))||f.push(c)}else this.capabilityTo
|
|
|
355
355
|
a+'" has not been added to the ComponentManager');if(this.hasCapability(a,b))console.warn('Plugin "'+a+'already has capability "'+b+'"');else{b=String(b).toLowerCase();var c;null==(c=this.componentData.get(a))||c.capabilities.push(b);var d;null==(d=this.capabilityToComponentIds.get(b))||d.push(a)}}removeCapability(a,b){if(!this.getComponent(a))throw Error('Cannot remove capability, "'+b+'". Plugin "'+a+'" has not been added to the ComponentManager');this.hasCapability(a,b)?(b=String(b).toLowerCase(),
|
|
356
356
|
removeElem$$module$build$src$core$utils$array(this.componentData.get(a).capabilities,b),removeElem$$module$build$src$core$utils$array(this.capabilityToComponentIds.get(b),a)):console.warn('Plugin "'+a+"doesn't have capability \""+b+'" to remove')}hasCapability(a,b){b=String(b).toLowerCase();return this.componentData.has(a)&&-1!==this.componentData.get(a).capabilities.indexOf(b)}getComponent(a){let b;return null==(b=this.componentData.get(a))?void 0:b.component}getComponents(a,b){a=String(a).toLowerCase();
|
|
357
357
|
a=this.capabilityToComponentIds.get(a);if(!a)return[];const c=[];if(b){const d=[];a.forEach(e=>{d.push(this.componentData.get(e))});d.sort(function(e,f){return e.weight-f.weight});d.forEach(function(e){c.push(e.component)})}else a.forEach(d=>{c.push(this.componentData.get(d).component)});return c}};ComponentManager$$module$build$src$core$component_manager.Capability=Capability$$module$build$src$core$component_manager;var module$build$src$core$component_manager={};
|
|
358
|
-
module$build$src$core$component_manager.ComponentManager=ComponentManager$$module$build$src$core$component_manager;var Selected$$module$build$src$core$events$events_selected=class extends UiBase$$module$build$src$core$events$events_ui_base{constructor(a,b,c){super(c);this.
|
|
358
|
+
module$build$src$core$component_manager.ComponentManager=ComponentManager$$module$build$src$core$component_manager;var Selected$$module$build$src$core$events$events_selected=class extends UiBase$$module$build$src$core$events$events_ui_base{constructor(a,b,c){super(c);this.type=SELECTED$$module$build$src$core$events$utils;this.oldElementId=null!=a?a:void 0;this.newElementId=null!=b?b:void 0}toJson(){const a=super.toJson();a.oldElementId=this.oldElementId;a.newElementId=this.newElementId;return a}fromJson(a){super.fromJson(a);this.oldElementId=a.oldElementId;this.newElementId=a.newElementId}};
|
|
359
359
|
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,SELECTED$$module$build$src$core$events$utils,Selected$$module$build$src$core$events$events_selected);var module$build$src$core$events$events_selected={};module$build$src$core$events$events_selected.Selected=Selected$$module$build$src$core$events$events_selected;var inputTypes$$module$build$src$core$input_types;(function(a){a[a.VALUE=1]="VALUE";a[a.STATEMENT=3]="STATEMENT";a[a.DUMMY=5]="DUMMY"})(inputTypes$$module$build$src$core$input_types||(inputTypes$$module$build$src$core$input_types={}));$.module$build$src$core$input_types={};$.module$build$src$core$input_types.inputTypes=inputTypes$$module$build$src$core$input_types;var SVG_NS$$module$build$src$core$utils$dom="http://www.w3.org/2000/svg",HTML_NS$$module$build$src$core$utils$dom="http://www.w3.org/1999/xhtml",XLINK_NS$$module$build$src$core$utils$dom="http://www.w3.org/1999/xlink",NodeType$$module$build$src$core$utils$dom;
|
|
360
360
|
(function(a){a[a.ELEMENT_NODE=1]="ELEMENT_NODE";a[a.TEXT_NODE=3]="TEXT_NODE";a[a.COMMENT_NODE=8]="COMMENT_NODE";a[a.DOCUMENT_POSITION_CONTAINED_BY=16]="DOCUMENT_POSITION_CONTAINED_BY"})(NodeType$$module$build$src$core$utils$dom||(NodeType$$module$build$src$core$utils$dom={}));var cacheWidths$$module$build$src$core$utils$dom=null,cacheReference$$module$build$src$core$utils$dom=0,canvasContext$$module$build$src$core$utils$dom=null,module$build$src$core$utils$dom={};
|
|
361
361
|
module$build$src$core$utils$dom.HTML_NS=HTML_NS$$module$build$src$core$utils$dom;module$build$src$core$utils$dom.NodeType=NodeType$$module$build$src$core$utils$dom;module$build$src$core$utils$dom.SVG_NS=SVG_NS$$module$build$src$core$utils$dom;module$build$src$core$utils$dom.XLINK_NS=XLINK_NS$$module$build$src$core$utils$dom;module$build$src$core$utils$dom.addClass=addClass$$module$build$src$core$utils$dom;module$build$src$core$utils$dom.containsNode=containsNode$$module$build$src$core$utils$dom;
|
|
@@ -363,8 +363,10 @@ module$build$src$core$utils$dom.createSvgElement=createSvgElement$$module$build$
|
|
|
363
363
|
module$build$src$core$utils$dom.insertAfter=insertAfter$$module$build$src$core$utils$dom;module$build$src$core$utils$dom.measureFontMetrics=measureFontMetrics$$module$build$src$core$utils$dom;module$build$src$core$utils$dom.removeClass=removeClass$$module$build$src$core$utils$dom;module$build$src$core$utils$dom.removeClasses=removeClasses$$module$build$src$core$utils$dom;module$build$src$core$utils$dom.removeNode=removeNode$$module$build$src$core$utils$dom;
|
|
364
364
|
module$build$src$core$utils$dom.setCssTransform=setCssTransform$$module$build$src$core$utils$dom;module$build$src$core$utils$dom.startTextWidthCache=startTextWidthCache$$module$build$src$core$utils$dom;module$build$src$core$utils$dom.stopTextWidthCache=stopTextWidthCache$$module$build$src$core$utils$dom;var Size$$module$build$src$core$utils$size=class{constructor(a,b){this.width=a;this.height=b}static equals(a,b){return a===b?!0:a&&b?a.width===b.width&&a.height===b.height:!1}},module$build$src$core$utils$size={};module$build$src$core$utils$size.Size=Size$$module$build$src$core$utils$size;var NAME_SPACE$$module$build$src$core$utils$xml,xmlDocument$$module$build$src$core$utils$xml;NAME_SPACE$$module$build$src$core$utils$xml="https://developers.google.com/blockly/xml";xmlDocument$$module$build$src$core$utils$xml=globalThis.document;$.module$build$src$core$utils$xml={};$.module$build$src$core$utils$xml.NAME_SPACE=NAME_SPACE$$module$build$src$core$utils$xml;$.module$build$src$core$utils$xml.createElement=createElement$$module$build$src$core$utils$xml;
|
|
365
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;
|
|
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)
|
|
367
|
-
|
|
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,setLocale$$module$build$src$core$msg;Msg$$module$build$src$core$msg=Object.create(null);setLocale$$module$build$src$core$msg=function(a){Object.keys(a).forEach(function(b){Msg$$module$build$src$core$msg[b]=a[b]})};$.module$build$src$core$msg={};$.module$build$src$core$msg.Msg=Msg$$module$build$src$core$msg;$.module$build$src$core$msg.setLocale=setLocale$$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.isBlank="undefined"===typeof a;a&&(this.varId=a.getId(),this.workspaceId=a.workspace.id)}toJson(){const a=super.toJson();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");a.varId=this.varId;return a}fromJson(a){super.fromJson(a);this.varId=a.varId}},module$build$src$core$events$events_var_base=
|
|
367
|
+
{};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();if(!this.varType)throw Error("The var type is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");
|
|
368
|
+
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_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");a?b.createVariable(this.varName,this.varType,this.varId):b.deleteVariableById(this.varId)}};
|
|
369
|
+
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={};
|
|
368
370
|
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
371
|
$.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;
|
|
370
372
|
$.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;
|
|
@@ -373,10 +375,10 @@ $.module$build$src$core$variables.promptName=promptName$$module$build$src$core$v
|
|
|
373
375
|
b.x,a.y-b.y)}static sum(a,b){return new Coordinate$$module$build$src$core$utils$coordinate(a.x+b.x,a.y+b.y)}},module$build$src$core$utils$coordinate={};module$build$src$core$utils$coordinate.Coordinate=Coordinate$$module$build$src$core$utils$coordinate;var WorkspaceComment$$module$build$src$core$workspace_comment=class{constructor(a,b,c,d,e){this.workspace=a;this.editable_=this.movable_=this.deletable_=!0;this.disposed_=!1;this.isComment=!0;this.id=e&&!a.getCommentById(e)?e:genUid$$module$build$src$core$utils$idgenerator();a.addTopComment(this);this.xy_=new Coordinate$$module$build$src$core$utils$coordinate(0,0);this.height_=c;this.width_=d;this.RTL=a.RTL;this.content_=b;WorkspaceComment$$module$build$src$core$workspace_comment.fireCreateEvent(this)}dispose(){this.disposed_||
|
|
374
376
|
(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)),this.workspace.removeTopComment(this),this.disposed_=!0)}getHeight(){return this.height_}setHeight(a){this.height_=a}getWidth(){return this.width_}setWidth(a){this.width_=a}getXY(){return new Coordinate$$module$build$src$core$utils$coordinate(this.xy_.x,this.xy_.y)}moveBy(a,b){const c=new (get$$module$build$src$core$events$utils(COMMENT_MOVE$$module$build$src$core$events$utils))(this);
|
|
375
377
|
this.xy_.translate(a,b);c.recordNew();fire$$module$build$src$core$events$utils(c)}isDeletable(){return this.deletable_&&!(this.workspace&&this.workspace.options.readOnly)}setDeletable(a){this.deletable_=a}isMovable(){return this.movable_&&!(this.workspace&&this.workspace.options.readOnly)}setMovable(a){this.movable_=a}isEditable(){return this.editable_&&!(this.workspace&&this.workspace.options.readOnly)}setEditable(a){this.editable_=a}getContent(){return this.content_}setContent(a){this.content_!==
|
|
376
|
-
a&&(fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(COMMENT_CHANGE$$module$build$src$core$events$utils))(this,this.content_,a)),this.content_=a)}toXmlWithXY(a){a=this.toXml(a);a.setAttribute("x"
|
|
377
|
-
getGroup$$module$build$src$core$events$utils();b||setGroup$$module$build$src$core$events$utils(!0);try{fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(COMMENT_CREATE$$module$build$src$core$events$utils))(a))}finally{b||setGroup$$module$build$src$core$events$utils(!1)}}}static fromXml(a,b){var c=WorkspaceComment$$module$build$src$core$workspace_comment.parseAttributes(a);
|
|
378
|
-
c=
|
|
379
|
-
module$build$src$core$workspace_comment.WorkspaceComment=WorkspaceComment$$module$build$src$core$workspace_comment;var module$build$src$core$utils$deprecation={};module$build$src$core$utils$deprecation.warn=warn$$module$build$src$core$utils$deprecation;var injected$$module$build$src$core$css=!1,content$$module$build$src$core$css='\n.blocklySvg {\n background-color: #fff;\n outline: none;\n overflow: hidden; /* IE overflows by default. */\n position: absolute;\n display: block;\n}\n\n.blocklyWidgetDiv {\n display: none;\n position: absolute;\n z-index: 99999; /* big value for bootstrap3 compatibility */\n}\n\n.injectionDiv {\n height: 100%;\n position: relative;\n overflow: hidden; /* So blocks in drag surface disappear at edges */\n touch-action: none;\n}\n\n.blocklyNonSelectable {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n}\n\n.blocklyWsDragSurface {\n display: none;\n position: absolute;\n top: 0;\n left: 0;\n}\n\n/* Added as a separate rule with multiple classes to make it more specific\n than a bootstrap rule that selects svg:root. See issue #1275 for context.\n*/\n.blocklyWsDragSurface.blocklyOverflowVisible {\n overflow: visible;\n}\n\n.blocklyBlockDragSurface {\n display: none;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: visible !important;\n z-index: 50; /* Display below toolbox, but above everything else. */\n}\n\n.blocklyBlockCanvas.blocklyCanvasTransitioning,\n.blocklyBubbleCanvas.blocklyCanvasTransitioning {\n transition: transform .5s;\n}\n\n.blocklyTooltipDiv {\n background-color: #ffffc7;\n border: 1px solid #ddc;\n box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);\n color: #000;\n display: none;\n font: 9pt sans-serif;\n opacity: .9;\n padding: 2px;\n position: absolute;\n z-index: 100000; /* big value for bootstrap3 compatibility */\n}\n\n.blocklyDropDownDiv {\n position: absolute;\n left: 0;\n top: 0;\n z-index: 1000;\n display: none;\n border: 1px solid;\n border-color: #dadce0;\n background-color: #fff;\n border-radius: 2px;\n padding: 4px;\n box-shadow: 0 0 3px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownDiv.blocklyFocused {\n box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownContent {\n max-height: 300px; // @todo: spec for maximum height.\n overflow: auto;\n overflow-x: hidden;\n position: relative;\n}\n\n.blocklyDropDownArrow {\n position: absolute;\n left: 0;\n top: 0;\n width: 16px;\n height: 16px;\n z-index: -1;\n background-color: inherit;\n border-color: inherit;\n}\n\n.blocklyDropDownButton {\n display: inline-block;\n float: left;\n padding: 0;\n margin: 4px;\n border-radius: 4px;\n outline: none;\n border: 1px solid;\n transition: box-shadow .1s;\n cursor: pointer;\n}\n\n.blocklyArrowTop {\n border-top: 1px solid;\n border-left: 1px solid;\n border-top-left-radius: 4px;\n border-color: inherit;\n}\n\n.blocklyArrowBottom {\n border-bottom: 1px solid;\n border-right: 1px solid;\n border-bottom-right-radius: 4px;\n border-color: inherit;\n}\n\n.blocklyResizeSE {\n cursor: se-resize;\n fill: #aaa;\n}\n\n.blocklyResizeSW {\n cursor: sw-resize;\n fill: #aaa;\n}\n\n.blocklyResizeLine {\n stroke: #515A5A;\n stroke-width: 1;\n}\n\n.blocklyHighlightedConnectionPath {\n fill: none;\n stroke: #fc3;\n stroke-width: 4px;\n}\n\n.blocklyPathLight {\n fill: none;\n stroke-linecap: round;\n stroke-width: 1;\n}\n\n.blocklySelected>.blocklyPathLight {\n display: none;\n}\n\n.blocklyDraggable {\n /* backup for browsers (e.g. IE11) that don\'t support grab */\n cursor: url("<<<PATH>>>/handopen.cur"), auto;\n cursor: grab;\n cursor: -webkit-grab;\n}\n\n /* backup for browsers (e.g. IE11) that don\'t support grabbing */\n.blocklyDragging {\n /* backup for browsers (e.g. IE11) that don\'t support grabbing */\n cursor: url("<<<PATH>>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n /* Changes cursor on mouse down. Not effective in Firefox because of\n https://bugzilla.mozilla.org/show_bug.cgi?id=771241 */\n.blocklyDraggable:active {\n /* backup for browsers (e.g. IE11) that don\'t support grabbing */\n cursor: url("<<<PATH>>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n/* Change the cursor on the whole drag surface in case the mouse gets\n ahead of block during a drag. This way the cursor is still a closed hand.\n */\n.blocklyBlockDragSurface .blocklyDraggable {\n /* backup for browsers (e.g. IE11) that don\'t support grabbing */\n cursor: url("<<<PATH>>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n.blocklyDragging.blocklyDraggingDelete {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyDragging>.blocklyPath,\n.blocklyDragging>.blocklyPathLight {\n fill-opacity: .8;\n stroke-opacity: .8;\n}\n\n.blocklyDragging>.blocklyPathDark {\n display: none;\n}\n\n.blocklyDisabled>.blocklyPath {\n fill-opacity: .5;\n stroke-opacity: .5;\n}\n\n.blocklyDisabled>.blocklyPathLight,\n.blocklyDisabled>.blocklyPathDark {\n display: none;\n}\n\n.blocklyInsertionMarker>.blocklyPath,\n.blocklyInsertionMarker>.blocklyPathLight,\n.blocklyInsertionMarker>.blocklyPathDark {\n fill-opacity: .2;\n stroke: none;\n}\n\n.blocklyMultilineText {\n font-family: monospace;\n}\n\n.blocklyNonEditableText>text {\n pointer-events: none;\n}\n\n.blocklyFlyout {\n position: absolute;\n z-index: 20;\n}\n\n.blocklyText text {\n cursor: default;\n}\n\n/*\n Don\'t allow users to select text. It gets annoying when trying to\n drag a block and selected text moves instead.\n*/\n.blocklySvg text,\n.blocklyBlockDragSurface text {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n cursor: inherit;\n}\n\n.blocklyHidden {\n display: none;\n}\n\n.blocklyFieldDropdown:not(.blocklyHidden) {\n display: block;\n}\n\n.blocklyIconGroup {\n cursor: default;\n}\n\n.blocklyIconGroup:not(:hover),\n.blocklyIconGroupReadonly {\n opacity: .6;\n}\n\n.blocklyIconShape {\n fill: #00f;\n stroke: #fff;\n stroke-width: 1px;\n}\n\n.blocklyIconSymbol {\n fill: #fff;\n}\n\n.blocklyMinimalBody {\n margin: 0;\n padding: 0;\n}\n\n.blocklyHtmlInput {\n border: none;\n border-radius: 4px;\n height: 100%;\n margin: 0;\n outline: none;\n padding: 0;\n width: 100%;\n text-align: center;\n display: block;\n box-sizing: border-box;\n}\n\n/* Edge and IE introduce a close icon when the input value is longer than a\n certain length. This affects our sizing calculations of the text input.\n Hiding the close icon to avoid that. */\n.blocklyHtmlInput::-ms-clear {\n display: none;\n}\n\n.blocklyMainBackground {\n stroke-width: 1;\n stroke: #c6c6c6; /* Equates to #ddd due to border being off-pixel. */\n}\n\n.blocklyMutatorBackground {\n fill: #fff;\n stroke: #ddd;\n stroke-width: 1;\n}\n\n.blocklyFlyoutBackground {\n fill: #ddd;\n fill-opacity: .8;\n}\n\n.blocklyMainWorkspaceScrollbar {\n z-index: 20;\n}\n\n.blocklyFlyoutScrollbar {\n z-index: 30;\n}\n\n.blocklyScrollbarHorizontal,\n.blocklyScrollbarVertical {\n position: absolute;\n outline: none;\n}\n\n.blocklyScrollbarBackground {\n opacity: 0;\n}\n\n.blocklyScrollbarHandle {\n fill: #ccc;\n}\n\n.blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,\n.blocklyScrollbarHandle:hover {\n fill: #bbb;\n}\n\n/* Darken flyout scrollbars due to being on a grey background. */\n/* By contrast, workspace scrollbars are on a white background. */\n.blocklyFlyout .blocklyScrollbarHandle {\n fill: #bbb;\n}\n\n.blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,\n.blocklyFlyout .blocklyScrollbarHandle:hover {\n fill: #aaa;\n}\n\n.blocklyInvalidInput {\n background: #faa;\n}\n\n.blocklyVerticalMarker {\n stroke-width: 3px;\n fill: rgba(255,255,255,.5);\n pointer-events: none;\n}\n\n.blocklyComputeCanvas {\n position: absolute;\n width: 0;\n height: 0;\n}\n\n.blocklyNoPointerEvents {\n pointer-events: none;\n}\n\n.blocklyContextMenu {\n border-radius: 4px;\n max-height: 100%;\n}\n\n.blocklyDropdownMenu {\n border-radius: 2px;\n padding: 0 !important;\n}\n\n.blocklyDropdownMenu .blocklyMenuItem {\n /* 28px on the left for icon or checkbox. */\n padding-left: 28px;\n}\n\n/* BiDi override for the resting state. */\n.blocklyDropdownMenu .blocklyMenuItemRtl {\n /* Flip left/right padding for BiDi. */\n padding-left: 5px;\n padding-right: 28px;\n}\n\n.blocklyWidgetDiv .blocklyMenu {\n background: #fff;\n border: 1px solid transparent;\n box-shadow: 0 0 3px 1px rgba(0,0,0,.3);\n font: normal 13px Arial, sans-serif;\n margin: 0;\n outline: none;\n padding: 4px 0;\n position: absolute;\n overflow-y: auto;\n overflow-x: hidden;\n max-height: 100%;\n z-index: 20000; /* Arbitrary, but some apps depend on it... */\n}\n\n.blocklyWidgetDiv .blocklyMenu.blocklyFocused {\n box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownDiv .blocklyMenu {\n background: inherit; /* Compatibility with gapi, reset from goog-menu */\n border: inherit; /* Compatibility with gapi, reset from goog-menu */\n font: normal 13px "Helvetica Neue", Helvetica, sans-serif;\n outline: none;\n position: relative; /* Compatibility with gapi, reset from goog-menu */\n z-index: 20000; /* Arbitrary, but some apps depend on it... */\n}\n\n/* State: resting. */\n.blocklyMenuItem {\n border: none;\n color: #000;\n cursor: pointer;\n list-style: none;\n margin: 0;\n /* 7em on the right for shortcut. */\n min-width: 7em;\n padding: 6px 15px;\n white-space: nowrap;\n}\n\n/* State: disabled. */\n.blocklyMenuItemDisabled {\n color: #ccc;\n cursor: inherit;\n}\n\n/* State: hover. */\n.blocklyMenuItemHighlight {\n background-color: rgba(0,0,0,.1);\n}\n\n/* State: selected/checked. */\n.blocklyMenuItemCheckbox {\n height: 16px;\n position: absolute;\n width: 16px;\n}\n\n.blocklyMenuItemSelected .blocklyMenuItemCheckbox {\n background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;\n float: left;\n margin-left: -24px;\n position: static; /* Scroll with the menu. */\n}\n\n.blocklyMenuItemRtl .blocklyMenuItemCheckbox {\n float: right;\n margin-right: -24px;\n}\n',
|
|
378
|
+
a&&(fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(COMMENT_CHANGE$$module$build$src$core$events$utils))(this,this.content_,a)),this.content_=a)}toXmlWithXY(a){a=this.toXml(a);a.setAttribute("x",`${Math.round(this.xy_.x)}`);a.setAttribute("y",`${Math.round(this.xy_.y)}`);a.setAttribute("h",`${this.height_}`);a.setAttribute("w",`${this.width_}`);return a}toXml(a){const b=createElement$$module$build$src$core$utils$xml("comment");a||(b.id=this.id);b.textContent=
|
|
379
|
+
this.getContent();return b}static fireCreateEvent(a){if(isEnabled$$module$build$src$core$events$utils()){const b=getGroup$$module$build$src$core$events$utils();b||setGroup$$module$build$src$core$events$utils(!0);try{fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(COMMENT_CREATE$$module$build$src$core$events$utils))(a))}finally{b||setGroup$$module$build$src$core$events$utils(!1)}}}static fromXml(a,b){var c=WorkspaceComment$$module$build$src$core$workspace_comment.parseAttributes(a);
|
|
380
|
+
b=new WorkspaceComment$$module$build$src$core$workspace_comment(b,c.content,c.h,c.w,c.id);c=a.getAttribute("x");a=a.getAttribute("y");c=c?parseInt(c,10):NaN;a=a?parseInt(a,10):NaN;isNaN(c)||isNaN(a)||b.moveBy(c,a);WorkspaceComment$$module$build$src$core$workspace_comment.fireCreateEvent(b);return b}static parseAttributes(a){const b=a.getAttribute("h"),c=a.getAttribute("w"),d=a.getAttribute("x"),e=a.getAttribute("y"),f=a.getAttribute("id");if(!f)throw Error("No ID present in XML comment definition.");
|
|
381
|
+
let g;return{id:f,h:b?parseInt(b):100,w:c?parseInt(c):100,x:d?parseInt(d):NaN,y:e?parseInt(e):NaN,content:null!=(g=a.textContent)?g:""}}},module$build$src$core$workspace_comment={};module$build$src$core$workspace_comment.WorkspaceComment=WorkspaceComment$$module$build$src$core$workspace_comment;var module$build$src$core$utils$deprecation={};module$build$src$core$utils$deprecation.warn=warn$$module$build$src$core$utils$deprecation;var injected$$module$build$src$core$css=!1,content$$module$build$src$core$css='\n.blocklySvg {\n background-color: #fff;\n outline: none;\n overflow: hidden; /* IE overflows by default. */\n position: absolute;\n display: block;\n}\n\n.blocklyWidgetDiv {\n display: none;\n position: absolute;\n z-index: 99999; /* big value for bootstrap3 compatibility */\n}\n\n.injectionDiv {\n height: 100%;\n position: relative;\n overflow: hidden; /* So blocks in drag surface disappear at edges */\n touch-action: none;\n}\n\n.blocklyNonSelectable {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n}\n\n.blocklyWsDragSurface {\n display: none;\n position: absolute;\n top: 0;\n left: 0;\n}\n\n/* Added as a separate rule with multiple classes to make it more specific\n than a bootstrap rule that selects svg:root. See issue #1275 for context.\n*/\n.blocklyWsDragSurface.blocklyOverflowVisible {\n overflow: visible;\n}\n\n.blocklyBlockDragSurface {\n display: none;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: visible !important;\n z-index: 50; /* Display below toolbox, but above everything else. */\n}\n\n.blocklyBlockCanvas.blocklyCanvasTransitioning,\n.blocklyBubbleCanvas.blocklyCanvasTransitioning {\n transition: transform .5s;\n}\n\n.blocklyTooltipDiv {\n background-color: #ffffc7;\n border: 1px solid #ddc;\n box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);\n color: #000;\n display: none;\n font: 9pt sans-serif;\n opacity: .9;\n padding: 2px;\n position: absolute;\n z-index: 100000; /* big value for bootstrap3 compatibility */\n}\n\n.blocklyDropDownDiv {\n position: absolute;\n left: 0;\n top: 0;\n z-index: 1000;\n display: none;\n border: 1px solid;\n border-color: #dadce0;\n background-color: #fff;\n border-radius: 2px;\n padding: 4px;\n box-shadow: 0 0 3px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownDiv.blocklyFocused {\n box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownContent {\n max-height: 300px; // @todo: spec for maximum height.\n overflow: auto;\n overflow-x: hidden;\n position: relative;\n}\n\n.blocklyDropDownArrow {\n position: absolute;\n left: 0;\n top: 0;\n width: 16px;\n height: 16px;\n z-index: -1;\n background-color: inherit;\n border-color: inherit;\n}\n\n.blocklyDropDownButton {\n display: inline-block;\n float: left;\n padding: 0;\n margin: 4px;\n border-radius: 4px;\n outline: none;\n border: 1px solid;\n transition: box-shadow .1s;\n cursor: pointer;\n}\n\n.blocklyArrowTop {\n border-top: 1px solid;\n border-left: 1px solid;\n border-top-left-radius: 4px;\n border-color: inherit;\n}\n\n.blocklyArrowBottom {\n border-bottom: 1px solid;\n border-right: 1px solid;\n border-bottom-right-radius: 4px;\n border-color: inherit;\n}\n\n.blocklyResizeSE {\n cursor: se-resize;\n fill: #aaa;\n}\n\n.blocklyResizeSW {\n cursor: sw-resize;\n fill: #aaa;\n}\n\n.blocklyResizeLine {\n stroke: #515A5A;\n stroke-width: 1;\n}\n\n.blocklyHighlightedConnectionPath {\n fill: none;\n stroke: #fc3;\n stroke-width: 4px;\n}\n\n.blocklyPathLight {\n fill: none;\n stroke-linecap: round;\n stroke-width: 1;\n}\n\n.blocklySelected>.blocklyPathLight {\n display: none;\n}\n\n.blocklyDraggable {\n /* backup for browsers (e.g. IE11) that don\'t support grab */\n cursor: url("<<<PATH>>>/handopen.cur"), auto;\n cursor: grab;\n cursor: -webkit-grab;\n}\n\n /* backup for browsers (e.g. IE11) that don\'t support grabbing */\n.blocklyDragging {\n /* backup for browsers (e.g. IE11) that don\'t support grabbing */\n cursor: url("<<<PATH>>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n /* Changes cursor on mouse down. Not effective in Firefox because of\n https://bugzilla.mozilla.org/show_bug.cgi?id=771241 */\n.blocklyDraggable:active {\n /* backup for browsers (e.g. IE11) that don\'t support grabbing */\n cursor: url("<<<PATH>>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n/* Change the cursor on the whole drag surface in case the mouse gets\n ahead of block during a drag. This way the cursor is still a closed hand.\n */\n.blocklyBlockDragSurface .blocklyDraggable {\n /* backup for browsers (e.g. IE11) that don\'t support grabbing */\n cursor: url("<<<PATH>>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n.blocklyDragging.blocklyDraggingDelete {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyDragging>.blocklyPath,\n.blocklyDragging>.blocklyPathLight {\n fill-opacity: .8;\n stroke-opacity: .8;\n}\n\n.blocklyDragging>.blocklyPathDark {\n display: none;\n}\n\n.blocklyDisabled>.blocklyPath {\n fill-opacity: .5;\n stroke-opacity: .5;\n}\n\n.blocklyDisabled>.blocklyPathLight,\n.blocklyDisabled>.blocklyPathDark {\n display: none;\n}\n\n.blocklyInsertionMarker>.blocklyPath,\n.blocklyInsertionMarker>.blocklyPathLight,\n.blocklyInsertionMarker>.blocklyPathDark {\n fill-opacity: .2;\n stroke: none;\n}\n\n.blocklyMultilineText {\n font-family: monospace;\n}\n\n.blocklyNonEditableText>text {\n pointer-events: none;\n}\n\n.blocklyFlyout {\n position: absolute;\n z-index: 20;\n}\n\n.blocklyText text {\n cursor: default;\n}\n\n/*\n Don\'t allow users to select text. It gets annoying when trying to\n drag a block and selected text moves instead.\n*/\n.blocklySvg text,\n.blocklyBlockDragSurface text {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n cursor: inherit;\n}\n\n.blocklyHidden {\n display: none;\n}\n\n.blocklyFieldDropdown:not(.blocklyHidden) {\n display: block;\n}\n\n.blocklyIconGroup {\n cursor: default;\n}\n\n.blocklyIconGroup:not(:hover),\n.blocklyIconGroupReadonly {\n opacity: .6;\n}\n\n.blocklyIconShape {\n fill: #00f;\n stroke: #fff;\n stroke-width: 1px;\n}\n\n.blocklyIconSymbol {\n fill: #fff;\n}\n\n.blocklyMinimalBody {\n margin: 0;\n padding: 0;\n}\n\n.blocklyHtmlInput {\n border: none;\n border-radius: 4px;\n height: 100%;\n margin: 0;\n outline: none;\n padding: 0;\n width: 100%;\n text-align: center;\n display: block;\n box-sizing: border-box;\n}\n\n/* Edge and IE introduce a close icon when the input value is longer than a\n certain length. This affects our sizing calculations of the text input.\n Hiding the close icon to avoid that. */\n.blocklyHtmlInput::-ms-clear {\n display: none;\n}\n\n.blocklyMainBackground {\n stroke-width: 1;\n stroke: #c6c6c6; /* Equates to #ddd due to border being off-pixel. */\n}\n\n.blocklyMutatorBackground {\n fill: #fff;\n stroke: #ddd;\n stroke-width: 1;\n}\n\n.blocklyFlyoutBackground {\n fill: #ddd;\n fill-opacity: .8;\n}\n\n.blocklyMainWorkspaceScrollbar {\n z-index: 20;\n}\n\n.blocklyFlyoutScrollbar {\n z-index: 30;\n}\n\n.blocklyScrollbarHorizontal,\n.blocklyScrollbarVertical {\n position: absolute;\n outline: none;\n}\n\n.blocklyScrollbarBackground {\n opacity: 0;\n}\n\n.blocklyScrollbarHandle {\n fill: #ccc;\n}\n\n.blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,\n.blocklyScrollbarHandle:hover {\n fill: #bbb;\n}\n\n/* Darken flyout scrollbars due to being on a grey background. */\n/* By contrast, workspace scrollbars are on a white background. */\n.blocklyFlyout .blocklyScrollbarHandle {\n fill: #bbb;\n}\n\n.blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,\n.blocklyFlyout .blocklyScrollbarHandle:hover {\n fill: #aaa;\n}\n\n.blocklyInvalidInput {\n background: #faa;\n}\n\n.blocklyVerticalMarker {\n stroke-width: 3px;\n fill: rgba(255,255,255,.5);\n pointer-events: none;\n}\n\n.blocklyComputeCanvas {\n position: absolute;\n width: 0;\n height: 0;\n}\n\n.blocklyNoPointerEvents {\n pointer-events: none;\n}\n\n.blocklyContextMenu {\n border-radius: 4px;\n max-height: 100%;\n}\n\n.blocklyDropdownMenu {\n border-radius: 2px;\n padding: 0 !important;\n}\n\n.blocklyDropdownMenu .blocklyMenuItem {\n /* 28px on the left for icon or checkbox. */\n padding-left: 28px;\n}\n\n/* BiDi override for the resting state. */\n.blocklyDropdownMenu .blocklyMenuItemRtl {\n /* Flip left/right padding for BiDi. */\n padding-left: 5px;\n padding-right: 28px;\n}\n\n.blocklyWidgetDiv .blocklyMenu {\n background: #fff;\n border: 1px solid transparent;\n box-shadow: 0 0 3px 1px rgba(0,0,0,.3);\n font: normal 13px Arial, sans-serif;\n margin: 0;\n outline: none;\n padding: 4px 0;\n position: absolute;\n overflow-y: auto;\n overflow-x: hidden;\n max-height: 100%;\n z-index: 20000; /* Arbitrary, but some apps depend on it... */\n}\n\n.blocklyWidgetDiv .blocklyMenu.blocklyFocused {\n box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownDiv .blocklyMenu {\n background: inherit; /* Compatibility with gapi, reset from goog-menu */\n border: inherit; /* Compatibility with gapi, reset from goog-menu */\n font: normal 13px "Helvetica Neue", Helvetica, sans-serif;\n outline: none;\n position: relative; /* Compatibility with gapi, reset from goog-menu */\n z-index: 20000; /* Arbitrary, but some apps depend on it... */\n}\n\n/* State: resting. */\n.blocklyMenuItem {\n border: none;\n color: #000;\n cursor: pointer;\n list-style: none;\n margin: 0;\n /* 7em on the right for shortcut. */\n min-width: 7em;\n padding: 6px 15px;\n white-space: nowrap;\n}\n\n/* State: disabled. */\n.blocklyMenuItemDisabled {\n color: #ccc;\n cursor: inherit;\n}\n\n/* State: hover. */\n.blocklyMenuItemHighlight {\n background-color: rgba(0,0,0,.1);\n}\n\n/* State: selected/checked. */\n.blocklyMenuItemCheckbox {\n height: 16px;\n position: absolute;\n width: 16px;\n}\n\n.blocklyMenuItemSelected .blocklyMenuItemCheckbox {\n background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;\n float: left;\n margin-left: -24px;\n position: static; /* Scroll with the menu. */\n}\n\n.blocklyMenuItemRtl .blocklyMenuItemCheckbox {\n float: right;\n margin-right: -24px;\n}\n',
|
|
380
382
|
module$build$src$core$css={};module$build$src$core$css.inject=inject$$module$build$src$core$css;module$build$src$core$css.register=register$$module$build$src$core$css;var Rect$$module$build$src$core$utils$rect=class{constructor(a,b,c,d){this.top=a;this.bottom=b;this.left=c;this.right=d}contains(a,b){return a>=this.left&&a<=this.right&&b>=this.top&&b<=this.bottom}intersects(a){return!(this.left>a.right||this.right<a.left||this.top>a.bottom||this.bottom<a.top)}},module$build$src$core$utils$rect={};module$build$src$core$utils$rect.Rect=Rect$$module$build$src$core$utils$rect;var Svg$$module$build$src$core$utils$svg=class{constructor(a){this.tagName=a}toString(){return this.tagName}};Svg$$module$build$src$core$utils$svg.ANIMATE=new Svg$$module$build$src$core$utils$svg("animate");Svg$$module$build$src$core$utils$svg.CIRCLE=new Svg$$module$build$src$core$utils$svg("circle");Svg$$module$build$src$core$utils$svg.CLIPPATH=new Svg$$module$build$src$core$utils$svg("clipPath");Svg$$module$build$src$core$utils$svg.DEFS=new Svg$$module$build$src$core$utils$svg("defs");
|
|
381
383
|
Svg$$module$build$src$core$utils$svg.FECOMPOSITE=new Svg$$module$build$src$core$utils$svg("feComposite");Svg$$module$build$src$core$utils$svg.FECOMPONENTTRANSFER=new Svg$$module$build$src$core$utils$svg("feComponentTransfer");Svg$$module$build$src$core$utils$svg.FEFLOOD=new Svg$$module$build$src$core$utils$svg("feFlood");Svg$$module$build$src$core$utils$svg.FEFUNCA=new Svg$$module$build$src$core$utils$svg("feFuncA");Svg$$module$build$src$core$utils$svg.FEGAUSSIANBLUR=new Svg$$module$build$src$core$utils$svg("feGaussianBlur");
|
|
382
384
|
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");
|
|
@@ -390,7 +392,7 @@ this.svgGroup_.appendChild(this.svgRect_);this.useDragSurface_=!!a.getBlockDragS
|
|
|
390
392
|
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
393
|
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;
|
|
392
394
|
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,
|
|
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(){
|
|
395
|
+
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(){addClass$$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_,
|
|
394
396
|
"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,
|
|
395
397
|
b)}moveBy(a,b){const c=new (get$$module$build$src$core$events$utils(COMMENT_MOVE$$module$build$src$core$events$utils))(this),d=this.getRelativeToSurfaceXY();this.translate(d.x+a,d.y+b);this.xy_=new Coordinate$$module$build$src$core$utils$coordinate(d.x+a,d.y+b);c.recordNew();fire$$module$build$src$core$events$utils(c);this.workspace.resizeContents()}translate(a,b){this.xy_=new Coordinate$$module$build$src$core$utils$coordinate(a,b);this.getSvgRoot().setAttribute("transform","translate("+a+","+b+")")}moveToDragSurface(){if(this.useDragSurface_){var a=
|
|
396
398
|
this.getRelativeToSurfaceXY();this.clearTransformAttributes_();this.workspace.getBlockDragSurface().translateSurface(a.x,a.y);this.workspace.getBlockDragSurface().setBlocksAndShow(this.getSvgRoot())}}moveDuringDrag(a,b){a?a.translateSurface(b.x,b.y):(this.svgGroup_.translate_="translate("+b.x+","+b.y+")",this.svgGroup_.setAttribute("transform",this.svgGroup_.translate_+this.svgGroup_.skew_))}moveTo(a,b){this.translate(a,b)}clearTransformAttributes_(){this.getSvgRoot().removeAttribute("transform")}getBoundingRectangle(){var a=
|
|
@@ -405,33 +407,36 @@ const a=document.createElementNS(HTML_NS$$module$build$src$core$utils$dom,"body"
|
|
|
405
407
|
RESIZE_SIZE$$module$build$src$core$workspace_comment_svg.toString())},this.resizeGroup_);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.LINE,{"class":"blocklyResizeLine",x1:RESIZE_SIZE$$module$build$src$core$workspace_comment_svg/3,y1:RESIZE_SIZE$$module$build$src$core$workspace_comment_svg-1,x2:RESIZE_SIZE$$module$build$src$core$workspace_comment_svg-1,y2:RESIZE_SIZE$$module$build$src$core$workspace_comment_svg/3},this.resizeGroup_);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.LINE,
|
|
406
408
|
{"class":"blocklyResizeLine",x1:2*RESIZE_SIZE$$module$build$src$core$workspace_comment_svg/3,y1:RESIZE_SIZE$$module$build$src$core$workspace_comment_svg-1,x2:RESIZE_SIZE$$module$build$src$core$workspace_comment_svg-1,y2:2*RESIZE_SIZE$$module$build$src$core$workspace_comment_svg/3},this.resizeGroup_)}addDeleteDom_(){this.deleteGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{"class":"blocklyCommentDeleteIcon"},this.svgGroup_);this.deleteIconBorder_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.CIRCLE,
|
|
407
409
|
{"class":"blocklyDeleteIconShape",r:"7",cx:"7.5",cy:"7.5"},this.deleteGroup_);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.LINE,{x1:"5",y1:"10",x2:"10",y2:"5",stroke:"#fff","stroke-width":"2"},this.deleteGroup_);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.LINE,{x1:"5",y1:"5",x2:"10",y2:"10",stroke:"#fff","stroke-width":"2"},this.deleteGroup_)}resizeMouseDown_(a){this.unbindDragEvents_();isRightButton$$module$build$src$core$browser_events(a)||
|
|
408
|
-
(this.workspace.startDrag(a,new Coordinate$$module$build$src$core$utils$coordinate(this.workspace.RTL?-this.width_:this.width_,this.height_)),this.onMouseUpWrapper_=conditionalBind$$module$build$src$core$browser_events(document,"mouseup",this,this.resizeMouseUp_),this.onMouseMoveWrapper_=conditionalBind$$module$build$src$core$browser_events(document,"mousemove",this,this.resizeMouseMove_),this.workspace.hideChaff());a.stopPropagation()}deleteMouseDown_(a){addClass$$module$build$src$core$utils$dom(this.deleteIconBorder_,
|
|
409
|
-
"blocklyDeleteIconHighlighted");a.stopPropagation()}deleteMouseOut_(a){removeClass$$module$build$src$core$utils$dom(this.deleteIconBorder_,"blocklyDeleteIconHighlighted")}deleteMouseUp_(a){this.dispose();a.stopPropagation()}unbindDragEvents_(){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_=
|
|
410
|
-
this.unbindDragEvents_()}resizeMouseMove_(a){this.autoLayout_=!1;a=this.workspace.moveDrag(a);this.setSize_(this.RTL?-a.x:a.x,a.y)}resizeComment_(){const a=this.getHeightWidth(),b=WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg.TOP_OFFSET,c=2*TEXTAREA_OFFSET$$module$build$src$core$workspace_comment_svg;this.foreignObject_.setAttribute("width",a.width);this.foreignObject_.setAttribute("height",(a.height-b).toString());
|
|
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",
|
|
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",
|
|
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+
|
|
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_
|
|
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,
|
|
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");
|
|
410
|
+
(this.workspace.startDrag(a,new Coordinate$$module$build$src$core$utils$coordinate(this.workspace.RTL?-this.width_:this.width_,this.height_)),this.onMouseUpWrapper_=conditionalBind$$module$build$src$core$browser_events(document,"mouseup",this,this.resizeMouseUp_),this.onMouseMoveWrapper_=conditionalBind$$module$build$src$core$browser_events(document,"mousemove",this,this.resizeMouseMove_),this.workspace.hideChaff());a.stopPropagation()}deleteMouseDown_(a){this.deleteIconBorder_&&addClass$$module$build$src$core$utils$dom(this.deleteIconBorder_,
|
|
411
|
+
"blocklyDeleteIconHighlighted");a.stopPropagation()}deleteMouseOut_(a){this.deleteIconBorder_&&removeClass$$module$build$src$core$utils$dom(this.deleteIconBorder_,"blocklyDeleteIconHighlighted")}deleteMouseUp_(a){this.dispose();a.stopPropagation()}unbindDragEvents_(){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_=
|
|
412
|
+
null)}resizeMouseUp_(a){clearTouchIdentifier$$module$build$src$core$touch();this.unbindDragEvents_()}resizeMouseMove_(a){this.autoLayout_=!1;a=this.workspace.moveDrag(a);this.setSize_(this.RTL?-a.x:a.x,a.y)}resizeComment_(){const a=this.getHeightWidth(),b=WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg.TOP_OFFSET,c=2*TEXTAREA_OFFSET$$module$build$src$core$workspace_comment_svg;this.foreignObject_.setAttribute("width",a.width);this.foreignObject_.setAttribute("height",(a.height-b).toString());
|
|
413
|
+
this.RTL&&this.foreignObject_.setAttribute("x",(-a.width).toString());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",
|
|
414
|
+
a);this.svgHandleTarget_.setAttribute("height",WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg.TOP_OFFSET);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",
|
|
415
|
+
"translate("+(-a+RESIZE_SIZE$$module$build$src$core$workspace_comment_svg)+","+-RESIZE_SIZE$$module$build$src$core$workspace_comment_svg+") 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+
|
|
416
|
+
")")));this.resizeComment_()}disposeInternal_(){this.svgHandleTarget_=this.svgRectTarget_=this.foreignObject_=this.textarea_=null;this.disposed_=!0}setFocus(){this.focused_=!0;setTimeout(()=>{this.disposed_||(this.textarea_.focus(),this.addFocus(),this.svgRectTarget_&&addClass$$module$build$src$core$utils$dom(this.svgRectTarget_,"blocklyCommentTargetFocused"),this.svgHandleTarget_&&addClass$$module$build$src$core$utils$dom(this.svgHandleTarget_,"blocklyCommentHandleTargetFocused"))},0)}blurFocus(){this.focused_=
|
|
417
|
+
!1;setTimeout(()=>{this.disposed_||(this.textarea_.blur(),this.removeFocus(),this.svgRectTarget_&&removeClass$$module$build$src$core$utils$dom(this.svgRectTarget_,"blocklyCommentTargetFocused"),this.svgHandleTarget_&&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,
|
|
418
|
+
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,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");
|
|
417
419
|
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;
|
|
418
420
|
$.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;
|
|
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.
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
421
|
+
$.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.isBlank=!!a;a&&(this.blockId=a.id,this.workspaceId=a.workspace.id)}toJson(){const a=super.toJson();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");a.blockId=this.blockId;return a}fromJson(a){super.fromJson(a);this.blockId=a.blockId}},module$build$src$core$events$events_block_base=
|
|
422
|
+
{};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=b,this.name=c||void 0,this.oldValue=d,this.newValue=e)}toJson(){const a=super.toJson();if(!this.element)throw Error("The changed element is undefined. Either pass an element to the constructor, or call fromJson");a.element=this.element;a.name=this.name;a.oldValue=
|
|
423
|
+
this.oldValue;a.newValue=this.newValue;return a}fromJson(a){super.fromJson(a);this.element=a.element;this.name=a.name;this.oldValue=a.oldValue;this.newValue=a.newValue}isNull(){return this.oldValue===this.newValue}run(a){var b=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");b=b.getBlockById(this.blockId);if(!b)throw Error("The associated block is undefined. Either pass a block to the constructor, or call fromJson");
|
|
424
|
+
b.mutator&&b.mutator.setVisible(!1);a=a?this.newValue:this.oldValue;switch(this.element){case "field":(b=b.getField(this.name))?b.setValue(a):console.warn("Can't set non-existent field: "+this.name);break;case "comment":b.setCommentText(a||null);break;case "collapsed":b.setCollapsed(!!a);break;case "disabled":b.setEnabled(!a);break;case "inline":b.setInputsInline(!!a);break;case "mutation":const c=BlockChange$$module$build$src$core$events$events_block_change.getExtraBlockState_(b);b.loadExtraState?
|
|
425
|
+
b.loadExtraState(JSON.parse(a||"{}")):b.domToMutation&&b.domToMutation(textToDom$$module$build$src$core$xml(a||"<mutation/>"));fire$$module$build$src$core$events$utils(new BlockChange$$module$build$src$core$events$events_block_change(b,"mutation",null,c,a));break;default:console.warn("Unknown change type: "+this.element)}}static getExtraBlockState_(a){return a.saveExtraState?(a=a.saveExtraState())?JSON.stringify(a):"":a.mutationToDom?(a=a.mutationToDom())?domToText$$module$build$src$core$xml(a):"":
|
|
426
|
+
""}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,CHANGE$$module$build$src$core$events$utils,BlockChange$$module$build$src$core$events$events_block_change);var module$build$src$core$events$events_block_change={};module$build$src$core$events$events_block_change.BlockChange=BlockChange$$module$build$src$core$events$events_block_change;var DeserializationError$$module$build$src$core$serialization$exceptions=class extends Error{},MissingBlockType$$module$build$src$core$serialization$exceptions=class extends DeserializationError$$module$build$src$core$serialization$exceptions{constructor(a){super("Expected to find a 'type' property, defining the block type");this.state=a}},MissingConnection$$module$build$src$core$serialization$exceptions=class extends DeserializationError$$module$build$src$core$serialization$exceptions{constructor(a,
|
|
424
427
|
b,c){super(`The block ${b.toDevString()} is missing a(n) ${a}
|
|
425
428
|
connection`);this.block=b;this.state=c}},BadConnectionCheck$$module$build$src$core$serialization$exceptions=class extends DeserializationError$$module$build$src$core$serialization$exceptions{constructor(a,b,c,d){super(`The block ${c.toDevString()} could not connect its
|
|
426
429
|
${b} to its parent, because: ${a}`);this.childBlock=c;this.childState=d}},RealChildOfShadow$$module$build$src$core$serialization$exceptions=class extends DeserializationError$$module$build$src$core$serialization$exceptions{constructor(a){super("Encountered a real block which is defined as a child of a shadow\nblock. It is an invariant of Blockly that shadow blocks only have shadow\nchildren");this.state=a}},module$build$src$core$serialization$exceptions={};
|
|
427
430
|
module$build$src$core$serialization$exceptions.BadConnectionCheck=BadConnectionCheck$$module$build$src$core$serialization$exceptions;module$build$src$core$serialization$exceptions.DeserializationError=DeserializationError$$module$build$src$core$serialization$exceptions;module$build$src$core$serialization$exceptions.MissingBlockType=MissingBlockType$$module$build$src$core$serialization$exceptions;module$build$src$core$serialization$exceptions.MissingConnection=MissingConnection$$module$build$src$core$serialization$exceptions;
|
|
428
431
|
module$build$src$core$serialization$exceptions.RealChildOfShadow=RealChildOfShadow$$module$build$src$core$serialization$exceptions;var VARIABLES$$module$build$src$core$serialization$priorities=100,BLOCKS$$module$build$src$core$serialization$priorities=50,module$build$src$core$serialization$priorities={};module$build$src$core$serialization$priorities.BLOCKS=BLOCKS$$module$build$src$core$serialization$priorities;module$build$src$core$serialization$priorities.VARIABLES=VARIABLES$$module$build$src$core$serialization$priorities;var module$build$src$core$serialization$registry={};module$build$src$core$serialization$registry.register=register$$module$build$src$core$serialization$registry;module$build$src$core$serialization$registry.unregister=unregister$$module$build$src$core$serialization$registry;var saveBlock$$module$build$src$core$serialization$blocks=save$$module$build$src$core$serialization$blocks,BlockSerializer$$module$build$src$core$serialization$blocks=class{constructor(){this.priority=BLOCKS$$module$build$src$core$serialization$priorities}save(a){const b=[];for(const c of a.getTopBlocks(!1))(a=save$$module$build$src$core$serialization$blocks(c,{addCoordinates:!0,doFullSerialization:!1}))&&b.push(a);return b.length?{languageVersion:0,blocks:b}:null}load(a,b){a=a.blocks;for(const c of a)append$$module$build$src$core$serialization$blocks(c,
|
|
429
432
|
b,{recordUndo:getRecordUndo$$module$build$src$core$events$utils()})}clear(a){for(const b of a.getTopBlocks(!1))b.dispose(!1)}};register$$module$build$src$core$serialization$registry("blocks",new BlockSerializer$$module$build$src$core$serialization$blocks);var module$build$src$core$serialization$blocks={};module$build$src$core$serialization$blocks.append=append$$module$build$src$core$serialization$blocks;module$build$src$core$serialization$blocks.appendInternal=appendInternal$$module$build$src$core$serialization$blocks;
|
|
430
|
-
module$build$src$core$serialization$blocks.save=save$$module$build$src$core$serialization$blocks;var BlockCreate$$module$build$src$core$events$events_block_create=class extends BlockBase$$module$build$src$core$events$events_block_base{constructor(a){super(a);this.type=CREATE$$module$build$src$core$events$utils;a&&(a.isShadow()&&(this.recordUndo=!1),this.xml=blockToDomWithXY$$module$build$src$core$xml(a),this.ids=getDescendantIds$$module$build$src$core$events$utils(a),this.json=save$$module$build$src$core$serialization$blocks(a,{addCoordinates:!0}))}toJson(){const a=super.toJson();
|
|
431
|
-
a.ids=this.ids;a.json=this.json;this.recordUndo||(a.recordUndo=this.recordUndo);return a}fromJson(a){super.fromJson(a);this.xml=textToDom$$module$build$src$core$xml(a.xml);this.ids=a.ids;this.json=a.json;void 0!==a.recordUndo&&
|
|
433
|
+
module$build$src$core$serialization$blocks.save=save$$module$build$src$core$serialization$blocks;var BlockCreate$$module$build$src$core$events$events_block_create=class extends BlockBase$$module$build$src$core$events$events_block_base{constructor(a){super(a);this.type=CREATE$$module$build$src$core$events$utils;a&&(a.isShadow()&&(this.recordUndo=!1),this.xml=blockToDomWithXY$$module$build$src$core$xml(a),this.ids=getDescendantIds$$module$build$src$core$events$utils(a),this.json=save$$module$build$src$core$serialization$blocks(a,{addCoordinates:!0}))}toJson(){const a=super.toJson();if(!this.xml)throw Error("The block XML is undefined. Either pass a block to the constructor, or call fromJson");
|
|
434
|
+
if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!this.json)throw Error("The block JSON is undefined. Either pass a block to the constructor, or call fromJson");a.xml=domToText$$module$build$src$core$xml(this.xml);a.ids=this.ids;a.json=this.json;this.recordUndo||(a.recordUndo=this.recordUndo);return a}fromJson(a){super.fromJson(a);this.xml=textToDom$$module$build$src$core$xml(a.xml);this.ids=a.ids;this.json=a.json;void 0!==a.recordUndo&&
|
|
435
|
+
(this.recordUndo=a.recordUndo)}run(a){const b=this.getEventWorkspace_();if(!this.json)throw Error("The block JSON is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(a)append$$module$build$src$core$serialization$blocks(this.json,b);else for(a=0;a<this.ids.length;a++){const c=this.ids[a],d=b.getBlockById(c);d?d.dispose(!1):c===this.blockId&&console.warn("Can't uncreate non-existent block: "+
|
|
432
436
|
c)}}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,CREATE$$module$build$src$core$events$utils,BlockCreate$$module$build$src$core$events$events_block_create);var module$build$src$core$events$events_block_create={};module$build$src$core$events$events_block_create.BlockCreate=BlockCreate$$module$build$src$core$events$events_block_create;var BlockDelete$$module$build$src$core$events$events_block_delete=class extends BlockBase$$module$build$src$core$events$events_block_base{constructor(a){super(a);this.type=DELETE$$module$build$src$core$events$utils;if(a){if(a.getParent())throw Error("Connected blocks cannot be deleted.");a.isShadow()&&(this.recordUndo=!1);this.oldXml=blockToDomWithXY$$module$build$src$core$xml(a);this.ids=getDescendantIds$$module$build$src$core$events$utils(a);this.wasShadow=a.isShadow();this.oldJson=save$$module$build$src$core$serialization$blocks(a,
|
|
433
|
-
{addCoordinates:!0})}}toJson(){const a=super.toJson();
|
|
434
|
-
this.
|
|
437
|
+
{addCoordinates:!0})}}toJson(){const a=super.toJson();if(!this.oldXml)throw Error("The old block XML is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(void 0===this.wasShadow)throw Error("Whether the block was a shadow is undefined. Either pass a block to the constructor, or call fromJson");if(!this.oldJson)throw Error("The old block JSON is undefined. Either pass a block to the constructor, or call fromJson");
|
|
438
|
+
a.oldXml=domToText$$module$build$src$core$xml(this.oldXml);a.ids=this.ids;a.wasShadow=this.wasShadow;a.oldJson=this.oldJson;this.recordUndo||(a.recordUndo=this.recordUndo);return a}fromJson(a){super.fromJson(a);this.oldXml=textToDom$$module$build$src$core$xml(a.oldXml);this.ids=a.ids;this.wasShadow=a.wasShadow||"shadow"===this.oldXml.tagName.toLowerCase();this.oldJson=a.oldJson;void 0!==a.recordUndo&&(this.recordUndo=a.recordUndo)}run(a){const b=this.getEventWorkspace_();if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");
|
|
439
|
+
if(!this.oldJson)throw Error("The old block JSON is undefined. Either pass a block to the constructor, or call fromJson");if(a)for(a=0;a<this.ids.length;a++){const c=this.ids[a],d=b.getBlockById(c);d?d.dispose(!1):c===this.blockId&&console.warn("Can't delete non-existent block: "+c)}else append$$module$build$src$core$serialization$blocks(this.oldJson,b)}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,DELETE$$module$build$src$core$events$utils,BlockDelete$$module$build$src$core$events$events_block_delete);
|
|
435
440
|
var module$build$src$core$events$events_block_delete={};module$build$src$core$events$events_block_delete.BlockDelete=BlockDelete$$module$build$src$core$events$events_block_delete;var ConnectionType$$module$build$src$core$connection_type;(function(a){a[a.INPUT_VALUE=1]="INPUT_VALUE";a[a.OUTPUT_VALUE=2]="OUTPUT_VALUE";a[a.NEXT_STATEMENT=3]="NEXT_STATEMENT";a[a.PREVIOUS_STATEMENT=4]="PREVIOUS_STATEMENT"})(ConnectionType$$module$build$src$core$connection_type||(ConnectionType$$module$build$src$core$connection_type={}));$.module$build$src$core$connection_type={};$.module$build$src$core$connection_type.ConnectionType=ConnectionType$$module$build$src$core$connection_type;var Connection$$module$build$src$core$connection=class{constructor(a,b){this.type=b;this.targetConnection=null;this.disposed=!1;this.shadowDom_=this.check_=null;this.y=this.x=0;this.shadowState_=null;this.sourceBlock_=a}connect_(a){const b=ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE,c=this.getSourceBlock();var d=a.getSourceBlock();a.isConnected()&&a.disconnect();let e;if(this.isConnected()){const g=this.stashShadowState_(),h=this.targetBlock();h.isShadow()?h.dispose(!1):(this.disconnect(),
|
|
436
441
|
e=h);this.applyShadowState_(g)}let f;isEnabled$$module$build$src$core$events$utils()&&(f=new (get$$module$build$src$core$events$utils(MOVE$$module$build$src$core$events$utils))(d));connectReciprocally$$module$build$src$core$connection(this,a);d.setParent(c);f&&(f.recordNew(),fire$$module$build$src$core$events$utils(f));if(e)if(a=this.type===b?e.outputConnection:e.previousConnection,d=Connection$$module$build$src$core$connection.getConnectionForOrphanedConnection(d,a))a.connect(d);else a.onFailedConnect(this)}dispose(){if(this.isConnected()){this.setShadowStateInternal_();
|
|
437
442
|
const a=this.targetBlock();a&&a.unplug()}this.disposed=!0}getSourceBlock(){return this.sourceBlock_}isSuperior(){return this.type===ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE||this.type===ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT}isConnected(){return!!this.targetConnection}getConnectionChecker(){return this.sourceBlock_.workspace.connectionChecker}onFailedConnect(a){}connect(a){if(this.targetConnection===a)return!0;if(this.getConnectionChecker().canConnect(this,
|
|
@@ -441,8 +446,8 @@ null;b.setParent(null);c&&(c.recordNew(),fire$$module$build$src$core$events$util
|
|
|
441
446
|
(a=[a]),this.check_=a,this.onCheckChanged_()):this.check_=null;return this}getCheck(){return this.check_}setShadowDom(a){this.setShadowStateInternal_({shadowDom:a})}getShadowDom(a){return a&&this.targetBlock().isShadow()?blockToDom$$module$build$src$core$xml(this.targetBlock()):this.shadowDom_}setShadowState(a){this.setShadowStateInternal_({shadowState:a})}getShadowState(a){return a&&this.targetBlock()&&this.targetBlock().isShadow()?save$$module$build$src$core$serialization$blocks(this.targetBlock()):
|
|
442
447
|
this.shadowState_}neighbours(a){return[]}getParentInput(){let a=null;const b=this.sourceBlock_.inputList;for(let c=0;c<b.length;c++)if(b[c].connection===this){a=b[c];break}return a}toString(){const a=this.sourceBlock_;if(!a)return"Orphan Connection";if(a.outputConnection===this)var b="Output Connection of ";else if(a.previousConnection===this)b="Previous Connection of ";else if(a.nextConnection===this)b="Next Connection of ";else{b=null;for(let c=0,d;d=a.inputList[c];c++)if(d.connection===this){b=
|
|
443
448
|
d;break}if(b)b='Input "'+b.name+'" connection on ';else return console.warn("Connection not actually connected to sourceBlock_"),"Orphan Connection"}return b+a.toDevString()}stashShadowState_(){const a=this.getShadowDom(!0),b=this.getShadowState(!0);this.shadowState_=this.shadowDom_=null;return{shadowDom:a,shadowState:b}}applyShadowState_({shadowDom:a,shadowState:b}){this.shadowDom_=a;this.shadowState_=b}setShadowStateInternal_({shadowDom:a=null,shadowState:b=null}={}){this.shadowDom_=a;this.shadowState_=
|
|
444
|
-
b;(a=this.targetBlock())?a.isShadow()?(a.dispose(!1),this.respawnShadow_(),this.targetBlock()&&this.targetBlock().isShadow()&&this.serializeShadow_(this.targetBlock())):(a=this.createShadowBlock_(!1),this.serializeShadow_(a),a&&a.dispose(!1)):(this.respawnShadow_(),this.targetBlock()&&this.targetBlock().isShadow()&&this.serializeShadow_(this.targetBlock()))}createShadowBlock_(a){var b=this.getSourceBlock();const c=this.getShadowState(),d=this.getShadowDom();if(b.
|
|
445
|
-
appendInternal$$module$build$src$core$serialization$blocks(c,b.workspace,{parentConnection:a?this:void 0,isShadow:!0,recordUndo:!1});if(d){b=domToBlock$$module$build$src$core$xml(d,b.workspace);if(a)if(this.type===ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE){if(!b.outputConnection)throw Error("Shadow block is missing an output connection");if(!this.connect(b.outputConnection))throw Error("Could not connect shadow block to connection");}else if(this.type===ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT){if(!b.previousConnection)throw Error("Shadow block is missing previous connection");
|
|
449
|
+
b;(a=this.targetBlock())?a.isShadow()?(a.dispose(!1),this.respawnShadow_(),this.targetBlock()&&this.targetBlock().isShadow()&&this.serializeShadow_(this.targetBlock())):(a=this.createShadowBlock_(!1),this.serializeShadow_(a),a&&a.dispose(!1)):(this.respawnShadow_(),this.targetBlock()&&this.targetBlock().isShadow()&&this.serializeShadow_(this.targetBlock()))}createShadowBlock_(a){var b=this.getSourceBlock();const c=this.getShadowState(),d=this.getShadowDom();if(b.isDeadOrDying()||!c&&!d)return null;
|
|
450
|
+
if(c)return b=appendInternal$$module$build$src$core$serialization$blocks(c,b.workspace,{parentConnection:a?this:void 0,isShadow:!0,recordUndo:!1});if(d){b=domToBlock$$module$build$src$core$xml(d,b.workspace);if(a)if(this.type===ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE){if(!b.outputConnection)throw Error("Shadow block is missing an output connection");if(!this.connect(b.outputConnection))throw Error("Could not connect shadow block to connection");}else if(this.type===ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT){if(!b.previousConnection)throw Error("Shadow block is missing previous connection");
|
|
446
451
|
if(!this.connect(b.previousConnection))throw Error("Could not connect shadow block to connection");}else throw Error("Cannot connect a shadow block to a previous/output connection");return b}return null}serializeShadow_(a){a&&(this.shadowDom_=blockToDom$$module$build$src$core$xml(a),this.shadowState_=save$$module$build$src$core$serialization$blocks(a))}static getConnectionForOrphanedConnection(a,b){if(b.type===ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE)return getConnectionForOrphanedOutput$$module$build$src$core$connection(a,
|
|
447
452
|
b.getSourceBlock());a=a.lastConnectionInStack(!0);const c=b.getConnectionChecker();return a&&c.canConnect(b,a,!1)?a:null}};Connection$$module$build$src$core$connection.CAN_CONNECT=0;Connection$$module$build$src$core$connection.REASON_SELF_CONNECTION=1;Connection$$module$build$src$core$connection.REASON_WRONG_TYPE=2;Connection$$module$build$src$core$connection.REASON_TARGET_NULL=3;Connection$$module$build$src$core$connection.REASON_CHECKS_FAILED=4;
|
|
448
453
|
Connection$$module$build$src$core$connection.REASON_DIFFERENT_WORKSPACES=5;Connection$$module$build$src$core$connection.REASON_SHADOW_PARENT=6;Connection$$module$build$src$core$connection.REASON_DRAG_CHECKS_FAILED=7;Connection$$module$build$src$core$connection.REASON_PREVIOUS_AND_OUTPUT=8;var module$build$src$core$connection={};module$build$src$core$connection.Connection=Connection$$module$build$src$core$connection;var COLLAPSED_INPUT_NAME$$module$build$src$core$constants="_TEMP_COLLAPSED_INPUT",COLLAPSED_FIELD_NAME$$module$build$src$core$constants="_TEMP_COLLAPSED_FIELD",module$build$src$core$constants={};module$build$src$core$constants.COLLAPSED_FIELD_NAME=COLLAPSED_FIELD_NAME$$module$build$src$core$constants;module$build$src$core$constants.COLLAPSED_INPUT_NAME=COLLAPSED_INPUT_NAME$$module$build$src$core$constants;var module$build$src$core$utils$math={};module$build$src$core$utils$math.clamp=clamp$$module$build$src$core$utils$math;module$build$src$core$utils$math.toDegrees=toDegrees$$module$build$src$core$utils$math;module$build$src$core$utils$math.toRadians=toRadians$$module$build$src$core$utils$math;var ARROW_SIZE$$module$build$src$core$dropdowndiv=16,BORDER_SIZE$$module$build$src$core$dropdowndiv=1,ARROW_HORIZONTAL_PADDING$$module$build$src$core$dropdowndiv=12,PADDING_Y$$module$build$src$core$dropdowndiv=16,ANIMATION_TIME$$module$build$src$core$dropdowndiv=.25,animateOutTimer$$module$build$src$core$dropdowndiv=null,onHide$$module$build$src$core$dropdowndiv=null,renderedClassName$$module$build$src$core$dropdowndiv="",themeClassName$$module$build$src$core$dropdowndiv="",div$$module$build$src$core$dropdowndiv,
|
|
@@ -463,23 +468,23 @@ module$build$src$core$tooltip.getCustomTooltip=getCustomTooltip$$module$build$sr
|
|
|
463
468
|
module$build$src$core$tooltip.unbindMouseEvents=unbindMouseEvents$$module$build$src$core$tooltip;module$build$src$core$tooltip.unblock=unblock$$module$build$src$core$tooltip;var hsvSaturation$$module$build$src$core$utils$colour=.45,hsvValue$$module$build$src$core$utils$colour=.65,names$$module$build$src$core$utils$colour={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00"},module$build$src$core$utils$colour={};module$build$src$core$utils$colour.blend=blend$$module$build$src$core$utils$colour;
|
|
464
469
|
module$build$src$core$utils$colour.getHsvSaturation=getHsvSaturation$$module$build$src$core$utils$colour;module$build$src$core$utils$colour.getHsvValue=getHsvValue$$module$build$src$core$utils$colour;module$build$src$core$utils$colour.hexToRgb=hexToRgb$$module$build$src$core$utils$colour;module$build$src$core$utils$colour.hsvToHex=hsvToHex$$module$build$src$core$utils$colour;module$build$src$core$utils$colour.hueToHex=hueToHex$$module$build$src$core$utils$colour;
|
|
465
470
|
module$build$src$core$utils$colour.names=names$$module$build$src$core$utils$colour;module$build$src$core$utils$colour.parse=parse$$module$build$src$core$utils$colour;module$build$src$core$utils$colour.rgbToHex=rgbToHex$$module$build$src$core$utils$colour;module$build$src$core$utils$colour.setHsvSaturation=setHsvSaturation$$module$build$src$core$utils$colour;module$build$src$core$utils$colour.setHsvValue=setHsvValue$$module$build$src$core$utils$colour;var module$build$src$core$utils$parsing={};module$build$src$core$utils$parsing.checkMessageReferences=checkMessageReferences$$module$build$src$core$utils$parsing;module$build$src$core$utils$parsing.parseBlockColour=parseBlockColour$$module$build$src$core$utils$parsing;module$build$src$core$utils$parsing.replaceMessageReferences=replaceMessageReferences$$module$build$src$core$utils$parsing;module$build$src$core$utils$parsing.tokenizeInterpolation=tokenizeInterpolation$$module$build$src$core$utils$parsing;var Sentinel$$module$build$src$core$utils$sentinel=class{},module$build$src$core$utils$sentinel={};module$build$src$core$utils$sentinel.Sentinel=Sentinel$$module$build$src$core$utils$sentinel;var owner$$module$build$src$core$widgetdiv=null,dispose$$module$build$src$core$widgetdiv=null,rendererClassName$$module$build$src$core$widgetdiv="",themeClassName$$module$build$src$core$widgetdiv="",containerDiv$$module$build$src$core$widgetdiv,module$build$src$core$widgetdiv={};module$build$src$core$widgetdiv.createDom=createDom$$module$build$src$core$widgetdiv;module$build$src$core$widgetdiv.getDiv=getDiv$$module$build$src$core$widgetdiv;module$build$src$core$widgetdiv.hide=hide$$module$build$src$core$widgetdiv;
|
|
466
|
-
module$build$src$core$widgetdiv.hideIfOwner=hideIfOwner$$module$build$src$core$widgetdiv;module$build$src$core$widgetdiv.isVisible=isVisible$$module$build$src$core$widgetdiv;module$build$src$core$widgetdiv.positionWithAnchor=positionWithAnchor$$module$build$src$core$widgetdiv;module$build$src$core$widgetdiv.show=show$$module$build$src$core$widgetdiv;module$build$src$core$widgetdiv.testOnly_setDiv=testOnly_setDiv$$module$build$src$core$widgetdiv;var Field$$module$build$src$core$field=class{constructor(a,b,c){this.
|
|
467
|
-
|
|
468
|
-
this.sourceBlock_.workspace.rendered&&(this.constants_=this.sourceBlock_.workspace.getRenderer().getConstants());return this.constants_}getSourceBlock(){return this.sourceBlock_}init(){this.fieldGroup_||(this.fieldGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{}),this.isVisible()||(this.fieldGroup_.style.display="none"),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_),this.initView(),this.updateEditable(),
|
|
469
|
-
this.bindEvents_(),this.initModel())}initView(){this.createBorderRect_();this.createTextElement_()}initModel(){}createBorderRect_(){this.borderRect_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{rx:this.getConstants().FIELD_BORDER_RECT_RADIUS,ry:this.getConstants().FIELD_BORDER_RECT_RADIUS,x:0,y:0,height:this.size_.height,width:this.size_.width,"class":"blocklyFieldRect"},this.fieldGroup_)}createTextElement_(){this.textElement_=
|
|
470
|
-
{"class":"blocklyText"},this.fieldGroup_);this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.textElement_.setAttribute("dominant-baseline","central");this.textContent_=document.createTextNode("");this.textElement_.appendChild(this.textContent_)}bindEvents_(){bindMouseEvents$$module$build$src$core$tooltip(this.getClickTarget_());this.mouseDownWrapper_=conditionalBind$$module$build$src$core$browser_events(this.getClickTarget_(),
|
|
471
|
-
this.getValue();return a}saveState(a){a=this.saveLegacyState(Field$$module$build$src$core$field);return null!==a?a:this.getValue()}loadState(a){this.loadLegacyState(Field$$module$build$src$core$field,a)||this.setValue(a)}saveLegacyState(a){return a.prototype.saveState===this.saveState&&a.prototype.toXml!==this.toXml?(a=createElement$$module$build$src$core$utils$xml("field"),a.setAttribute("name",this.name||
|
|
472
|
-
"")):null}loadLegacyState(a,b){return a.prototype.loadState===this.loadState&&a.prototype.fromXml!==this.fromXml?(this.fromXml(textToDom$$module$build$src$core$xml(b)),!0):!1}dispose(){hideIfOwner$$module$build$src$core$dropdowndiv(this);hideIfOwner$$module$build$src$core$widgetdiv(this);unbindMouseEvents$$module$build$src$core$tooltip(this.getClickTarget_());this.mouseDownWrapper_&&
|
|
473
|
-
this.disposed=!0}updateEditable(){const a=this.fieldGroup_;this.EDITABLE&&a&&(this.enabled_&&this.sourceBlock_.isEditable()?(addClass$$module$build$src$core$utils$dom(a,"blocklyEditableText"),removeClass$$module$build$src$core$utils$dom(a,"blocklyNonEditableText"),a.style.cursor=this.CURSOR):(addClass$$module$build$src$core$utils$dom(a,"blocklyNonEditableText"),removeClass$$module$build$src$core$utils$dom(a,
|
|
474
|
-
|
|
475
|
-
a){this.visible_=a;var b=this.getSvgRoot();b&&(b.style.display=a?"block":"none")}}setValidator(a){this.validator_=a}getValidator(){return this.validator_}getSvgRoot(){return this.fieldGroup_}applyColour(){}render_(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_());this.updateSize_()}showEditor(a){this.isClickable()&&this.showEditor_(a)}showEditor_(a){}updateSize_(a){const b=this.getConstants();
|
|
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(),
|
|
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,
|
|
471
|
+
module$build$src$core$widgetdiv.hideIfOwner=hideIfOwner$$module$build$src$core$widgetdiv;module$build$src$core$widgetdiv.isVisible=isVisible$$module$build$src$core$widgetdiv;module$build$src$core$widgetdiv.positionWithAnchor=positionWithAnchor$$module$build$src$core$widgetdiv;module$build$src$core$widgetdiv.show=show$$module$build$src$core$widgetdiv;module$build$src$core$widgetdiv.testOnly_setDiv=testOnly_setDiv$$module$build$src$core$widgetdiv;var Field$$module$build$src$core$field=class{constructor(a,b,c){this.name=void 0;this.constants_=this.mouseDownWrapper_=this.textContent_=this.textElement_=this.borderRect_=this.fieldGroup_=this.markerSvg_=this.cursorSvg_=this.tooltip_=this.validator_=null;this.disposed=!1;this.maxDisplayLength=50;this.sourceBlock_=null;this.enabled_=this.visible_=this.isDirty_=!0;this.suffixField=this.prefixField=this.clickTarget_=null;this.EDITABLE=!0;this.SERIALIZABLE=!1;this.CURSOR="";this.value_="DEFAULT_VALUE"in
|
|
472
|
+
new.target.prototype?new.target.prototype.DEFAULT_VALUE:null;this.size_=new Size$$module$build$src$core$utils$size(0,0);a!==Field$$module$build$src$core$field.SKIP_SETUP&&(c&&this.configure_(c),this.setValue(a),b&&this.setValidator(b))}configure_(a){a.tooltip&&this.setTooltip(replaceMessageReferences$$module$build$src$core$utils$parsing(a.tooltip))}setSourceBlock(a){if(this.sourceBlock_)throw Error("Field already bound to a block");this.sourceBlock_=a}getConstants(){!this.constants_&&this.sourceBlock_&&
|
|
473
|
+
!this.sourceBlock_.isDeadOrDying()&&this.sourceBlock_.workspace.rendered&&(this.constants_=this.sourceBlock_.workspace.getRenderer().getConstants());return this.constants_}getSourceBlock(){return this.sourceBlock_}init(){this.fieldGroup_||(this.fieldGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{}),this.isVisible()||(this.fieldGroup_.style.display="none"),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_),this.initView(),this.updateEditable(),
|
|
474
|
+
this.setTooltip(this.tooltip_),this.bindEvents_(),this.initModel())}initView(){this.createBorderRect_();this.createTextElement_()}initModel(){}createBorderRect_(){this.borderRect_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{rx:this.getConstants().FIELD_BORDER_RECT_RADIUS,ry:this.getConstants().FIELD_BORDER_RECT_RADIUS,x:0,y:0,height:this.size_.height,width:this.size_.width,"class":"blocklyFieldRect"},this.fieldGroup_)}createTextElement_(){this.textElement_=
|
|
475
|
+
createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.TEXT,{"class":"blocklyText"},this.fieldGroup_);this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.textElement_.setAttribute("dominant-baseline","central");this.textContent_=document.createTextNode("");this.textElement_.appendChild(this.textContent_)}bindEvents_(){bindMouseEvents$$module$build$src$core$tooltip(this.getClickTarget_());this.mouseDownWrapper_=conditionalBind$$module$build$src$core$browser_events(this.getClickTarget_(),
|
|
476
|
+
"mousedown",this,this.onMouseDown_)}fromXml(a){this.setValue(a.textContent)}toXml(a){a.textContent=this.getValue();return a}saveState(a){a=this.saveLegacyState(Field$$module$build$src$core$field);return null!==a?a:this.getValue()}loadState(a){this.loadLegacyState(Field$$module$build$src$core$field,a)||this.setValue(a)}saveLegacyState(a){return a.prototype.saveState===this.saveState&&a.prototype.toXml!==this.toXml?(a=createElement$$module$build$src$core$utils$xml("field"),a.setAttribute("name",this.name||
|
|
477
|
+
""),domToText$$module$build$src$core$xml(this.toXml(a)).replace(' xmlns="https://developers.google.com/blockly/xml"',"")):null}loadLegacyState(a,b){return a.prototype.loadState===this.loadState&&a.prototype.fromXml!==this.fromXml?(this.fromXml(textToDom$$module$build$src$core$xml(b)),!0):!1}dispose(){hideIfOwner$$module$build$src$core$dropdowndiv(this);hideIfOwner$$module$build$src$core$widgetdiv(this);unbindMouseEvents$$module$build$src$core$tooltip(this.getClickTarget_());this.mouseDownWrapper_&&
|
|
478
|
+
unbind$$module$build$src$core$browser_events(this.mouseDownWrapper_);removeNode$$module$build$src$core$utils$dom(this.fieldGroup_);this.disposed=!0}updateEditable(){const a=this.fieldGroup_;this.EDITABLE&&a&&(this.enabled_&&this.sourceBlock_.isEditable()?(addClass$$module$build$src$core$utils$dom(a,"blocklyEditableText"),removeClass$$module$build$src$core$utils$dom(a,"blocklyNonEditableText"),a.style.cursor=this.CURSOR):(addClass$$module$build$src$core$utils$dom(a,"blocklyNonEditableText"),removeClass$$module$build$src$core$utils$dom(a,
|
|
479
|
+
"blocklyEditableText"),a.style.cursor=""))}setEnabled(a){this.enabled_=a;this.updateEditable()}isEnabled(){return this.enabled_}isClickable(){return this.enabled_&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&this.showEditor_!==Field$$module$build$src$core$field.prototype.showEditor_}isCurrentlyEditable(){return this.enabled_&&this.EDITABLE&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()}isSerializable(){let a=!1;this.name&&(this.SERIALIZABLE?a=!0:this.EDITABLE&&(console.warn("Detected an editable field that was not serializable. Please define SERIALIZABLE property as true on all editable custom fields. Proceeding with serialization."),
|
|
480
|
+
a=!0));return a}isVisible(){return this.visible_}setVisible(a){if(this.visible_!==a){this.visible_=a;var b=this.getSvgRoot();b&&(b.style.display=a?"block":"none")}}setValidator(a){this.validator_=a}getValidator(){return this.validator_}getSvgRoot(){return this.fieldGroup_}applyColour(){}render_(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_());this.updateSize_()}showEditor(a){this.isClickable()&&this.showEditor_(a)}showEditor_(a){}updateSize_(a){const b=this.getConstants();
|
|
481
|
+
a=void 0!==a?a:this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;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(),
|
|
482
|
+
d=this.size_.height/2;this.textElement_.setAttribute("x",this.sourceBlock_.RTL?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,
|
|
478
483
|
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,
|
|
479
484
|
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
485
|
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
486
|
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_.
|
|
487
|
+
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_.isDeadOrDying()&&(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
488
|
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
489
|
(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
490
|
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,9 +498,9 @@ a[a.A=65]="A";a[a.B=66]="B";a[a.C=67]="C";a[a.D=68]="D";a[a.E=69]="E";a[a.F=70]=
|
|
|
493
498
|
a[a.OPEN_SQUARE_BRACKET=219]="OPEN_SQUARE_BRACKET";a[a.BACKSLASH=220]="BACKSLASH";a[a.CLOSE_SQUARE_BRACKET=221]="CLOSE_SQUARE_BRACKET";a[a.WIN_KEY=224]="WIN_KEY";a[a.MAC_FF_META=224]="MAC_FF_META";a[a.MAC_WK_CMD_LEFT=91]="MAC_WK_CMD_LEFT";a[a.MAC_WK_CMD_RIGHT=93]="MAC_WK_CMD_RIGHT";a[a.WIN_IME=229]="WIN_IME";a[a.VK_NONAME=252]="VK_NONAME";a[a.PHANTOM=255]="PHANTOM"})(KeyCodes$$module$build$src$core$utils$keycodes||(KeyCodes$$module$build$src$core$utils$keycodes={}));
|
|
494
499
|
var module$build$src$core$utils$keycodes={};module$build$src$core$utils$keycodes.KeyCodes=KeyCodes$$module$build$src$core$utils$keycodes;var Menu$$module$build$src$core$menu=class{constructor(){this.menuItems_=[];this.roleName_=this.element_=this.onKeyDownHandler_=this.mouseLeaveHandler_=this.mouseEnterHandler_=this.clickHandler_=this.mouseOverHandler_=this.highlightedItem_=this.openingCoords=null}addChild(a){this.menuItems_.push(a)}render(a){const b=document.createElement("div");b.className="blocklyMenu goog-menu blocklyNonSelectable";b.tabIndex=0;this.roleName_&&setRole$$module$build$src$core$utils$aria(b,this.roleName_);this.element_=
|
|
495
500
|
b;for(let c=0,d;d=this.menuItems_[c];c++)b.appendChild(d.createDom());this.mouseOverHandler_=conditionalBind$$module$build$src$core$browser_events(b,"mouseover",this,this.handleMouseOver_,!0);this.clickHandler_=conditionalBind$$module$build$src$core$browser_events(b,"click",this,this.handleClick_,!0);this.mouseEnterHandler_=conditionalBind$$module$build$src$core$browser_events(b,"mouseenter",this,this.handleMouseEnter_,!0);this.mouseLeaveHandler_=conditionalBind$$module$build$src$core$browser_events(b,
|
|
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_&&
|
|
501
|
+
"mouseleave",this,this.handleMouseLeave_,!0);this.onKeyDownHandler_=conditionalBind$$module$build$src$core$browser_events(b,"keydown",this,this.handleKeyEvent_);a.appendChild(b);return 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_&&
|
|
497
502
|
(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_),
|
|
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(
|
|
503
|
+
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(a.classList.contains("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(),
|
|
499
504
|
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
505
|
-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
506
|
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();
|
|
@@ -504,31 +509,33 @@ b.height=a.scrollHeight;return b}},module$build$src$core$menu={};module$build$sr
|
|
|
504
509
|
"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));
|
|
505
510
|
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
511
|
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_=
|
|
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),
|
|
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();
|
|
512
|
+
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),a=JSON.parse(JSON.stringify(a))),
|
|
513
|
+
this.menuGenerator_=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();
|
|
509
514
|
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_=
|
|
510
515
|
createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.TSPAN,{},this.textElement_);this.arrow_.appendChild(document.createTextNode(this.sourceBlock_.RTL?FieldDropdown$$module$build$src$core$field_dropdown.ARROW_CHAR+" ":" "+FieldDropdown$$module$build$src$core$field_dropdown.ARROW_CHAR));this.sourceBlock_.RTL?this.textElement_.insertBefore(this.arrow_,this.textContent_):this.textElement_.appendChild(this.arrow_)}createSVGArrow_(){this.svgArrow_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.IMAGE,
|
|
511
516
|
{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_);this.svgArrow_.setAttributeNS(XLINK_NS$$module$build$src$core$utils$dom,"xlink:href",this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI)}showEditor_(a){this.dropdownCreate_();this.menu_.openingCoords=a&&"number"===typeof a.clientX?new Coordinate$$module$build$src$core$utils$coordinate(a.clientX,a.clientY):null;clearContent$$module$build$src$core$dropdowndiv();
|
|
512
|
-
this.menu_.render(getContentDiv$$module$build$src$core$dropdowndiv());
|
|
513
|
-
this.dropdownDispose_.bind(this));this.menu_.focus();this.selectedMenuItem_&&this.menu_.setHighlighted(this.selectedMenuItem_);this.applyColour()}dropdownCreate_(){const a=new Menu$$module$build$src$core$menu;a.setRole(Role$$module$build$src$core$utils$aria.LISTBOX);this.menu_=a;const b=this.getOptions(!1);this.selectedMenuItem_=null;for(let d=0;d<b.length;d++){var c=b[d][0];const e=b[d][1];if("object"===typeof c){const f=new Image(c.width,
|
|
514
|
-
e);c.setRole(Role$$module$build$src$core$utils$aria.OPTION);c.setRightToLeft(this.sourceBlock_.RTL);c.setCheckable(!0);a.addChild(c);c.setChecked(e===this.value_);e===this.value_&&(this.selectedMenuItem_=c);c.onAction(this.handleMenuActionEvent_,this)}}dropdownDispose_(){this.menu_&&this.menu_.dispose();this.selectedMenuItem_=this.menu_=null;this.applyColour()}handleMenuActionEvent_(a){hideIfOwner$$module$build$src$core$dropdowndiv(this
|
|
515
|
-
this.menuGenerator_;if(Array.isArray(a)){var b=!1;for(var c=0;c<a.length;c++){var d=a[c][0];"string"===typeof d?a[c][0]=replaceMessageReferences$$module$build$src$core$utils$parsing(d):(null!==d.alt&&(a[c][0].alt=replaceMessageReferences$$module$build$src$core$utils$parsing(d.alt)),b=!0)}if(!(b||2>a.length)){b=[];for(c=0;c<a.length;c++)b.push(a[c][0]);c=shortestStringLength$$module$build$src$core$utils$string(b);
|
|
516
|
-
c);!d&&!e||c<=d+e||(d&&(this.prefixField=b[0].substring(0,d-1)),e&&(this.suffixField=b[0].substr(1-e)),this.menuGenerator_=FieldDropdown$$module$build$src$core$field_dropdown.applyTrim_(a,d,e))}}}isOptionListDynamic(){return"function"===typeof this.menuGenerator_}getOptions(a){return this.isOptionListDynamic()?(this.generatedOptions_&&a||(this.generatedOptions_=this.menuGenerator_.call(this),
|
|
517
|
-
|
|
518
|
-
a.colourTertiary),this.menu_?this.borderRect_.setAttribute("fill",a.colourTertiary):this.borderRect_.setAttribute("fill","transparent"));this.sourceBlock_&&this.arrow_&&(this.sourceBlock_.isShadow()?
|
|
519
|
-
|
|
520
|
-
c
|
|
521
|
-
(
|
|
522
|
-
this.
|
|
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;
|
|
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}};
|
|
525
|
-
FieldDropdown$$module$build$src$core$field_dropdown.
|
|
526
|
-
|
|
517
|
+
a=this.menu_.render(getContentDiv$$module$build$src$core$dropdowndiv());addClass$$module$build$src$core$utils$dom(a,"blocklyDropdownMenu");if(this.getConstants().FIELD_DROPDOWN_COLOURED_DIV){a=this.sourceBlock_.isShadow()?this.sourceBlock_.getParent().getColour():this.sourceBlock_.getColour();const b=this.sourceBlock_.isShadow()?this.sourceBlock_.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary;if(!b)throw Error("The renderer did not properly initialize the block style");setColour$$module$build$src$core$dropdowndiv(a,
|
|
518
|
+
b)}showPositionedByField$$module$build$src$core$dropdowndiv(this,this.dropdownDispose_.bind(this));this.menu_.focus();this.selectedMenuItem_&&this.menu_.setHighlighted(this.selectedMenuItem_);this.applyColour()}dropdownCreate_(){const a=new Menu$$module$build$src$core$menu;a.setRole(Role$$module$build$src$core$utils$aria.LISTBOX);this.menu_=a;const b=this.getOptions(!1);this.selectedMenuItem_=null;for(let d=0;d<b.length;d++){var c=b[d][0];const e=b[d][1];if("object"===typeof c){const f=new Image(c.width,
|
|
519
|
+
c.height);f.src=c.src;f.alt=c.alt||"";c=f}c=new MenuItem$$module$build$src$core$menuitem(c,e);c.setRole(Role$$module$build$src$core$utils$aria.OPTION);c.setRightToLeft(this.sourceBlock_.RTL);c.setCheckable(!0);a.addChild(c);c.setChecked(e===this.value_);e===this.value_&&(this.selectedMenuItem_=c);c.onAction(this.handleMenuActionEvent_,this)}}dropdownDispose_(){this.menu_&&this.menu_.dispose();this.selectedMenuItem_=this.menu_=null;this.applyColour()}handleMenuActionEvent_(a){hideIfOwner$$module$build$src$core$dropdowndiv(this,
|
|
520
|
+
!0);this.onItemSelected_(this.menu_,a)}onItemSelected_(a,b){this.setValue(b.getValue())}trimOptions_(){const a=this.menuGenerator_;if(Array.isArray(a)){var b=!1;for(var c=0;c<a.length;c++){var d=a[c][0];"string"===typeof d?a[c][0]=replaceMessageReferences$$module$build$src$core$utils$parsing(d):(null!==d.alt&&(a[c][0].alt=replaceMessageReferences$$module$build$src$core$utils$parsing(d.alt)),b=!0)}if(!(b||2>a.length)){b=[];for(c=0;c<a.length;c++)b.push(a[c][0]);c=shortestStringLength$$module$build$src$core$utils$string(b);
|
|
521
|
+
d=commonWordPrefix$$module$build$src$core$utils$string(b,c);var e=commonWordSuffix$$module$build$src$core$utils$string(b,c);!d&&!e||c<=d+e||(d&&(this.prefixField=b[0].substring(0,d-1)),e&&(this.suffixField=b[0].substr(1-e)),this.menuGenerator_=FieldDropdown$$module$build$src$core$field_dropdown.applyTrim_(a,d,e))}}}isOptionListDynamic(){return"function"===typeof this.menuGenerator_}getOptions(a){return this.isOptionListDynamic()?(this.generatedOptions_&&a||(this.generatedOptions_=this.menuGenerator_.call(this),
|
|
522
|
+
validateOptions$$module$build$src$core$field_dropdown(this.generatedOptions_)),this.generatedOptions_):this.menuGenerator_}doClassValidation_(a){let b=!1;const c=this.getOptions(!0);for(let d=0,e;e=c[d];d++)if(e[1]===a){b=!0;break}return b?a:(this.sourceBlock_&&console.warn("Cannot set the dropdown's value to an unavailable option. Block type: "+this.sourceBlock_.type+", Field name: "+this.name+", Value: "+a),null)}doValueUpdate_(a){super.doValueUpdate_(a);a=this.getOptions(!0);for(let b=0,c;c=a[b];b++)c[1]===
|
|
523
|
+
this.value_&&(this.selectedOption_=c)}applyColour(){const a=this.sourceBlock_.style;if(!a.colourSecondary)throw Error("The renderer did not properly initialize the block style");if(!a.colourTertiary)throw Error("The renderer did not properly initialize the block style");this.borderRect_&&(this.borderRect_.setAttribute("stroke",a.colourTertiary),this.menu_?this.borderRect_.setAttribute("fill",a.colourTertiary):this.borderRect_.setAttribute("fill","transparent"));this.sourceBlock_&&this.arrow_&&(this.sourceBlock_.isShadow()?
|
|
524
|
+
this.arrow_.style.fill=a.colourSecondary:this.arrow_.style.fill=a.colourPrimary)}render_(){this.textContent_.nodeValue="";this.imageElement_.style.display="none";const a=this.selectedOption_&&this.selectedOption_[0];a&&"object"===typeof a?this.renderSelectedImage_(a):this.renderSelectedText_();this.positionBorderRect_()}renderSelectedImage_(a){this.imageElement_.style.display="";this.imageElement_.setAttributeNS(XLINK_NS$$module$build$src$core$utils$dom,"xlink:href",a.src);this.imageElement_.setAttribute("height",
|
|
525
|
+
a.height);this.imageElement_.setAttribute("width",a.width);const b=Number(a.height);a=Number(a.width);var c=!!this.borderRect_;const d=Math.max(c?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,b+IMAGE_Y_PADDING$$module$build$src$core$field_dropdown);c=c?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let e;e=this.svgArrow_?this.positionSVGArrow_(a+c,d/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2):getFastTextWidth$$module$build$src$core$utils$dom(this.arrow_,this.getConstants().FIELD_TEXT_FONTSIZE,
|
|
526
|
+
this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY);this.size_.width=a+e+2*c;this.size_.height=d;let f=0;this.sourceBlock_.RTL?this.imageElement_.setAttribute("x",(c+e).toString()):(f=a+e,this.textElement_.setAttribute("text-anchor","end"),this.imageElement_.setAttribute("x",c.toString()));this.imageElement_.setAttribute("y",(d/2-b/2).toString());this.positionTextElement_(f+c,a+e)}renderSelectedText_(){this.textContent_.nodeValue=this.getDisplayText_();addClass$$module$build$src$core$utils$dom(this.textElement_,
|
|
527
|
+
"blocklyDropdownText");this.textElement_.setAttribute("text-anchor","start");var a=!!this.borderRect_;const b=Math.max(a?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,this.getConstants().FIELD_TEXT_HEIGHT),c=getFastTextWidth$$module$build$src$core$utils$dom(this.textElement_,this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY);a=a?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let d=0;this.svgArrow_&&(d=this.positionSVGArrow_(c+
|
|
528
|
+
a,b/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2));this.size_.width=c+d+2*a;this.size_.height=b;this.positionTextElement_(a,c)}positionSVGArrow_(a,b){if(!this.svgArrow_)return 0;const c=this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,d=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_PADDING,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;
|
|
529
|
+
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,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}};
|
|
530
|
+
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;FieldDropdown$$module$build$src$core$field_dropdown.ARROW_CHAR=ANDROID$$module$build$src$core$utils$useragent?"\u25bc":"\u25be";
|
|
531
|
+
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.type=BUBBLE_OPEN$$module$build$src$core$events$utils;a&&(this.blockId=a.id,this.isOpen=b,this.bubbleType=c)}toJson(){const a=super.toJson();if(void 0===this.isOpen)throw Error("Whether this event is for opening the bubble is undefined. Either pass the value to the constructor, or call fromJson");if(!this.bubbleType)throw Error("The type of bubble is undefined. Either pass the value to the constructor, or call fromJson");
|
|
532
|
+
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=a.blockId}},BubbleType$$module$build$src$core$events$events_bubble_open;(function(a){a.MUTATOR="mutator";a.COMMENT="comment";a.WARNING="warning"})(BubbleType$$module$build$src$core$events$events_bubble_open||(BubbleType$$module$build$src$core$events$events_bubble_open={}));
|
|
533
|
+
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;module$build$src$core$events$events_bubble_open.BubbleType=BubbleType$$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
534
|
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
535
|
(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
536
|
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
537
|
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("+
|
|
538
|
+
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;a=this.position.x+this.origin_.x;b=this.position.y+this.origin_.y;this.outerSvg_&&setCssTransform$$module$build$src$core$utils$dom(this.outerSvg_,"translate("+a+"px,"+b+"px)")}resize(a){if(!a&&(a=this.workspace.getMetrics(),!a))return;this.oldHostMetrics_&&Scrollbar$$module$build$src$core$scrollbar.metricsAreEquivalent_(a,
|
|
532
539
|
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
540
|
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
541
|
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=
|
|
@@ -562,10 +569,10 @@ this.workspace_.RTL?this.anchorXY_.x-b.x-this.width_:b.x-this.anchorXY_.x;this.r
|
|
|
562
569
|
Bubble$$module$build$src$core$bubble.onMouseUpWrapper_=null);Bubble$$module$build$src$core$bubble.onMouseMoveWrapper_&&(unbind$$module$build$src$core$browser_events(Bubble$$module$build$src$core$bubble.onMouseMoveWrapper_),Bubble$$module$build$src$core$bubble.onMouseMoveWrapper_=null)}static bubbleMouseUp_(a){clearTouchIdentifier$$module$build$src$core$touch();Bubble$$module$build$src$core$bubble.unbindDragEvents_()}static textToDom(a){const b=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.TEXT,
|
|
563
570
|
{"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,
|
|
564
571
|
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;
|
|
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.
|
|
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.
|
|
567
|
-
a;this.isVisible()&&this.bubble_.setAnchorLocation(a)}computeIconLocation(){var a=this.
|
|
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
|
|
572
|
+
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;a||warn$$module$build$src$core$utils$deprecation("Calling the Icon constructor with a null block","version 9","version 10","a non-null block");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.getBlock().isInFlyout&&addClass$$module$build$src$core$utils$dom(this.iconGroup_,
|
|
573
|
+
"blocklyIconGroupReadonly"),this.drawIcon_(this.iconGroup_),this.getBlock().getSvgRoot().appendChild(this.iconGroup_),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.getBlock().workspace.isDragging()||this.getBlock().isInFlyout||isRightButton$$module$build$src$core$browser_events(a)||
|
|
574
|
+
this.setVisible(!this.isVisible())}applyColour(){this.bubble_&&this.isVisible()&&this.bubble_.setColour(this.getBlock().style.colourPrimary)}setIconLocation(a){this.iconXY_=a;this.bubble_&&this.isVisible()&&this.bubble_.setAnchorLocation(a)}computeIconLocation(){var a=this.getBlock().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(),
|
|
575
|
+
a)||this.setIconLocation(a)}getIconLocation(){return this.iconXY_}getCorrectedSize(){return new Size$$module$build$src$core$utils$size(this.SIZE,this.SIZE-2)}drawIcon_(a){}setVisible(a){}getBlock(){if(!this.block_)throw Error("Block is not set for this icon.");return this.block_}},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=!1;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=
|
|
569
576
|
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&&
|
|
570
577
|
(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"},
|
|
571
578
|
list_category:{colour:"260"},logic_category:{colour:"210"},loop_category:{colour:"120"},math_category:{colour:"230"},procedure_category:{colour:"290"},text_category:{colour:"160"},variable_category:{colour:"330"},variable_dynamic_category:{colour:"310"}},Classic$$module$build$src$core$theme$classic=new Theme$$module$build$src$core$theme("classic",defaultBlockStyles$$module$build$src$core$theme$classic,categoryStyles$$module$build$src$core$theme$classic),module$build$src$core$theme$classic={};
|
|
@@ -579,20 +586,20 @@ null!=(w=a.parentWorkspace)?w:null;this.plugins=y}static parseMoveOptions_(a,b){
|
|
|
579
586
|
"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;
|
|
580
587
|
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||
|
|
581
588
|
"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;
|
|
582
|
-
$.Mutator$$module$build$src$core$mutator=class extends Icon$$module$build$src$core$icon{constructor(a,b){super(
|
|
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"},
|
|
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.
|
|
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:
|
|
586
|
-
Position$$module$build$src$core$utils$toolbox.LEFT;
|
|
587
|
-
return this.svgDialog_}newWorkspaceSvg(a){throw Error("The implementation of newWorkspaceSvg should be monkey-patched in by blockly.ts");}updateEditable(){super.updateEditable();this.
|
|
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.
|
|
589
|
-
`${this.workspaceHeight_}`),this.workspace_.setCachedParentSvgSize(this.workspaceWidth_,this.workspaceHeight_);this.
|
|
590
|
-
a,"mutator"))
|
|
591
|
-
this.rootBlock_.
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
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.
|
|
589
|
+
$.Mutator$$module$build$src$core$mutator=class extends Icon$$module$build$src$core$icon{constructor(a,b){b||warn$$module$build$src$core$utils$deprecation("Calling the Mutator constructor without passing the block it is attached to","version 9","version 10","the constructor by passing the list of subblocks and the block instance to attach the mutator to");super(null!=b?b:null);this.workspace_=null;this.workspaceHeight_=this.workspaceWidth_=0;this.updateWorkspacePid_=this.sourceListener_=this.rootBlock_=
|
|
590
|
+
this.svgDialog_=null;this.quarkNames_=a}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",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
|
+
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.getBlock().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
|
+
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;var c=this.getBlock();b=new Options$$module$build$src$core$options({disable:!1,parentWorkspace:c.workspace,media:c.workspace.options.pathToMedia,rtl:c.RTL,horizontalLayout:!1,renderer:c.workspace.options.renderer,rendererOverrides:c.workspace.options.rendererOverrides});b.toolboxPosition=c.RTL?Position$$module$build$src$core$utils$toolbox.RIGHT:
|
|
593
|
+
Position$$module$build$src$core$utils$toolbox.LEFT;if(c=!!a)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
|
+
return this.svgDialog_}newWorkspaceSvg(a){throw Error("The implementation of newWorkspaceSvg should be monkey-patched in by blockly.ts");}updateEditable(){super.updateEditable();this.getBlock().isInFlyout||(this.getBlock().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.getBlock().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",
|
|
596
|
+
`${this.workspaceHeight_}`),this.workspace_.setCachedParentSvgSize(this.workspaceWidth_,this.workspaceHeight_);this.getBlock().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()){var b=this.getBlock();fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(BUBBLE_OPEN$$module$build$src$core$events$utils))(b,
|
|
597
|
+
a,"mutator"));if(a){this.bubble_=new Bubble$$module$build$src$core$bubble(b.workspace,this.createEditor_(),b.pathObject.svgPath,this.iconXY_,null,null);this.bubble_.setSvgId(b.id);this.bubble_.registerMoveEvent(this.onBubbleMove_.bind(this));var c=this.workspace_.options.languageTree;a=this.workspace_.getFlyout();c&&(a.init(this.workspace_),a.show(c));this.rootBlock_=b.decompose(this.workspace_);c=this.rootBlock_.getDescendants(!1);for(let d=0,e;e=c[d];d++)e.render();this.rootBlock_.setMovable(!1);
|
|
598
|
+
this.rootBlock_.setDeletable(!1);a?(c=2*a.CORNER_RADIUS,a=this.rootBlock_.RTL?a.getWidth()+c:c):a=c=16;b.RTL&&(a=-a);this.rootBlock_.moveBy(a,c);if(b.saveConnections){const d=this.rootBlock_;b.saveConnections(d);this.sourceListener_=()=>{const e=this.getBlock();e.saveConnections&&e.saveConnections(d)};b.workspace.addChangeListener(this.sourceListener_)}this.resizeBubble_();this.workspace_.addChangeListener(this.workspaceChanged_.bind(this));this.updateWorkspace_();this.applyColour()}else this.svgDialog_=
|
|
599
|
+
null,this.workspace_.dispose(),this.rootBlock_=this.workspace_=null,null==(c=this.bubble_)||c.dispose(),this.bubble_=null,this.workspaceHeight_=this.workspaceWidth_=0,this.sourceListener_&&(b.workspace.removeChangeListener(this.sourceListener_),this.sourceListener_=null)}}workspaceChanged_(a){this.shouldIgnoreMutatorEvent_(a)||this.updateWorkspacePid_||(this.updateWorkspacePid_=setTimeout(()=>{this.updateWorkspacePid_=null;this.updateWorkspace_()},0))}shouldIgnoreMutatorEvent_(a){return a.isUiEvent||
|
|
600
|
+
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_&&this.rootBlock_.workspace===this.workspace_){(a=
|
|
601
|
+
getGroup$$module$build$src$core$events$utils())||setGroup$$module$build$src$core$events$utils(!0);const d=this.getBlock();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
|
+
"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.getBlock().mutator=null;super.dispose()}updateBlockStyle(){var a=
|
|
596
603
|
this.workspace_;if(a&&a.getAllBlocks(!1)){const b=a.getAllBlocks(!1);for(let c=0,d;d=b[c];c++)d.setStyle(d.getStyleName());if(a=a.getFlyout()){a=a.getWorkspace().getAllBlocks(!1);for(let c=0,d;d=a[c];c++)d.setStyle(d.getStyleName())}}}static reconnect(a,b,c){if(!a||!a.getSourceBlock().workspace)return!1;c=b.getInput(c).connection;const d=a.targetBlock();return d&&d!==b||!c||c.targetConnection===a?!1:(c.isConnected()&&c.disconnect(),c.connect(a),!0)}static findParentWs(a){let b=null;if(a&&a.options){const c=
|
|
597
604
|
a.options.parentWorkspace;a.isFlyout?c&&c.options&&(b=c.options.parentWorkspace):c&&(b=c)}return b}};module$build$src$core$mutator={};module$build$src$core$mutator.Mutator=$.Mutator$$module$build$src$core$mutator;var allExtensions$$module$build$src$core$extensions=Object.create(null),TEST_ONLY$$module$build$src$core$extensions={allExtensions:allExtensions$$module$build$src$core$extensions};register$$module$build$src$core$extensions("parent_tooltip_when_inline",extensionParentTooltip$$module$build$src$core$extensions);$.module$build$src$core$extensions={};$.module$build$src$core$extensions.TEST_ONLY=TEST_ONLY$$module$build$src$core$extensions;$.module$build$src$core$extensions.apply=apply$$module$build$src$core$extensions;
|
|
598
605
|
$.module$build$src$core$extensions.buildTooltipForDropdown=buildTooltipForDropdown$$module$build$src$core$extensions;$.module$build$src$core$extensions.buildTooltipWithFieldText=buildTooltipWithFieldText$$module$build$src$core$extensions;$.module$build$src$core$extensions.isRegistered=isRegistered$$module$build$src$core$extensions;$.module$build$src$core$extensions.register=register$$module$build$src$core$extensions;$.module$build$src$core$extensions.registerMixin=registerMixin$$module$build$src$core$extensions;
|
|
@@ -608,7 +615,7 @@ this.location_.getParentInput();const b=a.getSourceBlock();a=b.inputList.indexOf
|
|
|
608
615
|
this.location_,b=a.getParentInput();const c=a.getSourceBlock();var d=c.inputList.indexOf(b);for(a=b.fieldRow.indexOf(a)+1;d<c.inputList.length;d++){b=c.inputList[d];const e=b.fieldRow;for(;a<e.length;){if(e[a].isClickable()||ASTNode$$module$build$src$core$keyboard_nav$ast_node.NAVIGATE_ALL_FIELDS)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createFieldNode(e[a]);a++}a=0;if(b.connection)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createInputNode(b)}return null}findPrevForInput_(){const a=
|
|
609
616
|
this.location_.getParentInput(),b=a.getSourceBlock();for(var c=b.inputList.indexOf(a);0<=c;c--){var d=b.inputList[c];if(d.connection&&d!==a)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createInputNode(d);d=d.fieldRow;for(let e=d.length-1;0<=e;e--){const f=d[e];if(f.isClickable()||ASTNode$$module$build$src$core$keyboard_nav$ast_node.NAVIGATE_ALL_FIELDS)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createFieldNode(f)}}return null}findPrevForField_(){var a=this.location_;
|
|
610
617
|
const b=a.getParentInput(),c=a.getSourceBlock();var d=c.inputList.indexOf(b);for(a=b.fieldRow.indexOf(a)-1;0<=d;d--){var e=c.inputList[d];if(e.connection&&e!==b)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createInputNode(e);for(e=e.fieldRow;-1<a;){if(e[a].isClickable()||ASTNode$$module$build$src$core$keyboard_nav$ast_node.NAVIGATE_ALL_FIELDS)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createFieldNode(e[a]);a--}0<=d-1&&(a=c.inputList[d-1].fieldRow.length-1)}return null}navigateBetweenStacks_(a){var b=
|
|
611
|
-
this.getLocation();b.getSourceBlock&&(b=b.getSourceBlock());if(!b||b.
|
|
618
|
+
this.getLocation();b.getSourceBlock&&(b=b.getSourceBlock());if(!b||b.isDeadOrDying())return null;const c=b.getRootBlock();b=c.workspace.getTopBlocks(!0);for(let d=0;d<b.length;d++)if(c.id===b[d].id)return a=d+(a?1:-1),-1===a||a===b.length?null:ASTNode$$module$build$src$core$keyboard_nav$ast_node.createStackNode(b[a]);throw Error("Couldn't find "+(a?"next":"previous")+" stack?!");}findTopASTNodeForBlock_(a){const b=getParentConnection$$module$build$src$core$keyboard_nav$ast_node(a);return b?ASTNode$$module$build$src$core$keyboard_nav$ast_node.createConnectionNode(b):
|
|
612
619
|
ASTNode$$module$build$src$core$keyboard_nav$ast_node.createBlockNode(a)}getOutAstNodeForBlock_(a){if(!a)return null;a=a.getTopStackBlock();const b=getParentConnection$$module$build$src$core$keyboard_nav$ast_node(a);return b&&b.targetConnection&&b.targetConnection.getParentInput()?ASTNode$$module$build$src$core$keyboard_nav$ast_node.createInputNode(b.targetConnection.getParentInput()):ASTNode$$module$build$src$core$keyboard_nav$ast_node.createStackNode(a)}findFirstFieldOrInput_(a){a=a.inputList;for(let b=
|
|
613
620
|
0;b<a.length;b++){const c=a[b],d=c.fieldRow;for(let e=0;e<d.length;e++){const f=d[e];if(f.isClickable()||ASTNode$$module$build$src$core$keyboard_nav$ast_node.NAVIGATE_ALL_FIELDS)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createFieldNode(f)}if(c.connection)return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createInputNode(c)}return null}getSourceBlock(){return this.getType()===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.BLOCK?this.getLocation():this.getType()===
|
|
614
621
|
ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.STACK?this.getLocation():this.getType()===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.WORKSPACE?null:this.getLocation().getSourceBlock()}next(){switch(this.type_){case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.STACK:return this.navigateBetweenStacks_(!0);case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.OUTPUT:return ASTNode$$module$build$src$core$keyboard_nav$ast_node.createBlockNode(this.location_.getSourceBlock());
|
|
@@ -625,29 +632,29 @@ a):null}static createInputNode(a){return a&&a.connection?new ASTNode$$module$bui
|
|
|
625
632
|
a):null}static createWorkspaceNode(a,b){return b&&a?new ASTNode$$module$build$src$core$keyboard_nav$ast_node(ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.WORKSPACE,a,{wsCoordinate:b}):null}static createTopNode(a){const b=getParentConnection$$module$build$src$core$keyboard_nav$ast_node(a);return b?ASTNode$$module$build$src$core$keyboard_nav$ast_node.createConnectionNode(b):ASTNode$$module$build$src$core$keyboard_nav$ast_node.createBlockNode(a)}};
|
|
626
633
|
ASTNode$$module$build$src$core$keyboard_nav$ast_node.NAVIGATE_ALL_FIELDS=!1;ASTNode$$module$build$src$core$keyboard_nav$ast_node.DEFAULT_OFFSET_Y=-20;(function(a){a=a.types||(a.types={});a.FIELD="field";a.BLOCK="block";a.INPUT="input";a.OUTPUT="output";a.NEXT="next";a.PREVIOUS="previous";a.STACK="stack";a.WORKSPACE="workspace"})(ASTNode$$module$build$src$core$keyboard_nav$ast_node||(ASTNode$$module$build$src$core$keyboard_nav$ast_node={}));var module$build$src$core$keyboard_nav$ast_node={};
|
|
627
634
|
module$build$src$core$keyboard_nav$ast_node.ASTNode=ASTNode$$module$build$src$core$keyboard_nav$ast_node;var Block$$module$build$src$core$block=class{constructor(a,b,c){this.data=null;this.disposed=!1;this.hue_=null;this.colour_="#000000";this.styleName_="";this.loadExtraState=this.saveExtraState=this.domToMutation=this.mutationToDom=this.init=void 0;this.suppressPrefixSuffix=!1;this.decompose=this.compose=this.getDeveloperVariables=void 0;this.previousConnection=this.nextConnection=this.outputConnection=null;this.inputList=[];this.inputsInline=void 0;this.disabled=!1;this.tooltip="";this.contextMenu=
|
|
628
|
-
!0;this.parentBlock_=null;this.childBlocks_=[];this.editable_=this.movable_=this.deletable_=!0;this.collapsed_=this.isShadow_=!1;this.
|
|
635
|
+
!0;this.parentBlock_=null;this.childBlocks_=[];this.editable_=this.movable_=this.deletable_=!0;this.collapsed_=this.isShadow_=!1;this.outputShape_=null;this.disposing=!1;this.comment=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,
|
|
629
636
|
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);
|
|
630
637
|
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=
|
|
631
|
-
this.inputsInline;"function"===typeof this.onchange&&this.setOnChange(this.onchange)}dispose(a){if(!this.
|
|
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&&
|
|
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=
|
|
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,
|
|
635
|
-
[];this.outputConnection&&a.push(this.outputConnection);this.previousConnection&&a.push(this.previousConnection);this.nextConnection&&a.push(this.nextConnection);for(let b=0,c;c=this.inputList[b];b++)c.connection&&a.push(c.connection);return a}lastConnectionInStack(a){let b=this.nextConnection;for(;b;){const c=b.targetBlock();if(!c||a&&c.isShadow())return b;b=c.nextConnection}return null}bumpNeighbours(){}getParent(){return this.parentBlock_}getInputWithBlock(a){for(let b=
|
|
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;
|
|
638
|
+
this.inputsInline;"function"===typeof this.onchange&&this.setOnChange(this.onchange)}dispose(a){if(!this.isDeadOrDying()){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
|
+
this.workspace.removeBlockById(this.id);this.disposing=!0;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}}}isDeadOrDying(){return this.disposing||this.disposed}initModel(){for(let a=0,b;b=this.inputList[a];a++)for(let c=0,d;d=b.fieldRow[c];c++)d.initModel&&
|
|
640
|
+
d.initModel()}unplug(a){this.outputConnection&&this.unplugFromRow_(a);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=
|
|
641
|
+
null;for(let b=0;b<this.inputList.length;b++){const c=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,
|
|
642
|
+
a,!1)&&b.connect(a))}getConnections_(a){a=[];this.outputConnection&&a.push(this.outputConnection);this.previousConnection&&a.push(this.previousConnection);this.nextConnection&&a.push(this.nextConnection);for(let b=0,c;c=this.inputList[b];b++)c.connection&&a.push(c.connection);return a}lastConnectionInStack(a){let b=this.nextConnection;for(;b;){const c=b.targetBlock();if(!c||a&&c.isShadow())return b;b=c.nextConnection}return null}bumpNeighbours(){}getParent(){return this.parentBlock_}getInputWithBlock(a){for(let b=
|
|
643
|
+
0,c;c=this.inputList[b];b++)if(c.connection&&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;
|
|
637
644
|
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&&
|
|
638
645
|
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=
|
|
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.
|
|
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.
|
|
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_=
|
|
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=
|
|
643
|
-
a)return e;return null}getVars(){const a=[];for(let b=0,c;c=this.inputList[b];b++)for(let d=0,e;e=c.fieldRow[d];d++)e.referencesVariables()&&a.push(e.getValue());return a}getVarModels(){const a=[];for(let b=0,c;c=this.inputList[b];b++)for(let d=0,e;e=c.fieldRow[d];d++)if(e.referencesVariables()){const f=this.workspace.getVariableById(e.getValue());f&&a.push(f)}return a}updateVarName(a){for(let b=0,c;c=this.inputList[b];b++)for(let d=0,e;e=c.fieldRow[d];d++)e.referencesVariables()&&
|
|
644
|
-
e.refreshVariableName()}renameVarById(a,b){for(let c=0,d;d=this.inputList[c];c++)for(let e=0,f;f=d.fieldRow[e];e++)f.referencesVariables()&&a===f.getValue()&&f.setValue(b)}getFieldValue(a){return(a=this.getField(a))?a.getValue():null}setFieldValue(a,b){const c=this.getField(b);if(!c)throw Error('Field "'+b+'" not found.');c.setValue(a)}setPreviousStatement(a,b){if(a)void 0===b&&(b=null),this.previousConnection||(this.previousConnection=this.makeConnection_(ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT)),
|
|
646
|
+
[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.isDeadOrDying()&&!this.workspace.options.readOnly}setDeletable(a){this.deletable_=a}isMovable(){return this.movable_&&!this.isShadow_&&!this.isDeadOrDying()&&!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
|
+
!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.isDeadOrDying()&&!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);
|
|
648
|
+
if(c.length!==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_=
|
|
649
|
+
a}setOnChange(a){if(a&&"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=
|
|
650
|
+
0,e;e=c.fieldRow[d];d++)if(e.name===a)return e;return null}getVars(){const a=[];for(let b=0,c;c=this.inputList[b];b++)for(let d=0,e;e=c.fieldRow[d];d++)e.referencesVariables()&&a.push(e.getValue());return a}getVarModels(){const a=[];for(let b=0,c;c=this.inputList[b];b++)for(let d=0,e;e=c.fieldRow[d];d++)if(e.referencesVariables()){const f=this.workspace.getVariableById(e.getValue());f&&a.push(f)}return a}updateVarName(a){for(let b=0,c;c=this.inputList[b];b++)for(let d=0,e;e=c.fieldRow[d];d++)e.referencesVariables()&&
|
|
651
|
+
a.getId()===e.getValue()&&e.refreshVariableName()}renameVarById(a,b){for(let c=0,d;d=this.inputList[c];c++)for(let e=0,f;f=d.fieldRow[e];e++)f.referencesVariables()&&a===f.getValue()&&f.setValue(b)}getFieldValue(a){return(a=this.getField(a))?a.getValue():null}setFieldValue(a,b){const c=this.getField(b);if(!c)throw Error('Field "'+b+'" not found.');c.setValue(a)}setPreviousStatement(a,b){if(a)void 0===b&&(b=null),this.previousConnection||(this.previousConnection=this.makeConnection_(ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT)),
|
|
645
652
|
this.previousConnection.setCheck(b);else if(this.previousConnection){if(this.previousConnection.isConnected())throw Error("Must disconnect previous statement before removing connection.");this.previousConnection.dispose();this.previousConnection=null}}setNextStatement(a,b){if(a)void 0===b&&(b=null),this.nextConnection||(this.nextConnection=this.makeConnection_(ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT)),this.nextConnection.setCheck(b);else if(this.nextConnection){if(this.nextConnection.isConnected())throw Error("Must disconnect next statement before removing connection.");
|
|
646
653
|
this.nextConnection.dispose();this.nextConnection=null}}setOutput(a,b){if(a)void 0===b&&(b=null),this.outputConnection||(this.outputConnection=this.makeConnection_(ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE)),this.outputConnection.setCheck(b);else if(this.outputConnection){if(this.outputConnection.isConnected())throw Error("Must disconnect output value before removing connection.");this.outputConnection.dispose();this.outputConnection=null}}setInputsInline(a){this.inputsInline!==
|
|
647
654
|
a&&(fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CHANGE$$module$build$src$core$events$utils))(this,"inline",null,this.inputsInline,a)),this.inputsInline=a)}getInputsInline(){if(void 0!==this.inputsInline)return this.inputsInline;for(var a=1;a<this.inputList.length;a++)if(this.inputList[a-1].type===inputTypes$$module$build$src$core$input_types.DUMMY&&this.inputList[a].type===inputTypes$$module$build$src$core$input_types.DUMMY)return!1;for(a=1;a<this.inputList.length;a++)if(this.inputList[a-
|
|
648
655
|
1].type===inputTypes$$module$build$src$core$input_types.VALUE&&this.inputList[a].type===inputTypes$$module$build$src$core$input_types.DUMMY)return!0;return!1}setOutputShape(a){this.outputShape_=a}getOutputShape(){return this.outputShape_}isEnabled(){return!this.disabled}setEnabled(a){if(this.isEnabled()!==a){const b=this.disabled;this.disabled=!a;fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CHANGE$$module$build$src$core$events$utils))(this,"disabled",null,
|
|
649
656
|
b,!a))}}getInheritedDisabled(){let a=this.getSurroundParent();for(;a;){if(a.disabled)return!0;a=a.getSurroundParent()}return!1}isCollapsed(){return this.collapsed_}setCollapsed(a){this.collapsed_!==a&&(fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CHANGE$$module$build$src$core$events$utils))(this,"collapsed",null,this.collapsed_,a)),this.collapsed_=a)}toString(a,b){function c(l){let m=l.getCheck();!m&&l.targetConnection&&(m=l.targetConnection.getCheck());return!!m&&
|
|
650
|
-
(-1!==m.indexOf("Boolean")||-1!==m.indexOf("Number"))}function d(){let l,m;g&&g.getType()===(null==(l=h)?void 0:l.getType())&&g.getLocation()===(null==(m=h)?void 0:m.getLocation())&&(g=null)}
|
|
657
|
+
(-1!==m.indexOf("Boolean")||-1!==m.indexOf("Number"))}function d(){let l,m;g&&g.getType()===(null==(l=h)?void 0:l.getType())&&g.getLocation()===(null==(m=h)?void 0:m.getLocation())&&(g=null)}var e=[];b=b||"?";const f=ASTNode$$module$build$src$core$keyboard_nav$ast_node.NAVIGATE_ALL_FIELDS;ASTNode$$module$build$src$core$keyboard_nav$ast_node.NAVIGATE_ALL_FIELDS=!0;let g=ASTNode$$module$build$src$core$keyboard_nav$ast_node.createBlockNode(this);const h=g;for(;g;){switch(g.getType()){case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.INPUT:var k=
|
|
651
658
|
g.getLocation();g.in()?c(k)&&e.push("("):e.push(b);break;case ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.FIELD:k=g.getLocation(),k.name!==COLLAPSED_FIELD_NAME$$module$build$src$core$constants&&e.push(k.getText())}k=g;g=k.in()||k.next();if(!g){g=k.out();for(d();g&&!g.next();)g=g.out(),d(),g&&g.getType()===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.INPUT&&c(g.getLocation())&&e.push(")");g&&(g=g.next())}}ASTNode$$module$build$src$core$keyboard_nav$ast_node.NAVIGATE_ALL_FIELDS=
|
|
652
659
|
f;for(b=2;b<e.length;b++)"("===e[b-2]&&")"===e[b]&&(e[b-2]=e[b-1],e.splice(b-1,2));e=e.reduce(function(l,m){return l+("("===l.substr(-1)||")"===m?"":" ")+m},"");e=e.trim()||"???";a&&e.length>a&&(e=e.substring(0,a-3)+"...");return e}appendValueInput(a){return this.appendInput_(inputTypes$$module$build$src$core$input_types.VALUE,a)}appendStatementInput(a){return this.appendInput_(inputTypes$$module$build$src$core$input_types.STATEMENT,a)}appendDummyInput(a){return this.appendInput_(inputTypes$$module$build$src$core$input_types.DUMMY,
|
|
653
660
|
a||"")}jsonInit(a){var b=a.type?'Block "'+a.type+'": ':"";if(a.output&&a.previousStatement)throw Error(b+"Must not have both an output and a previousStatement.");a.style&&a.style.hat&&(this.hat=a.style.hat,a.style=null);if(a.style&&a.colour)throw Error(b+"Must not have both a colour and a style.");a.style?this.jsonInitStyle_(a,b):this.jsonInitColour_(a,b);for(var c=0;void 0!==a["message"+c];)this.interpolate_(a["message"+c],a["args"+c]||[],a["lastDummyAlign"+c],b),c++;void 0!==a.inputsInline&&this.setInputsInline(a.inputsInline);
|
|
@@ -667,13 +674,13 @@ Block$$module$build$src$core$block.COLLAPSED_INPUT_NAME=COLLAPSED_INPUT_NAME$$mo
|
|
|
667
674
|
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",
|
|
668
675
|
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_=
|
|
669
676
|
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=
|
|
670
|
-
"blocklyCommentTextarea";b.setAttribute("dir",this.
|
|
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.
|
|
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.
|
|
673
|
-
a,"comment")),(this.model_.pinned=a)?this.createBubble_():this.disposeBubble_())}createBubble_(){this.
|
|
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.
|
|
677
|
+
"blocklyCommentTextarea";b.setAttribute("dir",this.getBlock().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
|
+
"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.getBlock(),"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.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.getBlock(),
|
|
680
|
+
a,"comment")),(this.model_.pinned=a)?this.createBubble_():this.disposeBubble_())}createBubble_(){this.getBlock().isEditable()?this.createEditableBubble_():this.createNonEditableBubble_()}createEditableBubble_(){const a=this.getBlock();this.bubble_=new Bubble$$module$build$src$core$bubble(a.workspace,this.createEditor_(),a.pathObject.svgPath,this.iconXY_,this.model_.size.width,this.model_.size.height);this.bubble_.setSvgId(a.id);this.bubble_.registerResizeEvent(this.onBubbleResize_.bind(this));this.applyColour()}createNonEditableBubble_(){let a;
|
|
681
|
+
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.getBlock(),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
682
|
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,
|
|
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.
|
|
683
|
+
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.getBlock().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");
|
|
677
684
|
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;
|
|
678
685
|
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;
|
|
679
686
|
$.module$build$src$core$contextmenu.commentDuplicateOption=commentDuplicateOption$$module$build$src$core$contextmenu;$.module$build$src$core$contextmenu.dispose=dispose$$module$build$src$core$contextmenu;$.module$build$src$core$contextmenu.getCurrentBlock=getCurrentBlock$$module$build$src$core$contextmenu;$.module$build$src$core$contextmenu.hide=hide$$module$build$src$core$contextmenu;$.module$build$src$core$contextmenu.setCurrentBlock=setCurrentBlock$$module$build$src$core$contextmenu;
|
|
@@ -690,14 +697,14 @@ return a}out(){var a=this.getCurNode();if(!a)return null;(a=a.out())&&a.getType(
|
|
|
690
697
|
if(b(c))return c;if(c)return this.getNextNode_(c,b);a=this.findSiblingOrParent_(a.out());return b(a)?a:a?this.getNextNode_(a,b):null}getPreviousNode_(a,b){if(!a)return null;let c=a.prev();c=c?this.getRightMostChild_(c):a.out();return b(c)?c:c?this.getPreviousNode_(c,b):null}validNode_(a){let b=!1;a=a&&a.getType();if(a===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.OUTPUT||a===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.INPUT||a===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.FIELD||
|
|
691
698
|
a===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.NEXT||a===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.PREVIOUS||a===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.WORKSPACE)b=!0;return b}findSiblingOrParent_(a){if(!a)return null;const b=a.next();return b?b:this.findSiblingOrParent_(a.out())}getRightMostChild_(a){if(!a.in())return a;for(a=a.in();a&&a.next();)a=a.next();return this.getRightMostChild_(a)}};
|
|
692
699
|
BasicCursor$$module$build$src$core$keyboard_nav$basic_cursor.registrationName="basicCursor";register$$module$build$src$core$registry(Type$$module$build$src$core$registry.CURSOR,BasicCursor$$module$build$src$core$keyboard_nav$basic_cursor.registrationName,BasicCursor$$module$build$src$core$keyboard_nav$basic_cursor);var module$build$src$core$keyboard_nav$basic_cursor={};module$build$src$core$keyboard_nav$basic_cursor.BasicCursor=BasicCursor$$module$build$src$core$keyboard_nav$basic_cursor;var TabNavigateCursor$$module$build$src$core$keyboard_nav$tab_navigate_cursor=class extends BasicCursor$$module$build$src$core$keyboard_nav$basic_cursor{validNode_(a){let b=!1;const c=a&&a.getType();a&&(a=a.getLocation(),c===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.FIELD&&a&&a.isTabNavigable()&&a.isClickable()&&(b=!0));return b}},module$build$src$core$keyboard_nav$tab_navigate_cursor={};module$build$src$core$keyboard_nav$tab_navigate_cursor.TabNavigateCursor=TabNavigateCursor$$module$build$src$core$keyboard_nav$tab_navigate_cursor;var module$build$src$core$utils$svg_paths={};module$build$src$core$utils$svg_paths.arc=arc$$module$build$src$core$utils$svg_paths;module$build$src$core$utils$svg_paths.curve=curve$$module$build$src$core$utils$svg_paths;module$build$src$core$utils$svg_paths.line=line$$module$build$src$core$utils$svg_paths;module$build$src$core$utils$svg_paths.lineOnAxis=lineOnAxis$$module$build$src$core$utils$svg_paths;module$build$src$core$utils$svg_paths.lineTo=lineTo$$module$build$src$core$utils$svg_paths;
|
|
693
|
-
module$build$src$core$utils$svg_paths.moveBy=moveBy$$module$build$src$core$utils$svg_paths;module$build$src$core$utils$svg_paths.moveTo=moveTo$$module$build$src$core$utils$svg_paths;module$build$src$core$utils$svg_paths.point=point$$module$build$src$core$utils$svg_paths;var BUMP_RANDOMNESS$$module$build$src$core$rendered_connection=10,RenderedConnection$$module$build$src$core$rendered_connection=class extends Connection$$module$build$src$core$connection{constructor(a,b){super(a,b);this.targetConnection=null;this.db_=a.workspace.connectionDBList[b];this.dbOpposite_=a.workspace.connectionDBList[OPPOSITE_TYPE$$module$build$src$core$internal_constants[b]];this.offsetInBlock_=new Coordinate$$module$build$src$core$utils$coordinate(0,0);this.trackedState_=
|
|
694
|
-
this.trackedState_===RenderedConnection$$module$build$src$core$rendered_connection.TrackedState.TRACKED&&this.db_.removeConnection(this,this.y)}getSourceBlock(){return super.getSourceBlock()}targetBlock(){return super.targetBlock()}distanceFrom(a){const b=this.x-a.x;a=this.y-a.y;return Math.sqrt(b*b+a*a)}bumpAwayFrom(a){if(!this.sourceBlock_.workspace.isDragging()){var b=this.sourceBlock_.getRootBlock();
|
|
695
|
-
a=this;c=!0}var d=getSelected$$module$build$src$core$common()==b;d||b.addSelect();var e=a.x+$.config$$module$build$src$core$config.snapRadius+Math.floor(Math.random()*BUMP_RANDOMNESS$$module$build$src$core$rendered_connection)-this.x,f=a.y+$.config$$module$build$src$core$config.snapRadius+Math.floor(Math.random()*BUMP_RANDOMNESS$$module$build$src$core$rendered_connection)-this.y;c&&(f=-f);b.RTL&&
|
|
696
|
-
this.x);b.moveBy(e,f);d||b.removeSelect()}}}moveTo(a,b){this.trackedState_===RenderedConnection$$module$build$src$core$rendered_connection.TrackedState.WILL_TRACK?(this.db_.addConnection(this,b),this.trackedState_=RenderedConnection$$module$build$src$core$rendered_connection.TrackedState.TRACKED):this.trackedState_===RenderedConnection$$module$build$src$core$rendered_connection.TrackedState.TRACKED&&
|
|
697
|
-
b){this.moveTo(this.x+a,this.y+b)}moveToOffset(a){this.moveTo(a.x+this.offsetInBlock_.x,a.y+this.offsetInBlock_.y)}setOffsetInBlock(a,b){this.offsetInBlock_.x=a;this.offsetInBlock_.y=b}getOffsetInBlock(){return this.offsetInBlock_}tighten(){const a=this.targetConnection.x-this.x,b=this.targetConnection.y-this.y;if(0!==a||0!==b){const d=this.targetBlock();var c=d.getSvgRoot();if(!c)throw Error("block is not rendered.");
|
|
698
|
-
"translate("+(c.x-a)+","+(c.y-b)+")");d.moveConnections(-a,-b)}}closest(a,b){return this.dbOpposite_.searchForClosest(this,a,b)}highlight(){var a=this.sourceBlock_.workspace.getRenderer().getConstants();var b=a.shapeFor(this);this.type===ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE||this.type===ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE?(a=a.TAB_OFFSET_FROM_TOP,
|
|
699
|
-
a)+b.pathDown+lineOnAxis$$module$build$src$core$utils$svg_paths("v",a)):(a=a.NOTCH_OFFSET_LEFT-a.CORNER_RADIUS,b=moveBy$$module$build$src$core$utils$svg_paths(-a,0)+lineOnAxis$$module$build$src$core$utils$svg_paths("h",a)+b.pathLeft+lineOnAxis$$module$build$src$core$utils$svg_paths("h",a));a=this.sourceBlock_.getRelativeToSurfaceXY();
|
|
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(
|
|
700
|
+
module$build$src$core$utils$svg_paths.moveBy=moveBy$$module$build$src$core$utils$svg_paths;module$build$src$core$utils$svg_paths.moveTo=moveTo$$module$build$src$core$utils$svg_paths;module$build$src$core$utils$svg_paths.point=point$$module$build$src$core$utils$svg_paths;var BUMP_RANDOMNESS$$module$build$src$core$rendered_connection=10,RenderedConnection$$module$build$src$core$rendered_connection=class extends Connection$$module$build$src$core$connection{constructor(a,b){super(a,b);this.targetConnection=this.highlightPath=null;this.db_=a.workspace.connectionDBList[b];this.dbOpposite_=a.workspace.connectionDBList[OPPOSITE_TYPE$$module$build$src$core$internal_constants[b]];this.offsetInBlock_=new Coordinate$$module$build$src$core$utils$coordinate(0,0);this.trackedState_=
|
|
701
|
+
RenderedConnection$$module$build$src$core$rendered_connection.TrackedState.WILL_TRACK}dispose(){super.dispose();this.trackedState_===RenderedConnection$$module$build$src$core$rendered_connection.TrackedState.TRACKED&&this.db_.removeConnection(this,this.y)}getSourceBlock(){return super.getSourceBlock()}targetBlock(){return super.targetBlock()}distanceFrom(a){const b=this.x-a.x;a=this.y-a.y;return Math.sqrt(b*b+a*a)}bumpAwayFrom(a){if(!this.sourceBlock_.workspace.isDragging()){var b=this.sourceBlock_.getRootBlock();
|
|
702
|
+
if(!b.isInFlyout){var c=!1;if(!b.isMovable()){b=a.getSourceBlock().getRootBlock();if(!b.isMovable())return;a=this;c=!0}var d=getSelected$$module$build$src$core$common()==b;d||b.addSelect();var e=a.x+$.config$$module$build$src$core$config.snapRadius+Math.floor(Math.random()*BUMP_RANDOMNESS$$module$build$src$core$rendered_connection)-this.x,f=a.y+$.config$$module$build$src$core$config.snapRadius+Math.floor(Math.random()*BUMP_RANDOMNESS$$module$build$src$core$rendered_connection)-this.y;c&&(f=-f);b.RTL&&
|
|
703
|
+
(e=a.x-$.config$$module$build$src$core$config.snapRadius-Math.floor(Math.random()*BUMP_RANDOMNESS$$module$build$src$core$rendered_connection)-this.x);b.moveBy(e,f);d||b.removeSelect()}}}moveTo(a,b){this.trackedState_===RenderedConnection$$module$build$src$core$rendered_connection.TrackedState.WILL_TRACK?(this.db_.addConnection(this,b),this.trackedState_=RenderedConnection$$module$build$src$core$rendered_connection.TrackedState.TRACKED):this.trackedState_===RenderedConnection$$module$build$src$core$rendered_connection.TrackedState.TRACKED&&
|
|
704
|
+
(this.db_.removeConnection(this,this.y),this.db_.addConnection(this,b));this.x=a;this.y=b}moveBy(a,b){this.moveTo(this.x+a,this.y+b)}moveToOffset(a){this.moveTo(a.x+this.offsetInBlock_.x,a.y+this.offsetInBlock_.y)}setOffsetInBlock(a,b){this.offsetInBlock_.x=a;this.offsetInBlock_.y=b}getOffsetInBlock(){return this.offsetInBlock_}tighten(){const a=this.targetConnection.x-this.x,b=this.targetConnection.y-this.y;if(0!==a||0!==b){const d=this.targetBlock();var c=d.getSvgRoot();if(!c)throw Error("block is not rendered.");
|
|
705
|
+
c=getRelativeXY$$module$build$src$core$utils$svg_math(c);d.getSvgRoot().setAttribute("transform","translate("+(c.x-a)+","+(c.y-b)+")");d.moveConnections(-a,-b)}}closest(a,b){return this.dbOpposite_.searchForClosest(this,a,b)}highlight(){var a=this.sourceBlock_.workspace.getRenderer().getConstants();var b=a.shapeFor(this);this.type===ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE||this.type===ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE?(a=a.TAB_OFFSET_FROM_TOP,
|
|
706
|
+
b=moveBy$$module$build$src$core$utils$svg_paths(0,-a)+lineOnAxis$$module$build$src$core$utils$svg_paths("v",a)+b.pathDown+lineOnAxis$$module$build$src$core$utils$svg_paths("v",a)):(a=a.NOTCH_OFFSET_LEFT-a.CORNER_RADIUS,b=moveBy$$module$build$src$core$utils$svg_paths(-a,0)+lineOnAxis$$module$build$src$core$utils$svg_paths("h",a)+b.pathLeft+lineOnAxis$$module$build$src$core$utils$svg_paths("h",a));a=this.sourceBlock_.getRelativeToSurfaceXY();this.highlightPath=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.PATH,
|
|
707
|
+
{"class":"blocklyHighlightedConnectionPath",d:b,transform:"translate("+(this.x-a.x)+","+(this.y-a.y)+")"+(this.sourceBlock_.RTL?" scale(-1 1)":"")},this.sourceBlock_.getSvgRoot())}unhighlight(){this.highlightPath&&(removeNode$$module$build$src$core$utils$dom(this.highlightPath),this.highlightPath=null)}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||
|
|
701
708
|
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);
|
|
702
709
|
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&&
|
|
703
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(...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),
|
|
@@ -705,9 +712,9 @@ $.config$$module$build$src$core$config.bumpDelay)}}disconnectInternal_(a,b){supe
|
|
|
705
712
|
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():
|
|
706
713
|
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={}));
|
|
707
714
|
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,
|
|
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.
|
|
709
|
-
Bubble$$module$build$src$core$bubble.textToDom(this.getText());this.bubble_=Bubble$$module$build$src$core$bubble.createNonEditableBubble(this.paragraphElement_,this.
|
|
710
|
-
return a.join("\n")}dispose(){this.
|
|
715
|
+
{"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.getBlock(),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.getBlock(),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]);
|
|
717
|
+
return a.join("\n")}dispose(){this.getBlock().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
718
|
{});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
719
|
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()&&
|
|
713
720
|
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);
|
|
@@ -716,26 +723,26 @@ this.warning&&a.push(this.warning);return a}setParent(a){const b=this.parentBloc
|
|
|
716
723
|
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.getCanvas()&&d!==c)}return new Coordinate$$module$build$src$core$utils$coordinate(a,b)}moveBy(a,b){if(this.parentBlock_)throw Error("Block has parent.");
|
|
717
724
|
const c=isEnabled$$module$build$src$core$events$utils();let d=null;c&&(d=new (get$$module$build$src$core$events$utils(MOVE$$module$build$src$core$events$utils))(this));const e=this.getRelativeToSurfaceXY();this.translate(e.x+a,e.y+b);this.moveConnections(a,b);c&&d&&(d.recordNew(),fire$$module$build$src$core$events$utils(d));this.workspace.resizeContents()}translate(a,b){this.getSvgRoot().setAttribute("transform","translate("+a+","+b+")")}moveToDragSurface(){if(this.useDragSurface_){var a=this.getRelativeToSurfaceXY();
|
|
718
725
|
this.clearTransformAttributes_();this.workspace.getBlockDragSurface().translateSurface(a.x,a.y);(a=this.getSvgRoot())&&this.workspace.getBlockDragSurface().setBlocksAndShow(a)}}moveTo(a){const b=this.getRelativeToSurfaceXY();this.moveBy(a.x-b.x,a.y-b.y)}moveOffDragSurface(a){this.useDragSurface_&&(this.translate(a.x,a.y),this.workspace.getBlockDragSurface().clearAndHide(this.workspace.getCanvas()))}moveDuringDrag(a){this.useDragSurface_?this.workspace.getBlockDragSurface().translateSurface(a.x,a.y):
|
|
719
|
-
(this.svgGroup_.translate_="translate("+a.x+","+a.y+")",this.svgGroup_.setAttribute("transform",this.svgGroup_.translate_+this.svgGroup_.skew_))}clearTransformAttributes_(){this.getSvgRoot().removeAttribute("transform")}snapToGrid(){if(!(this.
|
|
726
|
+
(this.svgGroup_.translate_="translate("+a.x+","+a.y+")",this.svgGroup_.setAttribute("transform",this.svgGroup_.translate_+this.svgGroup_.skew_))}clearTransformAttributes_(){this.getSvgRoot().removeAttribute("transform")}snapToGrid(){if(!(this.isDeadOrDying()||this.workspace.isDragging()||this.getParent()||this.isInFlyout)){var a=this.workspace.getGrid();if(a&&a.shouldSnap()){var b=a.getSpacing(),c=b/2,d=this.getRelativeToSurfaceXY();a=Math.round(Math.round((d.x-c)/b)*b+c-d.x);b=Math.round(Math.round((d.y-
|
|
720
727
|
c)/b)*b+c-d.y);(a||b)&&this.moveBy(a,b)}}}getBoundingRectangle(){const a=this.getRelativeToSurfaceXY(),b=this.getHeightWidth();let c,d;this.RTL?(c=a.x-b.width,d=a.x):(c=a.x,d=a.x+b.width);return new Rect$$module$build$src$core$utils$rect(a.y,a.y+b.height,c,d)}markDirty(){this.pathObject.constants=this.workspace.getRenderer().getConstants();for(let a=0,b;b=this.inputList[a];a++)b.markDirty()}setCollapsed(a){this.collapsed_!==a&&(super.setCollapsed(a),a?this.rendered&&this.render():this.updateCollapsed_())}updateCollapsed_(){var a=
|
|
721
728
|
this.isCollapsed();const b=COLLAPSED_INPUT_NAME$$module$build$src$core$constants,c=COLLAPSED_FIELD_NAME$$module$build$src$core$constants;for(let e=0,f;f=this.inputList[e];e++)f.name!==b&&f.setVisible(!a);if(a){a=this.getIcons();for(let e=0,f;f=a[e];e++)f.setVisible(!1);a=this.toString(COLLAPSE_CHARS$$module$build$src$core$internal_constants);var d=this.getField(c);d?d.setValue(a):(this.getInput(b)||this.appendDummyInput(b)).appendField(new $.FieldLabel$$module$build$src$core$field_label(a),c)}else this.updateDisabled(),
|
|
722
729
|
this.removeInput(b)}tab(a,b){const c=new TabNavigateCursor$$module$build$src$core$keyboard_nav$tab_navigate_cursor;c.setCurNode(ASTNode$$module$build$src$core$keyboard_nav$ast_node.createFieldNode(a));a=c.getCurNode();b?c.next():c.prev();(b=c.getCurNode())&&b!==a&&(b.getLocation().showEditor(),this.workspace.keyboardAccessibilityMode&&this.workspace.getCursor().setCurNode(b))}onMouseDown_(a){const b=this.workspace.getGesture(a);b&&b.handleBlockStart(a,this)}showHelp(){const a="function"===typeof this.helpUrl?
|
|
723
730
|
this.helpUrl():this.helpUrl;a&&window.open(a)}generateContextMenu(){if(this.workspace.options.readOnly||!this.contextMenu)return null;const a=ContextMenuRegistry$$module$build$src$core$contextmenu_registry.registry.getContextMenuOptions(ContextMenuRegistry$$module$build$src$core$contextmenu_registry.ScopeType.BLOCK,{block:this});this.customContextMenu&&this.customContextMenu(a);return a}showContextMenu(a){const b=this.generateContextMenu();b&&b.length&&(show$$module$build$src$core$contextmenu(a,b,
|
|
724
731
|
this.RTL),setCurrentBlock$$module$build$src$core$contextmenu(this))}moveConnections(a,b){if(this.rendered){var c=this.getConnections_(!1);for(var d=0;d<c.length;d++)c[d].moveBy(a,b);c=this.getIcons();for(d=0;d<c.length;d++)c[d].computeIconLocation();for(c=0;c<this.childBlocks_.length;c++)this.childBlocks_[c].moveConnections(a,b)}}setDragging(a){if(a){var b=this.getSvgRoot();b.translate_="";b.skew_="";draggingConnections$$module$build$src$core$common.push(...this.getConnections_(!0));addClass$$module$build$src$core$utils$dom(this.svgGroup_,
|
|
725
732
|
"blocklyDragging")}else draggingConnections$$module$build$src$core$common.length=0,removeClass$$module$build$src$core$utils$dom(this.svgGroup_,"blocklyDragging");for(b=0;b<this.childBlocks_.length;b++)this.childBlocks_[b].setDragging(a)}setMovable(a){super.setMovable(a);this.pathObject.updateMovable(a)}setEditable(a){super.setEditable(a);a=this.getIcons();for(let b=0;b<a.length;b++)a[b].updateEditable()}setShadow(a){super.setShadow(a);this.applyColour()}setInsertionMarker(a){this.isInsertionMarker_!==
|
|
726
|
-
a&&(this.isInsertionMarker_=a)&&(this.setColour(this.workspace.getRenderer().getConstants().INSERTION_MARKER_COLOUR),this.pathObject.updateInsertionMarker(!0))}getSvgRoot(){return this.svgGroup_}dispose(a,b){if(!this.
|
|
733
|
+
a&&(this.isInsertionMarker_=a)&&(this.setColour(this.workspace.getRenderer().getConstants().INSERTION_MARKER_COLOUR),this.pathObject.updateInsertionMarker(!0))}getSvgRoot(){return this.svgGroup_}dispose(a,b){if(!this.isDeadOrDying()){dispose$$module$build$src$core$tooltip();unbindMouseEvents$$module$build$src$core$tooltip(this.pathObject.svgPath);startTextWidthCache$$module$build$src$core$utils$dom();var c=this.workspace;getSelected$$module$build$src$core$common()===this&&(this.unselect(),this.workspace.cancelCurrentGesture());
|
|
727
734
|
getCurrentBlock$$module$build$src$core$contextmenu()===this&&hide$$module$build$src$core$contextmenu();b&&this.rendered&&(this.unplug(a),disposeUiEffect$$module$build$src$core$block_animations(this));this.rendered=!1;for(var d of this.warningTextDb.values())clearTimeout(d);this.warningTextDb.clear();b=this.getIcons();for(d=0;d<b.length;d++)b[d].dispose();getSelected$$module$build$src$core$common()===this&&setSelected$$module$build$src$core$common(null);super.dispose(!!a);removeNode$$module$build$src$core$utils$dom(this.svgGroup_);
|
|
728
735
|
c.resizeContents();this.svgGroup_=null;stopTextWidthCache$$module$build$src$core$utils$dom()}}checkAndDelete(){this.workspace.isFlyout||(setGroup$$module$build$src$core$events$utils(!0),this.workspace.hideChaff(),this.outputConnection?this.dispose(!1,!0):this.dispose(!0,!0),setGroup$$module$build$src$core$events$utils(!1))}toCopyData(){return this.isInsertionMarker_?null:{saveInfo:save$$module$build$src$core$serialization$blocks(this,{addCoordinates:!0,addNextBlocks:!1}),source:this.workspace,typeCounts:getBlockTypeCounts$$module$build$src$core$common(this,
|
|
729
736
|
!0)}}applyColour(){this.pathObject.applyColour(this);const a=this.getIcons();for(let b=0;b<a.length;b++)a[b].applyColour();for(let b=0,c;c=this.inputList[b];b++)for(let d=0,e;e=c.fieldRow[d];d++)e.applyColour()}updateDisabled(){const a=this.getChildren(!1);this.applyColour();if(!this.isCollapsed())for(let b=0,c;c=a[b];b++)c.rendered&&c.updateDisabled()}getCommentIcon(){return this.commentIcon_}setCommentText(a){this.commentModel.text!==a&&(super.setCommentText(a),a=null!==a,!!this.commentIcon_===
|
|
730
737
|
a?this.commentIcon_.updateText():(a?this.comment=this.commentIcon_=new Comment$$module$build$src$core$comment(this):(this.commentIcon_.dispose(),this.comment=this.commentIcon_=null),this.rendered&&(this.render(),this.bumpNeighbours())))}setWarningText(a,b){const c=b||"";if(c)this.warningTextDb.has(c)&&(clearTimeout(this.warningTextDb.get(c)),this.warningTextDb.delete(c));else{for(var d of this.warningTextDb.values())clearTimeout(d);this.warningTextDb.clear()}if(this.workspace.isDragging())this.warningTextDb.set(c,
|
|
731
|
-
setTimeout(()=>{this.
|
|
732
|
-
|
|
733
|
-
this.pathObject.updateHighlighted(a)}addSelect(){this.pathObject.updateSelected(!0)}removeSelect(){this.pathObject.updateSelected(!1)}setDeleteStyle(a){this.pathObject.updateDraggingDelete(a)}getColour(){return this.style.colourPrimary}setColour(a){super.setColour(a);a=this.workspace.getRenderer().getConstants().getBlockStyleForColour(this.colour_);this.pathObject.setStyle(a.style);this.style=a.style;this.styleName_=a.name;this.applyColour()}setStyle(a){const b=
|
|
734
|
-
this.styleName_=a;if(b)this.hat=b.hat,this.pathObject.setStyle(b),this.colour_=b.colourPrimary,this.style=b,this.applyColour();else throw Error("Invalid style name: "+a);}bringToFront(){let a=this;do{const b=a.getSvgRoot(),c=b.parentNode,d=c.childNodes;d[d.length-1]!==b&&c.appendChild(b);a=a.getParent()}while(a)}setPreviousStatement(a,b){super.setPreviousStatement(a,b);this.rendered&&(this.render(),this.bumpNeighbours())}setNextStatement(a,
|
|
735
|
-
this.bumpNeighbours())}setOutput(a,b){super.setOutput(a,b);this.rendered&&(this.render(),this.bumpNeighbours())}setInputsInline(a){super.setInputsInline(a);this.rendered&&(this.render(),this.bumpNeighbours())}removeInput(a,b){a=super.removeInput(a,b);this.rendered&&(this.render(),this.bumpNeighbours());return a}moveNumberedInputBefore(a,b){super.moveNumberedInputBefore(a,b);this.rendered&&(this.render(),this.bumpNeighbours())}appendInput_(a,
|
|
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())&&
|
|
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,
|
|
738
|
-
a)}getNextBlock(){return super.getNextBlock()}getPreviousBlock(){return super.getPreviousBlock()}bumpNeighbours(){if(!this.
|
|
738
|
+
setTimeout(()=>{this.isDeadOrDying()||(this.warningTextDb.delete(c),this.setWarningText(a,c))},100));else{this.isInFlyout&&(a=null);b=!1;if("string"===typeof a){d=this.getSurroundParent();let e=null;for(;d;)d.isCollapsed()&&(e=d),d=d.getSurroundParent();e&&e.setWarningText(Msg$$module$build$src$core$msg.COLLAPSED_WARNINGS_WARNING,BlockSvg$$module$build$src$core$block_svg.COLLAPSED_WARNING_ID);this.warning||(this.warning=new Warning$$module$build$src$core$warning(this),b=!0);this.warning.setText(a,
|
|
739
|
+
c)}else this.warning&&!c?(this.warning.dispose(),b=!0):this.warning&&(b=this.warning.getText(),this.warning.setText("",c),(d=this.warning.getText())||this.warning.dispose(),b=b!==d);b&&this.rendered&&(this.render(),this.bumpNeighbours())}}setMutator(a){this.mutator&&this.mutator!==a&&this.mutator.dispose();a&&(a.setBlock(this),this.mutator=a,a.createIcon());this.rendered&&(this.render(),this.bumpNeighbours())}setEnabled(a){this.isEnabled()!==a&&(super.setEnabled(a),this.rendered&&!this.getInheritedDisabled()&&
|
|
740
|
+
this.updateDisabled())}setHighlighted(a){this.rendered&&this.pathObject.updateHighlighted(a)}addSelect(){this.pathObject.updateSelected(!0)}removeSelect(){this.pathObject.updateSelected(!1)}setDeleteStyle(a){this.pathObject.updateDraggingDelete(a)}getColour(){return this.style.colourPrimary}setColour(a){super.setColour(a);a=this.workspace.getRenderer().getConstants().getBlockStyleForColour(this.colour_);this.pathObject.setStyle(a.style);this.style=a.style;this.styleName_=a.name;this.applyColour()}setStyle(a){const b=
|
|
741
|
+
this.workspace.getRenderer().getConstants().getBlockStyle(a);this.styleName_=a;if(b)this.hat=b.hat,this.pathObject.setStyle(b),this.colour_=b.colourPrimary,this.style=b,this.applyColour();else throw Error("Invalid style name: "+a);}bringToFront(){let a=this;do{const b=a.getSvgRoot(),c=b.parentNode,d=c.childNodes;d[d.length-1]!==b&&c.appendChild(b);a=a.getParent()}while(a)}setPreviousStatement(a,b){super.setPreviousStatement(a,b);this.rendered&&(this.render(),this.bumpNeighbours())}setNextStatement(a,
|
|
742
|
+
b){super.setNextStatement(a,b);this.rendered&&(this.render(),this.bumpNeighbours())}setOutput(a,b){super.setOutput(a,b);this.rendered&&(this.render(),this.bumpNeighbours())}setInputsInline(a){super.setInputsInline(a);this.rendered&&(this.render(),this.bumpNeighbours())}removeInput(a,b){a=super.removeInput(a,b);this.rendered&&(this.render(),this.bumpNeighbours());return a}moveNumberedInputBefore(a,b){super.moveNumberedInputBefore(a,b);this.rendered&&(this.render(),this.bumpNeighbours())}appendInput_(a,
|
|
743
|
+
b){a=super.appendInput_(a,b);this.rendered&&(this.render(),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())&&
|
|
744
|
+
c.setConnectionTracking(a))}}getConnections_(a){const b=[];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
|
+
a)}getNextBlock(){return super.getNextBlock()}getPreviousBlock(){return super.getPreviousBlock()}bumpNeighbours(){if(!this.isDeadOrDying()&&!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()!==
|
|
739
746
|
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,
|
|
740
747
|
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);
|
|
741
748
|
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=
|
|
@@ -760,29 +767,31 @@ LID_HEIGHT$$module$build$src$core$trashcan,this.left_,this.left_+WIDTH$$module$b
|
|
|
760
767
|
b:-b;this.lidOpen_=Math.min(Math.max(this.lidOpen_,this.minOpenness_),1);this.setLidAngle_(this.lidOpen_*MAX_LID_ANGLE$$module$build$src$core$trashcan);b=OPACITY_MIN$$module$build$src$core$trashcan+this.lidOpen_*(OPACITY_MAX$$module$build$src$core$trashcan-OPACITY_MIN$$module$build$src$core$trashcan);this.svgGroup_&&(this.svgGroup_.style.opacity=b.toString());this.lidOpen_>this.minOpenness_&&1>this.lidOpen_&&(this.lidTask_=setTimeout(this.animateLid_.bind(this),ANIMATION_LENGTH$$module$build$src$core$trashcan/
|
|
761
768
|
a))}setLidAngle_(a){const b=this.workspace.toolboxPosition===Position$$module$build$src$core$utils$toolbox.RIGHT||this.workspace.horizontalLayout&&this.workspace.RTL;let c;null==(c=this.svgLid_)||c.setAttribute("transform","rotate("+(b?-a:a)+","+(b?4:WIDTH$$module$build$src$core$trashcan-4)+","+(LID_HEIGHT$$module$build$src$core$trashcan-2)+")")}setMinOpenness_(a){this.minOpenness_=a;this.isLidOpen||this.setLidAngle_(a*MAX_LID_ANGLE$$module$build$src$core$trashcan)}closeLid(){this.setLidOpen(!1)}click(){this.hasContents_()&&
|
|
762
769
|
this.openFlyout()}fireUiEvent_(a){a=new (get$$module$build$src$core$events$utils(TRASHCAN_OPEN$$module$build$src$core$events$utils))(a,this.workspace.id);fire$$module$build$src$core$events$utils(a)}blockMouseDownWhenOpenable_(a){!this.contentsIsOpen()&&this.hasContents_()&&a.stopPropagation()}mouseOver_(){this.hasContents_()&&this.setLidOpen(!0)}mouseOut_(){this.setLidOpen(!1)}onDelete_(a){if(!(0>=this.workspace.options.maxTrashcanContents||a.type!==DELETE$$module$build$src$core$events$utils||a.type!==
|
|
763
|
-
DELETE$$module$build$src$core$events$utils||a.wasShadow)
|
|
764
|
-
delete d.pinned}d=c.inputs;for(var e in d){var f=d[e];const g=f.block;f=f.shadow;g&&b(g);f&&b(f)}c.next&&(e=c.next,c=e.block,e=e.shadow,c&&b(c),e&&b(e))}}a=JSON.parse(JSON.stringify(a));b(a);return Object.assign({},{kind:"BLOCK"},a)}},WIDTH$$module$build$src$core$trashcan=47,BODY_HEIGHT$$module$build$src$core$trashcan=44,LID_HEIGHT$$module$build$src$core$trashcan=16,MARGIN_VERTICAL$$module$build$src$core$trashcan=20,
|
|
765
|
-
10,SPRITE_LEFT$$module$build$src$core$trashcan=0,SPRITE_TOP$$module$build$src$core$trashcan=32,HAS_BLOCKS_LID_ANGLE$$module$build$src$core$trashcan=.1,ANIMATION_LENGTH$$module$build$src$core$trashcan=80,ANIMATION_FRAMES$$module$build$src$core$trashcan=4,OPACITY_MIN$$module$build$src$core$trashcan=.4,OPACITY_MAX$$module$build$src$core$trashcan=.8,MAX_LID_ANGLE$$module$build$src$core$trashcan=45,module$build$src$core$trashcan=
|
|
770
|
+
DELETE$$module$build$src$core$events$utils||a.wasShadow)){if(!a.oldJson)throw Error("Encountered a delete event without proper oldJson");a=JSON.stringify(this.cleanBlockJson_(a.oldJson));if(-1===this.contents_.indexOf(a)){for(this.contents_.unshift(a);this.contents_.length>this.workspace.options.maxTrashcanContents;)this.contents_.pop();this.setMinOpenness_(HAS_BLOCKS_LID_ANGLE$$module$build$src$core$trashcan)}}}cleanBlockJson_(a){function b(c){if(c){delete c.id;delete c.x;delete c.y;delete c.enabled;
|
|
771
|
+
if(c.icons&&c.icons.comment){var d=c.icons.comment;delete d.height;delete d.width;delete d.pinned}d=c.inputs;for(var e in d){var f=d[e];const g=f.block;f=f.shadow;g&&b(g);f&&b(f)}c.next&&(e=c.next,c=e.block,e=e.shadow,c&&b(c),e&&b(e))}}a=JSON.parse(JSON.stringify(a));b(a);return Object.assign({},{kind:"BLOCK"},a)}},WIDTH$$module$build$src$core$trashcan=47,BODY_HEIGHT$$module$build$src$core$trashcan=44,LID_HEIGHT$$module$build$src$core$trashcan=16,MARGIN_VERTICAL$$module$build$src$core$trashcan=20,
|
|
772
|
+
MARGIN_HORIZONTAL$$module$build$src$core$trashcan=20,MARGIN_HOTSPOT$$module$build$src$core$trashcan=10,SPRITE_LEFT$$module$build$src$core$trashcan=0,SPRITE_TOP$$module$build$src$core$trashcan=32,HAS_BLOCKS_LID_ANGLE$$module$build$src$core$trashcan=.1,ANIMATION_LENGTH$$module$build$src$core$trashcan=80,ANIMATION_FRAMES$$module$build$src$core$trashcan=4,OPACITY_MIN$$module$build$src$core$trashcan=.4,OPACITY_MAX$$module$build$src$core$trashcan=.8,MAX_LID_ANGLE$$module$build$src$core$trashcan=45,module$build$src$core$trashcan=
|
|
773
|
+
{};module$build$src$core$trashcan.Trashcan=Trashcan$$module$build$src$core$trashcan;var ToolboxItemSelect$$module$build$src$core$events$events_toolbox_item_select=class extends UiBase$$module$build$src$core$events$events_ui_base{constructor(a,b,c){super(c);this.type=TOOLBOX_ITEM_SELECT$$module$build$src$core$events$utils;this.oldItem=null!=a?a:void 0;this.newItem=null!=b?b:void 0}toJson(){const a=super.toJson();a.oldItem=this.oldItem;a.newItem=this.newItem;return a}fromJson(a){super.fromJson(a);this.oldItem=a.oldItem;this.newItem=a.newItem}};
|
|
766
774
|
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,TOOLBOX_ITEM_SELECT$$module$build$src$core$events$utils,ToolboxItemSelect$$module$build$src$core$events$events_toolbox_item_select);var module$build$src$core$events$events_toolbox_item_select={};module$build$src$core$events$events_toolbox_item_select.ToolboxItemSelect=ToolboxItemSelect$$module$build$src$core$events$events_toolbox_item_select;var ToolboxItem$$module$build$src$core$toolbox$toolbox_item=class{constructor(a,b,c){this.id_=a.toolboxitemid||getNextUniqueId$$module$build$src$core$utils$idgenerator();this.level_=(this.parent_=c||null)?this.parent_.getLevel()+1:0;this.toolboxItemDef_=a;this.parentToolbox_=b;this.workspace_=this.parentToolbox_.getWorkspace()}init(){}getDiv(){return null}getClickTarget(){return null}getId(){return this.id_}getParent(){return null}getLevel(){return this.level_}isSelectable(){return!1}isCollapsible(){return!1}dispose(){}setVisible_(a){}},
|
|
767
775
|
module$build$src$core$toolbox$toolbox_item={};module$build$src$core$toolbox$toolbox_item.ToolboxItem=ToolboxItem$$module$build$src$core$toolbox$toolbox_item;var ToolboxCategory$$module$build$src$core$toolbox$category=class extends ToolboxItem$$module$build$src$core$toolbox$toolbox_item{constructor(a,b,c){super(a,b,c);this.colour_=this.name_="";this.labelDom_=this.iconDom_=this.rowContents_=this.rowDiv_=this.htmlDiv_=null;this.isDisabled_=this.isHidden_=!1;this.flyoutItems_=[];this.cssConfig_=this.makeDefaultCssConfig_()}init(){this.parseCategoryDef_(this.toolboxItemDef_);this.parseContents_(this.toolboxItemDef_);this.createDom_();"true"===this.toolboxItemDef_.hidden&&
|
|
768
|
-
this.hide()}makeDefaultCssConfig_(){return{container:"blocklyToolboxCategory",row:"blocklyTreeRow",rowcontentcontainer:"blocklyTreeRowContentContainer",icon:"blocklyTreeIcon",label:"blocklyTreeLabel",contents:"blocklyToolboxContents",selected:"blocklyTreeSelected",openicon:"blocklyTreeIconOpen",closedicon:"blocklyTreeIconClosed"}}parseContents_(a){
|
|
769
|
-
replaceMessageReferences$$module$build$src$core$utils$parsing(a.name);this.colour_=this.getColour_(a);Object.assign(this.cssConfig_,a.cssconfig||a.cssConfig)}createDom_(){this.htmlDiv_=this.createContainer_();setRole$$module$build$src$core$utils$aria(this.htmlDiv_,Role$$module$build$src$core$utils$aria.TREEITEM);setState$$module$build$src$core$utils$aria(this.htmlDiv_,State$$module$build$src$core$utils$aria.SELECTED,!1);setState$$module$build$src$core$utils$aria(this.htmlDiv_,State$$module$build$src$core$utils$aria.LEVEL,
|
|
776
|
+
this.hide()}makeDefaultCssConfig_(){return{container:"blocklyToolboxCategory",row:"blocklyTreeRow",rowcontentcontainer:"blocklyTreeRowContentContainer",icon:"blocklyTreeIcon",label:"blocklyTreeLabel",contents:"blocklyToolboxContents",selected:"blocklyTreeSelected",openicon:"blocklyTreeIconOpen",closedicon:"blocklyTreeIconClosed"}}parseContents_(a){if("custom"in a)this.flyoutItems_=a.custom;else if(a=a.contents)for(let b=0;b<a.length;b++){const c=a[b];Array.isArray(this.flyoutItems_)&&this.flyoutItems_.push(c)}}parseCategoryDef_(a){this.name_=
|
|
777
|
+
"name"in a?replaceMessageReferences$$module$build$src$core$utils$parsing(a.name):"";this.colour_=this.getColour_(a);Object.assign(this.cssConfig_,a.cssconfig||a.cssConfig)}createDom_(){this.htmlDiv_=this.createContainer_();setRole$$module$build$src$core$utils$aria(this.htmlDiv_,Role$$module$build$src$core$utils$aria.TREEITEM);setState$$module$build$src$core$utils$aria(this.htmlDiv_,State$$module$build$src$core$utils$aria.SELECTED,!1);setState$$module$build$src$core$utils$aria(this.htmlDiv_,State$$module$build$src$core$utils$aria.LEVEL,
|
|
770
778
|
this.level_);this.rowDiv_=this.createRowContainer_();this.rowDiv_.style.pointerEvents="auto";this.htmlDiv_.appendChild(this.rowDiv_);this.rowContents_=this.createRowContentsContainer_();this.rowContents_.style.pointerEvents="none";this.rowDiv_.appendChild(this.rowContents_);this.iconDom_=this.createIconDom_();setRole$$module$build$src$core$utils$aria(this.iconDom_,Role$$module$build$src$core$utils$aria.PRESENTATION);this.rowContents_.appendChild(this.iconDom_);this.labelDom_=this.createLabelDom_(this.name_);
|
|
771
|
-
this.rowContents_.appendChild(this.labelDom_);setState$$module$build$src$core$utils$aria(this.htmlDiv_,State$$module$build$src$core$utils$aria.LABELLEDBY,
|
|
772
|
-
|
|
773
|
-
a.style.display="inline-block";return a}createLabelDom_(a){const b=document.createElement("span");b.setAttribute("id",this.getId()+".label");b.textContent=a;addClass$$module$build$src$core$utils$dom(b,
|
|
774
|
-
a:this.rowDiv_.style.borderLeft=a)}getColour_(a){const b=a.categorystyle||a.categoryStyle;if((a=a.colour)&&b)console.warn('Toolbox category "'+this.name_+'" must not have both a style and a colour');else
|
|
775
|
-
replaceMessageReferences$$module$build$src$core$utils$parsing(a);if(null==a||""===a)return"";var b=Number(a);if(isNaN(b)){if(b=parse$$module$build$src$core$utils$colour(a))return b;console.warn('Toolbox category "'+this.name_+'" has unrecognized colour attribute: '+a);return""}return hueToHex$$module$build$src$core$utils$colour(b)}openIcon_(a){a&&
|
|
776
|
-
(removeClasses$$module$build$src$core$utils$dom(a,this.cssConfig_.
|
|
777
|
-
|
|
778
|
-
State$$module$build$src$core$utils$aria.SELECTED,a)}setDisabled(a){this.isDisabled_=a;this.getDiv().setAttribute("disabled"
|
|
779
|
-
|
|
780
|
-
|
|
779
|
+
this.rowContents_.appendChild(this.labelDom_);const a=this.labelDom_.getAttribute("id");a&&setState$$module$build$src$core$utils$aria(this.htmlDiv_,State$$module$build$src$core$utils$aria.LABELLEDBY,a);this.addColourBorder_(this.colour_);return this.htmlDiv_}createContainer_(){const a=document.createElement("div"),b=this.cssConfig_.container;b&&addClass$$module$build$src$core$utils$dom(a,b);return a}createRowContainer_(){const a=document.createElement("div");var b=this.cssConfig_.row;b&&addClass$$module$build$src$core$utils$dom(a,
|
|
780
|
+
b);b=`${ToolboxCategory$$module$build$src$core$toolbox$category.nestedPadding*this.getLevel()}px`;this.workspace_.RTL?a.style.paddingRight=b:a.style.paddingLeft=b;return a}createRowContentsContainer_(){const a=document.createElement("div"),b=this.cssConfig_.rowcontentcontainer;b&&addClass$$module$build$src$core$utils$dom(a,b);return a}createIconDom_(){const a=document.createElement("span");if(!this.parentToolbox_.isHorizontal()){const b=this.cssConfig_.icon;b&&addClass$$module$build$src$core$utils$dom(a,
|
|
781
|
+
b)}a.style.display="inline-block";return a}createLabelDom_(a){const b=document.createElement("span");b.setAttribute("id",this.getId()+".label");b.textContent=a;(a=this.cssConfig_.label)&&addClass$$module$build$src$core$utils$dom(b,a);return b}refreshTheme(){this.colour_=this.getColour_(this.toolboxItemDef_);this.addColourBorder_(this.colour_)}addColourBorder_(a){a&&(a=ToolboxCategory$$module$build$src$core$toolbox$category.borderWidth+"px solid "+(a||"#ddd"),this.workspace_.RTL?this.rowDiv_.style.borderRight=
|
|
782
|
+
a:this.rowDiv_.style.borderLeft=a)}getColour_(a){const b=a.categorystyle||a.categoryStyle;if((a=a.colour)&&b)console.warn('Toolbox category "'+this.name_+'" must not have both a style and a colour');else{if(b)return this.getColourfromStyle_(b);if(a)return this.parseColour_(a)}return""}getColourfromStyle_(a){var b=this.workspace_.getTheme();if(a&&b){if((b=b.categoryStyles[a])&&b.colour)return this.parseColour_(b.colour);console.warn('Style "'+a+'" must exist and contain a colour value')}return""}getClickTarget(){return this.rowDiv_}parseColour_(a){a=
|
|
783
|
+
replaceMessageReferences$$module$build$src$core$utils$parsing(a);if(null==a||""===a)return"";var b=Number(a);if(isNaN(b)){if(b=parse$$module$build$src$core$utils$colour(a))return b;console.warn('Toolbox category "'+this.name_+'" has unrecognized colour attribute: '+a);return""}return hueToHex$$module$build$src$core$utils$colour(b)}openIcon_(a){if(a){var b=this.cssConfig_.closedicon;b&&removeClasses$$module$build$src$core$utils$dom(a,b);(b=this.cssConfig_.openicon)&&addClass$$module$build$src$core$utils$dom(a,
|
|
784
|
+
b)}}closeIcon_(a){if(a){var b=this.cssConfig_.openicon;b&&removeClasses$$module$build$src$core$utils$dom(a,b);(b=this.cssConfig_.closedicon)&&addClass$$module$build$src$core$utils$dom(a,b)}}setVisible_(a){this.htmlDiv_.style.display=a?"block":"none";this.isHidden_=!a;this.parentToolbox_.getSelectedItem()===this&&this.parentToolbox_.clearSelection()}hide(){this.setVisible_(!1)}show(){this.setVisible_(!0)}isVisible(){return!this.isHidden_&&this.allAncestorsExpanded_()}allAncestorsExpanded_(){let a=
|
|
785
|
+
this;for(;a.getParent();)if(a=a.getParent(),!a.isExpanded())return!1;return!0}isSelectable(){return this.isVisible()&&!this.isDisabled_}onClick(a){}setSelected(a){if(this.rowDiv_){var b=this.cssConfig_.selected;if(a){const c=this.parseColour_(ToolboxCategory$$module$build$src$core$toolbox$category.defaultBackgroundColour);this.rowDiv_.style.backgroundColor=this.colour_||c;b&&addClass$$module$build$src$core$utils$dom(this.rowDiv_,b)}else this.rowDiv_.style.backgroundColor="",b&&removeClass$$module$build$src$core$utils$dom(this.rowDiv_,
|
|
786
|
+
b);setState$$module$build$src$core$utils$aria(this.htmlDiv_,State$$module$build$src$core$utils$aria.SELECTED,a)}}setDisabled(a){this.isDisabled_=a;this.getDiv().setAttribute("disabled",`${a}`);a?this.getDiv().setAttribute("disabled","true"):this.getDiv().removeAttribute("disabled")}getName(){return this.name_}getParent(){return this.parent_}getDiv(){return this.htmlDiv_}getContents(){return this.flyoutItems_}updateFlyoutContents(a){this.flyoutItems_=[];this.toolboxItemDef_="string"===typeof a?{kind:this.toolboxItemDef_.kind,
|
|
787
|
+
custom:a,id:this.toolboxItemDef_.id,categorystyle:this.toolboxItemDef_.categorystyle,colour:this.toolboxItemDef_.colour,cssconfig:this.toolboxItemDef_.cssconfig,hidden:this.toolboxItemDef_.hidden}:{kind:this.toolboxItemDef_.kind,name:"name"in this.toolboxItemDef_?this.toolboxItemDef_.name:"",contents:convertFlyoutDefToJsonArray$$module$build$src$core$utils$toolbox(a),id:this.toolboxItemDef_.id,categorystyle:this.toolboxItemDef_.categorystyle,colour:this.toolboxItemDef_.colour,cssconfig:this.toolboxItemDef_.cssconfig,
|
|
788
|
+
hidden:this.toolboxItemDef_.hidden};this.parseContents_(this.toolboxItemDef_)}dispose(){removeNode$$module$build$src$core$utils$dom(this.htmlDiv_)}};ToolboxCategory$$module$build$src$core$toolbox$category.registrationName="category";ToolboxCategory$$module$build$src$core$toolbox$category.nestedPadding=19;ToolboxCategory$$module$build$src$core$toolbox$category.borderWidth=8;ToolboxCategory$$module$build$src$core$toolbox$category.defaultBackgroundColour="#57e";register$$module$build$src$core$css('\n.blocklyTreeRow:not(.blocklyTreeSelected):hover {\n background-color: rgba(255, 255, 255, .2);\n}\n\n.blocklyToolboxDiv[layout="h"] .blocklyToolboxCategory {\n margin: 1px 5px 1px 0;\n}\n\n.blocklyToolboxDiv[dir="RTL"][layout="h"] .blocklyToolboxCategory {\n margin: 1px 0 1px 5px;\n}\n\n.blocklyTreeRow {\n height: 22px;\n line-height: 22px;\n margin-bottom: 3px;\n padding-right: 8px;\n white-space: nowrap;\n}\n\n.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {\n margin-left: 8px;\n padding-right: 0;\n}\n\n.blocklyTreeIcon {\n background-image: url(<<<PATH>>>/sprites.png);\n height: 16px;\n vertical-align: middle;\n visibility: hidden;\n width: 16px;\n}\n\n.blocklyTreeIconClosed {\n background-position: -32px -1px;\n}\n\n.blocklyToolboxDiv[dir="RTL"] .blocklyTreeIconClosed {\n background-position: 0 -1px;\n}\n\n.blocklyTreeSelected>.blocklyTreeIconClosed {\n background-position: -32px -17px;\n}\n\n.blocklyToolboxDiv[dir="RTL"] .blocklyTreeSelected>.blocklyTreeIconClosed {\n background-position: 0 -17px;\n}\n\n.blocklyTreeIconOpen {\n background-position: -16px -1px;\n}\n\n.blocklyTreeSelected>.blocklyTreeIconOpen {\n background-position: -16px -17px;\n}\n\n.blocklyTreeLabel {\n cursor: default;\n font: 16px sans-serif;\n padding: 0 3px;\n vertical-align: middle;\n}\n\n.blocklyToolboxDelete .blocklyTreeLabel {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyTreeSelected .blocklyTreeLabel {\n color: #fff;\n}\n');
|
|
789
|
+
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.TOOLBOX_ITEM,ToolboxCategory$$module$build$src$core$toolbox$category.registrationName,ToolboxCategory$$module$build$src$core$toolbox$category);var module$build$src$core$toolbox$category={};module$build$src$core$toolbox$category.ToolboxCategory=ToolboxCategory$$module$build$src$core$toolbox$category;var ToolboxSeparator$$module$build$src$core$toolbox$separator=class extends ToolboxItem$$module$build$src$core$toolbox$toolbox_item{constructor(a,b){super(a,b);this.cssConfig_={container:"blocklyTreeSeparator"};this.htmlDiv_=null;Object.assign(this.cssConfig_,a.cssconfig||a.cssConfig)}init(){this.createDom_()}createDom_(){const a=document.createElement("div"),b=this.cssConfig_.container;b&&addClass$$module$build$src$core$utils$dom(a,b);return this.htmlDiv_=a}getDiv(){return this.htmlDiv_}dispose(){removeNode$$module$build$src$core$utils$dom(this.htmlDiv_)}};
|
|
781
790
|
ToolboxSeparator$$module$build$src$core$toolbox$separator.registrationName="sep";register$$module$build$src$core$css('\n.blocklyTreeSeparator {\n border-bottom: solid #e5e5e5 1px;\n height: 0;\n margin: 5px 0;\n}\n\n.blocklyToolboxDiv[layout="h"] .blocklyTreeSeparator {\n border-right: solid #e5e5e5 1px;\n border-bottom: none;\n height: auto;\n margin: 0 5px 0 5px;\n padding: 5px 0;\n width: 0;\n}\n');
|
|
782
791
|
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.TOOLBOX_ITEM,ToolboxSeparator$$module$build$src$core$toolbox$separator.registrationName,ToolboxSeparator$$module$build$src$core$toolbox$separator);var module$build$src$core$toolbox$separator={};module$build$src$core$toolbox$separator.ToolboxSeparator=ToolboxSeparator$$module$build$src$core$toolbox$separator;var CollapsibleToolboxCategory$$module$build$src$core$toolbox$collapsible_category=class extends ToolboxCategory$$module$build$src$core$toolbox$category{constructor(a,b,c){super(a,b,c);this.subcategoriesDiv_=null;this.expanded_=!1;this.toolboxItems_=[]}makeDefaultCssConfig_(){const a=super.makeDefaultCssConfig_();a.contents="blocklyToolboxContents";return a}parseContents_(a){const b=a.contents;let c=!0;if(a.custom)this.flyoutItems_=a.custom;else if(b)for(a=0;a<b.length;a++){const d=b[a];!hasItem$$module$build$src$core$registry(Type$$module$build$src$core$registry.TOOLBOX_ITEM,
|
|
783
|
-
d.kind)||d.kind.toLowerCase()===ToolboxSeparator$$module$build$src$core$toolbox$separator.registrationName&&c?(this.flyoutItems_.push(d),c=!0):(this.createToolboxItem_(d),c=!1)}}createToolboxItem_(a){let b=a.kind;"CATEGORY"
|
|
792
|
+
d.kind)||d.kind.toLowerCase()===ToolboxSeparator$$module$build$src$core$toolbox$separator.registrationName&&c?(this.flyoutItems_.push(d),c=!0):(this.createToolboxItem_(d),c=!1)}}createToolboxItem_(a){let b=a.kind;"CATEGORY"===b.toUpperCase()&&isCategoryCollapsible$$module$build$src$core$utils$toolbox(a)&&(b=CollapsibleToolboxCategory$$module$build$src$core$toolbox$collapsible_category.registrationName);a=new (getClass$$module$build$src$core$registry(Type$$module$build$src$core$registry.TOOLBOX_ITEM,
|
|
784
793
|
b))(a,this.parentToolbox_,this);this.toolboxItems_.push(a)}init(){super.init();this.setExpanded("true"===this.toolboxItemDef_.expanded||this.toolboxItemDef_.expanded)}createDom_(){super.createDom_();const a=this.getChildToolboxItems();this.subcategoriesDiv_=this.createSubCategoriesDom_(a);setRole$$module$build$src$core$utils$aria(this.subcategoriesDiv_,Role$$module$build$src$core$utils$aria.GROUP);this.htmlDiv_.appendChild(this.subcategoriesDiv_);return this.htmlDiv_}createIconDom_(){const a=document.createElement("span");
|
|
785
|
-
this.parentToolbox_.isHorizontal()
|
|
794
|
+
if(!this.parentToolbox_.isHorizontal()){const b=this.cssConfig_.icon;b&&addClass$$module$build$src$core$utils$dom(a,b);a.style.visibility="visible"}a.style.display="inline-block";return a}createSubCategoriesDom_(a){const b=document.createElement("div");var c=this.cssConfig_.contents;c&&addClass$$module$build$src$core$utils$dom(b,c);for(c=0;c<a.length;c++){const d=a[c];d.init();const e=d.getDiv();b.appendChild(e);if(d.getClickTarget){let f;null==(f=d.getClickTarget())||f.setAttribute("id",d.getId())}}return b}setExpanded(a){this.expanded_!==
|
|
786
795
|
a&&((this.expanded_=a)?(this.subcategoriesDiv_.style.display="block",this.openIcon_(this.iconDom_)):(this.subcategoriesDiv_.style.display="none",this.closeIcon_(this.iconDom_)),setState$$module$build$src$core$utils$aria(this.htmlDiv_,State$$module$build$src$core$utils$aria.EXPANDED,a),this.parentToolbox_.handleToolboxItemResize())}setVisible_(a){this.htmlDiv_.style.display=a?"block":"none";const b=this.getChildToolboxItems();for(let c=0;c<b.length;c++)b[c].setVisible_(a);this.isHidden_=!a;this.parentToolbox_.getSelectedItem()===
|
|
787
796
|
this&&this.parentToolbox_.clearSelection()}isExpanded(){return this.expanded_}isCollapsible(){return!0}onClick(a){this.toggleExpanded()}toggleExpanded(){this.setExpanded(!this.expanded_)}getDiv(){return this.htmlDiv_}getChildToolboxItems(){return this.toolboxItems_}};CollapsibleToolboxCategory$$module$build$src$core$toolbox$collapsible_category.registrationName="collapsibleCategory";
|
|
788
797
|
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.TOOLBOX_ITEM,CollapsibleToolboxCategory$$module$build$src$core$toolbox$collapsible_category.registrationName,CollapsibleToolboxCategory$$module$build$src$core$toolbox$collapsible_category);var module$build$src$core$toolbox$collapsible_category={};module$build$src$core$toolbox$collapsible_category.CollapsibleToolboxCategory=CollapsibleToolboxCategory$$module$build$src$core$toolbox$collapsible_category;var Toolbox$$module$build$src$core$toolbox$toolbox=class extends DeleteArea$$module$build$src$core$delete_area{constructor(a){super();this.id="toolbox";this.contentsDiv_=this.HtmlDiv=null;this.isVisible_=!1;this.contents_=[];this.height_=this.width_=0;this.previouslySelectedItem_=this.selectedItem_=this.flyout_=null;this.boundEvents_=[];this.workspace_=a;this.toolboxDef_=a.options.languageTree||{contents:[]};this.horizontalLayout_=a.options.horizontalLayout;this.RTL=a.options.RTL;this.contentMap_=
|
|
@@ -794,9 +803,9 @@ else{var b=a.target.getAttribute("id");b&&(b=this.getToolboxItemById(b),b.isSele
|
|
|
794
803
|
this.selectParent_();break;case KeyCodes$$module$build$src$core$utils$keycodes.RIGHT:b=this.selectChild_();break;case KeyCodes$$module$build$src$core$utils$keycodes.ENTER:case KeyCodes$$module$build$src$core$utils$keycodes.SPACE:this.selectedItem_&&this.selectedItem_.isCollapsible()&&(this.selectedItem_.toggleExpanded(),b=!0);break;default:b=!1}if(!b&&this.selectedItem_){const c=this.selectedItem_;c.onKeyDown&&(b=c.onKeyDown(a))}b&&a.preventDefault()}createFlyout_(){const a=this.workspace_,b=new Options$$module$build$src$core$options({parentWorkspace:a,
|
|
795
804
|
rtl:a.RTL,oneBasedIndex:a.options.oneBasedIndex,horizontalLayout:a.horizontalLayout,renderer:a.options.renderer,rendererOverrides:a.options.rendererOverrides,move:{scrollbars:!0}});b.toolboxPosition=a.options.toolboxPosition;return new (a.horizontalLayout?getClassFromOptions$$module$build$src$core$registry(Type$$module$build$src$core$registry.FLYOUTS_HORIZONTAL_TOOLBOX,a.options,!0):getClassFromOptions$$module$build$src$core$registry(Type$$module$build$src$core$registry.FLYOUTS_VERTICAL_TOOLBOX,a.options,
|
|
796
805
|
!0))(b)}render(a){this.toolboxDef_=a;for(let b=0;b<this.contents_.length;b++){const c=this.contents_[b];c&&c.dispose()}this.contents_=[];this.contentMap_=Object.create(null);this.renderContents_(a.contents);this.position();this.handleToolboxItemResize()}renderContents_(a){const b=document.createDocumentFragment();for(let c=0;c<a.length;c++)this.createToolboxItem_(a[c],b);this.contentsDiv_.appendChild(b)}createToolboxItem_(a,b){var c=a.kind;"CATEGORY"===c.toUpperCase()&&isCategoryCollapsible$$module$build$src$core$utils$toolbox(a)&&
|
|
797
|
-
(c=CollapsibleToolboxCategory$$module$build$src$core$toolbox$collapsible_category.registrationName);if(c=getClass$$module$build$src$core$registry(Type$$module$build$src$core$registry.TOOLBOX_ITEM,c.toLowerCase()))a=new c(a,this),a.init(),this.addToolboxItem_(a),(c=a.getDiv())&&b.appendChild(c),a.getClickTarget()&&a.getClickTarget().setAttribute("id",a.getId())}addToolboxItem_(a){this.contents_.push(a);this.contentMap_[a.getId()]=a;if(a.isCollapsible()){a=a.getChildToolboxItems();for(let b=0;b<a.length;b++)this.addToolboxItem_(a[b])}}getToolboxItems(){return this.contents_}addStyle(a){
|
|
798
|
-
a)}removeStyle(a){removeClass$$module$build$src$core$utils$dom(this.HtmlDiv,a)}getClientRect(){if(!this.HtmlDiv||!this.isVisible_)return null;var a=this.HtmlDiv.getBoundingClientRect();const b=a.top,c=b+a.height,d=a.left;a=d+a.width;return this.toolboxPosition===Position$$module$build$src$core$utils$toolbox.TOP?new Rect$$module$build$src$core$utils$rect(-1E7,c,-1E7,1E7):this.toolboxPosition===Position$$module$build$src$core$utils$toolbox.BOTTOM?
|
|
799
|
-
1E7):this.toolboxPosition===Position$$module$build$src$core$utils$toolbox.LEFT?new Rect$$module$build$src$core$utils$rect(-1E7,1E7,-1E7,a):new Rect$$module$build$src$core$utils$rect(-1E7,1E7,d,1E7)}wouldDelete(a,b){a instanceof BlockSvg$$module$build$src$core$block_svg?this.updateWouldDelete_(!a.getParent()&&a.isDeletable()):this.updateWouldDelete_(a.isDeletable());return this.wouldDelete_}onDragEnter(a){this.updateCursorDeleteStyle_(!0)}onDragExit(a){this.updateCursorDeleteStyle_(!1)}onDrop(a){this.updateCursorDeleteStyle_(!1)}updateWouldDelete_(a){a!==
|
|
806
|
+
(c=CollapsibleToolboxCategory$$module$build$src$core$toolbox$collapsible_category.registrationName);if(c=getClass$$module$build$src$core$registry(Type$$module$build$src$core$registry.TOOLBOX_ITEM,c.toLowerCase()))a=new c(a,this),a.init(),this.addToolboxItem_(a),(c=a.getDiv())&&b.appendChild(c),a.getClickTarget()&&a.getClickTarget().setAttribute("id",a.getId())}addToolboxItem_(a){this.contents_.push(a);this.contentMap_[a.getId()]=a;if(a.isCollapsible()){a=a.getChildToolboxItems();for(let b=0;b<a.length;b++)this.addToolboxItem_(a[b])}}getToolboxItems(){return this.contents_}addStyle(a){a&&
|
|
807
|
+
this.HtmlDiv&&addClass$$module$build$src$core$utils$dom(this.HtmlDiv,a)}removeStyle(a){a&&this.HtmlDiv&&removeClass$$module$build$src$core$utils$dom(this.HtmlDiv,a)}getClientRect(){if(!this.HtmlDiv||!this.isVisible_)return null;var a=this.HtmlDiv.getBoundingClientRect();const b=a.top,c=b+a.height,d=a.left;a=d+a.width;return this.toolboxPosition===Position$$module$build$src$core$utils$toolbox.TOP?new Rect$$module$build$src$core$utils$rect(-1E7,c,-1E7,1E7):this.toolboxPosition===Position$$module$build$src$core$utils$toolbox.BOTTOM?
|
|
808
|
+
new Rect$$module$build$src$core$utils$rect(b,1E7,-1E7,1E7):this.toolboxPosition===Position$$module$build$src$core$utils$toolbox.LEFT?new Rect$$module$build$src$core$utils$rect(-1E7,1E7,-1E7,a):new Rect$$module$build$src$core$utils$rect(-1E7,1E7,d,1E7)}wouldDelete(a,b){a instanceof BlockSvg$$module$build$src$core$block_svg?this.updateWouldDelete_(!a.getParent()&&a.isDeletable()):this.updateWouldDelete_(a.isDeletable());return this.wouldDelete_}onDragEnter(a){this.updateCursorDeleteStyle_(!0)}onDragExit(a){this.updateCursorDeleteStyle_(!1)}onDrop(a){this.updateCursorDeleteStyle_(!1)}updateWouldDelete_(a){a!==
|
|
800
809
|
this.wouldDelete_&&(this.updateCursorDeleteStyle_(!1),this.wouldDelete_=a,this.updateCursorDeleteStyle_(!0))}updateCursorDeleteStyle_(a){const b=this.wouldDelete_?"blocklyToolboxDelete":"blocklyToolboxGrab";a?this.addStyle(b):this.removeStyle(b)}getToolboxItemById(a){return this.contentMap_[a]||null}getWidth(){return this.width_}getHeight(){return this.height_}getFlyout(){return this.flyout_}getWorkspace(){return this.workspace_}getSelectedItem(){return this.selectedItem_}getPreviouslySelectedItem(){return this.previouslySelectedItem_}isHorizontal(){return this.horizontalLayout_}position(){const a=
|
|
801
810
|
this.workspace_.getMetrics(),b=this.HtmlDiv;b&&(this.horizontalLayout_?(b.style.left="0",b.style.height="auto",b.style.width="100%",this.height_=b.offsetHeight,this.width_=a.viewWidth,this.toolboxPosition===Position$$module$build$src$core$utils$toolbox.TOP?b.style.top="0":b.style.bottom="0"):(this.toolboxPosition===Position$$module$build$src$core$utils$toolbox.RIGHT?b.style.right="0":b.style.left="0",b.style.height="100%",this.width_=b.offsetWidth,this.height_=a.viewHeight),this.flyout_.position())}handleToolboxItemResize(){const a=
|
|
802
811
|
this.workspace_,b=this.HtmlDiv.getBoundingClientRect();a.translate(this.toolboxPosition===Position$$module$build$src$core$utils$toolbox.LEFT?a.scrollX+b.width:a.scrollX,this.toolboxPosition===Position$$module$build$src$core$utils$toolbox.TOP?a.scrollY+b.height:a.scrollY);svgResize$$module$build$src$core$common(a)}clearSelection(){this.setSelectedItem(null)}refreshTheme(){for(let a=0;a<this.contents_.length;a++){const b=this.contents_[a];b.refreshTheme&&b.refreshTheme()}}refreshSelection(){this.selectedItem_&&
|
|
@@ -809,34 +818,36 @@ if(b&&b.isSelectable())return this.setSelectedItem(b),!0}return!1}dispose(){this
|
|
|
809
818
|
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.TOOLBOX,DEFAULT$$module$build$src$core$registry,Toolbox$$module$build$src$core$toolbox$toolbox);var module$build$src$core$toolbox$toolbox={};module$build$src$core$toolbox$toolbox.Toolbox=Toolbox$$module$build$src$core$toolbox$toolbox;var defaultBlockStyles$$module$build$src$core$theme$zelos={colour_blocks:{colourPrimary:"#CF63CF",colourSecondary:"#C94FC9",colourTertiary:"#BD42BD"},list_blocks:{colourPrimary:"#9966FF",colourSecondary:"#855CD6",colourTertiary:"#774DCB"},logic_blocks:{colourPrimary:"#4C97FF",colourSecondary:"#4280D7",colourTertiary:"#3373CC"},loop_blocks:{colourPrimary:"#0fBD8C",colourSecondary:"#0DA57A",colourTertiary:"#0B8E69"},math_blocks:{colourPrimary:"#59C059",colourSecondary:"#46B946",colourTertiary:"#389438"},
|
|
810
819
|
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=
|
|
811
820
|
{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),
|
|
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.
|
|
813
|
-
|
|
821
|
+
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.type=CLICK$$module$build$src$core$events$utils;this.blockId=a?a.id:void 0;this.targetType=c}toJson(){const a=super.toJson();if(!this.targetType)throw Error("The click target type is undefined. Either pass a block to the constructor, or call fromJson");a.targetType=this.targetType;a.blockId=this.blockId;return a}fromJson(a){super.fromJson(a);
|
|
822
|
+
this.targetType=a.targetType;this.blockId=a.blockId}},ClickTarget$$module$build$src$core$events$events_click;(function(a){a.BLOCK="block";a.WORKSPACE="workspace";a.ZOOM_CONTROLS="zoom_controls"})(ClickTarget$$module$build$src$core$events$events_click||(ClickTarget$$module$build$src$core$events$events_click={}));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);
|
|
823
|
+
var module$build$src$core$events$events_click={};module$build$src$core$events$events_click.Click=Click$$module$build$src$core$events$events_click;module$build$src$core$events$events_click.ClickTarget=ClickTarget$$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
824
|
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
825
|
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
826
|
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
827
|
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
828
|
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);
|
|
819
829
|
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={};
|
|
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_=
|
|
821
|
-
|
|
830
|
+
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.mouseDownXY_=new Coordinate$$module$build$src$core$utils$coordinate(0,0);this.startWorkspace_=this.targetBlock_=this.startBlock_=this.startField_=this.startBubble_=null;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_=a;
|
|
831
|
+
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();
|
|
822
832
|
this.workspaceDragger_&&this.workspaceDragger_.dispose()}updateFromEvent_(a){const b=new Coordinate$$module$build$src$core$utils$coordinate(a.clientX,a.clientY);this.updateDragDelta_(b)&&(this.updateIsDragging_(),longStop$$module$build$src$core$touch());this.mostRecentEvent_=a}updateDragDelta_(a){this.currentDragDeltaXY_=Coordinate$$module$build$src$core$utils$coordinate.difference(a,this.mouseDownXY_);return this.hasExceededDragRadius_?!1:this.hasExceededDragRadius_=Coordinate$$module$build$src$core$utils$coordinate.magnitude(this.currentDragDeltaXY_)>
|
|
823
|
-
(this.flyout_?$.config$$module$build$src$core$config.flyoutDragRadius:$.config$$module$build$src$core$config.dragRadius)}updateIsDraggingFromFlyout_(){
|
|
824
|
-
this.startBlock_=null,this.targetBlock_=this.flyout_.createBlock(this.targetBlock_),this.targetBlock_.select(),!0):!1
|
|
825
|
-
this.flyout_.isScrollable():this.startWorkspace_&&this.startWorkspace_.isDraggable())this.workspaceDragger_=new WorkspaceDragger$$module$build$src$core$workspace_dragger(this.startWorkspace_),this.
|
|
826
|
-
new (getClassFromOptions$$module$build$src$core$registry(Type$$module$build$src$core$registry.BLOCK_DRAGGER,this.creatorWorkspace.options,!0))(this.targetBlock_,this.startWorkspace_);this.blockDragger_.startDrag(this.currentDragDeltaXY_,this.healStack_);this.blockDragger_.drag(this.mostRecentEvent_,this.currentDragDeltaXY_)}startDraggingBubble_(){
|
|
827
|
-
|
|
828
|
-
this.
|
|
829
|
-
"
|
|
830
|
-
a.preventDefault();a.stopPropagation()}
|
|
831
|
-
this.
|
|
832
|
-
this.dispose())}
|
|
833
|
-
this.
|
|
834
|
-
|
|
835
|
-
this.
|
|
836
|
-
this.
|
|
837
|
-
|
|
838
|
-
this.
|
|
839
|
-
this.
|
|
833
|
+
(this.flyout_?$.config$$module$build$src$core$config.flyoutDragRadius:$.config$$module$build$src$core$config.dragRadius)}updateIsDraggingFromFlyout_(){let a;if(!this.targetBlock_||null==(a=this.flyout_)||!a.isBlockCreatable(this.targetBlock_))return!1;if(!this.flyout_.targetWorkspace)throw Error("Cannot update dragging from the flyout because the ' +\n 'flyout's target workspace is undefined");return!this.flyout_.isScrollable()||this.flyout_.isDragTowardWorkspace(this.currentDragDeltaXY_)?
|
|
834
|
+
(this.startWorkspace_=this.flyout_.targetWorkspace,this.startWorkspace_.updateScreenCalculationsIfScrolled(),getGroup$$module$build$src$core$events$utils()||setGroup$$module$build$src$core$events$utils(!0),this.startBlock_=null,this.targetBlock_=this.flyout_.createBlock(this.targetBlock_),this.targetBlock_.select(),!0):!1}updateIsDraggingBubble_(){if(!this.startBubble_)return!1;this.startDraggingBubble_();return!0}updateIsDraggingBlock_(){if(!this.targetBlock_)return!1;if(this.flyout_){if(this.updateIsDraggingFromFlyout_())return this.startDraggingBlock_(),
|
|
835
|
+
!0}else if(this.targetBlock_.isMovable())return this.startDraggingBlock_(),!0;return!1}updateIsDraggingWorkspace_(){if(!this.startWorkspace_)throw Error("Cannot update dragging the workspace because the start workspace is undefined");if(this.flyout_?this.flyout_.isScrollable():this.startWorkspace_&&this.startWorkspace_.isDraggable())this.workspaceDragger_=new WorkspaceDragger$$module$build$src$core$workspace_dragger(this.startWorkspace_),this.workspaceDragger_.startDrag()}updateIsDragging_(){if(this.calledUpdateIsDragging_)throw Error("updateIsDragging_ should only be called once per gesture.");
|
|
836
|
+
this.calledUpdateIsDragging_=!0;this.updateIsDraggingBubble_()||this.updateIsDraggingBlock_()||this.updateIsDraggingWorkspace_()}startDraggingBlock_(){this.blockDragger_=new (getClassFromOptions$$module$build$src$core$registry(Type$$module$build$src$core$registry.BLOCK_DRAGGER,this.creatorWorkspace.options,!0))(this.targetBlock_,this.startWorkspace_);this.blockDragger_.startDrag(this.currentDragDeltaXY_,this.healStack_);this.blockDragger_.drag(this.mostRecentEvent_,this.currentDragDeltaXY_)}startDraggingBubble_(){if(!this.startBubble_)throw Error("Cannot update dragging the bubble because the start bubble is undefined");
|
|
837
|
+
if(!this.startWorkspace_)throw Error("Cannot update dragging the bubble because the start workspace is undefined");this.bubbleDragger_=new BubbleDragger$$module$build$src$core$bubble_dragger(this.startBubble_,this.startWorkspace_);this.bubbleDragger_.startBubbleDrag();this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_)}doStart(a){if(isTargetInput$$module$build$src$core$browser_events(a))this.cancel();else{if(!this.startWorkspace_)throw Error("Cannot start the gesture because the start workspace is undefined");
|
|
838
|
+
this.hasStarted_=!0;disconnectUiStop$$module$build$src$core$block_animations();this.startWorkspace_.updateScreenCalculationsIfScrolled();this.startWorkspace_.isMutator&&this.startWorkspace_.resize();this.startWorkspace_.hideChaff(!!this.flyout_);this.startWorkspace_.markFocused();this.mostRecentEvent_=a;block$$module$build$src$core$tooltip();this.targetBlock_&&this.targetBlock_.select();isRightButton$$module$build$src$core$browser_events(a)?this.handleRightClick(a):("touchstart"!==a.type.toLowerCase()&&
|
|
839
|
+
"pointerdown"!==a.type.toLowerCase()||"mouse"===a.pointerType||longStart$$module$build$src$core$touch(a,this),this.mouseDownXY_=new Coordinate$$module$build$src$core$utils$coordinate(a.clientX,a.clientY),this.healStack_=a.altKey||a.ctrlKey||a.metaKey,this.bindMouseEvents(a))}}bindMouseEvents(a){this.onMoveWrapper_=conditionalBind$$module$build$src$core$browser_events(document,"mousemove",null,this.handleMove.bind(this));this.onUpWrapper_=conditionalBind$$module$build$src$core$browser_events(document,
|
|
840
|
+
"mouseup",null,this.handleUp.bind(this));a.preventDefault();a.stopPropagation()}handleMove(a){this.updateFromEvent_(a);this.workspaceDragger_?this.workspaceDragger_.drag(this.currentDragDeltaXY_):this.blockDragger_?this.blockDragger_.drag(this.mostRecentEvent_,this.currentDragDeltaXY_):this.bubbleDragger_&&this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_);a.preventDefault();a.stopPropagation()}handleUp(a){this.updateFromEvent_(a);longStop$$module$build$src$core$touch();
|
|
841
|
+
this.isEnding_?console.log("Trying to end a gesture recursively."):(this.isEnding_=!0,this.bubbleDragger_?this.bubbleDragger_.endBubbleDrag(a,this.currentDragDeltaXY_):this.blockDragger_?this.blockDragger_.endDrag(a,this.currentDragDeltaXY_):this.workspaceDragger_?this.workspaceDragger_.endDrag(this.currentDragDeltaXY_):this.isBubbleClick_()?this.doBubbleClick_():this.isFieldClick_()?this.doFieldClick_():this.isBlockClick_()?this.doBlockClick_():this.isWorkspaceClick_()&&this.doWorkspaceClick_(a),
|
|
842
|
+
a.preventDefault(),a.stopPropagation(),this.dispose())}cancel(){this.isEnding_||(longStop$$module$build$src$core$touch(),this.bubbleDragger_?this.bubbleDragger_.endBubbleDrag(this.mostRecentEvent_,this.currentDragDeltaXY_):this.blockDragger_?this.blockDragger_.endDrag(this.mostRecentEvent_,this.currentDragDeltaXY_):this.workspaceDragger_&&this.workspaceDragger_.endDrag(this.currentDragDeltaXY_),this.dispose())}handleRightClick(a){this.targetBlock_?(this.bringBlockToFront_(),this.targetBlock_.workspace.hideChaff(!!this.flyout_),
|
|
843
|
+
this.targetBlock_.showContextMenu(a)):this.startBubble_?this.startBubble_.showContextMenu(a):this.startWorkspace_&&!this.flyout_&&(this.startWorkspace_.hideChaff(),this.startWorkspace_.showContextMenu(a));a.preventDefault();a.stopPropagation();this.dispose()}handleWsStart(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");this.setStartWorkspace_(b);this.mostRecentEvent_=a;this.doStart(a)}fireWorkspaceClick_(a){fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CLICK$$module$build$src$core$events$utils))(null,
|
|
844
|
+
a.id,"workspace"))}handleFlyoutStart(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");this.setStartFlyout_(b);this.handleWsStart(a,b.getWorkspace())}handleBlockStart(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleBlockStart, but the gesture had already been started.");this.setStartBlock(b);this.mostRecentEvent_=a}handleBubbleStart(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");
|
|
845
|
+
this.setStartBubble(b);this.mostRecentEvent_=a}doBubbleClick_(){this.startBubble_ instanceof WorkspaceCommentSvg$$module$build$src$core$workspace_comment_svg&&(this.startBubble_.setFocus(),this.startBubble_.select())}doFieldClick_(){if(!this.startField_)throw Error("Cannot do a field click because the start field is undefined");this.startField_.showEditor(this.mostRecentEvent_);this.bringBlockToFront_()}doBlockClick_(){if(this.flyout_&&this.flyout_.autoClose){if(!this.targetBlock_)throw Error("Cannot do a block click because the target block is undefined");
|
|
846
|
+
this.targetBlock_.isEnabled()&&(getGroup$$module$build$src$core$events$utils()||setGroup$$module$build$src$core$events$utils(!0),this.flyout_.createBlock(this.targetBlock_).scheduleSnapAndBump())}else{if(!this.startWorkspace_)throw Error("Cannot do a block click because the start workspace is undefined");const a=new (get$$module$build$src$core$events$utils(CLICK$$module$build$src$core$events$utils))(this.startBlock_,this.startWorkspace_.id,"block");fire$$module$build$src$core$events$utils(a)}this.bringBlockToFront_();
|
|
847
|
+
setGroup$$module$build$src$core$events$utils(!1)}doWorkspaceClick_(a){a=this.creatorWorkspace;getSelected$$module$build$src$core$common()&&getSelected$$module$build$src$core$common().unselect();this.fireWorkspaceClick_(this.startWorkspace_||a)}bringBlockToFront_(){this.targetBlock_&&!this.flyout_&&this.targetBlock_.bringToFront()}setStartField(a){if(this.hasStarted_)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");this.startField_||(this.startField_=a)}setStartBubble(a){this.startBubble_||
|
|
848
|
+
(this.startBubble_=a)}setStartBlock(a){this.startBlock_||this.startBubble_||(this.startBlock_=a,a.isInFlyout&&a!==a.getRootBlock()?this.setTargetBlock_(a.getRootBlock()):this.setTargetBlock_(a))}setTargetBlock_(a){a.isShadow()?this.setTargetBlock_(a.getParent()):this.targetBlock_=a}setStartWorkspace_(a){this.startWorkspace_||(this.startWorkspace_=a)}setStartFlyout_(a){this.flyout_||(this.flyout_=a)}isBubbleClick_(){return!!this.startBubble_&&!this.hasExceededDragRadius_}isBlockClick_(){return!!this.startBlock_&&
|
|
849
|
+
!this.hasExceededDragRadius_&&!this.isFieldClick_()}isFieldClick_(){return(this.startField_?this.startField_.isClickable():!1)&&!this.hasExceededDragRadius_&&(!this.flyout_||!this.flyout_.autoClose)}isWorkspaceClick_(){return!this.startBlock_&&!this.startBubble_&&!this.startField_&&!this.hasExceededDragRadius_}isDragging(){return!!this.workspaceDragger_||!!this.blockDragger_||!!this.bubbleDragger_}hasStarted(){return this.hasStarted_}getInsertionMarkers(){return this.blockDragger_?this.blockDragger_.getInsertionMarkers():
|
|
850
|
+
[]}getCurrentDragger(){let a,b;return null!=(b=null!=(a=this.blockDragger_)?a:this.workspaceDragger_)?b:this.bubbleDragger_}static inProgress(){const a=getAllWorkspaces$$module$build$src$core$common();for(let b=0,c;c=a[b];b++)if(c.currentGesture_)return!0;return!1}},module$build$src$core$gesture={};module$build$src$core$gesture.Gesture=Gesture$$module$build$src$core$gesture;var ShortcutRegistry$$module$build$src$core$shortcut_registry=class{constructor(){this.shortcuts=new Map;this.keyMap=new Map;this.reset()}reset(){this.shortcuts.clear();this.keyMap.clear()}register(a,b){if(this.shortcuts.get(a.name)&&!b)throw Error('Shortcut with name "'+a.name+'" already exists.');this.shortcuts.set(a.name,a);if((b=a.keyCodes)&&0<b.length)for(let c=0;c<b.length;c++)this.addKeyMapping(b[c],a.name,!!a.allowCollision)}unregister(a){if(!this.shortcuts.get(a))return console.warn('Keyboard shortcut with name "'+
|
|
840
851
|
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),
|
|
841
852
|
!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),
|
|
842
853
|
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=
|
|
@@ -844,9 +855,10 @@ a)}onKeyDown(a,b){var c=this.serializeKeyEvent_(b);c=this.getShortcutNamesByKeyC
|
|
|
844
855
|
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;
|
|
845
856
|
(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;
|
|
846
857
|
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;
|
|
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.
|
|
848
|
-
var module$build$src$core$events$events_theme_change={};module$build$src$core$events$events_theme_change.ThemeChange=ThemeChange$$module$build$src$core$events$events_theme_change;var ViewportChange$$module$build$src$core$events$events_viewport=class extends UiBase$$module$build$src$core$events$events_ui_base{constructor(a,b,c,d,e){super(d);this.viewTop=a;this.viewLeft=b;this.scale=c;this.oldScale=e
|
|
849
|
-
|
|
858
|
+
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.type=THEME_CHANGE$$module$build$src$core$events$utils;this.themeName=a}toJson(){const a=super.toJson();if(!this.themeName)throw Error("The theme name is undefined. Either pass a theme name to the constructor, or call fromJson");a.themeName=this.themeName;return a}fromJson(a){super.fromJson(a);this.themeName=a.themeName}};
|
|
859
|
+
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);var module$build$src$core$events$events_theme_change={};module$build$src$core$events$events_theme_change.ThemeChange=ThemeChange$$module$build$src$core$events$events_theme_change;var ViewportChange$$module$build$src$core$events$events_viewport=class extends UiBase$$module$build$src$core$events$events_ui_base{constructor(a,b,c,d,e){super(d);this.type=VIEWPORT_CHANGE$$module$build$src$core$events$utils;this.viewTop=a;this.viewLeft=b;this.scale=c;this.oldScale=e}toJson(){const a=super.toJson();if(void 0===this.viewTop)throw Error("The view top is undefined. Either pass a value to the constructor, or call fromJson");if(void 0===this.viewLeft)throw Error("The view left is undefined. Either pass a value to the constructor, or call fromJson");
|
|
860
|
+
if(void 0===this.scale)throw Error("The scale is undefined. Either pass a value to the constructor, or call fromJson");if(void 0===this.oldScale)throw Error("The old scale is undefined. Either pass a value to the constructor, or call fromJson");a.viewTop=this.viewTop;a.viewLeft=this.viewLeft;a.scale=this.scale;a.oldScale=this.oldScale;return a}fromJson(a){super.fromJson(a);this.viewTop=a.viewTop;this.viewLeft=a.viewLeft;this.scale=a.scale;this.oldScale=a.oldScale}};
|
|
861
|
+
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,VIEWPORT_CHANGE$$module$build$src$core$events$utils,ViewportChange$$module$build$src$core$events$events_viewport);var module$build$src$core$events$events_viewport={};module$build$src$core$events$events_viewport.ViewportChange=ViewportChange$$module$build$src$core$events$events_viewport;var ConnectionDB$$module$build$src$core$connection_db=class{constructor(a){this.connectionChecker=a;this.connections_=[]}addConnection(a,b){b=this.calculateIndexForYPos_(b);this.connections_.splice(b,0,a)}findIndexOfConnection_(a,b){if(!this.connections_.length)return-1;const c=this.calculateIndexForYPos_(b);if(c>=this.connections_.length)return-1;b=a.y;let d=c;for(;0<=d&&this.connections_[d].y===b;){if(this.connections_[d]===a)return d;d--}for(d=c;d<this.connections_.length&&this.connections_[d].y===
|
|
850
862
|
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;
|
|
851
863
|
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<=
|
|
852
864
|
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]=
|
|
@@ -871,7 +883,7 @@ this.elements[d];b+=e.width;Types$$module$build$src$core$renderers$measurables$t
|
|
|
871
883
|
module$build$src$core$renderers$measurables$bottom_row.BottomRow=BottomRow$$module$build$src$core$renderers$measurables$bottom_row;var Connection$$module$build$src$core$renderers$measurables$connection=class extends Measurable$$module$build$src$core$renderers$measurables$base{constructor(a,b){super(a);this.connectionModel=b;this.shape=this.constants_.shapeFor(b);this.isDynamicShape="isDynamic"in this.shape&&this.shape.isDynamic;this.type|=Types$$module$build$src$core$renderers$measurables$types.CONNECTION}},module$build$src$core$renderers$measurables$connection={};
|
|
872
884
|
module$build$src$core$renderers$measurables$connection.Connection=Connection$$module$build$src$core$renderers$measurables$connection;var InputConnection$$module$build$src$core$renderers$measurables$input_connection=class extends Connection$$module$build$src$core$renderers$measurables$connection{constructor(a,b){super(a,b.connection);this.input=b;this.connectionOffsetY=this.connectionOffsetX=0;this.type|=Types$$module$build$src$core$renderers$measurables$types.INPUT;this.align=b.align;(this.connectedBlock=b.connection&&b.connection.targetBlock()?b.connection.targetBlock():null)?(a=this.connectedBlock.getHeightWidth(),this.connectedBlockWidth=
|
|
873
885
|
a.width,this.connectedBlockHeight=a.height):this.connectedBlockHeight=this.connectedBlockWidth=0}},module$build$src$core$renderers$measurables$input_connection={};module$build$src$core$renderers$measurables$input_connection.InputConnection=InputConnection$$module$build$src$core$renderers$measurables$input_connection;var ExternalValueInput$$module$build$src$core$renderers$measurables$external_value_input=class extends InputConnection$$module$build$src$core$renderers$measurables$input_connection{constructor(a,b){super(a,b);this.height=0;this.type|=Types$$module$build$src$core$renderers$measurables$types.EXTERNAL_VALUE_INPUT;this.height=this.connectedBlock?this.connectedBlockHeight-this.constants_.TAB_OFFSET_FROM_TOP-this.constants_.MEDIUM_PADDING:this.shape.height;this.width=this.shape.width+this.constants_.EXTERNAL_VALUE_INPUT_PADDING;
|
|
874
|
-
this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP;this.connectionHeight=this.shape.height;this.connectionWidth=this.shape.width}},module$build$src$core$renderers$measurables$external_value_input={};module$build$src$core$renderers$measurables$external_value_input.ExternalValueInput=ExternalValueInput$$module$build$src$core$renderers$measurables$external_value_input;var Field$$module$build$src$core$renderers$measurables$field=class extends Measurable$$module$build$src$core$renderers$measurables$base{constructor(a,b,c){super(a);this.field=b;this.parentInput=c;this.isEditable=b.EDITABLE;this.flipRtl=b.getFlipRtl();this.type|=Types$$module$build$src$core$renderers$measurables$types.FIELD;a=this.field.getSize();this.height=a.height;this.width=a.width}},module$build$src$core$renderers$measurables$field={};module$build$src$core$renderers$measurables$field.Field=Field$$module$build$src$core$renderers$measurables$field;var Hat$$module$build$src$core$renderers$measurables$hat=class extends Measurable$$module$build$src$core$renderers$measurables$base{constructor(a){super(a);this.type|=Types$$module$build$src$core$renderers$measurables$types.HAT;this.height=this.constants_.START_HAT.height;this.width=this.constants_.START_HAT.width;this.ascenderHeight=this.height}},module$build$src$core$renderers$measurables$hat={};module$build$src$core$renderers$measurables$hat.Hat=Hat$$module$build$src$core$renderers$measurables$hat;var Icon$$module$build$src$core$renderers$measurables$icon=class extends Measurable$$module$build$src$core$renderers$measurables$base{constructor(a,b){super(a);this.icon=b;this.isVisible=b.isVisible();this.type|=Types$$module$build$src$core$renderers$measurables$types.ICON;a=b.getCorrectedSize();this.height=a.height;this.width=a.width}},module$build$src$core$renderers$measurables$icon={};module$build$src$core$renderers$measurables$icon.Icon=Icon$$module$build$src$core$renderers$measurables$icon;var InRowSpacer$$module$build$src$core$renderers$measurables$in_row_spacer=class extends Measurable$$module$build$src$core$renderers$measurables$base{constructor(a,b){super(a);this.type=this.type|Types$$module$build$src$core$renderers$measurables$types.SPACER|Types$$module$build$src$core$renderers$measurables$types.IN_ROW_SPACER;this.width=b;this.height=this.constants_.SPACER_DEFAULT_HEIGHT}},module$build$src$core$renderers$measurables$in_row_spacer={};
|
|
886
|
+
this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP;this.connectionHeight=this.shape.height;this.connectionWidth=this.shape.width}},module$build$src$core$renderers$measurables$external_value_input={};module$build$src$core$renderers$measurables$external_value_input.ExternalValueInput=ExternalValueInput$$module$build$src$core$renderers$measurables$external_value_input;var Field$$module$build$src$core$renderers$measurables$field=class extends Measurable$$module$build$src$core$renderers$measurables$base{constructor(a,b,c){super(a);this.field=b;this.parentInput=c;this.isEditable=b.EDITABLE;this.flipRtl=b.getFlipRtl();this.type|=Types$$module$build$src$core$renderers$measurables$types.FIELD;a=this.field.getSize();this.height=a.height;this.width=a.width}},module$build$src$core$renderers$measurables$field={};module$build$src$core$renderers$measurables$field.Field=Field$$module$build$src$core$renderers$measurables$field;var Hat$$module$build$src$core$renderers$measurables$hat=class extends Measurable$$module$build$src$core$renderers$measurables$base{constructor(a){super(a);this.type|=Types$$module$build$src$core$renderers$measurables$types.HAT;this.height=this.constants_.START_HAT.height;this.width=this.constants_.START_HAT.width;this.ascenderHeight=this.height}},module$build$src$core$renderers$measurables$hat={};module$build$src$core$renderers$measurables$hat.Hat=Hat$$module$build$src$core$renderers$measurables$hat;var Icon$$module$build$src$core$renderers$measurables$icon=class extends Measurable$$module$build$src$core$renderers$measurables$base{constructor(a,b){super(a);this.icon=b;this.flipRtl=!1;this.isVisible=b.isVisible();this.type|=Types$$module$build$src$core$renderers$measurables$types.ICON;a=b.getCorrectedSize();this.height=a.height;this.width=a.width}},module$build$src$core$renderers$measurables$icon={};module$build$src$core$renderers$measurables$icon.Icon=Icon$$module$build$src$core$renderers$measurables$icon;var InRowSpacer$$module$build$src$core$renderers$measurables$in_row_spacer=class extends Measurable$$module$build$src$core$renderers$measurables$base{constructor(a,b){super(a);this.type=this.type|Types$$module$build$src$core$renderers$measurables$types.SPACER|Types$$module$build$src$core$renderers$measurables$types.IN_ROW_SPACER;this.width=b;this.height=this.constants_.SPACER_DEFAULT_HEIGHT}},module$build$src$core$renderers$measurables$in_row_spacer={};
|
|
875
887
|
module$build$src$core$renderers$measurables$in_row_spacer.InRowSpacer=InRowSpacer$$module$build$src$core$renderers$measurables$in_row_spacer;var InlineInput$$module$build$src$core$renderers$measurables$inline_input=class extends InputConnection$$module$build$src$core$renderers$measurables$input_connection{constructor(a,b){super(a,b);this.type|=Types$$module$build$src$core$renderers$measurables$types.INLINE_INPUT;this.connectedBlock?(this.width=this.connectedBlockWidth,this.height=this.connectedBlockHeight):(this.height=this.constants_.EMPTY_INLINE_INPUT_HEIGHT,this.width=this.constants_.EMPTY_INLINE_INPUT_PADDING);this.connectionHeight=
|
|
876
888
|
this.isDynamicShape?this.shape.height(this.height):this.shape.height;this.connectionWidth=this.isDynamicShape?this.shape.width(this.height):this.shape.width;this.connectedBlock||(this.width+=this.connectionWidth*(this.isDynamicShape?2:1));this.connectionOffsetY="connectionOffsetY"in this.shape?this.shape.connectionOffsetY(this.connectionHeight):this.constants_.TAB_OFFSET_FROM_TOP;this.connectionOffsetX="connectionOffsetX"in this.shape?this.shape.connectionOffsetX(this.connectionWidth):0}},module$build$src$core$renderers$measurables$inline_input=
|
|
877
889
|
{};module$build$src$core$renderers$measurables$inline_input.InlineInput=InlineInput$$module$build$src$core$renderers$measurables$inline_input;var StatementInput$$module$build$src$core$renderers$measurables$statement_input=class extends InputConnection$$module$build$src$core$renderers$measurables$input_connection{constructor(a,b){super(a,b);this.type|=Types$$module$build$src$core$renderers$measurables$types.STATEMENT_INPUT;this.height=this.connectedBlock?this.connectedBlockHeight+this.constants_.STATEMENT_BOTTOM_SPACER:this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT;this.width=this.constants_.STATEMENT_INPUT_NOTCH_OFFSET+this.shape.width}},
|
|
@@ -890,7 +902,7 @@ this.debugFilter_=null;this.CURSOR_COLOUR="#cc0a0a";this.MARKER_COLOUR="#4286f4"
|
|
|
890
902
|
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
903
|
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=";
|
|
892
904
|
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]=
|
|
893
|
-
this.validatedBlockStyle_(b[c]);this.setDynamicProperties_(a)}setDynamicProperties_(a){this.setFontConstants_(a);this.setComponentConstants_(a);this.ADD_START_HATS=
|
|
905
|
+
this.validatedBlockStyle_(b[c]);this.setDynamicProperties_(a)}setDynamicProperties_(a){this.setFontConstants_(a);this.setComponentConstants_(a);this.ADD_START_HATS=void 0!==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",
|
|
894
906
|
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"))||
|
|
895
907
|
this.INSERTION_MARKER_OPACITY}getBlockStyleForColour(a){const b="auto_"+a;this.blockStyles[b]||(this.blockStyles[b]=this.createBlockStyle_(a));return{style:this.blockStyles[b],name:b}}getBlockStyle(a){return this.blockStyles[a||""]||(a&&0===a.indexOf("auto_")?this.getBlockStyleForColour(a.substring(5)).style:this.createBlockStyle_("#000000"))}createBlockStyle_(a){return this.validatedBlockStyle_({colourPrimary:a})}validatedBlockStyle_(a){const b={};a&&Object.assign(b,a);a=parseBlockColour$$module$build$src$core$utils$parsing(b.colourPrimary||
|
|
896
908
|
"#000");b.colourPrimary=a.hex;b.colourSecondary=b.colourSecondary?parseBlockColour$$module$build$src$core$utils$parsing(b.colourSecondary).hex:this.generateSecondaryColour_(b.colourPrimary);b.colourTertiary=b.colourTertiary?parseBlockColour$$module$build$src$core$utils$parsing(b.colourTertiary).hex:this.generateTertiaryColour_(b.colourPrimary);b.hat=b.hat||"";return b}generateSecondaryColour_(a){return blend$$module$build$src$core$utils$colour("#fff",a,.6)||a}generateTertiaryColour_(a){return blend$$module$build$src$core$utils$colour("#fff",
|
|
@@ -908,35 +920,35 @@ a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$
|
|
|
908
920
|
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
921
|
"}",`${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
922
|
`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,
|
|
923
|
+
"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;module$build$src$core$renderers$common$constants.isDynamicShape=isDynamicShape$$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,
|
|
912
924
|
{"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",
|
|
913
925
|
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,
|
|
914
926
|
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",
|
|
915
|
-
stroke:"red",fill:"none","stroke-width":"0.5px"},this.svgRoot_))}Types$$module$build$src$core$renderers$measurables$types.isInput(a)&&a instanceof InputConnection$$module$build$src$core$renderers$measurables$input_connection&&Debug$$module$build$src$core$renderers$common$debugger.config.connections&&this.drawConnection(a.connectionModel)}drawConnection(a){if(Debug$$module$build$src$core$renderers$common$debugger.config.connections){
|
|
916
|
-
|
|
917
|
-
cy:a.
|
|
927
|
+
stroke:"red",fill:"none","stroke-width":"0.5px"},this.svgRoot_))}Types$$module$build$src$core$renderers$measurables$types.isInput(a)&&a instanceof InputConnection$$module$build$src$core$renderers$measurables$input_connection&&Debug$$module$build$src$core$renderers$common$debugger.config.connections&&this.drawConnection(a.connectionModel)}drawConnection(a){if(Debug$$module$build$src$core$renderers$common$debugger.config.connections){var b="",c=0,d="";a.type===ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE?
|
|
928
|
+
(c=4,b="magenta",d="none"):a.type===ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE?(c=2,d=b="magenta"):a.type===ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT?(c=4,b="goldenrod",d="none"):a.type===ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT&&(c=2,d=b="goldenrod");this.debugElements_.push(createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.CIRCLE,{"class":"blockRenderDebug",cx:a.getOffsetInBlock().x,
|
|
929
|
+
cy:a.getOffsetInBlock().y,r:c,fill:d,stroke:b},this.svgRoot_))}}drawRenderedRow(a,b,c){Debug$$module$build$src$core$renderers$common$debugger.config.rows&&(this.debugElements_.push(createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"elemRenderingRect blockRenderDebug",x:c?-(a.xPos+a.width):a.xPos,y:a.yPos,width:a.width,height:a.height,stroke:"red",fill:"none","stroke-width":"1px"},this.svgRoot_)),Types$$module$build$src$core$renderers$measurables$types.isTopOrBottomRow(a)||
|
|
918
930
|
Debug$$module$build$src$core$renderers$common$debugger.config.connectedBlockBounds&&this.debugElements_.push(createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"connectedBlockWidth blockRenderDebug",x:c?-(a.xPos+a.widthWithConnectedBlocks):a.xPos,y:a.yPos,width:a.widthWithConnectedBlocks,height:a.height,stroke:this.randomColour_,fill:"none","stroke-width":"1px","stroke-dasharray":"3,3"},this.svgRoot_)))}drawRowWithElements(a,b,c){for(let d=0;d<a.elements.length;d++){const e=
|
|
919
931
|
a.elements[d];e?Types$$module$build$src$core$renderers$measurables$types.isSpacer(e)?this.drawSpacerElem(e,a.height,c):this.drawRenderedElem(e,c):console.warn("A row has an undefined or null element.",a,e)}this.drawRenderedRow(a,b,c)}drawBoundingBox(a){if(Debug$$module$build$src$core$renderers$common$debugger.config.blockBounds){var b=a.RTL?-a.width:0;this.debugElements_.push(createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"blockBoundingBox blockRenderDebug",
|
|
920
932
|
x:b,y:0,width:a.width,height:a.height,stroke:"black",fill:"none","stroke-width":"1px","stroke-dasharray":"5,5"},this.svgRoot_));Debug$$module$build$src$core$renderers$common$debugger.config.connectedBlockBounds&&(b=a.RTL?-a.widthWithChildren:0,this.debugElements_.push(createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"blockRenderDebug",x:b,y:0,width:a.widthWithChildren,height:a.height,stroke:"#DF57BC",fill:"none","stroke-width":"1px","stroke-dasharray":"3,3"},
|
|
921
933
|
this.svgRoot_)))}}drawDebug(a,b){this.clearElems();this.svgRoot_=a.getSvgRoot();this.randomColour_="#"+Math.floor(16777215*Math.random()).toString(16);let c=0;for(let d=0;d<b.rows.length;d++){const e=b.rows[d];Types$$module$build$src$core$renderers$measurables$types.isBetweenRowSpacer(e)?this.drawSpacerRow(e,c,b.RTL):this.drawRowWithElements(e,c,b.RTL);c+=e.height}a.previousConnection&&this.drawConnection(a.previousConnection);a.nextConnection&&this.drawConnection(a.nextConnection);a.outputConnection&&
|
|
922
934
|
this.drawConnection(a.outputConnection);b.rightSide&&this.drawRenderedElem(b.rightSide,b.RTL);this.drawBoundingBox(b);this.drawRender(a.pathObject.svgPath)}drawRender(a){Debug$$module$build$src$core$renderers$common$debugger.config.render&&(a.setAttribute("filter","url(#"+this.constants.debugFilterId+")"),setTimeout(function(){a.setAttribute("filter","")},100))}};
|
|
923
|
-
Debug$$module$build$src$core$renderers$common$debugger.config={rowSpacers:!0,elemSpacers:!0,rows:!0,elems:!0,connections:!0,blockBounds:!0,connectedBlockBounds:!0,render:!0};var module$build$src$core$renderers$common$debugger={};module$build$src$core$renderers$common$debugger.Debug=Debug$$module$build$src$core$renderers$common$debugger;var Drawer$$module$build$src$core$renderers$common$drawer=class{constructor(a,b){this.inlinePath_=this.outlinePath_="";this.block_=a;this.info_=b;this.topLeft_=a.getRelativeToSurfaceXY();this.constants_=b.getRenderer().getConstants()}draw(){this.hideHiddenIcons_();this.drawOutline_();this.drawInternals_();this.block_.pathObject.setPath(this.outlinePath_+"\n"+this.inlinePath_);this.info_.RTL&&this.block_.pathObject.flipRTL();isDebuggerEnabled$$module$build$src$core$renderers$common$debug()
|
|
924
|
-
this.info_)
|
|
925
|
-
this.drawLeft_()}drawTop_(){const a=this.info_.topRow,b=a.elements;this.positionPreviousConnection_();this.outlinePath_+=moveBy$$module$build$src$core$utils$svg_paths(a.xPos,this.info_.startY);for(let c=0,d;d=b[c];c++)Types$$module$build$src$core$renderers$measurables$types.isLeftRoundedCorner(d)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topLeft:Types$$module$build$src$core$renderers$measurables$types.isRightRoundedCorner(d)?
|
|
926
|
-
d instanceof Connection$$module$build$src$core$renderers$measurables$connection?this.outlinePath_+=d.shape.pathLeft:Types$$module$build$src$core$renderers$measurables$types.isHat(d)?this.outlinePath_+=this.constants_.START_HAT.path:Types$$module$build$src$core$renderers$measurables$types.isSpacer(d)&&(this.outlinePath_+=lineOnAxis$$module$build$src$core$utils$svg_paths("h",
|
|
927
|
-
this.constants_.JAGGED_TEETH.path+lineOnAxis$$module$build$src$core$utils$svg_paths("v",a.height-this.constants_.JAGGED_TEETH.height)}drawValueInput_(a){const b=a.getLastInput();this.positionExternalValueConnection_(a);const c=
|
|
928
|
-
a.getLastInput();
|
|
929
|
-
a.xPos+a.width);this.positionStatementInputConnection_(a)}drawRightSideRow_(a){this.outlinePath_+=lineOnAxis$$module$build$src$core$utils$svg_paths("V",a.yPos+a.height)}drawBottom_(){const a=this.info_.bottomRow,b=a.elements;this.positionNextConnection_();let c=0,d="";for(let e=b.length-1,f;f=b[e];e--)Types$$module$build$src$core$renderers$measurables$types.isNextConnection(f)&&f instanceof Connection$$module$build$src$core$renderers$measurables$connection?
|
|
930
|
-
d+=lineOnAxis$$module$build$src$core$utils$svg_paths("H",a.xPos):Types$$module$build$src$core$renderers$measurables$types.isLeftRoundedCorner(f)?d+=this.constants_.OUTSIDE_CORNERS.bottomLeft:Types$$module$build$src$core$renderers$measurables$types.isRightRoundedCorner(f)?(d+=this.constants_.OUTSIDE_CORNERS.bottomRight,c=this.constants_.OUTSIDE_CORNERS.rightHeight):Types$$module$build$src$core$renderers$measurables$types.isSpacer(f)&&
|
|
931
|
-
this.outlinePath_+=lineOnAxis$$module$build$src$core$utils$svg_paths("V",a.baseline-c);this.outlinePath_+=d}drawLeft_(){var a=this.info_.outputConnection;this.positionOutputConnection_();if(a){const b=a.connectionOffsetY+a.height;a=
|
|
932
|
-
this.drawInlineInput_(d):(Types$$module$build$src$core$renderers$measurables$types.isIcon(d)||Types$$module$build$src$core$renderers$measurables$types.isField(d))&&this.layoutField_(d)}layoutField_(a){
|
|
933
|
-
Types$$module$build$src$core$renderers$measurables$types.isIcon(a)?(b.setAttribute("display","block"),b.setAttribute("transform","translate("+d+","+c+")"),a.icon.computeIconLocation()):b.setAttribute("transform","translate("+d+","+c+")"+e);this.info_.isInsertionMarker&&b.setAttribute("display","none")}drawInlineInput_(a){const b=a.width,c=a.height,d=a.connectionOffsetY,e=a.connectionHeight+d;this.inlinePath_+=
|
|
934
|
-
lineOnAxis$$module$build$src$core$utils$svg_paths("v",d)+a.shape.pathDown+lineOnAxis$$module$build$src$core$utils$svg_paths("v",c-e)+lineOnAxis$$module$build$src$core$utils$svg_paths("h",b-a.connectionWidth)+lineOnAxis$$module$build$src$core$utils$svg_paths("v",-c)+"z";this.positionInlineInputConnection_(a)}positionInlineInputConnection_(a){const b=a.centerline-a.height/2;if(a.connectionModel){let c=a.xPos+a.connectionWidth+
|
|
935
|
-
b+a.connectionOffsetY)}}positionStatementInputConnection_(a){const b=a.getLastInput();if(b.connectionModel){let c=a.xPos+a.statementEdge+b.notchOffset;this.info_.RTL&&(c*=-1);b.connectionModel.setOffsetInBlock(c,a.yPos)}}positionExternalValueConnection_(a){const b=a.getLastInput();if(b.connectionModel){let c=a.xPos+a.width;this.info_.RTL&&(c*=-1);b.connectionModel.setOffsetInBlock(c,a.yPos)}}positionPreviousConnection_(){const a=
|
|
936
|
-
|
|
937
|
-
module$build$src$core$renderers$common$drawer.Drawer=Drawer$$module$build$src$core$renderers$common$drawer;var RenderInfo$$module$build$src$core$renderers$common$info=class{constructor(a,b){this.statementEdge=this.width=this.widthWithChildren=this.height=0;this.rows=[];this.inputRows=[];this.hiddenIcons=[];this.startY=this.startX=0;this.renderer_=a;this.block_=b;this.constants_=this.renderer_.getConstants();this.outputConnection=b.outputConnection?new OutputConnection$$module$build$src$core$renderers$measurables$output_connection(this.constants_,b.outputConnection):null;this.isInline=b.getInputsInline()&&
|
|
935
|
+
Debug$$module$build$src$core$renderers$common$debugger.config={rowSpacers:!0,elemSpacers:!0,rows:!0,elems:!0,connections:!0,blockBounds:!0,connectedBlockBounds:!0,render:!0};var module$build$src$core$renderers$common$debugger={};module$build$src$core$renderers$common$debugger.Debug=Debug$$module$build$src$core$renderers$common$debugger;var Drawer$$module$build$src$core$renderers$common$drawer=class{constructor(a,b){this.inlinePath_=this.outlinePath_="";this.block_=a;this.info_=b;this.topLeft_=a.getRelativeToSurfaceXY();this.constants_=b.getRenderer().getConstants()}draw(){this.hideHiddenIcons_();this.drawOutline_();this.drawInternals_();this.block_.pathObject.setPath(this.outlinePath_+"\n"+this.inlinePath_);this.info_.RTL&&this.block_.pathObject.flipRTL();if(isDebuggerEnabled$$module$build$src$core$renderers$common$debug()){let a;
|
|
936
|
+
null==(a=this.block_.renderingDebugger)||a.drawDebug(this.block_,this.info_)}this.recordSizeOnBlock_()}recordSizeOnBlock_(){this.block_.height=this.info_.height;this.block_.width=this.info_.widthWithChildren}hideHiddenIcons_(){for(let a=0,b;b=this.info_.hiddenIcons[a];a++){let c;null==(c=b.icon.iconGroup_)||c.setAttribute("display","none")}}drawOutline_(){this.drawTop_();for(let a=1;a<this.info_.rows.length-1;a++){const b=this.info_.rows[a];b.hasJaggedEdge?this.drawJaggedEdge_(b):b.hasStatement?this.drawStatementInput_(b):
|
|
937
|
+
b.hasExternalInput?this.drawValueInput_(b):this.drawRightSideRow_(b)}this.drawBottom_();this.drawLeft_()}drawTop_(){const a=this.info_.topRow,b=a.elements;this.positionPreviousConnection_();this.outlinePath_+=moveBy$$module$build$src$core$utils$svg_paths(a.xPos,this.info_.startY);for(let c=0,d;d=b[c];c++)Types$$module$build$src$core$renderers$measurables$types.isLeftRoundedCorner(d)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topLeft:Types$$module$build$src$core$renderers$measurables$types.isRightRoundedCorner(d)?
|
|
938
|
+
this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topRight:Types$$module$build$src$core$renderers$measurables$types.isPreviousConnection(d)&&d instanceof Connection$$module$build$src$core$renderers$measurables$connection?this.outlinePath_+=d.shape.pathLeft:Types$$module$build$src$core$renderers$measurables$types.isHat(d)?this.outlinePath_+=this.constants_.START_HAT.path:Types$$module$build$src$core$renderers$measurables$types.isSpacer(d)&&(this.outlinePath_+=lineOnAxis$$module$build$src$core$utils$svg_paths("h",
|
|
939
|
+
d.width));this.outlinePath_+=lineOnAxis$$module$build$src$core$utils$svg_paths("v",a.height)}drawJaggedEdge_(a){this.outlinePath_+=this.constants_.JAGGED_TEETH.path+lineOnAxis$$module$build$src$core$utils$svg_paths("v",a.height-this.constants_.JAGGED_TEETH.height)}drawValueInput_(a){const b=a.getLastInput();this.positionExternalValueConnection_(a);const c=isDynamicShape$$module$build$src$core$renderers$common$constants(b.shape)?b.shape.pathDown(b.height):b.shape.pathDown;this.outlinePath_+=lineOnAxis$$module$build$src$core$utils$svg_paths("H",
|
|
940
|
+
b.xPos+b.width)+c+lineOnAxis$$module$build$src$core$utils$svg_paths("v",a.height-b.connectionHeight)}drawStatementInput_(a){var b=a.getLastInput();if(b){var c=b.xPos+b.notchOffset+b.shape.width;b=b.shape.pathRight+lineOnAxis$$module$build$src$core$utils$svg_paths("h",-(b.notchOffset-this.constants_.INSIDE_CORNERS.width))+this.constants_.INSIDE_CORNERS.pathTop;var d=a.height-2*this.constants_.INSIDE_CORNERS.height;this.outlinePath_+=lineOnAxis$$module$build$src$core$utils$svg_paths("H",c)+b+lineOnAxis$$module$build$src$core$utils$svg_paths("v",
|
|
941
|
+
d)+this.constants_.INSIDE_CORNERS.pathBottom+lineOnAxis$$module$build$src$core$utils$svg_paths("H",a.xPos+a.width);this.positionStatementInputConnection_(a)}}drawRightSideRow_(a){this.outlinePath_+=lineOnAxis$$module$build$src$core$utils$svg_paths("V",a.yPos+a.height)}drawBottom_(){const a=this.info_.bottomRow,b=a.elements;this.positionNextConnection_();let c=0,d="";for(let e=b.length-1,f;f=b[e];e--)Types$$module$build$src$core$renderers$measurables$types.isNextConnection(f)&&f instanceof Connection$$module$build$src$core$renderers$measurables$connection?
|
|
942
|
+
d+=f.shape.pathRight:Types$$module$build$src$core$renderers$measurables$types.isLeftSquareCorner(f)?d+=lineOnAxis$$module$build$src$core$utils$svg_paths("H",a.xPos):Types$$module$build$src$core$renderers$measurables$types.isLeftRoundedCorner(f)?d+=this.constants_.OUTSIDE_CORNERS.bottomLeft:Types$$module$build$src$core$renderers$measurables$types.isRightRoundedCorner(f)?(d+=this.constants_.OUTSIDE_CORNERS.bottomRight,c=this.constants_.OUTSIDE_CORNERS.rightHeight):Types$$module$build$src$core$renderers$measurables$types.isSpacer(f)&&
|
|
943
|
+
(d+=lineOnAxis$$module$build$src$core$utils$svg_paths("h",-1*f.width));this.outlinePath_+=lineOnAxis$$module$build$src$core$utils$svg_paths("V",a.baseline-c);this.outlinePath_+=d}drawLeft_(){var a=this.info_.outputConnection;this.positionOutputConnection_();if(a){const b=a.connectionOffsetY+a.height;a=isDynamicShape$$module$build$src$core$renderers$common$constants(a.shape)?a.shape.pathUp(a.height):a.shape.pathUp;this.outlinePath_+=lineOnAxis$$module$build$src$core$utils$svg_paths("V",b)+a}this.outlinePath_+=
|
|
944
|
+
"z"}drawInternals_(){for(let a=0,b;b=this.info_.rows[a];a++)for(let c=0,d;d=b.elements[c];c++)Types$$module$build$src$core$renderers$measurables$types.isInlineInput(d)?this.drawInlineInput_(d):(Types$$module$build$src$core$renderers$measurables$types.isIcon(d)||Types$$module$build$src$core$renderers$measurables$types.isField(d))&&this.layoutField_(d)}layoutField_(a){const b=Types$$module$build$src$core$renderers$measurables$types.isField(a)?a.field.getSvgRoot():a.icon.iconGroup_,c=a.centerline-a.height/
|
|
945
|
+
2;let d=a.xPos,e="";this.info_.RTL&&(d=-(d+a.width),a.flipRtl&&(d+=a.width,e="scale(-1 1)"));Types$$module$build$src$core$renderers$measurables$types.isIcon(a)?(b.setAttribute("display","block"),b.setAttribute("transform","translate("+d+","+c+")"),a.icon.computeIconLocation()):b.setAttribute("transform","translate("+d+","+c+")"+e);this.info_.isInsertionMarker&&b.setAttribute("display","none")}drawInlineInput_(a){const b=a.width,c=a.height,d=a.connectionOffsetY,e=a.connectionHeight+d;this.inlinePath_+=
|
|
946
|
+
moveTo$$module$build$src$core$utils$svg_paths(a.xPos+a.connectionWidth,a.centerline-c/2)+lineOnAxis$$module$build$src$core$utils$svg_paths("v",d)+a.shape.pathDown+lineOnAxis$$module$build$src$core$utils$svg_paths("v",c-e)+lineOnAxis$$module$build$src$core$utils$svg_paths("h",b-a.connectionWidth)+lineOnAxis$$module$build$src$core$utils$svg_paths("v",-c)+"z";this.positionInlineInputConnection_(a)}positionInlineInputConnection_(a){const b=a.centerline-a.height/2;if(a.connectionModel){let c=a.xPos+a.connectionWidth+
|
|
947
|
+
a.connectionOffsetX;this.info_.RTL&&(c*=-1);a.connectionModel.setOffsetInBlock(c,b+a.connectionOffsetY)}}positionStatementInputConnection_(a){const b=a.getLastInput();if(null==b?0:b.connectionModel){let c=a.xPos+a.statementEdge+b.notchOffset;this.info_.RTL&&(c*=-1);b.connectionModel.setOffsetInBlock(c,a.yPos)}}positionExternalValueConnection_(a){const b=a.getLastInput();if(b&&b.connectionModel){let c=a.xPos+a.width;this.info_.RTL&&(c*=-1);b.connectionModel.setOffsetInBlock(c,a.yPos)}}positionPreviousConnection_(){const a=
|
|
948
|
+
this.info_.topRow;if(a.connection){const b=a.xPos+a.notchOffset;a.connection.connectionModel.setOffsetInBlock(this.info_.RTL?-b:b,0)}}positionNextConnection_(){const a=this.info_.bottomRow;if(a.connection){const b=a.connection,c=b.xPos;b.connectionModel.setOffsetInBlock(this.info_.RTL?-c:c,a.baseline)}}positionOutputConnection_(){if(this.info_.outputConnection){const a=this.info_.startX+this.info_.outputConnection.connectionOffsetX;this.block_.outputConnection.setOffsetInBlock(this.info_.RTL?-a:a,
|
|
949
|
+
this.info_.outputConnection.connectionOffsetY)}}},module$build$src$core$renderers$common$drawer={};module$build$src$core$renderers$common$drawer.Drawer=Drawer$$module$build$src$core$renderers$common$drawer;var RenderInfo$$module$build$src$core$renderers$common$info=class{constructor(a,b){this.statementEdge=this.width=this.widthWithChildren=this.height=0;this.rows=[];this.inputRows=[];this.hiddenIcons=[];this.startY=this.startX=0;this.renderer_=a;this.block_=b;this.constants_=this.renderer_.getConstants();this.outputConnection=b.outputConnection?new OutputConnection$$module$build$src$core$renderers$measurables$output_connection(this.constants_,b.outputConnection):null;this.isInline=b.getInputsInline()&&
|
|
938
950
|
!b.isCollapsed();this.isCollapsed=b.isCollapsed();this.isInsertionMarker=b.isInsertionMarker();this.RTL=b.RTL;this.topRow=new TopRow$$module$build$src$core$renderers$measurables$top_row(this.constants_);this.bottomRow=new BottomRow$$module$build$src$core$renderers$measurables$bottom_row(this.constants_)}getRenderer(){return this.renderer_}measure(){this.createRows_();this.addElemSpacing_();this.addRowSpacing_();this.computeBounds_();this.alignRowElements_();this.finalize_()}createRows_(){this.populateTopRow_();
|
|
939
|
-
this.rows.push(this.topRow);let a=new InputRow$$module$build$src$core$renderers$measurables$input_row(this.constants_);this.inputRows.push(a);var b=this.block_.getIcons();for(let c=0,d;d=b[c];c++){const e=new Icon$$module$build$src$core$renderers$measurables$icon(this.constants_,d);this.isCollapsed&&d.collapseHidden?this.hiddenIcons.push(e):a.elements.push(e)}b=
|
|
951
|
+
this.rows.push(this.topRow);let a=new InputRow$$module$build$src$core$renderers$measurables$input_row(this.constants_);this.inputRows.push(a);var b=this.block_.getIcons();for(let c=0,d;d=b[c];c++){const e=new Icon$$module$build$src$core$renderers$measurables$icon(this.constants_,d);this.isCollapsed&&d.collapseHidden?this.hiddenIcons.push(e):a.elements.push(e)}b=void 0;for(let c=0,d;d=this.block_.inputList[c];c++)if(d.isVisible()){this.shouldStartNewRow_(d,b)&&(this.rows.push(a),a=new InputRow$$module$build$src$core$renderers$measurables$input_row(this.constants_),
|
|
940
952
|
this.inputRows.push(a));for(let e=0,f;f=d.fieldRow[e];e++)a.elements.push(new Field$$module$build$src$core$renderers$measurables$field(this.constants_,f,d));this.addInput_(d,a);b=d}this.isCollapsed&&(a.hasJaggedEdge=!0,a.elements.push(new JaggedEdge$$module$build$src$core$renderers$measurables$jagged_edge(this.constants_)));(a.elements.length||a.hasDummyInput)&&this.rows.push(a);this.populateBottomRow_();this.rows.push(this.bottomRow)}populateTopRow_(){var a=!!this.block_.previousConnection;const b=
|
|
941
953
|
(this.block_.hat?"cap"===this.block_.hat:this.constants_.ADD_START_HATS)&&!this.outputConnection&&!a;let c=this.topRow.hasLeftSquareCorner(this.block_)?SquareCorner$$module$build$src$core$renderers$measurables$square_corner:RoundCorner$$module$build$src$core$renderers$measurables$round_corner;this.topRow.elements.push(new c(this.constants_));b?(a=new Hat$$module$build$src$core$renderers$measurables$hat(this.constants_),this.topRow.elements.push(a),this.topRow.capline=a.ascenderHeight):a&&(this.topRow.hasPreviousConnection=
|
|
942
954
|
!0,this.topRow.connection=new PreviousConnection$$module$build$src$core$renderers$measurables$previous_connection(this.constants_,this.block_.previousConnection),this.topRow.elements.push(this.topRow.connection));this.block_.inputList.length&&this.block_.inputList[0].type===inputTypes$$module$build$src$core$input_types.STATEMENT&&!this.block_.isCollapsed()?this.topRow.minHeight=this.constants_.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT:this.topRow.minHeight=this.constants_.TOP_ROW_MIN_HEIGHT;c=this.topRow.hasRightSquareCorner(this.block_)?
|
|
@@ -948,35 +960,39 @@ Math.max(b.minHeight,a.getSourceBlock()&&a.getSourceBlock().isShadow()?this.cons
|
|
|
948
960
|
!this.isInline:!1:!1}addElemSpacing_(){for(let a=0,b;b=this.rows[a];a++){const c=b.elements;b.elements=[];b.startsWithElemSpacer()&&b.elements.push(new InRowSpacer$$module$build$src$core$renderers$measurables$in_row_spacer(this.constants_,this.getInRowSpacing_(null,c[0])));if(c.length){for(let d=0;d<c.length-1;d++){b.elements.push(c[d]);const e=this.getInRowSpacing_(c[d],c[d+1]);b.elements.push(new InRowSpacer$$module$build$src$core$renderers$measurables$in_row_spacer(this.constants_,e))}b.elements.push(c[c.length-
|
|
949
961
|
1]);b.endsWithElemSpacer()&&b.elements.push(new InRowSpacer$$module$build$src$core$renderers$measurables$in_row_spacer(this.constants_,this.getInRowSpacing_(c[c.length-1],null)))}}}getInRowSpacing_(a,b){if(!a&&b&&Types$$module$build$src$core$renderers$measurables$types.isStatementInput(b))return this.constants_.STATEMENT_INPUT_PADDING_LEFT;if(a&&Types$$module$build$src$core$renderers$measurables$types.isInput(a)&&!b){if(Types$$module$build$src$core$renderers$measurables$types.isExternalInput(a))return this.constants_.NO_PADDING;
|
|
950
962
|
if(Types$$module$build$src$core$renderers$measurables$types.isInlineInput(a))return this.constants_.LARGE_PADDING;if(Types$$module$build$src$core$renderers$measurables$types.isStatementInput(a))return this.constants_.NO_PADDING}return a&&Types$$module$build$src$core$renderers$measurables$types.isLeftSquareCorner(a)&&b&&(Types$$module$build$src$core$renderers$measurables$types.isPreviousConnection(b)||Types$$module$build$src$core$renderers$measurables$types.isNextConnection(b))?b.notchOffset:a&&Types$$module$build$src$core$renderers$measurables$types.isLeftRoundedCorner(a)&&
|
|
951
|
-
b&&(Types$$module$build$src$core$renderers$measurables$types.isPreviousConnection(b)||Types$$module$build$src$core$renderers$measurables$types.isNextConnection(b))?b.notchOffset-this.constants_.CORNER_RADIUS:this.constants_.MEDIUM_PADDING}computeBounds_(){let a=0,b=0,c=0;for(let
|
|
952
|
-
|
|
953
|
-
(c.widthWithConnectedBlocks=c.width)}}getDesiredRowWidth_(a){return this.width-this.startX}addAlignmentPadding_(a,b){const c=a.getFirstSpacer(),d=a.getLastSpacer();if(a.hasExternalInput||a.hasStatement)a.widthWithConnectedBlocks+=b;a.align===$.Align$$module$build$src$core$input.LEFT
|
|
954
|
-
var c=a.width-b.width
|
|
955
|
-
this.getSpacerRowWidth_(a,b);c=new SpacerRow$$module$build$src$core$renderers$measurables$spacer_row(this.constants_,c,d);a.hasStatement&&(c.followsStatement=!0);b.hasStatement&&(c.precedesStatement=!0);return c}getSpacerRowWidth_(a,b){return this.width-this.startX}getSpacerRowHeight_(a,b){return this.constants_.MEDIUM_PADDING}getElemCenterline_(a,b){return Types$$module$build$src$core$renderers$measurables$types.isSpacer(b)?a.yPos+b.height/2:Types$$module$build$src$core$renderers$measurables$types.isBottomRow(a)?
|
|
963
|
+
b&&(Types$$module$build$src$core$renderers$measurables$types.isPreviousConnection(b)||Types$$module$build$src$core$renderers$measurables$types.isNextConnection(b))?b.notchOffset-this.constants_.CORNER_RADIUS:this.constants_.MEDIUM_PADDING}computeBounds_(){let a=0,b=0,c=0;for(let e=0,f;f=this.rows[e];e++){f.measure();b=Math.max(b,f.width);if(f.hasStatement){var d=f.getLastInput();let g,h;d=f.width-(null!=(h=null==(g=d)?void 0:g.width)?h:0);a=Math.max(a,d)}c=Math.max(c,f.widthWithConnectedBlocks)}this.statementEdge=
|
|
964
|
+
a;this.width=b;for(let e=0,f;f=this.rows[e];e++)f.hasStatement&&(f.statementEdge=this.statementEdge);this.widthWithChildren=Math.max(b,c);this.outputConnection&&(this.startX=this.outputConnection.width,this.width+=this.outputConnection.width,this.widthWithChildren+=this.outputConnection.width)}alignRowElements_(){for(let b=0,c;c=this.rows[b];b++)if(c.hasStatement)this.alignStatementRow_(c);else{var a=c.width;a=this.getDesiredRowWidth_(c)-a;0<a&&this.addAlignmentPadding_(c,a);Types$$module$build$src$core$renderers$measurables$types.isTopOrBottomRow(c)&&
|
|
965
|
+
(c.widthWithConnectedBlocks=c.width)}}getDesiredRowWidth_(a){return this.width-this.startX}addAlignmentPadding_(a,b){const c=a.getFirstSpacer(),d=a.getLastSpacer();if(a.hasExternalInput||a.hasStatement)a.widthWithConnectedBlocks+=b;if(a.align===$.Align$$module$build$src$core$input.LEFT&&d)d.width+=b;else if(a.align===$.Align$$module$build$src$core$input.CENTRE&&c&&d)c.width+=b/2,d.width+=b/2;else if(a.align===$.Align$$module$build$src$core$input.RIGHT&&c)c.width+=b;else if(d)d.width+=b;else return;
|
|
966
|
+
a.width+=b}alignStatementRow_(a){const b=a.getLastInput();if(b){var c=a.width-b.width,d=this.statementEdge;c=d-c;0<c&&this.addAlignmentPadding_(a,c);c=a.width;d=this.getDesiredRowWidth_(a);b.width+=d-c;b.height=Math.max(b.height,a.height);a.width+=d-c;a.widthWithConnectedBlocks=Math.max(a.width,this.statementEdge+a.connectedBlockWidths)}}addRowSpacing_(){const a=this.rows;this.rows=[];for(let b=0;b<a.length;b++)this.rows.push(a[b]),b!==a.length-1&&this.rows.push(this.makeSpacerRow_(a[b],a[b+1]))}makeSpacerRow_(a,
|
|
967
|
+
b){var c=this.getSpacerRowHeight_(a,b);const d=this.getSpacerRowWidth_(a,b);c=new SpacerRow$$module$build$src$core$renderers$measurables$spacer_row(this.constants_,c,d);a.hasStatement&&(c.followsStatement=!0);b.hasStatement&&(c.precedesStatement=!0);return c}getSpacerRowWidth_(a,b){return this.width-this.startX}getSpacerRowHeight_(a,b){return this.constants_.MEDIUM_PADDING}getElemCenterline_(a,b){return Types$$module$build$src$core$renderers$measurables$types.isSpacer(b)?a.yPos+b.height/2:Types$$module$build$src$core$renderers$measurables$types.isBottomRow(a)?
|
|
956
968
|
(a=a.yPos+a.height-a.descenderHeight,Types$$module$build$src$core$renderers$measurables$types.isNextConnection(b)?a+b.height/2:a-b.height/2):Types$$module$build$src$core$renderers$measurables$types.isTopRow(a)?Types$$module$build$src$core$renderers$measurables$types.isHat(b)?a.capline-b.height/2:a.capline+b.height/2:a.yPos+a.height/2}recordElemPositions_(a){let b=a.xPos;for(let c=0,d;d=a.elements[c];c++)Types$$module$build$src$core$renderers$measurables$types.isSpacer(d)&&(d.height=a.height),d.xPos=
|
|
957
|
-
b,d.centerline=this.getElemCenterline_(a,d),b+=d.width}finalize_(){let a=0,b=0;for(let c=0,d;d=this.rows[c];c++)d.yPos=b,d.xPos=this.startX,b+=d.height,a=Math.max(a,d.widthWithConnectedBlocks),this.recordElemPositions_(d);this.outputConnection&&this.block_.nextConnection
|
|
958
|
-
|
|
959
|
-
a.oldNode=this.oldNode;a.newNode=this.newNode;return a}fromJson(a){super.fromJson(a);this.isCursor=a.isCursor;this.blockId=a.blockId;this.oldNode=a.oldNode;this.newNode=a.newNode}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,MARKER_MOVE$$module$build$src$core$events$utils,MarkerMove$$module$build$src$core$events$events_marker_move);
|
|
969
|
+
b,d.centerline=this.getElemCenterline_(a,d),b+=d.width}finalize_(){let a=0,b=0;for(let c=0,d;d=this.rows[c];c++)d.yPos=b,d.xPos=this.startX,b+=d.height,a=Math.max(a,d.widthWithConnectedBlocks),this.recordElemPositions_(d);if(this.outputConnection&&this.block_.nextConnection){const c=this.block_.nextConnection.targetBlock();c&&(a=Math.max(a,c.getHeightWidth().width))}this.widthWithChildren=a+this.startX;this.height=b;this.startY=this.topRow.capline;this.bottomRow.baseline=b-this.bottomRow.descenderHeight}},
|
|
970
|
+
module$build$src$core$renderers$common$info={};module$build$src$core$renderers$common$info.RenderInfo=RenderInfo$$module$build$src$core$renderers$common$info;var MarkerMove$$module$build$src$core$events$events_marker_move=class extends UiBase$$module$build$src$core$events$events_ui_base{constructor(a,b,c,d){let e=a?a.workspace.id:void 0;d&&d.getType()===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.WORKSPACE&&(e=d.getLocation().id);super(e);this.type=MARKER_MOVE$$module$build$src$core$events$utils;this.blockId=null==a?void 0:a.id;this.oldNode=c||void 0;this.newNode=d;this.isCursor=b}toJson(){const a=super.toJson();if(void 0===this.isCursor)throw Error("Whether this is a cursor event or not is undefined. Either pass a value to the constructor, or call fromJson");
|
|
971
|
+
if(!this.newNode)throw Error("The new node is undefined. Either pass a node to the constructor, or call fromJson");a.isCursor=this.isCursor;a.blockId=this.blockId;a.oldNode=this.oldNode;a.newNode=this.newNode;return a}fromJson(a){super.fromJson(a);this.isCursor=a.isCursor;this.blockId=a.blockId;this.oldNode=a.oldNode;this.newNode=a.newNode}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,MARKER_MOVE$$module$build$src$core$events$utils,MarkerMove$$module$build$src$core$events$events_marker_move);
|
|
972
|
+
var module$build$src$core$events$events_marker_move={};module$build$src$core$events$events_marker_move.MarkerMove=MarkerMove$$module$build$src$core$events$events_marker_move;var CURSOR_CLASS$$module$build$src$core$renderers$common$marker_svg="blocklyCursor",MARKER_CLASS$$module$build$src$core$renderers$common$marker_svg="blocklyMarker",HEIGHT_MULTIPLIER$$module$build$src$core$renderers$common$marker_svg=.75,MarkerSvg$$module$build$src$core$renderers$common$marker_svg=class{constructor(a,b,c){this.workspace=a;this.marker=c;this.markerSvgRect_=this.markerSvgLine_=this.markerInput_=this.markerBlock_=this.svgGroup_=this.markerSvg_=this.currentMarkerSvg=this.parent_=null;
|
|
960
973
|
this.constants_=b;a=this.isCursor()?this.constants_.CURSOR_COLOUR:this.constants_.MARKER_COLOUR;this.colour_=c.colour||a}getSvgRoot(){return this.svgGroup_}getMarker(){return this.marker}isCursor(){return"cursor"===this.marker.type}createDom(){const a=this.isCursor()?CURSOR_CLASS$$module$build$src$core$renderers$common$marker_svg:MARKER_CLASS$$module$build$src$core$renderers$common$marker_svg;this.svgGroup_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,{"class":a});
|
|
961
974
|
this.createDomInternal_();return this.svgGroup_}setParent_(a){this.isCursor()?(this.parent_&&this.parent_.setCursorSvg(null),a.setCursorSvg(this.getSvgRoot())):(this.parent_&&this.parent_.setMarkerSvg(null),a.setMarkerSvg(this.getSvgRoot()));this.parent_=a}draw(a,b){if(b){this.constants_=this.workspace.getRenderer().getConstants();var c=this.isCursor()?this.constants_.CURSOR_COLOUR:this.constants_.MARKER_COLOUR;this.colour_=this.marker.colour||c;this.applyColour_(b);this.showAtLocation_(b);this.fireMarkerEvent_(a,
|
|
962
|
-
b);a=this.currentMarkerSvg.childNodes[0];void 0!==a&&a
|
|
975
|
+
b);a=this.currentMarkerSvg.childNodes[0];void 0!==a&&a.beginElement&&a.beginElement()}else this.hide()}showAtLocation_(a){const b=a.getLocation().type;a.getType()===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.BLOCK?this.showWithBlock_(a):a.getType()===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.OUTPUT?this.showWithOutput_(a):b===ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE?this.showWithInput_(a):b===ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT?
|
|
963
976
|
this.showWithNext_(a):a.getType()===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.PREVIOUS?this.showWithPrevious_(a):a.getType()===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.FIELD?this.showWithField_(a):a.getType()===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.WORKSPACE?this.showWithCoordinates_(a):a.getType()===ASTNode$$module$build$src$core$keyboard_nav$ast_node.types.STACK&&this.showWithStack_(a)}showWithBlockPrevOutput_(a){a=a.getSourceBlock();const b=
|
|
964
977
|
a.width;var c=a.height,d=c*HEIGHT_MULTIPLIER$$module$build$src$core$renderers$common$marker_svg;const e=this.constants_.CURSOR_BLOCK_PADDING;a.previousConnection?(c=this.constants_.shapeFor(a.previousConnection),this.positionPrevious_(b,e,d,c)):a.outputConnection?(d=this.constants_.shapeFor(a.outputConnection),this.positionOutput_(b,c,d)):this.positionBlock_(b,e,d);this.setParent_(a);this.showCurrent_()}showWithBlock_(a){this.showWithBlockPrevOutput_(a)}showWithPrevious_(a){this.showWithBlockPrevOutput_(a)}showWithOutput_(a){this.showWithBlockPrevOutput_(a)}showWithCoordinates_(a){var b=
|
|
965
978
|
a.getWsCoordinate();a=b.x;b=b.y;this.workspace.RTL&&(a-=this.constants_.CURSOR_WS_WIDTH);this.positionLine_(a,b,this.constants_.CURSOR_WS_WIDTH);this.setParent_(this.workspace);this.showCurrent_()}showWithField_(a){a=a.getLocation();const b=a.getSize().width,c=a.getSize().height;this.positionRect_(0,0,b,c);this.setParent_(a);this.showCurrent_()}showWithInput_(a){a=a.getLocation();const b=a.getSourceBlock();this.positionInput_(a);this.setParent_(b);this.showCurrent_()}showWithNext_(a){var b=a.getLocation();
|
|
966
979
|
a=b.getSourceBlock();let c=0;b=b.getOffsetInBlock().y;const d=a.getHeightWidth().width;this.workspace.RTL&&(c=-d);this.positionLine_(c,b,d);this.setParent_(a);this.showCurrent_()}showWithStack_(a){a=a.getLocation();var b=a.getHeightWidth();const c=b.width+this.constants_.CURSOR_STACK_PADDING;b=b.height+this.constants_.CURSOR_STACK_PADDING;const d=-this.constants_.CURSOR_STACK_PADDING/2,e=-this.constants_.CURSOR_STACK_PADDING/2;let f=d;this.workspace.RTL&&(f=-(c+d));this.positionRect_(f,e,c,b);this.setParent_(a);
|
|
967
|
-
this.showCurrent_()}showCurrent_(){this.hide();this.currentMarkerSvg.style.display=""}positionBlock_(a,b,c){a=moveBy$$module$build$src$core$utils$svg_paths(-b,c)+lineOnAxis$$module$build$src$core$utils$svg_paths("V",-b)+lineOnAxis$$module$build$src$core$utils$svg_paths("H",a+2*b)+lineOnAxis$$module$build$src$core$utils$svg_paths("V",c);this.markerBlock_.setAttribute("d",a);this.workspace.RTL&&
|
|
968
|
-
c=a.getOffsetInBlock().y;a=moveTo$$module$build$src$core$utils$svg_paths(0,0)+this.constants_.shapeFor(a).pathDown;this.markerInput_.setAttribute("d",a);this.markerInput_.setAttribute("transform","translate("+b+","+c+")"+(this.workspace.RTL?" scale(-1 1)":""));this.currentMarkerSvg=this.markerInput_}positionLine_(a,b,c){
|
|
969
|
-
b,c){a=moveBy$$module$build$src$core$utils$svg_paths(a,0)+lineOnAxis$$module$build$src$core$utils$svg_paths("h",-(a-c.width))+lineOnAxis$$module$build$src$core$utils$svg_paths("v",this.constants_.TAB_OFFSET_FROM_TOP)+
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
this.
|
|
973
|
-
|
|
974
|
-
{
|
|
975
|
-
|
|
976
|
-
a
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
+
this.showCurrent_()}showCurrent_(){this.hide();this.currentMarkerSvg&&(this.currentMarkerSvg.style.display="")}positionBlock_(a,b,c){a=moveBy$$module$build$src$core$utils$svg_paths(-b,c)+lineOnAxis$$module$build$src$core$utils$svg_paths("V",-b)+lineOnAxis$$module$build$src$core$utils$svg_paths("H",a+2*b)+lineOnAxis$$module$build$src$core$utils$svg_paths("V",c);if(!this.markerBlock_)throw Error("createDom should be called before positioning the marker");this.markerBlock_.setAttribute("d",a);this.workspace.RTL&&
|
|
981
|
+
this.flipRtl_(this.markerBlock_);this.currentMarkerSvg=this.markerBlock_}positionInput_(a){const b=a.getOffsetInBlock().x,c=a.getOffsetInBlock().y;a=moveTo$$module$build$src$core$utils$svg_paths(0,0)+this.constants_.shapeFor(a).pathDown;this.markerInput_.setAttribute("d",a);this.markerInput_.setAttribute("transform","translate("+b+","+c+")"+(this.workspace.RTL?" scale(-1 1)":""));this.currentMarkerSvg=this.markerInput_}positionLine_(a,b,c){if(!this.markerSvgLine_)throw Error("createDom should be called before positioning the line");
|
|
982
|
+
this.markerSvgLine_.setAttribute("x",`${a}`);this.markerSvgLine_.setAttribute("y",`${b}`);this.markerSvgLine_.setAttribute("width",`${c}`);this.currentMarkerSvg=this.markerSvgLine_}positionOutput_(a,b,c){if(!this.markerBlock_)throw Error("createDom should be called before positioning the output");a=moveBy$$module$build$src$core$utils$svg_paths(a,0)+lineOnAxis$$module$build$src$core$utils$svg_paths("h",-(a-c.width))+lineOnAxis$$module$build$src$core$utils$svg_paths("v",this.constants_.TAB_OFFSET_FROM_TOP)+
|
|
983
|
+
c.pathDown+lineOnAxis$$module$build$src$core$utils$svg_paths("V",b)+lineOnAxis$$module$build$src$core$utils$svg_paths("H",a);this.markerBlock_.setAttribute("d",a);this.workspace.RTL&&this.flipRtl_(this.markerBlock_);this.currentMarkerSvg=this.markerBlock_}positionPrevious_(a,b,c,d){if(!this.markerBlock_)throw Error("createDom should be called before positioning the previous connection marker");a=moveBy$$module$build$src$core$utils$svg_paths(-b,c)+lineOnAxis$$module$build$src$core$utils$svg_paths("V",
|
|
984
|
+
-b)+lineOnAxis$$module$build$src$core$utils$svg_paths("H",this.constants_.NOTCH_OFFSET_LEFT)+d.pathLeft+lineOnAxis$$module$build$src$core$utils$svg_paths("H",a+2*b)+lineOnAxis$$module$build$src$core$utils$svg_paths("V",c);this.markerBlock_.setAttribute("d",a);this.workspace.RTL&&this.flipRtl_(this.markerBlock_);this.currentMarkerSvg=this.markerBlock_}positionRect_(a,b,c,d){if(!this.markerSvgRect_)throw Error("createDom should be called before positioning the rect");this.markerSvgRect_.setAttribute("x",
|
|
985
|
+
`${a}`);this.markerSvgRect_.setAttribute("y",`${b}`);this.markerSvgRect_.setAttribute("width",`${c}`);this.markerSvgRect_.setAttribute("height",`${d}`);this.currentMarkerSvg=this.markerSvgRect_}flipRtl_(a){a.setAttribute("transform","scale(-1 1)")}hide(){if(!(this.markerSvgLine_&&this.markerSvgRect_&&this.markerInput_&&this.markerBlock_))throw Error("createDom should be called before hiding the marker");this.markerSvgLine_.style.display="none";this.markerSvgRect_.style.display="none";this.markerInput_.style.display=
|
|
986
|
+
"none";this.markerBlock_.style.display="none"}fireMarkerEvent_(a,b){const c=b.getSourceBlock();a=new (get$$module$build$src$core$events$utils(MARKER_MOVE$$module$build$src$core$events$utils))(c,this.isCursor(),a,b);fire$$module$build$src$core$events$utils(a)}getBlinkProperties_(){return{attributeType:"XML",attributeName:"fill",dur:"1s",values:this.colour_+";transparent;transparent;",repeatCount:"indefinite"}}createDomInternal_(){this.markerSvg_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.G,
|
|
987
|
+
{width:this.constants_.CURSOR_WS_WIDTH,height:this.constants_.WS_CURSOR_HEIGHT},this.svgGroup_);this.markerSvgLine_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{width:this.constants_.CURSOR_WS_WIDTH,height:this.constants_.WS_CURSOR_HEIGHT,style:"display: none"},this.markerSvg_);this.markerSvgRect_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"blocklyVerticalMarker",rx:10,ry:10,style:"display: none"},
|
|
988
|
+
this.markerSvg_);this.markerInput_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.PATH,{transform:"",style:"display: none"},this.markerSvg_);this.markerBlock_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.PATH,{transform:"",style:"display: none",fill:"none","stroke-width":this.constants_.CURSOR_STROKE_WIDTH},this.markerSvg_);if(this.isCursor()){const a=this.getBlinkProperties_();createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.ANIMATE,
|
|
989
|
+
a,this.markerSvgLine_);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.ANIMATE,a,this.markerInput_);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.ANIMATE,Object.assign({},a,{attributeName:"stroke"}),this.markerBlock_)}return this.markerSvg_}applyColour_(a){if(!(this.markerSvgLine_&&this.markerSvgRect_&&this.markerInput_&&this.markerBlock_))throw Error("createDom should be called before applying color to the markerj");
|
|
990
|
+
this.markerSvgLine_.setAttribute("fill",this.colour_);this.markerSvgRect_.setAttribute("stroke",this.colour_);this.markerInput_.setAttribute("fill",this.colour_);this.markerBlock_.setAttribute("stroke",this.colour_);this.isCursor()&&(a=this.colour_+";transparent;transparent;",this.markerSvgLine_.firstElementChild.setAttribute("values",a),this.markerInput_.firstElementChild.setAttribute("values",a),this.markerBlock_.firstElementChild.setAttribute("values",a))}dispose(){this.svgGroup_&&removeNode$$module$build$src$core$utils$dom(this.svgGroup_)}},
|
|
991
|
+
module$build$src$core$renderers$common$marker_svg={};module$build$src$core$renderers$common$marker_svg.MarkerSvg=MarkerSvg$$module$build$src$core$renderers$common$marker_svg;var PathObject$$module$build$src$core$renderers$common$path_object=class{constructor(a,b,c){this.markerSvg=this.cursorSvg=null;this.constants=c;this.style=b;this.svgRoot=a;this.svgPath=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.PATH,{"class":"blocklyPath"},this.svgRoot)}setPath(a){this.svgPath.setAttribute("d",a)}flipRTL(){this.svgPath.setAttribute("transform","scale(-1 1)")}setCursorSvg(a){a?(this.svgRoot.appendChild(a),this.cursorSvg=a):this.cursorSvg=
|
|
992
|
+
null}setMarkerSvg(a){a?(this.cursorSvg?this.svgRoot.insertBefore(a,this.cursorSvg):this.svgRoot.appendChild(a),this.markerSvg=a):this.markerSvg=null}applyColour(a){if(!this.style.colourTertiary)throw Error("The renderer did not properly initialize the block style");this.svgPath.setAttribute("stroke",this.style.colourTertiary);this.svgPath.setAttribute("fill",this.style.colourPrimary);this.updateShadow_(a.isShadow());this.updateDisabled_(!a.isEnabled()||a.getInheritedDisabled())}setStyle(a){this.style=
|
|
993
|
+
a}setClass_(a,b){a&&(b?addClass$$module$build$src$core$utils$dom(this.svgRoot,a):removeClass$$module$build$src$core$utils$dom(this.svgRoot,a))}updateHighlighted(a){a?this.svgPath.setAttribute("filter","url(#"+this.constants.embossFilterId+")"):this.svgPath.setAttribute("filter","none")}updateShadow_(a){if(a){if(!this.style.colourSecondary)throw Error("The renderer did not properly initialize the block style");this.svgPath.setAttribute("stroke","none");this.svgPath.setAttribute("fill",this.style.colourSecondary)}}updateDisabled_(a){this.setClass_("blocklyDisabled",
|
|
994
|
+
a);a&&this.svgPath.setAttribute("fill","url(#"+this.constants.disabledPatternId+")")}updateSelected(a){this.setClass_("blocklySelected",a)}updateDraggingDelete(a){this.setClass_("blocklyDraggingDelete",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={};
|
|
995
|
+
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_=
|
|
980
996
|
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_=
|
|
981
997
|
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
998
|
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();
|
|
@@ -1008,16 +1024,16 @@ module$build$src$core$renderers$common$block_rendering.Measurable=Measurable$$mo
|
|
|
1008
1024
|
module$build$src$core$renderers$common$block_rendering.PreviousConnection=PreviousConnection$$module$build$src$core$renderers$measurables$previous_connection;module$build$src$core$renderers$common$block_rendering.RenderInfo=RenderInfo$$module$build$src$core$renderers$common$info;module$build$src$core$renderers$common$block_rendering.Renderer=Renderer$$module$build$src$core$renderers$common$renderer;module$build$src$core$renderers$common$block_rendering.RoundCorner=RoundCorner$$module$build$src$core$renderers$measurables$round_corner;
|
|
1009
1025
|
module$build$src$core$renderers$common$block_rendering.Row=Row$$module$build$src$core$renderers$measurables$row;module$build$src$core$renderers$common$block_rendering.SpacerRow=SpacerRow$$module$build$src$core$renderers$measurables$spacer_row;module$build$src$core$renderers$common$block_rendering.SquareCorner=SquareCorner$$module$build$src$core$renderers$measurables$square_corner;module$build$src$core$renderers$common$block_rendering.StatementInput=StatementInput$$module$build$src$core$renderers$measurables$statement_input;
|
|
1010
1026
|
module$build$src$core$renderers$common$block_rendering.TopRow=TopRow$$module$build$src$core$renderers$measurables$top_row;module$build$src$core$renderers$common$block_rendering.Types=Types$$module$build$src$core$renderers$measurables$types;module$build$src$core$renderers$common$block_rendering.init=init$$module$build$src$core$renderers$common$block_rendering;module$build$src$core$renderers$common$block_rendering.isDebuggerEnabled=isDebuggerEnabled$$module$build$src$core$renderers$common$block_rendering;
|
|
1011
|
-
module$build$src$core$renderers$common$block_rendering.register=register$$module$build$src$core$renderers$common$block_rendering;module$build$src$core$renderers$common$block_rendering.startDebugger=startDebugger$$module$build$src$core$renderers$common$block_rendering;module$build$src$core$renderers$common$block_rendering.stopDebugger=stopDebugger$$module$build$src$core$renderers$common$block_rendering;module$build$src$core$renderers$common$block_rendering.unregister=unregister$$module$build$src$core$renderers$common$block_rendering;var ThemeManager$$module$build$src$core$theme_manager=class{constructor(a,b){this.workspace=a;this.theme=b;this.subscribedWorkspaces_=[];this.componentDB=new Map}getTheme(){return this.theme}setTheme(a){var b=this.theme;this.theme=a;if(a=this.workspace.getInjectionDiv())b&&removeClass$$module$build$src$core$utils$dom(a,b.getClassName())
|
|
1012
|
-
e.element;
|
|
1013
|
-
b=this.theme&&this.theme.getComponentStyle(b);a.style[c]=b||""}unsubscribe(a){if(a)for(const [b,c]of this.componentDB){for(let d=c.length-1;0<=d;d--)c[d].element===a&&c.splice(d,1);c.length||this.componentDB.delete(b)}}dispose(){this.subscribedWorkspaces_=this.theme=this.owner_=null;this.componentDB.clear()}},module$build$src$core$theme_manager={};module$build$src$core$theme_manager.ThemeManager=ThemeManager$$module$build$src$core$theme_manager;var ZOOM_IN_MULTIPLIER$$module$build$src$core$touch_gesture=5,ZOOM_OUT_MULTIPLIER$$module$build$src$core$touch_gesture=6,TouchGesture$$module$build$src$core$touch_gesture=class extends Gesture$$module$build$src$core$gesture{constructor(){super(...arguments);this.isMultiTouch_=!1;this.cachedPoints=new Map;this.startDistance_=this.previousScale_=0;this.isPinchZoomEnabled_=this.onStartWrapper_=null}doStart(a){this.
|
|
1014
|
-
super.doStart(a);!this.isEnding_&&isTouchEvent$$module$build$src$core$touch(a)&&this.handleTouchStart(a)}bindMouseEvents(a){this.onStartWrapper_=conditionalBind$$module$build$src$core$browser_events(document,"mousedown",null,this.handleStart.bind(this),!0);this.onMoveWrapper_=conditionalBind$$module$build$src$core$browser_events(document,"mousemove",null,this.handleMove.bind(this),!0);
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
Array.from(this.cachedPoints.keys());2===c.length&&(b=this.cachedPoints.get(c[0]),c=this.cachedPoints.get(c[1]),this.startDistance_=Coordinate$$module$build$src$core$utils$coordinate.distance(b,c),this.isMultiTouch_=!0,a.preventDefault())}handleTouchMove(a){const b=getTouchIdentifierFromEvent$$module$build$src$core$touch(a);this.cachedPoints.set(b,this.getTouchPoint(a));this.isPinchZoomEnabled_&&
|
|
1018
|
-
c=this.cachedPoints.get(b[0]);b=this.cachedPoints.get(b[1]);c=Coordinate$$module$build$src$core$utils$coordinate.distance(c,b)/this.startDistance_;if(0<this.previousScale_&&Infinity>this.previousScale_){b=c-this.previousScale_;b=0<b?b*ZOOM_IN_MULTIPLIER$$module$build$src$core$touch_gesture:b*ZOOM_OUT_MULTIPLIER$$module$build$src$core$touch_gesture;
|
|
1019
|
-
c;a.preventDefault()}handleTouchEnd(a){a=getTouchIdentifierFromEvent$$module$build$src$core$touch(a);this.cachedPoints.has(a)&&this.cachedPoints.delete(a);2>this.cachedPoints.size&&(this.cachedPoints.clear(),this.previousScale_=0)}getTouchPoint(a){return this.startWorkspace_?new Coordinate$$module$build$src$core$utils$coordinate(a.changedTouches?
|
|
1020
|
-
module$build$src$core$touch_gesture.TouchGesture=TouchGesture$$module$build$src$core$touch_gesture;var getInjectionDivXY_$$module$build$src$core$utils=getInjectionDivXY$$module$build$src$core$utils,module$build$src$core$utils={};module$build$src$core$utils.Coordinate=Coordinate$$module$build$src$core$utils$coordinate;module$build$src$core$utils.KeyCodes=KeyCodes$$module$build$src$core$utils$keycodes;module$build$src$core$utils.Rect=Rect$$module$build$src$core$utils$rect;module$build$src$core$utils.Size=Size$$module$build$src$core$utils$size;module$build$src$core$utils.Svg=Svg$$module$build$src$core$utils$svg;
|
|
1027
|
+
module$build$src$core$renderers$common$block_rendering.register=register$$module$build$src$core$renderers$common$block_rendering;module$build$src$core$renderers$common$block_rendering.startDebugger=startDebugger$$module$build$src$core$renderers$common$block_rendering;module$build$src$core$renderers$common$block_rendering.stopDebugger=stopDebugger$$module$build$src$core$renderers$common$block_rendering;module$build$src$core$renderers$common$block_rendering.unregister=unregister$$module$build$src$core$renderers$common$block_rendering;var ThemeManager$$module$build$src$core$theme_manager=class{constructor(a,b){this.workspace=a;this.theme=b;this.subscribedWorkspaces_=[];this.componentDB=new Map}getTheme(){return this.theme}setTheme(a){var b=this.theme;this.theme=a;if(a=this.workspace.getInjectionDiv())b&&(b=b.getClassName())&&removeClass$$module$build$src$core$utils$dom(a,b),(b=this.theme.getClassName())&&addClass$$module$build$src$core$utils$dom(a,b);for(let c=0,d;d=this.subscribedWorkspaces_[c];c++)d.refreshTheme();for(const [c,
|
|
1028
|
+
d]of this.componentDB)for(const e of d){a=e.element;b=e.propertyName;const f=this.theme&&this.theme.getComponentStyle(c);a.style[b]=f||""}for(const c of this.subscribedWorkspaces_)c.hideChaff()}subscribeWorkspace(a){this.subscribedWorkspaces_.push(a)}unsubscribeWorkspace(a){if(!removeElem$$module$build$src$core$utils$array(this.subscribedWorkspaces_,a))throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.");}subscribe(a,b,c){this.componentDB.has(b)||this.componentDB.set(b,[]);this.componentDB.get(b).push({element:a,
|
|
1029
|
+
propertyName:c});b=this.theme&&this.theme.getComponentStyle(b);a.style[c]=b||""}unsubscribe(a){if(a)for(const [b,c]of this.componentDB){for(let d=c.length-1;0<=d;d--)c[d].element===a&&c.splice(d,1);c.length||this.componentDB.delete(b)}}dispose(){this.subscribedWorkspaces_=this.theme=this.owner_=null;this.componentDB.clear()}},module$build$src$core$theme_manager={};module$build$src$core$theme_manager.ThemeManager=ThemeManager$$module$build$src$core$theme_manager;var ZOOM_IN_MULTIPLIER$$module$build$src$core$touch_gesture=5,ZOOM_OUT_MULTIPLIER$$module$build$src$core$touch_gesture=6,TouchGesture$$module$build$src$core$touch_gesture=class extends Gesture$$module$build$src$core$gesture{constructor(){super(...arguments);this.isMultiTouch_=!1;this.cachedPoints=new Map;this.startDistance_=this.previousScale_=0;this.onUpWrapper_=this.onMoveWrapper_=this.isPinchZoomEnabled_=this.onStartWrapper_=null}doStart(a){if(!this.startWorkspace_)throw Error("Cannot start the touch event becauase the start workspace is undefined");
|
|
1030
|
+
this.isPinchZoomEnabled_=this.startWorkspace_.options.zoomOptions&&this.startWorkspace_.options.zoomOptions.pinch;super.doStart(a);!this.isEnding_&&isTouchEvent$$module$build$src$core$touch(a)&&this.handleTouchStart(a)}bindMouseEvents(a){this.onStartWrapper_=conditionalBind$$module$build$src$core$browser_events(document,"mousedown",null,this.handleStart.bind(this),!0);this.onMoveWrapper_=conditionalBind$$module$build$src$core$browser_events(document,"mousemove",null,this.handleMove.bind(this),!0);
|
|
1031
|
+
this.onUpWrapper_=conditionalBind$$module$build$src$core$browser_events(document,"mouseup",null,this.handleUp.bind(this),!0);a.preventDefault();a.stopPropagation()}handleStart(a){!this.isDragging()&&isTouchEvent$$module$build$src$core$touch(a)&&(this.handleTouchStart(a),this.isMultiTouch()&&longStop$$module$build$src$core$touch())}handleMove(a){this.isDragging()?shouldHandleEvent$$module$build$src$core$touch(a)&&super.handleMove(a):this.isMultiTouch()?(isTouchEvent$$module$build$src$core$touch(a)&&
|
|
1032
|
+
this.handleTouchMove(a),longStop$$module$build$src$core$touch()):super.handleMove(a)}handleUp(a){isTouchEvent$$module$build$src$core$touch(a)&&!this.isDragging()&&this.handleTouchEnd(a);!this.isMultiTouch()||this.isDragging()?shouldHandleEvent$$module$build$src$core$touch(a)&&super.handleUp(a):(a.preventDefault(),a.stopPropagation(),this.dispose())}isMultiTouch(){return this.isMultiTouch_}dispose(){super.dispose();this.onStartWrapper_&&unbind$$module$build$src$core$browser_events(this.onStartWrapper_)}handleTouchStart(a){var b=
|
|
1033
|
+
getTouchIdentifierFromEvent$$module$build$src$core$touch(a);this.cachedPoints.set(b,this.getTouchPoint(a));var c=Array.from(this.cachedPoints.keys());2===c.length&&(b=this.cachedPoints.get(c[0]),c=this.cachedPoints.get(c[1]),this.startDistance_=Coordinate$$module$build$src$core$utils$coordinate.distance(b,c),this.isMultiTouch_=!0,a.preventDefault())}handleTouchMove(a){const b=getTouchIdentifierFromEvent$$module$build$src$core$touch(a);this.cachedPoints.set(b,this.getTouchPoint(a));this.isPinchZoomEnabled_&&
|
|
1034
|
+
2===this.cachedPoints.size?this.handlePinch_(a):super.handleMove(a)}handlePinch_(a){var b=Array.from(this.cachedPoints.keys()),c=this.cachedPoints.get(b[0]);b=this.cachedPoints.get(b[1]);c=Coordinate$$module$build$src$core$utils$coordinate.distance(c,b)/this.startDistance_;if(0<this.previousScale_&&Infinity>this.previousScale_){b=c-this.previousScale_;b=0<b?b*ZOOM_IN_MULTIPLIER$$module$build$src$core$touch_gesture:b*ZOOM_OUT_MULTIPLIER$$module$build$src$core$touch_gesture;if(!this.startWorkspace_)throw Error("Cannot handle a pinch because the start workspace is undefined");
|
|
1035
|
+
const d=this.startWorkspace_,e=mouseToSvg$$module$build$src$core$browser_events(a,d.getParentSvg(),d.getInverseScreenCTM());d.zoom(e.x,e.y,b)}this.previousScale_=c;a.preventDefault()}handleTouchEnd(a){a=getTouchIdentifierFromEvent$$module$build$src$core$touch(a);this.cachedPoints.has(a)&&this.cachedPoints.delete(a);2>this.cachedPoints.size&&(this.cachedPoints.clear(),this.previousScale_=0)}getTouchPoint(a){return this.startWorkspace_?new Coordinate$$module$build$src$core$utils$coordinate(a.changedTouches?
|
|
1036
|
+
a.changedTouches[0].pageX:a.pageX,a.changedTouches?a.changedTouches[0].pageY:a.pageY):null}},module$build$src$core$touch_gesture={};module$build$src$core$touch_gesture.TouchGesture=TouchGesture$$module$build$src$core$touch_gesture;var getInjectionDivXY_$$module$build$src$core$utils=getInjectionDivXY$$module$build$src$core$utils,module$build$src$core$utils={};module$build$src$core$utils.Coordinate=Coordinate$$module$build$src$core$utils$coordinate;module$build$src$core$utils.KeyCodes=KeyCodes$$module$build$src$core$utils$keycodes;module$build$src$core$utils.Rect=Rect$$module$build$src$core$utils$rect;module$build$src$core$utils.Size=Size$$module$build$src$core$utils$size;module$build$src$core$utils.Svg=Svg$$module$build$src$core$utils$svg;
|
|
1021
1037
|
module$build$src$core$utils.aria=module$build$src$core$utils$aria;module$build$src$core$utils.array=module$build$src$core$utils$array;module$build$src$core$utils.arrayRemove=arrayRemove$$module$build$src$core$utils;module$build$src$core$utils.browserEvents=module$build$src$core$browser_events;module$build$src$core$utils.checkMessageReferences=checkMessageReferences$$module$build$src$core$utils;module$build$src$core$utils.colour=module$build$src$core$utils$colour;
|
|
1022
1038
|
module$build$src$core$utils.deprecation=module$build$src$core$utils$deprecation;module$build$src$core$utils.dom=module$build$src$core$utils$dom;module$build$src$core$utils.extensions=$.module$build$src$core$extensions;module$build$src$core$utils.genUid=genUid$$module$build$src$core$utils;module$build$src$core$utils.getBlockTypeCounts=getBlockTypeCounts$$module$build$src$core$utils;module$build$src$core$utils.getDocumentScroll=getDocumentScroll$$module$build$src$core$utils;
|
|
1023
1039
|
module$build$src$core$utils.getInjectionDivXY_=getInjectionDivXY$$module$build$src$core$utils;module$build$src$core$utils.getRelativeXY=getRelativeXY$$module$build$src$core$utils;module$build$src$core$utils.getScrollDeltaPixels=getScrollDeltaPixels$$module$build$src$core$utils;module$build$src$core$utils.getViewportBBox=getViewportBBox$$module$build$src$core$utils;module$build$src$core$utils.idGenerator=module$build$src$core$utils$idgenerator;module$build$src$core$utils.is3dSupported=is3dSupported$$module$build$src$core$utils;
|
|
@@ -1033,9 +1049,11 @@ c.workspace!==d.workspace?Connection$$module$build$src$core$connection.REASON_DI
|
|
|
1033
1049
|
Connection$$module$build$src$core$connection.CAN_CONNECT}doTypeChecks(a,b){a=a.getCheck();b=b.getCheck();if(!a||!b)return!0;for(let c=0;c<a.length;c++)if(-1!==b.indexOf(a[c]))return!0;return!1}doDragChecks(a,b,c){if(a.distanceFrom(b)>c||b.getSourceBlock().isInsertionMarker())return!1;switch(b.type){case ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT:return this.canConnectToPrevious_(a,b);case ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE:if(b.isConnected()&&
|
|
1034
1050
|
!b.targetBlock().isInsertionMarker()||a.isConnected())return!1;break;case ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE:if(b.isConnected()&&!b.targetBlock().isMovable()&&!b.targetBlock().isShadow())return!1;break;case ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT:if(b.isConnected()&&!a.getSourceBlock().nextConnection&&!b.targetBlock().isShadow()&&b.targetBlock().nextConnection)return!1;break;default:return!1}return-1!==draggingConnections$$module$build$src$core$common.indexOf(b)?
|
|
1035
1051
|
!1:!0}canConnectToPrevious_(a,b){if(a.targetConnection||-1!==draggingConnections$$module$build$src$core$common.indexOf(b))return!1;if(!b.targetConnection)return!0;a=b.targetBlock();return a.isInsertionMarker()?!a.getPreviousBlock():!1}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.CONNECTION_CHECKER,DEFAULT$$module$build$src$core$registry,ConnectionChecker$$module$build$src$core$connection_checker);var module$build$src$core$connection_checker={};
|
|
1036
|
-
module$build$src$core$connection_checker.ConnectionChecker=ConnectionChecker$$module$build$src$core$connection_checker;var VarDelete$$module$build$src$core$events$events_var_delete=class extends VarBase$$module$build$src$core$events$events_var_base{constructor(a){super(a);this.type=VAR_DELETE$$module$build$src$core$events$utils;a&&(this.varType=a.type,this.varName=a.name)}toJson(){const a=super.toJson();
|
|
1037
|
-
|
|
1038
|
-
|
|
1052
|
+
module$build$src$core$connection_checker.ConnectionChecker=ConnectionChecker$$module$build$src$core$connection_checker;var VarDelete$$module$build$src$core$events$events_var_delete=class extends VarBase$$module$build$src$core$events$events_var_base{constructor(a){super(a);this.type=VAR_DELETE$$module$build$src$core$events$utils;a&&(this.varType=a.type,this.varName=a.name)}toJson(){const a=super.toJson();if(!this.varType)throw Error("The var type is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");
|
|
1053
|
+
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_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");a?b.deleteVariableById(this.varId):b.createVariable(this.varName,this.varType,this.varId)}};
|
|
1054
|
+
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,VAR_DELETE$$module$build$src$core$events$utils,VarDelete$$module$build$src$core$events$events_var_delete);var module$build$src$core$events$events_var_delete={};module$build$src$core$events$events_var_delete.VarDelete=VarDelete$$module$build$src$core$events$events_var_delete;var VarRename$$module$build$src$core$events$events_var_rename=class extends VarBase$$module$build$src$core$events$events_var_base{constructor(a,b){super(a);this.type=VAR_RENAME$$module$build$src$core$events$utils;a&&(this.oldName=a.name,this.newName="undefined"===typeof b?"":b)}toJson(){const a=super.toJson();if(!this.oldName)throw Error("The old var name is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.newName)throw Error("The new var name is undefined. Either pass a value to the constructor, or call fromJson");
|
|
1055
|
+
a.oldName=this.oldName;a.newName=this.newName;return a}fromJson(a){super.fromJson(a);this.oldName=a.oldName;this.newName=a.newName}run(a){const b=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.oldName)throw Error("The old var name is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.newName)throw Error("The new var name is undefined. Either pass a value to the constructor, or call fromJson");
|
|
1056
|
+
a?b.renameVariableById(this.varId,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);
|
|
1039
1057
|
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));
|
|
1040
1058
|
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,
|
|
1041
1059
|
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=
|
|
@@ -1093,14 +1111,14 @@ this.rendered&&(this.scrollbar&&this.scrollbar.resize(),this.updateInverseScreen
|
|
|
1093
1111
|
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
1112
|
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
1113
|
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"
|
|
1097
|
-
|
|
1114
|
+
!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"),d;b=parseInt(null!=
|
|
1115
|
+
(d=this.getParentSvg().getAttribute("height"))?d:"0");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
1116
|
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
1117
|
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"
|
|
1101
|
-
|
|
1102
|
-
|
|
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"
|
|
1118
|
+
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");this.RTL&&(d=-d);let g;e=parseInt(null!=(g=a.getAttribute("y"))?g:"0")}else b&&
|
|
1119
|
+
(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=!0;
|
|
1120
|
+
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));
|
|
1121
|
+
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"),e,f=parseInt(null!=(e=a.getAttribute("y"))?e:"0");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
1122
|
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
1123
|
"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
1124
|
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());
|
|
@@ -1123,39 +1141,39 @@ a;this.resizesEnabled_=a;b&&this.resizeContents()}clear(){this.setResizesEnabled
|
|
|
1123
1141
|
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
1142
|
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
1143
|
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);
|
|
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.
|
|
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";
|
|
1128
|
-
|
|
1129
|
-
this.
|
|
1130
|
-
this.GRID_UNIT;this.
|
|
1131
|
-
|
|
1132
|
-
this.
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
e
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
a))
|
|
1144
|
-
{
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
`${a} .blocklyEditableText>
|
|
1150
|
-
|
|
1151
|
-
|
|
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?
|
|
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:
|
|
1154
|
-
lineOnAxis$$module$build$src$core$utils$svg_paths("V",a.yPos+a.height)}drawRightDynamicConnection_(){
|
|
1155
|
-
this.info_.
|
|
1156
|
-
a
|
|
1157
|
-
|
|
1158
|
-
this.positionStatementInputConnection_(a)}},module$build$src$core$renderers$zelos$drawer={};module$build$src$core$renderers$zelos$drawer.Drawer=Drawer$$module$build$src$core$renderers$zelos$drawer;$.FieldImage$$module$build$src$core$field_image=class extends Field$$module$build$src$core$field{constructor(a,b,c,d,e,f,g){super(Field$$module$build$src$core$field.SKIP_SETUP);this.imageElement_=this.clickHandler_=null;this.flipRtl_=this.isDirty_=this.EDITABLE=!1;this.altText_="";c=Number(replaceMessageReferences$$module$build$src$core$utils$parsing(c));b=Number(replaceMessageReferences$$module$build$src$core$utils$parsing(b));if(isNaN(c)||isNaN(b))throw Error("Height and width values of an image field must cast to numbers.");
|
|
1144
|
+
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.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.SHAPE_IN_SHAPE_PADDING={1:{0:5*this.GRID_UNIT,1:2*this.GRID_UNIT,2:5*this.GRID_UNIT,3:5*this.GRID_UNIT},
|
|
1145
|
+
2:{0:3*this.GRID_UNIT,1:3*this.GRID_UNIT,2:1*this.GRID_UNIT,3:2*this.GRID_UNIT},3:{0:2*this.GRID_UNIT,1:2*this.GRID_UNIT,2:2*this.GRID_UNIT,3:2*this.GRID_UNIT}};this.FULL_BLOCK_FIELDS=!0;this.FIELD_TEXT_FONTWEIGHT="bold";this.FIELD_TEXT_FONTFAMILY='"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";
|
|
1146
|
+
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_=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;
|
|
1147
|
+
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;this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING;this.BOTTOM_ROW_MIN_HEIGHT=this.CORNER_RADIUS;this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT=6*this.GRID_UNIT;this.STATEMENT_BOTTOM_SPACER=-this.NOTCH_HEIGHT;this.STATEMENT_INPUT_SPACER_MIN_WIDTH=40*
|
|
1148
|
+
this.GRID_UNIT;this.STATEMENT_INPUT_PADDING_LEFT=4*this.GRID_UNIT;this.EMPTY_INLINE_INPUT_PADDING=4*this.GRID_UNIT;this.EMPTY_INLINE_INPUT_HEIGHT=8*this.GRID_UNIT;this.DUMMY_INPUT_MIN_HEIGHT=8*this.GRID_UNIT;this.DUMMY_INPUT_SHADOW_MIN_HEIGHT=6*this.GRID_UNIT;this.CURSOR_WS_WIDTH=20*this.GRID_UNIT;this.FIELD_TEXT_FONTSIZE=3*this.GRID_UNIT;this.FIELD_BORDER_RECT_RADIUS=this.CORNER_RADIUS;this.FIELD_BORDER_RECT_X_PADDING=2*this.GRID_UNIT;this.FIELD_BORDER_RECT_Y_PADDING=1.625*this.GRID_UNIT;this.FIELD_BORDER_RECT_HEIGHT=
|
|
1149
|
+
8*this.GRID_UNIT;this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=8*this.GRID_UNIT;this.FIELD_DROPDOWN_SVG_ARROW_PADDING=this.FIELD_BORDER_RECT_X_PADDING;this.FIELD_COLOUR_DEFAULT_WIDTH=2*this.GRID_UNIT;this.FIELD_COLOUR_DEFAULT_HEIGHT=4*this.GRID_UNIT;this.FIELD_CHECKBOX_X_OFFSET=1*this.GRID_UNIT;this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH=12*this.GRID_UNIT}setFontConstants_(a){super.setFontConstants_(a);this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT=this.FIELD_TEXT_HEIGHT+2*this.FIELD_BORDER_RECT_Y_PADDING}init(){super.init();
|
|
1150
|
+
this.HEXAGONAL=this.makeHexagonal();this.ROUNDED=this.makeRounded();this.SQUARED=this.makeSquared();this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT+this.INSIDE_CORNERS.rightWidth}setDynamicProperties_(a){super.setDynamicProperties_(a);this.SELECTED_GLOW_COLOUR=a.getComponentStyle("selectedGlowColour")||this.SELECTED_GLOW_COLOUR;const b=Number(a.getComponentStyle("selectedGlowSize"));this.SELECTED_GLOW_SIZE=b&&!isNaN(b)?b:this.SELECTED_GLOW_SIZE;this.REPLACEMENT_GLOW_COLOUR=a.getComponentStyle("replacementGlowColour")||
|
|
1151
|
+
this.REPLACEMENT_GLOW_COLOUR;this.REPLACEMENT_GLOW_SIZE=(a=Number(a.getComponentStyle("replacementGlowSize")))&&!isNaN(a)?a:this.REPLACEMENT_GLOW_SIZE}dispose(){super.dispose();this.selectedGlowFilter_&&removeNode$$module$build$src$core$utils$dom(this.selectedGlowFilter_);this.replacementGlowFilter_&&removeNode$$module$build$src$core$utils$dom(this.replacementGlowFilter_)}makeStartHat(){const a=this.START_HAT_HEIGHT,b=this.START_HAT_WIDTH,c=curve$$module$build$src$core$utils$svg_paths("c",[point$$module$build$src$core$utils$svg_paths(25,
|
|
1152
|
+
-a),point$$module$build$src$core$utils$svg_paths(71,-a),point$$module$build$src$core$utils$svg_paths(b,0)]);return{height:a,width:b,path:c}}makeHexagonal(){function a(c,d,e){var f=c/2;f=f>b?b:f;e=e?-1:1;c=(d?-1:1)*c/2;return lineTo$$module$build$src$core$utils$svg_paths(-e*f,c)+lineTo$$module$build$src$core$utils$svg_paths(e*f,c)}const b=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH;return{type:this.SHAPES.HEXAGONAL,isDynamic:!0,width(c){c/=2;return c>b?b:c},height(c){return c},connectionOffsetY(c){return c/
|
|
1153
|
+
2},connectionOffsetX(c){return-c},pathDown(c){return a(c,!1,!1)},pathUp(c){return a(c,!0,!1)},pathRightDown(c){return a(c,!1,!0)},pathRightUp(c){return a(c,!1,!0)}}}makeRounded(){function a(d,e,f){const g=d>c?d-c:0;d=(d>c?c:d)/2;return arc$$module$build$src$core$utils$svg_paths("a","0 0,1",d,point$$module$build$src$core$utils$svg_paths((e?-1:1)*d,(e?-1:1)*d))+lineOnAxis$$module$build$src$core$utils$svg_paths("v",(f?1:-1)*g)+arc$$module$build$src$core$utils$svg_paths("a","0 0,1",d,point$$module$build$src$core$utils$svg_paths((e?
|
|
1154
|
+
1:-1)*d,(e?-1:1)*d))}const b=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,c=2*b;return{type:this.SHAPES.ROUND,isDynamic:!0,width(d){d/=2;return d>b?b:d},height(d){return d},connectionOffsetY(d){return d/2},connectionOffsetX(d){return-d},pathDown(d){return a(d,!1,!1)},pathUp(d){return a(d,!0,!1)},pathRightDown(d){return a(d,!1,!0)},pathRightUp(d){return a(d,!1,!0)}}}makeSquared(){function a(c,d,e){c-=2*b;return arc$$module$build$src$core$utils$svg_paths("a","0 0,1",b,point$$module$build$src$core$utils$svg_paths((d?
|
|
1155
|
+
-1:1)*b,(d?-1:1)*b))+lineOnAxis$$module$build$src$core$utils$svg_paths("v",(e?1:-1)*c)+arc$$module$build$src$core$utils$svg_paths("a","0 0,1",b,point$$module$build$src$core$utils$svg_paths((d?1:-1)*b,(d?-1:1)*b))}const b=this.CORNER_RADIUS;return{type:this.SHAPES.SQUARE,isDynamic:!0,width(c){return b},height(c){return c},connectionOffsetY(c){return c/2},connectionOffsetX(c){return-c},pathDown(c){return a(c,!1,!1)},pathUp(c){return a(c,!0,!1)},pathRightDown(c){return a(c,!1,!0)},pathRightUp(c){return a(c,
|
|
1156
|
+
!1,!0)}}}shapeFor(a){let b=a.getCheck();!b&&a.targetConnection&&(b=a.targetConnection.getCheck());switch(a.type){case ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE:case ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE:a=a.getSourceBlock().getOutputShape();if(null!==a)switch(a){case this.SHAPES.HEXAGONAL:return this.HEXAGONAL;case this.SHAPES.ROUND:return this.ROUNDED;case this.SHAPES.SQUARE:return this.SQUARED}if(b&&-1!==b.indexOf("Boolean"))return this.HEXAGONAL;
|
|
1157
|
+
if(b&&-1!==b.indexOf("Number"))return this.ROUNDED;b&&b.indexOf("String");return this.ROUNDED;case ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT:case ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown type");}}makeNotch(){function a(l){return curve$$module$build$src$core$utils$svg_paths("c",[point$$module$build$src$core$utils$svg_paths(l*e/2,0),point$$module$build$src$core$utils$svg_paths(l*e*3/4,g/2),point$$module$build$src$core$utils$svg_paths(l*
|
|
1158
|
+
e,g)])+line$$module$build$src$core$utils$svg_paths([point$$module$build$src$core$utils$svg_paths(l*e,f)])+curve$$module$build$src$core$utils$svg_paths("c",[point$$module$build$src$core$utils$svg_paths(l*e/4,g/2),point$$module$build$src$core$utils$svg_paths(l*e/2,g),point$$module$build$src$core$utils$svg_paths(l*e,g)])+lineOnAxis$$module$build$src$core$utils$svg_paths("h",l*d)+curve$$module$build$src$core$utils$svg_paths("c",[point$$module$build$src$core$utils$svg_paths(l*e/2,0),point$$module$build$src$core$utils$svg_paths(l*
|
|
1159
|
+
e*3/4,-(g/2)),point$$module$build$src$core$utils$svg_paths(l*e,-g)])+line$$module$build$src$core$utils$svg_paths([point$$module$build$src$core$utils$svg_paths(l*e,-f)])+curve$$module$build$src$core$utils$svg_paths("c",[point$$module$build$src$core$utils$svg_paths(l*e/4,-(g/2)),point$$module$build$src$core$utils$svg_paths(l*e/2,-g),point$$module$build$src$core$utils$svg_paths(l*e,-g)])}const b=this.NOTCH_WIDTH,c=this.NOTCH_HEIGHT,d=b/3,e=d/3,f=c/2,g=f/2,h=a(1),k=a(-1);return{type:this.SHAPES.NOTCH,
|
|
1160
|
+
width:b,height:c,pathLeft:h,pathRight:k}}makeInsideCorners(){const a=this.CORNER_RADIUS,b=arc$$module$build$src$core$utils$svg_paths("a","0 0,0",a,point$$module$build$src$core$utils$svg_paths(-a,a)),c=arc$$module$build$src$core$utils$svg_paths("a","0 0,1",a,point$$module$build$src$core$utils$svg_paths(-a,a)),d=arc$$module$build$src$core$utils$svg_paths("a","0 0,0",a,point$$module$build$src$core$utils$svg_paths(a,a)),e=arc$$module$build$src$core$utils$svg_paths("a","0 0,1",a,point$$module$build$src$core$utils$svg_paths(a,
|
|
1161
|
+
a));return{width:a,height:a,pathTop:b,pathBottom:d,rightWidth:a,rightHeight:a,pathTopRight:c,pathBottomRight:e}}generateSecondaryColour_(a){return blend$$module$build$src$core$utils$colour("#000",a,.15)||a}generateTertiaryColour_(a){return blend$$module$build$src$core$utils$colour("#000",a,.25)||a}createDom(a,b,c){super.createDom(a,b,c);a=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.DEFS,{},a);b=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FILTER,
|
|
1162
|
+
{id:"blocklySelectedGlowFilter"+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.SELECTED_GLOW_SIZE},b);c=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FECOMPONENTTRANSFER,{result:"outBlur"},b);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FEFUNCA,{type:"table",
|
|
1163
|
+
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);this.selectedGlowFilterId=b.id;this.selectedGlowFilter_=b;a=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FILTER,
|
|
1164
|
+
{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,{result:"outBlur"},a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FEFUNCA,{type:"table",
|
|
1165
|
+
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",result:"outGlow"},a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.FECOMPOSITE,{"in":"SourceGraphic",
|
|
1166
|
+
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),`,`${a} .blocklyEditableText>rect:not(.blocklyDropdownRect) {`,`fill: ${this.FIELD_BORDER_RECT_COLOUR};`,"}",`${a} .blocklyNonEditableText>text,`,
|
|
1167
|
+
`${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)`," .blocklyEditableText:not(.editing):hover>.blocklyPath {","stroke: #fff;","stroke-width: 2;","}",`${a} .blocklyHtmlInput {`,
|
|
1168
|
+
`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;","}",`${a} .blocklyHighlightedConnectionPath {`,`stroke: ${this.SELECTED_GLOW_COLOUR};`,"}",`${a} .blocklyDisabled > .blocklyOutlinePath {`,
|
|
1169
|
+
`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();if(isDebuggerEnabled$$module$build$src$core$renderers$common$debug()){let b,c;null==(b=this.block_)||null==(c=b.renderingDebugger)||c.drawDebug(this.block_,
|
|
1170
|
+
this.info_)}this.recordSizeOnBlock_();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?
|
|
1171
|
+
this.drawLeftDynamicConnection_():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:
|
|
1172
|
+
"")}else this.outlinePath_+=lineOnAxis$$module$build$src$core$utils$svg_paths("V",a.yPos+a.height)}drawRightDynamicConnection_(){if(!this.info_.outputConnection)throw Error("Cannot draw the output connection of a block that doesn't have one");this.outlinePath_+=this.info_.outputConnection.shape.pathRightDown(this.info_.outputConnection.height)}drawLeftDynamicConnection_(){if(!this.info_.outputConnection)throw Error("Cannot draw the output connection of a block that doesn't have one");this.positionOutputConnection_();
|
|
1173
|
+
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,this.info_.startY);this.outlinePath_+=lineOnAxis$$module$build$src$core$utils$svg_paths("h",a.width)}drawFlatBottom_(){const a=this.info_.bottomRow;this.positionNextConnection_();this.outlinePath_+=lineOnAxis$$module$build$src$core$utils$svg_paths("V",
|
|
1174
|
+
a.baseline);this.outlinePath_+=lineOnAxis$$module$build$src$core$utils$svg_paths("h",-a.width)}drawInlineInput_(a){this.positionInlineInputConnection_(a);const b=a.input.name;if(!a.connectedBlock&&!this.info_.isInsertionMarker){var c=a.width-2*a.connectionWidth;a=moveTo$$module$build$src$core$utils$svg_paths(a.xPos+a.connectionWidth,a.centerline-a.height/2)+lineOnAxis$$module$build$src$core$utils$svg_paths("h",c)+a.shape.pathRightDown(a.height)+lineOnAxis$$module$build$src$core$utils$svg_paths("h",
|
|
1175
|
+
-c)+a.shape.pathUp(a.height)+"z";this.block_.pathObject.setOutlinePath(b,a)}}drawStatementInput_(a){var b=a.getLastInput();const c=b.xPos+b.notchOffset+b.shape.width,d=b.shape.pathRight+lineOnAxis$$module$build$src$core$utils$svg_paths("h",-(b.notchOffset-this.constants_.INSIDE_CORNERS.width))+this.constants_.INSIDE_CORNERS.pathTop,e=a.height-2*this.constants_.INSIDE_CORNERS.height;b=this.constants_.INSIDE_CORNERS.pathBottom+lineOnAxis$$module$build$src$core$utils$svg_paths("h",b.notchOffset-this.constants_.INSIDE_CORNERS.width)+
|
|
1176
|
+
(b.connectedBottomNextConnection?"":b.shape.pathLeft);this.outlinePath_+=lineOnAxis$$module$build$src$core$utils$svg_paths("H",c)+d+lineOnAxis$$module$build$src$core$utils$svg_paths("v",e)+b+lineOnAxis$$module$build$src$core$utils$svg_paths("H",a.xPos+a.width);this.positionStatementInputConnection_(a)}},module$build$src$core$renderers$zelos$drawer={};module$build$src$core$renderers$zelos$drawer.Drawer=Drawer$$module$build$src$core$renderers$zelos$drawer;$.FieldImage$$module$build$src$core$field_image=class extends Field$$module$build$src$core$field{constructor(a,b,c,d,e,f,g){super(Field$$module$build$src$core$field.SKIP_SETUP);this.imageElement_=this.clickHandler_=null;this.flipRtl_=this.isDirty_=this.EDITABLE=!1;this.altText_="";c=Number(replaceMessageReferences$$module$build$src$core$utils$parsing(c));b=Number(replaceMessageReferences$$module$build$src$core$utils$parsing(b));if(isNaN(c)||isNaN(b))throw Error("Height and width values of an image field must cast to numbers.");
|
|
1159
1177
|
if(0>=c||0>=b)throw Error("Height and width values of an image field must be greater than 0.");this.size_=new Size$$module$build$src$core$utils$size(b,c+$.FieldImage$$module$build$src$core$field_image.Y_PADDING);this.imageHeight_=c;"function"===typeof e&&(this.clickHandler_=e);a!==Field$$module$build$src$core$field.SKIP_SETUP&&(g?this.configure_(g):(this.flipRtl_=!!f,this.altText_=replaceMessageReferences$$module$build$src$core$utils$parsing(d)||""),this.setValue(replaceMessageReferences$$module$build$src$core$utils$parsing(a)))}configure_(a){super.configure_(a);
|
|
1160
1178
|
a.flipRtl&&(this.flipRtl_=a.flipRtl);a.alt&&(this.altText_=replaceMessageReferences$$module$build$src$core$utils$parsing(a.alt))}initView(){this.imageElement_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.IMAGE,{height:this.imageHeight_+"px",width:this.size_.width+"px",alt:this.altText_},this.fieldGroup_);this.imageElement_.setAttributeNS(XLINK_NS$$module$build$src$core$utils$dom,"xlink:href",this.value_);this.clickHandler_&&(this.imageElement_.style.cursor=
|
|
1161
1179
|
"pointer")}updateSize_(){}doClassValidation_(a){return"string"!==typeof a?null:a}doValueUpdate_(a){this.value_=a;this.imageElement_&&this.imageElement_.setAttributeNS(XLINK_NS$$module$build$src$core$utils$dom,"xlink:href",String(this.value_))}getFlipRtl(){return this.flipRtl_}setAlt(a){a!==this.altText_&&(this.altText_=a||"",this.imageElement_&&this.imageElement_.setAttribute("alt",this.altText_))}showEditor_(){this.clickHandler_&&this.clickHandler_(this)}setOnClickHandler(a){this.clickHandler_=a}getText_(){return this.altText_}static fromJson(a){if(!a.src||
|
|
@@ -1163,17 +1181,18 @@ a.flipRtl&&(this.flipRtl_=a.flipRtl);a.alt&&(this.altText_=replaceMessageReferen
|
|
|
1163
1181
|
module$build$src$core$field_image.FieldImage=$.FieldImage$$module$build$src$core$field_image;$.FieldTextInput$$module$build$src$core$field_textinput=class extends Field$$module$build$src$core$field{constructor(a,b,c){super(Field$$module$build$src$core$field.SKIP_SETUP);this.spellcheck_=!0;this.htmlInput_=null;this.isTextValid_=this.isBeingEdited_=!1;this.onKeyInputWrapper_=this.onKeyDownWrapper_=null;this.fullBlockClickTarget_=!1;this.workspace_=null;this.SERIALIZABLE=!0;this.CURSOR="text";a!==Field$$module$build$src$core$field.SKIP_SETUP&&(c&&this.configure_(c),this.setValue(a),b&&this.setValidator(b))}configure_(a){super.configure_(a);
|
|
1164
1182
|
void 0!==a.spellcheck&&(this.spellcheck_=a.spellcheck)}initView(){if(this.getConstants().FULL_BLOCK_FIELDS){let a=0,b=0;for(let c=0,d;d=this.sourceBlock_.inputList[c];c++){for(let e=0;d.fieldRow[e];e++)a++;d.connection&&b++}this.fullBlockClickTarget_=1>=a&&this.sourceBlock_.outputConnection&&!b}else this.fullBlockClickTarget_=!1;this.fullBlockClickTarget_?this.clickTarget_=this.sourceBlock_.getSvgRoot():this.createBorderRect_();this.createTextElement_()}doClassValidation_(a){return null===a||void 0===
|
|
1165
1183
|
a?null:String(a)}doValueInvalid_(a){this.isBeingEdited_&&(this.isTextValid_=!1,a=this.value_,this.value_=this.htmlInput_.getAttribute("data-untyped-default-value"),this.sourceBlock_&&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))(this.sourceBlock_,"field",this.name||null,a,this.value_)))}doValueUpdate_(a){this.isTextValid_=!0;this.value_=a;this.isBeingEdited_||(this.isDirty_=
|
|
1166
|
-
!0)}applyColour(){this.sourceBlock_&&this.getConstants().FULL_BLOCK_FIELDS
|
|
1167
|
-
State$$module$build$src$core$utils$aria.INVALID,!1)):(addClass$$module$build$src$core$utils$dom(a,"blocklyInvalidInput"),setState$$module$build$src$core$utils$aria(a,State$$module$build$src$core$utils$aria.INVALID,!0))}}setSpellcheck(a){a!==this.spellcheck_&&(this.spellcheck_=a,this.htmlInput_&&this.htmlInput_.setAttribute("spellcheck",this.spellcheck_))}showEditor_(a,b){this.workspace_=this.sourceBlock_.workspace;a=b||!1;!a&&(MOBILE$$module$build$src$core$utils$useragent||
|
|
1168
|
-
IPAD$$module$build$src$core$utils$useragent)?this.showPromptEditor_():this.showInlineEditor_(a)}showPromptEditor_(){prompt$$module$build$src$core$dialog(Msg$$module$build$src$core$msg.CHANGE_VALUE_TITLE,this.getText(),a=>{null!==a&&this.setValue(this.getValueFromEditorText_(a))})}showInlineEditor_(a){show$$module$build$src$core$widgetdiv(this,this.sourceBlock_.RTL,this.widgetDispose_.bind(this));this.htmlInput_=this.widgetCreate_();this.isBeingEdited_
|
|
1169
|
-
this.htmlInput_.select())}widgetCreate_(){setGroup$$module$build$src$core$events$utils(!0);const a=getDiv$$module$build$src$core$widgetdiv();addClass$$module$build$src$core$utils$dom(this.getClickTarget_(),"editing");const b=document.createElement("input");b.className="blocklyHtmlInput";b.setAttribute("spellcheck",this.spellcheck_);const c=this.workspace_.getScale();var d=this.getConstants().FIELD_TEXT_FONTSIZE*c+"pt";a.style.fontSize=d;b.style.fontSize=
|
|
1170
|
-
c+"px";if(this.fullBlockClickTarget_){d=this.getScaledBBox();d=(d.bottom-d.top)/2+"px";const e=this.sourceBlock_.getParent()?this.sourceBlock_.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary;b.style.border=1*c+"px solid "+e;a.style.borderRadius=d;a.style.transition="box-shadow 0.25s ease 0s";this.getConstants().FIELD_TEXTINPUT_BOX_SHADOW&&(a.style.boxShadow="rgba(255, 255, 255, 0.3) 0 0 0 "+4*c+"px")}b.style.borderRadius=
|
|
1171
|
-
b.setAttribute("data-untyped-default-value",this.value_);b.setAttribute("data-old-value","");this.resizeEditor_();this.bindInputEvents_(b);return b}widgetDispose_(){this.isBeingEdited_=!1;this.isTextValid_=!0;this.forceRerender();this.onFinishEditing_(this.value_);setGroup$$module$build$src$core$events$utils(!1);this.unbindInputEvents_();const a=getDiv$$module$build$src$core$widgetdiv().style;a.width="auto";a.height="auto";
|
|
1172
|
-
"editing")}onFinishEditing_(a){}bindInputEvents_(a){this.onKeyDownWrapper_=conditionalBind$$module$build$src$core$browser_events(a,"keydown",this,this.onHtmlInputKeyDown_);this.onKeyInputWrapper_=conditionalBind$$module$build$src$core$browser_events(a,"input",this,this.onHtmlInputChange_)}unbindInputEvents_(){this.onKeyDownWrapper_&&(unbind$$module$build$src$core$browser_events(this.onKeyDownWrapper_),
|
|
1173
|
-
this.onKeyInputWrapper_=null)}onHtmlInputKeyDown_(a){a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.ENTER?(hide$$module$build$src$core$widgetdiv(),hideWithoutAnimation$$module$build$src$core$dropdowndiv()):a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.ESC?(this.setValue(this.htmlInput_.getAttribute("data-untyped-default-value")),hide$$module$build$src$core$widgetdiv(),
|
|
1174
|
-
(hide$$module$build$src$core$widgetdiv(),hideWithoutAnimation$$module$build$src$core$dropdowndiv(),this.sourceBlock_.tab(this,!a.shiftKey),a.preventDefault())}onHtmlInputChange_(a){a=this.htmlInput_.value;a!==this.htmlInput_.getAttribute("data-old-value")&&(this.htmlInput_.setAttribute("data-old-value",a),a=this.getValueFromEditorText_(a),this.setValue(a),this.forceRerender(),
|
|
1175
|
-
this.setValue(a)}resizeEditor_(){const a=getDiv$$module$build$src$core$widgetdiv();var b=this.getScaledBBox();a.style.width=b.right-b.left+"px";a.style.height=b.bottom-b.top+"px";b=new Coordinate$$module$build$src$core$utils$coordinate(this.sourceBlock_.RTL?b.right-a.offsetWidth:b.left,b.top);a.style.left=b.x+"px";a.style.top=b.y+"px"}isTabNavigable(){return!0}getText_(){return this.isBeingEdited_&&
|
|
1176
|
-
|
|
1184
|
+
!0)}applyColour(){if(this.sourceBlock_&&this.getConstants().FULL_BLOCK_FIELDS){var a=this.sourceBlock_;if(this.borderRect_){if(!a.style.colourTertiary)throw Error("The renderer did not properly initialize the block style");this.borderRect_.setAttribute("stroke",a.style.colourTertiary)}else a.pathObject.svgPath.setAttribute("fill",this.getConstants().FIELD_BORDER_RECT_COLOUR)}}render_(){super.render_();if(this.isBeingEdited_){this.resizeEditor_();const a=this.htmlInput_;this.isTextValid_?(removeClass$$module$build$src$core$utils$dom(a,
|
|
1185
|
+
"blocklyInvalidInput"),setState$$module$build$src$core$utils$aria(a,State$$module$build$src$core$utils$aria.INVALID,!1)):(addClass$$module$build$src$core$utils$dom(a,"blocklyInvalidInput"),setState$$module$build$src$core$utils$aria(a,State$$module$build$src$core$utils$aria.INVALID,!0))}}setSpellcheck(a){a!==this.spellcheck_&&(this.spellcheck_=a,this.htmlInput_&&this.htmlInput_.setAttribute("spellcheck",this.spellcheck_))}showEditor_(a,b){this.workspace_=this.sourceBlock_.workspace;a=b||!1;!a&&(MOBILE$$module$build$src$core$utils$useragent||
|
|
1186
|
+
ANDROID$$module$build$src$core$utils$useragent||IPAD$$module$build$src$core$utils$useragent)?this.showPromptEditor_():this.showInlineEditor_(a)}showPromptEditor_(){prompt$$module$build$src$core$dialog(Msg$$module$build$src$core$msg.CHANGE_VALUE_TITLE,this.getText(),a=>{null!==a&&this.setValue(this.getValueFromEditorText_(a))})}showInlineEditor_(a){show$$module$build$src$core$widgetdiv(this,this.sourceBlock_.RTL,this.widgetDispose_.bind(this));this.htmlInput_=this.widgetCreate_();this.isBeingEdited_=
|
|
1187
|
+
!0;a||(this.htmlInput_.focus({preventScroll:!0}),this.htmlInput_.select())}widgetCreate_(){setGroup$$module$build$src$core$events$utils(!0);const a=getDiv$$module$build$src$core$widgetdiv();addClass$$module$build$src$core$utils$dom(this.getClickTarget_(),"editing");const b=document.createElement("input");b.className="blocklyHtmlInput";b.setAttribute("spellcheck",this.spellcheck_);const c=this.workspace_.getScale();var d=this.getConstants().FIELD_TEXT_FONTSIZE*c+"pt";a.style.fontSize=d;b.style.fontSize=
|
|
1188
|
+
d;d=$.FieldTextInput$$module$build$src$core$field_textinput.BORDERRADIUS*c+"px";if(this.fullBlockClickTarget_){d=this.getScaledBBox();d=(d.bottom-d.top)/2+"px";const e=this.sourceBlock_.getParent()?this.sourceBlock_.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary;b.style.border=1*c+"px solid "+e;a.style.borderRadius=d;a.style.transition="box-shadow 0.25s ease 0s";this.getConstants().FIELD_TEXTINPUT_BOX_SHADOW&&(a.style.boxShadow="rgba(255, 255, 255, 0.3) 0 0 0 "+4*c+"px")}b.style.borderRadius=
|
|
1189
|
+
d;a.appendChild(b);b.value=b.defaultValue=this.getEditorText_(this.value_);b.setAttribute("data-untyped-default-value",this.value_);b.setAttribute("data-old-value","");this.resizeEditor_();this.bindInputEvents_(b);return b}widgetDispose_(){this.isBeingEdited_=!1;this.isTextValid_=!0;this.forceRerender();this.onFinishEditing_(this.value_);setGroup$$module$build$src$core$events$utils(!1);this.unbindInputEvents_();const a=getDiv$$module$build$src$core$widgetdiv().style;a.width="auto";a.height="auto";
|
|
1190
|
+
a.fontSize="";a.transition="";a.boxShadow="";this.htmlInput_=null;removeClass$$module$build$src$core$utils$dom(this.getClickTarget_(),"editing")}onFinishEditing_(a){}bindInputEvents_(a){this.onKeyDownWrapper_=conditionalBind$$module$build$src$core$browser_events(a,"keydown",this,this.onHtmlInputKeyDown_);this.onKeyInputWrapper_=conditionalBind$$module$build$src$core$browser_events(a,"input",this,this.onHtmlInputChange_)}unbindInputEvents_(){this.onKeyDownWrapper_&&(unbind$$module$build$src$core$browser_events(this.onKeyDownWrapper_),
|
|
1191
|
+
this.onKeyDownWrapper_=null);this.onKeyInputWrapper_&&(unbind$$module$build$src$core$browser_events(this.onKeyInputWrapper_),this.onKeyInputWrapper_=null)}onHtmlInputKeyDown_(a){a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.ENTER?(hide$$module$build$src$core$widgetdiv(),hideWithoutAnimation$$module$build$src$core$dropdowndiv()):a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.ESC?(this.setValue(this.htmlInput_.getAttribute("data-untyped-default-value")),hide$$module$build$src$core$widgetdiv(),
|
|
1192
|
+
hideWithoutAnimation$$module$build$src$core$dropdowndiv()):a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.TAB&&(hide$$module$build$src$core$widgetdiv(),hideWithoutAnimation$$module$build$src$core$dropdowndiv(),this.sourceBlock_.tab(this,!a.shiftKey),a.preventDefault())}onHtmlInputChange_(a){a=this.htmlInput_.value;a!==this.htmlInput_.getAttribute("data-old-value")&&(this.htmlInput_.setAttribute("data-old-value",a),a=this.getValueFromEditorText_(a),this.setValue(a),this.forceRerender(),
|
|
1193
|
+
this.resizeEditor_())}setEditorValue_(a){this.isDirty_=!0;this.isBeingEdited_&&(this.htmlInput_.value=this.getEditorText_(a));this.setValue(a)}resizeEditor_(){const a=getDiv$$module$build$src$core$widgetdiv();var b=this.getScaledBBox();a.style.width=b.right-b.left+"px";a.style.height=b.bottom-b.top+"px";b=new Coordinate$$module$build$src$core$utils$coordinate(this.sourceBlock_.RTL?b.right-a.offsetWidth:b.left,b.top);a.style.left=b.x+"px";a.style.top=b.y+"px"}isTabNavigable(){return!0}getText_(){return this.isBeingEdited_&&
|
|
1194
|
+
this.htmlInput_?this.htmlInput_.value:null}getEditorText_(a){return String(a)}getValueFromEditorText_(a){return a}static fromJson(a){return new this(replaceMessageReferences$$module$build$src$core$utils$parsing(a.text),void 0,a)}};$.FieldTextInput$$module$build$src$core$field_textinput.BORDERRADIUS=4;register$$module$build$src$core$field_registry("field_input",$.FieldTextInput$$module$build$src$core$field_textinput);$.FieldTextInput$$module$build$src$core$field_textinput.prototype.DEFAULT_VALUE="";
|
|
1195
|
+
var module$build$src$core$field_textinput={};module$build$src$core$field_textinput.FieldTextInput=$.FieldTextInput$$module$build$src$core$field_textinput;var BottomRow$$module$build$src$core$renderers$zelos$measurables$bottom_row=class extends BottomRow$$module$build$src$core$renderers$measurables$bottom_row{constructor(a){super(a)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(a){return!!a.outputConnection}hasRightSquareCorner(a){return!!a.outputConnection&&!a.statementInputCount&&!a.nextConnection}},module$build$src$core$renderers$zelos$measurables$bottom_row={};module$build$src$core$renderers$zelos$measurables$bottom_row.BottomRow=BottomRow$$module$build$src$core$renderers$zelos$measurables$bottom_row;var StatementInput$$module$build$src$core$renderers$zelos$measurables$inputs=class extends StatementInput$$module$build$src$core$renderers$measurables$statement_input{constructor(a,b){super(a,b);this.connectedBottomNextConnection=!1;if(this.connectedBlock){for(a=this.connectedBlock;b=a.getNextBlock();)a=b;a.nextConnection||(this.height=this.connectedBlockHeight,this.connectedBottomNextConnection=!0)}}},module$build$src$core$renderers$zelos$measurables$inputs={};
|
|
1177
1196
|
module$build$src$core$renderers$zelos$measurables$inputs.StatementInput=StatementInput$$module$build$src$core$renderers$zelos$measurables$inputs;var RightConnectionShape$$module$build$src$core$renderers$zelos$measurables$row_elements=class extends Measurable$$module$build$src$core$renderers$measurables$base{constructor(a){super(a);this.width=this.height=0;this.type|=Types$$module$build$src$core$renderers$measurables$types.getType("RIGHT_CONNECTION")}},module$build$src$core$renderers$zelos$measurables$row_elements={};module$build$src$core$renderers$zelos$measurables$row_elements.RightConnectionShape=RightConnectionShape$$module$build$src$core$renderers$zelos$measurables$row_elements;var TopRow$$module$build$src$core$renderers$zelos$measurables$top_row=class extends TopRow$$module$build$src$core$renderers$measurables$top_row{constructor(a){super(a)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(a){const b=(a.hat?"cap"===a.hat:this.constants_.ADD_START_HATS)&&!a.outputConnection&&!a.previousConnection;return!!a.outputConnection||b}hasRightSquareCorner(a){return!!a.outputConnection&&!a.statementInputCount&&!a.nextConnection}},module$build$src$core$renderers$zelos$measurables$top_row=
|
|
1178
1197
|
{};module$build$src$core$renderers$zelos$measurables$top_row.TopRow=TopRow$$module$build$src$core$renderers$zelos$measurables$top_row;var RenderInfo$$module$build$src$core$renderers$zelos$info=class extends RenderInfo$$module$build$src$core$renderers$common$info{constructor(a,b){super(a,b);this.isInline=!0;this.renderer_=a;this.constants_=this.renderer_.getConstants();this.topRow=new TopRow$$module$build$src$core$renderers$zelos$measurables$top_row(this.constants_);this.bottomRow=new BottomRow$$module$build$src$core$renderers$zelos$measurables$bottom_row(this.constants_);this.isMultiRow=!b.getInputsInline()||b.isCollapsed();this.hasStatementInput=
|
|
1179
1198
|
0<b.statementInputCount;this.rightSide=this.outputConnection?new RightConnectionShape$$module$build$src$core$renderers$zelos$measurables$row_elements(this.constants_):null;this.rightAlignedDummyInputs_=new WeakMap}getRenderer(){return this.renderer_}measure(){this.createRows_();this.addElemSpacing_();this.addRowSpacing_();this.adjustXPosition_();this.computeBounds_();this.alignRowElements_();this.finalize_()}shouldStartNewRow_(a,b){return b?a.type===inputTypes$$module$build$src$core$input_types.STATEMENT||
|
|
@@ -1185,24 +1204,26 @@ b.hasStatement;return d||c?(a=Math.max(this.constants_.NOTCH_HEIGHT,this.constan
|
|
|
1185
1204
|
b.hasStatement?Math.max(c,this.constants_.STATEMENT_INPUT_SPACER_MIN_WIDTH):c}getElemCenterline_(a,b){if(a.hasStatement&&!Types$$module$build$src$core$renderers$measurables$types.isSpacer(b)&&!Types$$module$build$src$core$renderers$measurables$types.isStatementInput(b))return a.yPos+this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT/2;if(Types$$module$build$src$core$renderers$measurables$types.isInlineInput(b)&&b instanceof InputConnection$$module$build$src$core$renderers$measurables$input_connection){const c=
|
|
1186
1205
|
b.connectedBlock;if(c&&c.outputConnection&&c.nextConnection)return a.yPos+c.height/2}return super.getElemCenterline_(a,b)}addInput_(a,b){if(a.type===inputTypes$$module$build$src$core$input_types.DUMMY&&b.hasDummyInput&&b.align===$.Align$$module$build$src$core$input.LEFT&&a.align===$.Align$$module$build$src$core$input.RIGHT)this.rightAlignedDummyInputs_.set(b,a);else if(a.type===inputTypes$$module$build$src$core$input_types.STATEMENT){b.elements.push(new StatementInput$$module$build$src$core$renderers$zelos$measurables$inputs(this.constants_,
|
|
1187
1206
|
a));b.hasStatement=!0;null===b.align&&(b.align=a.align);return}super.addInput_(a,b)}addAlignmentPadding_(a,b){if(this.rightAlignedDummyInputs_.get(a)){let c;for(let d=0;d<a.elements.length;d++){const e=a.elements[d];Types$$module$build$src$core$renderers$measurables$types.isSpacer(e)&&(c=e);if(Types$$module$build$src$core$renderers$measurables$types.isField(e)&&e instanceof Field$$module$build$src$core$renderers$measurables$field&&e.parentInput===this.rightAlignedDummyInputs_.get(a))break}if(c){c.width+=
|
|
1188
|
-
b;a.width+=b;return}}super.addAlignmentPadding_(a,b)}adjustXPosition_(){const a=this.constants_.NOTCH_OFFSET_LEFT+this.constants_.NOTCH_WIDTH;let b=a;for(let e=2;e<this.rows.length-1;e+=2){var c=this.rows[e-1];const f=this.rows[e];var d=this.rows[e+1];c=2===e?!!this.topRow.hasPreviousConnection:!!c.followsStatement;d=e+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!d.precedesStatement;if(Types$$module$build$src$core$renderers$measurables$types.isInputRow(f)&&f.hasStatement)f.measure()
|
|
1189
|
-
b=f.width-f.getLastInput().width+a
|
|
1207
|
+
b;a.width+=b;return}}super.addAlignmentPadding_(a,b)}adjustXPosition_(){const a=this.constants_.NOTCH_OFFSET_LEFT+this.constants_.NOTCH_WIDTH;let b=a;for(let e=2;e<this.rows.length-1;e+=2){var c=this.rows[e-1];const f=this.rows[e];var d=this.rows[e+1];c=2===e?!!this.topRow.hasPreviousConnection:!!c.followsStatement;d=e+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!d.precedesStatement;if(Types$$module$build$src$core$renderers$measurables$types.isInputRow(f)&&f.hasStatement){f.measure();
|
|
1208
|
+
let g,h;b=f.width-(null!=(h=null==(g=f.getLastInput())?void 0:g.width)?h:0)+a}else if(c&&(2===e||d)&&Types$$module$build$src$core$renderers$measurables$types.isInputRow(f)&&!f.hasStatement){d=f.xPos;c=null;for(let g=0;g<f.elements.length;g++){const h=f.elements[g];Types$$module$build$src$core$renderers$measurables$types.isSpacer(h)&&(c=h);c&&(Types$$module$build$src$core$renderers$measurables$types.isField(h)||Types$$module$build$src$core$renderers$measurables$types.isInput(h))&&d<b&&!(Types$$module$build$src$core$renderers$measurables$types.isField(h)&&
|
|
1190
1209
|
h instanceof Field$$module$build$src$core$renderers$measurables$field&&(h.field instanceof $.FieldLabel$$module$build$src$core$field_label||h.field instanceof $.FieldImage$$module$build$src$core$field_image))&&(c.width+=b-d);d+=h.width}}}}finalizeOutputConnection_(){if(this.outputConnection&&this.outputConnection.isDynamicShape){var a=this.outputConnection.shape;if("isDynamic"in a&&a.isDynamic){var b=0;for(var c=0;c<this.rows.length;c++){const d=this.rows[c];d.yPos=b;b+=d.height}this.height=b;c=this.bottomRow.hasNextConnection?
|
|
1191
1210
|
this.height-this.bottomRow.descenderHeight:this.height;b=a.height(c);c=a.width(c);this.outputConnection.height=b;this.outputConnection.width=c;this.outputConnection.startX=c;this.outputConnection.connectionOffsetY=a.connectionOffsetY(b);this.outputConnection.connectionOffsetX=a.connectionOffsetX(c);a=0;this.hasStatementInput||this.bottomRow.hasNextConnection||(a=c,this.rightSide.height=b,this.rightSide.width=a,this.rightSide.centerline=b/2,this.rightSide.xPos=this.width+a);this.startX=c;this.width+=
|
|
1192
1211
|
c+a;this.widthWithChildren+=c+a}}}finalizeHorizontalAlignment_(){if(this.outputConnection&&!this.hasStatementInput&&!this.bottomRow.hasNextConnection){var a=0;for(var b=0;b<this.rows.length;b++){var c=this.rows[b];if(!Types$$module$build$src$core$renderers$measurables$types.isInputRow(c))continue;a=c.elements[c.elements.length-2];let d=this.getNegativeSpacing_(c.elements[1]),e=this.getNegativeSpacing_(a);a=d+e;const f=this.constants_.MIN_BLOCK_WIDTH+2*this.outputConnection.width;this.width-a<f&&(a=
|
|
1193
1212
|
this.width-f,d=a/2,e=a/2);c.elements.unshift(new InRowSpacer$$module$build$src$core$renderers$measurables$in_row_spacer(this.constants_,-d));c.elements.push(new InRowSpacer$$module$build$src$core$renderers$measurables$in_row_spacer(this.constants_,-e))}if(a)for(this.width-=a,this.widthWithChildren-=a,this.rightSide.xPos-=a,b=0;b<this.rows.length;b++)c=this.rows[b],Types$$module$build$src$core$renderers$measurables$types.isTopOrBottomRow(c)&&(c.elements[1].width-=a),c.width-=a,c.widthWithConnectedBlocks-=
|
|
1194
|
-
a}}getNegativeSpacing_(a){if(!a)return 0;const b=this.outputConnection.width;var c=this.outputConnection.shape.type;const d=this.constants_;if(this.isMultiRow&&1<this.inputRows.length)switch(c){case d.SHAPES.ROUND:return c=this.constants_.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,c=this.height/2>c?c:this.height/2,b-c*(1-Math.sin(Math.acos((c-this.constants_.SMALL_PADDING)/c)));default:return 0}if(Types$$module$build$src$core$renderers$measurables$types.isInlineInput(a)&&a instanceof
|
|
1195
|
-
a.connectedBlock;a=e?e.pathObject.outputShapeType:a.shape.type;return null==a||e&&e.outputConnection&&(e.statementInputCount||e.nextConnection)||c===d.SHAPES.HEXAGONAL&&c!==a?0:b-this.constants_.SHAPE_IN_SHAPE_PADDING[c][a]}return Types$$module$build$src$core$renderers$measurables$types.isField(a)&&a instanceof Field$$module$build$src$core$renderers$measurables$field?c===d.SHAPES.ROUND&&a.field instanceof $.FieldTextInput$$module$build$src$core$field_textinput?
|
|
1196
|
-
Types$$module$build$src$core$renderers$measurables$types.isIcon(a)?this.constants_.SMALL_PADDING:0}finalizeVerticalAlignment_(){if(!this.outputConnection)for(let d=2;d<this.rows.length-1;d+=2){const e=this.rows[d-1],f=this.rows[d],g=this.rows[d+1];var a=2===d,b=d+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!g.precedesStatement;if(a?this.topRow.hasPreviousConnection:e.followsStatement){var c=f.elements[1];c=3===f.elements.length&&
|
|
1197
|
-
(c.field instanceof $.FieldLabel$$module$build$src$core$field_label||c.field instanceof $.FieldImage$$module$build$src$core$field_image);if(!a&&c)e.height-=this.constants_.SMALL_PADDING,g.height-=this.constants_.SMALL_PADDING,f.height-=this.constants_.MEDIUM_PADDING;else if(!a&&!b)e.height+=this.constants_.SMALL_PADDING;else if(b){a=!1;for(b=0;b<f.elements.length;b++)if(c=f.elements[b],c instanceof InputConnection$$module$build$src$core$renderers$measurables$input_connection&&
|
|
1198
|
-
c.connectedBlock&&!c.connectedBlock.isShadow()&&40<=c.connectedBlock.getHeightWidth().height){a=!0;break}a&&(e.height-=this.constants_.SMALL_PADDING,g.height-=this.constants_.SMALL_PADDING)}}}}finalize_(){this.finalizeOutputConnection_();this.finalizeHorizontalAlignment_();this.finalizeVerticalAlignment_();super.finalize_();this.rightSide&&(this.widthWithChildren+=this.rightSide.width)}},module$build$src$core$renderers$zelos$info=
|
|
1213
|
+
a}}getNegativeSpacing_(a){if(!a||!this.outputConnection)return 0;const b=this.outputConnection.width;var c=this.outputConnection.shape.type;const d=this.constants_;if(this.isMultiRow&&1<this.inputRows.length)switch(c){case d.SHAPES.ROUND:return c=this.constants_.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,c=this.height/2>c?c:this.height/2,b-c*(1-Math.sin(Math.acos((c-this.constants_.SMALL_PADDING)/c)));default:return 0}if(Types$$module$build$src$core$renderers$measurables$types.isInlineInput(a)&&a instanceof
|
|
1214
|
+
InputConnection$$module$build$src$core$renderers$measurables$input_connection){const e=a.connectedBlock;a=e?e.pathObject.outputShapeType:a.shape.type;return null==a||e&&e.outputConnection&&(e.statementInputCount||e.nextConnection)||c===d.SHAPES.HEXAGONAL&&c!==a?0:b-this.constants_.SHAPE_IN_SHAPE_PADDING[c][a]}return Types$$module$build$src$core$renderers$measurables$types.isField(a)&&a instanceof Field$$module$build$src$core$renderers$measurables$field?c===d.SHAPES.ROUND&&a.field instanceof $.FieldTextInput$$module$build$src$core$field_textinput?
|
|
1215
|
+
b-2.75*d.GRID_UNIT:b-this.constants_.SHAPE_IN_SHAPE_PADDING[c][0]:Types$$module$build$src$core$renderers$measurables$types.isIcon(a)?this.constants_.SMALL_PADDING:0}finalizeVerticalAlignment_(){if(!this.outputConnection)for(let d=2;d<this.rows.length-1;d+=2){const e=this.rows[d-1],f=this.rows[d],g=this.rows[d+1];var a=2===d,b=d+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!g.precedesStatement;if(a?this.topRow.hasPreviousConnection:e.followsStatement){var c=f.elements[1];c=3===f.elements.length&&
|
|
1216
|
+
c instanceof Field$$module$build$src$core$renderers$measurables$field&&(c.field instanceof $.FieldLabel$$module$build$src$core$field_label||c.field instanceof $.FieldImage$$module$build$src$core$field_image);if(!a&&c)e.height-=this.constants_.SMALL_PADDING,g.height-=this.constants_.SMALL_PADDING,f.height-=this.constants_.MEDIUM_PADDING;else if(!a&&!b)e.height+=this.constants_.SMALL_PADDING;else if(b){a=!1;for(b=0;b<f.elements.length;b++)if(c=f.elements[b],c instanceof InputConnection$$module$build$src$core$renderers$measurables$input_connection&&
|
|
1217
|
+
Types$$module$build$src$core$renderers$measurables$types.isInlineInput(c)&&c.connectedBlock&&!c.connectedBlock.isShadow()&&40<=c.connectedBlock.getHeightWidth().height){a=!0;break}a&&(e.height-=this.constants_.SMALL_PADDING,g.height-=this.constants_.SMALL_PADDING)}}}}finalize_(){this.finalizeOutputConnection_();this.finalizeHorizontalAlignment_();this.finalizeVerticalAlignment_();super.finalize_();this.rightSide&&(this.widthWithChildren+=this.rightSide.width)}},module$build$src$core$renderers$zelos$info=
|
|
1218
|
+
{};module$build$src$core$renderers$zelos$info.RenderInfo=RenderInfo$$module$build$src$core$renderers$zelos$info;var MarkerSvg$$module$build$src$core$renderers$zelos$marker_svg=class extends MarkerSvg$$module$build$src$core$renderers$common$marker_svg{constructor(a,b,c){super(a,b,c);this.markerCircle_=null}showWithInputOutput_(a){const b=a.getSourceBlock();a=a.getLocation().getOffsetInBlock();this.positionCircle_(a.x,a.y);this.setParent_(b);this.showCurrent_()}showWithOutput_(a){this.showWithInputOutput_(a)}showWithInput_(a){this.showWithInputOutput_(a)}showWithBlock_(a){a=a.getLocation();const b=a.getHeightWidth();
|
|
1199
1219
|
this.positionRect_(0,0,b.width,b.height);this.setParent_(a);this.showCurrent_()}positionCircle_(a,b){let c;null==(c=this.markerCircle_)||c.setAttribute("cx",a.toString());let d;null==(d=this.markerCircle_)||d.setAttribute("cy",b.toString());this.currentMarkerSvg=this.markerCircle_}hide(){super.hide();this.markerCircle_&&(this.markerCircle_.style.display="none")}createDomInternal_(){super.createDomInternal_();this.markerCircle_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.CIRCLE,
|
|
1200
1220
|
{r:this.constants_.CURSOR_RADIUS,style:"display: none","stroke-width":this.constants_.CURSOR_STROKE_WIDTH},this.markerSvg_);if(this.isCursor()){const a=this.getBlinkProperties_();createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.ANIMATE,a,this.markerCircle_)}return this.markerSvg_}applyColour_(a){super.applyColour_(a);let b;null==(b=this.markerCircle_)||b.setAttribute("fill",this.colour_);let c;null==(c=this.markerCircle_)||c.setAttribute("stroke",this.colour_);
|
|
1201
|
-
if(this.isCursor()){a=this.colour_+";transparent;transparent;";let d;null==(d=this.markerCircle_)||d.firstElementChild.setAttribute("values",a)}}},module$build$src$core$renderers$zelos$marker_svg={};module$build$src$core$renderers$zelos$marker_svg.MarkerSvg=MarkerSvg$$module$build$src$core$renderers$zelos$marker_svg;var PathObject$$module$build$src$core$renderers$zelos$path_object=class extends PathObject$$module$build$src$core$renderers$common$path_object{constructor(a,b,c){super(a,b,c);this.svgPathSelected_=null;this.outlines=new Map;this.remainingOutlines=new Set;this.outputShapeType=null;this.constants=c}setPath(a){super.setPath(a);this.svgPathSelected_&&this.svgPathSelected_.setAttribute("d",a)}applyColour(a){super.applyColour(a);const b=a.getParent();a.isShadow()&&b
|
|
1202
|
-
b.style.colourTertiary)
|
|
1203
|
-
this.svgPathSelected_&&(this.svgRoot.removeChild(this.svgPathSelected_),this.svgPathSelected_=null)}updateReplacementFade(a){this.setClass_("blocklyReplaceable",a);a?this.svgPath.setAttribute("filter","url(#"+this.constants.replacementGlowFilterId+")"):this.svgPath.removeAttribute("filter")}updateShapeForInputHighlight(a,b){a=a.getParentInput().name;
|
|
1204
|
-
for(const a of this.outlines.keys())this.remainingOutlines.add(a)}endDrawing(){if(this.remainingOutlines.size)for(const a of this.remainingOutlines)this.removeOutlinePath_(a);this.remainingOutlines.clear()}setOutlinePath(a,b){a=this.getOutlinePath_(a);a.setAttribute("d",b);
|
|
1205
|
-
d:""},this.svgRoot));this.remainingOutlines.delete(a);return this.outlines.get(a)}removeOutlinePath_(a){let b,c;null==(b=this.outlines.get(a))||null==(c=b.parentNode)||c.removeChild(this.outlines.get(a));this.outlines.delete(a)}},module$build$src$core$renderers$zelos$path_object=
|
|
1221
|
+
if(this.isCursor()){a=this.colour_+";transparent;transparent;";let d;null==(d=this.markerCircle_)||d.firstElementChild.setAttribute("values",a)}}},module$build$src$core$renderers$zelos$marker_svg={};module$build$src$core$renderers$zelos$marker_svg.MarkerSvg=MarkerSvg$$module$build$src$core$renderers$zelos$marker_svg;var PathObject$$module$build$src$core$renderers$zelos$path_object=class extends PathObject$$module$build$src$core$renderers$common$path_object{constructor(a,b,c){super(a,b,c);this.svgPathSelected_=null;this.outlines=new Map;this.remainingOutlines=new Set;this.outputShapeType=null;this.constants=c}setPath(a){super.setPath(a);this.svgPathSelected_&&this.svgPathSelected_.setAttribute("d",a)}applyColour(a){super.applyColour(a);const b=a.getParent();if(a.isShadow()&&b){if(!b.style.colourTertiary)throw Error("The renderer did not properly initialize the block style");
|
|
1222
|
+
this.svgPath.setAttribute("stroke",b.style.colourTertiary)}for(const c of this.outlines.values()){if(!this.style.colourTertiary)throw Error("The renderer did not properly initialize the block style");c.setAttribute("fill",this.style.colourTertiary)}}flipRTL(){super.flipRTL();for(const a of this.outlines.values())a.setAttribute("transform","scale(-1 1)")}updateSelected(a){this.setClass_("blocklySelected",a);a?this.svgPathSelected_||(this.svgPathSelected_=this.svgPath.cloneNode(!0),this.svgPathSelected_.setAttribute("fill",
|
|
1223
|
+
"none"),this.svgPathSelected_.setAttribute("filter","url(#"+this.constants.selectedGlowFilterId+")"),this.svgRoot.appendChild(this.svgPathSelected_)):this.svgPathSelected_&&(this.svgRoot.removeChild(this.svgPathSelected_),this.svgPathSelected_=null)}updateReplacementFade(a){this.setClass_("blocklyReplaceable",a);a?this.svgPath.setAttribute("filter","url(#"+this.constants.replacementGlowFilterId+")"):this.svgPath.removeAttribute("filter")}updateShapeForInputHighlight(a,b){a=a.getParentInput().name;
|
|
1224
|
+
(a=this.getOutlinePath_(a))&&(b?a.setAttribute("filter","url(#"+this.constants.replacementGlowFilterId+")"):a.removeAttribute("filter"))}beginDrawing(){this.remainingOutlines.clear();for(const a of this.outlines.keys())this.remainingOutlines.add(a)}endDrawing(){if(this.remainingOutlines.size)for(const a of this.remainingOutlines)this.removeOutlinePath_(a);this.remainingOutlines.clear()}setOutlinePath(a,b){a=this.getOutlinePath_(a);a.setAttribute("d",b);if(!this.style.colourTertiary)throw Error("The renderer did not properly initialize the block style");
|
|
1225
|
+
a.setAttribute("fill",this.style.colourTertiary)}getOutlinePath_(a){this.outlines.has(a)||this.outlines.set(a,createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.PATH,{"class":"blocklyOutlinePath",d:""},this.svgRoot));this.remainingOutlines.delete(a);return this.outlines.get(a)}removeOutlinePath_(a){let b,c;null==(b=this.outlines.get(a))||null==(c=b.parentNode)||c.removeChild(this.outlines.get(a));this.outlines.delete(a)}},module$build$src$core$renderers$zelos$path_object=
|
|
1226
|
+
{};module$build$src$core$renderers$zelos$path_object.PathObject=PathObject$$module$build$src$core$renderers$zelos$path_object;var Renderer$$module$build$src$core$renderers$zelos$renderer=class extends Renderer$$module$build$src$core$renderers$common$renderer{constructor(a){super(a)}makeConstants_(){return new ConstantProvider$$module$build$src$core$renderers$zelos$constants}makeRenderInfo_(a){return new RenderInfo$$module$build$src$core$renderers$zelos$info(this,a)}makeDrawer_(a,b){return new Drawer$$module$build$src$core$renderers$zelos$drawer(a,b)}makeMarkerDrawer(a,b){return new MarkerSvg$$module$build$src$core$renderers$zelos$marker_svg(a,
|
|
1206
1227
|
this.getConstants(),b)}makePathObject(a,b){return new PathObject$$module$build$src$core$renderers$zelos$path_object(a,b,this.getConstants())}getConstants(){return this.constants_}shouldHighlightConnection(a){return a.type!==ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE&&a.type!==ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE}getConnectionPreviewMethod(a,b,c){return b.type===ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE?a.isConnected()?InsertionMarkerManager$$module$build$src$core$insertion_marker_manager.PREVIEW_TYPE.REPLACEMENT_FADE:
|
|
1207
1228
|
InsertionMarkerManager$$module$build$src$core$insertion_marker_manager.PREVIEW_TYPE.INPUT_OUTLINE:super.getConnectionPreviewMethod(a,b,c)}};register$$module$build$src$core$renderers$common$block_rendering("zelos",Renderer$$module$build$src$core$renderers$zelos$renderer);var module$build$src$core$renderers$zelos$renderer={};module$build$src$core$renderers$zelos$renderer.Renderer=Renderer$$module$build$src$core$renderers$zelos$renderer;var module$build$src$core$renderers$zelos$zelos={};module$build$src$core$renderers$zelos$zelos.BottomRow=BottomRow$$module$build$src$core$renderers$zelos$measurables$bottom_row;module$build$src$core$renderers$zelos$zelos.ConstantProvider=ConstantProvider$$module$build$src$core$renderers$zelos$constants;module$build$src$core$renderers$zelos$zelos.Drawer=Drawer$$module$build$src$core$renderers$zelos$drawer;module$build$src$core$renderers$zelos$zelos.MarkerSvg=MarkerSvg$$module$build$src$core$renderers$zelos$marker_svg;
|
|
1208
1229
|
module$build$src$core$renderers$zelos$zelos.PathObject=PathObject$$module$build$src$core$renderers$zelos$path_object;module$build$src$core$renderers$zelos$zelos.RenderInfo=RenderInfo$$module$build$src$core$renderers$zelos$info;module$build$src$core$renderers$zelos$zelos.Renderer=Renderer$$module$build$src$core$renderers$zelos$renderer;module$build$src$core$renderers$zelos$zelos.RightConnectionShape=RightConnectionShape$$module$build$src$core$renderers$zelos$measurables$row_elements;
|
|
@@ -1217,8 +1238,8 @@ this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(Types$$module$bu
|
|
|
1217
1238
|
b?b.notchOffset-this.constants_.CORNER_RADIUS:Types$$module$build$src$core$renderers$measurables$types.isField(a)&&b&&Types$$module$build$src$core$renderers$measurables$types.isField(b)&&a.isEditable===b.isEditable||b&&Types$$module$build$src$core$renderers$measurables$types.isJaggedEdge(b)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getSpacerRowHeight_(a,b){return Types$$module$build$src$core$renderers$measurables$types.isTopRow(a)&&Types$$module$build$src$core$renderers$measurables$types.isBottomRow(b)?
|
|
1218
1239
|
this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:Types$$module$build$src$core$renderers$measurables$types.isTopRow(a)||Types$$module$build$src$core$renderers$measurables$types.isBottomRow(b)?this.constants_.NO_PADDING:a.hasExternalInput&&b.hasExternalInput?this.constants_.LARGE_PADDING:!a.hasStatement&&b.hasStatement?this.constants_.BETWEEN_STATEMENT_PADDING_Y:a.hasStatement&&b.hasStatement||a.hasDummyInput||b.hasDummyInput?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getElemCenterline_(a,
|
|
1219
1240
|
b){if(Types$$module$build$src$core$renderers$measurables$types.isSpacer(b))return a.yPos+b.height/2;if(Types$$module$build$src$core$renderers$measurables$types.isBottomRow(a))return a=a.yPos+a.height-a.descenderHeight,Types$$module$build$src$core$renderers$measurables$types.isNextConnection(b)?a+b.height/2:a-b.height/2;if(Types$$module$build$src$core$renderers$measurables$types.isTopRow(a))return Types$$module$build$src$core$renderers$measurables$types.isHat(b)?a.capline-b.height/2:a.capline+b.height/
|
|
1220
|
-
2;let c=a.yPos;return c=Types$$module$build$src$core$renderers$measurables$types.isField(b)&&a.hasStatement?c+(this.constants_.TALL_INPUT_FIELD_OFFSET_Y+b.height/2):c+a.height/2}finalize_(){let a=0,b=0;for(
|
|
1221
|
-
this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(
|
|
1241
|
+
2;let c=a.yPos;return c=Types$$module$build$src$core$renderers$measurables$types.isField(b)&&a.hasStatement?c+(this.constants_.TALL_INPUT_FIELD_OFFSET_Y+b.height/2):c+a.height/2}finalize_(){let a=0,b=0;for(var c=0;c<this.rows.length;c++){const e=this.rows[c];e.yPos=b;e.xPos=this.startX;b+=e.height;a=Math.max(a,e.widthWithConnectedBlocks);var d=b-this.topRow.ascenderHeight;e===this.bottomRow&&d<this.constants_.MIN_BLOCK_HEIGHT&&(d=this.constants_.MIN_BLOCK_HEIGHT-d,this.bottomRow.height+=d,b+=d);this.recordElemPositions_(e)}this.outputConnection&&
|
|
1242
|
+
this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(c=this.block_.nextConnection.targetBlock())&&(a=Math.max(a,c.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={};
|
|
1222
1243
|
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)}};
|
|
1223
1244
|
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;
|
|
1224
1245
|
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;",
|
|
@@ -1226,16 +1247,16 @@ module$build$src$core$renderers$minimalist$minimalist.Renderer=Renderer$$module$
|
|
|
1226
1247
|
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)?
|
|
1227
1248
|
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",
|
|
1228
1249
|
a.xPos+a.width-this.highlightOffset_)}drawJaggedEdge_(a){this.info_.RTL&&(this.steps_+=this.jaggedTeethPaths_.pathLeft+lineOnAxis$$module$build$src$core$utils$svg_paths("v",a.height-this.jaggedTeethPaths_.height-this.highlightOffset_))}drawValueInput(a){const b=a.getLastInput();if(this.RTL_){const c=a.height-b.connectionHeight;this.steps_+=moveTo$$module$build$src$core$utils$svg_paths(b.xPos+b.width-this.highlightOffset_,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+lineOnAxis$$module$build$src$core$utils$svg_paths("v",
|
|
1229
|
-
c)}else this.steps_+=moveTo$$module$build$src$core$utils$svg_paths(b.xPos+b.width,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)}drawStatementInput(a){const b=a.getLastInput();if(this.RTL_){const c=a.height-2*this.insideCornerPaths_.height;this.steps_+=moveTo$$module$build$src$core$utils$svg_paths(b.xPos,a.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+lineOnAxis$$module$build$src$core$utils$svg_paths("v",c)+this.insideCornerPaths_.pathBottom(this.RTL_)+lineTo$$module$build$src$core$utils$svg_paths(a.width-
|
|
1250
|
+
c)}else this.steps_+=moveTo$$module$build$src$core$utils$svg_paths(b.xPos+b.width,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)}drawStatementInput(a){const b=a.getLastInput();if(b)if(this.RTL_){const c=a.height-2*this.insideCornerPaths_.height;this.steps_+=moveTo$$module$build$src$core$utils$svg_paths(b.xPos,a.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+lineOnAxis$$module$build$src$core$utils$svg_paths("v",c)+this.insideCornerPaths_.pathBottom(this.RTL_)+lineTo$$module$build$src$core$utils$svg_paths(a.width-
|
|
1230
1251
|
b.xPos-this.insideCornerPaths_.width,0)}else this.steps_+=moveTo$$module$build$src$core$utils$svg_paths(b.xPos,a.yPos+a.height)+this.insideCornerPaths_.pathBottom(this.RTL_)+lineTo$$module$build$src$core$utils$svg_paths(a.width-b.xPos-this.insideCornerPaths_.width,0)}drawRightSideRow(a){const b=a.xPos+a.width-this.highlightOffset_;a instanceof SpacerRow$$module$build$src$core$renderers$measurables$spacer_row&&a.followsStatement&&(this.steps_+=lineOnAxis$$module$build$src$core$utils$svg_paths("H",
|
|
1231
1252
|
b));this.RTL_&&(this.steps_+=lineOnAxis$$module$build$src$core$utils$svg_paths("H",b),a.height>this.highlightOffset_&&(this.steps_+=lineOnAxis$$module$build$src$core$utils$svg_paths("V",a.yPos+a.height-this.highlightOffset_)))}drawBottomRow(a){if(this.RTL_)this.steps_+=lineOnAxis$$module$build$src$core$utils$svg_paths("V",a.baseline-this.highlightOffset_);else{const b=this.info_.bottomRow.elements[0];Types$$module$build$src$core$renderers$measurables$types.isLeftSquareCorner(b)?this.steps_+=moveTo$$module$build$src$core$utils$svg_paths(a.xPos+
|
|
1232
1253
|
this.highlightOffset_,a.baseline-this.highlightOffset_):Types$$module$build$src$core$renderers$measurables$types.isLeftRoundedCorner(b)&&(this.steps_+=moveTo$$module$build$src$core$utils$svg_paths(a.xPos,a.baseline),this.steps_+=this.outsideCornerPaths_.bottomLeft())}}drawLeft(){var a=this.info_.outputConnection;a&&(a=a.connectionOffsetY+a.height,this.RTL_?this.steps_+=moveTo$$module$build$src$core$utils$svg_paths(this.info_.startX,a):(this.steps_+=moveTo$$module$build$src$core$utils$svg_paths(this.info_.startX+
|
|
1233
1254
|
this.highlightOffset_,this.info_.bottomRow.baseline-this.highlightOffset_),this.steps_+=lineOnAxis$$module$build$src$core$utils$svg_paths("V",a)),this.steps_+=this.puzzleTabPaths_.pathUp(this.RTL_));this.RTL_||(a=this.info_.topRow,Types$$module$build$src$core$renderers$measurables$types.isLeftRoundedCorner(a.elements[0])?this.steps_+=lineOnAxis$$module$build$src$core$utils$svg_paths("V",this.outsideCornerPaths_.height):this.steps_+=lineOnAxis$$module$build$src$core$utils$svg_paths("V",a.capline+this.highlightOffset_))}drawInlineInput(a){const b=
|
|
1234
1255
|
this.highlightOffset_,c=a.xPos+a.connectionWidth;var d=a.centerline-a.height/2;const e=a.width-a.connectionWidth,f=d+b;this.RTL_?(d=a.connectionOffsetY-b,a=a.height-(a.connectionOffsetY+a.connectionHeight)+b,this.inlineSteps_+=moveTo$$module$build$src$core$utils$svg_paths(c-b,f)+lineOnAxis$$module$build$src$core$utils$svg_paths("v",d)+this.puzzleTabPaths_.pathDown(this.RTL_)+lineOnAxis$$module$build$src$core$utils$svg_paths("v",a)+lineOnAxis$$module$build$src$core$utils$svg_paths("h",e)):this.inlineSteps_+=
|
|
1235
|
-
moveTo$$module$build$src$core$utils$svg_paths(a.xPos+a.width+b,f)+lineOnAxis$$module$build$src$core$utils$svg_paths("v",a.height)+lineOnAxis$$module$build$src$core$utils$svg_paths("h",-e)+moveTo$$module$build$src$core$utils$svg_paths(c,d+a.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_)}},module$build$src$core$renderers$geras$highlighter={};module$build$src$core$renderers$geras$highlighter.Highlighter=Highlighter$$module$build$src$core$renderers$geras$highlighter;var Drawer$$module$build$src$core$renderers$geras$drawer=class extends Drawer$$module$build$src$core$renderers$common$drawer{constructor(a,b){super(a,b);this.highlighter_=new Highlighter$$module$build$src$core$renderers$geras$highlighter(b)}draw(){this.hideHiddenIcons_();this.drawOutline_();this.drawInternals_();const a=this.block_.pathObject;a.setPath(this.outlinePath_+"\n"+this.inlinePath_);a.setHighlightPath(this.highlighter_.getPath());this.info_.RTL&&a.flipRTL();isDebuggerEnabled$$module$build$src$core$renderers$common$debug()
|
|
1236
|
-
this.block_.renderingDebugger.drawDebug(this.block_,this.info_)
|
|
1256
|
+
moveTo$$module$build$src$core$utils$svg_paths(a.xPos+a.width+b,f)+lineOnAxis$$module$build$src$core$utils$svg_paths("v",a.height)+lineOnAxis$$module$build$src$core$utils$svg_paths("h",-e)+moveTo$$module$build$src$core$utils$svg_paths(c,d+a.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_)}},module$build$src$core$renderers$geras$highlighter={};module$build$src$core$renderers$geras$highlighter.Highlighter=Highlighter$$module$build$src$core$renderers$geras$highlighter;var Drawer$$module$build$src$core$renderers$geras$drawer=class extends Drawer$$module$build$src$core$renderers$common$drawer{constructor(a,b){super(a,b);this.highlighter_=new Highlighter$$module$build$src$core$renderers$geras$highlighter(b)}draw(){this.hideHiddenIcons_();this.drawOutline_();this.drawInternals_();const a=this.block_.pathObject;a.setPath(this.outlinePath_+"\n"+this.inlinePath_);a.setHighlightPath(this.highlighter_.getPath());this.info_.RTL&&a.flipRTL();if(isDebuggerEnabled$$module$build$src$core$renderers$common$debug()){let b,
|
|
1257
|
+
c;null==(b=this.block_)||null==(c=b.renderingDebugger)||c.drawDebug(this.block_,this.info_)}this.recordSizeOnBlock_()}drawTop_(){this.highlighter_.drawTopCorner(this.info_.topRow);this.highlighter_.drawRightSideRow(this.info_.topRow);super.drawTop_()}drawJaggedEdge_(a){this.highlighter_.drawJaggedEdge_(a);super.drawJaggedEdge_(a)}drawValueInput_(a){this.highlighter_.drawValueInput(a);super.drawValueInput_(a)}drawStatementInput_(a){this.highlighter_.drawStatementInput(a);super.drawStatementInput_(a)}drawRightSideRow_(a){this.highlighter_.drawRightSideRow(a);
|
|
1237
1258
|
this.outlinePath_+=lineOnAxis$$module$build$src$core$utils$svg_paths("H",a.xPos+a.width)+lineOnAxis$$module$build$src$core$utils$svg_paths("V",a.yPos+a.height)}drawBottom_(){this.highlighter_.drawBottomRow(this.info_.bottomRow);super.drawBottom_()}drawLeft_(){this.highlighter_.drawLeft();super.drawLeft_()}drawInlineInput_(a){this.highlighter_.drawInlineInput(a);super.drawInlineInput_(a)}positionInlineInputConnection_(a){const b=a.centerline-a.height/2;if(a.connectionModel){let c=a.xPos+a.connectionWidth+
|
|
1238
|
-
this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(c*=-1);a.connectionModel.setOffsetInBlock(c,b+a.connectionOffsetY+this.constants_.DARK_PATH_OFFSET)}}positionStatementInputConnection_(a){const b=a.getLastInput();if(b.connectionModel){let c=a.xPos+a.statementEdge+b.notchOffset;c=this.info_.RTL?-1*c:c+this.constants_.DARK_PATH_OFFSET;b.connectionModel.setOffsetInBlock(c,a.yPos+this.constants_.DARK_PATH_OFFSET)}}positionExternalValueConnection_(a){const b=a.getLastInput();if(b.connectionModel){let c=
|
|
1259
|
+
this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(c*=-1);a.connectionModel.setOffsetInBlock(c,b+a.connectionOffsetY+this.constants_.DARK_PATH_OFFSET)}}positionStatementInputConnection_(a){const b=a.getLastInput();if(null==b?0:b.connectionModel){let c=a.xPos+a.statementEdge+b.notchOffset;c=this.info_.RTL?-1*c:c+this.constants_.DARK_PATH_OFFSET;b.connectionModel.setOffsetInBlock(c,a.yPos+this.constants_.DARK_PATH_OFFSET)}}positionExternalValueConnection_(a){const b=a.getLastInput();if(b&&b.connectionModel){let c=
|
|
1239
1260
|
a.xPos+a.width+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(c*=-1);b.connectionModel.setOffsetInBlock(c,a.yPos)}}positionNextConnection_(){const a=this.info_.bottomRow;if(a.connection){const b=a.connection,c=b.xPos;b.connectionModel.setOffsetInBlock((this.info_.RTL?-c:c)+this.constants_.DARK_PATH_OFFSET/2,a.baseline+this.constants_.DARK_PATH_OFFSET)}}},module$build$src$core$renderers$geras$drawer={};module$build$src$core$renderers$geras$drawer.Drawer=Drawer$$module$build$src$core$renderers$geras$drawer;var HighlightConstantProvider$$module$build$src$core$renderers$geras$highlight_constants=class{constructor(a){this.OFFSET=.5;this.constantProvider=a;this.START_POINT=moveBy$$module$build$src$core$utils$svg_paths(this.OFFSET,this.OFFSET)}init(){this.INSIDE_CORNER=this.makeInsideCorner();this.OUTSIDE_CORNER=this.makeOutsideCorner();this.PUZZLE_TAB=this.makePuzzleTab();this.NOTCH=this.makeNotch();this.JAGGED_TEETH=this.makeJaggedTeeth();this.START_HAT=this.makeStartHat()}makeInsideCorner(){const a=this.constantProvider.CORNER_RADIUS,
|
|
1240
1261
|
b=this.OFFSET,c=(1-Math.SQRT1_2)*(a+b)-b,d=moveBy$$module$build$src$core$utils$svg_paths(c,c)+arc$$module$build$src$core$utils$svg_paths("a","0 0,0",a,point$$module$build$src$core$utils$svg_paths(-c-b,a-c)),e=arc$$module$build$src$core$utils$svg_paths("a","0 0,0",a+b,point$$module$build$src$core$utils$svg_paths(a+b,a+b)),f=moveBy$$module$build$src$core$utils$svg_paths(c,-c)+arc$$module$build$src$core$utils$svg_paths("a","0 0,0",a+b,point$$module$build$src$core$utils$svg_paths(a-c,c+b));return{width:a+
|
|
1241
1262
|
b,height:a,pathTop(g){return g?d:""},pathBottom(g){return g?e:f}}}makeOutsideCorner(){const a=this.constantProvider.CORNER_RADIUS,b=this.OFFSET,c=(1-Math.SQRT1_2)*(a-b)+b,d=moveBy$$module$build$src$core$utils$svg_paths(c,c)+arc$$module$build$src$core$utils$svg_paths("a","0 0,1",a-b,point$$module$build$src$core$utils$svg_paths(a-c,-c+b)),e=moveBy$$module$build$src$core$utils$svg_paths(b,a)+arc$$module$build$src$core$utils$svg_paths("a","0 0,1",a-b,point$$module$build$src$core$utils$svg_paths(a,-a+
|
|
@@ -1259,18 +1280,19 @@ Types$$module$build$src$core$renderers$measurables$types.isBottomRow(b)?this.con
|
|
|
1259
1280
|
2;if(Types$$module$build$src$core$renderers$measurables$types.isBottomRow(a))return a=a.yPos+a.height-a.descenderHeight,Types$$module$build$src$core$renderers$measurables$types.isNextConnection(b)?a+b.height/2:a-b.height/2;if(Types$$module$build$src$core$renderers$measurables$types.isTopRow(a))return Types$$module$build$src$core$renderers$measurables$types.isHat(b)?a.capline-b.height/2:a.capline+b.height/2;let c=a.yPos;Types$$module$build$src$core$renderers$measurables$types.isField(b)||Types$$module$build$src$core$renderers$measurables$types.isIcon(b)?
|
|
1260
1281
|
(c+=b.height/2,(a.hasInlineInput||a.hasStatement)&&b.height+this.constants_.TALL_INPUT_FIELD_OFFSET_Y<=a.height&&(c+=this.constants_.TALL_INPUT_FIELD_OFFSET_Y)):c=Types$$module$build$src$core$renderers$measurables$types.isInlineInput(b)?c+b.height/2:c+a.height/2;return c}alignRowElements_(){if(this.isInline){var a=0,b=new WeakMap,c=null;for(let d=this.rows.length-1,e;e=this.rows[d];d--)b.set(e,a),Types$$module$build$src$core$renderers$measurables$types.isInputRow(e)&&(e.hasStatement&&this.alignStatementRow_(e),
|
|
1261
1282
|
c&&c.hasStatement&&e.width<c.width?b.set(e,c.width):a=e.width,c=e);a=0;for(let d=0,e;e=this.rows[d];d++)e.hasStatement?a=this.getDesiredRowWidth_(e):Types$$module$build$src$core$renderers$measurables$types.isSpacer(e)?e.width=Math.max(a,b.get(e)):(c=e.width,a=Math.max(a,b.get(e))-c,0<a&&this.addAlignmentPadding_(e,a),a=e.width)}else super.alignRowElements_()}getDesiredRowWidth_(a){return this.isInline&&a.hasStatement?this.statementEdge+this.constants_.MAX_BOTTOM_WIDTH+this.startX:super.getDesiredRowWidth_(a)}finalize_(){let a=
|
|
1262
|
-
0,b=0;for(let d=0,e;e=this.rows[d];d++){e.yPos=b;e.xPos=this.startX;b+=e.height;a=Math.max(a,e.widthWithConnectedBlocks);var c=b-this.topRow.ascenderHeight;e===this.bottomRow&&c<this.constants_.MIN_BLOCK_HEIGHT&&(c=this.constants_.MIN_BLOCK_HEIGHT-c,this.bottomRow.height+=c,b+=c);this.recordElemPositions_(e)}this.outputConnection&&this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(
|
|
1283
|
+
0,b=0;for(let d=0,e;e=this.rows[d];d++){e.yPos=b;e.xPos=this.startX;b+=e.height;a=Math.max(a,e.widthWithConnectedBlocks);var c=b-this.topRow.ascenderHeight;e===this.bottomRow&&c<this.constants_.MIN_BLOCK_HEIGHT&&(c=this.constants_.MIN_BLOCK_HEIGHT-c,this.bottomRow.height+=c,b+=c);this.recordElemPositions_(e)}this.outputConnection&&this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(c=this.block_.nextConnection.targetBlock())&&(a=Math.max(a,c.getHeightWidth().width-this.constants_.DARK_PATH_OFFSET));
|
|
1263
1284
|
this.bottomRow.baseline=b-this.bottomRow.descenderHeight;this.widthWithChildren=a+this.startX+this.constants_.DARK_PATH_OFFSET;this.width+=this.constants_.DARK_PATH_OFFSET;this.height=b+this.constants_.DARK_PATH_OFFSET;this.startY=this.topRow.capline}},module$build$src$core$renderers$geras$info={};module$build$src$core$renderers$geras$info.RenderInfo=RenderInfo$$module$build$src$core$renderers$geras$info;var PathObject$$module$build$src$core$renderers$geras$path_object=class extends PathObject$$module$build$src$core$renderers$common$path_object{constructor(a,b,c){super(a,b,c);this.constants=c;this.colourDark="#000000";this.svgPathDark=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.PATH,{"class":"blocklyPathDark",transform:"translate(1,1)"});this.svgRoot.insertBefore(this.svgPathDark,this.svgPath);this.svgPathLight=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.PATH,
|
|
1264
|
-
{"class":"blocklyPathLight"},this.svgRoot)}setPath(a){this.svgPath.setAttribute("d",a);this.svgPathDark.setAttribute("d",a)}setHighlightPath(a){this.svgPathLight.setAttribute("d",a)}flipRTL(){this.svgPath.setAttribute("transform","scale(-1 1)");this.svgPathLight.setAttribute("transform","scale(-1 1)");this.svgPathDark.setAttribute("transform","translate(1,1) scale(-1 1)")}applyColour(a){this.svgPathLight.style.display="";this.svgPathDark.style.display="";
|
|
1265
|
-
this.svgPathDark.setAttribute("fill",this.colourDark);super.applyColour(a);this.svgPath.setAttribute("stroke","none")}setStyle(a){this.style=a;this.colourDark=blend$$module$build$src$core$utils$colour("#000",this.style.colourPrimary,.2)||this.colourDark}updateHighlighted(a){a?(this.svgPath.setAttribute("filter","url(#"+this.constants.embossFilterId+")"),this.svgPathLight.style.display="none"):(this.svgPath.setAttribute("filter","none"),
|
|
1266
|
-
(this.svgPathLight.style.display="none"
|
|
1267
|
-
|
|
1268
|
-
|
|
1285
|
+
{"class":"blocklyPathLight"},this.svgRoot)}setPath(a){this.svgPath.setAttribute("d",a);this.svgPathDark.setAttribute("d",a)}setHighlightPath(a){this.svgPathLight.setAttribute("d",a)}flipRTL(){this.svgPath.setAttribute("transform","scale(-1 1)");this.svgPathLight.setAttribute("transform","scale(-1 1)");this.svgPathDark.setAttribute("transform","translate(1,1) scale(-1 1)")}applyColour(a){this.svgPathLight.style.display="";this.svgPathDark.style.display="";if(!this.style.colourTertiary)throw Error("The renderer did not properly initialize the tertiary colour of the block style");
|
|
1286
|
+
this.svgPathLight.setAttribute("stroke",this.style.colourTertiary);this.svgPathDark.setAttribute("fill",this.colourDark);super.applyColour(a);this.svgPath.setAttribute("stroke","none")}setStyle(a){this.style=a;this.colourDark=blend$$module$build$src$core$utils$colour("#000",this.style.colourPrimary,.2)||this.colourDark}updateHighlighted(a){a?(this.svgPath.setAttribute("filter","url(#"+this.constants.embossFilterId+")"),this.svgPathLight.style.display="none"):(this.svgPath.setAttribute("filter","none"),
|
|
1287
|
+
this.svgPathLight.style.display="inline")}updateShadow_(a){if(a){this.svgPathLight.style.display="none";if(!this.style.colourSecondary)throw Error("The renderer did not properly initialize the secondary colour of the block style block style");this.svgPathDark.setAttribute("fill",this.style.colourSecondary);this.svgPath.setAttribute("stroke","none");this.svgPath.setAttribute("fill",this.style.colourSecondary)}}updateDisabled_(a){super.updateDisabled_(a);a&&this.svgPath.setAttribute("stroke","none")}},
|
|
1288
|
+
module$build$src$core$renderers$geras$path_object={};module$build$src$core$renderers$geras$path_object.PathObject=PathObject$$module$build$src$core$renderers$geras$path_object;var Renderer$$module$build$src$core$renderers$geras$renderer=class extends Renderer$$module$build$src$core$renderers$common$renderer{constructor(a){super(a);this.highlightConstants_=null}init(a,b){super.init(a,b);this.highlightConstants_=this.makeHighlightConstants_();this.highlightConstants_.init()}refreshDom(a,b){super.refreshDom(a,b);this.getHighlightConstants().init()}makeConstants_(){return new ConstantProvider$$module$build$src$core$renderers$geras$constants}makeRenderInfo_(a){return new RenderInfo$$module$build$src$core$renderers$geras$info(this,
|
|
1289
|
+
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(){if(!this.highlightConstants_)throw Error("Cannot access the highlight constants because init has not been called");return this.highlightConstants_}};
|
|
1290
|
+
register$$module$build$src$core$renderers$common$block_rendering("geras",Renderer$$module$build$src$core$renderers$geras$renderer);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;
|
|
1269
1291
|
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;
|
|
1270
1292
|
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(!
|
|
1272
|
-
|
|
1273
|
-
|
|
1293
|
+
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||!b.classList.contains("blocklyBlockCanvas")&&
|
|
1294
|
+
c.classList.contains("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,"");this.previousSibling=null}setContentsAndShow(a,
|
|
1295
|
+
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={};
|
|
1274
1296
|
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,
|
|
1275
1297
|
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,
|
|
1276
1298
|
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+
|
|
@@ -1321,8 +1343,8 @@ a.gaps);this.listeners_.push(conditionalBind$$module$build$src$core$browser_even
|
|
|
1321
1343
|
[],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,
|
|
1322
1344
|
c,d);break;case "LABEL":e=this.createButton_(g,!0);b.push({type:FlyoutItemType$$module$build$src$core$flyout_base.BUTTON,button:e});c.push(d);break;case "BUTTON":e=this.createButton_(g,!1),b.push({type:FlyoutItemType$$module$build$src$core$flyout_base.BUTTON,button:e}),c.push(d)}}return{contents:b,gaps:c}}getDynamicCategoryContents_(a){a=this.workspace_.targetWorkspace.getToolboxCategoryCallback(a);if("function"!==typeof a)throw TypeError("Couldn't find a callback function when opening a toolbox category.");
|
|
1323
1345
|
return a(this.workspace_.targetWorkspace)}createButton_(a,b){return new FlyoutButton$$module$build$src$core$flyout_button(this.workspace_,this.targetWorkspace,a,b)}createFlyoutBlock_(a){let b;a.blockxml?(a="string"===typeof a.blockxml?textToDom$$module$build$src$core$xml(a.blockxml):a.blockxml,(b=this.getRecycledBlock_(a.getAttribute("type")))||(b=domToBlock$$module$build$src$core$xml(a,this.workspace_))):(b=this.getRecycledBlock_(a.type),b||(void 0===a.enabled&&(a.enabled="true"!==a.disabled&&!0!==
|
|
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()
|
|
1325
|
-
|
|
1346
|
+
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()):a.blockxml&&(a="string"===typeof a.blockxml?textToDom$$module$build$src$core$xml(a.blockxml):a.blockxml,d=parseInt(a.getAttribute("gap")));
|
|
1347
|
+
b.push(!d||isNaN(d)?c:d)}addSeparatorGap_(a,b,c){a=parseInt(a.gap.toString());!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();
|
|
1326
1348
|
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,
|
|
1327
1349
|
"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
1350
|
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,
|
|
@@ -1354,10 +1376,10 @@ a.getAttribute("id");const c=a.textContent,d=a.getAttribute("variabletype")||a.g
|
|
|
1354
1376
|
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,
|
|
1355
1377
|
a.id||null,a.name,a.type||""),this.setValue(a.getId()))}setSourceBlock(a){if(a.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");super.setSourceBlock(a)}getValue(){return this.variable_?this.variable_.getId():null}getText(){return this.variable_?this.variable_.name:""}getVariable(){return this.variable_}getValidator(){return this.variable_?this.validator_:null}doClassValidation_(a){if(null===a)return null;var b=getVariable$$module$build$src$core$variables(this.sourceBlock_.workspace,
|
|
1356
1378
|
a);if(!b)return console.warn("Variable id doesn't point to a real variable! ID was "+a),null;b=b.type;return this.typeIsAllowed_(b)?a:(console.warn("Variable type doesn't match this field! Type was "+b),null)}doValueUpdate_(a){this.variable_=getVariable$$module$build$src$core$variables(this.sourceBlock_.workspace,a);super.doValueUpdate_(a)}typeIsAllowed_(a){const b=this.getVariableTypes_();if(!b)return!0;for(let c=0;c<b.length;c++)if(a===b[c])return!0;return!1}getVariableTypes_(){var a=this.variableTypes;
|
|
1357
|
-
if(null===a&&this.sourceBlock_&&!this.sourceBlock_.
|
|
1358
|
-
this.defaultType_=b;this.variableTypes=a}refreshVariableName(){this.forceRerender()}onItemSelected_(a,b){a=b.getValue();if(this.sourceBlock_&&!this.sourceBlock_.
|
|
1359
|
-
void 0,void 0,void 0,a)}static dropdownCreate(){if(!this.variable_)throw Error("Tried to call dropdownCreate on a variable field with no variable selected.");const a=this.getText();let b=[];if(this.sourceBlock_&&!this.sourceBlock_.
|
|
1360
|
-
c.push([Msg$$module$build$src$core$msg.RENAME_VARIABLE,RENAME_VARIABLE_ID$$module$build$src$core$internal_constants]);Msg$$module$build$src$core$msg.DELETE_VARIABLE&&c.push([Msg$$module$build$src$core$msg.DELETE_VARIABLE.replace("%1",a),DELETE_VARIABLE_ID$$module$build$src$core$internal_constants]);return c}};register$$module$build$src$core$field_registry("field_variable",FieldVariable$$module$build$src$core$field_variable);var module$build$src$core$field_variable={};
|
|
1379
|
+
if(null===a&&this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying())return this.sourceBlock_.workspace.getVariableTypes();a=a||[""];if(0===a.length)throw a=this.getText(),Error("'variableTypes' of field variable "+a+" was an empty list");return a}setTypes_(a,b){b=b||"";if(null===a||void 0===a)a=null;else if(Array.isArray(a)){let c=!1;for(let d=0;d<a.length;d++)a[d]===b&&(c=!0);if(!c)throw Error("Invalid default type '"+b+"' in the definition of a FieldVariable");}else throw Error("'variableTypes' was not an array in the definition of a FieldVariable");
|
|
1380
|
+
this.defaultType_=b;this.variableTypes=a}refreshVariableName(){this.forceRerender()}onItemSelected_(a,b){a=b.getValue();if(this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()){if(a===RENAME_VARIABLE_ID$$module$build$src$core$internal_constants){renameVariable$$module$build$src$core$variables(this.sourceBlock_.workspace,this.variable_);return}if(a===DELETE_VARIABLE_ID$$module$build$src$core$internal_constants){this.sourceBlock_.workspace.deleteVariableById(this.variable_.getId());return}}this.setValue(a)}referencesVariables(){return!0}static fromJson(a){return new this(replaceMessageReferences$$module$build$src$core$utils$parsing(a.variable),
|
|
1381
|
+
void 0,void 0,void 0,a)}static dropdownCreate(){if(!this.variable_)throw Error("Tried to call dropdownCreate on a variable field with no variable selected.");const a=this.getText();let b=[];if(this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()){var c=this.getVariableTypes_();for(var d=0;d<c.length;d++){const e=this.sourceBlock_.workspace.getVariablesOfType(c[d]);b=b.concat(e)}}b.sort(VariableModel$$module$build$src$core$variable_model.compareByName);c=[];for(d=0;d<b.length;d++)c[d]=[b[d].name,
|
|
1382
|
+
b[d].getId()];c.push([Msg$$module$build$src$core$msg.RENAME_VARIABLE,RENAME_VARIABLE_ID$$module$build$src$core$internal_constants]);Msg$$module$build$src$core$msg.DELETE_VARIABLE&&c.push([Msg$$module$build$src$core$msg.DELETE_VARIABLE.replace("%1",a),DELETE_VARIABLE_ID$$module$build$src$core$internal_constants]);return c}};register$$module$build$src$core$field_registry("field_variable",FieldVariable$$module$build$src$core$field_variable);var module$build$src$core$field_variable={};
|
|
1361
1383
|
module$build$src$core$field_variable.FieldVariable=FieldVariable$$module$build$src$core$field_variable;var FieldNumber$$module$build$src$core$field_number=class extends $.FieldTextInput$$module$build$src$core$field_textinput{constructor(a,b,c,d,e,f){super(Field$$module$build$src$core$field.SKIP_SETUP);this.min_=-Infinity;this.max_=Infinity;this.precision_=0;this.decimalPlaces_=null;this.SERIALIZABLE=!0;a!==Field$$module$build$src$core$field.SKIP_SETUP&&(f?this.configure_(f):this.setConstraints(b,c,d),this.setValue(a),e&&this.setValidator(e))}configure_(a){super.configure_(a);this.setMinInternal_(a.min);
|
|
1362
1384
|
this.setMaxInternal_(a.max);this.setPrecisionInternal_(a.precision)}setConstraints(a,b,c){this.setMinInternal_(a);this.setMaxInternal_(b);this.setPrecisionInternal_(c);this.setValue(this.getValue())}setMin(a){this.setMinInternal_(a);this.setValue(this.getValue())}setMinInternal_(a){null==a?this.min_=-Infinity:(a=Number(a),isNaN(a)||(this.min_=a))}getMin(){return this.min_}setMax(a){this.setMaxInternal_(a);this.setValue(this.getValue())}setMaxInternal_(a){null==a?this.max_=Infinity:(a=Number(a),isNaN(a)||
|
|
1363
1385
|
(this.max_=a))}getMax(){return this.max_}setPrecision(a){this.setPrecisionInternal_(a);this.setValue(this.getValue())}setPrecisionInternal_(a){this.precision_=Number(a)||0;let b=String(this.precision_);-1!==b.indexOf("e")&&(b=this.precision_.toLocaleString("en-US",{maximumFractionDigits:20}));const c=b.indexOf(".");this.decimalPlaces_=-1===c?a?0:null:b.length-c-1}getPrecision(){return this.precision_}doClassValidation_(a){if(null===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,
|
|
@@ -1396,35 +1418,39 @@ a||$.FieldCheckbox$$module$build$src$core$field_checkbox.CHECK_CHAR;this.forceRe
|
|
|
1396
1418
|
typeof a?"TRUE"===a:!!a}static fromJson(a){return new this(a.checked,void 0,a)}};$.FieldCheckbox$$module$build$src$core$field_checkbox.CHECK_CHAR="\u2713";register$$module$build$src$core$field_registry("field_checkbox",$.FieldCheckbox$$module$build$src$core$field_checkbox);$.FieldCheckbox$$module$build$src$core$field_checkbox.prototype.DEFAULT_VALUE=!1;var module$build$src$core$field_checkbox={};module$build$src$core$field_checkbox.FieldCheckbox=$.FieldCheckbox$$module$build$src$core$field_checkbox;var FieldAngle$$module$build$src$core$field_angle=class extends $.FieldTextInput$$module$build$src$core$field_textinput{constructor(a,b,c){super(Field$$module$build$src$core$field.SKIP_SETUP);this.moveSurfaceWrapper_=this.clickSurfaceWrapper_=this.clickWrapper_=this.symbol_=this.line_=this.gauge_=this.editor_=null;this.SERIALIZABLE=!0;this.clockwise_=FieldAngle$$module$build$src$core$field_angle.CLOCKWISE;this.offset_=FieldAngle$$module$build$src$core$field_angle.OFFSET;this.wrap_=FieldAngle$$module$build$src$core$field_angle.WRAP;
|
|
1397
1419
|
this.round_=FieldAngle$$module$build$src$core$field_angle.ROUND;a!==Field$$module$build$src$core$field.SKIP_SETUP&&(c&&this.configure_(c),this.setValue(a),b&&this.setValidator(b))}configure_(a){super.configure_(a);switch(a.mode){case Mode$$module$build$src$core$field_angle.COMPASS:this.clockwise_=!0;this.offset_=90;break;case Mode$$module$build$src$core$field_angle.PROTRACTOR:this.clockwise_=!1,this.offset_=0}a.clockwise&&(this.clockwise_=a.clockwise);a.offset&&(this.offset_=a.offset);a.wrap&&(this.wrap_=
|
|
1398
1420
|
a.wrap);a.round&&(this.round_=a.round)}initView(){super.initView();this.symbol_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.TSPAN,{});this.symbol_.appendChild(document.createTextNode("\u00b0"));this.textElement_.appendChild(this.symbol_)}render_(){super.render_();this.updateGraph_()}showEditor_(a){super.showEditor_(a,MOBILE$$module$build$src$core$utils$useragent||ANDROID$$module$build$src$core$utils$useragent||IPAD$$module$build$src$core$utils$useragent);
|
|
1399
|
-
this.dropdownCreate_();getContentDiv$$module$build$src$core$dropdowndiv().appendChild(this.editor_);this.sourceBlock_ instanceof BlockSvg$$module$build$src$core$block_svg
|
|
1400
|
-
{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",height:2*FieldAngle$$module$build$src$core$field_angle.HALF+"px",width:2*FieldAngle$$module$build$src$core$field_angle.HALF+"px",style:"touch-action: none"}),b=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.CIRCLE,
|
|
1401
|
-
r:FieldAngle$$module$build$src$core$field_angle.RADIUS,"class":"blocklyAngleCircle"},a);this.gauge_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.PATH,{"class":"blocklyAngleGauge"},a);this.line_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.LINE,{x1:FieldAngle$$module$build$src$core$field_angle.HALF,y1:FieldAngle$$module$build$src$core$field_angle.HALF,
|
|
1402
|
-
{x1:FieldAngle$$module$build$src$core$field_angle.HALF+FieldAngle$$module$build$src$core$field_angle.RADIUS,y1:FieldAngle$$module$build$src$core$field_angle.HALF,x2:FieldAngle$$module$build$src$core$field_angle.HALF+FieldAngle$$module$build$src$core$field_angle.RADIUS-(0===c%45?10:5),y2:FieldAngle$$module$build$src$core$field_angle.HALF,"class":"blocklyAngleMarks",
|
|
1403
|
-
a);this.clickWrapper_=conditionalBind$$module$build$src$core$browser_events(a,"click",this,this.hide_);this.clickSurfaceWrapper_=conditionalBind$$module$build$src$core$browser_events(b,"click",this,this.onMouseMove_,!0,!0);this.moveSurfaceWrapper_=conditionalBind$$module$build$src$core$browser_events(b,"mousemove",this,this.onMouseMove_,!0,!0);this.editor_=a}dropdownDispose_(){this.clickWrapper_&&
|
|
1404
|
-
(unbind$$module$build$src$core$browser_events(this.clickSurfaceWrapper_),this.clickSurfaceWrapper_=null);this.moveSurfaceWrapper_&&(unbind$$module$build$src$core$browser_events(this.moveSurfaceWrapper_),this.moveSurfaceWrapper_=null);this.line_=this.gauge_=null}hide_(){hideIfOwner$$module$build$src$core$dropdowndiv(this);hide$$module$build$src$core$widgetdiv()}onMouseMove_(a){var b=
|
|
1405
|
-
a=a.clientY-b.top-FieldAngle$$module$build$src$core$field_angle.HALF;b=Math.atan(-a/c);isNaN(b)||(b=toDegrees$$module$build$src$core$utils$math(b),0>c?b+=180:0<a&&(b+=360),b=this.clockwise_?this.offset_+360-b:360-(this.offset_-b),this.displayMouseOrKeyboardValue_(b))}displayMouseOrKeyboardValue_(a){this.round_&&(a=Math.round(a/this.round_)*this.round_);a=this.wrapValue_(a);
|
|
1406
|
-
360);a=["M ",FieldAngle$$module$build$src$core$field_angle.HALF,",",FieldAngle$$module$build$src$core$field_angle.HALF];var c=FieldAngle$$module$build$src$core$field_angle.HALF,d=FieldAngle$$module$build$src$core$field_angle.HALF;if(!isNaN(b)){const e=Number(this.clockwise_),f=toRadians$$module$build$src$core$utils$math(this.offset_),g=Math.cos(f)*
|
|
1407
|
-
d-=Math.sin(b)*FieldAngle$$module$build$src$core$field_angle.RADIUS;b=Math.abs(Math.floor((b-f)/Math.PI)%2);e&&(b=1-b);a.push(" l ",g,",",h," A ",FieldAngle$$module$build$src$core$field_angle.RADIUS,",",FieldAngle$$module$build$src$core$field_angle.RADIUS," 0 ",b," ",e," ",c,",",d," z")}this.gauge_.setAttribute("d",
|
|
1408
|
-
b=this.sourceBlock_.RTL?1:-1:a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.RIGHT?b=this.sourceBlock_.RTL?-1:1:a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.DOWN?b=-1:a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.UP&&(b=1);if(b){const c=this.getValue();this.displayMouseOrKeyboardValue_(c+
|
|
1409
|
-
a>this.wrap_&&(a-=360);return a}static fromJson(a){return new this(a.angle,void 0,a)}};FieldAngle$$module$build$src$core$field_angle.ROUND=15;FieldAngle$$module$build$src$core$field_angle.HALF=50;FieldAngle$$module$build$src$core$field_angle.CLOCKWISE=!1;FieldAngle$$module$build$src$core$field_angle.OFFSET=0;
|
|
1421
|
+
this.dropdownCreate_();getContentDiv$$module$build$src$core$dropdowndiv().appendChild(this.editor_);if(this.sourceBlock_ instanceof BlockSvg$$module$build$src$core$block_svg){if(!this.sourceBlock_.style.colourTertiary)throw Error("The renderer did not properly initialize the block style");setColour$$module$build$src$core$dropdowndiv(this.sourceBlock_.style.colourPrimary,this.sourceBlock_.style.colourTertiary)}showPositionedByField$$module$build$src$core$dropdowndiv(this,this.dropdownDispose_.bind(this));
|
|
1422
|
+
this.updateGraph_()}dropdownCreate_(){const a=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",height:2*FieldAngle$$module$build$src$core$field_angle.HALF+"px",width:2*FieldAngle$$module$build$src$core$field_angle.HALF+"px",style:"touch-action: none"}),b=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.CIRCLE,
|
|
1423
|
+
{cx:FieldAngle$$module$build$src$core$field_angle.HALF,cy:FieldAngle$$module$build$src$core$field_angle.HALF,r:FieldAngle$$module$build$src$core$field_angle.RADIUS,"class":"blocklyAngleCircle"},a);this.gauge_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.PATH,{"class":"blocklyAngleGauge"},a);this.line_=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.LINE,{x1:FieldAngle$$module$build$src$core$field_angle.HALF,y1:FieldAngle$$module$build$src$core$field_angle.HALF,
|
|
1424
|
+
"class":"blocklyAngleLine"},a);for(let c=0;360>c;c+=15)createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.LINE,{x1:FieldAngle$$module$build$src$core$field_angle.HALF+FieldAngle$$module$build$src$core$field_angle.RADIUS,y1:FieldAngle$$module$build$src$core$field_angle.HALF,x2:FieldAngle$$module$build$src$core$field_angle.HALF+FieldAngle$$module$build$src$core$field_angle.RADIUS-(0===c%45?10:5),y2:FieldAngle$$module$build$src$core$field_angle.HALF,"class":"blocklyAngleMarks",
|
|
1425
|
+
transform:"rotate("+c+","+FieldAngle$$module$build$src$core$field_angle.HALF+","+FieldAngle$$module$build$src$core$field_angle.HALF+")"},a);this.clickWrapper_=conditionalBind$$module$build$src$core$browser_events(a,"click",this,this.hide_);this.clickSurfaceWrapper_=conditionalBind$$module$build$src$core$browser_events(b,"click",this,this.onMouseMove_,!0,!0);this.moveSurfaceWrapper_=conditionalBind$$module$build$src$core$browser_events(b,"mousemove",this,this.onMouseMove_,!0,!0);this.editor_=a}dropdownDispose_(){this.clickWrapper_&&
|
|
1426
|
+
(unbind$$module$build$src$core$browser_events(this.clickWrapper_),this.clickWrapper_=null);this.clickSurfaceWrapper_&&(unbind$$module$build$src$core$browser_events(this.clickSurfaceWrapper_),this.clickSurfaceWrapper_=null);this.moveSurfaceWrapper_&&(unbind$$module$build$src$core$browser_events(this.moveSurfaceWrapper_),this.moveSurfaceWrapper_=null);this.line_=this.gauge_=null}hide_(){hideIfOwner$$module$build$src$core$dropdowndiv(this);hide$$module$build$src$core$widgetdiv()}onMouseMove_(a){var b=
|
|
1427
|
+
this.gauge_.ownerSVGElement.getBoundingClientRect();const c=a.clientX-b.left-FieldAngle$$module$build$src$core$field_angle.HALF;a=a.clientY-b.top-FieldAngle$$module$build$src$core$field_angle.HALF;b=Math.atan(-a/c);isNaN(b)||(b=toDegrees$$module$build$src$core$utils$math(b),0>c?b+=180:0<a&&(b+=360),b=this.clockwise_?this.offset_+360-b:360-(this.offset_-b),this.displayMouseOrKeyboardValue_(b))}displayMouseOrKeyboardValue_(a){this.round_&&(a=Math.round(a/this.round_)*this.round_);a=this.wrapValue_(a);
|
|
1428
|
+
a!==this.value_&&this.setEditorValue_(a)}updateGraph_(){if(this.gauge_){var a=Number(this.getText())+this.offset_,b=toRadians$$module$build$src$core$utils$math(a%360);a=["M ",FieldAngle$$module$build$src$core$field_angle.HALF,",",FieldAngle$$module$build$src$core$field_angle.HALF];var c=FieldAngle$$module$build$src$core$field_angle.HALF,d=FieldAngle$$module$build$src$core$field_angle.HALF;if(!isNaN(b)){const e=Number(this.clockwise_),f=toRadians$$module$build$src$core$utils$math(this.offset_),g=Math.cos(f)*
|
|
1429
|
+
FieldAngle$$module$build$src$core$field_angle.RADIUS,h=Math.sin(f)*-FieldAngle$$module$build$src$core$field_angle.RADIUS;e&&(b=2*f-b);c+=Math.cos(b)*FieldAngle$$module$build$src$core$field_angle.RADIUS;d-=Math.sin(b)*FieldAngle$$module$build$src$core$field_angle.RADIUS;b=Math.abs(Math.floor((b-f)/Math.PI)%2);e&&(b=1-b);a.push(" l ",g,",",h," A ",FieldAngle$$module$build$src$core$field_angle.RADIUS,",",FieldAngle$$module$build$src$core$field_angle.RADIUS," 0 ",b," ",e," ",c,",",d," z")}this.gauge_.setAttribute("d",
|
|
1430
|
+
a.join(""));this.line_.setAttribute("x2",c);this.line_.setAttribute("y2",d)}}onHtmlInputKeyDown_(a){super.onHtmlInputKeyDown_(a);let b;a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.LEFT?b=this.sourceBlock_.RTL?1:-1:a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.RIGHT?b=this.sourceBlock_.RTL?-1:1:a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.DOWN?b=-1:a.keyCode===KeyCodes$$module$build$src$core$utils$keycodes.UP&&(b=1);if(b){const c=this.getValue();this.displayMouseOrKeyboardValue_(c+
|
|
1431
|
+
b*this.round_);a.preventDefault();a.stopPropagation()}}doClassValidation_(a){a=Number(a);return isNaN(a)||!isFinite(a)?null:this.wrapValue_(a)}wrapValue_(a){a%=360;0>a&&(a+=360);a>this.wrap_&&(a-=360);return a}static fromJson(a){return new this(a.angle,void 0,a)}};FieldAngle$$module$build$src$core$field_angle.ROUND=15;FieldAngle$$module$build$src$core$field_angle.HALF=50;FieldAngle$$module$build$src$core$field_angle.CLOCKWISE=!1;FieldAngle$$module$build$src$core$field_angle.OFFSET=0;
|
|
1432
|
+
FieldAngle$$module$build$src$core$field_angle.WRAP=360;FieldAngle$$module$build$src$core$field_angle.RADIUS=FieldAngle$$module$build$src$core$field_angle.HALF-1;register$$module$build$src$core$css("\n.blocklyAngleCircle {\n stroke: #444;\n stroke-width: 1;\n fill: #ddd;\n fill-opacity: .8;\n}\n\n.blocklyAngleMarks {\n stroke: #444;\n stroke-width: 1;\n}\n\n.blocklyAngleGauge {\n fill: #f88;\n fill-opacity: .8;\n pointer-events: none;\n}\n\n.blocklyAngleLine {\n stroke: #f00;\n stroke-width: 2;\n stroke-linecap: round;\n pointer-events: none;\n}\n");
|
|
1410
1433
|
register$$module$build$src$core$field_registry("field_angle",FieldAngle$$module$build$src$core$field_angle);FieldAngle$$module$build$src$core$field_angle.prototype.DEFAULT_VALUE=0;var Mode$$module$build$src$core$field_angle;(function(a){a.COMPASS="compass";a.PROTRACTOR="protractor"})(Mode$$module$build$src$core$field_angle||(Mode$$module$build$src$core$field_angle={}));var module$build$src$core$field_angle={};module$build$src$core$field_angle.FieldAngle=FieldAngle$$module$build$src$core$field_angle;
|
|
1411
|
-
module$build$src$core$field_angle.Mode=Mode$$module$build$src$core$field_angle;var BlockMove$$module$build$src$core$events$events_block_move=class extends BlockBase$$module$build$src$core$events$events_block_base{constructor(a){super(a);this.
|
|
1412
|
-
|
|
1413
|
-
a.
|
|
1414
|
-
this.newCoordinate)}run(a){var b=this.getEventWorkspace_(),c=b.getBlockById(this.blockId);if(c){var d=a?this.newParentId:this.oldParentId,e=a?this.newInputName:this.oldInputName;a=a?this.newCoordinate:this.oldCoordinate;if(d){var f=b.getBlockById(d);
|
|
1415
|
-
let g;c=b.type;if(e){if(c=f.getInput(e))g=c.connection}else c===ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT&&(g=f.nextConnection);g?b.connect(g):console.warn("Can't connect to non-existent input: "+e)}}else console.warn("Can't move non-existent block: "+
|
|
1416
|
-
var module$build$src$core$events$events_block_move={};module$build$src$core$events$events_block_move.BlockMove=BlockMove$$module$build$src$core$events$events_block_move;var CommentBase$$module$build$src$core$events$events_comment_base=class extends Abstract$$module$build$src$core$events$events_abstract{constructor(a){super();this.
|
|
1417
|
-
this.commentId=a.commentId}static CommentCreateDeleteHelper(a,b){var c=a.getEventWorkspace_();
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
a)}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1434
|
+
module$build$src$core$field_angle.Mode=Mode$$module$build$src$core$field_angle;var BlockMove$$module$build$src$core$events$events_block_move=class extends BlockBase$$module$build$src$core$events$events_block_base{constructor(a){super(a);this.type=MOVE$$module$build$src$core$events$utils;a&&(a.isShadow()&&(this.recordUndo=!1),a=this.currentLocation_(),this.oldParentId=a.parentId,this.oldInputName=a.inputName,this.oldCoordinate=a.coordinate)}toJson(){const a=super.toJson();a.newParentId=this.newParentId;a.newInputName=this.newInputName;this.newCoordinate&&(a.newCoordinate=`${Math.round(this.newCoordinate.x)}, `+
|
|
1435
|
+
`${Math.round(this.newCoordinate.y)}`);this.recordUndo||(a.recordUndo=this.recordUndo);return a}fromJson(a){super.fromJson(a);this.newParentId=a.newParentId;this.newInputName=a.newInputName;if(a.newCoordinate){const b=a.newCoordinate.split(",");this.newCoordinate=new Coordinate$$module$build$src$core$utils$coordinate(Number(b[0]),Number(b[1]))}void 0!==a.recordUndo&&(this.recordUndo=a.recordUndo)}recordNew(){const a=this.currentLocation_();this.newParentId=a.parentId;this.newInputName=a.inputName;
|
|
1436
|
+
this.newCoordinate=a.coordinate}currentLocation_(){var a=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");var b=a.getBlockById(this.blockId);if(!b)throw Error("The block associated with the block move event could not be found");a={};const c=b.getParent();if(c){if(a.parentId=c.id,b=c.getInputWithBlock(b))a.inputName=b.name}else a.coordinate=b.getRelativeToSurfaceXY();return a}isNull(){return this.oldParentId===
|
|
1437
|
+
this.newParentId&&this.oldInputName===this.newInputName&&Coordinate$$module$build$src$core$utils$coordinate.equals(this.oldCoordinate,this.newCoordinate)}run(a){var b=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");var c=b.getBlockById(this.blockId);if(c){var d=a?this.newParentId:this.oldParentId,e=a?this.newInputName:this.oldInputName;a=a?this.newCoordinate:this.oldCoordinate;if(d){var f=b.getBlockById(d);
|
|
1438
|
+
if(!f){console.warn("Can't connect to non-existent block: "+d);return}}c.getParent()&&c.unplug();if(a)e=c.getRelativeToSurfaceXY(),c.moveBy(a.x-e.x,a.y-e.y);else{b=c.outputConnection;if(!b||c.previousConnection&&c.previousConnection.isConnected())b=c.previousConnection;let g;c=b.type;if(e){if(c=f.getInput(e))g=c.connection}else c===ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT&&(g=f.nextConnection);g?b.connect(g):console.warn("Can't connect to non-existent input: "+e)}}else console.warn("Can't move non-existent block: "+
|
|
1439
|
+
this.blockId)}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,MOVE$$module$build$src$core$events$utils,BlockMove$$module$build$src$core$events$events_block_move);var module$build$src$core$events$events_block_move={};module$build$src$core$events$events_block_move.BlockMove=BlockMove$$module$build$src$core$events$events_block_move;var CommentBase$$module$build$src$core$events$events_comment_base=class extends Abstract$$module$build$src$core$events$events_abstract{constructor(a){super();this.isBlank=!a;a&&(this.commentId=a.id,this.workspaceId=a.workspace.id,this.group=getGroup$$module$build$src$core$events$utils(),this.recordUndo=getRecordUndo$$module$build$src$core$events$utils())}toJson(){const a=super.toJson();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");
|
|
1440
|
+
a.commentId=this.commentId;return a}fromJson(a){super.fromJson(a);this.commentId=a.commentId}static CommentCreateDeleteHelper(a,b){var c=a.getEventWorkspace_();if(b){b=createElement$$module$build$src$core$utils$xml("xml");if(!a.xml)throw Error("Ecountered a comment event without proper xml");b.appendChild(a.xml);domToWorkspace$$module$build$src$core$xml(b,c)}else{if(!a.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");(c=c.getCommentById(a.commentId))?
|
|
1441
|
+
c.dispose():console.warn("Can't uncreate non-existent comment: "+a.commentId)}}},module$build$src$core$events$events_comment_base={};module$build$src$core$events$events_comment_base.CommentBase=CommentBase$$module$build$src$core$events$events_comment_base;var CommentChange$$module$build$src$core$events$events_comment_change=class extends CommentBase$$module$build$src$core$events$events_comment_base{constructor(a,b,c){super(a);this.type=COMMENT_CHANGE$$module$build$src$core$events$utils;a&&(this.oldContents_="undefined"===typeof b?"":b,this.newContents_="undefined"===typeof c?"":c)}toJson(){const a=super.toJson();if(!this.oldContents_)throw Error("The old contents is undefined. Either pass a value to the constructor, or call fromJson");if(!this.newContents_)throw Error("The new contents is undefined. Either pass a value to the constructor, or call fromJson");
|
|
1442
|
+
a.oldContents=this.oldContents_;a.newContents=this.newContents_;return a}fromJson(a){super.fromJson(a);this.oldContents_=a.oldContents;this.newContents_=a.newContents}isNull(){return this.oldContents_===this.newContents_}run(a){var b=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");if(b=b.getCommentById(this.commentId)){var c=a?this.newContents_:this.oldContents_;if(!c){if(a)throw Error("The new contents is undefined. Either pass a value to the constructor, or call fromJson");
|
|
1443
|
+
throw Error("The old contents is undefined. Either pass a value to the constructor, or call fromJson");}b.setContent(c)}else console.warn("Can't change non-existent comment: "+this.commentId)}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,COMMENT_CHANGE$$module$build$src$core$events$utils,CommentChange$$module$build$src$core$events$events_comment_change);var module$build$src$core$events$events_comment_change={};
|
|
1444
|
+
module$build$src$core$events$events_comment_change.CommentChange=CommentChange$$module$build$src$core$events$events_comment_change;var CommentCreate$$module$build$src$core$events$events_comment_create=class extends CommentBase$$module$build$src$core$events$events_comment_base{constructor(a){super(a);this.type=COMMENT_CREATE$$module$build$src$core$events$utils;a&&(this.xml=a.toXmlWithXY())}toJson(){const a=super.toJson();if(!this.xml)throw Error("The comment XML is undefined. Either pass a comment to the constructor, or call fromJson");a.xml=domToText$$module$build$src$core$xml(this.xml);return a}fromJson(a){super.fromJson(a);
|
|
1445
|
+
this.xml=textToDom$$module$build$src$core$xml(a.xml)}run(a){CommentBase$$module$build$src$core$events$events_comment_base.CommentCreateDeleteHelper(this,a)}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,COMMENT_CREATE$$module$build$src$core$events$utils,CommentCreate$$module$build$src$core$events$events_comment_create);var module$build$src$core$events$events_comment_create={};module$build$src$core$events$events_comment_create.CommentCreate=CommentCreate$$module$build$src$core$events$events_comment_create;var CommentDelete$$module$build$src$core$events$events_comment_delete=class extends CommentBase$$module$build$src$core$events$events_comment_base{constructor(a){super(a);this.type=COMMENT_DELETE$$module$build$src$core$events$utils;a&&(this.xml=a.toXmlWithXY())}run(a){CommentBase$$module$build$src$core$events$events_comment_base.CommentCreateDeleteHelper(this,!a)}};
|
|
1446
|
+
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,COMMENT_DELETE$$module$build$src$core$events$utils,CommentDelete$$module$build$src$core$events$events_comment_delete);var module$build$src$core$events$events_comment_delete={};module$build$src$core$events$events_comment_delete.CommentDelete=CommentDelete$$module$build$src$core$events$events_comment_delete;var CommentMove$$module$build$src$core$events$events_comment_move=class extends CommentBase$$module$build$src$core$events$events_comment_base{constructor(a){super(a);this.type=COMMENT_MOVE$$module$build$src$core$events$utils;a&&(this.comment_=a,this.oldCoordinate_=a.getXY())}recordNew(){if(this.newCoordinate_)throw Error("Tried to record the new position of a comment on the same event twice.");if(!this.comment_)throw Error("The comment is undefined. Pass a comment to the constructor if you want to use the record functionality");
|
|
1447
|
+
this.newCoordinate_=this.comment_.getXY()}setOldCoordinate(a){this.oldCoordinate_=a}toJson(){const a=super.toJson();if(!this.oldCoordinate_)throw Error("The old comment position is undefined. Either pass a comment to the constructor, or call fromJson");if(!this.newCoordinate_)throw Error("The new comment position is undefined. Either call recordNew, or call fromJson");a.oldCoordinate=`${Math.round(this.oldCoordinate_.x)}, `+`${Math.round(this.oldCoordinate_.y)}`;a.newCoordinate=Math.round(this.newCoordinate_.x)+
|
|
1448
|
+
","+Math.round(this.newCoordinate_.y);return a}fromJson(a){super.fromJson(a);let b=a.oldCoordinate.split(",");this.oldCoordinate_=new Coordinate$$module$build$src$core$utils$coordinate(Number(b[0]),Number(b[1]));b=a.newCoordinate.split(",");this.newCoordinate_=new Coordinate$$module$build$src$core$utils$coordinate(Number(b[0]),Number(b[1]))}isNull(){return Coordinate$$module$build$src$core$utils$coordinate.equals(this.oldCoordinate_,this.newCoordinate_)}run(a){var b=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");
|
|
1449
|
+
if(b=b.getCommentById(this.commentId)){a=a?this.newCoordinate_:this.oldCoordinate_;if(!a)throw Error("Either oldCoordinate_ or newCoordinate_ is undefined. Either pass a comment to the constructor and call recordNew, or call fromJson");var c=b.getXY();b.moveBy(a.x-c.x,a.y-c.y)}else console.warn("Can't move non-existent comment: "+this.commentId)}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,COMMENT_MOVE$$module$build$src$core$events$utils,CommentMove$$module$build$src$core$events$events_comment_move);
|
|
1450
|
+
var module$build$src$core$events$events_comment_move={};module$build$src$core$events$events_comment_move.CommentMove=CommentMove$$module$build$src$core$events$events_comment_move;var BlockDrag$$module$build$src$core$events$events_block_drag=class extends UiBase$$module$build$src$core$events$events_ui_base{constructor(a,b,c){super(a?a.workspace.id:void 0);this.type=BLOCK_DRAG$$module$build$src$core$events$utils;a&&(this.blockId=a.id,this.isStart=b,this.blocks=c)}toJson(){const a=super.toJson();if(void 0===this.isStart)throw Error("Whether this event is the start of a drag is undefined. Either pass the value to the constructor, or call fromJson");if(void 0===this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");
|
|
1451
|
+
a.isStart=this.isStart;a.blockId=this.blockId;a.blocks=this.blocks;return a}fromJson(a){super.fromJson(a);this.isStart=a.isStart;this.blockId=a.blockId;this.blocks=a.blocks}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,BLOCK_DRAG$$module$build$src$core$events$utils,BlockDrag$$module$build$src$core$events$events_block_drag);var module$build$src$core$events$events_block_drag={};module$build$src$core$events$events_block_drag.BlockDrag=BlockDrag$$module$build$src$core$events$events_block_drag;var Ui$$module$build$src$core$events$events_ui=class extends UiBase$$module$build$src$core$events$events_ui_base{constructor(a,b,c,d){super(a?a.workspace.id:void 0);this.type=UI$$module$build$src$core$events$utils;this.blockId=a?a.id:null;this.element="undefined"===typeof b?"":b;this.oldValue="undefined"===typeof c?"":c;this.newValue="undefined"===typeof d?"":d}toJson(){const a=super.toJson();a.element=this.element;void 0!==this.newValue&&(a.newValue=this.newValue);this.blockId&&(a.blockId=this.blockId);
|
|
1452
|
+
return a}fromJson(a){super.fromJson(a);this.element=a.element;this.newValue=a.newValue;this.blockId=a.blockId}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,UI$$module$build$src$core$events$utils,Ui$$module$build$src$core$events$events_ui);var module$build$src$core$events$events_ui={};module$build$src$core$events$events_ui.Ui=Ui$$module$build$src$core$events$events_ui;var FinishedLoading$$module$build$src$core$events$workspace_events=class extends Abstract$$module$build$src$core$events$events_abstract{constructor(a){super();this.isBlank=!0;this.recordUndo=!1;this.type=FINISHED_LOADING$$module$build$src$core$events$utils;this.isBlank=!!a;a&&(this.workspaceId=a.id)}toJson(){const a=super.toJson();if(!this.workspaceId)throw Error("The workspace ID is undefined. Either pass a workspace to the constructor, or call fromJson");a.workspaceId=this.workspaceId;return a}fromJson(a){super.fromJson(a);
|
|
1453
|
+
this.workspaceId=a.workspaceId}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,FINISHED_LOADING$$module$build$src$core$events$utils,FinishedLoading$$module$build$src$core$events$workspace_events);var module$build$src$core$events$workspace_events={};module$build$src$core$events$workspace_events.FinishedLoading=FinishedLoading$$module$build$src$core$events$workspace_events;var Abstract$$module$build$src$core$events$events,BLOCK_CHANGE$$module$build$src$core$events$events,BLOCK_CREATE$$module$build$src$core$events$events,BLOCK_DELETE$$module$build$src$core$events$events,BLOCK_DRAG$$module$build$src$core$events$events,BLOCK_MOVE$$module$build$src$core$events$events,BUBBLE_OPEN$$module$build$src$core$events$events,BUMP_EVENTS$$module$build$src$core$events$events,CHANGE$$module$build$src$core$events$events,CLICK$$module$build$src$core$events$events,COMMENT_CHANGE$$module$build$src$core$events$events,
|
|
1428
1454
|
COMMENT_CREATE$$module$build$src$core$events$events,COMMENT_DELETE$$module$build$src$core$events$events,COMMENT_MOVE$$module$build$src$core$events$events,CREATE$$module$build$src$core$events$events,DELETE$$module$build$src$core$events$events,FINISHED_LOADING$$module$build$src$core$events$events,MARKER_MOVE$$module$build$src$core$events$events,MOVE$$module$build$src$core$events$events,SELECTED$$module$build$src$core$events$events,THEME_CHANGE$$module$build$src$core$events$events,TOOLBOX_ITEM_SELECT$$module$build$src$core$events$events,
|
|
1429
1455
|
TRASHCAN_OPEN$$module$build$src$core$events$events,UI$$module$build$src$core$events$events,VAR_CREATE$$module$build$src$core$events$events,VAR_DELETE$$module$build$src$core$events$events,VAR_RENAME$$module$build$src$core$events$events,VIEWPORT_CHANGE$$module$build$src$core$events$events,clearPendingUndo$$module$build$src$core$events$events,disable$$module$build$src$core$events$events,enable$$module$build$src$core$events$events,filter$$module$build$src$core$events$events,fire$$module$build$src$core$events$events,
|
|
1430
1456
|
fromJson$$module$build$src$core$events$events,getDescendantIds$$module$build$src$core$events$events,get$$module$build$src$core$events$events,getGroup$$module$build$src$core$events$events,getRecordUndo$$module$build$src$core$events$events,isEnabled$$module$build$src$core$events$events,setGroup$$module$build$src$core$events$events,setRecordUndo$$module$build$src$core$events$events,disableOrphans$$module$build$src$core$events$events;Abstract$$module$build$src$core$events$events=Abstract$$module$build$src$core$events$events_abstract;
|
|
@@ -1439,17 +1465,18 @@ getRecordUndo$$module$build$src$core$events$events=getRecordUndo$$module$build$s
|
|
|
1439
1465
|
$.module$build$src$core$events$events={};$.module$build$src$core$events$events.Abstract=Abstract$$module$build$src$core$events$events_abstract;$.module$build$src$core$events$events.BLOCK_CHANGE=CHANGE$$module$build$src$core$events$utils;$.module$build$src$core$events$events.BLOCK_CREATE=CREATE$$module$build$src$core$events$utils;$.module$build$src$core$events$events.BLOCK_DELETE=DELETE$$module$build$src$core$events$utils;$.module$build$src$core$events$events.BLOCK_DRAG=BLOCK_DRAG$$module$build$src$core$events$utils;
|
|
1440
1466
|
$.module$build$src$core$events$events.BLOCK_MOVE=MOVE$$module$build$src$core$events$utils;$.module$build$src$core$events$events.BUBBLE_OPEN=BUBBLE_OPEN$$module$build$src$core$events$utils;$.module$build$src$core$events$events.BUMP_EVENTS=BUMP_EVENTS$$module$build$src$core$events$utils;$.module$build$src$core$events$events.BlockBase=BlockBase$$module$build$src$core$events$events_block_base;$.module$build$src$core$events$events.BlockChange=BlockChange$$module$build$src$core$events$events_block_change;
|
|
1441
1467
|
$.module$build$src$core$events$events.BlockCreate=BlockCreate$$module$build$src$core$events$events_block_create;$.module$build$src$core$events$events.BlockDelete=BlockDelete$$module$build$src$core$events$events_block_delete;$.module$build$src$core$events$events.BlockDrag=BlockDrag$$module$build$src$core$events$events_block_drag;$.module$build$src$core$events$events.BlockMove=BlockMove$$module$build$src$core$events$events_block_move;$.module$build$src$core$events$events.BubbleOpen=BubbleOpen$$module$build$src$core$events$events_bubble_open;
|
|
1442
|
-
$.module$build$src$core$events$events.
|
|
1443
|
-
$.module$build$src$core$events$events.
|
|
1444
|
-
$.module$build$src$core$events$events.
|
|
1445
|
-
$.module$build$src$core$events$events.
|
|
1446
|
-
$.module$build$src$core$events$events.
|
|
1447
|
-
$.module$build$src$core$events$events.
|
|
1448
|
-
$.module$build$src$core$events$events.
|
|
1449
|
-
$.module$build$src$core$events$events.
|
|
1450
|
-
$.module$build$src$core$events$events.
|
|
1451
|
-
$.module$build$src$core$events$events.
|
|
1452
|
-
$.module$build$src$core$events$events.
|
|
1468
|
+
$.module$build$src$core$events$events.BubbleType=BubbleType$$module$build$src$core$events$events_bubble_open;$.module$build$src$core$events$events.CHANGE=CHANGE$$module$build$src$core$events$utils;$.module$build$src$core$events$events.CLICK=CLICK$$module$build$src$core$events$utils;$.module$build$src$core$events$events.COMMENT_CHANGE=COMMENT_CHANGE$$module$build$src$core$events$utils;$.module$build$src$core$events$events.COMMENT_CREATE=COMMENT_CREATE$$module$build$src$core$events$utils;
|
|
1469
|
+
$.module$build$src$core$events$events.COMMENT_DELETE=COMMENT_DELETE$$module$build$src$core$events$utils;$.module$build$src$core$events$events.COMMENT_MOVE=COMMENT_MOVE$$module$build$src$core$events$utils;$.module$build$src$core$events$events.CREATE=CREATE$$module$build$src$core$events$utils;$.module$build$src$core$events$events.Click=Click$$module$build$src$core$events$events_click;$.module$build$src$core$events$events.ClickTarget=ClickTarget$$module$build$src$core$events$events_click;
|
|
1470
|
+
$.module$build$src$core$events$events.CommentBase=CommentBase$$module$build$src$core$events$events_comment_base;$.module$build$src$core$events$events.CommentChange=CommentChange$$module$build$src$core$events$events_comment_change;$.module$build$src$core$events$events.CommentCreate=CommentCreate$$module$build$src$core$events$events_comment_create;$.module$build$src$core$events$events.CommentDelete=CommentDelete$$module$build$src$core$events$events_comment_delete;
|
|
1471
|
+
$.module$build$src$core$events$events.CommentMove=CommentMove$$module$build$src$core$events$events_comment_move;$.module$build$src$core$events$events.DELETE=DELETE$$module$build$src$core$events$utils;$.module$build$src$core$events$events.FINISHED_LOADING=FINISHED_LOADING$$module$build$src$core$events$utils;$.module$build$src$core$events$events.FinishedLoading=FinishedLoading$$module$build$src$core$events$workspace_events;$.module$build$src$core$events$events.MARKER_MOVE=MARKER_MOVE$$module$build$src$core$events$utils;
|
|
1472
|
+
$.module$build$src$core$events$events.MOVE=MOVE$$module$build$src$core$events$utils;$.module$build$src$core$events$events.MarkerMove=MarkerMove$$module$build$src$core$events$events_marker_move;$.module$build$src$core$events$events.SELECTED=SELECTED$$module$build$src$core$events$utils;$.module$build$src$core$events$events.Selected=Selected$$module$build$src$core$events$events_selected;$.module$build$src$core$events$events.THEME_CHANGE=THEME_CHANGE$$module$build$src$core$events$utils;
|
|
1473
|
+
$.module$build$src$core$events$events.TOOLBOX_ITEM_SELECT=TOOLBOX_ITEM_SELECT$$module$build$src$core$events$utils;$.module$build$src$core$events$events.TRASHCAN_OPEN=TRASHCAN_OPEN$$module$build$src$core$events$utils;$.module$build$src$core$events$events.ThemeChange=ThemeChange$$module$build$src$core$events$events_theme_change;$.module$build$src$core$events$events.ToolboxItemSelect=ToolboxItemSelect$$module$build$src$core$events$events_toolbox_item_select;
|
|
1474
|
+
$.module$build$src$core$events$events.TrashcanOpen=TrashcanOpen$$module$build$src$core$events$events_trashcan_open;$.module$build$src$core$events$events.UI=UI$$module$build$src$core$events$utils;$.module$build$src$core$events$events.Ui=Ui$$module$build$src$core$events$events_ui;$.module$build$src$core$events$events.UiBase=UiBase$$module$build$src$core$events$events_ui_base;$.module$build$src$core$events$events.VAR_CREATE=VAR_CREATE$$module$build$src$core$events$utils;
|
|
1475
|
+
$.module$build$src$core$events$events.VAR_DELETE=VAR_DELETE$$module$build$src$core$events$utils;$.module$build$src$core$events$events.VAR_RENAME=VAR_RENAME$$module$build$src$core$events$utils;$.module$build$src$core$events$events.VIEWPORT_CHANGE=VIEWPORT_CHANGE$$module$build$src$core$events$utils;$.module$build$src$core$events$events.VarBase=VarBase$$module$build$src$core$events$events_var_base;$.module$build$src$core$events$events.VarCreate=VarCreate$$module$build$src$core$events$events_var_create;
|
|
1476
|
+
$.module$build$src$core$events$events.VarDelete=VarDelete$$module$build$src$core$events$events_var_delete;$.module$build$src$core$events$events.VarRename=VarRename$$module$build$src$core$events$events_var_rename;$.module$build$src$core$events$events.ViewportChange=ViewportChange$$module$build$src$core$events$events_viewport;$.module$build$src$core$events$events.clearPendingUndo=clearPendingUndo$$module$build$src$core$events$utils;$.module$build$src$core$events$events.disable=disable$$module$build$src$core$events$utils;
|
|
1477
|
+
$.module$build$src$core$events$events.disableOrphans=disableOrphans$$module$build$src$core$events$utils;$.module$build$src$core$events$events.enable=enable$$module$build$src$core$events$utils;$.module$build$src$core$events$events.filter=filter$$module$build$src$core$events$utils;$.module$build$src$core$events$events.fire=fire$$module$build$src$core$events$utils;$.module$build$src$core$events$events.fromJson=fromJson$$module$build$src$core$events$utils;$.module$build$src$core$events$events.get=get$$module$build$src$core$events$utils;
|
|
1478
|
+
$.module$build$src$core$events$events.getDescendantIds=getDescendantIds$$module$build$src$core$events$utils;$.module$build$src$core$events$events.getGroup=getGroup$$module$build$src$core$events$utils;$.module$build$src$core$events$events.getRecordUndo=getRecordUndo$$module$build$src$core$events$utils;$.module$build$src$core$events$events.isEnabled=isEnabled$$module$build$src$core$events$utils;$.module$build$src$core$events$events.setGroup=setGroup$$module$build$src$core$events$utils;
|
|
1479
|
+
$.module$build$src$core$events$events.setRecordUndo=setRecordUndo$$module$build$src$core$events$utils;registerDefaultOptions$$module$build$src$core$contextmenu_items();var module$build$src$core$contextmenu_items={};module$build$src$core$contextmenu_items.registerCleanup=registerCleanup$$module$build$src$core$contextmenu_items;module$build$src$core$contextmenu_items.registerCollapse=registerCollapse$$module$build$src$core$contextmenu_items;module$build$src$core$contextmenu_items.registerCollapseExpandBlock=registerCollapseExpandBlock$$module$build$src$core$contextmenu_items;
|
|
1453
1480
|
module$build$src$core$contextmenu_items.registerComment=registerComment$$module$build$src$core$contextmenu_items;module$build$src$core$contextmenu_items.registerDefaultOptions=registerDefaultOptions$$module$build$src$core$contextmenu_items;module$build$src$core$contextmenu_items.registerDelete=registerDelete$$module$build$src$core$contextmenu_items;module$build$src$core$contextmenu_items.registerDeleteAll=registerDeleteAll$$module$build$src$core$contextmenu_items;
|
|
1454
1481
|
module$build$src$core$contextmenu_items.registerDisable=registerDisable$$module$build$src$core$contextmenu_items;module$build$src$core$contextmenu_items.registerDuplicate=registerDuplicate$$module$build$src$core$contextmenu_items;module$build$src$core$contextmenu_items.registerExpand=registerExpand$$module$build$src$core$contextmenu_items;module$build$src$core$contextmenu_items.registerHelp=registerHelp$$module$build$src$core$contextmenu_items;
|
|
1455
1482
|
module$build$src$core$contextmenu_items.registerInline=registerInline$$module$build$src$core$contextmenu_items;module$build$src$core$contextmenu_items.registerRedo=registerRedo$$module$build$src$core$contextmenu_items;module$build$src$core$contextmenu_items.registerUndo=registerUndo$$module$build$src$core$contextmenu_items;var BlockDragger$$module$build$src$core$block_dragger=class{constructor(a,b){this.dragTarget_=null;this.wouldDeleteBlock_=!1;this.draggingBlock_=a;this.draggedConnectionManager_=new InsertionMarkerManager$$module$build$src$core$insertion_marker_manager(this.draggingBlock_);this.workspace_=b;this.startXY_=this.draggingBlock_.getRelativeToSurfaceXY();this.dragIconData_=initIconData$$module$build$src$core$block_dragger(a)}dispose(){this.dragIconData_.length=0;this.draggedConnectionManager_&&this.draggedConnectionManager_.dispose()}startDrag(a,
|
|
@@ -1462,7 +1489,7 @@ this.pixelsToWorkspaceUnits_(a);const b=Coordinate$$module$build$src$core$utils$
|
|
|
1462
1489
|
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):
|
|
1463
1490
|
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&&
|
|
1464
1491
|
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():[]}};
|
|
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.
|
|
1492
|
+
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.3",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,
|
|
1466
1493
|
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,
|
|
1467
1494
|
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=
|
|
1468
1495
|
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,
|
|
@@ -1497,8 +1524,8 @@ module$build$src$core$blockly.browserEvents=module$build$src$core$browser_events
|
|
|
1497
1524
|
module$build$src$core$blockly.constants=module$build$src$core$constants;module$build$src$core$blockly.copy=copy$$module$build$src$core$blockly;module$build$src$core$blockly.defineBlocksWithJsonArray=defineBlocksWithJsonArray$$module$build$src$core$common;module$build$src$core$blockly.dialog=module$build$src$core$dialog;module$build$src$core$blockly.duplicate=duplicate$$module$build$src$core$blockly;module$build$src$core$blockly.fieldRegistry=module$build$src$core$field_registry;
|
|
1498
1525
|
module$build$src$core$blockly.geras=module$build$src$core$renderers$geras$geras;module$build$src$core$blockly.getMainWorkspace=getMainWorkspace$$module$build$src$core$common;module$build$src$core$blockly.getSelected=getSelected$$module$build$src$core$common;module$build$src$core$blockly.hideChaff=hideChaff$$module$build$src$core$blockly;module$build$src$core$blockly.hueToHex=hueToHex$$module$build$src$core$blockly;module$build$src$core$blockly.inject=inject$$module$build$src$core$inject;
|
|
1499
1526
|
module$build$src$core$blockly.inputTypes=inputTypes$$module$build$src$core$input_types;module$build$src$core$blockly.isNumber=isNumber$$module$build$src$core$blockly;module$build$src$core$blockly.minimalist=module$build$src$core$renderers$minimalist$minimalist;module$build$src$core$blockly.paste=paste$$module$build$src$core$blockly;module$build$src$core$blockly.registry=module$build$src$core$registry;module$build$src$core$blockly.resizeSvgContents=resizeSvgContentsLocal$$module$build$src$core$blockly;
|
|
1500
|
-
module$build$src$core$blockly.serialization=serialization$$module$build$src$core$blockly;module$build$src$core$blockly.
|
|
1501
|
-
module$build$src$core$blockly.unbindEvent_=unbindEvent_$$module$build$src$core$blockly;module$build$src$core$blockly.utils=module$build$src$core$utils;module$build$src$core$blockly.zelos=module$build$src$core$renderers$zelos$zelos;var module$exports$Blockly$main={},module$contents$Blockly$main_Blockly=module$build$src$core$blockly,module$contents$Blockly$main_ContextMenu=$.module$build$src$core$contextmenu,module$contents$Blockly$main_Events=$.module$build$src$core$events$events,module$contents$Blockly$main_Msg=$.module$build$src$core$msg,module$contents$Blockly$main_Tooltip=module$build$src$core$tooltip,module$contents$Blockly$main_WidgetDiv=module$build$src$core$widgetdiv,module$contents$Blockly$main_colour=module$build$src$core$utils$colour,
|
|
1527
|
+
module$build$src$core$blockly.serialization=serialization$$module$build$src$core$blockly;module$build$src$core$blockly.setLocale=setLocale$$module$build$src$core$msg;module$build$src$core$blockly.setParentContainer=setParentContainer$$module$build$src$core$common;module$build$src$core$blockly.svgResize=svgResize$$module$build$src$core$common;module$build$src$core$blockly.svgSize=svgSize$$module$build$src$core$utils$svg_math;module$build$src$core$blockly.thrasos=module$build$src$core$renderers$thrasos$thrasos;
|
|
1528
|
+
module$build$src$core$blockly.uiPosition=module$build$src$core$positionable_helpers;module$build$src$core$blockly.unbindEvent_=unbindEvent_$$module$build$src$core$blockly;module$build$src$core$blockly.utils=module$build$src$core$utils;module$build$src$core$blockly.zelos=module$build$src$core$renderers$zelos$zelos;var module$exports$Blockly$main={},module$contents$Blockly$main_Blockly=module$build$src$core$blockly,module$contents$Blockly$main_ContextMenu=$.module$build$src$core$contextmenu,module$contents$Blockly$main_Events=$.module$build$src$core$events$events,module$contents$Blockly$main_Msg=$.module$build$src$core$msg,module$contents$Blockly$main_Tooltip=module$build$src$core$tooltip,module$contents$Blockly$main_WidgetDiv=module$build$src$core$widgetdiv,module$contents$Blockly$main_colour=module$build$src$core$utils$colour,
|
|
1502
1529
|
module$contents$Blockly$main_common=$.module$build$src$core$common,module$contents$Blockly$main_deprecation=module$build$src$core$utils$deprecation,module$contents$Blockly$main_dialog=module$build$src$core$dialog,module$contents$Blockly$main_eventUtils=module$build$src$core$events$utils;
|
|
1503
1530
|
Object.defineProperties(module$build$src$core$blockly,{alert:{set:function(a){module$build$src$core$utils$deprecation.warn("Blockly.alert","December 2021","December 2022");module$build$src$core$dialog.setAlert(a)},get:function(){module$build$src$core$utils$deprecation.warn("Blockly.alert","December 2021","December 2022","Blockly.dialog.alert()");return module$build$src$core$dialog.alert}},confirm:{set:function(a){module$build$src$core$utils$deprecation.warn("Blockly.confirm","December 2021","December 2022");
|
|
1504
1531
|
module$build$src$core$dialog.setConfirm(a)},get:function(){module$build$src$core$utils$deprecation.warn("Blockly.confirm","December 2021","December 2022","Blockly.dialog.confirm()");return module$build$src$core$dialog.confirm}},mainWorkspace:{set:function(a){module$build$src$core$utils$deprecation.warn("Blockly.mainWorkspace","August 2022","September 2022","Blockly.getMainWorkspace");$.module$build$src$core$common.setMainWorkspace(a)},get:function(){module$build$src$core$utils$deprecation.warn("Blockly.mainWorkspace",
|
|
@@ -2003,7 +2030,7 @@ a?"\u201c":"\u201d")}},module$contents$Blockly$libraryBlocks$texts_TEXT_QUOTES_E
|
|
|
2003
2030
|
saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(a){this.itemCount_=a.itemCount;this.updateShape_()},decompose:function(a){const b=a.newBlock("text_create_join_container");b.initSvg();let c=b.getInput("STACK").connection;for(let d=0;d<this.itemCount_;d++){const e=a.newBlock("text_create_join_item");e.initSvg();c.connect(e.previousConnection);c=e.nextConnection}return b},compose:function(a){var b=a.getInputTargetBlock("STACK");for(a=[];b;)b.isInsertionMarker()||
|
|
2004
2031
|
a.push(b.valueConnection_),b=b.getNextBlock();for(b=0;b<this.itemCount_;b++){const c=this.getInput("ADD"+b).connection.targetConnection;c&&-1===a.indexOf(c)&&c.disconnect()}this.itemCount_=a.length;this.updateShape_();for(b=0;b<this.itemCount_;b++)$.Mutator$$module$build$src$core$mutator.reconnect(a[b],this,"ADD"+b)},saveConnections:function(a){a=a.getInputTargetBlock("STACK");let b=0;for(;a;){if(a.isInsertionMarker()){a=a.getNextBlock();continue}const c=this.getInput("ADD"+b);a.valueConnection_=
|
|
2005
2032
|
c&&c.connection.targetConnection;a=a.getNextBlock();b++}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(this.newQuote_(!0)).appendField(this.newQuote_(!1));for(var a=0;a<this.itemCount_;a++)if(!this.getInput("ADD"+a)){const b=this.appendValueInput("ADD"+a).setAlign($.Align$$module$build$src$core$input.RIGHT);0===a&&b.appendField(module$contents$Blockly$libraryBlocks$texts_Msg.TEXT_JOIN_TITLE_CREATEWITH)}for(a=
|
|
2006
|
-
this.itemCount_;this.getInput("ADD"+a);a++)this.removeInput("ADD"+a)}},module$contents$Blockly$libraryBlocks$texts_TEXT_JOIN_EXTENSION=function(){this.mixin(module$contents$Blockly$libraryBlocks$texts_QUOTE_IMAGE_MIXIN);this.itemCount_=2;this.updateShape_();this.setMutator(new $.Mutator$$module$build$src$core$mutator(["text_create_join_item"]))};
|
|
2033
|
+
this.itemCount_;this.getInput("ADD"+a);a++)this.removeInput("ADD"+a)}},module$contents$Blockly$libraryBlocks$texts_TEXT_JOIN_EXTENSION=function(){this.mixin(module$contents$Blockly$libraryBlocks$texts_QUOTE_IMAGE_MIXIN);this.itemCount_=2;this.updateShape_();this.setMutator(new $.Mutator$$module$build$src$core$mutator(["text_create_join_item"],this))};
|
|
2007
2034
|
$.module$build$src$core$extensions.register("text_append_tooltip",$.module$build$src$core$extensions.buildTooltipWithFieldText("%{BKY_TEXT_APPEND_TOOLTIP}","VAR"));
|
|
2008
2035
|
var module$contents$Blockly$libraryBlocks$texts_TEXT_INDEXOF_TOOLTIP_EXTENSION=function(){const a=this;this.setTooltip(function(){return module$contents$Blockly$libraryBlocks$texts_Msg.TEXT_INDEXOF_TOOLTIP.replace("%1",a.workspace.options.oneBasedIndex?"0":"-1")})},module$contents$Blockly$libraryBlocks$texts_TEXT_CHARAT_MUTATOR_MIXIN={mutationToDom:function(){const a=$.module$build$src$core$utils$xml.createElement("mutation");a.setAttribute("at",!!this.isAt_);return a},domToMutation:function(a){a=
|
|
2009
2036
|
"false"!==a.getAttribute("at");this.updateAt_(a)},updateAt_:function(a){this.removeInput("AT",!0);this.removeInput("ORDINAL",!0);a&&(this.appendValueInput("AT").setCheck("Number"),module$contents$Blockly$libraryBlocks$texts_Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(module$contents$Blockly$libraryBlocks$texts_Msg.ORDINAL_NUMBER_SUFFIX));module$contents$Blockly$libraryBlocks$texts_Msg.TEXT_CHARAT_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField(module$contents$Blockly$libraryBlocks$texts_Msg.TEXT_CHARAT_TAIL));
|
|
@@ -2027,10 +2054,10 @@ if(this.mutator&&this.mutator.isVisible()){const c=this.mutator.workspace_.getAl
|
|
|
2027
2054
|
d.setAttribute("name",c);for(c=0;c<this.arguments_.length;c++){var e=$.module$build$src$core$utils$xml.createElement("arg");e.setAttribute("name",this.arguments_[c]);d.appendChild(e)}c=$.module$build$src$core$utils$xml.createElement("block");c.setAttribute("type",this.callType_);c.appendChild(d);b.callback=$.module$build$src$core$contextmenu.callbackFactory(this,c);a.push(b);if(!this.isCollapsed())for(b=0;b<this.argumentVarModels_.length;b++)d={enabled:!0},c=this.argumentVarModels_[b],d.text=module$contents$Blockly$libraryBlocks$procedures_Msg.VARIABLES_SET_CREATE_GET.replace("%1",
|
|
2028
2055
|
c.name),c=$.module$build$src$core$variables.generateVariableFieldDom(c),e=$.module$build$src$core$utils$xml.createElement("block"),e.setAttribute("type","variables_get"),e.appendChild(c),d.callback=$.module$build$src$core$contextmenu.callbackFactory(this,e),a.push(d)}}};
|
|
2029
2056
|
module$exports$Blockly$libraryBlocks$procedures.blocks.procedures_defnoreturn=Object.assign({},module$contents$Blockly$libraryBlocks$procedures_PROCEDURE_DEF_COMMON,{init:function(){var a=$.module$build$src$core$procedures.findLegalName("",this);a=new $.FieldTextInput$$module$build$src$core$field_textinput(a,$.module$build$src$core$procedures.rename);a.setSpellcheck(!1);this.appendDummyInput().appendField(module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_DEFNORETURN_TITLE).appendField(a,
|
|
2030
|
-
"NAME").appendField("","PARAMS");this.setMutator(new $.Mutator$$module$build$src$core$mutator(["procedures_mutatorarg"]));(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText(module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_DEFNORETURN_COMMENT);this.setStyle("procedure_blocks");this.setTooltip(module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_DEFNORETURN_TOOLTIP);
|
|
2057
|
+
"NAME").appendField("","PARAMS");this.setMutator(new $.Mutator$$module$build$src$core$mutator(["procedures_mutatorarg"],this));(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText(module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_DEFNORETURN_COMMENT);this.setStyle("procedure_blocks");this.setTooltip(module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_DEFNORETURN_TOOLTIP);
|
|
2031
2058
|
this.setHelpUrl(module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_DEFNORETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.setStatements_(!0);this.statementConnection_=null},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!1]},callType_:"procedures_callnoreturn"});
|
|
2032
2059
|
module$exports$Blockly$libraryBlocks$procedures.blocks.procedures_defreturn=Object.assign({},module$contents$Blockly$libraryBlocks$procedures_PROCEDURE_DEF_COMMON,{init:function(){var a=$.module$build$src$core$procedures.findLegalName("",this);a=new $.FieldTextInput$$module$build$src$core$field_textinput(a,$.module$build$src$core$procedures.rename);a.setSpellcheck(!1);this.appendDummyInput().appendField(module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_DEFRETURN_TITLE).appendField(a,
|
|
2033
|
-
"NAME").appendField("","PARAMS");this.appendValueInput("RETURN").setAlign($.Align$$module$build$src$core$input.RIGHT).appendField(module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_DEFRETURN_RETURN);this.setMutator(new $.Mutator$$module$build$src$core$mutator(["procedures_mutatorarg"]));(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_DEFRETURN_COMMENT&&
|
|
2060
|
+
"NAME").appendField("","PARAMS");this.appendValueInput("RETURN").setAlign($.Align$$module$build$src$core$input.RIGHT).appendField(module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_DEFRETURN_RETURN);this.setMutator(new $.Mutator$$module$build$src$core$mutator(["procedures_mutatorarg"],this));(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_DEFRETURN_COMMENT&&
|
|
2034
2061
|
this.setCommentText(module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_DEFRETURN_COMMENT);this.setStyle("procedure_blocks");this.setTooltip(module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_DEFRETURN_TOOLTIP);this.setHelpUrl(module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_DEFRETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.setStatements_(!0);this.statementConnection_=null},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,
|
|
2035
2062
|
!0]},callType_:"procedures_callreturn"});
|
|
2036
2063
|
module$exports$Blockly$libraryBlocks$procedures.blocks.procedures_mutatorcontainer={init:function(){this.appendDummyInput().appendField(module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_MUTATORCONTAINER_TITLE);this.appendStatementInput("STACK");this.appendDummyInput("STATEMENT_INPUT").appendField(module$contents$Blockly$libraryBlocks$procedures_Msg.PROCEDURES_ALLOW_STATEMENTS).appendField(new $.FieldCheckbox$$module$build$src$core$field_checkbox("TRUE"),"STATEMENTS");this.setStyle("procedure_blocks");
|
|
@@ -2121,7 +2148,7 @@ $.module$build$src$core$field_dropdown.FieldDropdown,module$contents$Blockly$lib
|
|
|
2121
2148
|
module$exports$Blockly$libraryBlocks$lists.blocks=module$contents$Blockly$libraryBlocks$lists_createBlockDefinitionsFromJsonArray([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM"},{type:"input_value",name:"NUM",check:"Number"}],output:"Array",style:"list_blocks",
|
|
2122
2149
|
tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_LISTS_REPEAT_HELPURL}"},{type:"lists_reverse",message0:"%{BKY_LISTS_REVERSE_MESSAGE0}",args0:[{type:"input_value",name:"LIST",check:"Array"}],output:"Array",inputsInline:!0,style:"list_blocks",tooltip:"%{BKY_LISTS_REVERSE_TOOLTIP}",helpUrl:"%{BKY_LISTS_REVERSE_HELPURL}"},{type:"lists_isEmpty",message0:"%{BKY_LISTS_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"list_blocks",tooltip:"%{BKY_LISTS_ISEMPTY_TOOLTIP}",
|
|
2123
2150
|
helpUrl:"%{BKY_LISTS_ISEMPTY_HELPURL}"},{type:"lists_length",message0:"%{BKY_LISTS_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",style:"list_blocks",tooltip:"%{BKY_LISTS_LENGTH_TOOLTIP}",helpUrl:"%{BKY_LISTS_LENGTH_HELPURL}"}]);
|
|
2124
|
-
module$exports$Blockly$libraryBlocks$lists.blocks.lists_create_with={init:function(){this.setHelpUrl(module$contents$Blockly$libraryBlocks$lists_Msg.LISTS_CREATE_WITH_HELPURL);this.setStyle("list_blocks");this.itemCount_=3;this.updateShape_();this.setOutput(!0,"Array");this.setMutator(new $.Mutator$$module$build$src$core$mutator(["lists_create_with_item"]));this.setTooltip(module$contents$Blockly$libraryBlocks$lists_Msg.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){const a=$.module$build$src$core$utils$xml.createElement("mutation");
|
|
2151
|
+
module$exports$Blockly$libraryBlocks$lists.blocks.lists_create_with={init:function(){this.setHelpUrl(module$contents$Blockly$libraryBlocks$lists_Msg.LISTS_CREATE_WITH_HELPURL);this.setStyle("list_blocks");this.itemCount_=3;this.updateShape_();this.setOutput(!0,"Array");this.setMutator(new $.Mutator$$module$build$src$core$mutator(["lists_create_with_item"],this));this.setTooltip(module$contents$Blockly$libraryBlocks$lists_Msg.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){const a=$.module$build$src$core$utils$xml.createElement("mutation");
|
|
2125
2152
|
a.setAttribute("items",this.itemCount_);return a},domToMutation:function(a){this.itemCount_=parseInt(a.getAttribute("items"),10);this.updateShape_()},saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(a){this.itemCount_=a.itemCount;this.updateShape_()},decompose:function(a){const b=a.newBlock("lists_create_with_container");b.initSvg();let c=b.getInput("STACK").connection;for(let d=0;d<this.itemCount_;d++){const e=a.newBlock("lists_create_with_item");e.initSvg();c.connect(e.previousConnection);
|
|
2126
2153
|
c=e.nextConnection}return b},compose:function(a){var b=a.getInputTargetBlock("STACK");for(a=[];b;)b.isInsertionMarker()||a.push(b.valueConnection_),b=b.getNextBlock();for(b=0;b<this.itemCount_;b++){const c=this.getInput("ADD"+b).connection.targetConnection;c&&-1===a.indexOf(c)&&c.disconnect()}this.itemCount_=a.length;this.updateShape_();for(b=0;b<this.itemCount_;b++)$.Mutator$$module$build$src$core$mutator.reconnect(a[b],this,"ADD"+b)},saveConnections:function(a){a=a.getInputTargetBlock("STACK");
|
|
2127
2154
|
let b=0;for(;a;){if(a.isInsertionMarker()){a=a.getNextBlock();continue}const c=this.getInput("ADD"+b);a.valueConnection_=c&&c.connection.targetConnection;a=a.getNextBlock();b++}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(module$contents$Blockly$libraryBlocks$lists_Msg.LISTS_CREATE_EMPTY_TITLE);for(var a=0;a<this.itemCount_;a++)if(!this.getInput("ADD"+a)){const b=this.appendValueInput("ADD"+
|
|
@@ -2154,8 +2181,8 @@ this.appendDummyInput("TAIL").appendField(module$contents$Blockly$libraryBlocks$
|
|
|
2154
2181
|
b);b=this.getInput("AT2").type===$.module$build$src$core$connection_type.ConnectionType.INPUT_VALUE;a.setAttribute("at2",b);return a},domToMutation:function(a){const b="true"===a.getAttribute("at1");a="true"===a.getAttribute("at2");this.updateAt_(1,b);this.updateAt_(2,a)},saveExtraState:function(){return null},loadExtraState:function(){},updateAt_:function(a,b){this.removeInput("AT"+a);this.removeInput("ORDINAL"+a,!0);b?(this.appendValueInput("AT"+a).setCheck("Number"),module$contents$Blockly$libraryBlocks$lists_Msg.ORDINAL_NUMBER_SUFFIX&&
|
|
2155
2182
|
this.appendDummyInput("ORDINAL"+a).appendField(module$contents$Blockly$libraryBlocks$lists_Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+a);const c=new module$contents$Blockly$libraryBlocks$lists_FieldDropdown(this["WHERE_OPTIONS_"+a],function(d){const e="FROM_START"===d||"FROM_END"===d;if(e!==b){const f=this.getSourceBlock();f.updateAt_(a,e);f.setFieldValue(d,"WHERE"+a);return null}});this.getInput("AT"+a).appendField(c,"WHERE"+a);1===a&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&
|
|
2156
2183
|
this.moveInputBefore("ORDINAL1","AT2"));module$contents$Blockly$libraryBlocks$lists_Msg.LISTS_GET_SUBLIST_TAIL&&this.moveInputBefore("TAIL",null)}};
|
|
2157
|
-
module$exports$Blockly$libraryBlocks$lists.blocks.lists_sort={init:function(){this.jsonInit({message0:
|
|
2158
|
-
|
|
2184
|
+
module$exports$Blockly$libraryBlocks$lists.blocks.lists_sort={init:function(){this.jsonInit({message0:"%{BKY_LISTS_SORT_TITLE}",args0:[{type:"field_dropdown",name:"TYPE",options:[["%{BKY_LISTS_SORT_TYPE_NUMERIC}","NUMERIC"],["%{BKY_LISTS_SORT_TYPE_TEXT}","TEXT"],["%{BKY_LISTS_SORT_TYPE_IGNORECASE}","IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[["%{BKY_LISTS_SORT_ORDER_ASCENDING}","1"],["%{BKY_LISTS_SORT_ORDER_DESCENDING}","-1"]]},{type:"input_value",name:"LIST",check:"Array"}],
|
|
2185
|
+
output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_SORT_TOOLTIP}",helpUrl:"%{BKY_LISTS_SORT_HELPURL}"})}};
|
|
2159
2186
|
module$exports$Blockly$libraryBlocks$lists.blocks.lists_split={init:function(){const a=this,b=new module$contents$Blockly$libraryBlocks$lists_FieldDropdown([[module$contents$Blockly$libraryBlocks$lists_Msg.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[module$contents$Blockly$libraryBlocks$lists_Msg.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]],function(c){a.updateType_(c)});this.setHelpUrl(module$contents$Blockly$libraryBlocks$lists_Msg.LISTS_SPLIT_HELPURL);this.setStyle("list_blocks");this.appendValueInput("INPUT").setCheck("String").appendField(b,
|
|
2160
2187
|
"MODE");this.appendValueInput("DELIM").setCheck("String").appendField(module$contents$Blockly$libraryBlocks$lists_Msg.LISTS_SPLIT_WITH_DELIMITER);this.setInputsInline(!0);this.setOutput(!0,"Array");this.setTooltip(function(){const c=a.getFieldValue("MODE");if("SPLIT"===c)return module$contents$Blockly$libraryBlocks$lists_Msg.LISTS_SPLIT_TOOLTIP_SPLIT;if("JOIN"===c)return module$contents$Blockly$libraryBlocks$lists_Msg.LISTS_SPLIT_TOOLTIP_JOIN;throw Error("Unknown mode: "+c);})},updateType_:function(a){if(this.getFieldValue("MODE")!==
|
|
2161
2188
|
a){const b=this.getInput("INPUT").connection;b.setShadowDom(null);const c=b.targetBlock();c&&(b.disconnect(),c.isShadow()?c.dispose():this.bumpNeighbours())}"SPLIT"===a?(this.outputConnection.setCheck("Array"),this.getInput("INPUT").setCheck("String")):(this.outputConnection.setCheck("String"),this.getInput("INPUT").setCheck("Array"))},mutationToDom:function(){const a=$.module$build$src$core$utils$xml.createElement("mutation");a.setAttribute("mode",this.getFieldValue("MODE"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("mode"))},
|