const fs=require('fs'),vm=require('vm');function N(){return{innerHTML:'',textContent:'',children:[],appendChild(x){this.children.push(x)},prepend(x){this.children.unshift(x)},click(){},files:[],value:''}}const el={},store={};const c={console,Math,Date,Blob:function(){},URL:{createObjectURL(){return''}},FileReader:function(){},localStorage:{setItem(k,v){store[k]=v},getItem(k){return store[k]||null}},document:{getElementById(i){return el[i]||(el[i]=N())},createElement(){return N()}},window:{}};c.window=c;vm.createContext(c);for(const f of ['data.js','tournaments.js','engine.js','game.js'])vm.runInContext(fs.readFileSync(__dirname+'/'+f,'utf8'),c);vm.runInContext('globalThis.__E=Engine;globalThis.__D=FOOTBALL_DATA;',c);const Q=c.__FIFA_CUP_QA,E=c.__E,D=c.__D;const exp={GB1:38,GB2:46,GB3:46,GB4:46,CNAT:46,FR1:34,FR2:34,FR3:34,L1:34,L2:34,L3:38,ES1:38,ES2:42,IT1:38,IT2:38,PO1:34,PO2:34};let out={};for(const [cid,n] of Object.entries(exp)){const clubs=D.clubs.filter(x=>x.competitionId===cid);const u=clubs.find(x=>E.squad(x.id).length>=18);if(!u){out[cid]={skip:'aucun club jouable'};continue}Q.startCareer(u.id);const s=Q.getState();if(s.calendar.length!==n)throw Error(`${cid}: ${s.calendar.length} != ${n}`);out[cid]={club:u.name,clubs:clubs.length,rounds:s.calendar.length}}console.log(JSON.stringify(out));
