`);
htmlContent = htmlContent.replace(/`);
let extraSetup = "";
if (epkFile) {
statusDiv.innerText = "assets.epk をエンコード中...";
const epkBase64 = await readFileAsBase64(epkFile);
extraSetup += `
window.eaglercraftOpts = window.eaglercraftOpts || {};
window.eaglercraftOpts.assetsURI = "data:application/octet-stream;base64,${epkBase64}";
`;
}
if (wasmFile) {
statusDiv.innerText = ".wasm をエンコード中...";
const wasmBase64 = await readFileAsBase64(wasmFile);
extraSetup += `
window.eaglercraftWasmBinaryURL = "data:application/wasm;base64,${wasmBase64}";
`;
}
if (extraSetup) {
htmlContent = htmlContent.replace('', `\n`);
}
const blob = new Blob([htmlContent], { type: 'text/html;charset=utf-8' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'eaglercraft_offline.html';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
statusDiv.innerText = "完了しました!ダウンロードを確認してください。";
packBtn.disabled = false;
} catch (err) {
console.error(err);
statusDiv.innerText = "エラーが発生しました: " + err.message;
packBtn.disabled = false;
}
}