/*! For license information please see index.js.LICENSE.txt */ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("blockly/core"));else if("function"==typeof define&&define.amd)define(["blockly/core"],t);else{var i="object"==typeof exports?t(require("blockly/core")):t(e.Blockly);for(var n in i)("object"==typeof exports?exports:e)[n]=i[n]}}(this,(e=>(()=>{"use strict";var t={573:t=>{t.exports=e}},i={};function n(e){var r=i[e];if(void 0!==r)return r.exports;var o=i[e]={exports:{}};return t[e](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{n.r(r);var e=n(573),t=n.n(e);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return l(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?l(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}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 o,a=!0,u=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==i.return||i.return()}finally{if(u)throw o}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i0&&void 0!==arguments[0]?arguments[0]:void 0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return a(this,b),(e=g.call(this,t,i,n)).SERIALIZABLE=!0,null!==e.getValue()?(e.imgHeight_=e.getValue().length,e.imgWidth_=e.getValue()[0].length||0):(e.imgHeight_=n&&n.height||5,e.imgWidth_=n&&n.width||5),e.filledPixelColor_=n&&n.filledColor||y,e.emptyPixelColor_=n&&n.emptyColor||v,e.bgColor_=n&&n.bgColor||_,null===e.getValue()&&e.setValue(e.getEmptyArray_()),e.boundEvents_=[],e.editorPixels_=null,e.fieldGroup_=null,e.blockDisplayPixels_=null,e.mouseIsDown_=!1,e.valToPaintWith_=void 0,e}return i=b,n=[{key:"getImageWidth",value:function(){return this.imgWidth_}},{key:"getImageHeight",value:function(){return this.imgHeight_}},{key:"toXml",value:function(e){return e.textContent=JSON.stringify(this.getValue()),e}},{key:"saveState",value:function(e){var t=this.saveLegacyState(b);return null!==t?t:JSON.stringify(this.getValue())}},{key:"doClassValidation_",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(!t)return null;if("string"==typeof t)try{e=JSON.parse(t)}catch(e){return null}else{if(!Array.isArray(t))return null;e=t}var i=e.length;if(0==i)return null;var n,r=e[0].length,l=o(e);try{for(l.s();!(n=l.n()).done;){var a=n.value;if(!Array.isArray(a))return null;if(a.length!==r)return null}}catch(e){l.e(e)}finally{l.f()}var u,s=o(e);try{for(s.s();!(u=s.n()).done;){var c,f=u.value,h=o(f);try{for(h.s();!(c=h.n()).done;){var d=c.value;if(0!==d&&1!==d)return null}}catch(e){h.e(e)}finally{h.f()}}}catch(e){s.e(e)}finally{s.f()}return e}},{key:"doValueUpdate_",value:function(e){if(s(d(b.prototype),"doValueUpdate_",this).call(this,e),e){var t=e.length,i=e[0]?e[0].length:0;this.imgHeight_===t&&this.imgWidth_===i||(this.imgHeight_=t,this.imgWidth_=i),this.imgHeight_=e.length,this.imgWidth_=e[0]?e[0].length:0}}},{key:"showEditor_",value:function(){var e=this.dropdownCreate_();t().DropDownDiv.getContentDiv().appendChild(e),t().DropDownDiv.setColour(this.sourceBlock_.style.colourPrimary,this.sourceBlock_.style.colourTertiary),t().DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this))}},{key:"render_",value:function(){var e=this;s(d(b.prototype),"render_",this).call(this),this.getValue()&&this.blockDisplayPixels_&&this.forAllCells_((function(t,i){var n=e.getValue()[t][i];e.blockDisplayPixels_&&(e.blockDisplayPixels_[t][i].style.fill=n?e.filledPixelColor_:e.emptyPixelColor_),e.editorPixels_&&(e.editorPixels_[t][i].style.background=n?e.filledPixelColor_:e.emptyPixelColor_)}))}},{key:"updateEditable",value:function(){return!0}},{key:"dropdownCreate_",value:function(){var e,i,n,r,o=this,l=this.createElementWithClassname_("div","dropdownEditor"),a=this.createElementWithClassname_("div","pixelContainer");l.appendChild(a),this.bindEvent_(l,"mouseup",this.onMouseUp_),this.bindEvent_(l,"mouseleave",this.onMouseUp_),this.bindEvent_(l,"dragstart",(function(e){e.preventDefault()})),this.editorPixels_=[];for(var u=function(e){o.editorPixels_.push([]);for(var t=o.createElementWithClassname_("div","pixelRow"),i=function(i){var n=o.createElementWithClassname_("div","pixelButton");o.editorPixels_[e].push(n),t.appendChild(n);var r=o.getValue()[e][i];n.style.background=r?o.filledPixelColor_:o.emptyPixelColor_,o.bindEvent_(n,"mousedown",(function(){return o.onMouseDownInPixel_(e,i),!0})),o.bindEvent_(n,"mouseenter",(function(){o.onMouseEnterPixel_(e,i)}))},n=0;n