let h=0;function f(t){return`${t}_callback_${Date.now()}_${h++}`}function d(t,e){return typeof e>"u"&&(e={}),new Promise((n,r)=>{const s=f("exec");window[s]=(i,l,a)=>{n({errno:i,stdout:l,stderr:a}),o(s)};function o(i){delete window[i]}try{ksu.exec(t,JSON.stringify(e),s)}catch(i){r(i),o(s)}})}function c(){this.listeners={}}c.prototype.on=function(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e)};c.prototype.emit=function(t,...e){this.listeners[t]&&this.listeners[t].forEach(n=>n(...e))};function u(){this.listeners={},this.stdin=new c,this.stdout=new c,this.stderr=new c}u.prototype.on=function(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e)};u.prototype.emit=function(t,...e){this.listeners[t]&&this.listeners[t].forEach(n=>n(...e))};function w(t,e,n){typeof e>"u"?e=[]:e instanceof Array||(n=e),typeof n>"u"&&(n={});const r=new u,s=f("spawn");window[s]=r;function o(i){delete window[i]}r.on("exit",i=>{o(s)});try{ksu.spawn(t,JSON.stringify(e),JSON.stringify(n),s)}catch(i){r.emit("error",i),o(s)}return r}function y(t){ksu.fullScreen(t)}function k(t){ksu.enableInsets(t)}function p(t){ksu.toast(t)}function m(){return ksu.moduleInfo()}function N(t){try{return JSON.parse(ksu.listPackages(t))}catch{return[]}}function S(t){try{return typeof t!="string"&&(t=JSON.stringify(t)),JSON.parse(ksu.getPackagesInfo(t))}catch{return[]}}export{k as enableInsets,d as exec,y as fullScreen,S as getPackagesInfo,N as listPackages,m as moduleInfo,w as spawn,p as toast};
