// @bun
var{defineProperty:R,getOwnPropertyNames:V,getOwnPropertyDescriptor:y}=Object,A=Object.prototype.hasOwnProperty;function E(q){return this[q]}var N=(q)=>{var w=(Z??=new WeakMap).get(q),B;if(w)return w;if(w=R({},"__esModule",{value:!0}),q&&typeof q==="object"||typeof q==="function"){for(var J of V(q))if(!A.call(w,J))R(w,J,{get:E.bind(q,J),enumerable:!(B=y(q,J))||B.enumerable})}return Z.set(q,w),w},Z;var T=(q)=>q;function U(q,w){this[q]=T.bind(null,w)}var _=(q,w)=>{for(var B in w)R(q,B,{get:w[B],enumerable:!0,configurable:!0,set:U.bind(w,B)})};var $=(q,w)=>()=>(q&&(w=q(q=0)),w);var W=import.meta.require;function P(q,w){return`${K[w]}${q}${K.reset}`}function D(q){return P(q,"green")}function O(q){return P(q,"yellow")}function z(q){return P(q,"red")}function S(q){return P(q,"cyan")}function k(q){return P(q,"gray")}var K;var G=$(()=>{K={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});async function L(){try{let q=await import("@stacksjs/desktop");if(typeof q.openDevWindow!=="function")return null;return q}catch{return null}}async function M(q,w={}){let B={...j,...w},J=await L();if(!J)return console.log(`${K.yellow}\u26A0${K.reset} Native window requested, but @stacksjs/desktop is not available.`),console.log("  Install & build the desktop package to enable --native."),!1;try{let H=await J.openDevWindow(q,{title:B.title,width:B.width,height:B.height,darkMode:B.darkMode,hotReload:B.hotReload,titlebarHidden:B.titlebarHidden,nativeSidebar:B.nativeSidebar,sidebarWidth:B.sidebarWidth,sidebarConfig:B.sidebarConfig});if(H&&B.nativeSidebar)console.log(`${K.green}\u2713${K.reset} Native sidebar enabled (macOS Tahoe style)`);return H}catch(H){return console.log(`${K.red}\u2717${K.reset} Could not open native window:`,H),!1}}async function h(){return await L()!==null}function x(q){if(q.match(/<Sidebar[\s\S]*?variant=["'](?:tahoe|vibrancy|desktop)["'][\s\S]*?\/>/i)){let H=q.match(/<script\s+server[^>]*>([\s\S]*?)<\/script>/i);if(H){let X=H[1];try{let Q=`
          ${X}
          return typeof sidebarConfig !== 'undefined' ? sidebarConfig : null;
        `,Y=Function(Q)();if(Y)return Y}catch(Q){console.warn("Invalid sidebarConfig:",Q)}}return{sections:[]}}let B=q.match(/@nativeSidebar\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(B)try{return JSON.parse(B[1])}catch{console.warn("Invalid @nativeSidebar configuration")}let J=q.match(/<script\s+native-sidebar[^>]*>([\s\S]*?)<\/script>/i);if(J)try{let H=J[1].match(/(?:export\s+(?:default\s+)?|const\s+\w+\s*=\s*)(\{[\s\S]*\})/m);if(H)return Function(`return ${H[1]}`)()}catch(H){console.warn("Invalid native-sidebar script configuration:",H)}return}var j;var F=$(()=>{G();j={title:"stx Development",width:1400,height:900,darkMode:!0,hotReload:!0,titlebarHidden:!1,nativeSidebar:!1,sidebarWidth:260,sidebarConfig:void 0}});F();export{M as openNativeWindow,h as isNativeWindowSupported,x as extractSidebarConfig,j as DEFAULT_NATIVE_WINDOW_CONFIG};
