not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1477 lines
52 KiB

  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  40. /******/ }
  41. /******/ };
  42. /******/
  43. /******/ // define __esModule on exports
  44. /******/ __webpack_require__.r = function(exports) {
  45. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47. /******/ }
  48. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  49. /******/ };
  50. /******/
  51. /******/ // create a fake namespace object
  52. /******/ // mode & 1: value is a module id, require it
  53. /******/ // mode & 2: merge all properties of value into the ns
  54. /******/ // mode & 4: return value when already ns object
  55. /******/ // mode & 8|1: behave like require
  56. /******/ __webpack_require__.t = function(value, mode) {
  57. /******/ if(mode & 1) value = __webpack_require__(value);
  58. /******/ if(mode & 8) return value;
  59. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  60. /******/ var ns = Object.create(null);
  61. /******/ __webpack_require__.r(ns);
  62. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  63. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  64. /******/ return ns;
  65. /******/ };
  66. /******/
  67. /******/ // getDefaultExport function for compatibility with non-harmony modules
  68. /******/ __webpack_require__.n = function(module) {
  69. /******/ var getter = module && module.__esModule ?
  70. /******/ function getDefault() { return module['default']; } :
  71. /******/ function getModuleExports() { return module; };
  72. /******/ __webpack_require__.d(getter, 'a', getter);
  73. /******/ return getter;
  74. /******/ };
  75. /******/
  76. /******/ // Object.prototype.hasOwnProperty.call
  77. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78. /******/
  79. /******/ // __webpack_public_path__
  80. /******/ __webpack_require__.p = "";
  81. /******/
  82. /******/
  83. /******/ // Load entry module and return exports
  84. /******/ return __webpack_require__(__webpack_require__.s = "./node_modules/babel-loader/lib/index.js?!./node_modules/scratch-vm/src/extension-support/extension-worker.js");
  85. /******/ })
  86. /************************************************************************/
  87. /******/ ({
  88. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/scratch-vm/src/extension-support/extension-worker.js":
  89. /*!*******************************************************************************************************************!*\
  90. !*** ./node_modules/babel-loader/lib??ref--4!./node_modules/scratch-vm/src/extension-support/extension-worker.js ***!
  91. \*******************************************************************************************************************/
  92. /*! no static exports found */
  93. /***/ (function(module, exports, __webpack_require__) {
  94. /* WEBPACK VAR INJECTION */(function(global) {function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
  95. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
  96. function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  97. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  98. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  99. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  100. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  101. /* eslint-env worker */
  102. var ArgumentType = __webpack_require__(/*! ../extension-support/argument-type */ "./node_modules/scratch-vm/src/extension-support/argument-type.js");
  103. var BlockType = __webpack_require__(/*! ../extension-support/block-type */ "./node_modules/scratch-vm/src/extension-support/block-type.js");
  104. var dispatch = __webpack_require__(/*! ../dispatch/worker-dispatch */ "./node_modules/scratch-vm/src/dispatch/worker-dispatch.js");
  105. var TargetType = __webpack_require__(/*! ../extension-support/target-type */ "./node_modules/scratch-vm/src/extension-support/target-type.js");
  106. var ExtensionWorker =
  107. /*#__PURE__*/
  108. function () {
  109. function ExtensionWorker() {
  110. var _this = this;
  111. _classCallCheck(this, ExtensionWorker);
  112. this.nextExtensionId = 0;
  113. this.initialRegistrations = [];
  114. dispatch.waitForConnection.then(function () {
  115. dispatch.call('extensions', 'allocateWorker').then(function (x) {
  116. var _x = _slicedToArray(x, 2),
  117. id = _x[0],
  118. extension = _x[1];
  119. _this.workerId = id;
  120. try {
  121. importScripts(extension);
  122. var initialRegistrations = _this.initialRegistrations;
  123. _this.initialRegistrations = null;
  124. Promise.all(initialRegistrations).then(function () {
  125. return dispatch.call('extensions', 'onWorkerInit', id);
  126. });
  127. } catch (e) {
  128. dispatch.call('extensions', 'onWorkerInit', id, e);
  129. }
  130. });
  131. });
  132. this.extensions = [];
  133. }
  134. _createClass(ExtensionWorker, [{
  135. key: "register",
  136. value: function register(extensionObject) {
  137. var extensionId = this.nextExtensionId++;
  138. this.extensions.push(extensionObject);
  139. var serviceName = "extension.".concat(this.workerId, ".").concat(extensionId);
  140. var promise = dispatch.setService(serviceName, extensionObject).then(function () {
  141. return dispatch.call('extensions', 'registerExtensionService', serviceName);
  142. });
  143. if (this.initialRegistrations) {
  144. this.initialRegistrations.push(promise);
  145. }
  146. return promise;
  147. }
  148. }]);
  149. return ExtensionWorker;
  150. }();
  151. global.Scratch = global.Scratch || {};
  152. global.Scratch.ArgumentType = ArgumentType;
  153. global.Scratch.BlockType = BlockType;
  154. global.Scratch.TargetType = TargetType;
  155. /**
  156. * Expose only specific parts of the worker to extensions.
  157. */
  158. var extensionWorker = new ExtensionWorker();
  159. global.Scratch.extensions = {
  160. register: extensionWorker.register.bind(extensionWorker)
  161. };
  162. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  163. /***/ }),
  164. /***/ "./node_modules/microee/index.js":
  165. /*!***************************************!*\
  166. !*** ./node_modules/microee/index.js ***!
  167. \***************************************/
  168. /*! no static exports found */
  169. /***/ (function(module, exports) {
  170. function M() { this._events = {}; }
  171. M.prototype = {
  172. on: function(ev, cb) {
  173. this._events || (this._events = {});
  174. var e = this._events;
  175. (e[ev] || (e[ev] = [])).push(cb);
  176. return this;
  177. },
  178. removeListener: function(ev, cb) {
  179. var e = this._events[ev] || [], i;
  180. for(i = e.length-1; i >= 0 && e[i]; i--){
  181. if(e[i] === cb || e[i].cb === cb) { e.splice(i, 1); }
  182. }
  183. },
  184. removeAllListeners: function(ev) {
  185. if(!ev) { this._events = {}; }
  186. else { this._events[ev] && (this._events[ev] = []); }
  187. },
  188. listeners: function(ev) {
  189. return (this._events ? this._events[ev] || [] : []);
  190. },
  191. emit: function(ev) {
  192. this._events || (this._events = {});
  193. var args = Array.prototype.slice.call(arguments, 1), i, e = this._events[ev] || [];
  194. for(i = e.length-1; i >= 0 && e[i]; i--){
  195. e[i].apply(this, args);
  196. }
  197. return this;
  198. },
  199. when: function(ev, cb) {
  200. return this.once(ev, cb, true);
  201. },
  202. once: function(ev, cb, when) {
  203. if(!cb) return this;
  204. function c() {
  205. if(!when) this.removeListener(ev, c);
  206. if(cb.apply(this, arguments) && when) this.removeListener(ev, c);
  207. }
  208. c.cb = cb;
  209. this.on(ev, c);
  210. return this;
  211. }
  212. };
  213. M.mixin = function(dest) {
  214. var o = M.prototype, k;
  215. for (k in o) {
  216. o.hasOwnProperty(k) && (dest.prototype[k] = o[k]);
  217. }
  218. };
  219. module.exports = M;
  220. /***/ }),
  221. /***/ "./node_modules/minilog/lib/common/filter.js":
  222. /*!***************************************************!*\
  223. !*** ./node_modules/minilog/lib/common/filter.js ***!
  224. \***************************************************/
  225. /*! no static exports found */
  226. /***/ (function(module, exports, __webpack_require__) {
  227. // default filter
  228. var Transform = __webpack_require__(/*! ./transform.js */ "./node_modules/minilog/lib/common/transform.js");
  229. var levelMap = { debug: 1, info: 2, warn: 3, error: 4 };
  230. function Filter() {
  231. this.enabled = true;
  232. this.defaultResult = true;
  233. this.clear();
  234. }
  235. Transform.mixin(Filter);
  236. // allow all matching, with level >= given level
  237. Filter.prototype.allow = function(name, level) {
  238. this._white.push({ n: name, l: levelMap[level] });
  239. return this;
  240. };
  241. // deny all matching, with level <= given level
  242. Filter.prototype.deny = function(name, level) {
  243. this._black.push({ n: name, l: levelMap[level] });
  244. return this;
  245. };
  246. Filter.prototype.clear = function() {
  247. this._white = [];
  248. this._black = [];
  249. return this;
  250. };
  251. function test(rule, name) {
  252. // use .test for RegExps
  253. return (rule.n.test ? rule.n.test(name) : rule.n == name);
  254. };
  255. Filter.prototype.test = function(name, level) {
  256. var i, len = Math.max(this._white.length, this._black.length);
  257. for(i = 0; i < len; i++) {
  258. if(this._white[i] && test(this._white[i], name) && levelMap[level] >= this._white[i].l) {
  259. return true;
  260. }
  261. if(this._black[i] && test(this._black[i], name) && levelMap[level] <= this._black[i].l) {
  262. return false;
  263. }
  264. }
  265. return this.defaultResult;
  266. };
  267. Filter.prototype.write = function(name, level, args) {
  268. if(!this.enabled || this.test(name, level)) {
  269. return this.emit('item', name, level, args);
  270. }
  271. };
  272. module.exports = Filter;
  273. /***/ }),
  274. /***/ "./node_modules/minilog/lib/common/minilog.js":
  275. /*!****************************************************!*\
  276. !*** ./node_modules/minilog/lib/common/minilog.js ***!
  277. \****************************************************/
  278. /*! no static exports found */
  279. /***/ (function(module, exports, __webpack_require__) {
  280. var Transform = __webpack_require__(/*! ./transform.js */ "./node_modules/minilog/lib/common/transform.js"),
  281. Filter = __webpack_require__(/*! ./filter.js */ "./node_modules/minilog/lib/common/filter.js");
  282. var log = new Transform(),
  283. slice = Array.prototype.slice;
  284. exports = module.exports = function create(name) {
  285. var o = function() { log.write(name, undefined, slice.call(arguments)); return o; };
  286. o.debug = function() { log.write(name, 'debug', slice.call(arguments)); return o; };
  287. o.info = function() { log.write(name, 'info', slice.call(arguments)); return o; };
  288. o.warn = function() { log.write(name, 'warn', slice.call(arguments)); return o; };
  289. o.error = function() { log.write(name, 'error', slice.call(arguments)); return o; };
  290. o.log = o.debug; // for interface compliance with Node and browser consoles
  291. o.suggest = exports.suggest;
  292. o.format = log.format;
  293. return o;
  294. };
  295. // filled in separately
  296. exports.defaultBackend = exports.defaultFormatter = null;
  297. exports.pipe = function(dest) {
  298. return log.pipe(dest);
  299. };
  300. exports.end = exports.unpipe = exports.disable = function(from) {
  301. return log.unpipe(from);
  302. };
  303. exports.Transform = Transform;
  304. exports.Filter = Filter;
  305. // this is the default filter that's applied when .enable() is called normally
  306. // you can bypass it completely and set up your own pipes
  307. exports.suggest = new Filter();
  308. exports.enable = function() {
  309. if(exports.defaultFormatter) {
  310. return log.pipe(exports.suggest) // filter
  311. .pipe(exports.defaultFormatter) // formatter
  312. .pipe(exports.defaultBackend); // backend
  313. }
  314. return log.pipe(exports.suggest) // filter
  315. .pipe(exports.defaultBackend); // formatter
  316. };
  317. /***/ }),
  318. /***/ "./node_modules/minilog/lib/common/transform.js":
  319. /*!******************************************************!*\
  320. !*** ./node_modules/minilog/lib/common/transform.js ***!
  321. \******************************************************/
  322. /*! no static exports found */
  323. /***/ (function(module, exports, __webpack_require__) {
  324. var microee = __webpack_require__(/*! microee */ "./node_modules/microee/index.js");
  325. // Implements a subset of Node's stream.Transform - in a cross-platform manner.
  326. function Transform() {}
  327. microee.mixin(Transform);
  328. // The write() signature is different from Node's
  329. // --> makes it much easier to work with objects in logs.
  330. // One of the lessons from v1 was that it's better to target
  331. // a good browser rather than the lowest common denominator
  332. // internally.
  333. // If you want to use external streams, pipe() to ./stringify.js first.
  334. Transform.prototype.write = function(name, level, args) {
  335. this.emit('item', name, level, args);
  336. };
  337. Transform.prototype.end = function() {
  338. this.emit('end');
  339. this.removeAllListeners();
  340. };
  341. Transform.prototype.pipe = function(dest) {
  342. var s = this;
  343. // prevent double piping
  344. s.emit('unpipe', dest);
  345. // tell the dest that it's being piped to
  346. dest.emit('pipe', s);
  347. function onItem() {
  348. dest.write.apply(dest, Array.prototype.slice.call(arguments));
  349. }
  350. function onEnd() { !dest._isStdio && dest.end(); }
  351. s.on('item', onItem);
  352. s.on('end', onEnd);
  353. s.when('unpipe', function(from) {
  354. var match = (from === dest) || typeof from == 'undefined';
  355. if(match) {
  356. s.removeListener('item', onItem);
  357. s.removeListener('end', onEnd);
  358. dest.emit('unpipe');
  359. }
  360. return match;
  361. });
  362. return dest;
  363. };
  364. Transform.prototype.unpipe = function(from) {
  365. this.emit('unpipe', from);
  366. return this;
  367. };
  368. Transform.prototype.format = function(dest) {
  369. throw new Error([
  370. 'Warning: .format() is deprecated in Minilog v2! Use .pipe() instead. For example:',
  371. 'var Minilog = require(\'minilog\');',
  372. 'Minilog',
  373. ' .pipe(Minilog.backends.console.formatClean)',
  374. ' .pipe(Minilog.backends.console);'].join('\n'));
  375. };
  376. Transform.mixin = function(dest) {
  377. var o = Transform.prototype, k;
  378. for (k in o) {
  379. o.hasOwnProperty(k) && (dest.prototype[k] = o[k]);
  380. }
  381. };
  382. module.exports = Transform;
  383. /***/ }),
  384. /***/ "./node_modules/minilog/lib/web/array.js":
  385. /*!***********************************************!*\
  386. !*** ./node_modules/minilog/lib/web/array.js ***!
  387. \***********************************************/
  388. /*! no static exports found */
  389. /***/ (function(module, exports, __webpack_require__) {
  390. var Transform = __webpack_require__(/*! ../common/transform.js */ "./node_modules/minilog/lib/common/transform.js"),
  391. cache = [ ];
  392. var logger = new Transform();
  393. logger.write = function(name, level, args) {
  394. cache.push([ name, level, args ]);
  395. };
  396. // utility functions
  397. logger.get = function() { return cache; };
  398. logger.empty = function() { cache = []; };
  399. module.exports = logger;
  400. /***/ }),
  401. /***/ "./node_modules/minilog/lib/web/console.js":
  402. /*!*************************************************!*\
  403. !*** ./node_modules/minilog/lib/web/console.js ***!
  404. \*************************************************/
  405. /*! no static exports found */
  406. /***/ (function(module, exports, __webpack_require__) {
  407. var Transform = __webpack_require__(/*! ../common/transform.js */ "./node_modules/minilog/lib/common/transform.js");
  408. var newlines = /\n+$/,
  409. logger = new Transform();
  410. logger.write = function(name, level, args) {
  411. var i = args.length-1;
  412. if (typeof console === 'undefined' || !console.log) {
  413. return;
  414. }
  415. if(console.log.apply) {
  416. return console.log.apply(console, [name, level].concat(args));
  417. } else if(JSON && JSON.stringify) {
  418. // console.log.apply is undefined in IE8 and IE9
  419. // for IE8/9: make console.log at least a bit less awful
  420. if(args[i] && typeof args[i] == 'string') {
  421. args[i] = args[i].replace(newlines, '');
  422. }
  423. try {
  424. for(i = 0; i < args.length; i++) {
  425. args[i] = JSON.stringify(args[i]);
  426. }
  427. } catch(e) {}
  428. console.log(args.join(' '));
  429. }
  430. };
  431. logger.formatters = ['color', 'minilog'];
  432. logger.color = __webpack_require__(/*! ./formatters/color.js */ "./node_modules/minilog/lib/web/formatters/color.js");
  433. logger.minilog = __webpack_require__(/*! ./formatters/minilog.js */ "./node_modules/minilog/lib/web/formatters/minilog.js");
  434. module.exports = logger;
  435. /***/ }),
  436. /***/ "./node_modules/minilog/lib/web/formatters/color.js":
  437. /*!**********************************************************!*\
  438. !*** ./node_modules/minilog/lib/web/formatters/color.js ***!
  439. \**********************************************************/
  440. /*! no static exports found */
  441. /***/ (function(module, exports, __webpack_require__) {
  442. var Transform = __webpack_require__(/*! ../../common/transform.js */ "./node_modules/minilog/lib/common/transform.js"),
  443. color = __webpack_require__(/*! ./util.js */ "./node_modules/minilog/lib/web/formatters/util.js");
  444. var colors = { debug: ['cyan'], info: ['purple' ], warn: [ 'yellow', true ], error: [ 'red', true ] },
  445. logger = new Transform();
  446. logger.write = function(name, level, args) {
  447. var fn = console.log;
  448. if(console[level] && console[level].apply) {
  449. fn = console[level];
  450. fn.apply(console, [ '%c'+name+' %c'+level, color('gray'), color.apply(color, colors[level])].concat(args));
  451. }
  452. };
  453. // NOP, because piping the formatted logs can only cause trouble.
  454. logger.pipe = function() { };
  455. module.exports = logger;
  456. /***/ }),
  457. /***/ "./node_modules/minilog/lib/web/formatters/minilog.js":
  458. /*!************************************************************!*\
  459. !*** ./node_modules/minilog/lib/web/formatters/minilog.js ***!
  460. \************************************************************/
  461. /*! no static exports found */
  462. /***/ (function(module, exports, __webpack_require__) {
  463. var Transform = __webpack_require__(/*! ../../common/transform.js */ "./node_modules/minilog/lib/common/transform.js"),
  464. color = __webpack_require__(/*! ./util.js */ "./node_modules/minilog/lib/web/formatters/util.js"),
  465. colors = { debug: ['gray'], info: ['purple' ], warn: [ 'yellow', true ], error: [ 'red', true ] },
  466. logger = new Transform();
  467. logger.write = function(name, level, args) {
  468. var fn = console.log;
  469. if(level != 'debug' && console[level]) {
  470. fn = console[level];
  471. }
  472. var subset = [], i = 0;
  473. if(level != 'info') {
  474. for(; i < args.length; i++) {
  475. if(typeof args[i] != 'string') break;
  476. }
  477. fn.apply(console, [ '%c'+name +' '+ args.slice(0, i).join(' '), color.apply(color, colors[level]) ].concat(args.slice(i)));
  478. } else {
  479. fn.apply(console, [ '%c'+name, color.apply(color, colors[level]) ].concat(args));
  480. }
  481. };
  482. // NOP, because piping the formatted logs can only cause trouble.
  483. logger.pipe = function() { };
  484. module.exports = logger;
  485. /***/ }),
  486. /***/ "./node_modules/minilog/lib/web/formatters/util.js":
  487. /*!*********************************************************!*\
  488. !*** ./node_modules/minilog/lib/web/formatters/util.js ***!
  489. \*********************************************************/
  490. /*! no static exports found */
  491. /***/ (function(module, exports) {
  492. var hex = {
  493. black: '#000',
  494. red: '#c23621',
  495. green: '#25bc26',
  496. yellow: '#bbbb00',
  497. blue: '#492ee1',
  498. magenta: '#d338d3',
  499. cyan: '#33bbc8',
  500. gray: '#808080',
  501. purple: '#708'
  502. };
  503. function color(fg, isInverse) {
  504. if(isInverse) {
  505. return 'color: #fff; background: '+hex[fg]+';';
  506. } else {
  507. return 'color: '+hex[fg]+';';
  508. }
  509. }
  510. module.exports = color;
  511. /***/ }),
  512. /***/ "./node_modules/minilog/lib/web/index.js":
  513. /*!***********************************************!*\
  514. !*** ./node_modules/minilog/lib/web/index.js ***!
  515. \***********************************************/
  516. /*! no static exports found */
  517. /***/ (function(module, exports, __webpack_require__) {
  518. var Minilog = __webpack_require__(/*! ../common/minilog.js */ "./node_modules/minilog/lib/common/minilog.js");
  519. var oldEnable = Minilog.enable,
  520. oldDisable = Minilog.disable,
  521. isChrome = (typeof navigator != 'undefined' && /chrome/i.test(navigator.userAgent)),
  522. console = __webpack_require__(/*! ./console.js */ "./node_modules/minilog/lib/web/console.js");
  523. // Use a more capable logging backend if on Chrome
  524. Minilog.defaultBackend = (isChrome ? console.minilog : console);
  525. // apply enable inputs from localStorage and from the URL
  526. if(typeof window != 'undefined') {
  527. try {
  528. Minilog.enable(JSON.parse(window.localStorage['minilogSettings']));
  529. } catch(e) {}
  530. if(window.location && window.location.search) {
  531. var match = RegExp('[?&]minilog=([^&]*)').exec(window.location.search);
  532. match && Minilog.enable(decodeURIComponent(match[1]));
  533. }
  534. }
  535. // Make enable also add to localStorage
  536. Minilog.enable = function() {
  537. oldEnable.call(Minilog, true);
  538. try { window.localStorage['minilogSettings'] = JSON.stringify(true); } catch(e) {}
  539. return this;
  540. };
  541. Minilog.disable = function() {
  542. oldDisable.call(Minilog);
  543. try { delete window.localStorage.minilogSettings; } catch(e) {}
  544. return this;
  545. };
  546. exports = module.exports = Minilog;
  547. exports.backends = {
  548. array: __webpack_require__(/*! ./array.js */ "./node_modules/minilog/lib/web/array.js"),
  549. browser: Minilog.defaultBackend,
  550. localStorage: __webpack_require__(/*! ./localstorage.js */ "./node_modules/minilog/lib/web/localstorage.js"),
  551. jQuery: __webpack_require__(/*! ./jquery_simple.js */ "./node_modules/minilog/lib/web/jquery_simple.js")
  552. };
  553. /***/ }),
  554. /***/ "./node_modules/minilog/lib/web/jquery_simple.js":
  555. /*!*******************************************************!*\
  556. !*** ./node_modules/minilog/lib/web/jquery_simple.js ***!
  557. \*******************************************************/
  558. /*! no static exports found */
  559. /***/ (function(module, exports, __webpack_require__) {
  560. var Transform = __webpack_require__(/*! ../common/transform.js */ "./node_modules/minilog/lib/common/transform.js");
  561. var cid = new Date().valueOf().toString(36);
  562. function AjaxLogger(options) {
  563. this.url = options.url || '';
  564. this.cache = [];
  565. this.timer = null;
  566. this.interval = options.interval || 30*1000;
  567. this.enabled = true;
  568. this.jQuery = window.jQuery;
  569. this.extras = {};
  570. }
  571. Transform.mixin(AjaxLogger);
  572. AjaxLogger.prototype.write = function(name, level, args) {
  573. if(!this.timer) { this.init(); }
  574. this.cache.push([name, level].concat(args));
  575. };
  576. AjaxLogger.prototype.init = function() {
  577. if(!this.enabled || !this.jQuery) return;
  578. var self = this;
  579. this.timer = setTimeout(function() {
  580. var i, logs = [], ajaxData, url = self.url;
  581. if(self.cache.length == 0) return self.init();
  582. // Test each log line and only log the ones that are valid (e.g. don't have circular references).
  583. // Slight performance hit but benefit is we log all valid lines.
  584. for(i = 0; i < self.cache.length; i++) {
  585. try {
  586. JSON.stringify(self.cache[i]);
  587. logs.push(self.cache[i]);
  588. } catch(e) { }
  589. }
  590. if(self.jQuery.isEmptyObject(self.extras)) {
  591. ajaxData = JSON.stringify({ logs: logs });
  592. url = self.url + '?client_id=' + cid;
  593. } else {
  594. ajaxData = JSON.stringify(self.jQuery.extend({logs: logs}, self.extras));
  595. }
  596. self.jQuery.ajax(url, {
  597. type: 'POST',
  598. cache: false,
  599. processData: false,
  600. data: ajaxData,
  601. contentType: 'application/json',
  602. timeout: 10000
  603. }).success(function(data, status, jqxhr) {
  604. if(data.interval) {
  605. self.interval = Math.max(1000, data.interval);
  606. }
  607. }).error(function() {
  608. self.interval = 30000;
  609. }).always(function() {
  610. self.init();
  611. });
  612. self.cache = [];
  613. }, this.interval);
  614. };
  615. AjaxLogger.prototype.end = function() {};
  616. // wait until jQuery is defined. Useful if you don't control the load order.
  617. AjaxLogger.jQueryWait = function(onDone) {
  618. if(typeof window !== 'undefined' && (window.jQuery || window.$)) {
  619. return onDone(window.jQuery || window.$);
  620. } else if (typeof window !== 'undefined') {
  621. setTimeout(function() { AjaxLogger.jQueryWait(onDone); }, 200);
  622. }
  623. };
  624. module.exports = AjaxLogger;
  625. /***/ }),
  626. /***/ "./node_modules/minilog/lib/web/localstorage.js":
  627. /*!******************************************************!*\
  628. !*** ./node_modules/minilog/lib/web/localstorage.js ***!
  629. \******************************************************/
  630. /*! no static exports found */
  631. /***/ (function(module, exports, __webpack_require__) {
  632. var Transform = __webpack_require__(/*! ../common/transform.js */ "./node_modules/minilog/lib/common/transform.js"),
  633. cache = false;
  634. var logger = new Transform();
  635. logger.write = function(name, level, args) {
  636. if(typeof window == 'undefined' || typeof JSON == 'undefined' || !JSON.stringify || !JSON.parse) return;
  637. try {
  638. if(!cache) { cache = (window.localStorage.minilog ? JSON.parse(window.localStorage.minilog) : []); }
  639. cache.push([ new Date().toString(), name, level, args ]);
  640. window.localStorage.minilog = JSON.stringify(cache);
  641. } catch(e) {}
  642. };
  643. module.exports = logger;
  644. /***/ }),
  645. /***/ "./node_modules/scratch-vm/src/dispatch/shared-dispatch.js":
  646. /*!*****************************************************************!*\
  647. !*** ./node_modules/scratch-vm/src/dispatch/shared-dispatch.js ***!
  648. \*****************************************************************/
  649. /*! no static exports found */
  650. /***/ (function(module, exports, __webpack_require__) {
  651. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
  652. function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
  653. function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
  654. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
  655. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
  656. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
  657. function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  658. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  659. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  660. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  661. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  662. var log = __webpack_require__(/*! ../util/log */ "./node_modules/scratch-vm/src/util/log.js");
  663. /**
  664. * @typedef {object} DispatchCallMessage - a message to the dispatch system representing a service method call
  665. * @property {*} responseId - send a response message with this response ID. See {@link DispatchResponseMessage}
  666. * @property {string} service - the name of the service to be called
  667. * @property {string} method - the name of the method to be called
  668. * @property {Array|undefined} args - the arguments to be passed to the method
  669. */
  670. /**
  671. * @typedef {object} DispatchResponseMessage - a message to the dispatch system representing the results of a call
  672. * @property {*} responseId - a copy of the response ID from the call which generated this response
  673. * @property {*|undefined} error - if this is truthy, then it contains results from a failed call (such as an exception)
  674. * @property {*|undefined} result - if error is not truthy, then this contains the return value of the call (if any)
  675. */
  676. /**
  677. * @typedef {DispatchCallMessage|DispatchResponseMessage} DispatchMessage
  678. * Any message to the dispatch system.
  679. */
  680. /**
  681. * The SharedDispatch class is responsible for dispatch features shared by
  682. * {@link CentralDispatch} and {@link WorkerDispatch}.
  683. */
  684. var SharedDispatch =
  685. /*#__PURE__*/
  686. function () {
  687. function SharedDispatch() {
  688. _classCallCheck(this, SharedDispatch);
  689. /**
  690. * List of callback registrations for promises waiting for a response from a call to a service on another
  691. * worker. A callback registration is an array of [resolve,reject] Promise functions.
  692. * Calls to local services don't enter this list.
  693. * @type {Array.<Function[]>}
  694. */
  695. this.callbacks = [];
  696. /**
  697. * The next response ID to be used.
  698. * @type {int}
  699. */
  700. this.nextResponseId = 0;
  701. }
  702. /**
  703. * Call a particular method on a particular service, regardless of whether that service is provided locally or on
  704. * a worker. If the service is provided by a worker, the `args` will be copied using the Structured Clone
  705. * algorithm, except for any items which are also in the `transfer` list. Ownership of those items will be
  706. * transferred to the worker, and they should not be used after this call.
  707. * @example
  708. * dispatcher.call('vm', 'setData', 'cat', 42);
  709. * // this finds the worker for the 'vm' service, then on that worker calls:
  710. * vm.setData('cat', 42);
  711. * @param {string} service - the name of the service.
  712. * @param {string} method - the name of the method.
  713. * @param {*} [args] - the arguments to be copied to the method, if any.
  714. * @returns {Promise} - a promise for the return value of the service method.
  715. */
  716. _createClass(SharedDispatch, [{
  717. key: "call",
  718. value: function call(service, method) {
  719. for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
  720. args[_key - 2] = arguments[_key];
  721. }
  722. return this.transferCall.apply(this, [service, method, null].concat(args));
  723. }
  724. /**
  725. * Call a particular method on a particular service, regardless of whether that service is provided locally or on
  726. * a worker. If the service is provided by a worker, the `args` will be copied using the Structured Clone
  727. * algorithm, except for any items which are also in the `transfer` list. Ownership of those items will be
  728. * transferred to the worker, and they should not be used after this call.
  729. * @example
  730. * dispatcher.transferCall('vm', 'setData', [myArrayBuffer], 'cat', myArrayBuffer);
  731. * // this finds the worker for the 'vm' service, transfers `myArrayBuffer` to it, then on that worker calls:
  732. * vm.setData('cat', myArrayBuffer);
  733. * @param {string} service - the name of the service.
  734. * @param {string} method - the name of the method.
  735. * @param {Array} [transfer] - objects to be transferred instead of copied. Must be present in `args` to be useful.
  736. * @param {*} [args] - the arguments to be copied to the method, if any.
  737. * @returns {Promise} - a promise for the return value of the service method.
  738. */
  739. }, {
  740. key: "transferCall",
  741. value: function transferCall(service, method, transfer) {
  742. try {
  743. var _this$_getServiceProv = this._getServiceProvider(service),
  744. provider = _this$_getServiceProv.provider,
  745. isRemote = _this$_getServiceProv.isRemote;
  746. if (provider) {
  747. for (var _len2 = arguments.length, args = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
  748. args[_key2 - 3] = arguments[_key2];
  749. }
  750. if (isRemote) {
  751. return this._remoteTransferCall.apply(this, [provider, service, method, transfer].concat(args));
  752. }
  753. var result = provider[method].apply(provider, args);
  754. return Promise.resolve(result);
  755. }
  756. return Promise.reject(new Error("Service not found: ".concat(service)));
  757. } catch (e) {
  758. return Promise.reject(e);
  759. }
  760. }
  761. /**
  762. * Check if a particular service lives on another worker.
  763. * @param {string} service - the service to check.
  764. * @returns {boolean} - true if the service is remote (calls must cross a Worker boundary), false otherwise.
  765. * @private
  766. */
  767. }, {
  768. key: "_isRemoteService",
  769. value: function _isRemoteService(service) {
  770. return this._getServiceProvider(service).isRemote;
  771. }
  772. /**
  773. * Like {@link call}, but force the call to be posted through a particular communication channel.
  774. * @param {object} provider - send the call through this object's `postMessage` function.
  775. * @param {string} service - the name of the service.
  776. * @param {string} method - the name of the method.
  777. * @param {*} [args] - the arguments to be copied to the method, if any.
  778. * @returns {Promise} - a promise for the return value of the service method.
  779. */
  780. }, {
  781. key: "_remoteCall",
  782. value: function _remoteCall(provider, service, method) {
  783. for (var _len3 = arguments.length, args = new Array(_len3 > 3 ? _len3 - 3 : 0), _key3 = 3; _key3 < _len3; _key3++) {
  784. args[_key3 - 3] = arguments[_key3];
  785. }
  786. return this._remoteTransferCall.apply(this, [provider, service, method, null].concat(args));
  787. }
  788. /**
  789. * Like {@link transferCall}, but force the call to be posted through a particular communication channel.
  790. * @param {object} provider - send the call through this object's `postMessage` function.
  791. * @param {string} service - the name of the service.
  792. * @param {string} method - the name of the method.
  793. * @param {Array} [transfer] - objects to be transferred instead of copied. Must be present in `args` to be useful.
  794. * @param {*} [args] - the arguments to be copied to the method, if any.
  795. * @returns {Promise} - a promise for the return value of the service method.
  796. */
  797. }, {
  798. key: "_remoteTransferCall",
  799. value: function _remoteTransferCall(provider, service, method, transfer) {
  800. var _this = this;
  801. for (var _len4 = arguments.length, args = new Array(_len4 > 4 ? _len4 - 4 : 0), _key4 = 4; _key4 < _len4; _key4++) {
  802. args[_key4 - 4] = arguments[_key4];
  803. }
  804. return new Promise(function (resolve, reject) {
  805. var responseId = _this._storeCallbacks(resolve, reject);
  806. /** @TODO: remove this hack! this is just here so we don't try to send `util` to a worker */
  807. if (args.length > 0 && typeof args[args.length - 1].yield === 'function') {
  808. args.pop();
  809. }
  810. if (transfer) {
  811. provider.postMessage({
  812. service: service,
  813. method: method,
  814. responseId: responseId,
  815. args: args
  816. }, transfer);
  817. } else {
  818. provider.postMessage({
  819. service: service,
  820. method: method,
  821. responseId: responseId,
  822. args: args
  823. });
  824. }
  825. });
  826. }
  827. /**
  828. * Store callback functions pending a response message.
  829. * @param {Function} resolve - function to call if the service method returns.
  830. * @param {Function} reject - function to call if the service method throws.
  831. * @returns {*} - a unique response ID for this set of callbacks. See {@link _deliverResponse}.
  832. * @protected
  833. */
  834. }, {
  835. key: "_storeCallbacks",
  836. value: function _storeCallbacks(resolve, reject) {
  837. var responseId = this.nextResponseId++;
  838. this.callbacks[responseId] = [resolve, reject];
  839. return responseId;
  840. }
  841. /**
  842. * Deliver call response from a worker. This should only be called as the result of a message from a worker.
  843. * @param {int} responseId - the response ID of the callback set to call.
  844. * @param {DispatchResponseMessage} message - the message containing the response value(s).
  845. * @protected
  846. */
  847. }, {
  848. key: "_deliverResponse",
  849. value: function _deliverResponse(responseId, message) {
  850. try {
  851. var _this$callbacks$respo = _slicedToArray(this.callbacks[responseId], 2),
  852. resolve = _this$callbacks$respo[0],
  853. reject = _this$callbacks$respo[1];
  854. delete this.callbacks[responseId];
  855. if (message.error) {
  856. reject(message.error);
  857. } else {
  858. resolve(message.result);
  859. }
  860. } catch (e) {
  861. log.error("Dispatch callback failed: ".concat(JSON.stringify(e)));
  862. }
  863. }
  864. /**
  865. * Handle a message event received from a connected worker.
  866. * @param {Worker} worker - the worker which sent the message, or the global object if running in a worker.
  867. * @param {MessageEvent} event - the message event to be handled.
  868. * @protected
  869. */
  870. }, {
  871. key: "_onMessage",
  872. value: function _onMessage(worker, event) {
  873. /** @type {DispatchMessage} */
  874. var message = event.data;
  875. message.args = message.args || [];
  876. var promise;
  877. if (message.service) {
  878. if (message.service === 'dispatch') {
  879. promise = this._onDispatchMessage(worker, message);
  880. } else {
  881. promise = this.call.apply(this, [message.service, message.method].concat(_toConsumableArray(message.args)));
  882. }
  883. } else if (typeof message.responseId === 'undefined') {
  884. log.error("Dispatch caught malformed message from a worker: ".concat(JSON.stringify(event)));
  885. } else {
  886. this._deliverResponse(message.responseId, message);
  887. }
  888. if (promise) {
  889. if (typeof message.responseId === 'undefined') {
  890. log.error("Dispatch message missing required response ID: ".concat(JSON.stringify(event)));
  891. } else {
  892. promise.then(function (result) {
  893. return worker.postMessage({
  894. responseId: message.responseId,
  895. result: result
  896. });
  897. }, function (error) {
  898. return worker.postMessage({
  899. responseId: message.responseId,
  900. error: error
  901. });
  902. });
  903. }
  904. }
  905. }
  906. /**
  907. * Fetch the service provider object for a particular service name.
  908. * @abstract
  909. * @param {string} service - the name of the service to look up
  910. * @returns {{provider:(object|Worker), isRemote:boolean}} - the means to contact the service, if found
  911. * @protected
  912. */
  913. }, {
  914. key: "_getServiceProvider",
  915. value: function _getServiceProvider(service) {
  916. throw new Error("Could not get provider for ".concat(service, ": _getServiceProvider not implemented"));
  917. }
  918. /**
  919. * Handle a call message sent to the dispatch service itself
  920. * @abstract
  921. * @param {Worker} worker - the worker which sent the message.
  922. * @param {DispatchCallMessage} message - the message to be handled.
  923. * @returns {Promise|undefined} - a promise for the results of this operation, if appropriate
  924. * @private
  925. */
  926. }, {
  927. key: "_onDispatchMessage",
  928. value: function _onDispatchMessage(worker, message) {
  929. throw new Error("Unimplemented dispatch message handler cannot handle ".concat(message.method, " method"));
  930. }
  931. }]);
  932. return SharedDispatch;
  933. }();
  934. module.exports = SharedDispatch;
  935. /***/ }),
  936. /***/ "./node_modules/scratch-vm/src/dispatch/worker-dispatch.js":
  937. /*!*****************************************************************!*\
  938. !*** ./node_modules/scratch-vm/src/dispatch/worker-dispatch.js ***!
  939. \*****************************************************************/
  940. /*! no static exports found */
  941. /***/ (function(module, exports, __webpack_require__) {
  942. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  943. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  944. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  945. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  946. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  947. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  948. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  949. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  950. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  951. var SharedDispatch = __webpack_require__(/*! ./shared-dispatch */ "./node_modules/scratch-vm/src/dispatch/shared-dispatch.js");
  952. var log = __webpack_require__(/*! ../util/log */ "./node_modules/scratch-vm/src/util/log.js");
  953. /**
  954. * This class provides a Worker with the means to participate in the message dispatch system managed by CentralDispatch.
  955. * From any context in the messaging system, the dispatcher's "call" method can call any method on any "service"
  956. * provided in any participating context. The dispatch system will forward function arguments and return values across
  957. * worker boundaries as needed.
  958. * @see {CentralDispatch}
  959. */
  960. var WorkerDispatch =
  961. /*#__PURE__*/
  962. function (_SharedDispatch) {
  963. _inherits(WorkerDispatch, _SharedDispatch);
  964. function WorkerDispatch() {
  965. var _this;
  966. _classCallCheck(this, WorkerDispatch);
  967. _this = _possibleConstructorReturn(this, _getPrototypeOf(WorkerDispatch).call(this));
  968. /**
  969. * This promise will be resolved when we have successfully connected to central dispatch.
  970. * @type {Promise}
  971. * @see {waitForConnection}
  972. * @private
  973. */
  974. _this._connectionPromise = new Promise(function (resolve) {
  975. _this._onConnect = resolve;
  976. });
  977. /**
  978. * Map of service name to local service provider.
  979. * If a service is not listed here, it is assumed to be provided by another context (another Worker or the main
  980. * thread).
  981. * @see {setService}
  982. * @type {object}
  983. */
  984. _this.services = {};
  985. _this._onMessage = _this._onMessage.bind(_assertThisInitialized(_this), self);
  986. if (typeof self !== 'undefined') {
  987. self.onmessage = _this._onMessage;
  988. }
  989. return _this;
  990. }
  991. /**
  992. * @returns {Promise} a promise which will resolve upon connection to central dispatch. If you need to make a call
  993. * immediately on "startup" you can attach a 'then' to this promise.
  994. * @example
  995. * dispatch.waitForConnection.then(() => {
  996. * dispatch.call('myService', 'hello');
  997. * })
  998. */
  999. _createClass(WorkerDispatch, [{
  1000. key: "setService",
  1001. /**
  1002. * Set a local object as the global provider of the specified service.
  1003. * WARNING: Any method on the provider can be called from any worker within the dispatch system.
  1004. * @param {string} service - a globally unique string identifying this service. Examples: 'vm', 'gui', 'extension9'.
  1005. * @param {object} provider - a local object which provides this service.
  1006. * @returns {Promise} - a promise which will resolve once the service is registered.
  1007. */
  1008. value: function setService(service, provider) {
  1009. var _this2 = this;
  1010. if (this.services.hasOwnProperty(service)) {
  1011. log.warn("Worker dispatch replacing existing service provider for ".concat(service));
  1012. }
  1013. this.services[service] = provider;
  1014. return this.waitForConnection.then(function () {
  1015. return _this2._remoteCall(self, 'dispatch', 'setService', service);
  1016. });
  1017. }
  1018. /**
  1019. * Fetch the service provider object for a particular service name.
  1020. * @override
  1021. * @param {string} service - the name of the service to look up
  1022. * @returns {{provider:(object|Worker), isRemote:boolean}} - the means to contact the service, if found
  1023. * @protected
  1024. */
  1025. }, {
  1026. key: "_getServiceProvider",
  1027. value: function _getServiceProvider(service) {
  1028. // if we don't have a local service by this name, contact central dispatch by calling `postMessage` on self
  1029. var provider = this.services[service];
  1030. return {
  1031. provider: provider || self,
  1032. isRemote: !provider
  1033. };
  1034. }
  1035. /**
  1036. * Handle a call message sent to the dispatch service itself
  1037. * @override
  1038. * @param {Worker} worker - the worker which sent the message.
  1039. * @param {DispatchCallMessage} message - the message to be handled.
  1040. * @returns {Promise|undefined} - a promise for the results of this operation, if appropriate
  1041. * @protected
  1042. */
  1043. }, {
  1044. key: "_onDispatchMessage",
  1045. value: function _onDispatchMessage(worker, message) {
  1046. var promise;
  1047. switch (message.method) {
  1048. case 'handshake':
  1049. promise = this._onConnect();
  1050. break;
  1051. case 'terminate':
  1052. // Don't close until next tick, after sending confirmation back
  1053. setTimeout(function () {
  1054. return self.close();
  1055. }, 0);
  1056. promise = Promise.resolve();
  1057. break;
  1058. default:
  1059. log.error("Worker dispatch received message for unknown method: ".concat(message.method));
  1060. }
  1061. return promise;
  1062. }
  1063. }, {
  1064. key: "waitForConnection",
  1065. get: function get() {
  1066. return this._connectionPromise;
  1067. }
  1068. }]);
  1069. return WorkerDispatch;
  1070. }(SharedDispatch);
  1071. module.exports = new WorkerDispatch();
  1072. /***/ }),
  1073. /***/ "./node_modules/scratch-vm/src/extension-support/argument-type.js":
  1074. /*!************************************************************************!*\
  1075. !*** ./node_modules/scratch-vm/src/extension-support/argument-type.js ***!
  1076. \************************************************************************/
  1077. /*! no static exports found */
  1078. /***/ (function(module, exports) {
  1079. /**
  1080. * Block argument types
  1081. * @enum {string}
  1082. */
  1083. var ArgumentType = {
  1084. /**
  1085. * Numeric value with angle picker
  1086. */
  1087. ANGLE: 'angle',
  1088. /**
  1089. * Boolean value with hexagonal placeholder
  1090. */
  1091. BOOLEAN: 'Boolean',
  1092. /**
  1093. * Numeric value with color picker
  1094. */
  1095. COLOR: 'color',
  1096. /**
  1097. * Numeric value with text field
  1098. */
  1099. NUMBER: 'number',
  1100. /**
  1101. * String value with text field
  1102. */
  1103. STRING: 'string',
  1104. /**
  1105. * String value with matrix field
  1106. */
  1107. MATRIX: 'matrix',
  1108. /**
  1109. * MIDI note number with note picker (piano) field
  1110. */
  1111. NOTE: 'note'
  1112. };
  1113. module.exports = ArgumentType;
  1114. /***/ }),
  1115. /***/ "./node_modules/scratch-vm/src/extension-support/block-type.js":
  1116. /*!*********************************************************************!*\
  1117. !*** ./node_modules/scratch-vm/src/extension-support/block-type.js ***!
  1118. \*********************************************************************/
  1119. /*! no static exports found */
  1120. /***/ (function(module, exports) {
  1121. /**
  1122. * Types of block
  1123. * @enum {string}
  1124. */
  1125. var BlockType = {
  1126. /**
  1127. * Boolean reporter with hexagonal shape
  1128. */
  1129. BOOLEAN: 'Boolean',
  1130. /**
  1131. * A button (not an actual block) for some special action, like making a variable
  1132. */
  1133. BUTTON: 'button',
  1134. /**
  1135. * Command block
  1136. */
  1137. COMMAND: 'command',
  1138. /**
  1139. * Specialized command block which may or may not run a child branch
  1140. * The thread continues with the next block whether or not a child branch ran.
  1141. */
  1142. CONDITIONAL: 'conditional',
  1143. /**
  1144. * Specialized hat block with no implementation function
  1145. * This stack only runs if the corresponding event is emitted by other code.
  1146. */
  1147. EVENT: 'event',
  1148. /**
  1149. * Hat block which conditionally starts a block stack
  1150. */
  1151. HAT: 'hat',
  1152. /**
  1153. * Specialized command block which may or may not run a child branch
  1154. * If a child branch runs, the thread evaluates the loop block again.
  1155. */
  1156. LOOP: 'loop',
  1157. /**
  1158. * General reporter with numeric or string value
  1159. */
  1160. REPORTER: 'reporter'
  1161. };
  1162. module.exports = BlockType;
  1163. /***/ }),
  1164. /***/ "./node_modules/scratch-vm/src/extension-support/target-type.js":
  1165. /*!**********************************************************************!*\
  1166. !*** ./node_modules/scratch-vm/src/extension-support/target-type.js ***!
  1167. \**********************************************************************/
  1168. /*! no static exports found */
  1169. /***/ (function(module, exports) {
  1170. /**
  1171. * Default types of Target supported by the VM
  1172. * @enum {string}
  1173. */
  1174. var TargetType = {
  1175. /**
  1176. * Rendered target which can move, change costumes, etc.
  1177. */
  1178. SPRITE: 'sprite',
  1179. /**
  1180. * Rendered target which cannot move but can change backdrops
  1181. */
  1182. STAGE: 'stage'
  1183. };
  1184. module.exports = TargetType;
  1185. /***/ }),
  1186. /***/ "./node_modules/scratch-vm/src/util/log.js":
  1187. /*!*************************************************!*\
  1188. !*** ./node_modules/scratch-vm/src/util/log.js ***!
  1189. \*************************************************/
  1190. /*! no static exports found */
  1191. /***/ (function(module, exports, __webpack_require__) {
  1192. var minilog = __webpack_require__(/*! minilog */ "./node_modules/minilog/lib/web/index.js");
  1193. minilog.enable();
  1194. module.exports = minilog('vm');
  1195. /***/ }),
  1196. /***/ "./node_modules/webpack/buildin/global.js":
  1197. /*!***********************************!*\
  1198. !*** (webpack)/buildin/global.js ***!
  1199. \***********************************/
  1200. /*! no static exports found */
  1201. /***/ (function(module, exports) {
  1202. var g;
  1203. // This works in non-strict mode
  1204. g = (function() {
  1205. return this;
  1206. })();
  1207. try {
  1208. // This works if eval is allowed (see CSP)
  1209. g = g || new Function("return this")();
  1210. } catch (e) {
  1211. // This works if the window reference is available
  1212. if (typeof window === "object") g = window;
  1213. }
  1214. // g can still be undefined, but nothing to do about it...
  1215. // We return undefined, instead of nothing here, so it's
  1216. // easier to handle this case. if(!global) { ...}
  1217. module.exports = g;
  1218. /***/ })
  1219. /******/ });
  1220. //# sourceMappingURL=extension-worker.js.map