UNPKG

@robotical/martyblocks

Version:
1 lines 20.1 kB
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){function r(){}n(11).mixin(r),r.prototype.write=function(e,t,n){this.emit("item",e,t,n)},r.prototype.end=function(){this.emit("end"),this.removeAllListeners()},r.prototype.pipe=function(e){var t=this;function n(){e.write.apply(e,Array.prototype.slice.call(arguments))}function r(){!e._isStdio&&e.end()}return t.emit("unpipe",e),e.emit("pipe",t),t.on("item",n),t.on("end",r),t.when("unpipe",function(o){var i=o===e||void 0===o;return i&&(t.removeListener("item",n),t.removeListener("end",r),e.emit("unpipe")),i}),e},r.prototype.unpipe=function(e){return this.emit("unpipe",e),this},r.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"))},r.mixin=function(e){var t,n=r.prototype;for(t in n)n.hasOwnProperty(t)&&(e.prototype[t]=n[t])},e.exports=r},function(e,t,n){var r=n(9);r.enable(),e.exports=r("vm")},function(e,t){var n={black:"#000",red:"#c23621",green:"#25bc26",yellow:"#bbbb00",blue:"#492ee1",magenta:"#d338d3",cyan:"#33bbc8",gray:"#808080",purple:"#708"};e.exports=function(e,t){return t?"color: #fff; background: "+n[e]+";":"color: "+n[e]+";"}},function(e,t,n){(function(e){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function a(e){var n=function(e,n){if("object"!==t(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,n||"default");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"===t(n)?n:String(n)}var c=n(5),s=n(6),u=n(7),l=n(19),f=function(){function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.nextExtensionId=0,this.initialRegistrations=[],u.waitForConnection.then(function(){u.call("extensions","allocateWorker").then(function(e){var n=r(e,2),o=n[0],i=n[1];t.workerId=o;try{importScripts(i);var a=t.initialRegistrations;t.initialRegistrations=null,Promise.all(a).then(function(){return u.call("extensions","onWorkerInit",o)})}catch(e){u.call("extensions","onWorkerInit",o,e)}})}),this.extensions=[]}var t,n,o;return t=e,(n=[{key:"register",value:function(e){var t=this.nextExtensionId++;this.extensions.push(e);var n="extension.".concat(this.workerId,".").concat(t),r=u.setService(n,e).then(function(){return u.call("extensions","registerExtensionService",n)});return this.initialRegistrations&&this.initialRegistrations.push(r),r}}])&&i(t.prototype,n),o&&i(t,o),Object.defineProperty(t,"prototype",{writable:!1}),e}();e.Scratch=e.Scratch||{},e.Scratch.ArgumentType=c,e.Scratch.BlockType=s,e.Scratch.TargetType=l;var p=new f;e.Scratch.extensions={register:p.register.bind(p)}}).call(this,n(4))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){e.exports={ANGLE:"angle",BOOLEAN:"Boolean",COLOR:"color",NUMBER:"number",STRING:"string",MATRIX:"matrix",NOTE:"note",IMAGE:"image",COG_COLOR:"cog_color"}},function(e,t){e.exports={BOOLEAN:"Boolean",BUTTON:"button",COMMAND:"command",CONDITIONAL:"conditional",EVENT:"event",HAT:"hat",LOOP:"loop",REPORTER:"reporter",HIDDEN:"hidden"}},function(e,t,n){function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===r(t)?t:String(t)}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var n,o=u(e);if(t){var i=u(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return s(e)}(this,n)}}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}var l=n(8),f=n(1),p=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}(u,e);var t,n,r,i=c(u);function u(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),(e=i.call(this))._connectionPromise=new Promise(function(t){e._onConnect=t}),e.services={},e._onMessage=e._onMessage.bind(s(e),self),"undefined"!=typeof self&&(self.onmessage=e._onMessage),e}return t=u,(n=[{key:"waitForConnection",get:function(){return this._connectionPromise}},{key:"setService",value:function(e,t){var n=this;return Object.prototype.hasOwnProperty.call(this.services,e)&&f.warn("Worker dispatch replacing existing service provider for ".concat(e)),this.services[e]=t,this.waitForConnection.then(function(){return n._remoteCall(self,"dispatch","setService",e)})}},{key:"_getServiceProvider",value:function(e){var t=this.services[e];return{provider:t||self,isRemote:!t}}},{key:"_onDispatchMessage",value:function(e,t){var n;switch(t.method){case"handshake":n=this._onConnect();break;case"terminate":setTimeout(function(){return self.close()},0),n=Promise.resolve();break;default:f.error("Worker dispatch received message for unknown method: ".concat(t.method))}return n}}])&&o(t.prototype,n),r&&o(t,r),Object.defineProperty(t,"prototype",{writable:!1}),u}(l);e.exports=new p},function(e,t,n){function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||a(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function u(e){var t=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===r(t)?t:String(t)}var l=n(1),f=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.callbacks=[],this.nextResponseId=0}var t,n,r;return t=e,n=[{key:"call",value:function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return this.transferCall.apply(this,[e,t,null].concat(r))}},{key:"transferCall",value:function(e,t,n){try{var r=this._getServiceProvider(e),o=r.provider,i=r.isRemote;if(o){for(var a=arguments.length,c=new Array(a>3?a-3:0),s=3;s<a;s++)c[s-3]=arguments[s];if(i)return this._remoteTransferCall.apply(this,[o,e,t,n].concat(c));var u=o[t].apply(o,c);return Promise.resolve(u)}return Promise.reject(new Error("Service not found: ".concat(e)))}catch(e){return Promise.reject(e)}}},{key:"_isRemoteService",value:function(e){return this._getServiceProvider(e).isRemote}},{key:"_remoteCall",value:function(e,t,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),i=3;i<r;i++)o[i-3]=arguments[i];return this._remoteTransferCall.apply(this,[e,t,n,null].concat(o))}},{key:"_remoteTransferCall",value:function(e,t,n,r){for(var o=this,i=arguments.length,a=new Array(i>4?i-4:0),c=4;c<i;c++)a[c-4]=arguments[c];return new Promise(function(i,c){var s=o._storeCallbacks(i,c);a.length>0&&"function"==typeof a[a.length-1].yield&&a.pop(),r?e.postMessage({service:t,method:n,responseId:s,args:a},r):e.postMessage({service:t,method:n,responseId:s,args:a})})}},{key:"_storeCallbacks",value:function(e,t){var n=this.nextResponseId++;return this.callbacks[n]=[e,t],n}},{key:"_deliverResponse",value:function(e,t){try{var n=i(this.callbacks[e],2),r=n[0],o=n[1];delete this.callbacks[e],t.error?o(t.error):r(t.result)}catch(e){l.error("Dispatch callback failed: ".concat(JSON.stringify(e)))}}},{key:"_onMessage",value:function(e,t){var n,r=t.data;r.args=r.args||[],r.service?n="dispatch"===r.service?this._onDispatchMessage(e,r):this.call.apply(this,[r.service,r.method].concat(o(r.args))):void 0===r.responseId?l.error("Dispatch caught malformed message from a worker: ".concat(JSON.stringify(t))):this._deliverResponse(r.responseId,r),n&&(void 0===r.responseId?l.error("Dispatch message missing required response ID: ".concat(JSON.stringify(t))):n.then(function(t){return e.postMessage({responseId:r.responseId,result:t})},function(t){return e.postMessage({responseId:r.responseId,error:t})}))}},{key:"_getServiceProvider",value:function(e){throw new Error("Could not get provider for ".concat(e,": _getServiceProvider not implemented"))}},{key:"_onDispatchMessage",value:function(e,t){throw new Error("Unimplemented dispatch message handler cannot handle ".concat(t.method," method"))}}],n&&s(t.prototype,n),r&&s(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();e.exports=f},function(e,t,n){var r=n(10),o=r.enable,i=r.disable,a="undefined"!=typeof navigator&&/chrome/i.test(navigator.userAgent),c=n(13);if(r.defaultBackend=a?c.minilog:c,"undefined"!=typeof window){try{r.enable(JSON.parse(window.localStorage.minilogSettings))}catch(e){}if(window.location&&window.location.search){var s=RegExp("[?&]minilog=([^&]*)").exec(window.location.search);s&&r.enable(decodeURIComponent(s[1]))}}r.enable=function(){o.call(r,!0);try{window.localStorage.minilogSettings=JSON.stringify(!0)}catch(e){}return this},r.disable=function(){i.call(r);try{delete window.localStorage.minilogSettings}catch(e){}return this},(e.exports=r).backends={array:n(16),browser:r.defaultBackend,localStorage:n(17),jQuery:n(18)}},function(e,t,n){var r=n(0),o=n(12),i=new r,a=Array.prototype.slice;t=e.exports=function(e){var n=function(){return i.write(e,void 0,a.call(arguments)),n};return n.debug=function(){return i.write(e,"debug",a.call(arguments)),n},n.info=function(){return i.write(e,"info",a.call(arguments)),n},n.warn=function(){return i.write(e,"warn",a.call(arguments)),n},n.error=function(){return i.write(e,"error",a.call(arguments)),n},n.log=n.debug,n.suggest=t.suggest,n.format=i.format,n},t.defaultBackend=t.defaultFormatter=null,t.pipe=function(e){return i.pipe(e)},t.end=t.unpipe=t.disable=function(e){return i.unpipe(e)},t.Transform=r,t.Filter=o,t.suggest=new o,t.enable=function(){return t.defaultFormatter?i.pipe(t.suggest).pipe(t.defaultFormatter).pipe(t.defaultBackend):i.pipe(t.suggest).pipe(t.defaultBackend)}},function(e,t){function n(){this._events={}}n.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,r=this._events[e]||[];for(n=r.length-1;n>=0&&r[n];n--)r[n]!==t&&r[n].cb!==t||r.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),r=this._events[e]||[];for(t=r.length-1;t>=0&&r[t];t--)r[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 r(){n||this.removeListener(e,r),t.apply(this,arguments)&&n&&this.removeListener(e,r)}return r.cb=t,this.on(e,r),this}},n.mixin=function(e){var t,r=n.prototype;for(t in r)r.hasOwnProperty(t)&&(e.prototype[t]=r[t])},e.exports=n},function(e,t,n){var r=n(0),o={debug:1,info:2,warn:3,error:4};function i(){this.enabled=!0,this.defaultResult=!0,this.clear()}function a(e,t){return e.n.test?e.n.test(t):e.n==t}r.mixin(i),i.prototype.allow=function(e,t){return this._white.push({n:e,l:o[t]}),this},i.prototype.deny=function(e,t){return this._black.push({n:e,l:o[t]}),this},i.prototype.clear=function(){return this._white=[],this._black=[],this},i.prototype.test=function(e,t){var n,r=Math.max(this._white.length,this._black.length);for(n=0;n<r;n++){if(this._white[n]&&a(this._white[n],e)&&o[t]>=this._white[n].l)return!0;if(this._black[n]&&a(this._black[n],e)&&o[t]<=this._black[n].l)return!1}return this.defaultResult},i.prototype.write=function(e,t,n){if(!this.enabled||this.test(e,t))return this.emit("item",e,t,n)},e.exports=i},function(e,t,n){var r=n(0),o=/\n+$/,i=new r;i.write=function(e,t,n){var r=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[r]&&"string"==typeof n[r]&&(n[r]=n[r].replace(o,""));try{for(r=0;r<n.length;r++)n[r]=JSON.stringify(n[r])}catch(e){}console.log(n.join(" "))}}},i.formatters=["color","minilog"],i.color=n(14),i.minilog=n(15),e.exports=i},function(e,t,n){var r=n(0),o=n(2),i={debug:["cyan"],info:["purple"],warn:["yellow",!0],error:["red",!0]},a=new r;a.write=function(e,t,n){console.log;console[t]&&console[t].apply&&console[t].apply(console,["%c"+e+" %c"+t,o("gray"),o.apply(o,i[t])].concat(n))},a.pipe=function(){},e.exports=a},function(e,t,n){var r=n(0),o=n(2),i={debug:["gray"],info:["purple"],warn:["yellow",!0],error:["red",!0]},a=new r;a.write=function(e,t,n){var r=console.log;"debug"!=t&&console[t]&&(r=console[t]);var a=0;if("info"!=t){for(;a<n.length&&"string"==typeof n[a];a++);r.apply(console,["%c"+e+" "+n.slice(0,a).join(" "),o.apply(o,i[t])].concat(n.slice(a)))}else r.apply(console,["%c"+e,o.apply(o,i[t])].concat(n))},a.pipe=function(){},e.exports=a},function(e,t,n){var r=n(0),o=[],i=new r;i.write=function(e,t,n){o.push([e,t,n])},i.get=function(){return o},i.empty=function(){o=[]},e.exports=i},function(e,t,n){var r=n(0),o=!1,i=new r;i.write=function(e,t,n){if("undefined"!=typeof window&&"undefined"!=typeof JSON&&JSON.stringify&&JSON.parse)try{o||(o=window.localStorage.minilog?JSON.parse(window.localStorage.minilog):[]),o.push([(new Date).toString(),e,t,n]),window.localStorage.minilog=JSON.stringify(o)}catch(e){}},e.exports=i},function(e,t,n){var r=n(0),o=(new Date).valueOf().toString(36);function i(e){this.url=e.url||"",this.cache=[],this.timer=null,this.interval=e.interval||3e4,this.enabled=!0,this.jQuery=window.jQuery,this.extras={}}r.mixin(i),i.prototype.write=function(e,t,n){this.timer||this.init(),this.cache.push([e,t].concat(n))},i.prototype.init=function(){if(this.enabled&&this.jQuery){var e=this;this.timer=setTimeout(function(){var t,n,r=[],i=e.url;if(0==e.cache.length)return e.init();for(t=0;t<e.cache.length;t++)try{JSON.stringify(e.cache[t]),r.push(e.cache[t])}catch(e){}e.jQuery.isEmptyObject(e.extras)?(n=JSON.stringify({logs:r}),i=e.url+"?client_id="+o):n=JSON.stringify(e.jQuery.extend({logs:r},e.extras)),e.jQuery.ajax(i,{type:"POST",cache:!1,processData:!1,data:n,contentType:"application/json",timeout:1e4}).success(function(t,n,r){t.interval&&(e.interval=Math.max(1e3,t.interval))}).error(function(){e.interval=3e4}).always(function(){e.init()}),e.cache=[]},this.interval)}},i.prototype.end=function(){},i.jQueryWait=function(e){if("undefined"!=typeof window&&(window.jQuery||window.$))return e(window.jQuery||window.$);"undefined"!=typeof window&&setTimeout(function(){i.jQueryWait(e)},200)},e.exports=i},function(e,t){e.exports={SPRITE:"sprite",STAGE:"stage"}}]);