drill.init(async e=>{let{remote:a,ipcRenderer:r}=require("electron");const t=require("path"),i=require("pfs"),{BrowserWindow:s,BrowserView:n,dialog:o}=a;let p=a.getCurrentWindow(),[l,c]=await e("util/create","util/open"),d=await e("common/data"),{history:g}=d;r.send("c-msg",{type:"getList"}),await new Promise(e=>{r.on("notice-launcher",(a,r)=>{let{dirpath:i,stat:s}=r,n=g.page.find(e=>e.dirpath===i);switch(s){case"initList":r.sData.pageCreator.forEach(e=>{let a=$(`dirline[dirpath="${e.dirpath}"]`);if(a)switch(e.stat){case"running":a.runtype=2;break;case"loading":a.runtype=1}}),d.appDir=r.serverDir,e();break;case"add":c.openPage(i);break;case"adderror":o.showMessageBox({title:"新建错误",type:"error",message:r.error});break;case"ok":if(n){let e=n.clone();e.stat=1,e.time=(new Date).getTime(),n.remove(),g.page.unshift(e),n=e}else{let e=t.basename(i);n=$.xdata({tag:"dirline",xvele:1,dirpath:i,name:e,time:(new Date).getTime()}),g.page.unshift(n)}n.runtype=2,p.hide();break;case"error":n&&(n.stat=2,n.runtype="0"),o.showMessageBox({title:"打开出错",type:"error",message:r.error}),console.error(r);break;case"close":n&&(n.runtype="0"),p.show()}})}),await Promise.all(d.apps.map(async e=>{let a=await i.readFile(t.normalize(`${d.appDir}/${e}/package.json`));a=JSON.parse(a),d.appDatas[e]={version:a.version}}))});