1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-12-11 02:49:22 +00:00
8bitworkshop/lib/stellerator/stellerator-embedded.min.js

23 lines
145 KiB
JavaScript
Raw Normal View History

2021-09-15 16:01:00 +00:00
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).$6502=e()}(this,(function(){"use strict";
/*! *****************************************************************************
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(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 o=t.length-1;o>=0;o--)(r=t[o])&&(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 e(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function s(t,e,s,i){return new(s||(s=Promise))((function(r,n){function a(t){try{h(i.next(t))}catch(t){n(t)}}function o(t){try{h(i.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(a,o)}h((i=i.apply(t,e||[])).next())}))}function i(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:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function o(n){return function(o){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,o])}}}var r=function(){function t(t){if(this._maxConcurrency=t,this._queue=[],t<=0)throw new Error("semaphore must be initialized to a positive value");this._value=t}return t.prototype.acquire=function(){var t=this,e=this.isLocked(),s=new Promise((function(e){return t._queue.push(e)}));return e||this._dispatch(),s},t.prototype.runExclusive=function(t){return s(this,void 0,void 0,(function(){var e,s,r;return i(this,(function(i){switch(i.label){case 0:return[4,this.acquire()];case 1:e=i.sent(),s=e[0],r=e[1],i.label=2;case 2:return i.trys.push([2,,4,5]),[4,t(s)];case 3:return[2,i.sent()];case 4:return r(),[7];case 5:return[2]}}))}))},t.prototype.isLocked=function(){return this._value<=0},t.prototype.release=function(){if(this._maxConcurrency>1)throw new Error("this method is unavailabel on semaphores with concurrency > 1; use the scoped release returned by acquire instead");this._currentReleaser&&(this._currentReleaser(),this._currentReleaser=void 0)},t.prototype._dispatch=function(){var t=this,e=this._queue.shift();if(e){var s=!1;this._currentReleaser=function(){s||(s=!0,t._value++,t._dispatch())},e([this._value--,this._currentReleaser])}},t}(),n=function(){function t(){this._semaphore=new r(1)}return t.prototype.acquire=function(){return s(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return[4,this._semaphore.acquire()];case 1:return t=e.sent(),[2,t[1]]}}))}))},t.prototype.runExclusive=function(t){return this._semaphore.runExclusive((function(){return t()}))},t.prototype.isLocked=function(){return this._semaphore.isLocked()},t.prototype.release=function(){this._semaphore.release()},t}();function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function o(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 h=o((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+"(p
/*!
* screenfull
* v5.0.2 - 2020-02-13
* (c) Sindre Sorhus; MIT License
*/
!function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},s=t.exports,i=function(){for(var t,s=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],i=0,r=s.length,n={};i<r;i++)if((t=s[i])&&t[1]in e){for(i=0;i<t.length;i++)n[s[0][i]]=t[i];return n}return!1}(),r={change:i.fullscreenchange,error:i.fullscreenerror},n={request:function(t){return new Promise(function(s,r){var n=function(){this.off("change",n),s()}.bind(this);this.on("change",n);var a=(t=t||e.documentElement)[i.requestFullscreen]();a instanceof Promise&&a.then(n).catch(r)}.bind(this))},exit:function(){return new Promise(function(t,s){if(this.isFullscreen){var r=function(){this.off("change",r),t()}.bind(this);this.on("change",r);var n=e[i.exitFullscreen]();n instanceof Promise&&n.then(r).catch(s)}else t()}.bind(this))},toggle:function(t){return this.isFullscreen?this.exit():this.request(t)},onchange:function(t){this.on("change",t)},onerror:function(t){this.on("error",t)},on:function(t,s){var i=r[t];i&&e.addEventListener(i,s,!1)},off:function(t,s){var i=r[t];i&&e.removeEventListener(i,s,!1)},raw:i};i?(Object.defineProperties(n,{isFullscreen:{get:function(){return Boolean(e[i.fullscreenElement])}},element:{enumerable:!0,get:function(){return e[i.fullscreenElement]}},isEnabled:{enumerable:!0,get:function(){return Boolean(e[i.fullscreenEnabled])}}}),s?t.exports=n:window.screenfull=n):s?t.exports={isEnabled:!1}:window.screenfull={isEnabled:!1}}()}));ni.isEnabled;const ai=Ls,oi=ni;class hi{constructor(t,e=1e5,s="stellerator-fullscreen"){this._videoDriver=t,this._zIndex=e,this._fullscreenClass=s,this._resizeListener=()=>{this._resizeHandle||(this._resizeHandle=setTimeout(()=>{this._resizeHandle=null,this._adjustSizeForFullscreen()},100))},this._resizeHandle=null,this._changeListener=this._onChange.bind(this),this._engaged=!1}engage(){this._engaged||(this._engaged=!0,ai||!oi?(this._adjustSizeForFullscreen(),window.addEventListener("resize",this._resizeListener),this._engaged=!0):(oi.on("change",this._changeListener),oi.request(this._videoDriver.getCanvas())))}disengage(){this._engaged&&(ai||!oi?(this._resetSize(),window.removeEventListener("resize",this._resizeListener),this._engaged=!1):oi.exit())}toggle(){this._engaged?this.disengage():this.engage()}isEngaged(){return this._engaged}_onChange(){oi&&(oi.isFullscreen?(window.addEventListener("resize",this._resizeListener),this._adjustSizeForFullscreen()):(this._resetSize(),window.removeEventListener("resize",this._resizeListener),oi.off("change",this._changeListener),this._engaged=!1))}_resetSize(){const t=this._videoDriver.getCanvas();this._resizeHandle&&(clearTimeout(this._resizeHandle),this._resizeHandle=null),t.style.width="",t.style.height="",t.style.maxWidth="",t.style.maxHeight="",ai&&(t.style.position="",t.style.top="",t.style.left="",t.style.zIndex=""),document.body.classList.remove(this._fullscreenClass),setTimeout(()=>this._videoDriver.resize(),0)}_adjustSizeForFullscreen(){const t=this._videoDriver.getCanvas();this._videoDriver.resize(window.innerWidth,window.innerHeight),t.style.width=window.innerWidth+"px",t.style.height=window.innerHeight+"px",t.style.maxWidth=window.innerWidth+"px",t.style.maxHeight=window.innerHeight+"px",ai&&(t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.zIndex=""+this._zIndex),document.body.classList.add(this._fullscreenClass)}}var ci;!function(t){let e;!function(t){t.vanilla_2k="vanilla_2k",t.vanilla_4k=
//# sourceMappingURL=stellerator-embedded.min.js.map