scratch-gui 4.0.1 → 4.0.7

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.
Files changed (31) hide show
  1. package/.github/workflows/ci-cd.yml +2 -2
  2. package/.nvmrc +1 -1
  3. package/CHANGELOG.md +45 -0
  4. package/dist/extension-worker.js +2 -0
  5. package/dist/extension-worker.js.LICENSE.txt +115 -0
  6. package/dist/extension-worker.js.map +1 -0
  7. package/dist/libraries/backdrops.json +1184 -0
  8. package/dist/libraries/costumes.json +12822 -0
  9. package/dist/libraries/sounds.json +4375 -0
  10. package/dist/libraries/sprites.json +17206 -0
  11. package/dist/scratch-gui.js +2 -1
  12. package/dist/{chunks/833.4bbf5b77396e51699161.js.LICENSE.txt → scratch-gui.js.LICENSE.txt} +30 -34
  13. package/dist/scratch-gui.js.map +1 -1
  14. package/pack/{scratch-gui-4.0.1.tgz → scratch-gui-4.0.7.tgz} +0 -0
  15. package/package.json +18 -23
  16. package/webpack.config.js +14 -52
  17. package/dist/chunks/833.4bbf5b77396e51699161.js +0 -2
  18. package/dist/runtime.js +0 -1
  19. /package/dist/{static/assets/scratch-microbit-1.2.0.30d09ba32a17082ef820.hex → 30d09ba32a17082ef820b57d52d60b7b.hex} +0 -0
  20. /package/dist/chunks/{am-steps.05e308dfe2686151dc0f.js → am-steps.3f73222d41015e1273dd.js} +0 -0
  21. /package/dist/chunks/{ar-steps.e9c85f3dc8e198eaaa12.js → ar-steps.70a4ffe7518d9f51857c.js} +0 -0
  22. /package/dist/chunks/{es-steps.b472eff86dac691d0bfd.js → es-steps.185d2537744e7847f007.js} +0 -0
  23. /package/dist/chunks/{fr-steps.bf4c30e02c2640204cad.js → fr-steps.7625c578b5499e062dee.js} +0 -0
  24. /package/dist/chunks/{ja-steps.5d5046e57e33733a503f.js → ja-steps.4400fdc64e70fbcf1b5d.js} +0 -0
  25. /package/dist/chunks/{pt_BR-steps.ea38088b1861a79930bb.js → pt_BR-steps.766aa6128e16c353d34c.js} +0 -0
  26. /package/dist/chunks/{sw-steps.c55c3dd1761feb3e8d83.js → sw-steps.49b087cb53763f2aac39.js} +0 -0
  27. /package/dist/chunks/{tr-steps.2cf369ed4ed2ef2111d8.js → tr-steps.d8fb1cdaa37d3a809c8d.js} +0 -0
  28. /package/dist/chunks/{uk-steps.e5a4ba6249fdc8c99272.js → uk-steps.138b26382fad2cc80545.js} +0 -0
  29. /package/dist/chunks/{zh_CN-steps.59ad9aafbcf84455c995.js → zh_CN-steps.4367f8310097c6618066.js} +0 -0
  30. /package/dist/chunks/{zh_TW-steps.7210c3dc836e5a46a84f.js → zh_TW-steps.4cdd3358855139a78ea7.js} +0 -0
  31. /package/dist/chunks/{zu-steps.acaf68fcef9e79e74f6b.js → zu-steps.f6818088b2be2d9f5c19.js} +0 -0
@@ -22,7 +22,7 @@ jobs:
22
22
  NODE_OPTIONS: --max-old-space-size=4000
23
23
  steps:
24
24
  - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
25
- - uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
25
+ - uses: actions/setup-node@26961cf329f22f6837d5f54c3efd76b480300ace # v4
26
26
  with:
27
27
  cache: "npm"
28
28
  node-version-file: ".nvmrc"
@@ -87,7 +87,7 @@ jobs:
87
87
  runs-on: ubuntu-latest
88
88
  steps:
89
89
  - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
90
- - uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
90
+ - uses: actions/setup-node@26961cf329f22f6837d5f54c3efd76b480300ace # v4
91
91
  with:
92
92
  cache: "npm"
93
93
  node-version-file: ".nvmrc"
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- 18
1
+ v20
package/CHANGELOG.md CHANGED
@@ -3,6 +3,51 @@
3
3
  All notable changes to this project will be documented in this file. See
4
4
  [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.0.7](https://github.com/scratchfoundation/scratch-gui/compare/v4.0.6...v4.0.7) (2024-08-08)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **deps:** lock file maintenance ([68c2da0](https://github.com/scratchfoundation/scratch-gui/commit/68c2da0402443421d2ea45e63a6c9e1155db2107))
12
+
13
+ ## [4.0.6](https://github.com/scratchfoundation/scratch-gui/compare/v4.0.5...v4.0.6) (2024-08-01)
14
+
15
+
16
+ ### Reverts
17
+
18
+ * Revert "ci: reduce package size" ([1054259](https://github.com/scratchfoundation/scratch-gui/commit/105425909c92cb5c162be2d03434e4338ec8cfa5))
19
+ * Revert "fix(package): don't omit src" ([d7c5f60](https://github.com/scratchfoundation/scratch-gui/commit/d7c5f60f808b5658457c9af2a3fe124d791aff9f))
20
+
21
+ ## [4.0.5](https://github.com/scratchfoundation/scratch-gui/compare/v4.0.4...v4.0.5) (2024-07-31)
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * [UEPR-27] Updated the css loader and added libraries to the build ([b7808e8](https://github.com/scratchfoundation/scratch-gui/commit/b7808e8d523ec48ddfb43e4de6ba1843a10f39be))
27
+ * [UEPR-30] Updated style-loader version to fix component not rendering ([509d294](https://github.com/scratchfoundation/scratch-gui/commit/509d294132dd27316049f98fbc2e842da2681969))
28
+
29
+ ## [4.0.4](https://github.com/scratchfoundation/scratch-gui/compare/v4.0.3...v4.0.4) (2024-04-24)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * **deps:** bump scratch-paint from 2.2.2 to 2.2.151 ([898bbfd](https://github.com/scratchfoundation/scratch-gui/commit/898bbfdc445dae4a716c2cc9bf6cdb68594f8886))
35
+ * **deps:** update dependency react-tooltip to v4 ([3c2afd1](https://github.com/scratchfoundation/scratch-gui/commit/3c2afd102a5c74c0b83f3b9654b926de235c31fc))
36
+
37
+ ## [4.0.3](https://github.com/scratchfoundation/scratch-gui/compare/v4.0.2...v4.0.3) (2024-04-12)
38
+
39
+
40
+ ### Bug Fixes
41
+
42
+ * force publish ([dbc8f1d](https://github.com/scratchfoundation/scratch-gui/commit/dbc8f1d6d116e51f6c39e65bc276b24901aa4e57))
43
+
44
+ ## [4.0.2](https://github.com/scratchfoundation/scratch-gui/compare/v4.0.1...v4.0.2) (2024-04-10)
45
+
46
+
47
+ ### Bug Fixes
48
+
49
+ * **package:** don't omit src ([8ffff71](https://github.com/scratchfoundation/scratch-gui/commit/8ffff71a5ea86c25e906f5c51024e3ca0aba6c9b))
50
+
6
51
  ## [4.0.1](https://github.com/scratchfoundation/scratch-gui/compare/v4.0.0...v4.0.1) (2024-04-10)
7
52
 
8
53
 
@@ -0,0 +1,2 @@
1
+ /*! For license information please see extension-worker.js.LICENSE.txt */
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VirtualMachine=t():e.VirtualMachine=t()}(self,(()=>(()=>{var e={"./src/dispatch/shared-dispatch.js":(e,t,n)=>{const o=n("./src/util/log.js");e.exports=class{constructor(){this.callbacks=[],this.nextResponseId=0}call(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return this.transferCall(e,t,null,...o)}transferCall(e,t,n){try{const{provider:s,isRemote:l}=this._getServiceProvider(e);if(s){for(var o=arguments.length,i=new Array(o>3?o-3:0),r=3;r<o;r++)i[r-3]=arguments[r];if(l)return this._remoteTransferCall(s,e,t,n,...i);const a=s[t].apply(s,i);return Promise.resolve(a)}return Promise.reject(new Error("Service not found: ".concat(e)))}catch(e){return Promise.reject(e)}}_isRemoteService(e){return this._getServiceProvider(e).isRemote}_remoteCall(e,t,n){for(var o=arguments.length,i=new Array(o>3?o-3:0),r=3;r<o;r++)i[r-3]=arguments[r];return this._remoteTransferCall(e,t,n,null,...i)}_remoteTransferCall(e,t,n,o){for(var i=arguments.length,r=new Array(i>4?i-4:0),s=4;s<i;s++)r[s-4]=arguments[s];return new Promise(((i,s)=>{const l=this._storeCallbacks(i,s);r.length>0&&"function"==typeof r[r.length-1].yield&&r.pop(),o?e.postMessage({service:t,method:n,responseId:l,args:r},o):e.postMessage({service:t,method:n,responseId:l,args:r})}))}_storeCallbacks(e,t){const n=this.nextResponseId++;return this.callbacks[n]=[e,t],n}_deliverResponse(e,t){try{const[n,o]=this.callbacks[e];delete this.callbacks[e],t.error?o(t.error):n(t.result)}catch(e){o.error("Dispatch callback failed: ".concat(JSON.stringify(e)))}}_onMessage(e,t){const n=t.data;let i;n.args=n.args||[],n.service?i="dispatch"===n.service?this._onDispatchMessage(e,n):this.call(n.service,n.method,...n.args):void 0===n.responseId?o.error("Dispatch caught malformed message from a worker: ".concat(JSON.stringify(t))):this._deliverResponse(n.responseId,n),i&&(void 0===n.responseId?o.error("Dispatch message missing required response ID: ".concat(JSON.stringify(t))):i.then((t=>e.postMessage({responseId:n.responseId,result:t})),(t=>e.postMessage({responseId:n.responseId,error:t}))))}_getServiceProvider(e){throw new Error("Could not get provider for ".concat(e,": _getServiceProvider not implemented"))}_onDispatchMessage(e,t){throw new Error("Unimplemented dispatch message handler cannot handle ".concat(t.method," method"))}}},"./src/dispatch/worker-dispatch.js":(e,t,n)=>{const o=n("./src/dispatch/shared-dispatch.js"),i=n("./src/util/log.js");e.exports=new class extends o{constructor(){super(),this._connectionPromise=new Promise((e=>{this._onConnect=e})),this.services={},this._onMessage=this._onMessage.bind(this,self),"undefined"!=typeof self&&(self.onmessage=this._onMessage)}get waitForConnection(){return this._connectionPromise}setService(e,t){return Object.prototype.hasOwnProperty.call(this.services,e)&&i.warn("Worker dispatch replacing existing service provider for ".concat(e)),this.services[e]=t,this.waitForConnection.then((()=>this._remoteCall(self,"dispatch","setService",e)))}_getServiceProvider(e){const t=this.services[e];return{provider:t||self,isRemote:!t}}_onDispatchMessage(e,t){let n;switch(t.method){case"handshake":n=this._onConnect();break;case"terminate":setTimeout((()=>self.close()),0),n=Promise.resolve();break;default:i.error("Worker dispatch received message for unknown method: ".concat(t.method))}return n}}},"./src/extension-support/argument-type.js":e=>{e.exports={ANGLE:"angle",BOOLEAN:"Boolean",COLOR:"color",NUMBER:"number",STRING:"string",MATRIX:"matrix",NOTE:"note",IMAGE:"image"}},"./src/extension-support/block-type.js":e=>{e.exports={BOOLEAN:"Boolean",BUTTON:"button",COMMAND:"command",CONDITIONAL:"conditional",EVENT:"event",HAT:"hat",LOOP:"loop",REPORTER:"reporter"}},"./src/extension-support/target-type.js":e=>{e.exports={SPRITE:"sprite",STAGE:"stage"}},"./src/util/log.js":(e,t,n)=>{const o=n("./node_modules/minilog/lib/web/index.js");o.enable(),e.exports=o("vm")},"./node_modules/microee/index.js":e=>{function t(){this._events={}}t.prototype={on:function(e,t){this._events||(this._events={});var n=this._events;return(n[e]||(n[e]=[])).push(t),this},removeListener:function(e,t){var n,o=this._events[e]||[];for(n=o.length-1;n>=0&&o[n];n--)o[n]!==t&&o[n].cb!==t||o.splice(n,1)},removeAllListeners:function(e){e?this._events[e]&&(this._events[e]=[]):this._events={}},listeners:function(e){return this._events&&this._events[e]||[]},emit:function(e){this._events||(this._events={});var t,n=Array.prototype.slice.call(arguments,1),o=this._events[e]||[];for(t=o.length-1;t>=0&&o[t];t--)o[t].apply(this,n);return this},when:function(e,t){return this.once(e,t,!0)},once:function(e,t,n){if(!t)return this;function o(){n||this.removeListener(e,o),t.apply(this,arguments)&&n&&this.removeListener(e,o)}return o.cb=t,this.on(e,o),this}},t.mixin=function(e){var n,o=t.prototype;for(n in o)o.hasOwnProperty(n)&&(e.prototype[n]=o[n])},e.exports=t},"./node_modules/minilog/lib/common/filter.js":(e,t,n)=>{var o=n("./node_modules/minilog/lib/common/transform.js"),i={debug:1,info:2,warn:3,error:4};function r(){this.enabled=!0,this.defaultResult=!0,this.clear()}function s(e,t){return e.n.test?e.n.test(t):e.n==t}o.mixin(r),r.prototype.allow=function(e,t){return this._white.push({n:e,l:i[t]}),this},r.prototype.deny=function(e,t){return this._black.push({n:e,l:i[t]}),this},r.prototype.clear=function(){return this._white=[],this._black=[],this},r.prototype.test=function(e,t){var n,o=Math.max(this._white.length,this._black.length);for(n=0;n<o;n++){if(this._white[n]&&s(this._white[n],e)&&i[t]>=this._white[n].l)return!0;if(this._black[n]&&s(this._black[n],e)&&i[t]<=this._black[n].l)return!1}return this.defaultResult},r.prototype.write=function(e,t,n){if(!this.enabled||this.test(e,t))return this.emit("item",e,t,n)},e.exports=r},"./node_modules/minilog/lib/common/minilog.js":(e,t,n)=>{var o=n("./node_modules/minilog/lib/common/transform.js"),i=n("./node_modules/minilog/lib/common/filter.js"),r=new o,s=Array.prototype.slice;(t=e.exports=function(e){var n=function(){return r.write(e,void 0,s.call(arguments)),n};return n.debug=function(){return r.write(e,"debug",s.call(arguments)),n},n.info=function(){return r.write(e,"info",s.call(arguments)),n},n.warn=function(){return r.write(e,"warn",s.call(arguments)),n},n.error=function(){return r.write(e,"error",s.call(arguments)),n},n.log=n.debug,n.suggest=t.suggest,n.format=r.format,n}).defaultBackend=t.defaultFormatter=null,t.pipe=function(e){return r.pipe(e)},t.end=t.unpipe=t.disable=function(e){return r.unpipe(e)},t.Transform=o,t.Filter=i,t.suggest=new i,t.enable=function(){return t.defaultFormatter?r.pipe(t.suggest).pipe(t.defaultFormatter).pipe(t.defaultBackend):r.pipe(t.suggest).pipe(t.defaultBackend)}},"./node_modules/minilog/lib/common/transform.js":(e,t,n)=>{function o(){}n("./node_modules/microee/index.js").mixin(o),o.prototype.write=function(e,t,n){this.emit("item",e,t,n)},o.prototype.end=function(){this.emit("end"),this.removeAllListeners()},o.prototype.pipe=function(e){var t=this;function n(){e.write.apply(e,Array.prototype.slice.call(arguments))}function o(){!e._isStdio&&e.end()}return t.emit("unpipe",e),e.emit("pipe",t),t.on("item",n),t.on("end",o),t.when("unpipe",(function(i){var r=i===e||void 0===i;return r&&(t.removeListener("item",n),t.removeListener("end",o),e.emit("unpipe")),r})),e},o.prototype.unpipe=function(e){return this.emit("unpipe",e),this},o.prototype.format=function(e){throw new Error(["Warning: .format() is deprecated in Minilog v2! Use .pipe() instead. For example:","var Minilog = require('minilog');","Minilog"," .pipe(Minilog.backends.console.formatClean)"," .pipe(Minilog.backends.console);"].join("\n"))},o.mixin=function(e){var t,n=o.prototype;for(t in n)n.hasOwnProperty(t)&&(e.prototype[t]=n[t])},e.exports=o},"./node_modules/minilog/lib/web/array.js":(e,t,n)=>{var o=n("./node_modules/minilog/lib/common/transform.js"),i=[],r=new o;r.write=function(e,t,n){i.push([e,t,n])},r.get=function(){return i},r.empty=function(){i=[]},e.exports=r},"./node_modules/minilog/lib/web/console.js":(e,t,n)=>{var o=n("./node_modules/minilog/lib/common/transform.js"),i=/\n+$/,r=new o;r.write=function(e,t,n){var o=n.length-1;if("undefined"!=typeof console&&console.log){if(console.log.apply)return console.log.apply(console,[e,t].concat(n));if(JSON&&JSON.stringify){n[o]&&"string"==typeof n[o]&&(n[o]=n[o].replace(i,""));try{for(o=0;o<n.length;o++)n[o]=JSON.stringify(n[o])}catch(e){}console.log(n.join(" "))}}},r.formatters=["color","minilog"],r.color=n("./node_modules/minilog/lib/web/formatters/color.js"),r.minilog=n("./node_modules/minilog/lib/web/formatters/minilog.js"),e.exports=r},"./node_modules/minilog/lib/web/formatters/color.js":(e,t,n)=>{var o=n("./node_modules/minilog/lib/common/transform.js"),i=n("./node_modules/minilog/lib/web/formatters/util.js"),r={debug:["cyan"],info:["purple"],warn:["yellow",!0],error:["red",!0]},s=new o;s.write=function(e,t,n){console.log,console[t]&&console[t].apply&&console[t].apply(console,["%c"+e+" %c"+t,i("gray"),i.apply(i,r[t])].concat(n))},s.pipe=function(){},e.exports=s},"./node_modules/minilog/lib/web/formatters/minilog.js":(e,t,n)=>{var o=n("./node_modules/minilog/lib/common/transform.js"),i=n("./node_modules/minilog/lib/web/formatters/util.js"),r={debug:["gray"],info:["purple"],warn:["yellow",!0],error:["red",!0]},s=new o;s.write=function(e,t,n){var o=console.log;"debug"!=t&&console[t]&&(o=console[t]);var s=0;if("info"!=t){for(;s<n.length&&"string"==typeof n[s];s++);o.apply(console,["%c"+e+" "+n.slice(0,s).join(" "),i.apply(i,r[t])].concat(n.slice(s)))}else o.apply(console,["%c"+e,i.apply(i,r[t])].concat(n))},s.pipe=function(){},e.exports=s},"./node_modules/minilog/lib/web/formatters/util.js":e=>{var t={black:"#000",red:"#c23621",green:"#25bc26",yellow:"#bbbb00",blue:"#492ee1",magenta:"#d338d3",cyan:"#33bbc8",gray:"#808080",purple:"#708"};e.exports=function(e,n){return n?"color: #fff; background: "+t[e]+";":"color: "+t[e]+";"}},"./node_modules/minilog/lib/web/index.js":(e,t,n)=>{var o=n("./node_modules/minilog/lib/common/minilog.js"),i=o.enable,r=o.disable,s="undefined"!=typeof navigator&&/chrome/i.test(navigator.userAgent),l=n("./node_modules/minilog/lib/web/console.js");if(o.defaultBackend=s?l.minilog:l,"undefined"!=typeof window){try{o.enable(JSON.parse(window.localStorage.minilogSettings))}catch(e){}if(window.location&&window.location.search){var a=RegExp("[?&]minilog=([^&]*)").exec(window.location.search);a&&o.enable(decodeURIComponent(a[1]))}}o.enable=function(){i.call(o,!0);try{window.localStorage.minilogSettings=JSON.stringify(!0)}catch(e){}return this},o.disable=function(){r.call(o);try{delete window.localStorage.minilogSettings}catch(e){}return this},(e.exports=o).backends={array:n("./node_modules/minilog/lib/web/array.js"),browser:o.defaultBackend,localStorage:n("./node_modules/minilog/lib/web/localstorage.js"),jQuery:n("./node_modules/minilog/lib/web/jquery_simple.js")}},"./node_modules/minilog/lib/web/jquery_simple.js":(e,t,n)=>{var o=n("./node_modules/minilog/lib/common/transform.js"),i=(new Date).valueOf().toString(36);function r(e){this.url=e.url||"",this.cache=[],this.timer=null,this.interval=e.interval||3e4,this.enabled=!0,this.jQuery=window.jQuery,this.extras={}}o.mixin(r),r.prototype.write=function(e,t,n){this.timer||this.init(),this.cache.push([e,t].concat(n))},r.prototype.init=function(){if(this.enabled&&this.jQuery){var e=this;this.timer=setTimeout((function(){var t,n,o=[],r=e.url;if(0==e.cache.length)return e.init();for(t=0;t<e.cache.length;t++)try{JSON.stringify(e.cache[t]),o.push(e.cache[t])}catch(e){}e.jQuery.isEmptyObject(e.extras)?(n=JSON.stringify({logs:o}),r=e.url+"?client_id="+i):n=JSON.stringify(e.jQuery.extend({logs:o},e.extras)),e.jQuery.ajax(r,{type:"POST",cache:!1,processData:!1,data:n,contentType:"application/json",timeout:1e4}).success((function(t,n,o){t.interval&&(e.interval=Math.max(1e3,t.interval))})).error((function(){e.interval=3e4})).always((function(){e.init()})),e.cache=[]}),this.interval)}},r.prototype.end=function(){},r.jQueryWait=function(e){if("undefined"!=typeof window&&(window.jQuery||window.$))return e(window.jQuery||window.$);"undefined"!=typeof window&&setTimeout((function(){r.jQueryWait(e)}),200)},e.exports=r},"./node_modules/minilog/lib/web/localstorage.js":(e,t,n)=>{var o=n("./node_modules/minilog/lib/common/transform.js"),i=!1,r=new o;r.write=function(e,t,n){if("undefined"!=typeof window&&"undefined"!=typeof JSON&&JSON.stringify&&JSON.parse)try{i||(i=window.localStorage.minilog?JSON.parse(window.localStorage.minilog):[]),i.push([(new Date).toString(),e,t,n]),window.localStorage.minilog=JSON.stringify(i)}catch(e){}},e.exports=r}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();const o=n("./src/extension-support/argument-type.js"),i=n("./src/extension-support/block-type.js"),r=n("./src/dispatch/worker-dispatch.js"),s=n("./src/extension-support/target-type.js");n.g.Scratch=n.g.Scratch||{},n.g.Scratch.ArgumentType=o,n.g.Scratch.BlockType=i,n.g.Scratch.TargetType=s;const l=new class{constructor(){this.nextExtensionId=0,this.initialRegistrations=[],r.waitForConnection.then((()=>{r.call("extensions","allocateWorker").then((e=>{const[t,n]=e;this.workerId=t;try{importScripts(n);const e=this.initialRegistrations;this.initialRegistrations=null,Promise.all(e).then((()=>r.call("extensions","onWorkerInit",t)))}catch(e){r.call("extensions","onWorkerInit",t,e)}}))})),this.extensions=[]}register(e){const t=this.nextExtensionId++;this.extensions.push(e);const n="extension.".concat(this.workerId,".").concat(t),o=r.setService(n,e).then((()=>r.call("extensions","registerExtensionService",n)));return this.initialRegistrations&&this.initialRegistrations.push(o),o}};return n.g.Scratch.extensions={register:l.register.bind(l)},{}})()));
@@ -0,0 +1,115 @@
1
+ /*! ../../common/transform.js */
2
+
3
+ /*! ../common/minilog.js */
4
+
5
+ /*! ../common/transform.js */
6
+
7
+ /*! ../dispatch/worker-dispatch */
8
+
9
+ /*! ../extension-support/argument-type */
10
+
11
+ /*! ../extension-support/block-type */
12
+
13
+ /*! ../extension-support/target-type */
14
+
15
+ /*! ../util/log */
16
+
17
+ /*! ./array.js */
18
+
19
+ /*! ./console.js */
20
+
21
+ /*! ./filter.js */
22
+
23
+ /*! ./formatters/color.js */
24
+
25
+ /*! ./formatters/minilog.js */
26
+
27
+ /*! ./jquery_simple.js */
28
+
29
+ /*! ./localstorage.js */
30
+
31
+ /*! ./shared-dispatch */
32
+
33
+ /*! ./transform.js */
34
+
35
+ /*! ./util.js */
36
+
37
+ /*! microee */
38
+
39
+ /*! minilog */
40
+
41
+ /*!*************************!*\
42
+ !*** ./src/util/log.js ***!
43
+ \*************************/
44
+
45
+ /*!***************************************!*\
46
+ !*** ./node_modules/microee/index.js ***!
47
+ \***************************************/
48
+
49
+ /*!*****************************************!*\
50
+ !*** ./src/dispatch/shared-dispatch.js ***!
51
+ \*****************************************/
52
+
53
+ /*!*****************************************!*\
54
+ !*** ./src/dispatch/worker-dispatch.js ***!
55
+ \*****************************************/
56
+
57
+ /*!*********************************************!*\
58
+ !*** ./src/extension-support/block-type.js ***!
59
+ \*********************************************/
60
+
61
+ /*!**********************************************!*\
62
+ !*** ./src/extension-support/target-type.js ***!
63
+ \**********************************************/
64
+
65
+ /*!***********************************************!*\
66
+ !*** ./node_modules/minilog/lib/web/array.js ***!
67
+ \***********************************************/
68
+
69
+ /*!***********************************************!*\
70
+ !*** ./node_modules/minilog/lib/web/index.js ***!
71
+ \***********************************************/
72
+
73
+ /*!************************************************!*\
74
+ !*** ./src/extension-support/argument-type.js ***!
75
+ \************************************************/
76
+
77
+ /*!*************************************************!*\
78
+ !*** ./node_modules/minilog/lib/web/console.js ***!
79
+ \*************************************************/
80
+
81
+ /*!***************************************************!*\
82
+ !*** ./node_modules/minilog/lib/common/filter.js ***!
83
+ \***************************************************/
84
+
85
+ /*!***************************************************!*\
86
+ !*** ./src/extension-support/extension-worker.js ***!
87
+ \***************************************************/
88
+
89
+ /*!****************************************************!*\
90
+ !*** ./node_modules/minilog/lib/common/minilog.js ***!
91
+ \****************************************************/
92
+
93
+ /*!******************************************************!*\
94
+ !*** ./node_modules/minilog/lib/common/transform.js ***!
95
+ \******************************************************/
96
+
97
+ /*!******************************************************!*\
98
+ !*** ./node_modules/minilog/lib/web/localstorage.js ***!
99
+ \******************************************************/
100
+
101
+ /*!*******************************************************!*\
102
+ !*** ./node_modules/minilog/lib/web/jquery_simple.js ***!
103
+ \*******************************************************/
104
+
105
+ /*!*********************************************************!*\
106
+ !*** ./node_modules/minilog/lib/web/formatters/util.js ***!
107
+ \*********************************************************/
108
+
109
+ /*!**********************************************************!*\
110
+ !*** ./node_modules/minilog/lib/web/formatters/color.js ***!
111
+ \**********************************************************/
112
+
113
+ /*!************************************************************!*\
114
+ !*** ./node_modules/minilog/lib/web/formatters/minilog.js ***!
115
+ \************************************************************/
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-worker.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACVA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AAAA;AAHA;AAAA;AAIA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;;AC1OA;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;;AC7GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;;AChBA;AACA;AAEA;;;;;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACvDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AC5CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACvEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACzEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACPA;;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack://VirtualMachine/webpack/universalModuleDefinition","webpack://VirtualMachine/./src/dispatch/shared-dispatch.js","webpack://VirtualMachine/./src/dispatch/worker-dispatch.js","webpack://VirtualMachine/./src/extension-support/argument-type.js","webpack://VirtualMachine/./src/extension-support/block-type.js","webpack://VirtualMachine/./src/extension-support/target-type.js","webpack://VirtualMachine/./src/util/log.js","webpack://VirtualMachine/./node_modules/microee/index.js","webpack://VirtualMachine/./node_modules/minilog/lib/common/filter.js","webpack://VirtualMachine/./node_modules/minilog/lib/common/minilog.js","webpack://VirtualMachine/./node_modules/minilog/lib/common/transform.js","webpack://VirtualMachine/./node_modules/minilog/lib/web/array.js","webpack://VirtualMachine/./node_modules/minilog/lib/web/console.js","webpack://VirtualMachine/./node_modules/minilog/lib/web/formatters/color.js","webpack://VirtualMachine/./node_modules/minilog/lib/web/formatters/minilog.js","webpack://VirtualMachine/./node_modules/minilog/lib/web/formatters/util.js","webpack://VirtualMachine/./node_modules/minilog/lib/web/index.js","webpack://VirtualMachine/./node_modules/minilog/lib/web/jquery_simple.js","webpack://VirtualMachine/./node_modules/minilog/lib/web/localstorage.js","webpack://VirtualMachine/webpack/bootstrap","webpack://VirtualMachine/webpack/runtime/global","webpack://VirtualMachine/./src/extension-support/extension-worker.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"VirtualMachine\"] = factory();\n\telse\n\t\troot[\"VirtualMachine\"] = factory();\n})(self, () => {\nreturn ","const log = require('../util/log');\n\n/**\n * @typedef {object} DispatchCallMessage - a message to the dispatch system representing a service method call\n * @property {*} responseId - send a response message with this response ID. See {@link DispatchResponseMessage}\n * @property {string} service - the name of the service to be called\n * @property {string} method - the name of the method to be called\n * @property {Array|undefined} args - the arguments to be passed to the method\n */\n\n/**\n * @typedef {object} DispatchResponseMessage - a message to the dispatch system representing the results of a call\n * @property {*} responseId - a copy of the response ID from the call which generated this response\n * @property {*|undefined} error - if this is truthy, then it contains results from a failed call (such as an exception)\n * @property {*|undefined} result - if error is not truthy, then this contains the return value of the call (if any)\n */\n\n/**\n * @typedef {DispatchCallMessage|DispatchResponseMessage} DispatchMessage\n * Any message to the dispatch system.\n */\n\n/**\n * The SharedDispatch class is responsible for dispatch features shared by\n * {@link CentralDispatch} and {@link WorkerDispatch}.\n */\nclass SharedDispatch {\n constructor () {\n /**\n * List of callback registrations for promises waiting for a response from a call to a service on another\n * worker. A callback registration is an array of [resolve,reject] Promise functions.\n * Calls to local services don't enter this list.\n * @type {Array.<Function[]>}\n */\n this.callbacks = [];\n\n /**\n * The next response ID to be used.\n * @type {int}\n */\n this.nextResponseId = 0;\n }\n\n /**\n * Call a particular method on a particular service, regardless of whether that service is provided locally or on\n * a worker. If the service is provided by a worker, the `args` will be copied using the Structured Clone\n * algorithm, except for any items which are also in the `transfer` list. Ownership of those items will be\n * transferred to the worker, and they should not be used after this call.\n * @example\n * dispatcher.call('vm', 'setData', 'cat', 42);\n * // this finds the worker for the 'vm' service, then on that worker calls:\n * vm.setData('cat', 42);\n * @param {string} service - the name of the service.\n * @param {string} method - the name of the method.\n * @param {*} [args] - the arguments to be copied to the method, if any.\n * @returns {Promise} - a promise for the return value of the service method.\n */\n call (service, method, ...args) {\n return this.transferCall(service, method, null, ...args);\n }\n\n /**\n * Call a particular method on a particular service, regardless of whether that service is provided locally or on\n * a worker. If the service is provided by a worker, the `args` will be copied using the Structured Clone\n * algorithm, except for any items which are also in the `transfer` list. Ownership of those items will be\n * transferred to the worker, and they should not be used after this call.\n * @example\n * dispatcher.transferCall('vm', 'setData', [myArrayBuffer], 'cat', myArrayBuffer);\n * // this finds the worker for the 'vm' service, transfers `myArrayBuffer` to it, then on that worker calls:\n * vm.setData('cat', myArrayBuffer);\n * @param {string} service - the name of the service.\n * @param {string} method - the name of the method.\n * @param {Array} [transfer] - objects to be transferred instead of copied. Must be present in `args` to be useful.\n * @param {*} [args] - the arguments to be copied to the method, if any.\n * @returns {Promise} - a promise for the return value of the service method.\n */\n transferCall (service, method, transfer, ...args) {\n try {\n const {provider, isRemote} = this._getServiceProvider(service);\n if (provider) {\n if (isRemote) {\n return this._remoteTransferCall(provider, service, method, transfer, ...args);\n }\n\n // TODO: verify correct `this` after switching from apply to spread\n // eslint-disable-next-line prefer-spread\n const result = provider[method].apply(provider, args);\n return Promise.resolve(result);\n }\n return Promise.reject(new Error(`Service not found: ${service}`));\n } catch (e) {\n return Promise.reject(e);\n }\n }\n\n /**\n * Check if a particular service lives on another worker.\n * @param {string} service - the service to check.\n * @returns {boolean} - true if the service is remote (calls must cross a Worker boundary), false otherwise.\n * @private\n */\n _isRemoteService (service) {\n return this._getServiceProvider(service).isRemote;\n }\n\n /**\n * Like {@link call}, but force the call to be posted through a particular communication channel.\n * @param {object} provider - send the call through this object's `postMessage` function.\n * @param {string} service - the name of the service.\n * @param {string} method - the name of the method.\n * @param {*} [args] - the arguments to be copied to the method, if any.\n * @returns {Promise} - a promise for the return value of the service method.\n */\n _remoteCall (provider, service, method, ...args) {\n return this._remoteTransferCall(provider, service, method, null, ...args);\n }\n\n /**\n * Like {@link transferCall}, but force the call to be posted through a particular communication channel.\n * @param {object} provider - send the call through this object's `postMessage` function.\n * @param {string} service - the name of the service.\n * @param {string} method - the name of the method.\n * @param {Array} [transfer] - objects to be transferred instead of copied. Must be present in `args` to be useful.\n * @param {*} [args] - the arguments to be copied to the method, if any.\n * @returns {Promise} - a promise for the return value of the service method.\n */\n _remoteTransferCall (provider, service, method, transfer, ...args) {\n return new Promise((resolve, reject) => {\n const responseId = this._storeCallbacks(resolve, reject);\n\n /** @TODO: remove this hack! this is just here so we don't try to send `util` to a worker */\n if ((args.length > 0) && (typeof args[args.length - 1].yield === 'function')) {\n args.pop();\n }\n\n if (transfer) {\n provider.postMessage({service, method, responseId, args}, transfer);\n } else {\n provider.postMessage({service, method, responseId, args});\n }\n });\n }\n\n /**\n * Store callback functions pending a response message.\n * @param {Function} resolve - function to call if the service method returns.\n * @param {Function} reject - function to call if the service method throws.\n * @returns {*} - a unique response ID for this set of callbacks. See {@link _deliverResponse}.\n * @protected\n */\n _storeCallbacks (resolve, reject) {\n const responseId = this.nextResponseId++;\n this.callbacks[responseId] = [resolve, reject];\n return responseId;\n }\n\n /**\n * Deliver call response from a worker. This should only be called as the result of a message from a worker.\n * @param {int} responseId - the response ID of the callback set to call.\n * @param {DispatchResponseMessage} message - the message containing the response value(s).\n * @protected\n */\n _deliverResponse (responseId, message) {\n try {\n const [resolve, reject] = this.callbacks[responseId];\n delete this.callbacks[responseId];\n if (message.error) {\n reject(message.error);\n } else {\n resolve(message.result);\n }\n } catch (e) {\n log.error(`Dispatch callback failed: ${JSON.stringify(e)}`);\n }\n }\n\n /**\n * Handle a message event received from a connected worker.\n * @param {Worker} worker - the worker which sent the message, or the global object if running in a worker.\n * @param {MessageEvent} event - the message event to be handled.\n * @protected\n */\n _onMessage (worker, event) {\n /** @type {DispatchMessage} */\n const message = event.data;\n message.args = message.args || [];\n let promise;\n if (message.service) {\n if (message.service === 'dispatch') {\n promise = this._onDispatchMessage(worker, message);\n } else {\n promise = this.call(message.service, message.method, ...message.args);\n }\n } else if (typeof message.responseId === 'undefined') {\n log.error(`Dispatch caught malformed message from a worker: ${JSON.stringify(event)}`);\n } else {\n this._deliverResponse(message.responseId, message);\n }\n if (promise) {\n if (typeof message.responseId === 'undefined') {\n log.error(`Dispatch message missing required response ID: ${JSON.stringify(event)}`);\n } else {\n promise.then(\n result => worker.postMessage({responseId: message.responseId, result}),\n error => worker.postMessage({responseId: message.responseId, error})\n );\n }\n }\n }\n\n /**\n * Fetch the service provider object for a particular service name.\n * @abstract\n * @param {string} service - the name of the service to look up\n * @returns {{provider:(object|Worker), isRemote:boolean}} - the means to contact the service, if found\n * @protected\n */\n _getServiceProvider (service) {\n throw new Error(`Could not get provider for ${service}: _getServiceProvider not implemented`);\n }\n\n /**\n * Handle a call message sent to the dispatch service itself\n * @abstract\n * @param {Worker} worker - the worker which sent the message.\n * @param {DispatchCallMessage} message - the message to be handled.\n * @returns {Promise|undefined} - a promise for the results of this operation, if appropriate\n * @private\n */\n _onDispatchMessage (worker, message) {\n throw new Error(`Unimplemented dispatch message handler cannot handle ${message.method} method`);\n }\n}\n\nmodule.exports = SharedDispatch;\n","const SharedDispatch = require('./shared-dispatch');\n\nconst log = require('../util/log');\n\n/**\n * This class provides a Worker with the means to participate in the message dispatch system managed by CentralDispatch.\n * From any context in the messaging system, the dispatcher's \"call\" method can call any method on any \"service\"\n * provided in any participating context. The dispatch system will forward function arguments and return values across\n * worker boundaries as needed.\n * @see {CentralDispatch}\n */\nclass WorkerDispatch extends SharedDispatch {\n constructor () {\n super();\n\n /**\n * This promise will be resolved when we have successfully connected to central dispatch.\n * @type {Promise}\n * @see {waitForConnection}\n * @private\n */\n this._connectionPromise = new Promise(resolve => {\n this._onConnect = resolve;\n });\n\n /**\n * Map of service name to local service provider.\n * If a service is not listed here, it is assumed to be provided by another context (another Worker or the main\n * thread).\n * @see {setService}\n * @type {object}\n */\n this.services = {};\n\n this._onMessage = this._onMessage.bind(this, self);\n if (typeof self !== 'undefined') {\n self.onmessage = this._onMessage;\n }\n }\n\n /**\n * @returns {Promise} a promise which will resolve upon connection to central dispatch. If you need to make a call\n * immediately on \"startup\" you can attach a 'then' to this promise.\n * @example\n * dispatch.waitForConnection.then(() => {\n * dispatch.call('myService', 'hello');\n * })\n */\n get waitForConnection () {\n return this._connectionPromise;\n }\n\n /**\n * Set a local object as the global provider of the specified service.\n * WARNING: Any method on the provider can be called from any worker within the dispatch system.\n * @param {string} service - a globally unique string identifying this service. Examples: 'vm', 'gui', 'extension9'.\n * @param {object} provider - a local object which provides this service.\n * @returns {Promise} - a promise which will resolve once the service is registered.\n */\n setService (service, provider) {\n if (Object.prototype.hasOwnProperty.call(this.services, service)) {\n log.warn(`Worker dispatch replacing existing service provider for ${service}`);\n }\n this.services[service] = provider;\n return this.waitForConnection.then(() => this._remoteCall(self, 'dispatch', 'setService', service));\n }\n\n /**\n * Fetch the service provider object for a particular service name.\n * @override\n * @param {string} service - the name of the service to look up\n * @returns {{provider:(object|Worker), isRemote:boolean}} - the means to contact the service, if found\n * @protected\n */\n _getServiceProvider (service) {\n // if we don't have a local service by this name, contact central dispatch by calling `postMessage` on self\n const provider = this.services[service];\n return {\n provider: provider || self,\n isRemote: !provider\n };\n }\n\n /**\n * Handle a call message sent to the dispatch service itself\n * @override\n * @param {Worker} worker - the worker which sent the message.\n * @param {DispatchCallMessage} message - the message to be handled.\n * @returns {Promise|undefined} - a promise for the results of this operation, if appropriate\n * @protected\n */\n _onDispatchMessage (worker, message) {\n let promise;\n switch (message.method) {\n case 'handshake':\n promise = this._onConnect();\n break;\n case 'terminate':\n // Don't close until next tick, after sending confirmation back\n setTimeout(() => self.close(), 0);\n promise = Promise.resolve();\n break;\n default:\n log.error(`Worker dispatch received message for unknown method: ${message.method}`);\n }\n return promise;\n }\n}\n\nmodule.exports = new WorkerDispatch();\n","/**\n * Block argument types\n * @enum {string}\n */\nconst ArgumentType = {\n /**\n * Numeric value with angle picker\n */\n ANGLE: 'angle',\n\n /**\n * Boolean value with hexagonal placeholder\n */\n BOOLEAN: 'Boolean',\n\n /**\n * Numeric value with color picker\n */\n COLOR: 'color',\n\n /**\n * Numeric value with text field\n */\n NUMBER: 'number',\n\n /**\n * String value with text field\n */\n STRING: 'string',\n\n /**\n * String value with matrix field\n */\n MATRIX: 'matrix',\n\n /**\n * MIDI note number with note picker (piano) field\n */\n NOTE: 'note',\n\n /**\n * Inline image on block (as part of the label)\n */\n IMAGE: 'image'\n};\n\nmodule.exports = ArgumentType;\n","/**\n * Types of block\n * @enum {string}\n */\nconst BlockType = {\n /**\n * Boolean reporter with hexagonal shape\n */\n BOOLEAN: 'Boolean',\n\n /**\n * A button (not an actual block) for some special action, like making a variable\n */\n BUTTON: 'button',\n\n /**\n * Command block\n */\n COMMAND: 'command',\n\n /**\n * Specialized command block which may or may not run a child branch\n * The thread continues with the next block whether or not a child branch ran.\n */\n CONDITIONAL: 'conditional',\n\n /**\n * Specialized hat block with no implementation function\n * This stack only runs if the corresponding event is emitted by other code.\n */\n EVENT: 'event',\n\n /**\n * Hat block which conditionally starts a block stack\n */\n HAT: 'hat',\n\n /**\n * Specialized command block which may or may not run a child branch\n * If a child branch runs, the thread evaluates the loop block again.\n */\n LOOP: 'loop',\n\n /**\n * General reporter with numeric or string value\n */\n REPORTER: 'reporter'\n};\n\nmodule.exports = BlockType;\n","/**\n * Default types of Target supported by the VM\n * @enum {string}\n */\nconst TargetType = {\n /**\n * Rendered target which can move, change costumes, etc.\n */\n SPRITE: 'sprite',\n\n /**\n * Rendered target which cannot move but can change backdrops\n */\n STAGE: 'stage'\n};\n\nmodule.exports = TargetType;\n","const minilog = require('minilog');\nminilog.enable();\n\nmodule.exports = minilog('vm');\n","function M() { this._events = {}; }\nM.prototype = {\n on: function(ev, cb) {\n this._events || (this._events = {});\n var e = this._events;\n (e[ev] || (e[ev] = [])).push(cb);\n return this;\n },\n removeListener: function(ev, cb) {\n var e = this._events[ev] || [], i;\n for(i = e.length-1; i >= 0 && e[i]; i--){\n if(e[i] === cb || e[i].cb === cb) { e.splice(i, 1); }\n }\n },\n removeAllListeners: function(ev) {\n if(!ev) { this._events = {}; }\n else { this._events[ev] && (this._events[ev] = []); }\n },\n listeners: function(ev) {\n return (this._events ? this._events[ev] || [] : []);\n },\n emit: function(ev) {\n this._events || (this._events = {});\n var args = Array.prototype.slice.call(arguments, 1), i, e = this._events[ev] || [];\n for(i = e.length-1; i >= 0 && e[i]; i--){\n e[i].apply(this, args);\n }\n return this;\n },\n when: function(ev, cb) {\n return this.once(ev, cb, true);\n },\n once: function(ev, cb, when) {\n if(!cb) return this;\n function c() {\n if(!when) this.removeListener(ev, c);\n if(cb.apply(this, arguments) && when) this.removeListener(ev, c);\n }\n c.cb = cb;\n this.on(ev, c);\n return this;\n }\n};\nM.mixin = function(dest) {\n var o = M.prototype, k;\n for (k in o) {\n o.hasOwnProperty(k) && (dest.prototype[k] = o[k]);\n }\n};\nmodule.exports = M;\n","// default filter\nvar Transform = require('./transform.js');\n\nvar levelMap = { debug: 1, info: 2, warn: 3, error: 4 };\n\nfunction Filter() {\n this.enabled = true;\n this.defaultResult = true;\n this.clear();\n}\n\nTransform.mixin(Filter);\n\n// allow all matching, with level >= given level\nFilter.prototype.allow = function(name, level) {\n this._white.push({ n: name, l: levelMap[level] });\n return this;\n};\n\n// deny all matching, with level <= given level\nFilter.prototype.deny = function(name, level) {\n this._black.push({ n: name, l: levelMap[level] });\n return this;\n};\n\nFilter.prototype.clear = function() {\n this._white = [];\n this._black = [];\n return this;\n};\n\nfunction test(rule, name) {\n // use .test for RegExps\n return (rule.n.test ? rule.n.test(name) : rule.n == name);\n};\n\nFilter.prototype.test = function(name, level) {\n var i, len = Math.max(this._white.length, this._black.length);\n for(i = 0; i < len; i++) {\n if(this._white[i] && test(this._white[i], name) && levelMap[level] >= this._white[i].l) {\n return true;\n }\n if(this._black[i] && test(this._black[i], name) && levelMap[level] <= this._black[i].l) {\n return false;\n }\n }\n return this.defaultResult;\n};\n\nFilter.prototype.write = function(name, level, args) {\n if(!this.enabled || this.test(name, level)) {\n return this.emit('item', name, level, args);\n }\n};\n\nmodule.exports = Filter;\n","var Transform = require('./transform.js'),\n Filter = require('./filter.js');\n\nvar log = new Transform(),\n slice = Array.prototype.slice;\n\nexports = module.exports = function create(name) {\n var o = function() { log.write(name, undefined, slice.call(arguments)); return o; };\n o.debug = function() { log.write(name, 'debug', slice.call(arguments)); return o; };\n o.info = function() { log.write(name, 'info', slice.call(arguments)); return o; };\n o.warn = function() { log.write(name, 'warn', slice.call(arguments)); return o; };\n o.error = function() { log.write(name, 'error', slice.call(arguments)); return o; };\n o.log = o.debug; // for interface compliance with Node and browser consoles\n o.suggest = exports.suggest;\n o.format = log.format;\n return o;\n};\n\n// filled in separately\nexports.defaultBackend = exports.defaultFormatter = null;\n\nexports.pipe = function(dest) {\n return log.pipe(dest);\n};\n\nexports.end = exports.unpipe = exports.disable = function(from) {\n return log.unpipe(from);\n};\n\nexports.Transform = Transform;\nexports.Filter = Filter;\n// this is the default filter that's applied when .enable() is called normally\n// you can bypass it completely and set up your own pipes\nexports.suggest = new Filter();\n\nexports.enable = function() {\n if(exports.defaultFormatter) {\n return log.pipe(exports.suggest) // filter\n .pipe(exports.defaultFormatter) // formatter\n .pipe(exports.defaultBackend); // backend\n }\n return log.pipe(exports.suggest) // filter\n .pipe(exports.defaultBackend); // formatter\n};\n\n","var microee = require('microee');\n\n// Implements a subset of Node's stream.Transform - in a cross-platform manner.\nfunction Transform() {}\n\nmicroee.mixin(Transform);\n\n// The write() signature is different from Node's\n// --> makes it much easier to work with objects in logs.\n// One of the lessons from v1 was that it's better to target\n// a good browser rather than the lowest common denominator\n// internally.\n// If you want to use external streams, pipe() to ./stringify.js first.\nTransform.prototype.write = function(name, level, args) {\n this.emit('item', name, level, args);\n};\n\nTransform.prototype.end = function() {\n this.emit('end');\n this.removeAllListeners();\n};\n\nTransform.prototype.pipe = function(dest) {\n var s = this;\n // prevent double piping\n s.emit('unpipe', dest);\n // tell the dest that it's being piped to\n dest.emit('pipe', s);\n\n function onItem() {\n dest.write.apply(dest, Array.prototype.slice.call(arguments));\n }\n function onEnd() { !dest._isStdio && dest.end(); }\n\n s.on('item', onItem);\n s.on('end', onEnd);\n\n s.when('unpipe', function(from) {\n var match = (from === dest) || typeof from == 'undefined';\n if(match) {\n s.removeListener('item', onItem);\n s.removeListener('end', onEnd);\n dest.emit('unpipe');\n }\n return match;\n });\n\n return dest;\n};\n\nTransform.prototype.unpipe = function(from) {\n this.emit('unpipe', from);\n return this;\n};\n\nTransform.prototype.format = function(dest) {\n throw new Error([\n 'Warning: .format() is deprecated in Minilog v2! Use .pipe() instead. For example:',\n 'var Minilog = require(\\'minilog\\');',\n 'Minilog',\n ' .pipe(Minilog.backends.console.formatClean)',\n ' .pipe(Minilog.backends.console);'].join('\\n'));\n};\n\nTransform.mixin = function(dest) {\n var o = Transform.prototype, k;\n for (k in o) {\n o.hasOwnProperty(k) && (dest.prototype[k] = o[k]);\n }\n};\n\nmodule.exports = Transform;\n","var Transform = require('../common/transform.js'),\n cache = [ ];\n\nvar logger = new Transform();\n\nlogger.write = function(name, level, args) {\n cache.push([ name, level, args ]);\n};\n\n// utility functions\nlogger.get = function() { return cache; };\nlogger.empty = function() { cache = []; };\n\nmodule.exports = logger;\n","var Transform = require('../common/transform.js');\n\nvar newlines = /\\n+$/,\n logger = new Transform();\n\nlogger.write = function(name, level, args) {\n var i = args.length-1;\n if (typeof console === 'undefined' || !console.log) {\n return;\n }\n if(console.log.apply) {\n return console.log.apply(console, [name, level].concat(args));\n } else if(JSON && JSON.stringify) {\n // console.log.apply is undefined in IE8 and IE9\n // for IE8/9: make console.log at least a bit less awful\n if(args[i] && typeof args[i] == 'string') {\n args[i] = args[i].replace(newlines, '');\n }\n try {\n for(i = 0; i < args.length; i++) {\n args[i] = JSON.stringify(args[i]);\n }\n } catch(e) {}\n console.log(args.join(' '));\n }\n};\n\nlogger.formatters = ['color', 'minilog'];\nlogger.color = require('./formatters/color.js');\nlogger.minilog = require('./formatters/minilog.js');\n\nmodule.exports = logger;\n","var Transform = require('../../common/transform.js'),\n color = require('./util.js');\n\nvar colors = { debug: ['cyan'], info: ['purple' ], warn: [ 'yellow', true ], error: [ 'red', true ] },\n logger = new Transform();\n\nlogger.write = function(name, level, args) {\n var fn = console.log;\n if(console[level] && console[level].apply) {\n fn = console[level];\n fn.apply(console, [ '%c'+name+' %c'+level, color('gray'), color.apply(color, colors[level])].concat(args));\n }\n};\n\n// NOP, because piping the formatted logs can only cause trouble.\nlogger.pipe = function() { };\n\nmodule.exports = logger;\n","var Transform = require('../../common/transform.js'),\n color = require('./util.js'),\n colors = { debug: ['gray'], info: ['purple' ], warn: [ 'yellow', true ], error: [ 'red', true ] },\n logger = new Transform();\n\nlogger.write = function(name, level, args) {\n var fn = console.log;\n if(level != 'debug' && console[level]) {\n fn = console[level];\n }\n\n var subset = [], i = 0;\n if(level != 'info') {\n for(; i < args.length; i++) {\n if(typeof args[i] != 'string') break;\n }\n fn.apply(console, [ '%c'+name +' '+ args.slice(0, i).join(' '), color.apply(color, colors[level]) ].concat(args.slice(i)));\n } else {\n fn.apply(console, [ '%c'+name, color.apply(color, colors[level]) ].concat(args));\n }\n};\n\n// NOP, because piping the formatted logs can only cause trouble.\nlogger.pipe = function() { };\n\nmodule.exports = logger;\n","var hex = {\n black: '#000',\n red: '#c23621',\n green: '#25bc26',\n yellow: '#bbbb00',\n blue: '#492ee1',\n magenta: '#d338d3',\n cyan: '#33bbc8',\n gray: '#808080',\n purple: '#708'\n};\nfunction color(fg, isInverse) {\n if(isInverse) {\n return 'color: #fff; background: '+hex[fg]+';';\n } else {\n return 'color: '+hex[fg]+';';\n }\n}\n\nmodule.exports = color;\n","var Minilog = require('../common/minilog.js');\n\nvar oldEnable = Minilog.enable,\n oldDisable = Minilog.disable,\n isChrome = (typeof navigator != 'undefined' && /chrome/i.test(navigator.userAgent)),\n console = require('./console.js');\n\n// Use a more capable logging backend if on Chrome\nMinilog.defaultBackend = (isChrome ? console.minilog : console);\n\n// apply enable inputs from localStorage and from the URL\nif(typeof window != 'undefined') {\n try {\n Minilog.enable(JSON.parse(window.localStorage['minilogSettings']));\n } catch(e) {}\n if(window.location && window.location.search) {\n var match = RegExp('[?&]minilog=([^&]*)').exec(window.location.search);\n match && Minilog.enable(decodeURIComponent(match[1]));\n }\n}\n\n// Make enable also add to localStorage\nMinilog.enable = function() {\n oldEnable.call(Minilog, true);\n try { window.localStorage['minilogSettings'] = JSON.stringify(true); } catch(e) {}\n return this;\n};\n\nMinilog.disable = function() {\n oldDisable.call(Minilog);\n try { delete window.localStorage.minilogSettings; } catch(e) {}\n return this;\n};\n\nexports = module.exports = Minilog;\n\nexports.backends = {\n array: require('./array.js'),\n browser: Minilog.defaultBackend,\n localStorage: require('./localstorage.js'),\n jQuery: require('./jquery_simple.js')\n};\n","var Transform = require('../common/transform.js');\n\nvar cid = new Date().valueOf().toString(36);\n\nfunction AjaxLogger(options) {\n this.url = options.url || '';\n this.cache = [];\n this.timer = null;\n this.interval = options.interval || 30*1000;\n this.enabled = true;\n this.jQuery = window.jQuery;\n this.extras = {};\n}\n\nTransform.mixin(AjaxLogger);\n\nAjaxLogger.prototype.write = function(name, level, args) {\n if(!this.timer) { this.init(); }\n this.cache.push([name, level].concat(args));\n};\n\nAjaxLogger.prototype.init = function() {\n if(!this.enabled || !this.jQuery) return;\n var self = this;\n this.timer = setTimeout(function() {\n var i, logs = [], ajaxData, url = self.url;\n if(self.cache.length == 0) return self.init();\n // Test each log line and only log the ones that are valid (e.g. don't have circular references).\n // Slight performance hit but benefit is we log all valid lines.\n for(i = 0; i < self.cache.length; i++) {\n try {\n JSON.stringify(self.cache[i]);\n logs.push(self.cache[i]);\n } catch(e) { }\n }\n if(self.jQuery.isEmptyObject(self.extras)) {\n ajaxData = JSON.stringify({ logs: logs });\n url = self.url + '?client_id=' + cid;\n } else {\n ajaxData = JSON.stringify(self.jQuery.extend({logs: logs}, self.extras));\n }\n\n self.jQuery.ajax(url, {\n type: 'POST',\n cache: false,\n processData: false,\n data: ajaxData,\n contentType: 'application/json',\n timeout: 10000\n }).success(function(data, status, jqxhr) {\n if(data.interval) {\n self.interval = Math.max(1000, data.interval);\n }\n }).error(function() {\n self.interval = 30000;\n }).always(function() {\n self.init();\n });\n self.cache = [];\n }, this.interval);\n};\n\nAjaxLogger.prototype.end = function() {};\n\n// wait until jQuery is defined. Useful if you don't control the load order.\nAjaxLogger.jQueryWait = function(onDone) {\n if(typeof window !== 'undefined' && (window.jQuery || window.$)) {\n return onDone(window.jQuery || window.$);\n } else if (typeof window !== 'undefined') {\n setTimeout(function() { AjaxLogger.jQueryWait(onDone); }, 200);\n }\n};\n\nmodule.exports = AjaxLogger;\n","var Transform = require('../common/transform.js'),\n cache = false;\n\nvar logger = new Transform();\n\nlogger.write = function(name, level, args) {\n if(typeof window == 'undefined' || typeof JSON == 'undefined' || !JSON.stringify || !JSON.parse) return;\n try {\n if(!cache) { cache = (window.localStorage.minilog ? JSON.parse(window.localStorage.minilog) : []); }\n cache.push([ new Date().toString(), name, level, args ]);\n window.localStorage.minilog = JSON.stringify(cache);\n } catch(e) {}\n};\n\nmodule.exports = logger;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","/* eslint-env worker */\n\nconst ArgumentType = require('../extension-support/argument-type');\nconst BlockType = require('../extension-support/block-type');\nconst dispatch = require('../dispatch/worker-dispatch');\nconst TargetType = require('../extension-support/target-type');\n\nclass ExtensionWorker {\n constructor () {\n this.nextExtensionId = 0;\n\n this.initialRegistrations = [];\n\n dispatch.waitForConnection.then(() => {\n dispatch.call('extensions', 'allocateWorker').then(x => {\n const [id, extension] = x;\n this.workerId = id;\n\n try {\n importScripts(extension);\n\n const initialRegistrations = this.initialRegistrations;\n this.initialRegistrations = null;\n\n Promise.all(initialRegistrations).then(() => dispatch.call('extensions', 'onWorkerInit', id));\n } catch (e) {\n dispatch.call('extensions', 'onWorkerInit', id, e);\n }\n });\n });\n\n this.extensions = [];\n }\n\n register (extensionObject) {\n const extensionId = this.nextExtensionId++;\n this.extensions.push(extensionObject);\n const serviceName = `extension.${this.workerId}.${extensionId}`;\n const promise = dispatch.setService(serviceName, extensionObject)\n .then(() => dispatch.call('extensions', 'registerExtensionService', serviceName));\n if (this.initialRegistrations) {\n this.initialRegistrations.push(promise);\n }\n return promise;\n }\n}\n\nglobal.Scratch = global.Scratch || {};\nglobal.Scratch.ArgumentType = ArgumentType;\nglobal.Scratch.BlockType = BlockType;\nglobal.Scratch.TargetType = TargetType;\n\n/**\n * Expose only specific parts of the worker to extensions.\n */\nconst extensionWorker = new ExtensionWorker();\nglobal.Scratch.extensions = {\n register: extensionWorker.register.bind(extensionWorker)\n};\n"],"names":[],"sourceRoot":""}