varOS;!function(t){lete;!function(e){classi{constructor(e){this.worker=newWorker(e.asFileHandle().getlink()),this.jobs={},this.worker.onmessage=t=>{lete=t.data,i=this.jobs[e.id];i?"log"===e.type?i.logger&&(e.error?i.logger.error(e.result):!1===e.show_time&&i.logger.print?i.logger.print(e.result):i.logger.info(e.result)):(i.callback(e),deletethis.jobs[e.id]):console.log("Unable to identify result of job",e.id,e)};consti={};for(consteint.setting.system.packages){constr=t.setting.system.packages[e];i[e]={path:r.path,name:r.pkgname}}this.submit("sdk-setup",{REST:t.API.REST,pkgs:i})}newJobID(){return"job_"+Math.random().toString(36).replace(".","")}exectue_job(t,e,i,r,o){consts=this.newJobID(),a={id:s,cmd:t,data:e,root:i};this.jobs[s]={callback:r,logger:o},this.worker.postMessage(a)}submit(t,e,i,r){returnnewPromise((o,s)=>{this.exectue_job(t,e,i,t=>{if(t.error)returns(t.error);o(t.result)},r)})}terminate(){this.worker.terminate()}}classr{constructor(t,e){this.root=e,this.logger=t,r.worker||(r.worker=newi("pkg://libantosdk/core/worker.js"))}require(t){returnthis.run("sdk-import",t.map(t=>t+".worker.js"))}compile(t,e){returnnewPromise(async(i,r)=>{try{awaitthis.require([t]),i(awaitthis.run(t+"-compile",e))}catch(t){r(__e(t))}})}run(e,i){return"sdk-run-app"===e?newPromise(async(e,r)=>{try{letr=i;1==r.split("://").length&&(r=`${this.root}/${i}`);consto=await(r+"/package.json").asFileHandle().read("json");returno.text=o.name,o.path=r,o.filename=o.pkgname,o.type="app",o.mime="antos/app",o.icon&&(o.icon=`${o.path}/${o.icon}`),o.iconclass||o.icon||(o.iconclass="fa fa-adn"),this.logger.info(__("Installing...")),t.setting.system.packages[o.pkgname]=o,o.app?(this.logger.info(__("Running {0}...",o.app)),t.GUI.forceLaunch(o.app,[])):this.logger.error(__("{0} is not an application",o.pkgname)),e(void0)}catch(t){r(t)}}):"batch"===e?newPromise(async(t,e)=>{try{if(!i||!i.target){constt=__("No target provided for job: batch");throwthis.logger.error(t),newError(t.__())}lete=i.pwd;e||(e=this.root);consto=awaite.asFileHandle().read();if(o.error)throwthis.logger.error(o.error),newError(o.error);lets=o.result.filter(t=>"dir"===t.type);i.modules&&(s=s.filter(t=>i.modules.includes(t.filename)));for(lettofs){conste=(t.path+"/build.json").asFileHandle();try{awaite.onready()}catch(e){this.logger.info(__("No build.json file found in {0}, ignore this file",t.path));continue}this.logger.info(__("########### BUILDING: {0} ###########",t.path));consto=newr(this.logger,t.path),s=awaite.read("json");s.root||(s.root=t.path),awaito.batch([i.target],s)}returnthis.logger.info(__("########### Batch building done ###########")),t(void0)}catch(t){e(t)}}):r.worker.submit(e,i,this.root,this.logger)}batch(t,e){returne.root&&(this.root=e.root),newPromise(async(i,r)=>{try{e.targets||r("No target found");for(constioft){constt=e.targets[i];if(!t)returnr(__("No target: {0}",i));if(t.depend&&awaitthis.batch(t.depend,e),t.require&&awaitthis.require(t.require),this.logger&&this.logger.info(__("### RUNNING STAGE: {0}###",i).__()),t.jobs)for(consteoft.jobs)awaitthis.run(e.name,e.data)}i(void0)}catch(t){r(t)}})}}leto;e.AntOSDKBuilder=r,function(t){classeextendst.RemoteFileHandle{constructor(t){super(t);conste="pkg://libantosdk/"+this.genealogy.join("/");this.setPath(e.asFileHandle().path)}}t.SDKFileHandle=e,t.register("^sdk$",e)}(o=e.VFS||(e.VFS={}))}(e=t.API||(t.API={}))}(OS||(OS={})),function(t){lete;!function(e){classi{constructor(t){this.target=t}info(t){this.log("info",t,!0)}warn(t){this.log("warn",t,!0)}error(t){this.log("error",t,!0)}log(t,e,i){letr=$("<pre></pre>").attr("class","sdk-log-"+t);if(i){lett=newDate,i=t.getDate()+"/"+(t.getMonth()+1)+"/"+t.getFullYear()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds();r.text(`[${i}]: ${e.__()}`)}elser.text(e.__());$(this.target).append(r),$(this.target).scrollTop($(this.target)[0].scrollHeight)}print(t){t.match(/warn/i)?this.log("warn",t,!1):t.match(/error/i)?this.log("error",t,!1):this.log("info",t,!1)}clear(){$(this.target).empty()}}classrextends