1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-07-04 12:29:31 +00:00
8bitworkshop/lib/stellerator/stellerator.min.js

32 lines
311 KiB
JavaScript
Raw Normal View History

2021-09-15 16:01:00 +00:00
!function(){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function s(t,e,s){return t(s={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&s.path)}},s.exports),s.exports}var i=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var s=[];function i(t){return s[t]||(s[t]=function(t){for(var e="return function dispatcher"+t+"(payload) {\n",s=[],i=[],r=0;r<t;r++)s.push("cb"+r),i.push("ctx"+r),e+=" cb"+r+"(payload, ctx"+r+");\n";return e+="};",new(Function.bind.apply(Function,[void 0].concat(s.concat(i),[e])))}(t)),s[t]}s[0]=function(){return function(){}},s[1]=function(t,e){return void 0===e?t:function(s){t(s,e)}};var r=function(){function t(){this.hasHandlers=!1,this._handlers=[],this._contexts=[],this._createDispatcher()}return t.prototype.addHandler=function(t,e){return this.isHandlerAttached(t,e)||(this._handlers.push(t),this._contexts.push(e),this._createDispatcher(),this._updateHasHandlers()),this},t.prototype.removeHandler=function(t,e){var s=this._getHandlerIndex(t,e);return void 0!==s&&(this._handlers.splice(s,1),this._contexts.splice(s,1),this._createDispatcher(),this._updateHasHandlers()),this},t.prototype.isHandlerAttached=function(t,e){return void 0!==this._getHandlerIndex(t,e)},t.prototype._updateHasHandlers=function(){this.hasHandlers=!!this._handlers.length},t.prototype._getHandlerIndex=function(t,e){var s,i=this._handlers.length;for(s=0;s<i&&(this._handlers[s]!==t||this._contexts[s]!==e);s++);return s<i?s:void 0},t.prototype._createDispatcher=function(){this.dispatch=i(this._handlers.length).apply(this,this._handlers.concat(this._contexts))},t}();e.default=r}));e(i);var r=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Event=i.default}));e(r);var n=r.Event,a=s((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var s="resolve_transaction",i="reject_transaction",n="error",a=function(){function t(t,e){void 0===e&&(e=0),this._dispatch=t,this._rpcTimeout=e,this.error=new r.Event,this._rpcHandlers={},this._signalHandlers={},this._pendingTransactions={},this._nextTransactionId=0}return t.prototype.dispatch=function(e){var s=e;switch(s.type){case t.MessageType.signal:return this._handleSignal(s);case t.MessageType.rpc:return this._handeRpc(s);case t.MessageType.internal:return this._handleInternal(s);default:this._raiseError("invalid message type "+s.type)}},t.prototype.rpc=function(e,s,i){var r=this,n=this._nextTransactionId++;return this._dispatch({type:t.MessageType.rpc,transactionId:n,id:e,payload:s},i||void 0),new Promise((function(t,e){var s=r._pendingTransactions[n]={id:n,resolve:t,reject:e};r._rpcTimeout>0&&(r._pendingTransactions[n].timeoutHandle=setTimeout((function(){return r._transactionTimeout(s)}),r._rpcTimeout))}))},t.prototype.signal=function(e,s,i){return this._dispatch({type:t.MessageType.signal,id:e,payload:s},i||void 0),this},t.prototype.registerRpcHandler=function(t,e){if(this._rpcHandlers[t])throw new Error("rpc handler for "+t+" already registered");return this._rpcHandlers[t]=e,this},t.prototype.registerSignalHandler=function(t,e){return this._signalHandlers[t]||(this._signalHandlers[t]=[]),this._signalHandlers[t].push(e),this},t.prototype.deregisterRpcHandler=function(t,e){return this._rpcHandlers[t]&&delete this._rpcHandlers[t],this},t.prototype.deregisterSignalHandler=function(t,e){return this._signalHandlers[t]&&(this._signalHandlers[t]=this._signalHandlers[t].filter((function(t){return e!==t}))),this},t.prototype._raiseError=function(e){this.error.dispatch(new Error(e)),this._dispatch({type:t.MessageType.internal,id:n,payload:e})},t.prototype._handleSignal=function(t){if(!this._signalHandlers[t.id])return this._raiseError("invalid signal "+t.id);this._signalHandlers[t.id].forEach((function(e){return e(t.payload)}))},t.p
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function _(t,e,s,i){var r,n=arguments.length,a=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,s,i);else for(var h=t.length-1;h>=0;h--)(r=t[h])&&(a=(n<3?r(a):n>3?r(e,s,a):r(e,s))||a);return n>3&&a&&Object.defineProperty(e,s,a),a}function d(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function f(t,e,s,i){return new(s||(s=Promise))((function(r,n){function a(t){try{o(i.next(t))}catch(t){n(t)}}function h(t){try{o(i.throw(t))}catch(t){n(t)}}function o(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(a,h)}o((i=i.apply(t,e||[])).next())}))}function p(t,e){var s,i,r,n,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:h(0),throw:h(1),return:h(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function h(n){return function(h){return function(n){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,i&&(r=2&n[0]?i.return:n[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,n[1])).done)return r;switch(i=0,r&&(n=[2&n[0],r.value]),n[0]){case 0:case 1:r=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,i=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==n[0]&&2!==n[0])){a=0;continue}if(3===n[0]&&(!r||n[1]>r[0]&&n[1]<r[3])){a.label=n[1];break}if(6===n[0]&&a.label<r[1]){a.label=r[1],r=n;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(n);break}r[2]&&a.ops.pop(),a.trys.pop();continue}n=e.call(t,a)}catch(t){n=[6,t],i=0}finally{s=r=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,h])}}}var g,b,A;c=new o((function(t,e){u?u.postMessage(t,e):postMessage(t,e),l&&(u=l,u.onmessage=t=>c.dispatch(t.data)),l=null})),c.error.addHandler(t=>{console.log(t?t.message:"unknown rpc error")}),onmessage=t=>u||c.dispatch(t.data),c.registerRpcHandler("/use-port",t=>u||l?Promise.reject("RPC already switched to message port"):(l=t,Promise.resolve())),function(t){let e;!function(t){t.stopped="stopped",t.running="running",t.paused="paused",t.error="error"}(e=t.State||(t.State={}))}(g||(g={}));class m{constructor(t,e,s){this._value=t,this._releaseCB=e,this._disposeCB=s,this._isAvailable=!1,this._isDisposed=!1}adopt(t){this._value=t}get(){return this._value}release(){this._releaseCB(this)}dispose(){this._disposeCB(this)}}class k{constructor(t){this._factory=t,this.event={release:new n,dispose:new n},this._pool=[],this._poolSize=0}get(){let t;if(0===this._poolSize){const e=this._factory();t=new m(e,t=>this._releaseMember(t),t=>this._disposeMember(t))}else t=this._pool[--this._poolSize],t._isAvailable=!1;return t}_releaseMember(t){if(t._isAvailable)throw new Error("Trying to release an already released pool member");if(t._isDisposed)throw new Error("Trying to release an already disposed pool member");const e=this._poolSize++;this._pool[e]=t,t._isAvailable=!0,t._poolPosition=e,this.event.release.dispatch(t.get())}_disposeMember(t){if(t._isDisposed)throw new Error("Trying to dispose of an already disposed pool member");t._isAvailable&&(this._poolSize>1&&(this._pool[t._poolPosition]=this._pool[this._poolSize-1]),this._poolSize--),t._isDisposed=!0,this.event.dispose.dispatch(t.get())}}class y{constructor(){this._height=0,this._width=0,this._buffer=null}static createFromArrayBuffer(t,e,s){return(new y).replaceUnderlyingBuffer(t,e,s)}replaceUnderlyingBuffer(t,e,s){if(t*e*4!==s.byteLength)throw new Error("surface size mismatch");return this._width=t,this._height=e,this._underlyingBuffer=s,this._buffer=new Uint32Array(this._underlyingBuffer),this}getUnderlyingBuffer(){return this._underlyingBuffer}resetUnderlyingBuffer(){return this._width=this._height=0,this._underlyingBuffer=this._buffer=null,this}getWidth(){return this._width}getHeight(){return this._height}getBuffer(){return this._buffer}getByteOrder(){return 0}fill(t){for(let e=0;e<this._buffer.length;e++)this._buffer[e]=t;ret
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var Ti=function(t,e){return(Ti=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s])})(t,e)};var Ei=function(){return(Ei=Object.assign||function(t){for(var e,s=1,i=arguments.length;s<i;s++)for(var r in e=arguments[s])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function Ii(t){var e="function"==typeof Symbol&&Symbol.iterator,s=e&&t[e],i=0;if(s)return s.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ri(t,e){var s="function"==typeof Symbol&&t[Symbol.iterator];if(!s)return t;var i,r,n=s.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(t){r={error:t}}finally{try{i&&!i.done&&(s=n.return)&&s.call(n)}finally{if(r)throw r.error}}return a}function Mi(t){return this instanceof Mi?(this.v=t,this):new Mi(t)}var Fi=Object.freeze({__proto__:null,__extends:function(t,e){function s(){this.constructor=t}Ti(t,e),t.prototype=null===e?Object.create(e):(s.prototype=e.prototype,new s)},get __assign(){return Ei},__rest:function(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(s[i[r]]=t[i[r]])}return s},__decorate:function(t,e,s,i){var r,n=arguments.length,a=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,s,i);else for(var h=t.length-1;h>=0;h--)(r=t[h])&&(a=(n<3?r(a):n>3?r(e,s,a):r(e,s))||a);return n>3&&a&&Object.defineProperty(e,s,a),a},__param:function(t,e){return function(s,i){e(s,i,t)}},__metadata:function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter:function(t,e,s,i){return new(s||(s=Promise))((function(r,n){function a(t){try{o(i.next(t))}catch(t){n(t)}}function h(t){try{o(i.throw(t))}catch(t){n(t)}}function o(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(a,h)}o((i=i.apply(t,e||[])).next())}))},__generator:function(t,e){var s,i,r,n,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:h(0),throw:h(1),return:h(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function h(n){return function(h){return function(n){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,i&&(r=2&n[0]?i.return:n[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,n[1])).done)return r;switch(i=0,r&&(n=[2&n[0],r.value]),n[0]){case 0:case 1:r=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,i=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==n[0]&&2!==n[0])){a=0;continue}if(3===n[0]&&(!r||n[1]>r[0]&&n[1]<r[3])){a.label=n[1];break}if(6===n[0]&&a.label<r[1]){a.label=r[1],r=n;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(n);break}r[2]&&a.ops.pop(),a.trys.pop();continue}n=e.call(t,a)}catch(t){n=[6,t],i=0}finally{s=r=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,h])}}},__createBinding:function(t,e,s,i){void 0===i&&(i=s),t[i]=e[s]},__exportStar:function(t,e){for(var s in t)"default"===s||e.hasOwnProperty(s)||(e[s]=t[s])},__values:Ii,__read:Ri,__spread:function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Ri(arguments[e]));return t},__spreadArrays:function(){for(var t=0,e=0,s=arguments.length;e<s;e++)t+=arguments[e].length;var i=Array(t),r=0;for(e=0;e<s;e++)for(var n=arguments[e],a=0,h=n.length;a<h;a++,r++)i[r]=n[a];return i},__await:Mi,__asyncGenerator:function(t,e,s){if(!Symbol.asyncIterator)throw
//# sourceMappingURL=stellerator.min.js.map