import"./_virtual/_rolldown/runtime.js";let e=null,t=!1,n=null;function loadNativeLightningcss(){if(t)return e;t=!0;try{let t=globalThis.imports?.gi;if(!t)return n=Error(`imports.gi not available — not running under GJS?`),null;let r=t.GjsifyLightningcss;return r?(e=r,e):(n=Error(`GjsifyLightningcss typelib not found on GI_TYPELIB_PATH`),null)}catch(t){return n=t instanceof Error?t:Error(String(t)),e=null,null}}function hasNativeLightningcss(){return loadNativeLightningcss()!==null}function getLoadError(){return n}function getGLib(){let e=globalThis.imports?.gi;if(!e||!e.GLib)throw Error(`@gjsify/lightningcss-native: GLib not available (not running under GJS?)`);return e.GLib}function transform(e){let t=loadNativeLightningcss();if(!t)throw Error(`@gjsify/lightningcss-native: prebuild not available (${n?.message??`unknown`})`);let r=typeof e.code==`string`?new TextEncoder().encode(e.code):e.code,i=getGLib().Bytes.new(r),[a,o]=new t.Engine().transform(e.filename??null,i,e.targets??null,!!e.minify,!!e.sourceMap),s={code:a.get_data()??new Uint8Array};if(o){let e=o.get_data();e&&(s.map=e)}return s}function bundle(e){let t=loadNativeLightningcss();if(!t)throw Error(`@gjsify/lightningcss-native: prebuild not available (${n?.message??`unknown`})`);let[r,i]=new t.Engine().bundle(e.filename,e.targets??null,!!e.minify,!!e.sourceMap,e.errorRecovery??!0),a={code:r.get_data()??new Uint8Array};if(i){let e=i.get_data();e&&(a.map=e)}return a}export{bundle,getLoadError,hasNativeLightningcss,loadNativeLightningcss,transform};