!function e(t,n,s){function r(i,a){if(!n[i]){if(!t[i]){var l="function"==typeof require&&require;if(!a&&l)return l(i,!0);if(o)return o(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[i]={exports:{}};t[i][0].call(u.exports,(function(e){return r(t[i][1][e]||e)}),u,u.exports,e,t,n,s)}return n[i].exports}for(var o="function"==typeof require&&require,i=0;i0&&s[0]<4?1:+(s[0]+s[1])),!r&&i&&(!(s=i.match(/Edge\/(\d+)/))||s[1]>=74)&&(s=i.match(/Chrome\/(\d+)/))&&(r=+s[1]),t.exports=r},{"../internals/engine-user-agent":17,"../internals/global":27}],19:[function(e,t,n){t.exports=function(e){try{return!!e()}catch(e){return!0}}},{}],20:[function(e,t,n){var s=e("../internals/fails");t.exports=!s((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},{"../internals/fails":19}],21:[function(e,t,n){var s=e("../internals/function-bind-native"),r=Function.prototype.call;t.exports=s?r.bind(r):function(){return r.apply(r,arguments)}},{"../internals/function-bind-native":20}],22:[function(e,t,n){var s=e("../internals/descriptors"),r=e("../internals/has-own-property"),o=Function.prototype,i=s&&Object.getOwnPropertyDescriptor,a=r(o,"name"),l=a&&"something"===function(){}.name,c=a&&(!s||s&&i(o,"name").configurable);t.exports={EXISTS:a,PROPER:l,CONFIGURABLE:c}},{"../internals/descriptors":14,"../internals/has-own-property":28}],23:[function(e,t,n){var s=e("../internals/function-uncurry-this"),r=e("../internals/a-callable");t.exports=function(e,t,n){try{return s(r(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}}},{"../internals/a-callable":1,"../internals/function-uncurry-this":24}],24:[function(e,t,n){var s=e("../internals/function-bind-native"),r=Function.prototype,o=r.call,i=s&&r.bind.bind(o,o);t.exports=s?i:function(e){return function(){return o.apply(e,arguments)}}},{"../internals/function-bind-native":20}],25:[function(e,t,n){var s=e("../internals/global"),r=e("../internals/is-callable"),o=function(e){return r(e)?e:void 0};t.exports=function(e,t){return arguments.length<2?o(s[e]):s[e]&&s[e][t]}},{"../internals/global":27,"../internals/is-callable":33}],26:[function(e,t,n){var s=e("../internals/a-callable"),r=e("../internals/is-null-or-undefined");t.exports=function(e,t){var n=e[t];return r(n)?void 0:s(n)}},{"../internals/a-callable":1,"../internals/is-null-or-undefined":34}],27:[function(e,t,n){(function(e){(function(){var n=function(e){return e&&e.Math==Math&&e};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||function(){return this}()||Function("return this")()}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],28:[function(e,t,n){var s=e("../internals/function-uncurry-this"),r=e("../internals/to-object"),o=s({}.hasOwnProperty);t.exports=Object.hasOwn||function(e,t){return o(r(e),t)}},{"../internals/function-uncurry-this":24,"../internals/to-object":53}],29:[function(e,t,n){t.exports={}},{}],30:[function(e,t,n){var s=e("../internals/descriptors"),r=e("../internals/fails"),o=e("../internals/document-create-element");t.exports=!s&&!r((function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},{"../internals/descriptors":14,"../internals/document-create-element":16,"../internals/fails":19}],31:[function(e,t,n){var s=e("../internals/function-uncurry-this"),r=e("../internals/is-callable"),o=e("../internals/shared-store"),i=s(Function.toString);r(o.inspectSource)||(o.inspectSource=function(e){return i(e)}),t.exports=o.inspectSource},{"../internals/function-uncurry-this":24,"../internals/is-callable":33,"../internals/shared-store":48}],32:[function(e,t,n){var s,r,o,i=e("../internals/weak-map-basic-detection"),a=e("../internals/global"),l=e("../internals/is-object"),c=e("../internals/create-non-enumerable-property"),u=e("../internals/has-own-property"),d=e("../internals/shared-store"),f=e("../internals/shared-key"),h=e("../internals/hidden-keys"),p="Object already initialized",m=a.TypeError,y=a.WeakMap;if(i||d.state){var b=d.state||(d.state=new y);b.get=b.get,b.has=b.has,b.set=b.set,s=function(e,t){if(b.has(e))throw m(p);return t.facade=e,b.set(e,t),t},r=function(e){return b.get(e)||{}},o=function(e){return b.has(e)}}else{var w=f("state");h[w]=!0,s=function(e,t){if(u(e,w))throw m(p);return t.facade=e,c(e,w,t),t},r=function(e){return u(e,w)?e[w]:{}},o=function(e){return u(e,w)}}t.exports={set:s,get:r,has:o,enforce:function(e){return o(e)?r(e):s(e,{})},getterFor:function(e){return function(t){var n;if(!l(t)||(n=r(t)).type!==e)throw m("Incompatible receiver, "+e+" required");return n}}}},{"../internals/create-non-enumerable-property":9,"../internals/global":27,"../internals/has-own-property":28,"../internals/hidden-keys":29,"../internals/is-object":35,"../internals/shared-key":47,"../internals/shared-store":48,"../internals/weak-map-basic-detection":63}],33:[function(e,t,n){var s=e("../internals/document-all"),r=s.all;t.exports=s.IS_HTMLDDA?function(e){return"function"==typeof e||e===r}:function(e){return"function"==typeof e}},{"../internals/document-all":15}],34:[function(e,t,n){t.exports=function(e){return null==e}},{}],35:[function(e,t,n){var s=e("../internals/is-callable"),r=e("../internals/document-all"),o=r.all;t.exports=r.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:s(e)||e===o}:function(e){return"object"==typeof e?null!==e:s(e)}},{"../internals/document-all":15,"../internals/is-callable":33}],36:[function(e,t,n){t.exports=!1},{}],37:[function(e,t,n){var s=e("../internals/get-built-in"),r=e("../internals/is-callable"),o=e("../internals/object-is-prototype-of"),i=e("../internals/use-symbol-as-uid"),a=Object;t.exports=i?function(e){return"symbol"==typeof e}:function(e){var t=s("Symbol");return r(t)&&o(t.prototype,a(e))}},{"../internals/get-built-in":25,"../internals/is-callable":33,"../internals/object-is-prototype-of":43,"../internals/use-symbol-as-uid":61}],38:[function(e,t,n){var s=e("../internals/to-length");t.exports=function(e){return s(e.length)}},{"../internals/to-length":52}],39:[function(e,t,n){var s=e("../internals/function-uncurry-this"),r=e("../internals/fails"),o=e("../internals/is-callable"),i=e("../internals/has-own-property"),a=e("../internals/descriptors"),l=e("../internals/function-name").CONFIGURABLE,c=e("../internals/inspect-source"),u=e("../internals/internal-state"),d=u.enforce,f=u.get,h=String,p=Object.defineProperty,m=s("".slice),y=s("".replace),b=s([].join),w=a&&!r((function(){return 8!==p((function(){}),"length",{value:8}).length})),g=String(String).split("String"),v=t.exports=function(e,t,n){"Symbol("===m(h(t),0,7)&&(t="["+y(h(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!i(e,"name")||l&&e.name!==t)&&(a?p(e,"name",{value:t,configurable:!0}):e.name=t),w&&n&&i(n,"arity")&&e.length!==n.arity&&p(e,"length",{value:n.arity});try{n&&i(n,"constructor")&&n.constructor?a&&p(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var s=d(e);return i(s,"source")||(s.source=b(g,"string"==typeof t?t:"")),e};Function.prototype.toString=v((function(){return o(this)&&f(this).source||c(this)}),"toString")},{"../internals/descriptors":14,"../internals/fails":19,"../internals/function-name":22,"../internals/function-uncurry-this":24,"../internals/has-own-property":28,"../internals/inspect-source":31,"../internals/internal-state":32,"../internals/is-callable":33}],40:[function(e,t,n){var s=Math.ceil,r=Math.floor;t.exports=Math.trunc||function(e){var t=+e;return(t>0?r:s)(t)}},{}],41:[function(e,t,n){var s=e("../internals/descriptors"),r=e("../internals/ie8-dom-define"),o=e("../internals/v8-prototype-define-bug"),i=e("../internals/an-object"),a=e("../internals/to-property-key"),l=TypeError,c=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d="enumerable",f="configurable",h="writable";n.f=s?o?function(e,t,n){if(i(e),t=a(t),i(n),"function"==typeof e&&"prototype"===t&&"value"in n&&h in n&&!n.writable){var s=u(e,t);s&&s.writable&&(e[t]=n.value,n={configurable:f in n?n.configurable:s.configurable,enumerable:d in n?n.enumerable:s.enumerable,writable:!1})}return c(e,t,n)}:c:function(e,t,n){if(i(e),t=a(t),i(n),r)try{return c(e,t,n)}catch(e){}if("get"in n||"set"in n)throw l("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},{"../internals/an-object":3,"../internals/descriptors":14,"../internals/ie8-dom-define":30,"../internals/to-property-key":57,"../internals/v8-prototype-define-bug":62}],42:[function(e,t,n){var s=e("../internals/has-own-property"),r=e("../internals/is-callable"),o=e("../internals/to-object"),i=e("../internals/shared-key"),a=e("../internals/correct-prototype-getter"),l=i("IE_PROTO"),c=Object,u=c.prototype;t.exports=a?c.getPrototypeOf:function(e){var t=o(e);if(s(t,l))return t[l];var n=t.constructor;return r(n)&&t instanceof n?n.prototype:t instanceof c?u:null}},{"../internals/correct-prototype-getter":8,"../internals/has-own-property":28,"../internals/is-callable":33,"../internals/shared-key":47,"../internals/to-object":53}],43:[function(e,t,n){var s=e("../internals/function-uncurry-this");t.exports=s({}.isPrototypeOf)},{"../internals/function-uncurry-this":24}],44:[function(e,t,n){var s=e("../internals/function-uncurry-this-accessor"),r=e("../internals/an-object"),o=e("../internals/a-possible-prototype");t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=s(Object.prototype,"__proto__","set"))(n,[]),t=n instanceof Array}catch(e){}return function(n,s){return r(n),o(s),t?e(n,s):n.__proto__=s,n}}():void 0)},{"../internals/a-possible-prototype":2,"../internals/an-object":3,"../internals/function-uncurry-this-accessor":23}],45:[function(e,t,n){var s=e("../internals/function-call"),r=e("../internals/is-callable"),o=e("../internals/is-object"),i=TypeError;t.exports=function(e,t){var n,a;if("string"===t&&r(n=e.toString)&&!o(a=s(n,e)))return a;if(r(n=e.valueOf)&&!o(a=s(n,e)))return a;if("string"!==t&&r(n=e.toString)&&!o(a=s(n,e)))return a;throw i("Can't convert object to primitive value")}},{"../internals/function-call":21,"../internals/is-callable":33,"../internals/is-object":35}],46:[function(e,t,n){var s=e("../internals/is-null-or-undefined"),r=TypeError;t.exports=function(e){if(s(e))throw r("Can't call method on "+e);return e}},{"../internals/is-null-or-undefined":34}],47:[function(e,t,n){var s=e("../internals/shared"),r=e("../internals/uid"),o=s("keys");t.exports=function(e){return o[e]||(o[e]=r(e))}},{"../internals/shared":49,"../internals/uid":60}],48:[function(e,t,n){var s=e("../internals/global"),r=e("../internals/define-global-property"),o="__core-js_shared__",i=s[o]||r(o,{});t.exports=i},{"../internals/define-global-property":13,"../internals/global":27}],49:[function(e,t,n){var s=e("../internals/is-pure"),r=e("../internals/shared-store");(t.exports=function(e,t){return r[e]||(r[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.30.0",mode:s?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.30.0/LICENSE",source:"https://github.com/zloirock/core-js"})},{"../internals/is-pure":36,"../internals/shared-store":48}],50:[function(e,t,n){var s=e("../internals/engine-v8-version"),r=e("../internals/fails");t.exports=!!Object.getOwnPropertySymbols&&!r((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&s&&s<41}))},{"../internals/engine-v8-version":18,"../internals/fails":19}],51:[function(e,t,n){var s=e("../internals/math-trunc");t.exports=function(e){var t=+e;return t!=t||0===t?0:s(t)}},{"../internals/math-trunc":40}],52:[function(e,t,n){var s=e("../internals/to-integer-or-infinity"),r=Math.min;t.exports=function(e){return e>0?r(s(e),9007199254740991):0}},{"../internals/to-integer-or-infinity":51}],53:[function(e,t,n){var s=e("../internals/require-object-coercible"),r=Object;t.exports=function(e){return r(s(e))}},{"../internals/require-object-coercible":46}],54:[function(e,t,n){var s=e("../internals/to-positive-integer"),r=RangeError;t.exports=function(e,t){var n=s(e);if(n%t)throw r("Wrong offset");return n}},{"../internals/to-positive-integer":55}],55:[function(e,t,n){var s=e("../internals/to-integer-or-infinity"),r=RangeError;t.exports=function(e){var t=s(e);if(t<0)throw r("The argument can't be less than 0");return t}},{"../internals/to-integer-or-infinity":51}],56:[function(e,t,n){var s=e("../internals/function-call"),r=e("../internals/is-object"),o=e("../internals/is-symbol"),i=e("../internals/get-method"),a=e("../internals/ordinary-to-primitive"),l=e("../internals/well-known-symbol"),c=TypeError,u=l("toPrimitive");t.exports=function(e,t){if(!r(e)||o(e))return e;var n,l=i(e,u);if(l){if(void 0===t&&(t="default"),n=s(l,e,t),!r(n)||o(n))return n;throw c("Can't convert object to primitive value")}return void 0===t&&(t="number"),a(e,t)}},{"../internals/function-call":21,"../internals/get-method":26,"../internals/is-object":35,"../internals/is-symbol":37,"../internals/ordinary-to-primitive":45,"../internals/well-known-symbol":64}],57:[function(e,t,n){var s=e("../internals/to-primitive"),r=e("../internals/is-symbol");t.exports=function(e){var t=s(e,"string");return r(t)?t:t+""}},{"../internals/is-symbol":37,"../internals/to-primitive":56}],58:[function(e,t,n){var s={};s[e("../internals/well-known-symbol")("toStringTag")]="z",t.exports="[object z]"===String(s)},{"../internals/well-known-symbol":64}],59:[function(e,t,n){var s=String;t.exports=function(e){try{return s(e)}catch(e){return"Object"}}},{}],60:[function(e,t,n){var s=e("../internals/function-uncurry-this"),r=0,o=Math.random(),i=s(1..toString);t.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+i(++r+o,36)}},{"../internals/function-uncurry-this":24}],61:[function(e,t,n){var s=e("../internals/symbol-constructor-detection");t.exports=s&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},{"../internals/symbol-constructor-detection":50}],62:[function(e,t,n){var s=e("../internals/descriptors"),r=e("../internals/fails");t.exports=s&&r((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},{"../internals/descriptors":14,"../internals/fails":19}],63:[function(e,t,n){var s=e("../internals/global"),r=e("../internals/is-callable"),o=s.WeakMap;t.exports=r(o)&&/native code/.test(String(o))},{"../internals/global":27,"../internals/is-callable":33}],64:[function(e,t,n){var s=e("../internals/global"),r=e("../internals/shared"),o=e("../internals/has-own-property"),i=e("../internals/uid"),a=e("../internals/symbol-constructor-detection"),l=e("../internals/use-symbol-as-uid"),c=s.Symbol,u=r("wks"),d=l?c.for||c:c&&c.withoutSetter||i;t.exports=function(e){return o(u,e)||(u[e]=a&&o(c,e)?c[e]:d("Symbol."+e)),u[e]}},{"../internals/global":27,"../internals/has-own-property":28,"../internals/shared":49,"../internals/symbol-constructor-detection":50,"../internals/uid":60,"../internals/use-symbol-as-uid":61}],65:[function(e,t,n){"use strict";var s=e("../internals/global"),r=e("../internals/function-call"),o=e("../internals/array-buffer-view-core"),i=e("../internals/length-of-array-like"),a=e("../internals/to-offset"),l=e("../internals/to-object"),c=e("../internals/fails"),u=s.RangeError,d=s.Int8Array,f=d&&d.prototype,h=f&&f.set,p=o.aTypedArray,m=o.exportTypedArrayMethod,y=!c((function(){var e=new Uint8ClampedArray(2);return r(h,e,{length:1,0:3},1),3!==e[1]})),b=y&&o.NATIVE_ARRAY_BUFFER_VIEWS&&c((function(){var e=new d(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));m("set",(function(e){p(this);var t=a(arguments.length>1?arguments[1]:void 0,1),n=l(e);if(y)return r(h,this,n,t);var s=this.length,o=i(n),c=0;if(o+t>s)throw u("Wrong length");for(;c1&&void 0!==arguments[1]?arguments[1]:"/",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"zip";return this.extractAll([{url:e,path:t,type:n}])}extractAll(e){return this.sources.push(...e),this}async toUint8Array(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t={};await this.libzipWasm.instantiate(t);const n=new r.default(t),s=[];for(const e of this.sources){if("zip"!==e.type)throw new Error("Only Zip is supported");const t=(0,o.httpRequest)(e.url,{responseType:"arraybuffer"}).then((t=>({source:e,data:new Uint8Array(t)})));s.push(t)}e||(await n.writeFile(".jsdos/dosbox.conf",this.dosboxConf),await n.writeFile(".jsdos/readme.txt",a),await n.writeFile(".jsdos/jsdos.json",JSON.stringify(this.jsdosConf,null,2)));const i=await Promise.all(s);for(const e of i)n.zipToFs(e.data,e.source.path);e&&(await n.writeFile(".jsdos/dosbox.conf",this.dosboxConf),await n.writeFile(".jsdos/readme.txt",a),await n.writeFile(".jsdos/jsdos.json",JSON.stringify(this.jsdosConf,null,2)));const l=await n.zipFromFs();return n.destroy(),l}};const a="\nPlease visit our website:\n\n _ __\n (_)____ ____/ /___ _____ _________ ____ ___\n / / ___/_____/ __ / __ \\/ ___// ___/ __ \\/ __ `__ \\\n / (__ )_____/ /_/ / /_/ (__ )/ /__/ /_/ / / / / / /\n __/ /____/ \\__,_/\\____/____(_)___/\\____/_/ /_/ /_/\n /___/\n".replace(/\n/g,"\r\n");n.defaultConfig="[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")},{"../../build":66,"../../http":71,"../../libzip/libzip":75,"core-js/modules/es.typed-array.set.js":65}],68:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.dosDirect=void 0;const s=e("../../../protocol/messages-queue");n.dosDirect=async function(e,t){const n=new s.MessagesQueue;let r=n.handler.bind(n);const o={postMessage:(e,t)=>{r(e,t)}},i=e=>{const n=e.data;"ws-sync-sleep"===n?.name&&n.props.sessionId===t&&postMessage({name:"wc-sync-sleep",props:n.props},"*")},a={sessionId:t,sendMessageToServer:(e,t)=>{o.messageHandler({data:{name:e,props:t}})},initMessageHandler:e=>{r=e,n.sendTo(r)},exit:()=>{"undefined"!=typeof window&&window.removeEventListener("message",i)}};return a.module=o,"undefined"!=typeof window&&window.addEventListener("message",i,{passive:!0}),await e.instantiate(o),o.callMain([t]),a}},{"../../../protocol/messages-queue":76}],69:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.dosWorker=void 0;const s=e("../../../protocol/messages-queue");n.dosWorker=async function(e,t,n){const r=new s.MessagesQueue;let o=r.handler.bind(r);const i=await fetch(e);if(200!==i.status)throw new Error("Unable to download '"+e+"' ("+i.status+"): "+i.statusText);const a=URL.createObjectURL(await i.blob()),l=new Worker(a);l.onerror=e=>{o("ws-err",{type:e.type,filename:e.filename,message:e.message})},l.onmessage=e=>{const t=e.data;void 0!==t?.name&&o(t.name,t.props)};const c={sessionId:n,sendMessageToServer:(e,t,n)=>{n?l.postMessage({name:e,props:t},n):l.postMessage({name:e,props:t})},initMessageHandler:e=>{o=e,r.sendTo(o)},exit:()=>{URL.revokeObjectURL(a),l.terminate()}};try{c.sendMessageToServer("wc-install",{module:t.wasmModule,sessionId:n})}catch(e){c.sendMessageToServer("wc-install",{sessionId:n})}return c}},{"../../../protocol/messages-queue":76}],70:[function(e,t,n){(function(t){(function(){"use strict";var s=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.NetworkType=void 0;const r=s(e("./impl/emulators-impl"));!function(e){e[e.NETWORK_DOSBOX_IPX=0]="NETWORK_DOSBOX_IPX"}(n.NetworkType||(n.NetworkType={})),"undefined"!=typeof window&&(window.emulators=r.default),void 0!==t&&(t.emulators=r.default)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./impl/emulators-impl":73}],71:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.httpRequest=void 0,n.httpRequest=function(e,t){return new Promise(((n,r)=>{new s(e,{...t,success:n,fail:e=>{r(new Error(e))}})}))};class s{resource;options;xhr=null;total=0;loaded=0;constructor(e,t){if(this.resource=e,this.options=t,this.options.method=t.method||"GET","GET"!==this.options.method)throw new Error("Method "+this.options.method+" is not supported");this.makeHttpRequest()}makeHttpRequest(){let e,t;this.xhr=new XMLHttpRequest,this.xhr.open(this.options.method||"GET",this.resource,!0),"POST"===this.options.method&&this.xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"),this.xhr.overrideMimeType("text/plain; charset=x-user-defined"),"function"==typeof(e=this.xhr).addEventListener&&e.addEventListener("progress",(e=>{if(this.total=e.total,this.loaded=e.loaded,this.options.progress)return this.options.progress(e.total,e.loaded)})),"function"==typeof(t=this.xhr).addEventListener&&t.addEventListener("error",(()=>{if(this.options.fail)return this.options.fail("Unalbe to download '"+this.resource+"', code: "+this.xhr.status),delete this.options.fail})),this.xhr.onreadystatechange=()=>this.onReadyStateChange(),this.options.responseType&&(this.xhr.responseType=this.options.responseType),this.xhr.send(this.options.data)}onReadyStateChange(){const e=this.xhr;if(4===e.readyState)if(200===e.status){if(this.options.success){const t=Math.max(this.total,this.loaded);return void 0!==this.options.progress&&this.options.progress(t,t),this.options.success(e.response)}}else if(this.options.fail)return this.options.fail("Unable to download '"+this.resource+"', code: "+e.status),delete this.options.fail}}},{}],72:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.CommandInterfaceEventsImpl=void 0;n.CommandInterfaceEventsImpl=class{onStdoutConsumers=[];delayedStdout=[];onFrameSizeConsumers=[];onFrameConsumers=[];onSoundPushConsumers=[];onExitConsumers=[];onMessageConsumers=[];delayedMessages=[];onNetworkConnectedConsumers=[];onNetworkDisconnectedConsumers=[];onUnloadConsumers=[];onStdout=e=>{if(this.onStdoutConsumers.push(e),1===this.onStdoutConsumers.length){for(const e of this.delayedStdout)this.fireStdout(e);this.delayedStdout=[]}};onFrameSize=e=>{this.onFrameSizeConsumers.push(e)};onFrame=e=>{this.onFrameConsumers.push(e)};onSoundPush=e=>{this.onSoundPushConsumers.push(e)};onExit=e=>{this.onExitConsumers.push(e)};onMessage=e=>{if(this.onMessageConsumers.push(e),1===this.onMessageConsumers.length){for(const t of this.delayedMessages)e(t.msgType,...t.args);this.delayedMessages=[]}};onNetworkConnected(e){this.onNetworkConnectedConsumers.push(e)}onNetworkDisconnected(e){this.onNetworkDisconnectedConsumers.push(e)}onUnload=e=>{this.onUnloadConsumers.push(e)};fireStdout=e=>{if(0!==this.onStdoutConsumers.length)for(const t of this.onStdoutConsumers)t(e);else this.delayedStdout.push(e)};fireFrameSize=(e,t)=>{for(const n of this.onFrameSizeConsumers)n(e,t)};fireFrame=(e,t)=>{for(const n of this.onFrameConsumers)n(e,t)};fireSoundPush=e=>{for(const t of this.onSoundPushConsumers)t(e)};fireExit=()=>{for(const e of this.onExitConsumers)e();this.onStdoutConsumers=[],this.onFrameSizeConsumers=[],this.onFrameConsumers=[],this.onSoundPushConsumers=[],this.onExitConsumers=[],this.onMessageConsumers=[]};fireMessage=(()=>{var e=this;return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),r=1;r{for(const n of this.onNetworkConnectedConsumers)n(e,t)};fireNetworkDisconnected=e=>{for(const t of this.onNetworkDisconnectedConsumers)t(e)};fireUnload=async()=>{const e=[];for(const t of this.onUnloadConsumers)e.push(t());await Promise.all(e)}}},{}],73:[function(e,t,n){"use strict";var s=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});const r=e("../build"),o=e("./modules"),i=s(e("../dos/bundle/dos-bundle")),a=e("../dos/dosbox/ts/direct"),l=e("../dos/dosbox/ts/worker"),c=e("../protocol/protocol"),u=s(e("../libzip/libzip"));const d=new class{pathPrefix="";pathSuffix="";version=r.Build.version;wdosboxJs="wdosbox.js";wdosboxxJs="wdosbox-x.js";wasmModulesPromise;async bundle(){const e=await this.wasmModules(),t=await e.libzip();return new i.default(t)}async bundleConfig(e){const t=await this.wasmModules(),n=await t.libzip(),s={};await n.instantiate(s);const o=new u.default(s);try{o.zipToFs(e,"/",".jsdos/");try{const e=await o.readFile(".jsdos/dosbox.conf");try{const t=await o.readFile(".jsdos/jsdos.json");return{dosboxConf:e,jsdosConf:JSON.parse(t)}}catch(e){}return{dosboxConf:e,jsdosConf:{version:r.Build.version}}}catch(e){}return null}finally{o.destroy()}}async bundleUpdateConfig(e,t){const n=await this.wasmModules(),s=await n.libzip(),r={};await s.instantiate(r);const o=new u.default(r);try{return await o.writeFile("bundle.zip",e),await o.writeFile(".jsdos/dosbox.conf",t.dosboxConf),await o.writeFile(".jsdos/jsdos.json",JSON.stringify(t.jsdosConf)),await o.zipAddFile("bundle.zip",".jsdos/jsdos.json"),await o.zipAddFile("bundle.zip",".jsdos/dosbox.conf"),await o.readFile("bundle.zip","binary")}finally{o.destroy()}}async dosboxNode(e,t){return this.dosboxDirect(e,t)}async dosboxDirect(e,t){const n=await this.wasmModules(),s=await n.dosbox(),r=await(0,a.dosDirect)(s,"session-"+Date.now());return this.backend(e,r,t)}async dosboxWorker(e,t){const n=await this.wasmModules(),s=await n.dosbox(),r=await(0,l.dosWorker)(this.pathPrefix+this.wdosboxJs+this.pathSuffix,s,"session-"+Date.now());return this.backend(e,r,t)}async dosboxXNode(e,t){return this.dosboxXDirect(e,t)}async dosboxXDirect(e,t){const n=await this.wasmModules(),s=await n.dosboxx(),r=await(0,a.dosDirect)(s,"session-"+Date.now());return this.backend(e,r,t)}async dosboxXWorker(e,t){const n=await this.wasmModules(),s=await n.dosboxx(),r=await(0,l.dosWorker)(this.pathPrefix+this.wdosboxxJs+this.pathSuffix,s,"session-"+Date.now());return this.backend(e,r,t)}async backend(e,t,n){return new Promise(((s,r)=>{const o=new c.CommandInterfaceOverTransportLayer(Array.isArray(e)?e:[e],t,(e=>{null!==e?r(e):setTimeout((()=>s(o)),4)}),n||{})}))}wasmModules(){if(void 0!==this.wasmModulesPromise)return this.wasmModulesPromise;return this.wasmModulesPromise=(async()=>new o.WasmModulesImpl(this.pathPrefix,this.pathSuffix,this.wdosboxJs,this.wdosboxxJs))(),this.wasmModulesPromise}async dosDirect(e){return this.dosboxDirect(e)}async dosWorker(e){return this.dosboxWorker(e)}};n.default=d},{"../build":66,"../dos/bundle/dos-bundle":67,"../dos/dosbox/ts/direct":68,"../dos/dosbox/ts/worker":69,"../libzip/libzip":75,"../protocol/protocol":78,"./modules":74}],74:[function(e,t,n){"use strict";e("core-js/modules/es.typed-array.set.js"),Object.defineProperty(n,"__esModule",{value:!0}),n.loadWasmModule=n.WasmModulesImpl=n.host=void 0;const s=e("../http");n.host=new class{wasmSupported=!1;globals;constructor(){if(this.globals="undefined"==typeof window?{}:window,this.globals.module||(this.globals.module={}),this.globals.exports||(this.globals.exports={}),this.globals.compiled||(this.globals.compiled={}),"object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate&&"function"==typeof WebAssembly.compile){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));e instanceof WebAssembly.Module&&(this.wasmSupported=new WebAssembly.Instance(e)instanceof WebAssembly.Instance)}Math.imul&&-5===Math.imul(4294967295,5)||(Math.imul=function(e,t){const n=65535&e,s=65535&t;return n*s+((e>>>16)*s+n*(t>>>16)<<16)|0}),Math.imul=Math.imul,Math.fround||(Math.fround=function(e){return e}),Math.fround=Math.fround,Math.clz32||(Math.clz32=function(e){e>>>=0;for(let t=0;t<32;t++)if(e&1<<31-t)return t;return 32}),Math.clz32=Math.clz32,Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Math.trunc=Math.trunc}};function r(t,r,a){return"undefined"==typeof XMLHttpRequest?function(t,s,r){if(void 0!==n.host.globals.compiled[s])return n.host.globals.compiled[s];const i=e(t),a=Promise.resolve(new o(i));s&&(n.host.globals.compiled[s]=a);return a}(t,r):function(e,t,r){if(void 0!==n.host.globals.compiled[t])return n.host.globals.compiled[t];async function o(){const o=e.lastIndexOf("/"),a=e.indexOf("w",o),l=a===o+1&&a>=0;if(!n.host.wasmSupported||!l)throw new Error("Starting from js-dos 6.22.60 js environment is not supported");const c=e.lastIndexOf(".js"),u=e.substring(0,c)+".wasm"+e.substring(c+3),d=(0,s.httpRequest)(u,{responseType:"arraybuffer",progress:(t,n)=>{r("Resolving DosBox ("+e+")",t,n)}}),f=(0,s.httpRequest)(e,{progress:(e,t)=>{r("Resolving DosBox",e,t)}}),[h,p]=await Promise.all([d,f]),m=await WebAssembly.compile(h),y=(e,t)=>(e.env=e.env||{},WebAssembly.instantiate(m,e).then((e=>t(e,m))));return eval.call(window,p),n.host.globals.exports[t]=n.host.globals.module.exports,new i(m,n.host.globals.exports[t],y)}const a=o();t&&(n.host.globals.compiled[t]=a);return a}(t,r,a)}n.WasmModulesImpl=class{pathPrefix;pathSuffix;wdosboxJs;wdosboxxJs;libzipPromise;dosboxPromise;dosboxxPromise;wasmSupported=!1;constructor(e,t,n,s){e.length>0&&"/"!==e[e.length-1]&&(e+="/"),this.pathPrefix=e,this.pathSuffix=t,this.wdosboxJs=n,this.wdosboxxJs=s}libzip(){return void 0!==this.libzipPromise||(this.libzipPromise=this.loadModule(this.pathPrefix+"wlibzip.js"+this.pathSuffix,"WLIBZIP")),this.libzipPromise}dosbox(){return void 0!==this.dosboxPromise||(this.dosboxPromise=this.loadModule(this.pathPrefix+this.wdosboxJs+this.pathSuffix,"WDOSBOX")),this.dosboxPromise}dosboxx(){return void 0!==this.dosboxxPromise||(this.dosboxxPromise=this.loadModule(this.pathPrefix+this.wdosboxxJs+this.pathSuffix,"WDOSBOXX")),this.dosboxxPromise}loadModule(e,t){return r(e,t,(()=>{}))}},n.loadWasmModule=r;class o{emModule;constructor(e){this.emModule=e}async instantiate(e){await this.emModule(e)}}class i{wasmModule;module;instantiateWasm;constructor(e,t,n){this.wasmModule=e,this.module=t,this.instantiateWasm=n}async instantiate(e){e.instantiateWasm=this.instantiateWasm,await this.module(e)}}},{"../http":71,"core-js/modules/es.typed-array.set.js":65}],75:[function(e,t,n){"use strict";e("core-js/modules/es.typed-array.set.js"),Object.defineProperty(n,"__esModule",{value:!0});n.default=class{module;home;constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/home/web_user";this.module=e,this.home=t,this.module.callMain([]),this.module.FS.ignorePermissions=!0,this.chdirToHome()}zipFromFs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;this.chdirToHome();const t=this.module._zip_from_fs(e);if(0===t)return Promise.reject(new Error("Can't create zip, see more info in logs"));const n=this.module.HEAPU32[t/4],s=this.module.HEAPU8.slice(t+4,t+4+n);return this.module._free(t),Promise.resolve(s)}zipToFs(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",n=arguments.length>2?arguments[2]:void 0;const s=this.module;t=this.normalizeFilename(t);const r=this.normalizeFilename(t).split("/");this.createPath(r,0,r.length),this.chdir(t);const o=void 0!==n&&n.length>0;let i=0;if(o){const e=s.lengthBytesUTF8(n)+1;i=s._malloc(e),s.stringToUTF8(n,i,e)}const a=new Uint8Array(e),l=s._malloc(a.length);s.HEAPU8.set(a,l);const c=s._zip_to_fs(l,a.length,i);return s._free(l),this.chdirToHome(),o&&s._free(i),0===c?Promise.resolve():Promise.reject(new Error("Can't extract zip, retcode "+c+", see more info in logs"))}writeFile(e,t){e=this.normalizeFilename(e),t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=e.split("/");if(0===n.length)throw new Error("Can't create file '"+e+"', because it's not valid file path");const s=n[n.length-1].trim();if(0===s.length)throw new Error("Can't create file '"+e+"', because file name is empty");const r=this.createPath(n,0,n.length-1);this.module.FS.writeFile(r+"/"+s,t)}async readFile(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";return e=this.normalizeFilename(e),this.module.FS.readFile(e,{encoding:t})}exists(e){e=this.normalizeFilename(e);try{return this.module.FS.lookupPath(e),!0}catch(e){return!1}}destroy(){try{this.module._libzip_destroy()}catch(e){return e}}normalizeFilename(e){for(e=e.replace(new RegExp("^[a-zA-z]+:"),"").replace(new RegExp("\\\\","g"),"/");"/"===e[0];)e=e.substr(1);return e}createPath(e,t,n){let s=".";for(let r=t;r>4;if(l>0){for(var c=l+240;255===c;)l+=c=e[r++];for(var u=r+l;ri)return-(r-2);var f=15&a;for(c=f+240;255===c;)f+=c=e[r++];var h=i-d;for(u=i+f+4;ir?0:e+e/255+16|0},s.compress=function(e,t,n,u){return l.set(c),function(e,t,n,c,u){var d=c,f=u-c,h=0;if(e.length>=r)throw new Error("input too large");if(e.length>12){var p=s.compressBound(e.length);if(f>>16,v=l[g]-1;if(l[g]=n+1,v<0||n-v>>>16>0||(e[v+3]<<8|e[v+2])!=w||(e[v+1]<<8|e[v])!=b)n+=m++>>6;else{m=67;var x=n-h,_=n-v;v+=4;for(var k=n+=4;n=i){t[d++]=240+P;for(var j=x-i;j>254;j-=255)t[d++]=255;t[d++]=j}else t[d++]=(x<<4)+P;for(var S=0;S>8,k>=o){for(k-=o;k>=255;)k-=255,t[d++]=255;t[d++]=k}h=n}}}if(0==h)return 0;if((x=e.length-h)>=i){t[d++]=240;for(var M=x-i;M>254;M-=255)t[d++]=255;t[d++]=M}else t[d++]=x<<4;n=h;for(;n{};panicMessages=[];connectPromise=null;connectResolve=()=>{};connectReject=()=>{};disconnectPromise=null;disconnectResolve=()=>{};asyncifyStatsPromise=null;asyncifyStatsResolve=()=>{};fsTreePromise=null;fsTreeResolve=()=>{};fsGetFilePromise={};fsGetFileResolve={};fsGetFileParts={};fsDeleteFilePromise=null;fsDeleteFileResolve=()=>{};dataChunkPromise={};dataChunkResolve={};networkId=0;network={};sockdrives={};options;constructor(e,t,n,s){this.options=s,this.init=e,this.transport=t,this.ready=n,this.configPromise=new Promise((e=>this.configResolve=e)),this.transport.initMessageHandler(this.onServerMessage.bind(this))}sendClientMessage(e,t,n){(t=t||{}).sessionId=t.sessionId||this.transport.sessionId,this.transport.sendMessageToServer(e,t,n)}onServerMessage(e,t){if(!(void 0===e||e.length<3||"w"!==e[0]||"s"!==e[1]||"-"!==e[2])&&void 0!==t&&t.sessionId===this.transport.sessionId)switch(e){case"ws-ready":{const e=async()=>{if(!this.init||0===this.init.length)return;const e=new TextEncoder,t=async(e,t,n)=>{await this.sendDataChunk({type:e,name:t,data:n.buffer}),await this.sendDataChunk({type:e,name:t,data:null})};let n=0;for(const s of this.init)if(ArrayBuffer.isView(s))await t("bundle",n+"",s),n++;else if("string"==typeof s)await t("file",".jsdos/dosbox.conf",e.encode(s));else{const n=s,r=s;void 0!==r.jsdosConf?.version?(await t("file",".jsdos/dosbox.conf",e.encode(r.dosboxConf)),await t("file",".jsdos/jsdos.json",e.encode(JSON.stringify(r.jsdosConf,null,2)))):void 0!==n.path?await t("file",n.path,n.contents):console.error("Unknown init part",s)}};e().then((()=>{this.sendClientMessage("wc-run",{token:this.options.token})})).catch((e=>{this.onErr("panic","Can't send bundles to backend: "+e.message),console.error(e)})).finally((()=>{delete this.init}))}break;case"ws-server-ready":this.panicMessages.length>0?(void 0!==this.transport.exit&&this.transport.exit(),this.ready(new Error(JSON.stringify(this.panicMessages)))):this.ready(null),delete this.ready;break;case"ws-frame-set-size":this.onFrameSize(t.width,t.height);break;case"ws-update-lines":this.onFrameLines(t.lines,t.rgba);break;case"ws-exit":this.onExit();break;case"ws-log":this.onLog(t.tag,t.message);break;case"ws-warn":this.onWarn(t.tag,t.message);break;case"ws-err":this.onErr(t.tag,t.message);break;case"ws-stdout":this.onStdout(t.message);break;case"ws-persist":this.onPersist(t.bundle??t.sockdrives??null);break;case"ws-sound-init":this.onSoundInit(t.freq);break;case"ws-sound-push":this.onSoundPush(t.samples);break;case"ws-config":this.onConfig({dosboxConf:this.utf8Decoder.decode(t.dosboxConf),jsdosConf:JSON.parse(t.jsdosConf)});break;case"ws-sync-sleep":this.sendClientMessage("wc-sync-sleep",t);break;case"ws-connected":this.connectResolve(),this.connectPromise=null,this.connectResolve=()=>{},this.connectReject=()=>{},this.eventsImpl.fireNetworkConnected(t.networkType,t.address);break;case"ws-disconnected":null!==this.connectPromise?(this.connectReject(),this.connectPromise=null,this.connectResolve=()=>{},this.connectReject=()=>{}):(this.disconnectResolve(),this.disconnectPromise=null,this.disconnectResolve=()=>{}),this.eventsImpl.fireNetworkDisconnected(t.networkType);break;case"ws-extract-progress":this.options.onExtractProgress&&this.options.onExtractProgress(t.index,t.file,t.extracted,t.count);break;case"ws-asyncify-stats":t.driveIo=[];for(const e of Object.values(this.sockdrives))t.driveIo.push({url:e.info.url,preload:e.info.preloadSizeInBytes,total:e.info.sizeInBytes,read:e.info.readInBytes,write:e.info.writeInBytes});this.asyncifyStatsResolve(t),this.asyncifyStatsResolve=()=>{},this.asyncifyStatsPromise=null;break;case"ws-fs-tree":this.fsTreeResolve(t.fsTree),this.fsTreeResolve=()=>{},this.fsTreePromise=null;break;case"ws-fs-delete-file":this.fsDeleteFileResolve(t.deleted),this.fsDeleteFileResolve=()=>{},this.fsDeleteFilePromise=null;break;case"ws-send-data-chunk":{const e=t.chunk,n=this.dataChunkKey(e);if("ok"===e.type)void 0!==this.dataChunkPromise[n]&&(this.dataChunkResolve[n](),delete this.dataChunkPromise[n],delete this.dataChunkResolve[n]);else if("file"===e.type)if(null===e.data){const t=this.mergeChunks(this.fsGetFileParts[e.name]);this.fsGetFileResolve[e.name](t),delete this.fsGetFilePromise[e.name],delete this.fsGetFileResolve[e.name]}else this.fsGetFileParts[e.name].push(new Uint8Array(e.data));else console.log("Unknown chunk type:",e.type)}break;case"ws-net-connect":{this.networkId+=1;const e=this.networkId,n=new WebSocket(t.address);n.binaryType="arraybuffer",n.addEventListener("error",(e=>{console.error("Can't connect to",t.address),this.sendClientMessage("wc-net-connected",{networkId:-1})})),n.addEventListener("open",(()=>{this.network[e]=n,this.sendClientMessage("wc-net-connected",{networkId:e})})),n.addEventListener("message",(t=>{this.sendClientMessage("wc-net-received",{networkId:e,data:t.data},[t.data])}))}break;case"ws-net-send":{const e=this.network[t.networkId];e&&e.send(t.data)}break;case"ws-net-disconnect":{const e=this.network[t.networkId];delete this.network[t.networkId],e&&e.close()}break;case"ws-sockdrive-open":{const e=t.handle;let n=t.url.replace("wss://sockdrive.js-dos.com:8001/dos.zone/","https://br.cdn.dos.zone/sockdrive-qcow2/dos.zone-").replace("wss://sockdrive.js-dos.com:8001/system/","https://br.cdn.dos.zone/sockdrive-qcow2/system-");n.endsWith("/")&&(n=n.slice(0,-1)),(0,r.sockdrive)(n,((t,n)=>{this.sendClientMessage("wc-sockdrive-new-range",{handle:e,range:t,buffer:n})})).then((n=>{this.sockdrives[t.handle]=n;const s=Array.from(n.info.dropped_ranges);this.sendClientMessage("wc-sockdrive-opened",{handle:e,size:n.info.size,heads:n.info.heads,cylinders:n.info.cylinders,sectors:n.info.sectors,sectorSize:n.info.sector_size,aheadRange:n.info.ahead_read,emptyRangesCount:n.info.dropped_ranges.length,emptyRanges:s})})).catch((t=>{this.onErr("panic","Can't open sockdrive("+n+"): "+t.message),console.error(t),this.sendClientMessage("wc-sockdrive-opened",{handle:e,size:0,heads:0,cylinders:0,sectors:0,sectorSize:0,aheadRange:0,emptyRangesCount:0,emptyRanges:[]})}))}break;case"ws-sockdrive-ready":this.sockdrives[t.handle].ready();break;case"ws-sockdrive-load-range":this.sockdrives[t.handle].readRangeAsync(t.range);break;case"ws-sockdrive-write-sector":this.sockdrives[t.handle].write(t.sector,t.data);break;case"ws-sockdrive-close":delete this.sockdrives[t.handle];break;case"ws-unload":this.eventsImpl.fireUnload().finally((()=>{this.sendClientMessage("wc-unload")}));break;default:console.log("Unknown server message (ws):",e)}}onConfig(e){this.configResolve(e)}onFrameSize(e,t){this.frameWidth===e&&this.frameHeight===t||(this.frameWidth=e,this.frameHeight=t,this.rgb=new Uint8Array(e*t*3),this.eventsImpl.fireFrameSize(e,t))}onFrameLines(e,t){for(const t of e)this.rgb.set(t.heapu8,t.start*this.frameWidth*3);this.eventsImpl.fireFrame(this.rgb,this.rgba)}onSoundInit(e){this.freq=e}onSoundPush(e){this.eventsImpl.fireSoundPush(e)}onLog(e,t){this.eventsImpl.fireMessage("log","["+e+"]"+t)}onWarn(e,t){this.eventsImpl.fireMessage("warn","["+e+"]"+t)}onErr(e,t){"panic"===e&&(this.panicMessages.push(t),console.error("["+e+"]"+t)),this.eventsImpl.fireMessage("error","["+e+"]"+t)}onStdout(e){this.eventsImpl.fireStdout(e)}config(){return this.configPromise}width(){return this.frameWidth}height(){return this.frameHeight}soundFrequency(){return this.freq}screenshot(){if(null!==this.rgb||null!==this.rgba){const e=new Uint8ClampedArray(this.frameWidth*this.frameHeight*4),t=null!==this.rgb?this.rgb:this.rgba;let n=0,s=0;for(;sthis.addKey(t,!0,e))),n.forEach((t=>this.addKey(t,!1,e+16)))}sendKeyEvent(e,t){this.addKey(e,t,Date.now()-this.startedAt)}addKey(e,t,n){!0===this.keyMatrix[e]!==t&&(this.keyMatrix[e]=t,this.sendClientMessage("wc-add-key",{key:e,pressed:t,timeMs:n}))}sendMouseMotion(e,t){this.sendClientMessage("wc-mouse-move",{x:e,y:t,relative:!1,timeMs:Date.now()-this.startedAt})}sendMouseRelativeMotion(e,t){this.sendClientMessage("wc-mouse-move",{x:e,y:t,relative:!0,timeMs:Date.now()-this.startedAt})}sendMouseButton(e,t){this.sendClientMessage("wc-mouse-button",{button:e,pressed:t,timeMs:Date.now()-this.startedAt})}sendMouseSync(){this.sendClientMessage("wc-mouse-sync",{timeMs:Date.now()-this.startedAt})}sendBackendEvent(e){this.sendClientMessage("wc-backend-event",{json:JSON.stringify(e)})}async persist(e){const t=e??!0;if(void 0!==this.persistPromise)return this.persistPromise;const n=await this.persistSockdrives();if(null!==n&&t)return Promise.resolve(n);const s=new Promise((e=>{this.persistResolve=e}));return this.persistPromise=s,this.sendClientMessage("wc-pack-fs-to-bundle",{onlyChanges:t}),s}onPersist(e){this.persistResolve&&(this.persistResolve(e),delete this.persistPromise,delete this.persistResolve)}pause(){this.sendClientMessage("wc-pause")}resume(){this.sendClientMessage("wc-resume")}mute(){this.sendClientMessage("wc-mute")}unmute(){this.sendClientMessage("wc-unmute")}exit(){if(this.exited)return Promise.resolve();if(void 0!==this.exitPromise)return this.exitPromise;this.exitPromise=new Promise((e=>this.exitResolve=e)),this.exitPromise.then((()=>{this.events().fireExit()})),this.resume();for(const e of Object.values(this.network))e.close();return this.network={},this.sendClientMessage("wc-exit"),this.exitPromise}onExit(){this.exited||(this.exited=!0,void 0!==this.transport.exit&&this.transport.exit(),this.exitResolve&&(this.exitResolve(),delete this.exitPromise,delete this.exitResolve))}events(){return this.eventsImpl}networkConnect(e,t){return null!==this.connectPromise||null!==this.disconnectPromise?Promise.reject(new Error("Already prefoming connection or disconnection...")):(this.connectPromise=new Promise(((n,s)=>{t.startsWith("wss://")||t.startsWith("ws://")||(t=("http:"===window.location.protocol?"ws://":"wss://")+t),this.connectResolve=n,this.connectReject=s,this.sendClientMessage("wc-connect",{networkType:e,address:t})})),this.connectPromise)}networkDisconnect(e){return null!==this.connectPromise||null!==this.disconnectPromise?Promise.reject(new Error("Already prefoming connection or disconnection...")):(this.disconnectPromise=new Promise((t=>{this.disconnectResolve=t,this.sendClientMessage("wc-disconnect",{networkType:e})})),this.disconnectPromise)}asyncifyStats(){if(null!==this.asyncifyStatsPromise)return this.asyncifyStatsPromise;const e=new Promise((e=>{this.asyncifyStatsResolve=e}));return this.asyncifyStatsPromise=e,this.sendClientMessage("wc-asyncify-stats",{}),e}fsTree(){if(null!==this.fsTreePromise)return this.fsTreePromise;const e=new Promise((e=>{this.fsTreeResolve=e}));return this.fsTreePromise=e,this.sendClientMessage("wc-fs-tree"),e}async fsReadFile(e){if(void 0!==this.fsGetFilePromise[e])throw new Error("fsGetFile should not be called twice for same file");const t=new Promise((t=>{this.fsGetFileResolve[e]=t}));return this.fsGetFilePromise[e]=t,this.fsGetFileParts[e]=[],this.sendClientMessage("wc-fs-get-file",{file:e}),t}async fsWriteFile(e,t){if(ArrayBuffer.isView(t))await this.sendDataChunk({type:"file",name:e,data:t.buffer});else{const n=t.getReader();for(;;){const t=await n.read();if(void 0!==t.value&&await this.sendDataChunk({type:"file",name:e,data:t.value.buffer}),t.done)break}}await this.sendDataChunk({type:"file",name:e,data:null})}async fsDeleteFile(e){if(null!==this.fsDeleteFilePromise)throw new Error("fsDeleteFile should not be called while previous one is not resolved");const t=new Promise((e=>{this.fsDeleteFileResolve=e}));return this.fsDeleteFilePromise=t,this.sendClientMessage("wc-fs-delete-file",{file:e}),t}async persistSockdrives(){if(0===Object.keys(this.sockdrives).length)return null;const e=[];for(const[t,n]of Object.entries(this.sockdrives)){const t=await n.persist();null!==t&&e.push({url:n.info.url,persist:t})}return{drives:e}}async sendDataChunk(e){if(null===e.data||e.data.byteLength<=o)return this.sendFullDataChunk(e);{let t=0;for(;t{this.dataChunkResolve[t]=e}));return this.dataChunkPromise[t]=n,this.sendClientMessage("wc-send-data-chunk",{chunk:e},null===e.data?void 0:[e.data]),n}dataChunkKey(e){return e.name}mergeChunks(e){if(1===e.length)return e[0];let t=0;for(const n of e)t+=n.byteLength;const n=new Uint8Array(t);t=0;for(const s of e)n.set(s,t),t+=s.byteLength;return n}}},{"../impl/ci-impl":72,"./sockdrive":80,"core-js/modules/es.typed-array.set.js":65}],79:[function(e,t,n){"use strict";e("core-js/modules/es.typed-array.set.js"),Object.defineProperty(n,"__esModule",{value:!0}),n.getStore=n.NoStore=n.WRITE_STORE=n.RAW_STORE=void 0,n.RAW_STORE="raw",n.WRITE_STORE="write";class s{owner="";close(){}put(e,t,n){return Promise.resolve()}get(e,t){return Promise.resolve(null)}keys(e){return Promise.resolve([])}each(e,t,n){return Promise.resolve()}}n.NoStore=s;class r{indexedDB;db=null;constructor(e,t,s){if(this.indexedDB="undefined"==typeof window?void 0:window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,this.indexedDB)try{const r=this.indexedDB.open("sockdrive ("+e+")",1);r.onerror=()=>{s("Can't open cache database: "+r.error?.message)},r.onsuccess=()=>{this.db=r.result,t(this)},r.onupgradeneeded=()=>{try{this.db=r.result,this.db.onerror=()=>{s("Can't upgrade cache database")},this.db.createObjectStore(n.RAW_STORE).createIndex("range","",{multiEntry:!1}),this.db.createObjectStore(n.WRITE_STORE).createIndex("sector","",{multiEntry:!1})}catch(e){s("Can't upgrade cache database")}}}catch(e){s("Can't open cache database: "+e.message)}else s("IndexedDB is not supported on this host")}close(){null!==this.db&&(this.db.close(),this.db=null)}put(e,t,n){return new Promise((s=>{const r=this.db.transaction(n,"readwrite").objectStore(n).put(new Blob([t.buffer]),e);r.onerror=e=>{console.error(e),s()},r.onsuccess=()=>{s()}}))}get(e,t){return new Promise((n=>{const s=this.db.transaction(t,"readonly").objectStore(t).get(e);s.onerror=e=>{console.error(e),n(null)},s.onsuccess=()=>{s.result?s.result.arrayBuffer().then((e=>{n(new Uint8Array(e))})).catch((e=>{console.error(e),n(null)})):n(null)}}))}keys(e){return new Promise((t=>{if(null===this.db)return void t([]);const n=this.db.transaction(e,"readonly").objectStore(e).getAllKeys();n.onerror=e=>{console.error(e),t([])},n.onsuccess=e=>{n.result?t(n.result):t([])}}))}each(e,t,n){return new Promise((s=>{if(null===this.db)return void s();const r=this.db.transaction(t,"readonly").objectStore(t),o=async e=>new Promise(((t,n)=>{const s=r.get(e);s.onerror=e=>{n(e)},s.onsuccess=e=>{s.result.arrayBuffer().then((e=>{t(new Uint8Array(e))})).catch(n)}}));(async()=>{for(const t of e){const e=await o(t);n(t,e)}s()})().catch((e=>{console.error(e),s()}))}))}}n.getStore=function(e){return new Promise((t=>{new r(e,t,(e=>{console.error("Can't open IndexedDB cache",e),t(new s)}))}))}},{"core-js/modules/es.typed-array.set.js":65}],80:[function(e,t,n){"use strict";e("core-js/modules/es.typed-array.set.js"),Object.defineProperty(n,"__esModule",{value:!0}),n.sockdrive=void 0;const s=e("./sockdrive-store"),r=e("./mini-lz4");n.sockdrive=async function(e,t){const n=await(0,s.getStore)(e),o=await fetch(e+"/sockdrive.metaj"),i=await o.json();i.url=e,i.readInBytes=0,i.writeInBytes=0,void 0===i.small_ranges&&(i.small_ranges=[]);let a=new Map;const l=await n.get(0,s.WRITE_STORE);l&&(i.writeInBytes=l.length,a=x(l));const c=new Set;for(const e of await n.keys(s.RAW_STORE))c.add(e);if(void 0!==i.small_ranges.find((e=>!c.has(e)))){const t=new Uint8Array(await(await fetch(e+"/preload.raw")).arrayBuffer());for(let e=0;e=i.range_count)&&e.push(t);if(e.length>0){console.error("sockdrive-error: invalid ranges",e);for(const t of e)h.splice(h.indexOf(t),1)}}h.reverse();let m=h.length;for(let e=0;e0&&e.length<1;){const t=h.pop();u.has(t)||(u.add(t),e.push(w(t)))}await Promise.all(e),h.length>0&&g().catch(console.error)}function v(e){const t=new Map;for(const[n,s]of e.entries())s.forEach(((e,s)=>{t.set(s+n*i.ahead_read/i.sector_size,e)}));const n=i.sector_size+4,s=(0,r.compressBound)(n),o=new Uint8Array(n),a=new Uint32Array(o.buffer),l=new Uint8Array(s),c=[];let u=0;t.forEach(((e,t)=>{a[0]=t,o.set(e,4);const s=(0,r.compress)(o,l,0,l.length);s<=0||s>=o.length?(c.push(o.slice(0)),u+=n):(c.push(l.slice(0,s)),u+=s)}));const d=new Uint8Array(u+4*t.size+4);d[0]=t.size,d[1]=(65280&t.size)>>8,d[2]=(16711680&t.size)>>16,d[3]=(4278190080&t.size)>>24;let f=4;for(const e of c)d[f]=e.length,d[f+1]=(65280&e.length)>>8,d[f+2]=(16711680&e.length)>>16,d[f+3]=(4278190080&e.length)>>24,f+=4,d.set(e,f),f+=e.length;return d}function x(e){const t=new Map,n=255&e[0]|e[1]<<8&65280|e[2]<<16&16711680|e[3]<<24&4278190080,s=i.sector_size+4,o=new Uint8Array(s),a=new Uint32Array(o.buffer);let l=4;for(let c=0;c{if(0===a.size)return;const e=v(a),t=new Blob([e],{type:"application/octet-stream"}),n=URL.createObjectURL(t);console.log("Download serialized sectors:",n);const s=x(e);console.log("Comparing sectors and deserialized:"),console.log("Original sectors size:",a.size),console.log("Deserialized sectors size:",s.size),a.forEach(((e,t)=>{const n=s.get(t);n?e.forEach(((e,s)=>{const r=n.get(s);if(!r)return void console.error(`Sector ${s} missing in range ${t}`);e.length===r.length&&e.every(((e,t)=>e===r[t]))||(console.error(`Data mismatch in range ${t}, sector ${s}`),console.log("Original:",e),console.log("Deserialized:",r))})):console.error(`Range ${t} missing in deserialized data`)}))},{info:i,range:y,readRangeAsync:async e=>{u.has(e)||(u.add(e),w(e))},ready:()=>{g().catch(console.error)},write:(e,t)=>{const n=y(e);a.has(n)||a.set(n,new Map),a.get(n).set(e-n*i.ahead_read/i.sector_size,t)},persist:async()=>{const e=v(a);return e.byteLength>4?e:null}}}},{"./mini-lz4":77,"./sockdrive-store":79,"core-js/modules/es.typed-array.set.js":65}]},{},[70]); //# sourceMappingURL=emulators.js.map