js-dos 8.4.0 → 8.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/js-dos.js CHANGED
@@ -18,5 +18,5 @@ var Et=Pt;var Ot="function"==typeof Object.is?Object.is:function(e,t){return e==
18
18
  * This source code is licensed under the MIT license found in the
19
19
  * LICENSE file in the root directory of this source tree.
20
20
  */function qn(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case Dn:switch(e=e.type){case Ln:case zn:case In:case Un:case Kn:return e;default:switch(e=e&&e.$$typeof){case Nn:case Rn:case Fn:case Vn:case Hn:case Bn:return e;default:return t}}case Tn:return t}}}function Xn(){const e=Xt;let t=null,n=null;return{clear(){t=null,n=null},notify(){e((()=>{let e=t;for(;e;)e.callback(),e=e.next}))},get(){let e=[],n=t;for(;n;)e.push(n),n=n.next;return e},subscribe(e){let o=!0,r=n={callback:e,next:null,prev:n};return r.prev?r.prev.next=r:t=r,function(){o&&null!==t&&(o=!1,r.next?r.next.prev=r.prev:n=r.prev,r.prev?r.prev.next=r.next:t=r.next)}}}}jn=Symbol.for("react.module.reference"),An.ContextConsumer=Rn,An.ContextProvider=Bn,An.Element=Dn,An.ForwardRef=Fn,An.Fragment=Ln,An.Lazy=Vn,An.Memo=Hn,An.Portal=Tn,An.Profiler=zn,An.StrictMode=In,An.Suspense=Un,An.SuspenseList=Kn,An.isAsyncMode=function(){return!1},An.isConcurrentMode=function(){return!1},An.isContextConsumer=function(e){return qn(e)===Rn},An.isContextProvider=function(e){return qn(e)===Bn},An.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===Dn},An.isForwardRef=function(e){return qn(e)===Fn},An.isFragment=function(e){return qn(e)===Ln},An.isLazy=function(e){return qn(e)===Vn},An.isMemo=function(e){return qn(e)===Hn},An.isPortal=function(e){return qn(e)===Tn},An.isProfiler=function(e){return qn(e)===zn},An.isStrictMode=function(e){return qn(e)===In},An.isSuspense=function(e){return qn(e)===Un},An.isSuspenseList=function(e){return qn(e)===Kn},An.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===Ln||e===zn||e===In||e===Un||e===Kn||e===Wn||"object"==typeof e&&null!==e&&(e.$$typeof===Vn||e.$$typeof===Hn||e.$$typeof===Bn||e.$$typeof===Rn||e.$$typeof===Fn||e.$$typeof===jn||void 0!==e.getModuleId)},An.typeOf=qn;const Gn={notify(){},get:()=>[]};const $n=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement)?ce:ae;function Yn({store:e,context:t,children:n,serverState:o,stabilityCheck:r="once",noopCheck:i="once"}){const s=de((()=>{const t=function(e){let t,n=Gn,o=0,r=!1;function i(){c.onStateChange&&c.onStateChange()}function s(){o++,t||(t=e.subscribe(i),n=Xn())}function a(){o--,t&&0===o&&(t(),t=void 0,n.clear(),n=Gn)}const c={addNestedSub:function(e){s();const t=n.subscribe(e);let o=!1;return()=>{o||(o=!0,t(),a())}},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:i,isSubscribed:function(){return r},trySubscribe:function(){r||(r=!0,s())},tryUnsubscribe:function(){r&&(r=!1,a())},getListeners:()=>n};return c}(e);return{store:e,subscription:t,getServerState:o?()=>o:void 0,stabilityCheck:r,noopCheck:i}}),[e,o,r,i]),a=de((()=>e.getState()),[e]);$n((()=>{const{subscription:t}=s;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),a!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[s,a]);return m((t||Jt).Provider,{value:s},n)}function Jn(e=Jt){const t=e===Jt?Zt:Qt(e);return function(){const{store:e}=t();return e}}const Qn=Jn();function Zn(e=Jt){const t=e===Jt?Qn:Jn(e);return function(){return t().dispatch}}const eo=Zn();var to;function no(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function oo(e){return!!e&&!!e[Vo]}function ro(e){var t;return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Wo}(e)||Array.isArray(e)||!!e[Ho]||!!(null===(t=e.constructor)||void 0===t?void 0:t[Ho])||uo(e)||po(e))}function io(e,t,n){void 0===n&&(n=!1),0===so(e)?(n?Object.keys:qo)(e).forEach((function(o){n&&"symbol"==typeof o||t(o,e[o],e)})):e.forEach((function(n,o){return t(o,n,e)}))}function so(e){var t=e[Vo];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:uo(e)?2:po(e)?3:0}function ao(e,t){return 2===so(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function co(e,t,n){var o=so(e);2===o?e.set(t,n):3===o?e.add(n):e[t]=n}function lo(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function uo(e){return No&&e instanceof Map}function po(e){return Fo&&e instanceof Set}function fo(e){return e.o||e.t}function ho(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Xo(e);delete t[Vo];for(var n=qo(t),o=0;o<n.length;o++){var r=n[o],i=t[r];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[r]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[r]})}return Object.create(Object.getPrototypeOf(e),t)}function vo(e,t){return void 0===t&&(t=!1),_o(e)||oo(e)||!ro(e)||(so(e)>1&&(e.set=e.add=e.clear=e.delete=mo),Object.freeze(e),t&&io(e,(function(e,t){return vo(t,!0)}),!0)),e}function mo(){no(2)}function _o(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function yo(e){var t=Go[e];return t||no(18,e),t}function go(){return Bo}function bo(e,t){t&&(yo("Patches"),e.u=[],e.s=[],e.v=t)}function wo(e){xo(e),e.p.forEach(Co),e.p=null}function xo(e){e===Bo&&(Bo=e.l)}function ko(e){return Bo={p:[],l:Bo,h:e,m:!0,_:0}}function Co(e){var t=e[Vo];0===t.i||1===t.i?t.j():t.g=!0}function So(e,t){t._=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.O||yo("ES5").S(t,e,o),o?(n[Vo].P&&(wo(t),no(4)),ro(e)&&(e=Po(t,e),t.l||Oo(t,e)),t.u&&yo("Patches").M(n[Vo].t,e,t.u,t.s)):e=Po(t,n,[]),wo(t),t.u&&t.v(t.u,t.s),e!==Ko?e:void 0}function Po(e,t,n){if(_o(t))return t;var o=t[Vo];if(!o)return io(t,(function(r,i){return Eo(e,o,t,r,i,n)}),!0),t;if(o.A!==e)return t;if(!o.P)return Oo(e,o.t,!0),o.t;if(!o.I){o.I=!0,o.A._--;var r=4===o.i||5===o.i?o.o=ho(o.k):o.o,i=r,s=!1;3===o.i&&(i=new Set(r),r.clear(),s=!0),io(i,(function(t,i){return Eo(e,o,r,t,i,n,s)})),Oo(e,r,!1),n&&e.u&&yo("Patches").N(o,n,e.u,e.s)}return o.o}function Eo(e,t,n,o,r,i,s){if(oo(r)){var a=Po(e,r,i&&t&&3!==t.i&&!ao(t.R,o)?i.concat(o):void 0);if(co(n,o,a),!oo(a))return;e.m=!1}else s&&n.add(r);if(ro(r)&&!_o(r)){if(!e.h.D&&e._<1)return;Po(e,r),t&&t.A.l||Oo(e,r)}}function Oo(e,t,n){void 0===n&&(n=!1),!e.l&&e.h.D&&e.m&&vo(t,n)}function Mo(e,t){var n=e[Vo];return(n?fo(n):e)[t]}function jo(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Object.getPrototypeOf(n)}}function Ao(e){e.P||(e.P=!0,e.l&&Ao(e.l))}function Do(e){e.o||(e.o=ho(e.t))}function To(e,t,n){var o=uo(t)?yo("MapSet").F(t,n):po(t)?yo("MapSet").T(t,n):e.O?function(e,t){var n=Array.isArray(e),o={i:n?1:0,A:t?t.A:go(),P:!1,I:!1,R:{},l:t,t:e,k:null,o:null,j:null,C:!1},r=o,i=$o;n&&(r=[o],i=Yo);var s=Proxy.revocable(r,i),a=s.revoke,c=s.proxy;return o.k=c,o.j=a,c}(t,n):yo("ES5").J(t,n);return(n?n.A:go()).p.push(o),o}function Lo(e){return oo(e)||no(22,e),function e(t){if(!ro(t))return t;var n,o=t[Vo],r=so(t);if(o){if(!o.P&&(o.i<4||!yo("ES5").K(o)))return o.t;o.I=!0,n=Io(t,r),o.I=!1}else n=Io(t,r);return io(n,(function(t,r){o&&function(e,t){return 2===so(e)?e.get(t):e[t]}(o.t,t)===r||co(n,t,e(r))})),3===r?new Set(n):n}(e)}function Io(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return ho(e)}to=qt.useSyncExternalStoreWithSelector,en=to,Xt=ht;var zo,Bo,Ro="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),No="undefined"!=typeof Map,Fo="undefined"!=typeof Set,Uo="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Ko=Ro?Symbol.for("immer-nothing"):((zo={})["immer-nothing"]=!0,zo),Ho=Ro?Symbol.for("immer-draftable"):"__$immer_draftable",Vo=Ro?Symbol.for("immer-state"):"__$immer_state",Wo=""+Object.prototype.constructor,qo="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Xo=Object.getOwnPropertyDescriptors||function(e){var t={};return qo(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Go={},$o={get:function(e,t){if(t===Vo)return e;var n,o,r,i=fo(e);if(!ao(i,t))return n=e,(r=jo(i,t))?"value"in r?r.value:null===(o=r.get)||void 0===o?void 0:o.call(n.k):void 0;var s=i[t];return e.I||!ro(s)?s:s===Mo(e.t,t)?(Do(e),e.o[t]=To(e.A.h,s,e)):s},has:function(e,t){return t in fo(e)},ownKeys:function(e){return Reflect.ownKeys(fo(e))},set:function(e,t,n){var o=jo(fo(e),t);if(null==o?void 0:o.set)return o.set.call(e.k,n),!0;if(!e.P){var r=Mo(fo(e),t),i=null==r?void 0:r[Vo];if(i&&i.t===n)return e.o[t]=n,e.R[t]=!1,!0;if(lo(n,r)&&(void 0!==n||ao(e.t,t)))return!0;Do(e),Ao(e)}return e.o[t]===n&&(void 0!==n||t in e.o)||Number.isNaN(n)&&Number.isNaN(e.o[t])||(e.o[t]=n,e.R[t]=!0),!0},deleteProperty:function(e,t){return void 0!==Mo(e.t,t)||t in e.t?(e.R[t]=!1,Do(e),Ao(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=fo(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty:function(){no(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){no(12)}},Yo={};io($o,(function(e,t){Yo[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Yo.deleteProperty=function(e,t){return Yo.set.call(this,e,t,void 0)},Yo.set=function(e,t,n){return $o.set.call(this,e[0],t,n,e[0])};var Jo=function(){function e(e){var t=this;this.O=Uo,this.D=!0,this.produce=function(e,n,o){if("function"==typeof e&&"function"!=typeof n){var r=n;n=e;var i=t;return function(e){var t=this;void 0===e&&(e=r);for(var o=arguments.length,s=Array(o>1?o-1:0),a=1;a<o;a++)s[a-1]=arguments[a];return i.produce(e,(function(e){var o;return(o=n).call.apply(o,[t,e].concat(s))}))}}var s;if("function"!=typeof n&&no(6),void 0!==o&&"function"!=typeof o&&no(7),ro(e)){var a=ko(t),c=To(t,e,void 0),l=!0;try{s=n(c),l=!1}finally{l?wo(a):xo(a)}return"undefined"!=typeof Promise&&s instanceof Promise?s.then((function(e){return bo(a,o),So(e,a)}),(function(e){throw wo(a),e})):(bo(a,o),So(s,a))}if(!e||"object"!=typeof e){if(void 0===(s=n(e))&&(s=e),s===Ko&&(s=void 0),t.D&&vo(s,!0),o){var u=[],d=[];yo("Patches").M(e,s,u,d),o(u,d)}return s}no(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var o=arguments.length,r=Array(o>1?o-1:0),i=1;i<o;i++)r[i-1]=arguments[i];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(r))}))};var o,r,i=t.produce(e,n,(function(e,t){o=e,r=t}));return"undefined"!=typeof Promise&&i instanceof Promise?i.then((function(e){return[e,o,r]})):[i,o,r]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){ro(e)||no(8),oo(e)&&(e=Lo(e));var t=ko(this),n=To(this,e,void 0);return n[Vo].C=!0,xo(t),n},t.finishDraft=function(e,t){var n=(e&&e[Vo]).A;return bo(n,t),So(void 0,n)},t.setAutoFreeze=function(e){this.D=e},t.setUseProxies=function(e){e&&!Uo&&no(20),this.O=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));var r=yo("Patches").$;return oo(e)?r(e,t):this.produce(e,(function(e){return r(e,t)}))},e}(),Qo=new Jo,Zo=Qo.produce;function er(e){return(er="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})(e)}function tr(e){var t=function(e,t){if("object"!==er(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!==er(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===er(t)?t:String(t)}function nr(e,t,n){return(t=tr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function or(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function rr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?or(Object(n),!0).forEach((function(t){nr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):or(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ir(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}Qo.produceWithPatches.bind(Qo),Qo.setAutoFreeze.bind(Qo),Qo.setUseProxies.bind(Qo),Qo.applyPatches.bind(Qo),Qo.createDraft.bind(Qo),Qo.finishDraft.bind(Qo);var sr="function"==typeof Symbol&&Symbol.observable||"@@observable",ar=function(){return Math.random().toString(36).substring(7).split("").join(".")},cr={INIT:"@@redux/INIT"+ar(),REPLACE:"@@redux/REPLACE"+ar(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+ar()}};function lr(e,t,n){var o;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(ir(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(ir(1));return n(lr)(e,t)}if("function"!=typeof e)throw new Error(ir(2));var r=e,i=t,s=[],a=s,c=!1;function l(){a===s&&(a=s.slice())}function u(){if(c)throw new Error(ir(3));return i}function d(e){if("function"!=typeof e)throw new Error(ir(4));if(c)throw new Error(ir(5));var t=!0;return l(),a.push(e),function(){if(t){if(c)throw new Error(ir(6));t=!1,l();var n=a.indexOf(e);a.splice(n,1),s=null}}}function p(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(ir(7));if(void 0===e.type)throw new Error(ir(8));if(c)throw new Error(ir(9));try{c=!0,i=r(i,e)}finally{c=!1}for(var t=s=a,n=0;n<t.length;n++){(0,t[n])()}return e}return p({type:cr.INIT}),(o={dispatch:p,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(ir(10));r=e,p({type:cr.REPLACE})}})[sr]=function(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(ir(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[sr]=function(){return this},e},o}function ur(e){for(var t=Object.keys(e),n={},o=0;o<t.length;o++){var r=t[o];"function"==typeof e[r]&&(n[r]=e[r])}var i,s=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:cr.INIT}))throw new Error(ir(12));if(void 0===n(void 0,{type:cr.PROBE_UNKNOWN_ACTION()}))throw new Error(ir(13))}))}(n)}catch(a){i=a}return function(e,t){if(void 0===e&&(e={}),i)throw i;for(var o=!1,r={},a=0;a<s.length;a++){var c=s[a],l=n[c],u=e[c],d=l(u,t);if(void 0===d)throw t&&t.type,new Error(ir(14));r[c]=d,o=o||d!==u}return(o=o||s.length!==Object.keys(e).length)?r:e}}function dr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function pr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),o=function(){throw new Error(ir(15))},r={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},i=t.map((function(e){return e(r)}));return o=dr.apply(void 0,i)(n.dispatch),rr(rr({},n),{},{dispatch:o})}}}function fr(e){return function(t){var n=t.dispatch,o=t.getState;return function(t){return function(r){return"function"==typeof r?r(n,o,e):t(r)}}}}var hr=fr();hr.withExtraArgument=fr;var vr=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),mr=function(e,t){var n,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(a){i=[6,a],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},_r=function(e,t){for(var n=0,o=t.length,r=e.length;n<o;n++,r++)e[r]=t[n];return e},yr=Object.defineProperty,gr=Object.defineProperties,br=Object.getOwnPropertyDescriptors,wr=Object.getOwnPropertySymbols,xr=Object.prototype.hasOwnProperty,kr=Object.prototype.propertyIsEnumerable,Cr=function(e,t,n){return t in e?yr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Sr=function(e,t){for(var n in t||(t={}))xr.call(t,n)&&Cr(e,n,t[n]);if(wr)for(var o=0,r=wr(t);o<r.length;o++){n=r[o];kr.call(t,n)&&Cr(e,n,t[n])}return e},Pr=function(e,t){return gr(e,br(t))},Er="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?dr:dr.apply(null,arguments)};function Or(e,t){function n(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(t){var r=t.apply(void 0,n);if(!r)throw new Error("prepareAction did not return an object");return Sr(Sr({type:e,payload:r.payload},"meta"in r&&{meta:r.meta}),"error"in r&&{error:r.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}var Mr=function(e){function t(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var r=e.apply(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return vr(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,_r([void 0],e[0].concat(this)))):new(t.bind.apply(t,_r([void 0],e.concat(this))))},t}(Array),jr=function(e){function t(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var r=e.apply(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return vr(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,_r([void 0],e[0].concat(this)))):new(t.bind.apply(t,_r([void 0],e.concat(this))))},t}(Array);function Ar(e){return ro(e)?Zo(e,(function(){})):e}function Dr(){return function(e){return function(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t;e.immutableCheck,e.serializableCheck,e.actionCreatorCheck;var o=new Mr;n&&("boolean"==typeof n?o.push(hr):o.push(hr.withExtraArgument(n.extraArgument)));return o}(e)}}function Tr(e){var t,n=Dr(),o=e,r=o.reducer,i=void 0===r?void 0:r,s=o.middleware,a=void 0===s?n():s,c=o.devTools,l=void 0===c||c,u=o.preloadedState,d=void 0===u?void 0:u,p=o.enhancers,f=void 0===p?void 0:p;if("function"==typeof i)t=i;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(i))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=ur(i)}var h=a;"function"==typeof h&&(h=h(n));var v=pr.apply(void 0,h),m=dr;l&&(m=Er(Sr({trace:!1},"object"==typeof l&&l)));var _=new jr(v),y=_;return Array.isArray(f)?y=_r([v],f):"function"==typeof f&&(y=f(_)),lr(t,d,m.apply(void 0,y))}function Lr(e){var t,n={},o=[],r={addCase:function(e,t){var o="string"==typeof e?e:e.type;if(!o)throw new Error("`builder.addCase` cannot be called with an empty action type");if(o in n)throw new Error("`builder.addCase` cannot be called with two reducers for the same action type");return n[o]=t,r},addMatcher:function(e,t){return o.push({matcher:e,reducer:t}),r},addDefaultCase:function(e){return t=e,r}};return e(r),[n,o,t]}function Ir(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,o="function"==typeof e.initialState?e.initialState:Ar(e.initialState),r=e.reducers||{},i=Object.keys(r),s={},a={},c={};function l(){var t="function"==typeof e.extraReducers?Lr(e.extraReducers):[e.extraReducers],n=t[0],r=void 0===n?{}:n,i=t[1],s=void 0===i?[]:i,c=t[2],l=void 0===c?void 0:c,u=Sr(Sr({},r),a);return function(e,t,n,o){void 0===n&&(n=[]);var r,i="function"==typeof t?Lr(t):[t,n,o],s=i[0],a=i[1],c=i[2];if("function"==typeof e)r=function(){return Ar(e())};else{var l=Ar(e);r=function(){return l}}function u(e,t){void 0===e&&(e=r());var n=_r([s[t.type]],a.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[c]),n.reduce((function(e,n){if(n){var o;if(oo(e))return void 0===(o=n(e,t))?e:o;if(ro(e))return Zo(e,(function(e){return n(e,t)}));if(void 0===(o=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return o}return e}),e)}return u.getInitialState=r,u}(o,(function(e){for(var t in u)e.addCase(t,u[t]);for(var n=0,o=s;n<o.length;n++){var r=o[n];e.addMatcher(r.matcher,r.reducer)}l&&e.addDefaultCase(l)}))}return i.forEach((function(e){var n,o,i=r[e],l=t+"/"+e;"reducer"in i?(n=i.reducer,o=i.prepare):n=i,s[e]=n,a[l]=n,c[e]=o?Or(l,o):Or(l)})),{name:t,reducer:function(e,t){return n||(n=l()),n(e,t)},actions:c,caseReducers:s,getInitialState:function(){return n||(n=l()),n.getInitialState()}}}var zr=["name","message","stack","code"],Br=function(){return function(e,t){this.payload=e,this.meta=t}}(),Rr=function(){return function(e,t){this.payload=e,this.meta=t}}(),Nr=function(e){if("object"==typeof e&&null!==e){for(var t={},n=0,o=zr;n<o.length;n++){var r=o[n];"string"==typeof e[r]&&(t[r]=e[r])}return t}return{message:String(e)}};function Fr(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}!function(){function e(e,t,n){var o=Or(e+"/fulfilled",(function(e,t,n,o){return{payload:e,meta:Pr(Sr({},o||{}),{arg:n,requestId:t,requestStatus:"fulfilled"})}})),r=Or(e+"/pending",(function(e,t,n){return{payload:void 0,meta:Pr(Sr({},n||{}),{arg:t,requestId:e,requestStatus:"pending"})}})),i=Or(e+"/rejected",(function(e,t,o,r,i){return{payload:r,error:(n&&n.serializeError||Nr)(e||"Rejected"),meta:Pr(Sr({},i||{}),{arg:o,requestId:t,rejectedWithValue:!!r,requestStatus:"rejected",aborted:"AbortError"===(null==e?void 0:e.name),condition:"ConditionError"===(null==e?void 0:e.name)})}})),s="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign((function(e){return function(a,c,l){var u,d=(null==n?void 0:n.idGenerator)?n.idGenerator(e):function(e){void 0===e&&(e=21);for(var t="",n=e;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t}(),p=new s;function f(e){u=e,p.abort()}var h=function(){return s=this,h=null,v=function(){var s,h,v,m,_,y;return mr(this,(function(g){switch(g.label){case 0:return g.trys.push([0,4,,5]),m=null==(s=null==n?void 0:n.condition)?void 0:s.call(n,e,{getState:c,extra:l}),null===(b=m)||"object"!=typeof b||"function"!=typeof b.then?[3,2]:[4,m];case 1:m=g.sent(),g.label=2;case 2:if(!1===m||p.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return _=new Promise((function(e,t){return p.signal.addEventListener("abort",(function(){return t({name:"AbortError",message:u||"Aborted"})}))})),a(r(d,e,null==(h=null==n?void 0:n.getPendingMeta)?void 0:h.call(n,{requestId:d,arg:e},{getState:c,extra:l}))),[4,Promise.race([_,Promise.resolve(t(e,{dispatch:a,getState:c,extra:l,requestId:d,signal:p.signal,abort:f,rejectWithValue:function(e,t){return new Br(e,t)},fulfillWithValue:function(e,t){return new Rr(e,t)}})).then((function(t){if(t instanceof Br)throw t;return t instanceof Rr?o(t.payload,d,e,t.meta):o(t,d,e)}))])];case 3:return v=g.sent(),[3,5];case 4:return y=g.sent(),v=y instanceof Br?i(null,d,e,y.payload,y.meta):i(y,d,e),[3,5];case 5:return n&&!n.dispatchConditionRejection&&i.match(v)&&v.meta.condition||a(v),[2,v]}var b}))},new Promise((function(e,t){var n=function(e){try{r(v.next(e))}catch(n){t(n)}},o=function(e){try{r(v.throw(e))}catch(n){t(n)}},r=function(t){return t.done?e(t.value):Promise.resolve(t.value).then(n,o)};r((v=v.apply(s,h)).next())}));var s,h,v}();return Object.assign(h,{abort:f,requestId:d,arg:e,unwrap:function(){return h.then(Fr)}})}}),{pending:r,rejected:i,fulfilled:o,typePrefix:e})}e.withTypes=function(){return e}}();var Ur="listenerMiddleware";Or(Ur+"/add"),Or(Ur+"/removeAll"),Or(Ur+"/remove"),"function"==typeof queueMicrotask&&queueMicrotask.bind("undefined"!=typeof window?window:"undefined"!=typeof global?global:globalThis),function(){function e(e,t){var n=s[e];return n?n.enumerable=t:s[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[Vo];return $o.get(t,e)},set:function(t){var n=this[Vo];$o.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var r=e[t][Vo];if(!r.P)switch(r.i){case 5:o(r)&&Ao(r);break;case 4:n(r)&&Ao(r)}}}function n(e){for(var t=e.t,n=e.k,o=qo(n),r=o.length-1;r>=0;r--){var i=o[r];if(i!==Vo){var s=t[i];if(void 0===s&&!ao(t,i))return!0;var a=n[i],c=a&&a[Vo];if(c?c.t!==s:!lo(a,s))return!0}}var l=!!t[Vo];return o.length!==qo(t).length+(l?0:1)}function o(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var o=0;o<t.length;o++)if(!t.hasOwnProperty(o))return!0;return!1}var r,i,s={};i={J:function(t,n){var o=Array.isArray(t),r=function(t,n){if(t){for(var o=Array(n.length),r=0;r<n.length;r++)Object.defineProperty(o,""+r,e(r,!0));return o}var i=Xo(n);delete i[Vo];for(var s=qo(i),a=0;a<s.length;a++){var c=s[a];i[c]=e(c,t||!!i[c].enumerable)}return Object.create(Object.getPrototypeOf(n),i)}(o,t),i={i:o?5:4,A:n?n.A:go(),P:!1,I:!1,R:{},l:n,t:t,k:r,o:null,g:!1,C:!1};return Object.defineProperty(r,Vo,{value:i,writable:!0}),r},S:function(e,n,r){r?oo(n)&&n[Vo].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[Vo];if(n){var r=n.t,i=n.k,s=n.R,a=n.i;if(4===a)io(i,(function(t){t!==Vo&&(void 0!==r[t]||ao(r,t)?s[t]||e(i[t]):(s[t]=!0,Ao(n)))})),io(r,(function(e){void 0!==i[e]||ao(i,e)||(s[e]=!1,Ao(n))}));else if(5===a){if(o(n)&&(Ao(n),s.length=!0),i.length<r.length)for(var c=i.length;c<r.length;c++)s[c]=!1;else for(var l=r.length;l<i.length;l++)s[l]=!0;for(var u=Math.min(i.length,r.length),d=0;d<u;d++)i.hasOwnProperty(d)||(s[d]=!0),void 0===s[d]&&e(i[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):o(e)}},Go[r="ES5"]||(Go[r]=i)}();const Kr={ru:{click_to_lock:"Нажмите что бы захватить мышь",use_esc_key_to_unlock:"Используйте `Esc` что бы освободить",use_slider_to_change_sensitivity:"Используйте слайдер слева что бы изменить чувствительность",current_sensitivity:"Текущая чувствительность",hello:"Привет",hello_guest:"Привет, гость!",mobile_controls:"Мобильное управление",mirrored_controls:"Отразить управление",scale_controls:"Масштаб управления",enter_name_of_drive:"Введите название диска",ws_outdated:"Необходимо обновить DOS Браузер",update:"Обновить",preloading_sockdrive:"Загрузка (единожды)",filter:"Фильтр",add:"Добавить",logout:"Выйти",features:"Функции",premium:"Подписка",buy:"Купить",experimental_features:"Доступ к экспериентальным функциям",cloud_saves:"Облачные сохранения",writeable_fat32:"FAT32 диски",net_no_limits:"Выбор сервера для стевой игры",unlock_options:"Доступ ко всем настройкам",error:"Упс... Что-то пошло не так...",consult_logs:"Проверьте логи браузера",bundle_loading:"Загрузка бандла",bundle_config:"Чтение конфигурации",try_free:"дней бесплатно",upload_file:"Выбирите архив jsdos/zip что бы начать...",emulation_backend:"Эмуляция",render_backend:"Рендер",render_aspect:"Соотношение сторон",worker:"Фоновый поток",mouse_sensitivity:"Чувст. мыши",mouse_lock:"Захват мыши",volume:"Громкость",pause:"Пауза",dosboxconf_template:"dosbox.conf шаблон:",preview:"Превью",continue:"Продолжить",skip:"Пропустить",loading:"Загрузка",extract_loading:"Распаковка архива",extract_long_time:"Может занять длительное время, пожалуйста ждите...",theme:"Тема",create_empty:"Создать пустой бандл",uploading_file:"Загрузка файла",fs_restart:"Вы хотите пересобрать бандл используя эту FS?",please_wait:"Пожалуйста подождите",making_bundle:"Создаем бандл",size:"Размер",room:"Команта",server:"Сервер",load_by_url:"Загрузить по ссылке",enter_url:"Введите ссылку",load:"Загрузить",stored:"Сохраненные",delete:"Удалить",editor:"Редактор",download:"Скачать",changes:"Сохранения",loading_saves:"Загрузка сохранений",success:"Успешно",success_save:"Сохранено в облаке",warn_save_locally:"Сохранено в браузере",warn_save_no_account:"Cохранено в браузере (вы не вошли)",warn_save_no_premium:"Cохранено в браузере (нет подписки)",warn_save_big_file:"Cохранено в браузере (большой файл)",unable_to_save:"Ошибка записи",not_premium:"Подключить подписку",copy_net_link:"Отправьте ссылку на подключение",copied:"Скопировано",image_rendering:"Обработка изображения",fix:"Исправить",close:"Закрыть",cancle:"Отказаться",manage:"Управлять",unable_to_cancle_subscription:"Не удалось отменить подписку",subscription_cancelled:"Подписка отменена",hardware:"Аппаратное ускорение",play:"Запустить",system_cursor:"Системный курсор",no_cloud_access:"Что бы использовать облачные сохранения, введите",no_cloud_access2:"ниже",no_cloud_access3:"Без подписки прогресс сохраняется локально в браузере и может быть потерян",key:"ваш ключ",load_archive:"Загрузить архив",sockdrives:"Готовые образы (sockdrive)",confirm_save:"Хотите сохранить прогресс?",save:"Сохранить",emulation_ended:"Эмуляция завершена",saving_game:"Сохранение игры...",sockdrive_save_in_the_middle:"Win9x безопаснее сохранять после выключении системы",changes_loaded:"Сохранения загружены в игру",error_deleting_changes:"Ошибка удаления сохранений",no_changes_loaded:"Нет сохранений",upload:"Загрузить",error_uploading_changes:"Ошибка загрузки сохранений",delete_changes_confirm:"Вы уверены что хотите удалить сохранения?",no_changes_to_save:"Нет изменений для сохранения",offscreen_canvas:"Фоновый рендеринг",special_keys:"Специальные клавиши",create_server:"Создание сервера",connect_to_network:"Подключение к сети",lookup_address:"Поиск адреса",unable_to_connect_to_network:"Не удалось подключиться к сети"},en:{warn_save_locally:"Saved in browser",click_to_lock:"Click to capture mouse",use_esc_key_to_unlock:"Use `Esc` to unlock",use_slider_to_change_sensitivity:"Use slider on the left to change sensitivity",current_sensitivity:"Current sensitivity",hello:"Hello",hello_guest:"Hello, guest!",play:"Start",system_cursor:"System cursor",mobile_controls:"Mobile controls",mirrored_controls:"Mirror controls",scale_controls:"Scale controls",enter_name_of_drive:"Enter name of drive",ws_outdated:"Must update DOS Browser App",update:"Update",preloading_sockdrive:"Loading (once)",filter:"Filter",add:"Add",logout:"Logout",features:"Features",premium:"Subscription",buy:"Buy",experimental_features:"Access to all experimental features",cloud_saves:"Cloud saves",writeable_fat32:"Writable FAT32",net_no_limits:"Change the network region",unlock_options:"Unlock all configuration options",error:"Oops... Something went wrong...",consult_logs:"Please check browser logs",bundle_loading:"Bundle loading",bundle_config:"Reading config",try_free:"days for free",upload_file:"Select jsdos/zip file to start...",emulation_backend:"Emulation",render_backend:"Render",render_aspect:"Aspect",worker:"Worker thread",mouse_sensitivity:"Mouse sens...",mouse_lock:"Capture mouse",volume:"Volume",pause:"Pause",dosboxconf_template:"dosbox.conf template:",preview:"Preview",continue:"Continue",skip:"Skip",loading:"Loading",extract_loading:"Unpacking archive",extract_long_time:"Can take long time, please be patient...",theme:"Theme",create_empty:"Create empty bundle",uploading_file:"Uploading file",fs_restart:"Do you want to rebuild the bundle using this fs?",please_wait:"Please wait",making_bundle:"Creating bundle",size:"Size",room:"Room",server:"Server",load_by_url:"Load by url",enter_url:"Enter url",load:"Load",stored:"Stored",delete:"Delete",editor:"Editor",download:"Download",changes:"Saves",loading_saves:"Loading saves",success:"Success",success_save:"Saved in cloud",warn_save_no_account:"Saved in browser (not logged in)",warn_save_no_premium:"Saved in browser (no subscription)",warn_save_big_file:"Saved in browser (large file)",unable_to_save:"Unable to save",not_premium:"Subscribe",copy_net_link:"Share this link to connect",copied:"Copied",image_rendering:"Image rendering",fix:"Fix",close:"Close",cancle:"Cancel",manage:"Manage",unable_to_cancle_subscription:"Unable to cancel subscription",subscription_cancelled:"Subscription cancelled",hardware:"Hardware acceleration",no_cloud_access:"To enable cloud saves, enter",no_cloud_access2:"below",no_cloud_access3:"Without a subscription, your progress will only be saved locally in your browser and may be lost",key:"your key",load_archive:"Load archive",sockdrives:"Disk images (sockdrive)",confirm_save:"Do you want to save progress?",save:"Save",emulation_ended:"Emulation ended",saving_game:"Saving game...",sockdrive_save_in_the_middle:"Win9x is safer to save after shutting down the system",changes_loaded:"Changes loaded in game",error_deleting_changes:"Error deleting changes",no_changes_loaded:"No changes loaded",upload:"Upload",error_uploading_changes:"Error uploading changes",delete_changes_confirm:"Are you sure you want to delete saves?",no_changes_to_save:"No changes to save",offscreen_canvas:"Background rendering",special_keys:"Special keys",create_server:"Creating server",connect_to_network:"Connecting to network",lookup_address:"Looking up address",unable_to_connect_to_network:"Unable to connect to network"},pt:{warn_save_locally:"Salvo no navegador",click_to_lock:"Clique para capturar o mouse",use_esc_key_to_unlock:"Use `Esc` para desbloquear",use_slider_to_change_sensitivity:"Use o slider à esquerda para alterar a sensibilidade",current_sensitivity:"Sensibilidade atual",hello:"Olá",hello_guest:"Olá, convidado!",play:"Iniciar",system_cursor:"Cursor do sistema",mobile_controls:"Controles móveis",mirrored_controls:"Controles espelhados",scale_controls:"Escalar controles",enter_name_of_drive:"Digite o nome da unidade",ws_outdated:"Você precisa atualizar o aplicativo DOS Browser",update:"Atualizar",preloading_sockdrive:"Carregando",filter:"Filtrar",add:"Adicionar",logout:"Sair",features:"Recursos",premium:"Assinatura",buy:"Comprar",experimental_features:"Acesso a todos os recursos experimentais",cloud_saves:"Salvamentos em nuvem",writeable_fat32:"FAT32 gravável",net_no_limits:"Alterar a região da rede",unlock_options:"Desbloquear todas as opções de configuração",error:"Oops... Algo deu errado...",consult_logs:"Por favor, verifique os logs do navegador",bundle_loading:"Carregando pacote",bundle_config:"Lendo configuração",try_free:"dias grátis",upload_file:"Selecione um arquivo jsdos/zip para iniciar...",emulation_backend:"Emulador",render_backend:"Renderização",render_aspect:"Aspecto",worker:"Thread de trabalho",mouse_sensitivity:"Sensibilidade do mouse...",mouse_lock:"Capturar mouse",volume:"Volume",pause:"Pausar",dosboxconf_template:"Modelo dosbox.conf:",preview:"Pré-visualizar",continue:"Continuar",skip:"Pular",loading:"Carregando",extract_loading:"Extraindo arquivo",extract_long_time:"Pode levar algum tempo, por favor, seja paciente...",theme:"Tema",create_empty:"Criar pacote vazio",uploading_file:"Enviando arquivo",fs_restart:"Você deseja reconstruir o pacote usando este sistema de arquivos?",please_wait:"Por favor, aguarde",making_bundle:"Criando pacote",size:"Tamanho",room:"Sala",server:"Servidor",load_by_url:"Carregar por URL",enter_url:"Digite a URL",load:"Carregar",stored:"Armazenado",delete:"Excluir",editor:"Editor",download:"Download",changes:"Salvamentos",loading_saves:"Carregando salvamentos",success:"Sucesso",success_save:"Salvo na nuvem",warn_save_no_account:"Salvo no navegador (você não está conectado)",warn_save_no_premium:"Salvo no navegador (sem assinatura)",warn_save_big_file:"Salvo no navegador (grande arquivo)",unable_to_save:"Não foi possível salvar",not_premium:"Assine",copy_net_link:"Compartilhe este link para se conectar",copied:"Copiado",image_rendering:"Renderização de imagem",fix:"Corrigir",close:"Fechar",cancle:"Cancelar",manage:"Gerenciar",unable_to_cancle_subscription:"Não foi possível cancelar a assinatura",subscription_cancelled:"Assinatura cancelada",hardware:"Aceleração de hardware",no_cloud_access:"Para usar o armazenamento em nuvem, insira",no_cloud_access2:"abaixo",no_cloud_access3:"Sem assinatura, seu progresso será salvo localmente no navegador e pode ser perdido",key:"sua chave",load_archive:"Carregar arquivo",sockdrives:"Imagens de disco (sockdrive)",confirm_save:"Você deseja salvar o progresso?",save:"Salvar",emulation_ended:"Emulação terminada",saving_game:"Salvando jogo...",sockdrive_save_in_the_middle:"Win9x é mais seguro salvar após desligar o sistema",changes_loaded:"Alterações carregadas no jogo",error_deleting_changes:"Erro ao deletar alterações",no_changes_loaded:"Nenhuma alteração carregada",upload:"Carregar",error_uploading_changes:"Erro ao carregar alterações",delete_changes_confirm:"Tem certeza que deseja deletar os salvamentos?",no_changes_to_save:"Nenhuma alteração para salvar",offscreen_canvas:"Renderização de fundo",special_keys:"Teclas especiais",create_server:"Criando servidor",connect_to_network:"Conectando à rede",lookup_address:"Procurando endereço",unable_to_connect_to_network:"Não foi possível conectar à rede"},ro:{warn_save_locally:"Salvat în browser",click_to_lock:"Faceți clic pentru a captura mouse-ul",use_esc_key_to_unlock:"Folosește `Esc` pentru a debloca",use_slider_to_change_sensitivity:"Folosește cursorul din stânga pentru a schimba sensibilitatea",current_sensitivity:"Sensibilitatea în prezent",hello:"Salutare",hello_guest:"Salutare, oaspete!",play:"Pornește",system_cursor:"Cursorul sistemului",mobile_controls:"Comenzi mobile",mirrored_controls:"Comenzi oglindă",scale_controls:"Controale de scalare",enter_name_of_drive:"Introduceți numele unității",ws_outdated:"Trebuie să actualizați aplicația de browser DOS",update:"Actualizare",preloading_sockdrive:"Se încarcă (o dată)",filter:"Filtru",add:"Adaugă",logout:"Deconectare",features:"Caracteristici",premium:"Abonament",buy:"Cumpără",experimental_features:"Acces la toate funcțiile experimentale",cloud_saves:"Salvează în cloud",writeable_fat32:"FAT32 inscriptibil",net_no_limits:"Schimbați regiunea rețelei",unlock_options:"Deblocați toate opțiunile de configurare",error:"Ups... Ceva nu a mers bine...",consult_logs:"Vă rugăm să verificați jurnalele browserului",bundle_loading:"Pachetul se încarcă",bundle_config:"Citirea configurației",try_free:"zile gratuite",upload_file:"Selectați fișierul jsdos/zip pentru a începe...",emulation_backend:"Emulare",render_backend:"Randează",render_aspect:"Aspect",worker:"Fir de lucru",mouse_sensitivity:"Senzor mouse...",mouse_lock:"Captură mouse",volume:"Volum",pause:"Pauză",dosboxconf_template:"Șablon dosbox.conf:",preview:"Previzualizare",continue:"Continuați",skip:"Sari peste",loading:"Se încarcă",extract_loading:"Despachetarea arhivei",extract_long_time:"Poate dura mult timp, vă rog să aveți răbdare...",theme:"Temă",create_empty:"Creați un pachet gol",uploading_file:"Se încarcă fișierul",fs_restart:"Vrei să reconstruiești pachetul folosind acest fs?",please_wait:"Va rugăm așteptați",making_bundle:"Se creează pachetul",size:"Dimensiune",room:"Cameră",server:"Server",load_by_url:"Încărcare după URL",enter_url:"Introduceți adresa URL",load:"Încarcă",stored:"Stocat",delete:"Şterge",editor:"Editor",download:"Descărcare",changes:"Salvări",loading_saves:"Se încarcă salvările",success:"Succes",success_save:"Salvat în cloud",warn_save_no_account:"Salvat în browser (neconectat)",warn_save_no_premium:"Salvat în browser (fără abonament)",warn_save_big_file:"Salvat în browser (fișier mare)",unable_to_save:"Nu se poate salva",not_premium:"Abonează-te",copy_net_link:"Distribuiți acest link pentru a vă conecta",copied:"Copiat",image_rendering:"Redarea imaginilor",fix:"Reparare",close:"Închide",cancle:"Anulează",manage:"Gestionează",unable_to_cancle_subscription:"Nu se poate anula abonamentul",subscription_cancelled:"Abonament anulat",hardware:"Accelerare hardware",no_cloud_access:"Pentru a activa salvările în cloud, introduceți",no_cloud_access2:"dedesubt",no_cloud_access3:"Fără un abonament, progresul dvs. va fi salvat doar local în browser și se poate pierde.",key:"cheia ta",load_archive:"Încărcați arhiva",sockdrives:"Imagini de disc (unitate de tip sock)",confirm_save:"Vrei să salvezi progresul?",save:"Salvați",emulation_ended:"Emularea s-a încheiat",saving_game:"Se salvează jocul...",sockdrive_save_in_the_middle:"Este mai sigur să salvați fișierele în Win9x după închiderea sistemului.",changes_loaded:"Modificări încărcate în joc",error_deleting_changes:"Eroare la ștergerea modificărilor",no_changes_loaded:"Nicio modificare încărcată",upload:"Încărcați",error_uploading_changes:"Eroare la încărcarea modificărilor",delete_changes_confirm:"Sunteți sigur că doriți să ștergeți modificările?",no_changes_to_save:"Nu există modificări pentru a fi salvate",offscreen_canvas:"Renderizare în fundal",special_keys:"Teclă speciale",create_server:"Creare server",connect_to_network:"Conectare la rețea",lookup_address:"Căutare adresă",unable_to_connect_to_network:"Nu s-a putut conecta la rețea"},zhs:{warn_save_locally:"已保存到浏览器",click_to_lock:"单击捕获鼠标",use_esc_key_to_unlock:"按下 `Esc` 键解锁",use_slider_to_change_sensitivity:"拖动左侧的滑块调整灵敏度.",current_sensitivity:"当前灵敏度",hello:"Hi",hello_guest:"Hi, 朋友!",play:"开始",system_cursor:"系统光标",mobile_controls:"移动控制",mirrored_controls:"反转控制",scale_controls:"比例控制",enter_name_of_drive:"输入设备",ws_outdated:"务必更新 DOS 浏览器",update:"更新",preloading_sockdrive:"加载中...",filter:"筛选",add:"添加",logout:"退出",features:"Features",premium:"VIP会员",buy:"购买",experimental_features:"访问所有测试性功能(Beta)",cloud_saves:"云保存",writeable_fat32:"可写 FAT32",net_no_limits:"更改网络地区",unlock_options:"解锁所有配置选项",error:"糟糕...出问题了...",consult_logs:"请检查浏览器日志",bundle_loading:"压缩包加载中",bundle_config:"读取配置",try_free:"免费天数",upload_file:"请选择 jsdos/zip 文件",emulation_backend:"模拟模式",render_backend:"渲染模式",render_aspect:"渲染比例",worker:"多线程",mouse_sensitivity:"鼠标灵敏度",mouse_lock:"捕捉鼠标",volume:"音量",pause:"暂停",dosboxconf_template:"dosbox.conf 配置:",preview:"预览",continue:"继续",skip:"跳过",loading:"加载中",extract_loading:"解压中",extract_long_time:"可能需要很长时间,请耐心等待...",theme:"主题",create_empty:"创建空白项目",uploading_file:"上传文件",fs_restart:"您想使用此文件系统重新构建吗?",please_wait:"请稍等",making_bundle:"创建压缩包",size:"大小",room:"命令",server:"服务器",load_by_url:"通过网址加载",enter_url:"输入网址",load:"加载",stored:"暂存",delete:"删除",editor:"编辑器",download:"下载",changes:"保存",loading_saves:"加载暂存内容",success:"完成",success_save:"保存到云端",warn_save_no_account:"已保存到浏览器(未登录)",warn_save_no_premium:"已保存到浏览器(无VIP会员)",warn_save_big_file:"已保存到浏览器(大文件)",unable_to_save:"无法保存",not_premium:"无VIP会员",copy_net_link:"分享此链接即可连接",copied:"已复制",image_rendering:"图像处理",fix:"纠正",close:"关闭",cancle:"取消",manage:"管理",unable_to_cancle_subscription:"无法取消VIP会员",subscription_cancelled:"VIP会员已取消",hardware:"硬件加速",no_cloud_access:"要使用云存储,请将",no_cloud_access2:"到下方输入框内",no_cloud_access3:"如果没有会员,进度会保存在浏览器本地,可能会丢失.",key:"你的Key",load_archive:"加载存档",sockdrives:"系统镜像文件",confirm_save:"您想保存进度吗?",save:"保存",emulation_ended:"模拟器已停止",saving_game:"保存游戏...",sockdrive_save_in_the_middle:"Win9.x 在关闭后会更安全地保存",changes_loaded:"已加载更改",error_deleting_changes:"删除更改时出错",no_changes_loaded:"未加载任何更改",upload:"上传",error_uploading_changes:"加载上传出错",delete_changes_confirm:"您确定要删除您的存档吗?",no_changes_to_save:"没有要保存的更改",offscreen_canvas:"canvas 渲染",special_keys:"特殊按键",create_server:"创建服务器",connect_to_network:"连接到网络",lookup_address:"查找地址",unable_to_connect_to_network:"连接网络失败"}},Hr=navigator.language.startsWith("ru")?"ru":navigator.language.startsWith("pt")?"pt":navigator.language.startsWith("ro")?"ro":navigator.language.startsWith("zhs")?"zhs":"en",Vr=Ir({name:"i18n",initialState:{lang:Hr,keys:Kr[Hr]},reducers:{setLang:(e,t)=>{e.lang=t.payload,e.keys=Kr[t.payload]}}});function Wr(){const e=on((e=>e.i18n.keys));return t=>e[t]??t}const qr=[{name:"7.xx",backend:"dosbox",contents:"[sdl]\nautolock=false\n\nfullscreen=false\nfulldouble=false\nfullresolution=original\nwindowresolution=original\noutput=surface\nsensitivity=100\nwaitonerror=true\npriority=higher,normal\nmapperfile=mapper-jsdos.map\nusescancodes=true\nvsync=false\n[dosbox]\nmachine=svga_s3\n\nlanguage=\ncaptures=capture\nmemsize=16\n[cpu]\ncore=auto\ncputype=auto\ncycles=auto\n\ncycleup=10\ncycledown=20\n[mixer]\nnosound=false\nrate=44100\n\nblocksize=1024\nprebuffer=20\n\n[render]\n# frameskip: How many frames DOSBox skips before drawing one.\n# aspect: Do aspect correction, if your output method doesn't support scaling this can slow things down!.\n# scaler: Scaler used to enlarge/enhance low resolution modes.\n# If 'forced' is appended, then the scaler will be used even if the result might not be desired.\n# Possible values: none, normal2x, normal3x, advmame2x, advmame3x, advinterp2x, advinterp3x, hq2x, hq3x, 2xsai, super2xsai, supereagle, tv2x, tv3x, rgb2x, rgb3x, scan2x, scan3x.\n\nframeskip=0\naspect=false\nscaler=none\n\n[midi]\n# mpu401: Type of MPU-401 to emulate.\n# Possible values: intelligent, uart, none.\n# mididevice: Device that will receive the MIDI data from MPU-401.\n# Possible values: default, win32, alsa, oss, coreaudio, coremidi, none.\n# midiconfig: Special configuration options for the device driver. This is usually the id of the device you want to use.\n# See the README/Manual for more details.\n\nmpu401=intelligent\nmididevice=default\nmidiconfig=\n\n[sblaster]\n# sbtype: Type of Soundblaster to emulate. gb is Gameblaster.\n# Possible values: sb1, sb2, sbpro1, sbpro2, sb16, gb, none.\n# sbbase: The IO address of the soundblaster.\n# Possible values: 220, 240, 260, 280, 2a0, 2c0, 2e0, 300.\n# irq: The IRQ number of the soundblaster.\n# Possible values: 7, 5, 3, 9, 10, 11, 12.\n# dma: The DMA number of the soundblaster.\n# Possible values: 1, 5, 0, 3, 6, 7.\n# hdma: The High DMA number of the soundblaster.\n# Possible values: 1, 5, 0, 3, 6, 7.\n# sbmixer: Allow the soundblaster mixer to modify the DOSBox mixer.\n# oplmode: Type of OPL emulation. On 'auto' the mode is determined by sblaster type. All OPL modes are Adlib-compatible, except for 'cms'.\n# Possible values: auto, cms, opl2, dualopl2, opl3, none.\n# oplemu: Provider for the OPL emulation. compat might provide better quality (see oplrate as well).\n# Possible values: default, compat, fast.\n# oplrate: Sample rate of OPL music emulation. Use 49716 for highest quality (set the mixer rate accordingly).\n# Possible values: 44100, 49716, 48000, 32000, 22050, 16000, 11025, 8000.\n\nsbtype=sb16\nsbbase=220\nirq=7\ndma=1\nhdma=5\nsbmixer=true\noplmode=auto\noplemu=default\noplrate=44100\n\n[gus]\n# gus: Enable the Gravis Ultrasound emulation.\n# gusrate: Sample rate of Ultrasound emulation.\n# Possible values: 44100, 48000, 32000, 22050, 16000, 11025, 8000, 49716.\n# gusbase: The IO base address of the Gravis Ultrasound.\n# Possible values: 240, 220, 260, 280, 2a0, 2c0, 2e0, 300.\n# gusirq: The IRQ number of the Gravis Ultrasound.\n# Possible values: 5, 3, 7, 9, 10, 11, 12.\n# gusdma: The DMA channel of the Gravis Ultrasound.\n# Possible values: 3, 0, 1, 5, 6, 7.\n# ultradir: Path to Ultrasound directory. In this directory\n# there should be a MIDI directory that contains\n# the patch files for GUS playback. Patch sets used\n# with Timidity should work fine.\n\ngus=false\ngusrate=44100\ngusbase=240\ngusirq=5\ngusdma=3\nultradir=C:\\ULTRASND\n\n[speaker]\n# pcspeaker: Enable PC-Speaker emulation.\n# pcrate: Sample rate of the PC-Speaker sound generation.\n# Possible values: 44100, 48000, 32000, 22050, 16000, 11025, 8000, 49716.\n# tandy: Enable Tandy Sound System emulation. For 'auto', emulation is present only if machine is set to 'tandy'.\n# Possible values: auto, on, off.\n# tandyrate: Sample rate of the Tandy 3-Voice generation.\n# Possible values: 44100, 48000, 32000, 22050, 16000, 11025, 8000, 49716.\n# disney: Enable Disney Sound Source emulation. (Covox Voice Master and Speech Thing compatible).\n\npcspeaker=true\npcrate=44100\ntandy=auto\ntandyrate=44100\ndisney=true\n\n[joystick]\n# joysticktype: Type of joystick to emulate: auto (default), none,\n# 2axis (supports two joysticks),\n# 4axis (supports one joystick, first joystick used),\n# 4axis_2 (supports one joystick, second joystick used),\n# fcs (Thrustmaster), ch (CH Flightstick).\n# none disables joystick emulation.\n# auto chooses emulation depending on real joystick(s).\n# (Remember to reset dosbox's mapperfile if you saved it earlier)\n# Possible values: auto, 2axis, 4axis, 4axis_2, fcs, ch, none.\n# timed: enable timed intervals for axis. Experiment with this option, if your joystick drifts (away).\n# autofire: continuously fires as long as you keep the button pressed.\n# swap34: swap the 3rd and the 4th axis. can be useful for certain joysticks.\n# buttonwrap: enable button wrapping at the number of emulated buttons.\n\njoysticktype=auto\ntimed=true\nautofire=false\nswap34=false\nbuttonwrap=false\n\n[serial]\n# serial1: set type of device connected to com port.\n# Can be disabled, dummy, modem, nullmodem, directserial.\n# Additional parameters must be in the same line in the form of\n# parameter:value. Parameter for all types is irq (optional).\n# for directserial: realport (required), rxdelay (optional).\n# (realport:COM1 realport:ttyS0).\n# for modem: listenport (optional).\n# for nullmodem: server, rxdelay, txdelay, telnet, usedtr,\n# transparent, port, inhsocket (all optional).\n# Example: serial1=modem listenport:5000\n# Possible values: dummy, disabled, modem, nullmodem, directserial.\n# serial2: see serial1\n# Possible values: dummy, disabled, modem, nullmodem, directserial.\n# serial3: see serial1\n# Possible values: dummy, disabled, modem, nullmodem, directserial.\n# serial4: see serial1\n# Possible values: dummy, disabled, modem, nullmodem, directserial.\n\nserial1=dummy\nserial2=dummy\nserial3=disabled\nserial4=disabled\n\n[dos]\n# xms: Enable XMS support.\n# ems: Enable EMS support.\n# umb: Enable UMB support.\n# keyboardlayout: Language code of the keyboard layout (or none).\n\nxms=true\nems=true\numb=true\nkeyboardlayout=auto\n\n[ipx]\n# ipx: Enable ipx over UDP/IP emulation.\n\nipx=true\n[autoexec]\necho off\nmount c .\nc:\n\ntype jsdos~1/readme.txt\necho on\n\n# Generated using https://js-dos.com\n# █▀▀▀▀▀█ █ ▄▄▄▀▀█ █▀▀▀▀▀█\n# █ ███ █ ██▄ █ ▀ ▄ █ ███ █\n# █ ▀▀▀ █ ▄██ ▀ ▀▀█ █ ▀▀▀ █\n# ▀▀▀▀▀▀▀ ▀ █▄▀▄▀ █ ▀▀▀▀▀▀▀\n# █▀▄▄█▀▀▄▄ ▀ ▀█▄▄▄▄ ▀▄█▀█▀\n# █▀ ▀ ▀▀▄ █▀ ▄ ▄▀▀▀▄ █▀█▄\n# ▄ ▄▄ █▀▀▄ ▄▀▄▀▀█ ▀▀▄▀▀█▀\n# ▄▀▀█▀▀ █▀█▀█▀▀▄ ▀██▀█▄\n# ▀▀▀ ▀ ▀ █▄█ ▀█▄▄█▀▀▀█▀▀\n# █▀▀▀▀▀█ ▄▄▄ ▄ ▄ █ ▀ █▄▄▄▄\n# █ ███ █ ▀█▀▀▄▀▀▄████▀▀█▄█\n# █ ▀▀▀ █ ▄▀▀█▀█▀▄ ▀▀▄▄█▄█\n# ▀▀▀▀▀▀▀ ▀ ▀▀ ▀ ▀ ▀▀▀\n".replace(/\n/g,"\r\n")},{name:"DOS 7.1",backend:"dosboxX",contents:"\n[sdl]\nautolock=false\n\n[dosbox]\ntitle=DOS 7.1\nmemsize=64\n\n[dos]\nver=7.1\nhard drive data rate limit=0\nfloppy drive data rate limit=0\n\n[cpu]\ncputype=pentium_mmx\ncore=auto\n\n[sblaster]\nsbtype=sb16vibra\n\n[render]\nscaler=none\n\n[autoexec]\necho off\n\necho Please visit our website:\necho \necho _ __\necho (_)____ ____/ /___ _____ _________ ____ ___\necho / / ___/_____/ __ / __ \\/ ___// ___/ __ \\/ __ `__ \\\necho / (__ )_____/ /_/ / /_/ (__ )/ /__/ /_/ / / / / / /\necho __/ /____/ \\__,_/\\____/____(_)___/\\____/_/ /_/ /_/\necho /___/\necho\necho type 'boot c:' to load DOS 7.1\necho on\n# \n# █▀▀▀▀▀█ █ ▄▄▄▀▀█ █▀▀▀▀▀█\n# █ ███ █ ██▄ █ ▀ ▄ █ ███ █\n# █ ▀▀▀ █ ▄██ ▀ ▀▀█ █ ▀▀▀ █\n# ▀▀▀▀▀▀▀ ▀ █▄▀▄▀ █ ▀▀▀▀▀▀▀\n# █▀▄▄█▀▀▄▄ ▀ ▀█▄▄▄▄ ▀▄█▀█▀\n# █▀ ▀ ▀▀▄ █▀ ▄ ▄▀▀▀▄ █▀█▄\n# ▄ ▄▄ █▀▀▄ ▄▀▄▀▀█ ▀▀▄▀▀█▀\n# ▄▀▀█▀▀ █▀█▀█▀▀▄ ▀██▀█▄\n# ▀▀▀ ▀ ▀ █▄█ ▀█▄▄█▀▀▀█▀▀\n# █▀▀▀▀▀█ ▄▄▄ ▄ ▄ █ ▀ █▄▄▄▄\n# █ ███ █ ▀█▀▀▄▀▀▄████▀▀█▄█\n# █ ▀▀▀ █ ▄▀▀█▀█▀▄ ▀▀▄▄█▄█\n# ▀▀▀▀▀▀▀ ▀ ▀▀ ▀ ▀ ▀▀▀\n#\n".replace(/\n/g,"\r\n")},{name:"Win 3.11",backend:"dosboxX",contents:"\n[sdl]\nautolock=false\nmouse emulation=integration\n\n[dosbox]\ntitle=Win 3.11\nmemsize=256\n\n[dos]\nhard drive data rate limit=0\nfloppy drive data rate limit=0\n\n[cpu]\ncputype=pentium\ncore=auto\nintegration device=true\n\n[pci]\nvoodoo=false\n\n[sblaster]\nsbtype=sb16vibra\n\n[render]\nscaler=none\n\n[autoexec]\necho off\n\necho Please visit our website:\necho \necho _ __\necho (_)____ ____/ /___ _____ _________ ____ ___\necho / / ___/_____/ __ / __ \\/ ___// ___/ __ \\/ __ `__ \\\necho / (__ )_____/ /_/ / /_/ (__ )/ /__/ /_/ / / / / / /\necho __/ /____/ \\__,_/\\____/____(_)___/\\____/_/ /_/ /_/\necho /___/\necho\necho type 'boot c:' to load Win 3.11\necho on\n# \n# █▀▀▀▀▀█ █ ▄▄▄▀▀█ █▀▀▀▀▀█\n# █ ███ █ ██▄ █ ▀ ▄ █ ███ █\n# █ ▀▀▀ █ ▄██ ▀ ▀▀█ █ ▀▀▀ █\n# ▀▀▀▀▀▀▀ ▀ █▄▀▄▀ █ ▀▀▀▀▀▀▀\n# █▀▄▄█▀▀▄▄ ▀ ▀█▄▄▄▄ ▀▄█▀█▀\n# █▀ ▀ ▀▀▄ █▀ ▄ ▄▀▀▀▄ █▀█▄\n# ▄ ▄▄ █▀▀▄ ▄▀▄▀▀█ ▀▀▄▀▀█▀\n# ▄▀▀█▀▀ █▀█▀█▀▀▄ ▀██▀█▄\n# ▀▀▀ ▀ ▀ █▄█ ▀█▄▄█▀▀▀█▀▀\n# █▀▀▀▀▀█ ▄▄▄ ▄ ▄ █ ▀ █▄▄▄▄\n# █ ███ █ ▀█▀▀▄▀▀▄████▀▀█▄█\n# █ ▀▀▀ █ ▄▀▀█▀█▀▄ ▀▀▄▄█▄█\n# ▀▀▀▀▀▀▀ ▀ ▀▀ ▀ ▀ ▀▀▀\n#\n".replace(/\n/g,"\r\n")},{name:"Win 95",backend:"dosboxX",contents:"\n[sdl]\nautolock=false\nmouse_emulation=integration\n\n[dosbox]\ntitle=Windows 95\nmemsize=128\n\n[video]\nvmemsize=8\nvesa modelist width limit=0\nvesa modelist height limit=0\n\n[dos]\nver=7.1\nhard drive data rate limit=0\nfloppy drive data rate limit=0\n\n[cpu]\ncputype=pentium_mmx\ncore=auto\nintegration device=true\n\n[sblaster]\nsbtype=sb16vibra\n\n[fdc, primary]\nint13fakev86io=true\n\n[ide, primary]\nint13fakeio=true\nint13fakev86io=true\n\n[ide, secondary]\nint13fakeio=true\nint13fakev86io=true\ncd-rom insertion delay=4000\n\n[render]\nscaler=none\n\n[autoexec]\necho off\n\necho Please visit our website:\necho \necho _ __\necho (_)____ ____/ /___ _____ _________ ____ ___\necho / / ___/_____/ __ / __ \\/ ___// ___/ __ \\/ __ `__ \\\necho / (__ )_____/ /_/ / /_/ (__ )/ /__/ /_/ / / / / / /\necho __/ /____/ \\__,_/\\____/____(_)___/\\____/_/ /_/ /_/\necho /___/\necho\necho type 'boot c:' to load windows 95\necho on\n# \n# █▀▀▀▀▀█ █ ▄▄▄▀▀█ █▀▀▀▀▀█\n# █ ███ █ ██▄ █ ▀ ▄ █ ███ █\n# █ ▀▀▀ █ ▄██ ▀ ▀▀█ █ ▀▀▀ █\n# ▀▀▀▀▀▀▀ ▀ █▄▀▄▀ █ ▀▀▀▀▀▀▀\n# █▀▄▄█▀▀▄▄ ▀ ▀█▄▄▄▄ ▀▄█▀█▀\n# █▀ ▀ ▀▀▄ █▀ ▄ ▄▀▀▀▄ █▀█▄\n# ▄ ▄▄ █▀▀▄ ▄▀▄▀▀█ ▀▀▄▀▀█▀\n# ▄▀▀█▀▀ █▀█▀█▀▀▄ ▀██▀█▄\n# ▀▀▀ ▀ ▀ █▄█ ▀█▄▄█▀▀▀█▀▀\n# █▀▀▀▀▀█ ▄▄▄ ▄ ▄ █ ▀ █▄▄▄▄\n# █ ███ █ ▀█▀▀▄▀▀▄████▀▀█▄█\n# █ ▀▀▀ █ ▄▀▀█▀█▀▄ ▀▀▄▄█▄█\n# ▀▀▀▀▀▀▀ ▀ ▀▀ ▀ ▀ ▀▀▀\n#\n".replace(/\n/g,"\r\n")},{name:"Win 98",backend:"dosboxX",contents:"\n[sdl]\nautolock=false\nmouse_emulation=integration\n\n[dosbox]\ntitle=Windows 98\nmemsize=128\n\n[video]\nvmemsize=8\nvesa modelist width limit=0\nvesa modelist height limit=0\n\n[dos]\nver=7.1\nhard drive data rate limit=0\nfloppy drive data rate limit=0\n\n[cpu]\ncputype=pentium_mmx\ncore=auto\nintegration device=true\n\n[sblaster]\nsbtype=sb16vibra\n\n[fdc, primary]\nint13fakev86io=true\n\n[ide, primary]\nint13fakeio=true\nint13fakev86io=true\n\n[ide, secondary]\nint13fakeio=true\nint13fakev86io=true\ncd-rom insertion delay=4000\n\n[render]\nscaler=none\n\n[autoexec]\necho off\n\necho Please visit our website:\necho \necho _ __\necho (_)____ ____/ /___ _____ _________ ____ ___\necho / / ___/_____/ __ / __ \\/ ___// ___/ __ \\/ __ `__ \\\necho / (__ )_____/ /_/ / /_/ (__ )/ /__/ /_/ / / / / / /\necho __/ /____/ \\__,_/\\____/____(_)___/\\____/_/ /_/ /_/\necho /___/\necho\necho type 'boot c:' to load windows 98\necho on\n# \n# █▀▀▀▀▀█ █ ▄▄▄▀▀█ █▀▀▀▀▀█\n# █ ███ █ ██▄ █ ▀ ▄ █ ███ █\n# █ ▀▀▀ █ ▄██ ▀ ▀▀█ █ ▀▀▀ █\n# ▀▀▀▀▀▀▀ ▀ █▄▀▄▀ █ ▀▀▀▀▀▀▀\n# █▀▄▄█▀▀▄▄ ▀ ▀█▄▄▄▄ ▀▄█▀█▀\n# █▀ ▀ ▀▀▄ █▀ ▄ ▄▀▀▀▄ █▀█▄\n# ▄ ▄▄ █▀▀▄ ▄▀▄▀▀█ ▀▀▄▀▀█▀\n# ▄▀▀█▀▀ █▀█▀█▀▀▄ ▀██▀█▄\n# ▀▀▀ ▀ ▀ █▄█ ▀█▄▄█▀▀▀█▀▀\n# █▀▀▀▀▀█ ▄▄▄ ▄ ▄ █ ▀ █▄▄▄▄\n# █ ███ █ ▀█▀▀▄▀▀▄████▀▀█▄█\n# █ ▀▀▀ █ ▄▀▀█▀█▀▄ ▀▀▄▄█▄█\n# ▀▀▀▀▀▀▀ ▀ ▀▀ ▀ ▀ ▀▀▀\n#\n".replace(/\n/g,"\r\n")}],Xr=Ir({name:"editor",initialState:{configChanged:!1,bundleConfig:null,errorMessage:null,fs:[]},reducers:{init:(e,t)=>{null===t.payload?(e.configChanged=!0,e.bundleConfig={dosboxConf:qr[0].contents,jsdosConf:{version:"js-dos-v8"}}):(e.configChanged=!1,e.bundleConfig=t.payload)},dosboxConf:(e,t)=>{e.configChanged=!0,e.bundleConfig.dosboxConf=t.payload}}});class Gr{constructor(){t(this,"length",0),t(this,"storage",{})}setItem(e,t){this.storage[e]=t,this.length=Object.keys(this.storage).length}getItem(e){const t=this.storage[e];return void 0===t?null:t}removeItem(e){delete this.storage[e],this.length=Object.keys(this.storage).length}key(e){const t=Object.keys(this.storage);return void 0===t[e]?null:t[e]}clear(){this.length=0,this.storage={}}}const $r=new class{constructor(e,n){t(this,"backend"),t(this,"length"),t(this,"prefix"),this.prefix=n;try{this.backend=e||localStorage,this.testBackend()}catch(o){this.backend=new Gr}this.length=this.backend.length,"function"==typeof this.backend.sync&&(this.sync=e=>{this.backend.sync(e)})}testBackend(){const e=this.prefix+".test.record";this.backend.setItem(e,"123");const t=this.backend.getItem(e);this.backend.removeItem(e);if(!("123"===t&&null===this.backend.getItem(e)))throw new Error("Storage backend is not working properly")}setLocalStoragePrefix(e){this.prefix=e}clear(){if(!this.backend.length)return;const e=[];for(let t=0;t<this.backend.length;++t){const n=this.backend.key(t);n&&n.startsWith(this.prefix)&&e.push(n)}for(const t of e)this.backend.removeItem(t);this.length=this.backend.length}key(e){return this.backend.key(e)}setItem(e,t){if(!t||void 0===t.length||0===t.length)return void this.writeStringToKey(e,"");let n=0;for(;n<t.length;){let o=t.substr(n,1024);n+=o.length,n<t.length&&(o+="@"),this.writeStringToKey(e,o),e+="."}}getItem(e){let t=this.readStringFromKey(e);if(null===t)return null;if(0===t.length)return t;for(;"@"===t[t.length-1];){t=t.substr(0,t.length-1),e+=".";const n=this.readStringFromKey(e);t+=null===n?"":n}return t}removeItem(e){this.backend.removeItem(this.prefix+e),this.length=this.backend.length}writeStringToKey(e,t){this.backend.setItem(this.prefix+e,t),this.length=this.backend.length}readStringFromKey(e){return this.backend.getItem(this.prefix+e)}}(void 0,"jsdos.8."),Yr=["light","dark","cupcake","bumblebee","emerald","corporate","synthwave","retro","cyberpunk","valentine","halloween","garden","forest","aqua","lofi","pastel","fantasy","wireframe","black","luxury","dracula","cmyk","autumn","business","acid","lemonade","night","coffee","winter"],Jr=Ir({name:"js-dos v8s",initialState:{hidden:!1,frame:"none",frameXs:!1,window:"none",theme:$r.getItem("theme")??(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches)?"dark":"light",editor:!1,wideScreen:!0,fullScreen:!1,toast:null,toastIntent:"none",toastTimeoutId:0,background:null,updateWsWarning:!1,canSave:!0,autoStart:!1,countDownStart:0,autoSave:!1,kiosk:!1,documentHidden:document.hidden??!1,noCloud:!1,softFullscreen:!1,haveQuickSave:!1,thinSidebar:!1,pointerLocked:!1,clickToLockModal:!0,modalText:null,modalTextLoading:!1},reducers:{theme:(e,t)=>{$r.setItem("theme",t.payload),e.theme=t.payload},frameNone:e=>{e.frame="none",e.frameXs=!1},frameSettings:e=>{e.frame="settings",e.frameXs=!1},frameStats:e=>{e.frame="stats",e.frameXs=!1},frameConf:e=>{e.frame="editor-conf",e.frameXs=!1},frameFs:e=>{e.frame="editor-fs",e.frameXs=!1},framePreRun:e=>{e.frame="prerun",e.frameXs=!1},frameTurbo:e=>{e.frame="turbo",e.frameXs=!1},toggleFileExplorer:e=>{"file-explorer"===e.window?e.window="prerun":e.window="file-explorer"},windowSelect:e=>{e.window="select",e.editor=!0},background:(e,t)=>{e.background=t.payload},setEditor:(e,t)=>{e.editor=t.payload},setWideScreen:(e,t)=>{e.wideScreen=t.payload},setFullScreen:(e,t)=>{e.fullScreen=t.payload,e.thinSidebar=t.payload},showToast:(e,t)=>{0!==e.toastTimeoutId&&clearInterval(e.toastTimeoutId),e.toast=t.payload.message,e.toastIntent=t.payload.intent??"none","panic"!==t.payload.intent&&(e.toastTimeoutId=setTimeout((()=>{t.asyncStore((e=>e.dispatch(Jr.actions.hideToast())))}),t.payload.long?5e3:1500))},hideToast:e=>{e.toast=null,e.toastTimeoutId=0},updateWsWarning:(e,t)=>{e.updateWsWarning=t.payload},autoStart:(e,t)=>{e.autoStart=t.payload},countDownStart:(e,t)=>{e.countDownStart=t.payload,e.autoStart=!0},autoSave:(e,t)=>{e.autoSave=t.payload},kiosk:(e,t)=>{e.kiosk=t.payload},documentHidden:(e,t)=>{e.documentHidden=t.payload},noCloud:(e,t)=>{e.noCloud=t.payload},hidden:(e,t)=>{e.hidden=t.payload},softFullscreen:(e,t)=>{e.softFullscreen=t.payload},canSave:(e,t)=>{e.canSave=t.payload},setHaveQuickSave:(e,t)=>{e.haveQuickSave=t.payload},thinSidebar:(e,t)=>{e.thinSidebar=t.payload},pointerLocked:(e,t)=>{e.pointerLocked=t.payload},clickToLockModal:(e,t)=>{e.clickToLockModal=t.payload},modalText:(e,t)=>{e.modalText=t.payload.text,e.modalTextLoading=t.payload.loading??!0},modalTextClear:e=>{e.modalText=null,e.modalTextLoading=!1}},extraReducers:e=>{e.addCase(Or("dos/bndLoad"),((e,t)=>{e.window="loading"})).addCase(Or("editor/extract"),((e,t)=>{e.window="loading"})).addCase(Or("editor/ready"),((e,t)=>{e.window="prerun"})).addCase(Or("dos/bndReady"),((e,t)=>{e.autoStart&&0===e.countDownStart?t.asyncStore((e=>{e.dispatch(ki.actions.bndPlay({}))})):e.window="prerun"})).addCase(Or("dos/bndPlay"),((e,t)=>{e.window="run",e.frame="none"})).addMatcher((e=>e.type.startsWith("dos/")&&e.type.endsWith("Error")),((e,t)=>{e.window="error"}))}}),Qr=Ir({name:"storage",initialState:{recived:0,total:0,changedRecived:0,changedTotal:0,ready:!1},reducers:{reset:e=>{e.recived=-1,e.total=0,e.changedRecived=0,e.changedTotal=0,e.ready=!1},progress:(e,t)=>{e.recived=t.payload[0],e.total=t.payload[1]},changedProgress:(e,t)=>{e.changedRecived=t.payload[0],e.changedTotal=t.payload[1]},ready:e=>{e.ready=!0}}});let Zr=-1;function ei(){return Zr+=1,{storeUid:Zr,slice:Ir({name:"init",initialState:{uid:Zr},reducers:{}})}}ei().slice;const ti=Ir({name:"opfs",initialState:{freeSpace:null,usage:null},reducers:{setFreeSpace:(e,t)=>{e.freeSpace=t.payload},setUsage:(e,t)=>{e.usage=t.payload}}});function ni(e){(async function(){const{quota:e,usage:t}=await navigator.storage.estimate();if(void 0===e||void 0===t)return null;return console.log(li(e),li(t)),e-t})().then((t=>{e.dispatch(ti.actions.setFreeSpace(t))})).catch(console.error),async function(){return ii(await oi())}().then((t=>{e.dispatch(ti.actions.setUsage(t))})).catch(console.error)}async function oi(){return await(await navigator.storage.getDirectory()).getDirectoryHandle("jsdos",{create:!0})}async function ri(e){let t=await oi();for(const n of e)""!==n&&(t=await t.getDirectoryHandle(n,{create:!0}));return t}async function ii(e){let t=0;for await(const[,n]of e)if("file"===n.kind){t+=(await n.getFile()).size}else t+=await ii(n);return t}async function si(e,t){const n=ui(e);try{const e=await t.getFileHandle(n,{create:!1});return new Uint8Array(await(await e.getFile()).arrayBuffer())}catch{return console.log("Changes not found",e),null}}async function ai(e,t,n){const o=ui(e),r=await n.getFileHandle(o,{create:!0}),i=await r.createWritable();await i.write(t.buffer),await i.close()}async function ci(e){return si(e,await ri(["saves"]))}function li(e){return null==e?null:e<1024?[e,"B"]:e<1048576?[Math.ceil(e/1024),"KB"]:e<1073741824?[Math.ceil(e/1024/1024),"MB"]:[Math.ceil(e/1024/1024/1024),"GB"]}function ui(e){return e.replace(/^https?:\/\//,"").replace(/[^a-zA-Z0-9._-]/g,"_").substring(0,200)}const di=e=>t=>n=>{const o=Object.assign({},n,{asyncStore:function(t){setTimeout((()=>t(e)),4)}});t(o)},pi={};function fi(e){return"function"==typeof e.getState?pi[e.getState().init.uid]:pi[e.init.uid]}function hi(){return fi(Qn())}function vi(e,t,n){e.options.onEvent&&setTimeout((()=>{var o,r;null==(r=(o=e.options).onEvent)||r.call(o,t,n)}),4)}function mi(e){return e.getState()}const _i=["dosbox","dosboxX"],yi=["webgl","canvas"],gi=["AsIs","1/1","5/4","4/3","16/10","16/9","Fit"],bi=65535,wi=["none","all","default"],xi=["pixelated","smooth"],ki=Ir({name:"dos",initialState:{step:"emu-init",emuVersion:"-",error:null,bundle:null,config:{},worker:"false"!==$r.getItem("worker"),jspi:"true"===$r.getItem("jspi")&&"function"==typeof WebAssembly.promising,backend:$r.getItem("backend")??"dosbox",backendLocked:!1,backendHardware:"false"!==$r.getItem("backendHardware"),renderBackend:$r.getItem("renderBackend")??"webgl",renderAspect:$r.getItem("renderAspect")??"AsIs",volume:Number.parseFloat($r.getItem("volume")??"1.0"),mobileControls:!1,mirroredControls:"true"===$r.getItem("mirroredControls"),scaleControls:Number.parseFloat($r.getItem("scaleControls")??"0.2"),mouseSensitivity:Number.parseFloat($r.getItem("mouse_sensitivity")??"0.5"),mouseCapture:!1,paused:!1,stats:{glfx:!1,offscreenCanvas:!1,cpuMetrics:null,nonSkippableSleepPreSec:0,sleepPerSec:0,sleepTimePerSec:0,framePerSec:0,soundPerSec:0,msgSentPerSec:0,msgRecvPerSec:0,netRecv:0,netSent:0,driveIo:[]},ipx:{address:"",status:"disconnected"},ci:!1,ciStartedAt:0,imageRendering:$r.getItem("imageRendering")??"pixelated",softKeyboard:!1,softKeyboardLayout:[[["{esc} {f1} {f2} {f3} {f4}","0 1 2 3 4","5 6 7 8 9","{ } ( ) {shift}","{layout} {ctrl} {alt} {space}"],["{f5} {f6} {f7} {f8}","{pgup} {pgdown} {bksp}","","{up}","{left} {down} {right}"],["{f9} {f10} {f11} {f12}","{del} {kp7} {kp8} {kp9}","{tab} {kp4} {kp5} {kp6}","- {kp1} {kp2} {kp3}","+ {kp0} . {enter}"]],[["{esc} ` 1 2 3 4 5 6 7 8 9 0 ( ) - = {bksp} {enter}","{tab} q w e r t y u i o p { } \\ [ ] {up}","{shift} {left} {right} a s d f g h j k l : ; ' [ {down}","{layout} {symbols} {alt} {ctrl} z x c v b n m , . / ] {space}"]]],softKeyboardSymbols:[{"{esc}":"␛","{bksp}":"⌫","{enter}":"↵","{up}":"↑","{down}":"↓","{left}":"←","{right}":"→","{shift}":"⇑","{layout}":"⎘","{pgup}":"PgUp","{pgdown}":"PgDown","{kp7}":"↖","{kp8}":"↑","{kp9}":"↗","{kp5}":"5","{kp4}":"←","{kp6}":"→","{kp1}":"↙","{kp2}":"↓","{kp3}":"↘","{kp0}":"0","{symbols}":"En/Ru"},{q:"й",w:"ц",e:"у",r:"к",t:"е",y:"н",u:"г",i:"ш",o:"щ",p:"з","{":"х","}":"ъ",a:"ф",s:"ы",d:"в",f:"а",g:"п",h:"р",j:"о",k:"л",l:"д",";":"ж","'":"э",z:"я",x:"ч",c:"с",v:"м",b:"и",n:"т",m:"ь",",":"б",".":"ю"}],softKeyboardActiveSymbols:0,softKeyboardActiveLayout:0,noCursor:!1,offscreenCanvas:!1,sockdrivePreload:"default",startIpxServer:!1,connectIpxAddress:null,fastForward:!1,frameSkip:0,cpuAuto:!0,cycles:"3000",speed:100,fastForwardOnBoot:0,withSockdrive:!1},reducers:{emuReady:(e,t)=>{e.step="emu-ready",e.emuVersion=t.payload},emuError:(e,t)=>{e.step="emu-error",e.error=t.payload??"Unexpeceted error"},bndLoad:(e,t)=>{e.step="bnd-load",e.bundle=t.payload},bndError:(e,t)=>{e.step="bnd-error",e.error=t.payload??"Unexpeceted error"},bndConfig:e=>{e.step="bnd-config"},bndReady:(e,t)=>{e.step="bnd-ready",e.config=t.payload},bndPlay:(e,t)=>{e.step="bnd-play",t.asyncStore((e=>{vi(fi(e),"bnd-play")}))},dosWorker:(e,t)=>{e.worker=t.payload,$r.setItem("worker",e.worker?"true":"false")},dosJspi:(e,t)=>{t.payload&&"function"!=typeof WebAssembly.promising?(e.jspi=!1,alert("JSPI is not supported by this browser")):e.jspi=t.payload,$r.setItem("jspi",e.jspi?"true":"false")},dosBackend:(e,t)=>{e.backend=t.payload},dosBackendLocked:(e,t)=>{e.backendLocked=t.payload},dosBackendHardware:(e,t)=>{e.backendHardware=t.payload,$r.setItem("backendHardware",e.backendHardware?"true":"false")},renderBackend:(e,t)=>{e.renderBackend=t.payload,$r.setItem("renderBackend",e.renderBackend)},renderAspect:(e,t)=>{e.renderAspect=t.payload,$r.setItem("renderAspect",e.renderAspect)},imageRendering:(e,t)=>{e.imageRendering=t.payload,$r.setItem("imageRendering",e.imageRendering)},volume:(e,t)=>{e.volume=t.payload,$r.setItem("volume",e.volume+"")},mouseSensitivity:(e,t)=>{e.mouseSensitivity=t.payload,$r.setItem("mouse_sensitivity",e.mouseSensitivity+"")},mouseCapture:(e,t)=>{e.mouseCapture=t.payload},paused:(e,t)=>{e.paused=t.payload},stats:(e,t)=>{e.stats=t.payload},ci:(e,t)=>{e.ci=t.payload,t.payload&&(e.ciStartedAt=Date.now())},connectIpx:(e,t)=>{if("connected"===e.ipx.status)throw new Error("Already connected");if(!e.ci)throw new Error("DOS is not started");const{room:n,address:o}=t.payload;e.ipx.status="connecting",t.asyncStore((e=>{const t=fi(e);if(!t.ci)throw new Error("DOS is not started");const r=o.endsWith("/")?o.substring(0,o.length-1):o;t.ci.networkConnect(0,r+":1900/ipx/"+n.replaceAll("@","_")).then((()=>{e.dispatch(ki.actions.statusIpx("connected"))})).catch((t=>{e.dispatch(ki.actions.statusIpx("error")),console.error(t)}))}))},statusIpx:(e,t)=>{e.ipx.status=t.payload},disconnectIpx:(e,t)=>{e.ipx.status="disconnected",t.asyncStore((e=>{var t;null==(t=fi(e).ci)||t.networkDisconnect(0)}))},setIpxAddress:(e,t)=>{e.ipx.address=t.payload},mobileControls:(e,t)=>{e.mobileControls=t.payload},mirroredControls:(e,t)=>{e.mirroredControls=t.payload,$r.setItem("mirroredControls",t.payload?"true":"false")},scaleControls:(e,t)=>{e.scaleControls=t.payload,$r.setItem("scaleControls",e.scaleControls+"")},softKeyboard:(e,t)=>{e.softKeyboard=t.payload},softKeyboardLayout:(e,t)=>{t.payload.length>0&&Array.isArray(t.payload[0])?e.softKeyboardLayout=t.payload:e.softKeyboardLayout=[[t.payload]]},softKeyboardSymbols:(e,t)=>{e.softKeyboardSymbols=t.payload},softKeyboardActiveSymbols:(e,t)=>{e.softKeyboardActiveSymbols=t.payload},softKeyboardActiveLayout:(e,t)=>{e.softKeyboardActiveLayout=t.payload},noCursor:(e,t)=>{e.noCursor=t.payload},offscreenCanvas:(e,t)=>{e.offscreenCanvas=t.payload},sockdrivePreload:(e,t)=>{e.sockdrivePreload=t.payload},startIpxServer:(e,t)=>{e.startIpxServer=t.payload},connectIpxAddress:(e,t)=>{e.connectIpxAddress=t.payload},fastForward:(e,t)=>{e.fastForward=t.payload},frameSkip:(e,t)=>{e.frameSkip=t.payload},cpuAuto:(e,t)=>{e.cpuAuto=t.payload},cycles:(e,t)=>{e.cycles=t.payload},speed:(e,t)=>{e.speed=t.payload},fastForwardOnBoot:(e,t)=>{e.fastForwardOnBoot=t.payload},withSockdrive:(e,t)=>{e.withSockdrive=t.payload}}});let Ci=!1;function Si(e,t,n){e.dispatch((async e=>{try{Ci||(await function(e,t){if(null!==document.querySelector("#emulators-js"))return Promise.resolve();return new Promise(((n,o)=>{const r=document.createElement("script");r.id="emulators-js",r.async=!0,r.type="text/javascript",r.src=e+"emulators.js"+t,r.onload=()=>{emulators.pathPrefix=e,emulators.pathSuffix=t,n()},r.onerror=e=>{o(new Error("Unable to add emulators.js. Probably you should set the 'pathPrefix' option to point to the js-dos folder."))},document.head.appendChild(r)}))}(t,n),Ci=!0),e(ki.actions.emuReady(emulators.version))}catch(o){console.error("Unable to init emulators.js",o),e(ki.actions.emuError(o.message))}}))}const Pi="https://br.cdn.dos.zone";function Ei(e){return e&&(e.endsWith("/b4b5275904d86a4ab8a20917b2b7e34f0df47bf7.jsdos")||e.endsWith("/dhry2.jsdos"))}async function Oi(e,t){var n,o;const r=await fi(t);if(null==(n=r.options.fsChanges)?void 0:n.pull)return await r.options.fsChanges.pull(e);if(!1!==(null==(o=r.options.fsChanges)?void 0:o.local))try{return await ci(e)}catch(i){return console.error(i),null}return null}async function Mi(e,t){try{if(!Ei(e)){const t=await async function(e){return si(e,await ri(["caches","bundles"]))}(e);if(null!==t)return t}}catch(r){}t.dispatch(Qr.actions.reset());const n=await fetch(e,{cache:"no-store"});if(200!==n.status)throw new Error("Resource not avalible ("+n.status+"): "+n.statusText);const o=await async function(e,t,n){const o=e.headers.get("Content-Length"),r=null===o?0:Number.parseInt(o),i=e.body.getReader();let s=0;const a=[];for(;;){const{done:e,value:o}=await i.read();if(e)break;a.push(o),s+=o.length;n(Math.min(t.startsWith(Pi)?s/2:s,r),r)}let c=0;const l=new Uint8Array(s);for(const u of a)l.set(u,c),c+=u.length;return l}(n,e,((e,n)=>{t.dispatch(Qr.actions.progress([e,n]))}));return async function(e,t){return ai(e,t,await ri(["caches","bundles"]))}(e,o).catch(console.error),o}function ji(e,t){return Di(e.name,function(e,t){return new Promise((n=>{t.dispatch(Qr.actions.reset());const o=new FileReader;o.addEventListener("load",(async e=>{n(new Uint8Array(o.result))})),o.addEventListener("progress",(e=>{t.dispatch(Qr.actions.progress([e.loaded,e.total]))})),o.readAsArrayBuffer(e)}))}(e,t),null,null,t)}async function Ai(e,t){return Di(e,Mi(e,t),async function(e,t){var n,o;const r=await(null==(o=null==(n=fi(t).options.fsChanges)?void 0:n.urlToKey)?void 0:o.call(n,e))??e+".changes";return{url:r,bundle:await Oi(r,t)}}(e,t),e,t)}async function Di(e,t,n,o,r){const i=fi(r),s=r.dispatch;i.loadedBundle=null,s(ki.actions.bndLoad(e));const a=await t;s(Qr.actions.ready());const c=await n;s(ki.actions.bndConfig());const l=await emulators.bundleConfig(a);s(Xr.actions.init(l)),null===l?s(Jr.actions.frameConf()):Ti(l,s),i.loadedBundle={bundleUrl:o,bundleChangesUrl:(null==c?void 0:c.url)??null,bundle:a,bundleChanges:(null==c?void 0:c.bundle)??null,initFs:i.options.initFs??null},s(ki.actions.bndReady({}))}function Ti(e,t){Li(e.dosboxConf,t),t(ki.actions.mouseCapture(e.dosboxConf.indexOf("autolock=true")>=0))}function Li(e,t){(e.indexOf("sockdrive")>=0||e.indexOf(".qcow2")>=0)&&(t(ki.actions.dosBackendLocked(!0)),t(ki.actions.dosBackend("dosboxX")),t(ki.actions.noCursor(!0)),t(ki.actions.withSockdrive(!0)),t(Jr.actions.canSave(-1===e.indexOf(".qcow2"))))}var Ii=0;function zi(e,t,n,r,i,s){var a,c,l={};for(c in t)"ref"==c?a=t[c]:l[c]=t[c];var u={type:e,props:l,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Ii,__i:-1,__u:0,__source:i,__self:s};if("function"==typeof e&&(a=e.defaultProps))for(c in a)void 0===l[c]&&(l[c]=a[c]);return o.vnode&&o.vnode(u),u}function Bi(){const e=Wr(),t=on((e=>e.editor.bundleConfig)),n=eo();function o(e){var t;Li(t=e,n),n(ki.actions.mouseCapture(t.indexOf("autolock=true")>0)),n(Xr.actions.dosboxConf(t))}return null===t?null:zi("div",{class:"editor-conf-frame flex flex-col flex-grow w-full gap-2",children:[zi("div",{class:"",children:e("dosboxconf_template")}),zi("div",{class:"flex flex-row flex-wrap items-center gap-2",children:qr.map((({name:e,backend:t,contents:o})=>zi("button",{class:"btn btn-sm",onClick:()=>{n(ki.actions.dosBackend("dosboxX"===t?"dosboxX":"dosbox"))},children:e})))}),zi("textarea",{class:"flex-grow",value:t.dosboxConf,onChange:e=>{var t;return o((null==(t=e.currentTarget)?void 0:t.value)??"")}})]})}var Ri={exports:{}};
21
- /*! react-checkbox-tree - v1.8.0 | 2022 */self;const Ni=K(Ri.exports=(e=>(()=>{var t={4184:(e,t)=>{var n;!function(){var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)){if(n.length){var s=r.apply(null,n);s&&e.push(s)}}else if("object"===i)if(n.toString===Object.prototype.toString)for(var a in n)o.call(n,a)&&n[a]&&e.push(a);else e.push(n.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()},8552:(e,t,n)=>{var o=n(852)(n(5639),"DataView");e.exports=o},1989:(e,t,n)=>{var o=n(1789),r=n(401),i=n(7667),s=n(1327),a=n(1866);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}c.prototype.clear=o,c.prototype.delete=r,c.prototype.get=i,c.prototype.has=s,c.prototype.set=a,e.exports=c},8407:(e,t,n)=>{var o=n(7040),r=n(4125),i=n(2117),s=n(7518),a=n(4705);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}c.prototype.clear=o,c.prototype.delete=r,c.prototype.get=i,c.prototype.has=s,c.prototype.set=a,e.exports=c},7071:(e,t,n)=>{var o=n(852)(n(5639),"Map");e.exports=o},3369:(e,t,n)=>{var o=n(4785),r=n(1285),i=n(6e3),s=n(9916),a=n(5265);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}c.prototype.clear=o,c.prototype.delete=r,c.prototype.get=i,c.prototype.has=s,c.prototype.set=a,e.exports=c},3818:(e,t,n)=>{var o=n(852)(n(5639),"Promise");e.exports=o},8525:(e,t,n)=>{var o=n(852)(n(5639),"Set");e.exports=o},8668:(e,t,n)=>{var o=n(3369),r=n(619),i=n(2385);function s(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new o;++t<n;)this.add(e[t])}s.prototype.add=s.prototype.push=r,s.prototype.has=i,e.exports=s},6384:(e,t,n)=>{var o=n(8407),r=n(7465),i=n(3779),s=n(7599),a=n(4758),c=n(4309);function l(e){var t=this.__data__=new o(e);this.size=t.size}l.prototype.clear=r,l.prototype.delete=i,l.prototype.get=s,l.prototype.has=a,l.prototype.set=c,e.exports=l},2705:(e,t,n)=>{var o=n(5639).Symbol;e.exports=o},1149:(e,t,n)=>{var o=n(5639).Uint8Array;e.exports=o},577:(e,t,n)=>{var o=n(852)(n(5639),"WeakMap");e.exports=o},4963:e=>{e.exports=function(e,t){for(var n=-1,o=null==e?0:e.length,r=0,i=[];++n<o;){var s=e[n];t(s,n,e)&&(i[r++]=s)}return i}},4636:(e,t,n)=>{var o=n(2545),r=n(5694),i=n(1469),s=n(4144),a=n(5776),c=n(6719),l=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=i(e),u=!n&&r(e),d=!n&&!u&&s(e),p=!n&&!u&&!d&&c(e),f=n||u||d||p,h=f?o(e.length,String):[],v=h.length;for(var m in e)!t&&!l.call(e,m)||f&&("length"==m||d&&("offset"==m||"parent"==m)||p&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||a(m,v))||h.push(m);return h}},2488:e=>{e.exports=function(e,t){for(var n=-1,o=t.length,r=e.length;++n<o;)e[r+n]=t[n];return e}},2908:e=>{e.exports=function(e,t){for(var n=-1,o=null==e?0:e.length;++n<o;)if(t(e[n],n,e))return!0;return!1}},8470:(e,t,n)=>{var o=n(7813);e.exports=function(e,t){for(var n=e.length;n--;)if(o(e[n][0],t))return n;return-1}},8866:(e,t,n)=>{var o=n(2488),r=n(1469);e.exports=function(e,t,n){var i=t(e);return r(e)?i:o(i,n(e))}},4239:(e,t,n)=>{var o=n(2705),r=n(9607),i=n(2333),s=o?o.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?r(e):i(e)}},9454:(e,t,n)=>{var o=n(4239),r=n(7005);e.exports=function(e){return r(e)&&"[object Arguments]"==o(e)}},939:(e,t,n)=>{var o=n(2492),r=n(7005);e.exports=function e(t,n,i,s,a){return t===n||(null==t||null==n||!r(t)&&!r(n)?t!=t&&n!=n:o(t,n,i,s,e,a))}},2492:(e,t,n)=>{var o=n(6384),r=n(7114),i=n(8351),s=n(6096),a=n(4160),c=n(1469),l=n(4144),u=n(6719),d="[object Arguments]",p="[object Array]",f="[object Object]",h=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,v,m,_){var y=c(e),g=c(t),b=y?p:a(e),w=g?p:a(t),x=(b=b==d?f:b)==f,k=(w=w==d?f:w)==f,C=b==w;if(C&&l(e)){if(!l(t))return!1;y=!0,x=!1}if(C&&!x)return _||(_=new o),y||u(e)?r(e,t,n,v,m,_):i(e,t,b,n,v,m,_);if(!(1&n)){var S=x&&h.call(e,"__wrapped__"),P=k&&h.call(t,"__wrapped__");if(S||P){var E=S?e.value():e,O=P?t.value():t;return _||(_=new o),m(E,O,n,v,_)}}return!!C&&(_||(_=new o),s(e,t,n,v,m,_))}},8458:(e,t,n)=>{var o=n(3560),r=n(5346),i=n(3218),s=n(346),a=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,p=RegExp("^"+u.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||r(e))&&(o(e)?p:a).test(s(e))}},8749:(e,t,n)=>{var o=n(4239),r=n(1780),i=n(7005),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,e.exports=function(e){return i(e)&&r(e.length)&&!!s[o(e)]}},280:(e,t,n)=>{var o=n(5726),r=n(6916),i=Object.prototype.hasOwnProperty;e.exports=function(e){if(!o(e))return r(e);var t=[];for(var n in Object(e))i.call(e,n)&&"constructor"!=n&&t.push(n);return t}},2545:e=>{e.exports=function(e,t){for(var n=-1,o=Array(e);++n<e;)o[n]=t(n);return o}},1717:e=>{e.exports=function(e){return function(t){return e(t)}}},4757:e=>{e.exports=function(e,t){return e.has(t)}},4429:(e,t,n)=>{var o=n(5639)["__core-js_shared__"];e.exports=o},7114:(e,t,n)=>{var o=n(8668),r=n(2908),i=n(4757);e.exports=function(e,t,n,s,a,c){var l=1&n,u=e.length,d=t.length;if(u!=d&&!(l&&d>u))return!1;var p=c.get(e),f=c.get(t);if(p&&f)return p==t&&f==e;var h=-1,v=!0,m=2&n?new o:void 0;for(c.set(e,t),c.set(t,e);++h<u;){var _=e[h],y=t[h];if(s)var g=l?s(y,_,h,t,e,c):s(_,y,h,e,t,c);if(void 0!==g){if(g)continue;v=!1;break}if(m){if(!r(t,(function(e,t){if(!i(m,t)&&(_===e||a(_,e,n,s,c)))return m.push(t)}))){v=!1;break}}else if(_!==y&&!a(_,y,n,s,c)){v=!1;break}}return c.delete(e),c.delete(t),v}},8351:(e,t,n)=>{var o=n(2705),r=n(1149),i=n(7813),s=n(7114),a=n(8776),c=n(1814),l=o?o.prototype:void 0,u=l?l.valueOf:void 0;e.exports=function(e,t,n,o,l,d,p){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!d(new r(e),new r(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var f=a;case"[object Set]":var h=1&o;if(f||(f=c),e.size!=t.size&&!h)return!1;var v=p.get(e);if(v)return v==t;o|=2,p.set(e,t);var m=s(f(e),f(t),o,l,d,p);return p.delete(e),m;case"[object Symbol]":if(u)return u.call(e)==u.call(t)}return!1}},6096:(e,t,n)=>{var o=n(8234),r=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,i,s,a){var c=1&n,l=o(e),u=l.length;if(u!=o(t).length&&!c)return!1;for(var d=u;d--;){var p=l[d];if(!(c?p in t:r.call(t,p)))return!1}var f=a.get(e),h=a.get(t);if(f&&h)return f==t&&h==e;var v=!0;a.set(e,t),a.set(t,e);for(var m=c;++d<u;){var _=e[p=l[d]],y=t[p];if(i)var g=c?i(y,_,p,t,e,a):i(_,y,p,e,t,a);if(!(void 0===g?_===y||s(_,y,n,i,a):g)){v=!1;break}m||(m="constructor"==p)}if(v&&!m){var b=e.constructor,w=t.constructor;b==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof w&&w instanceof w||(v=!1)}return a.delete(e),a.delete(t),v}},1957:(e,t,n)=>{var o="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=o},8234:(e,t,n)=>{var o=n(8866),r=n(9551),i=n(3674);e.exports=function(e){return o(e,i,r)}},5050:(e,t,n)=>{var o=n(7019);e.exports=function(e,t){var n=e.__data__;return o(t)?n["string"==typeof t?"string":"hash"]:n.map}},852:(e,t,n)=>{var o=n(8458),r=n(7801);e.exports=function(e,t){var n=r(e,t);return o(n)?n:void 0}},9607:(e,t,n)=>{var o=n(2705),r=Object.prototype,i=r.hasOwnProperty,s=r.toString,a=o?o.toStringTag:void 0;e.exports=function(e){var t=i.call(e,a),n=e[a];try{e[a]=void 0;var o=!0}catch(c){}var r=s.call(e);return o&&(t?e[a]=n:delete e[a]),r}},9551:(e,t,n)=>{var o=n(4963),r=n(479),i=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,a=s?function(e){return null==e?[]:(e=Object(e),o(s(e),(function(t){return i.call(e,t)})))}:r;e.exports=a},4160:(e,t,n)=>{var o=n(8552),r=n(7071),i=n(3818),s=n(8525),a=n(577),c=n(4239),l=n(346),u="[object Map]",d="[object Promise]",p="[object Set]",f="[object WeakMap]",h="[object DataView]",v=l(o),m=l(r),_=l(i),y=l(s),g=l(a),b=c;(o&&b(new o(new ArrayBuffer(1)))!=h||r&&b(new r)!=u||i&&b(i.resolve())!=d||s&&b(new s)!=p||a&&b(new a)!=f)&&(b=function(e){var t=c(e),n="[object Object]"==t?e.constructor:void 0,o=n?l(n):"";if(o)switch(o){case v:return h;case m:return u;case _:return d;case y:return p;case g:return f}return t}),e.exports=b},7801:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},1789:(e,t,n)=>{var o=n(4536);e.exports=function(){this.__data__=o?o(null):{},this.size=0}},401:e=>{e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},7667:(e,t,n)=>{var o=n(4536),r=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(o){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return r.call(t,e)?t[e]:void 0}},1327:(e,t,n)=>{var o=n(4536),r=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return o?void 0!==t[e]:r.call(t,e)}},1866:(e,t,n)=>{var o=n(4536);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=o&&void 0===t?"__lodash_hash_undefined__":t,this}},5776:e=>{var t=/^(?:0|[1-9]\d*)$/;e.exports=function(e,n){var o=typeof e;return!!(n=null==n?9007199254740991:n)&&("number"==o||"symbol"!=o&&t.test(e))&&e>-1&&e%1==0&&e<n}},7019:e=>{e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},5346:(e,t,n)=>{var o,r=n(4429),i=(o=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||""))?"Symbol(src)_1."+o:"";e.exports=function(e){return!!i&&i in e}},5726:e=>{var t=Object.prototype;e.exports=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||t)}},7040:e=>{e.exports=function(){this.__data__=[],this.size=0}},4125:(e,t,n)=>{var o=n(8470),r=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=o(t,e);return!(n<0||(n==t.length-1?t.pop():r.call(t,n,1),--this.size,0))}},2117:(e,t,n)=>{var o=n(8470);e.exports=function(e){var t=this.__data__,n=o(t,e);return n<0?void 0:t[n][1]}},7518:(e,t,n)=>{var o=n(8470);e.exports=function(e){return o(this.__data__,e)>-1}},4705:(e,t,n)=>{var o=n(8470);e.exports=function(e,t){var n=this.__data__,r=o(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}},4785:(e,t,n)=>{var o=n(1989),r=n(8407),i=n(7071);e.exports=function(){this.size=0,this.__data__={hash:new o,map:new(i||r),string:new o}}},1285:(e,t,n)=>{var o=n(5050);e.exports=function(e){var t=o(this,e).delete(e);return this.size-=t?1:0,t}},6e3:(e,t,n)=>{var o=n(5050);e.exports=function(e){return o(this,e).get(e)}},9916:(e,t,n)=>{var o=n(5050);e.exports=function(e){return o(this,e).has(e)}},5265:(e,t,n)=>{var o=n(5050);e.exports=function(e,t){var n=o(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}},8776:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,o){n[++t]=[o,e]})),n}},4536:(e,t,n)=>{var o=n(852)(Object,"create");e.exports=o},6916:(e,t,n)=>{var o=n(5569)(Object.keys,Object);e.exports=o},1167:(e,t,n)=>{e=n.nmd(e);var o=n(1957),r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,s=i&&i.exports===r&&o.process,a=function(){try{return i&&i.require&&i.require("util").types||s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=a},2333:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},5569:e=>{e.exports=function(e,t){return function(n){return e(t(n))}}},5639:(e,t,n)=>{var o=n(1957),r="object"==typeof self&&self&&self.Object===Object&&self,i=o||r||Function("return this")();e.exports=i},619:e=>{e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},2385:e=>{e.exports=function(e){return this.__data__.has(e)}},1814:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}},7465:(e,t,n)=>{var o=n(8407);e.exports=function(){this.__data__=new o,this.size=0}},3779:e=>{e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},7599:e=>{e.exports=function(e){return this.__data__.get(e)}},4758:e=>{e.exports=function(e){return this.__data__.has(e)}},4309:(e,t,n)=>{var o=n(8407),r=n(7071),i=n(3369);e.exports=function(e,t){var n=this.__data__;if(n instanceof o){var s=n.__data__;if(!r||s.length<199)return s.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(s)}return n.set(e,t),this.size=n.size,this}},346:e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(n){}try{return e+""}catch(n){}}return""}},7813:e=>{e.exports=function(e,t){return e===t||e!=e&&t!=t}},5694:(e,t,n)=>{var o=n(9454),r=n(7005),i=Object.prototype,s=i.hasOwnProperty,a=i.propertyIsEnumerable,c=o(function(){return arguments}())?o:function(e){return r(e)&&s.call(e,"callee")&&!a.call(e,"callee")};e.exports=c},1469:e=>{var t=Array.isArray;e.exports=t},8612:(e,t,n)=>{var o=n(3560),r=n(1780);e.exports=function(e){return null!=e&&r(e.length)&&!o(e)}},4144:(e,t,n)=>{e=n.nmd(e);var o=n(5639),r=n(5062),i=t&&!t.nodeType&&t,s=i&&e&&!e.nodeType&&e,a=s&&s.exports===i?o.Buffer:void 0,c=(a?a.isBuffer:void 0)||r;e.exports=c},8446:(e,t,n)=>{var o=n(939);e.exports=function(e,t){return o(e,t)}},3560:(e,t,n)=>{var o=n(4239),r=n(3218);e.exports=function(e){if(!r(e))return!1;var t=o(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},1780:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},3218:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},7005:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},6719:(e,t,n)=>{var o=n(8749),r=n(1717),i=n(1167),s=i&&i.isTypedArray,a=s?r(s):o;e.exports=a},3674:(e,t,n)=>{var o=n(4636),r=n(280),i=n(8612);e.exports=function(e){return i(e)?o(e):r(e)}},8306:(e,t,n)=>{var o=n(3369);function r(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var o=arguments,r=t?t.apply(this,o):o[0],i=n.cache;if(i.has(r))return i.get(r);var s=e.apply(this,o);return n.cache=i.set(r,s)||i,s};return n.cache=new(r.Cache||o),n}r.Cache=o,e.exports=r},479:e=>{e.exports=function(){return[]}},5062:e=>{e.exports=function(){return!1}},2703:(e,t,n)=>{var o=n(414);function r(){}function i(){}i.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,i,s){if(s!==o){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return n.PropTypes=n,n}},5697:(e,t,n)=>{e.exports=n(2703)()},414:e=>{e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},9787:t=>{t.exports=e}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var i=n[e]={id:e,loaded:!1,exports:{}};return t[e](i,i.exports,o),i.loaded=!0,i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};return(()=>{o.r(r),o.d(r,{default:()=>le,expandNodesToLevel:()=>ce});var e=o(4184),t=o.n(e),n=o(8446),i=o.n(n),s=o(8306),a=o.n(s);let c=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce(((e,t)=>e+((t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_")),"");var l=o(5697),u=o.n(l),d=o(9787),p=o.n(d);function f(e){return(f="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})(e)}var h=["children","title"];function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},v.apply(this,arguments)}function m(e,t){return(m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var g=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&&m(e,t)}(s,e);var t,n,o,r,i=(o=s,r=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}}(),function(){var e,t=_(o);if(r){var n=_(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===f(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function s(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),i.apply(this,arguments)}return t=s,(n=[{key:"render",value:function(){var e=this.props,t=e.children,n=e.title,o=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,h);return p().createElement("button",v({"aria-label":n,title:n,type:"button"},o),t)}}])&&function(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),s}(p().PureComponent);y(g,"propTypes",{children:u().node.isRequired,title:u().string}),y(g,"defaultProps",{title:null});const b=g,w={ALL:"all",PARENT:"parent",LEAF:"leaf"};function x(e){this.message=e,this.stack=Error().stack}x.prototype=Object.create(Error.prototype),x.prototype.name="CheckboxTreeError";const k=x;function C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function S(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var P=w;const E=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.props=t,this.flatNodes=n}var t,n;return t=e,n=[{key:"setProps",value:function(e){this.props=e}},{key:"clone",value:function(){var t=this,n={};return Object.keys(this.flatNodes).forEach((function(e){var o=t.flatNodes[e];n[e]=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},o)})),new e(this.props,n)}},{key:"getNode",value:function(e){return this.flatNodes[e]}},{key:"reset",value:function(){this.flatNodes={}}},{key:"flattenNodes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(Array.isArray(e)&&0!==e.length){var r=this.props,i=r.disabled,s=r.noCascade;e.forEach((function(e,r){var a=t.nodeHasChildren(e);if(void 0!==t.flatNodes[e.value])throw new k("Duplicate value '".concat(e.value,"' detected. All node values must be unique."));t.flatNodes[e.value]={label:e.label,value:e.value,children:e.children,parent:n,isChild:void 0!==n.value,isParent:a,isLeaf:!a,showCheckbox:void 0===e.showCheckbox||e.showCheckbox,disabled:t.getDisabledState(e,n,i,s),treeDepth:o,index:r},t.flattenNodes(e.children,e,o+1)}))}}},{key:"nodeHasChildren",value:function(e){return Array.isArray(e.children)}},{key:"getDisabledState",value:function(e,t,n,o){return!!n||!(o||!t.disabled)||Boolean(e.disabled)}},{key:"deserializeLists",value:function(e){var t=this,n=["checked","expanded"];Object.keys(this.flatNodes).forEach((function(e){n.forEach((function(n){t.flatNodes[e][n]=!1}))})),n.forEach((function(n){e[n].forEach((function(e){void 0!==t.flatNodes[e]&&(t.flatNodes[e][n]=!0)}))}))}},{key:"serializeList",value:function(e){var t=this,n=[];return Object.keys(this.flatNodes).forEach((function(o){t.flatNodes[o][e]&&n.push(o)})),n}},{key:"expandAllNodes",value:function(e){var t=this;return Object.keys(this.flatNodes).forEach((function(n){t.flatNodes[n].isParent&&(t.flatNodes[n].expanded=e)})),this}},{key:"toggleChecked",value:function(e,t,n,o){var r=this,i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=this.flatNodes[e.value],a=[P.PARENT,P.ALL].indexOf(n)>-1,c=[P.LEAF,P.ALL].indexOf(n)>-1;if(s.isLeaf||o){if(e.disabled)return this;this.toggleNode(e.value,"checked",t)}else(a||0===s.children.length)&&this.toggleNode(e.value,"checked",t),c&&s.children.forEach((function(e){r.toggleChecked(e,t,n,o,!1)}));return i&&!o&&s.isChild&&a&&this.toggleParentStatus(s.parent,n),this}},{key:"toggleParentStatus",value:function(e,t){var n=this.flatNodes[e.value];n.isChild?(t===P.ALL&&this.toggleNode(e.value,"checked",this.isEveryChildChecked(n)),this.toggleParentStatus(n.parent,t)):this.toggleNode(e.value,"checked",this.isEveryChildChecked(n))}},{key:"isEveryChildChecked",value:function(e){var t=this;return e.children.every((function(e){return t.getNode(e.value).checked}))}},{key:"toggleNode",value:function(e,t,n){return this.flatNodes[e][t]=n,this}}],n&&function(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function O(e){return(O="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})(e)}function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},M.apply(this,arguments)}function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function A(e,t){return(A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function D(e){return(D=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var L=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)}(s,e);var t,n,o,r,i=(o=s,r=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}}(),function(){var e,t=D(o);if(r){var n=D(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===O(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function s(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),i.apply(this,arguments)}return t=s,n=[{key:"componentDidMount",value:function(){this.updateDeterminateProperty()}},{key:"componentDidUpdate",value:function(){this.updateDeterminateProperty()}},{key:"updateDeterminateProperty",value:function(){var e=this.props.indeterminate;this.checkbox.indeterminate=e}},{key:"render",value:function(){var e=this,t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach((function(t){T(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},this.props);return delete t.indeterminate,p().createElement("input",M({},t,{ref:function(t){e.checkbox=t},type:"checkbox"}))}}],n&&function(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),s}(p().PureComponent);T(L,"propTypes",{indeterminate:u().bool}),T(L,"defaultProps",{indeterminate:!1});const I=L,z=u().shape({check:u().node,uncheck:u().node,halfCheck:u().node,expandClose:u().node,expandOpen:u().node,expandAll:u().node,collapseAll:u().node,parentClose:u().node,parentOpen:u().node,leaf:u().node}),B=u().shape({collapseAll:u().string.isRequired,expandAll:u().string.isRequired,toggle:u().string.isRequired});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})(e)}function N(e,t){return(N=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function F(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)})(e)}function K(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var H=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&&N(e,t)}(a,e);var n,o,r,i,s=(r=a,i=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}}(),function(){var e,t=U(r);if(i){var n=U(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.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 F(e)}(this,e)});function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=s.call(this,e)).onCheck=t.onCheck.bind(F(t)),t.onCheckboxKeyPress=t.onCheckboxKeyPress.bind(F(t)),t.onCheckboxKeyUp=t.onCheckboxKeyUp.bind(F(t)),t.onClick=t.onClick.bind(F(t)),t.onExpand=t.onExpand.bind(F(t)),t}return n=a,(o=[{key:"onCheck",value:function(){var e=this.props,t=e.value;(0,e.onCheck)({value:t,checked:this.getCheckState({toggle:!0})})}},{key:"onCheckboxKeyPress",value:function(e){32===e.which&&e.preventDefault()}},{key:"onCheckboxKeyUp",value:function(e){var t=e.keyCode;[13,32].includes(t)&&this.onCheck()}},{key:"onClick",value:function(){var e=this.props,t=e.expandOnClick,n=e.isParent,o=e.value,r=e.onClick;n&&t&&this.onExpand(),r({value:o,checked:this.getCheckState({toggle:!1})})}},{key:"onExpand",value:function(){var e=this.props,t=e.expanded,n=e.value;(0,e.onExpand)({value:n,expanded:!t})}},{key:"getCheckState",value:function(e){var t=e.toggle,n=this.props,o=n.checked,r=n.optimisticToggle;return!(0!==o||!t)||1===o&&!t||2===o&&r}},{key:"renderCollapseButton",value:function(){var e=this.props,t=e.expandDisabled,n=e.isLeaf,o=e.lang;return n?p().createElement("span",{className:"rct-collapse"},p().createElement("span",{className:"rct-icon"})):p().createElement(b,{className:"rct-collapse rct-collapse-btn",disabled:t,title:o.toggle,onClick:this.onExpand},this.renderCollapseIcon())}},{key:"renderCollapseIcon",value:function(){var e=this.props,t=e.expanded,n=e.icons,o=n.expandClose,r=n.expandOpen;return t?r:o}},{key:"renderCheckboxIcon",value:function(){var e=this.props,t=e.checked,n=e.icons,o=n.uncheck,r=n.check,i=n.halfCheck;return 0===t?o:1===t?r:i}},{key:"renderNodeIcon",value:function(){var e=this.props,t=e.expanded,n=e.icon,o=e.icons,r=o.leaf,i=o.parentClose,s=o.parentOpen,a=e.isLeaf;return null!==n?n:a?r:t?s:i}},{key:"renderBareLabel",value:function(e){var t=this.props,n=t.onClick,o=t.title,r=null!==n;return p().createElement("span",{className:"rct-bare-label",title:o},r?p().createElement("span",{className:"rct-node-clickable",onClick:this.onClick,onKeyPress:this.onClick,role:"button",tabIndex:0},e):e)}},{key:"renderCheckboxLabel",value:function(e){var t=this.props,n=t.checked,o=t.disabled,r=t.title,i=t.treeId,s=t.value,a=null!==t.onClick,c="".concat(i,"-").concat(String(s).split(" ").join("_")),l=[p().createElement("label",{key:0,htmlFor:c,title:r},p().createElement(I,{checked:1===n,disabled:o,id:c,indeterminate:2===n,onClick:this.onCheck,onChange:function(){}}),p().createElement("span",{"aria-checked":1===n,"aria-disabled":o,className:"rct-checkbox",role:"checkbox",tabIndex:0,onKeyPress:this.onCheckboxKeyPress,onKeyUp:this.onCheckboxKeyUp},this.renderCheckboxIcon()),a?null:e)];return a&&l.push(p().createElement("span",{key:1,className:"rct-node-clickable",onClick:this.onClick,onKeyPress:this.onClick,role:"link",tabIndex:0},e)),l}},{key:"renderLabel",value:function(){var e=this.props,t=e.label,n=e.showCheckbox,o=[e.showNodeIcon?p().createElement("span",{key:0,className:"rct-node-icon"},this.renderNodeIcon()):null,p().createElement("span",{key:1,className:"rct-title"},t)];return n?this.renderCheckboxLabel(o):this.renderBareLabel(o)}},{key:"renderChildren",value:function(){return this.props.expanded?this.props.children:null}},{key:"render",value:function(){var e=this.props,n=e.className,o=e.disabled,r=e.expanded,i=e.isLeaf,s=t()({"rct-node":!0,"rct-node-leaf":i,"rct-node-parent":!i,"rct-node-expanded":!i&&r,"rct-node-collapsed":!i&&!r,"rct-disabled":o},n);return p().createElement("li",{className:s},p().createElement("span",{className:"rct-text"},this.renderCollapseButton(),this.renderLabel()),this.renderChildren())}}])&&function(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(n.prototype,o),Object.defineProperty(n,"prototype",{writable:!1}),a}(p().PureComponent);K(H,"propTypes",{checked:u().number.isRequired,disabled:u().bool.isRequired,expandDisabled:u().bool.isRequired,expanded:u().bool.isRequired,icons:z.isRequired,isLeaf:u().bool.isRequired,isParent:u().bool.isRequired,label:u().node.isRequired,lang:B.isRequired,optimisticToggle:u().bool.isRequired,showNodeIcon:u().bool.isRequired,treeId:u().string.isRequired,value:u().oneOfType([u().string,u().number]).isRequired,onCheck:u().func.isRequired,onExpand:u().func.isRequired,children:u().node,className:u().string,expandOnClick:u().bool,icon:u().node,showCheckbox:u().bool,title:u().string,onClick:u().func}),K(H,"defaultProps",{children:null,className:null,expandOnClick:!1,icon:null,showCheckbox:!0,title:null,onClick:function(){}});const V=H,W=u().oneOfType([u().arrayOf(u().string),u().arrayOf(u().number)]);function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function X(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q(Object(n),!0).forEach((function(t){G(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function G(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $={label:u().node.isRequired,value:u().oneOfType([u().string,u().number]).isRequired,disabled:u().bool,icon:u().node,showCheckbox:u().bool,title:u().string};const Y=u().oneOfType([u().shape($),u().shape(X(X({},$),{},{children:u().arrayOf($).isRequired}))]);function J(e){return(J="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})(e)}function Q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Q(Object(n),!0).forEach((function(t){re(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ee(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function te(e,t){return(te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ne(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function oe(e){return(oe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function re(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ie=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&&te(e,t)}(d,e);var n,o,r,s,l,u=(s=d,l=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}}(),function(){var e,t=oe(s);if(l){var n=oe(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===J(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ne(e)}(this,e)});function d(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),t=u.call(this,e);var n=new E(e);return n.flattenNodes(e.nodes),n.deserializeLists({checked:e.checked,expanded:e.expanded}),t.state={id:e.id||"rct-".concat(c()),model:n,prevProps:e},t.onCheck=t.onCheck.bind(ne(t)),t.onExpand=t.onExpand.bind(ne(t)),t.onNodeClick=t.onNodeClick.bind(ne(t)),t.onExpandAll=t.onExpandAll.bind(ne(t)),t.onCollapseAll=t.onCollapseAll.bind(ne(t)),t.combineMemorized=a()((function(e,t){return Z(Z({},e),t)})).bind(ne(t)),t}return n=d,o=[{key:"onCheck",value:function(e){var t=this.props,n=t.checkModel,o=t.noCascade,r=t.onCheck,i=this.state.model.clone(),s=i.getNode(e.value);i.toggleChecked(e,e.checked,n,o),r(i.serializeList("checked"),Z(Z({},s),e))}},{key:"onExpand",value:function(e){var t=this.props.onExpand,n=this.state.model.clone(),o=n.getNode(e.value);n.toggleNode(e.value,"expanded",e.expanded),t(n.serializeList("expanded"),Z(Z({},o),e))}},{key:"onNodeClick",value:function(e){(0,this.props.onClick)(Z(Z({},this.state.model.getNode(e.value)),e))}},{key:"onExpandAll",value:function(){this.expandAllNodes()}},{key:"onCollapseAll",value:function(){this.expandAllNodes(!1)}},{key:"expandAllNodes",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];(0,this.props.onExpand)(this.state.model.clone().expandAllNodes(e).serializeList("expanded"))}},{key:"determineShallowCheckState",value:function(e,t){var n=this.state.model.getNode(e.value);return n.isLeaf||t||0===e.children.length?n.checked?1:0:this.isEveryChildChecked(e)?1:this.isSomeChildChecked(e)?2:0}},{key:"isEveryChildChecked",value:function(e){var t=this;return e.children.every((function(e){return 1===t.state.model.getNode(e.value).checkState}))}},{key:"isSomeChildChecked",value:function(e){var t=this;return e.children.some((function(e){return t.state.model.getNode(e.value).checkState>0}))}},{key:"renderTreeNodes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=this.props,r=o.expandDisabled,i=o.expandOnClick,s=o.icons,a=o.lang,c=o.noCascade,l=o.onClick,u=o.onlyLeafCheckboxes,f=o.optimisticToggle,h=o.showNodeTitle,v=o.showNodeIcon,m=this.state,_=m.id,y=m.model,g=d.defaultProps.icons,b=e.map((function(e){var o=e.value,d=y.getNode(e.value),m=d.isParent?t.renderTreeNodes(e.children,e):null;d.checkState=t.determineShallowCheckState(e,c);var b=u?d.isLeaf:d.showCheckbox;return!n.value||y.getNode(n.value).expanded?p().createElement(V,{key:o,checked:d.checkState,className:e.className,disabled:d.disabled,expandDisabled:r,expandOnClick:i,expanded:d.expanded,icon:e.icon,icons:t.combineMemorized(g,s),label:e.label,lang:a,optimisticToggle:f,isLeaf:d.isLeaf,isParent:d.isParent,showCheckbox:b,showNodeIcon:v,title:h?e.title||e.label:e.title,treeId:_,value:e.value,onCheck:t.onCheck,onClick:l&&t.onNodeClick,onExpand:t.onExpand},m):null}));return p().createElement("ol",null,b)}},{key:"renderExpandAll",value:function(){var e=this.props,t=e.icons,n=t.expandAll,o=t.collapseAll,r=e.lang;return e.showExpandAll?p().createElement("div",{className:"rct-options"},p().createElement(b,{className:"rct-option rct-option-expand-all",title:r.expandAll,onClick:this.onExpandAll},n),p().createElement(b,{className:"rct-option rct-option-collapse-all",title:r.collapseAll,onClick:this.onCollapseAll},o)):null}},{key:"renderHiddenInput",value:function(){var e=this.props,t=e.name,n=e.nameAsArray;return void 0===t?null:n?this.renderArrayHiddenInput():this.renderJoinedHiddenInput()}},{key:"renderArrayHiddenInput",value:function(){var e=this.props,t=e.checked,n=e.name;return t.map((function(e){var t="".concat(n,"[]");return p().createElement("input",{key:e,name:t,type:"hidden",value:e})}))}},{key:"renderJoinedHiddenInput",value:function(){var e=this.props,t=e.checked,n=e.name,o=t.join(",");return p().createElement("input",{name:n,type:"hidden",value:o})}},{key:"render",value:function(){var e,n=this.props,o=n.direction,r=n.disabled,i=n.iconsClass,s=n.nodes,a=n.nativeCheckboxes,c=this.state.id,l=this.renderTreeNodes(s),u=t()((re(e={"react-checkbox-tree":!0,"rct-disabled":r},"rct-icons-".concat(i),!0),re(e,"rct-native-display",a),re(e,"rct-direction-rtl","rtl"===o),e));return p().createElement("div",{className:u,id:c},this.renderExpandAll(),this.renderHiddenInput(),l)}}],r=[{key:"getDerivedStateFromProps",value:function(e,t){var n=t.model,o=t.prevProps,r=e.disabled,s=e.id,a=e.nodes,c=Z(Z({},t),{},{prevProps:e});return n.setProps(e),i()(o.nodes,a)&&o.disabled===r||(n.reset(),n.flattenNodes(a)),null!==s&&(c=Z(Z({},c),{},{id:s})),n.deserializeLists({checked:e.checked,expanded:e.expanded}),c}}],o&&ee(n.prototype,o),r&&ee(n,r),Object.defineProperty(n,"prototype",{writable:!1}),d}(p().Component);function se(e){return function(e){if(Array.isArray(e))return ae(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return ae(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)?ae(e,t):void 0}}(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 ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ce(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(n>t)return[];var o=[];return e.forEach((function(e){e.children&&(o=[].concat(se(o),[e.value],se(ce(e.children,t,n+1))))})),o}re(ie,"propTypes",{nodes:u().arrayOf(Y).isRequired,checkModel:u().oneOf([w.LEAF,w.ALL]),checked:W,direction:u().string,disabled:u().bool,expandDisabled:u().bool,expandOnClick:u().bool,expanded:W,icons:z,iconsClass:u().string,id:u().string,lang:B,name:u().string,nameAsArray:u().bool,nativeCheckboxes:u().bool,noCascade:u().bool,onlyLeafCheckboxes:u().bool,optimisticToggle:u().bool,showExpandAll:u().bool,showNodeIcon:u().bool,showNodeTitle:u().bool,onCheck:u().func,onClick:u().func,onExpand:u().func}),re(ie,"defaultProps",{checkModel:w.LEAF,checked:[],direction:"ltr",disabled:!1,expandDisabled:!1,expandOnClick:!1,expanded:[],icons:{check:p().createElement("span",{className:"rct-icon rct-icon-check"}),uncheck:p().createElement("span",{className:"rct-icon rct-icon-uncheck"}),halfCheck:p().createElement("span",{className:"rct-icon rct-icon-half-check"}),expandClose:p().createElement("span",{className:"rct-icon rct-icon-expand-close"}),expandOpen:p().createElement("span",{className:"rct-icon rct-icon-expand-open"}),expandAll:p().createElement("span",{className:"rct-icon rct-icon-expand-all"}),collapseAll:p().createElement("span",{className:"rct-icon rct-icon-collapse-all"}),parentClose:p().createElement("span",{className:"rct-icon rct-icon-parent-close"}),parentOpen:p().createElement("span",{className:"rct-icon rct-icon-parent-open"}),leaf:p().createElement("span",{className:"rct-icon rct-icon-leaf"})},iconsClass:"fa4",id:null,lang:{collapseAll:"Collapse all",expandAll:"Expand all",toggle:"Toggle"},name:void 0,nameAsArray:!1,nativeCheckboxes:!1,noCascade:!1,onlyLeafCheckboxes:!1,optimisticToggle:!0,showExpandAll:!1,showNodeIcon:!0,showNodeTitle:!1,onCheck:function(){},onClick:null,onExpand:function(){}});const le=ie})(),r})())(Pt));function Fi(e,t,n="application/zip"){const o=new Blob([t],{type:n});!function(e,t,n=!0){const o=document.createElement("a");o.href=t,o.target=n?"_blank":"_self",o.download=e,o.style.display="none",document.body.appendChild(o),o.click(),o.remove()}(e,URL.createObjectURL(o))}function Ui(){const e=Wr(),t=on((e=>e.dos.ci)),n=hi(),[o,r]=ie(0),[i,s]=ie(null),[a,c]=ie([]),[l,u]=ie([]),[d,p]=ie(null),[f,h]=ie(!1);function v(e){s(e),r(Math.round(Gi(e)/1024/1024*100)/100)}async function m(){if(v(null),null===n.ci||!t)return;v(Ki(await n.ci.fsTree()))}return ae((()=>{if(null===n.ci||!t)return;let e=!1;return n.ci.fsTree().then((t=>{e||v(Ki(t))})).catch((t=>{console.error(t),e||v(null)})),()=>{e=!0}}),[t]),zi("div",{class:"editor-fs-frame frame-root items-start px-4",children:[(f||null!==d)&&zi("div",{class:"card card-bordered bg-base-100 shadow-xl w-full",children:zi("div",{class:"card-body",children:[zi("div",{class:"card-title",children:e(f?"please_wait":"uploading_file")}),zi("span",{class:"break-words",children:f?e("making_bundle"):d})]})}),!f&&null===d&&i&&zi("div",{className:"fs-tree-view",children:[zi(Vi,{onRefresh:m,onUploadingFile:p,onMakingBundle:h,onRemoveFile:async function(){const e=n.ci;if(null!==e){try{p("DELETE_OPERATION");for(let t of l)t.startsWith("./")&&(t=t.slice(2)),await e.fsDeleteFile(t)}finally{p(null)}u([]),await m()}},canDelete:l.length>0}),zi("div",{class:"bg-base-200 px-2 py-1 text-right",children:[e("size"),": ",o," Mb"]}),zi("div",{class:"fs-tree",children:zi(Ni,{icons:{expandOpen:zi(qi,{}),expandClose:zi(Xi,{})},iconsClass:"icon",nativeCheckboxes:!1,onlyLeafCheckboxes:!1,nodes:i,checked:l,onCheck:function(e,t){const n=e.indexOf(t.value);t.checked&&-1===n?e.push(t.value):t.checked||-1===n||e.splice(n,1),u(e)},expanded:a,onExpand:function(e,t){c(e)}})})]})]})}function Ki(e){var t;const n=[];for(const o of(null==(t=e.nodes)?void 0:t.sort(Wi))||[])n.push(Hi(o,"."));return n}function Hi(e,t){const n=t+"/"+e.name,o={label:e.name,value:n,fsNode:e};if(null!==e.nodes){const t=e.nodes.sort(Wi).map((e=>Hi(e,n)));o.children=t}return o}function Vi(e){const t=Wr(),n=le(null),o=le(null),r=Qn(),i=hi(),{onRefresh:s,onUploadingFile:a,onMakingBundle:c,onRemoveFile:l,canDelete:u}=e;function d(e){const t=(e?o:n).current;null!==t&&t.click()}async function p(e){const t=i.ci,n=e.target.files;if(null!==t&&null!==n){try{for(const e of n){a(e.name);const n=(e.webkitRelativePath??"").split("/");n.shift();const o=n.join("/");await t.fsWriteFile(0==o.length?e.name:o,e.stream())}}finally{a(null)}await s()}}return ae((()=>{null!==n.current&&(n.current.setAttribute("directory",""),n.current.setAttribute("webkitdirectory",""))}),[n]),zi("div",{class:"h-6 flex flex-row",children:[zi("input",{class:"hidden",type:"file",multiple:!0,ref:n,onChange:p}),zi("input",{class:"hidden",type:"file",multiple:!0,ref:o,onChange:p}),zi("button",{class:"refresh btn-xs rounded-none",onClick:s,children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99"})})}),zi("button",{class:"add-file btn-xs rounded-none",onClick:()=>d(!0),children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m3.75 9v6m3-3H9m1.5-12H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}),zi("button",{class:"add-dir btn-xs rounded-none",onClick:()=>d(!1),children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 10.5v6m3-3H9m4.06-7.19l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})}),u&&zi("button",{class:"btn-xs rounded-none text-error",onClick:()=>l(),children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"})})}),zi("div",{class:"flex-grow"}),zi("button",{class:"download btn-xs rounded-none",onClick:async function(){const e=i.ci;if(null!==e){c(!0);try{const t=await e.persist(!1);t&&Fi("bundle.jsdos",t)}finally{c(!1)}}},children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 13.5l3 3m0 0l3-3m-3 3v-6m1.06-4.19l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})}),zi("button",{class:"restart btn-xs rounded-none",onClick:async function(){const e=i.ci;if(null!==e&&window.confirm(t("fs_restart"))){c(!0);try{const t=await e.persist(!1);t&&async function(e,t,n){await Di("bundle.jsdos",Promise.resolve(e),null,null,n),n.dispatch(Jr.actions.frameConf())}(t,0,r)}finally{c(!1)}}},children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21 7.5V18M15 7.5V18M3 16.811V8.69c0-.864.933-1.406 1.683-.977l7.108 4.061a1.125 1.125 0 010 1.954l-7.108 4.061A1.125 1.125 0 013 16.811z"})})})]})}function Wi(e,t){return null!==e.nodes&&null!==t.nodes?t.name.localeCompare(e.name):null===e.nodes?1:-1}function qi(){return zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4 mr-2",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})}function Xi(){return zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4 mr-2",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})}function Gi(e){if(!e)return 0;let t=0;for(const n of e)null!==n.fsNode.size?t+=n.fsNode.size:t+=Gi(n.children);return t}function $i(e){const t=le(null);return ae((()=>{null!==t&&null!==t.current&&(t.current.indeterminate=e.intermediate)}),[t,e.intermediate]),zi("div",{className:e.class+" form-control option",onClick:function(){e.onChange&&e.onChange(!(!0===e.checked))},children:zi("label",{className:"label cursor-pointer",children:[zi("span",{className:"label-text mr-6",children:e.label}),zi("input",{ref:t,checked:!0===e.checked,type:"checkbox",className:"toggle "+(e.checked?" toggle-primary ":"")+e.toggleClass,disabled:!0===e.disabled})]})})}function Yi(){const e=Wr(),t=eo(),n=on((e=>e.ui.editor));return zi($i,{class:"mt-4",label:e("editor"),checked:n,onChange:e=>t(Jr.actions.setEditor(e))})}function Ji(){const e=Wr(),t=eo(),n=on((e=>e.dos.mouseCapture));return zi($i,{class:"mt-4",label:e("mouse_lock"),checked:n,onChange:e=>t(ki.actions.mouseCapture(e))})}function Qi(){const e=Wr(),t=eo(),n=on((e=>!e.dos.noCursor));return zi($i,{class:"mt-4",label:e("system_cursor"),checked:n,onChange:e=>t(ki.actions.noCursor(!e))})}function Zi(){const e=Wr(),t=eo(),n=on((e=>e.dos.mobileControls));return zi($i,{class:"mt-4",label:e("mobile_controls"),checked:n,onChange:e=>t(ki.actions.mobileControls(e))})}function es(){const e=Wr(),t=eo(),n=on((e=>e.dos.mirroredControls));return zi($i,{class:"mt-4",label:e("mirrored_controls"),checked:n,onChange:e=>t(ki.actions.mirroredControls(e))})}function ts(){const e=Wr(),t=eo(),n=on((e=>e.dos.paused)),o="run"!==on((e=>e.ui.window));return zi($i,{class:"mt-4",label:e("pause"),checked:n,disabled:o,onChange:e=>t(ki.actions.paused(e))})}function ns(){const e=Wr(),t=eo(),n=on((e=>e.dos.worker)),o=on((e=>e.dos.backendHardware)),r="run"===on((e=>e.ui.window)),i=hi();return o&&i.options.backendHardware?null:zi($i,{class:"mt-4",label:e("worker"),checked:n,disabled:r,onChange:e=>t(ki.actions.dosWorker(e))})}function os(){const e=eo();return zi($i,{class:"mt-4",label:"JSPI",checked:on((e=>e.dos.jspi)),onChange:t=>e(ki.actions.dosJspi(t))})}function rs(){const e=Wr(),t=eo(),n=on((e=>e.dos.offscreenCanvas));return zi($i,{class:"mt-4",label:e("offscreen_canvas"),checked:n,onChange:e=>t(ki.actions.offscreenCanvas(e))})}function is(){const e=eo();return zi($i,{class:"mt-4",label:"IPX Server",checked:on((e=>e.dos.startIpxServer)),onChange:t=>e(ki.actions.startIpxServer(t))})}function ss(){const e=Wr(),t=eo(),n=on((e=>e.dos.backendHardware));return hi().options.backendHardware?zi($i,{class:"mt-4",label:e("hardware"),checked:n,onChange:e=>t(ki.actions.dosBackendHardware(e))}):null}function as(e){const t=Wr(),n=!0===e.multiline;return zi("div",{class:e.class+" option flex "+(n?"flex-col":"flex-row items-center"),children:[zi("div",{class:n?"mb-2":"mr-4",children:e.label}),zi("div",{class:"flex-grow",children:zi("select",{class:e.selectClass?e.selectClass:n?"w-full":"w-28",onChange:function(t){void 0!==e.onSelect&&e.onSelect(t.currentTarget.value)},disabled:!0===e.disabled,children:e.values.map((n=>zi("option",{selected:n===e.selected,value:n,children:t(n)})))})})]})}function cs(e){const t=on((e=>e.dos.backendLocked));return zi(hs,{multiline:e.multiline,label:"emulation_backend",values:[..._i],disabled:t,selector:e=>e.dos.backend,dispatch:e=>($r.setItem("backend",e),ki.actions.dosBackend(e))})}function ls(e){const t="run"===on((e=>e.ui.window));return zi(hs,{multiline:e.multiline,label:"render_backend",values:[...yi],disabled:t,selector:e=>e.dos.renderBackend,dispatch:e=>ki.actions.renderBackend(e)})}function us(e){return zi(hs,{label:"render_aspect",multiline:e.multiline,values:[...gi],selector:e=>e.dos.renderAspect,dispatch:e=>ki.actions.renderAspect(e)})}function ds(e){return zi(hs,{label:"Sockdrive Preload",multiline:e.multiline,values:[...wi],selector:e=>e.dos.sockdrivePreload,dispatch:e=>ki.actions.sockdrivePreload(e)})}function ps(e){return zi(hs,{label:"image_rendering",multiline:e.multiline,values:[...xi],selector:e=>e.dos.imageRendering,dispatch:e=>ki.actions.imageRendering(e)})}function fs(e){return zi(hs,{class:e.class,label:"theme",values:[...Yr],selector:e=>e.ui.theme,dispatch:e=>Jr.actions.theme(e),multiline:e.multiline})}function hs(e){const t=Wr(),n=on(e.selector),o=eo();return zi(as,{class:"mt-4 "+e.class,selectClass:e.selectClass,disabled:e.disabled,multiline:e.multiline,label:t(e.label),selected:n,values:e.values,onSelect:function(t){o(e.dispatch(t))}})}function vs(e){const t=le(null),n=le(null),o=e.vertical??!1,r=e.bgClass??"bg-base-200";ae((()=>{if(null===(null==t?void 0:t.current))return;const n=t.current;let r=!1;function i(t){const r=n.getBoundingClientRect(),i=o?1-Math.min(1,Math.max(0,(t.clientY-r.top)/r.height)):Math.min(1,Math.max(0,(t.clientX-r.left)/r.width));e.onChange(i)}function s(e){r=!0,i(e)}function a(e){r&&i(e)}function c(e){r=!1}return n.addEventListener("pointerdown",s),n.addEventListener("pointermove",a),n.addEventListener("pointerup",c),n.addEventListener("pointercancel",c),n.addEventListener("pointerleave",c),()=>{n.removeEventListener("pointerdown",s),n.removeEventListener("pointermove",a),n.removeEventListener("pointerup",c),n.removeEventListener("pointercancel",c),n.removeEventListener("pointerleave",c)}}),[t,o]);const i=o?"":"rounded-full",s=o?"items-start":"items-center",a=Math.min(Math.max(0,100*e.value),100),c=o?"flex-col":"flex-row",l=o?"h-full":"w-full",u=o?"w-4":"h-16",d=o?"w-2":"h-2",p=o?{active:{bottom:0,height:"calc("+a+"% + 12px)"},point:{left:"-8px",bottom:"calc("+a+"% - 12px)"}}:{active:{left:0,width:a+"%"},point:{left:"calc("+a+"% - 12px)"}};return zi("div",{class:e.class+" slider option "+l,children:[e.label&&zi("div",{class:"label w-full flex justify-between gap-2 "+c,children:[zi("p",{children:e.label}),zi("p",{children:e.value.toFixed(2)})]}),zi("div",{class:"touch "+u+" "+l+" "+c+" "+s,ref:t,children:[zi("div",{class:"bg "+d+" "+l+" "+r+" "+i}),zi("div",{class:"bg-active "+d+" "+i,style:p.active}),zi("div",{class:"point "+e.pointClass,ref:n,style:p.point,children:e.children})]})]})}function ms(e){const t=Wr(),n=on((e=>e.dos.mouseSensitivity)),o=eo();return zi(vs,{class:e.class,label:t("mouse_sensitivity"),value:n,onChange:e=>o(ki.actions.mouseSensitivity(e))})}function _s(e){const t=Wr(),n=on((e=>e.dos.scaleControls)),o=eo();return zi(vs,{class:e.class,label:t("scale_controls"),value:n,onChange:e=>o(ki.actions.scaleControls(e))})}function ys(e){const t=Wr(),n=on((e=>e.dos.volume)),o=eo();return zi(vs,{class:e.class,label:t("volume"),value:n,onChange:e=>o(ki.actions.volume(e))})}const gs=48,bs=290,ws=291,xs=292,ks=293,Cs=294,Ss=295,Ps=296,Es=297,Os=298,Ms=299,js=300,As=301,Ds=320,Ts=321,Ls=322,Is=323,zs=324,Bs=325,Rs=326,Ns=327,Fs=328,Us=329,Ks=256,Hs=258,Vs=259,Ws=257,qs=342,Xs=341,Gs=340,$s=61,Ys=268,Js=266,Qs=261,Zs=269,ea=267,ta=263,na=265,oa=264,ra=262,ia={8:259,9:Hs,13:257,16:Gs,17:Xs,18:qs,19:284,27:256,32:32,33:266,34:267,35:269,36:268,37:263,38:265,39:262,40:264,45:260,46:Qs,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,59:59,64:61,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,93:93,96:320,97:321,98:322,99:323,100:324,101:325,102:326,103:327,104:328,105:329,106:332,111:331,112:290,113:291,114:292,115:293,116:294,117:295,118:296,119:297,120:298,121:299,122:300,123:301,144:282,145:281,173:45,186:59,187:61,188:44,189:45,190:46,191:47,192:96,219:91,220:92,221:93,222:39},sa={KBD_NONE:0,KBD_0:48,KBD_1:49,KBD_2:50,KBD_3:51,KBD_4:52,KBD_5:53,KBD_6:54,KBD_7:55,KBD_8:56,KBD_9:57,KBD_a:65,KBD_b:66,KBD_c:67,KBD_d:68,KBD_e:69,KBD_f:70,KBD_g:71,KBD_h:72,KBD_i:73,KBD_j:74,KBD_k:75,KBD_l:76,KBD_m:77,KBD_n:78,KBD_o:79,KBD_p:80,KBD_q:81,KBD_r:82,KBD_s:83,KBD_t:84,KBD_u:85,KBD_v:86,KBD_w:87,KBD_x:88,KBD_y:89,KBD_z:90,KBD_f1:290,KBD_f2:291,KBD_f3:292,KBD_f4:293,KBD_f5:294,KBD_f6:295,KBD_f7:296,KBD_f8:297,KBD_f9:298,KBD_f10:299,KBD_f11:300,KBD_f12:301,KBD_kp0:320,KBD_kp1:321,KBD_kp2:322,KBD_kp3:323,KBD_kp4:324,KBD_kp5:325,KBD_kp6:326,KBD_kp7:327,KBD_kp8:328,KBD_kp9:329,KBD_kpperiod:330,KBD_kpdivide:331,KBD_kpmultiply:332,KBD_kpminus:333,KBD_kpplus:334,KBD_kpenter:335,KBD_esc:256,KBD_tab:Hs,KBD_backspace:259,KBD_enter:257,KBD_space:32,KBD_leftalt:qs,KBD_rightalt:346,KBD_leftctrl:Xs,KBD_rightctrl:345,KBD_leftshift:Gs,KBD_rightshift:344,KBD_capslock:280,KBD_scrolllock:281,KBD_numlock:282,KBD_grave:96,KBD_minus:45,KBD_equals:61,KBD_backslash:92,KBD_leftbracket:91,KBD_rightbracket:93,KBD_semicolon:59,KBD_quote:39,KBD_period:46,KBD_comma:44,KBD_slash:47,KBD_printscreen:283,KBD_pause:284,KBD_insert:260,KBD_home:268,KBD_pageup:266,KBD_delete:Qs,KBD_end:269,KBD_pagedown:267,KBD_left:263,KBD_up:265,KBD_down:264,KBD_right:262,KBD_extra_lt_gt:348},aa={16:{1:Gs,2:344},17:{1:Xs,2:345},18:{1:qs,2:346}};function ca(e,t){var n;return(null==(n=aa[e])?void 0:n[t])??ia[e]??0}function la(e){return zi("div",{class:"settings-frame frame-root items-start pl-4",children:[zi(ts,{}),zi(Qi,{}),zi(Ji,{}),zi(Zi,{}),zi(es,{}),zi(ms,{class:"mt-4"}),zi(_s,{}),zi(ys,{}),zi(ua,{}),zi(us,{multiline:!0}),zi(ps,{multiline:!0}),zi(fs,{multiline:!0})]})}function ua(){const e=Wr(),t=hi();return zi("div",{class:"flex flex-col gap-2",children:[zi("label",{children:e("special_keys")}),zi("div",{class:"join",children:[zi("button",{class:"btn btn-sm btn-ghost join-item",onClick:()=>{var e;null==(e=t.ci)||e.simulateKeyPress(qs,Hs)},children:"Alt + Tab"}),zi("button",{class:"btn btn-sm btn-ghost join-item",onClick:()=>{var e;null==(e=t.ci)||e.simulateKeyPress(Xs,qs,Qs)},children:"Ctrl + Alt + Del"})]})]})}function da(){var e;const t=hi(),n=on((e=>e.dos.backend)),o=on((e=>e.dos.backendHardware))&&t.options.backendHardware,r=on((e=>e.dos.emuVersion)),i=on((e=>e.dos.ciStartedAt)),s=on((e=>e.dos.stats)),a=on((e=>e.dos.stats.cpuMetrics)),c=on((e=>e.dos.startIpxServer)),l=on((e=>e.dos.jspi)),u=eo(),d=Wr();return zi("div",{class:"stats-frame frame-root items-start px-4",children:[zi("div",{class:"text-center mb-2 text-xs",children:["js-dos/emu: ","8.4.0","/",r]}),zi("div",{class:"w-full overflow-x-auto",children:zi("table",{class:"table table-compact w-full",children:[zi("thead",{children:zi("tr",{children:[zi("th",{children:"Metric"}),zi("th",{children:"Value"})]})}),zi("tbody",{children:[zi("tr",{children:[zi("td",{children:"Emulation"}),zi("td",{children:n+" "+(o?"(WS)":"(WA)")+(l?" +JSPI":"")})]}),zi("tr",{children:[zi("td",{children:"Offscreen Canvas"}),zi("td",{children:s.offscreenCanvas?"Yes":"No"})]}),zi("tr",{children:[zi("td",{children:"Glide GL (3D)"}),zi("td",{children:s.glfx?"Yes":"No"})]}),zi("tr",{children:[zi("td",{children:"Uptime"}),zi("td",{children:[Math.round((Date.now()-i)/100)/10," s"]})]}),zi("tr",{children:[zi("td",{children:"Cycles"}),zi("td",{children:(null==a?void 0:a.cpuMax)??"???"})]}),zi("tr",{children:[zi("td",{children:"NonSkipSleep COUNT/s"}),zi("td",{children:s.nonSkippableSleepPreSec})]}),zi("tr",{children:[zi("td",{children:"Sleep COUNT/s"}),zi("td",{children:s.sleepPerSec})]}),zi("tr",{children:[zi("td",{children:"Sleep TIME/s"}),zi("td",{children:s.sleepTimePerSec})]}),zi("tr",{children:[zi("td",{children:"Msg FRAME/s"}),zi("td",{children:s.framePerSec})]}),zi("tr",{children:[zi("td",{children:"Msg SOUND/s"}),zi("td",{children:s.soundPerSec})]}),zi("tr",{children:[zi("td",{children:"Msg SENT/s"}),zi("td",{children:s.msgSentPerSec})]}),zi("tr",{children:[zi("td",{children:"Msg RECV/s"}),zi("td",{children:s.msgRecvPerSec})]}),zi("tr",{children:[zi("td",{children:"Net Id"}),zi("td",{children:[c&&zi("div",{class:"flex items-center gap-2 justify-between",children:[(null==(e=t.net)?void 0:e.peerId)??"-",zi("button",{class:"btn btn-sm btn-ghost btn-square",onClick:()=>{var e;navigator.clipboard.writeText(((null==(e=t.net)?void 0:e.peerId)??"-").toString()),u(Jr.actions.showToast({message:d("copied"),intent:"success"}))},children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-4",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75"})})})]}),!c&&zi("p",{children:"-"})]})]}),zi("tr",{children:[zi("td",{children:"Net SENT"}),zi("td",{children:[Math.round(s.netSent/1024*100)/100,"Kb"]})]}),zi("tr",{children:[zi("td",{children:"Net RECV"}),zi("td",{children:[Math.round(s.netRecv/1024*100)/100,"Kb"]})]}),s.driveIo.map(((e,t)=>zi(g,{children:[zi("tr",{children:[zi("td",{children:["HDD ",0==t?"C:":"D:"]}),zi("td",{children:[e.url.substring(e.url.lastIndexOf("/")+1)," -",Math.round(100*e.read/e.total),"%"]})]}),zi("tr",{children:[zi("td",{children:"Size"}),zi("td",{children:[Math.round(e.total/1024/1024)," Mb ",zi("br",{}),Math.round(e.write/1024)," Kb"]})]})]})))]})]})})]})}const pa=document.createElement("input");function fa(e){const t=()=>{pa.removeEventListener("change",t),e(pa)};pa.addEventListener("change",t),pa.click()}async function ha(e,t,n,o=!1,r=null){var i,s,a;const c=t.ci,l=null==(i=t.loadedBundle)?void 0:i.bundleChangesUrl;if(null===c&&null===r||!l||!e.ui.canSave)return!1;const u=function(e){return t=>e.i18n.keys[t]??t}(e);try{n(Jr.actions.showToast({message:u("saving_game"),intent:"none",long:!0}));let e=!0,i=!1;return null===r&&(i=!(null===(r=await c.persist(!0))||80===r[0]&&75===r[1]||o)),null!==r&&(i&&n(Jr.actions.showToast({message:u("sockdrive_save_in_the_middle"),intent:"warning",long:!0})),(null==(s=t.options.fsChanges)?void 0:s.push)?(await t.options.fsChanges.push(l,r),e=!1):!1!==(null==(a=t.options.fsChanges)?void 0:a.local)&&await async function(e,t){return ai(e,t,await ri(["saves"]))}(l,r)),null===r?n(Jr.actions.showToast({message:u("no_changes_to_save"),intent:"warning",long:!0})):e?setTimeout((()=>{n(Jr.actions.showToast({message:u("warn_save_locally"),intent:"success",long:!0}))}),i?3e3:4):n(Jr.actions.showToast({message:u("success_save"),intent:"success",long:!0})),!0}catch(d){return n(Jr.actions.showToast({message:u("unable_to_save"),intent:"error",long:!0})),console.error(d),!1}}function va(e,t,n){return e[n]=255&t,e[n+1]=(65280&t)>>8,e[n+2]=(16711680&t)>>16,e[n+3]=(4278190080&t)>>24,n+4}function ma(e,t){return 255&e[t]|e[t+1]<<8&65280|e[t+2]<<16&16711680|e[t+3]<<24&4278190080}function _a(e){e.sendBackendEvent({type:"wc-trigger-event",event:"hand_savestate"})}function ya(e){e.sendBackendEvent({type:"wc-trigger-event",event:"hand_loadstate"})}function ga(){const e=on((e=>e.dos.emuVersion));return zi("div",{class:"pre-run-window",children:[zi(xa,{}),zi(wa,{}),zi("span",{class:"mt-4 bottom-3 text-ellipsis overflow-hidden text-sm text-neutral-content/50",children:["js-","8.4.0","/emu-",e.substring(0,e.indexOf(" "))]})]})}function ba(){var e,t,n;const o=Wr(),r=hi(),[i,s]=ie(!1),a=null==(e=r.loadedBundle)?void 0:e.bundleUrl,c=null==(t=r.loadedBundle)?void 0:t.bundleChangesUrl,l=(null==(n=r.loadedBundle)?void 0:n.bundleChanges)??null,u=null!==l,d=Qn(),p=eo();if(null===a||null===c)return null;if(i)return zi("span",{class:"loading loading-spinner loading-md"});const f=zi("svg",{xmlns:"http://www.w3.org/2000/svg",style:"padding: 2px",viewBox:"0 0 16 16","enable-background":"new 0 0 16 16",fill:"currentColor",class:"w-4 h-4 ",children:zi("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.71,2.29l-2-2C13.53,0.11,13.28,0,13,0h-1v6H4V0H1C0.45,0,0,0.45,0,1v14 c0,0.55,0.45,1,1,1h14c0.55,0,1-0.45,1-1V3C16,2.72,15.89,2.47,15.71,2.29z M14,15H2V9c0-0.55,0.45-1,1-1h10c0.55,0,1,0.45,1,1V15 z M11,1H9v4h2V1z"})});if(u)return zi("div",{class:"flex flex-row items-baseline gap-1",children:[zi("p",{class:"text-accent",children:o("changes_loaded")}),zi("button",{class:"btn btn-ghost btn-xs text-accent underline self-center",onClick:()=>{Fi("changes.bin",l,"application/octet-stream")},children:[f,o("download")]}),zi("button",{class:"btn btn-ghost btn-xs underline -ml-2",onClick:()=>{window.confirm(o("delete_changes_confirm"))&&(s(!0),async function(e){const t=await ri(["saves"]),n=ui(e);try{await t.removeEntry(n,{recursive:!1})}catch{}}(c).then((async()=>{var e;(null==(e=r.options.fsChanges)?void 0:e.delete)&&c&&await r.options.fsChanges.delete(c),await Ai(a,d)})).catch((e=>{console.error(e),p(Jr.actions.showToast({message:o("error_deleting_changes"),intent:"error"}))})).finally((()=>s(!1))))},children:o("delete")})]});async function h(e){try{if(null===e.files||0===e.files.length)return;const t=e.files[0];await ha(d.getState(),r,p,!1,new Uint8Array(await t.arrayBuffer())),await Ai(a,d)}catch(t){console.error(t),p(Jr.actions.showToast({message:o("error_uploading_changes"),intent:"error"}))}finally{s(!1)}}return zi("div",{class:"flex flex-row items-baseline gap-1",children:[o("no_changes_loaded"),zi("button",{class:"btn btn-ghost btn-xs text-accent underline self-center",onClick:()=>{s(!0),fa(h)},children:[f,o("upload")]})]})}function wa(){var e,t;const n=hi(),o=null==(e=n.loadedBundle)?void 0:e.bundleUrl,r=null==(t=n.loadedBundle)?void 0:t.bundleChangesUrl;return on((e=>e.ui.kiosk))||null===o||null===r?null:zi("div",{class:"bg-base-200/80 mx-4 my-5 px-8 pt-4 pb-6 flex flex-col gap-2 items-center rounded-xl",children:zi("div",{class:"mt-4 flex flex-col items-center gap-2",children:zi(ba,{})})})}function xa(e){const t=on((e=>e.editor.configChanged)),n=on((e=>e.editor.bundleConfig)),o=on((e=>"none"!==e.ui.frame)),r=on((e=>e.ui.countDownStart)),i=on((e=>e.ui.autoStart)),s=on((e=>e.ui.editor)),[a,c]=ie(r),[l,u]=ie(i),d=hi(),p=eo(),f=Wr(),h=l&&!o&&!s;async function v(){var e;if(t){const t=n,r=null==(e=d.loadedBundle)?void 0:e.bundle;if(null===r||null===t||!ArrayBuffer.isView(r))throw new Error("Unexpected behaviour (internal state is broken), bundle is null");try{d.loadedBundle.bundle=await emulators.bundleUpdateConfig(r,t),p(ki.actions.bndPlay({}))}catch(o){p(ki.actions.bndError(o.message??"unexpected error"))}}else p(ki.actions.bndPlay({}))}return ae((()=>{if(r>0&&a>0&&h){const e=setTimeout((()=>{c(a-1)}),1e3);return()=>clearInterval(e)}0===a&&r>0&&h&&p(ki.actions.bndPlay({}))}),[a,r,h]),ae((()=>{u(i)}),[i]),!0===e.button?zi("div",{class:"btn btn-accent w-full sm:hidden",onClick:v,children:[zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-6 h-6",children:[zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.91 11.672a.375.375 0 010 .656l-5.603 3.113a.375.375 0 01-.557-.328V8.887c0-.286.307-.466.557-.327l5.603 3.112z"})]}),f("play")]}):zi("div",{class:e.class+" relative cursor-pointer w-1/4 h-1/4 min-w-48 min-h-48 max-w-96 max-h-96",children:[zi("div",{class:"relative",children:[zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-full h-full play-button",onClick:v,children:[zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.91 11.672a.375.375 0 010 .656l-5.603 3.113a.375.375 0 01-.557-.328V8.887c0-.286.307-.466.557-.327l5.603 3.112z"})]}),r>0&&h&&zi("div",{class:"absolute top-0 right-0 translate-x-1/2 w-12 h-12 opacity-90 cursor-pointer flex items-center justify-center text-2xl font-bold bg-primary text-primary-content rounded-full animate-pulse cound-down-start",onClick:()=>u(!1),children:[zi("div",{children:a}),zi("div",{children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-12",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})})]})]}),zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-10 h-10 absolute right-0 bottom-0 cursor-pointer"+(o?" sidebar-highlight":""),onClick:e=>{p(o?Jr.actions.frameNone():Jr.actions.framePreRun()),e.stopPropagation()},children:[zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"}),zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})]})}function ka(e){return zi("div",{class:"prerun-frame frame-root items-start pl-4",children:[zi(xa,{button:!0}),zi(Qi,{}),zi(Ji,{}),zi(Zi,{}),zi(es,{}),zi(ms,{class:"mt-4"}),zi(_s,{}),zi(ys,{}),zi(cs,{multiline:!0}),zi(ns,{}),zi(os,{}),zi(rs,{}),zi("div",{class:"h-4"}),zi(is,{}),zi(Ca,{}),zi("div",{class:"h-4"}),zi(ls,{multiline:!0}),zi(us,{multiline:!0}),zi(ss,{}),zi(Yi,{}),zi(ds,{multiline:!0}),zi(fs,{multiline:!0})]})}function Ca(){const e=eo(),t=on((e=>e.dos.connectIpxAddress));return zi("div",{class:"flex flex-col mt-4 gap-2",children:[zi("div",{children:"IPX Address"}),zi("input",{type:"text",class:"input input-bordered",value:t??"",onChange:t=>e(ki.actions.connectIpxAddress(t.target.value))})]})}pa.type="file";const Sa=50,Pa=250;function Ea(){const e=eo(),[t,n]=ie(null),o=on((e=>e.dos.stats.cpuMetrics)),r=on((e=>e.dos.fastForward)),i=on((e=>e.dos.frameSkip)),s=on((e=>e.dos.cpuAuto)),a=on((e=>e.dos.cycles)),c=on((e=>e.dos.speed));if(ae((()=>{o&&n(o)}),[o]),!t)return null;const l=t.ratio.reduce(((e,t)=>e+t),0)/t.ratio.length,u=t.newCmax.reduce(((e,t)=>e+t),0)/t.newCmax.length,d=t.ticksDone.reduce(((e,t)=>e+t),0)/t.ticksDone.length,p=t.ticksScheduled.reduce(((e,t)=>e+t),0)/t.ticksScheduled.length,f=d/p,h=!(s&&t.cpuAuto);return zi("div",{class:"turbo-frame frame-root items-start px-4",children:zi("div",{class:"flex flex-col gap-4 w-full text-sm",children:[t.emulatorSpeed>0&&zi("div",{class:"flex flex-col gap-2 mb-8",children:[zi("p",{children:"Speed"}),zi("input",{type:"range",min:Sa,max:Pa,value:c,step:5,class:"range range-sm "+(h?"opacity-20":""),onChange:t=>e(ki.actions.speed(Number(t.target.value))),disabled:h}),zi("div",{class:"flex justify-between px-2.5 mt-2 text-xs",children:[zi("span",{children:"|"}),zi("span",{children:"|"}),zi("span",{children:"|"}),zi("span",{children:"|"}),zi("span",{children:"|"})]}),zi("div",{class:"flex justify-between px-2.5 mt-2 text-xs",children:[zi("span",{children:[Sa,"%"]}),zi("span",{children:[Math.round(100),"%"]}),zi("span",{children:[Math.round(150),"%"]}),zi("span",{children:[Math.round(200),"%"]}),zi("span",{children:[Pa,"%"]})]})]}),!s&&zi("div",{class:"flex flex-row gap-2 items-center justify-between",children:[zi("p",{children:"Cycles"}),zi("input",{type:"text",class:"input input-sm",value:a,onChange:t=>e(ki.actions.cycles(t.target.value))})]}),zi("div",{class:"grid2",children:[zi("div",{class:"value",children:[zi("p",{children:"Speed"}),zi("p",{children:[t.emulatorSpeed>0?Math.round(100*t.emulatorSpeed):"100","%"]})]}),zi("div",{class:"value",children:[zi("p",{children:"Fast Forward"}),zi("input",{type:"radio",class:"radio radio-sm "+(t.fastForward?"radio-accent":""),checked:r,onClick:()=>e(ki.actions.fastForward(!r))})]}),zi("div",{class:"value",children:[zi("p",{children:"Frame Skip"}),zi("input",{type:"radio",class:"radio radio-sm "+(t.frameSkip>0?"radio-accent":""),checked:i>0,onClick:()=>e(ki.actions.frameSkip(i>0?0:2))})]}),zi("div",{class:"value",children:[zi("p",{children:"Auto Adjust"}),zi("input",{type:"radio",class:"radio radio-sm "+(t.cpuAuto?"radio-accent":""),checked:s,disabled:!1,onClick:()=>{e(ki.actions.cpuAuto(!s)),s&&(e(ki.actions.speed(100)),e(ki.actions.cycles(a)))}})]})]}),zi("div",{class:"grid2",children:[zi("div",{class:"value",children:[zi("p",{children:"Cycles"}),zi("p",{children:Math.round(t.cpuMax)})]}),zi("div",{class:"value",children:[zi("p",{children:"CPU Load"}),zi("p",{children:[Math.round(100*f),"%"]})]})]}),zi("div",{class:"grid2",children:[zi("div",{class:"value",children:[zi("p",{children:"Sockdrive"}),zi("input",{type:"radio",class:"radio radio-sm "+(t.cpuSockdrive?"radio-error":""),checked:t.cpuSockdrive,disabled:!0})]}),zi("div",{class:"value",children:[zi("p",{children:"Auto skip"}),zi("input",{type:"radio",class:"radio radio-sm "+(t.cpuSkip?"radio-accent":""),checked:t.cpuSkip,disabled:!0})]}),zi("div",{}),zi("div",{class:"value",children:[zi("p",{children:"CPU Used"}),zi("p",{children:[Math.round(100*t.cpuUsed),"%"]})]})]}),zi("div",{class:"grid2",children:[zi("div",{class:"value",children:[zi("p",{children:"Ratio"}),zi("p",{children:l.toFixed(2)})]}),zi("div",{class:"value",children:[zi("p",{children:"Cmax"}),zi("p",{children:Math.round(u)})]}),zi("div",{class:"value",children:[zi("p",{children:"Scheduled"}),zi("p",{children:Math.round(p)})]}),zi("div",{class:"value",children:[zi("p",{children:"Done"}),zi("p",{children:Math.round(d)})]})]}),zi("p",{class:"text-sm",children:"Sleep pattern"}),zi("div",{class:"rounded-box bg-base-200 p-4 w-full h-24",children:zi("p",{class:"text-micro overflow-y-hidden",children:t.sleepPattern.substring(0,256)})})]})})}function Oa(e){const t=on((e=>e.ui.frame)),n=on((e=>e.ui.frameXs)),o=on((e=>e.ui.wideScreen));return"none"===t?null:zi("div",{class:"frame "+(n?" frame-xs ":"")+(n||o?"":" frame-md"),children:["settings"===t&&zi(la,{}),"editor-conf"===t&&zi(Bi,{}),"editor-fs"===t&&zi(Ui,{}),"stats"===t&&zi(da,{}),"prerun"===t&&zi(ka,{}),"turbo"===t&&zi(Ea,{})]})}function Ma(e,t){(async()=>{const n=t.getState().ui.softFullscreen,o=fi(t),r=o.root;e?n?r.classList.add("jsdos-fullscreen-workaround"):r.requestFullscreen?await r.requestFullscreen():r.webkitRequestFullscreen?await r.webkitRequestFullscreen():r.mozRequestFullScreen?await r.mozRequestFullScreen():r.msRequestFullscreen?await r.msRequestFullscreen():r.webkitEnterFullscreen?await r.webkitEnterFullscreen():r.classList.add("jsdos-fullscreen-workaround"):r.classList.contains("jsdos-fullscreen-workaround")?r.classList.remove("jsdos-fullscreen-workaround"):document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen&&document.msExitFullscreen(),t.dispatch(Jr.actions.setFullScreen(e)),vi(o,"fullscreen-change",e)})().catch((e=>{console.error("Can't enter fullscreen",e)}))}function ja(e){const t=on((e=>e.ui.fullScreen)),n=Qn();return zi("div",{class:"fullscreen-button sidebar-button "+e.class,onClick:function(){Ma(!t,n)},children:zi("div",{class:"w-full h-full scale-75 hover:scale-90",children:[!t&&zi("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 16 16",fill:"currentColor",stroke:"none","enable-background":"new 0 0 16 16",children:zi("g",{children:zi("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M5.99,8.99c-0.28,0-0.53,0.11-0.71,0.29l-3.29,3.29v-1.59c0-0.55-0.45-1-1-1 s-1,0.45-1,1v4c0,0.55,0.45,1,1,1h4c0.55,0,1-0.45,1-1s-0.45-1-1-1H3.41L6.7,10.7c0.18-0.18,0.29-0.43,0.29-0.71 C6.99,9.44,6.54,8.99,5.99,8.99z M14.99-0.01h-4c-0.55,0-1,0.45-1,1s0.45,1,1,1h1.59L9.28,5.29C9.1,5.47,8.99,5.72,8.99,5.99 c0,0.55,0.45,1,1,1c0.28,0,0.53-0.11,0.71-0.29l3.29-3.29v1.59c0,0.55,0.45,1,1,1s1-0.45,1-1v-4C15.99,0.44,15.54-0.01,14.99-0.01 z"})})}),t&&zi("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 16 16",fill:"currentColor",stroke:"none","enable-background":"new 0 0 16 16",children:zi("g",{children:zi("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.99,0.99c0-0.55-0.45-1-1-1c-0.28,0-0.53,0.11-0.71,0.29l-3.29,3.29V1.99 c0-0.55-0.45-1-1-1s-1,0.45-1,1v4c0,0.55,0.45,1,1,1h4c0.55,0,1-0.45,1-1s-0.45-1-1-1h-1.59L15.7,1.7 C15.88,1.52,15.99,1.27,15.99,0.99z M5.99,8.99h-4c-0.55,0-1,0.45-1,1s0.45,1,1,1h1.59l-3.29,3.29c-0.18,0.18-0.29,0.43-0.29,0.71 c0,0.55,0.45,1,1,1c0.28,0,0.53-0.11,0.71-0.29l3.29-3.29v1.59c0,0.55,0.45,1,1,1s1-0.45,1-1v-4C6.99,9.44,6.54,8.99,5.99,8.99z"})})})]})})}function Aa(e){return zi(Ba,{class:e.class,frame:"editor-conf",action:Jr.actions.frameConf(),children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-full h-full",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})})}function Da(e){return zi(Ba,{class:e.class,frame:"editor-fs",action:Jr.actions.frameFs(),children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-full h-full",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21.75 17.25v-.228a4.5 4.5 0 00-.12-1.03l-2.268-9.64a3.375 3.375 0 00-3.285-2.602H7.923a3.375 3.375 0 00-3.285 2.602l-2.268 9.64a4.5 4.5 0 00-.12 1.03v.228m19.5 0a3 3 0 01-3 3H5.25a3 3 0 01-3-3m19.5 0a3 3 0 00-3-3H5.25a3 3 0 00-3 3m16.5 0h.008v.008h-.008v-.008zm-3 0h.008v.008h-.008v-.008z"})})})}function Ta(e){const t=on((e=>e.ui.window)),n=on((e=>e.opfs.freeSpace)),o="number"==typeof n?li(n):null;return zi(g,{children:[o&&zi("div",{class:"text-xs flex flex-row gap-0 items-end",children:[zi("span",{class:n<1073741824?"text-error animate-pulse":n<2147483648?"text-warning":"",children:o[0]}),zi("span",{class:"opacity-50",children:o[1]})]}),zi(Ba,{class:e.class+t==="file-explorer"?" sidebar-highlight":"",frame:"editor-fs",action:Jr.actions.toggleFileExplorer(),children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-full h-full",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21.75 17.25v-.228a4.5 4.5 0 00-.12-1.03l-2.268-9.64a3.375 3.375 0 00-3.285-2.602H7.923a3.375 3.375 0 00-3.285 2.602l-2.268 9.64a4.5 4.5 0 00-.12 1.03v.228m19.5 0a3 3 0 01-3 3H5.25a3 3 0 01-3-3m19.5 0a3 3 0 00-3-3H5.25a3 3 0 00-3 3m16.5 0h.008v.008h-.008v-.008zm-3 0h.008v.008h-.008v-.008z"})})})]})}function La(){const e=on((e=>e.dos.stats.cpuMetrics));let t=1;return e&&e.ticksDone.length>0&&(t=e.ticksDone.reduce(((e,t)=>e+t),0)/e.ticksScheduled.reduce(((e,t)=>e+t),0)),zi(Ba,{class:"cycles",frame:"stats",action:Jr.actions.frameStats(),children:zi("span",{children:[Math.round(100*t),"%"]})})}function Ia(e){const t=Qn(),n=le(null),[o]=ie({recv:0,enabled:!1,delayLedTo:0});ae((()=>{if(n.current){const e=n.current;e.classList.add("bg-base-300");const r=setInterval((()=>{if(o.delayLedTo<=Date.now()){const n=mi(t).dos.stats.msgSentPerSec,r=o.recv!==n;r!==o.enabled&&(e.classList.remove("bg-base-300","bg-green-300","animate-led"),r?e.classList.add("bg-green-300","animate-led"):e.classList.add("bg-base-300"),o.enabled=r),o.delayLedTo=r?Date.now()+300+1500*Math.random():0,o.recv=n}}),150);return()=>{e.classList.remove("bg-base-300","bg-green-300","animate-led"),clearInterval(r)}}}),[n,o]);const[r,i]=ie(!1),[s,a]=ie({recv:0,timeoutId:null}),c=on((e=>e.dos.stats.msgRecvPerSec));if(s.recv!==c){r||i(!0),s.timeoutId&&clearTimeout(s.timeoutId);const e=setTimeout((()=>{i(!1),a({recv:c,timeoutId:null})}),1e3);a({recv:c,timeoutId:e})}return zi("div",{ref:n,class:"self-end mr-2 -mt-3 w-2 h-1"})}function za(e){return zi(Ba,{class:e.class,action:Jr.actions.frameSettings(),frame:"settings",children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-full h-full",children:[zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"}),zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})}function Ba(e){const t=on((e=>e.ui.frame))===e.frame,n=eo();return zi("div",{class:"sidebar-button "+(t?"sidebar-highlight ":"")+e.class,onClick:function(){n(t?Jr.actions.frameNone():e.action)},children:e.children})}function Ra(e){const t=on((e=>e.dos.softKeyboard)),n=eo();return zi("div",{class:"sidebar-button "+(t?"sidebar-highlight ":"")+e.class,onClick:()=>n(ki.actions.softKeyboard(!t)),children:zi("svg",{class:"w-full h-full",fill:"currentColor",stroke:"currentColor",version:"1.1",id:"Layer_1",viewBox:"0 0 507.9 507.9",children:[zi("g",{id:"SVGRepo_bgCarrier","stroke-width":"0"}),zi("g",{id:"SVGRepo_tracerCarrier","stroke-linecap":"round","stroke-linejoin":"round"}),zi("g",{id:"SVGRepo_iconCarrier",children:[" ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M465.7,140.75H268.1v-77.3c0-7.8-6.3-14.1-14.1-14.1c-7.8,0-14.1,6.3-14.1,14.1v77.3H42.3c-23.3,0-42.3,19-42.3,42.3 v233.2c0,23.3,19,42.3,42.3,42.3h423.3c23.3,0,42.3-19,42.3-42.3v-233.2C508,159.75,489,140.75,465.7,140.75z M465.7,430.35H42.3 c-7.8,0-14.1-6.3-14.1-14.1v-233.2c0-7.8,6.3-14.1,14.1-14.1h423.3c7.8,0,14.1,6.3,14.1,14.1v233.2h0.1 C479.8,424.05,473.5,430.35,465.7,430.35z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M440.6,194.05h-85.4c-7.8,0-14.1,6.3-14.1,14.1s6.3,14.1,14.1,14.1h85.4c7.8,0,14.1-6.3,14.1-14.1 C454.7,200.35,448.4,194.05,440.6,194.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M80.9,377.05H67.4c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C95,383.35,88.7,377.05,80.9,377.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M303.3,377.05H141.6c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h161.8c7.8,0,14.1-6.3,14.1-14.1 C317.5,383.35,311.1,377.05,303.3,377.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M80.9,255.05H67.4c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C95.1,261.35,88.7,255.05,80.9,255.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M152.8,255.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.4,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C166.9,261.35,160.6,255.05,152.8,255.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M224.8,255.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C238.9,261.35,232.6,255.05,224.8,255.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M296.7,255.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C310.8,261.35,304.5,255.05,296.7,255.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M80.9,194.05H67.4c-7.8,0-14.1,6.3-14.1,14.1s6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C95.1,200.35,88.7,194.05,80.9,194.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M152.8,194.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.4,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C166.9,200.35,160.6,194.05,152.8,194.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M224.8,194.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C238.9,200.35,232.6,194.05,224.8,194.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M296.7,194.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C310.8,200.35,304.5,194.05,296.7,194.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M368.7,255.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C382.8,261.35,376.4,255.05,368.7,255.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M440.6,255.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C454.7,261.35,448.4,255.05,440.6,255.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M368.7,316.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C382.8,322.35,376.4,316.05,368.7,316.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M440.6,316.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C454.7,322.35,448.4,316.05,440.6,316.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M368.7,377.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C382.8,383.35,376.4,377.05,368.7,377.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M440.6,377.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C454.7,383.35,448.4,377.05,440.6,377.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M80.9,316.05H67.4c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C95.1,322.35,88.7,316.05,80.9,316.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M152.8,316.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.4,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C166.9,322.35,160.6,316.05,152.8,316.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M224.8,316.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C238.9,322.35,232.6,316.05,224.8,316.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M296.7,316.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C310.8,322.35,304.5,316.05,296.7,316.05z"})," "]})," "]})," "]})]})})}function Na(e){return zi(Ba,{class:e.class,frame:"prerun",action:Jr.actions.framePreRun(),children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-full h-full",children:[zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"}),zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})}function Fa(){const e="turbo"===on((e=>e.ui.frame)),t=on((e=>e.dos.cpuAuto)),n=on((e=>e.dos.speed)),o=on((e=>e.dos.fastForward)),r=on((e=>e.dos.frameSkip)),i=!1===t||100!==n||o||r>0,s=eo();return zi("div",{class:"sidebar-button turbo flex flex-col items-center justify-center "+(e?"sidebar-highlight ":"")+(i?" used":""),onClick:()=>s(e?Jr.actions.frameNone():Jr.actions.frameTurbo()),children:zi("p",{class:"font-mono text-micro mt-1",children:"TURBO"})})}function Ua(e){return zi("svg",{xmlns:"http://www.w3.org/2000/svg",style:"padding: 2px",viewBox:"0 0 16 16","enable-background":"new 0 0 16 16",fill:"currentColor",class:"w-full h-full rounded-lg "+e.class,children:zi("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.71,2.29l-2-2C13.53,0.11,13.28,0,13,0h-1v6H4V0H1C0.45,0,0,0.45,0,1v14 c0,0.55,0.45,1,1,1h14c0.55,0,1-0.45,1-1V3C16,2.72,15.89,2.47,15.71,2.29z M14,15H2V9c0-0.55,0.45-1,1-1h10c0.55,0,1,0.45,1,1V15 z M11,1H9v4h2V1z"})})}function Ka(){const e=on((e=>e.ui.haveQuickSave)),t="dosboxX"===on((e=>e.dos.backend));return zi("div",{class:"save-buttons flex flex-col justify-center items-center -my-2",children:[zi(Wa,{}),t&&zi(Ha,{label:"X",bgcolor:"bg-primary",textcolor:"text-primary-content"}),t&&e&&zi(Va,{label:"X",bgcolor:"bg-primary"})]})}function Ha(e){const t=hi(),n=eo();return zi("div",{class:"sidebar-button flex justify-center",onClick:function(){const e=t.ci;null!==e&&(_a(e),n(Jr.actions.setHaveQuickSave(!0)))},children:[zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"absolute left-0 bottom-0 w-6 h-6 opacity-30",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"})}),zi("p",{class:"absolute top-0 right-0 font-bold",children:"F6"})]})}function Va(e){const t=hi();return zi("div",{class:"sidebar-button flex justify-center",onClick:function(){const e=t.ci;null!==e&&ya(e)},children:[zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"absolute left-0 bottom-0 w-6 h-6 -scale-y-100 opacity-30",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m15 15 6-6m0 0-6-6m6 6H9a6 6 0 0 0 0 12h3"})}),zi("p",{class:"absolute top-0 right-0 font-bold",children:"F7"})]})}function Wa(e){const[t,n]=ie(!1),o=eo(),r=on((e=>e.ui.canSave)),i=hi(),s=Qn();if(!r||null===i.loadedBundle||null===i.loadedBundle.bundleChangesUrl)return null;return zi("div",{class:"save-button sidebar-button overflow-hidden "+(t?" sidebar-highlight ":"")+e.class,onClick:function(){t||(n(!0),ha(mi(s),i,o).finally((()=>n(!1))))},children:zi("div",{class:"w-full h-full flex justify-center",children:[zi(Ua,{}),t&&zi("div",{class:"sidebar-badge"})]})})}function qa(e){const t=on((e=>e.ui.window)),n=on((e=>e.ui.editor)),o=on((e=>e.ui.kiosk)),r="none"!==on((e=>e.ui.frame)),i=on((e=>e.dos.mouseCapture)),s=on((e=>e.ui.thinSidebar)),a=eo();return o?"run"===t&&i?zi(Xa,{class:"h-full"}):null:zi("div",s?{class:"sidebar-thin",children:[zi("div",{class:"cursor-pointer hover:bg-base-100 w-full h-full flex flex-col items-center justify-center gap-1",onClick:()=>{a(Jr.actions.thinSidebar(!1))},children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"})})}),!r&&"run"===t&&i&&zi(Xa,{})]}:{class:"sidebar",children:["run"===t&&zi(Ka,{}),"run"===t&&zi(Ra,{}),n&&"prerun"===t&&zi(Aa,{}),n&&"run"===t&&zi(Da,{}),zi("div",{class:"contentbar"}),"run"===t&&zi(ja,{}),"run"===t&&zi(Fa,{}),"run"===t&&zi(La,{}),"run"===t&&zi(Ia,{}),("prerun"===t||"file-explorer"===t)&&zi(Ta,{}),("prerun"===t||"select"===t||"file-explorer"===t)&&zi(Na,{}),"run"===t&&zi(za,{}),!r&&"run"===t&&i&&zi(Xa,{})]})}function Xa(e){const t=on((e=>e.dos.mouseSensitivity)),n=eo();return zi("div",{class:"sidebar-slider "+e.class,children:zi(vs,{bgClass:"bg-base-300",vertical:!0,label:"",value:t,onChange:e=>{n(ki.actions.mouseSensitivity(e))},children:zi("svg",{class:"w-6 h-6",viewBox:"0 0 24 24",stroke:"currentColor",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:zi("path",{d:"M12 9V7M12 21C8.68629 21 6 18.3137 6 15V9C6 5.68629 8.68629 3 12 3C15.3137 3 18 5.68629 18 9V15C18 18.3137 15.3137 21 12 21Z","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})})})})}function Ga(e,t,n,o){const r=e.parentElement.getBoundingClientRect(),i=r.width,s=r.height;if(0===n)return;const a=65535===o?i/s:o??t/n;let c=i,l=i/a;l>s&&(l=s,c=s*a),e.style.position="relative",e.style.top=(s-l)/2+"px",e.style.left=(i-c)/2+"px",e.style.width=c+"px",e.style.height=l+"px"}function $a(e,t,n,o){const r=n.gl??e.getContext("webgl");if(null===r)throw new Error("Unable to create webgl context on given canvas");n.gl=r;const i=function(e,t,n){const o=Ya(e,e.VERTEX_SHADER,t),r=Ya(e,e.FRAGMENT_SHADER,n),i=e.createProgram();if(e.attachShader(i,o),e.attachShader(i,r),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))throw new Error("Unable to initialize the shader program: "+e.getProgramInfoLog(i));return i}(r,"\nattribute vec4 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nvarying highp vec2 vTextureCoord;\n\nvoid main(void) {\n gl_Position = aVertexPosition;\n vTextureCoord = aTextureCoord;\n}\n","\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\n\nvoid main(void) {\n highp vec4 color = texture2D(uSampler, vTextureCoord);\n gl_FragColor = vec4(color.r, color.g, color.b, 1.0);\n}\n"),s=r.getAttribLocation(i,"aVertexPosition"),a=r.getAttribLocation(i,"aTextureCoord"),c=r.getUniformLocation(i,"uSampler");!function(e,t,n){const o=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,o);const r=[-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0];e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW),e.vertexAttribPointer(t,3,e.FLOAT,!1,0,0),e.enableVertexAttribArray(t);const i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i);const s=[0,1,1,1,1,0,0,1,1,0,0,0];e.bufferData(e.ARRAY_BUFFER,new Float32Array(s),e.STATIC_DRAW),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(n)}(r,s,a);const l=r.createTexture();r.bindTexture(r.TEXTURE_2D,l),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR);const u=new Uint8Array([0,0,0]);r.texImage2D(r.TEXTURE_2D,0,r.RGB,1,1,0,r.RGB,r.UNSIGNED_BYTE,u),r.useProgram(i),r.activeTexture(r.TEXTURE0),r.uniform1i(c,0);let d=0,p=0,f=null,h=null,v=0;const m=()=>{null!==h&&(r.texImage2D(r.TEXTURE_2D,0,v,d,p,0,v,r.UNSIGNED_BYTE,h),h=null),r.drawArrays(r.TRIANGLES,0,6),f=null},_=()=>{Ga(e,d,p,o)},y=(t,n)=>{d=t,p=n,e.width=d,e.height=p,h=null,r.viewport(0,0,d,p),_()};t.events().onFrameSize(y),t.events().onFrame(((e,t)=>{h=null!=e?e:t,v=null!=e?r.RGB:r.RGBA,null===f&&(f=requestAnimationFrame(m))})),y(t.width(),t.height());const g=new ResizeObserver(_);return g.observe(e.parentElement),window.addEventListener("resize",_),()=>{n.gl=null,t.events().onFrameSize((()=>{})),t.events().onFrame((()=>{})),g.disconnect(),window.removeEventListener("resize",_)}}function Ya(e,t,n){const o=e.createShader(t);if(e.shaderSource(o,n),e.compileShader(o),!e.getShaderParameter(o,e.COMPILE_STATUS)){const t=e.getShaderInfoLog(o);throw e.deleteShader(o),new Error("An error occurred compiling the shaders: "+t)}return o}function Ja(e,t,n){const o=e.getContext("2d");if(null===o)throw new Error("Unable to create 2d context on given canvas");let r=0,i=0;const s=()=>{Ga(e,r,i,n)};let a=new Uint8ClampedArray(0);const c=(t,n)=>{r=t,i=n,e.width=r,e.height=i,a=new Uint8ClampedArray(t*n*4),s()};t.events().onFrameSize(c),t.events().onFrame(((e,t)=>{if(null===e&&null===t)return;const n=null!==e?e:t;let s=0,c=0;for(;c<a.length;)a[c++]=n[s++],a[c++]=n[s++],a[c++]=n[s++],a[c++]=255,n.length===a.length&&s++;o.putImageData(new ImageData(a,r,i),0,0)})),c(t.width(),t.height());const l=new ResizeObserver(s);return l.observe(e.parentElement),window.addEventListener("resize",s),()=>{t.events().onFrameSize((()=>{})),t.events().onFrame((()=>{})),l.disconnect(),window.removeEventListener("resize",s)}}class Qa{constructor(){t(this,"samplesQueue",[])}push(e){this.samplesQueue.push(e)}length(){let e=0;for(const t of this.samplesQueue)e+=t.length;return e}writeTo(e,t){let n=0;for(;this.samplesQueue.length>0;){const o=this.samplesQueue[0],r=Math.min(t-n,o.length);if(r===o.length?(e.set(o,n),this.samplesQueue.shift()):(e.set(o.slice(0,r),n),this.samplesQueue[0]=o.slice(r)),n+=r,n===t)break}n<t&&e.fill(0,n)}}const Za=/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion)||/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.userAgent)||/MacIntel/.test(navigator.platform)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2;const ec={};function tc(e,t,n,o){const r=function(e){if(e.type.match(/^touch/)){const n=e,o=t.getBoundingClientRect();return{id:"touch-"+n.targetTouches[0].identifier,x:n.targetTouches[0].clientX-o.x,y:n.targetTouches[0].clientY-o.y,mX:0,mY:0}}if(e.type.match(/^pointer/)){const t=e;return{id:"pointer-"+t.pointerId,x:t.offsetX,y:t.offsetY,mX:t.movementX,mY:t.movementY,button:0===t.button?0:1}}{const t=e;return{id:"mouse",x:t.offsetX,y:t.offsetY,mX:t.movementX,mY:t.movementY,button:0===t.button?0:1}}}(e);return o||(ec[r.id]?(r.mX=r.x-ec[r.id].x,r.mY=r.y-ec[r.id].y):(r.mX=0,r.mY=0)),ec[r.id]={x:r.x,y:r.y},r.mX=oc(r.mX,n),r.mY=oc(r.mY,n),r}const nc=function(){const e=Za&&!!("ontouchstart"in window),t=!!window.PointerEvent,n=!!window.MSPointerEvent;let o=!Za;const r=[],i=[],s=[],a=[],c=[];return t?(r.push("pointerdown"),s.push("pointerup","pointercancel"),i.push("pointermove"),c.push("touchstart","touchmove","touchend")):n?(r.push("MSPointerDown"),i.push("MSPointerMove"),s.push("MSPointerUp")):e?(o=!1,r.push("touchstart","mousedown"),i.push("touchmove"),s.push("touchend","touchcancel","mouseup")):(r.push("mousedown"),i.push("mousemove"),s.push("mouseup"),a.push("mouseleave")),{mobile:Za,canLock:o,starters:r,changers:i,enders:s,prevents:c,leavers:a}}();function oc(e,t){e>50?e=50:e<-50&&(e=-50);return e*=Math.pow(8,2*t-1)}function rc(e,t,n,o,r,i,s){const a=r=>{if(r.target!==e)return;const i=tc(r,e,t,n);o(i.x,i.y,i.button),r.stopPropagation()},c=o=>{if(o.target!==e)return;const i=tc(o,e,t,n);r(i.x,i.y,i.mX,i.mY),o.stopPropagation()},l=o=>{const r=tc(o,e,t,n);i(r.x,r.y,r.button),o.stopPropagation()},u=o=>{if(o.target!==e)return;const r=tc(o,e,t,n);s(r.x,r.y),o.stopPropagation()},d=e=>{e.stopPropagation()},p={capture:!1};for(const f of nc.starters)e.addEventListener(f,a,p);for(const f of nc.changers)e.addEventListener(f,c,p);for(const f of nc.enders)e.addEventListener(f,l,p);for(const f of nc.prevents)e.addEventListener(f,d,p);for(const f of nc.leavers)e.addEventListener(f,u,p);return()=>{for(const t of nc.starters)e.removeEventListener(t,a,p);for(const t of nc.changers)e.removeEventListener(t,c,p);for(const t of nc.enders)e.removeEventListener(t,l,p);for(const t of nc.prevents)e.removeEventListener(t,d,p);for(const t of nc.leavers)e.removeEventListener(t,u,p)}}const ic=.01;function sc(e,t,n){const o=(e,o)=>function(e,t,n,o){const{width:r,height:i}=n.getBoundingClientRect(),s=o.width(),a=o.height(),c=s/a;let l=r,u=r/c;u>i&&(u=i,l=i*c);const d=(i-u)/2,p=(r-l)/2;let f=Math.max(0,Math.min(1,(e-p)/l)),h=Math.max(0,Math.min(1,(t-d)/u));f<=ic&&(f=0);f>=.99&&(f=1);h<=ic&&(h=0);h>=.99&&(h=1);return{x:f,y:h}}(e,o,t,n);return document.pointerLockElement===t&&document.exitPointerLock(),rc(t,0,!1,(function(t,r,i){const s=o(t,r);n.sendMouseMotion(s.x,s.y),n.sendMouseButton(i??e,!0)}),(function(e,t,r,i){const s=o(e,t);n.sendMouseMotion(s.x,s.y)}),(function(t,r,i){const s=o(t,r);n.sendMouseMotion(s.x,s.y),n.sendMouseButton(i??e,!1)}),(function(e,t){const r=o(e,t);n.sendMouseMotion(r.x,r.y)}))}function ac(e,t,n,o,r){let i=-1,s=0,a=0,c=0;return rc(o,e,t,((e,t,n)=>{i=Date.now(),s=0,a=e,c=t,void 0!==n&&r.sendMouseButton(n,!0)}),(function(e,t,n,o){void 0===n&&(n=e-a),void 0===o&&(o=t-c),a=e,c=t,0===n&&0===o||(s+=Math.abs(n)+Math.abs(o),r.sendMouseRelativeMotion(n,o))}),((e,t,o)=>{if(void 0!==o)r.sendMouseButton(o,!1);else{if(Date.now()-i<500&&s<50){const e=o??n;r.sendMouseButton(e,!0),setTimeout((()=>r.sendMouseButton(e,!1)),60)}}}),(()=>{}))}function cc(e,t,n,o,r){if(e&&!nc.canLock)return ac(t,!1,n,o,r);if(e){const e=function(e){async function t(){if(document.pointerLockElement===e);else try{await e.requestPointerLock({unadjustedMovement:!0})}catch(t){console.warn("Failed to request pointer lock with unadjusted movement, falling back to default"),await e.requestPointerLock()}}const n={capture:!0};for(const o of nc.starters)e.addEventListener(o,t,n);return()=>{for(const o of nc.starters)e.removeEventListener(o,t,n)}}(o),i=ac(t,!0,n,o,r);return()=>{i(),e()}}return sc(n,o,r)}function lc(e,t){const n=document.createElement("div");return n.className=e,void 0!==t&&(n.innerHTML=t),n}class uc{constructor(e,n,o,r){t(this,"options"),t(this,"root"),t(this,"canvas"),t(this,"mouseOverlay"),t(this,"width"),t(this,"height"),t(this,"keyboardVisible",!1),t(this,"pointerLock",!1),t(this,"pointerDisabled",!1),t(this,"pointerButton",0),t(this,"toggleKeyboard"),t(this,"onResize"),t(this,"onKeyDown"),t(this,"onKeyUp"),t(this,"onKeyPress"),t(this,"onKeysPress"),this.toggleKeyboard=o,this.options=r,this.root=e,this.root.classList.add("emulator-root"),this.canvas=n,this.canvas.className="emulator-canvas",this.mouseOverlay=lc("emulator-mouse-overlay",""),this.root.appendChild(this.mouseOverlay),this.width=e.offsetWidth,this.height=e.offsetHeight,this.onResize=[],this.onKeyDown=()=>{},this.onKeyUp=()=>{},this.onKeyPress=()=>{},this.onKeysPress=()=>{},new ResizeObserver((t=>{for(const n of t)if(n.target===e){this.width=n.contentRect.width,this.height=n.contentRect.height;for(const e of this.onResize)e(this.width,this.height)}})).observe(this.root)}addOnResize(e){this.onResize.push(e)}removeOnResize(e){this.onResize=this.onResize.filter((t=>t!==e))}setOnKeyDown(e){this.onKeyDown=e}fireKeyDown(e){this.onKeyDown(e)}setOnKeyUp(e){this.onKeyUp=e}fireKeyUp(e){this.onKeyUp(e)}setOnKeyPress(e){this.onKeyPress=e}fireKeyPress(e){this.onKeyPress(e)}setOnKeysPress(e){this.onKeysPress=e}fireKeysPress(e){this.onKeysPress(e)}}function dc(e){return void 0!==e.layersConfig?(1===e.layersConfig.version&&function(e){for(const t of e.layers)for(const e of t.controls)if("Key"===e.type){const t=e;"number"==typeof t.mapTo&&(t.mapTo=[t.mapTo])}}(e.layersConfig),e.layersConfig):void 0!==e.layers?e.layers:null}const pc=function(){const e={};for(const t of Object.keys(sa))e[sa[t]]=t.substr(4,2);return e}();function fc(e,t,n){const o=Math.round(.6*n),r=Math.round(.5*n),i=Math.max(1,Math.round(n/20)),s=wc[e.toLowerCase()],a=void 0===s?e:"",c=hc("emulator-button-touch-zone"),l=hc("emulator-button"),u=hc("emulator-button-text",void 0===s?void 0===a||0===a.length?"□":a.substr(0,1).toUpperCase():"");void 0!==s&&(l.style.backgroundImage='url("'+s+'")'),l.style.width=o+"px",l.style.height=o+"px",u.style.fontSize=r+"px",c.widthPx=n-2*i,c.heightPx=n-2*i,c.style.width=c.widthPx+"px",c.style.height=c.heightPx+"px",c.style.borderWidth=i+"px",c.appendChild(l),c.appendChild(u);const d=e=>{void 0!==t.onDown&&t.onDown(),void 0!==t.onClick&&t.onClick(),e.stopPropagation(),e.preventDefault()},p=e=>{void 0!==t.onUp&&t.onUp(),e.stopPropagation(),e.preventDefault()},f=e=>{e.stopPropagation(),e.preventDefault()},h={capture:!0};for(const v of nc.starters)c.addEventListener(v,d,h);for(const v of nc.enders)c.addEventListener(v,p,h);for(const v of nc.changers)c.addEventListener(v,f,h);for(const v of nc.leavers)c.addEventListener(v,f,h);for(const v of nc.prevents)c.addEventListener(v,f,h);return c}function hc(e,t){const n=document.createElement("div");return n.className=e,void 0!==t&&(n.innerHTML=t),n}function vc(e){return"number"==typeof e?pc[e]:e}function mc(e,t){return"click"===e.action?{onClick:()=>t.fireKeyPress(e.mapTo)}:{onDown:()=>t.fireKeyDown(e.mapTo),onUp:()=>t.fireKeyUp(e.mapTo)}}const _c="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg version='1.1' id='Layer_1' xmlns:sketch='http://www.bohemiancoding.com/sketch/ns' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 20 20' fill='%23FFF' enable-background='new 0 0 20 20' xml:space='preserve'%3E%3Ctitle%3EShape%3C/title%3E%3Cdesc%3ECreated with Sketch.%3C/desc%3E%3Cg id='Page-1' sketch:type='MSPage'%3E%3Cg id='Artboard-1' transform='translate(-3.000000, -1.000000)' sketch:type='MSArtboardGroup'%3E%3Cpath id='Shape' sketch:type='MSShapeGroup' d='M19,12c-0.3,0-0.5,0.1-0.7,0.3L14,16.6V3c0-0.5-0.4-1-1-1s-1,0.5-1,1v13.6 l-4.3-4.3C7.5,12.1,7.3,12,7,12c-0.5,0-1,0.4-1,1c0,0.3,0.1,0.5,0.3,0.7l6,6c0.2,0.2,0.4,0.3,0.7,0.3s0.5-0.1,0.7-0.3l6-6 c0.2-0.2,0.3-0.4,0.3-0.7C20,12.4,19.5,12,19,12L19,12z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E",yc="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 20 20' enable-background='new 0 0 20 20' fill='%23FFF' xml:space='preserve'%3E%3Cg id='left_arrow_1_'%3E%3Cg%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18,9H4.41l4.29-4.29C8.89,4.53,9,4.28,9,4c0-0.55-0.45-1-1-1 C7.72,3,7.47,3.11,7.29,3.29l-6,6C1.11,9.47,1,9.72,1,10c0,0.28,0.11,0.53,0.29,0.71l6,6C7.47,16.89,7.72,17,8,17 c0.55,0,1-0.45,1-1c0-0.28-0.11-0.53-0.29-0.71L4.41,11H18c0.55,0,1-0.45,1-1C19,9.45,18.55,9,18,9z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E",gc="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' fill='%23fff' viewBox='0 0 20 20' enable-background='new 0 0 20 20' xml:space='preserve'%3E%3Cg id='right_arrow_1_'%3E%3Cg%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.71,9.29l-6-6C12.53,3.11,12.28,3,12,3c-0.55,0-1,0.45-1,1 c0,0.28,0.11,0.53,0.29,0.71L15.59,9H2c-0.55,0-1,0.45-1,1c0,0.55,0.45,1,1,1h13.59l-4.29,4.29C11.11,15.47,11,15.72,11,16 c0,0.55,0.45,1,1,1c0.28,0,0.53-0.11,0.71-0.29l6-6C18.89,10.53,19,10.28,19,10C19,9.72,18.89,9.47,18.71,9.29z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E",bc="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' fill='%23fff' viewBox='0 0 20 20' enable-background='new 0 0 20 20' xml:space='preserve'%3E%3Cg id='key_enter_1_'%3E%3Cg%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18,2c-0.55,0-1,0.45-1,1v5c0,2.21-1.79,4-4,4H4.41l2.29-2.29 C6.89,9.53,7,9.28,7,9c0-0.55-0.45-1-1-1C5.72,8,5.47,8.11,5.29,8.29l-4,4C1.11,12.47,1,12.72,1,13c0,0.28,0.11,0.53,0.29,0.71 l4,4C5.47,17.89,5.72,18,6,18c0.55,0,1-0.45,1-1c0-0.28-0.11-0.53-0.29-0.71L4.41,14H13c3.31,0,6-2.69,6-6V3C19,2.45,18.55,2,18,2 z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E",wc={fullscreen:"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 16 16' enable-background='new 0 0 16 16' xml:space='preserve'%3E%3Cg id='maximize_1_' fill='%23FFFFFF'%3E%3Cg%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M5.99,8.99c-0.28,0-0.53,0.11-0.71,0.29l-3.29,3.29v-1.59c0-0.55-0.45-1-1-1 s-1,0.45-1,1v4c0,0.55,0.45,1,1,1h4c0.55,0,1-0.45,1-1s-0.45-1-1-1H3.41L6.7,10.7c0.18-0.18,0.29-0.43,0.29-0.71 C6.99,9.44,6.54,8.99,5.99,8.99z M14.99-0.01h-4c-0.55,0-1,0.45-1,1s0.45,1,1,1h1.59L9.28,5.29C9.1,5.47,8.99,5.72,8.99,5.99 c0,0.55,0.45,1,1,1c0.28,0,0.53-0.11,0.71-0.29l3.29-3.29v1.59c0,0.55,0.45,1,1,1s1-0.45,1-1v-4C15.99,0.44,15.54-0.01,14.99-0.01 z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E",save:"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 18.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 16 16' enable-background='new 0 0 16 16' fill='%23FFFFFF' xml:space='preserve'%3E%3Cg id='floppy_disk'%3E%3Cg%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M15.71,2.29l-2-2C13.53,0.11,13.28,0,13,0h-1v6H4V0H1C0.45,0,0,0.45,0,1v14 c0,0.55,0.45,1,1,1h14c0.55,0,1-0.45,1-1V3C16,2.72,15.89,2.47,15.71,2.29z M14,15H2V9c0-0.55,0.45-1,1-1h10c0.55,0,1,0.45,1,1V15 z M11,1H9v4h2V1z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A",options:"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 20 20' enable-background='new 0 0 20 20' fill='%23FFF' xml:space='preserve'%3E%3Cg id='cog_2_'%3E%3Cg%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M19,8h-2.31c-0.14-0.46-0.33-0.89-0.56-1.3l1.7-1.7c0.39-0.39,0.39-1.02,0-1.41 l-1.41-1.41c-0.39-0.39-1.02-0.39-1.41,0l-1.7,1.7c-0.41-0.22-0.84-0.41-1.3-0.55V1c0-0.55-0.45-1-1-1H9C8.45,0,8,0.45,8,1v2.33 C7.52,3.47,7.06,3.67,6.63,3.91L5,2.28c-0.37-0.37-0.98-0.37-1.36,0L2.28,3.64C1.91,4.02,1.91,4.63,2.28,5l1.62,1.62 C3.66,7.06,3.46,7.51,3.31,8H1C0.45,8,0,8.45,0,9v2c0,0.55,0.45,1,1,1h2.31c0.14,0.46,0.33,0.89,0.56,1.3L2.17,15 c-0.39,0.39-0.39,1.02,0,1.41l1.41,1.41c0.39,0.39,1.02,0.39,1.41,0l1.7-1.7c0.41,0.22,0.84,0.41,1.3,0.55V19c0,0.55,0.45,1,1,1h2 c0.55,0,1-0.45,1-1v-2.33c0.48-0.14,0.94-0.35,1.37-0.59L15,17.72c0.37,0.37,0.98,0.37,1.36,0l1.36-1.36 c0.37-0.37,0.37-0.98,0-1.36l-1.62-1.62c0.24-0.43,0.45-0.89,0.6-1.38H19c0.55,0,1-0.45,1-1V9C20,8.45,19.55,8,19,8z M10,14 c-2.21,0-4-1.79-4-4c0-2.21,1.79-4,4-4s4,1.79,4,4C14,12.21,12.21,14,10,14z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E",keyboard:"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 16 16' enable-background='new 0 0 16 16' xml:space='preserve'%3E%3Cg id='manually_entered_data_2_'%3E%3Cg%3E%3Cpath fill='%23FFFFFF' fill-rule='evenodd' clip-rule='evenodd' d='M1,8h3.76l2-2H1C0.45,6,0,6.45,0,7C0,7.55,0.45,8,1,8z M15.49,3.99 C15.8,3.67,16,3.23,16,2.75C16,1.78,15.22,1,14.25,1c-0.48,0-0.92,0.2-1.24,0.51l-1.44,1.44l2.47,2.47L15.49,3.99z M1,4h7.76l2-2 H1C0.45,2,0,2.45,0,3C0,3.55,0.45,4,1,4z M1,10c-0.55,0-1,0.45-1,1c0,0.48,0.35,0.86,0.8,0.96L2.76,10H1z M10.95,3.57l-6.69,6.69 l2.47,2.47l6.69-6.69L10.95,3.57z M15.2,6.04L13.24,8H15c0.55,0,1-0.45,1-1C16,6.52,15.65,6.14,15.2,6.04z M2,15l3.86-1.39 l-2.46-2.44L2,15z M15,10h-3.76l-2,2H15c0.55,0,1-0.45,1-1C16,10.45,15.55,10,15,10z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E",up:"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg version='1.1' id='Layer_1' xmlns:sketch='http://www.bohemiancoding.com/sketch/ns' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 20 20' fill='%23FFF' enable-background='new 0 0 20 20' xml:space='preserve'%3E%3Ctitle%3EShape%3C/title%3E%3Cdesc%3ECreated with Sketch.%3C/desc%3E%3Cg id='Page-1' sketch:type='MSPage'%3E%3Cg id='Artboard-1' transform='translate(-3.000000, -1.000000)' sketch:type='MSArtboardGroup'%3E%3Cpath id='Shape' sketch:type='MSShapeGroup' d='M19.7,8.3l-6-6C13.5,2.1,13.3,2,13,2s-0.5,0.1-0.7,0.3l-6,6C6.1,8.5,6,8.7,6,9 c0,0.6,0.5,1,1,1c0.3,0,0.5-0.1,0.7-0.3L12,5.4V19c0,0.5,0.4,1,1,1s1-0.5,1-1V5.4l4.3,4.3C18.5,9.9,18.7,10,19,10c0.5,0,1-0.4,1-1 C20,8.7,19.9,8.5,19.7,8.3L19.7,8.3z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E",down:_c,do:_c,dw:_c,dwn:_c,left:yc,le:yc,lft:yc,right:gc,ri:gc,rght:gc,rgh:gc,enter:bc,en:bc,enr:bc,ent:bc,entr:bc};function xc(e,t){const n=e.mouseOverlay,o=(n,o)=>function(e,t,n,o){const r=n.width(),i=n.height(),s=o.width,a=o.height,c=r/i;let l=s,u=s/c;u>a&&(u=a,l=a*c);const d=(a-u)/2,p=(s-l)/2;let f=Math.max(0,Math.min(1,(e-p)/l)),h=Math.max(0,Math.min(1,(t-d)/u));f<=kc&&(f=0);f>=1-kc&&(f=1);h<=kc&&(h=0);h>=1-kc&&(h=1);return{x:f,y:h}}(n,o,t,e);return document.pointerLockElement===n&&document.exitPointerLock(),Cc(n,e,0,!1,(function(e,n,r){const i=o(e,n);t.sendMouseMotion(i.x,i.y),t.sendMouseButton(r,!0)}),(function(e,n,r,i){const s=o(e,n);t.sendMouseMotion(s.x,s.y)}),(function(e,n,r){const i=o(e,n);t.sendMouseMotion(i.x,i.y),t.sendMouseButton(r,!1)}),(function(e,n){const r=o(e,n);t.sendMouseMotion(r.x,r.y)}))}const kc=.01;function Cc(e,t,n,o,r,i,s,a){let c=0;const l=i=>{if(i.target!==e)return;if(t.pointerDisabled)return void i.stopPropagation();const s=tc(i,e,n,o);c=(Za&&0===s.button?t.pointerButton:s.button)??0,r(s.x,s.y,c),i.stopPropagation()},u=r=>{if(r.target!==e)return;if(t.pointerDisabled)return void r.stopPropagation();const s=tc(r,e,n,o);i(s.x,s.y,s.mX,s.mY),r.stopPropagation()},d=r=>{if(t.pointerDisabled)return void r.stopPropagation();const i=tc(r,e,n,o);s(i.x,i.y,c),r.stopPropagation()},p=r=>{if(r.target!==e)return;if(t.pointerDisabled)return void r.stopPropagation();const i=tc(r,e,n,o);a(i.x,i.y),r.stopPropagation()},f=e=>{e.stopPropagation()},h={capture:!1};for(const v of nc.starters)e.addEventListener(v,l,h);for(const v of nc.changers)e.addEventListener(v,u,h);for(const v of nc.enders)e.addEventListener(v,d,h);for(const v of nc.prevents)e.addEventListener(v,f,h);for(const v of nc.leavers)e.addEventListener(v,p,h);return()=>{for(const t of nc.starters)e.removeEventListener(t,l,h);for(const t of nc.changers)e.removeEventListener(t,u,h);for(const t of nc.enders)e.removeEventListener(t,d,h);for(const t of nc.prevents)e.removeEventListener(t,f,h);for(const t of nc.leavers)e.removeEventListener(t,p,h)}}function Sc(e,t,n,o){return e&&!nc.canLock?function(e,t,n){const o=t.mouseOverlay;let r=-1,i=0;return Cc(o,t,e,!1,((e,t)=>{r=Date.now(),i=0}),(function(e,t,o,r){0===o&&0===r||(i+=Math.abs(o)+Math.abs(r),n.sendMouseRelativeMotion(o,r))}),((e,o)=>{if(Date.now()-r<500&&i<50){const e=t.pointerButton||0;n.sendMouseButton(e,!0),setTimeout((()=>n.sendMouseButton(e,!1)),60)}}),(()=>{}))}(t,n,o):e?function(e,t,n){const o=t.mouseOverlay;function r(){return document.pointerLockElement!==o}return Cc(o,t,e,!0,(async function(e,t,i){if(r())try{await o.requestPointerLock({unadjustedMovement:!0})}catch(s){console.warn("Failed to request pointer lock with unadjusted movement, falling back to default"),await o.requestPointerLock()}else n.sendMouseButton(i,!0)}),(function(e,t,o,i){r()||0===o&&0===i||n.sendMouseRelativeMotion(o,i)}),(function(e,t,o){r()||n.sendMouseButton(o,!1)}),(function(e,t){}))}(t,n,o):xc(n,o)}const Pc=(e,t)=>{const n=t.x-e.x,o=t.y-e.y;return Math.sqrt(n*n+o*o)},Ec=e=>e*(Math.PI/180),Oc=e=>e*(180/Math.PI),Mc=new Map,jc=e=>{Mc.has(e)&&clearTimeout(Mc.get(e)),Mc.set(e,setTimeout(e,100))},Ac=(e,t,n)=>{const o=t.split(/[ ,]+/g);let r;for(let i=0;i<o.length;i+=1)r=o[i],e.addEventListener?e.addEventListener(r,n,!1):e.attachEvent&&e.attachEvent(r,n)},Dc=(e,t,n)=>{const o=t.split(/[ ,]+/g);let r;for(let i=0;i<o.length;i+=1)r=o[i],e.removeEventListener?e.removeEventListener(r,n):e.detachEvent&&e.detachEvent(r,n)},Tc=e=>(e.preventDefault(),e.type.match(/^touch/)?e.changedTouches:e),Lc=()=>({x:void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}),Ic=(e,t)=>{t.top||t.right||t.bottom||t.left?(e.style.top=t.top,e.style.right=t.right,e.style.bottom=t.bottom,e.style.left=t.left):(e.style.left=t.x+"px",e.style.top=t.y+"px")},zc=(e,t,n)=>{const o=Bc(e);for(let r in o)if(o.hasOwnProperty(r))if("string"==typeof t)o[r]=t+" "+n;else{let e="";for(let o=0,r=t.length;o<r;o+=1)e+=t[o]+" "+n+", ";o[r]=e.slice(0,-2)}return o},Bc=e=>{const t={};t[e]="";return["webkit","Moz","o"].forEach((function(n){t[n+e.charAt(0).toUpperCase()+e.slice(1)]=""})),t},Rc=(e,t)=>{for(let n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},Nc=(e,t)=>{if(e.length)for(let n=0,o=e.length;n<o;n+=1)t(e[n]);else t(e)};var Fc,Uc=!!("ontouchstart"in window),Kc=!!window.PointerEvent,Hc=!!window.MSPointerEvent,Vc={start:"mousedown",move:"mousemove",end:"mouseup"},Wc={};function qc(){}function Xc(e,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=e,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:.5,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(t),"dynamic"===this.options.mode&&(this.options.restOpacity=0),this.id=Xc.id,Xc.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}function Gc(e,t){var n=this;n.nipples=[],n.idles=[],n.actives=[],n.ids=[],n.pressureIntervals={},n.manager=e,n.id=Gc.id,Gc.id+=1,n.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:.5,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},n.config(t),"static"!==n.options.mode&&"semi"!==n.options.mode||(n.options.multitouch=!1),n.options.multitouch||(n.options.maxNumberOfNipples=1);const o=getComputedStyle(n.options.zone.parentElement);return o&&"flex"===o.display&&(n.parentIsFlex=!0),n.updateBox(),n.prepareNipples(),n.bindings(),n.begin(),n.nipples}function $c(e){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=Lc(),t.config(e),t.prepareCollections();var n=function(){var e;t.collections.forEach((function(n){n.forEach((function(n){e=n.el.getBoundingClientRect(),n.position={x:t.scroll.x+e.left,y:t.scroll.y+e.top}}))}))};Ac(window,"resize",(function(){jc(n)}));var o=function(){t.scroll=Lc()};return Ac(window,"scroll",(function(){jc(o)})),t.collections}Kc?Fc={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:Hc?Fc={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:Uc?(Fc={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},Wc=Vc):Fc=Vc,qc.prototype.on=function(e,t){var n,o=this,r=e.split(/[ ,]+/g);o._handlers_=o._handlers_||{};for(var i=0;i<r.length;i+=1)n=r[i],o._handlers_[n]=o._handlers_[n]||[],o._handlers_[n].push(t);return o},qc.prototype.off=function(e,t){var n=this;return n._handlers_=n._handlers_||{},void 0===e?n._handlers_={}:void 0===t?n._handlers_[e]=null:n._handlers_[e]&&n._handlers_[e].indexOf(t)>=0&&n._handlers_[e].splice(n._handlers_[e].indexOf(t),1),n},qc.prototype.trigger=function(e,t){var n,o=this,r=e.split(/[ ,]+/g);o._handlers_=o._handlers_||{};for(var i=0;i<r.length;i+=1)n=r[i],o._handlers_[n]&&o._handlers_[n].length&&o._handlers_[n].forEach((function(e){e.call(o,{type:n,target:o},t)}))},qc.prototype.config=function(e){var t=this;t.options=t.defaults||{},e&&(t.options=((e,t)=>{const n={};for(let o in e)e.hasOwnProperty(o)&&t.hasOwnProperty(o)?n[o]=t[o]:e.hasOwnProperty(o)&&(n[o]=e[o]);return n})(t.options,e))},qc.prototype.bindEvt=function(e,t){var n=this;return n._domHandlers_=n._domHandlers_||{},n._domHandlers_[t]=function(){"function"==typeof n["on"+t]?n["on"+t].apply(n,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},Ac(e,Fc[t],n._domHandlers_[t]),Wc[t]&&Ac(e,Wc[t],n._domHandlers_[t]),n},qc.prototype.unbindEvt=function(e,t){var n=this;return n._domHandlers_=n._domHandlers_||{},Dc(e,Fc[t],n._domHandlers_[t]),Wc[t]&&Dc(e,Wc[t],n._domHandlers_[t]),delete n._domHandlers_[t],this},Xc.prototype=new qc,Xc.constructor=Xc,Xc.id=0,Xc.prototype.buildEl=function(e){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},Xc.prototype.stylize=function(){if(this.options.dataOnly)return this;var e=this.options.fadeTime+"ms",t=((e,t)=>{const n=Bc(e);for(let o in n)n.hasOwnProperty(o)&&(n[o]=t);return n})("borderRadius","50%"),n=zc("transition","opacity",e),o={};return o.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},o.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",left:0,marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:this.options.color,opacity:".5"},o.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",left:0,marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:this.options.color,opacity:".5",transform:"translate(0px, 0px)"},Rc(o.el,n),"circle"===this.options.shape&&Rc(o.back,t),Rc(o.front,t),this.applyStyles(o),this},Xc.prototype.applyStyles=function(e){for(var t in this.ui)if(this.ui.hasOwnProperty(t))for(var n in e[t])this.ui[t].style[n]=e[t][n];return this},Xc.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},Xc.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},Xc.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off()},Xc.prototype.show=function(e){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout((function(){t.ui.el.style.opacity=1}),0),t.showTimeout=setTimeout((function(){t.trigger("shown",t.instance),"function"==typeof e&&e.call(this)}),t.options.fadeTime)),t},Xc.prototype.hide=function(e){var t=this;if(t.options.dataOnly)return t;if(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout((function(){var n="dynamic"===t.options.mode?"none":"block";t.ui.el.style.display=n,"function"==typeof e&&e.call(t),t.trigger("hidden",t.instance)}),t.options.fadeTime),t.options.restJoystick){const n=t.options.restJoystick,o={};o.x=!0===n||!1!==n.x?0:t.instance.frontPosition.x,o.y=!0===n||!1!==n.y?0:t.instance.frontPosition.y,t.setPosition(e,o)}return t},Xc.prototype.setPosition=function(e,t){var n=this;n.frontPosition={x:t.x,y:t.y};var o=n.options.fadeTime+"ms",r={};r.front=zc("transition",["transform"],o);var i={front:{}};i.front={transform:"translate("+n.frontPosition.x+"px,"+n.frontPosition.y+"px)"},n.applyStyles(r),n.applyStyles(i),n.restTimeout=setTimeout((function(){"function"==typeof e&&e.call(n),n.restCallback()}),n.options.fadeTime)},Xc.prototype.restCallback=function(){var e=this,t={};t.front=zc("transition","none",""),e.applyStyles(t),e.trigger("rested",e.instance)},Xc.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},Xc.prototype.computeDirection=function(e){var t,n,o,r=e.angle.radian,i=Math.PI/4,s=Math.PI/2;if(r>i&&r<3*i&&!e.lockX?t="up":r>-i&&r<=i&&!e.lockY?t="left":r>3*-i&&r<=-i&&!e.lockX?t="down":e.lockY||(t="right"),e.lockY||(n=r>-s&&r<s?"left":"right"),e.lockX||(o=r>0?"up":"down"),e.force>this.options.threshold){var a,c={};for(a in this.direction)this.direction.hasOwnProperty(a)&&(c[a]=this.direction[a]);var l={};for(a in this.direction={x:n,y:o,angle:t},e.direction=this.direction,c)c[a]===this.direction[a]&&(l[a]=!0);if(l.x&&l.y&&l.angle)return e;l.x&&l.y||this.trigger("plain",e),l.x||this.trigger("plain:"+n,e),l.y||this.trigger("plain:"+o,e),l.angle||this.trigger("dir dir:"+t,e)}else this.resetDirection();return e},Gc.prototype=new qc,Gc.constructor=Gc,Gc.id=0,Gc.prototype.prepareNipples=function(){var e=this,t=e.nipples;t.on=e.on.bind(e),t.off=e.off.bind(e),t.options=e.options,t.destroy=e.destroy.bind(e),t.ids=e.ids,t.id=e.id,t.processOnMove=e.processOnMove.bind(e),t.processOnEnd=e.processOnEnd.bind(e),t.get=function(e){if(void 0===e)return t[0];for(var n=0,o=t.length;n<o;n+=1)if(t[n].identifier===e)return t[n];return!1}},Gc.prototype.bindings=function(){var e=this;e.bindEvt(e.options.zone,"start"),e.options.zone.style.touchAction="none",e.options.zone.style.msTouchAction="none"},Gc.prototype.begin=function(){var e=this,t=e.options;if("static"===t.mode){var n=e.createNipple(t.position,e.manager.getIdentifier());n.add(),e.idles.push(n)}},Gc.prototype.createNipple=function(e,t){var n=this,o=n.manager.scroll,r={},i=n.options,s=n.parentIsFlex?o.x:o.x+n.box.left,a=n.parentIsFlex?o.y:o.y+n.box.top;if(e.x&&e.y)r={x:e.x-s,y:e.y-a};else if(e.top||e.right||e.bottom||e.left){var c=document.createElement("DIV");c.style.display="hidden",c.style.top=e.top,c.style.right=e.right,c.style.bottom=e.bottom,c.style.left=e.left,c.style.position="absolute",i.zone.appendChild(c);var l=c.getBoundingClientRect();i.zone.removeChild(c),r=e,e={x:l.left+o.x,y:l.top+o.y}}var u=new Xc(n,{color:i.color,size:i.size,threshold:i.threshold,fadeTime:i.fadeTime,dataOnly:i.dataOnly,restJoystick:i.restJoystick,restOpacity:i.restOpacity,mode:i.mode,identifier:t,position:e,zone:i.zone,frontPosition:{x:0,y:0},shape:i.shape});return i.dataOnly||(Ic(u.ui.el,r),Ic(u.ui.front,u.frontPosition)),n.nipples.push(u),n.trigger("added "+u.identifier+":added",u),n.manager.trigger("added "+u.identifier+":added",u),n.bindNipple(u),u},Gc.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},Gc.prototype.bindNipple=function(e){var t,n=this,o=function(e,o){t=e.type+" "+o.id+":"+e.type,n.trigger(t,o)};e.on("destroyed",n.onDestroyed.bind(n)),e.on("shown hidden rested dir plain",o),e.on("dir:up dir:right dir:down dir:left",o),e.on("plain:up plain:right plain:down plain:left",o)},Gc.prototype.pressureFn=function(e,t,n){var o=this,r=0;clearInterval(o.pressureIntervals[n]),o.pressureIntervals[n]=setInterval(function(){var n=e.force||e.pressure||e.webkitForce||0;n!==r&&(t.trigger("pressure",n),o.trigger("pressure "+t.identifier+":pressure",n),r=n)}.bind(o),100)},Gc.prototype.onstart=function(e){var t=this,n=t.options,o=e;e=Tc(e),t.updateBox();return Nc(e,(function(r){t.actives.length<n.maxNumberOfNipples?t.processOnStart(r):o.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach((function(n){if(Object.values(o.touches).findIndex((function(e){return e.identifier===n}))<0){var r=[e[0]];r.identifier=n,t.processOnEnd(r)}})),t.actives.length<n.maxNumberOfNipples&&t.processOnStart(r))})),t.manager.bindDocument(),!1},Gc.prototype.processOnStart=function(e){var t,n=this,o=n.options,r=n.manager.getIdentifier(e),i=e.force||e.pressure||e.webkitForce||0,s={x:e.pageX,y:e.pageY},a=n.getOrCreate(r,s);a.identifier!==r&&n.manager.removeIdentifier(a.identifier),a.identifier=r;var c=function(t){t.trigger("start",t),n.trigger("start "+t.id+":start",t),t.show(),i>0&&n.pressureFn(e,t,t.identifier),n.processOnMove(e)};if((t=n.idles.indexOf(a))>=0&&n.idles.splice(t,1),n.actives.push(a),n.ids.push(a.identifier),"semi"!==o.mode)c(a);else{if(!(Pc(s,a.position)<=o.catchDistance))return a.destroy(),void n.processOnStart(e);c(a)}return a},Gc.prototype.getOrCreate=function(e,t){var n,o=this,r=o.options;return/(semi|static)/.test(r.mode)?(n=o.idles[0])?(o.idles.splice(0,1),n):"semi"===r.mode?o.createNipple(t,e):(console.warn("Coudln't find the needed nipple."),!1):n=o.createNipple(t,e)},Gc.prototype.processOnMove=function(e){var t=this,n=t.options,o=t.manager.getIdentifier(e),r=t.nipples.get(o),i=t.manager.scroll;if((e=>isNaN(e.buttons)?0!==e.pressure:0!==e.buttons)(e)){if(!r)return console.error("Found zombie joystick with ID "+o),void t.manager.removeIdentifier(o);if(n.dynamicPage){var s=r.el.getBoundingClientRect();r.position={x:i.x+s.left,y:i.y+s.top}}r.identifier=o;var a=r.options.size/2,c={x:e.pageX,y:e.pageY};n.lockX&&(c.y=r.position.y),n.lockY&&(c.x=r.position.x);var l,u,d=Pc(c,r.position),p=((e,t)=>{const n=t.x-e.x,o=t.y-e.y;return Oc(Math.atan2(o,n))})(c,r.position),f=Ec(p),h=d/a,v={distance:d,position:c};if("circle"===r.options.shape?(l=Math.min(d,a),u=((e,t,n)=>{const o={x:0,y:0};return n=Ec(n),o.x=e.x-t*Math.cos(n),o.y=e.y-t*Math.sin(n),o})(r.position,l,p)):(u=((e,t,n)=>({x:Math.min(Math.max(e.x,t.x-n),t.x+n),y:Math.min(Math.max(e.y,t.y-n),t.y+n)}))(c,r.position,a),l=Pc(u,r.position)),n.follow){if(d>a){let e=c.x-u.x,n=c.y-u.y;r.position.x+=e,r.position.y+=n,r.el.style.top=r.position.y-(t.box.top+i.y)+"px",r.el.style.left=r.position.x-(t.box.left+i.x)+"px",d=Pc(c,r.position)}}else c=u,d=l;var m=c.x-r.position.x,_=c.y-r.position.y;r.frontPosition={x:m,y:_},n.dataOnly||(r.ui.front.style.transform="translate("+m+"px,"+_+"px)");var y={identifier:r.identifier,position:c,force:h,pressure:e.force||e.pressure||e.webkitForce||0,distance:d,angle:{radian:f,degree:p},vector:{x:m/a,y:-_/a},raw:v,instance:r,lockX:n.lockX,lockY:n.lockY};(y=r.computeDirection(y)).angle={radian:Ec(180-p),degree:180-p},r.trigger("move",y),t.trigger("move "+r.id+":move",y)}else this.processOnEnd(e)},Gc.prototype.processOnEnd=function(e){var t=this,n=t.options,o=t.manager.getIdentifier(e),r=t.nipples.get(o),i=t.manager.removeIdentifier(r.identifier);r&&(n.dataOnly||r.hide((function(){"dynamic"===n.mode&&(r.trigger("removed",r),t.trigger("removed "+r.id+":removed",r),t.manager.trigger("removed "+r.id+":removed",r),r.destroy())})),clearInterval(t.pressureIntervals[r.identifier]),r.resetDirection(),r.trigger("end",r),t.trigger("end "+r.id+":end",r),t.ids.indexOf(r.identifier)>=0&&t.ids.splice(t.ids.indexOf(r.identifier),1),t.actives.indexOf(r)>=0&&t.actives.splice(t.actives.indexOf(r),1),/(semi|static)/.test(n.mode)?t.idles.push(r):t.nipples.indexOf(r)>=0&&t.nipples.splice(t.nipples.indexOf(r),1),t.manager.unbindDocument(),/(semi|static)/.test(n.mode)&&(t.manager.ids[i.id]=i.identifier))},Gc.prototype.onDestroyed=function(e,t){var n=this;n.nipples.indexOf(t)>=0&&n.nipples.splice(n.nipples.indexOf(t),1),n.actives.indexOf(t)>=0&&n.actives.splice(n.actives.indexOf(t),1),n.idles.indexOf(t)>=0&&n.idles.splice(n.idles.indexOf(t),1),n.ids.indexOf(t.identifier)>=0&&n.ids.splice(n.ids.indexOf(t.identifier),1),n.manager.removeIdentifier(t.identifier),n.manager.unbindDocument()},Gc.prototype.destroy=function(){var e=this;for(var t in e.unbindEvt(e.options.zone,"start"),e.nipples.forEach((function(e){e.destroy()})),e.pressureIntervals)e.pressureIntervals.hasOwnProperty(t)&&clearInterval(e.pressureIntervals[t]);e.trigger("destroyed",e.nipples),e.manager.unbindDocument(),e.off()},$c.prototype=new qc,$c.constructor=$c,$c.prototype.prepareCollections=function(){var e=this;e.collections.create=e.create.bind(e),e.collections.on=e.on.bind(e),e.collections.off=e.off.bind(e),e.collections.destroy=e.destroy.bind(e),e.collections.get=function(t){var n;return e.collections.every((function(e){return!(n=e.get(t))})),n}},$c.prototype.create=function(e){return this.createCollection(e)},$c.prototype.createCollection=function(e){var t=this,n=new Gc(t,e);return t.bindCollection(n),t.collections.push(n),n},$c.prototype.bindCollection=function(e){var t,n=this,o=function(e,o){t=e.type+" "+o.id+":"+e.type,n.trigger(t,o)};e.on("destroyed",n.onDestroyed.bind(n)),e.on("shown hidden rested dir plain",o),e.on("dir:up dir:right dir:down dir:left",o),e.on("plain:up plain:right plain:down plain:left",o)},$c.prototype.bindDocument=function(){var e=this;e.binded||(e.bindEvt(document,"move").bindEvt(document,"end"),e.binded=!0)},$c.prototype.unbindDocument=function(e){var t=this;Object.keys(t.ids).length&&!0!==e||(t.unbindEvt(document,"move").unbindEvt(document,"end"),t.binded=!1)},$c.prototype.getIdentifier=function(e){var t;return e?void 0===(t=void 0===e.identifier?e.pointerId:e.identifier)&&(t=this.latest||0):t=this.index,void 0===this.ids[t]&&(this.ids[t]=this.index,this.index+=1),this.latest=t,this.ids[t]},$c.prototype.removeIdentifier=function(e){var t={};for(var n in this.ids)if(this.ids[n]===e){t.id=n,t.identifier=this.ids[n],delete this.ids[n];break}return t},$c.prototype.onmove=function(e){return this.onAny("move",e),!1},$c.prototype.onend=function(e){return this.onAny("end",e),!1},$c.prototype.oncancel=function(e){return this.onAny("end",e),!1},$c.prototype.onAny=function(e,t){var n,o=this,r="processOn"+e.charAt(0).toUpperCase()+e.slice(1);t=Tc(t);var i=function(e,t,n){n.ids.indexOf(t)>=0&&(n[r](e),e._found_=!0)};return Nc(t,(function(e){n=o.getIdentifier(e),Nc(o.collections,i.bind(null,e,n)),e._found_||o.removeIdentifier(n)})),!1},$c.prototype.destroy=function(){var e=this;e.unbindDocument(!0),e.ids={},e.index=0,e.collections.forEach((function(e){e.destroy()})),e.off()},$c.prototype.onDestroyed=function(e,t){var n=this;if(n.collections.indexOf(t)<0)return!1;n.collections.splice(n.collections.indexOf(t),1)};const Yc=new $c,Jc=function(e){return Yc.create(e)};function Qc(e,t,n,o,r,i){const s=Math.round(o/4);let a=!1;const c=()=>{const e=a?"flex":"none";for(const t of l)t!=u&&(t.style.display=e)},l=[Zc(t,n),fc("keyboard",{onClick:()=>{e.toggleKeyboard(),a&&(a=!1,c())}},o),fc("options",{onClick:()=>{a=!a,c()}},o)],u=l[l.length-1],d=lc("emulator-options");for(const p of l)p!==u&&p.classList.add("emulator-button-control"),p.style.marginRight=s+"px",p.style.marginBottom=s+"px",p!==u&&(p.style.display="none"),d.appendChild(p);return d.style.position="absolute",d.style.right=i+"px",d.style.top=r+"px",e.mouseOverlay.appendChild(d),()=>{e.mouseOverlay.removeChild(d)}}function Zc(e,t){if(e.length<=1)return document.createElement("div");const n=document.createElement("select");n.classList.add("emulator-control-select");for(const o of e){const e=document.createElement("option");e.value=o,e.innerHTML=o,n.appendChild(e)}return n.onchange=e=>{const n=e.target.value;t(n)},function(e,t=!0){const n=e=>{e.stopPropagation()},o=e=>{e.stopPropagation(),t&&e.preventDefault()},r={capture:!1};for(const i of nc.starters)e.addEventListener(i,n,r);for(const i of nc.enders)e.addEventListener(i,n,r);for(const i of nc.prevents)e.addEventListener(i,o,r)}(n,!1),n}function el(e,t,n){const o=n||{};function r(e){return void 0!==o[e]?o[e]:e}return e.setOnKeyDown((e=>{t.sendKeyEvent(r(e),!0)})),e.setOnKeyUp((e=>{t.sendKeyEvent(r(e),!1)})),e.setOnKeyPress((e=>{t.simulateKeyPress(r(e))})),e.setOnKeysPress((e=>{t.simulateKeyPress(...e)})),()=>{e.setOnKeyDown((e=>{})),e.setOnKeyUp((e=>{})),e.setOnKeyPress((e=>{})),e.setOnKeysPress((e=>{}))}}function tl(e,t,n,o){var r;const i=Object.keys(n),s={keyboard:()=>{},mouse:()=>{},gestures:()=>{},buttons:()=>{}},a=r=>{s.keyboard(),s.mouse(),s.gestures(),s.buttons(),s.keyboard=()=>{},s.mouse=()=>{},s.gestures=()=>{},s.buttons=()=>{};const i=n[r];void 0!==i&&(s.keyboard=el(t,o,i.mapper),void 0!==i.gestures&&i.gestures.length>0?s.gestures=function(e,t,n){const o=Jc({zone:e.mouseOverlay,multitouch:!0,maxNumberOfNipples:2});let r=-1;const i=()=>{-1!==r&&(e.fireKeyUp(r),r=-1)},s={},a={},c={};for(const u of n)"end:release"===u.event?s[u.joystickId]=!0:0!==u.mapTo&&("tap"===u.event?a[u.joystickId]=u.mapTo:o.on(u.event,(()=>{var t;c[u.joystickId]=Date.now(),i(),t=u.mapTo,e.fireKeyDown(t),r=t})));const l={};return o.on("start",(()=>{const e=o.ids.length-1;l[e]=Date.now()})),o.on("end",(()=>{const t=o.ids.length-1,n=Date.now()-l[t];!0===s[t]&&i(),a[t]&&n<500&&c[t]<l[t]&&e.fireKeyPress(a[t])})),()=>o.destroy()}(t,0,i.gestures):s.mouse=Sc(e.autolock,e.sensitivity,t,o),void 0!==i.buttons&&i.buttons.length&&(s.buttons=function(e,t,n,o){const r=Math.round(o/4),i=[];for(const s of n){if(0===s.mapTo)continue;const t=fc((s.symbol||vc(s.mapTo)).toUpperCase(),mc(s,e),o);t.style.position="absolute";const n=s.style;if(n)for(const e of Object.keys(n))t.style[e]=n[e];if(void 0!==s.position){const e=s.position.left,n=s.position.top,i=s.position.bottom,a=s.position.right;void 0!==e&&(t.style.left=r*e+o*(e-1)+"px"),void 0!==a&&(t.style.right=r*a+o*(a-1)+"px"),void 0!==n&&(t.style.top=r*n+o*(n-1)+"px"),void 0!==i&&(t.style.bottom=r*i+o*(i-1)+"px")}e.mouseOverlay.appendChild(t),i.push(t)}return()=>{for(const t of i)t.parentElement===e.mouseOverlay&&e.mouseOverlay.removeChild(t)}}(t,0,i.buttons,54)))},c=0===(null==(r=t.options.optionControls)?void 0:r.length)?()=>{}:Qc(t,i,a,54,13.5,0);return a("default"),()=>{s.gestures(),s.buttons(),s.mouse(),s.keyboard(),c()}}function nl(e){switch(e){case"square":return function(){class e{constructor(){t(this,"aspect",.625)}getConfiguration(e,t,n=1){const o=this.getCols(),r=this.getRows(),i=Math.floor(o/2),s=Math.floor(r/2),a=5*e/100/2,c=a,l=(e-2*a)/o*n,u=(t-2*c)/r*n,d=Math.min(l,u),p=[];for(let f=0;f<r;++f){const n=[];for(let l=0;l<o;++l)n.push({centerX:l<i?a+d*(l+.5):e-a-d*(o-l-1+.5),centerY:f<s?c+d*(f+.5):t-c-d*(r-f-1+.5)});p.push(n)}return{gridType:"square",cells:p,columnWidth:d,rowHeight:d,columnsPadding:a,rowsPadding:c,width:e,height:t}}getCols(){return 10}getRows(){return Math.floor(this.getCols()*this.aspect)+1}}return new e}();case"honeycomb":return function(){class e{constructor(){t(this,"aspect",.625)}getConfiguration(e,t,n=1){const o=this.getCols(),r=this.getRows(),i=Math.floor(o/2),s=Math.floor(r/2),a=5*e/100/2,c=a,l=(e-2*a)/o*n,u=(t-2*c)/r*n,d=Math.min(l,u),p=[];for(let f=0;f<r;++f){const n=[],l=f%2==0?o:o-1,u=f%2==0?0:d/2;for(let p=0;p<l;++p)n.push({centerX:p<i?u+a+d*(p+.5):u+e-a-d*(o-p-1+.5),centerY:f<s?c+d*(f+.5):t-c-d*(r-f-1+.5)});p.push(n)}return{gridType:"honeycomb",cells:p,columnWidth:d,rowHeight:d,columnsPadding:a,rowsPadding:c,width:e,height:t}}getCols(){return 10}getRows(){return Math.floor(this.getCols()*this.aspect)+1}}return new e}()}throw new Error("Unknown grid type "+e)}function ol(e,t,n,o,r,i,s){let a=t.layers[0];if(void 0!==s)for(const c of t.layers)if(c.title===s){a=c;break}return function(e,t,n,o,r,i){const s=el(t,n),a=Sc(o.autolock,o.sensitivity,t,n),c=[];function l(s,a){var l;for(const e of c)e();c.splice(0,c.length);const u=nl(e.grid).getConfiguration(s,a,i),d=new rl;for(const t of e.controls){const{row:e,column:n,type:o}=t;"NippleActivator"===o&&cl(u,e,n)}let p=-1;if(0===(null==(l=t.options.optionControls)?void 0:l.length))for(const t of e.controls){const{row:e,type:n}=t;if("Options"===n){p=e;break}}const f={};if(r)for(const t of e.controls){const{row:e}=t;let n=t.column;const o=u.cells[e].length,r=o/2;e===p&&n>=r&&(n=Math.min(n+1,o-1)),void 0===f[e]&&(f[e]={leftStart:r,leftEnd:0,rightStart:o-1,rightEnd:r}),n<r?(f[e].leftStart=Math.min(f[e].leftStart,n),f[e].leftEnd=Math.max(f[e].leftEnd,n)):(f[e].rightStart=Math.min(f[e].rightStart,n),f[e].rightEnd=Math.max(f[e].rightEnd,n))}for(const i of e.controls){const e=il[i.type];if(void 0===e){console.error("Factory for control '"+i.type+"' is not defined");continue}const s={...i},a=u.cells[i.row].length,l=a/2;if(p===i.row&&i.column>=l&&(s.column=Math.min(s.column+1,a-1)),r){const{leftStart:e,leftEnd:t,rightStart:n,rightEnd:o}=f[s.row],r=s.column<l;r?s.column+=l+(l-t)-e-1:s.column-=l+(n-l)-(a-o)+1,s.column>=a?(console.error("Column",s.column,"is out of bound",a,r?"[leftSide]":"[rightSide]",f),s.column=a-1):s.column<0&&(console.error("Column",s.column,"is out of bound",0,r?"[leftSide]":"[rightSide]",f),s.column=0)}const h=e(s,t,n,u,d,o);c.push(h)}}return t.addOnResize(l),l(t.width,t.height),()=>{t.removeOnResize(l),s(),a();for(const e of c)e()}}(a,e,n,o,r,i)}class rl{constructor(){t(this,"sensors",{})}activate(e,t){const n=this.sensors[t+"_"+e];void 0!==n&&n.activate()}deactivate(e,t){const n=this.sensors[t+"_"+e];void 0!==n&&n.deactivate()}register(e,t,n){this.sensors[t+"_"+e]=n}}const il={Key:function(e,t,n,o,r,i){const{cells:s,columnWidth:a}=o,{row:c,column:l}=e,{centerX:u,centerY:d}=s[c][l],p={onDown:()=>{for(const t of e.mapTo)n.sendKeyEvent(t,!0)},onUp:()=>{for(const t of e.mapTo)n.sendKeyEvent(t,!1)}};if(r.register(c,l,{activate:p.onDown,deactivate:p.onUp}),al(o,c,l))return()=>{};const f=fc(e.symbol,p,a);return f.style.position="absolute",f.style.left=u-f.widthPx/2+"px",f.style.top=d-f.heightPx/2+"px",t.mouseOverlay.appendChild(f),()=>t.mouseOverlay.removeChild(f)},Options:function(e,t,n,o,r,i){var s;if(0===(null==(s=t.options.optionControls)?void 0:s.length))return()=>{};if(void 0!==t.options.optionControls&&1===t.options.optionControls.length&&"keyboard"===t.options.optionControls[0])return sl(e,t,n,o);const{cells:a,columnWidth:c,rowHeight:l}=o,{row:u,column:d}=e,{centerX:p,centerY:f}=a[u][d],h=f-l/2,v=p-c/2,m=o.width-v-c;return Qc(t,["default"],(()=>{}),c,h,m)},Keyboard:sl,Switch:function(e,t,n,o,r,i){const{cells:s,columnWidth:a}=o,{row:c,column:l}=e,{centerX:u,centerY:d}=s[c][l],p=fc(e.symbol,{onUp:()=>i.setActiveConfig(i.getActiveConfig(),e.layerName)},a);return p.style.position="absolute",p.style.left=u-p.widthPx/2+"px",p.style.top=d-p.heightPx/2+"px",t.mouseOverlay.appendChild(p),()=>{t.mouseOverlay.removeChild(p)}},ScreenMove:function(e,t,n,o,r,i){const{cells:s,columnWidth:a}=o,{row:c,column:l}=e,{centerX:u,centerY:d}=s[c][l];let p=.5,f=.5;e.direction.indexOf("up")>=0&&(f=0);e.direction.indexOf("down")>=0&&(f=1);e.direction.indexOf("left")>=0&&(p=0);e.direction.indexOf("right")>=0&&(p=1);const h={onDown:()=>{n.sendMouseMotion(p,f)},onUp:()=>{n.sendMouseMotion(.5,.5)}};if(r.register(c,l,{activate:h.onDown,deactivate:h.onUp}),al(o,c,l))return()=>{};const v=fc(e.symbol,h,a);return v.style.position="absolute",v.style.left=u-v.widthPx/2+"px",v.style.top=d-v.heightPx/2+"px",t.mouseOverlay.appendChild(v),()=>t.mouseOverlay.removeChild(v)},PointerButton:function(e,t,n,o,r,i){const{cells:s,columnWidth:a}=o,{row:c,column:l,click:u}=e,{centerX:d,centerY:p}=s[c][l],f={onDown:()=>{u?n.sendMouseButton(e.button,!0):t.pointerButton=e.button},onUp:()=>{u?n.sendMouseButton(e.button,!1):t.pointerButton=0}};if(r.register(c,l,{activate:f.onDown,deactivate:f.onUp}),al(o,c,l))return()=>{};const h=fc(e.symbol,f,a);return h.style.position="absolute",h.style.left=d-h.widthPx/2+"px",h.style.top=p-h.heightPx/2+"px",t.mouseOverlay.appendChild(h),()=>t.mouseOverlay.removeChild(h)},PointerMove:function(e,t,n,o,r,i){const{cells:s,columnWidth:a}=o,{row:c,column:l,x:u,y:d}=e,{centerX:p,centerY:f}=s[c][l],h={onDown:()=>{n.sendMouseMotion(u,d)},onUp:()=>{n.sendMouseMotion(u,d)}};if(r.register(c,l,{activate:h.onDown,deactivate:h.onUp}),al(o,c,l))return()=>{};const v=fc(e.symbol,h,a);return v.style.position="absolute",v.style.left=p-v.widthPx/2+"px",v.style.top=f-v.heightPx/2+"px",t.mouseOverlay.appendChild(v),()=>t.mouseOverlay.removeChild(v)},PointerReset:function(e,t,n,o,r,i){const{cells:s,columnWidth:a}=o,{row:c,column:l}=e,{centerX:u,centerY:d}=s[c][l],p={onDown:()=>{n.sendMouseSync()}};if(r.register(c,l,{activate:p.onDown,deactivate:()=>{}}),al(o,c,l))return()=>{};const f=fc(e.symbol,p,a);return f.style.position="absolute",f.style.left=u-f.widthPx/2+"px",f.style.top=d-f.heightPx/2+"px",t.mouseOverlay.appendChild(f),()=>t.mouseOverlay.removeChild(f)},PointerToggle:function(e,t,n,o,r,i){const{cells:s,columnWidth:a}=o,{row:c,column:l}=e,{centerX:u,centerY:d}=s[c][l],p={onDown:()=>{t.pointerDisabled=!t.pointerDisabled,t.pointerDisabled?f.classList.contains("emulator-button-highlight")||f.classList.add("emulator-button-highlight"):f.classList.remove("emulator-button-highlight")}};if(r.register(c,l,{activate:p.onDown,deactivate:()=>{}}),al(o,c,l))return()=>{};const f=fc(e.symbol,p,a);return f.style.position="absolute",f.style.left=u-f.widthPx/2+"px",f.style.top=d-f.heightPx/2+"px",t.mouseOverlay.appendChild(f),()=>t.mouseOverlay.removeChild(f)},NippleActivator:function(e,t,n,o,r,i){const{cells:s,columnWidth:a,rowHeight:c,width:l,height:u}=o,{row:d,column:p}=e,{centerX:f,centerY:h}=s[d][p],v=document.createElement("div"),m=1.5,_=Math.max(0,f-a*m),y=Math.max(0,h-c*m),g=Math.max(0,l-f-a*m),b=Math.max(0,u-h-c*m);v.style.position="absolute",v.style.zIndex="999",v.style.left=_+"px",v.style.top=y+"px",v.style.right=g+"px",v.style.bottom=b+"px",t.mouseOverlay.appendChild(v);const w=Jc({zone:v,multitouch:!1,maxNumberOfNipples:1,mode:"static",follow:!1,dynamicPage:!0,size:1.5*Math.max(a,c),position:{left:(l-g-_)/2+"px",top:(u-b-y)/2+"px"}});let x=-1,k=-1;w.on("move",((e,t)=>{if(t.distance<10)return r.deactivate(k,x),x=-1,void(k=-1);let n=-1,o=-1;const i=22.5,s=t.angle.degree;s>i&&s<=67.5?(n=p+1,o=d-1):s>67.5&&s<=112.5?(n=p,o=d-1):s>112.5&&s<=157.5?(n=p-1,o=d-1):s>157.5&&s<=202.5?(n=p-1,o=d):s>202.5&&s<=247.5?(n=p-1,o=d+1):s>247.5&&s<=292.5?(n=p,o=d+1):s>292.5&&s<=337.5?(n=p+1,o=d+1):(n=p+1,o=d),x===n&&k===o||(r.deactivate(k,x),r.activate(o,n),x=n,k=o)}));let C=!1;w.on("start",(()=>{C=!0})),w.on("end",(()=>{C=!1,r.deactivate(k,x),k=-1,x=-1}));const S={capture:!0};function P(e){C&&w.processOnEnd(e)}for(const E of nc.enders)t.mouseOverlay.addEventListener(E,P,S);return()=>{w.destroy(),t.mouseOverlay.removeChild(v);for(const e of nc.enders)t.mouseOverlay.removeEventListener(e,P,S)}}};function sl(e,t,n,o,r,i){const{cells:s,columnWidth:a}=o,{row:c,column:l}=e,{centerX:u,centerY:d}=s[c][l],p=fc("keyboard",{onUp:()=>t.toggleKeyboard()},a);return p.style.position="absolute",p.style.left=u-p.widthPx/2+"px",p.style.top=d-p.heightPx/2+"px",t.mouseOverlay.appendChild(p),()=>{t.mouseOverlay.removeChild(p)}}function al(e,t,n){return!0===e.cells[t][n].hidden}function cl(e,t,n){function o(o,r){if((o!==t||r!==n)&&o>=0&&o<e.cells.length){const t=e.cells[o];r>=0&&r<t.length&&(t[r].hidden=!0)}}for(let r=t-1;r<=t+1;++r)for(let e=n-1;e<=n+1;++e)o(r,e)}function ll(e,t){!function(e){const t=eo();ae((()=>{e.events().onMessage(((e,...n)=>{var o;"error"===e&&(null==(o=n[0])?void 0:o.startsWith("[panic]"))&&t(Jr.actions.showToast({message:n[0],intent:"panic"}))}))}),[e,t])}(t),function(e){const t=on((e=>e.dos.fastForward)),n=on((e=>e.dos.frameSkip)),o=on((e=>e.dos.cpuAuto)),r=on((e=>e.dos.speed)),i=on((e=>e.dos.fastForwardOnBoot)),s=on((e=>e.dos.withSockdrive));let a=parseInt(on((e=>e.dos.cycles)));(isNaN(a)||a<3e3||a>1e6)&&(a=0);ae((()=>{if(i>0&&s){const t=setInterval((()=>{e.sendBackendEvent({type:"wc-trigger-event",event:"fast_forward:1"})}),300);setTimeout((()=>{clearInterval(t),e.sendBackendEvent({type:"wc-trigger-event",event:"fast_forward:0"})}),1e3*i)}}),[e,i,s]),ae((()=>{e.canSetFastForward?e.sendBackendEvent({type:"wc-trigger-event",event:"fast_forward:"+(t?"1":"0")}):e.canSetFastForward=!0}),[e,t]),ae((()=>{e.canSetFrameSkip?e.sendBackendEvent({type:"wc-trigger-event",event:"frame_skip:"+n}):e.canSetFrameSkip=!0}),[e,n]),ae((()=>{e.canAdjustCpu?e.sendBackendEvent({type:"wc-trigger-event",event:"auto_adjust:"+(o?"1":"0")}):e.canAdjustCpu=!0}),[e,o]),ae((()=>{e.canSetCycles&&a>0?e.sendBackendEvent({type:"wc-trigger-event",event:"cycles:"+a}):e.canSetCycles=!0}),[e,a]),ae((()=>{e.canSetSpeed?e.sendBackendEvent({type:"wc-trigger-event",event:"speed:"+r}):e.canSetSpeed=!0}),[e,r])}(t),function(e){const t=on((e=>e.dos.imageRendering));ae((()=>{e.style.imageRendering="smooth"===t?"auto":t}),[e,t])}(e),function(e){const t=eo(),n=Wr();ae((()=>{let o=0,r=0,i=48,s=0,a=0,c=0,l=0,u=Date.now();const d=setInterval((()=>{e.asyncifyStats().then((e=>{const d=(Date.now()-u)/1e3;if(d>0){const p={cpuMetrics:e.cpuMetrics??null,glfx:e.glfx??!1,offscreenCanvas:e.offscreenCanvas??!1,cycles:0,nonSkippableSleepPreSec:Math.round((e.nonSkippableSleepCount-o)/d),sleepPerSec:Math.round((e.sleepCount-r)/d),sleepTimePerSec:Math.round((e.sleepTime-i)/d),framePerSec:Math.round((e.messageFrame-s)/d),soundPerSec:Math.round((e.messageSound-a)/d),msgSentPerSec:Math.round((e.messageSent-c)/d),msgRecvPerSec:Math.round((e.messageReceived-l)/d),netSent:e.netSent,netRecv:e.netRecv,driveIo:structuredClone(e.driveIo)??[]};if(t(ki.actions.stats(p)),p.driveIo.length>0){let e=n("preloading_sockdrive"),o=!1;for(let t=0;t<p.driveIo.length;t++){const n=p.driveIo[t],r=Math.min(100,Math.round(100*n.read/n.preload));e+=" "+(0===t?"C: ":", D: ")+" "+r+"%",o=o||r<100}o&&t(Jr.actions.showToast({message:e,long:!0}))}o=e.nonSkippableSleepCount,r=e.sleepCount,i=e.sleepTime,s=e.messageFrame,a=e.messageSound,c=e.messageSent,l=e.messageReceived,u=Date.now()}}))}),1e3);return()=>{clearInterval(d)}}),[t,e])}(t),function(e){const t=on((e=>e.dos.paused)),n=on((e=>e.ui.documentHidden));ae((()=>{t||n?e.pause():e.resume()}),[t,n,e])}(t),function(e){const t=eo(),n="dosboxX"===on((e=>e.dos.backend)),o=on((e=>e.dos.paused));ae((()=>function(e,t,n,o,r){const i=new Set;function s(){i.forEach((e=>{t.sendKeyEvent(e,!1)})),i.clear()}function a(e){if("text"===e.target.type)return;n&&("F6"===e.key&&(_a(t),o(Jr.actions.setHaveQuickSave(!0))),"F7"===e.key&&ya(t));const s=ca(e.keyCode,e.location);284===s?o(ki.actions.paused(!r)):(t.sendKeyEvent(s,!0),i.add(s),e.stopPropagation(),e.preventDefault())}function c(e){if("text"===e.target.type)return;const n=ca(e.keyCode,e.location);t.sendKeyEvent(n,!1),i.delete(n),e.stopPropagation(),e.preventDefault()}function l(){s()}return e.addEventListener("keydown",a),e.addEventListener("keyup",c),e.addEventListener("blur",l),()=>{s(),e.removeEventListener("keydown",a),e.removeEventListener("keyup",c),e.removeEventListener("blur",l)}}(window,e,n,t,o)),[e,n,t,o])}(t),function(e,t){const n=on((e=>e.dos.mobileControls)),o=on((e=>e.dos.mouseCapture)),r=on((e=>e.dos.mouseSensitivity));ae((()=>{if(!n)return cc(o,r,0,e,t)}),[e,t,o,r,n])}(e,t),function(e,t){const n=hi(),o=on((e=>e.dos.mouseCapture)),r=on((e=>e.dos.mirroredControls)),i=1+on((e=>e.dos.scaleControls)),s=.1+3*on((e=>e.dos.mouseSensitivity)),a=on((e=>e.dos.mobileControls)),c=eo();let l=on((e=>e.dos.softKeyboard));function u(){l=!l,c(ki.actions.softKeyboard(l))}ae((()=>{a?null===n.layers?(n.layers=async function(){const n=new uc(e.parentElement,e,u,{}),a=dc((await t.config()).jsdosConf);let c,l=null,d=()=>{};const p={config:a,layers:n,autolock:o,sensitivity:s,mirroredControls:r,scaleControls:i,activeLayer:c,getActiveConfig:()=>l,setActiveConfig:(e,o)=>{l=e,c=o,d(),null===e?(d=()=>{},n.mouseOverlay.style.display="none"):void 0===e.version?(n.mouseOverlay.style.display="block",d=tl(p,n,e,t)):(n.mouseOverlay.style.display="block",d=ol(n,e,t,p,p.mirroredControls,p.scaleControls,o))}};return p.setActiveConfig(a),p}(),n.layers.catch(console.error)):n.layers.then((e=>{e.autolock=o,e.sensitivity=s,e.mirroredControls=r,e.scaleControls=i,e.setActiveConfig(e.getActiveConfig()??e.config,e.activeLayer)})):null!==n.layers&&n.layers.then((e=>e.setActiveConfig(null)))}),[t,o,s,a,r,i])}(e,t),function(e,t){const n=hi(),o=on((e=>e.dos.renderBackend)),r=on((e=>e.dos.renderAspect));let i;switch(r){case"1/1":i=1;break;case"5/4":i=5/4;break;case"4/3":i=4/3;break;case"16/10":i=1.6;break;case"16/9":i=16/9;break;case"Fit":i=bi}ae((()=>{let r=()=>{};if(n.offscreenCanvas)r=function(e,t,n){let o=0,r=0;const i=()=>{Ga(e,o,r,n)},s=(e,t)=>{o=e,r=t,i()};t.events().onFrameSize(s),t.events().onFrame((()=>{console.error("onFrame should not be called")})),s(t.width(),t.height());const a=new ResizeObserver(i);return a.observe(e.parentElement),window.addEventListener("resize",i),()=>{t.events().onFrameSize((()=>{})),t.events().onFrame((()=>{})),a.disconnect(),window.removeEventListener("resize",i)}}(e,t,i);else if("canvas"===o)r=Ja(e,t,i);else try{r=$a(e,t,n,i)}catch(s){console.error("Unalbe to start webgl render",s),r=Ja(e,t,i)}return r}),[e,t,o,i])}(e,t),function(e){const t=Qn();ae((()=>{const n=function(e,t){const n=e.soundFrequency();if(0===n)return console.warn("Can't create audio node with sampleRate === 0, ingnoring"),()=>{};let o=null;if("undefined"!=typeof AudioContext?o=new AudioContext({sampleRate:n,latencyHint:"interactive"}):void 0!==window.webkitAudioContext&&(o=new window.webkitAudioContext({sampleRate:n,latencyHint:"interactive"})),null==o)return()=>{};const r=new Qa;e.events().onSoundPush((e=>{r.length()<6144&&r.push(e)}));const i=o.createScriptProcessor(2048,0,1);let s=!1;i.onaudioprocess=e=>{const t=e.outputBuffer.length,n=e.outputBuffer.numberOfChannels,o=r.length();if(s||(s=o>=2048),s)for(let i=0;i<n;i++){const n=e.outputBuffer.getChannelData(i);r.writeTo(n,t)}};const a=o.createGain();let c;a.connect(o.destination),i.connect(a),a.gain.value=1,c=t((e=>{a.gain.value=e}));const l=()=>{null!==o&&"suspended"===o.state&&o.resume()};return document.addEventListener("pointerdown",l,{once:!0}),document.addEventListener("keydown",l,{once:!0}),()=>{e.events().onSoundPush((()=>{})),null!==o&&(i.disconnect(),a.disconnect(),o.close().catch(console.error),o=null),void 0!==c&&c(),document.removeEventListener("pointerdown",l),document.removeEventListener("keydown",l)}}(e,(e=>{let n=1;const o=()=>{const o=mi(t).dos.volume;Math.abs(n-o)>=.05&&(e(o),n=o)};return t.subscribe(o)}));return n}),[e])}(t)}const ul=[{cpu:"a7",width:640,height:1136,model:"iPhone 5/iPhone 5s"},{cpu:"a7",width:1536,height:2048,model:"iPad Air/iPad Mini 2/iPad Mini 3"},{cpu:"a8",width:640,height:1136,model:"iPod touch (6th gen)"},{cpu:"a8",width:750,height:1334,model:"iPhone 6"},{cpu:"a8",width:1242,height:2208,model:"iPhone 6 Plus"},{cpu:"a8",width:1536,height:2048,model:"iPad Air 2/iPad Mini 4"},{cpu:"a9",width:640,height:1136,model:"iPhone SE"},{cpu:"a9",width:750,height:1334,model:"iPhone 6s"},{cpu:"a9",width:1242,height:2208,model:"iPhone 6s Plus"},{cpu:"a9x",width:1536,height:2048,model:"iPad Pro (1st gen 9.7-inch)"},{cpu:"a9x",width:2048,height:2732,model:"iPad Pro (1st gen 12.9-inch)"},{cpu:"a10",width:750,height:1334,model:"iPhone 7"},{cpu:"a10",width:1242,height:2208,model:"iPhone 7 Plus"},{cpu:"a10x",width:1668,height:2224,model:"iPad Pro (2th gen 10.5-inch)"},{cpu:"a10x",width:2048,height:2732,model:"iPad Pro (2th gen 12.9-inch)"},{cpu:"a11",width:750,height:1334,model:"iPhone 8"},{cpu:"a11",width:1242,height:2208,model:"iPhone 8 Plus"},{cpu:"a11",width:1125,height:2436,model:"iPhone X"},{cpu:"a12",width:828,height:1792,model:"iPhone Xr"},{cpu:"a12",width:1125,height:2436,model:"iPhone Xs"},{cpu:"a12",width:1242,height:2688,model:"iPhone Xs Max"},{cpu:"a12x",width:1668,height:2388,model:"iPad Pro (3rd gen 11-inch)"},{cpu:"a12x",width:2048,height:2732,model:"iPad Pro (3rd gen 12.9-inch)"},{cpu:"a13",width:828,height:1792,model:"iPhone 11"},{cpu:"a13",width:1125,height:2436,model:"iPhone 11 Pro"},{cpu:"a13",width:1242,height:2688,model:"iPhone 11 Pro Max"},{cpu:"a14",width:1080,height:2340,model:"iPhone 12 Mini"},{cpu:"a14",width:1170,height:2532,model:"iPhone 12"},{cpu:"a14",width:1284,height:2778,model:"iPhone 12 Pro Max"},{cpu:"a15",width:1080,height:2340,model:"iPhone 13 Mini"},{cpu:"a15",width:1170,height:2532,model:"iPhone 13"},{cpu:"a15",width:1284,height:2778,model:"iPhone 13 Pro Max"},{cpu:"a15",width:1170,height:2532,model:"iPhone 14"},{cpu:"a15",width:1284,height:2778,model:"iPhone 14 Plus"},{cpu:"a16",width:1179,height:2556,model:"iPhone 14 Pro"},{cpu:"a16",width:1290,height:2796,model:"iPhone 14 Pro Max"},{cpu:"a16",width:1179,height:2556,model:"iPhone 15"},{cpu:"a16",width:1290,height:2796,model:"iPhone 15 Plus"},{cpu:"a17",width:1179,height:2556,model:"iPhone 15 Pro"},{cpu:"a17",width:1290,height:2796,model:"iPhone 15 Pro Max"},{cpu:"a18",width:1179,height:2556,model:"iPhone 16"},{cpu:"a18",width:1290,height:2796,model:"iPhone 16 Plus"},{cpu:"a18",width:1206,height:2622,model:"iPhone 16 Pro"},{cpu:"a18",width:1320,height:2868,model:"iPhone 16 Pro Max"}];function dl(e){const t=navigator.userAgent+" ";function n(e,t,n){const o=RegExp(e,"i").exec(t);return o&&o[n]}const o=function(){const e={Yandex:{prefixs:["YaApp","YaBrowser"]},Firefox:{prefixs:["Firefox"]},Opera:{prefixs:["OPR"]},Edge:{prefixs:["Edg"]},"Samsung Browser":{prefixs:["SamsungBrowser"]},"Internet Explorer":{prefixs:["Trident","MSIE"]},Chrome:{prefixs:["Chrome"]},"Chrome on iOS":{prefixs:["CriOS"]},"Firefox on iOS":{prefixs:["FxiOS"]},Safari:{prefixs:["Safari"]},Facebook:{prefixs:["FBSV"],regExp:"[/;](.*?)[;\\)]"}};for(const[o,r]of Object.entries(e))for(const e of r.prefixs){let i=n(e+(r.regExp||"[/ ](.*?)[ \\)]"),t,1);if(null!==i)return"Safari"===o&&(i=n("Version/(.*?) ",t,1)),"Internet Explorer"===o&&(i=n("rv:(.*?)\\)? ",t,1)||i),{name:o,version:i}}return{name:"",version:""}}(),r=function(){const e={Android:["Android ([0-9_.]+)"],Windows:["Windows (.*?)[;)]"],iOS:["iPhone OS ([0-9_.]+)","iPad.*? OS ([0-9_.]+)"],macOS:["Mac OS X ([0-9_.]+)"],Linux:["FreeBSD( )","OpenBSD( )","Linux|X11()"],"Search Bot":["bot|google|baidu|bing|msn|teoma|slurp|yandex"]};for(const[o,r]of Object.entries(e))for(const e of r){let r=n(e,t,1);if(null!=r){if(r=r.replace(/_/g,"."),"Windows"===o){r={"NT 5.0":"2000","NT 5.1":"XP","NT 5.2":"Server 2003","NT 6.0":"Vista","NT 6.1":"7","NT 6.2":"8","NT 6.3":"8.1","NT 10.0":"10"}[r]||r}return{name:o,version:r}}}return{name:"",version:""}}(),i=/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion)||/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.userAgent)||/MacIntel/.test(navigator.platform)&&void 0!==navigator.maxTouchPoints&&navigator.maxTouchPoints>2,s=navigator.hardwareConcurrency,a=function(e){const t=e.getExtension("WEBGL_debug_renderer_info");if(t)return e.getParameter(t.UNMASKED_RENDERER_WEBGL)||"-";return"-"}(e),c=function(){const e=window.devicePixelRatio||1;return{width:Math.min(screen.width,screen.height)*e,height:Math.max(screen.width,screen.height)*e}}(),l=c.height,u=c.width;return{browser:o.name,browserVersion:o.version??"???",mobile:i,os:r.name,osVersion:r.version,gpu:a,deviceModel:pl(i,a,{width:u,height:l}),cpu:(s||0).toString(),emscripten:"3.1.68"}}function pl(e,t,n){if(!e)return"desktop/laptop";return t.match(/^apple+[a-zA-Z0-9_\s]+gpu$/i)?function(e){let t="";for(const n of ul)e.width===Math.min(n.width,n.height)&&e.height===Math.max(n.width,n.height)&&(t+=t.length>0?"/"+n.model:n.model);return t.length>0?t:"unknown iPhone"}(n):function(e){const t=[/Android[\s][\d]+\.[\d]+\.[\d]+; [A-Za-z]{2}\-[A-Za-z]{2}\; (.+) Build/,/Android[\s][\d]+\.[\d]+\.[\d]+; (.+) Build/,/Android(.+)Build/];for(const n of t){const t=e.match(n);if(t&&t.length>0)return t[1]}return"unknown Android"}(navigator.userAgent)}function fl(e){const t=e.ci,n=hi(),o=on((e=>e.dos.backend)),r=on((e=>e.dos.worker)),i=on((e=>e.dos.emuVersion)),s=on((e=>e.dos.backendHardware))&&n.options.backendHardware,[a,c]=ie(!1),[l,u]=ie({runs:0,time:0,vax:0,pc:null}),[d,p]=ie({sleepPerSec:0,cpuMax:0});return ae((()=>{const e=[];t.events().onStdout((t=>{for(const n of e)n(t)}));const a=t.events().onStdout;t.events().onStdout=t=>{e.push(t)};let l=Date.now(),f=0;return t.events().onStdout((e=>{if(!e.startsWith("dhry2:"))return;t.asyncifyStats().then((e=>{var t;const n=Date.now()-l;p({sleepPerSec:Math.round(1e3*(e.sleepCount-f)/n),cpuMax:Math.max((null==(t=e.cpuMetrics)?void 0:t.cpuMax)??0,d.cpuMax)}),l=Date.now(),f=e.sleepCount}));const[a,h,v,m]=e.split(" "),_=Number.parseInt(h),y=Number.parseFloat(v),g=Number.parseFloat(m);y>=5e3?(u({runs:_,time:Math.round(10*y)/10,vax:Math.round(100*g)/100,pc:hl(g)}),(async()=>{const e=n.gl;if(e){const t={token:"",test:"dhry2",jsdos:"8.4.0",emu:i,backend:o,worker:r,hardware:!1!==s&&null!=s,result:Math.round(100*g)/100,...dl(e)};await fetch("https://d5dn8hh4ivlobv6682ep.apigw.yandexcloud.net/perf/set",{method:"POST",body:JSON.stringify(t)})}})().catch(console.error).finally((()=>c(!0)))):u({runs:_,time:Math.round(10*y)/10,vax:Math.round(100*g)/100,pc:null})})),()=>{t.events().onStdout=a}}),[t]),zi("div",{class:"dhry2-window",children:[zi("div",{class:"title",children:"Dhrystone 2 Benchmark"}),zi("div",{class:"backend",children:["Backend: ",o+"-"+(r?"worker":"direct")," ",s?"(WS)":"(WA)"]}),zi("div",{class:"results",children:[zi("div",{children:"VAX:"}),zi("div",{children:l.vax}),zi("div",{children:"Cycles MAX:"}),zi("div",{children:d.cpuMax}),zi("div",{children:"Sleep p/sec:"}),zi("div",{children:d.sleepPerSec}),zi("div",{children:"Runs:"}),zi("div",{children:l.runs}),zi("div",{children:"Time:"}),zi("div",{children:[l.time," ",zi("span",{children:"ms"})]}),a&&null!==l.pc&&zi("div",{children:"PC:"}),a&&null!==l.pc&&zi("div",{children:l.pc??"..."})]}),!a&&zi("div",{class:"mt-14 text-yellow-500",children:"Please wait until this message disappears"})]})}function hl(e){let t=0;for(;2*t+1<vl.length&&!(vl[2*t+1]>=e);)t++;return t=Math.min(vl.length/2-1,t),(vl[2*t]+"").trim()}const vl=["AMD 80386 40MHz",13.7,"IBM 486D2 50MHz",22.4,"80486 DX2 66MHz",35.3,"IBM 486BL 100MHz",40.9,"AMD 5X86 133MHz",84.5,"Pentium 75MHz",87.1,"Cyrix P150 120MHz",160,"Pentium 100MHz",122,"Cyrix PP166 133MHz",180,"IBM 6x86 150MHz",188,"Pentium 133MHz",181,"Pentium 166MHz",189,"Cyrix PR233 188MHz",232,"Pentium 200MHz",269,"Pentium MMX 200MHz",276,"AMD K6 200MHz",289,"Pentium Pro 200MHz",312,"Celeron A 300MHz",484,"Pentium II 300MHz",477,"AMD K62 500MHz",606,"AMD K63 450MHz",645,"Pentium II 450MHz",713,"Celeron A 450MHz",720,"Pentium III 450MHz",722,"Pentium III 600MHz",959,"Athlon 600MHz",942,"Duron 600MHz",999,"Pentium III 1000MHz",1595,"PIII Tualatin 1200MHz",1907,"Pentium 4 1700MHz",1843,"Athlon Tbird 1000MHz",1659,"Duron 1000MHz",1674,"Celeron M 1295MHz",2273,"Atom 1600MHz",1828,"Pentium 4 1900MHz",2003,"Atom 1666MHz",1948,"P4 Xeon 2200MHz",2265,"Atom Z8300 1840MHz",2686,"Athlon 4 1600MHz",2830,"Pentium M 1862MHz",3933,"Ath4 Barton 1800MHz",3172,"Pentium 4E 3000MHz",3553,"Athlon XP 2080MHz",3700,"Turion 64 M 1900MHz",3742,"Pentium 4 3066MHz",4012,"Opteron 1991MHz",3985,"Core 2 Duo M 1830MHz",4952,"Athlon XP 2338MHz",4160,"Athlon 64 2150MHz",4288,"Pentium 4 3678MHz",4227,"Athlon 64 2211MHz",4462,"Celeron C2 M 2000MHz",5275,"Core 2 Duo 1 CP 2400MHz",6446,"Core i5 2467M 2300MHz",4752,"Phenom II 1 CP 3000MHz",7615,"Core i7 930 3066MHz",8684,"Core i7 860 3460MHz",9978,"Core i7 3930K 3800MHz",11197,"Core i7 4820K 3900MHz",11867,"Core i7 4820K 3900MHz",11978,"Core i7 3930K",13877],ml=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","!","#","$","%","&","(",")","*","+",",",".","/",":",";","<","=",">","?","@","[","]","^","_","`","{","|","}","~",'"'],_l=[91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,62,90,63,64,65,66,91,67,68,69,70,71,91,72,73,52,53,54,55,56,57,58,59,60,61,74,75,76,77,78,79,80,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,81,91,82,83,84,85,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,86,87,88,89,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91];let yl=0;const gl=function(e){const t=e.length;let n="",o=0,r=0,i=0;for(yl=0;yl<t;++yl)o|=(255&e[yl])<<r,r+=8,r>13&&(i=8191&o,i>88?(o>>=13,r-=13):(i=16383&o,o>>=14,r-=14),n+=ml[i%91],n+=ml[i/91|0]);return r>0&&(n+=ml[o%91],(r>7||o>90)&&(n+=ml[o/91|0])),n},bl=function(e){let t=e.length;const n=t/1.2297|0;let o=0,r=0,i=-1,s=0,a=-1,c=0,l=new Array(n);for(s=0;s<t;++s)if(c=e.charCodeAt(s),91!==_l[c])if(-1===i)i=_l[c];else{i+=91*_l[c],o|=i<<r,r+=(8191&i)>88?13:14;do{++a>=n?l.push(255&o):l[a]=255&o,o>>=8,r-=8}while(r>7);i=-1}-1!==i&&(++a>=n?l.push(o|i<<r):l[a]=o|i<<r),a>-1&&a<n-1&&(l=l.slice(0,a+1));const u=new Uint8Array(l.length);for(s=0,t=l.length;s<t;++s)u[s]=l[s];return u},wl=new TextDecoder,xl=new TextEncoder,kl=2e8,Cl={};["wc-install","wc-run","wc-pack-fs-to-bundle","wc-add-key","wc-mouse-move","wc-mouse-button","wc-mouse-sync","wc-exit","wc-sync-sleep","wc-pause","wc-resume","wc-mute","wc-unmute","wc-connect","wc-disconnect","wc-backend-event","wc-asyncify-stats","wc-fs-tree","wc-fs-get-file","wc-send-data-chunk","wc-net-connected","wc-net-received","wc-sockdrive-opened","wc-sockdrive-new-range","wc-unload"].forEach(((e,t)=>Cl[e]=t));const Sl={};["ws-extract-progress","ws-ready","ws-server-ready","ws-frame-set-size","ws-update-lines","ws-log","ws-warn","ws-err","ws-stdout","ws-exit","ws-persist","ws-sound-init","ws-sound-push","ws-config","ws-sync-sleep","ws-connected","ws-disconnected","ws-asyncify-stats","ws-fs-tree","ws-send-data-chunk","ws-net-disconnect","ws-net-send","ws-sockdrive-open","ws-sockdrive-ready","ws-sockdrive-close","ws-sockdrive-load-range","ws-sockdrive-write-sector","ws-unload"].forEach(((e,t)=>Sl[t]=e));class Pl{constructor(e){t(this,"socket"),this.socket=e}send(e){this.socket.send(e)}onMessage(e){let t=null,n=null,o=0,r=[];const i=i=>{if(null===t||t<7){if(null===t){if(i.length<6||1!==i[0]||1!==ma(i,1))return void console.error("unparsable version message on transport layer, blob size:",i.length," error: too short");t=i[5]}e(i)}else null===n?(n=ma(i,0),r.push(i.slice(4)),o+=i.length-4):(r.push(i),o+=i.length);if(null!==n&&o===n){const t=new Uint8Array(n);let i=0;for(const e of r)t.set(e,i),i+=e.length;r=[],o=0,n=null,e(t)}},s=[];let a=!1;this.socket.addEventListener("message",(e=>{s.push({size:e.data.size,buffer:e.data.arrayBuffer()}),a||(a=!0,c().catch(console.error).finally((()=>a=!1)))}));const c=async()=>{for(;s.length>0;){const{size:t,buffer:n}=s.shift();try{const e=new Uint8Array(await n);i(e)}catch(e){console.error("unparsable message on transport layer, blob size:",t," error:",e.message),console.error(e)}}}}onError(e){this.socket.addEventListener("error",(t=>{e(t),this.socket.close()}))}}class El{constructor(e,n){t(this,"socket"),t(this,"sessionId",Date.now()+""),t(this,"hardware"),t(this,"onInit",(()=>{})),t(this,"net",null),t(this,"cycles",0),t(this,"version",0),t(this,"handler",(()=>{})),this.socket=e,this.socket.onError((e=>{this.handler("ws-err",{tag:"ws",message:e.message??"Unknown transport layer error"}),this.handler("ws-exit",{})})),this.socket.onMessage(this.onMessage.bind(this)),this.sendMessageToSocket("wc-install"),this.hardware=null,this.onInit=n}readUint64(e,t){return ma(e,t)+ma(e,t+4)*2**32}sendMessageToSocket(e,...t){let n=1;for(const i of t)n+=4+((null==i?void 0:i.length)??0);const o=new Uint8Array(n);o[0]="string"==typeof e?Cl[e]:e;let r=1;for(const i of t)va(o,(null==i?void 0:i.length)??0,r),r+=4,i&&(o.set(i,r),r+=i.length);this.socket.send(o)}readMessage(e){const t=[];let n=1;for(;n+4<=e.length;){const o=ma(e,n);if(n+=4,n+o>e.length)throw new Error("read_message out of bounds");t.push(e.slice(n,n+o)),n+=o}return{id:e[0],payload:t}}onMessage(e){var t;const{id:n,payload:o}=this.readMessage(e),r=Sl[n];switch(r){case"ws-ready":this.version=o&&o[0]&&o.length>0?o[0][0]:0,this.onInit(this.version),this.handler(r,{});break;case"ws-server-ready":case"ws-exit":"ws-server-ready"!==r&&this.handler(r,{});break;case"ws-stdout":case"ws-log":case"ws-warn":case"ws-err":this.handler(r,{tag:wl.decode(o[0]),message:wl.decode(o[1])});break;case"ws-send-data-chunk":{const e={type:wl.decode(o[0]),name:wl.decode(o[1]),data:o[2]};this.handler(r,{chunk:e})}break;case"ws-config":this.handler(r,{dosboxConf:o[0],jsdosConf:wl.decode(o[1])});break;case"ws-sound-init":this.handler(r,{freq:ma(o[0],0)}),this.handler("ws-server-ready",{});break;case"ws-sound-push":this.handler(r,{samples:new Float32Array(o[0].buffer)});break;case"ws-frame-set-size":this.handler(r,{width:ma(o[0],0),height:ma(o[0],4)});break;case"ws-update-lines":if(o.length>0){const e=[];for(const t of o)e.push({start:ma(t,0),heapu8:t.slice(4)});this.handler(r,{lines:e})}break;case"ws-asyncify-stats":{this.cycles+=ma(o[0],0);const e={messageSent:ma(o[0],4),messageReceived:ma(o[0],8),messageFrame:ma(o[0],12),messageSound:ma(o[0],16),nonSkippableSleepCount:0,sleepCount:0,sleepTime:0,cycles:this.cycles,netSent:0,netRecv:0,driveBufferedAmount:0,driveIo:[]};this.handler(r,e)}break;case"ws-connected":this.handler(r,{networkType:o[0][0],address:wl.decode(o[1])});break;case"ws-disconnected":this.handler(r,{networkType:o[0][0]});break;case"ws-fs-tree":{let e=function(e){var t;const n=e.split("/");let o=i;for(let r=1;r<n.length-1;++r){const i=n[r];if(o=null==(t=o.nodes)?void 0:t.find((e=>e.name==i)),!o)throw new Error("Unable to find node "+e+", subdir "+i)}return[o,n[n.length-1]]};const n=[];for(let t=0;t<o.length-1;++t)n.push({name:wl.decode(o[t]),size:null});const r=o[o.length-1];for(let t=0;t<n.length;++t){const e=ma(r,4*t);n[t].size=e<0?null:e}const i={name:".",nodes:[],size:null};for(const{name:o,size:s}of n){const[n,r]=e(o);null==(t=n.nodes)||t.push({name:r,size:s,nodes:null===s?[]:null})}this.handler("ws-fs-tree",{fsTree:i})}break;case"ws-persist":this.handler("ws-persist",{bundle:o.length>0?o[0]:null});break;case"ws-net-send":this.handler("ws-net-send",{networkId:ma(o[0],0),data:o[1]});break;case"ws-net-disconnect":this.handler("ws-net-disconnect",{networkId:ma(o[0],0)});break;case"ws-unload":this.handler("ws-unload",{});break;case"ws-sockdrive-open":this.handler("ws-sockdrive-open",{handle:ma(o[0],0),url:wl.decode(o[1])});break;case"ws-sockdrive-ready":this.handler("ws-sockdrive-ready",{handle:ma(o[0],0)});break;case"ws-sockdrive-close":this.handler("ws-sockdrive-close",{handle:ma(o[0],0)});break;case"ws-sockdrive-load-range":this.handler("ws-sockdrive-load-range",{handle:ma(o[0],0),range:ma(o[0],4)});break;case"ws-sockdrive-write-sector":this.handler("ws-sockdrive-write-sector",{handle:ma(o[0],0),sector:ma(o[0],4),data:o[1]});break;default:console.warn("WARN! Unhandled server message",r)}}async sendMessageToServer(e,t){if(void 0===t||(null==t?void 0:t.sessionId)!==this.sessionId)return;const n=Cl[e];switch(e){case"wc-run":{const e=t.token??"";this.sendMessageToSocket(n,xl.encode(e))}break;case"wc-send-data-chunk":{const e=t.chunk;this.sendMessageToSocket(n,xl.encode(e.type),xl.encode(e.name),e.data?new Uint8Array(e.data):null)}break;case"wc-asyncify-stats":case"wc-fs-tree":case"wc-unload":this.sendMessageToSocket(n);break;case"wc-add-key":{const e=new Uint8Array(12);let o=0;o=va(e,t.key,o),o=va(e,t.pressed?1:0,o),va(e,t.timeMs,o),this.sendMessageToSocket(n,e)}break;case"wc-mouse-move":{const e=new Uint8Array(15);let o=0;o=va(e,Math.abs(t.x)*kl,o),o=va(e,Math.abs(t.y)*kl,o),o=va(e,t.timeMs,o),e[o]=t.relative?1:0,e[o+1]=t.x>=0?0:1,e[o+2]=t.y>=0?0:1,this.sendMessageToSocket(n,e)}break;case"wc-mouse-button":{const e=new Uint8Array(6);e[0]=t.button,e[1]=t.pressed?1:0,va(e,t.timeMs,2),this.sendMessageToSocket(n,e)}break;case"wc-mouse-sync":{const e=new Uint8Array(4);va(e,t.timeMs,0),this.sendMessageToSocket(n,e)}break;case"wc-connect":this.sendMessageToSocket(n,new Uint8Array([t.networkType]),xl.encode(t.address));break;case"wc-pack-fs-to-bundle":this.sendMessageToSocket(n,new Uint8Array([t.onlyChanges?1:0]));break;case"wc-net-connected":{const e=new Uint8Array(4);va(e,t.networkId+1,0),this.sendMessageToSocket(n,e)}break;case"wc-net-received":{const e=new Uint8Array(4);va(e,t.networkId,0),this.sendMessageToSocket(n,e,new Uint8Array(t.data))}break;case"wc-sockdrive-opened":{const{handle:e,sectorSize:o,emptyRangesCount:r,emptyRanges:i,size:s,heads:a,cylinders:c,sectors:l,aheadRange:u}=t,d=new Uint8Array(12+4*r+4+4+4+4+4);let p=0;p=va(d,e,p),p=va(d,o,p),p=va(d,r,p);for(const t of i)p=va(d,t,p);p=va(d,s,p),p=va(d,a,p),p=va(d,c,p),p=va(d,l,p),p=va(d,u,p),this.sendMessageToSocket(n,d)}break;case"wc-sockdrive-new-range":{const{handle:e,range:o,buffer:r}=t,i=new Uint8Array(8);va(i,e,0),va(i,o,4),this.sendMessageToSocket(n,i,new Uint8Array(r))}break;case"wc-persist-sockdrives":this.handler("ws-persist-sockdrives",{drives:null});break;default:console.log("Unhandled client message (wc):",e,n,t)}}initMessageHandler(e){this.handler=(t,n)=>{n.sessionId=this.sessionId,e(t,n)}}exit(){this.sendMessageToSocket("wc-exit")}}class Ol{constructor(){t(this,"handler",(()=>{})),window.wsMessage=e=>{this.handler(bl(e))}}send(e){window.android.wcMessage(gl(e))}onMessage(e){this.handler=e}onError(e){}}function Ml(e){const{ci:t}=e,n=on((e=>e.dos.softKeyboard)),o=on((e=>e.dos.softKeyboardLayout)),r=on((e=>e.dos.softKeyboardSymbols)),i=on((e=>e.dos.softKeyboardActiveSymbols)),s=on((e=>e.dos.softKeyboardActiveLayout)),a=eo(),c=r[i%r.length],l=o[s%o.length];if(!n||null===t)return null;function u(e,n){if(null!==t)if("{symbols}"===e){if(n){const e=(i+1)%r.length;e!==i&&a(ki.actions.softKeyboardActiveSymbols(e))}}else if("{layout}"===e){if(n){const e=(s+1)%o.length;e!==s&&a(ki.actions.softKeyboardActiveLayout(e))}}else for(const o of function(e){switch(e){case"{enter}":return[Ws];case"{shift}":return[Gs];case"{bksp}":return[Vs];case"{lock}":return[280];case"{tab}":return[Hs];case"{space}":return[32];case"{esc}":return[Ks];case"{ctrl}":return[Xs];case"{alt}":return[qs];case"{up}":return[na];case"{down}":return[oa];case"{left}":return[ta];case"{right}":return[ra];case",":return[44];case".":return[46];case"'":return[39];case":":return[Gs,59];case"{":return[Gs,91];case"}":return[Gs,93];case"(":return[Gs,57];case")":return[Gs,gs];case"{f1}":return[bs];case"{f2}":return[ws];case"{f3}":return[xs];case"{f4}":return[ks];case"{f5}":return[Cs];case"{f6}":return[Ss];case"{f7}":return[Ps];case"{f8}":return[Es];case"{f9}":return[Os];case"{f10}":return[Ms];case"{f11}":return[js];case"{f12}":return[As];case"{kp1}":return[Ts];case"{kp2}":return[Ls];case"{kp3}":return[Is];case"{kp4}":return[zs];case"{kp5}":return[Bs];case"{kp6}":return[Rs];case"{kp7}":return[Ns];case"{kp8}":return[Fs];case"{kp9}":return[Us];case"{kp0}":return[Ds];case"{pgup}":return[Js];case"{pgdown}":return[ea];case"{del}":return[Qs];case"{home}":return[Ys];case"{end}":return[Zs];case"-":return[45];case"=":return[$s];case"+":return[Gs,$s];default:if(e.length>1)return console.warn("Unknown button",e),[]}const t=ca(e.toUpperCase().charCodeAt(0),0);if(0===t)return[];return[t]}(e))t.sendKeyEvent(o,n)}function d(e){return e.length>2&&e.startsWith("{")&&e.endsWith("}")?e[1].toUpperCase()+e.substring(2,e.length-1):e}return zi("div",{class:"soft-keyboard my-4 mx-2",children:zi("div",{class:"flex flex-row gap-2 flex-wrap justify-evenly items-center",children:l.map(((e,t)=>zi("div",{class:"flex flex-col gap-2 flex-wrap"+(1===l.length||1===t?" items-center":0===t?" items-start":" items-end"),children:e.map((e=>zi("div",{class:"flex flex-row gap-2 flex-wrap items-center",children:0===e.length?zi("div",{class:"kbd-md"}):e.split(" ").map((e=>zi("kbd",{class:"kbd kbd-md cursor-pointer hover:bg-accent-focus",onPointerDown:()=>u(e,!0),onPointerUp:()=>u(e,!1),onPointerCancel:()=>u(e,!1),children:c[e]??r[0][e]??d(e)})))})))})))})})}async function jl(e,t,n){var o,r;if(n.options.sharedNet)return n.options.sharedNet;const i=null==(r=null==(o=n.options.net)?void 0:o.iceServers)?void 0:r.call(o);await async function(e){const t=(e.options.pathPrefix?e.options.pathPrefix+"webrtcnet.mjs":"webrtcnet.mjs")+(e.options.pathSuffix??""),n=(e.options.pathPrefix?e.options.pathPrefix+"webrtcnet.wasm":"webrtcnet.wasm")+(e.options.pathSuffix??""),o=await(await fetch(t)).text(),r=URL.createObjectURL(new Blob([o],{type:"text/javascript"}));return new Promise(((e,t)=>{if(void 0===window.WebRTCNet){const o=document.createElement("script");o.type="module",o.text=`\nimport WebRTCNet from "${r}";\nwindow.WebRTCNetImpl = WebRTCNet;\n`,o.onerror=t,document.body.appendChild(o);const i=setInterval((()=>{void 0!==window.WebRTCNetImpl&&(clearInterval(i),URL.revokeObjectURL(r),window.WebRTCNet=()=>WebRTCNetImpl({locateFile:e=>e.endsWith(".wasm")?n:e}),e())}),1e3)}else e()}))}(n);const s=window.netConfig||{};if(s.debug=!0,i){const e=await i;s.iceServers=e}else s.iceServers=[{urls:["stun:stun.l.google.com:19302","stun:stun1.l.google.com:19302","stun:stun2.l.google.com:19302","stun:stun3.l.google.com:19302","stun:stun4.l.google.com:19302"]}];window.netConfig=s;const a=await WebRTCNet();a.onNetworkError=e;const c=(e,t)=>{const n=a.lengthBytesUTF8(e)+1,o=a.stringToNewUTF8(e);t(o,n),a._free(o)},l={};return a.aliasQueryAdd=(e,t,n)=>{l[e].matches.push({alias:t,peerId:n})},a.onAliasQueryEnd=e=>{l[e].resolve(l[e].matches),delete l[e]},new Promise(((e,o)=>{var r;c((null==(r=n.options.net)?void 0:r.peerServer)??"https://net.dos.zone",(r=>{var i;c((null==(i=n.options.net)?void 0:i.token)??"js-dos",(i=>{var s;c((null==(s=n.options.net)?void 0:s.secret)??"fallback",(n=>{try{if(a._connectTo(r,i,n)){const n=4194304,o=a._malloc(n),r=a._malloc(4),i={lib:a,peerId:0,connected:new Set,wait:e=>{a._wait(e)},registerAlias:e=>a.pendingRegister?Promise.reject(new Error("Register already in progress")):(a.pendingRegister=new Promise(((t,n)=>{c(e,(e=>{a._registerAlias(e)})),i.queryAliases("="+e).then((e=>{1===e.length&&e[0].peerId===i.peerId?t():n(new Error("Alias already in use"))})).catch(n)})),a.pendingRegister.finally((()=>{a.pendingRegister=null}))),unregisterAlias:e=>{c(e,(e=>{a._unregisterAlias(e)}))},queryAliases:e=>(void 0!==l[e]||(l[e]={matches:[]},l[e].promise=new Promise((t=>{l[e].resolve=t,c(e,(e=>{a._queryAliases(e)}))}))),l[e].promise),sendBinary:(e,t)=>{if(t===i.peerId||0===t)throw new Error("Cannot send to self ("+t+")");return i.connected.add(t),((e,t)=>{const n=e.byteLength,o=a._malloc(n);a.HEAPU8.set(e,o);const r=t(o,n);return a._free(o),r})(e,((e,n)=>a._sendto(e,n,t,0)))},recvBinary:()=>{const e=a._recvfrom(o,n,r),t=a.HEAP32[r/4];return e<0?(0!==t&&i.connected.delete(t),null):e>0?(i.connected.add(t),{data:a.HEAPU8.slice(o,o+e),peerId:t}):null},disconnect:e=>{a._disconnect(e)},shutdown:()=>{try{a._shutdown()}catch(e){}}};window.net=i;const s=setInterval((()=>{if(i.peerId=a._myId(),0!==i.peerId){clearInterval(s),e(i);const n=setInterval((()=>{0===a._myId()&&(t(),clearInterval(n))}),1e3)}i.wait(4)}),30)}else o(new Error("Failed to connect to HumbleNet"))}catch(s){o(s)}}))}))}))}))}function Al(e){const t=le(null),[n,o]=ie(null),r=on((e=>e.dos.worker)),i=on((e=>e.dos.jspi)),s=on((e=>e.dos.backend)),a=on((e=>e.dos.backendHardware)),c=on((e=>e.dos.noCursor)),l=on((e=>e.ui.pointerLocked)),u=on((e=>e.dos.mouseCapture)),d=eo(),p=hi(),f=nc.canLock&&u&&!l?"cursor-pointer":c?"cursor-none":"",h=on((e=>e.dos.offscreenCanvas)),v=on((e=>e.dos.sockdrivePreload)),m=on((e=>e.dos.startIpxServer)),_=on((e=>e.dos.connectIpxAddress)),y=Wr();return ae((()=>{try{const e=p.loadedBundle;let n=null!==e.bundleChanges?[e.bundle,e.bundleChanges]:e.bundle;if(null!==e.initFs)if(Array.isArray(n)||(n=[n]),Array.isArray(e.initFs))for(const t of e.initFs)n.push(t);else n.push(e.initFs);e.bundle=null,e.bundleChanges=null,e.initFs=null;let c=0;const l=(async()=>{var e,o,l;if(a&&p.options.backendHardware)if("dosboxX"===s)console.error("backendHardware is not supported for dosboxX");else{const e=await p.options.backendHardware(s);if(null!==e)return emulators.backend(n,await(o=e,l=e=>{e<5&&d(Jr.actions.updateWsWarning(!0)),console.log("wsServer:",e," expected:",5)},new Promise((e=>{let t=!1;const n=setInterval((()=>{if(!t)if(t=!0,"android://"===o)clearInterval(n),console.log("Connected to",o),e(new El(new Ol,l));else{const r=new WebSocket(o),i=()=>{clearInterval(n),console.log("Connected to",o),e(new El(new Pl(r),l))};r.addEventListener("error",(e=>{console.error("Can't conect to ",o,e),r.removeEventListener("open",i),r.close(),t=!1})),r.addEventListener("open",i)}}),1e3)}))),{sockdrivePreload:v})}if(h&&null!==t.current&&"function"==typeof t.current.transferControlToOffscreen&&(p.offscreenCanvas=t.current.transferControlToOffscreen()),null==(e=p.net)||e.shutdown(),m||_){const e=m?y("create_server"):y("lookup_address")+": "+_;if(d(Jr.actions.modalText({text:e})),p.net=await jl((e=>console.log("network error for peer",e)),(()=>console.log("network disconnected")),p),_){const e=p.net,t=Number.parseInt(_);c=t?Number.parseInt(_):await new Promise((t=>{const n=async()=>{const o=await e.queryAliases("="+_);1===o.length?t(o[0].peerId):setTimeout(n,100)};setTimeout(n,4)}))}d(Jr.actions.modalTextClear())}else p.net=void 0;let u="dosbox";if("dosboxX"===s)u="dosboxX",i&&(u+="Jspi");return emulators[u+(r?"Worker":"Direct")](n,{canvas:p.offscreenCanvas,audioWorklet:!0,sockdrivePreload:v,net:p.net})})();return l.then((e=>{o(e),d(ki.actions.ci(!0)),nc.mobile&&e.config().then((e=>{d(ki.actions.mobileControls(null!==dc(e.jsdosConf)))})).catch((e=>d(ki.actions.emuError(e.message)))),p.ci=e,m?e.sendBackendEvent({type:"wc-trigger-event",event:"hand_ipx_startserver"}):_&&p.net&&(d(Jr.actions.modalText({text:y("connect_to_network")+": "+_})),e.events().onNetworkConnected((()=>{d(Jr.actions.modalTextClear())})),e.events().onNetworkDisconnected((()=>{d(Jr.actions.modalText({text:y("unable_to_connect_to_network"),loading:!1})),e.exit()})),e.networkConnect(0,c.toString())),vi(p,"ci-ready",e)})).catch((e=>d(ki.actions.emuError(e.message)))),()=>{l.then((e=>{d(ki.actions.ci(!1)),p.ci=null,e.exit()}))}}catch(e){d(ki.actions.emuError(e.message))}}),[r,s,h,v,m,_]),zi("div",{class:"flex flex-col flex-grow h-full overflow-hidden",children:[zi("div",{class:"bg-black h-full flex-grow overflow-hidden relative",children:[zi("canvas",{class:f,ref:t}),t.current&&n&&zi(Ll,{canvas:t.current,ci:n}),zi(Dl,{}),zi(Tl,{})]}),zi(Ml,{ci:n})]})}function Dl(){const e=on((e=>e.ui.pointerLocked)),t=on((e=>e.dos.mouseCapture)),n=on((e=>e.dos.mouseSensitivity)),o=on((e=>e.ui.clickToLockModal)),r=Wr();return!e&&nc.canLock&&t?zi("div",o?{class:"absolute top-0 left-0 w-full h-full flex flex-col items-center justify-center pointer-events-none bg-black/70 gap-2 px-4 py-2 text-white text-center",children:[zi("div",{class:"text-4xl",children:r("click_to_lock")}),zi("div",{class:"text-xl",children:r("use_esc_key_to_unlock")}),zi("div",{class:"text-xl",children:r("use_slider_to_change_sensitivity")}),zi("div",{class:"text-sm",children:[r("current_sensitivity"),": ",n.toFixed(2)]})]}:{class:"absolute top-6 left-0 w-full pointer-events-none flex flex-row items-center justify-center",children:zi("div",{class:"flex flex-col items-center justify-center bg-black/70 gap-2 px-4 py-2 text-white text-center rounded-lg",children:[zi("div",{class:"text-4xl",children:r("click_to_lock")}),zi("div",{class:"text-xl",children:r("use_esc_key_to_unlock")}),zi("div",{class:"text-xl",children:r("use_slider_to_change_sensitivity")}),zi("div",{class:"text-sm",children:[r("current_sensitivity"),": ",n.toFixed(2)]})]})}):null}function Tl(){const e=on((e=>e.ui.modalText)),t=on((e=>e.ui.modalTextLoading));return e?zi("div",{class:"absolute top-0 left-0 w-full h-full flex flex-row items-center justify-center pointer-events-none bg-black/70 gap-2 px-4 py-2 text-white text-center",children:[t&&zi("span",{class:"loading loading-spinner loading-md"}),zi("div",{class:"text-4xl",children:e})]}):null}function Ll(e){const{canvas:t,ci:n}=e,o=on((e=>e.dos.bundle));return ll(t,n),zi(g,{children:[zi(zl,{ci:n}),Ei(o)&&zi(fl,{ci:n})]})}let Il=()=>{};function zl(e){const t=e.ci,n=Wr(),o=Qn(),r=hi(),[i,s]=ie(!1),[a,c]=ie(!1),[l,u]=ie(null);return ae((()=>{if(null!==l){c(!0);const e=()=>{c(!1),Il()};l?ha(o.getState(),r,o.dispatch,!0).catch(console.error).finally(e):e()}}),[l]),ae((()=>{t.events().onUnload((()=>new Promise((e=>{s(!0),Il=e}))))}),[t]),i?zi("dialog",{id:"save-dialog",className:"modal",open:!0,children:zi("div",{className:"modal-box",children:[zi("h3",{className:"font-bold text-lg",children:n("emulation_ended")}),zi("p",{className:"py-4",children:n("confirm_save")}),zi("div",{className:"modal-action",children:zi("form",{method:"dialog",className:"join",children:[zi("button",{className:"btn btn-neutral join-item",onClick:()=>{s(!1),u(!1)},children:n("close")}),zi("button",{className:"btn btn-primary join-item",onClick:()=>{s(!1),u(!0)},children:n("save")})]})})]})}):a?zi("dialog",{id:"busy-dialog",className:"modal",open:!0,children:zi("div",{className:"modal-box",children:[zi("h3",{className:"font-bold text-lg",children:n("emulation_ended")}),zi("div",{class:"flex flex-row gap-4 py-4 items-center",children:[zi("span",{class:"loading loading-spinner loading-lg"}),zi("p",{children:n("saving_game")})]})]})}):null}function Bl(e){const t=Wr(),n=e.error??"Unexpected error";return zi("div",{class:"flex-grow flex flex-col items-center justify-center px-8 m-auto",children:[zi("div",{class:"text-2xl text-center",children:t("error")}),zi("div",{class:"text-red-400 mt-8 text-2xl text-center",children:['"',n,'"']}),zi("div",{class:"mt-8 text-sm text-center",children:t("consult_logs")}),e.onSkip&&zi("button",{class:"mt-8 btn-primary",onClick:e.onSkip,children:t("skip")})]})}function Rl(){return zi(Bl,{error:on((e=>e.dos.error))})}function Nl(e){const{head:t,message:n}=e;return zi("div",{class:"flex flex-col items-center justify-center frame-color px-8",children:[zi("div",{class:"text-2xl text-center",children:t}),zi("div",{class:"mt-2 text-center",children:n})]})}function Fl(e){return e<1024?e+"b":(e/=1024)<1024?Math.round(e)+"kb":(e/=1024,Math.round(10*e)/10+"mb")}function Ul(){const e=Wr(),t=on((e=>e.dos.step)),n=on((e=>e.storage.recived)),o=on((e=>e.storage.total)),r=on((e=>e.storage.changedRecived)),i=on((e=>e.storage.changedTotal));let s=e("loading"),a="100%",c="";switch(t){case"bnd-load":s=e("bundle_loading"),n>0&&(a=`${Fl(n)} / ${Fl(o)}`,o>0&&(a+=` (${Math.round(1e3*n/o)/10}%)`)),r>0&&(c=`${Fl(r)} / ${Fl(i)}`,i>0&&(c+=` (${Math.round(1e3*r/i)/10}%)`));break;case"bnd-config":s=e("bundle_config")}return zi("div",{class:"flex flex-col w-full h-full items-center justify-center",children:[zi(Nl,{head:s,message:a}),""!==c&&zi(g,{children:[zi("br",{}),zi(Nl,{head:e("changes"),message:c})]})]})}function Kl(){const e=Wr(),t=Qn(),[n,o]=ie(!1);if(n)return zi("div",{class:"select-window overflow-hidden flex-grow flex flex-col items-center justify-center px-8 py-8",children:zi(Hl,{})});async function r(e){if(null===e.files||0===e.files.length)return;const n=e.files[0];try{await ji(n,t).catch((e=>t.dispatch(ki.actions.bndError(e.message))))}catch(o){t.dispatch(ki.actions.bndError(o.message??"unexpected error"))}}function i(){fa(r)}return zi("div",{class:"select-window overflow-hidden flex-grow flex flex-col items-center justify-center px-8",children:[zi("div",{class:"mb-4 text-center underline cursor-pointer hover:text-accent",onClick:()=>o(!0),children:e("load_by_url")}),zi(Vl,{onUpload:i}),zi("div",{class:"mt-4 text-center",children:e("upload_file")}),zi("div",{class:"flex flex-row flex-wrap gap-4",children:[zi("div",{class:"mt-4 text-center underline cursor-pointer hover:text-accent",onClick:i,children:e("load_archive")}),zi("div",{class:"mt-4 text-center underline cursor-pointer hover:text-accent",onClick:async function(){try{await async function(e){await Di("empty.jsdos",(async()=>(await emulators.bundle()).toUint8Array())(),null,null,e),e.dispatch(Jr.actions.frameConf()),e.dispatch(Jr.actions.setEditor(!0))}(t).catch(console.error)}catch(e){t.dispatch(ki.actions.bndError(e.message??"unexpected error"))}},children:e("create_empty")})]}),zi("div",{class:"mt-4 text-center",children:[e("sockdrives"),":"]}),zi("div",{class:"flex flex-row flex-wrap gap-4",children:[{url:"https://br.cdn.dos.zone/js-dos/system/system-dos7.1-v1.jsdos",label:"DOS v7.1"},{url:"https://br.cdn.dos.zone/js-dos/system/system-win311-v1.jsdos",label:"Windows 3.11"},{url:"https://br.cdn.dos.zone/js-dos/system/system-win311-ru.jsdos",label:"Windows 3.11 (RU)"},{url:"https://br.cdn.dos.zone/js-dos/system/system-win95-v1.jsdos",label:"Windows 95"},{url:"https://br.cdn.dos.zone/js-dos/system/system-win95-v2.jsdos",label:"Windows 95 (DT)"},{url:"https://br.cdn.dos.zone/js-dos/system/system-win95-lock.jsdos",label:"Windows 95 (LOCK, DT)"},{url:"https://br.cdn.dos.zone/js-dos/system/system-win95-ru.jsdos",label:"Windows 95 (RU)"},{url:"https://br.cdn.dos.zone/js-dos/system/system-win95-ru-lock.jsdos",label:"Windows 95 (RU, DT, LOCK)"},{url:"https://br.cdn.dos.zone/js-dos/system/system-win98-v1.jsdos",label:"Windows 98 (DT)"}].map((({url:e,label:t})=>zi("a",{href:e,target:"_blank",class:"mt-4 text-center underline cursor-pointer hover:text-accent",children:t})))})]})}function Hl(){const e=Wr(),t=Qn(),n=eo(),[o,r]=ie(""),[i,s]=ie(null);return zi(g,{children:[zi("div",{class:"form-control w-3/4 mb-4",children:[zi("label",{class:"label",children:zi("span",{class:"label-text",children:[e("enter_url"),":"]})}),zi("input",{type:"text",class:"input w-full input-sm input-bordered",onChange:e=>r(e.currentTarget.value??""),value:o})]}),zi("div",{class:"mt-4 text-center underline cursor-pointer hover:text-accent",onClick:()=>async function(e){let o;n(Jr.actions.frameNone());try{o=new URL(e)}catch(r){return void s(r.message)}try{await Ai(o.toString(),t)}catch(r){n(ki.actions.bndError(r.message??"unexpected error"))}}(o),children:e("load")}),null!==i&&zi("div",{class:"mt-8 text-center text-error",children:i})]})}function Vl(e){return zi("div",{class:"cursor-pointer",onClick:e.onUpload,children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-48 h-48 play-button",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 13.5l3 3m0 0l3-3m-3 3v-6m1.06-4.19l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})})}function Wl(){const[e,t]=ie(!1),n=hi(),o=eo(),r=le(null),i=Qn();return ae((()=>{e||async function(e){const t=(e.options.pathPrefix?e.options.pathPrefix+"file-explorer.js":"file-explorer.js")+(e.options.pathSuffix??""),n=(e.options.pathPrefix?e.options.pathPrefix+"file-explorer.css":"file-explorer.css")+(e.options.pathSuffix??""),o=await(await fetch(t)).text();let r=await(await fetch(n)).text();const i=new URL(n.substring(0,n.lastIndexOf("/")+1),new URL(window.location.href)).toString();r=r.replace(/url\('([^']+)'\)/g,((e,t)=>`url('${i}${t}')`));const s=URL.createObjectURL(new Blob([o],{type:"text/javascript"})),a=URL.createObjectURL(new Blob([r],{type:"text/css"}));return new Promise(((e,t)=>{if(void 0===window.FileExplorer){const n=document.createElement("link");n.rel="stylesheet",n.href=a,n.onload=()=>{URL.revokeObjectURL(a)},document.head.appendChild(n);const o=document.createElement("script");o.onerror=t,o.src=s,o.onload=()=>{URL.revokeObjectURL(s),e()},document.body.appendChild(o)}else e()}))}(n).then((()=>t(!0))).catch((e=>{o(ki.actions.bndError(e.message))}))}),[e]),ae((()=>{const t=r.current;t&&e&&function(e,t){new FileExplorer(e,{initpath:[["","/"]],onselchanged:function(e,t,n){const o=this;if(!o)return;const r="/"+e.GetPath().map((e=>e[0])).filter(Boolean).join("/");if(1===n){const e=Object.keys(t)[0];o.SetNamedStatusBarText("path",r+(r.endsWith("/")?"":"/")+e,0)}else o.SetNamedStatusBarText("path",r,0)},onrefresh:async function(e,t){e.SetBusyRef(1);try{const t=e.GetPath().map((e=>e[0]));this.SetNamedStatusBarText("path","/"+t.filter(Boolean).join("/"),0);const n=await ri(t),o=await async function(e){const t=[];for await(const[o,r]of e){const e={name:o,type:"directory"===r.kind?"folder":"file"};if("file"===e.type)try{const t=await r.getFile();e.size=t.size}catch(n){}else e.size=await ii(r);t.push(e)}return t}(n),r=o.map((e=>{const t={id:e.name,name:e.name,type:e.type,hash:e.name+"_"+e.type,tooltip:e.name};return e.size&&(t.size=e.size),t}));e.SetEntries(r)}catch(n){e.SetEntries([])}e.SetBusyRef(-1)},oninitdownload:async function(e,t,n,o){try{const e=t.GetPath().map((e=>e[0])),n=await ri(e);for(const t of o)if("file"===t.type){const e=await n.getFileHandle(t.name),o=await e.getFile(),r=URL.createObjectURL(o),i=document.createElement("a");i.href=r,i.download=t.name,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}this.StopOperationIndicator(),this.SetNamedStatusBarText("message","Download started",2e3)}catch(r){this.StopOperationIndicator(),this.SetNamedStatusBarText("message","Download failed: "+(r.message||r),3e3)}},ondelete:async function(e,n,o,r){try{const t=n.GetPath().map((e=>e[0])),o=await ri(t);for(const e of r)await o.removeEntry(e.name,{recursive:!0});e(!0)}catch(i){e(i.message||"Delete failed")}finally{ni(t)}}})}(t,i)}),[r,e]),zi("div",e?{ref:r,class:"w-full h-full"}:{class:"w-full h-full flex justify-center items-center",children:zi("div",{class:"radial-progress animate-spin",style:"--value:70;"})})}function ql(e){const t="none"!==on((e=>e.ui.frame)),n=on((e=>e.ui.frameXs)),o=on((e=>e.ui.window)),r=on((e=>e.ui.background)),i=on((e=>e.ui.kiosk)),s=on((e=>e.ui.thinSidebar)),a=on((e=>e.dos.mouseCapture));let c=zi(Xl,{});switch(o){case"error":c=zi(Rl,{});break;case"loading":c=zi(Ul,{});break;case"prerun":c=zi(ga,{});break;case"run":c=zi(Al,{});break;case"select":c=zi(Kl,{});break;case"file-explorer":c=zi(Wl,{})}const l="run"===o&&a;let u="left-12",d=l?"w-14":"w-12";return s&&!t?(d=l?"w-6":"w-4",u="left-4"):t&&(d=n?"w-24":"w-96"),zi("div",{class:"window absolute w-full h-full bg-base-100",children:[zi("div",{class:"background-image "+u,style:{backgroundImage:r?"url("+r+")":void 0}}),zi("div",{class:"relative flex flex-row h-full w-full items-start justify-start overflow-auto",children:[!i&&zi("div",{class:d+" flex-shrink-0"}),i&&l&&zi("div",{class:"w-2 flex-shrink-0"}),c]})]})}function Xl(){return zi("div",{class:"w-full h-full flex justify-center items-center",children:zi("div",{class:"radial-progress animate-spin",style:"--value:70;"})})}let Gl=Jr.getInitialState().wideScreen;function $l(){const e=le(null),t=on((e=>e.ui.hidden)),n=on((e=>e.ui.theme)),o=eo();return ae((()=>{if(t||null===e||null===e.current)return;const n=e.current;function r(){const e=n.getBoundingClientRect().width>640;e!==Gl&&(Gl=e,o(Jr.actions.setWideScreen(Gl)))}const i=new ResizeObserver(r);return i.observe(n),window.addEventListener("resize",r),()=>{i.disconnect(),window.removeEventListener("resize",r)}}),[t,e,o]),t?null:zi("div",{ref:e,class:"w-full h-full relative","data-theme":n,children:[zi(ql,{}),zi(Oa,{}),zi(qa,{}),zi(Yl,{}),zi(Jl,{})]})}function Yl(){const e=on((e=>e.ui.toast)),t=on((e=>e.ui.toastIntent)),n="panic"===t?"error":t;if(null===e)return null;let o=zi("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"});return"warning"===t&&(o=zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})),"error"!==t&&"panic"!==t||(o=zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z"})),zi("div",{class:"absolute right-10 bottom-10 pointer-events-none "+("error"===t||"panic"===t||"warning"===t?"opacity-80":"opacity-50"),children:zi("div",{class:"alert alert-"+n+" text-"+n+"-content",children:[zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",class:"shrink-0 w-6 h-6",children:o}),zi("span",{class:"break-words",children:e})]})})}function Jl(){const e=on((e=>e.ui.updateWsWarning)),t=Wr(),n=eo();if(!e)return null;return zi("div",{class:"absolute left-20 right-10 top-10 flex justify-center",children:zi("div",{class:"alert w-auto",children:[zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6 text-error",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})}),zi("span",{children:t("ws_outdated")}),zi("div",{children:[zi("button",{class:"btn btn-sm btn-primary mr-2",onClick:function(){window.open("https://dos.zone/download/","_blank"),n(Jr.actions.updateWsWarning(!1))},children:t("update")}),zi("button",{class:"btn btn-sm",onClick:function(){n(Jr.actions.updateWsWarning(!1))},children:t("close")})]})]})})}window.Dos=(e,t={})=>{var n;const o=function(e){return{root:null,loadedBundle:null,ci:null,options:e,layers:null,gl:null}}(t),r=function(e){const{storeUid:t,slice:n}=ei(),o=Tr({reducer:{init:n.reducer,i18n:Vr.reducer,ui:Jr.reducer,dos:ki.reducer,storage:Qr.reducer,editor:Xr.reducer,opfs:ti.reducer},middleware:e=>{const t=e();return t.push(di),t}});return pi[t]=e,o}(o);!function(e,t,n){function o(){n.dispatch(Jr.actions.documentHidden(document.hidden))}t.root=e,e.classList.add("jsdos-rso"),e.addEventListener("contextmenu",(e=>{var t;if(null===e.target||!(null==(t=e.target.classList)?void 0:t.contains("contextmenu")))return e.stopPropagation(),e.preventDefault(),!1})),document.addEventListener("fullscreenchange",(o=>{if(!n.getState().ui.softFullscreen){const o=document.fullscreenElement===e;n.dispatch(Jr.actions.setFullScreen(o)),!o&&n.getState().ui.autoSave&&ha(mi(n),t,n.dispatch)}})),document.addEventListener("pointerlockchange",(()=>{n.dispatch(Jr.actions.pointerLocked(null!==document.pointerLockElement)),null!==document.pointerLockElement&&n.getState().ui.clickToLockModal&&n.dispatch(Jr.actions.clickToLockModal(!1)),null===document.pointerLockElement&&n.getState().ui.autoSave&&ha(mi(n),t,n.dispatch)})),document.addEventListener("visibilitychange",o)}(e,o,r),null==(n=navigator.keyboard)||n.lock(["KeyW","Escape"]);let i="none";function s(e){r.dispatch(Jr.actions.theme(e))}function a(e){r.dispatch(Vr.actions.setLang(e))}function c(e){r.dispatch(ki.actions.dosBackend(e))}function l(e){r.dispatch(ki.actions.dosBackendLocked(e))}function u(e){r.dispatch(ki.actions.dosWorker(e))}function d(e){r.dispatch(ki.actions.mouseCapture(e))}function p(e){r.dispatch(Jr.actions.background(e))}function f(e){Ma(e,r)}function h(e){r.dispatch(Jr.actions.autoStart(e))}function v(e){r.dispatch(Jr.actions.countDownStart(e))}function m(e){r.dispatch(Jr.actions.autoSave(e))}function _(e){r.dispatch(Jr.actions.kiosk(e))}function y(e){r.dispatch(ki.actions.imageRendering(e))}function g(e){r.dispatch(ki.actions.renderBackend(e))}function b(e){r.dispatch(ki.actions.renderAspect(e))}function w(e){r.dispatch(ki.actions.scaleControls(e))}function x(e){r.dispatch(ki.actions.mouseSensitivity(e))}function k(e){r.dispatch(ki.actions.noCursor(e))}function C(e){r.dispatch(ki.actions.softKeyboardLayout(e))}function S(e){r.dispatch(ki.actions.softKeyboardSymbols(e))}function P(e){r.dispatch(ki.actions.volume(e))}function E(e){r.dispatch(ki.actions.offscreenCanvas(e))}function O(e){r.dispatch(Jr.actions.softFullscreen(e))}function M(e){r.dispatch(Jr.actions.thinSidebar(e))}return r.subscribe((function(){(async()=>{const e=mi(r),n=e.dos.step;if(n!==i)switch(i=n,e.dos.step){case"bnd-ready":void 0!==t.mouseCapture&&d(t.mouseCapture);break;case"emu-ready":if(o.options.url)try{await Ai(o.options.url,r)}catch(s){console.error(s),r.dispatch(ki.actions.bndError(s.message))}else if(o.options.dosboxConf){const e=o.options.jsdosConf??{version:"8"};e.version||(e.version="8"),async function(e,t,n){const o=fi(n),r=n.dispatch;o.loadedBundle=null,r(Xr.actions.init(e)),Ti(e,r),o.loadedBundle={bundleUrl:null,bundleChangesUrl:null,bundle:e,bundleChanges:null,initFs:t},r(ki.actions.bndReady({}))}({dosboxConf:o.options.dosboxConf,jsdosConf:e},o.options.initFs??null,r)}else r.dispatch(Jr.actions.windowSelect());vi(o,"emu-ready")}})().catch(console.error)})),Si(r,t.pathPrefix??"https://v8.js-dos.com/latest/emulators/",t.pathSuffix??""),t.theme&&s(t.theme),t.lang&&a(t.lang),t.backend&&c(t.backend),t.backendLocked&&l(t.backendLocked),void 0!==t.workerThread&&u(t.workerThread),t.background&&p(t.background),void 0!==t.fullScreen&&f(t.fullScreen),void 0!==t.autoStart&&h(t.autoStart),void 0!==t.countDownStart&&v(t.countDownStart),void 0!==t.autoSave&&m(t.autoSave),void 0!==t.kiosk&&_(t.kiosk),void 0!==t.imageRendering&&y(t.imageRendering),void 0!==t.renderBackend&&g(t.renderBackend),void 0!==t.renderAspect&&b(t.renderAspect),void 0!==t.scaleControls&&w(t.scaleControls),void 0!==t.mouseSensitivity&&x(t.mouseSensitivity),void 0!==t.noCursor&&k(t.noCursor),void 0!==t.softKeyboardLayout&&C(t.softKeyboardLayout),void 0!==t.softKeyboardSymbols&&S(t.softKeyboardSymbols),void 0!==t.volume&&P(t.volume),void 0!==t.backendHardware&&O(!0),void 0!==t.softFullscreen&&O(t.softFullscreen),void 0!==t.thinSidebar&&M(t.thinSidebar),void 0!==t.offscreenCanvas&&E(t.offscreenCanvas),void 0!==t.sockdrivePreload&&r.dispatch(ki.actions.sockdrivePreload(t.sockdrivePreload)),!0===t.startIpxServer&&r.dispatch(ki.actions.startIpxServer(!0)),t.connectIpxAddress&&r.dispatch(ki.actions.connectIpxAddress(t.connectIpxAddress)),void 0!==t.fastForwardOnBoot&&r.dispatch(ki.actions.fastForwardOnBoot(t.fastForwardOnBoot)),ni(r),R(zi(Yn,{store:r,children:zi($l,{})}),e),{getVersion:()=>["8.4.0",r.getState().dos.emuVersion],getLocalChanges:e=>ci(e),setTheme:s,setLang:a,setBackend:c,setBackendLocked:l,setWorkerThread:u,setOffscreenCanvas:E,setMouseCapture:d,setBackground:p,setFullScreen:f,setAutoStart:h,setCountDownStart:v,setAutoSave:m,setKiosk:_,setImageRendering:y,setRenderBackend:g,setRenderAspect:b,setNoCloud:function(e){r.dispatch(Jr.actions.noCloud(e))},setPaused:function(e){r.dispatch(ki.actions.paused(e))},setScaleControls:w,setMouseSensitivity:x,setNoCursor:k,setSoftKeyboardLayout:C,setSoftKeyboardSymbols:S,setVolume:P,setSoftFullscreen:O,setThinSidebar:M,save:()=>ha(mi(r),o,r.dispatch),stop:async()=>{r.dispatch(Jr.actions.hidden(!0));const e=fi(r);if(e.ci)return e.ci.exit()}}};
21
+ /*! react-checkbox-tree - v1.8.0 | 2022 */self;const Ni=K(Ri.exports=(e=>(()=>{var t={4184:(e,t)=>{var n;!function(){var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)){if(n.length){var s=r.apply(null,n);s&&e.push(s)}}else if("object"===i)if(n.toString===Object.prototype.toString)for(var a in n)o.call(n,a)&&n[a]&&e.push(a);else e.push(n.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()},8552:(e,t,n)=>{var o=n(852)(n(5639),"DataView");e.exports=o},1989:(e,t,n)=>{var o=n(1789),r=n(401),i=n(7667),s=n(1327),a=n(1866);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}c.prototype.clear=o,c.prototype.delete=r,c.prototype.get=i,c.prototype.has=s,c.prototype.set=a,e.exports=c},8407:(e,t,n)=>{var o=n(7040),r=n(4125),i=n(2117),s=n(7518),a=n(4705);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}c.prototype.clear=o,c.prototype.delete=r,c.prototype.get=i,c.prototype.has=s,c.prototype.set=a,e.exports=c},7071:(e,t,n)=>{var o=n(852)(n(5639),"Map");e.exports=o},3369:(e,t,n)=>{var o=n(4785),r=n(1285),i=n(6e3),s=n(9916),a=n(5265);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}c.prototype.clear=o,c.prototype.delete=r,c.prototype.get=i,c.prototype.has=s,c.prototype.set=a,e.exports=c},3818:(e,t,n)=>{var o=n(852)(n(5639),"Promise");e.exports=o},8525:(e,t,n)=>{var o=n(852)(n(5639),"Set");e.exports=o},8668:(e,t,n)=>{var o=n(3369),r=n(619),i=n(2385);function s(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new o;++t<n;)this.add(e[t])}s.prototype.add=s.prototype.push=r,s.prototype.has=i,e.exports=s},6384:(e,t,n)=>{var o=n(8407),r=n(7465),i=n(3779),s=n(7599),a=n(4758),c=n(4309);function l(e){var t=this.__data__=new o(e);this.size=t.size}l.prototype.clear=r,l.prototype.delete=i,l.prototype.get=s,l.prototype.has=a,l.prototype.set=c,e.exports=l},2705:(e,t,n)=>{var o=n(5639).Symbol;e.exports=o},1149:(e,t,n)=>{var o=n(5639).Uint8Array;e.exports=o},577:(e,t,n)=>{var o=n(852)(n(5639),"WeakMap");e.exports=o},4963:e=>{e.exports=function(e,t){for(var n=-1,o=null==e?0:e.length,r=0,i=[];++n<o;){var s=e[n];t(s,n,e)&&(i[r++]=s)}return i}},4636:(e,t,n)=>{var o=n(2545),r=n(5694),i=n(1469),s=n(4144),a=n(5776),c=n(6719),l=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=i(e),u=!n&&r(e),d=!n&&!u&&s(e),p=!n&&!u&&!d&&c(e),f=n||u||d||p,h=f?o(e.length,String):[],v=h.length;for(var m in e)!t&&!l.call(e,m)||f&&("length"==m||d&&("offset"==m||"parent"==m)||p&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||a(m,v))||h.push(m);return h}},2488:e=>{e.exports=function(e,t){for(var n=-1,o=t.length,r=e.length;++n<o;)e[r+n]=t[n];return e}},2908:e=>{e.exports=function(e,t){for(var n=-1,o=null==e?0:e.length;++n<o;)if(t(e[n],n,e))return!0;return!1}},8470:(e,t,n)=>{var o=n(7813);e.exports=function(e,t){for(var n=e.length;n--;)if(o(e[n][0],t))return n;return-1}},8866:(e,t,n)=>{var o=n(2488),r=n(1469);e.exports=function(e,t,n){var i=t(e);return r(e)?i:o(i,n(e))}},4239:(e,t,n)=>{var o=n(2705),r=n(9607),i=n(2333),s=o?o.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?r(e):i(e)}},9454:(e,t,n)=>{var o=n(4239),r=n(7005);e.exports=function(e){return r(e)&&"[object Arguments]"==o(e)}},939:(e,t,n)=>{var o=n(2492),r=n(7005);e.exports=function e(t,n,i,s,a){return t===n||(null==t||null==n||!r(t)&&!r(n)?t!=t&&n!=n:o(t,n,i,s,e,a))}},2492:(e,t,n)=>{var o=n(6384),r=n(7114),i=n(8351),s=n(6096),a=n(4160),c=n(1469),l=n(4144),u=n(6719),d="[object Arguments]",p="[object Array]",f="[object Object]",h=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,v,m,_){var y=c(e),g=c(t),b=y?p:a(e),w=g?p:a(t),x=(b=b==d?f:b)==f,k=(w=w==d?f:w)==f,C=b==w;if(C&&l(e)){if(!l(t))return!1;y=!0,x=!1}if(C&&!x)return _||(_=new o),y||u(e)?r(e,t,n,v,m,_):i(e,t,b,n,v,m,_);if(!(1&n)){var S=x&&h.call(e,"__wrapped__"),P=k&&h.call(t,"__wrapped__");if(S||P){var E=S?e.value():e,O=P?t.value():t;return _||(_=new o),m(E,O,n,v,_)}}return!!C&&(_||(_=new o),s(e,t,n,v,m,_))}},8458:(e,t,n)=>{var o=n(3560),r=n(5346),i=n(3218),s=n(346),a=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,p=RegExp("^"+u.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||r(e))&&(o(e)?p:a).test(s(e))}},8749:(e,t,n)=>{var o=n(4239),r=n(1780),i=n(7005),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,e.exports=function(e){return i(e)&&r(e.length)&&!!s[o(e)]}},280:(e,t,n)=>{var o=n(5726),r=n(6916),i=Object.prototype.hasOwnProperty;e.exports=function(e){if(!o(e))return r(e);var t=[];for(var n in Object(e))i.call(e,n)&&"constructor"!=n&&t.push(n);return t}},2545:e=>{e.exports=function(e,t){for(var n=-1,o=Array(e);++n<e;)o[n]=t(n);return o}},1717:e=>{e.exports=function(e){return function(t){return e(t)}}},4757:e=>{e.exports=function(e,t){return e.has(t)}},4429:(e,t,n)=>{var o=n(5639)["__core-js_shared__"];e.exports=o},7114:(e,t,n)=>{var o=n(8668),r=n(2908),i=n(4757);e.exports=function(e,t,n,s,a,c){var l=1&n,u=e.length,d=t.length;if(u!=d&&!(l&&d>u))return!1;var p=c.get(e),f=c.get(t);if(p&&f)return p==t&&f==e;var h=-1,v=!0,m=2&n?new o:void 0;for(c.set(e,t),c.set(t,e);++h<u;){var _=e[h],y=t[h];if(s)var g=l?s(y,_,h,t,e,c):s(_,y,h,e,t,c);if(void 0!==g){if(g)continue;v=!1;break}if(m){if(!r(t,(function(e,t){if(!i(m,t)&&(_===e||a(_,e,n,s,c)))return m.push(t)}))){v=!1;break}}else if(_!==y&&!a(_,y,n,s,c)){v=!1;break}}return c.delete(e),c.delete(t),v}},8351:(e,t,n)=>{var o=n(2705),r=n(1149),i=n(7813),s=n(7114),a=n(8776),c=n(1814),l=o?o.prototype:void 0,u=l?l.valueOf:void 0;e.exports=function(e,t,n,o,l,d,p){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!d(new r(e),new r(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var f=a;case"[object Set]":var h=1&o;if(f||(f=c),e.size!=t.size&&!h)return!1;var v=p.get(e);if(v)return v==t;o|=2,p.set(e,t);var m=s(f(e),f(t),o,l,d,p);return p.delete(e),m;case"[object Symbol]":if(u)return u.call(e)==u.call(t)}return!1}},6096:(e,t,n)=>{var o=n(8234),r=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,i,s,a){var c=1&n,l=o(e),u=l.length;if(u!=o(t).length&&!c)return!1;for(var d=u;d--;){var p=l[d];if(!(c?p in t:r.call(t,p)))return!1}var f=a.get(e),h=a.get(t);if(f&&h)return f==t&&h==e;var v=!0;a.set(e,t),a.set(t,e);for(var m=c;++d<u;){var _=e[p=l[d]],y=t[p];if(i)var g=c?i(y,_,p,t,e,a):i(_,y,p,e,t,a);if(!(void 0===g?_===y||s(_,y,n,i,a):g)){v=!1;break}m||(m="constructor"==p)}if(v&&!m){var b=e.constructor,w=t.constructor;b==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof w&&w instanceof w||(v=!1)}return a.delete(e),a.delete(t),v}},1957:(e,t,n)=>{var o="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=o},8234:(e,t,n)=>{var o=n(8866),r=n(9551),i=n(3674);e.exports=function(e){return o(e,i,r)}},5050:(e,t,n)=>{var o=n(7019);e.exports=function(e,t){var n=e.__data__;return o(t)?n["string"==typeof t?"string":"hash"]:n.map}},852:(e,t,n)=>{var o=n(8458),r=n(7801);e.exports=function(e,t){var n=r(e,t);return o(n)?n:void 0}},9607:(e,t,n)=>{var o=n(2705),r=Object.prototype,i=r.hasOwnProperty,s=r.toString,a=o?o.toStringTag:void 0;e.exports=function(e){var t=i.call(e,a),n=e[a];try{e[a]=void 0;var o=!0}catch(c){}var r=s.call(e);return o&&(t?e[a]=n:delete e[a]),r}},9551:(e,t,n)=>{var o=n(4963),r=n(479),i=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,a=s?function(e){return null==e?[]:(e=Object(e),o(s(e),(function(t){return i.call(e,t)})))}:r;e.exports=a},4160:(e,t,n)=>{var o=n(8552),r=n(7071),i=n(3818),s=n(8525),a=n(577),c=n(4239),l=n(346),u="[object Map]",d="[object Promise]",p="[object Set]",f="[object WeakMap]",h="[object DataView]",v=l(o),m=l(r),_=l(i),y=l(s),g=l(a),b=c;(o&&b(new o(new ArrayBuffer(1)))!=h||r&&b(new r)!=u||i&&b(i.resolve())!=d||s&&b(new s)!=p||a&&b(new a)!=f)&&(b=function(e){var t=c(e),n="[object Object]"==t?e.constructor:void 0,o=n?l(n):"";if(o)switch(o){case v:return h;case m:return u;case _:return d;case y:return p;case g:return f}return t}),e.exports=b},7801:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},1789:(e,t,n)=>{var o=n(4536);e.exports=function(){this.__data__=o?o(null):{},this.size=0}},401:e=>{e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},7667:(e,t,n)=>{var o=n(4536),r=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(o){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return r.call(t,e)?t[e]:void 0}},1327:(e,t,n)=>{var o=n(4536),r=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return o?void 0!==t[e]:r.call(t,e)}},1866:(e,t,n)=>{var o=n(4536);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=o&&void 0===t?"__lodash_hash_undefined__":t,this}},5776:e=>{var t=/^(?:0|[1-9]\d*)$/;e.exports=function(e,n){var o=typeof e;return!!(n=null==n?9007199254740991:n)&&("number"==o||"symbol"!=o&&t.test(e))&&e>-1&&e%1==0&&e<n}},7019:e=>{e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},5346:(e,t,n)=>{var o,r=n(4429),i=(o=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||""))?"Symbol(src)_1."+o:"";e.exports=function(e){return!!i&&i in e}},5726:e=>{var t=Object.prototype;e.exports=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||t)}},7040:e=>{e.exports=function(){this.__data__=[],this.size=0}},4125:(e,t,n)=>{var o=n(8470),r=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=o(t,e);return!(n<0||(n==t.length-1?t.pop():r.call(t,n,1),--this.size,0))}},2117:(e,t,n)=>{var o=n(8470);e.exports=function(e){var t=this.__data__,n=o(t,e);return n<0?void 0:t[n][1]}},7518:(e,t,n)=>{var o=n(8470);e.exports=function(e){return o(this.__data__,e)>-1}},4705:(e,t,n)=>{var o=n(8470);e.exports=function(e,t){var n=this.__data__,r=o(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}},4785:(e,t,n)=>{var o=n(1989),r=n(8407),i=n(7071);e.exports=function(){this.size=0,this.__data__={hash:new o,map:new(i||r),string:new o}}},1285:(e,t,n)=>{var o=n(5050);e.exports=function(e){var t=o(this,e).delete(e);return this.size-=t?1:0,t}},6e3:(e,t,n)=>{var o=n(5050);e.exports=function(e){return o(this,e).get(e)}},9916:(e,t,n)=>{var o=n(5050);e.exports=function(e){return o(this,e).has(e)}},5265:(e,t,n)=>{var o=n(5050);e.exports=function(e,t){var n=o(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}},8776:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,o){n[++t]=[o,e]})),n}},4536:(e,t,n)=>{var o=n(852)(Object,"create");e.exports=o},6916:(e,t,n)=>{var o=n(5569)(Object.keys,Object);e.exports=o},1167:(e,t,n)=>{e=n.nmd(e);var o=n(1957),r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,s=i&&i.exports===r&&o.process,a=function(){try{return i&&i.require&&i.require("util").types||s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=a},2333:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},5569:e=>{e.exports=function(e,t){return function(n){return e(t(n))}}},5639:(e,t,n)=>{var o=n(1957),r="object"==typeof self&&self&&self.Object===Object&&self,i=o||r||Function("return this")();e.exports=i},619:e=>{e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},2385:e=>{e.exports=function(e){return this.__data__.has(e)}},1814:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}},7465:(e,t,n)=>{var o=n(8407);e.exports=function(){this.__data__=new o,this.size=0}},3779:e=>{e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},7599:e=>{e.exports=function(e){return this.__data__.get(e)}},4758:e=>{e.exports=function(e){return this.__data__.has(e)}},4309:(e,t,n)=>{var o=n(8407),r=n(7071),i=n(3369);e.exports=function(e,t){var n=this.__data__;if(n instanceof o){var s=n.__data__;if(!r||s.length<199)return s.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(s)}return n.set(e,t),this.size=n.size,this}},346:e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(n){}try{return e+""}catch(n){}}return""}},7813:e=>{e.exports=function(e,t){return e===t||e!=e&&t!=t}},5694:(e,t,n)=>{var o=n(9454),r=n(7005),i=Object.prototype,s=i.hasOwnProperty,a=i.propertyIsEnumerable,c=o(function(){return arguments}())?o:function(e){return r(e)&&s.call(e,"callee")&&!a.call(e,"callee")};e.exports=c},1469:e=>{var t=Array.isArray;e.exports=t},8612:(e,t,n)=>{var o=n(3560),r=n(1780);e.exports=function(e){return null!=e&&r(e.length)&&!o(e)}},4144:(e,t,n)=>{e=n.nmd(e);var o=n(5639),r=n(5062),i=t&&!t.nodeType&&t,s=i&&e&&!e.nodeType&&e,a=s&&s.exports===i?o.Buffer:void 0,c=(a?a.isBuffer:void 0)||r;e.exports=c},8446:(e,t,n)=>{var o=n(939);e.exports=function(e,t){return o(e,t)}},3560:(e,t,n)=>{var o=n(4239),r=n(3218);e.exports=function(e){if(!r(e))return!1;var t=o(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},1780:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},3218:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},7005:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},6719:(e,t,n)=>{var o=n(8749),r=n(1717),i=n(1167),s=i&&i.isTypedArray,a=s?r(s):o;e.exports=a},3674:(e,t,n)=>{var o=n(4636),r=n(280),i=n(8612);e.exports=function(e){return i(e)?o(e):r(e)}},8306:(e,t,n)=>{var o=n(3369);function r(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var o=arguments,r=t?t.apply(this,o):o[0],i=n.cache;if(i.has(r))return i.get(r);var s=e.apply(this,o);return n.cache=i.set(r,s)||i,s};return n.cache=new(r.Cache||o),n}r.Cache=o,e.exports=r},479:e=>{e.exports=function(){return[]}},5062:e=>{e.exports=function(){return!1}},2703:(e,t,n)=>{var o=n(414);function r(){}function i(){}i.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,i,s){if(s!==o){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return n.PropTypes=n,n}},5697:(e,t,n)=>{e.exports=n(2703)()},414:e=>{e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},9787:t=>{t.exports=e}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var i=n[e]={id:e,loaded:!1,exports:{}};return t[e](i,i.exports,o),i.loaded=!0,i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};return(()=>{o.r(r),o.d(r,{default:()=>le,expandNodesToLevel:()=>ce});var e=o(4184),t=o.n(e),n=o(8446),i=o.n(n),s=o(8306),a=o.n(s);let c=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce(((e,t)=>e+((t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_")),"");var l=o(5697),u=o.n(l),d=o(9787),p=o.n(d);function f(e){return(f="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})(e)}var h=["children","title"];function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},v.apply(this,arguments)}function m(e,t){return(m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var g=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&&m(e,t)}(s,e);var t,n,o,r,i=(o=s,r=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}}(),function(){var e,t=_(o);if(r){var n=_(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===f(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function s(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),i.apply(this,arguments)}return t=s,(n=[{key:"render",value:function(){var e=this.props,t=e.children,n=e.title,o=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,h);return p().createElement("button",v({"aria-label":n,title:n,type:"button"},o),t)}}])&&function(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),s}(p().PureComponent);y(g,"propTypes",{children:u().node.isRequired,title:u().string}),y(g,"defaultProps",{title:null});const b=g,w={ALL:"all",PARENT:"parent",LEAF:"leaf"};function x(e){this.message=e,this.stack=Error().stack}x.prototype=Object.create(Error.prototype),x.prototype.name="CheckboxTreeError";const k=x;function C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function S(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var P=w;const E=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.props=t,this.flatNodes=n}var t,n;return t=e,n=[{key:"setProps",value:function(e){this.props=e}},{key:"clone",value:function(){var t=this,n={};return Object.keys(this.flatNodes).forEach((function(e){var o=t.flatNodes[e];n[e]=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},o)})),new e(this.props,n)}},{key:"getNode",value:function(e){return this.flatNodes[e]}},{key:"reset",value:function(){this.flatNodes={}}},{key:"flattenNodes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(Array.isArray(e)&&0!==e.length){var r=this.props,i=r.disabled,s=r.noCascade;e.forEach((function(e,r){var a=t.nodeHasChildren(e);if(void 0!==t.flatNodes[e.value])throw new k("Duplicate value '".concat(e.value,"' detected. All node values must be unique."));t.flatNodes[e.value]={label:e.label,value:e.value,children:e.children,parent:n,isChild:void 0!==n.value,isParent:a,isLeaf:!a,showCheckbox:void 0===e.showCheckbox||e.showCheckbox,disabled:t.getDisabledState(e,n,i,s),treeDepth:o,index:r},t.flattenNodes(e.children,e,o+1)}))}}},{key:"nodeHasChildren",value:function(e){return Array.isArray(e.children)}},{key:"getDisabledState",value:function(e,t,n,o){return!!n||!(o||!t.disabled)||Boolean(e.disabled)}},{key:"deserializeLists",value:function(e){var t=this,n=["checked","expanded"];Object.keys(this.flatNodes).forEach((function(e){n.forEach((function(n){t.flatNodes[e][n]=!1}))})),n.forEach((function(n){e[n].forEach((function(e){void 0!==t.flatNodes[e]&&(t.flatNodes[e][n]=!0)}))}))}},{key:"serializeList",value:function(e){var t=this,n=[];return Object.keys(this.flatNodes).forEach((function(o){t.flatNodes[o][e]&&n.push(o)})),n}},{key:"expandAllNodes",value:function(e){var t=this;return Object.keys(this.flatNodes).forEach((function(n){t.flatNodes[n].isParent&&(t.flatNodes[n].expanded=e)})),this}},{key:"toggleChecked",value:function(e,t,n,o){var r=this,i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=this.flatNodes[e.value],a=[P.PARENT,P.ALL].indexOf(n)>-1,c=[P.LEAF,P.ALL].indexOf(n)>-1;if(s.isLeaf||o){if(e.disabled)return this;this.toggleNode(e.value,"checked",t)}else(a||0===s.children.length)&&this.toggleNode(e.value,"checked",t),c&&s.children.forEach((function(e){r.toggleChecked(e,t,n,o,!1)}));return i&&!o&&s.isChild&&a&&this.toggleParentStatus(s.parent,n),this}},{key:"toggleParentStatus",value:function(e,t){var n=this.flatNodes[e.value];n.isChild?(t===P.ALL&&this.toggleNode(e.value,"checked",this.isEveryChildChecked(n)),this.toggleParentStatus(n.parent,t)):this.toggleNode(e.value,"checked",this.isEveryChildChecked(n))}},{key:"isEveryChildChecked",value:function(e){var t=this;return e.children.every((function(e){return t.getNode(e.value).checked}))}},{key:"toggleNode",value:function(e,t,n){return this.flatNodes[e][t]=n,this}}],n&&function(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function O(e){return(O="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})(e)}function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},M.apply(this,arguments)}function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function A(e,t){return(A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function D(e){return(D=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var L=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)}(s,e);var t,n,o,r,i=(o=s,r=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}}(),function(){var e,t=D(o);if(r){var n=D(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===O(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function s(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),i.apply(this,arguments)}return t=s,n=[{key:"componentDidMount",value:function(){this.updateDeterminateProperty()}},{key:"componentDidUpdate",value:function(){this.updateDeterminateProperty()}},{key:"updateDeterminateProperty",value:function(){var e=this.props.indeterminate;this.checkbox.indeterminate=e}},{key:"render",value:function(){var e=this,t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach((function(t){T(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},this.props);return delete t.indeterminate,p().createElement("input",M({},t,{ref:function(t){e.checkbox=t},type:"checkbox"}))}}],n&&function(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),s}(p().PureComponent);T(L,"propTypes",{indeterminate:u().bool}),T(L,"defaultProps",{indeterminate:!1});const I=L,z=u().shape({check:u().node,uncheck:u().node,halfCheck:u().node,expandClose:u().node,expandOpen:u().node,expandAll:u().node,collapseAll:u().node,parentClose:u().node,parentOpen:u().node,leaf:u().node}),B=u().shape({collapseAll:u().string.isRequired,expandAll:u().string.isRequired,toggle:u().string.isRequired});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})(e)}function N(e,t){return(N=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function F(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)})(e)}function K(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var H=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&&N(e,t)}(a,e);var n,o,r,i,s=(r=a,i=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}}(),function(){var e,t=U(r);if(i){var n=U(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.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 F(e)}(this,e)});function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=s.call(this,e)).onCheck=t.onCheck.bind(F(t)),t.onCheckboxKeyPress=t.onCheckboxKeyPress.bind(F(t)),t.onCheckboxKeyUp=t.onCheckboxKeyUp.bind(F(t)),t.onClick=t.onClick.bind(F(t)),t.onExpand=t.onExpand.bind(F(t)),t}return n=a,(o=[{key:"onCheck",value:function(){var e=this.props,t=e.value;(0,e.onCheck)({value:t,checked:this.getCheckState({toggle:!0})})}},{key:"onCheckboxKeyPress",value:function(e){32===e.which&&e.preventDefault()}},{key:"onCheckboxKeyUp",value:function(e){var t=e.keyCode;[13,32].includes(t)&&this.onCheck()}},{key:"onClick",value:function(){var e=this.props,t=e.expandOnClick,n=e.isParent,o=e.value,r=e.onClick;n&&t&&this.onExpand(),r({value:o,checked:this.getCheckState({toggle:!1})})}},{key:"onExpand",value:function(){var e=this.props,t=e.expanded,n=e.value;(0,e.onExpand)({value:n,expanded:!t})}},{key:"getCheckState",value:function(e){var t=e.toggle,n=this.props,o=n.checked,r=n.optimisticToggle;return!(0!==o||!t)||1===o&&!t||2===o&&r}},{key:"renderCollapseButton",value:function(){var e=this.props,t=e.expandDisabled,n=e.isLeaf,o=e.lang;return n?p().createElement("span",{className:"rct-collapse"},p().createElement("span",{className:"rct-icon"})):p().createElement(b,{className:"rct-collapse rct-collapse-btn",disabled:t,title:o.toggle,onClick:this.onExpand},this.renderCollapseIcon())}},{key:"renderCollapseIcon",value:function(){var e=this.props,t=e.expanded,n=e.icons,o=n.expandClose,r=n.expandOpen;return t?r:o}},{key:"renderCheckboxIcon",value:function(){var e=this.props,t=e.checked,n=e.icons,o=n.uncheck,r=n.check,i=n.halfCheck;return 0===t?o:1===t?r:i}},{key:"renderNodeIcon",value:function(){var e=this.props,t=e.expanded,n=e.icon,o=e.icons,r=o.leaf,i=o.parentClose,s=o.parentOpen,a=e.isLeaf;return null!==n?n:a?r:t?s:i}},{key:"renderBareLabel",value:function(e){var t=this.props,n=t.onClick,o=t.title,r=null!==n;return p().createElement("span",{className:"rct-bare-label",title:o},r?p().createElement("span",{className:"rct-node-clickable",onClick:this.onClick,onKeyPress:this.onClick,role:"button",tabIndex:0},e):e)}},{key:"renderCheckboxLabel",value:function(e){var t=this.props,n=t.checked,o=t.disabled,r=t.title,i=t.treeId,s=t.value,a=null!==t.onClick,c="".concat(i,"-").concat(String(s).split(" ").join("_")),l=[p().createElement("label",{key:0,htmlFor:c,title:r},p().createElement(I,{checked:1===n,disabled:o,id:c,indeterminate:2===n,onClick:this.onCheck,onChange:function(){}}),p().createElement("span",{"aria-checked":1===n,"aria-disabled":o,className:"rct-checkbox",role:"checkbox",tabIndex:0,onKeyPress:this.onCheckboxKeyPress,onKeyUp:this.onCheckboxKeyUp},this.renderCheckboxIcon()),a?null:e)];return a&&l.push(p().createElement("span",{key:1,className:"rct-node-clickable",onClick:this.onClick,onKeyPress:this.onClick,role:"link",tabIndex:0},e)),l}},{key:"renderLabel",value:function(){var e=this.props,t=e.label,n=e.showCheckbox,o=[e.showNodeIcon?p().createElement("span",{key:0,className:"rct-node-icon"},this.renderNodeIcon()):null,p().createElement("span",{key:1,className:"rct-title"},t)];return n?this.renderCheckboxLabel(o):this.renderBareLabel(o)}},{key:"renderChildren",value:function(){return this.props.expanded?this.props.children:null}},{key:"render",value:function(){var e=this.props,n=e.className,o=e.disabled,r=e.expanded,i=e.isLeaf,s=t()({"rct-node":!0,"rct-node-leaf":i,"rct-node-parent":!i,"rct-node-expanded":!i&&r,"rct-node-collapsed":!i&&!r,"rct-disabled":o},n);return p().createElement("li",{className:s},p().createElement("span",{className:"rct-text"},this.renderCollapseButton(),this.renderLabel()),this.renderChildren())}}])&&function(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(n.prototype,o),Object.defineProperty(n,"prototype",{writable:!1}),a}(p().PureComponent);K(H,"propTypes",{checked:u().number.isRequired,disabled:u().bool.isRequired,expandDisabled:u().bool.isRequired,expanded:u().bool.isRequired,icons:z.isRequired,isLeaf:u().bool.isRequired,isParent:u().bool.isRequired,label:u().node.isRequired,lang:B.isRequired,optimisticToggle:u().bool.isRequired,showNodeIcon:u().bool.isRequired,treeId:u().string.isRequired,value:u().oneOfType([u().string,u().number]).isRequired,onCheck:u().func.isRequired,onExpand:u().func.isRequired,children:u().node,className:u().string,expandOnClick:u().bool,icon:u().node,showCheckbox:u().bool,title:u().string,onClick:u().func}),K(H,"defaultProps",{children:null,className:null,expandOnClick:!1,icon:null,showCheckbox:!0,title:null,onClick:function(){}});const V=H,W=u().oneOfType([u().arrayOf(u().string),u().arrayOf(u().number)]);function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function X(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q(Object(n),!0).forEach((function(t){G(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function G(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $={label:u().node.isRequired,value:u().oneOfType([u().string,u().number]).isRequired,disabled:u().bool,icon:u().node,showCheckbox:u().bool,title:u().string};const Y=u().oneOfType([u().shape($),u().shape(X(X({},$),{},{children:u().arrayOf($).isRequired}))]);function J(e){return(J="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})(e)}function Q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Q(Object(n),!0).forEach((function(t){re(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ee(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function te(e,t){return(te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ne(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function oe(e){return(oe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function re(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ie=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&&te(e,t)}(d,e);var n,o,r,s,l,u=(s=d,l=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}}(),function(){var e,t=oe(s);if(l){var n=oe(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===J(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ne(e)}(this,e)});function d(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),t=u.call(this,e);var n=new E(e);return n.flattenNodes(e.nodes),n.deserializeLists({checked:e.checked,expanded:e.expanded}),t.state={id:e.id||"rct-".concat(c()),model:n,prevProps:e},t.onCheck=t.onCheck.bind(ne(t)),t.onExpand=t.onExpand.bind(ne(t)),t.onNodeClick=t.onNodeClick.bind(ne(t)),t.onExpandAll=t.onExpandAll.bind(ne(t)),t.onCollapseAll=t.onCollapseAll.bind(ne(t)),t.combineMemorized=a()((function(e,t){return Z(Z({},e),t)})).bind(ne(t)),t}return n=d,o=[{key:"onCheck",value:function(e){var t=this.props,n=t.checkModel,o=t.noCascade,r=t.onCheck,i=this.state.model.clone(),s=i.getNode(e.value);i.toggleChecked(e,e.checked,n,o),r(i.serializeList("checked"),Z(Z({},s),e))}},{key:"onExpand",value:function(e){var t=this.props.onExpand,n=this.state.model.clone(),o=n.getNode(e.value);n.toggleNode(e.value,"expanded",e.expanded),t(n.serializeList("expanded"),Z(Z({},o),e))}},{key:"onNodeClick",value:function(e){(0,this.props.onClick)(Z(Z({},this.state.model.getNode(e.value)),e))}},{key:"onExpandAll",value:function(){this.expandAllNodes()}},{key:"onCollapseAll",value:function(){this.expandAllNodes(!1)}},{key:"expandAllNodes",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];(0,this.props.onExpand)(this.state.model.clone().expandAllNodes(e).serializeList("expanded"))}},{key:"determineShallowCheckState",value:function(e,t){var n=this.state.model.getNode(e.value);return n.isLeaf||t||0===e.children.length?n.checked?1:0:this.isEveryChildChecked(e)?1:this.isSomeChildChecked(e)?2:0}},{key:"isEveryChildChecked",value:function(e){var t=this;return e.children.every((function(e){return 1===t.state.model.getNode(e.value).checkState}))}},{key:"isSomeChildChecked",value:function(e){var t=this;return e.children.some((function(e){return t.state.model.getNode(e.value).checkState>0}))}},{key:"renderTreeNodes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=this.props,r=o.expandDisabled,i=o.expandOnClick,s=o.icons,a=o.lang,c=o.noCascade,l=o.onClick,u=o.onlyLeafCheckboxes,f=o.optimisticToggle,h=o.showNodeTitle,v=o.showNodeIcon,m=this.state,_=m.id,y=m.model,g=d.defaultProps.icons,b=e.map((function(e){var o=e.value,d=y.getNode(e.value),m=d.isParent?t.renderTreeNodes(e.children,e):null;d.checkState=t.determineShallowCheckState(e,c);var b=u?d.isLeaf:d.showCheckbox;return!n.value||y.getNode(n.value).expanded?p().createElement(V,{key:o,checked:d.checkState,className:e.className,disabled:d.disabled,expandDisabled:r,expandOnClick:i,expanded:d.expanded,icon:e.icon,icons:t.combineMemorized(g,s),label:e.label,lang:a,optimisticToggle:f,isLeaf:d.isLeaf,isParent:d.isParent,showCheckbox:b,showNodeIcon:v,title:h?e.title||e.label:e.title,treeId:_,value:e.value,onCheck:t.onCheck,onClick:l&&t.onNodeClick,onExpand:t.onExpand},m):null}));return p().createElement("ol",null,b)}},{key:"renderExpandAll",value:function(){var e=this.props,t=e.icons,n=t.expandAll,o=t.collapseAll,r=e.lang;return e.showExpandAll?p().createElement("div",{className:"rct-options"},p().createElement(b,{className:"rct-option rct-option-expand-all",title:r.expandAll,onClick:this.onExpandAll},n),p().createElement(b,{className:"rct-option rct-option-collapse-all",title:r.collapseAll,onClick:this.onCollapseAll},o)):null}},{key:"renderHiddenInput",value:function(){var e=this.props,t=e.name,n=e.nameAsArray;return void 0===t?null:n?this.renderArrayHiddenInput():this.renderJoinedHiddenInput()}},{key:"renderArrayHiddenInput",value:function(){var e=this.props,t=e.checked,n=e.name;return t.map((function(e){var t="".concat(n,"[]");return p().createElement("input",{key:e,name:t,type:"hidden",value:e})}))}},{key:"renderJoinedHiddenInput",value:function(){var e=this.props,t=e.checked,n=e.name,o=t.join(",");return p().createElement("input",{name:n,type:"hidden",value:o})}},{key:"render",value:function(){var e,n=this.props,o=n.direction,r=n.disabled,i=n.iconsClass,s=n.nodes,a=n.nativeCheckboxes,c=this.state.id,l=this.renderTreeNodes(s),u=t()((re(e={"react-checkbox-tree":!0,"rct-disabled":r},"rct-icons-".concat(i),!0),re(e,"rct-native-display",a),re(e,"rct-direction-rtl","rtl"===o),e));return p().createElement("div",{className:u,id:c},this.renderExpandAll(),this.renderHiddenInput(),l)}}],r=[{key:"getDerivedStateFromProps",value:function(e,t){var n=t.model,o=t.prevProps,r=e.disabled,s=e.id,a=e.nodes,c=Z(Z({},t),{},{prevProps:e});return n.setProps(e),i()(o.nodes,a)&&o.disabled===r||(n.reset(),n.flattenNodes(a)),null!==s&&(c=Z(Z({},c),{},{id:s})),n.deserializeLists({checked:e.checked,expanded:e.expanded}),c}}],o&&ee(n.prototype,o),r&&ee(n,r),Object.defineProperty(n,"prototype",{writable:!1}),d}(p().Component);function se(e){return function(e){if(Array.isArray(e))return ae(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return ae(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)?ae(e,t):void 0}}(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 ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ce(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(n>t)return[];var o=[];return e.forEach((function(e){e.children&&(o=[].concat(se(o),[e.value],se(ce(e.children,t,n+1))))})),o}re(ie,"propTypes",{nodes:u().arrayOf(Y).isRequired,checkModel:u().oneOf([w.LEAF,w.ALL]),checked:W,direction:u().string,disabled:u().bool,expandDisabled:u().bool,expandOnClick:u().bool,expanded:W,icons:z,iconsClass:u().string,id:u().string,lang:B,name:u().string,nameAsArray:u().bool,nativeCheckboxes:u().bool,noCascade:u().bool,onlyLeafCheckboxes:u().bool,optimisticToggle:u().bool,showExpandAll:u().bool,showNodeIcon:u().bool,showNodeTitle:u().bool,onCheck:u().func,onClick:u().func,onExpand:u().func}),re(ie,"defaultProps",{checkModel:w.LEAF,checked:[],direction:"ltr",disabled:!1,expandDisabled:!1,expandOnClick:!1,expanded:[],icons:{check:p().createElement("span",{className:"rct-icon rct-icon-check"}),uncheck:p().createElement("span",{className:"rct-icon rct-icon-uncheck"}),halfCheck:p().createElement("span",{className:"rct-icon rct-icon-half-check"}),expandClose:p().createElement("span",{className:"rct-icon rct-icon-expand-close"}),expandOpen:p().createElement("span",{className:"rct-icon rct-icon-expand-open"}),expandAll:p().createElement("span",{className:"rct-icon rct-icon-expand-all"}),collapseAll:p().createElement("span",{className:"rct-icon rct-icon-collapse-all"}),parentClose:p().createElement("span",{className:"rct-icon rct-icon-parent-close"}),parentOpen:p().createElement("span",{className:"rct-icon rct-icon-parent-open"}),leaf:p().createElement("span",{className:"rct-icon rct-icon-leaf"})},iconsClass:"fa4",id:null,lang:{collapseAll:"Collapse all",expandAll:"Expand all",toggle:"Toggle"},name:void 0,nameAsArray:!1,nativeCheckboxes:!1,noCascade:!1,onlyLeafCheckboxes:!1,optimisticToggle:!0,showExpandAll:!1,showNodeIcon:!0,showNodeTitle:!1,onCheck:function(){},onClick:null,onExpand:function(){}});const le=ie})(),r})())(Pt));function Fi(e,t,n="application/zip"){const o=new Blob([t],{type:n});!function(e,t,n=!0){const o=document.createElement("a");o.href=t,o.target=n?"_blank":"_self",o.download=e,o.style.display="none",document.body.appendChild(o),o.click(),o.remove()}(e,URL.createObjectURL(o))}function Ui(){const e=Wr(),t=on((e=>e.dos.ci)),n=hi(),[o,r]=ie(0),[i,s]=ie(null),[a,c]=ie([]),[l,u]=ie([]),[d,p]=ie(null),[f,h]=ie(!1);function v(e){s(e),r(Math.round(Gi(e)/1024/1024*100)/100)}async function m(){if(v(null),null===n.ci||!t)return;v(Ki(await n.ci.fsTree()))}return ae((()=>{if(null===n.ci||!t)return;let e=!1;return n.ci.fsTree().then((t=>{e||v(Ki(t))})).catch((t=>{console.error(t),e||v(null)})),()=>{e=!0}}),[t]),zi("div",{class:"editor-fs-frame frame-root items-start px-4",children:[(f||null!==d)&&zi("div",{class:"card card-bordered bg-base-100 shadow-xl w-full",children:zi("div",{class:"card-body",children:[zi("div",{class:"card-title",children:e(f?"please_wait":"uploading_file")}),zi("span",{class:"break-words",children:f?e("making_bundle"):d})]})}),!f&&null===d&&i&&zi("div",{className:"fs-tree-view",children:[zi(Vi,{onRefresh:m,onUploadingFile:p,onMakingBundle:h,onRemoveFile:async function(){const e=n.ci;if(null!==e){try{p("DELETE_OPERATION");for(let t of l)t.startsWith("./")&&(t=t.slice(2)),await e.fsDeleteFile(t)}finally{p(null)}u([]),await m()}},canDelete:l.length>0}),zi("div",{class:"bg-base-200 px-2 py-1 text-right",children:[e("size"),": ",o," Mb"]}),zi("div",{class:"fs-tree",children:zi(Ni,{icons:{expandOpen:zi(qi,{}),expandClose:zi(Xi,{})},iconsClass:"icon",nativeCheckboxes:!1,onlyLeafCheckboxes:!1,nodes:i,checked:l,onCheck:function(e,t){const n=e.indexOf(t.value);t.checked&&-1===n?e.push(t.value):t.checked||-1===n||e.splice(n,1),u(e)},expanded:a,onExpand:function(e,t){c(e)}})})]})]})}function Ki(e){var t;const n=[];for(const o of(null==(t=e.nodes)?void 0:t.sort(Wi))||[])n.push(Hi(o,"."));return n}function Hi(e,t){const n=t+"/"+e.name,o={label:e.name,value:n,fsNode:e};if(null!==e.nodes){const t=e.nodes.sort(Wi).map((e=>Hi(e,n)));o.children=t}return o}function Vi(e){const t=Wr(),n=le(null),o=le(null),r=Qn(),i=hi(),{onRefresh:s,onUploadingFile:a,onMakingBundle:c,onRemoveFile:l,canDelete:u}=e;function d(e){const t=(e?o:n).current;null!==t&&t.click()}async function p(e){const t=i.ci,n=e.target.files;if(null!==t&&null!==n){try{for(const e of n){a(e.name);const n=(e.webkitRelativePath??"").split("/");n.shift();const o=n.join("/");await t.fsWriteFile(0==o.length?e.name:o,e.stream())}}finally{a(null)}await s()}}return ae((()=>{null!==n.current&&(n.current.setAttribute("directory",""),n.current.setAttribute("webkitdirectory",""))}),[n]),zi("div",{class:"h-6 flex flex-row",children:[zi("input",{class:"hidden",type:"file",multiple:!0,ref:n,onChange:p}),zi("input",{class:"hidden",type:"file",multiple:!0,ref:o,onChange:p}),zi("button",{class:"refresh btn-xs rounded-none",onClick:s,children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99"})})}),zi("button",{class:"add-file btn-xs rounded-none",onClick:()=>d(!0),children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m3.75 9v6m3-3H9m1.5-12H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}),zi("button",{class:"add-dir btn-xs rounded-none",onClick:()=>d(!1),children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 10.5v6m3-3H9m4.06-7.19l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})}),u&&zi("button",{class:"btn-xs rounded-none text-error",onClick:()=>l(),children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"})})}),zi("div",{class:"flex-grow"}),zi("button",{class:"download btn-xs rounded-none",onClick:async function(){const e=i.ci;if(null!==e){c(!0);try{const t=await e.persist(!1);t&&Fi("bundle.jsdos",t)}finally{c(!1)}}},children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 13.5l3 3m0 0l3-3m-3 3v-6m1.06-4.19l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})}),zi("button",{class:"restart btn-xs rounded-none",onClick:async function(){const e=i.ci;if(null!==e&&window.confirm(t("fs_restart"))){c(!0);try{const t=await e.persist(!1);t&&async function(e,t,n){await Di("bundle.jsdos",Promise.resolve(e),null,null,n),n.dispatch(Jr.actions.frameConf())}(t,0,r)}finally{c(!1)}}},children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21 7.5V18M15 7.5V18M3 16.811V8.69c0-.864.933-1.406 1.683-.977l7.108 4.061a1.125 1.125 0 010 1.954l-7.108 4.061A1.125 1.125 0 013 16.811z"})})})]})}function Wi(e,t){return null!==e.nodes&&null!==t.nodes?t.name.localeCompare(e.name):null===e.nodes?1:-1}function qi(){return zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4 mr-2",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})}function Xi(){return zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4 mr-2",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})}function Gi(e){if(!e)return 0;let t=0;for(const n of e)null!==n.fsNode.size?t+=n.fsNode.size:t+=Gi(n.children);return t}function $i(e){const t=le(null);return ae((()=>{null!==t&&null!==t.current&&(t.current.indeterminate=e.intermediate)}),[t,e.intermediate]),zi("div",{className:e.class+" form-control option",onClick:function(){e.onChange&&e.onChange(!(!0===e.checked))},children:zi("label",{className:"label cursor-pointer",children:[zi("span",{className:"label-text mr-6",children:e.label}),zi("input",{ref:t,checked:!0===e.checked,type:"checkbox",className:"toggle "+(e.checked?" toggle-primary ":"")+e.toggleClass,disabled:!0===e.disabled})]})})}function Yi(){const e=Wr(),t=eo(),n=on((e=>e.ui.editor));return zi($i,{class:"mt-4",label:e("editor"),checked:n,onChange:e=>t(Jr.actions.setEditor(e))})}function Ji(){const e=Wr(),t=eo(),n=on((e=>e.dos.mouseCapture));return zi($i,{class:"mt-4",label:e("mouse_lock"),checked:n,onChange:e=>t(ki.actions.mouseCapture(e))})}function Qi(){const e=Wr(),t=eo(),n=on((e=>!e.dos.noCursor));return zi($i,{class:"mt-4",label:e("system_cursor"),checked:n,onChange:e=>t(ki.actions.noCursor(!e))})}function Zi(){const e=Wr(),t=eo(),n=on((e=>e.dos.mobileControls));return zi($i,{class:"mt-4",label:e("mobile_controls"),checked:n,onChange:e=>t(ki.actions.mobileControls(e))})}function es(){const e=Wr(),t=eo(),n=on((e=>e.dos.mirroredControls));return zi($i,{class:"mt-4",label:e("mirrored_controls"),checked:n,onChange:e=>t(ki.actions.mirroredControls(e))})}function ts(){const e=Wr(),t=eo(),n=on((e=>e.dos.paused)),o="run"!==on((e=>e.ui.window));return zi($i,{class:"mt-4",label:e("pause"),checked:n,disabled:o,onChange:e=>t(ki.actions.paused(e))})}function ns(){const e=Wr(),t=eo(),n=on((e=>e.dos.worker)),o=on((e=>e.dos.backendHardware)),r="run"===on((e=>e.ui.window)),i=hi();return o&&i.options.backendHardware?null:zi($i,{class:"mt-4",label:e("worker"),checked:n,disabled:r,onChange:e=>t(ki.actions.dosWorker(e))})}function os(){const e=eo();return zi($i,{class:"mt-4",label:"JSPI",checked:on((e=>e.dos.jspi)),onChange:t=>e(ki.actions.dosJspi(t))})}function rs(){const e=Wr(),t=eo(),n=on((e=>e.dos.offscreenCanvas));return zi($i,{class:"mt-4",label:e("offscreen_canvas"),checked:n,onChange:e=>t(ki.actions.offscreenCanvas(e))})}function is(){const e=eo();return zi($i,{class:"mt-4",label:"IPX Server",checked:on((e=>e.dos.startIpxServer)),onChange:t=>e(ki.actions.startIpxServer(t))})}function ss(){const e=Wr(),t=eo(),n=on((e=>e.dos.backendHardware));return hi().options.backendHardware?zi($i,{class:"mt-4",label:e("hardware"),checked:n,onChange:e=>t(ki.actions.dosBackendHardware(e))}):null}function as(e){const t=Wr(),n=!0===e.multiline;return zi("div",{class:e.class+" option flex "+(n?"flex-col":"flex-row items-center"),children:[zi("div",{class:n?"mb-2":"mr-4",children:e.label}),zi("div",{class:"flex-grow",children:zi("select",{class:e.selectClass?e.selectClass:n?"w-full":"w-28",onChange:function(t){void 0!==e.onSelect&&e.onSelect(t.currentTarget.value)},disabled:!0===e.disabled,children:e.values.map((n=>zi("option",{selected:n===e.selected,value:n,children:t(n)})))})})]})}function cs(e){const t=on((e=>e.dos.backendLocked));return zi(hs,{multiline:e.multiline,label:"emulation_backend",values:[..._i],disabled:t,selector:e=>e.dos.backend,dispatch:e=>($r.setItem("backend",e),ki.actions.dosBackend(e))})}function ls(e){const t="run"===on((e=>e.ui.window));return zi(hs,{multiline:e.multiline,label:"render_backend",values:[...yi],disabled:t,selector:e=>e.dos.renderBackend,dispatch:e=>ki.actions.renderBackend(e)})}function us(e){return zi(hs,{label:"render_aspect",multiline:e.multiline,values:[...gi],selector:e=>e.dos.renderAspect,dispatch:e=>ki.actions.renderAspect(e)})}function ds(e){return zi(hs,{label:"Sockdrive Preload",multiline:e.multiline,values:[...wi],selector:e=>e.dos.sockdrivePreload,dispatch:e=>ki.actions.sockdrivePreload(e)})}function ps(e){return zi(hs,{label:"image_rendering",multiline:e.multiline,values:[...xi],selector:e=>e.dos.imageRendering,dispatch:e=>ki.actions.imageRendering(e)})}function fs(e){return zi(hs,{class:e.class,label:"theme",values:[...Yr],selector:e=>e.ui.theme,dispatch:e=>Jr.actions.theme(e),multiline:e.multiline})}function hs(e){const t=Wr(),n=on(e.selector),o=eo();return zi(as,{class:"mt-4 "+e.class,selectClass:e.selectClass,disabled:e.disabled,multiline:e.multiline,label:t(e.label),selected:n,values:e.values,onSelect:function(t){o(e.dispatch(t))}})}function vs(e){const t=le(null),n=le(null),o=e.vertical??!1,r=e.bgClass??"bg-base-200";ae((()=>{if(null===(null==t?void 0:t.current))return;const n=t.current;let r=!1;function i(t){const r=n.getBoundingClientRect(),i=o?1-Math.min(1,Math.max(0,(t.clientY-r.top)/r.height)):Math.min(1,Math.max(0,(t.clientX-r.left)/r.width));e.onChange(i)}function s(e){r=!0,i(e)}function a(e){r&&i(e)}function c(e){r=!1}return n.addEventListener("pointerdown",s),n.addEventListener("pointermove",a),n.addEventListener("pointerup",c),n.addEventListener("pointercancel",c),n.addEventListener("pointerleave",c),()=>{n.removeEventListener("pointerdown",s),n.removeEventListener("pointermove",a),n.removeEventListener("pointerup",c),n.removeEventListener("pointercancel",c),n.removeEventListener("pointerleave",c)}}),[t,o]);const i=o?"":"rounded-full",s=o?"items-start":"items-center",a=Math.min(Math.max(0,100*e.value),100),c=o?"flex-col":"flex-row",l=o?"h-full":"w-full",u=o?"w-4":"h-16",d=o?"w-2":"h-2",p=o?{active:{bottom:0,height:"calc("+a+"% + 12px)"},point:{left:"-8px",bottom:"calc("+a+"% - 12px)"}}:{active:{left:0,width:a+"%"},point:{left:"calc("+a+"% - 12px)"}};return zi("div",{class:e.class+" slider option "+l,children:[e.label&&zi("div",{class:"label w-full flex justify-between gap-2 "+c,children:[zi("p",{children:e.label}),zi("p",{children:e.value.toFixed(2)})]}),zi("div",{class:"touch "+u+" "+l+" "+c+" "+s,ref:t,children:[zi("div",{class:"bg "+d+" "+l+" "+r+" "+i}),zi("div",{class:"bg-active "+d+" "+i,style:p.active}),zi("div",{class:"point "+e.pointClass,ref:n,style:p.point,children:e.children})]})]})}function ms(e){const t=Wr(),n=on((e=>e.dos.mouseSensitivity)),o=eo();return zi(vs,{class:e.class,label:t("mouse_sensitivity"),value:n,onChange:e=>o(ki.actions.mouseSensitivity(e))})}function _s(e){const t=Wr(),n=on((e=>e.dos.scaleControls)),o=eo();return zi(vs,{class:e.class,label:t("scale_controls"),value:n,onChange:e=>o(ki.actions.scaleControls(e))})}function ys(e){const t=Wr(),n=on((e=>e.dos.volume)),o=eo();return zi(vs,{class:e.class,label:t("volume"),value:n,onChange:e=>o(ki.actions.volume(e))})}const gs=48,bs=290,ws=291,xs=292,ks=293,Cs=294,Ss=295,Ps=296,Es=297,Os=298,Ms=299,js=300,As=301,Ds=320,Ts=321,Ls=322,Is=323,zs=324,Bs=325,Rs=326,Ns=327,Fs=328,Us=329,Ks=256,Hs=258,Vs=259,Ws=257,qs=342,Xs=341,Gs=340,$s=61,Ys=268,Js=266,Qs=261,Zs=269,ea=267,ta=263,na=265,oa=264,ra=262,ia={8:259,9:Hs,13:257,16:Gs,17:Xs,18:qs,19:284,27:256,32:32,33:266,34:267,35:269,36:268,37:263,38:265,39:262,40:264,45:260,46:Qs,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,59:59,64:61,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,93:93,96:320,97:321,98:322,99:323,100:324,101:325,102:326,103:327,104:328,105:329,106:332,111:331,112:290,113:291,114:292,115:293,116:294,117:295,118:296,119:297,120:298,121:299,122:300,123:301,144:282,145:281,173:45,186:59,187:61,188:44,189:45,190:46,191:47,192:96,219:91,220:92,221:93,222:39},sa={KBD_NONE:0,KBD_0:48,KBD_1:49,KBD_2:50,KBD_3:51,KBD_4:52,KBD_5:53,KBD_6:54,KBD_7:55,KBD_8:56,KBD_9:57,KBD_a:65,KBD_b:66,KBD_c:67,KBD_d:68,KBD_e:69,KBD_f:70,KBD_g:71,KBD_h:72,KBD_i:73,KBD_j:74,KBD_k:75,KBD_l:76,KBD_m:77,KBD_n:78,KBD_o:79,KBD_p:80,KBD_q:81,KBD_r:82,KBD_s:83,KBD_t:84,KBD_u:85,KBD_v:86,KBD_w:87,KBD_x:88,KBD_y:89,KBD_z:90,KBD_f1:290,KBD_f2:291,KBD_f3:292,KBD_f4:293,KBD_f5:294,KBD_f6:295,KBD_f7:296,KBD_f8:297,KBD_f9:298,KBD_f10:299,KBD_f11:300,KBD_f12:301,KBD_kp0:320,KBD_kp1:321,KBD_kp2:322,KBD_kp3:323,KBD_kp4:324,KBD_kp5:325,KBD_kp6:326,KBD_kp7:327,KBD_kp8:328,KBD_kp9:329,KBD_kpperiod:330,KBD_kpdivide:331,KBD_kpmultiply:332,KBD_kpminus:333,KBD_kpplus:334,KBD_kpenter:335,KBD_esc:256,KBD_tab:Hs,KBD_backspace:259,KBD_enter:257,KBD_space:32,KBD_leftalt:qs,KBD_rightalt:346,KBD_leftctrl:Xs,KBD_rightctrl:345,KBD_leftshift:Gs,KBD_rightshift:344,KBD_capslock:280,KBD_scrolllock:281,KBD_numlock:282,KBD_grave:96,KBD_minus:45,KBD_equals:61,KBD_backslash:92,KBD_leftbracket:91,KBD_rightbracket:93,KBD_semicolon:59,KBD_quote:39,KBD_period:46,KBD_comma:44,KBD_slash:47,KBD_printscreen:283,KBD_pause:284,KBD_insert:260,KBD_home:268,KBD_pageup:266,KBD_delete:Qs,KBD_end:269,KBD_pagedown:267,KBD_left:263,KBD_up:265,KBD_down:264,KBD_right:262,KBD_extra_lt_gt:348},aa={16:{1:Gs,2:344},17:{1:Xs,2:345},18:{1:qs,2:346}};function ca(e,t){var n;return(null==(n=aa[e])?void 0:n[t])??ia[e]??0}function la(e){return zi("div",{class:"settings-frame frame-root items-start pl-4",children:[zi(ts,{}),zi(Qi,{}),zi(Ji,{}),zi(Zi,{}),zi(es,{}),zi(ms,{class:"mt-4"}),zi(_s,{}),zi(ys,{}),zi(ua,{}),zi(us,{multiline:!0}),zi(ps,{multiline:!0}),zi(fs,{multiline:!0})]})}function ua(){const e=Wr(),t=hi();return zi("div",{class:"flex flex-col gap-2",children:[zi("label",{children:e("special_keys")}),zi("div",{class:"join",children:[zi("button",{class:"btn btn-sm btn-ghost join-item",onClick:()=>{var e;null==(e=t.ci)||e.simulateKeyPress(qs,Hs)},children:"Alt + Tab"}),zi("button",{class:"btn btn-sm btn-ghost join-item",onClick:()=>{var e;null==(e=t.ci)||e.simulateKeyPress(Xs,qs,Qs)},children:"Ctrl + Alt + Del"})]})]})}function da(){var e;const t=hi(),n=on((e=>e.dos.backend)),o=on((e=>e.dos.backendHardware))&&t.options.backendHardware,r=on((e=>e.dos.emuVersion)),i=on((e=>e.dos.ciStartedAt)),s=on((e=>e.dos.stats)),a=on((e=>e.dos.stats.cpuMetrics)),c=on((e=>e.dos.startIpxServer)),l=on((e=>e.dos.jspi)),u=eo(),d=Wr();return zi("div",{class:"stats-frame frame-root items-start px-4",children:[zi("div",{class:"text-center mb-2 text-xs",children:["js-dos/emu: ","8.4.1","/",r]}),zi("div",{class:"w-full overflow-x-auto",children:zi("table",{class:"table table-compact w-full",children:[zi("thead",{children:zi("tr",{children:[zi("th",{children:"Metric"}),zi("th",{children:"Value"})]})}),zi("tbody",{children:[zi("tr",{children:[zi("td",{children:"Emulation"}),zi("td",{children:n+" "+(o?"(WS)":"(WA)")+(l?" +JSPI":"")})]}),zi("tr",{children:[zi("td",{children:"Offscreen Canvas"}),zi("td",{children:s.offscreenCanvas?"Yes":"No"})]}),zi("tr",{children:[zi("td",{children:"Glide GL (3D)"}),zi("td",{children:s.glfx?"Yes":"No"})]}),zi("tr",{children:[zi("td",{children:"Uptime"}),zi("td",{children:[Math.round((Date.now()-i)/100)/10," s"]})]}),zi("tr",{children:[zi("td",{children:"Cycles"}),zi("td",{children:(null==a?void 0:a.cpuMax)??"???"})]}),zi("tr",{children:[zi("td",{children:"NonSkipSleep COUNT/s"}),zi("td",{children:s.nonSkippableSleepPreSec})]}),zi("tr",{children:[zi("td",{children:"Sleep COUNT/s"}),zi("td",{children:s.sleepPerSec})]}),zi("tr",{children:[zi("td",{children:"Sleep TIME/s"}),zi("td",{children:s.sleepTimePerSec})]}),zi("tr",{children:[zi("td",{children:"Msg FRAME/s"}),zi("td",{children:s.framePerSec})]}),zi("tr",{children:[zi("td",{children:"Msg SOUND/s"}),zi("td",{children:s.soundPerSec})]}),zi("tr",{children:[zi("td",{children:"Msg SENT/s"}),zi("td",{children:s.msgSentPerSec})]}),zi("tr",{children:[zi("td",{children:"Msg RECV/s"}),zi("td",{children:s.msgRecvPerSec})]}),zi("tr",{children:[zi("td",{children:"Net Id"}),zi("td",{children:[c&&zi("div",{class:"flex items-center gap-2 justify-between",children:[(null==(e=t.net)?void 0:e.peerId)??"-",zi("button",{class:"btn btn-sm btn-ghost btn-square",onClick:()=>{var e;navigator.clipboard.writeText(((null==(e=t.net)?void 0:e.peerId)??"-").toString()),u(Jr.actions.showToast({message:d("copied"),intent:"success"}))},children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-4",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75"})})})]}),!c&&zi("p",{children:"-"})]})]}),zi("tr",{children:[zi("td",{children:"Net SENT"}),zi("td",{children:[Math.round(s.netSent/1024*100)/100,"Kb"]})]}),zi("tr",{children:[zi("td",{children:"Net RECV"}),zi("td",{children:[Math.round(s.netRecv/1024*100)/100,"Kb"]})]}),s.driveIo.map(((e,t)=>zi(g,{children:[zi("tr",{children:[zi("td",{children:["HDD ",0==t?"C:":"D:"]}),zi("td",{children:[e.url.substring(e.url.lastIndexOf("/")+1)," -",Math.round(100*e.read/e.total),"%"]})]}),zi("tr",{children:[zi("td",{children:"Size"}),zi("td",{children:[Math.round(e.total/1024/1024)," Mb ",zi("br",{}),Math.round(e.write/1024)," Kb"]})]})]})))]})]})})]})}const pa=document.createElement("input");function fa(e){const t=()=>{pa.removeEventListener("change",t),e(pa)};pa.addEventListener("change",t),pa.click()}async function ha(e,t,n,o=!1,r=null){var i,s,a;const c=t.ci,l=null==(i=t.loadedBundle)?void 0:i.bundleChangesUrl;if(null===c&&null===r||!l||!e.ui.canSave)return!1;const u=function(e){return t=>e.i18n.keys[t]??t}(e);try{n(Jr.actions.showToast({message:u("saving_game"),intent:"none",long:!0}));let e=!0,i=!1;return null===r&&(i=!(null===(r=await c.persist(!0))||80===r[0]&&75===r[1]||o)),null!==r&&(i&&n(Jr.actions.showToast({message:u("sockdrive_save_in_the_middle"),intent:"warning",long:!0})),(null==(s=t.options.fsChanges)?void 0:s.push)?(await t.options.fsChanges.push(l,r),e=!1):!1!==(null==(a=t.options.fsChanges)?void 0:a.local)&&await async function(e,t){return ai(e,t,await ri(["saves"]))}(l,r)),null===r?n(Jr.actions.showToast({message:u("no_changes_to_save"),intent:"warning",long:!0})):e?setTimeout((()=>{n(Jr.actions.showToast({message:u("warn_save_locally"),intent:"success",long:!0}))}),i?3e3:4):n(Jr.actions.showToast({message:u("success_save"),intent:"success",long:!0})),!0}catch(d){return n(Jr.actions.showToast({message:u("unable_to_save"),intent:"error",long:!0})),console.error(d),!1}}function va(e,t,n){return e[n]=255&t,e[n+1]=(65280&t)>>8,e[n+2]=(16711680&t)>>16,e[n+3]=(4278190080&t)>>24,n+4}function ma(e,t){return 255&e[t]|e[t+1]<<8&65280|e[t+2]<<16&16711680|e[t+3]<<24&4278190080}function _a(e){e.sendBackendEvent({type:"wc-trigger-event",event:"hand_savestate"})}function ya(e){e.sendBackendEvent({type:"wc-trigger-event",event:"hand_loadstate"})}function ga(){const e=on((e=>e.dos.emuVersion));return zi("div",{class:"pre-run-window",children:[zi(xa,{}),zi(wa,{}),zi("span",{class:"mt-4 bottom-3 text-ellipsis overflow-hidden text-sm text-neutral-content/50",children:["js-","8.4.1","/emu-",e.substring(0,e.indexOf(" "))]})]})}function ba(){var e,t,n;const o=Wr(),r=hi(),[i,s]=ie(!1),a=null==(e=r.loadedBundle)?void 0:e.bundleUrl,c=null==(t=r.loadedBundle)?void 0:t.bundleChangesUrl,l=(null==(n=r.loadedBundle)?void 0:n.bundleChanges)??null,u=null!==l,d=Qn(),p=eo();if(null===a||null===c)return null;if(i)return zi("span",{class:"loading loading-spinner loading-md"});const f=zi("svg",{xmlns:"http://www.w3.org/2000/svg",style:"padding: 2px",viewBox:"0 0 16 16","enable-background":"new 0 0 16 16",fill:"currentColor",class:"w-4 h-4 ",children:zi("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.71,2.29l-2-2C13.53,0.11,13.28,0,13,0h-1v6H4V0H1C0.45,0,0,0.45,0,1v14 c0,0.55,0.45,1,1,1h14c0.55,0,1-0.45,1-1V3C16,2.72,15.89,2.47,15.71,2.29z M14,15H2V9c0-0.55,0.45-1,1-1h10c0.55,0,1,0.45,1,1V15 z M11,1H9v4h2V1z"})});if(u)return zi("div",{class:"flex flex-row items-baseline gap-1",children:[zi("p",{class:"text-accent",children:o("changes_loaded")}),zi("button",{class:"btn btn-ghost btn-xs text-accent underline self-center",onClick:()=>{Fi("changes.bin",l,"application/octet-stream")},children:[f,o("download")]}),zi("button",{class:"btn btn-ghost btn-xs underline -ml-2",onClick:()=>{window.confirm(o("delete_changes_confirm"))&&(s(!0),async function(e){const t=await ri(["saves"]),n=ui(e);try{await t.removeEntry(n,{recursive:!1})}catch{}}(c).then((async()=>{var e;(null==(e=r.options.fsChanges)?void 0:e.delete)&&c&&await r.options.fsChanges.delete(c),await Ai(a,d)})).catch((e=>{console.error(e),p(Jr.actions.showToast({message:o("error_deleting_changes"),intent:"error"}))})).finally((()=>s(!1))))},children:o("delete")})]});async function h(e){try{if(null===e.files||0===e.files.length)return;const t=e.files[0];await ha(d.getState(),r,p,!1,new Uint8Array(await t.arrayBuffer())),await Ai(a,d)}catch(t){console.error(t),p(Jr.actions.showToast({message:o("error_uploading_changes"),intent:"error"}))}finally{s(!1)}}return zi("div",{class:"flex flex-row items-baseline gap-1",children:[o("no_changes_loaded"),zi("button",{class:"btn btn-ghost btn-xs text-accent underline self-center",onClick:()=>{s(!0),fa(h)},children:[f,o("upload")]})]})}function wa(){var e,t;const n=hi(),o=null==(e=n.loadedBundle)?void 0:e.bundleUrl,r=null==(t=n.loadedBundle)?void 0:t.bundleChangesUrl;return on((e=>e.ui.kiosk))||null===o||null===r?null:zi("div",{class:"bg-base-200/80 mx-4 my-5 px-8 pt-4 pb-6 flex flex-col gap-2 items-center rounded-xl",children:zi("div",{class:"mt-4 flex flex-col items-center gap-2",children:zi(ba,{})})})}function xa(e){const t=on((e=>e.editor.configChanged)),n=on((e=>e.editor.bundleConfig)),o=on((e=>"none"!==e.ui.frame)),r=on((e=>e.ui.countDownStart)),i=on((e=>e.ui.autoStart)),s=on((e=>e.ui.editor)),[a,c]=ie(r),[l,u]=ie(i),d=hi(),p=eo(),f=Wr(),h=l&&!o&&!s;async function v(){var e;if(t){const t=n,r=null==(e=d.loadedBundle)?void 0:e.bundle;if(null===r||null===t||!ArrayBuffer.isView(r))throw new Error("Unexpected behaviour (internal state is broken), bundle is null");try{d.loadedBundle.bundle=await emulators.bundleUpdateConfig(r,t),p(ki.actions.bndPlay({}))}catch(o){p(ki.actions.bndError(o.message??"unexpected error"))}}else p(ki.actions.bndPlay({}))}return ae((()=>{if(r>0&&a>0&&h){const e=setTimeout((()=>{c(a-1)}),1e3);return()=>clearInterval(e)}0===a&&r>0&&h&&p(ki.actions.bndPlay({}))}),[a,r,h]),ae((()=>{u(i)}),[i]),!0===e.button?zi("div",{class:"btn btn-accent w-full sm:hidden",onClick:v,children:[zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-6 h-6",children:[zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.91 11.672a.375.375 0 010 .656l-5.603 3.113a.375.375 0 01-.557-.328V8.887c0-.286.307-.466.557-.327l5.603 3.112z"})]}),f("play")]}):zi("div",{class:e.class+" relative cursor-pointer w-1/4 h-1/4 min-w-48 min-h-48 max-w-96 max-h-96",children:[zi("div",{class:"relative",children:[zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-full h-full play-button",onClick:v,children:[zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.91 11.672a.375.375 0 010 .656l-5.603 3.113a.375.375 0 01-.557-.328V8.887c0-.286.307-.466.557-.327l5.603 3.112z"})]}),r>0&&h&&zi("div",{class:"absolute top-0 right-0 translate-x-1/2 w-12 h-12 opacity-90 cursor-pointer flex items-center justify-center text-2xl font-bold bg-primary text-primary-content rounded-full animate-pulse cound-down-start",onClick:()=>u(!1),children:[zi("div",{children:a}),zi("div",{children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-12",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})})]})]}),zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-10 h-10 absolute right-0 bottom-0 cursor-pointer"+(o?" sidebar-highlight":""),onClick:e=>{p(o?Jr.actions.frameNone():Jr.actions.framePreRun()),e.stopPropagation()},children:[zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"}),zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})]})}function ka(e){return zi("div",{class:"prerun-frame frame-root items-start pl-4",children:[zi(xa,{button:!0}),zi(Qi,{}),zi(Ji,{}),zi(Zi,{}),zi(es,{}),zi(ms,{class:"mt-4"}),zi(_s,{}),zi(ys,{}),zi(cs,{multiline:!0}),zi(ns,{}),zi(os,{}),zi(rs,{}),zi("div",{class:"h-4"}),zi(is,{}),zi(Ca,{}),zi("div",{class:"h-4"}),zi(ls,{multiline:!0}),zi(us,{multiline:!0}),zi(ss,{}),zi(Yi,{}),zi(ds,{multiline:!0}),zi(fs,{multiline:!0})]})}function Ca(){const e=eo(),t=on((e=>e.dos.connectIpxAddress));return zi("div",{class:"flex flex-col mt-4 gap-2",children:[zi("div",{children:"IPX Address"}),zi("input",{type:"text",class:"input input-bordered",value:t??"",onChange:t=>e(ki.actions.connectIpxAddress(t.target.value))})]})}pa.type="file";const Sa=50,Pa=250;function Ea(){const e=eo(),[t,n]=ie(null),o=on((e=>e.dos.stats.cpuMetrics)),r=on((e=>e.dos.fastForward)),i=on((e=>e.dos.frameSkip)),s=on((e=>e.dos.cpuAuto)),a=on((e=>e.dos.cycles)),c=on((e=>e.dos.speed));if(ae((()=>{o&&n(o)}),[o]),!t)return null;const l=t.ratio.reduce(((e,t)=>e+t),0)/t.ratio.length,u=t.newCmax.reduce(((e,t)=>e+t),0)/t.newCmax.length,d=t.ticksDone.reduce(((e,t)=>e+t),0)/t.ticksDone.length,p=t.ticksScheduled.reduce(((e,t)=>e+t),0)/t.ticksScheduled.length,f=d/p,h=!(s&&t.cpuAuto);return zi("div",{class:"turbo-frame frame-root items-start px-4",children:zi("div",{class:"flex flex-col gap-4 w-full text-sm",children:[t.emulatorSpeed>0&&zi("div",{class:"flex flex-col gap-2 mb-8",children:[zi("p",{children:"Speed"}),zi("input",{type:"range",min:Sa,max:Pa,value:c,step:5,class:"range range-sm "+(h?"opacity-20":""),onChange:t=>e(ki.actions.speed(Number(t.target.value))),disabled:h}),zi("div",{class:"flex justify-between px-2.5 mt-2 text-xs",children:[zi("span",{children:"|"}),zi("span",{children:"|"}),zi("span",{children:"|"}),zi("span",{children:"|"}),zi("span",{children:"|"})]}),zi("div",{class:"flex justify-between px-2.5 mt-2 text-xs",children:[zi("span",{children:[Sa,"%"]}),zi("span",{children:[Math.round(100),"%"]}),zi("span",{children:[Math.round(150),"%"]}),zi("span",{children:[Math.round(200),"%"]}),zi("span",{children:[Pa,"%"]})]})]}),!s&&zi("div",{class:"flex flex-row gap-2 items-center justify-between",children:[zi("p",{children:"Cycles"}),zi("input",{type:"text",class:"input input-sm",value:a,onChange:t=>e(ki.actions.cycles(t.target.value))})]}),zi("div",{class:"grid2",children:[zi("div",{class:"value",children:[zi("p",{children:"Speed"}),zi("p",{children:[t.emulatorSpeed>0?Math.round(100*t.emulatorSpeed):"100","%"]})]}),zi("div",{class:"value",children:[zi("p",{children:"Fast Forward"}),zi("input",{type:"radio",class:"radio radio-sm "+(t.fastForward?"radio-accent":""),checked:r,onClick:()=>e(ki.actions.fastForward(!r))})]}),zi("div",{class:"value",children:[zi("p",{children:"Frame Skip"}),zi("input",{type:"radio",class:"radio radio-sm "+(t.frameSkip>0?"radio-accent":""),checked:i>0,onClick:()=>e(ki.actions.frameSkip(i>0?0:2))})]}),zi("div",{class:"value",children:[zi("p",{children:"Auto Adjust"}),zi("input",{type:"radio",class:"radio radio-sm "+(t.cpuAuto?"radio-accent":""),checked:s,disabled:!1,onClick:()=>{e(ki.actions.cpuAuto(!s)),s&&(e(ki.actions.speed(100)),e(ki.actions.cycles(a)))}})]})]}),zi("div",{class:"grid2",children:[zi("div",{class:"value",children:[zi("p",{children:"Cycles"}),zi("p",{children:Math.round(t.cpuMax)})]}),zi("div",{class:"value",children:[zi("p",{children:"CPU Load"}),zi("p",{children:[Math.round(100*f),"%"]})]})]}),zi("div",{class:"grid2",children:[zi("div",{class:"value",children:[zi("p",{children:"Sockdrive"}),zi("input",{type:"radio",class:"radio radio-sm "+(t.cpuSockdrive?"radio-error":""),checked:t.cpuSockdrive,disabled:!0})]}),zi("div",{class:"value",children:[zi("p",{children:"Auto skip"}),zi("input",{type:"radio",class:"radio radio-sm "+(t.cpuSkip?"radio-accent":""),checked:t.cpuSkip,disabled:!0})]}),zi("div",{}),zi("div",{class:"value",children:[zi("p",{children:"CPU Used"}),zi("p",{children:[Math.round(100*t.cpuUsed),"%"]})]})]}),zi("div",{class:"grid2",children:[zi("div",{class:"value",children:[zi("p",{children:"Ratio"}),zi("p",{children:l.toFixed(2)})]}),zi("div",{class:"value",children:[zi("p",{children:"Cmax"}),zi("p",{children:Math.round(u)})]}),zi("div",{class:"value",children:[zi("p",{children:"Scheduled"}),zi("p",{children:Math.round(p)})]}),zi("div",{class:"value",children:[zi("p",{children:"Done"}),zi("p",{children:Math.round(d)})]})]}),zi("p",{class:"text-sm",children:"Sleep pattern"}),zi("div",{class:"rounded-box bg-base-200 p-4 w-full h-24",children:zi("p",{class:"text-micro overflow-y-hidden",children:t.sleepPattern.substring(0,256)})})]})})}function Oa(e){const t=on((e=>e.ui.frame)),n=on((e=>e.ui.frameXs)),o=on((e=>e.ui.wideScreen));return"none"===t?null:zi("div",{class:"frame "+(n?" frame-xs ":"")+(n||o?"":" frame-md"),children:["settings"===t&&zi(la,{}),"editor-conf"===t&&zi(Bi,{}),"editor-fs"===t&&zi(Ui,{}),"stats"===t&&zi(da,{}),"prerun"===t&&zi(ka,{}),"turbo"===t&&zi(Ea,{})]})}function Ma(e,t){(async()=>{const n=t.getState().ui.softFullscreen,o=fi(t),r=o.root;e?n?r.classList.add("jsdos-fullscreen-workaround"):r.requestFullscreen?await r.requestFullscreen():r.webkitRequestFullscreen?await r.webkitRequestFullscreen():r.mozRequestFullScreen?await r.mozRequestFullScreen():r.msRequestFullscreen?await r.msRequestFullscreen():r.webkitEnterFullscreen?await r.webkitEnterFullscreen():r.classList.add("jsdos-fullscreen-workaround"):r.classList.contains("jsdos-fullscreen-workaround")?r.classList.remove("jsdos-fullscreen-workaround"):document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen&&document.msExitFullscreen(),t.dispatch(Jr.actions.setFullScreen(e)),vi(o,"fullscreen-change",e)})().catch((e=>{console.error("Can't enter fullscreen",e)}))}function ja(e){const t=on((e=>e.ui.fullScreen)),n=Qn();return zi("div",{class:"fullscreen-button sidebar-button "+e.class,onClick:function(){Ma(!t,n)},children:zi("div",{class:"w-full h-full scale-75 hover:scale-90",children:[!t&&zi("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 16 16",fill:"currentColor",stroke:"none","enable-background":"new 0 0 16 16",children:zi("g",{children:zi("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M5.99,8.99c-0.28,0-0.53,0.11-0.71,0.29l-3.29,3.29v-1.59c0-0.55-0.45-1-1-1 s-1,0.45-1,1v4c0,0.55,0.45,1,1,1h4c0.55,0,1-0.45,1-1s-0.45-1-1-1H3.41L6.7,10.7c0.18-0.18,0.29-0.43,0.29-0.71 C6.99,9.44,6.54,8.99,5.99,8.99z M14.99-0.01h-4c-0.55,0-1,0.45-1,1s0.45,1,1,1h1.59L9.28,5.29C9.1,5.47,8.99,5.72,8.99,5.99 c0,0.55,0.45,1,1,1c0.28,0,0.53-0.11,0.71-0.29l3.29-3.29v1.59c0,0.55,0.45,1,1,1s1-0.45,1-1v-4C15.99,0.44,15.54-0.01,14.99-0.01 z"})})}),t&&zi("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 16 16",fill:"currentColor",stroke:"none","enable-background":"new 0 0 16 16",children:zi("g",{children:zi("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.99,0.99c0-0.55-0.45-1-1-1c-0.28,0-0.53,0.11-0.71,0.29l-3.29,3.29V1.99 c0-0.55-0.45-1-1-1s-1,0.45-1,1v4c0,0.55,0.45,1,1,1h4c0.55,0,1-0.45,1-1s-0.45-1-1-1h-1.59L15.7,1.7 C15.88,1.52,15.99,1.27,15.99,0.99z M5.99,8.99h-4c-0.55,0-1,0.45-1,1s0.45,1,1,1h1.59l-3.29,3.29c-0.18,0.18-0.29,0.43-0.29,0.71 c0,0.55,0.45,1,1,1c0.28,0,0.53-0.11,0.71-0.29l3.29-3.29v1.59c0,0.55,0.45,1,1,1s1-0.45,1-1v-4C6.99,9.44,6.54,8.99,5.99,8.99z"})})})]})})}function Aa(e){return zi(Ba,{class:e.class,frame:"editor-conf",action:Jr.actions.frameConf(),children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-full h-full",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})})}function Da(e){return zi(Ba,{class:e.class,frame:"editor-fs",action:Jr.actions.frameFs(),children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-full h-full",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21.75 17.25v-.228a4.5 4.5 0 00-.12-1.03l-2.268-9.64a3.375 3.375 0 00-3.285-2.602H7.923a3.375 3.375 0 00-3.285 2.602l-2.268 9.64a4.5 4.5 0 00-.12 1.03v.228m19.5 0a3 3 0 01-3 3H5.25a3 3 0 01-3-3m19.5 0a3 3 0 00-3-3H5.25a3 3 0 00-3 3m16.5 0h.008v.008h-.008v-.008zm-3 0h.008v.008h-.008v-.008z"})})})}function Ta(e){const t=on((e=>e.ui.window)),n=on((e=>e.opfs.freeSpace)),o="number"==typeof n?li(n):null;return zi(g,{children:[o&&zi("div",{class:"text-xs flex flex-row gap-0 items-end",children:[zi("span",{class:n<1073741824?"text-error animate-pulse":n<2147483648?"text-warning":"",children:o[0]}),zi("span",{class:"opacity-50",children:o[1]})]}),zi(Ba,{class:e.class+t==="file-explorer"?" sidebar-highlight":"",frame:"editor-fs",action:Jr.actions.toggleFileExplorer(),children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-full h-full",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21.75 17.25v-.228a4.5 4.5 0 00-.12-1.03l-2.268-9.64a3.375 3.375 0 00-3.285-2.602H7.923a3.375 3.375 0 00-3.285 2.602l-2.268 9.64a4.5 4.5 0 00-.12 1.03v.228m19.5 0a3 3 0 01-3 3H5.25a3 3 0 01-3-3m19.5 0a3 3 0 00-3-3H5.25a3 3 0 00-3 3m16.5 0h.008v.008h-.008v-.008zm-3 0h.008v.008h-.008v-.008z"})})})]})}function La(){const e=on((e=>e.dos.stats.cpuMetrics));let t=1;return e&&e.ticksDone.length>0&&(t=e.ticksDone.reduce(((e,t)=>e+t),0)/e.ticksScheduled.reduce(((e,t)=>e+t),0)),zi(Ba,{class:"cycles",frame:"stats",action:Jr.actions.frameStats(),children:zi("span",{children:[Math.round(100*t),"%"]})})}function Ia(e){const t=Qn(),n=le(null),[o]=ie({recv:0,enabled:!1,delayLedTo:0});ae((()=>{if(n.current){const e=n.current;e.classList.add("bg-base-300");const r=setInterval((()=>{if(o.delayLedTo<=Date.now()){const n=mi(t).dos.stats.msgSentPerSec,r=o.recv!==n;r!==o.enabled&&(e.classList.remove("bg-base-300","bg-green-300","animate-led"),r?e.classList.add("bg-green-300","animate-led"):e.classList.add("bg-base-300"),o.enabled=r),o.delayLedTo=r?Date.now()+300+1500*Math.random():0,o.recv=n}}),150);return()=>{e.classList.remove("bg-base-300","bg-green-300","animate-led"),clearInterval(r)}}}),[n,o]);const[r,i]=ie(!1),[s,a]=ie({recv:0,timeoutId:null}),c=on((e=>e.dos.stats.msgRecvPerSec));if(s.recv!==c){r||i(!0),s.timeoutId&&clearTimeout(s.timeoutId);const e=setTimeout((()=>{i(!1),a({recv:c,timeoutId:null})}),1e3);a({recv:c,timeoutId:e})}return zi("div",{ref:n,class:"self-end mr-2 -mt-3 w-2 h-1"})}function za(e){return zi(Ba,{class:e.class,action:Jr.actions.frameSettings(),frame:"settings",children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-full h-full",children:[zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"}),zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})}function Ba(e){const t=on((e=>e.ui.frame))===e.frame,n=eo();return zi("div",{class:"sidebar-button "+(t?"sidebar-highlight ":"")+e.class,onClick:function(){n(t?Jr.actions.frameNone():e.action)},children:e.children})}function Ra(e){const t=on((e=>e.dos.softKeyboard)),n=eo();return zi("div",{class:"sidebar-button "+(t?"sidebar-highlight ":"")+e.class,onClick:()=>n(ki.actions.softKeyboard(!t)),children:zi("svg",{class:"w-full h-full",fill:"currentColor",stroke:"currentColor",version:"1.1",id:"Layer_1",viewBox:"0 0 507.9 507.9",children:[zi("g",{id:"SVGRepo_bgCarrier","stroke-width":"0"}),zi("g",{id:"SVGRepo_tracerCarrier","stroke-linecap":"round","stroke-linejoin":"round"}),zi("g",{id:"SVGRepo_iconCarrier",children:[" ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M465.7,140.75H268.1v-77.3c0-7.8-6.3-14.1-14.1-14.1c-7.8,0-14.1,6.3-14.1,14.1v77.3H42.3c-23.3,0-42.3,19-42.3,42.3 v233.2c0,23.3,19,42.3,42.3,42.3h423.3c23.3,0,42.3-19,42.3-42.3v-233.2C508,159.75,489,140.75,465.7,140.75z M465.7,430.35H42.3 c-7.8,0-14.1-6.3-14.1-14.1v-233.2c0-7.8,6.3-14.1,14.1-14.1h423.3c7.8,0,14.1,6.3,14.1,14.1v233.2h0.1 C479.8,424.05,473.5,430.35,465.7,430.35z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M440.6,194.05h-85.4c-7.8,0-14.1,6.3-14.1,14.1s6.3,14.1,14.1,14.1h85.4c7.8,0,14.1-6.3,14.1-14.1 C454.7,200.35,448.4,194.05,440.6,194.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M80.9,377.05H67.4c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C95,383.35,88.7,377.05,80.9,377.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M303.3,377.05H141.6c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h161.8c7.8,0,14.1-6.3,14.1-14.1 C317.5,383.35,311.1,377.05,303.3,377.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M80.9,255.05H67.4c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C95.1,261.35,88.7,255.05,80.9,255.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M152.8,255.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.4,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C166.9,261.35,160.6,255.05,152.8,255.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M224.8,255.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C238.9,261.35,232.6,255.05,224.8,255.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M296.7,255.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C310.8,261.35,304.5,255.05,296.7,255.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M80.9,194.05H67.4c-7.8,0-14.1,6.3-14.1,14.1s6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C95.1,200.35,88.7,194.05,80.9,194.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M152.8,194.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.4,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C166.9,200.35,160.6,194.05,152.8,194.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M224.8,194.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C238.9,200.35,232.6,194.05,224.8,194.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M296.7,194.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C310.8,200.35,304.5,194.05,296.7,194.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M368.7,255.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C382.8,261.35,376.4,255.05,368.7,255.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M440.6,255.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C454.7,261.35,448.4,255.05,440.6,255.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M368.7,316.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C382.8,322.35,376.4,316.05,368.7,316.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M440.6,316.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C454.7,322.35,448.4,316.05,440.6,316.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M368.7,377.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C382.8,383.35,376.4,377.05,368.7,377.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M440.6,377.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C454.7,383.35,448.4,377.05,440.6,377.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M80.9,316.05H67.4c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C95.1,322.35,88.7,316.05,80.9,316.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M152.8,316.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.4,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C166.9,322.35,160.6,316.05,152.8,316.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M224.8,316.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C238.9,322.35,232.6,316.05,224.8,316.05z"})," "]})," "]})," ",zi("g",{children:[" ",zi("g",{children:[" ",zi("path",{d:"M296.7,316.05h-13.5c-7.8,0-14.1,6.3-14.1,14.1c0,7.8,6.3,14.1,14.1,14.1h13.5c7.8,0,14.1-6.3,14.1-14.1 C310.8,322.35,304.5,316.05,296.7,316.05z"})," "]})," "]})," "]})]})})}function Na(e){return zi(Ba,{class:e.class,frame:"prerun",action:Jr.actions.framePreRun(),children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-full h-full",children:[zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"}),zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})}function Fa(){const e="turbo"===on((e=>e.ui.frame)),t=on((e=>e.dos.cpuAuto)),n=on((e=>e.dos.speed)),o=on((e=>e.dos.fastForward)),r=on((e=>e.dos.frameSkip)),i=!1===t||100!==n||o||r>0,s=eo();return zi("div",{class:"sidebar-button turbo flex flex-col items-center justify-center "+(e?"sidebar-highlight ":"")+(i?" used":""),onClick:()=>s(e?Jr.actions.frameNone():Jr.actions.frameTurbo()),children:zi("p",{class:"font-mono text-micro mt-1",children:"TURBO"})})}function Ua(e){return zi("svg",{xmlns:"http://www.w3.org/2000/svg",style:"padding: 2px",viewBox:"0 0 16 16","enable-background":"new 0 0 16 16",fill:"currentColor",class:"w-full h-full rounded-lg "+e.class,children:zi("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.71,2.29l-2-2C13.53,0.11,13.28,0,13,0h-1v6H4V0H1C0.45,0,0,0.45,0,1v14 c0,0.55,0.45,1,1,1h14c0.55,0,1-0.45,1-1V3C16,2.72,15.89,2.47,15.71,2.29z M14,15H2V9c0-0.55,0.45-1,1-1h10c0.55,0,1,0.45,1,1V15 z M11,1H9v4h2V1z"})})}function Ka(){const e=on((e=>e.ui.haveQuickSave)),t="dosboxX"===on((e=>e.dos.backend));return zi("div",{class:"save-buttons flex flex-col justify-center items-center -my-2",children:[zi(Wa,{}),t&&zi(Ha,{label:"X",bgcolor:"bg-primary",textcolor:"text-primary-content"}),t&&e&&zi(Va,{label:"X",bgcolor:"bg-primary"})]})}function Ha(e){const t=hi(),n=eo();return zi("div",{class:"sidebar-button flex justify-center",onClick:function(){const e=t.ci;null!==e&&(_a(e),n(Jr.actions.setHaveQuickSave(!0)))},children:[zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"absolute left-0 bottom-0 w-6 h-6 opacity-30",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"})}),zi("p",{class:"absolute top-0 right-0 font-bold",children:"F6"})]})}function Va(e){const t=hi();return zi("div",{class:"sidebar-button flex justify-center",onClick:function(){const e=t.ci;null!==e&&ya(e)},children:[zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"absolute left-0 bottom-0 w-6 h-6 -scale-y-100 opacity-30",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m15 15 6-6m0 0-6-6m6 6H9a6 6 0 0 0 0 12h3"})}),zi("p",{class:"absolute top-0 right-0 font-bold",children:"F7"})]})}function Wa(e){const[t,n]=ie(!1),o=eo(),r=on((e=>e.ui.canSave)),i=hi(),s=Qn();if(!r||null===i.loadedBundle||null===i.loadedBundle.bundleChangesUrl)return null;return zi("div",{class:"save-button sidebar-button overflow-hidden "+(t?" sidebar-highlight ":"")+e.class,onClick:function(){t||(n(!0),ha(mi(s),i,o).finally((()=>n(!1))))},children:zi("div",{class:"w-full h-full flex justify-center",children:[zi(Ua,{}),t&&zi("div",{class:"sidebar-badge"})]})})}function qa(e){const t=on((e=>e.ui.window)),n=on((e=>e.ui.editor)),o=on((e=>e.ui.kiosk)),r="none"!==on((e=>e.ui.frame)),i=on((e=>e.dos.mouseCapture)),s=on((e=>e.ui.thinSidebar)),a=eo();return o?"run"===t&&i?zi(Xa,{class:"h-full"}):null:zi("div",s?{class:"sidebar-thin",children:[zi("div",{class:"cursor-pointer hover:bg-base-100 w-full h-full flex flex-col items-center justify-center gap-1",onClick:()=>{a(Jr.actions.thinSidebar(!1))},children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-4 h-4",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"})})}),!r&&"run"===t&&i&&zi(Xa,{})]}:{class:"sidebar",children:["run"===t&&zi(Ka,{}),"run"===t&&zi(Ra,{}),n&&"prerun"===t&&zi(Aa,{}),n&&"run"===t&&zi(Da,{}),zi("div",{class:"contentbar"}),"run"===t&&zi(ja,{}),"run"===t&&zi(Fa,{}),"run"===t&&zi(La,{}),"run"===t&&zi(Ia,{}),("prerun"===t||"file-explorer"===t)&&zi(Ta,{}),("prerun"===t||"select"===t||"file-explorer"===t)&&zi(Na,{}),"run"===t&&zi(za,{}),!r&&"run"===t&&i&&zi(Xa,{})]})}function Xa(e){const t=on((e=>e.dos.mouseSensitivity)),n=eo();return zi("div",{class:"sidebar-slider "+e.class,children:zi(vs,{bgClass:"bg-base-300",vertical:!0,label:"",value:t,onChange:e=>{n(ki.actions.mouseSensitivity(e))},children:zi("svg",{class:"w-6 h-6",viewBox:"0 0 24 24",stroke:"currentColor",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:zi("path",{d:"M12 9V7M12 21C8.68629 21 6 18.3137 6 15V9C6 5.68629 8.68629 3 12 3C15.3137 3 18 5.68629 18 9V15C18 18.3137 15.3137 21 12 21Z","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})})})})}function Ga(e,t,n,o){const r=e.parentElement.getBoundingClientRect(),i=r.width,s=r.height;if(0===n)return;const a=65535===o?i/s:o??t/n;let c=i,l=i/a;l>s&&(l=s,c=s*a),e.style.position="relative",e.style.top=(s-l)/2+"px",e.style.left=(i-c)/2+"px",e.style.width=c+"px",e.style.height=l+"px"}function $a(e,t,n,o){const r=n.gl??e.getContext("webgl");if(null===r)throw new Error("Unable to create webgl context on given canvas");n.gl=r;const i=function(e,t,n){const o=Ya(e,e.VERTEX_SHADER,t),r=Ya(e,e.FRAGMENT_SHADER,n),i=e.createProgram();if(e.attachShader(i,o),e.attachShader(i,r),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))throw new Error("Unable to initialize the shader program: "+e.getProgramInfoLog(i));return i}(r,"\nattribute vec4 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nvarying highp vec2 vTextureCoord;\n\nvoid main(void) {\n gl_Position = aVertexPosition;\n vTextureCoord = aTextureCoord;\n}\n","\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\n\nvoid main(void) {\n highp vec4 color = texture2D(uSampler, vTextureCoord);\n gl_FragColor = vec4(color.r, color.g, color.b, 1.0);\n}\n"),s=r.getAttribLocation(i,"aVertexPosition"),a=r.getAttribLocation(i,"aTextureCoord"),c=r.getUniformLocation(i,"uSampler");!function(e,t,n){const o=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,o);const r=[-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0];e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW),e.vertexAttribPointer(t,3,e.FLOAT,!1,0,0),e.enableVertexAttribArray(t);const i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i);const s=[0,1,1,1,1,0,0,1,1,0,0,0];e.bufferData(e.ARRAY_BUFFER,new Float32Array(s),e.STATIC_DRAW),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(n)}(r,s,a);const l=r.createTexture();r.bindTexture(r.TEXTURE_2D,l),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR);const u=new Uint8Array([0,0,0]);r.texImage2D(r.TEXTURE_2D,0,r.RGB,1,1,0,r.RGB,r.UNSIGNED_BYTE,u),r.useProgram(i),r.activeTexture(r.TEXTURE0),r.uniform1i(c,0);let d=0,p=0,f=null,h=null,v=0;const m=()=>{null!==h&&(r.texImage2D(r.TEXTURE_2D,0,v,d,p,0,v,r.UNSIGNED_BYTE,h),h=null),r.drawArrays(r.TRIANGLES,0,6),f=null},_=()=>{Ga(e,d,p,o)},y=(t,n)=>{d=t,p=n,e.width=d,e.height=p,h=null,r.viewport(0,0,d,p),_()};t.events().onFrameSize(y),t.events().onFrame(((e,t)=>{h=null!=e?e:t,v=null!=e?r.RGB:r.RGBA,null===f&&(f=requestAnimationFrame(m))})),y(t.width(),t.height());const g=new ResizeObserver(_);return g.observe(e.parentElement),window.addEventListener("resize",_),()=>{n.gl=null,t.events().onFrameSize((()=>{})),t.events().onFrame((()=>{})),g.disconnect(),window.removeEventListener("resize",_)}}function Ya(e,t,n){const o=e.createShader(t);if(e.shaderSource(o,n),e.compileShader(o),!e.getShaderParameter(o,e.COMPILE_STATUS)){const t=e.getShaderInfoLog(o);throw e.deleteShader(o),new Error("An error occurred compiling the shaders: "+t)}return o}function Ja(e,t,n){const o=e.getContext("2d");if(null===o)throw new Error("Unable to create 2d context on given canvas");let r=0,i=0;const s=()=>{Ga(e,r,i,n)};let a=new Uint8ClampedArray(0);const c=(t,n)=>{r=t,i=n,e.width=r,e.height=i,a=new Uint8ClampedArray(t*n*4),s()};t.events().onFrameSize(c),t.events().onFrame(((e,t)=>{if(null===e&&null===t)return;const n=null!==e?e:t;let s=0,c=0;for(;c<a.length;)a[c++]=n[s++],a[c++]=n[s++],a[c++]=n[s++],a[c++]=255,n.length===a.length&&s++;o.putImageData(new ImageData(a,r,i),0,0)})),c(t.width(),t.height());const l=new ResizeObserver(s);return l.observe(e.parentElement),window.addEventListener("resize",s),()=>{t.events().onFrameSize((()=>{})),t.events().onFrame((()=>{})),l.disconnect(),window.removeEventListener("resize",s)}}class Qa{constructor(){t(this,"samplesQueue",[])}push(e){this.samplesQueue.push(e)}length(){let e=0;for(const t of this.samplesQueue)e+=t.length;return e}writeTo(e,t){let n=0;for(;this.samplesQueue.length>0;){const o=this.samplesQueue[0],r=Math.min(t-n,o.length);if(r===o.length?(e.set(o,n),this.samplesQueue.shift()):(e.set(o.slice(0,r),n),this.samplesQueue[0]=o.slice(r)),n+=r,n===t)break}n<t&&e.fill(0,n)}}const Za=/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion)||/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.userAgent)||/MacIntel/.test(navigator.platform)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2;const ec={};function tc(e,t,n,o){const r=function(e){if(e.type.match(/^touch/)){const n=e,o=t.getBoundingClientRect();return{id:"touch-"+n.targetTouches[0].identifier,x:n.targetTouches[0].clientX-o.x,y:n.targetTouches[0].clientY-o.y,mX:0,mY:0}}if(e.type.match(/^pointer/)){const t=e;return{id:"pointer-"+t.pointerId,x:t.offsetX,y:t.offsetY,mX:t.movementX,mY:t.movementY,button:0===t.button?0:1}}{const t=e;return{id:"mouse",x:t.offsetX,y:t.offsetY,mX:t.movementX,mY:t.movementY,button:0===t.button?0:1}}}(e);return o||(ec[r.id]?(r.mX=r.x-ec[r.id].x,r.mY=r.y-ec[r.id].y):(r.mX=0,r.mY=0)),ec[r.id]={x:r.x,y:r.y},r.mX=oc(r.mX,n),r.mY=oc(r.mY,n),r}const nc=function(){const e=Za&&!!("ontouchstart"in window),t=!!window.PointerEvent,n=!!window.MSPointerEvent;let o=!Za;const r=[],i=[],s=[],a=[],c=[];return t?(r.push("pointerdown"),s.push("pointerup","pointercancel"),i.push("pointermove"),c.push("touchstart","touchmove","touchend")):n?(r.push("MSPointerDown"),i.push("MSPointerMove"),s.push("MSPointerUp")):e?(o=!1,r.push("touchstart","mousedown"),i.push("touchmove"),s.push("touchend","touchcancel","mouseup")):(r.push("mousedown"),i.push("mousemove"),s.push("mouseup"),a.push("mouseleave")),{mobile:Za,canLock:o,starters:r,changers:i,enders:s,prevents:c,leavers:a}}();function oc(e,t){e>50?e=50:e<-50&&(e=-50);return e*=Math.pow(8,2*t-1)}function rc(e,t,n,o,r,i,s){const a=r=>{if(r.target!==e)return;const i=tc(r,e,t,n);o(i.x,i.y,i.button),r.stopPropagation()},c=o=>{if(o.target!==e)return;const i=tc(o,e,t,n);r(i.x,i.y,i.mX,i.mY),o.stopPropagation()},l=o=>{const r=tc(o,e,t,n);i(r.x,r.y,r.button),o.stopPropagation()},u=o=>{if(o.target!==e)return;const r=tc(o,e,t,n);s(r.x,r.y),o.stopPropagation()},d=e=>{e.stopPropagation()},p={capture:!1};for(const f of nc.starters)e.addEventListener(f,a,p);for(const f of nc.changers)e.addEventListener(f,c,p);for(const f of nc.enders)e.addEventListener(f,l,p);for(const f of nc.prevents)e.addEventListener(f,d,p);for(const f of nc.leavers)e.addEventListener(f,u,p);return()=>{for(const t of nc.starters)e.removeEventListener(t,a,p);for(const t of nc.changers)e.removeEventListener(t,c,p);for(const t of nc.enders)e.removeEventListener(t,l,p);for(const t of nc.prevents)e.removeEventListener(t,d,p);for(const t of nc.leavers)e.removeEventListener(t,u,p)}}const ic=.01;function sc(e,t,n){const o=(e,o)=>function(e,t,n,o){const{width:r,height:i}=n.getBoundingClientRect(),s=o.width(),a=o.height(),c=s/a;let l=r,u=r/c;u>i&&(u=i,l=i*c);const d=(i-u)/2,p=(r-l)/2;let f=Math.max(0,Math.min(1,(e-p)/l)),h=Math.max(0,Math.min(1,(t-d)/u));f<=ic&&(f=0);f>=.99&&(f=1);h<=ic&&(h=0);h>=.99&&(h=1);return{x:f,y:h}}(e,o,t,n);return document.pointerLockElement===t&&document.exitPointerLock(),rc(t,0,!1,(function(t,r,i){const s=o(t,r);n.sendMouseMotion(s.x,s.y),n.sendMouseButton(i??e,!0)}),(function(e,t,r,i){const s=o(e,t);n.sendMouseMotion(s.x,s.y)}),(function(t,r,i){const s=o(t,r);n.sendMouseMotion(s.x,s.y),n.sendMouseButton(i??e,!1)}),(function(e,t){const r=o(e,t);n.sendMouseMotion(r.x,r.y)}))}function ac(e,t,n,o,r){let i=-1,s=0,a=0,c=0;return rc(o,e,t,((e,t,n)=>{i=Date.now(),s=0,a=e,c=t,void 0!==n&&r.sendMouseButton(n,!0)}),(function(e,t,n,o){void 0===n&&(n=e-a),void 0===o&&(o=t-c),a=e,c=t,0===n&&0===o||(s+=Math.abs(n)+Math.abs(o),r.sendMouseRelativeMotion(n,o))}),((e,t,o)=>{if(void 0!==o)r.sendMouseButton(o,!1);else{if(Date.now()-i<500&&s<50){const e=o??n;r.sendMouseButton(e,!0),setTimeout((()=>r.sendMouseButton(e,!1)),60)}}}),(()=>{}))}function cc(e,t,n,o,r){if(e&&!nc.canLock)return ac(t,!1,n,o,r);if(e){const e=function(e){async function t(){if(document.pointerLockElement===e);else try{await e.requestPointerLock({unadjustedMovement:!0})}catch(t){console.warn("Failed to request pointer lock with unadjusted movement, falling back to default"),await e.requestPointerLock()}}const n={capture:!0};for(const o of nc.starters)e.addEventListener(o,t,n);return()=>{for(const o of nc.starters)e.removeEventListener(o,t,n)}}(o),i=ac(t,!0,n,o,r);return()=>{i(),e()}}return sc(n,o,r)}function lc(e,t){const n=document.createElement("div");return n.className=e,void 0!==t&&(n.innerHTML=t),n}class uc{constructor(e,n,o,r){t(this,"options"),t(this,"root"),t(this,"canvas"),t(this,"mouseOverlay"),t(this,"width"),t(this,"height"),t(this,"keyboardVisible",!1),t(this,"pointerLock",!1),t(this,"pointerDisabled",!1),t(this,"pointerButton",0),t(this,"toggleKeyboard"),t(this,"onResize"),t(this,"onKeyDown"),t(this,"onKeyUp"),t(this,"onKeyPress"),t(this,"onKeysPress"),this.toggleKeyboard=o,this.options=r,this.root=e,this.root.classList.add("emulator-root"),this.canvas=n,this.canvas.className="emulator-canvas",this.mouseOverlay=lc("emulator-mouse-overlay",""),this.root.appendChild(this.mouseOverlay),this.width=e.offsetWidth,this.height=e.offsetHeight,this.onResize=[],this.onKeyDown=()=>{},this.onKeyUp=()=>{},this.onKeyPress=()=>{},this.onKeysPress=()=>{},new ResizeObserver((t=>{for(const n of t)if(n.target===e){this.width=n.contentRect.width,this.height=n.contentRect.height;for(const e of this.onResize)e(this.width,this.height)}})).observe(this.root)}addOnResize(e){this.onResize.push(e)}removeOnResize(e){this.onResize=this.onResize.filter((t=>t!==e))}setOnKeyDown(e){this.onKeyDown=e}fireKeyDown(e){this.onKeyDown(e)}setOnKeyUp(e){this.onKeyUp=e}fireKeyUp(e){this.onKeyUp(e)}setOnKeyPress(e){this.onKeyPress=e}fireKeyPress(e){this.onKeyPress(e)}setOnKeysPress(e){this.onKeysPress=e}fireKeysPress(e){this.onKeysPress(e)}}function dc(e){return void 0!==e.layersConfig?(1===e.layersConfig.version&&function(e){for(const t of e.layers)for(const e of t.controls)if("Key"===e.type){const t=e;"number"==typeof t.mapTo&&(t.mapTo=[t.mapTo])}}(e.layersConfig),e.layersConfig):void 0!==e.layers?e.layers:null}const pc=function(){const e={};for(const t of Object.keys(sa))e[sa[t]]=t.substr(4,2);return e}();function fc(e,t,n){const o=Math.round(.6*n),r=Math.round(.5*n),i=Math.max(1,Math.round(n/20)),s=wc[e.toLowerCase()],a=void 0===s?e:"",c=hc("emulator-button-touch-zone"),l=hc("emulator-button"),u=hc("emulator-button-text",void 0===s?void 0===a||0===a.length?"□":a.substr(0,1).toUpperCase():"");void 0!==s&&(l.style.backgroundImage='url("'+s+'")'),l.style.width=o+"px",l.style.height=o+"px",u.style.fontSize=r+"px",c.widthPx=n-2*i,c.heightPx=n-2*i,c.style.width=c.widthPx+"px",c.style.height=c.heightPx+"px",c.style.borderWidth=i+"px",c.appendChild(l),c.appendChild(u);const d=e=>{void 0!==t.onDown&&t.onDown(),void 0!==t.onClick&&t.onClick(),e.stopPropagation(),e.preventDefault()},p=e=>{void 0!==t.onUp&&t.onUp(),e.stopPropagation(),e.preventDefault()},f=e=>{e.stopPropagation(),e.preventDefault()},h={capture:!0};for(const v of nc.starters)c.addEventListener(v,d,h);for(const v of nc.enders)c.addEventListener(v,p,h);for(const v of nc.changers)c.addEventListener(v,f,h);for(const v of nc.leavers)c.addEventListener(v,f,h);for(const v of nc.prevents)c.addEventListener(v,f,h);return c}function hc(e,t){const n=document.createElement("div");return n.className=e,void 0!==t&&(n.innerHTML=t),n}function vc(e){return"number"==typeof e?pc[e]:e}function mc(e,t){return"click"===e.action?{onClick:()=>t.fireKeyPress(e.mapTo)}:{onDown:()=>t.fireKeyDown(e.mapTo),onUp:()=>t.fireKeyUp(e.mapTo)}}const _c="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg version='1.1' id='Layer_1' xmlns:sketch='http://www.bohemiancoding.com/sketch/ns' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 20 20' fill='%23FFF' enable-background='new 0 0 20 20' xml:space='preserve'%3E%3Ctitle%3EShape%3C/title%3E%3Cdesc%3ECreated with Sketch.%3C/desc%3E%3Cg id='Page-1' sketch:type='MSPage'%3E%3Cg id='Artboard-1' transform='translate(-3.000000, -1.000000)' sketch:type='MSArtboardGroup'%3E%3Cpath id='Shape' sketch:type='MSShapeGroup' d='M19,12c-0.3,0-0.5,0.1-0.7,0.3L14,16.6V3c0-0.5-0.4-1-1-1s-1,0.5-1,1v13.6 l-4.3-4.3C7.5,12.1,7.3,12,7,12c-0.5,0-1,0.4-1,1c0,0.3,0.1,0.5,0.3,0.7l6,6c0.2,0.2,0.4,0.3,0.7,0.3s0.5-0.1,0.7-0.3l6-6 c0.2-0.2,0.3-0.4,0.3-0.7C20,12.4,19.5,12,19,12L19,12z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E",yc="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 20 20' enable-background='new 0 0 20 20' fill='%23FFF' xml:space='preserve'%3E%3Cg id='left_arrow_1_'%3E%3Cg%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18,9H4.41l4.29-4.29C8.89,4.53,9,4.28,9,4c0-0.55-0.45-1-1-1 C7.72,3,7.47,3.11,7.29,3.29l-6,6C1.11,9.47,1,9.72,1,10c0,0.28,0.11,0.53,0.29,0.71l6,6C7.47,16.89,7.72,17,8,17 c0.55,0,1-0.45,1-1c0-0.28-0.11-0.53-0.29-0.71L4.41,11H18c0.55,0,1-0.45,1-1C19,9.45,18.55,9,18,9z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E",gc="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' fill='%23fff' viewBox='0 0 20 20' enable-background='new 0 0 20 20' xml:space='preserve'%3E%3Cg id='right_arrow_1_'%3E%3Cg%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.71,9.29l-6-6C12.53,3.11,12.28,3,12,3c-0.55,0-1,0.45-1,1 c0,0.28,0.11,0.53,0.29,0.71L15.59,9H2c-0.55,0-1,0.45-1,1c0,0.55,0.45,1,1,1h13.59l-4.29,4.29C11.11,15.47,11,15.72,11,16 c0,0.55,0.45,1,1,1c0.28,0,0.53-0.11,0.71-0.29l6-6C18.89,10.53,19,10.28,19,10C19,9.72,18.89,9.47,18.71,9.29z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E",bc="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' fill='%23fff' viewBox='0 0 20 20' enable-background='new 0 0 20 20' xml:space='preserve'%3E%3Cg id='key_enter_1_'%3E%3Cg%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18,2c-0.55,0-1,0.45-1,1v5c0,2.21-1.79,4-4,4H4.41l2.29-2.29 C6.89,9.53,7,9.28,7,9c0-0.55-0.45-1-1-1C5.72,8,5.47,8.11,5.29,8.29l-4,4C1.11,12.47,1,12.72,1,13c0,0.28,0.11,0.53,0.29,0.71 l4,4C5.47,17.89,5.72,18,6,18c0.55,0,1-0.45,1-1c0-0.28-0.11-0.53-0.29-0.71L4.41,14H13c3.31,0,6-2.69,6-6V3C19,2.45,18.55,2,18,2 z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E",wc={fullscreen:"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 16 16' enable-background='new 0 0 16 16' xml:space='preserve'%3E%3Cg id='maximize_1_' fill='%23FFFFFF'%3E%3Cg%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M5.99,8.99c-0.28,0-0.53,0.11-0.71,0.29l-3.29,3.29v-1.59c0-0.55-0.45-1-1-1 s-1,0.45-1,1v4c0,0.55,0.45,1,1,1h4c0.55,0,1-0.45,1-1s-0.45-1-1-1H3.41L6.7,10.7c0.18-0.18,0.29-0.43,0.29-0.71 C6.99,9.44,6.54,8.99,5.99,8.99z M14.99-0.01h-4c-0.55,0-1,0.45-1,1s0.45,1,1,1h1.59L9.28,5.29C9.1,5.47,8.99,5.72,8.99,5.99 c0,0.55,0.45,1,1,1c0.28,0,0.53-0.11,0.71-0.29l3.29-3.29v1.59c0,0.55,0.45,1,1,1s1-0.45,1-1v-4C15.99,0.44,15.54-0.01,14.99-0.01 z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E",save:"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 18.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 16 16' enable-background='new 0 0 16 16' fill='%23FFFFFF' xml:space='preserve'%3E%3Cg id='floppy_disk'%3E%3Cg%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M15.71,2.29l-2-2C13.53,0.11,13.28,0,13,0h-1v6H4V0H1C0.45,0,0,0.45,0,1v14 c0,0.55,0.45,1,1,1h14c0.55,0,1-0.45,1-1V3C16,2.72,15.89,2.47,15.71,2.29z M14,15H2V9c0-0.55,0.45-1,1-1h10c0.55,0,1,0.45,1,1V15 z M11,1H9v4h2V1z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A",options:"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 20 20' enable-background='new 0 0 20 20' fill='%23FFF' xml:space='preserve'%3E%3Cg id='cog_2_'%3E%3Cg%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M19,8h-2.31c-0.14-0.46-0.33-0.89-0.56-1.3l1.7-1.7c0.39-0.39,0.39-1.02,0-1.41 l-1.41-1.41c-0.39-0.39-1.02-0.39-1.41,0l-1.7,1.7c-0.41-0.22-0.84-0.41-1.3-0.55V1c0-0.55-0.45-1-1-1H9C8.45,0,8,0.45,8,1v2.33 C7.52,3.47,7.06,3.67,6.63,3.91L5,2.28c-0.37-0.37-0.98-0.37-1.36,0L2.28,3.64C1.91,4.02,1.91,4.63,2.28,5l1.62,1.62 C3.66,7.06,3.46,7.51,3.31,8H1C0.45,8,0,8.45,0,9v2c0,0.55,0.45,1,1,1h2.31c0.14,0.46,0.33,0.89,0.56,1.3L2.17,15 c-0.39,0.39-0.39,1.02,0,1.41l1.41,1.41c0.39,0.39,1.02,0.39,1.41,0l1.7-1.7c0.41,0.22,0.84,0.41,1.3,0.55V19c0,0.55,0.45,1,1,1h2 c0.55,0,1-0.45,1-1v-2.33c0.48-0.14,0.94-0.35,1.37-0.59L15,17.72c0.37,0.37,0.98,0.37,1.36,0l1.36-1.36 c0.37-0.37,0.37-0.98,0-1.36l-1.62-1.62c0.24-0.43,0.45-0.89,0.6-1.38H19c0.55,0,1-0.45,1-1V9C20,8.45,19.55,8,19,8z M10,14 c-2.21,0-4-1.79-4-4c0-2.21,1.79-4,4-4s4,1.79,4,4C14,12.21,12.21,14,10,14z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E",keyboard:"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 16 16' enable-background='new 0 0 16 16' xml:space='preserve'%3E%3Cg id='manually_entered_data_2_'%3E%3Cg%3E%3Cpath fill='%23FFFFFF' fill-rule='evenodd' clip-rule='evenodd' d='M1,8h3.76l2-2H1C0.45,6,0,6.45,0,7C0,7.55,0.45,8,1,8z M15.49,3.99 C15.8,3.67,16,3.23,16,2.75C16,1.78,15.22,1,14.25,1c-0.48,0-0.92,0.2-1.24,0.51l-1.44,1.44l2.47,2.47L15.49,3.99z M1,4h7.76l2-2 H1C0.45,2,0,2.45,0,3C0,3.55,0.45,4,1,4z M1,10c-0.55,0-1,0.45-1,1c0,0.48,0.35,0.86,0.8,0.96L2.76,10H1z M10.95,3.57l-6.69,6.69 l2.47,2.47l6.69-6.69L10.95,3.57z M15.2,6.04L13.24,8H15c0.55,0,1-0.45,1-1C16,6.52,15.65,6.14,15.2,6.04z M2,15l3.86-1.39 l-2.46-2.44L2,15z M15,10h-3.76l-2,2H15c0.55,0,1-0.45,1-1C16,10.45,15.55,10,15,10z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E",up:"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg version='1.1' id='Layer_1' xmlns:sketch='http://www.bohemiancoding.com/sketch/ns' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 20 20' fill='%23FFF' enable-background='new 0 0 20 20' xml:space='preserve'%3E%3Ctitle%3EShape%3C/title%3E%3Cdesc%3ECreated with Sketch.%3C/desc%3E%3Cg id='Page-1' sketch:type='MSPage'%3E%3Cg id='Artboard-1' transform='translate(-3.000000, -1.000000)' sketch:type='MSArtboardGroup'%3E%3Cpath id='Shape' sketch:type='MSShapeGroup' d='M19.7,8.3l-6-6C13.5,2.1,13.3,2,13,2s-0.5,0.1-0.7,0.3l-6,6C6.1,8.5,6,8.7,6,9 c0,0.6,0.5,1,1,1c0.3,0,0.5-0.1,0.7-0.3L12,5.4V19c0,0.5,0.4,1,1,1s1-0.5,1-1V5.4l4.3,4.3C18.5,9.9,18.7,10,19,10c0.5,0,1-0.4,1-1 C20,8.7,19.9,8.5,19.7,8.3L19.7,8.3z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E",down:_c,do:_c,dw:_c,dwn:_c,left:yc,le:yc,lft:yc,right:gc,ri:gc,rght:gc,rgh:gc,enter:bc,en:bc,enr:bc,ent:bc,entr:bc};function xc(e,t){const n=e.mouseOverlay,o=(n,o)=>function(e,t,n,o){const r=n.width(),i=n.height(),s=o.width,a=o.height,c=r/i;let l=s,u=s/c;u>a&&(u=a,l=a*c);const d=(a-u)/2,p=(s-l)/2;let f=Math.max(0,Math.min(1,(e-p)/l)),h=Math.max(0,Math.min(1,(t-d)/u));f<=kc&&(f=0);f>=1-kc&&(f=1);h<=kc&&(h=0);h>=1-kc&&(h=1);return{x:f,y:h}}(n,o,t,e);return document.pointerLockElement===n&&document.exitPointerLock(),Cc(n,e,0,!1,(function(e,n,r){const i=o(e,n);t.sendMouseMotion(i.x,i.y),t.sendMouseButton(r,!0)}),(function(e,n,r,i){const s=o(e,n);t.sendMouseMotion(s.x,s.y)}),(function(e,n,r){const i=o(e,n);t.sendMouseMotion(i.x,i.y),t.sendMouseButton(r,!1)}),(function(e,n){const r=o(e,n);t.sendMouseMotion(r.x,r.y)}))}const kc=.01;function Cc(e,t,n,o,r,i,s,a){let c=0;const l=i=>{if(i.target!==e)return;if(t.pointerDisabled)return void i.stopPropagation();const s=tc(i,e,n,o);c=(Za&&0===s.button?t.pointerButton:s.button)??0,r(s.x,s.y,c),i.stopPropagation()},u=r=>{if(r.target!==e)return;if(t.pointerDisabled)return void r.stopPropagation();const s=tc(r,e,n,o);i(s.x,s.y,s.mX,s.mY),r.stopPropagation()},d=r=>{if(t.pointerDisabled)return void r.stopPropagation();const i=tc(r,e,n,o);s(i.x,i.y,c),r.stopPropagation()},p=r=>{if(r.target!==e)return;if(t.pointerDisabled)return void r.stopPropagation();const i=tc(r,e,n,o);a(i.x,i.y),r.stopPropagation()},f=e=>{e.stopPropagation()},h={capture:!1};for(const v of nc.starters)e.addEventListener(v,l,h);for(const v of nc.changers)e.addEventListener(v,u,h);for(const v of nc.enders)e.addEventListener(v,d,h);for(const v of nc.prevents)e.addEventListener(v,f,h);for(const v of nc.leavers)e.addEventListener(v,p,h);return()=>{for(const t of nc.starters)e.removeEventListener(t,l,h);for(const t of nc.changers)e.removeEventListener(t,u,h);for(const t of nc.enders)e.removeEventListener(t,d,h);for(const t of nc.prevents)e.removeEventListener(t,f,h);for(const t of nc.leavers)e.removeEventListener(t,p,h)}}function Sc(e,t,n,o){return e&&!nc.canLock?function(e,t,n){const o=t.mouseOverlay;let r=-1,i=0;return Cc(o,t,e,!1,((e,t)=>{r=Date.now(),i=0}),(function(e,t,o,r){0===o&&0===r||(i+=Math.abs(o)+Math.abs(r),n.sendMouseRelativeMotion(o,r))}),((e,o)=>{if(Date.now()-r<500&&i<50){const e=t.pointerButton||0;n.sendMouseButton(e,!0),setTimeout((()=>n.sendMouseButton(e,!1)),60)}}),(()=>{}))}(t,n,o):e?function(e,t,n){const o=t.mouseOverlay;function r(){return document.pointerLockElement!==o}return Cc(o,t,e,!0,(async function(e,t,i){if(r())try{await o.requestPointerLock({unadjustedMovement:!0})}catch(s){console.warn("Failed to request pointer lock with unadjusted movement, falling back to default"),await o.requestPointerLock()}else n.sendMouseButton(i,!0)}),(function(e,t,o,i){r()||0===o&&0===i||n.sendMouseRelativeMotion(o,i)}),(function(e,t,o){r()||n.sendMouseButton(o,!1)}),(function(e,t){}))}(t,n,o):xc(n,o)}const Pc=(e,t)=>{const n=t.x-e.x,o=t.y-e.y;return Math.sqrt(n*n+o*o)},Ec=e=>e*(Math.PI/180),Oc=e=>e*(180/Math.PI),Mc=new Map,jc=e=>{Mc.has(e)&&clearTimeout(Mc.get(e)),Mc.set(e,setTimeout(e,100))},Ac=(e,t,n)=>{const o=t.split(/[ ,]+/g);let r;for(let i=0;i<o.length;i+=1)r=o[i],e.addEventListener?e.addEventListener(r,n,!1):e.attachEvent&&e.attachEvent(r,n)},Dc=(e,t,n)=>{const o=t.split(/[ ,]+/g);let r;for(let i=0;i<o.length;i+=1)r=o[i],e.removeEventListener?e.removeEventListener(r,n):e.detachEvent&&e.detachEvent(r,n)},Tc=e=>(e.preventDefault(),e.type.match(/^touch/)?e.changedTouches:e),Lc=()=>({x:void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}),Ic=(e,t)=>{t.top||t.right||t.bottom||t.left?(e.style.top=t.top,e.style.right=t.right,e.style.bottom=t.bottom,e.style.left=t.left):(e.style.left=t.x+"px",e.style.top=t.y+"px")},zc=(e,t,n)=>{const o=Bc(e);for(let r in o)if(o.hasOwnProperty(r))if("string"==typeof t)o[r]=t+" "+n;else{let e="";for(let o=0,r=t.length;o<r;o+=1)e+=t[o]+" "+n+", ";o[r]=e.slice(0,-2)}return o},Bc=e=>{const t={};t[e]="";return["webkit","Moz","o"].forEach((function(n){t[n+e.charAt(0).toUpperCase()+e.slice(1)]=""})),t},Rc=(e,t)=>{for(let n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},Nc=(e,t)=>{if(e.length)for(let n=0,o=e.length;n<o;n+=1)t(e[n]);else t(e)};var Fc,Uc=!!("ontouchstart"in window),Kc=!!window.PointerEvent,Hc=!!window.MSPointerEvent,Vc={start:"mousedown",move:"mousemove",end:"mouseup"},Wc={};function qc(){}function Xc(e,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=e,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:.5,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(t),"dynamic"===this.options.mode&&(this.options.restOpacity=0),this.id=Xc.id,Xc.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}function Gc(e,t){var n=this;n.nipples=[],n.idles=[],n.actives=[],n.ids=[],n.pressureIntervals={},n.manager=e,n.id=Gc.id,Gc.id+=1,n.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:.5,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},n.config(t),"static"!==n.options.mode&&"semi"!==n.options.mode||(n.options.multitouch=!1),n.options.multitouch||(n.options.maxNumberOfNipples=1);const o=getComputedStyle(n.options.zone.parentElement);return o&&"flex"===o.display&&(n.parentIsFlex=!0),n.updateBox(),n.prepareNipples(),n.bindings(),n.begin(),n.nipples}function $c(e){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=Lc(),t.config(e),t.prepareCollections();var n=function(){var e;t.collections.forEach((function(n){n.forEach((function(n){e=n.el.getBoundingClientRect(),n.position={x:t.scroll.x+e.left,y:t.scroll.y+e.top}}))}))};Ac(window,"resize",(function(){jc(n)}));var o=function(){t.scroll=Lc()};return Ac(window,"scroll",(function(){jc(o)})),t.collections}Kc?Fc={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:Hc?Fc={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:Uc?(Fc={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},Wc=Vc):Fc=Vc,qc.prototype.on=function(e,t){var n,o=this,r=e.split(/[ ,]+/g);o._handlers_=o._handlers_||{};for(var i=0;i<r.length;i+=1)n=r[i],o._handlers_[n]=o._handlers_[n]||[],o._handlers_[n].push(t);return o},qc.prototype.off=function(e,t){var n=this;return n._handlers_=n._handlers_||{},void 0===e?n._handlers_={}:void 0===t?n._handlers_[e]=null:n._handlers_[e]&&n._handlers_[e].indexOf(t)>=0&&n._handlers_[e].splice(n._handlers_[e].indexOf(t),1),n},qc.prototype.trigger=function(e,t){var n,o=this,r=e.split(/[ ,]+/g);o._handlers_=o._handlers_||{};for(var i=0;i<r.length;i+=1)n=r[i],o._handlers_[n]&&o._handlers_[n].length&&o._handlers_[n].forEach((function(e){e.call(o,{type:n,target:o},t)}))},qc.prototype.config=function(e){var t=this;t.options=t.defaults||{},e&&(t.options=((e,t)=>{const n={};for(let o in e)e.hasOwnProperty(o)&&t.hasOwnProperty(o)?n[o]=t[o]:e.hasOwnProperty(o)&&(n[o]=e[o]);return n})(t.options,e))},qc.prototype.bindEvt=function(e,t){var n=this;return n._domHandlers_=n._domHandlers_||{},n._domHandlers_[t]=function(){"function"==typeof n["on"+t]?n["on"+t].apply(n,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},Ac(e,Fc[t],n._domHandlers_[t]),Wc[t]&&Ac(e,Wc[t],n._domHandlers_[t]),n},qc.prototype.unbindEvt=function(e,t){var n=this;return n._domHandlers_=n._domHandlers_||{},Dc(e,Fc[t],n._domHandlers_[t]),Wc[t]&&Dc(e,Wc[t],n._domHandlers_[t]),delete n._domHandlers_[t],this},Xc.prototype=new qc,Xc.constructor=Xc,Xc.id=0,Xc.prototype.buildEl=function(e){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},Xc.prototype.stylize=function(){if(this.options.dataOnly)return this;var e=this.options.fadeTime+"ms",t=((e,t)=>{const n=Bc(e);for(let o in n)n.hasOwnProperty(o)&&(n[o]=t);return n})("borderRadius","50%"),n=zc("transition","opacity",e),o={};return o.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},o.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",left:0,marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:this.options.color,opacity:".5"},o.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",left:0,marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:this.options.color,opacity:".5",transform:"translate(0px, 0px)"},Rc(o.el,n),"circle"===this.options.shape&&Rc(o.back,t),Rc(o.front,t),this.applyStyles(o),this},Xc.prototype.applyStyles=function(e){for(var t in this.ui)if(this.ui.hasOwnProperty(t))for(var n in e[t])this.ui[t].style[n]=e[t][n];return this},Xc.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},Xc.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},Xc.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off()},Xc.prototype.show=function(e){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout((function(){t.ui.el.style.opacity=1}),0),t.showTimeout=setTimeout((function(){t.trigger("shown",t.instance),"function"==typeof e&&e.call(this)}),t.options.fadeTime)),t},Xc.prototype.hide=function(e){var t=this;if(t.options.dataOnly)return t;if(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout((function(){var n="dynamic"===t.options.mode?"none":"block";t.ui.el.style.display=n,"function"==typeof e&&e.call(t),t.trigger("hidden",t.instance)}),t.options.fadeTime),t.options.restJoystick){const n=t.options.restJoystick,o={};o.x=!0===n||!1!==n.x?0:t.instance.frontPosition.x,o.y=!0===n||!1!==n.y?0:t.instance.frontPosition.y,t.setPosition(e,o)}return t},Xc.prototype.setPosition=function(e,t){var n=this;n.frontPosition={x:t.x,y:t.y};var o=n.options.fadeTime+"ms",r={};r.front=zc("transition",["transform"],o);var i={front:{}};i.front={transform:"translate("+n.frontPosition.x+"px,"+n.frontPosition.y+"px)"},n.applyStyles(r),n.applyStyles(i),n.restTimeout=setTimeout((function(){"function"==typeof e&&e.call(n),n.restCallback()}),n.options.fadeTime)},Xc.prototype.restCallback=function(){var e=this,t={};t.front=zc("transition","none",""),e.applyStyles(t),e.trigger("rested",e.instance)},Xc.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},Xc.prototype.computeDirection=function(e){var t,n,o,r=e.angle.radian,i=Math.PI/4,s=Math.PI/2;if(r>i&&r<3*i&&!e.lockX?t="up":r>-i&&r<=i&&!e.lockY?t="left":r>3*-i&&r<=-i&&!e.lockX?t="down":e.lockY||(t="right"),e.lockY||(n=r>-s&&r<s?"left":"right"),e.lockX||(o=r>0?"up":"down"),e.force>this.options.threshold){var a,c={};for(a in this.direction)this.direction.hasOwnProperty(a)&&(c[a]=this.direction[a]);var l={};for(a in this.direction={x:n,y:o,angle:t},e.direction=this.direction,c)c[a]===this.direction[a]&&(l[a]=!0);if(l.x&&l.y&&l.angle)return e;l.x&&l.y||this.trigger("plain",e),l.x||this.trigger("plain:"+n,e),l.y||this.trigger("plain:"+o,e),l.angle||this.trigger("dir dir:"+t,e)}else this.resetDirection();return e},Gc.prototype=new qc,Gc.constructor=Gc,Gc.id=0,Gc.prototype.prepareNipples=function(){var e=this,t=e.nipples;t.on=e.on.bind(e),t.off=e.off.bind(e),t.options=e.options,t.destroy=e.destroy.bind(e),t.ids=e.ids,t.id=e.id,t.processOnMove=e.processOnMove.bind(e),t.processOnEnd=e.processOnEnd.bind(e),t.get=function(e){if(void 0===e)return t[0];for(var n=0,o=t.length;n<o;n+=1)if(t[n].identifier===e)return t[n];return!1}},Gc.prototype.bindings=function(){var e=this;e.bindEvt(e.options.zone,"start"),e.options.zone.style.touchAction="none",e.options.zone.style.msTouchAction="none"},Gc.prototype.begin=function(){var e=this,t=e.options;if("static"===t.mode){var n=e.createNipple(t.position,e.manager.getIdentifier());n.add(),e.idles.push(n)}},Gc.prototype.createNipple=function(e,t){var n=this,o=n.manager.scroll,r={},i=n.options,s=n.parentIsFlex?o.x:o.x+n.box.left,a=n.parentIsFlex?o.y:o.y+n.box.top;if(e.x&&e.y)r={x:e.x-s,y:e.y-a};else if(e.top||e.right||e.bottom||e.left){var c=document.createElement("DIV");c.style.display="hidden",c.style.top=e.top,c.style.right=e.right,c.style.bottom=e.bottom,c.style.left=e.left,c.style.position="absolute",i.zone.appendChild(c);var l=c.getBoundingClientRect();i.zone.removeChild(c),r=e,e={x:l.left+o.x,y:l.top+o.y}}var u=new Xc(n,{color:i.color,size:i.size,threshold:i.threshold,fadeTime:i.fadeTime,dataOnly:i.dataOnly,restJoystick:i.restJoystick,restOpacity:i.restOpacity,mode:i.mode,identifier:t,position:e,zone:i.zone,frontPosition:{x:0,y:0},shape:i.shape});return i.dataOnly||(Ic(u.ui.el,r),Ic(u.ui.front,u.frontPosition)),n.nipples.push(u),n.trigger("added "+u.identifier+":added",u),n.manager.trigger("added "+u.identifier+":added",u),n.bindNipple(u),u},Gc.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},Gc.prototype.bindNipple=function(e){var t,n=this,o=function(e,o){t=e.type+" "+o.id+":"+e.type,n.trigger(t,o)};e.on("destroyed",n.onDestroyed.bind(n)),e.on("shown hidden rested dir plain",o),e.on("dir:up dir:right dir:down dir:left",o),e.on("plain:up plain:right plain:down plain:left",o)},Gc.prototype.pressureFn=function(e,t,n){var o=this,r=0;clearInterval(o.pressureIntervals[n]),o.pressureIntervals[n]=setInterval(function(){var n=e.force||e.pressure||e.webkitForce||0;n!==r&&(t.trigger("pressure",n),o.trigger("pressure "+t.identifier+":pressure",n),r=n)}.bind(o),100)},Gc.prototype.onstart=function(e){var t=this,n=t.options,o=e;e=Tc(e),t.updateBox();return Nc(e,(function(r){t.actives.length<n.maxNumberOfNipples?t.processOnStart(r):o.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach((function(n){if(Object.values(o.touches).findIndex((function(e){return e.identifier===n}))<0){var r=[e[0]];r.identifier=n,t.processOnEnd(r)}})),t.actives.length<n.maxNumberOfNipples&&t.processOnStart(r))})),t.manager.bindDocument(),!1},Gc.prototype.processOnStart=function(e){var t,n=this,o=n.options,r=n.manager.getIdentifier(e),i=e.force||e.pressure||e.webkitForce||0,s={x:e.pageX,y:e.pageY},a=n.getOrCreate(r,s);a.identifier!==r&&n.manager.removeIdentifier(a.identifier),a.identifier=r;var c=function(t){t.trigger("start",t),n.trigger("start "+t.id+":start",t),t.show(),i>0&&n.pressureFn(e,t,t.identifier),n.processOnMove(e)};if((t=n.idles.indexOf(a))>=0&&n.idles.splice(t,1),n.actives.push(a),n.ids.push(a.identifier),"semi"!==o.mode)c(a);else{if(!(Pc(s,a.position)<=o.catchDistance))return a.destroy(),void n.processOnStart(e);c(a)}return a},Gc.prototype.getOrCreate=function(e,t){var n,o=this,r=o.options;return/(semi|static)/.test(r.mode)?(n=o.idles[0])?(o.idles.splice(0,1),n):"semi"===r.mode?o.createNipple(t,e):(console.warn("Coudln't find the needed nipple."),!1):n=o.createNipple(t,e)},Gc.prototype.processOnMove=function(e){var t=this,n=t.options,o=t.manager.getIdentifier(e),r=t.nipples.get(o),i=t.manager.scroll;if((e=>isNaN(e.buttons)?0!==e.pressure:0!==e.buttons)(e)){if(!r)return console.error("Found zombie joystick with ID "+o),void t.manager.removeIdentifier(o);if(n.dynamicPage){var s=r.el.getBoundingClientRect();r.position={x:i.x+s.left,y:i.y+s.top}}r.identifier=o;var a=r.options.size/2,c={x:e.pageX,y:e.pageY};n.lockX&&(c.y=r.position.y),n.lockY&&(c.x=r.position.x);var l,u,d=Pc(c,r.position),p=((e,t)=>{const n=t.x-e.x,o=t.y-e.y;return Oc(Math.atan2(o,n))})(c,r.position),f=Ec(p),h=d/a,v={distance:d,position:c};if("circle"===r.options.shape?(l=Math.min(d,a),u=((e,t,n)=>{const o={x:0,y:0};return n=Ec(n),o.x=e.x-t*Math.cos(n),o.y=e.y-t*Math.sin(n),o})(r.position,l,p)):(u=((e,t,n)=>({x:Math.min(Math.max(e.x,t.x-n),t.x+n),y:Math.min(Math.max(e.y,t.y-n),t.y+n)}))(c,r.position,a),l=Pc(u,r.position)),n.follow){if(d>a){let e=c.x-u.x,n=c.y-u.y;r.position.x+=e,r.position.y+=n,r.el.style.top=r.position.y-(t.box.top+i.y)+"px",r.el.style.left=r.position.x-(t.box.left+i.x)+"px",d=Pc(c,r.position)}}else c=u,d=l;var m=c.x-r.position.x,_=c.y-r.position.y;r.frontPosition={x:m,y:_},n.dataOnly||(r.ui.front.style.transform="translate("+m+"px,"+_+"px)");var y={identifier:r.identifier,position:c,force:h,pressure:e.force||e.pressure||e.webkitForce||0,distance:d,angle:{radian:f,degree:p},vector:{x:m/a,y:-_/a},raw:v,instance:r,lockX:n.lockX,lockY:n.lockY};(y=r.computeDirection(y)).angle={radian:Ec(180-p),degree:180-p},r.trigger("move",y),t.trigger("move "+r.id+":move",y)}else this.processOnEnd(e)},Gc.prototype.processOnEnd=function(e){var t=this,n=t.options,o=t.manager.getIdentifier(e),r=t.nipples.get(o),i=t.manager.removeIdentifier(r.identifier);r&&(n.dataOnly||r.hide((function(){"dynamic"===n.mode&&(r.trigger("removed",r),t.trigger("removed "+r.id+":removed",r),t.manager.trigger("removed "+r.id+":removed",r),r.destroy())})),clearInterval(t.pressureIntervals[r.identifier]),r.resetDirection(),r.trigger("end",r),t.trigger("end "+r.id+":end",r),t.ids.indexOf(r.identifier)>=0&&t.ids.splice(t.ids.indexOf(r.identifier),1),t.actives.indexOf(r)>=0&&t.actives.splice(t.actives.indexOf(r),1),/(semi|static)/.test(n.mode)?t.idles.push(r):t.nipples.indexOf(r)>=0&&t.nipples.splice(t.nipples.indexOf(r),1),t.manager.unbindDocument(),/(semi|static)/.test(n.mode)&&(t.manager.ids[i.id]=i.identifier))},Gc.prototype.onDestroyed=function(e,t){var n=this;n.nipples.indexOf(t)>=0&&n.nipples.splice(n.nipples.indexOf(t),1),n.actives.indexOf(t)>=0&&n.actives.splice(n.actives.indexOf(t),1),n.idles.indexOf(t)>=0&&n.idles.splice(n.idles.indexOf(t),1),n.ids.indexOf(t.identifier)>=0&&n.ids.splice(n.ids.indexOf(t.identifier),1),n.manager.removeIdentifier(t.identifier),n.manager.unbindDocument()},Gc.prototype.destroy=function(){var e=this;for(var t in e.unbindEvt(e.options.zone,"start"),e.nipples.forEach((function(e){e.destroy()})),e.pressureIntervals)e.pressureIntervals.hasOwnProperty(t)&&clearInterval(e.pressureIntervals[t]);e.trigger("destroyed",e.nipples),e.manager.unbindDocument(),e.off()},$c.prototype=new qc,$c.constructor=$c,$c.prototype.prepareCollections=function(){var e=this;e.collections.create=e.create.bind(e),e.collections.on=e.on.bind(e),e.collections.off=e.off.bind(e),e.collections.destroy=e.destroy.bind(e),e.collections.get=function(t){var n;return e.collections.every((function(e){return!(n=e.get(t))})),n}},$c.prototype.create=function(e){return this.createCollection(e)},$c.prototype.createCollection=function(e){var t=this,n=new Gc(t,e);return t.bindCollection(n),t.collections.push(n),n},$c.prototype.bindCollection=function(e){var t,n=this,o=function(e,o){t=e.type+" "+o.id+":"+e.type,n.trigger(t,o)};e.on("destroyed",n.onDestroyed.bind(n)),e.on("shown hidden rested dir plain",o),e.on("dir:up dir:right dir:down dir:left",o),e.on("plain:up plain:right plain:down plain:left",o)},$c.prototype.bindDocument=function(){var e=this;e.binded||(e.bindEvt(document,"move").bindEvt(document,"end"),e.binded=!0)},$c.prototype.unbindDocument=function(e){var t=this;Object.keys(t.ids).length&&!0!==e||(t.unbindEvt(document,"move").unbindEvt(document,"end"),t.binded=!1)},$c.prototype.getIdentifier=function(e){var t;return e?void 0===(t=void 0===e.identifier?e.pointerId:e.identifier)&&(t=this.latest||0):t=this.index,void 0===this.ids[t]&&(this.ids[t]=this.index,this.index+=1),this.latest=t,this.ids[t]},$c.prototype.removeIdentifier=function(e){var t={};for(var n in this.ids)if(this.ids[n]===e){t.id=n,t.identifier=this.ids[n],delete this.ids[n];break}return t},$c.prototype.onmove=function(e){return this.onAny("move",e),!1},$c.prototype.onend=function(e){return this.onAny("end",e),!1},$c.prototype.oncancel=function(e){return this.onAny("end",e),!1},$c.prototype.onAny=function(e,t){var n,o=this,r="processOn"+e.charAt(0).toUpperCase()+e.slice(1);t=Tc(t);var i=function(e,t,n){n.ids.indexOf(t)>=0&&(n[r](e),e._found_=!0)};return Nc(t,(function(e){n=o.getIdentifier(e),Nc(o.collections,i.bind(null,e,n)),e._found_||o.removeIdentifier(n)})),!1},$c.prototype.destroy=function(){var e=this;e.unbindDocument(!0),e.ids={},e.index=0,e.collections.forEach((function(e){e.destroy()})),e.off()},$c.prototype.onDestroyed=function(e,t){var n=this;if(n.collections.indexOf(t)<0)return!1;n.collections.splice(n.collections.indexOf(t),1)};const Yc=new $c,Jc=function(e){return Yc.create(e)};function Qc(e,t,n,o,r,i){const s=Math.round(o/4);let a=!1;const c=()=>{const e=a?"flex":"none";for(const t of l)t!=u&&(t.style.display=e)},l=[Zc(t,n),fc("keyboard",{onClick:()=>{e.toggleKeyboard(),a&&(a=!1,c())}},o),fc("options",{onClick:()=>{a=!a,c()}},o)],u=l[l.length-1],d=lc("emulator-options");for(const p of l)p!==u&&p.classList.add("emulator-button-control"),p.style.marginRight=s+"px",p.style.marginBottom=s+"px",p!==u&&(p.style.display="none"),d.appendChild(p);return d.style.position="absolute",d.style.right=i+"px",d.style.top=r+"px",e.mouseOverlay.appendChild(d),()=>{e.mouseOverlay.removeChild(d)}}function Zc(e,t){if(e.length<=1)return document.createElement("div");const n=document.createElement("select");n.classList.add("emulator-control-select");for(const o of e){const e=document.createElement("option");e.value=o,e.innerHTML=o,n.appendChild(e)}return n.onchange=e=>{const n=e.target.value;t(n)},function(e,t=!0){const n=e=>{e.stopPropagation()},o=e=>{e.stopPropagation(),t&&e.preventDefault()},r={capture:!1};for(const i of nc.starters)e.addEventListener(i,n,r);for(const i of nc.enders)e.addEventListener(i,n,r);for(const i of nc.prevents)e.addEventListener(i,o,r)}(n,!1),n}function el(e,t,n){const o=n||{};function r(e){return void 0!==o[e]?o[e]:e}return e.setOnKeyDown((e=>{t.sendKeyEvent(r(e),!0)})),e.setOnKeyUp((e=>{t.sendKeyEvent(r(e),!1)})),e.setOnKeyPress((e=>{t.simulateKeyPress(r(e))})),e.setOnKeysPress((e=>{t.simulateKeyPress(...e)})),()=>{e.setOnKeyDown((e=>{})),e.setOnKeyUp((e=>{})),e.setOnKeyPress((e=>{})),e.setOnKeysPress((e=>{}))}}function tl(e,t,n,o){var r;const i=Object.keys(n),s={keyboard:()=>{},mouse:()=>{},gestures:()=>{},buttons:()=>{}},a=r=>{s.keyboard(),s.mouse(),s.gestures(),s.buttons(),s.keyboard=()=>{},s.mouse=()=>{},s.gestures=()=>{},s.buttons=()=>{};const i=n[r];void 0!==i&&(s.keyboard=el(t,o,i.mapper),void 0!==i.gestures&&i.gestures.length>0?s.gestures=function(e,t,n){const o=Jc({zone:e.mouseOverlay,multitouch:!0,maxNumberOfNipples:2});let r=-1;const i=()=>{-1!==r&&(e.fireKeyUp(r),r=-1)},s={},a={},c={};for(const u of n)"end:release"===u.event?s[u.joystickId]=!0:0!==u.mapTo&&("tap"===u.event?a[u.joystickId]=u.mapTo:o.on(u.event,(()=>{var t;c[u.joystickId]=Date.now(),i(),t=u.mapTo,e.fireKeyDown(t),r=t})));const l={};return o.on("start",(()=>{const e=o.ids.length-1;l[e]=Date.now()})),o.on("end",(()=>{const t=o.ids.length-1,n=Date.now()-l[t];!0===s[t]&&i(),a[t]&&n<500&&c[t]<l[t]&&e.fireKeyPress(a[t])})),()=>o.destroy()}(t,0,i.gestures):s.mouse=Sc(e.autolock,e.sensitivity,t,o),void 0!==i.buttons&&i.buttons.length&&(s.buttons=function(e,t,n,o){const r=Math.round(o/4),i=[];for(const s of n){if(0===s.mapTo)continue;const t=fc((s.symbol||vc(s.mapTo)).toUpperCase(),mc(s,e),o);t.style.position="absolute";const n=s.style;if(n)for(const e of Object.keys(n))t.style[e]=n[e];if(void 0!==s.position){const e=s.position.left,n=s.position.top,i=s.position.bottom,a=s.position.right;void 0!==e&&(t.style.left=r*e+o*(e-1)+"px"),void 0!==a&&(t.style.right=r*a+o*(a-1)+"px"),void 0!==n&&(t.style.top=r*n+o*(n-1)+"px"),void 0!==i&&(t.style.bottom=r*i+o*(i-1)+"px")}e.mouseOverlay.appendChild(t),i.push(t)}return()=>{for(const t of i)t.parentElement===e.mouseOverlay&&e.mouseOverlay.removeChild(t)}}(t,0,i.buttons,54)))},c=0===(null==(r=t.options.optionControls)?void 0:r.length)?()=>{}:Qc(t,i,a,54,13.5,0);return a("default"),()=>{s.gestures(),s.buttons(),s.mouse(),s.keyboard(),c()}}function nl(e){switch(e){case"square":return function(){class e{constructor(){t(this,"aspect",.625)}getConfiguration(e,t,n=1){const o=this.getCols(),r=this.getRows(),i=Math.floor(o/2),s=Math.floor(r/2),a=5*e/100/2,c=a,l=(e-2*a)/o*n,u=(t-2*c)/r*n,d=Math.min(l,u),p=[];for(let f=0;f<r;++f){const n=[];for(let l=0;l<o;++l)n.push({centerX:l<i?a+d*(l+.5):e-a-d*(o-l-1+.5),centerY:f<s?c+d*(f+.5):t-c-d*(r-f-1+.5)});p.push(n)}return{gridType:"square",cells:p,columnWidth:d,rowHeight:d,columnsPadding:a,rowsPadding:c,width:e,height:t}}getCols(){return 10}getRows(){return Math.floor(this.getCols()*this.aspect)+1}}return new e}();case"honeycomb":return function(){class e{constructor(){t(this,"aspect",.625)}getConfiguration(e,t,n=1){const o=this.getCols(),r=this.getRows(),i=Math.floor(o/2),s=Math.floor(r/2),a=5*e/100/2,c=a,l=(e-2*a)/o*n,u=(t-2*c)/r*n,d=Math.min(l,u),p=[];for(let f=0;f<r;++f){const n=[],l=f%2==0?o:o-1,u=f%2==0?0:d/2;for(let p=0;p<l;++p)n.push({centerX:p<i?u+a+d*(p+.5):u+e-a-d*(o-p-1+.5),centerY:f<s?c+d*(f+.5):t-c-d*(r-f-1+.5)});p.push(n)}return{gridType:"honeycomb",cells:p,columnWidth:d,rowHeight:d,columnsPadding:a,rowsPadding:c,width:e,height:t}}getCols(){return 10}getRows(){return Math.floor(this.getCols()*this.aspect)+1}}return new e}()}throw new Error("Unknown grid type "+e)}function ol(e,t,n,o,r,i,s){let a=t.layers[0];if(void 0!==s)for(const c of t.layers)if(c.title===s){a=c;break}return function(e,t,n,o,r,i){const s=el(t,n),a=Sc(o.autolock,o.sensitivity,t,n),c=[];function l(s,a){var l;for(const e of c)e();c.splice(0,c.length);const u=nl(e.grid).getConfiguration(s,a,i),d=new rl;for(const t of e.controls){const{row:e,column:n,type:o}=t;"NippleActivator"===o&&cl(u,e,n)}let p=-1;if(0===(null==(l=t.options.optionControls)?void 0:l.length))for(const t of e.controls){const{row:e,type:n}=t;if("Options"===n){p=e;break}}const f={};if(r)for(const t of e.controls){const{row:e}=t;let n=t.column;const o=u.cells[e].length,r=o/2;e===p&&n>=r&&(n=Math.min(n+1,o-1)),void 0===f[e]&&(f[e]={leftStart:r,leftEnd:0,rightStart:o-1,rightEnd:r}),n<r?(f[e].leftStart=Math.min(f[e].leftStart,n),f[e].leftEnd=Math.max(f[e].leftEnd,n)):(f[e].rightStart=Math.min(f[e].rightStart,n),f[e].rightEnd=Math.max(f[e].rightEnd,n))}for(const i of e.controls){const e=il[i.type];if(void 0===e){console.error("Factory for control '"+i.type+"' is not defined");continue}const s={...i},a=u.cells[i.row].length,l=a/2;if(p===i.row&&i.column>=l&&(s.column=Math.min(s.column+1,a-1)),r){const{leftStart:e,leftEnd:t,rightStart:n,rightEnd:o}=f[s.row],r=s.column<l;r?s.column+=l+(l-t)-e-1:s.column-=l+(n-l)-(a-o)+1,s.column>=a?(console.error("Column",s.column,"is out of bound",a,r?"[leftSide]":"[rightSide]",f),s.column=a-1):s.column<0&&(console.error("Column",s.column,"is out of bound",0,r?"[leftSide]":"[rightSide]",f),s.column=0)}const h=e(s,t,n,u,d,o);c.push(h)}}return t.addOnResize(l),l(t.width,t.height),()=>{t.removeOnResize(l),s(),a();for(const e of c)e()}}(a,e,n,o,r,i)}class rl{constructor(){t(this,"sensors",{})}activate(e,t){const n=this.sensors[t+"_"+e];void 0!==n&&n.activate()}deactivate(e,t){const n=this.sensors[t+"_"+e];void 0!==n&&n.deactivate()}register(e,t,n){this.sensors[t+"_"+e]=n}}const il={Key:function(e,t,n,o,r,i){const{cells:s,columnWidth:a}=o,{row:c,column:l}=e,{centerX:u,centerY:d}=s[c][l],p={onDown:()=>{for(const t of e.mapTo)n.sendKeyEvent(t,!0)},onUp:()=>{for(const t of e.mapTo)n.sendKeyEvent(t,!1)}};if(r.register(c,l,{activate:p.onDown,deactivate:p.onUp}),al(o,c,l))return()=>{};const f=fc(e.symbol,p,a);return f.style.position="absolute",f.style.left=u-f.widthPx/2+"px",f.style.top=d-f.heightPx/2+"px",t.mouseOverlay.appendChild(f),()=>t.mouseOverlay.removeChild(f)},Options:function(e,t,n,o,r,i){var s;if(0===(null==(s=t.options.optionControls)?void 0:s.length))return()=>{};if(void 0!==t.options.optionControls&&1===t.options.optionControls.length&&"keyboard"===t.options.optionControls[0])return sl(e,t,n,o);const{cells:a,columnWidth:c,rowHeight:l}=o,{row:u,column:d}=e,{centerX:p,centerY:f}=a[u][d],h=f-l/2,v=p-c/2,m=o.width-v-c;return Qc(t,["default"],(()=>{}),c,h,m)},Keyboard:sl,Switch:function(e,t,n,o,r,i){const{cells:s,columnWidth:a}=o,{row:c,column:l}=e,{centerX:u,centerY:d}=s[c][l],p=fc(e.symbol,{onUp:()=>i.setActiveConfig(i.getActiveConfig(),e.layerName)},a);return p.style.position="absolute",p.style.left=u-p.widthPx/2+"px",p.style.top=d-p.heightPx/2+"px",t.mouseOverlay.appendChild(p),()=>{t.mouseOverlay.removeChild(p)}},ScreenMove:function(e,t,n,o,r,i){const{cells:s,columnWidth:a}=o,{row:c,column:l}=e,{centerX:u,centerY:d}=s[c][l];let p=.5,f=.5;e.direction.indexOf("up")>=0&&(f=0);e.direction.indexOf("down")>=0&&(f=1);e.direction.indexOf("left")>=0&&(p=0);e.direction.indexOf("right")>=0&&(p=1);const h={onDown:()=>{n.sendMouseMotion(p,f)},onUp:()=>{n.sendMouseMotion(.5,.5)}};if(r.register(c,l,{activate:h.onDown,deactivate:h.onUp}),al(o,c,l))return()=>{};const v=fc(e.symbol,h,a);return v.style.position="absolute",v.style.left=u-v.widthPx/2+"px",v.style.top=d-v.heightPx/2+"px",t.mouseOverlay.appendChild(v),()=>t.mouseOverlay.removeChild(v)},PointerButton:function(e,t,n,o,r,i){const{cells:s,columnWidth:a}=o,{row:c,column:l,click:u}=e,{centerX:d,centerY:p}=s[c][l],f={onDown:()=>{u?n.sendMouseButton(e.button,!0):t.pointerButton=e.button},onUp:()=>{u?n.sendMouseButton(e.button,!1):t.pointerButton=0}};if(r.register(c,l,{activate:f.onDown,deactivate:f.onUp}),al(o,c,l))return()=>{};const h=fc(e.symbol,f,a);return h.style.position="absolute",h.style.left=d-h.widthPx/2+"px",h.style.top=p-h.heightPx/2+"px",t.mouseOverlay.appendChild(h),()=>t.mouseOverlay.removeChild(h)},PointerMove:function(e,t,n,o,r,i){const{cells:s,columnWidth:a}=o,{row:c,column:l,x:u,y:d}=e,{centerX:p,centerY:f}=s[c][l],h={onDown:()=>{n.sendMouseMotion(u,d)},onUp:()=>{n.sendMouseMotion(u,d)}};if(r.register(c,l,{activate:h.onDown,deactivate:h.onUp}),al(o,c,l))return()=>{};const v=fc(e.symbol,h,a);return v.style.position="absolute",v.style.left=p-v.widthPx/2+"px",v.style.top=f-v.heightPx/2+"px",t.mouseOverlay.appendChild(v),()=>t.mouseOverlay.removeChild(v)},PointerReset:function(e,t,n,o,r,i){const{cells:s,columnWidth:a}=o,{row:c,column:l}=e,{centerX:u,centerY:d}=s[c][l],p={onDown:()=>{n.sendMouseSync()}};if(r.register(c,l,{activate:p.onDown,deactivate:()=>{}}),al(o,c,l))return()=>{};const f=fc(e.symbol,p,a);return f.style.position="absolute",f.style.left=u-f.widthPx/2+"px",f.style.top=d-f.heightPx/2+"px",t.mouseOverlay.appendChild(f),()=>t.mouseOverlay.removeChild(f)},PointerToggle:function(e,t,n,o,r,i){const{cells:s,columnWidth:a}=o,{row:c,column:l}=e,{centerX:u,centerY:d}=s[c][l],p={onDown:()=>{t.pointerDisabled=!t.pointerDisabled,t.pointerDisabled?f.classList.contains("emulator-button-highlight")||f.classList.add("emulator-button-highlight"):f.classList.remove("emulator-button-highlight")}};if(r.register(c,l,{activate:p.onDown,deactivate:()=>{}}),al(o,c,l))return()=>{};const f=fc(e.symbol,p,a);return f.style.position="absolute",f.style.left=u-f.widthPx/2+"px",f.style.top=d-f.heightPx/2+"px",t.mouseOverlay.appendChild(f),()=>t.mouseOverlay.removeChild(f)},NippleActivator:function(e,t,n,o,r,i){const{cells:s,columnWidth:a,rowHeight:c,width:l,height:u}=o,{row:d,column:p}=e,{centerX:f,centerY:h}=s[d][p],v=document.createElement("div"),m=1.5,_=Math.max(0,f-a*m),y=Math.max(0,h-c*m),g=Math.max(0,l-f-a*m),b=Math.max(0,u-h-c*m);v.style.position="absolute",v.style.zIndex="999",v.style.left=_+"px",v.style.top=y+"px",v.style.right=g+"px",v.style.bottom=b+"px",t.mouseOverlay.appendChild(v);const w=Jc({zone:v,multitouch:!1,maxNumberOfNipples:1,mode:"static",follow:!1,dynamicPage:!0,size:1.5*Math.max(a,c),position:{left:(l-g-_)/2+"px",top:(u-b-y)/2+"px"}});let x=-1,k=-1;w.on("move",((e,t)=>{if(t.distance<10)return r.deactivate(k,x),x=-1,void(k=-1);let n=-1,o=-1;const i=22.5,s=t.angle.degree;s>i&&s<=67.5?(n=p+1,o=d-1):s>67.5&&s<=112.5?(n=p,o=d-1):s>112.5&&s<=157.5?(n=p-1,o=d-1):s>157.5&&s<=202.5?(n=p-1,o=d):s>202.5&&s<=247.5?(n=p-1,o=d+1):s>247.5&&s<=292.5?(n=p,o=d+1):s>292.5&&s<=337.5?(n=p+1,o=d+1):(n=p+1,o=d),x===n&&k===o||(r.deactivate(k,x),r.activate(o,n),x=n,k=o)}));let C=!1;w.on("start",(()=>{C=!0})),w.on("end",(()=>{C=!1,r.deactivate(k,x),k=-1,x=-1}));const S={capture:!0};function P(e){C&&w.processOnEnd(e)}for(const E of nc.enders)t.mouseOverlay.addEventListener(E,P,S);return()=>{w.destroy(),t.mouseOverlay.removeChild(v);for(const e of nc.enders)t.mouseOverlay.removeEventListener(e,P,S)}}};function sl(e,t,n,o,r,i){const{cells:s,columnWidth:a}=o,{row:c,column:l}=e,{centerX:u,centerY:d}=s[c][l],p=fc("keyboard",{onUp:()=>t.toggleKeyboard()},a);return p.style.position="absolute",p.style.left=u-p.widthPx/2+"px",p.style.top=d-p.heightPx/2+"px",t.mouseOverlay.appendChild(p),()=>{t.mouseOverlay.removeChild(p)}}function al(e,t,n){return!0===e.cells[t][n].hidden}function cl(e,t,n){function o(o,r){if((o!==t||r!==n)&&o>=0&&o<e.cells.length){const t=e.cells[o];r>=0&&r<t.length&&(t[r].hidden=!0)}}for(let r=t-1;r<=t+1;++r)for(let e=n-1;e<=n+1;++e)o(r,e)}function ll(e,t){!function(e){const t=eo();ae((()=>{e.events().onMessage(((e,...n)=>{var o;"error"===e&&(null==(o=n[0])?void 0:o.startsWith("[panic]"))&&t(Jr.actions.showToast({message:n[0],intent:"panic"}))}))}),[e,t])}(t),function(e){const t=on((e=>e.dos.fastForward)),n=on((e=>e.dos.frameSkip)),o=on((e=>e.dos.cpuAuto)),r=on((e=>e.dos.speed)),i=on((e=>e.dos.fastForwardOnBoot)),s=on((e=>e.dos.withSockdrive));let a=parseInt(on((e=>e.dos.cycles)));(isNaN(a)||a<3e3||a>1e6)&&(a=0);ae((()=>{if(i>0&&s){const t=setInterval((()=>{e.sendBackendEvent({type:"wc-trigger-event",event:"fast_forward:1"})}),300);setTimeout((()=>{clearInterval(t),e.sendBackendEvent({type:"wc-trigger-event",event:"fast_forward:0"})}),1e3*i)}}),[e,i,s]),ae((()=>{e.canSetFastForward?e.sendBackendEvent({type:"wc-trigger-event",event:"fast_forward:"+(t?"1":"0")}):e.canSetFastForward=!0}),[e,t]),ae((()=>{e.canSetFrameSkip?e.sendBackendEvent({type:"wc-trigger-event",event:"frame_skip:"+n}):e.canSetFrameSkip=!0}),[e,n]),ae((()=>{e.canAdjustCpu?e.sendBackendEvent({type:"wc-trigger-event",event:"auto_adjust:"+(o?"1":"0")}):e.canAdjustCpu=!0}),[e,o]),ae((()=>{e.canSetCycles&&a>0?e.sendBackendEvent({type:"wc-trigger-event",event:"cycles:"+a}):e.canSetCycles=!0}),[e,a]),ae((()=>{e.canSetSpeed?e.sendBackendEvent({type:"wc-trigger-event",event:"speed:"+r}):e.canSetSpeed=!0}),[e,r])}(t),function(e){const t=on((e=>e.dos.imageRendering));ae((()=>{e.style.imageRendering="smooth"===t?"auto":t}),[e,t])}(e),function(e){const t=eo(),n=Wr();ae((()=>{let o=0,r=0,i=48,s=0,a=0,c=0,l=0,u=Date.now();const d=setInterval((()=>{e.asyncifyStats().then((e=>{const d=(Date.now()-u)/1e3;if(d>0){const p={cpuMetrics:e.cpuMetrics??null,glfx:e.glfx??!1,offscreenCanvas:e.offscreenCanvas??!1,cycles:0,nonSkippableSleepPreSec:Math.round((e.nonSkippableSleepCount-o)/d),sleepPerSec:Math.round((e.sleepCount-r)/d),sleepTimePerSec:Math.round((e.sleepTime-i)/d),framePerSec:Math.round((e.messageFrame-s)/d),soundPerSec:Math.round((e.messageSound-a)/d),msgSentPerSec:Math.round((e.messageSent-c)/d),msgRecvPerSec:Math.round((e.messageReceived-l)/d),netSent:e.netSent,netRecv:e.netRecv,driveIo:structuredClone(e.driveIo)??[]};if(t(ki.actions.stats(p)),p.driveIo.length>0){let e=n("preloading_sockdrive"),o=!1;for(let t=0;t<p.driveIo.length;t++){const n=p.driveIo[t],r=Math.min(100,Math.round(100*n.read/n.preload));e+=" "+(0===t?"C: ":", D: ")+" "+r+"%",o=o||r<100}o&&t(Jr.actions.showToast({message:e,long:!0}))}o=e.nonSkippableSleepCount,r=e.sleepCount,i=e.sleepTime,s=e.messageFrame,a=e.messageSound,c=e.messageSent,l=e.messageReceived,u=Date.now()}}))}),1e3);return()=>{clearInterval(d)}}),[t,e])}(t),function(e){const t=on((e=>e.dos.paused)),n=on((e=>e.ui.documentHidden));ae((()=>{t||n?e.pause():e.resume()}),[t,n,e])}(t),function(e){const t=eo(),n="dosboxX"===on((e=>e.dos.backend)),o=on((e=>e.dos.paused));ae((()=>function(e,t,n,o,r){const i=new Set;function s(){i.forEach((e=>{t.sendKeyEvent(e,!1)})),i.clear()}function a(e){if("text"===e.target.type)return;n&&("F6"===e.key&&(_a(t),o(Jr.actions.setHaveQuickSave(!0))),"F7"===e.key&&ya(t));const s=ca(e.keyCode,e.location);284===s?o(ki.actions.paused(!r)):(t.sendKeyEvent(s,!0),i.add(s),e.stopPropagation(),e.preventDefault())}function c(e){if("text"===e.target.type)return;const n=ca(e.keyCode,e.location);t.sendKeyEvent(n,!1),i.delete(n),e.stopPropagation(),e.preventDefault()}function l(){s()}return e.addEventListener("keydown",a),e.addEventListener("keyup",c),e.addEventListener("blur",l),()=>{s(),e.removeEventListener("keydown",a),e.removeEventListener("keyup",c),e.removeEventListener("blur",l)}}(window,e,n,t,o)),[e,n,t,o])}(t),function(e,t){const n=on((e=>e.dos.mobileControls)),o=on((e=>e.dos.mouseCapture)),r=on((e=>e.dos.mouseSensitivity));ae((()=>{if(!n)return cc(o,r,0,e,t)}),[e,t,o,r,n])}(e,t),function(e,t){const n=hi(),o=on((e=>e.dos.mouseCapture)),r=on((e=>e.dos.mirroredControls)),i=1+on((e=>e.dos.scaleControls)),s=.1+3*on((e=>e.dos.mouseSensitivity)),a=on((e=>e.dos.mobileControls)),c=eo();let l=on((e=>e.dos.softKeyboard));function u(){l=!l,c(ki.actions.softKeyboard(l))}ae((()=>{a?null===n.layers?(n.layers=async function(){const n=new uc(e.parentElement,e,u,{}),a=dc((await t.config()).jsdosConf);let c,l=null,d=()=>{};const p={config:a,layers:n,autolock:o,sensitivity:s,mirroredControls:r,scaleControls:i,activeLayer:c,getActiveConfig:()=>l,setActiveConfig:(e,o)=>{l=e,c=o,d(),null===e?(d=()=>{},n.mouseOverlay.style.display="none"):void 0===e.version?(n.mouseOverlay.style.display="block",d=tl(p,n,e,t)):(n.mouseOverlay.style.display="block",d=ol(n,e,t,p,p.mirroredControls,p.scaleControls,o))}};return p.setActiveConfig(a),p}(),n.layers.catch(console.error)):n.layers.then((e=>{e.autolock=o,e.sensitivity=s,e.mirroredControls=r,e.scaleControls=i,e.setActiveConfig(e.getActiveConfig()??e.config,e.activeLayer)})):null!==n.layers&&n.layers.then((e=>e.setActiveConfig(null)))}),[t,o,s,a,r,i])}(e,t),function(e,t){const n=hi(),o=on((e=>e.dos.renderBackend)),r=on((e=>e.dos.renderAspect));let i;switch(r){case"1/1":i=1;break;case"5/4":i=5/4;break;case"4/3":i=4/3;break;case"16/10":i=1.6;break;case"16/9":i=16/9;break;case"Fit":i=bi}ae((()=>{let r=()=>{};if(n.offscreenCanvas)r=function(e,t,n){let o=0,r=0;const i=()=>{Ga(e,o,r,n)},s=(e,t)=>{o=e,r=t,i()};t.events().onFrameSize(s),t.events().onFrame((()=>{console.error("onFrame should not be called")})),s(t.width(),t.height());const a=new ResizeObserver(i);return a.observe(e.parentElement),window.addEventListener("resize",i),()=>{t.events().onFrameSize((()=>{})),t.events().onFrame((()=>{})),a.disconnect(),window.removeEventListener("resize",i)}}(e,t,i);else if("canvas"===o)r=Ja(e,t,i);else try{r=$a(e,t,n,i)}catch(s){console.error("Unalbe to start webgl render",s),r=Ja(e,t,i)}return r}),[e,t,o,i])}(e,t),function(e){const t=Qn();ae((()=>{const n=function(e,t){const n=e.soundFrequency();if(0===n)return console.warn("Can't create audio node with sampleRate === 0, ingnoring"),()=>{};let o=null;if("undefined"!=typeof AudioContext?o=new AudioContext({sampleRate:n,latencyHint:"interactive"}):void 0!==window.webkitAudioContext&&(o=new window.webkitAudioContext({sampleRate:n,latencyHint:"interactive"})),null==o)return()=>{};const r=new Qa;e.events().onSoundPush((e=>{r.length()<6144&&r.push(e)}));const i=o.createScriptProcessor(2048,0,1);let s=!1;i.onaudioprocess=e=>{const t=e.outputBuffer.length,n=e.outputBuffer.numberOfChannels,o=r.length();if(s||(s=o>=2048),s)for(let i=0;i<n;i++){const n=e.outputBuffer.getChannelData(i);r.writeTo(n,t)}};const a=o.createGain();let c;a.connect(o.destination),i.connect(a),a.gain.value=1,c=t((e=>{a.gain.value=e}));const l=()=>{null!==o&&"suspended"===o.state&&o.resume()};return document.addEventListener("pointerdown",l,{once:!0}),document.addEventListener("keydown",l,{once:!0}),()=>{e.events().onSoundPush((()=>{})),null!==o&&(i.disconnect(),a.disconnect(),o.close().catch(console.error),o=null),void 0!==c&&c(),document.removeEventListener("pointerdown",l),document.removeEventListener("keydown",l)}}(e,(e=>{let n=1;const o=()=>{const o=mi(t).dos.volume;Math.abs(n-o)>=.05&&(e(o),n=o)};return t.subscribe(o)}));return n}),[e])}(t)}const ul=[{cpu:"a7",width:640,height:1136,model:"iPhone 5/iPhone 5s"},{cpu:"a7",width:1536,height:2048,model:"iPad Air/iPad Mini 2/iPad Mini 3"},{cpu:"a8",width:640,height:1136,model:"iPod touch (6th gen)"},{cpu:"a8",width:750,height:1334,model:"iPhone 6"},{cpu:"a8",width:1242,height:2208,model:"iPhone 6 Plus"},{cpu:"a8",width:1536,height:2048,model:"iPad Air 2/iPad Mini 4"},{cpu:"a9",width:640,height:1136,model:"iPhone SE"},{cpu:"a9",width:750,height:1334,model:"iPhone 6s"},{cpu:"a9",width:1242,height:2208,model:"iPhone 6s Plus"},{cpu:"a9x",width:1536,height:2048,model:"iPad Pro (1st gen 9.7-inch)"},{cpu:"a9x",width:2048,height:2732,model:"iPad Pro (1st gen 12.9-inch)"},{cpu:"a10",width:750,height:1334,model:"iPhone 7"},{cpu:"a10",width:1242,height:2208,model:"iPhone 7 Plus"},{cpu:"a10x",width:1668,height:2224,model:"iPad Pro (2th gen 10.5-inch)"},{cpu:"a10x",width:2048,height:2732,model:"iPad Pro (2th gen 12.9-inch)"},{cpu:"a11",width:750,height:1334,model:"iPhone 8"},{cpu:"a11",width:1242,height:2208,model:"iPhone 8 Plus"},{cpu:"a11",width:1125,height:2436,model:"iPhone X"},{cpu:"a12",width:828,height:1792,model:"iPhone Xr"},{cpu:"a12",width:1125,height:2436,model:"iPhone Xs"},{cpu:"a12",width:1242,height:2688,model:"iPhone Xs Max"},{cpu:"a12x",width:1668,height:2388,model:"iPad Pro (3rd gen 11-inch)"},{cpu:"a12x",width:2048,height:2732,model:"iPad Pro (3rd gen 12.9-inch)"},{cpu:"a13",width:828,height:1792,model:"iPhone 11"},{cpu:"a13",width:1125,height:2436,model:"iPhone 11 Pro"},{cpu:"a13",width:1242,height:2688,model:"iPhone 11 Pro Max"},{cpu:"a14",width:1080,height:2340,model:"iPhone 12 Mini"},{cpu:"a14",width:1170,height:2532,model:"iPhone 12"},{cpu:"a14",width:1284,height:2778,model:"iPhone 12 Pro Max"},{cpu:"a15",width:1080,height:2340,model:"iPhone 13 Mini"},{cpu:"a15",width:1170,height:2532,model:"iPhone 13"},{cpu:"a15",width:1284,height:2778,model:"iPhone 13 Pro Max"},{cpu:"a15",width:1170,height:2532,model:"iPhone 14"},{cpu:"a15",width:1284,height:2778,model:"iPhone 14 Plus"},{cpu:"a16",width:1179,height:2556,model:"iPhone 14 Pro"},{cpu:"a16",width:1290,height:2796,model:"iPhone 14 Pro Max"},{cpu:"a16",width:1179,height:2556,model:"iPhone 15"},{cpu:"a16",width:1290,height:2796,model:"iPhone 15 Plus"},{cpu:"a17",width:1179,height:2556,model:"iPhone 15 Pro"},{cpu:"a17",width:1290,height:2796,model:"iPhone 15 Pro Max"},{cpu:"a18",width:1179,height:2556,model:"iPhone 16"},{cpu:"a18",width:1290,height:2796,model:"iPhone 16 Plus"},{cpu:"a18",width:1206,height:2622,model:"iPhone 16 Pro"},{cpu:"a18",width:1320,height:2868,model:"iPhone 16 Pro Max"}];function dl(e){const t=navigator.userAgent+" ";function n(e,t,n){const o=RegExp(e,"i").exec(t);return o&&o[n]}const o=function(){const e={Yandex:{prefixs:["YaApp","YaBrowser"]},Firefox:{prefixs:["Firefox"]},Opera:{prefixs:["OPR"]},Edge:{prefixs:["Edg"]},"Samsung Browser":{prefixs:["SamsungBrowser"]},"Internet Explorer":{prefixs:["Trident","MSIE"]},Chrome:{prefixs:["Chrome"]},"Chrome on iOS":{prefixs:["CriOS"]},"Firefox on iOS":{prefixs:["FxiOS"]},Safari:{prefixs:["Safari"]},Facebook:{prefixs:["FBSV"],regExp:"[/;](.*?)[;\\)]"}};for(const[o,r]of Object.entries(e))for(const e of r.prefixs){let i=n(e+(r.regExp||"[/ ](.*?)[ \\)]"),t,1);if(null!==i)return"Safari"===o&&(i=n("Version/(.*?) ",t,1)),"Internet Explorer"===o&&(i=n("rv:(.*?)\\)? ",t,1)||i),{name:o,version:i}}return{name:"",version:""}}(),r=function(){const e={Android:["Android ([0-9_.]+)"],Windows:["Windows (.*?)[;)]"],iOS:["iPhone OS ([0-9_.]+)","iPad.*? OS ([0-9_.]+)"],macOS:["Mac OS X ([0-9_.]+)"],Linux:["FreeBSD( )","OpenBSD( )","Linux|X11()"],"Search Bot":["bot|google|baidu|bing|msn|teoma|slurp|yandex"]};for(const[o,r]of Object.entries(e))for(const e of r){let r=n(e,t,1);if(null!=r){if(r=r.replace(/_/g,"."),"Windows"===o){r={"NT 5.0":"2000","NT 5.1":"XP","NT 5.2":"Server 2003","NT 6.0":"Vista","NT 6.1":"7","NT 6.2":"8","NT 6.3":"8.1","NT 10.0":"10"}[r]||r}return{name:o,version:r}}}return{name:"",version:""}}(),i=/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion)||/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.userAgent)||/MacIntel/.test(navigator.platform)&&void 0!==navigator.maxTouchPoints&&navigator.maxTouchPoints>2,s=navigator.hardwareConcurrency,a=function(e){const t=e.getExtension("WEBGL_debug_renderer_info");if(t)return e.getParameter(t.UNMASKED_RENDERER_WEBGL)||"-";return"-"}(e),c=function(){const e=window.devicePixelRatio||1;return{width:Math.min(screen.width,screen.height)*e,height:Math.max(screen.width,screen.height)*e}}(),l=c.height,u=c.width;return{browser:o.name,browserVersion:o.version??"???",mobile:i,os:r.name,osVersion:r.version,gpu:a,deviceModel:pl(i,a,{width:u,height:l}),cpu:(s||0).toString(),emscripten:"3.1.68"}}function pl(e,t,n){if(!e)return"desktop/laptop";return t.match(/^apple+[a-zA-Z0-9_\s]+gpu$/i)?function(e){let t="";for(const n of ul)e.width===Math.min(n.width,n.height)&&e.height===Math.max(n.width,n.height)&&(t+=t.length>0?"/"+n.model:n.model);return t.length>0?t:"unknown iPhone"}(n):function(e){const t=[/Android[\s][\d]+\.[\d]+\.[\d]+; [A-Za-z]{2}\-[A-Za-z]{2}\; (.+) Build/,/Android[\s][\d]+\.[\d]+\.[\d]+; (.+) Build/,/Android(.+)Build/];for(const n of t){const t=e.match(n);if(t&&t.length>0)return t[1]}return"unknown Android"}(navigator.userAgent)}function fl(e){const t=e.ci,n=hi(),o=on((e=>e.dos.backend)),r=on((e=>e.dos.worker)),i=on((e=>e.dos.emuVersion)),s=on((e=>e.dos.backendHardware))&&n.options.backendHardware,[a,c]=ie(!1),[l,u]=ie({runs:0,time:0,vax:0,pc:null}),[d,p]=ie({sleepPerSec:0,cpuMax:0});return ae((()=>{const e=[];t.events().onStdout((t=>{for(const n of e)n(t)}));const a=t.events().onStdout;t.events().onStdout=t=>{e.push(t)};let l=Date.now(),f=0;return t.events().onStdout((e=>{if(!e.startsWith("dhry2:"))return;t.asyncifyStats().then((e=>{var t;const n=Date.now()-l;p({sleepPerSec:Math.round(1e3*(e.sleepCount-f)/n),cpuMax:Math.max((null==(t=e.cpuMetrics)?void 0:t.cpuMax)??0,d.cpuMax)}),l=Date.now(),f=e.sleepCount}));const[a,h,v,m]=e.split(" "),_=Number.parseInt(h),y=Number.parseFloat(v),g=Number.parseFloat(m);y>=5e3?(u({runs:_,time:Math.round(10*y)/10,vax:Math.round(100*g)/100,pc:hl(g)}),(async()=>{const e=n.gl;if(e){const t={token:"",test:"dhry2",jsdos:"8.4.1",emu:i,backend:o,worker:r,hardware:!1!==s&&null!=s,result:Math.round(100*g)/100,...dl(e)};await fetch("https://d5dn8hh4ivlobv6682ep.apigw.yandexcloud.net/perf/set",{method:"POST",body:JSON.stringify(t)})}})().catch(console.error).finally((()=>c(!0)))):u({runs:_,time:Math.round(10*y)/10,vax:Math.round(100*g)/100,pc:null})})),()=>{t.events().onStdout=a}}),[t]),zi("div",{class:"dhry2-window",children:[zi("div",{class:"title",children:"Dhrystone 2 Benchmark"}),zi("div",{class:"backend",children:["Backend: ",o+"-"+(r?"worker":"direct")," ",s?"(WS)":"(WA)"]}),zi("div",{class:"results",children:[zi("div",{children:"VAX:"}),zi("div",{children:l.vax}),zi("div",{children:"Cycles MAX:"}),zi("div",{children:d.cpuMax}),zi("div",{children:"Sleep p/sec:"}),zi("div",{children:d.sleepPerSec}),zi("div",{children:"Runs:"}),zi("div",{children:l.runs}),zi("div",{children:"Time:"}),zi("div",{children:[l.time," ",zi("span",{children:"ms"})]}),a&&null!==l.pc&&zi("div",{children:"PC:"}),a&&null!==l.pc&&zi("div",{children:l.pc??"..."})]}),!a&&zi("div",{class:"mt-14 text-yellow-500",children:"Please wait until this message disappears"})]})}function hl(e){let t=0;for(;2*t+1<vl.length&&!(vl[2*t+1]>=e);)t++;return t=Math.min(vl.length/2-1,t),(vl[2*t]+"").trim()}const vl=["AMD 80386 40MHz",13.7,"IBM 486D2 50MHz",22.4,"80486 DX2 66MHz",35.3,"IBM 486BL 100MHz",40.9,"AMD 5X86 133MHz",84.5,"Pentium 75MHz",87.1,"Cyrix P150 120MHz",160,"Pentium 100MHz",122,"Cyrix PP166 133MHz",180,"IBM 6x86 150MHz",188,"Pentium 133MHz",181,"Pentium 166MHz",189,"Cyrix PR233 188MHz",232,"Pentium 200MHz",269,"Pentium MMX 200MHz",276,"AMD K6 200MHz",289,"Pentium Pro 200MHz",312,"Celeron A 300MHz",484,"Pentium II 300MHz",477,"AMD K62 500MHz",606,"AMD K63 450MHz",645,"Pentium II 450MHz",713,"Celeron A 450MHz",720,"Pentium III 450MHz",722,"Pentium III 600MHz",959,"Athlon 600MHz",942,"Duron 600MHz",999,"Pentium III 1000MHz",1595,"PIII Tualatin 1200MHz",1907,"Pentium 4 1700MHz",1843,"Athlon Tbird 1000MHz",1659,"Duron 1000MHz",1674,"Celeron M 1295MHz",2273,"Atom 1600MHz",1828,"Pentium 4 1900MHz",2003,"Atom 1666MHz",1948,"P4 Xeon 2200MHz",2265,"Atom Z8300 1840MHz",2686,"Athlon 4 1600MHz",2830,"Pentium M 1862MHz",3933,"Ath4 Barton 1800MHz",3172,"Pentium 4E 3000MHz",3553,"Athlon XP 2080MHz",3700,"Turion 64 M 1900MHz",3742,"Pentium 4 3066MHz",4012,"Opteron 1991MHz",3985,"Core 2 Duo M 1830MHz",4952,"Athlon XP 2338MHz",4160,"Athlon 64 2150MHz",4288,"Pentium 4 3678MHz",4227,"Athlon 64 2211MHz",4462,"Celeron C2 M 2000MHz",5275,"Core 2 Duo 1 CP 2400MHz",6446,"Core i5 2467M 2300MHz",4752,"Phenom II 1 CP 3000MHz",7615,"Core i7 930 3066MHz",8684,"Core i7 860 3460MHz",9978,"Core i7 3930K 3800MHz",11197,"Core i7 4820K 3900MHz",11867,"Core i7 4820K 3900MHz",11978,"Core i7 3930K",13877],ml=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","!","#","$","%","&","(",")","*","+",",",".","/",":",";","<","=",">","?","@","[","]","^","_","`","{","|","}","~",'"'],_l=[91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,62,90,63,64,65,66,91,67,68,69,70,71,91,72,73,52,53,54,55,56,57,58,59,60,61,74,75,76,77,78,79,80,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,81,91,82,83,84,85,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,86,87,88,89,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91];let yl=0;const gl=function(e){const t=e.length;let n="",o=0,r=0,i=0;for(yl=0;yl<t;++yl)o|=(255&e[yl])<<r,r+=8,r>13&&(i=8191&o,i>88?(o>>=13,r-=13):(i=16383&o,o>>=14,r-=14),n+=ml[i%91],n+=ml[i/91|0]);return r>0&&(n+=ml[o%91],(r>7||o>90)&&(n+=ml[o/91|0])),n},bl=function(e){let t=e.length;const n=t/1.2297|0;let o=0,r=0,i=-1,s=0,a=-1,c=0,l=new Array(n);for(s=0;s<t;++s)if(c=e.charCodeAt(s),91!==_l[c])if(-1===i)i=_l[c];else{i+=91*_l[c],o|=i<<r,r+=(8191&i)>88?13:14;do{++a>=n?l.push(255&o):l[a]=255&o,o>>=8,r-=8}while(r>7);i=-1}-1!==i&&(++a>=n?l.push(o|i<<r):l[a]=o|i<<r),a>-1&&a<n-1&&(l=l.slice(0,a+1));const u=new Uint8Array(l.length);for(s=0,t=l.length;s<t;++s)u[s]=l[s];return u},wl=new TextDecoder,xl=new TextEncoder,kl=2e8,Cl={};["wc-install","wc-run","wc-pack-fs-to-bundle","wc-add-key","wc-mouse-move","wc-mouse-button","wc-mouse-sync","wc-exit","wc-sync-sleep","wc-pause","wc-resume","wc-mute","wc-unmute","wc-connect","wc-disconnect","wc-backend-event","wc-asyncify-stats","wc-fs-tree","wc-fs-get-file","wc-send-data-chunk","wc-net-connected","wc-net-received","wc-sockdrive-opened","wc-sockdrive-new-range","wc-unload"].forEach(((e,t)=>Cl[e]=t));const Sl={};["ws-extract-progress","ws-ready","ws-server-ready","ws-frame-set-size","ws-update-lines","ws-log","ws-warn","ws-err","ws-stdout","ws-exit","ws-persist","ws-sound-init","ws-sound-push","ws-config","ws-sync-sleep","ws-connected","ws-disconnected","ws-asyncify-stats","ws-fs-tree","ws-send-data-chunk","ws-net-disconnect","ws-net-send","ws-sockdrive-open","ws-sockdrive-ready","ws-sockdrive-close","ws-sockdrive-load-range","ws-sockdrive-write-sector","ws-unload"].forEach(((e,t)=>Sl[t]=e));class Pl{constructor(e){t(this,"socket"),this.socket=e}send(e){this.socket.send(e)}onMessage(e){let t=null,n=null,o=0,r=[];const i=i=>{if(null===t||t<7){if(null===t){if(i.length<6||1!==i[0]||1!==ma(i,1))return void console.error("unparsable version message on transport layer, blob size:",i.length," error: too short");t=i[5]}e(i)}else null===n?(n=ma(i,0),r.push(i.slice(4)),o+=i.length-4):(r.push(i),o+=i.length);if(null!==n&&o===n){const t=new Uint8Array(n);let i=0;for(const e of r)t.set(e,i),i+=e.length;r=[],o=0,n=null,e(t)}},s=[];let a=!1;this.socket.addEventListener("message",(e=>{s.push({size:e.data.size,buffer:e.data.arrayBuffer()}),a||(a=!0,c().catch(console.error).finally((()=>a=!1)))}));const c=async()=>{for(;s.length>0;){const{size:t,buffer:n}=s.shift();try{const e=new Uint8Array(await n);i(e)}catch(e){console.error("unparsable message on transport layer, blob size:",t," error:",e.message),console.error(e)}}}}onError(e){this.socket.addEventListener("error",(t=>{e(t),this.socket.close()}))}}class El{constructor(e,n){t(this,"socket"),t(this,"sessionId",Date.now()+""),t(this,"hardware"),t(this,"onInit",(()=>{})),t(this,"net",null),t(this,"cycles",0),t(this,"version",0),t(this,"handler",(()=>{})),this.socket=e,this.socket.onError((e=>{this.handler("ws-err",{tag:"ws",message:e.message??"Unknown transport layer error"}),this.handler("ws-exit",{})})),this.socket.onMessage(this.onMessage.bind(this)),this.sendMessageToSocket("wc-install"),this.hardware=null,this.onInit=n}readUint64(e,t){return ma(e,t)+ma(e,t+4)*2**32}sendMessageToSocket(e,...t){let n=1;for(const i of t)n+=4+((null==i?void 0:i.length)??0);const o=new Uint8Array(n);o[0]="string"==typeof e?Cl[e]:e;let r=1;for(const i of t)va(o,(null==i?void 0:i.length)??0,r),r+=4,i&&(o.set(i,r),r+=i.length);this.socket.send(o)}readMessage(e){const t=[];let n=1;for(;n+4<=e.length;){const o=ma(e,n);if(n+=4,n+o>e.length)throw new Error("read_message out of bounds");t.push(e.slice(n,n+o)),n+=o}return{id:e[0],payload:t}}onMessage(e){var t;const{id:n,payload:o}=this.readMessage(e),r=Sl[n];switch(r){case"ws-ready":this.version=o&&o[0]&&o.length>0?o[0][0]:0,this.onInit(this.version),this.handler(r,{});break;case"ws-server-ready":case"ws-exit":"ws-server-ready"!==r&&this.handler(r,{});break;case"ws-stdout":case"ws-log":case"ws-warn":case"ws-err":this.handler(r,{tag:wl.decode(o[0]),message:wl.decode(o[1])});break;case"ws-send-data-chunk":{const e={type:wl.decode(o[0]),name:wl.decode(o[1]),data:o[2]};this.handler(r,{chunk:e})}break;case"ws-config":this.handler(r,{dosboxConf:o[0],jsdosConf:wl.decode(o[1])});break;case"ws-sound-init":this.handler(r,{freq:ma(o[0],0)}),this.handler("ws-server-ready",{});break;case"ws-sound-push":this.handler(r,{samples:new Float32Array(o[0].buffer)});break;case"ws-frame-set-size":this.handler(r,{width:ma(o[0],0),height:ma(o[0],4)});break;case"ws-update-lines":if(o.length>0){const e=[];for(const t of o)e.push({start:ma(t,0),heapu8:t.slice(4)});this.handler(r,{lines:e})}break;case"ws-asyncify-stats":{this.cycles+=ma(o[0],0);const e={messageSent:ma(o[0],4),messageReceived:ma(o[0],8),messageFrame:ma(o[0],12),messageSound:ma(o[0],16),nonSkippableSleepCount:0,sleepCount:0,sleepTime:0,cycles:this.cycles,netSent:0,netRecv:0,driveBufferedAmount:0,driveIo:[]};this.handler(r,e)}break;case"ws-connected":this.handler(r,{networkType:o[0][0],address:wl.decode(o[1])});break;case"ws-disconnected":this.handler(r,{networkType:o[0][0]});break;case"ws-fs-tree":{let e=function(e){var t;const n=e.split("/");let o=i;for(let r=1;r<n.length-1;++r){const i=n[r];if(o=null==(t=o.nodes)?void 0:t.find((e=>e.name==i)),!o)throw new Error("Unable to find node "+e+", subdir "+i)}return[o,n[n.length-1]]};const n=[];for(let t=0;t<o.length-1;++t)n.push({name:wl.decode(o[t]),size:null});const r=o[o.length-1];for(let t=0;t<n.length;++t){const e=ma(r,4*t);n[t].size=e<0?null:e}const i={name:".",nodes:[],size:null};for(const{name:o,size:s}of n){const[n,r]=e(o);null==(t=n.nodes)||t.push({name:r,size:s,nodes:null===s?[]:null})}this.handler("ws-fs-tree",{fsTree:i})}break;case"ws-persist":this.handler("ws-persist",{bundle:o.length>0?o[0]:null});break;case"ws-net-send":this.handler("ws-net-send",{networkId:ma(o[0],0),data:o[1]});break;case"ws-net-disconnect":this.handler("ws-net-disconnect",{networkId:ma(o[0],0)});break;case"ws-unload":this.handler("ws-unload",{});break;case"ws-sockdrive-open":this.handler("ws-sockdrive-open",{handle:ma(o[0],0),url:wl.decode(o[1])});break;case"ws-sockdrive-ready":this.handler("ws-sockdrive-ready",{handle:ma(o[0],0)});break;case"ws-sockdrive-close":this.handler("ws-sockdrive-close",{handle:ma(o[0],0)});break;case"ws-sockdrive-load-range":this.handler("ws-sockdrive-load-range",{handle:ma(o[0],0),range:ma(o[0],4)});break;case"ws-sockdrive-write-sector":this.handler("ws-sockdrive-write-sector",{handle:ma(o[0],0),sector:ma(o[0],4),data:o[1]});break;default:console.warn("WARN! Unhandled server message",r)}}async sendMessageToServer(e,t){if(void 0===t||(null==t?void 0:t.sessionId)!==this.sessionId)return;const n=Cl[e];switch(e){case"wc-run":{const e=t.token??"";this.sendMessageToSocket(n,xl.encode(e))}break;case"wc-send-data-chunk":{const e=t.chunk;this.sendMessageToSocket(n,xl.encode(e.type),xl.encode(e.name),e.data?new Uint8Array(e.data):null)}break;case"wc-asyncify-stats":case"wc-fs-tree":case"wc-unload":this.sendMessageToSocket(n);break;case"wc-add-key":{const e=new Uint8Array(12);let o=0;o=va(e,t.key,o),o=va(e,t.pressed?1:0,o),va(e,t.timeMs,o),this.sendMessageToSocket(n,e)}break;case"wc-mouse-move":{const e=new Uint8Array(15);let o=0;o=va(e,Math.abs(t.x)*kl,o),o=va(e,Math.abs(t.y)*kl,o),o=va(e,t.timeMs,o),e[o]=t.relative?1:0,e[o+1]=t.x>=0?0:1,e[o+2]=t.y>=0?0:1,this.sendMessageToSocket(n,e)}break;case"wc-mouse-button":{const e=new Uint8Array(6);e[0]=t.button,e[1]=t.pressed?1:0,va(e,t.timeMs,2),this.sendMessageToSocket(n,e)}break;case"wc-mouse-sync":{const e=new Uint8Array(4);va(e,t.timeMs,0),this.sendMessageToSocket(n,e)}break;case"wc-connect":this.sendMessageToSocket(n,new Uint8Array([t.networkType]),xl.encode(t.address));break;case"wc-pack-fs-to-bundle":this.sendMessageToSocket(n,new Uint8Array([t.onlyChanges?1:0]));break;case"wc-net-connected":{const e=new Uint8Array(4);va(e,t.networkId+1,0),this.sendMessageToSocket(n,e)}break;case"wc-net-received":{const e=new Uint8Array(4);va(e,t.networkId,0),this.sendMessageToSocket(n,e,new Uint8Array(t.data))}break;case"wc-sockdrive-opened":{const{handle:e,sectorSize:o,emptyRangesCount:r,emptyRanges:i,size:s,heads:a,cylinders:c,sectors:l,aheadRange:u}=t,d=new Uint8Array(12+4*r+4+4+4+4+4);let p=0;p=va(d,e,p),p=va(d,o,p),p=va(d,r,p);for(const t of i)p=va(d,t,p);p=va(d,s,p),p=va(d,a,p),p=va(d,c,p),p=va(d,l,p),p=va(d,u,p),this.sendMessageToSocket(n,d)}break;case"wc-sockdrive-new-range":{const{handle:e,range:o,buffer:r}=t,i=new Uint8Array(8);va(i,e,0),va(i,o,4),this.sendMessageToSocket(n,i,new Uint8Array(r))}break;case"wc-persist-sockdrives":this.handler("ws-persist-sockdrives",{drives:null});break;default:console.log("Unhandled client message (wc):",e,n,t)}}initMessageHandler(e){this.handler=(t,n)=>{n.sessionId=this.sessionId,e(t,n)}}exit(){this.sendMessageToSocket("wc-exit")}}class Ol{constructor(){t(this,"handler",(()=>{})),window.wsMessage=e=>{this.handler(bl(e))}}send(e){window.android.wcMessage(gl(e))}onMessage(e){this.handler=e}onError(e){}}function Ml(e){const{ci:t}=e,n=on((e=>e.dos.softKeyboard)),o=on((e=>e.dos.softKeyboardLayout)),r=on((e=>e.dos.softKeyboardSymbols)),i=on((e=>e.dos.softKeyboardActiveSymbols)),s=on((e=>e.dos.softKeyboardActiveLayout)),a=eo(),c=r[i%r.length],l=o[s%o.length];if(!n||null===t)return null;function u(e,n){if(null!==t)if("{symbols}"===e){if(n){const e=(i+1)%r.length;e!==i&&a(ki.actions.softKeyboardActiveSymbols(e))}}else if("{layout}"===e){if(n){const e=(s+1)%o.length;e!==s&&a(ki.actions.softKeyboardActiveLayout(e))}}else for(const o of function(e){switch(e){case"{enter}":return[Ws];case"{shift}":return[Gs];case"{bksp}":return[Vs];case"{lock}":return[280];case"{tab}":return[Hs];case"{space}":return[32];case"{esc}":return[Ks];case"{ctrl}":return[Xs];case"{alt}":return[qs];case"{up}":return[na];case"{down}":return[oa];case"{left}":return[ta];case"{right}":return[ra];case",":return[44];case".":return[46];case"'":return[39];case":":return[Gs,59];case"{":return[Gs,91];case"}":return[Gs,93];case"(":return[Gs,57];case")":return[Gs,gs];case"{f1}":return[bs];case"{f2}":return[ws];case"{f3}":return[xs];case"{f4}":return[ks];case"{f5}":return[Cs];case"{f6}":return[Ss];case"{f7}":return[Ps];case"{f8}":return[Es];case"{f9}":return[Os];case"{f10}":return[Ms];case"{f11}":return[js];case"{f12}":return[As];case"{kp1}":return[Ts];case"{kp2}":return[Ls];case"{kp3}":return[Is];case"{kp4}":return[zs];case"{kp5}":return[Bs];case"{kp6}":return[Rs];case"{kp7}":return[Ns];case"{kp8}":return[Fs];case"{kp9}":return[Us];case"{kp0}":return[Ds];case"{pgup}":return[Js];case"{pgdown}":return[ea];case"{del}":return[Qs];case"{home}":return[Ys];case"{end}":return[Zs];case"-":return[45];case"=":return[$s];case"+":return[Gs,$s];default:if(e.length>1)return console.warn("Unknown button",e),[]}const t=ca(e.toUpperCase().charCodeAt(0),0);if(0===t)return[];return[t]}(e))t.sendKeyEvent(o,n)}function d(e){return e.length>2&&e.startsWith("{")&&e.endsWith("}")?e[1].toUpperCase()+e.substring(2,e.length-1):e}return zi("div",{class:"soft-keyboard my-4 mx-2",children:zi("div",{class:"flex flex-row gap-2 flex-wrap justify-evenly items-center",children:l.map(((e,t)=>zi("div",{class:"flex flex-col gap-2 flex-wrap"+(1===l.length||1===t?" items-center":0===t?" items-start":" items-end"),children:e.map((e=>zi("div",{class:"flex flex-row gap-2 flex-wrap items-center",children:0===e.length?zi("div",{class:"kbd-md"}):e.split(" ").map((e=>zi("kbd",{class:"kbd kbd-md cursor-pointer hover:bg-accent-focus",onPointerDown:()=>u(e,!0),onPointerUp:()=>u(e,!1),onPointerCancel:()=>u(e,!1),children:c[e]??r[0][e]??d(e)})))})))})))})})}async function jl(e,t,n){var o,r;if(n.options.sharedNet)return n.options.sharedNet;const i=null==(r=null==(o=n.options.net)?void 0:o.iceServers)?void 0:r.call(o);await async function(e){const t=(e.options.pathPrefix?e.options.pathPrefix+"webrtcnet.mjs":"webrtcnet.mjs")+(e.options.pathSuffix??""),n=(e.options.pathPrefix?e.options.pathPrefix+"webrtcnet.wasm":"webrtcnet.wasm")+(e.options.pathSuffix??""),o=await(await fetch(t)).text(),r=URL.createObjectURL(new Blob([o],{type:"text/javascript"}));return new Promise(((e,t)=>{if(void 0===window.WebRTCNet){const o=document.createElement("script");o.type="module",o.text=`\nimport WebRTCNet from "${r}";\nwindow.WebRTCNetImpl = WebRTCNet;\n`,o.onerror=t,document.body.appendChild(o);const i=setInterval((()=>{void 0!==window.WebRTCNetImpl&&(clearInterval(i),URL.revokeObjectURL(r),window.WebRTCNet=()=>WebRTCNetImpl({locateFile:e=>e.endsWith(".wasm")?n:e}),e())}),1e3)}else e()}))}(n);const s=window.netConfig||{};if(s.debug=!0,i){const e=await i;s.iceServers=e}else s.iceServers=[{urls:["stun:stun.l.google.com:19302","stun:stun1.l.google.com:19302","stun:stun2.l.google.com:19302","stun:stun3.l.google.com:19302","stun:stun4.l.google.com:19302"]}];window.netConfig=s;const a=await WebRTCNet();a.onNetworkError=e;const c=(e,t)=>{const n=a.lengthBytesUTF8(e)+1,o=a.stringToNewUTF8(e);t(o,n),a._free(o)},l={};return a.aliasQueryAdd=(e,t,n)=>{l[e].matches.push({alias:t,peerId:n})},a.onAliasQueryEnd=e=>{l[e].resolve(l[e].matches),delete l[e]},new Promise(((e,o)=>{var r;c((null==(r=n.options.net)?void 0:r.peerServer)??"https://net.dos.zone",(r=>{var i;c((null==(i=n.options.net)?void 0:i.token)??"js-dos",(i=>{var s;c((null==(s=n.options.net)?void 0:s.secret)??"fallback",(n=>{try{if(a._connectTo(r,i,n)){const n=4194304,o=a._malloc(n),r=a._malloc(4),i={lib:a,peerId:0,connected:new Set,wait:e=>{a._wait(e)},registerAlias:e=>a.pendingRegister?Promise.reject(new Error("Register already in progress")):(a.pendingRegister=new Promise(((t,n)=>{c(e,(e=>{a._registerAlias(e)})),i.queryAliases("="+e).then((e=>{1===e.length&&e[0].peerId===i.peerId?t():n(new Error("Alias already in use"))})).catch(n)})),a.pendingRegister.finally((()=>{a.pendingRegister=null}))),unregisterAlias:e=>{c(e,(e=>{a._unregisterAlias(e)}))},queryAliases:e=>(void 0!==l[e]||(l[e]={matches:[]},l[e].promise=new Promise((t=>{l[e].resolve=t,c(e,(e=>{a._queryAliases(e)}))}))),l[e].promise),sendBinary:(e,t)=>{if(t===i.peerId||0===t)throw new Error("Cannot send to self ("+t+")");return i.connected.add(t),((e,t)=>{const n=e.byteLength,o=a._malloc(n);a.HEAPU8.set(e,o);const r=t(o,n);return a._free(o),r})(e,((e,n)=>a._sendto(e,n,t,0)))},recvBinary:()=>{const e=a._recvfrom(o,n,r),t=a.HEAP32[r/4];return e<0?(0!==t&&i.connected.delete(t),null):e>0?(i.connected.add(t),{data:a.HEAPU8.slice(o,o+e),peerId:t}):null},disconnect:e=>{a._disconnect(e)},shutdown:()=>{try{a._shutdown()}catch(e){}}};window.net=i;const s=setInterval((()=>{if(i.peerId=a._myId(),0!==i.peerId){clearInterval(s),e(i);const n=setInterval((()=>{0===a._myId()&&(t(),clearInterval(n))}),1e3)}i.wait(4)}),30)}else o(new Error("Failed to connect to HumbleNet"))}catch(s){o(s)}}))}))}))}))}function Al(e){const t=le(null),[n,o]=ie(null),r=on((e=>e.dos.worker)),i=on((e=>e.dos.jspi)),s=on((e=>e.dos.backend)),a=on((e=>e.dos.backendHardware)),c=on((e=>e.dos.noCursor)),l=on((e=>e.ui.pointerLocked)),u=on((e=>e.dos.mouseCapture)),d=eo(),p=hi(),f=nc.canLock&&u&&!l?"cursor-pointer":c?"cursor-none":"",h=on((e=>e.dos.offscreenCanvas)),v=on((e=>e.dos.sockdrivePreload)),m=on((e=>e.dos.startIpxServer)),_=on((e=>e.dos.connectIpxAddress)),y=Wr();return ae((()=>{try{const e=p.loadedBundle;let n=null!==e.bundleChanges?[e.bundle,e.bundleChanges]:e.bundle;if(null!==e.initFs)if(Array.isArray(n)||(n=[n]),Array.isArray(e.initFs))for(const t of e.initFs)n.push(t);else n.push(e.initFs);e.bundle=null,e.bundleChanges=null,e.initFs=null;let c=0;const l=(async()=>{var e,o,l;if(a&&p.options.backendHardware)if("dosboxX"===s)console.error("backendHardware is not supported for dosboxX");else{const e=await p.options.backendHardware(s);if(null!==e)return emulators.backend(n,await(o=e,l=e=>{e<5&&d(Jr.actions.updateWsWarning(!0)),console.log("wsServer:",e," expected:",5)},new Promise((e=>{let t=!1;const n=setInterval((()=>{if(!t)if(t=!0,"android://"===o)clearInterval(n),console.log("Connected to",o),e(new El(new Ol,l));else{const r=new WebSocket(o),i=()=>{clearInterval(n),console.log("Connected to",o),e(new El(new Pl(r),l))};r.addEventListener("error",(e=>{console.error("Can't conect to ",o,e),r.removeEventListener("open",i),r.close(),t=!1})),r.addEventListener("open",i)}}),1e3)}))),{sockdrivePreload:v})}if(h&&null!==t.current&&"function"==typeof t.current.transferControlToOffscreen&&(p.offscreenCanvas=t.current.transferControlToOffscreen()),null==(e=p.net)||e.shutdown(),m||_){const e=m?y("create_server"):y("lookup_address")+": "+_;if(d(Jr.actions.modalText({text:e})),p.net=await jl((e=>console.log("network error for peer",e)),(()=>console.log("network disconnected")),p),_){const e=p.net,t=Number.parseInt(_);c=t?Number.parseInt(_):await new Promise((t=>{const n=async()=>{const o=await e.queryAliases("="+_);1===o.length?t(o[0].peerId):setTimeout(n,100)};setTimeout(n,4)}))}d(Jr.actions.modalTextClear())}else p.net=void 0;let u="dosbox";if("dosboxX"===s)u="dosboxX",i&&(u+="Jspi");return emulators[u+(r?"Worker":"Direct")](n,{canvas:p.offscreenCanvas,audioWorklet:!0,sockdrivePreload:v,net:p.net})})();return l.then((e=>{o(e),d(ki.actions.ci(!0)),nc.mobile&&e.config().then((e=>{d(ki.actions.mobileControls(null!==dc(e.jsdosConf)))})).catch((e=>d(ki.actions.emuError(e.message)))),p.ci=e,m?e.sendBackendEvent({type:"wc-trigger-event",event:"hand_ipx_startserver"}):_&&p.net&&(d(Jr.actions.modalText({text:y("connect_to_network")+": "+_})),e.events().onNetworkConnected((()=>{d(Jr.actions.modalTextClear())})),e.events().onNetworkDisconnected((()=>{d(Jr.actions.modalText({text:y("unable_to_connect_to_network"),loading:!1})),e.exit()})),e.networkConnect(0,c.toString())),vi(p,"ci-ready",e)})).catch((e=>d(ki.actions.emuError(e.message)))),()=>{l.then((e=>{d(ki.actions.ci(!1)),p.ci=null,e.exit()}))}}catch(e){d(ki.actions.emuError(e.message))}}),[r,s,h,v,m,_]),zi("div",{class:"flex flex-col flex-grow h-full overflow-hidden",children:[zi("div",{class:"bg-black h-full flex-grow overflow-hidden relative",children:[zi("canvas",{class:f,ref:t}),t.current&&n&&zi(Ll,{canvas:t.current,ci:n}),zi(Dl,{}),zi(Tl,{})]}),zi(Ml,{ci:n})]})}function Dl(){const e=on((e=>e.ui.pointerLocked)),t=on((e=>e.dos.mouseCapture)),n=on((e=>e.dos.mouseSensitivity)),o=on((e=>e.ui.clickToLockModal)),r=Wr();return!e&&nc.canLock&&t?zi("div",o?{class:"absolute top-0 left-0 w-full h-full flex flex-col items-center justify-center pointer-events-none bg-black/70 gap-2 px-4 py-2 text-white text-center",children:[zi("div",{class:"text-4xl",children:r("click_to_lock")}),zi("div",{class:"text-xl",children:r("use_esc_key_to_unlock")}),zi("div",{class:"text-xl",children:r("use_slider_to_change_sensitivity")}),zi("div",{class:"text-sm",children:[r("current_sensitivity"),": ",n.toFixed(2)]})]}:{class:"absolute top-6 left-0 w-full pointer-events-none flex flex-row items-center justify-center",children:zi("div",{class:"flex flex-col items-center justify-center bg-black/70 gap-2 px-4 py-2 text-white text-center rounded-lg",children:[zi("div",{class:"text-4xl",children:r("click_to_lock")}),zi("div",{class:"text-xl",children:r("use_esc_key_to_unlock")}),zi("div",{class:"text-xl",children:r("use_slider_to_change_sensitivity")}),zi("div",{class:"text-sm",children:[r("current_sensitivity"),": ",n.toFixed(2)]})]})}):null}function Tl(){const e=on((e=>e.ui.modalText)),t=on((e=>e.ui.modalTextLoading));return e?zi("div",{class:"absolute top-0 left-0 w-full h-full flex flex-row items-center justify-center pointer-events-none bg-black/70 gap-2 px-4 py-2 text-white text-center",children:[t&&zi("span",{class:"loading loading-spinner loading-md"}),zi("div",{class:"text-4xl",children:e})]}):null}function Ll(e){const{canvas:t,ci:n}=e,o=on((e=>e.dos.bundle));return ll(t,n),zi(g,{children:[zi(zl,{ci:n}),Ei(o)&&zi(fl,{ci:n})]})}let Il=()=>{};function zl(e){const t=e.ci,n=Wr(),o=Qn(),r=hi(),[i,s]=ie(!1),[a,c]=ie(!1),[l,u]=ie(null);return ae((()=>{if(null!==l){c(!0);const e=()=>{c(!1),Il()};l?ha(o.getState(),r,o.dispatch,!0).catch(console.error).finally(e):e()}}),[l]),ae((()=>{t.events().onUnload((()=>new Promise((e=>{s(!0),Il=e}))))}),[t]),i?zi("dialog",{id:"save-dialog",className:"modal",open:!0,children:zi("div",{className:"modal-box",children:[zi("h3",{className:"font-bold text-lg",children:n("emulation_ended")}),zi("p",{className:"py-4",children:n("confirm_save")}),zi("div",{className:"modal-action",children:zi("form",{method:"dialog",className:"join",children:[zi("button",{className:"btn btn-neutral join-item",onClick:()=>{s(!1),u(!1)},children:n("close")}),zi("button",{className:"btn btn-primary join-item",onClick:()=>{s(!1),u(!0)},children:n("save")})]})})]})}):a?zi("dialog",{id:"busy-dialog",className:"modal",open:!0,children:zi("div",{className:"modal-box",children:[zi("h3",{className:"font-bold text-lg",children:n("emulation_ended")}),zi("div",{class:"flex flex-row gap-4 py-4 items-center",children:[zi("span",{class:"loading loading-spinner loading-lg"}),zi("p",{children:n("saving_game")})]})]})}):null}function Bl(e){const t=Wr(),n=e.error??"Unexpected error";return zi("div",{class:"flex-grow flex flex-col items-center justify-center px-8 m-auto",children:[zi("div",{class:"text-2xl text-center",children:t("error")}),zi("div",{class:"text-red-400 mt-8 text-2xl text-center",children:['"',n,'"']}),zi("div",{class:"mt-8 text-sm text-center",children:t("consult_logs")}),e.onSkip&&zi("button",{class:"mt-8 btn-primary",onClick:e.onSkip,children:t("skip")})]})}function Rl(){return zi(Bl,{error:on((e=>e.dos.error))})}function Nl(e){const{head:t,message:n}=e;return zi("div",{class:"flex flex-col items-center justify-center frame-color px-8",children:[zi("div",{class:"text-2xl text-center",children:t}),zi("div",{class:"mt-2 text-center",children:n})]})}function Fl(e){return e<1024?e+"b":(e/=1024)<1024?Math.round(e)+"kb":(e/=1024,Math.round(10*e)/10+"mb")}function Ul(){const e=Wr(),t=on((e=>e.dos.step)),n=on((e=>e.storage.recived)),o=on((e=>e.storage.total)),r=on((e=>e.storage.changedRecived)),i=on((e=>e.storage.changedTotal));let s=e("loading"),a="100%",c="";switch(t){case"bnd-load":s=e("bundle_loading"),n>0&&(a=`${Fl(n)} / ${Fl(o)}`,o>0&&(a+=` (${Math.round(1e3*n/o)/10}%)`)),r>0&&(c=`${Fl(r)} / ${Fl(i)}`,i>0&&(c+=` (${Math.round(1e3*r/i)/10}%)`));break;case"bnd-config":s=e("bundle_config")}return zi("div",{class:"flex flex-col w-full h-full items-center justify-center",children:[zi(Nl,{head:s,message:a}),""!==c&&zi(g,{children:[zi("br",{}),zi(Nl,{head:e("changes"),message:c})]})]})}function Kl(){const e=Wr(),t=Qn(),[n,o]=ie(!1);if(n)return zi("div",{class:"select-window overflow-hidden flex-grow flex flex-col items-center justify-center px-8 py-8",children:zi(Hl,{})});async function r(e){if(null===e.files||0===e.files.length)return;const n=e.files[0];try{await ji(n,t).catch((e=>t.dispatch(ki.actions.bndError(e.message))))}catch(o){t.dispatch(ki.actions.bndError(o.message??"unexpected error"))}}function i(){fa(r)}return zi("div",{class:"select-window overflow-hidden flex-grow flex flex-col items-center justify-center px-8",children:[zi("div",{class:"mb-4 text-center underline cursor-pointer hover:text-accent",onClick:()=>o(!0),children:e("load_by_url")}),zi(Vl,{onUpload:i}),zi("div",{class:"mt-4 text-center",children:e("upload_file")}),zi("div",{class:"flex flex-row flex-wrap gap-4",children:[zi("div",{class:"mt-4 text-center underline cursor-pointer hover:text-accent",onClick:i,children:e("load_archive")}),zi("div",{class:"mt-4 text-center underline cursor-pointer hover:text-accent",onClick:async function(){try{await async function(e){await Di("empty.jsdos",(async()=>(await emulators.bundle()).toUint8Array())(),null,null,e),e.dispatch(Jr.actions.frameConf()),e.dispatch(Jr.actions.setEditor(!0))}(t).catch(console.error)}catch(e){t.dispatch(ki.actions.bndError(e.message??"unexpected error"))}},children:e("create_empty")})]}),zi("div",{class:"mt-4 text-center",children:[e("sockdrives"),":"]}),zi("div",{class:"flex flex-row flex-wrap gap-4",children:[{url:"https://br.cdn.dos.zone/js-dos/system/system-dos7.1-v1.jsdos",label:"DOS v7.1"},{url:"https://br.cdn.dos.zone/js-dos/system/system-win311-v1.jsdos",label:"Windows 3.11"},{url:"https://br.cdn.dos.zone/js-dos/system/system-win311-ru.jsdos",label:"Windows 3.11 (RU)"},{url:"https://br.cdn.dos.zone/js-dos/system/system-win95-v1.jsdos",label:"Windows 95"},{url:"https://br.cdn.dos.zone/js-dos/system/system-win95-v2.jsdos",label:"Windows 95 (DT)"},{url:"https://br.cdn.dos.zone/js-dos/system/system-win95-lock.jsdos",label:"Windows 95 (LOCK, DT)"},{url:"https://br.cdn.dos.zone/js-dos/system/system-win95-ru.jsdos",label:"Windows 95 (RU)"},{url:"https://br.cdn.dos.zone/js-dos/system/system-win95-ru-lock.jsdos",label:"Windows 95 (RU, DT, LOCK)"},{url:"https://br.cdn.dos.zone/js-dos/system/system-win98-v1.jsdos",label:"Windows 98 (DT)"}].map((({url:e,label:t})=>zi("a",{href:e,target:"_blank",class:"mt-4 text-center underline cursor-pointer hover:text-accent",children:t})))})]})}function Hl(){const e=Wr(),t=Qn(),n=eo(),[o,r]=ie(""),[i,s]=ie(null);return zi(g,{children:[zi("div",{class:"form-control w-3/4 mb-4",children:[zi("label",{class:"label",children:zi("span",{class:"label-text",children:[e("enter_url"),":"]})}),zi("input",{type:"text",class:"input w-full input-sm input-bordered",onChange:e=>r(e.currentTarget.value??""),value:o})]}),zi("div",{class:"mt-4 text-center underline cursor-pointer hover:text-accent",onClick:()=>async function(e){let o;n(Jr.actions.frameNone());try{o=new URL(e)}catch(r){return void s(r.message)}try{await Ai(o.toString(),t)}catch(r){n(ki.actions.bndError(r.message??"unexpected error"))}}(o),children:e("load")}),null!==i&&zi("div",{class:"mt-8 text-center text-error",children:i})]})}function Vl(e){return zi("div",{class:"cursor-pointer",onClick:e.onUpload,children:zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-48 h-48 play-button",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 13.5l3 3m0 0l3-3m-3 3v-6m1.06-4.19l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})})})}function Wl(){const[e,t]=ie(!1),n=hi(),o=eo(),r=le(null),i=Qn();return ae((()=>{e||async function(e){const t=(e.options.pathPrefix?e.options.pathPrefix+"file-explorer.js":"file-explorer.js")+(e.options.pathSuffix??""),n=(e.options.pathPrefix?e.options.pathPrefix+"file-explorer.css":"file-explorer.css")+(e.options.pathSuffix??""),o=await(await fetch(t)).text();let r=await(await fetch(n)).text();const i=new URL(n.substring(0,n.lastIndexOf("/")+1),new URL(window.location.href)).toString();r=r.replace(/url\('([^']+)'\)/g,((e,t)=>`url('${i}${t}')`));const s=URL.createObjectURL(new Blob([o],{type:"text/javascript"})),a=URL.createObjectURL(new Blob([r],{type:"text/css"}));return new Promise(((e,t)=>{if(void 0===window.FileExplorer){const n=document.createElement("link");n.rel="stylesheet",n.href=a,n.onload=()=>{URL.revokeObjectURL(a)},document.head.appendChild(n);const o=document.createElement("script");o.onerror=t,o.src=s,o.onload=()=>{URL.revokeObjectURL(s),e()},document.body.appendChild(o)}else e()}))}(n).then((()=>t(!0))).catch((e=>{o(ki.actions.bndError(e.message))}))}),[e]),ae((()=>{const t=r.current;t&&e&&function(e,t){new FileExplorer(e,{initpath:[["","/"]],onselchanged:function(e,t,n){const o=this;if(!o)return;const r="/"+e.GetPath().map((e=>e[0])).filter(Boolean).join("/");if(1===n){const e=Object.keys(t)[0];o.SetNamedStatusBarText("path",r+(r.endsWith("/")?"":"/")+e,0)}else o.SetNamedStatusBarText("path",r,0)},onrefresh:async function(e,t){e.SetBusyRef(1);try{const t=e.GetPath().map((e=>e[0]));this.SetNamedStatusBarText("path","/"+t.filter(Boolean).join("/"),0);const n=await ri(t),o=await async function(e){const t=[];for await(const[o,r]of e){const e={name:o,type:"directory"===r.kind?"folder":"file"};if("file"===e.type)try{const t=await r.getFile();e.size=t.size}catch(n){}else e.size=await ii(r);t.push(e)}return t}(n),r=o.map((e=>{const t={id:e.name,name:e.name,type:e.type,hash:e.name+"_"+e.type,tooltip:e.name};return e.size&&(t.size=e.size),t}));e.SetEntries(r)}catch(n){e.SetEntries([])}e.SetBusyRef(-1)},oninitdownload:async function(e,t,n,o){try{const e=t.GetPath().map((e=>e[0])),n=await ri(e);for(const t of o)if("file"===t.type){const e=await n.getFileHandle(t.name),o=await e.getFile(),r=URL.createObjectURL(o),i=document.createElement("a");i.href=r,i.download=t.name,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}this.StopOperationIndicator(),this.SetNamedStatusBarText("message","Download started",2e3)}catch(r){this.StopOperationIndicator(),this.SetNamedStatusBarText("message","Download failed: "+(r.message||r),3e3)}},ondelete:async function(e,n,o,r){try{const t=n.GetPath().map((e=>e[0])),o=await ri(t);for(const e of r)await o.removeEntry(e.name,{recursive:!0});e(!0)}catch(i){e(i.message||"Delete failed")}finally{ni(t)}}})}(t,i)}),[r,e]),zi("div",e?{ref:r,class:"w-full h-full"}:{class:"w-full h-full flex justify-center items-center",children:zi("div",{class:"radial-progress animate-spin",style:"--value:70;"})})}function ql(e){const t="none"!==on((e=>e.ui.frame)),n=on((e=>e.ui.frameXs)),o=on((e=>e.ui.window)),r=on((e=>e.ui.background)),i=on((e=>e.ui.kiosk)),s=on((e=>e.ui.thinSidebar)),a=on((e=>e.dos.mouseCapture));let c=zi(Xl,{});switch(o){case"error":c=zi(Rl,{});break;case"loading":c=zi(Ul,{});break;case"prerun":c=zi(ga,{});break;case"run":c=zi(Al,{});break;case"select":c=zi(Kl,{});break;case"file-explorer":c=zi(Wl,{})}const l="run"===o&&a;let u="left-12",d=l?"w-14":"w-12";return s&&!t?(d=l?"w-6":"w-4",u="left-4"):t&&(d=n?"w-24":"w-96"),zi("div",{class:"window absolute w-full h-full bg-base-100",children:[zi("div",{class:"background-image "+u,style:{backgroundImage:r?"url("+r+")":void 0}}),zi("div",{class:"relative flex flex-row h-full w-full items-start justify-start overflow-auto",children:[!i&&zi("div",{class:d+" flex-shrink-0"}),i&&l&&zi("div",{class:"w-2 flex-shrink-0"}),c]})]})}function Xl(){return zi("div",{class:"w-full h-full flex justify-center items-center",children:zi("div",{class:"radial-progress animate-spin",style:"--value:70;"})})}let Gl=Jr.getInitialState().wideScreen;function $l(){const e=le(null),t=on((e=>e.ui.hidden)),n=on((e=>e.ui.theme)),o=eo();return ae((()=>{if(t||null===e||null===e.current)return;const n=e.current;function r(){const e=n.getBoundingClientRect().width>640;e!==Gl&&(Gl=e,o(Jr.actions.setWideScreen(Gl)))}const i=new ResizeObserver(r);return i.observe(n),window.addEventListener("resize",r),()=>{i.disconnect(),window.removeEventListener("resize",r)}}),[t,e,o]),t?null:zi("div",{ref:e,class:"w-full h-full relative","data-theme":n,children:[zi(ql,{}),zi(Oa,{}),zi(qa,{}),zi(Yl,{}),zi(Jl,{})]})}function Yl(){const e=on((e=>e.ui.toast)),t=on((e=>e.ui.toastIntent)),n="panic"===t?"error":t;if(null===e)return null;let o=zi("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"});return"warning"===t&&(o=zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})),"error"!==t&&"panic"!==t||(o=zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z"})),zi("div",{class:"absolute right-10 bottom-10 pointer-events-none "+("error"===t||"panic"===t||"warning"===t?"opacity-80":"opacity-50"),children:zi("div",{class:"alert alert-"+n+" text-"+n+"-content",children:[zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",class:"shrink-0 w-6 h-6",children:o}),zi("span",{class:"break-words",children:e})]})})}function Jl(){const e=on((e=>e.ui.updateWsWarning)),t=Wr(),n=eo();if(!e)return null;return zi("div",{class:"absolute left-20 right-10 top-10 flex justify-center",children:zi("div",{class:"alert w-auto",children:[zi("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6 text-error",children:zi("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})}),zi("span",{children:t("ws_outdated")}),zi("div",{children:[zi("button",{class:"btn btn-sm btn-primary mr-2",onClick:function(){window.open("https://dos.zone/download/","_blank"),n(Jr.actions.updateWsWarning(!1))},children:t("update")}),zi("button",{class:"btn btn-sm",onClick:function(){n(Jr.actions.updateWsWarning(!1))},children:t("close")})]})]})})}window.Dos=(e,t={})=>{var n;const o=function(e){return{root:null,loadedBundle:null,ci:null,options:e,layers:null,gl:null}}(t),r=function(e){const{storeUid:t,slice:n}=ei(),o=Tr({reducer:{init:n.reducer,i18n:Vr.reducer,ui:Jr.reducer,dos:ki.reducer,storage:Qr.reducer,editor:Xr.reducer,opfs:ti.reducer},middleware:e=>{const t=e();return t.push(di),t}});return pi[t]=e,o}(o);!function(e,t,n){function o(){n.dispatch(Jr.actions.documentHidden(document.hidden))}t.root=e,e.classList.add("jsdos-rso"),e.addEventListener("contextmenu",(e=>{var t;if(null===e.target||!(null==(t=e.target.classList)?void 0:t.contains("contextmenu")))return e.stopPropagation(),e.preventDefault(),!1})),document.addEventListener("fullscreenchange",(o=>{if(!n.getState().ui.softFullscreen){const o=document.fullscreenElement===e;n.dispatch(Jr.actions.setFullScreen(o)),!o&&n.getState().ui.autoSave&&ha(mi(n),t,n.dispatch)}})),document.addEventListener("pointerlockchange",(()=>{n.dispatch(Jr.actions.pointerLocked(null!==document.pointerLockElement)),null!==document.pointerLockElement&&n.getState().ui.clickToLockModal&&n.dispatch(Jr.actions.clickToLockModal(!1)),null===document.pointerLockElement&&n.getState().ui.autoSave&&ha(mi(n),t,n.dispatch)})),document.addEventListener("visibilitychange",o)}(e,o,r),null==(n=navigator.keyboard)||n.lock(["KeyW","Escape"]);let i="none";function s(e){r.dispatch(Jr.actions.theme(e))}function a(e){r.dispatch(Vr.actions.setLang(e))}function c(e){r.dispatch(ki.actions.dosBackend(e))}function l(e){r.dispatch(ki.actions.dosBackendLocked(e))}function u(e){r.dispatch(ki.actions.dosWorker(e))}function d(e){r.dispatch(ki.actions.mouseCapture(e))}function p(e){r.dispatch(Jr.actions.background(e))}function f(e){Ma(e,r)}function h(e){r.dispatch(Jr.actions.autoStart(e))}function v(e){r.dispatch(Jr.actions.countDownStart(e))}function m(e){r.dispatch(Jr.actions.autoSave(e))}function _(e){r.dispatch(Jr.actions.kiosk(e))}function y(e){r.dispatch(ki.actions.imageRendering(e))}function g(e){r.dispatch(ki.actions.renderBackend(e))}function b(e){r.dispatch(ki.actions.renderAspect(e))}function w(e){r.dispatch(ki.actions.scaleControls(e))}function x(e){r.dispatch(ki.actions.mouseSensitivity(e))}function k(e){r.dispatch(ki.actions.noCursor(e))}function C(e){r.dispatch(ki.actions.softKeyboardLayout(e))}function S(e){r.dispatch(ki.actions.softKeyboardSymbols(e))}function P(e){r.dispatch(ki.actions.volume(e))}function E(e){r.dispatch(ki.actions.offscreenCanvas(e))}function O(e){r.dispatch(Jr.actions.softFullscreen(e))}function M(e){r.dispatch(Jr.actions.thinSidebar(e))}return r.subscribe((function(){(async()=>{const e=mi(r),n=e.dos.step;if(n!==i)switch(i=n,e.dos.step){case"bnd-ready":void 0!==t.mouseCapture&&d(t.mouseCapture);break;case"emu-ready":if(o.options.url)try{await Ai(o.options.url,r)}catch(s){console.error(s),r.dispatch(ki.actions.bndError(s.message))}else if(o.options.dosboxConf){const e=o.options.jsdosConf??{version:"8"};e.version||(e.version="8"),async function(e,t,n){const o=fi(n),r=n.dispatch;o.loadedBundle=null,r(Xr.actions.init(e)),Ti(e,r),o.loadedBundle={bundleUrl:null,bundleChangesUrl:null,bundle:e,bundleChanges:null,initFs:t},r(ki.actions.bndReady({}))}({dosboxConf:o.options.dosboxConf,jsdosConf:e},o.options.initFs??null,r)}else r.dispatch(Jr.actions.windowSelect());vi(o,"emu-ready")}})().catch(console.error)})),Si(r,t.pathPrefix??"https://v8.js-dos.com/latest/emulators/",t.pathSuffix??""),t.theme&&s(t.theme),t.lang&&a(t.lang),t.backend&&c(t.backend),t.backendLocked&&l(t.backendLocked),void 0!==t.workerThread&&u(t.workerThread),t.background&&p(t.background),void 0!==t.fullScreen&&f(t.fullScreen),void 0!==t.autoStart&&h(t.autoStart),void 0!==t.countDownStart&&v(t.countDownStart),void 0!==t.autoSave&&m(t.autoSave),void 0!==t.kiosk&&_(t.kiosk),void 0!==t.imageRendering&&y(t.imageRendering),void 0!==t.renderBackend&&g(t.renderBackend),void 0!==t.renderAspect&&b(t.renderAspect),void 0!==t.scaleControls&&w(t.scaleControls),void 0!==t.mouseSensitivity&&x(t.mouseSensitivity),void 0!==t.noCursor&&k(t.noCursor),void 0!==t.softKeyboardLayout&&C(t.softKeyboardLayout),void 0!==t.softKeyboardSymbols&&S(t.softKeyboardSymbols),void 0!==t.volume&&P(t.volume),void 0!==t.backendHardware&&O(!0),void 0!==t.softFullscreen&&O(t.softFullscreen),void 0!==t.thinSidebar&&M(t.thinSidebar),void 0!==t.offscreenCanvas&&E(t.offscreenCanvas),void 0!==t.sockdrivePreload&&r.dispatch(ki.actions.sockdrivePreload(t.sockdrivePreload)),!0===t.startIpxServer&&r.dispatch(ki.actions.startIpxServer(!0)),t.connectIpxAddress&&r.dispatch(ki.actions.connectIpxAddress(t.connectIpxAddress)),void 0!==t.fastForwardOnBoot&&r.dispatch(ki.actions.fastForwardOnBoot(t.fastForwardOnBoot)),ni(r),R(zi(Yn,{store:r,children:zi($l,{})}),e),{getVersion:()=>["8.4.1",r.getState().dos.emuVersion],getLocalChanges:e=>ci(e),setTheme:s,setLang:a,setBackend:c,setBackendLocked:l,setWorkerThread:u,setOffscreenCanvas:E,setMouseCapture:d,setBackground:p,setFullScreen:f,setAutoStart:h,setCountDownStart:v,setAutoSave:m,setKiosk:_,setImageRendering:y,setRenderBackend:g,setRenderAspect:b,setNoCloud:function(e){r.dispatch(Jr.actions.noCloud(e))},setPaused:function(e){r.dispatch(ki.actions.paused(e))},setScaleControls:w,setMouseSensitivity:x,setNoCursor:k,setSoftKeyboardLayout:C,setSoftKeyboardSymbols:S,setVolume:P,setSoftFullscreen:O,setThinSidebar:M,save:()=>ha(mi(r),o,r.dispatch),stop:async()=>{r.dispatch(Jr.actions.hidden(!0));const e=fi(r);if(e.ci)return e.ci.exit()}}};
22
22
  //# sourceMappingURL=js-dos.js.map