/*! For license information please see index.js.LICENSE.txt */ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("blockly/core"));else if("function"==typeof define&&define.amd)define(["blockly/core"],e);else{var o="object"==typeof exports?e(require("blockly/core")):e(t.Blockly);for(var r in o)("object"==typeof exports?exports:t)[r]=o[r]}}(this,(function(t){return(()=>{"use strict";var e={573:e=>{e.exports=t}},o={};function r(t){var n=o[t];if(void 0!==n)return n.exports;var i=o[t]={exports:{}};return e[t](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{r.r(n),r.d(n,{ContinuousCategory:()=>u,ContinuousFlyout:()=>F,ContinuousMetrics:()=>Y,ContinuousToolbox:()=>g});var t=r(573);function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function o(t,e){for(var o=0;ot.length)&&(e=t.length);for(var o=0,r=new Array(e);o=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,c=!0,l=!1;return{s:function(){o=o.call(t)},n:function(){var t=o.next();return c=t.done,t},e:function(t){l=!0,i=t},f:function(){try{c||null==o.return||o.return()}finally{if(l)throw i}}}}(this.contents_);try{for(r.s();!(e=r.n()).done;){var n=e.value;if(n instanceof t.ToolboxCategory){o.push({kind:"LABEL",text:n.getName()});var i=n.getContents();"string"==typeof i&&(i={custom:i,kind:"CATEGORY"}),o=o.concat(i)}}}catch(t){r.e(t)}finally{r.f()}return o}},{key:"refreshSelection",value:function(){this.getFlyout().show(this.getInitialFlyoutContents_())}},{key:"updateFlyout_",value:function(t,e){if(e){var o=this.getFlyout().getCategoryScrollPosition(e.name_).y;this.getFlyout().scrollTo(o)}}},{key:"shouldDeselectItem_",value:function(t,e){return t&&t!==e}},{key:"getCategoryByName",value:function(e){return this.contents_.find((function(o){return o instanceof t.ToolboxCategory&&o.isSelectable()&&e===o.getName()}))||null}},{key:"selectCategoryByName",value:function(t){var e=this.getCategoryByName(t);if(e){var o=this.selectedItem_;this.shouldDeselectItem_(o,e)&&this.deselectItem_(o),this.shouldSelectItem_(o,e)&&this.selectItem_(o,e)}}},{key:"getClientRect",value:function(){var t=this.getFlyout();return t&&!t.autoClose?t.getClientRect():y(d(l.prototype),"getClientRect",this).call(this)}}])&&f(o.prototype,r),Object.defineProperty(o,"prototype",{writable:!1}),l}(t.Toolbox);function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function m(t,e){for(var o=0;o0&&void 0!==arguments[0]?arguments[0]:void 0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=_(P(c.prototype),"getScrollMetrics",this).call(this,t,e,o),n=o||this.getContentMetrics(t),i=e||this.getViewMetrics(t);return r&&(r.height+=this.flyout_.calculateBottomPadding(n,i)),r}}],o&&m(e.prototype,o),Object.defineProperty(e,"prototype",{writable:!1}),c}(t.FlyoutMetricsManager);function j(t){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(t)}function S(t,e){var o="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!o){if(Array.isArray(t)||(o=function(t,e){if(t){if("string"==typeof t)return R(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?R(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){o&&(t=o);var r=0,n=function(){};return{s:n,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,c=!0,l=!1;return{s:function(){o=o.call(t)},n:function(){var t=o.next();return c=t.done,t},e:function(t){l=!0,i=t},f:function(){try{c||null==o.return||o.return()}finally{if(l)throw i}}}}function R(t,e){(null==e||e>t.length)&&(e=t.length);for(var o=0,r=new Array(e);o=0;o--){var r=this.scrollPositions[o];if(e>=r.position.y)return void this.getParentToolbox_().selectCategoryByName(r.name)}}},{key:"scrollTo",value:function(t){var e=this.workspace_.getMetrics();this.scrollTarget=Math.min(t*this.workspace_.scale,e.scrollHeight-e.viewHeight),this.stepScrollAnimation_()}},{key:"stepScrollAnimation_",value:function(){if(this.scrollTarget){var t=-this.workspace_.scrollY,e=this.scrollTarget-t;if(Math.abs(e)<1)return this.workspace_.scrollbar.setY(this.scrollTarget),void(this.scrollTarget=null);this.workspace_.scrollbar.setY(t+e*this.scrollAnimationFraction),requestAnimationFrame(this.stepScrollAnimation_.bind(this))}}},{key:"calculateBottomPadding",value:function(t,e){if(this.scrollPositions.length>0){var o=this.scrollPositions[this.scrollPositions.length-1].position.y*this.workspace_.scale,r=t.height-o;if(r0&&void 0!==arguments[0]?arguments[0]:void 0,o=e?this.workspace_.scale:1,r=this.getSvgMetrics(),n=this.getToolboxMetrics(),i=this.getFlyoutMetrics(!1),c=n.position;return this.workspace_.getToolbox()&&(c==t.TOOLBOX_AT_TOP||c==t.TOOLBOX_AT_BOTTOM?r.height-=n.height+i.height:c!=t.TOOLBOX_AT_LEFT&&c!=t.TOOLBOX_AT_RIGHT||(r.width-=n.width+i.width)),{height:r.height/o,width:r.width/o,top:-this.workspace_.scrollY/o,left:-this.workspace_.scrollX/o}}},{key:"getAbsoluteMetrics",value:function(){var e=this.getToolboxMetrics(),o=this.getFlyoutMetrics(!1),r=e.position,n=0;this.workspace_.getToolbox()&&r==t.TOOLBOX_AT_LEFT&&(n=e.width+o.width);var i=0;return this.workspace_.getToolbox()&&r==t.TOOLBOX_AT_TOP&&(i=e.height+o.height),{top:i,left:n}}}],r&&D(o.prototype,r),Object.defineProperty(o,"prototype",{writable:!1}),l}(t.MetricsManager);t.registry.register(t.registry.Type.METRICS_MANAGER,"CustomMetricsManager",Y)})(),n})()}));