@stacksjs/stx 0.2.638 → 0.2.639

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/{chunk-6p04wfam.js → chunk-06d1sznf.js} +1 -1
  2. package/dist/{chunk-rkf1kbjk.js → chunk-06y8nsyj.js} +1 -1
  3. package/dist/{chunk-3w0mafdz.js → chunk-0dxw5xbk.js} +1 -1
  4. package/dist/{chunk-5pb8pxgd.js → chunk-2ekfrm68.js} +1 -1
  5. package/dist/{chunk-7b5xxcg8.js → chunk-2rffxmdh.js} +1 -1
  6. package/dist/{chunk-hpkmd72m.js → chunk-2yycvrt9.js} +1 -1
  7. package/dist/{chunk-rh9yzvfm.js → chunk-3qv5dkz3.js} +1 -1
  8. package/dist/{chunk-t6pq15yt.js → chunk-4fe9hw31.js} +1 -1
  9. package/dist/{chunk-pmpgghfd.js → chunk-4fqkamxa.js} +1 -1
  10. package/dist/{chunk-mn3v0h9m.js → chunk-4v652fjx.js} +2 -2
  11. package/dist/{chunk-1h6swnze.js → chunk-5wep11np.js} +1 -1
  12. package/dist/{chunk-srx027sq.js → chunk-5xepx5y1.js} +6 -6
  13. package/dist/{chunk-jkd6pxwr.js → chunk-6e5t8e5b.js} +1 -1
  14. package/dist/{chunk-xwjwb6tm.js → chunk-6rpt4s20.js} +1 -1
  15. package/dist/{chunk-eewny4pc.js → chunk-7mv2dr59.js} +2 -2
  16. package/dist/{chunk-3crbqfwf.js → chunk-901x249w.js} +1 -1
  17. package/dist/{chunk-5f37s2sr.js → chunk-9xrmv78p.js} +1 -1
  18. package/dist/{chunk-1cdva0k4.js → chunk-afvs2d83.js} +1 -1
  19. package/dist/chunk-b5ctmyf5.js +2 -0
  20. package/dist/{chunk-w98xzhqc.js → chunk-bhvbtk5v.js} +1 -1
  21. package/dist/{chunk-ggbq6xqf.js → chunk-brfknbwn.js} +1 -1
  22. package/dist/{chunk-cny3mgax.js → chunk-bwhwkb22.js} +1 -1
  23. package/dist/{chunk-f0tqnz92.js → chunk-bxj5wg5n.js} +1 -1
  24. package/dist/{chunk-pjxsa0cx.js → chunk-c8wkjjs5.js} +1 -1
  25. package/dist/chunk-d5q7sq7c.js +2 -0
  26. package/dist/{chunk-hbv4s3df.js → chunk-e1khh3pf.js} +1 -1
  27. package/dist/{chunk-zyfxyg81.js → chunk-f920yx9g.js} +1 -1
  28. package/dist/{chunk-sdq8b5v3.js → chunk-gk9629wk.js} +1 -1
  29. package/dist/{chunk-x6w6rxyp.js → chunk-gpztrw67.js} +1 -1
  30. package/dist/{chunk-8vkmt2xf.js → chunk-gyrmwwgm.js} +18 -18
  31. package/dist/{chunk-ntd9f1aq.js → chunk-hd080add.js} +1 -1
  32. package/dist/{chunk-wpmc1any.js → chunk-k3sre98y.js} +1 -1
  33. package/dist/{chunk-myayey15.js → chunk-kad2cp0z.js} +1 -1
  34. package/dist/{chunk-h0vtsqea.js → chunk-me88325a.js} +1 -1
  35. package/dist/{chunk-tgrh7wbt.js → chunk-msp7zz1a.js} +2 -2
  36. package/dist/{chunk-qzdbsjgm.js → chunk-n8vqhbgp.js} +1 -1
  37. package/dist/{chunk-ee5cgwrm.js → chunk-nfqk2m0e.js} +1 -1
  38. package/dist/{chunk-w36swpnh.js → chunk-ptj8qcbc.js} +1 -1
  39. package/dist/{chunk-7s6xt9z9.js → chunk-q0n4vgy8.js} +1 -1
  40. package/dist/{chunk-bg4b1b35.js → chunk-rc0yb6rk.js} +1 -1
  41. package/dist/chunk-rdgjwpte.js +2 -0
  42. package/dist/{chunk-2e732rbq.js → chunk-rfxtatzg.js} +1 -1
  43. package/dist/{chunk-2tkatj77.js → chunk-svgzmrxm.js} +1 -1
  44. package/dist/{chunk-jgfn9adg.js → chunk-tjmy7vq3.js} +1 -1
  45. package/dist/{chunk-6qgrrv59.js → chunk-tt78ksns.js} +1 -1
  46. package/dist/{chunk-j4baaqny.js → chunk-wp2d4cyc.js} +3 -3
  47. package/dist/{chunk-0wbcx146.js → chunk-x5h1qspg.js} +1 -1
  48. package/dist/{chunk-5p0ng7q1.js → chunk-xzpq96dc.js} +1 -1
  49. package/dist/{chunk-fh37yz67.js → chunk-z2s2f36w.js} +1 -1
  50. package/dist/cli.js +7 -7
  51. package/dist/craft-entry.js +1 -1
  52. package/dist/craft.js +1 -1
  53. package/dist/menubar.js +1 -0
  54. package/dist/pwa.js +1 -1
  55. package/dist/ssg.js +2 -2
  56. package/package.json +5 -5
  57. package/dist/chunk-a8n8mhpr.js +0 -2
  58. package/dist/chunk-cz92f77e.js +0 -2
  59. package/dist/chunk-eyfv7ksn.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-g1ae3haw.js";import"./chunk-ahyq08mp.js";import{m,h,w,B}from"./chunk-8vkmt2xf.js";import"./chunk-m92q2jyt.js";import"./chunk-y255yybn.js";import"./chunk-gsp3627d.js";import"./chunk-qmh6f1bt.js";import"./chunk-6vmvra0f.js";import"./chunk-1m5cjrpw.js";import"./chunk-a0ygyftk.js";import"./chunk-1h6swnze.js";import"./chunk-pvfx0dgz.js";import"./chunk-r00nn2qs.js";import f from"path";var S=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useBroadcastStream","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],L=new Set(S);var l=new Map,x=m(64),y=new Set,O=0,R=new Set(S);function A(){l.clear(),x.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=h(n,O),r=x.get(o);if(r)return r.slice();let a=n.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(y.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),x.set(o,t),t.slice()}async function W(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=B({loader:"ts",target:"browser",define:w()}),C=new Set(r),d=[],g=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let b=[];try{b=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!b.some((c)=>C.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),d.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
2
+ import"./chunk-g1ae3haw.js";import"./chunk-ahyq08mp.js";import{m,h,w,B}from"./chunk-gyrmwwgm.js";import"./chunk-m92q2jyt.js";import"./chunk-y255yybn.js";import"./chunk-gsp3627d.js";import"./chunk-qmh6f1bt.js";import"./chunk-6vmvra0f.js";import"./chunk-1m5cjrpw.js";import"./chunk-a0ygyftk.js";import"./chunk-5wep11np.js";import"./chunk-pvfx0dgz.js";import"./chunk-r00nn2qs.js";import f from"path";var S=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useBroadcastStream","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],L=new Set(S);var l=new Map,x=m(64),y=new Set,O=0,R=new Set(S);function A(){l.clear(),x.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=h(n,O),r=x.get(o);if(r)return r.slice();let a=n.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(y.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),x.set(o,t),t.slice()}async function W(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=B({loader:"ts",target:"browser",define:w()}),C=new Set(r),d=[],g=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let b=[];try{b=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!b.some((c)=>C.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),d.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
3
3
  ${u.transformSync(e).trim()}`);for(let c of b)g.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let v=r.filter((s)=>!g.has(s)&&!I(n,s));if(v.length>0)console.warn(`[stx] could not bundle ${v.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(d.length===0)return l.set(t,""),null;let E=[...g].map((s)=>` try { if (!(${JSON.stringify(s)} in __s)) { __s[${JSON.stringify(s)}] = ${s}; if (!(${JSON.stringify(s)} in window)) window[${JSON.stringify(s)}] = ${s}; } } catch (e) {}`).join(`
4
4
  `),k=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
5
5
  ;(function(){
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Cl}from"./chunk-0wbcx146.js";import"./chunk-tgrh7wbt.js";import"./chunk-w98xzhqc.js";import"./chunk-8vkmt2xf.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-1h6swnze.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{Cl as startProductionServer};
2
+ import{Cl}from"./chunk-x5h1qspg.js";import"./chunk-msp7zz1a.js";import"./chunk-bhvbtk5v.js";import"./chunk-gyrmwwgm.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-5wep11np.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{Cl as startProductionServer};
@@ -853,7 +853,7 @@ window.stxDialog = {
853
853
  // Check if dialog is available
854
854
  isAvailable: () => typeof window.craft?.dialog !== 'undefined',
855
855
  };
856
- `}import _ from"process";import{existsSync as xn}from"fs";import{dirname as yn,join as vn}from"path";import{craftBinaryNotFoundMessage as Ge,resolveCraftBinary as Pn}from"craft-native";var U={};function Sn(e){U={...U,...e}}function kn(){return{...U}}function An(){U={}}function we(e){if(!e.sidebarConfig)return;let t={...e.sidebarConfig};if(t.variant==="desktop")t.material=t.material??"sidebar",t.backgroundEffect=t.backgroundEffect??"shimmer",t.allowsVibrancy=t.allowsVibrancy??!0;return t}function ne(){let e=yn(_.execPath),t=e.includes(".app/Contents/MacOS")?vn(e,"craft"):void 0,r=[_.env.CRAFT_BINARY_PATH,U.craftBinaryPath,...U.additionalSearchPaths||[],t];for(let n of r)if(n&&xn(n))return n;return Pn()}var T=new Map;function be(e){let t=T.get(e);if(!t||t.closed)return;t.closed=!0;for(let r of t.closeListeners??[])try{r()}catch(n){console.warn(`[stx/desktop] window ${e} close listener threw:`,n)}t.closeListeners?.clear()}var Cn=50;async function xe(e,t){let r=t.show().then(()=>({failed:!1}),(i)=>({failed:!0,error:i})),n=await Promise.race([r,new Promise((i)=>setTimeout(()=>i(null),Cn))]);if(n?.failed)throw n.error;r.then(()=>be(e))}function In(){return Array.from(T.keys())}function $n(e){let t=T.get(e);if(!t)return null;return oe(e,t.app)}function Tn(){for(let[e,t]of T)try{t.app?.close?.()}catch(r){console.warn(`Failed to close window ${e}:`,r)}T.clear()}function oe(e,t){return{id:e,show:()=>{console.log(`[stx/desktop] Window ${e} shown`)},hide:()=>{console.log("[stx/desktop] To hide window, use window.craft.window.hide() from inside the webview")},close:()=>{let r=T.get(e);if(r?.app)r.app.close(),be(e),T.delete(e),console.log(`[stx/desktop] Window ${e} closed`)},onClosed:(r)=>{let n=T.get(e);if(!n||n.closed)return queueMicrotask(r),()=>{};return n.closeListeners??=new Set,n.closeListeners.add(r),()=>n.closeListeners?.delete(r)},focus:()=>{console.log("[stx/desktop] To focus window, use window.craft.window.focus() from inside the webview")},minimize:()=>{console.log("[stx/desktop] To minimize window, use window.craft.window.minimize() from inside the webview")},maximize:()=>{console.log("[stx/desktop] To maximize window, use window.craft.window.maximize() from inside the webview")},restore:()=>{console.log("[stx/desktop] To restore window, use window.craft.window.show() from inside the webview")},setTitle:(r)=>{console.log(`[stx/desktop] To set title, use window.craft.window.setTitle({ title: "${r}" }) from inside the webview`)},loadURL:(r)=>{console.log(`[stx/desktop] To navigate, use window.location.href = "${r}" from inside the webview`)},reload:()=>{console.log("[stx/desktop] To reload, use window.craft.window.reload() from inside the webview")}}}function ye(e,t={}){let r=["--url",e,"--title",t.title||"stx Desktop","--width",String(t.width??1200),"--height",String(t.height??800)];if(t.darkMode)r.push("--dark");if(t.hotReload)r.push("--hot-reload");if(t.resizable===!1)r.push("--no-resize");if(t.frameless)r.push("--frameless");if(t.alwaysOnTop)r.push("--always-on-top");if(t.titlebarHidden)r.push("--titlebar-hidden");if(t.systemTray)r.push("--system-tray");if(t.hideDockIcon)r.push("--hide-dock-icon");if(t.devTools===!1)r.push("--no-devtools");if(t.nativeSidebar)r.push("--native-sidebar");if(t.sidebarWidth!==void 0)r.push("--sidebar-width",String(t.sidebarWidth));let n=we(t);if(n)r.push("--sidebar-config",JSON.stringify(n));return r}async function En(e,t={}){let r=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,n=ne();try{let{createApp:i}=await import("craft-native"),a=i({url:e,craftPath:n,window:{title:t.title||"stx Desktop",width:t.width??1200,height:t.height??800,darkMode:t.darkMode??!1,hotReload:t.hotReload??!1,resizable:t.resizable??!0,frameless:t.frameless??!1,alwaysOnTop:t.alwaysOnTop??!1,titlebarHidden:t.titlebarHidden??!1,systemTray:t.systemTray??!1,hideDockIcon:t.hideDockIcon??!1,devTools:t.devTools??!1,nativeSidebar:t.nativeSidebar??!1,sidebarWidth:t.sidebarWidth,sidebarConfig:we(t)}});return T.set(r,{app:a,url:e,options:t}),await xe(r,a),oe(r,a)}catch{try{let{spawn:i}=await import("child_process"),a=i(n,ye(e,t),{stdio:"inherit"});a.on("error",(c)=>{console.error(c.code==="ENOENT"?Ge(n):`craft child error: ${c.message}`)});let s={close:()=>a.kill()};return T.set(r,{app:s,url:e,options:t}),a.on("exit",()=>be(r)),oe(r,s)}catch(i){return console.error("Failed to spawn craft binary:",i.message),null}}}async function Mn(e,t={}){let r=`http://localhost:${e}/`;if(_.env.NODE_ENV==="test"||_.env.BUN_TEST)return console.warn("\u26A0 Skipping native window in test environment"),console.log("(Skipping browser fallback in test environment)"),!1;try{let{createApp:i}=await import("craft-native");console.log("\u26A1 Opening native window via craft-native\u2026");let a=!t.nativeSidebar,s=we(t),c=i({url:r,craftPath:ne(),window:{title:t.title||"stx Development",width:t.width||1400,height:t.height||900,resizable:!0,systemTray:a,darkMode:t.darkMode??!0,hotReload:t.hotReload??!0,devTools:!0,titlebarHidden:t.titlebarHidden??!1,nativeSidebar:t.nativeSidebar??!1,sidebarWidth:t.sidebarWidth??260,sidebarConfig:s}}),l=`dev-window-${e}`;return T.set(l,{app:c,url:r,options:t}),await xe(l,c),console.log(`\u2713 Native window opened at ${r}`),!0}catch{let i=ne();try{console.log(`\u26A1 Opening native window via craft binary (${i})\u2026`);let{spawn:a}=await import("child_process"),s=a(i,ye(r,{title:"stx Development",width:1400,height:900,hotReload:!0,...t}),{stdio:"inherit"});s.on("exit",()=>_.exit(0)),s.on("error",(l)=>{console.warn(l.code==="ENOENT"?Ge(i):`craft child error: ${l.message}`)});let c=`dev-window-${e}`;return T.set(c,{app:{close:()=>s.kill()},url:r,options:t}),console.log(`\u2713 Native window opened at ${r}`),!0}catch(a){console.warn("\u26A0 Could not spawn craft binary:",a.message)}if(_.env.NODE_ENV==="test"||_.env.BUN_TEST)return console.log("(Skipping browser fallback in test environment)"),!1;console.log("\uD83D\uDCF1 Opening in browser instead\u2026");try{let{spawn:a}=await import("child_process"),s=_.platform;return a(s==="darwin"?"open":s==="win32"?"cmd":"xdg-open",s==="win32"?["/c","start",r]:[r],{detached:!0,stdio:"ignore"}).unref(),console.log(`\u2713 Browser opened at ${r}`),!0}catch(a){return console.error("Could not open browser:",a),console.log(`Please open manually: ${r}`),!1}}}async function Dn(e,t={}){let{title:r="stx Desktop",width:n=1200,height:i=800,darkMode:a=!1,hotReload:s=!1,resizable:c=!0,frameless:l=!1,alwaysOnTop:u=!1}=t;try{let{createApp:f}=await import("craft-native"),m=ne(),p=f({html:e,craftPath:m,window:{title:r,width:n,height:i,darkMode:a,hotReload:s,resizable:c,frameless:l,alwaysOnTop:u}}),w=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return T.set(w,{app:p,url:"html-content",options:t}),await xe(w,p),oe(w,p)}catch(f){return console.error("Failed to create window with HTML:",f),null}}function Bn(){try{return d.resolve("craft-native"),!0}catch{return!1}}function On(){return`
856
+ `}import _ from"process";import{existsSync as xn}from"fs";import{dirname as yn,join as vn}from"path";import{craftBinaryNotFoundMessage as Ge,resolveCraftBinary as Pn}from"craft-native";var U={};function Sn(e){U={...U,...e}}function kn(){return{...U}}function An(){U={}}function we(e){if(!e.sidebarConfig)return;let t={...e.sidebarConfig};if(t.variant==="desktop")t.material=t.material??"sidebar",t.backgroundEffect=t.backgroundEffect??"shimmer",t.allowsVibrancy=t.allowsVibrancy??!0;return t}function ne(){let e=yn(_.execPath),t=e.includes(".app/Contents/MacOS")?vn(e,"craft"):void 0,r=[_.env.CRAFT_BINARY_PATH,U.craftBinaryPath,...U.additionalSearchPaths||[],t];for(let n of r)if(n&&xn(n))return n;return Pn()}var T=new Map;function be(e){let t=T.get(e);if(!t||t.closed)return;t.closed=!0;for(let r of t.closeListeners??[])try{r()}catch(n){console.warn(`[stx/desktop] window ${e} close listener threw:`,n)}t.closeListeners?.clear()}var Cn=50;async function xe(e,t){let r=t.show().then(()=>({failed:!1}),(i)=>({failed:!0,error:i})),n=await Promise.race([r,new Promise((i)=>setTimeout(()=>i(null),Cn))]);if(n?.failed)throw n.error;r.then(()=>be(e))}function In(){return Array.from(T.keys())}function $n(e){let t=T.get(e);if(!t)return null;return oe(e,t.app)}function Tn(){for(let[e,t]of T)try{t.app?.close?.()}catch(r){console.warn(`Failed to close window ${e}:`,r)}T.clear()}function oe(e,t){return{id:e,show:()=>{console.log(`[stx/desktop] Window ${e} shown`)},hide:()=>{console.log("[stx/desktop] To hide window, use window.craft.window.hide() from inside the webview")},close:()=>{let r=T.get(e);if(r?.app)r.app.close(),be(e),T.delete(e),console.log(`[stx/desktop] Window ${e} closed`)},onClosed:(r)=>{let n=T.get(e);if(!n||n.closed)return queueMicrotask(r),()=>{};return n.closeListeners??=new Set,n.closeListeners.add(r),()=>n.closeListeners?.delete(r)},focus:()=>{console.log("[stx/desktop] To focus window, use window.craft.window.focus() from inside the webview")},minimize:()=>{console.log("[stx/desktop] To minimize window, use window.craft.window.minimize() from inside the webview")},maximize:()=>{console.log("[stx/desktop] To maximize window, use window.craft.window.maximize() from inside the webview")},restore:()=>{console.log("[stx/desktop] To restore window, use window.craft.window.show() from inside the webview")},setTitle:(r)=>{console.log(`[stx/desktop] To set title, use window.craft.window.setTitle({ title: "${r}" }) from inside the webview`)},loadURL:(r)=>{console.log(`[stx/desktop] To navigate, use window.location.href = "${r}" from inside the webview`)},reload:()=>{console.log("[stx/desktop] To reload, use window.craft.window.reload() from inside the webview")}}}function ye(e,t={}){let r=["--url",e,"--title",t.title||"stx Desktop","--width",String(t.width??1200),"--height",String(t.height??800)];if(t.headless)r.push("--headless");if(t.darkMode)r.push("--dark");if(t.hotReload)r.push("--hot-reload");if(t.resizable===!1)r.push("--no-resize");if(t.frameless)r.push("--frameless");if(t.alwaysOnTop)r.push("--always-on-top");if(t.titlebarHidden)r.push("--titlebar-hidden");if(t.systemTray)r.push("--system-tray");if(t.hideDockIcon)r.push("--hide-dock-icon");if(t.devTools===!1)r.push("--no-devtools");if(t.nativeSidebar)r.push("--native-sidebar");if(t.sidebarWidth!==void 0)r.push("--sidebar-width",String(t.sidebarWidth));let n=we(t);if(n)r.push("--sidebar-config",JSON.stringify(n));return r}async function En(e,t={}){let r=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,n=ne();try{let{createApp:i}=await import("craft-native"),a=i({url:e,craftPath:n,window:{title:t.title||"stx Desktop",headless:t.headless??!1,width:t.width??1200,height:t.height??800,darkMode:t.darkMode??!1,hotReload:t.hotReload??!1,resizable:t.resizable??!0,frameless:t.frameless??!1,alwaysOnTop:t.alwaysOnTop??!1,titlebarHidden:t.titlebarHidden??!1,systemTray:t.systemTray??!1,hideDockIcon:t.hideDockIcon??!1,devTools:t.devTools??!1,nativeSidebar:t.nativeSidebar??!1,sidebarWidth:t.sidebarWidth,sidebarConfig:we(t)}});return T.set(r,{app:a,url:e,options:t}),await xe(r,a),oe(r,a)}catch{try{let{spawn:i}=await import("child_process"),a=i(n,ye(e,t),{stdio:"inherit"});a.on("error",(c)=>{console.error(c.code==="ENOENT"?Ge(n):`craft child error: ${c.message}`)});let s={close:()=>a.kill()};return T.set(r,{app:s,url:e,options:t}),a.on("exit",()=>be(r)),oe(r,s)}catch(i){return console.error("Failed to spawn craft binary:",i.message),null}}}async function Mn(e,t={}){let r=`http://localhost:${e}/`;if(_.env.NODE_ENV==="test"||_.env.BUN_TEST)return console.warn("\u26A0 Skipping native window in test environment"),console.log("(Skipping browser fallback in test environment)"),!1;try{let{createApp:i}=await import("craft-native");console.log("\u26A1 Opening native window via craft-native\u2026");let a=!t.nativeSidebar,s=we(t),c=i({url:r,craftPath:ne(),window:{title:t.title||"stx Development",width:t.width||1400,height:t.height||900,resizable:!0,systemTray:a,darkMode:t.darkMode??!0,hotReload:t.hotReload??!0,headless:t.headless??!1,devTools:!0,titlebarHidden:t.titlebarHidden??!1,nativeSidebar:t.nativeSidebar??!1,sidebarWidth:t.sidebarWidth??260,sidebarConfig:s}}),l=`dev-window-${e}`;return T.set(l,{app:c,url:r,options:t}),await xe(l,c),console.log(`\u2713 Native window opened at ${r}`),!0}catch{let i=ne();try{console.log(`\u26A1 Opening native window via craft binary (${i})\u2026`);let{spawn:a}=await import("child_process"),s=a(i,ye(r,{title:"stx Development",width:1400,height:900,hotReload:!0,...t}),{stdio:"inherit"});s.on("exit",()=>_.exit(0)),s.on("error",(l)=>{console.warn(l.code==="ENOENT"?Ge(i):`craft child error: ${l.message}`)});let c=`dev-window-${e}`;return T.set(c,{app:{close:()=>s.kill()},url:r,options:t}),console.log(`\u2713 Native window opened at ${r}`),!0}catch(a){console.warn("\u26A0 Could not spawn craft binary:",a.message)}if(_.env.NODE_ENV==="test"||_.env.BUN_TEST)return console.log("(Skipping browser fallback in test environment)"),!1;console.log("\uD83D\uDCF1 Opening in browser instead\u2026");try{let{spawn:a}=await import("child_process"),s=_.platform;return a(s==="darwin"?"open":s==="win32"?"cmd":"xdg-open",s==="win32"?["/c","start",r]:[r],{detached:!0,stdio:"ignore"}).unref(),console.log(`\u2713 Browser opened at ${r}`),!0}catch(a){return console.error("Could not open browser:",a),console.log(`Please open manually: ${r}`),!1}}}async function Dn(e,t={}){let{title:r="stx Desktop",width:n=1200,height:i=800,darkMode:a=!1,hotReload:s=!1,resizable:c=!0,frameless:l=!1,alwaysOnTop:u=!1}=t;try{let{createApp:f}=await import("craft-native"),m=ne(),p=f({html:e,craftPath:m,window:{title:r,headless:t.headless??!1,width:n,height:i,darkMode:a,hotReload:s,resizable:c,frameless:l,alwaysOnTop:u}}),w=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return T.set(w,{app:p,url:"html-content",options:t}),await xe(w,p),oe(w,p)}catch(f){return console.error("Failed to create window with HTML:",f),null}}function Bn(){try{return d.resolve("craft-native"),!0}catch{return!1}}function On(){return`
857
857
  // STX Desktop Window Bridge
858
858
  // Provides convenient wrappers around window.craft APIs
859
859
  window.stxWindow = {
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{cr,Tc,nd,$c,rd,Rc,lr,b,Lt,Te,Ac,ks,Pc,sd,Z,Ic,od,x,id}from"./chunk-8vkmt2xf.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-1h6swnze.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{Ic as applyFilters,rd as clearCustomFilters,Ac as clientLoopScopes,cr as defaultFilters,b as escapeHtml,Lt as escapeHtmlValue,x as evaluateExpression,Rc as findMustacheEnd,$c as getAllFilters,Pc as interpolateScriptAttributes,ks as interpolateScriptExpressions,sd as interpolateScriptsInTemplate,Z as processExpressions,Tc as registerFilter,nd as registerFilters,lr as replaceInterpolations,od as resetRejectedExpressionWarnings,id as unescapeHtml,Te as usesSignalsInScript};
2
+ import{cr,Tc,nd,$c,rd,Rc,lr,b,Lt,Te,Ac,ks,Pc,sd,Z,Ic,od,x,id}from"./chunk-gyrmwwgm.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-5wep11np.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{Ic as applyFilters,rd as clearCustomFilters,Ac as clientLoopScopes,cr as defaultFilters,b as escapeHtml,Lt as escapeHtmlValue,x as evaluateExpression,Rc as findMustacheEnd,$c as getAllFilters,Pc as interpolateScriptAttributes,ks as interpolateScriptExpressions,sd as interpolateScriptsInTemplate,Z as processExpressions,Tc as registerFilter,nd as registerFilters,lr as replaceInterpolations,od as resetRejectedExpressionWarnings,id as unescapeHtml,Te as usesSignalsInScript};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ut}from"./chunk-qmh6f1bt.js";import{yi,Ss,W,Xe,ne,Lt,x,Ze,Qe,mr,u}from"./chunk-8vkmt2xf.js";import{D}from"./chunk-7mkw98cr.js";var H=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function V(t,n,e){let r={fullTag:e,content:n,attrs:t};if(/\bserver\b/.test(t))return{...r,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...r,type:"client"};if(H.test(n))return{...r,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...r,type:"client"};return{...r,type:"server"}}var B=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function Po(t){let n=[],e=[],r=[],i=0;while(i<t.length){let s=t.indexOf("<",i);if(s===-1)break;let a=Xe(t,s);if(a>s){i=a;continue}let o=W(t,s);if(o>s){let c=t.slice(s,o),f=B.exec(c);if(f){let l=V(f[1],f[2],c);switch(l.type){case"signals":n.push(l);break;case"client":e.push(l);break;case"server":r.push(l);break}}i=o;continue}i=s+(t.startsWith("<!--",s)?4:1)}return{signals:n,client:e,server:r}}var q=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function z(t){let n=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,r;while((r=e.exec(t))!==null)n.push({start:r.index,end:r.index+r[0].length});return n}function P(t,n){return n.some((e)=>t>=e.start&&t<e.end)}function G(t){let n=(t||"").trim();if(!n)return null;if(/[\s>+~,:]/.test(n))return null;let e={},r=n,i=r.match(/^[a-z][\w-]*/i);if(i)e.tag=i[0].toLowerCase(),r=r.slice(i[0].length);while(r.length>0){let s=r.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(s){if(e.attr=s[1],s[3]!==void 0&&s[3]!=="")e.attrValue=s[3];r=r.slice(s[0].length);continue}let a=r.match(/^#([\w-]+)/);if(a){e.id=a[1],r=r.slice(a[0].length);continue}let o=r.match(/^\.([\w-]+)/);if(o){e.className=o[1],r=r.slice(o[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function U(t,n){if(n.attr){if(!(n.attrValue===void 0?new RegExp(`\\b${n.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${n.attr}\\s*=\\s*(["'])\\s*${n.attrValue}\\s*\\1`,"i")).test(t))return!1}if(n.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${n.id}\\s*\\1`,"i").test(t))return!1}if(n.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(n.className))return!1}return!0}function O(t,n="main"){let e=G(n);if(!e)return null;let r=/<([a-z][\w-]*)\b([^>]*)>/gi,i=z(t),s;while((s=r.exec(t))!==null){if(P(s.index,i))continue;let a=s[1].toLowerCase(),o=s[2]||"";if(o.trimEnd().endsWith("/")||q.has(a))continue;if(e.tag&&e.tag!==a)continue;if(!U(o,e))continue;let c=s[0],f=s.index+c.length,l=new RegExp(`<(/?)${a}\\b([^>]*)>`,"gi");l.lastIndex=f;let g=1,m;while((m=l.exec(t))!==null){if(P(m.index,i))continue;let S=m[1]==="/";if(!S&&(m[2]||"").trimEnd().endsWith("/"))continue;if(g+=S?-1:1,g===0)return{openTag:c,openIndex:s.index,start:f,end:m.index,tagName:a}}return null}return null}var He="private, no-store";function Io(t){return t.replace(/&#(\d+);/g,(n,e)=>M(Number(e),n)).replace(/&#x([0-9a-f]+);/gi,(n,e)=>M(Number.parseInt(e,16),n)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function M(t,n){if(!Number.isInteger(t)||t<0||t>1114111)return n;try{return String.fromCodePoint(t)}catch{return n}}function ce(t){return t.headers.get("X-STX-Router")==="true"}function X(t,n){if(!t)return n;return t.split(",").some((r)=>r.trim().toLowerCase()===n.toLowerCase())?t:`${t}, ${n}`}function T(t){return{Vary:X(t,"X-STX-Router")}}import E from"path";var J="stx-page-head:",K=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v={dev:null,prod:null};function Y(){let t=D()?"dev":"prod",n=v[t];if(n!==null)return n;try{let e=import.meta.require("./chunk-degxqdbb.js"),r=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;v[t]=`<script>${r()}</script>`}catch{v[t]=""}return v[t]}async function Oo(t,n){if(n===!1)return null;if(n&&typeof n==="string"){let r=E.resolve(t,n);if(await Bun.file(r).exists())return r;return null}let e=E.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function Gr(t,n){try{let e=await Bun.file(t).text(),r=e,i=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(i)r=i[1].trim();let s=Po(e),a=[...s.client.map((d)=>d.fullTag),...s.signals.map((d)=>d.fullTag)],o=[],c=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,f;while((f=c.exec(e))!==null)o.push(f[0]);let l=r;for(let d of s.server)l=l.replace(d.fullTag,"");for(let d of s.client)l=l.replace(d.fullTag,"");l=l.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let g="<!--__STX_PAGE_SLOT__-->";if(l=l.replace(/<slot\s*\/>/gi,g).replace(/<slot\s*>\s*<\/slot>/gi,g),!l.includes(g))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:m,extractVariables:S,defaultConfig:b,loadStxConfig:w}=await import("./chunk-a8n8mhpr.js"),y=await w(),p={__filename:t,__dirname:E.dirname(t)};for(let d of a){let C=d.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(C&&!d.includes("client")&&!d.includes('type="module"'))await S(C[1],p,t)}let R=await m(l,p,t,{...b,...y,...n},new Set),h=R.indexOf(g);if(h===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:R.substring(0,h),afterSlot:R.substring(h+g.length),filePath:t,shellScripts:a,shellStyles:o}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function Zn(t,n,e){let r,i="",s=n.match(K);if(s){n=n.replace(s[0],"");try{let l=Buffer.from(s[1],"base64").toString("utf8"),g=l.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(g)r=g[1].trim();i=l.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let a=e||r||"stx App",o=Y(),c="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
2
+ import{Ut}from"./chunk-qmh6f1bt.js";import{yi,Ss,W,Xe,ne,Lt,x,Ze,Qe,mr,u}from"./chunk-gyrmwwgm.js";import{D}from"./chunk-7mkw98cr.js";var H=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function V(t,n,e){let r={fullTag:e,content:n,attrs:t};if(/\bserver\b/.test(t))return{...r,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...r,type:"client"};if(H.test(n))return{...r,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...r,type:"client"};return{...r,type:"server"}}var B=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function Po(t){let n=[],e=[],r=[],i=0;while(i<t.length){let s=t.indexOf("<",i);if(s===-1)break;let a=Xe(t,s);if(a>s){i=a;continue}let o=W(t,s);if(o>s){let c=t.slice(s,o),f=B.exec(c);if(f){let l=V(f[1],f[2],c);switch(l.type){case"signals":n.push(l);break;case"client":e.push(l);break;case"server":r.push(l);break}}i=o;continue}i=s+(t.startsWith("<!--",s)?4:1)}return{signals:n,client:e,server:r}}var q=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function z(t){let n=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,r;while((r=e.exec(t))!==null)n.push({start:r.index,end:r.index+r[0].length});return n}function P(t,n){return n.some((e)=>t>=e.start&&t<e.end)}function G(t){let n=(t||"").trim();if(!n)return null;if(/[\s>+~,:]/.test(n))return null;let e={},r=n,i=r.match(/^[a-z][\w-]*/i);if(i)e.tag=i[0].toLowerCase(),r=r.slice(i[0].length);while(r.length>0){let s=r.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(s){if(e.attr=s[1],s[3]!==void 0&&s[3]!=="")e.attrValue=s[3];r=r.slice(s[0].length);continue}let a=r.match(/^#([\w-]+)/);if(a){e.id=a[1],r=r.slice(a[0].length);continue}let o=r.match(/^\.([\w-]+)/);if(o){e.className=o[1],r=r.slice(o[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function U(t,n){if(n.attr){if(!(n.attrValue===void 0?new RegExp(`\\b${n.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${n.attr}\\s*=\\s*(["'])\\s*${n.attrValue}\\s*\\1`,"i")).test(t))return!1}if(n.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${n.id}\\s*\\1`,"i").test(t))return!1}if(n.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(n.className))return!1}return!0}function O(t,n="main"){let e=G(n);if(!e)return null;let r=/<([a-z][\w-]*)\b([^>]*)>/gi,i=z(t),s;while((s=r.exec(t))!==null){if(P(s.index,i))continue;let a=s[1].toLowerCase(),o=s[2]||"";if(o.trimEnd().endsWith("/")||q.has(a))continue;if(e.tag&&e.tag!==a)continue;if(!U(o,e))continue;let c=s[0],f=s.index+c.length,l=new RegExp(`<(/?)${a}\\b([^>]*)>`,"gi");l.lastIndex=f;let g=1,m;while((m=l.exec(t))!==null){if(P(m.index,i))continue;let S=m[1]==="/";if(!S&&(m[2]||"").trimEnd().endsWith("/"))continue;if(g+=S?-1:1,g===0)return{openTag:c,openIndex:s.index,start:f,end:m.index,tagName:a}}return null}return null}var He="private, no-store";function Io(t){return t.replace(/&#(\d+);/g,(n,e)=>M(Number(e),n)).replace(/&#x([0-9a-f]+);/gi,(n,e)=>M(Number.parseInt(e,16),n)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function M(t,n){if(!Number.isInteger(t)||t<0||t>1114111)return n;try{return String.fromCodePoint(t)}catch{return n}}function ce(t){return t.headers.get("X-STX-Router")==="true"}function X(t,n){if(!t)return n;return t.split(",").some((r)=>r.trim().toLowerCase()===n.toLowerCase())?t:`${t}, ${n}`}function T(t){return{Vary:X(t,"X-STX-Router")}}import E from"path";var J="stx-page-head:",K=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v={dev:null,prod:null};function Y(){let t=D()?"dev":"prod",n=v[t];if(n!==null)return n;try{let e=import.meta.require("./chunk-degxqdbb.js"),r=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;v[t]=`<script>${r()}</script>`}catch{v[t]=""}return v[t]}async function Oo(t,n){if(n===!1)return null;if(n&&typeof n==="string"){let r=E.resolve(t,n);if(await Bun.file(r).exists())return r;return null}let e=E.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function Gr(t,n){try{let e=await Bun.file(t).text(),r=e,i=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(i)r=i[1].trim();let s=Po(e),a=[...s.client.map((d)=>d.fullTag),...s.signals.map((d)=>d.fullTag)],o=[],c=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,f;while((f=c.exec(e))!==null)o.push(f[0]);let l=r;for(let d of s.server)l=l.replace(d.fullTag,"");for(let d of s.client)l=l.replace(d.fullTag,"");l=l.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let g="<!--__STX_PAGE_SLOT__-->";if(l=l.replace(/<slot\s*\/>/gi,g).replace(/<slot\s*>\s*<\/slot>/gi,g),!l.includes(g))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:m,extractVariables:S,defaultConfig:b,loadStxConfig:w}=await import("./chunk-rdgjwpte.js"),y=await w(),p={__filename:t,__dirname:E.dirname(t)};for(let d of a){let C=d.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(C&&!d.includes("client")&&!d.includes('type="module"'))await S(C[1],p,t)}let R=await m(l,p,t,{...b,...y,...n},new Set),h=R.indexOf(g);if(h===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:R.substring(0,h),afterSlot:R.substring(h+g.length),filePath:t,shellScripts:a,shellStyles:o}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function Zn(t,n,e){let r,i="",s=n.match(K);if(s){n=n.replace(s[0],"");try{let l=Buffer.from(s[1],"base64").toString("utf8"),g=l.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(g)r=g[1].trim();i=l.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let a=e||r||"stx App",o=Y(),c="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -27,5 +27,5 @@ ${o}
27
27
  `));if(i.length>0)y.push(i.filter((p)=>!c.has(p)).join(`
28
28
  `));if(S.length>0)y.push(S.filter((p)=>!c.has(p)).join(`
29
29
  `));return y.push(m),y.join(`
30
- `)}import k from"fs";import I from"path";function Do(t,n,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:n,outputDir:e}}function Mo(t,n){let e=I.join(n,"manifest.json");k.writeFileSync(e,JSON.stringify(t,null,2))}function Lo(t){let n=I.join(t,"manifest.json");if(!k.existsSync(n))return null;try{let e=k.readFileSync(n,"utf-8"),r=JSON.parse(e);if(r.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${r.version}`),null;return r}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function _(t,n,e={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`;if(e.maxAge!==void 0)r+=`; Max-Age=${e.maxAge}`;if(e.expires)r+=`; Expires=${e.expires.toUTCString()}`;if(e.path)r+=`; Path=${e.path}`;if(e.domain)r+=`; Domain=${e.domain}`;if(e.secure)r+="; Secure";if(e.httpOnly)r+="; HttpOnly";if(e.sameSite)r+=`; SameSite=${e.sameSite}`;return r}async function Q(t){let n=t.headers.get("content-type")||"",e={},r=(i,s)=>{let a=e[i];if(a===void 0)e[i]=s;else if(Array.isArray(a))a.push(s);else e[i]=[a,s]};if(n.includes("multipart/form-data")){let i=await t.formData();for(let[s,a]of i.entries())if(typeof a==="string")r(s,a);return e}if(n.includes("application/x-www-form-urlencoded")){for(let[i,s]of new URLSearchParams(await t.text()).entries())r(i,s);return e}return e}function Kr(t){if(!t)return!1;let n=t.toUpperCase();return n!=="GET"&&n!=="HEAD"}async function F(t,n={}){let e=n.request,r=n.method??e?.method;if(!e||!Kr(r))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let i={};try{i=await Q(e)}catch{}let s=await t.action({request:e,form:i,params:n.params??{},query:t.query??{},cookies:n.cookies??{}});if(s&&typeof s==="object"){let a=s,o=tt(a.cookies),c=a.redirect;if(typeof c==="string"&&c)return{redirect:c,ran:!0,...o.length>0?{cookies:o}:{}};let{cookies:f,redirect:l,...g}=a;if(Object.assign(t,g),o.length>0)return{ran:!0,cookies:o}}return{ran:!0}}function tt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let n=[];for(let[e,r]of Object.entries(t)){if(!e)continue;if(typeof r==="string"){n.push(_(e,r));continue}if(r&&typeof r==="object"){let i=r;if(typeof i.value!=="string")continue;n.push(_(e,i.value,i))}}return n}function jo(t,n=[],e){let r=new Headers({Location:t,"Cache-Control":"no-store"});for(let i of n)r.append("Set-Cookie",i);for(let[i,s]of Object.entries(e??{}))if(i.toLowerCase()!=="location")r.set(i,s);return new Response(null,{status:303,headers:r})}async function Jt(t,n={}){let{html:e,context:r,redirect:i,cookies:s}=await et(t,n),a=Ze(r),o=Qe(r);if(i)return{html:e,redirect:i,cookies:s,status:a,headers:o};let{extractStreamBoundaries:c}=await import("./chunk-xwjwb6tm.js"),f=c(r),l=t.streamTemplates;if(l&&Object.keys(l).length>0){let{processDirectives:g}=await import("./chunk-7b5xxcg8.js"),{defaultConfig:m}=await import("./chunk-pmpgghfd.js"),S=r.streamBoundaries||{},b={...m,autoShell:!1},w=Object.keys(l).map((p)=>({id:p,render:async()=>{let R=typeof S[p]==="function"?await S[p]():void 0;return g(l[p],{...r,$boundary:R},t.sourceFile,b,new Set)}})),y=new Set(w.map((p)=>p.id));f=[...(f||[]).filter((p)=>!y.has(p.id)),...w]}return{html:e,boundaries:f&&f.length>0?f:void 0,cookies:s,status:a,headers:o}}async function et(t,n){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...n};if(!t.hasServerScripts&&!Ss(t.html))return{html:t.html,context:e};for(let a of t.serverScriptContent)try{await u(a,e,t.sourceFile)}catch(o){if(n.__stx_strict_hydration)throw o;console.warn(`[stx] Server script error in ${t.sourceFile}:`,o)}let r=await F(e,{request:n.request,method:n.method,params:n.params??{},cookies:n.cookies??{}}),i=(a)=>{let o=a.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),c=mr(e);if(!c)return o;let f=o.indexOf("</head>");return f<0?c+o:o.slice(0,f)+c+o.slice(f)};if(r.redirect)return{html:t.html,context:e,redirect:r.redirect,cookies:r.cookies};if(!Ss(t.html))return{html:i(t.html),context:e,cookies:r.cookies};let s=new Map;for(let[a,o]of Object.entries(t.placeholders))if(o.expression)try{let c=x(o.expression,e);if(o.type==="raw")s.set(a,c!==void 0&&c!==null?String(c):"");else s.set(a,c!==void 0&&c!==null?Lt(String(c)):"")}catch(c){if(n.__stx_strict_hydration)throw c;s.set(a,"")}return{html:i(yi(t.html,s)),context:e,cookies:r.cookies}}
30
+ `)}import k from"fs";import I from"path";function Do(t,n,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:n,outputDir:e}}function Mo(t,n){let e=I.join(n,"manifest.json");k.writeFileSync(e,JSON.stringify(t,null,2))}function Lo(t){let n=I.join(t,"manifest.json");if(!k.existsSync(n))return null;try{let e=k.readFileSync(n,"utf-8"),r=JSON.parse(e);if(r.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${r.version}`),null;return r}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function _(t,n,e={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`;if(e.maxAge!==void 0)r+=`; Max-Age=${e.maxAge}`;if(e.expires)r+=`; Expires=${e.expires.toUTCString()}`;if(e.path)r+=`; Path=${e.path}`;if(e.domain)r+=`; Domain=${e.domain}`;if(e.secure)r+="; Secure";if(e.httpOnly)r+="; HttpOnly";if(e.sameSite)r+=`; SameSite=${e.sameSite}`;return r}async function Q(t){let n=t.headers.get("content-type")||"",e={},r=(i,s)=>{let a=e[i];if(a===void 0)e[i]=s;else if(Array.isArray(a))a.push(s);else e[i]=[a,s]};if(n.includes("multipart/form-data")){let i=await t.formData();for(let[s,a]of i.entries())if(typeof a==="string")r(s,a);return e}if(n.includes("application/x-www-form-urlencoded")){for(let[i,s]of new URLSearchParams(await t.text()).entries())r(i,s);return e}return e}function Kr(t){if(!t)return!1;let n=t.toUpperCase();return n!=="GET"&&n!=="HEAD"}async function F(t,n={}){let e=n.request,r=n.method??e?.method;if(!e||!Kr(r))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let i={};try{i=await Q(e)}catch{}let s=await t.action({request:e,form:i,params:n.params??{},query:t.query??{},cookies:n.cookies??{}});if(s&&typeof s==="object"){let a=s,o=tt(a.cookies),c=a.redirect;if(typeof c==="string"&&c)return{redirect:c,ran:!0,...o.length>0?{cookies:o}:{}};let{cookies:f,redirect:l,...g}=a;if(Object.assign(t,g),o.length>0)return{ran:!0,cookies:o}}return{ran:!0}}function tt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let n=[];for(let[e,r]of Object.entries(t)){if(!e)continue;if(typeof r==="string"){n.push(_(e,r));continue}if(r&&typeof r==="object"){let i=r;if(typeof i.value!=="string")continue;n.push(_(e,i.value,i))}}return n}function jo(t,n=[],e){let r=new Headers({Location:t,"Cache-Control":"no-store"});for(let i of n)r.append("Set-Cookie",i);for(let[i,s]of Object.entries(e??{}))if(i.toLowerCase()!=="location")r.set(i,s);return new Response(null,{status:303,headers:r})}async function Jt(t,n={}){let{html:e,context:r,redirect:i,cookies:s}=await et(t,n),a=Ze(r),o=Qe(r);if(i)return{html:e,redirect:i,cookies:s,status:a,headers:o};let{extractStreamBoundaries:c}=await import("./chunk-6rpt4s20.js"),f=c(r),l=t.streamTemplates;if(l&&Object.keys(l).length>0){let{processDirectives:g}=await import("./chunk-2rffxmdh.js"),{defaultConfig:m}=await import("./chunk-4fqkamxa.js"),S=r.streamBoundaries||{},b={...m,autoShell:!1},w=Object.keys(l).map((p)=>({id:p,render:async()=>{let R=typeof S[p]==="function"?await S[p]():void 0;return g(l[p],{...r,$boundary:R},t.sourceFile,b,new Set)}})),y=new Set(w.map((p)=>p.id));f=[...(f||[]).filter((p)=>!y.has(p.id)),...w]}return{html:e,boundaries:f&&f.length>0?f:void 0,cookies:s,status:a,headers:o}}async function et(t,n){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...n};if(!t.hasServerScripts&&!Ss(t.html))return{html:t.html,context:e};for(let a of t.serverScriptContent)try{await u(a,e,t.sourceFile)}catch(o){if(n.__stx_strict_hydration)throw o;console.warn(`[stx] Server script error in ${t.sourceFile}:`,o)}let r=await F(e,{request:n.request,method:n.method,params:n.params??{},cookies:n.cookies??{}}),i=(a)=>{let o=a.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),c=mr(e);if(!c)return o;let f=o.indexOf("</head>");return f<0?c+o:o.slice(0,f)+c+o.slice(f)};if(r.redirect)return{html:t.html,context:e,redirect:r.redirect,cookies:r.cookies};if(!Ss(t.html))return{html:i(t.html),context:e,cookies:r.cookies};let s=new Map;for(let[a,o]of Object.entries(t.placeholders))if(o.expression)try{let c=x(o.expression,e);if(o.type==="raw")s.set(a,c!==void 0&&c!==null?String(c):"");else s.set(a,c!==void 0&&c!==null?Lt(String(c)):"")}catch(c){if(n.__stx_strict_hydration)throw c;s.set(a,"")}return{html:i(yi(t.html,s)),context:e,cookies:r.cookies}}
31
31
  export{Po,He,Io,ce,T,Oo,Gr,Zn,ke,No,le,Do,Mo,Lo,Kr,jo,Jt};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ea,Ao,$l,Ta,$a,Rl,Al}from"./chunk-ggbq6xqf.js";import"./chunk-ee5cgwrm.js";import"./chunk-rkf1kbjk.js";import"./chunk-w98xzhqc.js";import"./chunk-bsts9pr5.js";import{tt,Fc}from"./chunk-8vkmt2xf.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-1h6swnze.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{Ea as buildVirtualSource,tt as extractScriptBlocks,Fc as extractTemplateExpressions,Ta as findRuntimeTypeDeclarations,$a as findStxModuleDeclarations,Al as formatTypecheckDiagnostics,$l as sourcePathFor,Rl as typecheckStxFiles,Ao as virtualPathFor};
2
+ import{Ea,Ao,$l,Ta,$a,Rl,Al}from"./chunk-brfknbwn.js";import"./chunk-nfqk2m0e.js";import"./chunk-06y8nsyj.js";import"./chunk-bhvbtk5v.js";import"./chunk-bsts9pr5.js";import{tt,Fc}from"./chunk-gyrmwwgm.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-5wep11np.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{Ea as buildVirtualSource,tt as extractScriptBlocks,Fc as extractTemplateExpressions,Ta as findRuntimeTypeDeclarations,$a as findStxModuleDeclarations,Al as formatTypecheckDiagnostics,$l as sourcePathFor,Rl as typecheckStxFiles,Ao as virtualPathFor};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{y}from"./chunk-g1ae3haw.js";import{I,qt}from"./chunk-ahyq08mp.js";import{Nt,m,h,w,nt,B,o}from"./chunk-8vkmt2xf.js";import{pe,At,Pt,It}from"./chunk-rkf1kbjk.js";import{Ue,ln,_t,K}from"./chunk-g6s0xdgb.js";import{E,zn}from"./chunk-7mkw98cr.js";import S from"path";var C=new Map,k=new Map,A=m(64),F=new Map,q=["composables","functions"];function J(t){let n=S.basename(t,".ts");return n==="index"||n==="types"||t.endsWith(".d.ts")}async function Q(t){if(t)return S.resolve(t);let n=`<default>:${process.cwd()}`,a=F.get(n);if(a!==void 0)return a;let e=await V();if(e!==null)F.set(n,e);return e}async function V(){let t=await o(),n=t.root||process.cwd(),a=t.composablesDir;if(a)return S.resolve(n,a);for(let e of q){let s=S.resolve(n,e);try{let d=new Bun.Glob("**/*.ts");for await(let c of d.scan({cwd:s,absolute:!0}))if(!J(c))return s}catch{}}return null}async function L(t){let n=Array.isArray(t)?t:t?[S.resolve(t)]:(await o())._layerComposableDirs??[await Q()].filter((e)=>!!e),a=new Map;for(let e of n){let s=new Bun.Glob("**/*.ts");try{for await(let d of s.scan({cwd:e,absolute:!0})){let c=S.relative(e,d);if(!J(d)&&!a.has(c))a.set(c,d)}}catch{}}return{key:n.join("\x00"),files:[...a.values()].sort()}}async function is(t){let{files:n}=await L(t),a=B({loader:"ts",target:"browser",define:w()}),e=[];for(let s of n)try{let d=await Bun.file(s).text(),c=a.scan(d).exports.filter((p)=>p!=="default");if(c.length>0)e.push({file:s,names:c})}catch{}return e}function Y(t,n){return new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(t)}function H(t,n){let a=new Set(t.match(/\w+/g)),e=new Set;for(let s of n)if(/^\w+$/.test(s)?a.has(s):Y(t,s))e.add(s);return e}var G=m(64);function ee(t,n){let a=h(t,n.size),e=G.get(a);if(e)return e;let s;try{s=Nt(t,n)}catch{s=H(t,n)}let d=[...t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...t.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let c of d)for(let p of c[1].split(",")){let g=p.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(g&&n.has(g))s.add(g)}return G.set(a,s),s}function te(t,n,a){let e=new Map;for(let{file:u,names:l}of t)for(let f of l)if(!e.has(f))e.set(f,u);let s=(u)=>{let l=[];for(let f of H(u,e.keys()))l.push(e.get(f));return l},d=new Set(e.keys()),c=(u)=>{let l=[];for(let f of ee(u,d))l.push(e.get(f));return l},p=new Set,g=a.flatMap((u,l)=>l===0?s(u):c(u));while(g.length>0){let u=[];for(let l of g){if(p.has(l))continue;p.add(l);for(let f of c(n.get(l)??""))if(!p.has(f))u.push(f)}g=u}return p}async function iu(t,n,a){let{key:e,files:s}=await L(t);if(!e)return null;let d=()=>[...new Set([...s,...s.flatMap((r)=>pe(r))])],c=Ue(d());if(s.length===0)return K(C,e,c,""),null;s.sort();let p=B({loader:"ts",target:"browser",define:w()}),g=_t(k,e,c);if(!g){let r=new Map,i=[];for(let _ of s)try{let x=await Bun.file(_).text();r.set(_,x);let b=p.scan(x).exports.filter((Z)=>Z!=="default");if(b.length>0)i.push({file:_,names:b})}catch{r.set(_,"")}g=K(k,e,c,{codeByFile:r,modules:i})}let{codeByFile:u,modules:l}=g,f;if(n===void 0)f=new Set(s);else{let r=a?[n,...a]:[n],i=h(r.join("\x00"),e,r.length,c),_=A.get(i);if(f=_??te(l,u,r),!_)A.set(i,f)}if(f.size===0)return null;let R=s.filter((r)=>f.has(r)),M=`${e}\x00${R.join("\x00")}\x00${Pt()}`,j=_t(C,M,c);if(j!==void 0)return j||null;let N=[],v=new Set,P=new Set;for(let r of R)try{let i=u.get(r)??await Bun.file(r).text(),_=S.basename(r,".ts");for(let b of i.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(b[1])P.add(b[1]);let x=[];try{for(let b of p.scan(i).exports)if(b!=="default")v.add(b),x.push(b)}catch{}if(i=I(i),At(i))i=await It(i,r,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:x}),i=nt(i);i=qt(i),i=i.replace(/^export\s+(default\s+)?/gm,""),i=p.transformSync(i),N.push(`// Composable: ${_}
2
+ import{y}from"./chunk-g1ae3haw.js";import{I,qt}from"./chunk-ahyq08mp.js";import{Nt,m,h,w,nt,B,o}from"./chunk-gyrmwwgm.js";import{pe,At,Pt,It}from"./chunk-06y8nsyj.js";import{Ue,ln,_t,K}from"./chunk-g6s0xdgb.js";import{E,zn}from"./chunk-7mkw98cr.js";import S from"path";var C=new Map,k=new Map,A=m(64),F=new Map,q=["composables","functions"];function J(t){let n=S.basename(t,".ts");return n==="index"||n==="types"||t.endsWith(".d.ts")}async function Q(t){if(t)return S.resolve(t);let n=`<default>:${process.cwd()}`,a=F.get(n);if(a!==void 0)return a;let e=await V();if(e!==null)F.set(n,e);return e}async function V(){let t=await o(),n=t.root||process.cwd(),a=t.composablesDir;if(a)return S.resolve(n,a);for(let e of q){let s=S.resolve(n,e);try{let d=new Bun.Glob("**/*.ts");for await(let c of d.scan({cwd:s,absolute:!0}))if(!J(c))return s}catch{}}return null}async function L(t){let n=Array.isArray(t)?t:t?[S.resolve(t)]:(await o())._layerComposableDirs??[await Q()].filter((e)=>!!e),a=new Map;for(let e of n){let s=new Bun.Glob("**/*.ts");try{for await(let d of s.scan({cwd:e,absolute:!0})){let c=S.relative(e,d);if(!J(d)&&!a.has(c))a.set(c,d)}}catch{}}return{key:n.join("\x00"),files:[...a.values()].sort()}}async function is(t){let{files:n}=await L(t),a=B({loader:"ts",target:"browser",define:w()}),e=[];for(let s of n)try{let d=await Bun.file(s).text(),c=a.scan(d).exports.filter((p)=>p!=="default");if(c.length>0)e.push({file:s,names:c})}catch{}return e}function Y(t,n){return new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(t)}function H(t,n){let a=new Set(t.match(/\w+/g)),e=new Set;for(let s of n)if(/^\w+$/.test(s)?a.has(s):Y(t,s))e.add(s);return e}var G=m(64);function ee(t,n){let a=h(t,n.size),e=G.get(a);if(e)return e;let s;try{s=Nt(t,n)}catch{s=H(t,n)}let d=[...t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...t.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let c of d)for(let p of c[1].split(",")){let g=p.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(g&&n.has(g))s.add(g)}return G.set(a,s),s}function te(t,n,a){let e=new Map;for(let{file:u,names:l}of t)for(let f of l)if(!e.has(f))e.set(f,u);let s=(u)=>{let l=[];for(let f of H(u,e.keys()))l.push(e.get(f));return l},d=new Set(e.keys()),c=(u)=>{let l=[];for(let f of ee(u,d))l.push(e.get(f));return l},p=new Set,g=a.flatMap((u,l)=>l===0?s(u):c(u));while(g.length>0){let u=[];for(let l of g){if(p.has(l))continue;p.add(l);for(let f of c(n.get(l)??""))if(!p.has(f))u.push(f)}g=u}return p}async function iu(t,n,a){let{key:e,files:s}=await L(t);if(!e)return null;let d=()=>[...new Set([...s,...s.flatMap((r)=>pe(r))])],c=Ue(d());if(s.length===0)return K(C,e,c,""),null;s.sort();let p=B({loader:"ts",target:"browser",define:w()}),g=_t(k,e,c);if(!g){let r=new Map,i=[];for(let _ of s)try{let x=await Bun.file(_).text();r.set(_,x);let b=p.scan(x).exports.filter((Z)=>Z!=="default");if(b.length>0)i.push({file:_,names:b})}catch{r.set(_,"")}g=K(k,e,c,{codeByFile:r,modules:i})}let{codeByFile:u,modules:l}=g,f;if(n===void 0)f=new Set(s);else{let r=a?[n,...a]:[n],i=h(r.join("\x00"),e,r.length,c),_=A.get(i);if(f=_??te(l,u,r),!_)A.set(i,f)}if(f.size===0)return null;let R=s.filter((r)=>f.has(r)),M=`${e}\x00${R.join("\x00")}\x00${Pt()}`,j=_t(C,M,c);if(j!==void 0)return j||null;let N=[],v=new Set,P=new Set;for(let r of R)try{let i=u.get(r)??await Bun.file(r).text(),_=S.basename(r,".ts");for(let b of i.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(b[1])P.add(b[1]);let x=[];try{for(let b of p.scan(i).exports)if(b!=="default")v.add(b),x.push(b)}catch{}if(i=I(i),At(i))i=await It(i,r,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:x}),i=nt(i);i=qt(i),i=i.replace(/^export\s+(default\s+)?/gm,""),i=p.transformSync(i),N.push(`// Composable: ${_}
3
3
  ${i.trim()}`)}catch(i){console.warn(`[stx] Failed to load composable ${r}:`,i)}if(N.length===0||v.size===0)return K(C,M,c,""),null;let W=[...v].map((r)=>` try { if (!(${JSON.stringify(r)} in __c)) __c[${JSON.stringify(r)}] = ${r}; } catch (e) {}`).join(`
4
4
  `),O=JSON.stringify([...v]),D=N.join(`
5
5
 
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ke,Oc,ad,cd,ld,ud,Nc,Dc,dd,pd,bi,fd,xn,Sn,ur}from"./chunk-8vkmt2xf.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-1h6swnze.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{ud as __setSignalsGeneratorsForTest,Ke as cacheEngineFingerprint,Sn as cacheTemplate,xn as checkCache,fd as clearDevCaches,Dc as getCachedRouterScript,Nc as getCachedSignalsRuntime,dd as getServeClientAsset,bi as getServeModuleBundle,ur as hashFilePath,cd as invalidateFileCache,ld as invalidateFileCacheByDir,ad as readFileCached,pd as registerServeModuleBundle,Oc as templateCache};
2
+ import{Ke,Oc,ad,cd,ld,ud,Nc,Dc,dd,pd,bi,fd,xn,Sn,ur}from"./chunk-gyrmwwgm.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-5wep11np.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{ud as __setSignalsGeneratorsForTest,Ke as cacheEngineFingerprint,Sn as cacheTemplate,xn as checkCache,fd as clearDevCaches,Dc as getCachedRouterScript,Nc as getCachedSignalsRuntime,dd as getServeClientAsset,bi as getServeModuleBundle,ur as hashFilePath,cd as invalidateFileCache,ld as invalidateFileCacheByDir,ad as readFileCached,pd as registerServeModuleBundle,Oc as templateCache};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{y}from"./chunk-g1ae3haw.js";import{I,qt}from"./chunk-ahyq08mp.js";import{w,nt,B,o}from"./chunk-8vkmt2xf.js";import{pe,At,Pt,It}from"./chunk-rkf1kbjk.js";import{Ue,ln,_t,K}from"./chunk-g6s0xdgb.js";import{E,zn}from"./chunk-7mkw98cr.js";import p from"path";var a=new Map;function A(c,n){for(let s of c.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(s[1])n.add(s[1]);for(let s of c.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let i of(s[1]??"").split(",")){let l=((i.includes(":")?i.split(":").pop():i)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(l))n.add(l)}for(let s of c.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let i of(s[1]??"").split(",")){let r=i.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))n.add(r)}}async function Tu(c){let n;if(c)n=p.resolve(c);else{let t=await o();n=p.resolve(t.root||process.cwd(),t.storesDir||"stores")}let s=`${n}\x00${Pt()}`,i=new Bun.Glob("*.ts"),r=[];try{for await(let t of i.scan({cwd:n,absolute:!0})){let e=p.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return K(a,s,"",""),null}let l=()=>[...new Set([...r,...r.flatMap((t)=>pe(t))])],f=Ue(l()),d=_t(a,s,f);if(d!==void 0)return d||null;if(r.length===0)return K(a,s,f,""),null;let u=[];for(let t of r){let e=await Bun.file(t).text();u.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}u.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let x=u.map((t)=>t.file),m=[],g=new Set,v=B({loader:"ts",target:"browser",define:w()});for(let t of x)try{let e=await Bun.file(t).text(),_=p.basename(t,".ts");if(A(e,g),At(e))e=await It(e,t,{projectRoot:process.cwd(),externalizeUserModules:E()});e=nt(e),e=I(e),e=qt(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=v.transformSync(e),m.push(`// Store: ${_}
2
+ import{y}from"./chunk-g1ae3haw.js";import{I,qt}from"./chunk-ahyq08mp.js";import{w,nt,B,o}from"./chunk-gyrmwwgm.js";import{pe,At,Pt,It}from"./chunk-06y8nsyj.js";import{Ue,ln,_t,K}from"./chunk-g6s0xdgb.js";import{E,zn}from"./chunk-7mkw98cr.js";import p from"path";var a=new Map;function A(c,n){for(let s of c.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(s[1])n.add(s[1]);for(let s of c.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let i of(s[1]??"").split(",")){let l=((i.includes(":")?i.split(":").pop():i)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(l))n.add(l)}for(let s of c.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let i of(s[1]??"").split(",")){let r=i.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))n.add(r)}}async function Tu(c){let n;if(c)n=p.resolve(c);else{let t=await o();n=p.resolve(t.root||process.cwd(),t.storesDir||"stores")}let s=`${n}\x00${Pt()}`,i=new Bun.Glob("*.ts"),r=[];try{for await(let t of i.scan({cwd:n,absolute:!0})){let e=p.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return K(a,s,"",""),null}let l=()=>[...new Set([...r,...r.flatMap((t)=>pe(t))])],f=Ue(l()),d=_t(a,s,f);if(d!==void 0)return d||null;if(r.length===0)return K(a,s,f,""),null;let u=[];for(let t of r){let e=await Bun.file(t).text();u.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}u.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let x=u.map((t)=>t.file),m=[],g=new Set,v=B({loader:"ts",target:"browser",define:w()});for(let t of x)try{let e=await Bun.file(t).text(),_=p.basename(t,".ts");if(A(e,g),At(e))e=await It(e,t,{projectRoot:process.cwd(),externalizeUserModules:E()});e=nt(e),e=I(e),e=qt(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=v.transformSync(e),m.push(`// Store: ${_}
3
3
  ${e.trim()}`)}catch(e){console.warn(`[stx] Failed to load store ${t}:`,e)}if(m.length===0)return K(a,s,f,""),null;let S=m.join(`
4
4
 
5
5
  `),h=`;(function(){
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Y,vs,ws,Ec,Dt,fi,xs,gi,td,_e,wn,Ee}from"./chunk-8vkmt2xf.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import{Wi,s}from"./chunk-70et0fbw.js";import"./chunk-1m5cjrpw.js";import"./chunk-1h6swnze.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{Y as BROWSER_CORE_IMPORTS,Ec as STX_AUTO_IMPORTS,vs as extractAndStripCssImports,_e as extractBridgeData,Wi as findInterpolationEnd,gi as generateAutoImportDestructuring,td as generateBrowserAutoImportDestructuring,wn as generateServerDataBridge,Dt as injectBrowserCoreAutoImports,Ee as processClientScript,xs as referencesName,ws as renderVendorStyleTags,s as stripCommentsAndLiterals,fi as transformAutoImports};
2
+ import{Y,vs,ws,Ec,Dt,fi,xs,gi,td,_e,wn,Ee}from"./chunk-gyrmwwgm.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import{Wi,s}from"./chunk-70et0fbw.js";import"./chunk-1m5cjrpw.js";import"./chunk-5wep11np.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{Y as BROWSER_CORE_IMPORTS,Ec as STX_AUTO_IMPORTS,vs as extractAndStripCssImports,_e as extractBridgeData,Wi as findInterpolationEnd,gi as generateAutoImportDestructuring,td as generateBrowserAutoImportDestructuring,wn as generateServerDataBridge,Dt as injectBrowserCoreAutoImports,Ee as processClientScript,xs as referencesName,ws as renderVendorStyleTags,s as stripCommentsAndLiterals,fi as transformAutoImports};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ha,ya}from"./chunk-5xepx5y1.js";import"./chunk-z2s2f36w.js";import"./chunk-x5h1qspg.js";import"./chunk-j00v4m56.js";import"./chunk-9939fjh4.js";import"./chunk-brfknbwn.js";import"./chunk-6avpd901.js";import"./chunk-901x249w.js";import{Po}from"./chunk-msp7zz1a.js";import"./chunk-fztvkacg.js";import"./chunk-639ngkgb.js";import"./chunk-bwhwkb22.js";import"./chunk-45xhjrha.js";import"./chunk-s775b8ra.js";import"./chunk-svgzmrxm.js";import"./chunk-5e063mgs.js";import"./chunk-48yja477.js";import"./chunk-aztp8r80.js";import"./chunk-drrczm0b.js";import"./chunk-fwdptew6.js";import"./chunk-5wyp57g3.js";import"./chunk-b4j5bpec.js";import"./chunk-nfqk2m0e.js";import"./chunk-wjq1wqn6.js";import"./chunk-60azcvwr.js";import"./chunk-88p10v0w.js";import"./chunk-c858mepd.js";import"./chunk-qy11cp1v.js";import"./chunk-q0n4vgy8.js";import"./chunk-dcwhp21g.js";import"./chunk-tjmy7vq3.js";import"./chunk-7mv2dr59.js";import"./chunk-gmxrckgj.js";import"./chunk-gqz26wza.js";import"./chunk-06y8nsyj.js";import"./chunk-bhvbtk5v.js";import"./chunk-bsts9pr5.js";import{Ee,xn,Sn,Q,u,n,br,A,o,be}from"./chunk-gyrmwwgm.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-5wep11np.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{br as buildWebComponents,Sn as cacheTemplate,xn as checkCache,Po as classifyAllScripts,ha as createMiddleware,ya as createRoute,A as defaultConfig,u as extractVariables,Q as injectRouterScript,o as loadStxConfig,Ee as processClientScript,n as processDirectives,be as readMarkdownFile};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{bc,vc,pe,wc,di,$t,Rt,Qu,pi,At,yn,xc,Sc,kc,gs,Pt,Cc,It,_c}from"./chunk-rkf1kbjk.js";import"./chunk-w98xzhqc.js";import"./chunk-bsts9pr5.js";import"./chunk-8vkmt2xf.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-1h6swnze.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{yn as MODULE_SPECIFIER_PREFIX,bc as bundleCacheDir,vc as bundleCacheEntryLimit,It as bundleClientScript,Rt as clearBundleFailures,pe as clientBundleDependencies,$t as getBundleFailures,At as hasUserImports,Pt as moduleSubstitutionKey,Sc as normalizeRegistrySpecifiers,Cc as queueClientBundleBuild,di as recordBundleFailure,xc as registryIdForPath,pi as resolveBundlerFallback,kc as rewriteRegistryImports,Qu as setBundlerFallbackMode,wc as shouldLogBundlerDiagnostics,_c as tempBuildName,gs as withModuleSubstitutes};
2
+ import{bc,vc,pe,wc,di,$t,Rt,Qu,pi,At,yn,xc,Sc,kc,gs,Pt,Cc,It,_c}from"./chunk-06y8nsyj.js";import"./chunk-bhvbtk5v.js";import"./chunk-bsts9pr5.js";import"./chunk-gyrmwwgm.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-5wep11np.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{yn as MODULE_SPECIFIER_PREFIX,bc as bundleCacheDir,vc as bundleCacheEntryLimit,It as bundleClientScript,Rt as clearBundleFailures,pe as clientBundleDependencies,$t as getBundleFailures,At as hasUserImports,Pt as moduleSubstitutionKey,Sc as normalizeRegistrySpecifiers,Cc as queueClientBundleBuild,di as recordBundleFailure,xc as registryIdForPath,pi as resolveBundlerFallback,kc as rewriteRegistryImports,Qu as setBundlerFallbackMode,wc as shouldLogBundlerDiagnostics,_c as tempBuildName,gs as withModuleSubstitutes};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{p,c}from"./chunk-m92q2jyt.js";import{re,b}from"./chunk-8vkmt2xf.js";function A(t,o){let i=1,r=o,n="<template",e="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(n,r)&&(r+n.length>=t.length||/[\s>\/]/.test(t[r+n.length]))){i++,r+=n.length;continue}if(t.startsWith(e,r)){let a=t.indexOf(">",r+e.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var w=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function x(t,o){let i=null;for(let r=o;r<t.length;r++){let n=t[r];if(i){if(n==="\\"){r++;continue}if(n===i)i=null;continue}if(n==='"'||n==="'"){i=n;continue}if(n===">")return r+1}return-1}function N(t,o,i){let r=o.toLowerCase(),n=1,e=i;while(e<t.length){let s=t.indexOf("<",e);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);e=g===-1?t.length:g+3;continue}let a=x(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),u=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(u&&u[2].toLowerCase()===r){if(u[1]==="/"){if(n--,n===0)return a}else if(!/\/\s*>$/.test(f))n++}e=a}return-1}function R(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,n=0;while(n<t.length){let e=t.indexOf("<",n);if(e===-1)break;if(t.startsWith("<!--",e)){let l=t.indexOf("-->",e+4);n=l===-1?t.length:l+3;continue}let s=x(t,e+1);if(s===-1)break;let a=t.slice(e,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){n=s;continue}let u=f[2].toLowerCase();if(f[1]==="/"){let l=i.lastIndexOf(u);if(l!==-1)i.splice(l);n=s;continue}let g=/\/\s*>$/.test(a),m=i.length===0?a.match(r):null;if(m){let l=m[1]||m[2],d=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),h=g||w.has(u)?-1:N(t,u,s);if(h===-1)o.push({start:e,end:s,slotName:l,element:d}),n=s;else o.push({start:e,end:h,slotName:l,element:d+t.slice(s,h)}),n=h;continue}if(!g&&!w.has(u)){if(i.push(u),u==="script"||u==="style"){let l=t.toLowerCase().indexOf(`</${u}>`,s);if(l!==-1){n=l;continue}}}n=s}return o}function O(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,n=0;while(n<t.length){let e=t.indexOf("<",n);if(e===-1)break;if(t.startsWith("<!--",e)){let l=t.indexOf("-->",e+4);n=l===-1?t.length:l+3;continue}let s=x(t,e+1);if(s===-1)break;let a=t.slice(e,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){n=s;continue}let u=f[1]==="/",g=f[2].toLowerCase();if(u){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);n=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let d=A(t,s);if(d!==-1){let h=l[1]||l[2]||l[3];o.push({start:e,end:d,slotName:h,content:t.slice(s,d-11).trim(),propsBinding:l[4]||void 0}),n=d;continue}}}if(!/\/\s*>$/.test(a)&&!w.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){n=l;continue}}}n=s}return o}function Oa(t){let o={default:"",named:new Map},i=t,r=O(t);for(let e of r)o.named.set(e.slotName,{name:e.slotName,content:e.content,propsBinding:e.propsBinding});r.sort((e,s)=>s.start-e.start);for(let e of r)i=i.slice(0,e.start)+i.slice(e.end);let n=R(i);for(let e of n){let s=o.named.get(e.slotName);if(s)s.content+=e.element;else o.named.set(e.slotName,{name:e.slotName,content:e.element})}for(let e=n.length-1;e>=0;e--){let s=n[e];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function ql(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},n=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,e;while((e=n.exec(t))!==null)r[e[1]]=e[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function Na(t,o,i,r){if(!t)return i;let n=t.content;if(t.propsBinding&&Object.keys(o).length>0){let e=t.propsBinding.trim(),s={...r},a=new Set,f=new Set;if(e.startsWith("{")&&e.endsWith("}")){let u=e.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);for(let g of u){let[m,l]=g.split(":").map((h)=>h.trim()),d=l||m;if(s[d]=o[m],o[m]!==void 0)f.add(d);else a.add(d)}}else if(s[e]=o,Object.values(o).some((u)=>u===void 0))a.add(e);else f.add(e);n=C(n,s,a,f)}return n}function C(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(n,e)=>{try{let s=e.trim();if(re(s,i))return n;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!re(s,r))return n;let a=k(s,o);if(a===void 0)return n;return b(String(a??""))}catch{return`{{ ${e} }}`}})}function k(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),n=o;for(let e of r)if(n&&typeof n==="object"&&e in n)n=n[e];else return;return n}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,n,e]=i,s=o[r],a=parseInt(e,10);if(typeof s==="number")switch(n){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!p(t))return;return c(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Da(t,o,i){let r=t;r=await M(r,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,f,u)=>{let g=o.named.get(a),m=u?.trim()||"",l=f||"",d={},h=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,S;while((S=h.exec(l))!==null){let y=S[1],E=S[2];d[y]=k(E,i)}return await Na(g,d,m,i)});let e=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return r=r.replace(e,(s,a,f)=>{if(/\bname\s*=/.test(a||""))return s;let u=f?.trim()||"";return o.default||u}),r}async function M(t,o,i){let r=[],n=[];t.replace(o,(a,...f)=>{let u=f[f.length-2];return n.push({match:a,index:u}),r.push(i(a,...f.slice(0,-2))),a});let e=await Promise.all(r),s=t;for(let a=n.length-1;a>=0;a--){let{match:f,index:u}=n[a];s=s.slice(0,u)+e[a]+s.slice(u+f.length)}return s}function Gl(t){let o=Oa(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Kl(t,o,i,r){return await Da(t,{default:o,named:i},r)}
2
+ import{p,c}from"./chunk-m92q2jyt.js";import{re,b}from"./chunk-gyrmwwgm.js";function A(t,o){let i=1,r=o,n="<template",e="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(n,r)&&(r+n.length>=t.length||/[\s>\/]/.test(t[r+n.length]))){i++,r+=n.length;continue}if(t.startsWith(e,r)){let a=t.indexOf(">",r+e.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var w=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function x(t,o){let i=null;for(let r=o;r<t.length;r++){let n=t[r];if(i){if(n==="\\"){r++;continue}if(n===i)i=null;continue}if(n==='"'||n==="'"){i=n;continue}if(n===">")return r+1}return-1}function N(t,o,i){let r=o.toLowerCase(),n=1,e=i;while(e<t.length){let s=t.indexOf("<",e);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);e=g===-1?t.length:g+3;continue}let a=x(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),u=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(u&&u[2].toLowerCase()===r){if(u[1]==="/"){if(n--,n===0)return a}else if(!/\/\s*>$/.test(f))n++}e=a}return-1}function R(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,n=0;while(n<t.length){let e=t.indexOf("<",n);if(e===-1)break;if(t.startsWith("<!--",e)){let l=t.indexOf("-->",e+4);n=l===-1?t.length:l+3;continue}let s=x(t,e+1);if(s===-1)break;let a=t.slice(e,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){n=s;continue}let u=f[2].toLowerCase();if(f[1]==="/"){let l=i.lastIndexOf(u);if(l!==-1)i.splice(l);n=s;continue}let g=/\/\s*>$/.test(a),m=i.length===0?a.match(r):null;if(m){let l=m[1]||m[2],d=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),h=g||w.has(u)?-1:N(t,u,s);if(h===-1)o.push({start:e,end:s,slotName:l,element:d}),n=s;else o.push({start:e,end:h,slotName:l,element:d+t.slice(s,h)}),n=h;continue}if(!g&&!w.has(u)){if(i.push(u),u==="script"||u==="style"){let l=t.toLowerCase().indexOf(`</${u}>`,s);if(l!==-1){n=l;continue}}}n=s}return o}function O(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,n=0;while(n<t.length){let e=t.indexOf("<",n);if(e===-1)break;if(t.startsWith("<!--",e)){let l=t.indexOf("-->",e+4);n=l===-1?t.length:l+3;continue}let s=x(t,e+1);if(s===-1)break;let a=t.slice(e,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){n=s;continue}let u=f[1]==="/",g=f[2].toLowerCase();if(u){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);n=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let d=A(t,s);if(d!==-1){let h=l[1]||l[2]||l[3];o.push({start:e,end:d,slotName:h,content:t.slice(s,d-11).trim(),propsBinding:l[4]||void 0}),n=d;continue}}}if(!/\/\s*>$/.test(a)&&!w.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){n=l;continue}}}n=s}return o}function Oa(t){let o={default:"",named:new Map},i=t,r=O(t);for(let e of r)o.named.set(e.slotName,{name:e.slotName,content:e.content,propsBinding:e.propsBinding});r.sort((e,s)=>s.start-e.start);for(let e of r)i=i.slice(0,e.start)+i.slice(e.end);let n=R(i);for(let e of n){let s=o.named.get(e.slotName);if(s)s.content+=e.element;else o.named.set(e.slotName,{name:e.slotName,content:e.element})}for(let e=n.length-1;e>=0;e--){let s=n[e];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function ql(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},n=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,e;while((e=n.exec(t))!==null)r[e[1]]=e[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function Na(t,o,i,r){if(!t)return i;let n=t.content;if(t.propsBinding&&Object.keys(o).length>0){let e=t.propsBinding.trim(),s={...r},a=new Set,f=new Set;if(e.startsWith("{")&&e.endsWith("}")){let u=e.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);for(let g of u){let[m,l]=g.split(":").map((h)=>h.trim()),d=l||m;if(s[d]=o[m],o[m]!==void 0)f.add(d);else a.add(d)}}else if(s[e]=o,Object.values(o).some((u)=>u===void 0))a.add(e);else f.add(e);n=C(n,s,a,f)}return n}function C(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(n,e)=>{try{let s=e.trim();if(re(s,i))return n;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!re(s,r))return n;let a=k(s,o);if(a===void 0)return n;return b(String(a??""))}catch{return`{{ ${e} }}`}})}function k(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),n=o;for(let e of r)if(n&&typeof n==="object"&&e in n)n=n[e];else return;return n}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,n,e]=i,s=o[r],a=parseInt(e,10);if(typeof s==="number")switch(n){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!p(t))return;return c(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Da(t,o,i){let r=t;r=await M(r,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,f,u)=>{let g=o.named.get(a),m=u?.trim()||"",l=f||"",d={},h=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,S;while((S=h.exec(l))!==null){let y=S[1],E=S[2];d[y]=k(E,i)}return await Na(g,d,m,i)});let e=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return r=r.replace(e,(s,a,f)=>{if(/\bname\s*=/.test(a||""))return s;let u=f?.trim()||"";return o.default||u}),r}async function M(t,o,i){let r=[],n=[];t.replace(o,(a,...f)=>{let u=f[f.length-2];return n.push({match:a,index:u}),r.push(i(a,...f.slice(0,-2))),a});let e=await Promise.all(r),s=t;for(let a=n.length-1;a>=0;a--){let{match:f,index:u}=n[a];s=s.slice(0,u)+e[a]+s.slice(u+f.length)}return s}function Gl(t){let o=Oa(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Kl(t,o,i,r){return await Da(t,{default:o,named:i},r)}
3
3
  export{Oa,ql,Na,Da,Gl,Kl};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{b,u,n,g,A}from"./chunk-8vkmt2xf.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,s;M.lastIndex=0;while((s=M.exec(e))!==null){if(s.index>o){let a=e.slice(o,s.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let r=s[1],i=s[2];t.push({type:"suspense",name:r,content:i}),o=s.index+s[0].length}if(o<e.length){let r=e.slice(o);if(r.trim())t.push({type:t.length===0?"shell":"content",content:r})}if(t.length===0)t.push({type:"shell",content:e});return t}async function Du(e,t={},o={}){let s={...A,...o,streaming:{...q,...o.streaming}},r=s.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),w=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),m=w?w[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(m.trim())await u(m,y,e);let E=H(c),l=new Set;if(!E.some((h)=>h.type==="suspense")){let h=s.streaming?.strategy||"auto",S=new RegExp(T.source,"g");if(!(h!=="manual"&&S.test(c))){let p=await n(c,y,e,s,l);for(let x=0;x<p.length;x+=r)i.enqueue(p.slice(x,x+r)),await new Promise((f)=>setTimeout(f,0))}else{let p=[],x=new RegExp(T.source,"g"),f;while((f=x.exec(c))!==null)p.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of p){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await n(I,y,e,s,l);i.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await n(_.content,y,e,s,l);i.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await n(_,y,e,s,l);i.enqueue(C)}}}}else{let h=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let p=await n(d.content,y,e,s,l);i.enqueue(p)}else if(d.type==="suspense"&&d.name){let p=`stx-suspense-${d.name}`;i.enqueue(`<div id="${p}" data-suspense="${d.name}" style="display:contents;">
2
+ import{b,u,n,g,A}from"./chunk-gyrmwwgm.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,s;M.lastIndex=0;while((s=M.exec(e))!==null){if(s.index>o){let a=e.slice(o,s.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let r=s[1],i=s[2];t.push({type:"suspense",name:r,content:i}),o=s.index+s[0].length}if(o<e.length){let r=e.slice(o);if(r.trim())t.push({type:t.length===0?"shell":"content",content:r})}if(t.length===0)t.push({type:"shell",content:e});return t}async function Du(e,t={},o={}){let s={...A,...o,streaming:{...q,...o.streaming}},r=s.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),w=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),m=w?w[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(m.trim())await u(m,y,e);let E=H(c),l=new Set;if(!E.some((h)=>h.type==="suspense")){let h=s.streaming?.strategy||"auto",S=new RegExp(T.source,"g");if(!(h!=="manual"&&S.test(c))){let p=await n(c,y,e,s,l);for(let x=0;x<p.length;x+=r)i.enqueue(p.slice(x,x+r)),await new Promise((f)=>setTimeout(f,0))}else{let p=[],x=new RegExp(T.source,"g"),f;while((f=x.exec(c))!==null)p.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of p){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await n(I,y,e,s,l);i.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await n(_.content,y,e,s,l);i.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await n(_,y,e,s,l);i.enqueue(C)}}}}else{let h=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let p=await n(d.content,y,e,s,l);i.enqueue(p)}else if(d.type==="suspense"&&d.name){let p=`stx-suspense-${d.name}`;i.enqueue(`<div id="${p}" data-suspense="${d.name}" style="display:contents;">
3
3
  <template data-suspense-fallback>Loading...</template>
4
4
  </div>`),h.set(d.name,n(d.content,y,e,s,l))}i.enqueue(`
5
5
  <script>
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{gd,vi,md,wi,Mc,Lc,Bt,_n,hd,jc,Bc,yd,f}from"./chunk-8vkmt2xf.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-1h6swnze.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{Bt as buildCss,jc as extractClassNames,Lc as fingerprintConfig,Bc as generateCss,hd as getCachedCSS,gd as getCssServeAsset,f as injectCss,vi as loadCssEngine,wi as loadCssEngineConfig,_n as rebuildCss,md as resetCssCache,Mc as resolveUserCssConfig,yd as withLinkedModuleBundles};
2
+ import{gd,vi,md,wi,Mc,Lc,Bt,_n,hd,jc,Bc,yd,f}from"./chunk-gyrmwwgm.js";import"./chunk-r00nn2qs.js";import"./chunk-y255yybn.js";import"./chunk-1m5cjrpw.js";import"./chunk-5wep11np.js";import"./chunk-a0ygyftk.js";import"./chunk-6vmvra0f.js";import"./chunk-qmh6f1bt.js";import"./chunk-m92q2jyt.js";import"./chunk-ahyq08mp.js";import"./chunk-g1ae3haw.js";import"./chunk-gsp3627d.js";import"./chunk-pvfx0dgz.js";export{Bt as buildCss,jc as extractClassNames,Lc as fingerprintConfig,Bc as generateCss,hd as getCachedCSS,gd as getCssServeAsset,f as injectCss,vi as loadCssEngine,wi as loadCssEngineConfig,_n as rebuildCss,md as resetCssCache,Mc as resolveUserCssConfig,yd as withLinkedModuleBundles};