import {platform} from './platform.v2.0.1.mjs'; import {chooseLanguage,applyShellLocale} from './i18n.v2.0.1.mjs'; import {SAVE_KEYS} from './storage.v2.0.1.mjs'; import {accountClient} from './account.v2.0.1.mjs'; // Release generation replaces these paths as a unit; no runtime code download service. const entries={ru:'./main.v2.0.1.mjs',en:'./main.en.v2.0.1.mjs'},shell='./locale-shell.v2.0.1.json'; try{ await platform.init(); const language=chooseLanguage({url:location.href,saved:platform.storage.getItem(SAVE_KEYS.language),languages:navigator.languages||[navigator.language],platformLanguage:platform.target==='yandex'?platform.languageHint():null}); const response=await fetch(new URL(shell,import.meta.url));if(!response.ok)throw new Error('Language resources unavailable');const catalog=await response.json(); applyShellLocale(document,language,catalog);document.documentElement.classList.remove('locale-pending');document.querySelector('#bootstrap-splash')?.remove(); await accountClient.initialize(); await import(entries[language]); }catch{ document.documentElement.classList.remove('locale-pending');document.querySelector('#bootstrap-splash')?.remove(); const main=document.querySelector('#main');if(main){main.replaceChildren();const h=document.createElement('h1'),p=document.createElement('p'),button=document.createElement('button');h.textContent='Opening Lab';p.textContent='Unable to load the trainer. / Не удалось загрузить тренажёр.';button.textContent='Reload / Перезагрузить';button.className='btn primary';button.addEventListener('click',()=>location.reload());main.append(h,p,button);} }