@easyeyes_threshold/runtime 1.20261029.41002 → 1.20261029.53194
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/errors/easyeyes-error-table.tsv +28 -0
- package/js/easyeyes_wasm.min.js.map +1 -1
- package/js/first.min.js +1 -1
- package/js/first.min.js.map +1 -1
- package/js/index.js +2 -7
- package/js/index.min.js.map +1 -1
- package/js/runtime.js +2 -0
- package/js/runtime.min.js.map +1 -0
- package/js/threshold.css +1 -1
- package/js/threshold.min.js +46 -37
- package/js/threshold.min.js.map +1 -1
- package/package.json +8 -5
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name explanation
|
|
2
|
+
fullscreenExit The participant left full-screen mode (e.g. pressed ESC) and chose Quit in the pause overlay. A voluntary quit. An optional (rc:<trigger>) suffix names the RemoteCalibrator quit hook that opened the overlay, when the quit came from RC rather than the participant. A trailing parenthetical, e.g. (block 3/31, trial 12/40), shows how far the participant got.
|
|
3
|
+
escapeKey The participant pressed the Escape key and chose Quit from the Skip Trial / Skip Block / Quit dialog.
|
|
4
|
+
participant:tabClosed The participant closed or reloaded the browser tab while the experiment was running. The rest of the cell says where it ended (e.g. participant:tabClosed:trialRoutineEachFrame) and how far they got. A later attempt to re-open the study appears as a separate session file.
|
|
5
|
+
consentDeclined The participant answered No to the consent question, so the experiment ended before any data collection.
|
|
6
|
+
compatibilityNotMet [renamed to "incompatible" 2026-09-28] Historical code (already-collected results files): the participant's device failed one or more of this study's compatibility requirements (screen size, memory, operating system, browser, sound output, …). The unmetNeeds column lists the failed requirements (e.g. _needMemoryGB).
|
|
7
|
+
incompatible The participant's device failed one or more of this study's compatibility requirements (screen size, memory, operating system, browser, sound output, …), or a requirement step could not be completed (e.g. rc:noCameraDetected). The unmetNeeds column lists the failed requirements (e.g. _needMemoryGB).
|
|
8
|
+
rc:cameraReconnectPopup:quit The webcam feed was lost during the experiment and EasyEyes offered to reconnect; after the failed attempts shown in the cell, the participant clicked Quit. The parenthetical gives the camera status, camera name, attempts, and minutes since start.
|
|
9
|
+
rc:chooseScreenQuit:quit During setup of camera-based distance tracking, the participant was asked to choose which screen to share, and clicked Quit instead.
|
|
10
|
+
rc:selectCameraFailed During the Device Compatibility camera step, selecting or starting a webcam failed, so the study could not continue.
|
|
11
|
+
rc:noCameraDetected The Device Compatibility camera step ended with no usable camera: either no camera was found, or every camera found was excluded by this study's camera policy (by default external webcams are hidden — _calibrateDistanceAllowExternalCameraBool). The participant ended the study at the no-camera page. The cameraName/class/cameraArray columns list every camera seen and how it was classified, so "no camera" can be told apart from "only external cameras".
|
|
12
|
+
rc: A quit initiated by RemoteCalibrator, EasyEyes' camera and distance-tracking library. The text after rc: names the trigger (e.g. rc:cameraReconnectPopup:quit); see the matching rc: row.
|
|
13
|
+
_crash An unexpected programming error ended the session. The label says where it happened: _crash:function:error type:top stack frame. The session's previous row holds the full technical report (message and stack trace) — please send the results file to the EasyEyes team. The participant saw an error dialog and could not continue.
|
|
14
|
+
emailSendFailed The experiment could not send the verification email, so sign-up could not continue. A technical problem on the study's side.
|
|
15
|
+
emailVerificationCancelled The participant closed or cancelled the email-verification step before finishing it.
|
|
16
|
+
emailVerificationFailed The participant entered a wrong verification code too many times, so the session ended.
|
|
17
|
+
calibrationObjectUnavailable The distance check asks the participant to hold up a ruler (or similar measuring object); this participant reported having none, so the session ended.
|
|
18
|
+
soundCalibrationFailed Sound calibration (measuring the loudspeaker's level) did not pass within the allowed attempts, so the study could not guarantee its sound level.
|
|
19
|
+
soundCalibrationAborted The participant clicked Abort while entering their calibrated (USB) microphone's details, so the study could not continue.
|
|
20
|
+
microphonePermissionDenied The participant's browser blocked access to the microphone, which this study requires.
|
|
21
|
+
soundOutputDisconnected The required sound output device was disconnected during the experiment, and the participant clicked Quit in the reconnect dialog.
|
|
22
|
+
noSmartphone The study needs a smartphone as a second device (e.g. for the loudspeaker survey); the participant reported having none.
|
|
23
|
+
peerConnectCancelled The participant could not connect their smartphone during pairing and chose Quit on the can't-connect prompt.
|
|
24
|
+
peerConnectDeclined Asked to pair their smartphone, the participant preferred not to and chose Quit.
|
|
25
|
+
peerConnectNoSmartphone Smartphone pairing ended because the participant reported having no smartphone.
|
|
26
|
+
remoteCalibratorQuit Historical label, now rc:cameraReconnectPopup:quit: the participant clicked Quit in the webcam-reconnect popup.
|
|
27
|
+
soundOutput:selectionQuit The participant clicked Quit while choosing the required sound-output device (headphones or loudspeakers) on the Requirements page. The session ended there, before any trials — a voluntary exit from the device-selection step, not a failed device requirement.
|
|
28
|
+
compatibility:unclassifiedRejection The device-compatibility flow rejected this session without recording a specific failure or an unmet device requirement — a gap in EasyEyes failure accounting, not a participant action. Please forward this session to the EasyEyes team so the missing cause can be labeled.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"easyeyes_wasm.js","sources":["../@rust/pkg/easyeyes_wasm.js"],"sourcesContent":["let wasm;\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (\n cachedUint8ArrayMemory0 === null ||\n cachedUint8ArrayMemory0.byteLength === 0\n ) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nlet cachedTextDecoder = new TextDecoder(\"utf-8\", {\n ignoreBOM: true,\n fatal: true,\n});\n\ncachedTextDecoder.decode();\n\nconst MAX_SAFARI_DECODE_BYTES = 2146435072;\nlet numBytesDecoded = 0;\nfunction decodeText(ptr, len) {\n numBytesDecoded += len;\n if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {\n cachedTextDecoder = new TextDecoder(\"utf-8\", {\n ignoreBOM: true,\n fatal: true,\n });\n cachedTextDecoder.decode();\n numBytesDecoded = len;\n }\n return cachedTextDecoder.decode(\n getUint8ArrayMemory0().subarray(ptr, ptr + len),\n );\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return decodeText(ptr, len);\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nfunction passArray8ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 1, 1) >>> 0;\n getUint8ArrayMemory0().set(arg, ptr / 1);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nfunction takeFromExternrefTable0(idx) {\n const value = wasm.__wbindgen_externrefs.get(idx);\n wasm.__externref_table_dealloc(idx);\n return value;\n}\n/**\n * Get variable font axes information as JSON.\n * Returns JSON with isVariable flag and axis details (tag, min, max, default).\n * Used by the compiler to validate fontVariableSettings at compile time.\n * @param {Uint8Array} font_data\n * @returns {string}\n */\nexport function get_font_variable_axes(font_data) {\n let deferred3_0;\n let deferred3_1;\n try {\n const ptr0 = passArray8ToWasm0(font_data, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.get_font_variable_axes(ptr0, len0);\n var ptr2 = ret[0];\n var len2 = ret[1];\n if (ret[3]) {\n ptr2 = 0;\n len2 = 0;\n throw takeFromExternrefTable0(ret[2]);\n }\n deferred3_0 = ptr2;\n deferred3_1 = len2;\n return getStringFromWasm0(ptr2, len2);\n } finally {\n wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);\n }\n}\n\nconst cachedTextEncoder = new TextEncoder();\n\nif (!(\"encodeInto\" in cachedTextEncoder)) {\n cachedTextEncoder.encodeInto = 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}\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0()\n .subarray(ptr, ptr + buf.length)\n .set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\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), 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = cachedTextEncoder.encodeInto(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nfunction getArrayU8FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n/**\n * Apply OpenType feature settings by injecting each enabled feature's GSUB\n * lookups into the calt feature. The Canvas 2D API has no font-feature-settings,\n * so this \"bakes\" the features into the font binary. Tags are validated up front\n * by the compiler. Disabling (value 0) clears the feature's lookup indices.\n * @param {Uint8Array} font_data\n * @param {string} feature_settings\n * @returns {Uint8Array}\n */\nexport function apply_feature_settings(font_data, feature_settings) {\n const ptr0 = passArray8ToWasm0(font_data, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(\n feature_settings,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc,\n );\n const len1 = WASM_VECTOR_LEN;\n const ret = wasm.apply_feature_settings(ptr0, len0, ptr1, len1);\n if (ret[3]) {\n throw takeFromExternrefTable0(ret[2]);\n }\n var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n return v3;\n}\n\n/**\n * @param {Uint8Array} font_data\n * @param {string} variable_settings\n * @returns {Uint8Array}\n */\nexport function generate_static_font_instance(font_data, variable_settings) {\n const ptr0 = passArray8ToWasm0(font_data, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(\n variable_settings,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc,\n );\n const len1 = WASM_VECTOR_LEN;\n const ret = wasm.generate_static_font_instance(ptr0, len0, ptr1, len1);\n if (ret[3]) {\n throw takeFromExternrefTable0(ret[2]);\n }\n var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n return v3;\n}\n\n/**\n * Process a font: apply variable-font instancing, then bake stylistic sets AND\n * feature settings into `calt` in a single GSUB rebuild (the lookups are\n * deduped, so overlapping features cost nothing extra).\n * @param {Uint8Array} font_data\n * @param {string} variable_settings\n * @param {string} stylistic_sets\n * @param {string} feature_settings\n * @returns {Uint8Array}\n */\nexport function process_font(\n font_data,\n variable_settings,\n stylistic_sets,\n feature_settings,\n) {\n const ptr0 = passArray8ToWasm0(font_data, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(\n variable_settings,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc,\n );\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(\n stylistic_sets,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc,\n );\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(\n feature_settings,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc,\n );\n const len3 = WASM_VECTOR_LEN;\n const ret = wasm.process_font(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);\n if (ret[3]) {\n throw takeFromExternrefTable0(ret[2]);\n }\n var v5 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n return v5;\n}\n\n/**\n * Apply stylistic sets by injecting their GSUB lookups into the calt feature.\n * The calt (Contextual Alternates) feature is typically enabled by default in\n * browsers and runs for all text, making it suitable for applying stylistic\n * set substitutions.\n * @param {Uint8Array} font_data\n * @param {string} stylistic_sets\n * @returns {Uint8Array}\n */\nexport function apply_stylistic_sets(font_data, stylistic_sets) {\n const ptr0 = passArray8ToWasm0(font_data, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(\n stylistic_sets,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc,\n );\n const len1 = WASM_VECTOR_LEN;\n const ret = wasm.apply_stylistic_sets(ptr0, len0, ptr1, len1);\n if (ret[3]) {\n throw takeFromExternrefTable0(ret[2]);\n }\n var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n return v3;\n}\n\n/**\n * Check whether a font supports a shaperglot language id (e.g. \"ar_Arab\").\n * @param {Uint8Array} font_data\n * @param {string} language_id\n * @returns {string}\n */\nexport function check_font_language_support(font_data, language_id) {\n let deferred3_0;\n let deferred3_1;\n try {\n const ptr0 = passArray8ToWasm0(font_data, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(\n language_id,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc,\n );\n const len1 = WASM_VECTOR_LEN;\n const ret = wasm.check_font_language_support(ptr0, len0, ptr1, len1);\n deferred3_0 = ret[0];\n deferred3_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Check whether every significant character in `text` is covered by the font.\n * Whitespace and default-ignorable characters are skipped.\n * @param {Uint8Array} font_data\n * @param {string} text\n * @returns {string}\n */\nexport function check_font_text_coverage(font_data, text) {\n let deferred3_0;\n let deferred3_1;\n try {\n const ptr0 = passArray8ToWasm0(font_data, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(\n text,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc,\n );\n const len1 = WASM_VECTOR_LEN;\n const ret = wasm.check_font_text_coverage(ptr0, len0, ptr1, len1);\n deferred3_0 = ret[0];\n deferred3_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Initialize the WASM module\n */\nexport function init() {\n wasm.init();\n}\n\nconst EXPECTED_RESPONSE_TYPES = new Set([\"basic\", \"cors\", \"default\"]);\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === \"function\" && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === \"function\") {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n const validResponse =\n module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);\n\n if (\n validResponse &&\n module.headers.get(\"Content-Type\") !== \"application/wasm\"\n ) {\n console.warn(\n \"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",\n e,\n );\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n imports.wbg.__wbg_log_461b6f6f48e94344 = function (arg0, arg1) {\n console.log(getStringFromWasm0(arg0, arg1));\n };\n imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function (arg0, arg1) {\n // Cast intrinsic for `Ref(String) -> Externref`.\n const ret = getStringFromWasm0(arg0, arg1);\n return ret;\n };\n imports.wbg.__wbindgen_init_externref_table = function () {\n const table = wasm.__wbindgen_externrefs;\n const offset = table.grow(4);\n table.set(0, undefined);\n table.set(offset + 0, undefined);\n table.set(offset + 1, null);\n table.set(offset + 2, true);\n table.set(offset + 3, false);\n };\n\n return imports;\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedUint8ArrayMemory0 = null;\n\n wasm.__wbindgen_start();\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n if (typeof module !== \"undefined\") {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({ module } = module);\n } else {\n console.warn(\n \"using deprecated parameters for `initSync()`; pass a single object instead\",\n );\n }\n }\n\n const imports = __wbg_get_imports();\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n if (typeof module_or_path !== \"undefined\") {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({ module_or_path } = module_or_path);\n } else {\n console.warn(\n \"using deprecated parameters for the initialization function; pass a single object instead\",\n );\n }\n }\n\n if (typeof module_or_path === \"undefined\") {\n module_or_path = new URL(\"easyeyes_wasm_bg.wasm\", import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (\n typeof module_or_path === \"string\" ||\n (typeof Request === \"function\" && module_or_path instanceof Request) ||\n (typeof URL === \"function\" && module_or_path instanceof URL)\n ) {\n module_or_path = fetch(module_or_path);\n }\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n"],"names":["wasm","cachedUint8ArrayMemory0","getUint8ArrayMemory0","byteLength","Uint8Array","memory","buffer","cachedTextDecoder","TextDecoder","ignoreBOM","fatal","decode","numBytesDecoded","getStringFromWasm0","ptr","len","subarray","decodeText","WASM_VECTOR_LEN","passArray8ToWasm0","arg","malloc","length","set","takeFromExternrefTable0","idx","value","__wbindgen_externrefs","get","__externref_table_dealloc","get_font_variable_axes","font_data","deferred3_0","deferred3_1","ptr0","__wbindgen_malloc","len0","ret","ptr2","len2","__wbindgen_free","cachedTextEncoder","TextEncoder","passStringToWasm0","realloc","undefined","buf","encode","mem","offset","code","charCodeAt","slice","view","encodeInto","written","getArrayU8FromWasm0","apply_feature_settings","feature_settings","ptr1","__wbindgen_realloc","len1","v3","generate_static_font_instance","variable_settings","process_font","stylistic_sets","ptr3","len3","v5","apply_stylistic_sets","check_font_language_support","language_id","check_font_text_coverage","text","init","read","EXPECTED_RESPONSE_TYPES","Set","__wbg_get_imports","imports","wbg","__wbg_log_461b6f6f48e94344","arg0","arg1","console","log","__wbindgen_cast_2241b6af4c4b2941","__wbindgen_init_externref_table","table","grow","__wbg_finalize_init","instance","module","exports","__wbg_init","__wbindgen_wasm_module","__wbindgen_start","initSync","Object","getPrototypeOf","prototype","warn","WebAssembly","Module","Instance","async","module_or_path","Request","URL","fetch","Response","instantiateStreaming","e","ok","has","type","headers","bytes","arrayBuffer","instantiate","__wbg_load"],"mappings":"AAAA,IAAIA,kYAEJ,IAAIC,EAA0B,KAE9B,SAASC,IAOP,OAL8B,OAA5BD,GACuC,IAAvCA,EAAwBE,aAExBF,EAA0B,IAAIG,WAAWJ,EAAKK,OAAOC,SAEhDL,CACT,CAEA,IAAIM,EAAoB,IAAIC,YAAY,QAAS,CAC/CC,WAAW,EACXC,OAAO,IAGTH,EAAkBI,SAGlB,IAAIC,EAAkB,EAgBtB,SAASC,EAAmBC,EAAKC,GAE/B,OAjBF,SAAoBD,EAAKC,GAUvB,OATAH,GAAmBG,EACfH,GAJ0B,aAK5BL,EAAoB,IAAIC,YAAY,QAAS,CAC3CC,WAAW,EACXC,OAAO,IAETH,EAAkBI,SAClBC,EAAkBG,GAEbR,EAAkBI,OACvBT,IAAuBc,SAASF,EAAKA,EAAMC,GAE/C,CAISE,CADPH,KAAc,EACSC,EACzB,CAEA,IAAIG,EAAkB,EAEtB,SAASC,EAAkBC,EAAKC,GAC9B,MAAMP,EAAMO,EAAoB,EAAbD,EAAIE,OAAY,KAAO,EAG1C,OAFApB,IAAuBqB,IAAIH,EAAKN,EAAM,GACtCI,EAAkBE,EAAIE,OACfR,CACT,CAEA,SAASU,EAAwBC,GAC/B,MAAMC,EAAQ1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+
{"version":3,"file":"easyeyes_wasm.js","sources":["../@rust/pkg/easyeyes_wasm.js"],"sourcesContent":["let wasm;\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (\n cachedUint8ArrayMemory0 === null ||\n cachedUint8ArrayMemory0.byteLength === 0\n ) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nlet cachedTextDecoder = new TextDecoder(\"utf-8\", {\n ignoreBOM: true,\n fatal: true,\n});\n\ncachedTextDecoder.decode();\n\nconst MAX_SAFARI_DECODE_BYTES = 2146435072;\nlet numBytesDecoded = 0;\nfunction decodeText(ptr, len) {\n numBytesDecoded += len;\n if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {\n cachedTextDecoder = new TextDecoder(\"utf-8\", {\n ignoreBOM: true,\n fatal: true,\n });\n cachedTextDecoder.decode();\n numBytesDecoded = len;\n }\n return cachedTextDecoder.decode(\n getUint8ArrayMemory0().subarray(ptr, ptr + len),\n );\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return decodeText(ptr, len);\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nfunction passArray8ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 1, 1) >>> 0;\n getUint8ArrayMemory0().set(arg, ptr / 1);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nfunction takeFromExternrefTable0(idx) {\n const value = wasm.__wbindgen_externrefs.get(idx);\n wasm.__externref_table_dealloc(idx);\n return value;\n}\n/**\n * Get variable font axes information as JSON.\n * Returns JSON with isVariable flag and axis details (tag, min, max, default).\n * Used by the compiler to validate fontVariableSettings at compile time.\n * @param {Uint8Array} font_data\n * @returns {string}\n */\nexport function get_font_variable_axes(font_data) {\n let deferred3_0;\n let deferred3_1;\n try {\n const ptr0 = passArray8ToWasm0(font_data, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.get_font_variable_axes(ptr0, len0);\n var ptr2 = ret[0];\n var len2 = ret[1];\n if (ret[3]) {\n ptr2 = 0;\n len2 = 0;\n throw takeFromExternrefTable0(ret[2]);\n }\n deferred3_0 = ptr2;\n deferred3_1 = len2;\n return getStringFromWasm0(ptr2, len2);\n } finally {\n wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);\n }\n}\n\nconst cachedTextEncoder = new TextEncoder();\n\nif (!(\"encodeInto\" in cachedTextEncoder)) {\n cachedTextEncoder.encodeInto = 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}\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0()\n .subarray(ptr, ptr + buf.length)\n .set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\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), 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = cachedTextEncoder.encodeInto(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nfunction getArrayU8FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n/**\n * Apply OpenType feature settings by injecting each enabled feature's GSUB\n * lookups into the calt feature. The Canvas 2D API has no font-feature-settings,\n * so this \"bakes\" the features into the font binary. Tags are validated up front\n * by the compiler. Disabling (value 0) clears the feature's lookup indices.\n * @param {Uint8Array} font_data\n * @param {string} feature_settings\n * @returns {Uint8Array}\n */\nexport function apply_feature_settings(font_data, feature_settings) {\n const ptr0 = passArray8ToWasm0(font_data, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(\n feature_settings,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc,\n );\n const len1 = WASM_VECTOR_LEN;\n const ret = wasm.apply_feature_settings(ptr0, len0, ptr1, len1);\n if (ret[3]) {\n throw takeFromExternrefTable0(ret[2]);\n }\n var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n return v3;\n}\n\n/**\n * @param {Uint8Array} font_data\n * @param {string} variable_settings\n * @returns {Uint8Array}\n */\nexport function generate_static_font_instance(font_data, variable_settings) {\n const ptr0 = passArray8ToWasm0(font_data, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(\n variable_settings,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc,\n );\n const len1 = WASM_VECTOR_LEN;\n const ret = wasm.generate_static_font_instance(ptr0, len0, ptr1, len1);\n if (ret[3]) {\n throw takeFromExternrefTable0(ret[2]);\n }\n var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n return v3;\n}\n\n/**\n * Process a font: apply variable-font instancing, then bake stylistic sets AND\n * feature settings into `calt` in a single GSUB rebuild (the lookups are\n * deduped, so overlapping features cost nothing extra).\n * @param {Uint8Array} font_data\n * @param {string} variable_settings\n * @param {string} stylistic_sets\n * @param {string} feature_settings\n * @returns {Uint8Array}\n */\nexport function process_font(\n font_data,\n variable_settings,\n stylistic_sets,\n feature_settings,\n) {\n const ptr0 = passArray8ToWasm0(font_data, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(\n variable_settings,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc,\n );\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(\n stylistic_sets,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc,\n );\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passStringToWasm0(\n feature_settings,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc,\n );\n const len3 = WASM_VECTOR_LEN;\n const ret = wasm.process_font(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);\n if (ret[3]) {\n throw takeFromExternrefTable0(ret[2]);\n }\n var v5 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n return v5;\n}\n\n/**\n * Apply stylistic sets by injecting their GSUB lookups into the calt feature.\n * The calt (Contextual Alternates) feature is typically enabled by default in\n * browsers and runs for all text, making it suitable for applying stylistic\n * set substitutions.\n * @param {Uint8Array} font_data\n * @param {string} stylistic_sets\n * @returns {Uint8Array}\n */\nexport function apply_stylistic_sets(font_data, stylistic_sets) {\n const ptr0 = passArray8ToWasm0(font_data, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(\n stylistic_sets,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc,\n );\n const len1 = WASM_VECTOR_LEN;\n const ret = wasm.apply_stylistic_sets(ptr0, len0, ptr1, len1);\n if (ret[3]) {\n throw takeFromExternrefTable0(ret[2]);\n }\n var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n return v3;\n}\n\n/**\n * Check whether a font supports a shaperglot language id (e.g. \"ar_Arab\").\n * @param {Uint8Array} font_data\n * @param {string} language_id\n * @returns {string}\n */\nexport function check_font_language_support(font_data, language_id) {\n let deferred3_0;\n let deferred3_1;\n try {\n const ptr0 = passArray8ToWasm0(font_data, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(\n language_id,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc,\n );\n const len1 = WASM_VECTOR_LEN;\n const ret = wasm.check_font_language_support(ptr0, len0, ptr1, len1);\n deferred3_0 = ret[0];\n deferred3_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Check whether every significant character in `text` is covered by the font.\n * Whitespace and default-ignorable characters are skipped.\n * @param {Uint8Array} font_data\n * @param {string} text\n * @returns {string}\n */\nexport function check_font_text_coverage(font_data, text) {\n let deferred3_0;\n let deferred3_1;\n try {\n const ptr0 = passArray8ToWasm0(font_data, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(\n text,\n wasm.__wbindgen_malloc,\n wasm.__wbindgen_realloc,\n );\n const len1 = WASM_VECTOR_LEN;\n const ret = wasm.check_font_text_coverage(ptr0, len0, ptr1, len1);\n deferred3_0 = ret[0];\n deferred3_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Initialize the WASM module\n */\nexport function init() {\n wasm.init();\n}\n\nconst EXPECTED_RESPONSE_TYPES = new Set([\"basic\", \"cors\", \"default\"]);\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === \"function\" && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === \"function\") {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n const validResponse =\n module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);\n\n if (\n validResponse &&\n module.headers.get(\"Content-Type\") !== \"application/wasm\"\n ) {\n console.warn(\n \"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",\n e,\n );\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n imports.wbg.__wbg_log_461b6f6f48e94344 = function (arg0, arg1) {\n console.log(getStringFromWasm0(arg0, arg1));\n };\n imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function (arg0, arg1) {\n // Cast intrinsic for `Ref(String) -> Externref`.\n const ret = getStringFromWasm0(arg0, arg1);\n return ret;\n };\n imports.wbg.__wbindgen_init_externref_table = function () {\n const table = wasm.__wbindgen_externrefs;\n const offset = table.grow(4);\n table.set(0, undefined);\n table.set(offset + 0, undefined);\n table.set(offset + 1, null);\n table.set(offset + 2, true);\n table.set(offset + 3, false);\n };\n\n return imports;\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedUint8ArrayMemory0 = null;\n\n wasm.__wbindgen_start();\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n if (typeof module !== \"undefined\") {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({ module } = module);\n } else {\n console.warn(\n \"using deprecated parameters for `initSync()`; pass a single object instead\",\n );\n }\n }\n\n const imports = __wbg_get_imports();\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n if (typeof module_or_path !== \"undefined\") {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({ module_or_path } = module_or_path);\n } else {\n console.warn(\n \"using deprecated parameters for the initialization function; pass a single object instead\",\n );\n }\n }\n\n if (typeof module_or_path === \"undefined\") {\n module_or_path = new URL(\"easyeyes_wasm_bg.wasm\", import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (\n typeof module_or_path === \"string\" ||\n (typeof Request === \"function\" && module_or_path instanceof Request) ||\n (typeof URL === \"function\" && module_or_path instanceof URL)\n ) {\n module_or_path = fetch(module_or_path);\n }\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n"],"names":["wasm","cachedUint8ArrayMemory0","getUint8ArrayMemory0","byteLength","Uint8Array","memory","buffer","cachedTextDecoder","TextDecoder","ignoreBOM","fatal","decode","numBytesDecoded","getStringFromWasm0","ptr","len","subarray","decodeText","WASM_VECTOR_LEN","passArray8ToWasm0","arg","malloc","length","set","takeFromExternrefTable0","idx","value","__wbindgen_externrefs","get","__externref_table_dealloc","get_font_variable_axes","font_data","deferred3_0","deferred3_1","ptr0","__wbindgen_malloc","len0","ret","ptr2","len2","__wbindgen_free","cachedTextEncoder","TextEncoder","passStringToWasm0","realloc","undefined","buf","encode","mem","offset","code","charCodeAt","slice","view","encodeInto","written","getArrayU8FromWasm0","apply_feature_settings","feature_settings","ptr1","__wbindgen_realloc","len1","v3","generate_static_font_instance","variable_settings","process_font","stylistic_sets","ptr3","len3","v5","apply_stylistic_sets","check_font_language_support","language_id","check_font_text_coverage","text","init","read","EXPECTED_RESPONSE_TYPES","Set","__wbg_get_imports","imports","wbg","__wbg_log_461b6f6f48e94344","arg0","arg1","console","log","__wbindgen_cast_2241b6af4c4b2941","__wbindgen_init_externref_table","table","grow","__wbg_finalize_init","instance","module","exports","__wbg_init","__wbindgen_wasm_module","__wbindgen_start","initSync","Object","getPrototypeOf","prototype","warn","WebAssembly","Module","Instance","async","module_or_path","URL","url","Request","fetch","Response","instantiateStreaming","e","ok","has","type","headers","bytes","arrayBuffer","instantiate","__wbg_load"],"mappings":"AAAA,IAAIA,k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AA,gkx0MAAAC,MAEnB,MAAM7B,EAAUD,KAGY,iBAAnB4B,GACa,mBAAZG,SAA0BH,aAA0BG,SAC5C,mBAARF,KAAsBD,aAA0BC,OAExDD,EAAiBI,MAAMJ,IAGzB,MAAMf,SAAEA,EAAQC,OAAEA,SAvHpBa,eAA0Bb,EAAQb,GAChC,GAAwB,mBAAbgC,UAA2BnB,aAAkBmB,SAAU,CAChE,GAAgD,mBAArCT,YAAYU,qBACrB,IACE,aAAaV,YAAYU,qBAAqBpB,EAAQb,EACxD,CAAE,MAAOkC,GAIP,IAFErB,EAAOsB,KAAMtC,EAAwBuC,IAAIvB,EAAOwB,OAIT,qBAAvCxB,EAAOyB,QAAQ1F,IAAI,gBAOnB,MAAMsF,EALN7B,QAAQiB,KACN,oMACAY,EAKN,CAGF,MAAMK,QAAc1B,EAAO2B,cAC3B,aAAajB,YAAYkB,YAAYF,EAAOvC,EAC9C,CAAO,CACL,MAAMY,QAAiBW,YAAYkB,YAAY5B,EAAQb,GAEvD,OAAIY,aAAoBW,YAAYE,SAC3B,CAAEb,WAAUC,UAEZD,CAEX,CACF,CAqFqC8B,OAAiBf,EAAgB3B,GAEpE,OAAOW,EAAoBC,EAAUC,EACvC"}
|
package/js/first.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(){try{var n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},e=(new n.Error).stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="bb7b98df-3b54-4319-bf0a-17b1cb3fd67a",n._sentryDebugIdIdentifier="sentry-dbid-bb7b98df-3b54-4319-bf0a-17b1cb3fd67a")}catch(n){}}();const n=new class{constructor(){this.currentPercentage=0,this.listeners=[],this.progressIntervalId=null}startProgressAnimation(){this.progressIntervalId||(this.progressIntervalId=setInterval((
|
|
1
|
+
!function(){try{var n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},e=(new n.Error).stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="bb7b98df-3b54-4319-bf0a-17b1cb3fd67a",n._sentryDebugIdIdentifier="sentry-dbid-bb7b98df-3b54-4319-bf0a-17b1cb3fd67a")}catch(n){}}();const n=new class{constructor(){this.currentPercentage=0,this.listeners=[],this.progressIntervalId=null}startProgressAnimation(){this.progressIntervalId||(this.progressIntervalId=setInterval(()=>{if(this.currentPercentage<90){const n=4*Math.random()+1;this.currentPercentage=Math.min(90,this.currentPercentage+n),this.notifyListeners()}},800))}stopProgressAnimation(){this.progressIntervalId&&(clearInterval(this.progressIntervalId),this.progressIntervalId=null)}notifyListeners(){this.listeners.forEach(n=>{n(this.currentPercentage)}),"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("threshold-init-progress",{detail:{percentage:Math.round(this.currentPercentage)}}))}reset(){this.stopProgressAnimation(),this.currentPercentage=0}},e=async()=>{const[n,e]=window.location.pathname.split("/").filter(Boolean),t=new URLSearchParams(window.location.search).get("preview-deploy")||("localhost"!==window.location.hostname?"https://easyeyes.app":"http://localhost:8888"),o=await fetch(`${t}/.netlify/functions/phrases?pinned=${n}/${e}`);if(!o.ok)throw new Error(`phrases pin fetch failed: ${o.status}`);const{version:i}=await o.json(),s=await fetch(`${t}/.netlify/functions/phrases?v=${i}`);if(!s.ok)throw new Error(`phrases fetch failed: ${s.status}`);return(await s.json()).phrases};document.addEventListener("DOMContentLoaded",()=>{document.body.setAttribute("dir","undefined"!=typeof experimentLanguageDirection&&"rtl"===String(experimentLanguageDirection).toLowerCase()?"rtl":"ltr"),n.startProgressAnimation();const t=document.createElement("div");t.className="loading-container",t.innerHTML='\n <div class="loading-content">\n <div class="loading-spinner"></div>\n <div class="loading-text"></div>\n <div class="progress-bar">\n <div class="progress-fill" id="progressFill"></div>\n </div>\n <div class="progress-percent" id="progressPercent">0%</div>\n <div id="timeoutMessage" class="timeout-message" style="display: none;"></div>\n <button id="reloadButton" class="reload-button" style="display: none;"></button>\n </div>\n ',document.body.appendChild(t);let o=!1,i=!1;const s=()=>{if(!o||!i||!t.parentNode)return;const n=document.getElementById("timeoutMessage"),e=document.getElementById("reloadButton");n&&(n.style.display="block"),e&&(e.style.display="block")};e().then(n=>{const e=((n,e)=>{let t;return t=e&&Object.prototype.hasOwnProperty.call(n.EE_LanguageEnglishName,e)?e:Object.keys(n.EE_LanguageEnglishName).find(t=>n.EE_LanguageEnglishName[t]===e),t?{loadingText:n.RC_LoadingStudy[t],timeoutMessage:n.RC_LoadingStudyTakingLonger[t],reloadButton:n.RC_ReloadStudyButton[t]}:null})(n,experimentLanguage);if(e){const n=t.querySelector(".loading-text");n&&(n.textContent=e.loadingText);const i=document.getElementById("timeoutMessage");i&&(i.textContent=e.timeoutMessage);const r=document.getElementById("reloadButton");r&&(r.textContent=e.reloadButton),o=!0,s()}}).catch(n=>{console.warn("Failed to load phrases:",n);const e=t.querySelector(".loading-text");e&&(e.textContent="Loading …")});const r=setTimeout(()=>{i=!0,s()},1e4),a=document.getElementById("reloadButton");a&&a.addEventListener("click",()=>{window.location.reload()}),window.addEventListener("threshold-init-progress",n=>{const{percentage:e}=n.detail,t=document.getElementById("progressFill"),o=document.getElementById("progressPercent");t&&(t.style.width=e+"%"),o&&(o.textContent=Math.round(e)+"%")});const d=()=>{clearTimeout(r),n.stopProgressAnimation(),n.currentPercentage=100,n.notifyListeners(),t.parentNode&&t.remove()};window.removeLoadingScreen=d,window.showCriticalLoadError=(e,t)=>{clearTimeout(r),n.stopProgressAnimation(),"undefined"!=typeof Swal&&Swal.fire({allowOutsideClick:!1,icon:"error",title:e||"Loading Failed",text:t||"Please refresh the page to try again.",confirmButtonText:"Refresh"}).then(()=>window.location.reload())},window.addEventListener("threshold-ready-for-ui",()=>{d()})});const t=document.createElement("style");t.textContent='\n body, html {\n margin: 0;\n padding: 0;\n }\n\n .loading-container {\n position: fixed;\n top: 0;\n left: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n transition: opacity 0.4s ease;\n padding: 0;\n margin: 0;\n height: 100vh;\n width: 100vw;\n background: white;\n z-index: 10000;\n }\n\n .loading-content {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 20px;\n width: 400px;\n max-width: 90vw;\n padding: 20px;\n }\n\n .loading-spinner {\n border: 5px solid #f3f3f3;\n border-top: 5px solid #3498db;\n border-radius: 50%;\n width: 50px;\n height: 50px;\n animation: spin 1s linear infinite;\n }\n\n .loading-text {\n font-size: 18px;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n color: #333;\n font-weight: 500;\n }\n\n .progress-bar {\n width: 100%;\n height: 8px;\n background: #e0e0e0;\n border-radius: 4px;\n overflow: hidden;\n }\n\n .progress-fill {\n height: 100%;\n background: #3498db;\n width: 0%;\n transition: width 0.3s ease;\n }\n\n .progress-percent {\n font-size: 14px;\n color: #666;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n }\n\n .progress-step {\n font-size: 12px;\n color: #999;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n min-height: 16px;\n }\n\n .timeout-message {\n font-size: 14px;\n color: #666;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n font-weight: 400;\n text-align: center;\n }\n\n .reload-button {\n background: #3498db;\n color: white;\n border: none;\n padding: 12px 24px;\n border-radius: 4px;\n font-size: 14px;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n font-weight: 500;\n cursor: pointer;\n transition: background 0.2s ease;\n }\n\n .reload-button:hover {\n background: #2980b9;\n }\n\n .reload-button:active {\n background: #1f618d;\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n\n .fade-out {\n opacity: 0;\n }\n\n /* Center-align Swal2 modal title and content for consistent alignment */\n .swal2-title,\n .swal2-html-container {\n text-align: center !important;\n }\n',document.head.appendChild(t);
|
|
2
2
|
//# sourceMappingURL=first.min.js.map
|
package/js/first.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first.min.js","sources":["../components/timeoutUtils.js","../first.js","../components/loadingScreenText.ts"],"sourcesContent":["/**\n * Class to track initialization progress\n */\nexport class InitializationProgress {\n constructor() {\n this.currentPercentage = 0;\n this.listeners = [];\n this.progressIntervalId = null;\n }\n /**\n * Start progress animation for better UX\n * Gradually increases progress if not already at target\n */\n startProgressAnimation() {\n if (this.progressIntervalId) return; // Already running\n\n this.progressIntervalId = setInterval(() => {\n // Gradually increase progress between updates (but slower as we get higher)\n if (this.currentPercentage < 90) {\n // Math.random (not the seeded rng): first.js imports this module and\n // must stay a standalone bundle; the increment is cosmetic only.\n const increment = Math.random() * (5 - 1) + 1; // Random 1-5% increment\n this.currentPercentage = Math.min(\n 90,\n this.currentPercentage + increment,\n );\n this.notifyListeners();\n }\n }, 800); // Update every 800ms\n }\n\n /**\n * Stop progress animation\n */\n stopProgressAnimation() {\n if (this.progressIntervalId) {\n clearInterval(this.progressIntervalId);\n this.progressIntervalId = null;\n }\n }\n\n /**\n * Notify all listeners of progress update\n */\n notifyListeners() {\n this.listeners.forEach((callback) => {\n callback(this.currentPercentage);\n });\n\n // Also dispatch custom event for cross-module communication\n if (typeof window !== \"undefined\") {\n window.dispatchEvent(\n new CustomEvent(\"threshold-init-progress\", {\n detail: {\n percentage: Math.round(this.currentPercentage),\n },\n }),\n );\n }\n }\n\n /**\n * Reset progress\n */\n reset() {\n this.stopProgressAnimation();\n this.currentPercentage = 0;\n }\n}\n\n// Create a singleton instance\nexport const initProgress = new InitializationProgress();\n","// Import only what's needed for initial page rendering\nimport { initProgress } from \"./components/timeoutUtils.js\";\nimport * as sentry from \"./components/sentry\";\nimport { localizeLoadingScreen } from \"./components/loadingScreenText\";\n\n// Resolve the EasyEyes base URL for the loading-screen phrases fetch. Kept\n// self-contained (no shared imports) so first.js stays a standalone bundle —\n// see loadPhrases below. Mirrors components/easyeyesBaseUrl.ts for the deployed\n// cases (preview-deploy param, production); a local dev server is assumed at\n// :8888 without probing, since the spinner falls back gracefully on failure.\nconst getBaseUrl = () => {\n const previewDeployBase = new URLSearchParams(window.location.search).get(\n \"preview-deploy\",\n );\n if (previewDeployBase) return previewDeployBase;\n if (window.location.hostname !== \"localhost\") return \"https://easyeyes.app\";\n return \"http://localhost:8888\";\n};\n\n// Load phrases for the loading screen from the same versioned read-path the\n// experiment uses. Inlined here (not imported from preprocess/phrases-loader,\n// which has a top-level await) so first.js bundles standalone — sharing a module\n// across that async boundary would split a chunk that Pavlovia does not deploy.\n// A single attempt is enough: setupInitialUI's .catch falls back to plain text.\nconst loadPhrases = async () => {\n const [username, experimentName] = window.location.pathname\n .split(\"/\")\n .filter(Boolean);\n const base = getBaseUrl();\n // Two-step read: resolve the (mutable, uncached) pin to a version, then fetch\n // the immutable payload by explicit ?v= — the same cacheable URL the\n // experiment loader uses. Single attempt: the .catch falls back to plain text.\n const pinnedRes = await fetch(\n `${base}/.netlify/functions/phrases?pinned=${username}/${experimentName}`,\n );\n if (!pinnedRes.ok)\n throw new Error(`phrases pin fetch failed: ${pinnedRes.status}`);\n const { version } = await pinnedRes.json();\n const res = await fetch(`${base}/.netlify/functions/phrases?v=${version}`);\n if (!res.ok) throw new Error(`phrases fetch failed: ${res.status}`);\n const data = await res.json();\n return data.phrases;\n};\n\n// Initial UI setup function - show spinner immediately\nconst setupInitialUI = () => {\n // experimentLanguageDirection is defined (alongside experimentLanguage) in\n // the compile-time generated js/experimentLanguage.js loaded by index.html;\n // it holds the _language's direction per the phrases' EE_LanguageDirection.\n // Set <body dir> so every HTML element inherits the experiment's text\n // direction by default. Guarded with typeof: experiments compiled before\n // this constant existed ship an experimentLanguage.js without it.\n document.body.setAttribute(\n \"dir\",\n typeof experimentLanguageDirection !== \"undefined\" &&\n String(experimentLanguageDirection).toLowerCase() === \"rtl\"\n ? \"rtl\"\n : \"ltr\",\n );\n\n // Start the progress animation immediately (no i18n needed)\n initProgress.startProgressAnimation();\n\n // Create loading indicator with spinner only (no text initially)\n const loadingElement = document.createElement(\"div\");\n loadingElement.className = \"loading-container\";\n loadingElement.innerHTML = `\n <div class=\"loading-content\">\n <div class=\"loading-spinner\"></div>\n <div class=\"loading-text\"></div>\n <div class=\"progress-bar\">\n <div class=\"progress-fill\" id=\"progressFill\"></div>\n </div>\n <div class=\"progress-percent\" id=\"progressPercent\">0%</div>\n <div id=\"timeoutMessage\" class=\"timeout-message\" style=\"display: none;\"></div>\n <button id=\"reloadButton\" class=\"reload-button\" style=\"display: none;\"></button>\n </div>\n `;\n document.body.appendChild(loadingElement);\n\n // Show the timeout message and reload button only once BOTH conditions hold:\n // the 10s timer has fired and phrases have loaded (so they have localized\n // text). Either side can be the last to happen, so each calls this helper.\n let phrasesLoaded = false;\n let timeoutReached = false;\n const maybeShowTimeoutUI = () => {\n if (!phrasesLoaded || !timeoutReached || !loadingElement.parentNode) return;\n const timeoutMessage = document.getElementById(\"timeoutMessage\");\n const reloadButton = document.getElementById(\"reloadButton\");\n if (timeoutMessage) {\n timeoutMessage.style.display = \"block\";\n }\n if (reloadButton) {\n reloadButton.style.display = \"block\";\n }\n };\n\n // Lazy-load i18n and update text elements once available\n loadPhrases()\n .then((phrases) => {\n // experimentLanguage is loaded in the index.html\n const text = localizeLoadingScreen(phrases, experimentLanguage);\n if (text) {\n // Update text elements (DOM already has them, just populate)\n const loadingText = loadingElement.querySelector(\".loading-text\");\n if (loadingText) {\n loadingText.textContent = text.loadingText;\n }\n const timeoutMessage = document.getElementById(\"timeoutMessage\");\n if (timeoutMessage) {\n timeoutMessage.textContent = text.timeoutMessage;\n }\n const reloadButton = document.getElementById(\"reloadButton\");\n if (reloadButton) {\n reloadButton.textContent = text.reloadButton;\n }\n phrasesLoaded = true;\n maybeShowTimeoutUI();\n }\n })\n .catch((err) => {\n console.warn(\"Failed to load phrases:\", err);\n const loadingText = loadingElement.querySelector(\".loading-text\");\n if (loadingText) {\n loadingText.textContent = \"Loading …\";\n }\n });\n\n // Setup timeout warning and reload button (10 seconds)\n const timeoutWarningTimer = setTimeout(() => {\n timeoutReached = true;\n maybeShowTimeoutUI();\n }, 10000);\n\n // Reload button click handler\n const reloadButton = document.getElementById(\"reloadButton\");\n if (reloadButton) {\n reloadButton.addEventListener(\"click\", () => {\n window.location.reload();\n });\n }\n\n // Listen for initialization progress updates\n window.addEventListener(\"threshold-init-progress\", (event) => {\n const { percentage } = event.detail;\n const progressFill = document.getElementById(\"progressFill\");\n const progressPercent = document.getElementById(\"progressPercent\");\n\n if (progressFill) {\n progressFill.style.width = percentage + \"%\";\n }\n if (progressPercent) {\n progressPercent.textContent = Math.round(percentage) + \"%\";\n }\n });\n\n // Extract loading screen removal function\n const removeLoadingScreen = () => {\n // Clear timeout timer\n clearTimeout(timeoutWarningTimer);\n\n // Stop progress animation and ensure progress bar shows 100%\n initProgress.stopProgressAnimation();\n initProgress.currentPercentage = 100;\n initProgress.notifyListeners();\n\n if (loadingElement.parentNode) {\n loadingElement.remove();\n }\n };\n\n // Expose globally for threshold.js (before threshold.js loads)\n window.removeLoadingScreen = removeLoadingScreen;\n\n // Show critical load error using Swal2 (loaded in index.html before first.js)\n window.showCriticalLoadError = (title, text) => {\n clearTimeout(timeoutWarningTimer);\n initProgress.stopProgressAnimation();\n if (typeof Swal !== \"undefined\") {\n Swal.fire({\n allowOutsideClick: false,\n icon: \"error\",\n title: title || \"Loading Failed\",\n text: text || \"Please refresh the page to try again.\",\n confirmButtonText: \"Refresh\",\n }).then(() => window.location.reload());\n }\n };\n\n // Remove loading screen when ready for UI (compatibility page)\n window.addEventListener(\"threshold-ready-for-ui\", () => {\n removeLoadingScreen(); // Delegates to extracted function\n });\n};\n\n// Run immediately\ndocument.addEventListener(\"DOMContentLoaded\", setupInitialUI);\n\n// Add some CSS for the loading screen\nconst style = document.createElement(\"style\");\nstyle.textContent = `\n body, html {\n margin: 0;\n padding: 0;\n }\n\n .loading-container {\n position: fixed;\n top: 0;\n left: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n transition: opacity 0.4s ease;\n padding: 0;\n margin: 0;\n height: 100vh;\n width: 100vw;\n background: white;\n z-index: 10000;\n }\n\n .loading-content {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 20px;\n width: 400px;\n max-width: 90vw;\n padding: 20px;\n }\n\n .loading-spinner {\n border: 5px solid #f3f3f3;\n border-top: 5px solid #3498db;\n border-radius: 50%;\n width: 50px;\n height: 50px;\n animation: spin 1s linear infinite;\n }\n\n .loading-text {\n font-size: 18px;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n color: #333;\n font-weight: 500;\n }\n\n .progress-bar {\n width: 100%;\n height: 8px;\n background: #e0e0e0;\n border-radius: 4px;\n overflow: hidden;\n }\n\n .progress-fill {\n height: 100%;\n background: #3498db;\n width: 0%;\n transition: width 0.3s ease;\n }\n\n .progress-percent {\n font-size: 14px;\n color: #666;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n }\n\n .progress-step {\n font-size: 12px;\n color: #999;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n min-height: 16px;\n }\n\n .timeout-message {\n font-size: 14px;\n color: #666;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n font-weight: 400;\n text-align: center;\n }\n\n .reload-button {\n background: #3498db;\n color: white;\n border: none;\n padding: 12px 24px;\n border-radius: 4px;\n font-size: 14px;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n font-weight: 500;\n cursor: pointer;\n transition: background 0.2s ease;\n }\n\n .reload-button:hover {\n background: #2980b9;\n }\n\n .reload-button:active {\n background: #1f618d;\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n\n .fade-out {\n opacity: 0;\n }\n\n /* Center-align Swal2 modal title and content for consistent alignment */\n .swal2-title,\n .swal2-html-container {\n text-align: center !important;\n }\n`;\ndocument.head.appendChild(style);\n\n// Export things that threshold.js might need\nexport { setupInitialUI };\n","type Phrases = Record<string, Record<string, string>>;\n\nexport interface LoadingScreenText {\n loadingText: string;\n timeoutMessage: string;\n reloadButton: string;\n}\n\n/**\n * Resolve the loading-screen strings for the experiment's language (as set in\n * index.html). Accepts either a language code (e.g. \"fr\") or, for backward\n * compatibility, the full English name. Returns null when nothing matches.\n */\nexport const localizeLoadingScreen = (\n phrases: Phrases,\n experimentLanguageName: string,\n): LoadingScreenText | null => {\n let lang: string | undefined;\n // _language now takes a language code; use it directly when it is one.\n if (\n experimentLanguageName &&\n Object.prototype.hasOwnProperty.call(\n phrases.EE_LanguageEnglishName,\n experimentLanguageName,\n )\n ) {\n lang = experimentLanguageName;\n } else {\n lang = Object.keys(phrases.EE_LanguageEnglishName).find(\n (key) => phrases.EE_LanguageEnglishName[key] === experimentLanguageName,\n );\n }\n if (!lang) return null;\n return {\n loadingText: phrases.RC_LoadingStudy[lang],\n timeoutMessage: phrases.RC_LoadingStudyTakingLonger[lang],\n reloadButton: phrases.RC_ReloadStudyButton[lang],\n };\n};\n"],"names":["initProgress","constructor","this","currentPercentage","listeners","progressIntervalId","startProgressAnimation","setInterval","increment","Math","random","min","notifyListeners","stopProgressAnimation","clearInterval","forEach","callback","window","dispatchEvent","CustomEvent","detail","percentage","round","reset","loadPhrases","async","username","experimentName","location","pathname","split","filter","Boolean","base","URLSearchParams","search","get","hostname","pinnedRes","fetch","ok","Error","status","version","json","res","phrases","document","addEventListener","body","setAttribute","experimentLanguageDirection","String","toLowerCase","loadingElement","createElement","className","innerHTML","appendChild","phrasesLoaded","timeoutReached","maybeShowTimeoutUI","parentNode","timeoutMessage","getElementById","reloadButton","style","display","then","text","experimentLanguageName","lang","Object","prototype","hasOwnProperty","call","EE_LanguageEnglishName","keys","find","key","loadingText","RC_LoadingStudy","RC_LoadingStudyTakingLonger","RC_ReloadStudyButton","localizeLoadingScreen","experimentLanguage","querySelector","textContent","catch","err","console","warn","timeoutWarningTimer","setTimeout","reload","event","progressFill","progressPercent","width","removeLoadingScreen","clearTimeout","remove","showCriticalLoadError","title","Swal","fire","allowOutsideClick","icon","confirmButtonText","head"],"mappings":"gYAuEO,MAAMA,EAAe,IApErB,MACL,WAAAC,GACEC,KAAKC,kBAAoB,EACzBD,KAAKE,UAAY,GACjBF,KAAKG,mBAAqB,IAC5B,CAKA,sBAAAC,GACMJ,KAAKG,qBAETH,KAAKG,mBAAqBE,aAAY,KAEpC,GAAIL,KAAKC,kBAAoB,GAAI,CAG/B,MAAMK,EAAyB,EAAbC,KAAKC,SAAqB,EAC5CR,KAAKC,kBAAoBM,KAAKE,IAC5B,GACAT,KAAKC,kBAAoBK,GAE3BN,KAAKU,iBACP,IACC,KACL,CAKA,qBAAAC,GACMX,KAAKG,qBACPS,cAAcZ,KAAKG,oBACnBH,KAAKG,mBAAqB,KAE9B,CAKA,eAAAO,GACEV,KAAKE,UAAUW,SAASC,IACtBA,EAASd,KAAKC,kBAAkB,IAIZ,oBAAXc,QACTA,OAAOC,cACL,IAAIC,YAAY,0BAA2B,CACzCC,OAAQ,CACNC,WAAYZ,KAAKa,MAAMpB,KAAKC,sBAKtC,CAKA,KAAAoB,GACErB,KAAKW,wBACLX,KAAKC,kBAAoB,CAC3B,GC3CIqB,EAAcC,UAClB,MAAOC,EAAUC,GAAkBV,OAAOW,SAASC,SAChDC,MAAM,KACNC,OAAOC,SACJC,EAjBoB,IAAIC,gBAAgBjB,OAAOW,SAASO,QAAQC,IACpE,oBAG+B,cAA7BnB,OAAOW,SAASS,SAAiC,uBAC9C,yBAgBDC,QAAkBC,MACtB,GAAGN,uCAA0CP,KAAYC,KAE3D,IAAKW,EAAUE,GACb,MAAM,IAAIC,MAAM,6BAA6BH,EAAUI,UACzD,MAAMC,QAAEA,SAAkBL,E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ACzCC,IACFA,EAAasB,YAAclB,EAAKJ,cAElCN,GAAgB,EAChBE,GACF,KAED2B,OAAOC,IACNC,QAAQC,KAAK,0BAA2BF,GACxC,MAAMT,EAAc1B,EAAegC,cAAc,iBAC7CN,IACFA,EAAYO,YAAc,YAC5B,IAIJ,MAAMK,EAAsBC,YAAW,KACrCjC,GAAiB,EACjBC,GAAoB,GACnB,KAGGI,EAAelB,SAASiB,eAAe,gBACzCC,GACFA,EAAajB,iBAAiB,SAAS,KACrC/B,OAAOW,SAASkE,QAAQ,IAK5B7E,OAAO+B,iBAAiB,2BAA4B+C,IAClD,MAAM1E,WAAEA,GAAe0E,EAAM3E,OACvB4E,EAAejD,SAASiB,eAAe,gBACvCiC,EAAkBlD,SAASiB,eAAe,mBAE5CgC,IACFA,EAAa9B,MAAMgC,MAAQ7E,EAAa,KAEtC4E,IACFA,EAAgBV,YAAc9E,KAAKa,MAAMD,GAAc,IACzD,IAIF,MAAM8E,EAAsB,KAE1BC,aAAaR,GAGb5F,EAAaa,wBACbb,EAAaG,kBAAoB,IACjCH,EAAaY,kBAET0C,EAAeQ,YACjBR,EAAe+C,QACjB,EAIFpF,OAAOkF,oBAAsBA,EAG7BlF,OAAOqF,sBAAwB,CAACC,EAAOlC,KACrC+B,aAAaR,GACb5F,EAAaa,wBACO,oBAAT2F,MACTA,KAAKC,KAAK,CACRC,mBAAmB,EACnBC,KAAM,QACNJ,MAAOA,GAAS,iBAChBlC,KAAMA,GAAQ,wCACduC,kBAAmB,YAClBxC,MAAK,IAAMnD,OAAOW,SAASkE,UAChC,EAIF7E,OAAO+B,iBAAiB,0BAA0B,KAChDmD,GAAqB,GACrB,IAOJ,MAAMjC,EAAQnB,SAASQ,cAAc,SACrCW,EAAMqB,YAAc,kyFAyHpBxC,SAAS8D,KAAKnD,YAAYQ"}
|
|
1
|
+
{"version":3,"file":"first.min.js","sources":["../components/timeoutUtils.js","../first.js","../components/loadingScreenText.ts"],"sourcesContent":["/**\n * Class to track initialization progress\n */\nexport class InitializationProgress {\n constructor() {\n this.currentPercentage = 0;\n this.listeners = [];\n this.progressIntervalId = null;\n }\n /**\n * Start progress animation for better UX\n * Gradually increases progress if not already at target\n */\n startProgressAnimation() {\n if (this.progressIntervalId) return; // Already running\n\n this.progressIntervalId = setInterval(() => {\n // Gradually increase progress between updates (but slower as we get higher)\n if (this.currentPercentage < 90) {\n // Math.random (not the seeded rng): first.js imports this module and\n // must stay a standalone bundle; the increment is cosmetic only.\n const increment = Math.random() * (5 - 1) + 1; // Random 1-5% increment\n this.currentPercentage = Math.min(\n 90,\n this.currentPercentage + increment,\n );\n this.notifyListeners();\n }\n }, 800); // Update every 800ms\n }\n\n /**\n * Stop progress animation\n */\n stopProgressAnimation() {\n if (this.progressIntervalId) {\n clearInterval(this.progressIntervalId);\n this.progressIntervalId = null;\n }\n }\n\n /**\n * Notify all listeners of progress update\n */\n notifyListeners() {\n this.listeners.forEach((callback) => {\n callback(this.currentPercentage);\n });\n\n // Also dispatch custom event for cross-module communication\n if (typeof window !== \"undefined\") {\n window.dispatchEvent(\n new CustomEvent(\"threshold-init-progress\", {\n detail: {\n percentage: Math.round(this.currentPercentage),\n },\n }),\n );\n }\n }\n\n /**\n * Reset progress\n */\n reset() {\n this.stopProgressAnimation();\n this.currentPercentage = 0;\n }\n}\n\n// Create a singleton instance\nexport const initProgress = new InitializationProgress();\n","// Import only what's needed for initial page rendering\nimport { initProgress } from \"./components/timeoutUtils.js\";\nimport * as sentry from \"./components/sentry\";\nimport { localizeLoadingScreen } from \"./components/loadingScreenText\";\n\n// Resolve the EasyEyes base URL for the loading-screen phrases fetch. Kept\n// self-contained (no shared imports) so first.js stays a standalone bundle —\n// see loadPhrases below. Mirrors components/easyeyesBaseUrl.ts for the deployed\n// cases (preview-deploy param, production); a local dev server is assumed at\n// :8888 without probing, since the spinner falls back gracefully on failure.\nconst getBaseUrl = () => {\n const previewDeployBase = new URLSearchParams(window.location.search).get(\n \"preview-deploy\",\n );\n if (previewDeployBase) return previewDeployBase;\n if (window.location.hostname !== \"localhost\") return \"https://easyeyes.app\";\n return \"http://localhost:8888\";\n};\n\n// Load phrases for the loading screen from the same versioned read-path the\n// experiment uses. Inlined here (not imported from preprocess/phrases-loader,\n// which has a top-level await) so first.js bundles standalone — sharing a module\n// across that async boundary would split a chunk that Pavlovia does not deploy.\n// A single attempt is enough: setupInitialUI's .catch falls back to plain text.\nconst loadPhrases = async () => {\n const [username, experimentName] = window.location.pathname\n .split(\"/\")\n .filter(Boolean);\n const base = getBaseUrl();\n // Two-step read: resolve the (mutable, uncached) pin to a version, then fetch\n // the immutable payload by explicit ?v= — the same cacheable URL the\n // experiment loader uses. Single attempt: the .catch falls back to plain text.\n const pinnedRes = await fetch(\n `${base}/.netlify/functions/phrases?pinned=${username}/${experimentName}`,\n );\n if (!pinnedRes.ok)\n throw new Error(`phrases pin fetch failed: ${pinnedRes.status}`);\n const { version } = await pinnedRes.json();\n const res = await fetch(`${base}/.netlify/functions/phrases?v=${version}`);\n if (!res.ok) throw new Error(`phrases fetch failed: ${res.status}`);\n const data = await res.json();\n return data.phrases;\n};\n\n// Initial UI setup function - show spinner immediately\nconst setupInitialUI = () => {\n // experimentLanguageDirection is defined (alongside experimentLanguage) in\n // the compile-time generated js/experimentLanguage.js loaded by index.html;\n // it holds the _language's direction per the phrases' EE_LanguageDirection.\n // Set <body dir> so every HTML element inherits the experiment's text\n // direction by default. Guarded with typeof: experiments compiled before\n // this constant existed ship an experimentLanguage.js without it.\n document.body.setAttribute(\n \"dir\",\n typeof experimentLanguageDirection !== \"undefined\" &&\n String(experimentLanguageDirection).toLowerCase() === \"rtl\"\n ? \"rtl\"\n : \"ltr\",\n );\n\n // Start the progress animation immediately (no i18n needed)\n initProgress.startProgressAnimation();\n\n // Create loading indicator with spinner only (no text initially)\n const loadingElement = document.createElement(\"div\");\n loadingElement.className = \"loading-container\";\n loadingElement.innerHTML = `\n <div class=\"loading-content\">\n <div class=\"loading-spinner\"></div>\n <div class=\"loading-text\"></div>\n <div class=\"progress-bar\">\n <div class=\"progress-fill\" id=\"progressFill\"></div>\n </div>\n <div class=\"progress-percent\" id=\"progressPercent\">0%</div>\n <div id=\"timeoutMessage\" class=\"timeout-message\" style=\"display: none;\"></div>\n <button id=\"reloadButton\" class=\"reload-button\" style=\"display: none;\"></button>\n </div>\n `;\n document.body.appendChild(loadingElement);\n\n // Show the timeout message and reload button only once BOTH conditions hold:\n // the 10s timer has fired and phrases have loaded (so they have localized\n // text). Either side can be the last to happen, so each calls this helper.\n let phrasesLoaded = false;\n let timeoutReached = false;\n const maybeShowTimeoutUI = () => {\n if (!phrasesLoaded || !timeoutReached || !loadingElement.parentNode) return;\n const timeoutMessage = document.getElementById(\"timeoutMessage\");\n const reloadButton = document.getElementById(\"reloadButton\");\n if (timeoutMessage) {\n timeoutMessage.style.display = \"block\";\n }\n if (reloadButton) {\n reloadButton.style.display = \"block\";\n }\n };\n\n // Lazy-load i18n and update text elements once available\n loadPhrases()\n .then((phrases) => {\n // experimentLanguage is loaded in the index.html\n const text = localizeLoadingScreen(phrases, experimentLanguage);\n if (text) {\n // Update text elements (DOM already has them, just populate)\n const loadingText = loadingElement.querySelector(\".loading-text\");\n if (loadingText) {\n loadingText.textContent = text.loadingText;\n }\n const timeoutMessage = document.getElementById(\"timeoutMessage\");\n if (timeoutMessage) {\n timeoutMessage.textContent = text.timeoutMessage;\n }\n const reloadButton = document.getElementById(\"reloadButton\");\n if (reloadButton) {\n reloadButton.textContent = text.reloadButton;\n }\n phrasesLoaded = true;\n maybeShowTimeoutUI();\n }\n })\n .catch((err) => {\n console.warn(\"Failed to load phrases:\", err);\n const loadingText = loadingElement.querySelector(\".loading-text\");\n if (loadingText) {\n loadingText.textContent = \"Loading …\";\n }\n });\n\n // Setup timeout warning and reload button (10 seconds)\n const timeoutWarningTimer = setTimeout(() => {\n timeoutReached = true;\n maybeShowTimeoutUI();\n }, 10000);\n\n // Reload button click handler\n const reloadButton = document.getElementById(\"reloadButton\");\n if (reloadButton) {\n reloadButton.addEventListener(\"click\", () => {\n window.location.reload();\n });\n }\n\n // Listen for initialization progress updates\n window.addEventListener(\"threshold-init-progress\", (event) => {\n const { percentage } = event.detail;\n const progressFill = document.getElementById(\"progressFill\");\n const progressPercent = document.getElementById(\"progressPercent\");\n\n if (progressFill) {\n progressFill.style.width = percentage + \"%\";\n }\n if (progressPercent) {\n progressPercent.textContent = Math.round(percentage) + \"%\";\n }\n });\n\n // Extract loading screen removal function\n const removeLoadingScreen = () => {\n // Clear timeout timer\n clearTimeout(timeoutWarningTimer);\n\n // Stop progress animation and ensure progress bar shows 100%\n initProgress.stopProgressAnimation();\n initProgress.currentPercentage = 100;\n initProgress.notifyListeners();\n\n if (loadingElement.parentNode) {\n loadingElement.remove();\n }\n };\n\n // Expose globally for threshold.js (before threshold.js loads)\n window.removeLoadingScreen = removeLoadingScreen;\n\n // Show critical load error using Swal2 (loaded in index.html before first.js)\n window.showCriticalLoadError = (title, text) => {\n clearTimeout(timeoutWarningTimer);\n initProgress.stopProgressAnimation();\n if (typeof Swal !== \"undefined\") {\n Swal.fire({\n allowOutsideClick: false,\n icon: \"error\",\n title: title || \"Loading Failed\",\n text: text || \"Please refresh the page to try again.\",\n confirmButtonText: \"Refresh\",\n }).then(() => window.location.reload());\n }\n };\n\n // Remove loading screen when ready for UI (compatibility page)\n window.addEventListener(\"threshold-ready-for-ui\", () => {\n removeLoadingScreen(); // Delegates to extracted function\n });\n};\n\n// Run immediately\ndocument.addEventListener(\"DOMContentLoaded\", setupInitialUI);\n\n// Add some CSS for the loading screen\nconst style = document.createElement(\"style\");\nstyle.textContent = `\n body, html {\n margin: 0;\n padding: 0;\n }\n\n .loading-container {\n position: fixed;\n top: 0;\n left: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n transition: opacity 0.4s ease;\n padding: 0;\n margin: 0;\n height: 100vh;\n width: 100vw;\n background: white;\n z-index: 10000;\n }\n\n .loading-content {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 20px;\n width: 400px;\n max-width: 90vw;\n padding: 20px;\n }\n\n .loading-spinner {\n border: 5px solid #f3f3f3;\n border-top: 5px solid #3498db;\n border-radius: 50%;\n width: 50px;\n height: 50px;\n animation: spin 1s linear infinite;\n }\n\n .loading-text {\n font-size: 18px;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n color: #333;\n font-weight: 500;\n }\n\n .progress-bar {\n width: 100%;\n height: 8px;\n background: #e0e0e0;\n border-radius: 4px;\n overflow: hidden;\n }\n\n .progress-fill {\n height: 100%;\n background: #3498db;\n width: 0%;\n transition: width 0.3s ease;\n }\n\n .progress-percent {\n font-size: 14px;\n color: #666;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n }\n\n .progress-step {\n font-size: 12px;\n color: #999;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n min-height: 16px;\n }\n\n .timeout-message {\n font-size: 14px;\n color: #666;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n font-weight: 400;\n text-align: center;\n }\n\n .reload-button {\n background: #3498db;\n color: white;\n border: none;\n padding: 12px 24px;\n border-radius: 4px;\n font-size: 14px;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n font-weight: 500;\n cursor: pointer;\n transition: background 0.2s ease;\n }\n\n .reload-button:hover {\n background: #2980b9;\n }\n\n .reload-button:active {\n background: #1f618d;\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n\n .fade-out {\n opacity: 0;\n }\n\n /* Center-align Swal2 modal title and content for consistent alignment */\n .swal2-title,\n .swal2-html-container {\n text-align: center !important;\n }\n`;\ndocument.head.appendChild(style);\n\n// Export things that threshold.js might need\nexport { setupInitialUI };\n","type Phrases = Record<string, Record<string, string>>;\n\nexport interface LoadingScreenText {\n loadingText: string;\n timeoutMessage: string;\n reloadButton: string;\n}\n\n/**\n * Resolve the loading-screen strings for the experiment's language (as set in\n * index.html). Accepts either a language code (e.g. \"fr\") or, for backward\n * compatibility, the full English name. Returns null when nothing matches.\n */\nexport const localizeLoadingScreen = (\n phrases: Phrases,\n experimentLanguageName: string,\n): LoadingScreenText | null => {\n let lang: string | undefined;\n // _language now takes a language code; use it directly when it is one.\n if (\n experimentLanguageName &&\n Object.prototype.hasOwnProperty.call(\n phrases.EE_LanguageEnglishName,\n experimentLanguageName,\n )\n ) {\n lang = experimentLanguageName;\n } else {\n lang = Object.keys(phrases.EE_LanguageEnglishName).find(\n (key) => phrases.EE_LanguageEnglishName[key] === experimentLanguageName,\n );\n }\n if (!lang) return null;\n return {\n loadingText: phrases.RC_LoadingStudy[lang],\n timeoutMessage: phrases.RC_LoadingStudyTakingLonger[lang],\n reloadButton: phrases.RC_ReloadStudyButton[lang],\n };\n};\n"],"names":["initProgress","constructor","this","currentPercentage","listeners","progressIntervalId","startProgressAnimation","setInterval","increment","Math","random","min","notifyListeners","stopProgressAnimation","clearInterval","forEach","callback","window","dispatchEvent","CustomEvent","detail","percentage","round","reset","loadPhrases","async","username","experimentName","location","pathname","split","filter","Boolean","base","URLSearchParams","search","get","hostname","pinnedRes","fetch","ok","Error","status","version","json","res","phrases","document","addEventListener","body","setAttribute","experimentLanguageDirection","String","toLowerCase","loadingElement","createElement","className","innerHTML","appendChild","phrasesLoaded","timeoutReached","maybeShowTimeoutUI","parentNode","timeoutMessage","getElementById","reloadButton","style","display","then","text","experimentLanguageName","lang","Object","prototype","hasOwnProperty","call","EE_LanguageEnglishName","keys","find","key","loadingText","RC_LoadingStudy","RC_LoadingStudyTakingLonger","RC_ReloadStudyButton","localizeLoadingScreen","experimentLanguage","querySelector","textContent","catch","err","console","warn","timeoutWarningTimer","setTimeout","reload","event","progressFill","progressPercent","width","removeLoadingScreen","clearTimeout","remove","showCriticalLoadError","title","Swal","fire","allowOutsideClick","icon","confirmButtonText","head"],"mappings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,GACFA,EAAajB,iBAAiB,QAAS,KACrC/B,OAAOW,SAASkE,WAKpB7E,OAAO+B,iBAAiB,0BAA4B+C,IAClD,MAAM1E,WAAEA,GAAe0E,EAAM3E,OACvB4E,EAAejD,SAASiB,eAAe,gBACvCiC,EAAkBlD,SAASiB,eAAe,mBAE5CgC,IACFA,EAAa9B,MAAMgC,MAAQ7E,EAAa,KAEtC4E,IACFA,EAAgBV,YAAc9E,KAAKa,MAAMD,GAAc,OAK3D,MAAM8E,EAAsB,KAE1BC,aAAaR,GAGb5F,EAAaa,wBACbb,EAAaG,kBAAoB,IACjCH,EAAaY,kBAET0C,EAAeQ,YACjBR,EAAe+C,UAKnBpF,OAAOkF,oBAAsBA,EAG7BlF,OAAOqF,sBAAwB,CAACC,EAAOlC,KACrC+B,aAAaR,GACb5F,EAAaa,wBACO,oBAAT2F,MACTA,KAAKC,KAAK,CACRC,mBAAmB,EACnBC,KAAM,QACNJ,MAAOA,GAAS,iBAChBlC,KAAMA,GAAQ,wCACduC,kBAAmB,YAClBxC,KAAK,IAAMnD,OAAOW,SAASkE,WAKlC7E,OAAO+B,iBAAiB,yBAA0B,KAChDmD,QAQJ,MAAMjC,EAAQnB,SAASQ,cAAc,SACrCW,EAAMqB,YAAc,kyFAyHpBxC,SAAS8D,KAAKnD,YAAYQ"}
|
package/js/index.js
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const ffmpeg = createFFmpeg({
|
|
5
|
-
corePath: 'http://localhost:3000/ffmpeg-core.js',
|
|
6
|
-
});
|
|
7
|
-
`;const f=async(e,r)=>{i("info",`fetch ${e}`);const t=await (await fetch(e)).arrayBuffer();i("info",`${e} file size = ${t.byteLength} bytes`);const o=new Blob([t],{type:r}),a=URL.createObjectURL(o);return i("info",`${e} blob URL = ${a}`),a},l=Object.freeze(Object.defineProperty({__proto__:null,defaultOptions:o,fetchFile:async e=>{let r=e;if(void 0===e)return new Uint8Array;if("string"==typeof e)if(/data:_data\/([a-zA-Z]*);base64,([^"]*)/.test(e))r=atob(e.split(",")[1]).split("").map((e=>e.charCodeAt(0)));else{const t=await fetch(new URL(e,import.meta.url).href);r=await t.arrayBuffer()}else(e instanceof File||e instanceof Blob)&&(r=await (t=e,new Promise(((e,r)=>{const o=new FileReader;o.onload=()=>{e(o.result)},o.onerror=({target:{error:{code:e}}})=>{r(Error(`File could not be read! Code=${e}`))},o.readAsArrayBuffer(t)}))));var t;return new Uint8Array(r)},getCreateFFmpegCore:async({corePath:e,workerPath:r,wasmPath:t})=>{if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){if("string"!=typeof e)throw Error("corePath should be a string!");const o=new URL(e,import.meta.url).href,a=await f(o,"application/javascript"),n=await f(void 0!==t?t:o.replace("ffmpeg-core.js","ffmpeg-core.wasm"),"application/wasm"),l=await f(void 0!==r?r:o.replace("ffmpeg-core.js","ffmpeg-core.worker.js"),"application/javascript");return"undefined"==typeof createFFmpegCore?new Promise((e=>{if(globalThis.importScripts(a),"undefined"==typeof createFFmpegCore)throw Error(s(o));i("info","ffmpeg-core.js script loaded"),e({createFFmpegCore:createFFmpegCore,corePath:a,wasmPath:n,workerPath:l})})):(i("info","ffmpeg-core.js script is loaded already"),Promise.resolve({createFFmpegCore:createFFmpegCore,corePath:a,wasmPath:n,workerPath:l}))}if("string"!=typeof e)throw Error("corePath should be a string!");const o=new URL(e,import.meta.url).href,a=await f(o,"application/javascript"),n=await f(void 0!==t?t:o.replace("ffmpeg-core.js","ffmpeg-core.wasm"),"application/wasm"),l=await f(void 0!==r?r:o.replace("ffmpeg-core.js","ffmpeg-core.worker.js"),"application/javascript");return"undefined"==typeof createFFmpegCore?new Promise((e=>{const r=document.createElement("script"),t=()=>{if(r.removeEventListener("load",t),"undefined"==typeof createFFmpegCore)throw Error(s(o));i("info","ffmpeg-core.js script loaded"),e({createFFmpegCore:createFFmpegCore,corePath:a,wasmPath:n,workerPath:l})};r.src=a,r.type="text/javascript",r.addEventListener("load",t),document.getElementsByTagName("head")[0].appendChild(r)})):(i("info","ffmpeg-core.js script is loaded already"),Promise.resolve({createFFmpegCore:createFFmpegCore,corePath:a,wasmPath:n,workerPath:l}))}},Symbol.toStringTag,{value:"Module"})),c=e(l),{defaultArgs:p,baseOptions:m}={defaultArgs:["./ffmpeg","-nostdin","-y"],baseOptions:{log:!1,logger:()=>{},progress:()=>{},corePath:""}},d=(e,r)=>{const t=e._malloc(r.length*Uint32Array.BYTES_PER_ELEMENT);return r.forEach(((r,o)=>{const a=e.lengthBytesUTF8(r)+1,n=e._malloc(a);e.stringToUTF8(r,n,a),e.setValue(t+Uint32Array.BYTES_PER_ELEMENT*o,n,"i32")})),[r.length,t]},{defaultOptions:g,getCreateFFmpegCore:u}=c,{version:h}=t,w=Error("ffmpeg.wasm is not ready, make sure you have completed load().");const y=(e={})=>{const{log:r,logger:t,progress:o,...a}={...m,...g,...e};let n=null,i=null,s=null,f=null,l=!1,c=()=>{},y=r,F=o,b=0,P=0,v=!1,E=0;const j=(e,r)=>{c({type:e,message:r}),y&&console.log(`[${e}] ${r}`)},C=e=>{const[r,t,o]=e.split(":");return 60*parseFloat(r)*60+60*parseFloat(t)+parseFloat(o)},_=({type:e,message:r})=>{j(e,r),((e,r)=>{if("string"==typeof e)if(e.startsWith(" Duration")){const t=e.split(", ")[0].split(": ")[1],o=C(t);r({duration:o,ratio:E}),(0===b||b>o)&&(b=o,v=!0)}else if(v&&e.startsWith(" Stream")){const r=e.match(/([\d.]+) fps/);if(r){const e=parseFloat(r[1]);P=b*e}else P=0;v=!1}else if(e.startsWith("frame")||e.startsWith("size")){const t=e.split("time=")[1].split(" ")[0],o=C(t),a=e.match(/frame=\s*(\d+)/);if(P&&a){const e=parseFloat(a[1]);E=Math.min(e/P,1)}else E=o/b;r({ratio:E,time:o})}else e.startsWith("video:")&&(r({ratio:1}),b=0)})(r,F),(e=>{"FFMPEG_END"===e&&null!==s&&(s(),s=null,f=null,l=!1)})(r)};return j("info",`use ffmpeg.wasm v${h}`),{setProgress:e=>{F=e},setLogger:e=>{c=e},setLogging:e=>{y=e},load:async()=>{if(j("info","load ffmpeg-core"),null!==n)throw Error("ffmpeg.wasm was loaded, you should not load it again, use ffmpeg.isLoaded() to check next time.");{j("info","loading ffmpeg-core");const{createFFmpegCore:e,corePath:r,workerPath:t,wasmPath:o}=await u(a);n=await e({mainScriptUrlOrBlob:r,printErr:e=>_({type:"fferr",message:e}),print:e=>_({type:"ffout",message:e}),locateFile:(e,r)=>{if("undefined"!=typeof window||"undefined"!=typeof WorkerGlobalScope){if(void 0!==o&&e.endsWith("ffmpeg-core.wasm"))return o;if(void 0!==t&&e.endsWith("ffmpeg-core.worker.js"))return t}return r+e}}),i=n.cwrap(a.mainName||"proxy_main","number",["number","number"]),j("info","ffmpeg-core loaded")}},isLoaded:()=>null!==n,run:(...e)=>{if(j("info",`run ffmpeg command: ${e.join(" ")}`),null===n)throw w;if(l)throw Error("ffmpeg.wasm can only run one command at a time");return l=!0,new Promise(((r,t)=>{const o=[...p,...e].filter((e=>0!==e.length));s=r,f=t,i(...d(n,o))}))},exit:()=>{if(null===n)throw w;f&&f("ffmpeg has exited"),l=!1;try{n.exit(1)}catch(e){j(e.message),f&&f(e)}finally{n=null,i=null,s=null,f=null}},FS:(e,...r)=>{if(j("info",`run FS.${e} ${r.map((e=>"string"==typeof e?e:`<${e.length} bytes binary file>`)).join(" ")}`),null===n)throw w;{let o=null;try{o=n.FS[e](...r)}catch(t){throw"readdir"===e?Error(`ffmpeg.FS('readdir', '${r[0]}') error. Check if the path exists, ex: ffmpeg.FS('readdir', '/')`):"readFile"===e?Error(`ffmpeg.FS('readFile', '${r[0]}') error. Check if the path exists`):Error("Oops, something went wrong in FS operation.")}return o}}}},{fetchFile:F}=c;b=r({__proto__:null},[{createFFmpeg:y,fetchFile:F}])});export{b as i,__tla};
|
|
1
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},r=(new e.Error).stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="ec80782f-df47-43ea-9e86-3b6524e481b3",e._sentryDebugIdIdentifier="sentry-dbid-ec80782f-df47-43ea-9e86-3b6524e481b3")}catch(e){}}();import{a as e,r}from"./runtime.js";function t(e,r){for(var t=0;t<r.length;t++){const o=r[t];if("string"!=typeof o&&!Array.isArray(o))for(const r in o)if("default"!==r&&!(r in e)){const t=Object.getOwnPropertyDescriptor(o,r);t&&Object.defineProperty(e,r,t.get?t:{enumerable:!0,get:()=>o[r]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var o,a,n,i;function s(){return i?n:(i=1,n=(e,r)=>{const t=e._malloc(r.length*Uint32Array.BYTES_PER_ELEMENT);return r.forEach((r,o)=>{const a=e.lengthBytesUTF8(r)+1,n=e._malloc(a);e.stringToUTF8(r,n,a),e.setValue(t+Uint32Array.BYTES_PER_ELEMENT*o,n,"i32")}),[r.length,t]})}const f={version:"0.11.6",devDependencies:{"@ffmpeg/core":"^0.11.0"}},l={corePath:`https://unpkg.com/@ffmpeg/core@${f.devDependencies["@ffmpeg/core"].substring(1)}/dist/ffmpeg-core.js`};var c,p;var g,m,d=function(){if(p)return c;p=1;let e=!1,r=()=>{};return c={logging:e,setLogging:r=>{e=r},setCustomLogger:e=>{r=e},log:(t,o)=>{r({type:t,message:o}),e&&console.log(`[${t}] ${o}`)}}}();var u=(m||(m=1,g={CREATE_FFMPEG_CORE_IS_NOT_DEFINED:e=>`\ncreateFFmpegCore is not defined. ffmpeg.wasm is unable to find createFFmpegCore after loading ffmpeg-core.js from ${e}. Use another URL when calling createFFmpeg():\n\nconst ffmpeg = createFFmpeg({\n corePath: 'http://localhost:3000/ffmpeg-core.js',\n});\n`}),g);const h=async(e,r)=>{d.log("info",`fetch ${e}`);const t=await(await fetch(e)).arrayBuffer();d.log("info",`${e} file size = ${t.byteLength} bytes`);const o=new Blob([t],{type:r}),a=URL.createObjectURL(o);return d.log("info",`${e} blob URL = ${a}`),a},F=Object.freeze(Object.defineProperty({__proto__:null,defaultOptions:l,fetchFile:async e=>{let r=e;if(void 0===e)return new Uint8Array;if("string"==typeof e)if(/data:_data\/([a-zA-Z]*);base64,([^"]*)/.test(e))r=atob(e.split(",")[1]).split("").map(e=>e.charCodeAt(0));else{const t=await fetch(new URL(e,import.meta.url).href);r=await t.arrayBuffer()}else(e instanceof File||e instanceof Blob)&&(r=await(t=e,new Promise((e,r)=>{const o=new FileReader;o.onload=()=>{e(o.result)},o.onerror=({target:{error:{code:e}}})=>{r(Error(`File could not be read! Code=${e}`))},o.readAsArrayBuffer(t)})));var t;return new Uint8Array(r)},getCreateFFmpegCore:async({corePath:e,workerPath:r,wasmPath:t})=>{if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){if("string"!=typeof e)throw Error("corePath should be a string!");const o=new URL(e,import.meta.url).href,a=await h(o,"application/javascript"),n=await h(void 0!==t?t:o.replace("ffmpeg-core.js","ffmpeg-core.wasm"),"application/wasm"),i=await h(void 0!==r?r:o.replace("ffmpeg-core.js","ffmpeg-core.worker.js"),"application/javascript");return"undefined"==typeof createFFmpegCore?new Promise(e=>{if(globalThis.importScripts(a),"undefined"==typeof createFFmpegCore)throw Error(u.CREATE_FFMPEG_CORE_IS_NOT_DEFINED(o));d.log("info","ffmpeg-core.js script loaded"),e({createFFmpegCore:createFFmpegCore,corePath:a,wasmPath:n,workerPath:i})}):(d.log("info","ffmpeg-core.js script is loaded already"),Promise.resolve({createFFmpegCore:createFFmpegCore,corePath:a,wasmPath:n,workerPath:i}))}if("string"!=typeof e)throw Error("corePath should be a string!");const o=new URL(e,import.meta.url).href,a=await h(o,"application/javascript"),n=await h(void 0!==t?t:o.replace("ffmpeg-core.js","ffmpeg-core.wasm"),"application/wasm"),i=await h(void 0!==r?r:o.replace("ffmpeg-core.js","ffmpeg-core.worker.js"),"application/javascript");return"undefined"==typeof createFFmpegCore?new Promise(e=>{const r=document.createElement("script"),t=()=>{if(r.removeEventListener("load",t),"undefined"==typeof createFFmpegCore)throw Error(u.CREATE_FFMPEG_CORE_IS_NOT_DEFINED(o));d.log("info","ffmpeg-core.js script loaded"),e({createFFmpegCore:createFFmpegCore,corePath:a,wasmPath:n,workerPath:i})};r.src=a,r.type="text/javascript",r.addEventListener("load",t),document.getElementsByTagName("head")[0].appendChild(r)}):(d.log("info","ffmpeg-core.js script is loaded already"),Promise.resolve({createFFmpegCore:createFFmpegCore,corePath:a,wasmPath:n,workerPath:i}))}},Symbol.toStringTag,{value:"Module"})),w=e(F);var y,b,E,P;function _(){if(b)return y;b=1;const{defaultArgs:e,baseOptions:r}=a?o:(a=1,o={defaultArgs:["./ffmpeg","-nostdin","-y"],baseOptions:{log:!1,logger:()=>{},progress:()=>{},corePath:""}}),t=s(),{defaultOptions:n,getCreateFFmpegCore:i}=w,{version:l}=f,c=Error("ffmpeg.wasm is not ready, make sure you have completed load().");return y=(o={})=>{const{log:a,logger:s,progress:f,...p}={...r,...n,...o};let g=null,m=null,d=null,u=null,h=!1,F=()=>{},w=a,y=f,b=0,E=0,P=!1,_=0;const v=(e,r)=>{F({type:e,message:r}),w&&console.log(`[${e}] ${r}`)},C=e=>{const[r,t,o]=e.split(":");return 60*parseFloat(r)*60+60*parseFloat(t)+parseFloat(o)},j=({type:e,message:r})=>{v(e,r),((e,r)=>{if("string"==typeof e)if(e.startsWith(" Duration")){const t=e.split(", ")[0].split(": ")[1],o=C(t);r({duration:o,ratio:_}),(0===b||b>o)&&(b=o,P=!0)}else if(P&&e.startsWith(" Stream")){const r=e.match(/([\d.]+) fps/);if(r){const e=parseFloat(r[1]);E=b*e}else E=0;P=!1}else if(e.startsWith("frame")||e.startsWith("size")){const t=e.split("time=")[1].split(" ")[0],o=C(t),a=e.match(/frame=\s*(\d+)/);if(E&&a){const e=parseFloat(a[1]);_=Math.min(e/E,1)}else _=o/b;r({ratio:_,time:o})}else e.startsWith("video:")&&(r({ratio:1}),b=0)})(r,y),(e=>{"FFMPEG_END"===e&&null!==d&&(d(),d=null,u=null,h=!1)})(r)};return v("info",`use ffmpeg.wasm v${l}`),{setProgress:e=>{y=e},setLogger:e=>{F=e},setLogging:e=>{w=e},load:async()=>{if(v("info","load ffmpeg-core"),null!==g)throw Error("ffmpeg.wasm was loaded, you should not load it again, use ffmpeg.isLoaded() to check next time.");{v("info","loading ffmpeg-core");const{createFFmpegCore:e,corePath:r,workerPath:t,wasmPath:o}=await i(p);g=await e({mainScriptUrlOrBlob:r,printErr:e=>j({type:"fferr",message:e}),print:e=>j({type:"ffout",message:e}),locateFile:(e,r)=>{if("undefined"!=typeof window||"undefined"!=typeof WorkerGlobalScope){if(void 0!==o&&e.endsWith("ffmpeg-core.wasm"))return o;if(void 0!==t&&e.endsWith("ffmpeg-core.worker.js"))return t}return r+e}}),m=g.cwrap(p.mainName||"proxy_main","number",["number","number"]),v("info","ffmpeg-core loaded")}},isLoaded:()=>null!==g,run:(...r)=>{if(v("info",`run ffmpeg command: ${r.join(" ")}`),null===g)throw c;if(h)throw Error("ffmpeg.wasm can only run one command at a time");return h=!0,new Promise((o,a)=>{const n=[...e,...r].filter(e=>0!==e.length);d=o,u=a,m(...t(g,n))})},exit:()=>{if(null===g)throw c;u&&u("ffmpeg has exited"),h=!1;try{g.exit(1)}catch(e){v(e.message),u&&u(e)}finally{g=null,m=null,d=null,u=null}},FS:(e,...r)=>{if(v("info",`run FS.${e} ${r.map(e=>"string"==typeof e?e:`<${e.length} bytes binary file>`).join(" ")}`),null===g)throw c;{let o=null;try{o=g.FS[e](...r)}catch(t){throw"readdir"===e?Error(`ffmpeg.FS('readdir', '${r[0]}') error. Check if the path exists, ex: ffmpeg.FS('readdir', '/')`):"readFile"===e?Error(`ffmpeg.FS('readFile', '${r[0]}') error. Check if the path exists`):Error("Oops, something went wrong in FS operation.")}return o}}}},y}var v=function(){if(P)return E;P=1,r();const e=_(),{fetchFile:t}=w;return E={createFFmpeg:e,fetchFile:t}}();const C=t({__proto__:null},[v]);export{C as i};
|
|
2
|
+
//# sourceMappingURL=index.min.js.map
|
package/js/index.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../node_modules/@ffmpeg/ffmpeg/src/browser/defaultOptions.js","../node_modules/@ffmpeg/ffmpeg/src/utils/log.js","../node_modules/@ffmpeg/ffmpeg/src/utils/errors.js","../node_modules/@ffmpeg/ffmpeg/src/browser/getCreateFFmpegCore.js","../node_modules/@ffmpeg/ffmpeg/src/browser/fetchFile.js","../node_modules/@ffmpeg/ffmpeg/src/createFFmpeg.js","../node_modules/@ffmpeg/ffmpeg/src/config.js","../node_modules/@ffmpeg/ffmpeg/src/utils/parseArgs.js","../node_modules/@ffmpeg/ffmpeg/src/index.js"],"sourcesContent":["import pkg from '../../package.json';\n\n/*\n * Default options for browser environment\n */\nconst corePath = typeof process !== 'undefined' && process.env.NODE_ENV === 'development'\n ? new URL('/node_modules/@ffmpeg/core/dist/ffmpeg-core.js', import.meta.url).href\n : `https://unpkg.com/@ffmpeg/core@${pkg.devDependencies['@ffmpeg/core'].substring(1)}/dist/ffmpeg-core.js`;\n\nexport default { corePath };\n","let logging = false;\nlet customLogger = () => {};\n\nconst setLogging = (_logging) => {\n logging = _logging;\n};\n\nconst setCustomLogger = (logger) => {\n customLogger = logger;\n};\n\nconst log = (type, message) => {\n customLogger({ type, message });\n if (logging) {\n console.log(`[${type}] ${message}`);\n }\n};\n\nmodule.exports = {\n logging,\n setLogging,\n setCustomLogger,\n log,\n};\n","const CREATE_FFMPEG_CORE_IS_NOT_DEFINED = (corePath) => (`\ncreateFFmpegCore is not defined. ffmpeg.wasm is unable to find createFFmpegCore after loading ffmpeg-core.js from ${corePath}. Use another URL when calling createFFmpeg():\n\nconst ffmpeg = createFFmpeg({\n corePath: 'http://localhost:3000/ffmpeg-core.js',\n});\n`);\n\nmodule.exports = {\n CREATE_FFMPEG_CORE_IS_NOT_DEFINED,\n};\n","/* eslint-disable no-undef */\nimport { log } from '../utils/log';\nimport {\n CREATE_FFMPEG_CORE_IS_NOT_DEFINED,\n} from '../utils/errors';\n\n/*\n * Fetch data from remote URL and convert to blob URL\n * to avoid CORS issue\n */\nconst toBlobURL = async (url, mimeType) => {\n log('info', `fetch ${url}`);\n const buf = await (await fetch(url)).arrayBuffer();\n log('info', `${url} file size = ${buf.byteLength} bytes`);\n const blob = new Blob([buf], { type: mimeType });\n const blobURL = URL.createObjectURL(blob);\n log('info', `${url} blob URL = ${blobURL}`);\n return blobURL;\n};\n\n// eslint-disable-next-line\nexport const getCreateFFmpegCore = async ({\n corePath: _corePath,\n workerPath: _workerPath,\n wasmPath: _wasmPath,\n}) => {\n // in Web Worker context\n // eslint-disable-next-line\n if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {\n if (typeof _corePath !== 'string') {\n throw Error('corePath should be a string!');\n }\n const coreRemotePath = new URL(_corePath, import.meta.url).href;\n const corePath = await toBlobURL(\n coreRemotePath,\n 'application/javascript',\n );\n const wasmPath = await toBlobURL(\n _wasmPath !== undefined ? _wasmPath : coreRemotePath.replace('ffmpeg-core.js', 'ffmpeg-core.wasm'),\n 'application/wasm',\n );\n const workerPath = await toBlobURL(\n _workerPath !== undefined ? _workerPath : coreRemotePath.replace('ffmpeg-core.js', 'ffmpeg-core.worker.js'),\n 'application/javascript',\n );\n if (typeof createFFmpegCore === 'undefined') {\n return new Promise((resolve) => {\n globalThis.importScripts(corePath);\n if (typeof createFFmpegCore === 'undefined') {\n throw Error(CREATE_FFMPEG_CORE_IS_NOT_DEFINED(coreRemotePath));\n }\n log('info', 'ffmpeg-core.js script loaded');\n resolve({\n createFFmpegCore,\n corePath,\n wasmPath,\n workerPath,\n });\n });\n }\n log('info', 'ffmpeg-core.js script is loaded already');\n return Promise.resolve({\n createFFmpegCore,\n corePath,\n wasmPath,\n workerPath,\n });\n }\n if (typeof _corePath !== 'string') {\n throw Error('corePath should be a string!');\n }\n const coreRemotePath = new URL(_corePath, import.meta.url).href;\n const corePath = await toBlobURL(\n coreRemotePath,\n 'application/javascript',\n );\n const wasmPath = await toBlobURL(\n _wasmPath !== undefined ? _wasmPath : coreRemotePath.replace('ffmpeg-core.js', 'ffmpeg-core.wasm'),\n 'application/wasm',\n );\n const workerPath = await toBlobURL(\n _workerPath !== undefined ? _workerPath : coreRemotePath.replace('ffmpeg-core.js', 'ffmpeg-core.worker.js'),\n 'application/javascript',\n );\n if (typeof createFFmpegCore === 'undefined') {\n return new Promise((resolve) => {\n const script = document.createElement('script');\n const eventHandler = () => {\n script.removeEventListener('load', eventHandler);\n if (typeof createFFmpegCore === 'undefined') {\n throw Error(CREATE_FFMPEG_CORE_IS_NOT_DEFINED(coreRemotePath));\n }\n log('info', 'ffmpeg-core.js script loaded');\n resolve({\n createFFmpegCore,\n corePath,\n wasmPath,\n workerPath,\n });\n };\n script.src = corePath;\n script.type = 'text/javascript';\n script.addEventListener('load', eventHandler);\n document.getElementsByTagName('head')[0].appendChild(script);\n });\n }\n log('info', 'ffmpeg-core.js script is loaded already');\n return Promise.resolve({\n createFFmpegCore,\n corePath,\n wasmPath,\n workerPath,\n });\n};\n","const readFromBlobOrFile = (blob) => (\n new Promise((resolve, reject) => {\n const fileReader = new FileReader();\n fileReader.onload = () => {\n resolve(fileReader.result);\n };\n fileReader.onerror = ({ target: { error: { code } } }) => {\n reject(Error(`File could not be read! Code=${code}`));\n };\n fileReader.readAsArrayBuffer(blob);\n })\n);\n\n// eslint-disable-next-line\nexport const fetchFile = async (_data) => {\n let data = _data;\n if (typeof _data === 'undefined') {\n return new Uint8Array();\n }\n\n if (typeof _data === 'string') {\n /* From base64 format */\n if (/data:_data\\/([a-zA-Z]*);base64,([^\"]*)/.test(_data)) {\n data = atob(_data.split(',')[1])\n .split('')\n .map((c) => c.charCodeAt(0));\n /* From remote server/URL */\n } else {\n const res = await fetch(new URL(_data, import.meta.url).href);\n data = await res.arrayBuffer();\n }\n /* From Blob or File */\n } else if (_data instanceof File || _data instanceof Blob) {\n data = await readFromBlobOrFile(_data);\n }\n\n return new Uint8Array(data);\n};\n","const { defaultArgs, baseOptions } = require('./config');\nconst parseArgs = require('./utils/parseArgs');\nconst { defaultOptions, getCreateFFmpegCore } = require('./node');\nconst { version } = require('../package.json');\n\nconst NO_LOAD = Error('ffmpeg.wasm is not ready, make sure you have completed load().');\n\nmodule.exports = (_options = {}) => {\n const {\n log: optLog,\n logger,\n progress: optProgress,\n ...options\n } = {\n ...baseOptions,\n ...defaultOptions,\n ..._options,\n };\n let Core = null;\n let ffmpeg = null;\n let runResolve = null;\n let runReject = null;\n let running = false;\n let customLogger = () => {};\n let logging = optLog;\n let progress = optProgress;\n let duration = 0;\n let frames = 0;\n let readFrames = false;\n let ratio = 0;\n\n const detectCompletion = (message) => {\n if (message === 'FFMPEG_END' && runResolve !== null) {\n runResolve();\n runResolve = null;\n runReject = null;\n running = false;\n }\n };\n const log = (type, message) => {\n customLogger({ type, message });\n if (logging) {\n console.log(`[${type}] ${message}`);\n }\n };\n const ts2sec = (ts) => {\n const [h, m, s] = ts.split(':');\n return (parseFloat(h) * 60 * 60) + (parseFloat(m) * 60) + parseFloat(s);\n };\n const parseProgress = (message, prog) => {\n if (typeof message === 'string') {\n if (message.startsWith(' Duration')) {\n const ts = message.split(', ')[0].split(': ')[1];\n const d = ts2sec(ts);\n prog({ duration: d, ratio });\n if (duration === 0 || duration > d) {\n duration = d;\n readFrames = true;\n }\n } else if (readFrames && message.startsWith(' Stream')) {\n const match = message.match(/([\\d.]+) fps/);\n if (match) {\n const fps = parseFloat(match[1]);\n frames = duration * fps;\n } else {\n frames = 0;\n }\n readFrames = false;\n } else if (message.startsWith('frame') || message.startsWith('size')) {\n const ts = message.split('time=')[1].split(' ')[0];\n const t = ts2sec(ts);\n const match = message.match(/frame=\\s*(\\d+)/);\n if (frames && match) {\n const f = parseFloat(match[1]);\n ratio = Math.min(f / frames, 1);\n } else {\n ratio = t / duration;\n }\n prog({ ratio, time: t });\n } else if (message.startsWith('video:')) {\n prog({ ratio: 1 });\n duration = 0;\n }\n }\n };\n const parseMessage = ({ type, message }) => {\n log(type, message);\n parseProgress(message, progress);\n detectCompletion(message);\n };\n\n /*\n * Load ffmpeg.wasm-core script.\n * In browser environment, the ffmpeg.wasm-core script is fetch from\n * CDN and can be assign to a local path by assigning `corePath`.\n * In node environment, we use dynamic require and the default `corePath`\n * is `$ffmpeg/core`.\n *\n * Typically the load() func might take few seconds to minutes to complete,\n * better to do it as early as possible.\n *\n */\n const load = async () => {\n log('info', 'load ffmpeg-core');\n if (Core === null) {\n log('info', 'loading ffmpeg-core');\n /*\n * In node environment, all paths are undefined as there\n * is no need to set them.\n */\n const {\n createFFmpegCore,\n corePath,\n workerPath,\n wasmPath,\n } = await getCreateFFmpegCore(options);\n Core = await createFFmpegCore({\n /*\n * Assign mainScriptUrlOrBlob fixes chrome extension web worker issue\n * as there is no document.currentScript in the context of content_scripts\n */\n mainScriptUrlOrBlob: corePath,\n printErr: (message) => parseMessage({ type: 'fferr', message }),\n print: (message) => parseMessage({ type: 'ffout', message }),\n /*\n * locateFile overrides paths of files that is loaded by main script (ffmpeg-core.js).\n * It is critical for browser environment and we override both wasm and worker paths\n * as we are using blob URL instead of original URL to avoid cross origin issues.\n */\n locateFile: (path, prefix) => {\n if (typeof window !== 'undefined' || typeof WorkerGlobalScope !== 'undefined') {\n if (typeof wasmPath !== 'undefined'\n && path.endsWith('ffmpeg-core.wasm')) {\n return wasmPath;\n }\n if (typeof workerPath !== 'undefined'\n && path.endsWith('ffmpeg-core.worker.js')) {\n return workerPath;\n }\n }\n return prefix + path;\n },\n });\n ffmpeg = Core.cwrap(options.mainName || 'proxy_main', 'number', ['number', 'number']);\n log('info', 'ffmpeg-core loaded');\n } else {\n throw Error('ffmpeg.wasm was loaded, you should not load it again, use ffmpeg.isLoaded() to check next time.');\n }\n };\n\n /*\n * Determine whether the Core is loaded.\n */\n const isLoaded = () => Core !== null;\n\n /*\n * Run ffmpeg command.\n * This is the major function in ffmpeg.wasm, you can just imagine it\n * as ffmpeg native cli and what you need to pass is the same.\n *\n * For example, you can convert native command below:\n *\n * ```\n * $ ffmpeg -i video.avi -c:v libx264 video.mp4\n * ```\n *\n * To\n *\n * ```\n * await ffmpeg.run('-i', 'video.avi', '-c:v', 'libx264', 'video.mp4');\n * ```\n *\n */\n const run = (..._args) => {\n log('info', `run ffmpeg command: ${_args.join(' ')}`);\n if (Core === null) {\n throw NO_LOAD;\n } else if (running) {\n throw Error('ffmpeg.wasm can only run one command at a time');\n } else {\n running = true;\n return new Promise((resolve, reject) => {\n const args = [...defaultArgs, ..._args].filter((s) => s.length !== 0);\n runResolve = resolve;\n runReject = reject;\n ffmpeg(...parseArgs(Core, args));\n });\n }\n };\n\n /*\n * Run FS operations.\n * For input/output file of ffmpeg.wasm, it is required to save them to MEMFS\n * first so that ffmpeg.wasm is able to consume them. Here we rely on the FS\n * methods provided by Emscripten.\n *\n * Common methods to use are:\n * ffmpeg.FS('writeFile', 'video.avi', new Uint8Array(...)): writeFile writes\n * data to MEMFS. You need to use Uint8Array for binary data.\n * ffmpeg.FS('readFile', 'video.mp4'): readFile from MEMFS.\n * ffmpeg.FS('unlink', 'video.map'): delete file from MEMFS.\n *\n * For more info, check https://emscripten.org/docs/api_reference/Filesystem-API.html\n *\n */\n const FS = (method, ...args) => {\n log('info', `run FS.${method} ${args.map((arg) => (typeof arg === 'string' ? arg : `<${arg.length} bytes binary file>`)).join(' ')}`);\n if (Core === null) {\n throw NO_LOAD;\n } else {\n let ret = null;\n try {\n ret = Core.FS[method](...args);\n } catch (e) {\n if (method === 'readdir') {\n throw Error(`ffmpeg.FS('readdir', '${args[0]}') error. Check if the path exists, ex: ffmpeg.FS('readdir', '/')`);\n } else if (method === 'readFile') {\n throw Error(`ffmpeg.FS('readFile', '${args[0]}') error. Check if the path exists`);\n } else {\n throw Error('Oops, something went wrong in FS operation.');\n }\n }\n return ret;\n }\n };\n\n /**\n * forcibly terminate the ffmpeg program.\n */\n const exit = () => {\n if (Core === null) {\n throw NO_LOAD;\n } else {\n // if there's any pending runs, reject them\n if (runReject) {\n runReject('ffmpeg has exited');\n }\n running = false;\n try {\n Core.exit(1);\n } catch (err) {\n log(err.message);\n if (runReject) {\n runReject(err);\n }\n } finally {\n Core = null;\n ffmpeg = null;\n runResolve = null;\n runReject = null;\n }\n }\n };\n\n const setProgress = (_progress) => {\n progress = _progress;\n };\n\n const setLogger = (_logger) => {\n customLogger = _logger;\n };\n\n const setLogging = (_logging) => {\n logging = _logging;\n };\n\n log('info', `use ffmpeg.wasm v${version}`);\n\n return {\n setProgress,\n setLogger,\n setLogging,\n load,\n isLoaded,\n run,\n exit,\n FS,\n };\n};\n","module.exports = {\n defaultArgs: [\n /* args[0] is always the binary path */\n './ffmpeg',\n /* Disable interaction mode */\n '-nostdin',\n /* Force to override output file */\n '-y',\n ],\n baseOptions: {\n /* Flag to turn on/off log messages in console */\n log: false,\n /*\n * Custom logger to get ffmpeg.wasm output messages.\n * a sample logger looks like this:\n *\n * ```\n * logger = ({ type, message }) => {\n * console.log(type, message);\n * }\n * ```\n *\n * type can be one of following:\n *\n * info: internal workflow debug messages\n * fferr: ffmpeg native stderr output\n * ffout: ffmpeg native stdout output\n */\n logger: () => {},\n /*\n * Progress handler to get current progress of ffmpeg command.\n * a sample progress handler looks like this:\n *\n * ```\n * progress = ({ ratio }) => {\n * console.log(ratio);\n * }\n * ```\n *\n * ratio is a float number between 0 to 1.\n */\n progress: () => {},\n /*\n * Path to find/download ffmpeg.wasm-core,\n * this value should be overwriten by `defaultOptions` in\n * each environment.\n */\n corePath: '',\n },\n};\n","module.exports = (Core, args) => {\n const argsPtr = Core._malloc(args.length * Uint32Array.BYTES_PER_ELEMENT);\n args.forEach((s, idx) => {\n const sz = Core.lengthBytesUTF8(s) + 1;\n const buf = Core._malloc(sz);\n Core.stringToUTF8(s, buf, sz);\n Core.setValue(argsPtr + (Uint32Array.BYTES_PER_ELEMENT * idx), buf, 'i32');\n });\n return [args.length, argsPtr];\n};\n","require('regenerator-runtime/runtime');\nconst createFFmpeg = require('./createFFmpeg');\nconst { fetchFile } = require('./node');\n\nmodule.exports = {\n /*\n * Create ffmpeg instance.\n * Each ffmpeg instance owns an isolated MEMFS and works\n * independently.\n *\n * For example:\n *\n * ```\n * const ffmpeg = createFFmpeg({\n * log: true,\n * logger: () => {},\n * progress: () => {},\n * corePath: '',\n * })\n * ```\n *\n * For the usage of these four arguments, check config.js\n *\n */\n createFFmpeg,\n /*\n * Helper function for fetching files from various resource.\n * Sometimes the video/audio file you want to process may located\n * in a remote URL and somewhere in your local file system.\n *\n * This helper function helps you to fetch to file and return an\n * Uint8Array variable for ffmpeg.wasm to consume.\n *\n */\n fetchFile,\n};\n"],"names":["defaultOptions$1","corePath","pkg","devDependencies","substring","logging","customLogger","log_1","type","message","console","log","errors","toBlobURL","async","url","mimeType","buf","fetch","arrayBuffer","byteLength","blob","Blob","blobURL","URL","createObjectURL","_data","data","Uint8Array","test","atob","split","map","c","charCodeAt","res","href","File","Promise","resolve","reject","fileReader","FileReader","onload","result","onerror","target","error","code","Error","readAsArrayBuffer","_corePath","workerPath","_workerPath","wasmPath","_wasmPath","WorkerGlobalScope","self","coreRemotePath","undefined","replace","createFFmpegCore","globalThis","importScripts","CREATE_FFMPEG_CORE_IS_NOT_DEFINED","script","document","createElement","eventHandler","removeEventListener","src","addEventListener","getElementsByTagName","appendChild","defaultArgs","baseOptions","logger","progress","parseArgs","Core","args","argsPtr","_malloc","length","Uint32Array","BYTES_PER_ELEMENT","forEach","s","idx","sz","lengthBytesUTF8","stringToUTF8","setValue","defaultOptions","getCreateFFmpegCore","require$$2","version","require$$3","NO_LOAD","createFFmpeg","_options","optLog","optProgress","options","ffmpeg","runResolve","runReject","running","duration","frames","readFrames","ratio","ts2sec","ts","h","m","parseFloat","parseMessage","prog","startsWith","d","match","fps","t","f","Math","min","time","parseProgress","detectCompletion","setProgress","_progress","setLogger","_logger","setLogging","_logging","load","mainScriptUrlOrBlob","printErr","print","locateFile","path","prefix","window","endsWith","cwrap","mainName","isLoaded","run","_args","join","filter","exit","err","FS","method","arg","ret","e","fetchFile"],"mappings":"i0BASAA,EAAe,CAAEC,SAFb,kCAAkCC,EAAIC,gBAAgB,gBAAgBC,UAAU,0BCPpF,IAAIC,GAAU,EACVC,EAAe,OAiBnB,IAAAC,EAPY,CAACC,EAAMC,KACjBH,EAAa,CAAEE,OAAMC,YACjBJ,GACFK,QAAQC,IAAI,IAAIH,MAASC,IAC7B,ECPA,IAAAG,EAR2CX,GAAQ,uHACiEA,+ICSpH,MAAMY,EAAYC,MAAOC,EAAKC,KAC5BL,EAAI,OAAQ,SAASI,KACrB,MAAME,cAAmBC,MAAMH,IAAMI,cACrCR,EAAI,OAAQ,GAAGI,iBAAmBE,EAAIG,oBACtC,MAAMC,EAAO,IAAIC,KAAK,CAACL,GAAM,CAAET,KAAMQ,IAC/BO,EAAUC,IAAIC,gBAAgBJ,GAEpC,OADAV,EAAI,OAAQ,GAAGI,gBAAkBQ,KAC1BA,CAAO,mFCHST,MAAOY,IAC9B,IAAIC,EAAOD,EACX,QAAqB,IAAVA,EACT,OAAO,IAAIE,WAGb,GAAqB,iBAAVF,EAET,GAAI,yCAAyCG,KAAKH,GAChDC,EAAOG,KAAKJ,EAAMK,MAAM,KAAK,IAC1BA,MAAM,IACNC,KAAKC,GAAMA,EAAEC,WAAW,SAEtB,CACL,MAAMC,QAAYjB,MAAM,IAAIM,IAAIE,cAAmBX,KAAKqB,MACxDT,QAAaQ,EAAIhB,aACnB,MAESO,aAAiBW,MAAQX,aAAiBJ,QACnDK,QAjCwBN,EAiCQK,EAjCJ,IAC1BY,SAAQ,CAACC,EAASC,KACpB,MAAMC,EAAa,IAAIC,WACvBD,EAAWE,OAAS,KAClBJ,EAAQE,EAAWG,OAAO,EAE5BH,EAAWI,QAAU,EAAGC,QAAUC,OAASC,aACzCR,EAAOS,MAAM,gCAAgCD,KA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,EAAU,qBAEZC,GAAU,EACV,IACE5B,EAAKyE,KAAK,EAClB,CAAQ,MAAOC,GACP9I,EAAI8I,EAAIhJ,SACJiG,GACFA,EAAU+C,EAEpB,CAAO,QACC1E,EAAO,KACPyB,EAAS,KACTC,EAAa,KACbC,EAAY,IACpB,CACA,EAyBIgD,GAvES,CAACC,KAAW3E,KAErB,GADArE,EAAI,OAAQ,UAAUgJ,KAAU3E,EAAKhD,KAAK4H,GAAwB,iBAARA,EAAmBA,EAAM,IAAIA,EAAIzE,8BAA8BmE,KAAK,QACjH,OAATvE,EACF,MAAMmB,EACD,CACL,IAAI2D,EAAM,KACV,IACEA,EAAM9E,EAAK2E,GAAGC,MAAW3E,EACjC,CAAQ,MAAO8E,GACP,KAAe,YAAXH,EACI1G,MAAM,yBAAyB+B,EAAK,uEACtB,aAAX2E,EACH1G,MAAM,0BAA0B+B,EAAK,wCAErC/B,MAAM,8CAEtB,CACM,OAAO4G,CACb,GAsDG,GGnRGE,UAAEA,GAAchE,8BAEL,CAoBfI,eAUA4D","x_google_ignoreList":[0,1,2,3,4,5,6,7,8]}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../node_modules/@ffmpeg/ffmpeg/src/utils/parseArgs.js","../node_modules/@ffmpeg/ffmpeg/src/browser/defaultOptions.js","../node_modules/@ffmpeg/ffmpeg/src/utils/log.js","../node_modules/@ffmpeg/ffmpeg/src/utils/errors.js","../node_modules/@ffmpeg/ffmpeg/src/browser/getCreateFFmpegCore.js","../node_modules/@ffmpeg/ffmpeg/src/browser/fetchFile.js","../node_modules/@ffmpeg/ffmpeg/src/createFFmpeg.js","../node_modules/@ffmpeg/ffmpeg/src/config.js","../node_modules/@ffmpeg/ffmpeg/src/index.js"],"sourcesContent":["module.exports = (Core, args) => {\n const argsPtr = Core._malloc(args.length * Uint32Array.BYTES_PER_ELEMENT);\n args.forEach((s, idx) => {\n const sz = Core.lengthBytesUTF8(s) + 1;\n const buf = Core._malloc(sz);\n Core.stringToUTF8(s, buf, sz);\n Core.setValue(argsPtr + (Uint32Array.BYTES_PER_ELEMENT * idx), buf, 'i32');\n });\n return [args.length, argsPtr];\n};\n","import pkg from '../../package.json';\n\n/*\n * Default options for browser environment\n */\nconst corePath = typeof process !== 'undefined' && process.env.NODE_ENV === 'development'\n ? new URL('/node_modules/@ffmpeg/core/dist/ffmpeg-core.js', import.meta.url).href\n : `https://unpkg.com/@ffmpeg/core@${pkg.devDependencies['@ffmpeg/core'].substring(1)}/dist/ffmpeg-core.js`;\n\nexport default { corePath };\n","let logging = false;\nlet customLogger = () => {};\n\nconst setLogging = (_logging) => {\n logging = _logging;\n};\n\nconst setCustomLogger = (logger) => {\n customLogger = logger;\n};\n\nconst log = (type, message) => {\n customLogger({ type, message });\n if (logging) {\n console.log(`[${type}] ${message}`);\n }\n};\n\nmodule.exports = {\n logging,\n setLogging,\n setCustomLogger,\n log,\n};\n","const CREATE_FFMPEG_CORE_IS_NOT_DEFINED = (corePath) => (`\ncreateFFmpegCore is not defined. ffmpeg.wasm is unable to find createFFmpegCore after loading ffmpeg-core.js from ${corePath}. Use another URL when calling createFFmpeg():\n\nconst ffmpeg = createFFmpeg({\n corePath: 'http://localhost:3000/ffmpeg-core.js',\n});\n`);\n\nmodule.exports = {\n CREATE_FFMPEG_CORE_IS_NOT_DEFINED,\n};\n","/* eslint-disable no-undef */\nimport { log } from '../utils/log';\nimport {\n CREATE_FFMPEG_CORE_IS_NOT_DEFINED,\n} from '../utils/errors';\n\n/*\n * Fetch data from remote URL and convert to blob URL\n * to avoid CORS issue\n */\nconst toBlobURL = async (url, mimeType) => {\n log('info', `fetch ${url}`);\n const buf = await (await fetch(url)).arrayBuffer();\n log('info', `${url} file size = ${buf.byteLength} bytes`);\n const blob = new Blob([buf], { type: mimeType });\n const blobURL = URL.createObjectURL(blob);\n log('info', `${url} blob URL = ${blobURL}`);\n return blobURL;\n};\n\n// eslint-disable-next-line\nexport const getCreateFFmpegCore = async ({\n corePath: _corePath,\n workerPath: _workerPath,\n wasmPath: _wasmPath,\n}) => {\n // in Web Worker context\n // eslint-disable-next-line\n if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {\n if (typeof _corePath !== 'string') {\n throw Error('corePath should be a string!');\n }\n const coreRemotePath = new URL(_corePath, import.meta.url).href;\n const corePath = await toBlobURL(\n coreRemotePath,\n 'application/javascript',\n );\n const wasmPath = await toBlobURL(\n _wasmPath !== undefined ? _wasmPath : coreRemotePath.replace('ffmpeg-core.js', 'ffmpeg-core.wasm'),\n 'application/wasm',\n );\n const workerPath = await toBlobURL(\n _workerPath !== undefined ? _workerPath : coreRemotePath.replace('ffmpeg-core.js', 'ffmpeg-core.worker.js'),\n 'application/javascript',\n );\n if (typeof createFFmpegCore === 'undefined') {\n return new Promise((resolve) => {\n globalThis.importScripts(corePath);\n if (typeof createFFmpegCore === 'undefined') {\n throw Error(CREATE_FFMPEG_CORE_IS_NOT_DEFINED(coreRemotePath));\n }\n log('info', 'ffmpeg-core.js script loaded');\n resolve({\n createFFmpegCore,\n corePath,\n wasmPath,\n workerPath,\n });\n });\n }\n log('info', 'ffmpeg-core.js script is loaded already');\n return Promise.resolve({\n createFFmpegCore,\n corePath,\n wasmPath,\n workerPath,\n });\n }\n if (typeof _corePath !== 'string') {\n throw Error('corePath should be a string!');\n }\n const coreRemotePath = new URL(_corePath, import.meta.url).href;\n const corePath = await toBlobURL(\n coreRemotePath,\n 'application/javascript',\n );\n const wasmPath = await toBlobURL(\n _wasmPath !== undefined ? _wasmPath : coreRemotePath.replace('ffmpeg-core.js', 'ffmpeg-core.wasm'),\n 'application/wasm',\n );\n const workerPath = await toBlobURL(\n _workerPath !== undefined ? _workerPath : coreRemotePath.replace('ffmpeg-core.js', 'ffmpeg-core.worker.js'),\n 'application/javascript',\n );\n if (typeof createFFmpegCore === 'undefined') {\n return new Promise((resolve) => {\n const script = document.createElement('script');\n const eventHandler = () => {\n script.removeEventListener('load', eventHandler);\n if (typeof createFFmpegCore === 'undefined') {\n throw Error(CREATE_FFMPEG_CORE_IS_NOT_DEFINED(coreRemotePath));\n }\n log('info', 'ffmpeg-core.js script loaded');\n resolve({\n createFFmpegCore,\n corePath,\n wasmPath,\n workerPath,\n });\n };\n script.src = corePath;\n script.type = 'text/javascript';\n script.addEventListener('load', eventHandler);\n document.getElementsByTagName('head')[0].appendChild(script);\n });\n }\n log('info', 'ffmpeg-core.js script is loaded already');\n return Promise.resolve({\n createFFmpegCore,\n corePath,\n wasmPath,\n workerPath,\n });\n};\n","const readFromBlobOrFile = (blob) => (\n new Promise((resolve, reject) => {\n const fileReader = new FileReader();\n fileReader.onload = () => {\n resolve(fileReader.result);\n };\n fileReader.onerror = ({ target: { error: { code } } }) => {\n reject(Error(`File could not be read! Code=${code}`));\n };\n fileReader.readAsArrayBuffer(blob);\n })\n);\n\n// eslint-disable-next-line\nexport const fetchFile = async (_data) => {\n let data = _data;\n if (typeof _data === 'undefined') {\n return new Uint8Array();\n }\n\n if (typeof _data === 'string') {\n /* From base64 format */\n if (/data:_data\\/([a-zA-Z]*);base64,([^\"]*)/.test(_data)) {\n data = atob(_data.split(',')[1])\n .split('')\n .map((c) => c.charCodeAt(0));\n /* From remote server/URL */\n } else {\n const res = await fetch(new URL(_data, import.meta.url).href);\n data = await res.arrayBuffer();\n }\n /* From Blob or File */\n } else if (_data instanceof File || _data instanceof Blob) {\n data = await readFromBlobOrFile(_data);\n }\n\n return new Uint8Array(data);\n};\n","const { defaultArgs, baseOptions } = require('./config');\nconst parseArgs = require('./utils/parseArgs');\nconst { defaultOptions, getCreateFFmpegCore } = require('./node');\nconst { version } = require('../package.json');\n\nconst NO_LOAD = Error('ffmpeg.wasm is not ready, make sure you have completed load().');\n\nmodule.exports = (_options = {}) => {\n const {\n log: optLog,\n logger,\n progress: optProgress,\n ...options\n } = {\n ...baseOptions,\n ...defaultOptions,\n ..._options,\n };\n let Core = null;\n let ffmpeg = null;\n let runResolve = null;\n let runReject = null;\n let running = false;\n let customLogger = () => {};\n let logging = optLog;\n let progress = optProgress;\n let duration = 0;\n let frames = 0;\n let readFrames = false;\n let ratio = 0;\n\n const detectCompletion = (message) => {\n if (message === 'FFMPEG_END' && runResolve !== null) {\n runResolve();\n runResolve = null;\n runReject = null;\n running = false;\n }\n };\n const log = (type, message) => {\n customLogger({ type, message });\n if (logging) {\n console.log(`[${type}] ${message}`);\n }\n };\n const ts2sec = (ts) => {\n const [h, m, s] = ts.split(':');\n return (parseFloat(h) * 60 * 60) + (parseFloat(m) * 60) + parseFloat(s);\n };\n const parseProgress = (message, prog) => {\n if (typeof message === 'string') {\n if (message.startsWith(' Duration')) {\n const ts = message.split(', ')[0].split(': ')[1];\n const d = ts2sec(ts);\n prog({ duration: d, ratio });\n if (duration === 0 || duration > d) {\n duration = d;\n readFrames = true;\n }\n } else if (readFrames && message.startsWith(' Stream')) {\n const match = message.match(/([\\d.]+) fps/);\n if (match) {\n const fps = parseFloat(match[1]);\n frames = duration * fps;\n } else {\n frames = 0;\n }\n readFrames = false;\n } else if (message.startsWith('frame') || message.startsWith('size')) {\n const ts = message.split('time=')[1].split(' ')[0];\n const t = ts2sec(ts);\n const match = message.match(/frame=\\s*(\\d+)/);\n if (frames && match) {\n const f = parseFloat(match[1]);\n ratio = Math.min(f / frames, 1);\n } else {\n ratio = t / duration;\n }\n prog({ ratio, time: t });\n } else if (message.startsWith('video:')) {\n prog({ ratio: 1 });\n duration = 0;\n }\n }\n };\n const parseMessage = ({ type, message }) => {\n log(type, message);\n parseProgress(message, progress);\n detectCompletion(message);\n };\n\n /*\n * Load ffmpeg.wasm-core script.\n * In browser environment, the ffmpeg.wasm-core script is fetch from\n * CDN and can be assign to a local path by assigning `corePath`.\n * In node environment, we use dynamic require and the default `corePath`\n * is `$ffmpeg/core`.\n *\n * Typically the load() func might take few seconds to minutes to complete,\n * better to do it as early as possible.\n *\n */\n const load = async () => {\n log('info', 'load ffmpeg-core');\n if (Core === null) {\n log('info', 'loading ffmpeg-core');\n /*\n * In node environment, all paths are undefined as there\n * is no need to set them.\n */\n const {\n createFFmpegCore,\n corePath,\n workerPath,\n wasmPath,\n } = await getCreateFFmpegCore(options);\n Core = await createFFmpegCore({\n /*\n * Assign mainScriptUrlOrBlob fixes chrome extension web worker issue\n * as there is no document.currentScript in the context of content_scripts\n */\n mainScriptUrlOrBlob: corePath,\n printErr: (message) => parseMessage({ type: 'fferr', message }),\n print: (message) => parseMessage({ type: 'ffout', message }),\n /*\n * locateFile overrides paths of files that is loaded by main script (ffmpeg-core.js).\n * It is critical for browser environment and we override both wasm and worker paths\n * as we are using blob URL instead of original URL to avoid cross origin issues.\n */\n locateFile: (path, prefix) => {\n if (typeof window !== 'undefined' || typeof WorkerGlobalScope !== 'undefined') {\n if (typeof wasmPath !== 'undefined'\n && path.endsWith('ffmpeg-core.wasm')) {\n return wasmPath;\n }\n if (typeof workerPath !== 'undefined'\n && path.endsWith('ffmpeg-core.worker.js')) {\n return workerPath;\n }\n }\n return prefix + path;\n },\n });\n ffmpeg = Core.cwrap(options.mainName || 'proxy_main', 'number', ['number', 'number']);\n log('info', 'ffmpeg-core loaded');\n } else {\n throw Error('ffmpeg.wasm was loaded, you should not load it again, use ffmpeg.isLoaded() to check next time.');\n }\n };\n\n /*\n * Determine whether the Core is loaded.\n */\n const isLoaded = () => Core !== null;\n\n /*\n * Run ffmpeg command.\n * This is the major function in ffmpeg.wasm, you can just imagine it\n * as ffmpeg native cli and what you need to pass is the same.\n *\n * For example, you can convert native command below:\n *\n * ```\n * $ ffmpeg -i video.avi -c:v libx264 video.mp4\n * ```\n *\n * To\n *\n * ```\n * await ffmpeg.run('-i', 'video.avi', '-c:v', 'libx264', 'video.mp4');\n * ```\n *\n */\n const run = (..._args) => {\n log('info', `run ffmpeg command: ${_args.join(' ')}`);\n if (Core === null) {\n throw NO_LOAD;\n } else if (running) {\n throw Error('ffmpeg.wasm can only run one command at a time');\n } else {\n running = true;\n return new Promise((resolve, reject) => {\n const args = [...defaultArgs, ..._args].filter((s) => s.length !== 0);\n runResolve = resolve;\n runReject = reject;\n ffmpeg(...parseArgs(Core, args));\n });\n }\n };\n\n /*\n * Run FS operations.\n * For input/output file of ffmpeg.wasm, it is required to save them to MEMFS\n * first so that ffmpeg.wasm is able to consume them. Here we rely on the FS\n * methods provided by Emscripten.\n *\n * Common methods to use are:\n * ffmpeg.FS('writeFile', 'video.avi', new Uint8Array(...)): writeFile writes\n * data to MEMFS. You need to use Uint8Array for binary data.\n * ffmpeg.FS('readFile', 'video.mp4'): readFile from MEMFS.\n * ffmpeg.FS('unlink', 'video.map'): delete file from MEMFS.\n *\n * For more info, check https://emscripten.org/docs/api_reference/Filesystem-API.html\n *\n */\n const FS = (method, ...args) => {\n log('info', `run FS.${method} ${args.map((arg) => (typeof arg === 'string' ? arg : `<${arg.length} bytes binary file>`)).join(' ')}`);\n if (Core === null) {\n throw NO_LOAD;\n } else {\n let ret = null;\n try {\n ret = Core.FS[method](...args);\n } catch (e) {\n if (method === 'readdir') {\n throw Error(`ffmpeg.FS('readdir', '${args[0]}') error. Check if the path exists, ex: ffmpeg.FS('readdir', '/')`);\n } else if (method === 'readFile') {\n throw Error(`ffmpeg.FS('readFile', '${args[0]}') error. Check if the path exists`);\n } else {\n throw Error('Oops, something went wrong in FS operation.');\n }\n }\n return ret;\n }\n };\n\n /**\n * forcibly terminate the ffmpeg program.\n */\n const exit = () => {\n if (Core === null) {\n throw NO_LOAD;\n } else {\n // if there's any pending runs, reject them\n if (runReject) {\n runReject('ffmpeg has exited');\n }\n running = false;\n try {\n Core.exit(1);\n } catch (err) {\n log(err.message);\n if (runReject) {\n runReject(err);\n }\n } finally {\n Core = null;\n ffmpeg = null;\n runResolve = null;\n runReject = null;\n }\n }\n };\n\n const setProgress = (_progress) => {\n progress = _progress;\n };\n\n const setLogger = (_logger) => {\n customLogger = _logger;\n };\n\n const setLogging = (_logging) => {\n logging = _logging;\n };\n\n log('info', `use ffmpeg.wasm v${version}`);\n\n return {\n setProgress,\n setLogger,\n setLogging,\n load,\n isLoaded,\n run,\n exit,\n FS,\n };\n};\n","module.exports = {\n defaultArgs: [\n /* args[0] is always the binary path */\n './ffmpeg',\n /* Disable interaction mode */\n '-nostdin',\n /* Force to override output file */\n '-y',\n ],\n baseOptions: {\n /* Flag to turn on/off log messages in console */\n log: false,\n /*\n * Custom logger to get ffmpeg.wasm output messages.\n * a sample logger looks like this:\n *\n * ```\n * logger = ({ type, message }) => {\n * console.log(type, message);\n * }\n * ```\n *\n * type can be one of following:\n *\n * info: internal workflow debug messages\n * fferr: ffmpeg native stderr output\n * ffout: ffmpeg native stdout output\n */\n logger: () => {},\n /*\n * Progress handler to get current progress of ffmpeg command.\n * a sample progress handler looks like this:\n *\n * ```\n * progress = ({ ratio }) => {\n * console.log(ratio);\n * }\n * ```\n *\n * ratio is a float number between 0 to 1.\n */\n progress: () => {},\n /*\n * Path to find/download ffmpeg.wasm-core,\n * this value should be overwriten by `defaultOptions` in\n * each environment.\n */\n corePath: '',\n },\n};\n","require('regenerator-runtime/runtime');\nconst createFFmpeg = require('./createFFmpeg');\nconst { fetchFile } = require('./node');\n\nmodule.exports = {\n /*\n * Create ffmpeg instance.\n * Each ffmpeg instance owns an isolated MEMFS and works\n * independently.\n *\n * For example:\n *\n * ```\n * const ffmpeg = createFFmpeg({\n * log: true,\n * logger: () => {},\n * progress: () => {},\n * corePath: '',\n * })\n * ```\n *\n * For the usage of these four arguments, check config.js\n *\n */\n createFFmpeg,\n /*\n * Helper function for fetching files from various resource.\n * Sometimes the video/audio file you want to process may located\n * in a remote URL and somewhere in your local file system.\n *\n * This helper function helps you to fetch to file and return an\n * Uint8Array variable for ffmpeg.wasm to consume.\n *\n */\n fetchFile,\n};\n"],"names":["parseArgs","Core","args","argsPtr","_malloc","length","Uint32Array","BYTES_PER_ELEMENT","forEach","s","idx","sz","lengthBytesUTF8","buf","stringToUTF8","setValue","defaultOptions","corePath","pkg","devDependencies","substring","logging","customLogger","log_1","setLogging","_logging","setCustomLogger","logger","log","type","message","console","errors","CREATE_FFMPEG_CORE_IS_NOT_DEFINED","toBlobURL","async","url","mimeType","fetch","arrayBuffer","byteLength","blob","Blob","blobURL","URL","createObjectURL","_data","data","Uint8Array","test","atob","split","map","c","charCodeAt","res","href","File","Promise","resolve","reject","fileReader","FileReader","onload","result","onerror","target","error","code","Error","readAsArrayBuffer","_corePath","workerPath","_workerPath","wasmPath","_wasmPath","WorkerGlobalScope","self","coreRemotePath","undefined","replace","createFFmpegCore","globalThis","importScripts","script","document","createElement","eventHandler","removeEventListener","src","addEventListener","getElementsByTagName","appendChild","defaultArgs","baseOptions","config","progress","require$$1","getCreateFFmpegCore","require$$2","version","require$$3","NO_LOAD","createFFmpeg","_options","optLog","optProgress","options","ffmpeg","runResolve","runReject","running","duration","frames","readFrames","ratio","ts2sec","ts","h","m","parseFloat","parseMessage","prog","startsWith","d","match","fps","t","f","Math","min","time","parseProgress","detectCompletion","setProgress","_progress","setLogger","_logger","load","mainScriptUrlOrBlob","printErr","print","locateFile","path","prefix","window","endsWith","cwrap","mainName","isLoaded","run","_args","join","filter","exit","err","FS","method","arg","ret","e","require$$0","fetchFile"],"mappings":"gyBAAAA,EAAiB,CAACC,EAAMC,KACtB,MAAMC,EAAUF,EAAKG,QAAQF,EAAKG,OAASC,YAAYC,mBAOvD,OANAL,EAAKM,QAAQ,CAACC,EAAGC,KACf,MAAMC,EAAKV,EAAKW,gBAAgBH,GAAK,EAC/BI,EAAMZ,EAAKG,QAAQO,GACzBV,EAAKa,aAAaL,EAAGI,EAAKF,GAC1BV,EAAKc,SAASZ,EAAWG,YAAYC,kBAAoBG,EAAMG,EAAK,SAE/D,CAACX,EAAKG,OAAQF,2ECCvBa,EAAe,CAAEC,SAFb,kCAAkCC,EAAIC,gBAAgB,gBAAgBC,UAAU,yECPpF,IAAIC,GAAU,EACVC,EAAe,cAiBnBC,EAAiB,CACfF,UACAG,WAjBkBC,IAClBJ,EAAUI,GAiBVC,gBAduBC,IACvBL,EAAeK,GAcfC,IAXU,CAACC,EAA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AEA,GAAc/D,SAEtBV,EAAiB,CAoBfc,eAUA2D","x_google_ignoreList":[0,1,2,3,4,5,6,7,8]}
|
package/js/runtime.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(){try{var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},e=(new t.Error).stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="713add71-c4d1-4925-a6ca-a45f2b092e34",t._sentryDebugIdIdentifier="sentry-dbid-713add71-c4d1-4925-a6ca-a45f2b092e34")}catch(t){}}();var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function r(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if("function"==typeof e){var r=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})}),r}var n,o={exports:{}};function i(){return n||(n=1,function(t){var e=function(t){var e,r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(F){f=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof g?e:g,a=Object.create(i.prototype),c=new G(n||[]);return o(a,"_invoke",{value:j(t,r,c)}),a}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(F){return{type:"throw",arg:F}}}t.wrap=l;var h="suspendedStart",p="suspendedYield",y="executing",d="completed",v={};function g(){}function w(){}function b(){}var m={};f(m,a,function(){return this});var x=Object.getPrototypeOf,L=x&&x(x(I([])));L&&L!==r&&n.call(L,a)&&(m=L);var _=b.prototype=g.prototype=Object.create(m);function E(t){["next","throw","return"].forEach(function(e){f(t,e,function(t){return this._invoke(e,t)})})}function O(t,e){function r(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var f=u.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then(function(t){r("next",t,a,c)},function(t){r("throw",t,a,c)}):e.resolve(l).then(function(t){f.value=t,a(f)},function(t){return r("throw",t,a,c)})}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e(function(e,o){r(t,n,e,o)})}return i=i?i.then(o,o):o()}})}function j(t,e,r){var n=h;return function(o,i){if(n===y)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return N()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=P(a,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=y;var u=s(t,e,r);if("normal"===u.type){if(n=r.done?d:p,u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=d,r.method="throw",r.arg=u.arg)}}}function P(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,P(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=s(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function I(t){if(t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}return{next:N}}function N(){return{value:e,done:!0}}return w.prototype=b,o(_,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:w,configurable:!0}),w.displayName=f(b,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,f(t,u,"GeneratorFunction")),t.prototype=Object.create(_),t},t.awrap=function(t){return{__await:t}},E(O.prototype),f(O.prototype,c,function(){return this}),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next()})},E(_),f(_,u,"Generator"),f(_,a,function(){return this}),f(_,"toString",function(){return"[object Generator]"}),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=I,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(k),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),f=n.call(a,"finallyLoc");if(u&&f){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:I(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}(t.exports);try{regeneratorRuntime=e}catch(r){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}(o)),o.exports}export{r as a,t as c,e as g,i as r};
|
|
2
|
+
//# sourceMappingURL=runtime.min.js.map
|