(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[0],{

/***/ "../pkg/vtracer_webapp.js":
/*!********************************!*\
  !*** ../pkg/vtracer_webapp.js ***!
  \********************************/
/*! exports provided: main, BinaryImageConverter, ColorImageConverter, __wbindgen_object_drop_ref, __wbindgen_string_new, __wbg_new_59cb74e423758ede, __wbg_stack_558ba5917b466edd, __wbg_error_4bb6c2a97407129a, __wbg_instanceof_Window_adf3196bdc02b386, __wbg_document_6cc8d0b87c0a99b9, __wbg_createElementNS_ea14cb45a87a0719, __wbg_getElementById_0cb6ad9511b1efc0, __wbg_setAttribute_727bdb9763037624, __wbg_prepend_fa995bb42f6e2983, __wbg_debug_d101e002eb92f20b, __wbg_error_cb872335132b1ef7, __wbg_info_a25afde0ff8cd04a, __wbg_log_3bafd82835c6de6d, __wbg_log_64f566ae90a6c43c, __wbg_warn_f632d7d3f55682b6, __wbg_instanceof_CanvasRenderingContext2d_5b86ec94bce38d5b, __wbg_getImageData_888c08c04395524a, __wbg_instanceof_HtmlCanvasElement_4f5b5ec6cd53ccf3, __wbg_width_a22f9855caa54b53, __wbg_height_9a404a6b3c61c7ef, __wbg_getContext_37ca0870acb096d9, __wbg_data_c2cd7a48734589b2, __wbg_call_8e95613cc6524977, __wbindgen_object_clone_ref, __wbg_newnoargs_f3b8a801d5d4b079, __wbg_self_07b2f89e82ceb76d, __wbg_window_ba85d88572adc0dc, __wbg_globalThis_b9277fc37e201fe5, __wbg_global_e16303fe83e1d57f, __wbindgen_is_undefined, __wbindgen_debug_string, __wbindgen_throw */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vtracer_webapp_bg.wasm */ \"../pkg/vtracer_webapp_bg.wasm\");\n/* harmony import */ var _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./vtracer_webapp_bg.js */ \"../pkg/vtracer_webapp_bg.js\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"main\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"main\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"BinaryImageConverter\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"BinaryImageConverter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"ColorImageConverter\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"ColorImageConverter\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_object_drop_ref\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbindgen_object_drop_ref\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_string_new\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbindgen_string_new\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_new_59cb74e423758ede\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_new_59cb74e423758ede\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_stack_558ba5917b466edd\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_stack_558ba5917b466edd\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_error_4bb6c2a97407129a\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_error_4bb6c2a97407129a\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_instanceof_Window_adf3196bdc02b386\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_instanceof_Window_adf3196bdc02b386\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_document_6cc8d0b87c0a99b9\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_document_6cc8d0b87c0a99b9\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_createElementNS_ea14cb45a87a0719\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_createElementNS_ea14cb45a87a0719\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_getElementById_0cb6ad9511b1efc0\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_getElementById_0cb6ad9511b1efc0\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_setAttribute_727bdb9763037624\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_setAttribute_727bdb9763037624\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_prepend_fa995bb42f6e2983\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_prepend_fa995bb42f6e2983\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_debug_d101e002eb92f20b\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_debug_d101e002eb92f20b\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_error_cb872335132b1ef7\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_error_cb872335132b1ef7\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_info_a25afde0ff8cd04a\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_info_a25afde0ff8cd04a\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_log_3bafd82835c6de6d\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_log_3bafd82835c6de6d\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_log_64f566ae90a6c43c\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_log_64f566ae90a6c43c\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_warn_f632d7d3f55682b6\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_warn_f632d7d3f55682b6\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_instanceof_CanvasRenderingContext2d_5b86ec94bce38d5b\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_instanceof_CanvasRenderingContext2d_5b86ec94bce38d5b\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_getImageData_888c08c04395524a\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_getImageData_888c08c04395524a\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_instanceof_HtmlCanvasElement_4f5b5ec6cd53ccf3\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_instanceof_HtmlCanvasElement_4f5b5ec6cd53ccf3\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_width_a22f9855caa54b53\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_width_a22f9855caa54b53\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_height_9a404a6b3c61c7ef\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_height_9a404a6b3c61c7ef\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_getContext_37ca0870acb096d9\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_getContext_37ca0870acb096d9\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_data_c2cd7a48734589b2\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_data_c2cd7a48734589b2\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_call_8e95613cc6524977\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_call_8e95613cc6524977\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_object_clone_ref\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbindgen_object_clone_ref\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_newnoargs_f3b8a801d5d4b079\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_newnoargs_f3b8a801d5d4b079\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_self_07b2f89e82ceb76d\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_self_07b2f89e82ceb76d\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_window_ba85d88572adc0dc\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_window_ba85d88572adc0dc\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_globalThis_b9277fc37e201fe5\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_globalThis_b9277fc37e201fe5\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_global_e16303fe83e1d57f\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_global_e16303fe83e1d57f\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_is_undefined\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbindgen_is_undefined\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_debug_string\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbindgen_debug_string\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_throw\", function() { return _vtracer_webapp_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbindgen_throw\"]; });\n\n\n\n_vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_start\"]();\n\n\n//# sourceURL=webpack:///../pkg/vtracer_webapp.js?");

/***/ }),

/***/ "../pkg/vtracer_webapp_bg.js":
/*!***********************************!*\
  !*** ../pkg/vtracer_webapp_bg.js ***!
  \***********************************/
/*! exports provided: main, BinaryImageConverter, ColorImageConverter, __wbindgen_object_drop_ref, __wbindgen_string_new, __wbg_new_59cb74e423758ede, __wbg_stack_558ba5917b466edd, __wbg_error_4bb6c2a97407129a, __wbg_instanceof_Window_adf3196bdc02b386, __wbg_document_6cc8d0b87c0a99b9, __wbg_createElementNS_ea14cb45a87a0719, __wbg_getElementById_0cb6ad9511b1efc0, __wbg_setAttribute_727bdb9763037624, __wbg_prepend_fa995bb42f6e2983, __wbg_debug_d101e002eb92f20b, __wbg_error_cb872335132b1ef7, __wbg_info_a25afde0ff8cd04a, __wbg_log_3bafd82835c6de6d, __wbg_log_64f566ae90a6c43c, __wbg_warn_f632d7d3f55682b6, __wbg_instanceof_CanvasRenderingContext2d_5b86ec94bce38d5b, __wbg_getImageData_888c08c04395524a, __wbg_instanceof_HtmlCanvasElement_4f5b5ec6cd53ccf3, __wbg_width_a22f9855caa54b53, __wbg_height_9a404a6b3c61c7ef, __wbg_getContext_37ca0870acb096d9, __wbg_data_c2cd7a48734589b2, __wbg_call_8e95613cc6524977, __wbindgen_object_clone_ref, __wbg_newnoargs_f3b8a801d5d4b079, __wbg_self_07b2f89e82ceb76d, __wbg_window_ba85d88572adc0dc, __wbg_globalThis_b9277fc37e201fe5, __wbg_global_e16303fe83e1d57f, __wbindgen_is_undefined, __wbindgen_debug_string, __wbindgen_throw */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(module, global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"main\", function() { return main; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BinaryImageConverter\", function() { return BinaryImageConverter; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ColorImageConverter\", function() { return ColorImageConverter; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_object_drop_ref\", function() { return __wbindgen_object_drop_ref; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_string_new\", function() { return __wbindgen_string_new; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_new_59cb74e423758ede\", function() { return __wbg_new_59cb74e423758ede; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_stack_558ba5917b466edd\", function() { return __wbg_stack_558ba5917b466edd; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_error_4bb6c2a97407129a\", function() { return __wbg_error_4bb6c2a97407129a; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_instanceof_Window_adf3196bdc02b386\", function() { return __wbg_instanceof_Window_adf3196bdc02b386; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_document_6cc8d0b87c0a99b9\", function() { return __wbg_document_6cc8d0b87c0a99b9; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_createElementNS_ea14cb45a87a0719\", function() { return __wbg_createElementNS_ea14cb45a87a0719; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_getElementById_0cb6ad9511b1efc0\", function() { return __wbg_getElementById_0cb6ad9511b1efc0; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_setAttribute_727bdb9763037624\", function() { return __wbg_setAttribute_727bdb9763037624; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_prepend_fa995bb42f6e2983\", function() { return __wbg_prepend_fa995bb42f6e2983; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_debug_d101e002eb92f20b\", function() { return __wbg_debug_d101e002eb92f20b; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_error_cb872335132b1ef7\", function() { return __wbg_error_cb872335132b1ef7; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_info_a25afde0ff8cd04a\", function() { return __wbg_info_a25afde0ff8cd04a; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_log_3bafd82835c6de6d\", function() { return __wbg_log_3bafd82835c6de6d; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_log_64f566ae90a6c43c\", function() { return __wbg_log_64f566ae90a6c43c; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_warn_f632d7d3f55682b6\", function() { return __wbg_warn_f632d7d3f55682b6; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_instanceof_CanvasRenderingContext2d_5b86ec94bce38d5b\", function() { return __wbg_instanceof_CanvasRenderingContext2d_5b86ec94bce38d5b; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_getImageData_888c08c04395524a\", function() { return __wbg_getImageData_888c08c04395524a; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_instanceof_HtmlCanvasElement_4f5b5ec6cd53ccf3\", function() { return __wbg_instanceof_HtmlCanvasElement_4f5b5ec6cd53ccf3; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_width_a22f9855caa54b53\", function() { return __wbg_width_a22f9855caa54b53; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_height_9a404a6b3c61c7ef\", function() { return __wbg_height_9a404a6b3c61c7ef; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_getContext_37ca0870acb096d9\", function() { return __wbg_getContext_37ca0870acb096d9; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_data_c2cd7a48734589b2\", function() { return __wbg_data_c2cd7a48734589b2; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_call_8e95613cc6524977\", function() { return __wbg_call_8e95613cc6524977; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_object_clone_ref\", function() { return __wbindgen_object_clone_ref; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_newnoargs_f3b8a801d5d4b079\", function() { return __wbg_newnoargs_f3b8a801d5d4b079; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_self_07b2f89e82ceb76d\", function() { return __wbg_self_07b2f89e82ceb76d; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_window_ba85d88572adc0dc\", function() { return __wbg_window_ba85d88572adc0dc; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_globalThis_b9277fc37e201fe5\", function() { return __wbg_globalThis_b9277fc37e201fe5; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_global_e16303fe83e1d57f\", function() { return __wbg_global_e16303fe83e1d57f; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_is_undefined\", function() { return __wbindgen_is_undefined; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_debug_string\", function() { return __wbindgen_debug_string; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_throw\", function() { return __wbindgen_throw; });\n/* harmony import */ var _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vtracer_webapp_bg.wasm */ \"../pkg/vtracer_webapp_bg.wasm\");\n\n\nconst heap = new Array(32).fill(undefined);\n\nheap.push(undefined, null, true, false);\n\nfunction getObject(idx) { return heap[idx]; }\n\nlet heap_next = heap.length;\n\nfunction dropObject(idx) {\n    if (idx < 36) return;\n    heap[idx] = heap_next;\n    heap_next = idx;\n}\n\nfunction takeObject(idx) {\n    const ret = getObject(idx);\n    dropObject(idx);\n    return ret;\n}\n\nconst lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;\n\nlet cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n\ncachedTextDecoder.decode();\n\nlet cachegetUint8Memory0 = null;\nfunction getUint8Memory0() {\n    if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"memory\"].buffer) {\n        cachegetUint8Memory0 = new Uint8Array(_vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"memory\"].buffer);\n    }\n    return cachegetUint8Memory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n    return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));\n}\n\nfunction addHeapObject(obj) {\n    if (heap_next === heap.length) heap.push(heap.length + 1);\n    const idx = heap_next;\n    heap_next = heap[idx];\n\n    heap[idx] = obj;\n    return idx;\n}\n\nfunction debugString(val) {\n    // primitive types\n    const type = typeof val;\n    if (type == 'number' || type == 'boolean' || val == null) {\n        return  `${val}`;\n    }\n    if (type == 'string') {\n        return `\"${val}\"`;\n    }\n    if (type == 'symbol') {\n        const description = val.description;\n        if (description == null) {\n            return 'Symbol';\n        } else {\n            return `Symbol(${description})`;\n        }\n    }\n    if (type == 'function') {\n        const name = val.name;\n        if (typeof name == 'string' && name.length > 0) {\n            return `Function(${name})`;\n        } else {\n            return 'Function';\n        }\n    }\n    // objects\n    if (Array.isArray(val)) {\n        const length = val.length;\n        let debug = '[';\n        if (length > 0) {\n            debug += debugString(val[0]);\n        }\n        for(let i = 1; i < length; i++) {\n            debug += ', ' + debugString(val[i]);\n        }\n        debug += ']';\n        return debug;\n    }\n    // Test for built-in\n    const builtInMatches = /\\[object ([^\\]]+)\\]/.exec(toString.call(val));\n    let className;\n    if (builtInMatches.length > 1) {\n        className = builtInMatches[1];\n    } else {\n        // Failed to match the standard '[object ClassName]'\n        return toString.call(val);\n    }\n    if (className == 'Object') {\n        // we're a user defined class or Object\n        // JSON.stringify avoids problems with cycles, and is generally much\n        // easier than looping through ownProperties of `val`.\n        try {\n            return 'Object(' + JSON.stringify(val) + ')';\n        } catch (_) {\n            return 'Object';\n        }\n    }\n    // errors\n    if (val instanceof Error) {\n        return `${val.name}: ${val.message}\\n${val.stack}`;\n    }\n    // TODO we could test for more things here, like `Set`s and `Map`s.\n    return className;\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nconst lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;\n\nlet cachedTextEncoder = new lTextEncoder('utf-8');\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n    ? function (arg, view) {\n    return cachedTextEncoder.encodeInto(arg, view);\n}\n    : function (arg, view) {\n    const buf = cachedTextEncoder.encode(arg);\n    view.set(buf);\n    return {\n        read: arg.length,\n        written: buf.length\n    };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n    if (realloc === undefined) {\n        const buf = cachedTextEncoder.encode(arg);\n        const ptr = malloc(buf.length);\n        getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);\n        WASM_VECTOR_LEN = buf.length;\n        return ptr;\n    }\n\n    let len = arg.length;\n    let ptr = malloc(len);\n\n    const mem = getUint8Memory0();\n\n    let offset = 0;\n\n    for (; offset < len; offset++) {\n        const code = arg.charCodeAt(offset);\n        if (code > 0x7F) break;\n        mem[ptr + offset] = code;\n    }\n\n    if (offset !== len) {\n        if (offset !== 0) {\n            arg = arg.slice(offset);\n        }\n        ptr = realloc(ptr, len, len = offset + arg.length * 3);\n        const view = getUint8Memory0().subarray(ptr + offset, ptr + len);\n        const ret = encodeString(arg, view);\n\n        offset += ret.written;\n    }\n\n    WASM_VECTOR_LEN = offset;\n    return ptr;\n}\n\nlet cachegetInt32Memory0 = null;\nfunction getInt32Memory0() {\n    if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"memory\"].buffer) {\n        cachegetInt32Memory0 = new Int32Array(_vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"memory\"].buffer);\n    }\n    return cachegetInt32Memory0;\n}\n/**\n*/\nfunction main() {\n    _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"main\"]();\n}\n\nfunction isLikeNone(x) {\n    return x === undefined || x === null;\n}\n\nfunction handleError(f) {\n    return function () {\n        try {\n            return f.apply(this, arguments);\n\n        } catch (e) {\n            _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_exn_store\"](addHeapObject(e));\n        }\n    };\n}\n\nfunction passArray8ToWasm0(arg, malloc) {\n    const ptr = malloc(arg.length * 1);\n    getUint8Memory0().set(arg, ptr / 1);\n    WASM_VECTOR_LEN = arg.length;\n    return ptr;\n}\n/**\n*/\nclass BinaryImageConverter {\n\n    static __wrap(ptr) {\n        const obj = Object.create(BinaryImageConverter.prototype);\n        obj.ptr = ptr;\n\n        return obj;\n    }\n\n    free() {\n        const ptr = this.ptr;\n        this.ptr = 0;\n\n        _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"__wbg_binaryimageconverter_free\"](ptr);\n    }\n    /**\n    * @param {string} params\n    * @returns {BinaryImageConverter}\n    */\n    static new_with_string(params) {\n        var ptr0 = passStringToWasm0(params, _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_malloc\"], _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_realloc\"]);\n        var len0 = WASM_VECTOR_LEN;\n        var ret = _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"binaryimageconverter_new_with_string\"](ptr0, len0);\n        return BinaryImageConverter.__wrap(ret);\n    }\n    /**\n    */\n    init() {\n        _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"binaryimageconverter_init\"](this.ptr);\n    }\n    /**\n    * @returns {boolean}\n    */\n    tick() {\n        var ret = _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"binaryimageconverter_tick\"](this.ptr);\n        return ret !== 0;\n    }\n    /**\n    * @returns {number}\n    */\n    progress() {\n        var ret = _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"binaryimageconverter_progress\"](this.ptr);\n        return ret >>> 0;\n    }\n}\n/**\n*/\nclass ColorImageConverter {\n\n    static __wrap(ptr) {\n        const obj = Object.create(ColorImageConverter.prototype);\n        obj.ptr = ptr;\n\n        return obj;\n    }\n\n    free() {\n        const ptr = this.ptr;\n        this.ptr = 0;\n\n        _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"__wbg_colorimageconverter_free\"](ptr);\n    }\n    /**\n    * @param {string} params\n    * @returns {ColorImageConverter}\n    */\n    static new_with_string(params) {\n        var ptr0 = passStringToWasm0(params, _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_malloc\"], _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_realloc\"]);\n        var len0 = WASM_VECTOR_LEN;\n        var ret = _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"colorimageconverter_new_with_string\"](ptr0, len0);\n        return ColorImageConverter.__wrap(ret);\n    }\n    /**\n    */\n    init() {\n        _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"colorimageconverter_init\"](this.ptr);\n    }\n    /**\n    * @returns {boolean}\n    */\n    tick() {\n        var ret = _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"colorimageconverter_tick\"](this.ptr);\n        return ret !== 0;\n    }\n    /**\n    * @returns {number}\n    */\n    progress() {\n        var ret = _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"colorimageconverter_progress\"](this.ptr);\n        return ret;\n    }\n}\n\nconst __wbindgen_object_drop_ref = function(arg0) {\n    takeObject(arg0);\n};\n\nconst __wbindgen_string_new = function(arg0, arg1) {\n    var ret = getStringFromWasm0(arg0, arg1);\n    return addHeapObject(ret);\n};\n\nconst __wbg_new_59cb74e423758ede = function() {\n    var ret = new Error();\n    return addHeapObject(ret);\n};\n\nconst __wbg_stack_558ba5917b466edd = function(arg0, arg1) {\n    var ret = getObject(arg1).stack;\n    var ptr0 = passStringToWasm0(ret, _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_malloc\"], _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_realloc\"]);\n    var len0 = WASM_VECTOR_LEN;\n    getInt32Memory0()[arg0 / 4 + 1] = len0;\n    getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n};\n\nconst __wbg_error_4bb6c2a97407129a = function(arg0, arg1) {\n    try {\n        console.error(getStringFromWasm0(arg0, arg1));\n    } finally {\n        _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_free\"](arg0, arg1);\n    }\n};\n\nconst __wbg_instanceof_Window_adf3196bdc02b386 = function(arg0) {\n    var ret = getObject(arg0) instanceof Window;\n    return ret;\n};\n\nconst __wbg_document_6cc8d0b87c0a99b9 = function(arg0) {\n    var ret = getObject(arg0).document;\n    return isLikeNone(ret) ? 0 : addHeapObject(ret);\n};\n\nconst __wbg_createElementNS_ea14cb45a87a0719 = handleError(function(arg0, arg1, arg2, arg3, arg4) {\n    var ret = getObject(arg0).createElementNS(arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));\n    return addHeapObject(ret);\n});\n\nconst __wbg_getElementById_0cb6ad9511b1efc0 = function(arg0, arg1, arg2) {\n    var ret = getObject(arg0).getElementById(getStringFromWasm0(arg1, arg2));\n    return isLikeNone(ret) ? 0 : addHeapObject(ret);\n};\n\nconst __wbg_setAttribute_727bdb9763037624 = handleError(function(arg0, arg1, arg2, arg3, arg4) {\n    getObject(arg0).setAttribute(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));\n});\n\nconst __wbg_prepend_fa995bb42f6e2983 = handleError(function(arg0, arg1) {\n    getObject(arg0).prepend(getObject(arg1));\n});\n\nconst __wbg_debug_d101e002eb92f20b = function(arg0, arg1, arg2, arg3) {\n    console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));\n};\n\nconst __wbg_error_cb872335132b1ef7 = function(arg0, arg1, arg2, arg3) {\n    console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));\n};\n\nconst __wbg_info_a25afde0ff8cd04a = function(arg0, arg1, arg2, arg3) {\n    console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));\n};\n\nconst __wbg_log_3bafd82835c6de6d = function(arg0) {\n    console.log(getObject(arg0));\n};\n\nconst __wbg_log_64f566ae90a6c43c = function(arg0, arg1, arg2, arg3) {\n    console.log(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));\n};\n\nconst __wbg_warn_f632d7d3f55682b6 = function(arg0, arg1, arg2, arg3) {\n    console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));\n};\n\nconst __wbg_instanceof_CanvasRenderingContext2d_5b86ec94bce38d5b = function(arg0) {\n    var ret = getObject(arg0) instanceof CanvasRenderingContext2D;\n    return ret;\n};\n\nconst __wbg_getImageData_888c08c04395524a = handleError(function(arg0, arg1, arg2, arg3, arg4) {\n    var ret = getObject(arg0).getImageData(arg1, arg2, arg3, arg4);\n    return addHeapObject(ret);\n});\n\nconst __wbg_instanceof_HtmlCanvasElement_4f5b5ec6cd53ccf3 = function(arg0) {\n    var ret = getObject(arg0) instanceof HTMLCanvasElement;\n    return ret;\n};\n\nconst __wbg_width_a22f9855caa54b53 = function(arg0) {\n    var ret = getObject(arg0).width;\n    return ret;\n};\n\nconst __wbg_height_9a404a6b3c61c7ef = function(arg0) {\n    var ret = getObject(arg0).height;\n    return ret;\n};\n\nconst __wbg_getContext_37ca0870acb096d9 = handleError(function(arg0, arg1, arg2) {\n    var ret = getObject(arg0).getContext(getStringFromWasm0(arg1, arg2));\n    return isLikeNone(ret) ? 0 : addHeapObject(ret);\n});\n\nconst __wbg_data_c2cd7a48734589b2 = function(arg0, arg1) {\n    var ret = getObject(arg1).data;\n    var ptr0 = passArray8ToWasm0(ret, _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_malloc\"]);\n    var len0 = WASM_VECTOR_LEN;\n    getInt32Memory0()[arg0 / 4 + 1] = len0;\n    getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n};\n\nconst __wbg_call_8e95613cc6524977 = handleError(function(arg0, arg1) {\n    var ret = getObject(arg0).call(getObject(arg1));\n    return addHeapObject(ret);\n});\n\nconst __wbindgen_object_clone_ref = function(arg0) {\n    var ret = getObject(arg0);\n    return addHeapObject(ret);\n};\n\nconst __wbg_newnoargs_f3b8a801d5d4b079 = function(arg0, arg1) {\n    var ret = new Function(getStringFromWasm0(arg0, arg1));\n    return addHeapObject(ret);\n};\n\nconst __wbg_self_07b2f89e82ceb76d = handleError(function() {\n    var ret = self.self;\n    return addHeapObject(ret);\n});\n\nconst __wbg_window_ba85d88572adc0dc = handleError(function() {\n    var ret = window.window;\n    return addHeapObject(ret);\n});\n\nconst __wbg_globalThis_b9277fc37e201fe5 = handleError(function() {\n    var ret = globalThis.globalThis;\n    return addHeapObject(ret);\n});\n\nconst __wbg_global_e16303fe83e1d57f = handleError(function() {\n    var ret = global.global;\n    return addHeapObject(ret);\n});\n\nconst __wbindgen_is_undefined = function(arg0) {\n    var ret = getObject(arg0) === undefined;\n    return ret;\n};\n\nconst __wbindgen_debug_string = function(arg0, arg1) {\n    var ret = debugString(getObject(arg1));\n    var ptr0 = passStringToWasm0(ret, _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_malloc\"], _vtracer_webapp_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_realloc\"]);\n    var len0 = WASM_VECTOR_LEN;\n    getInt32Memory0()[arg0 / 4 + 1] = len0;\n    getInt32Memory0()[arg0 / 4 + 0] = ptr0;\n};\n\nconst __wbindgen_throw = function(arg0, arg1) {\n    throw new Error(getStringFromWasm0(arg0, arg1));\n};\n\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../app/node_modules/webpack/buildin/harmony-module.js */ \"./node_modules/webpack/buildin/harmony-module.js\")(module), __webpack_require__(/*! ./../app/node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///../pkg/vtracer_webapp_bg.js?");

/***/ }),

/***/ "../pkg/vtracer_webapp_bg.wasm":
/*!*************************************!*\
  !*** ../pkg/vtracer_webapp_bg.wasm ***!
  \*************************************/
/*! exports provided: memory, main, __wbg_colorimageconverter_free, colorimageconverter_new_with_string, colorimageconverter_init, colorimageconverter_tick, colorimageconverter_progress, __wbg_binaryimageconverter_free, binaryimageconverter_new_with_string, binaryimageconverter_init, binaryimageconverter_tick, binaryimageconverter_progress, __wbindgen_malloc, __wbindgen_realloc, __wbindgen_free, __wbindgen_exn_store, __wbindgen_start */
/***/ (function(module, exports, __webpack_require__) {

eval("\"use strict\";\n// Instantiate WebAssembly module\nvar wasmExports = __webpack_require__.w[module.i];\n__webpack_require__.r(exports);\n// export exports from WebAssembly module\nfor(var name in wasmExports) if(name != \"__webpack_init__\") exports[name] = wasmExports[name];\n// exec imports from WebAssembly module (for esm order)\n/* harmony import */ var m0 = __webpack_require__(/*! ./vtracer_webapp_bg.js */ \"../pkg/vtracer_webapp_bg.js\");\n\n\n// exec wasm module\nwasmExports[\"__webpack_init__\"]()\n\n//# sourceURL=webpack:///../pkg/vtracer_webapp_bg.wasm?");

/***/ }),

/***/ "./index.js":
/*!******************!*\
  !*** ./index.js ***!
  \******************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vtracer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vtracer */ \"../pkg/vtracer_webapp.js\");\n\n\nlet runner;\nconst canvas = document.getElementById('frame');\nconst ctx = canvas.getContext('2d');\nconst svg = document.getElementById('svg');\nconst img = new Image();\nconst progress = document.getElementById('progressbar');\nconst progressregion = document.getElementById('progressregion');\nlet mode = 'spline', clustering_mode = 'color', clustering_hierarchical = 'stacked';\n\n// Hide canas and svg on load\ncanvas.style.display = 'none';\nsvg.style.display = 'none';\n\n// Paste from clipboard\ndocument.addEventListener('paste', function (e) {\n    if (e.clipboardData) {\n        var items = e.clipboardData.items;\n        if (!items) return;\n\n        //access data directly\n        for (var i = 0; i < items.length; i++) {\n            if (items[i].type.indexOf(\"image\") !== -1) {\n                //image\n                var blob = items[i].getAsFile();\n                var URLObj = window.URL || window.webkitURL;\n                var source = URLObj.createObjectURL(blob);\n                setSourceAndRestart(source);\n            }\n        }\n        e.preventDefault();\n    }\n});\n\n// Download as SVG\ndocument.getElementById('export').addEventListener('click', function (e) {\n    const blob = new Blob([new XMLSerializer().serializeToString(svg)], {type: 'octet/stream'}),\n    url = window.URL.createObjectURL(blob);\n\n    this.href = url;\n    this.target = '_blank';\n\n    this.download = 'export-' + new Date().toISOString().slice(0, 19).replace(/:/g, '').replace('T', ' ') + '.svg';\n});\n\n// Store template config\nvar presetConfigs = [\n    {\n        src: 'assets/samples/K1_drawing.jpg',\n        clustering_mode: 'binary',\n        clustering_hierarchical: 'stacked',\n        filter_speckle: 4,\n        color_precision: 6,\n        path_precision: 8,\n        layer_difference: 16,\n        mode: 'spline',\n        corner_threshold: 60,\n        length_threshold: 4,\n        splice_threshold: 45,\n        source: 'https://commons.wikimedia.org/wiki/File:K1_drawing.jpg',\n        credit: '<a href=\"https://commons.wikimedia.org/\">Wikimedia</a>',\n    },\n    {\n        src: 'assets/samples/Cityscape Sunset_DFM3-01.jpg',\n        clustering_mode: 'color',\n        clustering_hierarchical: 'stacked',\n        filter_speckle: 4,\n        color_precision: 8,\n        path_precision: 8,\n        layer_difference: 25,\n        mode: 'spline',\n        corner_threshold: 60,\n        length_threshold: 4,\n        splice_threshold: 45,\n        source: 'https://www.vecteezy.com/vector-art/227400-beautiful-cityscape-at-sunset',\n        credit: '<a href=\"https://www.vecteezy.com/free-vector/building\">Building Vectors by Vecteezy</a>',\n    },\n    {\n        src: 'assets/samples/Gum Tree Vector.jpg',\n        clustering_mode: 'color',\n        clustering_hierarchical: 'stacked',\n        filter_speckle: 4,\n        color_precision: 8,\n        path_precision: 8,\n        layer_difference: 28,\n        mode: 'spline',\n        corner_threshold: 60,\n        length_threshold: 4,\n        splice_threshold: 45,\n        source: 'https://www.vecteezy.com/vector-art/172177-gum-tree-vector',\n        credit: '<a href=\"https://www.vecteezy.com/free-vector/nature\">Nature Vectors by Vecteezy</a>',\n    },\n    {\n        src: 'assets/samples/vectorstock_31191940.png',\n        clustering_mode: 'color',\n        clustering_hierarchical: 'stacked',\n        filter_speckle: 8,\n        color_precision: 7,\n        path_precision: 8,\n        layer_difference: 64,\n        mode: 'spline',\n        corner_threshold: 60,\n        length_threshold: 4,\n        splice_threshold: 45,\n        source: 'https://www.vectorstock.com/royalty-free-vector/dessert-poster-design-with-chocolate-cake-mousses-vector-31191940',\n        credit: '<a href=\"https://www.vectorstock.com/royalty-free-vector/dessert-poster-design-with-chocolate-cake-mousses-vector-31191940\">Vector image by VectorStock / vectorstock</a>',\n    },\n    {\n        src: 'assets/samples/angel-luciano-LATYeZyw88c-unsplash-s.jpg',\n        clustering_mode: 'color',\n        clustering_hierarchical: 'stacked',\n        filter_speckle: 10,\n        color_precision: 8,\n        path_precision: 8,\n        layer_difference: 48,\n        mode: 'spline',\n        corner_threshold: 180,\n        length_threshold: 4,\n        splice_threshold: 45,\n        source: 'https://unsplash.com/photos/LATYeZyw88c',\n        credit: '<span>Photo by <a href=\"https://unsplash.com/@roaming_angel?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\">Angel Luciano</a> on <a href=\"https://unsplash.com/s/photos/dog?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\">Unsplash</a></span>',\n    },\n    {\n        src: 'assets/samples/tank-unit-preview.png',\n        clustering_mode: 'color',\n        clustering_hierarchical: 'stacked',\n        filter_speckle: 0,\n        color_precision: 8,\n        path_precision: 8,\n        layer_difference: 0,\n        mode: 'none',\n        corner_threshold: 180,\n        length_threshold: 4,\n        splice_threshold: 45,\n        source: 'https://opengameart.org/content/sideview-sci-fi-patreon-collection',\n        credit: '<span>Artwork by <a href=\"https://opengameart.org/content/sideview-sci-fi-patreon-collection\">Luis Zuno</a> on <a href=\"https://opengameart.org/\">opengameart.org</a></span>',\n    },\n];\n\n// Insert gallery items dynamically\nif (document.getElementById('galleryslider')) {\n    for (let i = 0; i < presetConfigs.length; i++) {\n        document.getElementById('galleryslider').innerHTML += \n        `<li>\n        <div class=\"galleryitem uk-panel uk-flex uk-flex-center\">\n            <a href=\"#\">\n                <img src=\"${presetConfigs[i].src}\" title=\"${presetConfigs[i].source}\">\n            </a>\n        </div>\n        </li>`;\n        document.getElementById('credits-modal-content').innerHTML += \n        `<p>${presetConfigs[i].credit}</p>`;\n    }\n}\n\n// Function to load a given config WITHOUT restarting\nfunction loadConfig(config) {\n    mode = config.mode;\n    clustering_mode = config.clustering_mode;\n    clustering_hierarchical = config.clustering_hierarchical;\n\n    globalcorner = config.corner_threshold;\n    document.getElementById('cornervalue').innerHTML = globalcorner;\n    document.getElementById('corner').value = globalcorner;\n    \n    globallength = config.length_threshold;\n    document.getElementById('lengthvalue').innerHTML = globallength;\n    document.getElementById('length').value = globallength;\n    \n    globalsplice = config.splice_threshold;\n    document.getElementById('splicevalue').innerHTML = globalsplice;\n    document.getElementById('splice').value = globalsplice;\n\n    globalfilterspeckle = config.filter_speckle;\n    document.getElementById('filterspecklevalue').innerHTML = globalfilterspeckle;\n    document.getElementById('filterspeckle').value = globalfilterspeckle;\n\n    globalcolorprecision = config.color_precision;\n    document.getElementById('colorprecisionvalue').innerHTML = globalcolorprecision;\n    document.getElementById('colorprecision').value = globalcolorprecision;\n\n    globallayerdifference = config.layer_difference;\n    document.getElementById('layerdifferencevalue').innerHTML = globallayerdifference;\n    document.getElementById('layerdifference').value = globallayerdifference;\n\n    globalpathprecision = config.path_precision;\n    document.getElementById('pathprecisionvalue').innerHTML = globalpathprecision;\n    document.getElementById('pathprecision').value = globalpathprecision;\n}\n\n// Choose template from gallery\nlet chooseGalleryButtons = document.querySelectorAll('.galleryitem a');\nchooseGalleryButtons.forEach(item => {\n    item.addEventListener('click', function (e) {\n        // Load preset template config\n        let i = Array.prototype.indexOf.call(chooseGalleryButtons, item);\n        if (presetConfigs.length > i) {\n            loadConfig(presetConfigs[i]);\n        }\n\n        // Set source as specified\n        setSourceAndRestart(this.firstElementChild.src);\n    });\n});\n\n// Upload button\nvar imageSelect = document.getElementById('imageSelect'),\nimageInput = document.getElementById('imageInput');  \nimageSelect.addEventListener('click', function (e) {\n    imageInput.click();\n    e.preventDefault();\n});\n\nimageInput.addEventListener('change', function (e) {\n    setSourceAndRestart(this.files[0]);\n});\n\n// Drag-n-Drop\nvar drop = document.getElementById('drop');\nvar droptext = document.getElementById('droptext');\ndrop.addEventListener('dragenter', function (e) {\n    if (e.preventDefault) e.preventDefault();\n    e.dataTransfer.dropEffect = 'copy';\n    droptext.classList.add('hovering');\n    return false;\n});\n\ndrop.addEventListener('dragleave', function (e) {\n    if (e.preventDefault) e.preventDefault();\n    e.dataTransfer.dropEffect = 'copy';\n    droptext.classList.remove('hovering');\n    return false;\n});\n\ndrop.addEventListener('dragover', function (e) {\n    if (e.preventDefault) e.preventDefault();\n    e.dataTransfer.dropEffect = 'copy';\n    droptext.classList.add('hovering');\n    return false;\n});\n\ndrop.addEventListener('drop', function (e) {\n    if (e.preventDefault) e.preventDefault();\n    droptext.classList.remove('hovering');\n    setSourceAndRestart(e.dataTransfer.files[0]);\n    return false;\n});\n\n// Get Input from UI controls\nvar globalcorner = parseInt(document.getElementById('corner').value),\n    globallength = parseFloat(document.getElementById('length').value),\n    globalsplice = parseInt(document.getElementById('splice').value),\n    globalfilterspeckle = parseInt(document.getElementById('filterspeckle').value),\n    globalcolorprecision = parseInt(document.getElementById('colorprecision').value),\n    globallayerdifference = parseInt(document.getElementById('layerdifference').value),\n    globalpathprecision = parseInt(document.getElementById('pathprecision').value);\n\n// Load past inputs from localStorage\n/*\nif (localStorage.VSsettings) {\n    var settings = JSON.parse(localStorage.VSsettings);\n    document.getElementById('cornervalue').innerHTML = document.getElementById('corner').value = globalcorner = settings.globalcorner;\n    document.getElementById('lengthvalue').innerHTML = document.getElementById('length').value = globallength = settings.globallength;\n    document.getElementById('splicevalue').innerHTML = document.getElementById('splice').value = globalsplice = settings.globalsplice;\n}\n*/\n\ndocument.getElementById('none').addEventListener('click', function (e) {\n    mode = 'none';\n    restart();\n}, false);\n\ndocument.getElementById('polygon').addEventListener('click', function (e) {\n    mode = 'polygon';\n    restart();\n}, false);\n\ndocument.getElementById('spline').addEventListener('click', function (e) {\n    mode = 'spline';\n    restart();\n}, false);\n\ndocument.getElementById('clustering-binary').addEventListener('click', function (e) {\n    clustering_mode = 'binary';\n    restart();\n}, false);\n\ndocument.getElementById('clustering-color').addEventListener('click', function (e) {\n    clustering_mode = 'color';\n    restart();\n}, false);\n\ndocument.getElementById('clustering-cutout').addEventListener('click', function (e) {\n    clustering_hierarchical = 'cutout';\n    restart();\n}, false);\n\ndocument.getElementById('clustering-stacked').addEventListener('click', function (e) {\n    clustering_hierarchical = 'stacked';\n    restart();\n}, false);\n\ndocument.getElementById('filterspeckle').addEventListener('change', function (e) {\n    globalfilterspeckle = parseInt(this.value);\n    document.getElementById('filterspecklevalue').innerHTML = this.value;\n    restart();\n});\n\ndocument.getElementById('colorprecision').addEventListener('change', function (e) {\n    globalcolorprecision = parseInt(this.value);\n    document.getElementById('colorprecisionvalue').innerHTML = this.value;\n    restart();\n});\n\ndocument.getElementById('layerdifference').addEventListener('change', function (e) {\n    globallayerdifference = parseInt(this.value);\n    document.getElementById('layerdifferencevalue').innerHTML = this.value;\n    restart();\n});\n\ndocument.getElementById('corner').addEventListener('change', function (e) {\n    globalcorner = parseInt(this.value);\n    document.getElementById('cornervalue').innerHTML = this.value;\n    restart();\n});\n\ndocument.getElementById('length').addEventListener('change', function (e) {\n    globallength = parseFloat(this.value);\n    document.getElementById('lengthvalue').innerHTML = this.value;\n    restart();\n});\n\ndocument.getElementById('splice').addEventListener('change', function (e) {\n    globalsplice = parseInt(this.value);\n    document.getElementById('splicevalue').innerHTML = this.value;\n    restart();\n});\n\ndocument.getElementById('pathprecision').addEventListener('change', function (e) {\n    globalpathprecision = parseInt(this.value);\n    document.getElementById('pathprecisionvalue').innerHTML = this.value;\n    restart();\n});\n\n// Save inputs before unloading\n/*\nwindow.addEventListener('beforeunload', function () {\n    localStorage.VSsettings = JSON.stringify({\n        globalcorner: globalcorner,\n        globallength: globallength,\n        globalsplice: globalsplice,\n    });\n});\n*/\n\nfunction setSourceAndRestart(source) {\n    img.src = source instanceof File ? URL.createObjectURL(source) : source;\n    img.onload = function () {\n        const width = img.naturalWidth, height = img.naturalHeight;\n        svg.setAttribute('viewBox', `0 0 ${width} ${height}`);\n        canvas.width = img.naturalWidth;\n        canvas.height = img.naturalHeight;\n        if (height > width) {\n            document.getElementById('canvas-container').style.width = '50%';\n            document.getElementById('canvas-container').style.marginBottom = (height / width * 50) + '%';\n        } else {\n            document.getElementById('canvas-container').style.width = '';\n            document.getElementById('canvas-container').style.marginBottom = (height / width * 100) + '%';\n        }\n        ctx.drawImage(img, 0, 0, canvas.width, canvas.height);\n        ctx.getImageData(0, 0, canvas.width, canvas.height);\n        restart();\n    }\n    // Show display\n    canvas.style.display = 'block';\n    svg.style.display = 'block';\n    // Hide upload text\n    droptext.style.display = 'none';\n}\n\nfunction restart() {\n    document.getElementById('clustering-binary').classList.remove('selected');\n    document.getElementById('clustering-color').classList.remove('selected');\n    document.getElementById('clustering-' + clustering_mode).classList.add('selected');\n    Array.from(document.getElementsByClassName('clustering-color-options')).forEach((el) => {\n        el.style.display = clustering_mode == 'color' ? '' : 'none';\n    });\n\n    document.getElementById('clustering-cutout').classList.remove('selected');\n    document.getElementById('clustering-stacked').classList.remove('selected');\n    document.getElementById('clustering-' + clustering_hierarchical).classList.add('selected');\n\n    document.getElementById('none').classList.remove('selected');\n    document.getElementById('polygon').classList.remove('selected');\n    document.getElementById('spline').classList.remove('selected');\n    document.getElementById(mode).classList.add('selected');\n    Array.from(document.getElementsByClassName('spline-options')).forEach((el) => {\n        el.style.display = mode == 'spline' ? '' : 'none';\n    });\n\n    if (!img.src) {\n        return;\n    }\n    while (svg.firstChild) {\n        svg.removeChild(svg.firstChild);\n    }\n    ctx.clearRect(0, 0, canvas.width, canvas.height);\n    ctx.drawImage(img, 0, 0);\n    let converter_params = JSON.stringify({\n        'canvas_id': canvas.id,\n        'svg_id': svg.id,\n        'mode': mode,\n        'clustering_mode': clustering_mode,\n        'hierarchical': clustering_hierarchical,\n        'corner_threshold': deg2rad(globalcorner),\n        'length_threshold': globallength,\n        'max_iterations': 10,\n        'splice_threshold': deg2rad(globalsplice),\n        'filter_speckle': globalfilterspeckle*globalfilterspeckle,\n        'color_precision': 8-globalcolorprecision,\n        'layer_difference': globallayerdifference,\n        'path_precision': globalpathprecision,\n    });\n    if (runner) {\n        runner.stop();\n    }\n    runner = new ConverterRunner(converter_params);\n    progress.value = 0;\n    progressregion.style.display = 'block';\n    runner.run();\n}\n\nfunction deg2rad(deg) {\n    return deg/180*3.141592654;\n}\n\nclass ConverterRunner {\n    constructor (converter_params) {\n        this.converter =\n            clustering_mode == 'color' ?\n                vtracer__WEBPACK_IMPORTED_MODULE_0__[\"ColorImageConverter\"].new_with_string(converter_params):\n                vtracer__WEBPACK_IMPORTED_MODULE_0__[\"BinaryImageConverter\"].new_with_string(converter_params);\n        this.converter.init();\n        this.stopped = false;\n        if (clustering_mode == 'binary') {\n            svg.style.background = '#000';\n            canvas.style.display = 'none';\n        } else {\n            svg.style.background = '';\n            canvas.style.display = '';\n        }\n        canvas.style.opacity = '';\n    }\n\n    run () {\n        const This = this;\n        setTimeout(function tick () {\n            if (!This.stopped) {\n                let done = false;\n                const startTick = performance.now();\n                while (!(done = This.converter.tick()) &&\n                    performance.now() - startTick < 25) {\n                }\n                progress.value = This.converter.progress();\n                if (progress.value >= 50) {\n                    canvas.style.display = 'none';\n                } else {\n                    canvas.style.opacity = (50 - progress.value) / 25;\n                }\n                if (progress.value >= progress.max) {\n                    progressregion.style.display = 'none';\n                    progress.value = 0;\n                }\n                if (!done) {\n                    setTimeout(tick, 1);\n                }\n            }\n        }, 1);\n    }\n\n    stop () {\n        this.stopped = true;\n        this.converter.free();\n    }\n}\n\n//# sourceURL=webpack:///./index.js?");

/***/ }),

/***/ "./node_modules/webpack/buildin/global.js":
/*!***********************************!*\
  !*** (webpack)/buildin/global.js ***!
  \***********************************/
/*! no static exports found */
/***/ (function(module, exports) {

eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n\n\n//# sourceURL=webpack:///(webpack)/buildin/global.js?");

/***/ }),

/***/ "./node_modules/webpack/buildin/harmony-module.js":
/*!*******************************************!*\
  !*** (webpack)/buildin/harmony-module.js ***!
  \*******************************************/
/*! no static exports found */
/***/ (function(module, exports) {

eval("module.exports = function(originalModule) {\n\tif (!originalModule.webpackPolyfill) {\n\t\tvar module = Object.create(originalModule);\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"exports\", {\n\t\t\tenumerable: true\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n\n\n//# sourceURL=webpack:///(webpack)/buildin/harmony-module.js?");

/***/ })

}]);