{"version":3,"file":"mod-utils.cjs","sources":["../src/lib/utils/promise-utils.ts","../src/lib/utils/file-utils.ts"],"sourcesContent":["/**\n * Waits for the specified amount of time before resolving the returned promise.\n *\n * @param timeout - The duration in milliseconds to wait before resolving.\n * @returns A promise that resolves after the specified time has elapsed.\n * @internal\n */\nexport function wait(timeout: number): Promise<void> {\n\treturn new Promise(resolve => setTimeout(resolve, timeout));\n}\n","/**\n * Loads the contents of a specified file.\n *\n * @param file - The file object to load contents from.\n * @param encoding - The encoding to use while reading the file. Default is UTF-8.\n *\n * @returns - A Promise that resolves with the contents of the file as a string.\n *          - If the file is empty, the Promise will be rejected with an error.\n */\nexport function loadFileContents(\n\tfile: File,\n\tencoding = 'utf-8'\n): Promise<string> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst reader = new FileReader();\n\t\treader.addEventListener('load', () => {\n\t\t\tif (reader.result) {\n\t\t\t\tif (typeof reader.result !== 'string')\n\t\t\t\t\t// ArrayBuffer\n\t\t\t\t\treturn resolve(new TextDecoder(encoding).decode(reader.result));\n\n\t\t\t\tresolve(reader.result.toString());\n\t\t\t} else {\n\t\t\t\treject(\n\t\t\t\t\tnew Error('Empty file specified. Please select a non-empty file.')\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t\treader.addEventListener('error', reject);\n\t\treader.readAsText(file, encoding);\n\t});\n}\n"],"names":["wait","timeout","resolve","loadFileContents","file","encoding","reject","reader"],"mappings":"kIAOO,SAASA,EAAKC,EAAgC,CACpD,OAAO,IAAI,QAAQC,GAAW,WAAWA,EAASD,CAAO,CAAC,CAC3D,CCAgB,SAAAE,EACfC,EACAC,EAAW,QACO,CAClB,OAAO,IAAI,QAAQ,CAACH,EAASI,IAAW,CACjC,MAAAC,EAAS,IAAI,WACZA,EAAA,iBAAiB,OAAQ,IAAM,CACrC,GAAIA,EAAO,OAAQ,CACd,GAAA,OAAOA,EAAO,QAAW,SAErB,OAAAL,EAAQ,IAAI,YAAYG,CAAQ,EAAE,OAAOE,EAAO,MAAM,CAAC,EAEvDL,EAAAK,EAAO,OAAO,SAAU,CAAA,CAAA,MAEhCD,EACC,IAAI,MAAM,uDAAuD,CAAA,CAEnE,CACA,EACMC,EAAA,iBAAiB,QAASD,CAAM,EAChCC,EAAA,WAAWH,EAAMC,CAAQ,CAAA,CAChC,CACF"}