├── lr.jsdos ├── cover.png ├── ingame.png ├── _resources ├── LR.DAT ├── LR.RES ├── _LR.COM ├── GAME.zip └── LODERUN.COM ├── emulators ├── wdosbox.wasm ├── wlibzip.wasm ├── wdosbox-x.wasm ├── types │ ├── protocol │ │ ├── mini-lz4.d.ts │ │ ├── messages-queue.d.ts │ │ ├── sockdrive.d.ts │ │ ├── sockdrive-store.d.ts │ │ └── protocol.d.ts │ ├── dos │ │ ├── dosbox │ │ │ └── ts │ │ │ │ ├── direct.d.ts │ │ │ │ └── worker.d.ts │ │ └── bundle │ │ │ └── dos-bundle.d.ts │ ├── http.d.ts │ ├── build.d.ts │ ├── libzip │ │ └── libzip.d.ts │ ├── impl │ │ ├── modules.d.ts │ │ ├── emulators-impl.d.ts │ │ └── ci-impl.d.ts │ └── emulators.d.ts ├── wlibzip.js.symbols ├── emulators.js └── wlibzip.js ├── README.md ├── index.html ├── hammer.min.js └── LICENSE /lr.jsdos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mad4j/loderunner-in-a-box/HEAD/lr.jsdos -------------------------------------------------------------------------------- /cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mad4j/loderunner-in-a-box/HEAD/cover.png -------------------------------------------------------------------------------- /ingame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mad4j/loderunner-in-a-box/HEAD/ingame.png -------------------------------------------------------------------------------- /_resources/LR.DAT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mad4j/loderunner-in-a-box/HEAD/_resources/LR.DAT -------------------------------------------------------------------------------- /_resources/LR.RES: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mad4j/loderunner-in-a-box/HEAD/_resources/LR.RES -------------------------------------------------------------------------------- /_resources/_LR.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mad4j/loderunner-in-a-box/HEAD/_resources/_LR.COM -------------------------------------------------------------------------------- /_resources/GAME.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mad4j/loderunner-in-a-box/HEAD/_resources/GAME.zip -------------------------------------------------------------------------------- /_resources/LODERUN.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mad4j/loderunner-in-a-box/HEAD/_resources/LODERUN.COM -------------------------------------------------------------------------------- /emulators/wdosbox.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mad4j/loderunner-in-a-box/HEAD/emulators/wdosbox.wasm -------------------------------------------------------------------------------- /emulators/wlibzip.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mad4j/loderunner-in-a-box/HEAD/emulators/wlibzip.wasm -------------------------------------------------------------------------------- /emulators/wdosbox-x.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mad4j/loderunner-in-a-box/HEAD/emulators/wdosbox-x.wasm -------------------------------------------------------------------------------- /emulators/types/protocol/mini-lz4.d.ts: -------------------------------------------------------------------------------- 1 | export declare const compressBound: any; 2 | export declare const compress: any; 3 | export declare const uncompress: any; 4 | -------------------------------------------------------------------------------- /emulators/types/dos/dosbox/ts/direct.d.ts: -------------------------------------------------------------------------------- 1 | import { WasmModule } from "../../../impl/modules"; 2 | import { TransportLayer } from "../../../protocol/protocol"; 3 | export declare function dosDirect(wasmModule: WasmModule, sessionId: string): Promise; 4 | -------------------------------------------------------------------------------- /emulators/types/dos/dosbox/ts/worker.d.ts: -------------------------------------------------------------------------------- 1 | import { WasmModule } from "../../../impl/modules"; 2 | import { TransportLayer } from "../../../protocol/protocol"; 3 | export declare function dosWorker(workerUrl: string, wasmModule: WasmModule, sessionId: string): Promise; 4 | -------------------------------------------------------------------------------- /emulators/types/protocol/messages-queue.d.ts: -------------------------------------------------------------------------------- 1 | import { ServerMessage, MessageHandler } from "./protocol"; 2 | export declare class MessagesQueue { 3 | private messages; 4 | handler(name: ServerMessage, props: { 5 | [key: string]: any; 6 | }): void; 7 | sendTo(handler: MessageHandler): void; 8 | } 9 | -------------------------------------------------------------------------------- /emulators/types/http.d.ts: -------------------------------------------------------------------------------- 1 | export interface XhrOptions { 2 | method?: string; 3 | progress?: (total: number, loaded: number) => void; 4 | data?: string; 5 | responseType?: XMLHttpRequestResponseType; 6 | } 7 | export declare const httpRequest: typeof XhrRequest; 8 | declare function XhrRequest(url: string, options: XhrOptions): Promise; 9 | export {}; 10 | -------------------------------------------------------------------------------- /emulators/types/build.d.ts: -------------------------------------------------------------------------------- 1 | export declare const Build: { 2 | version: string; 3 | buildSeed: number; 4 | "wdosbox-x.wasm": { 5 | size: number; 6 | gzSize: number; 7 | }; 8 | "wdosbox-x.js": { 9 | size: number; 10 | gzSize: number; 11 | }; 12 | "wdosbox.wasm": { 13 | size: number; 14 | gzSize: number; 15 | }; 16 | "wdosbox.js": { 17 | size: number; 18 | gzSize: number; 19 | }; 20 | "wlibzip.wasm": { 21 | size: number; 22 | gzSize: number; 23 | }; 24 | "wlibzip.js": { 25 | size: number; 26 | gzSize: number; 27 | }; 28 | }; 29 | -------------------------------------------------------------------------------- /emulators/types/libzip/libzip.d.ts: -------------------------------------------------------------------------------- 1 | export default class LibZip { 2 | module: any; 3 | private home; 4 | constructor(module: any, home?: string); 5 | zipFromFs(changedAfterMs?: number): Promise; 6 | zipToFs(zipArchive: Uint8Array, path?: string, filter?: string): Promise; 7 | writeFile(file: string, body: ArrayBuffer | Uint8Array | string): void; 8 | readFile(file: string, encoding?: "binary" | "utf8"): Promise; 9 | exists(file: string): boolean; 10 | destroy(): any; 11 | private normalizeFilename; 12 | private createPath; 13 | private chdirToHome; 14 | private chdir; 15 | zipAddFile(archive: string, file: string): Promise; 16 | } 17 | -------------------------------------------------------------------------------- /emulators/types/dos/bundle/dos-bundle.d.ts: -------------------------------------------------------------------------------- 1 | import { WasmModule } from "../../impl/modules"; 2 | export interface DosArchiveSource { 3 | url: string; 4 | path: string; 5 | type?: "zip"; 6 | } 7 | export default class DosBundle { 8 | dosboxConf: string; 9 | jsdosConf: { 10 | version: string; 11 | }; 12 | sources: DosArchiveSource[]; 13 | private libzipWasm; 14 | constructor(libzipWasm: WasmModule); 15 | autoexec(...lines: string[]): DosBundle; 16 | extract(url: string, path?: string, type?: "zip"): DosBundle; 17 | extractAll(sources: DosArchiveSource[]): DosBundle; 18 | toUint8Array(overwriteConfig?: boolean): Promise; 19 | } 20 | export declare const defaultConfig: string; 21 | -------------------------------------------------------------------------------- /emulators/types/protocol/sockdrive.d.ts: -------------------------------------------------------------------------------- 1 | interface DriveInfo { 2 | ahead_read: number; 3 | range_count: number; 4 | dropped_ranges: number[]; 5 | preload_ranges: number[] | "_"; 6 | small_ranges: number[]; 7 | cylinders: number; 8 | heads: number; 9 | sectors: number; 10 | sector_size: number; 11 | size: number; 12 | name: string; 13 | url: string; 14 | preloadSizeInBytes: number; 15 | sizeInBytes: number; 16 | readInBytes: number; 17 | writeInBytes: number; 18 | } 19 | export interface Drive { 20 | info: DriveInfo; 21 | range(sector: number): number; 22 | readRangeAsync(range: number): void; 23 | ready(): void; 24 | write(sector: number, buffer: Uint8Array): void; 25 | persist(): Promise; 26 | } 27 | export declare function sockdrive(url: string, _onNewRange: (range: number, buffer: Uint8Array) => void): Promise; 28 | export {}; 29 | -------------------------------------------------------------------------------- /emulators/types/protocol/sockdrive-store.d.ts: -------------------------------------------------------------------------------- 1 | export declare const RAW_STORE = "raw"; 2 | export declare const WRITE_STORE = "write"; 3 | export interface Store { 4 | put: (key: number, data: Uint8Array, store: string) => Promise; 5 | get: (key: number, store: string) => Promise; 6 | keys: (store: string) => Promise; 7 | each: (key: number[], store: string, callback: (key: number, data: Uint8Array) => void) => Promise; 8 | close: () => void; 9 | } 10 | export declare class NoStore implements Store { 11 | owner: string; 12 | close(): void; 13 | put(key: number, data: Uint8Array, store: string): Promise; 14 | get(range: number, store: string): Promise; 15 | keys(store: string): Promise; 16 | each(keys: number[], store: string, callback: (key: number, data: Uint8Array) => void): Promise; 17 | } 18 | export declare function getStore(owner: string): Promise; 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Lode Runner(-in-a-box) 2 | 3 | Play MS-DOS Lode Runner on modern browsers or mobile screens [HERE](https://mad4j.github.io/loderunner-in-a-box/) 4 | 5 | ![cover](cover.png) 6 | 7 | Use the following commands 8 | 9 | | Action | Key | Key Alt | Gesture | 10 | |--------|---------|-------------|-----------------------| 11 | | Up | Keypad8 | Arrow Up | Pan Up | 12 | | Down | Keypad2 | Arrow Down | Pan Down | 13 | | Left | Keypad4 | Arrow Left | Pan Left | 14 | | Right | Keypad6 | Arrow Right | Pan Right | 15 | | Stop | Keypad5 | Space | Tap near center | 16 | | FireL | Keypad7 | Page Up | Tap near left corner | 17 | | FireR | Keypad9 | Page Down | Tap near right corner | 18 | | Menu | Esc | - | - | 19 | 20 | 21 | Made possible using: 22 | 23 | * [DosBox](https://www.dosbox.com/) 24 | * [Em-DosBox](https://github.com/dreamlayers/em-dosbox) 25 | * [JS-Dos](https://js-dos.com/) 26 | * [Emscripten](https://github.com/kripken/emscripten/wiki) 27 | 28 | see [LICENSE](LICENSE) file. 29 | -------------------------------------------------------------------------------- /emulators/types/impl/modules.d.ts: -------------------------------------------------------------------------------- 1 | export interface WasmModule { 2 | instantiate: (module?: any) => Promise; 3 | } 4 | export interface IWasmModules { 5 | libzip: () => Promise; 6 | dosbox: () => Promise; 7 | dosboxx: () => Promise; 8 | } 9 | interface Globals { 10 | exports: { 11 | [moduleName: string]: any; 12 | }; 13 | module: { 14 | exports?: () => void; 15 | }; 16 | compiled: { 17 | [moduleName: string]: Promise; 18 | }; 19 | } 20 | declare class Host { 21 | wasmSupported: boolean; 22 | globals: Globals; 23 | constructor(); 24 | } 25 | export declare const host: Host; 26 | export declare class WasmModulesImpl implements IWasmModules { 27 | private pathPrefix; 28 | private pathSuffix; 29 | private wdosboxJs; 30 | private wdosboxxJs; 31 | private libzipPromise?; 32 | private dosboxPromise?; 33 | private dosboxxPromise?; 34 | wasmSupported: boolean; 35 | constructor(pathPrefix: string, pathSuffix: string, wdosboxJs: string, wdosboxxJs: string); 36 | libzip(): Promise; 37 | dosbox(): Promise; 38 | dosboxx(): Promise; 39 | private loadModule; 40 | } 41 | export declare function loadWasmModule(url: string, moduleName: string, onprogress: (stage: string, total: number, loaded: number) => void): Promise; 42 | export {}; 43 | -------------------------------------------------------------------------------- /emulators/types/impl/emulators-impl.d.ts: -------------------------------------------------------------------------------- 1 | import { Emulators, CommandInterface, BackendOptions, DosConfig, InitFs, InitBundleEntry } from "../emulators"; 2 | import { IWasmModules } from "./modules"; 3 | import DosBundle from "../dos/bundle/dos-bundle"; 4 | import { TransportLayer } from "../protocol/protocol"; 5 | declare class EmulatorsImpl implements Emulators { 6 | pathPrefix: string; 7 | pathSuffix: string; 8 | version: string; 9 | wdosboxJs: string; 10 | wdosboxxJs: string; 11 | private wasmModulesPromise?; 12 | bundle(): Promise; 13 | bundleConfig(bundle: InitBundleEntry): Promise; 14 | bundleUpdateConfig(bundle: InitBundleEntry, config: DosConfig): Promise; 15 | dosboxNode(init: InitFs, options?: BackendOptions): Promise; 16 | dosboxDirect(init: InitFs, options?: BackendOptions): Promise; 17 | dosboxWorker(init: InitFs, options?: BackendOptions): Promise; 18 | dosboxXNode(init: InitFs, options?: BackendOptions): Promise; 19 | dosboxXDirect(init: InitFs, options?: BackendOptions): Promise; 20 | dosboxXWorker(init: InitFs, options?: BackendOptions): Promise; 21 | backend(init: InitFs, transportLayer: TransportLayer, options?: BackendOptions): Promise; 22 | wasmModules(): Promise; 23 | dosDirect(init: InitFs): Promise; 24 | dosWorker(init: InitFs): Promise; 25 | } 26 | declare const emulators: EmulatorsImpl; 27 | export default emulators; 28 | -------------------------------------------------------------------------------- /emulators/types/impl/ci-impl.d.ts: -------------------------------------------------------------------------------- 1 | import { CommandInterfaceEvents, MessageType, NetworkType } from "../emulators"; 2 | export declare class CommandInterfaceEventsImpl implements CommandInterfaceEvents { 3 | private onStdoutConsumers; 4 | private delayedStdout; 5 | private onFrameSizeConsumers; 6 | private onFrameConsumers; 7 | private onSoundPushConsumers; 8 | private onExitConsumers; 9 | private onMessageConsumers; 10 | private delayedMessages; 11 | private onNetworkConnectedConsumers; 12 | private onNetworkDisconnectedConsumers; 13 | private onUnloadConsumers; 14 | onStdout: (consumer: (message: string) => void) => void; 15 | onFrameSize: (consumer: (width: number, height: number) => void) => void; 16 | onFrame: (consumer: (rgb: Uint8Array | null, rgba: Uint8Array | null) => void) => void; 17 | onSoundPush: (consumer: (samples: Float32Array) => void) => void; 18 | onExit: (consumer: () => void) => void; 19 | onMessage: (consumer: (msgType: MessageType, ...args: any[]) => void) => void; 20 | onNetworkConnected(consumer: (networkType: NetworkType, address: string) => void): void; 21 | onNetworkDisconnected(consumer: (networkType: NetworkType) => void): void; 22 | onUnload: (consumer: () => Promise) => void; 23 | fireStdout: (message: string) => void; 24 | fireFrameSize: (width: number, height: number) => void; 25 | fireFrame: (rgb: Uint8Array | null, rgba: Uint8Array | null) => void; 26 | fireSoundPush: (samples: Float32Array) => void; 27 | fireExit: () => void; 28 | fireMessage: (msgType: MessageType, ...args: any[]) => void; 29 | fireNetworkConnected: (networkType: NetworkType, address: string) => void; 30 | fireNetworkDisconnected: (networkType: NetworkType) => void; 31 | fireUnload: () => Promise; 32 | } 33 | -------------------------------------------------------------------------------- /emulators/types/emulators.d.ts: -------------------------------------------------------------------------------- 1 | import DosBundle from "./dos/bundle/dos-bundle"; 2 | import { AsyncifyStats, TransportLayer, FsNode } from "./protocol/protocol"; 3 | export interface DosConfig { 4 | dosboxConf: string; 5 | jsdosConf: { 6 | version: string; 7 | }; 8 | } 9 | export declare enum NetworkType { 10 | NETWORK_DOSBOX_IPX = 0 11 | } 12 | export interface BackendOptions { 13 | token?: string | undefined; 14 | onExtractProgress?: (bundleIndex: number, file: string, extracted: number, total: number) => void; 15 | } 16 | export type InitBundleEntry = Uint8Array; 17 | export interface InitFileEntry { 18 | path: string; 19 | contents: Uint8Array; 20 | } 21 | export type InitFsEntry = InitBundleEntry | InitFileEntry | DosConfig | string; 22 | export type InitFs = InitFsEntry | InitFsEntry[]; 23 | export type PersistedSockdrives = { 24 | drives: { 25 | url: string; 26 | persist: Uint8Array; 27 | }[]; 28 | } | null; 29 | export interface Emulators { 30 | pathPrefix: string; 31 | pathSuffix: string; 32 | version: string; 33 | wdosboxJs: string; 34 | bundle: () => Promise; 35 | bundleConfig: (bundle: InitBundleEntry) => Promise; 36 | bundleUpdateConfig: (bundle: InitBundleEntry, config: DosConfig) => Promise; 37 | dosboxNode: (init: InitFs, options?: BackendOptions) => Promise; 38 | dosboxDirect: (init: InitFs, options?: BackendOptions) => Promise; 39 | dosboxWorker: (init: InitFs, options?: BackendOptions) => Promise; 40 | dosboxXNode: (init: InitFs, options?: BackendOptions) => Promise; 41 | dosboxXDirect: (init: InitFs, options?: BackendOptions) => Promise; 42 | dosboxXWorker: (init: InitFs, options?: BackendOptions) => Promise; 43 | backend: (init: InitFs, transportLayer: TransportLayer, options?: BackendOptions) => Promise; 44 | } 45 | export interface CommandInterface { 46 | config: () => Promise; 47 | height: () => number; 48 | width: () => number; 49 | soundFrequency: () => number; 50 | screenshot: () => Promise; 51 | pause: () => void; 52 | resume: () => void; 53 | mute: () => void; 54 | unmute: () => void; 55 | exit: () => Promise; 56 | simulateKeyPress: (...keyCodes: number[]) => void; 57 | sendKeyEvent: (keyCode: number, pressed: boolean) => void; 58 | sendMouseMotion: (x: number, y: number) => void; 59 | sendMouseRelativeMotion: (x: number, y: number) => void; 60 | sendMouseButton: (button: number, pressed: boolean) => void; 61 | sendMouseSync: () => void; 62 | sendBackendEvent: (event: any) => void; 63 | persist(onlyChanges?: boolean): Promise; 64 | events(): CommandInterfaceEvents; 65 | networkConnect(networkType: NetworkType, address: string): Promise; 66 | networkDisconnect(networkType: NetworkType): Promise; 67 | asyncifyStats(): Promise; 68 | fsTree(): Promise; 69 | fsReadFile(file: string): Promise; 70 | fsWriteFile(file: string, contents: ReadableStream | Uint8Array): Promise; 71 | fsDeleteFile(file: string): Promise; 72 | } 73 | export type MessageType = "log" | "warn" | "error" | string; 74 | export interface CommandInterfaceEvents { 75 | onStdout: (consumer: (message: string) => void) => void; 76 | onFrameSize: (consumer: (width: number, height: number) => void) => void; 77 | onFrame: (consumer: (rgb: Uint8Array | null, rgba: Uint8Array | null) => void) => void; 78 | onSoundPush: (consumer: (samples: Float32Array) => void) => void; 79 | onExit: (consumer: () => void) => void; 80 | onMessage: (consumer: (msgType: MessageType, ...args: any[]) => void) => void; 81 | onNetworkConnected: (consumer: (networkType: NetworkType, address: string) => void) => void; 82 | onNetworkDisconnected: (consumer: (networkType: NetworkType) => void) => void; 83 | onUnload: (consumer: () => Promise) => void; 84 | } 85 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Lode Runner 7 | 8 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
34 | 35 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /emulators/types/protocol/protocol.d.ts: -------------------------------------------------------------------------------- 1 | import { CommandInterface, NetworkType, BackendOptions, DosConfig, InitFsEntry, PersistedSockdrives } from "../emulators"; 2 | import { CommandInterfaceEventsImpl } from "../impl/ci-impl"; 3 | export type ClientMessage = "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" | "wc-fs-delete-file"; 4 | export type ServerMessage = "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-connect" | "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" | "ws-fs-delete-file"; 5 | export type MessageHandler = (name: ServerMessage, props: { 6 | [key: string]: any; 7 | }) => void; 8 | export interface TransportLayer { 9 | sessionId: string; 10 | sendMessageToServer(name: ClientMessage, props: { 11 | [key: string]: any; 12 | }, transfer?: ArrayBuffer[]): void; 13 | initMessageHandler(handler: MessageHandler): void; 14 | exit?: () => void; 15 | } 16 | export interface FrameLine { 17 | start: number; 18 | heapu8: Uint8Array; 19 | } 20 | export interface DataChunk { 21 | type: "ok" | "file" | "bundle"; 22 | name: string; 23 | data: ArrayBuffer | null; 24 | } 25 | export interface AsyncifyStats { 26 | messageSent: number; 27 | messageReceived: number; 28 | messageFrame: number; 29 | messageSound: number; 30 | nonSkippableSleepCount: number; 31 | sleepCount: number; 32 | sleepTime: number; 33 | cycles: number; 34 | netSent: number; 35 | netRecv: number; 36 | driveIo: { 37 | url: string; 38 | preload: number; 39 | total: number; 40 | read: number; 41 | write: number; 42 | }[]; 43 | } 44 | export interface FsNode { 45 | name: string; 46 | size: number | null; 47 | nodes: FsNode[] | null; 48 | } 49 | export declare class CommandInterfaceOverTransportLayer implements CommandInterface { 50 | private startedAt; 51 | private exited; 52 | private frameWidth; 53 | private frameHeight; 54 | private rgb; 55 | private rgba; 56 | private freq; 57 | private utf8Decoder; 58 | private init?; 59 | private transport; 60 | private ready; 61 | private persistPromise?; 62 | private persistResolve?; 63 | private exitPromise?; 64 | private exitResolve?; 65 | private eventsImpl; 66 | private keyMatrix; 67 | private configPromise; 68 | private configResolve; 69 | private panicMessages; 70 | private connectPromise; 71 | private connectResolve; 72 | private connectReject; 73 | private disconnectPromise; 74 | private disconnectResolve; 75 | private asyncifyStatsPromise; 76 | private asyncifyStatsResolve; 77 | private fsTreePromise; 78 | private fsTreeResolve; 79 | private fsGetFilePromise; 80 | private fsGetFileResolve; 81 | private fsGetFileParts; 82 | private fsDeleteFilePromise; 83 | private fsDeleteFileResolve; 84 | private dataChunkPromise; 85 | private dataChunkResolve; 86 | private networkId; 87 | private network; 88 | private sockdrives; 89 | options: BackendOptions; 90 | constructor(init: InitFsEntry[], transport: TransportLayer, ready: (err: Error | null) => void, options: BackendOptions); 91 | private sendClientMessage; 92 | private onServerMessage; 93 | private onConfig; 94 | private onFrameSize; 95 | private onFrameLines; 96 | private onSoundInit; 97 | private onSoundPush; 98 | private onLog; 99 | private onWarn; 100 | private onErr; 101 | private onStdout; 102 | config(): Promise; 103 | width(): number; 104 | height(): number; 105 | soundFrequency(): number; 106 | screenshot(): Promise; 107 | simulateKeyPress(...keyCodes: number[]): void; 108 | sendKeyEvent(keyCode: number, pressed: boolean): void; 109 | addKey(keyCode: number, pressed: boolean, timeMs: number): void; 110 | sendMouseMotion(x: number, y: number): void; 111 | sendMouseRelativeMotion(x: number, y: number): void; 112 | sendMouseButton(button: number, pressed: boolean): void; 113 | sendMouseSync(): void; 114 | sendBackendEvent(payload: any): void; 115 | persist(optOnlyChanges?: boolean): Promise; 116 | private onPersist; 117 | pause(): void; 118 | resume(): void; 119 | mute(): void; 120 | unmute(): void; 121 | exit(): Promise; 122 | private onExit; 123 | events(): CommandInterfaceEventsImpl; 124 | networkConnect(networkType: NetworkType, address: string): Promise; 125 | networkDisconnect(networkType: NetworkType): Promise; 126 | asyncifyStats(): Promise; 127 | fsTree(): Promise; 128 | fsReadFile(file: string): Promise; 129 | fsWriteFile(file: string, contents: ReadableStream | Uint8Array): Promise; 130 | fsDeleteFile(file: string): Promise; 131 | persistSockdrives(): Promise; 132 | private sendDataChunk; 133 | private sendFullDataChunk; 134 | private dataChunkKey; 135 | private mergeChunks; 136 | } 137 | -------------------------------------------------------------------------------- /emulators/wlibzip.js.symbols: -------------------------------------------------------------------------------- 1 | 0:exit 2 | 1:__wasi_fd_close 3 | 2:__wasi_fd_write 4 | 3:emsc_getMTimeMs 5 | 4:__syscall_openat 6 | 5:__syscall_fcntl64 7 | 6:legalimport$_mktime_js 8 | 7:legalimport$_localtime_js 9 | 8:legalimport$__wasi_fd_seek 10 | 9:emscripten_resize_heap 11 | 10:emscripten_force_exit 12 | 11:emscripten_exit_with_live_runtime 13 | 12:emscripten_date_now 14 | 13:emsc_progress 15 | 14:_tzset_js 16 | 15:_setitimer_js 17 | 16:_emscripten_runtime_keepalive_clear 18 | 17:_abort_js 19 | 18:__wasi_proc_exit 20 | 19:__wasi_fd_read 21 | 20:__syscall_unlinkat 22 | 21:__syscall_stat64 23 | 22:__syscall_rmdir 24 | 23:__syscall_renameat 25 | 24:__syscall_newfstatat 26 | 25:__syscall_mkdirat 27 | 26:__syscall_lstat64 28 | 27:__syscall_ioctl 29 | 28:__syscall_getdents64 30 | 29:__syscall_fstat64 31 | 30:__syscall_chmod 32 | 31:__call_sighandler 33 | 32:zip_error_set 34 | 33:emmalloc_free 35 | 34:_zip_error_set_from_source 36 | 35:emmalloc_memalign 37 | 36:_zip_buffer_free 38 | 37:crc32_z 39 | 38:zip_source_free 40 | 39:_zip_buffer_put_16 41 | 40:_zip_buffer_get_16 42 | 41:_zip_buffer_get 43 | 42:strlen 44 | 43:out 45 | 44:pad 46 | 45:fiprintf 47 | 46:_zip_source_call 48 | 47:_zip_buffer_put_32 49 | 48:_tr_flush_block 50 | 49:zip_source_seek 51 | 50:_zip_string_free 52 | 51:_zip_buffer_new 53 | 52:_zip_buffer_get_32 54 | 53:zip_strerror 55 | 54:zip_error_init 56 | 55:zip_source_read 57 | 56:_zip_ef_free 58 | 57:_zip_buffer_set_offset 59 | 58:_zip_buffer_put_64 60 | 59:adler32_z 61 | 60:_zip_buffer_left 62 | 61:_zip_buffer_get_64 63 | 62:__syscall_ret 64 | 63:zip_source_tell_write 65 | 64:zip_source_stat 66 | 65:zip_source_make_command_bitmap 67 | 66:zip_source_close 68 | 67:fwrite 69 | 68:buffer_free 70 | 69:_zip_write 71 | 70:zip_stat_init 72 | 71:strchr 73 | 72:_zip_guess_encoding 74 | 73:_zip_dirent_free 75 | 74:_zip_buffer_offset 76 | 75:__wasi_syscall_ret 77 | 76:zip_error_to_data 78 | 77:zip_error_fini 79 | 78:strcmp 80 | 79:fmt_u 81 | 80:flush_pending 82 | 81:fclose 83 | 82:crc32 84 | 83:_zip_buffer_put 85 | 84:_zip_buffer_new_from_source 86 | 85:__memcpy 87 | 86:zip_close 88 | 87:umask 89 | 88:remove 90 | 89:memcmp 91 | 90:fflush 92 | 91:emmalloc_realloc 93 | 92:buffer_new 94 | 93:_zip_string_get 95 | 94:_zip_error_copy 96 | 95:_zip_dirent_clone 97 | 96:_zip_cdir_free 98 | 97:_zip_buffer_eof 99 | 98:_tr_flush_bits 100 | 99:zip_source_tell 101 | 100:zip_source_open 102 | 101:tolower 103 | 102:open 104 | 103:hash_resize 105 | 104:fill_window 106 | 105:_zip_string_new 107 | 106:_zip_string_length 108 | 107:_zip_progress_update 109 | 108:_zip_get_dirent 110 | 109:_zip_ef_new 111 | 110:_zip_dirent_write 112 | 111:_zip_dirent_init 113 | 112:_tr_stored_block 114 | 113:zip_source_rollback_write 115 | 114:zip_source_layered 116 | 115:zip_source_keep 117 | 116:zip_source_error 118 | 117:zip_open 119 | 118:vfiprintf 120 | 119:strcpy 121 | 120:stat 122 | 121:siprintf 123 | 122:memchr 124 | 123:inflate_table 125 | 124:hash_string 126 | 125:fputc 127 | 126:fopen 128 | 127:decrypt 129 | 128:close 130 | 129:build_tree 131 | 130:attempt_allocate 132 | 131:abort 133 | 132:_zip_unchange_data 134 | 133:_zip_u2d_time 135 | 134:_zip_read_data 136 | 135:_zip_read 137 | 136:_zip_get_name 138 | 137:_zip_get_encryption_implementation 139 | 138:_zip_fseek 140 | 139:_zip_file_get_offset 141 | 140:_zip_entry_finalize 142 | 141:_zip_ef_get_by_id 143 | 142:_zip_dirent_finalize 144 | 143:_zip_checkcons 145 | 144:_zip_allocate_new 146 | 145:__towrite 147 | 146:__strerror_l 148 | 147:__memset 149 | 148:__fwritex 150 | 149:__ftello 151 | 150:__fseeko_unlocked 152 | 151:zipfile_to_fs 153 | 152:zip_stat_index 154 | 153:zip_source_seek_write 155 | 154:zip_source_seek_compute_offset 156 | 155:zip_source_layered_create 157 | 156:zip_source_function_create 158 | 157:zip_source_file_create 159 | 158:zip_source_file 160 | 159:zip_source_decompress 161 | 160:zip_source_crc 162 | 161:zip_source_buffer 163 | 162:zip_set_file_compression 164 | 163:zip_recursively 165 | 164:zip_file_add 166 | 165:zip_error_to_str 167 | 166:zip_error_strerror 168 | 167:zip_discard 169 | 168:zError 170 | 169:wctomb 171 | 170:strdup 172 | 171:snprintf 173 | 172:send_tree 174 | 173:safe_create_dir 175 | 174:printf_core 176 | 175:pop_arg 177 | 176:longest_match 178 | 177:init_block.llvm.13708832007047381696 179 | 178:getint 180 | 179:frexp 181 | 180:fread 182 | 181:ferror 183 | 182:emmalloc_calloc 184 | 183:deflate_stored 185 | 184:deflateEnd 186 | 185:context_free 187 | 186:compression_source_new 188 | 187:compress_block 189 | 188:claim_more_memory 190 | 189:chmod 191 | 190:buffer_seek 192 | 191:buffer_grow_fragments 193 | 192:buffer_find_fragment 194 | 193:allocate 195 | 194:_zip_string_write 196 | 195:_zip_string_equal 197 | 196:_zip_string_crc32 198 | 197:_zip_stat_merge 199 | 198:_zip_source_zip_new 200 | 199:_zip_source_window_new 201 | 200:_zip_source_new 202 | 201:_zip_read_string 203 | 202:_zip_progress_end 204 | 203:_zip_name_locate 205 | 204:_zip_hash_delete 206 | 205:_zip_hash_add 207 | 206:_zip_fseek_u 208 | 207:_zip_file_replace 209 | 208:_zip_error_clear 210 | 209:_zip_entry_init 211 | 210:_zip_ef_write 212 | 211:_zip_ef_utf8 213 | 212:_zip_ef_size 214 | 213:_zip_ef_remove_internal 215 | 214:_zip_ef_parse 216 | 215:_zip_ef_merge 217 | 216:_zip_dirent_read 218 | 217:_zip_dirent_process_ef_utf_8 219 | 218:_zip_dirent_needs_zip64 220 | 219:_zip_cdir_new 221 | 220:_zip_cdir_grow 222 | 221:_zip_buffer_put_8 223 | 222:_zip_buffer_get_8 224 | 223:__vfprintf_internal 225 | 224:__tzset 226 | 225:__time 227 | 226:__overflow 228 | 227:__ftello_unlocked 229 | 228:__fstatat 230 | 229:__fseeko 231 | 230:__fdopen 232 | 231:zipfile_add 233 | 232:zip_to_fs 234 | 233:zip_source_pkware 235 | 234:zip_from_fs 236 | 235:zcfree 237 | 236:zcalloc 238 | 237:window_read 239 | 238:strcasecmp 240 | 239:start 241 | 240:sn_write 242 | 241:read_file 243 | 242:read_data 244 | 243:process 245 | 244:pop_arg_long_double 246 | 245:pkware_decrypt 247 | 246:main 248 | 247:libzip_destroy 249 | 248:input 250 | 249:get_changes_mtime_ms 251 | 250:fmt_fp 252 | 251:end_of_input 253 | 252:end 254 | 253:emmalloc_malloc 255 | 254:demangling_terminate_handler\28\29 256 | 255:deflate_slow 257 | 256:deflate_fast 258 | 257:decompress_allocate 259 | 258:deallocate 260 | 259:crc_read 261 | 260:compression_flags 262 | 261:compress_callback 263 | 262:compress_allocate 264 | 263:action_terminate 265 | 264:action_abort 266 | 265:abort_message 267 | 266:_emscripten_timeout 268 | 267:_emscripten_tempret_set 269 | 268:_emscripten_stack_alloc 270 | 269:__wasm_call_ctors 271 | 270:__stdio_write 272 | 271:__stdio_seek 273 | 272:__stdio_read 274 | 273:__stdio_close 275 | 274:__pthread_mutex_lock 276 | 275:__funcs_on_exit 277 | 276:__emscripten_stdout_seek 278 | -------------------------------------------------------------------------------- /hammer.min.js: -------------------------------------------------------------------------------- 1 | /*! Hammer.JS - v2.0.8 - 2016-04-23 2 | * http://hammerjs.github.io/ 3 | * 4 | * Copyright (c) 2016 Jorik Tangelder; 5 | * Licensed under the MIT license */ 6 | !function(a,b,c,d){"use strict";function e(a,b,c){return setTimeout(j(a,c),b)}function f(a,b,c){return Array.isArray(a)?(g(a,c[b],c),!0):!1}function g(a,b,c){var e;if(a)if(a.forEach)a.forEach(b,c);else if(a.length!==d)for(e=0;e\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",f=a.console&&(a.console.warn||a.console.log);return f&&f.call(a.console,e,d),b.apply(this,arguments)}}function i(a,b,c){var d,e=b.prototype;d=a.prototype=Object.create(e),d.constructor=a,d._super=e,c&&la(d,c)}function j(a,b){return function(){return a.apply(b,arguments)}}function k(a,b){return typeof a==oa?a.apply(b?b[0]||d:d,b):a}function l(a,b){return a===d?b:a}function m(a,b,c){g(q(b),function(b){a.addEventListener(b,c,!1)})}function n(a,b,c){g(q(b),function(b){a.removeEventListener(b,c,!1)})}function o(a,b){for(;a;){if(a==b)return!0;a=a.parentNode}return!1}function p(a,b){return a.indexOf(b)>-1}function q(a){return a.trim().split(/\s+/g)}function r(a,b,c){if(a.indexOf&&!c)return a.indexOf(b);for(var d=0;dc[b]}):d.sort()),d}function u(a,b){for(var c,e,f=b[0].toUpperCase()+b.slice(1),g=0;g1&&!c.firstMultiple?c.firstMultiple=D(b):1===e&&(c.firstMultiple=!1);var f=c.firstInput,g=c.firstMultiple,h=g?g.center:f.center,i=b.center=E(d);b.timeStamp=ra(),b.deltaTime=b.timeStamp-f.timeStamp,b.angle=I(h,i),b.distance=H(h,i),B(c,b),b.offsetDirection=G(b.deltaX,b.deltaY);var j=F(b.deltaTime,b.deltaX,b.deltaY);b.overallVelocityX=j.x,b.overallVelocityY=j.y,b.overallVelocity=qa(j.x)>qa(j.y)?j.x:j.y,b.scale=g?K(g.pointers,d):1,b.rotation=g?J(g.pointers,d):0,b.maxPointers=c.prevInput?b.pointers.length>c.prevInput.maxPointers?b.pointers.length:c.prevInput.maxPointers:b.pointers.length,C(c,b);var k=a.element;o(b.srcEvent.target,k)&&(k=b.srcEvent.target),b.target=k}function B(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};b.eventType!==Ea&&f.eventType!==Ga||(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function C(a,b){var c,e,f,g,h=a.lastInterval||b,i=b.timeStamp-h.timeStamp;if(b.eventType!=Ha&&(i>Da||h.velocity===d)){var j=b.deltaX-h.deltaX,k=b.deltaY-h.deltaY,l=F(i,j,k);e=l.x,f=l.y,c=qa(l.x)>qa(l.y)?l.x:l.y,g=G(j,k),a.lastInterval=b}else c=h.velocity,e=h.velocityX,f=h.velocityY,g=h.direction;b.velocity=c,b.velocityX=e,b.velocityY=f,b.direction=g}function D(a){for(var b=[],c=0;ce;)c+=a[e].clientX,d+=a[e].clientY,e++;return{x:pa(c/b),y:pa(d/b)}}function F(a,b,c){return{x:b/a||0,y:c/a||0}}function G(a,b){return a===b?Ia:qa(a)>=qa(b)?0>a?Ja:Ka:0>b?La:Ma}function H(a,b,c){c||(c=Qa);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return Math.sqrt(d*d+e*e)}function I(a,b,c){c||(c=Qa);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return 180*Math.atan2(e,d)/Math.PI}function J(a,b){return I(b[1],b[0],Ra)+I(a[1],a[0],Ra)}function K(a,b){return H(b[0],b[1],Ra)/H(a[0],a[1],Ra)}function L(){this.evEl=Ta,this.evWin=Ua,this.pressed=!1,x.apply(this,arguments)}function M(){this.evEl=Xa,this.evWin=Ya,x.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function N(){this.evTarget=$a,this.evWin=_a,this.started=!1,x.apply(this,arguments)}function O(a,b){var c=s(a.touches),d=s(a.changedTouches);return b&(Ga|Ha)&&(c=t(c.concat(d),"identifier",!0)),[c,d]}function P(){this.evTarget=bb,this.targetIds={},x.apply(this,arguments)}function Q(a,b){var c=s(a.touches),d=this.targetIds;if(b&(Ea|Fa)&&1===c.length)return d[c[0].identifier]=!0,[c,c];var e,f,g=s(a.changedTouches),h=[],i=this.target;if(f=c.filter(function(a){return o(a.target,i)}),b===Ea)for(e=0;e-1&&d.splice(a,1)};setTimeout(e,cb)}}function U(a){for(var b=a.srcEvent.clientX,c=a.srcEvent.clientY,d=0;d=f&&db>=g)return!0}return!1}function V(a,b){this.manager=a,this.set(b)}function W(a){if(p(a,jb))return jb;var b=p(a,kb),c=p(a,lb);return b&&c?jb:b||c?b?kb:lb:p(a,ib)?ib:hb}function X(){if(!fb)return!1;var b={},c=a.CSS&&a.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(d){b[d]=c?a.CSS.supports("touch-action",d):!0}),b}function Y(a){this.options=la({},this.defaults,a||{}),this.id=v(),this.manager=null,this.options.enable=l(this.options.enable,!0),this.state=nb,this.simultaneous={},this.requireFail=[]}function Z(a){return a&sb?"cancel":a&qb?"end":a&pb?"move":a&ob?"start":""}function $(a){return a==Ma?"down":a==La?"up":a==Ja?"left":a==Ka?"right":""}function _(a,b){var c=b.manager;return c?c.get(a):a}function aa(){Y.apply(this,arguments)}function ba(){aa.apply(this,arguments),this.pX=null,this.pY=null}function ca(){aa.apply(this,arguments)}function da(){Y.apply(this,arguments),this._timer=null,this._input=null}function ea(){aa.apply(this,arguments)}function fa(){aa.apply(this,arguments)}function ga(){Y.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function ha(a,b){return b=b||{},b.recognizers=l(b.recognizers,ha.defaults.preset),new ia(a,b)}function ia(a,b){this.options=la({},ha.defaults,b||{}),this.options.inputTarget=this.options.inputTarget||a,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=a,this.input=y(this),this.touchAction=new V(this,this.options.touchAction),ja(this,!0),g(this.options.recognizers,function(a){var b=this.add(new a[0](a[1]));a[2]&&b.recognizeWith(a[2]),a[3]&&b.requireFailure(a[3])},this)}function ja(a,b){var c=a.element;if(c.style){var d;g(a.options.cssProps,function(e,f){d=u(c.style,f),b?(a.oldCssProps[d]=c.style[d],c.style[d]=e):c.style[d]=a.oldCssProps[d]||""}),b||(a.oldCssProps={})}}function ka(a,c){var d=b.createEvent("Event");d.initEvent(a,!0,!0),d.gesture=c,c.target.dispatchEvent(d)}var la,ma=["","webkit","Moz","MS","ms","o"],na=b.createElement("div"),oa="function",pa=Math.round,qa=Math.abs,ra=Date.now;la="function"!=typeof Object.assign?function(a){if(a===d||null===a)throw new TypeError("Cannot convert undefined or null to object");for(var b=Object(a),c=1;ch&&(b.push(a),h=b.length-1):e&(Ga|Ha)&&(c=!0),0>h||(b[h]=a,this.callback(this.manager,e,{pointers:b,changedPointers:[a],pointerType:f,srcEvent:a}),c&&b.splice(h,1))}});var Za={touchstart:Ea,touchmove:Fa,touchend:Ga,touchcancel:Ha},$a="touchstart",_a="touchstart touchmove touchend touchcancel";i(N,x,{handler:function(a){var b=Za[a.type];if(b===Ea&&(this.started=!0),this.started){var c=O.call(this,a,b);b&(Ga|Ha)&&c[0].length-c[1].length===0&&(this.started=!1),this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:za,srcEvent:a})}}});var ab={touchstart:Ea,touchmove:Fa,touchend:Ga,touchcancel:Ha},bb="touchstart touchmove touchend touchcancel";i(P,x,{handler:function(a){var b=ab[a.type],c=Q.call(this,a,b);c&&this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:za,srcEvent:a})}});var cb=2500,db=25;i(R,x,{handler:function(a,b,c){var d=c.pointerType==za,e=c.pointerType==Ba;if(!(e&&c.sourceCapabilities&&c.sourceCapabilities.firesTouchEvents)){if(d)S.call(this,b,c);else if(e&&U.call(this,c))return;this.callback(a,b,c)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var eb=u(na.style,"touchAction"),fb=eb!==d,gb="compute",hb="auto",ib="manipulation",jb="none",kb="pan-x",lb="pan-y",mb=X();V.prototype={set:function(a){a==gb&&(a=this.compute()),fb&&this.manager.element.style&&mb[a]&&(this.manager.element.style[eb]=a),this.actions=a.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var a=[];return g(this.manager.recognizers,function(b){k(b.options.enable,[b])&&(a=a.concat(b.getTouchAction()))}),W(a.join(" "))},preventDefaults:function(a){var b=a.srcEvent,c=a.offsetDirection;if(this.manager.session.prevented)return void b.preventDefault();var d=this.actions,e=p(d,jb)&&!mb[jb],f=p(d,lb)&&!mb[lb],g=p(d,kb)&&!mb[kb];if(e){var h=1===a.pointers.length,i=a.distance<2,j=a.deltaTime<250;if(h&&i&&j)return}return g&&f?void 0:e||f&&c&Na||g&&c&Oa?this.preventSrc(b):void 0},preventSrc:function(a){this.manager.session.prevented=!0,a.preventDefault()}};var nb=1,ob=2,pb=4,qb=8,rb=qb,sb=16,tb=32;Y.prototype={defaults:{},set:function(a){return la(this.options,a),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(a){if(f(a,"recognizeWith",this))return this;var b=this.simultaneous;return a=_(a,this),b[a.id]||(b[a.id]=a,a.recognizeWith(this)),this},dropRecognizeWith:function(a){return f(a,"dropRecognizeWith",this)?this:(a=_(a,this),delete this.simultaneous[a.id],this)},requireFailure:function(a){if(f(a,"requireFailure",this))return this;var b=this.requireFail;return a=_(a,this),-1===r(b,a)&&(b.push(a),a.requireFailure(this)),this},dropRequireFailure:function(a){if(f(a,"dropRequireFailure",this))return this;a=_(a,this);var b=r(this.requireFail,a);return b>-1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(a){function b(b){c.manager.emit(b,a)}var c=this,d=this.state;qb>d&&b(c.options.event+Z(d)),b(c.options.event),a.additionalEvent&&b(a.additionalEvent),d>=qb&&b(c.options.event+Z(d))},tryEmit:function(a){return this.canEmit()?this.emit(a):void(this.state=tb)},canEmit:function(){for(var a=0;af?Ja:Ka,c=f!=this.pX,d=Math.abs(a.deltaX)):(e=0===g?Ia:0>g?La:Ma,c=g!=this.pY,d=Math.abs(a.deltaY))),a.direction=e,c&&d>b.threshold&&e&b.direction},attrTest:function(a){return aa.prototype.attrTest.call(this,a)&&(this.state&ob||!(this.state&ob)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=$(a.direction);b&&(a.additionalEvent=this.options.event+b),this._super.emit.call(this,a)}}),i(ca,aa,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[jb]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||this.state&ob)},emit:function(a){if(1!==a.scale){var b=a.scale<1?"in":"out";a.additionalEvent=this.options.event+b}this._super.emit.call(this,a)}}),i(da,Y,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[hb]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distanceb.time;if(this._input=a,!d||!c||a.eventType&(Ga|Ha)&&!f)this.reset();else if(a.eventType&Ea)this.reset(),this._timer=e(function(){this.state=rb,this.tryEmit()},b.time,this);else if(a.eventType&Ga)return rb;return tb},reset:function(){clearTimeout(this._timer)},emit:function(a){this.state===rb&&(a&&a.eventType&Ga?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=ra(),this.manager.emit(this.options.event,this._input)))}}),i(ea,aa,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[jb]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||this.state&ob)}}),i(fa,aa,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Na|Oa,pointers:1},getTouchAction:function(){return ba.prototype.getTouchAction.call(this)},attrTest:function(a){var b,c=this.options.direction;return c&(Na|Oa)?b=a.overallVelocity:c&Na?b=a.overallVelocityX:c&Oa&&(b=a.overallVelocityY),this._super.attrTest.call(this,a)&&c&a.offsetDirection&&a.distance>this.options.threshold&&a.maxPointers==this.options.pointers&&qa(b)>this.options.velocity&&a.eventType&Ga},emit:function(a){var b=$(a.offsetDirection);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),i(ga,Y,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ib]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /emulators/emulators.js: -------------------------------------------------------------------------------- 1 | !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]); 2 | //# sourceMappingURL=emulators.js.map 3 | -------------------------------------------------------------------------------- /emulators/wlibzip.js: -------------------------------------------------------------------------------- 1 | var WLIBZIP = (() => { 2 | var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined; 3 | if (typeof __filename != 'undefined') _scriptName = _scriptName || __filename; 4 | return ( 5 | async function(moduleArg = {}) { 6 | var moduleRtn; 7 | 8 | var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;var readyPromise=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject});var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope!="undefined";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";if(ENVIRONMENT_IS_NODE){}var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");scriptDirectory=__dirname+"/";readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(!Module["thisProgram"]&&process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptName){scriptDirectory=_scriptName}if(scriptDirectory.startsWith("blob:")){scriptDirectory=""}else{scriptDirectory=scriptDirectory.slice(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status)};xhr.onerror=reject;xhr.send(null)})}var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];var wasmBinary=Module["wasmBinary"];var wasmMemory;var ABORT=false;var EXITSTATUS;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;var runtimeInitialized=false;var runtimeExited=false;var dataURIPrefix="data:application/octet-stream;base64,";var isDataURI=filename=>filename.startsWith(dataURIPrefix);var isFileURI=filename=>filename.startsWith("file://");function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b)}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.initialized)FS.init();FS.ignorePermissions=false;TTY.init();callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){___funcs_on_exit();callRuntimeCallbacks(__ATEXIT__);FS.quit();TTY.shutdown();runtimeExited=true}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;Module["monitorRunDependencies"]?.(runDependencies)}function removeRunDependency(id){runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(runDependencies==0){if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var wasmBinaryFile;function findWasmBinary(){var f="wlibzip.wasm";if(!isDataURI(f)){return locateFile(f)}return f}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(binaryFile)&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){return{a:wasmImports}}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;wasmMemory=wasmExports["G"];updateMemoryViews();wasmTable=wasmExports["K"];addOnInit(wasmExports["H"]);removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err(`Module.instantiateWasm callback failed with error: ${e}`);readyPromiseReject(e)}}wasmBinaryFile??=findWasmBinary();try{var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}catch(e){readyPromiseReject(e);return Promise.reject(e)}}var tempDouble;var tempI64;function emsc_getMTimeMs(path){var lookup=FS.lookupPath(UTF8ToString(path));return lookup.node.mtime}function emsc_progress(file,extracted,count){if(Module.libzip_progress!==undefined){Module.libzip_progress(UTF8ToString(file),extracted,count)}}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var noExitRuntime=Module["noExitRuntime"]||false;var wasmTable;var getWasmTableEntry=funcPtr=>wasmTable.get(funcPtr);var ___call_sighandler=(fp,sig)=>getWasmTableEntry(fp)(sig);var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.slice(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.slice(0,-1)}return root+dir},basename:path=>path&&path.match(/([^\/]+|\/)\/*$/)[1],join:(...paths)=>PATH.normalize(paths.join("/")),join2:(l,r)=>PATH.normalize(l+"/"+r)};var initRandomFill=()=>{if(ENVIRONMENT_IS_NODE){var nodeCrypto=require("crypto");return view=>nodeCrypto.randomFillSync(view)}return view=>crypto.getRandomValues(view)};var randomFill=view=>{(randomFill=initRandomFill())(view)};var PATH_FS={resolve:(...args)=>{var resolvedPath="",resolvedAbsolute=false;for(var i=args.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?args[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).slice(1);to=PATH_FS.resolve(to).slice(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i{var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx>10,56320|ch&1023)}}return str};var FS_stdin_getChar_buffer=[];var lengthBytesUTF8=str=>{var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx};var intArrayFromString=(stringy,dontAddNull,length)=>{var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array};var FS_stdin_getChar=()=>{if(!FS_stdin_getChar_buffer.length){var result=null;if(ENVIRONMENT_IS_NODE){var BUFSIZE=256;var buf=Buffer.alloc(BUFSIZE);var bytesRead=0;var fd=process.stdin.fd;try{bytesRead=fs.readSync(fd,buf,0,BUFSIZE)}catch(e){if(e.toString().includes("EOF"))bytesRead=0;else throw e}if(bytesRead>0){result=buf.slice(0,bytesRead).toString("utf-8")}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else{}if(!result){return null}FS_stdin_getChar_buffer=intArrayFromString(result,true)}return FS_stdin_getChar_buffer.shift()};var TTY={ttys:[],init(){},shutdown(){},register(dev,ops){TTY.ttys[dev]={input:[],output:[],ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close(stream){stream.tty.ops.fsync(stream.tty)},fsync(stream){stream.tty.ops.fsync(stream.tty)},read(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60)}var bytesRead=0;for(var i=0;i0){out(UTF8ArrayToString(tty.output));tty.output=[]}},ioctl_tcgets(tty){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(tty,optional_actions,data){return 0},ioctl_tiocgwinsz(tty){return[24,80]}},default_tty1_ops:{put_char(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output?.length>0){err(UTF8ArrayToString(tty.output));tty.output=[]}}}};var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var mmapAlloc=size=>{abort()};var MEMFS={ops_table:null,mount(mount){return MEMFS.createNode(null,"/",16895,0)},createNode(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}MEMFS.ops_table||={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}};var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.atime=node.mtime=node.ctime=Date.now();if(parent){parent.contents[name]=node;parent.atime=parent.mtime=parent.ctime=node.atime}return node},getFileDataAsTypedArray(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.atime);attr.mtime=new Date(node.mtime);attr.ctime=new Date(node.ctime);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr(node,attr){for(const key of["mode","atime","mtime","ctime"]){if(attr[key]!=null){node[key]=attr[key]}}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup(parent,name){throw MEMFS.doesNotExistError},mknod(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename(old_node,new_dir,new_name){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){if(FS.isDir(old_node.mode)){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}FS.hashRemoveNode(new_node)}delete old_node.parent.contents[old_node.name];new_dir.contents[new_name]=old_node;old_node.name=new_name;new_dir.ctime=new_dir.mtime=old_node.parent.ctime=old_node.parent.mtime=Date.now()},unlink(parent,name){delete parent.contents[name];parent.ctime=parent.mtime=Date.now()},rmdir(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.ctime=parent.mtime=Date.now()},readdir(node){return[".","..",...Object.keys(node.contents)]},symlink(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{var arrayBuffer=await readAsync(url);return new Uint8Array(arrayBuffer)};var FS_createDataFile=(parent,name,fileData,canRead,canWrite,canOwn)=>{FS.createDataFile(parent,name,fileData,canRead,canWrite,canOwn)};var preloadPlugins=Module["preloadPlugins"]||[];var FS_handledByPreloadPlugin=(byteArray,fullname,finish,onerror)=>{if(typeof Browser!="undefined")Browser.init();var handled=false;preloadPlugins.forEach(plugin=>{if(handled)return;if(plugin["canHandle"](fullname)){plugin["handle"](byteArray,fullname,finish,onerror);handled=true}});return handled};var FS_createPreloadedFile=(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency(`cp ${fullname}`);function processData(byteArray){function finish(byteArray){preFinish?.();if(!dontCreateFile){FS_createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}onload?.();removeRunDependency(dep)}if(FS_handledByPreloadPlugin(byteArray,fullname,finish,()=>{onerror?.();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url).then(processData,onerror)}else{processData(url)}};var FS_modeStringToFlags=str=>{var flagModes={r:0,"r+":2,w:512|64|1,"w+":512|64|2,a:1024|64|1,"a+":1024|64|2};var flags=flagModes[str];if(typeof flags=="undefined"){throw new Error(`Unknown file open mode: ${str}`)}return flags};var FS_getMode=(canRead,canWrite)=>{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:class{name="ErrnoError";constructor(errno){this.errno=errno}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{shared={};get object(){return this.node}set object(val){this.node=val}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(val){this.shared.flags=val}get position(){return this.shared.position}set position(val){this.shared.position=val}},FSNode:class{node_ops={};stream_ops={};readMode=292|73;writeMode=146;mounted=null;constructor(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.rdev=rdev;this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(val){val?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(val){val?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return FS.isDir(this.mode)}get isDevice(){return FS.isChrdev(this.mode)}},lookupPath(path,opts={}){if(!path){throw new FS.ErrnoError(44)}opts.follow_mount??=true;if(!PATH.isAbs(path)){path=FS.cwd()+"/"+path}linkloop:for(var nlinks=0;nlinks<40;nlinks++){var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i>>0)%FS.nameTable.length},hashAddNode(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode(parent,name){var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode(parent,name,mode,rdev){var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode(node){FS.hashRemoveNode(node)},isRoot(node){return node===node.parent},isMountpoint(node){return!!node.mounted},isFile(mode){return(mode&61440)===32768},isDir(mode){return(mode&61440)===16384},isLink(mode){return(mode&61440)===40960},isChrdev(mode){return(mode&61440)===8192},isBlkdev(mode){return(mode&61440)===24576},isFIFO(mode){return(mode&61440)===4096},isSocket(mode){return(mode&49152)===49152},flagsToPermissionString(flag){var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions(node,perms){if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}else if(perms.includes("w")&&!(node.mode&146)){return 2}else if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup(dir){if(!FS.isDir(dir.mode))return 54;var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate(dir,name){if(!FS.isDir(dir.mode)){return 54}try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen(node,flags){if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&(512|64)){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},checkOpExists(op,err){if(!op){throw new FS.ErrnoError(err)}return op},MAX_OPEN_FDS:4096,nextfd(){for(var fd=0;fd<=FS.MAX_OPEN_FDS;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStreamChecked(fd){var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}return stream},getStream:fd=>FS.streams[fd],createStream(stream,fd=-1){stream=Object.assign(new FS.FSStream,stream);if(fd==-1){fd=FS.nextfd()}stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream(fd){FS.streams[fd]=null},dupStream(origStream,fd=-1){var stream=FS.createStream(origStream,fd);stream.stream_ops?.dup?.(stream);return stream},doSetAttr(stream,node,attr){var setattr=stream?.stream_ops.setattr;var arg=setattr?stream:node;setattr??=node.node_ops.setattr;FS.checkOpExists(setattr,63);setattr(arg,attr)},chrdev_stream_ops:{open(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;stream.stream_ops.open?.(stream)},llseek(){throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice(dev,ops){FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push(...m.mounts)}return mounts},syncfs(populate,callback){if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`)}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount(type,opts,mountpoint){var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type,opts,mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(hash=>{var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup(parent,name){return parent.node_ops.lookup(parent,name)},mknod(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name){throw new FS.ErrnoError(28)}if(name==="."||name===".."){throw new FS.ErrnoError(20)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},statfs(path){return FS.statfsNode(FS.lookupPath(path,{follow:true}).node)},statfsStream(stream){return FS.statfsNode(stream.node)},statfsNode(node){var rtn={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:FS.nextInode,ffree:FS.nextInode-1,fsid:42,flags:2,namelen:255};if(node.node_ops.statfs){Object.assign(rtn,node.node_ops.statfs(node.mount.opts.root))}return rtn},create(path,mode=438){mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir(path,mode=511){mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree(path,mode){var dirs=path.split("/");var d="";for(var i=0;iFS.currentPath,chdir(path){var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories(){FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices(){FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length,llseek:()=>0});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var randomBuffer=new Uint8Array(1024),randomLeft=0;var randomByte=()=>{if(randomLeft===0){randomFill(randomBuffer);randomLeft=randomBuffer.byteLength}return randomBuffer[--randomLeft]};FS.createDevice("/dev","random",randomByte);FS.createDevice("/dev","urandom",randomByte);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories(){FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount(){var node=FS.createNode(proc_self,"fd",16895,73);node.stream_ops={llseek:MEMFS.stream_ops.llseek};node.node_ops={lookup(parent,name){var fd=+name;var stream=FS.getStreamChecked(fd);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path},id:fd+1};ret.parent=ret;return ret},readdir(){return Array.from(FS.streams.entries()).filter(([k,v])=>v).map(([k,v])=>k.toString())}};return node}},{},"/proc/self/fd")},createStandardStreams(input,output,error){if(input){FS.createDevice("/dev","stdin",input)}else{FS.symlink("/dev/tty","/dev/stdin")}if(output){FS.createDevice("/dev","stdout",null,output)}else{FS.symlink("/dev/tty","/dev/stdout")}if(error){FS.createDevice("/dev","stderr",null,error)}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},staticInit(){FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={MEMFS}},init(input,output,error){FS.initialized=true;input??=Module["stdin"];output??=Module["stdout"];error??=Module["stderr"];FS.createStandardStreams(input,output,error)},quit(){FS.initialized=false;_fflush(0);for(var i=0;ithis.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]}setDataGetter(getter){this.getter=getter}cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}return intArrayFromString(xhr.responseText||"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true}get length(){if(!this.lengthKnown){this.cacheLength()}return this._length}get chunkSize(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}if(typeof XMLHttpRequest!="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=(...args)=>{FS.forceLoadFile(node);return fn(...args)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,HEAP8,ptr,length,position);return{ptr,allocated:true}};node.stream_ops=stream_ops;return node}};var UTF8ToString=(ptr,maxBytesToRead)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):"";var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return dir+"/"+path},writeStat(buf,stat){HEAP32[buf>>2]=stat.dev;HEAP32[buf+4>>2]=stat.mode;HEAPU32[buf+8>>2]=stat.nlink;HEAP32[buf+12>>2]=stat.uid;HEAP32[buf+16>>2]=stat.gid;HEAP32[buf+20>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+24>>2]=tempI64[0],HEAP32[buf+28>>2]=tempI64[1];HEAP32[buf+32>>2]=4096;HEAP32[buf+36>>2]=stat.blocks;var atime=stat.atime.getTime();var mtime=stat.mtime.getTime();var ctime=stat.ctime.getTime();tempI64=[Math.floor(atime/1e3)>>>0,(tempDouble=Math.floor(atime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAPU32[buf+48>>2]=atime%1e3*1e3*1e3;tempI64=[Math.floor(mtime/1e3)>>>0,(tempDouble=Math.floor(mtime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAPU32[buf+64>>2]=mtime%1e3*1e3*1e3;tempI64=[Math.floor(ctime/1e3)>>>0,(tempDouble=Math.floor(ctime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAPU32[buf+80>>2]=ctime%1e3*1e3*1e3;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];return 0},writeStatFs(buf,stats){HEAP32[buf+4>>2]=stats.bsize;HEAP32[buf+40>>2]=stats.bsize;HEAP32[buf+8>>2]=stats.blocks;HEAP32[buf+12>>2]=stats.bfree;HEAP32[buf+16>>2]=stats.bavail;HEAP32[buf+20>>2]=stats.files;HEAP32[buf+24>>2]=stats.ffree;HEAP32[buf+28>>2]=stats.fsid;HEAP32[buf+44>>2]=stats.flags;HEAP32[buf+36>>2]=stats.namelen},doMsync(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},getStreamFromFD(fd){var stream=FS.getStreamChecked(fd);return stream},varargs:undefined,getStr(ptr){var ret=UTF8ToString(ptr);return ret}};function ___syscall_chmod(path,mode){try{path=SYSCALLS.getStr(path);FS.chmod(path,mode);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var syscallGetVarargI=()=>{var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret};var syscallGetVarargP=syscallGetVarargI;function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=syscallGetVarargI();if(arg<0){return-28}while(FS.streams[arg]){arg++}var newStream;newStream=FS.dupStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=syscallGetVarargI();stream.flags|=arg;return 0}case 12:{var arg=syscallGetVarargP();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 13:case 14:return 0}return-28}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_fstat64(fd,buf){try{return SYSCALLS.writeStat(buf,FS.fstat(fd))}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);function ___syscall_getdents64(fd,dirp,count){try{var stream=SYSCALLS.getStreamFromFD(fd);stream.getdents||=FS.readdir(stream.path);var struct_size=280;var pos=0;var off=FS.llseek(stream,0,1);var startIdx=Math.floor(off/struct_size);var endIdx=Math.min(stream.getdents.length,startIdx+Math.floor(count/struct_size));for(var idx=startIdx;idx>>0,(tempDouble=id,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[dirp+pos>>2]=tempI64[0],HEAP32[dirp+pos+4>>2]=tempI64[1];tempI64=[(idx+1)*struct_size>>>0,(tempDouble=(idx+1)*struct_size,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[dirp+pos+8>>2]=tempI64[0],HEAP32[dirp+pos+12>>2]=tempI64[1];HEAP16[dirp+pos+16>>1]=280;HEAP8[dirp+pos+18]=type;stringToUTF8(name,dirp+pos+19,256);pos+=struct_size}FS.llseek(stream,idx*struct_size,0);return pos}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:{if(!stream.tty)return-59;return 0}case 21505:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcgets){var termios=stream.tty.ops.ioctl_tcgets(stream);var argp=syscallGetVarargP();HEAP32[argp>>2]=termios.c_iflag||0;HEAP32[argp+4>>2]=termios.c_oflag||0;HEAP32[argp+8>>2]=termios.c_cflag||0;HEAP32[argp+12>>2]=termios.c_lflag||0;for(var i=0;i<32;i++){HEAP8[argp+i+17]=termios.c_cc[i]||0}return 0}return 0}case 21510:case 21511:case 21512:{if(!stream.tty)return-59;return 0}case 21506:case 21507:case 21508:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcsets){var argp=syscallGetVarargP();var c_iflag=HEAP32[argp>>2];var c_oflag=HEAP32[argp+4>>2];var c_cflag=HEAP32[argp+8>>2];var c_lflag=HEAP32[argp+12>>2];var c_cc=[];for(var i=0;i<32;i++){c_cc.push(HEAP8[argp+i+17])}return stream.tty.ops.ioctl_tcsets(stream.tty,op,{c_iflag,c_oflag,c_cflag,c_lflag,c_cc})}return 0}case 21519:{if(!stream.tty)return-59;var argp=syscallGetVarargP();HEAP32[argp>>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=syscallGetVarargP();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tiocgwinsz){var winsize=stream.tty.ops.ioctl_tiocgwinsz(stream.tty);var argp=syscallGetVarargP();HEAP16[argp>>1]=winsize[0];HEAP16[argp+2>>1]=winsize[1]}return 0}case 21524:{if(!stream.tty)return-59;return 0}case 21515:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_lstat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.writeStat(buf,FS.lstat(path))}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_mkdirat(dirfd,path,mode){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);FS.mkdir(path,mode,0);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.writeStat(buf,nofollow?FS.lstat(path):FS.stat(path))}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?syscallGetVarargI():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_renameat(olddirfd,oldpath,newdirfd,newpath){try{oldpath=SYSCALLS.getStr(oldpath);newpath=SYSCALLS.getStr(newpath);oldpath=SYSCALLS.calculateAt(olddirfd,oldpath);newpath=SYSCALLS.calculateAt(newdirfd,newpath);FS.rename(oldpath,newpath);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_rmdir(path){try{path=SYSCALLS.getStr(path);FS.rmdir(path);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_stat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.writeStat(buf,FS.stat(path))}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_unlinkat(dirfd,path,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(flags===0){FS.unlink(path)}else if(flags===512){FS.rmdir(path)}else{abort("Invalid flags passed to unlinkat")}return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var __abort_js=()=>abort("");var runtimeKeepaliveCounter=0;var __emscripten_runtime_keepalive_clear=()=>{noExitRuntime=false;runtimeKeepaliveCounter=0};var isLeapYear=year=>year%4===0&&(year%100!==0||year%400===0);var MONTH_DAYS_LEAP_CUMULATIVE=[0,31,60,91,121,152,182,213,244,274,305,335];var MONTH_DAYS_REGULAR_CUMULATIVE=[0,31,59,90,120,151,181,212,243,273,304,334];var ydayFromDate=date=>{var leap=isLeapYear(date.getFullYear());var monthDaysCumulative=leap?MONTH_DAYS_LEAP_CUMULATIVE:MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday};var convertI32PairToI53Checked=(lo,hi)=>hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN;function __localtime_js(time_low,time_high,tmPtr){var time=convertI32PairToI53Checked(time_low,time_high);var date=new Date(time*1e3);HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst}var setTempRet0=val=>__emscripten_tempret_set(val);var __mktime_js=function(tmPtr){var ret=(()=>{var date=new Date(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);var dst=HEAP32[tmPtr+32>>2];var guessedOffset=date.getTimezoneOffset();var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dstOffset=Math.min(winterOffset,summerOffset);if(dst<0){HEAP32[tmPtr+32>>2]=Number(summerOffset!=winterOffset&&dstOffset==guessedOffset)}else if(dst>0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getYear();var timeMs=date.getTime();if(isNaN(timeMs)){return-1}return timeMs/1e3})();return setTempRet0((tempDouble=ret,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)),ret>>>0};var timers={};var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)};var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;if(!keepRuntimeAlive()){exitRuntime()}_proc_exit(status)};var _exit=exitJS;var maybeExit=()=>{if(runtimeExited){return}if(!keepRuntimeAlive()){try{_exit(EXITSTATUS)}catch(e){handleException(e)}}};var callUserCallback=func=>{if(runtimeExited||ABORT){return}try{func();maybeExit()}catch(e){handleException(e)}};var _emscripten_get_now=()=>performance.now();var __setitimer_js=(which,timeout_ms)=>{if(timers[which]){clearTimeout(timers[which].id);delete timers[which]}if(!timeout_ms)return 0;var id=setTimeout(()=>{delete timers[which];callUserCallback(()=>__emscripten_timeout(which,_emscripten_get_now()))},timeout_ms);timers[which]={id,timeout_ms};return 0};var __tzset_js=(timezone,daylight,std_name,dst_name)=>{var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);var extractZone=timezoneOffset=>{var sign=timezoneOffset>=0?"-":"+";var absOffset=Math.abs(timezoneOffset);var hours=String(Math.floor(absOffset/60)).padStart(2,"0");var minutes=String(absOffset%60).padStart(2,"0");return`UTC${sign}${hours}${minutes}`};var winterName=extractZone(winterOffset);var summerName=extractZone(summerOffset);if(summerOffsetDate.now();var runtimeKeepalivePush=()=>{runtimeKeepaliveCounter+=1};var _emscripten_exit_with_live_runtime=()=>{runtimeKeepalivePush();throw"unwind"};var _emscripten_force_exit=status=>{__emscripten_runtime_keepalive_clear();_exit(status)};var getHeapMax=()=>2147483648;var growMemory=size=>{var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doReadv=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){var offset=convertI32PairToI53Checked(offset_low,offset_high);try{if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[newOffset>>2]=tempI64[0],HEAP32[newOffset+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doWritev=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var FS_createPath=FS.createPath;var UTF16Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):undefined;var UTF16ToString=(ptr,maxBytesToRead)=>{var endPtr=ptr;var idx=endPtr>>1;var maxIdx=idx+maxBytesToRead/2;while(!(idx>=maxIdx)&&HEAPU16[idx])++idx;endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder)return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr));var str="";for(var i=0;!(i>=maxBytesToRead/2);++i){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit)}return str};var FS_unlink=path=>FS.unlink(path);var FS_createLazyFile=FS.createLazyFile;var FS_createDevice=FS.createDevice;FS.createPreloadedFile=FS_createPreloadedFile;FS.staticInit();Module["FS_createPath"]=FS.createPath;Module["FS_createPreloadedFile"]=FS.createPreloadedFile;Module["FS_createDataFile"]=FS.createDataFile;Module["FS_createPath"]=FS.createPath;Module["FS_createDataFile"]=FS.createDataFile;Module["FS_createPreloadedFile"]=FS.createPreloadedFile;Module["FS_unlink"]=FS.unlink;Module["FS_createLazyFile"]=FS.createLazyFile;Module["FS_createDevice"]=FS.createDevice;MEMFS.doesNotExistError=new FS.ErrnoError(44);MEMFS.doesNotExistError.stack="";var wasmImports={F:___call_sighandler,E:___syscall_chmod,f:___syscall_fcntl64,D:___syscall_fstat64,C:___syscall_getdents64,B:___syscall_ioctl,A:___syscall_lstat64,z:___syscall_mkdirat,y:___syscall_newfstatat,e:___syscall_openat,x:___syscall_renameat,w:___syscall_rmdir,v:___syscall_stat64,u:___syscall_unlinkat,r:__abort_js,q:__emscripten_runtime_keepalive_clear,h:__localtime_js,g:__mktime_js,p:__setitimer_js,o:__tzset_js,d:emsc_getMTimeMs,n:emsc_progress,m:_emscripten_date_now,l:_emscripten_exit_with_live_runtime,k:_emscripten_force_exit,j:_emscripten_resize_heap,a:_exit,b:_fd_close,t:_fd_read,i:_fd_seek,c:_fd_write,s:_proc_exit};var wasmExports=await createWasm();var ___wasm_call_ctors=wasmExports["H"];var _malloc=Module["_malloc"]=wasmExports["I"];var _free=Module["_free"]=wasmExports["J"];var _get_changes_mtime_ms=Module["_get_changes_mtime_ms"]=wasmExports["L"];var _zip_from_fs=Module["_zip_from_fs"]=wasmExports["M"];var _zip_to_fs=Module["_zip_to_fs"]=wasmExports["N"];var _zipfile_to_fs=Module["_zipfile_to_fs"]=wasmExports["O"];var _libzip_destroy=Module["_libzip_destroy"]=wasmExports["P"];var _zipfile_add=Module["_zipfile_add"]=wasmExports["Q"];var _main=Module["_main"]=wasmExports["R"];var _abort=Module["_abort"]=wasmExports["S"];var ___funcs_on_exit=wasmExports["T"];var _fflush=wasmExports["U"];var __emscripten_timeout=wasmExports["V"];var __emscripten_tempret_set=wasmExports["W"];var __emscripten_stack_alloc=wasmExports["X"];Module["addRunDependency"]=addRunDependency;Module["removeRunDependency"]=removeRunDependency;Module["err"]=err;Module["callMain"]=callMain;Module["UTF8ToString"]=UTF8ToString;Module["stringToUTF8"]=stringToUTF8;Module["lengthBytesUTF8"]=lengthBytesUTF8;Module["UTF16ToString"]=UTF16ToString;Module["FS_createPreloadedFile"]=FS_createPreloadedFile;Module["FS_unlink"]=FS_unlink;Module["FS_createPath"]=FS_createPath;Module["FS_createDevice"]=FS_createDevice;Module["FS"]=FS;Module["FS_createDataFile"]=FS_createDataFile;Module["FS_createLazyFile"]=FS_createLazyFile;function callMain(args=[]){var entryFunction=_main;args.unshift(thisProgram);var argc=args.length;var argv=stackAlloc((argc+1)*4);var argv_ptr=argv;args.forEach(arg=>{HEAPU32[argv_ptr>>2]=stringToUTF8OnStack(arg);argv_ptr+=4});HEAPU32[argv_ptr>>2]=0;try{var ret=entryFunction(argc,argv);exitJS(ret,true);return ret}catch(e){return handleException(e)}}function run(args=arguments_){if(runDependencies>0){dependenciesFulfilled=run;return}preRun();if(runDependencies>0){dependenciesFulfilled=run;return}function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();readyPromiseResolve(Module);Module["onRuntimeInitialized"]?.();var noInitialRun=Module["noInitialRun"]||true;if(!noInitialRun)callMain(args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run();moduleRtn=readyPromise; 9 | 10 | 11 | return moduleRtn; 12 | } 13 | ); 14 | })(); 15 | if (typeof exports === 'object' && typeof module === 'object') { 16 | module.exports = WLIBZIP; 17 | // This default export looks redundant, but it allows TS to import this 18 | // commonjs style module. 19 | module.exports.default = WLIBZIP; 20 | } else if (typeof define === 'function' && define['amd']) 21 | define([], () => WLIBZIP); 22 | --------------------------------------------------------------------------------