{"code":"(window.webpackJsonpGUI=window.webpackJsonpGUI||[]).push([[31],{1387:function(t,e,o){\"use strict\";const s=\"http://www.w3.org/2000/svg\",i=document.createElementNS(s,\"svg\");i.style.position=\"fixed\",i.style.top=\"-999999px\",i.style.width=\"0\",i.style.height=\"0\",document.body.appendChild(i);let n=0;const r=new WeakMap,l=t=>(r.get(t)||r.set(t,new Set),r.get(t)),c=(t,e)=>{let o;for(const t of e)(!o||t.priority>o.priority)&&(o=t);t.style.filter=o?o.filter:\"\"},a=(t,e)=>{const o=l(t);o.add(e),c(t,o)},u=(t,e)=>{const o=l(t);o.delete(e),c(t,o)};e.a=class{constructor(t,e){this.priority=t;const o=\"sa_glower_filter\".concat(n++);this.filter='url(\"#'.concat(o,'\")'),this.previousElements=new Set;const r=document.createElementNS(s,\"filter\");r.id=o,r.setAttribute(\"width\",\"180%\"),r.setAttribute(\"height\",\"160%\"),r.setAttribute(\"x\",\"-40%\"),r.setAttribute(\"y\",\"-30%\");const l=document.createElementNS(s,\"feGaussianBlur\");l.setAttribute(\"in\",\"SourceGraphic\"),l.setAttribute(\"stdDeviation\",\"4\"),r.appendChild(l);const c=document.createElementNS(s,\"feComponentTransfer\");c.setAttribute(\"result\",\"outBlur\"),r.appendChild(c);const a=document.createElementNS(s,\"feFuncA\");a.setAttribute(\"type\",\"table\"),a.setAttribute(\"tableValues\",\"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\"),c.appendChild(a);const u=document.createElementNS(s,\"feFlood\");u.setAttribute(\"flood-opacity\",\"1\"),u.setAttribute(\"result\",\"outColor\"),r.appendChild(u),this.filterFlood=u;const d=document.createElementNS(s,\"feComposite\");d.setAttribute(\"in\",\"outColor\"),d.setAttribute(\"in2\",\"outBlur\"),d.setAttribute(\"operator\",\"in\"),d.setAttribute(\"result\",\"outGlow\"),r.appendChild(d);const h=document.createElementNS(s,\"feComposite\");h.setAttribute(\"in\",\"SourceGraphic\"),h.setAttribute(\"in2\",\"outGlow\"),h.setAttribute(\"operator\",\"over\"),r.appendChild(h),i.appendChild(r),this.setColor(e)}setColor(t){this.filterFlood.setAttribute(\"flood-color\",t)}setGlowingThreads(t){const e=new Set,o=Blockly.getMainWorkspace();if(o)for(const s of t)s.stack.forEach((t=>{const i=o.getBlockById(t);if(!i)return;if(!s.stack.find((t=>{let e=i;for(;e.childBlocks_.length;)if(e=e.childBlocks_[e.childBlocks_.length-1],t===e.id)return!0;return!1}))&&i.svgPath_){const t=i.svgPath_;e.add(t)}}));for(const t of this.previousElements)e.has(t)||u(t,this);for(const t of e)this.previousElements.has(t)||a(t,this);this.previousElements=e}}},1592:function(t,e,o){\"use strict\";o.r(e),o.d(e,\"resources\",(function(){return n}));var s=o(1380),i=o(1387);const n={\"userscript.js\":async function(t){let{addon:e,console:o}=t;const n=e.tab.traps.vm,r=new i.a(0,e.settings.get(\"highlight-color\"));e.settings.addEventListener(\"change\",(()=>{r.setColor(e.settings.get(\"highlight-color\"))})),e.self.addEventListener(\"disabled\",(()=>{r.setGlowingThreads([])}));const l=n.runtime._step;n.runtime._step=function(){for(var t=arguments.length,o=new Array(t),i=0;ie!==t&&!e.target.blocks.forceNoGlow&&!e.isCompiled));r.setGlowingThreads(e)}}}}}}]);","name":"js/pentapod/addon-entry-editor-stepping.3906443f65cdf76ddaee.js","input":"(window[\"webpackJsonpGUI\"] = window[\"webpackJsonpGUI\"] || []).push([[31],{\n\n/***/ 1387:\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\nconst containerSvg = document.createElementNS(SVG_NS, \"svg\");\n// unfortunately we can't use display: none on this as that breaks filters\ncontainerSvg.style.position = \"fixed\";\ncontainerSvg.style.top = \"-999999px\";\ncontainerSvg.style.width = \"0\";\ncontainerSvg.style.height = \"0\";\ndocument.body.appendChild(containerSvg);\nlet nextGlowerId = 0;\nconst highlightsPerElement = new WeakMap();\nconst getHighlightersForElement = element => {\n if (!highlightsPerElement.get(element)) {\n highlightsPerElement.set(element, new Set());\n }\n return highlightsPerElement.get(element);\n};\nconst updateHighlight = (element, highlighters) => {\n let result;\n for (const i of highlighters) {\n if (!result || i.priority > result.priority) {\n result = i;\n }\n }\n if (result) {\n element.style.filter = result.filter;\n } else {\n element.style.filter = \"\";\n }\n};\nconst addHighlight = (element, highlighter) => {\n const highlighters = getHighlightersForElement(element);\n highlighters.add(highlighter);\n updateHighlight(element, highlighters);\n};\nconst removeHighlight = (element, highlighter) => {\n const highlighters = getHighlightersForElement(element);\n highlighters.delete(highlighter);\n updateHighlight(element, highlighters);\n};\nclass Highlighter {\n constructor(priority, color) {\n this.priority = priority;\n const id = \"sa_glower_filter\".concat(nextGlowerId++);\n this.filter = \"url(\\\"#\".concat(id, \"\\\")\");\n this.previousElements = new Set();\n const filterElement = document.createElementNS(SVG_NS, \"filter\");\n filterElement.id = id;\n filterElement.setAttribute(\"width\", \"180%\");\n filterElement.setAttribute(\"height\", \"160%\");\n filterElement.setAttribute(\"x\", \"-40%\");\n filterElement.setAttribute(\"y\", \"-30%\");\n const filterBlur = document.createElementNS(SVG_NS, \"feGaussianBlur\");\n filterBlur.setAttribute(\"in\", \"SourceGraphic\");\n filterBlur.setAttribute(\"stdDeviation\", \"4\");\n filterElement.appendChild(filterBlur);\n const filterTransfer = document.createElementNS(SVG_NS, \"feComponentTransfer\");\n filterTransfer.setAttribute(\"result\", \"outBlur\");\n filterElement.appendChild(filterTransfer);\n const filterTransferTable = document.createElementNS(SVG_NS, \"feFuncA\");\n filterTransferTable.setAttribute(\"type\", \"table\");\n filterTransferTable.setAttribute(\"tableValues\", \"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\");\n filterTransfer.appendChild(filterTransferTable);\n const filterFlood = document.createElementNS(SVG_NS, \"feFlood\");\n filterFlood.setAttribute(\"flood-opacity\", \"1\");\n filterFlood.setAttribute(\"result\", \"outColor\");\n filterElement.appendChild(filterFlood);\n this.filterFlood = filterFlood;\n const filterComposite = document.createElementNS(SVG_NS, \"feComposite\");\n filterComposite.setAttribute(\"in\", \"outColor\");\n filterComposite.setAttribute(\"in2\", \"outBlur\");\n filterComposite.setAttribute(\"operator\", \"in\");\n filterComposite.setAttribute(\"result\", \"outGlow\");\n filterElement.appendChild(filterComposite);\n const filterFinalComposite = document.createElementNS(SVG_NS, \"feComposite\");\n filterFinalComposite.setAttribute(\"in\", \"SourceGraphic\");\n filterFinalComposite.setAttribute(\"in2\", \"outGlow\");\n filterFinalComposite.setAttribute(\"operator\", \"over\");\n filterElement.appendChild(filterFinalComposite);\n containerSvg.appendChild(filterElement);\n this.setColor(color);\n }\n setColor(color) {\n this.filterFlood.setAttribute(\"flood-color\", color);\n }\n setGlowingThreads(threads) {\n const elementsToHighlight = new Set();\n const workspace = Blockly.getMainWorkspace();\n if (workspace) {\n for (const thread of threads) {\n thread.stack.forEach(blockId => {\n const block = workspace.getBlockById(blockId);\n if (!block) {\n return;\n }\n const childblock = thread.stack.find(i => {\n let b = block;\n while (b.childBlocks_.length) {\n b = b.childBlocks_[b.childBlocks_.length - 1];\n if (i === b.id) return true;\n }\n return false;\n });\n if (!childblock && block.svgPath_) {\n const svgPath = block.svgPath_;\n elementsToHighlight.add(svgPath);\n }\n });\n }\n }\n for (const element of this.previousElements) {\n if (!elementsToHighlight.has(element)) {\n removeHighlight(element, this);\n }\n }\n for (const element of elementsToHighlight) {\n if (!this.previousElements.has(element)) {\n addHighlight(element, this);\n }\n }\n this.previousElements = elementsToHighlight;\n }\n}\n/* harmony default export */ __webpack_exports__[\"a\"] = (Highlighter);\n\n/***/ }),\n\n/***/ 1592:\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n// ESM COMPAT FLAG\n__webpack_require__.r(__webpack_exports__);\n\n// EXPORTS\n__webpack_require__.d(__webpack_exports__, \"resources\", function() { return /* binding */ resources; });\n\n// EXTERNAL MODULE: ./src/addons/addons/debugger/module.js\nvar debugger_module = __webpack_require__(1380);\n\n// EXTERNAL MODULE: ./src/addons/addons/editor-stepping/highlighter.js\nvar editor_stepping_highlighter = __webpack_require__(1387);\n\n// CONCATENATED MODULE: ./src/addons/addons/editor-stepping/userscript.js\n\n\n/* harmony default export */ var userscript = (async function (_ref) {\n let {\n addon,\n console\n } = _ref;\n const vm = addon.tab.traps.vm;\n const highlighter = new editor_stepping_highlighter[\"a\" /* default */](0, addon.settings.get(\"highlight-color\"));\n addon.settings.addEventListener(\"change\", () => {\n highlighter.setColor(addon.settings.get(\"highlight-color\"));\n });\n addon.self.addEventListener(\"disabled\", () => {\n highlighter.setGlowingThreads([]);\n });\n const oldStep = vm.runtime._step;\n vm.runtime._step = function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n oldStep.call(this, ...args);\n if (!addon.self.disabled) {\n const runningThread = Object(debugger_module[\"a\" /* getRunningThread */])();\n const threads = vm.runtime.threads.filter(thread => thread !== runningThread && !thread.target.blocks.forceNoGlow && !thread.isCompiled);\n highlighter.setGlowingThreads(threads);\n }\n };\n});\n// CONCATENATED MODULE: ./src/addons/addons/editor-stepping/_runtime_entry.js\n/* generated by pull.js */\n\nconst resources = {\n \"userscript.js\": userscript\n};\n\n/***/ })\n\n}]);","inputSourceMap":null}