@stacksjs/stx 0.2.346 → 0.2.348

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 (77) hide show
  1. package/dist/binding-manifest.js +2 -0
  2. package/dist/{chunk-qp7sk0ex.js → chunk-05dbtcqr.js} +1 -1
  3. package/dist/chunk-08v51z39.js +2 -0
  4. package/dist/{chunk-t83m2pkm.js → chunk-1nhpc0hz.js} +1 -1
  5. package/dist/{chunk-zz2yxsf9.js → chunk-2dy1yerz.js} +1 -1
  6. package/dist/{chunk-akb6mgrb.js → chunk-39tzaza0.js} +1 -1
  7. package/dist/{chunk-21mmq3aj.js → chunk-42akykta.js} +1 -1
  8. package/dist/{chunk-fvvdq3ev.js → chunk-4956wxhq.js} +1 -1
  9. package/dist/{chunk-7hjjckat.js → chunk-5md1ycw2.js} +1 -1
  10. package/dist/{chunk-km92eab7.js → chunk-6nwrt02y.js} +1 -1
  11. package/dist/{chunk-dyy74sdv.js → chunk-72x80y39.js} +1 -1
  12. package/dist/{chunk-1xts7768.js → chunk-7j6vf641.js} +1 -1
  13. package/dist/{chunk-j8s9akdq.js → chunk-7pn9m07r.js} +1 -1
  14. package/dist/{chunk-wbp4vbm0.js → chunk-8fxbexvd.js} +1 -1
  15. package/dist/{chunk-9jbssgem.js → chunk-8m0g0h4x.js} +146 -10
  16. package/dist/{chunk-mph46gkj.js → chunk-9kmhwbwy.js} +12 -10
  17. package/dist/chunk-a8dyw9eg.js +32 -0
  18. package/dist/{chunk-3pggfwbf.js → chunk-bhjq5phg.js} +1 -1
  19. package/dist/{chunk-1bws4afs.js → chunk-c33jgh9n.js} +9 -9
  20. package/dist/chunk-cdt3dm8h.js +2 -0
  21. package/dist/{chunk-ddsgfmhv.js → chunk-cj5t2xsa.js} +1 -1
  22. package/dist/{chunk-rf2cejt3.js → chunk-d8gna0pj.js} +1 -1
  23. package/dist/{chunk-8tghv8cf.js → chunk-d9wq2e7a.js} +1 -1
  24. package/dist/{chunk-vw83y4we.js → chunk-djrrczet.js} +2 -2
  25. package/dist/{chunk-k5hv1qqy.js → chunk-e0qrfg4x.js} +1 -1
  26. package/dist/{chunk-vzbcdxd5.js → chunk-e1y8m2yp.js} +1 -1
  27. package/dist/{chunk-k80kr2t2.js → chunk-f32by983.js} +1 -1
  28. package/dist/{chunk-kfkf9v2d.js → chunk-f5veee11.js} +1 -1
  29. package/dist/{chunk-s3jyec9k.js → chunk-fb4gkrcw.js} +1 -1
  30. package/dist/{chunk-es275g3w.js → chunk-h0ntb2x4.js} +1 -1
  31. package/dist/{chunk-rwk5hwvk.js → chunk-hxta7f82.js} +1 -1
  32. package/dist/{chunk-1djdz98r.js → chunk-j6tdkr06.js} +1 -1
  33. package/dist/{chunk-1caep9rn.js → chunk-kzyd1gnx.js} +1 -1
  34. package/dist/{chunk-maq5jag2.js → chunk-mw33297e.js} +1 -1
  35. package/dist/chunk-mw3k7607.js +2 -0
  36. package/dist/{chunk-bxwanj4g.js → chunk-mz459926.js} +1 -1
  37. package/dist/{chunk-1xayahc6.js → chunk-na1wndvy.js} +1 -1
  38. package/dist/{chunk-v7aa7v85.js → chunk-p3p4d6g1.js} +1 -1
  39. package/dist/{chunk-xytgvfbf.js → chunk-pbt6f8gv.js} +2 -2
  40. package/dist/{chunk-5hhng72w.js → chunk-pg6esg0m.js} +1 -1
  41. package/dist/{chunk-tnm0nez5.js → chunk-pjg5v73e.js} +1 -1
  42. package/dist/{chunk-p04rck27.js → chunk-pw32a3x9.js} +1 -1
  43. package/dist/{chunk-1yh6pq6b.js → chunk-pwh8pbks.js} +1 -1
  44. package/dist/{chunk-s11e8aq9.js → chunk-r1x8wm83.js} +1 -1
  45. package/dist/{chunk-1vyz6kr8.js → chunk-rqfcafcy.js} +2 -2
  46. package/dist/{chunk-yg5r7bnm.js → chunk-swvm1wgn.js} +27 -3
  47. package/dist/{chunk-hfvknn03.js → chunk-t255mdy2.js} +2 -2
  48. package/dist/{chunk-7w66sc17.js → chunk-tbsvwy95.js} +1 -1
  49. package/dist/chunk-tg33an38.js +3745 -0
  50. package/dist/{chunk-jwe0cwff.js → chunk-vneewh3d.js} +6 -6
  51. package/dist/{chunk-q45fva8h.js → chunk-w1nnmcsr.js} +1 -1
  52. package/dist/{chunk-864m3xp2.js → chunk-xv6aydze.js} +1 -1
  53. package/dist/{chunk-b08taxsf.js → chunk-yj9kv14q.js} +1 -1
  54. package/dist/{chunk-byn0ptqt.js → chunk-zrjbge6f.js} +1 -1
  55. package/dist/{chunk-t2py7vc3.js → chunk-zwkkgham.js} +1 -1
  56. package/dist/cli.js +8 -8
  57. package/dist/config.js +16 -4
  58. package/dist/craft-entry.js +1 -1
  59. package/dist/craft.js +1 -1
  60. package/dist/dev-server/ts-css.js +16 -47
  61. package/dist/error-boundaries.d.ts +2 -13
  62. package/dist/error-boundaries.js +14 -6
  63. package/dist/process.js +13 -8
  64. package/dist/pwa.js +1 -1
  65. package/dist/signals.js +146 -10
  66. package/dist/ssg.js +2 -2
  67. package/dist/stx-virtual-ts.d.ts +16 -1
  68. package/dist/stx-virtual-ts.js +44 -3
  69. package/dist/typecheck.js +2 -0
  70. package/dist/types/config-types.d.ts +10 -0
  71. package/dist/utils.js +11 -2
  72. package/package.json +5 -5
  73. package/dist/chunk-fynb9e02.js +0 -2
  74. package/dist/chunk-pc8np1bb.js +0 -2
  75. package/dist/chunk-skd72bn4.js +0 -33
  76. package/dist/chunk-washyj03.js +0 -2
  77. package/dist/chunk-zdq7emrd.js +0 -3745
@@ -16,6 +16,8 @@ export function classifyAttribute(name) {
16
16
  return "for";
17
17
  if (isRuntimeEventName(bare))
18
18
  return "event";
19
+ if (name.startsWith("@"))
20
+ return "event";
19
21
  return "attr";
20
22
  }
21
23
  if (name.startsWith("x-")) {
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Te as a}from"./chunk-dyy74sdv.js";import"./chunk-zdq7emrd.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-skd72bn4.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-21mmq3aj.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-yg5r7bnm.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{a as startInteractive};
2
+ import{Te as a}from"./chunk-72x80y39.js";import"./chunk-tg33an38.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-a8dyw9eg.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-42akykta.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-swvm1wgn.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{a as startInteractive};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ye as a}from"./chunk-fb4gkrcw.js";import"./chunk-pbt6f8gv.js";import"./chunk-57atgbyq.js";import"./chunk-t255mdy2.js";import"./chunk-tg33an38.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-a8dyw9eg.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-42akykta.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-swvm1wgn.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{a as startProductionServer};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Gp as b,Hp as c,Ip as d,Jp as e,lo as a}from"./chunk-zdq7emrd.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-skd72bn4.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-21mmq3aj.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-yg5r7bnm.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{d as validateClientScript,c as processOnceDirective,b as processJsonDirective,e as processDirectives,a as injectRouterScript};
2
+ import{Gp as b,Hp as c,Ip as d,Jp as e,lo as a}from"./chunk-tg33an38.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-a8dyw9eg.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-42akykta.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-swvm1wgn.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{d as validateClientScript,c as processOnceDirective,b as processJsonDirective,e as processDirectives,a as injectRouterScript};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Hi as a,Ii as b}from"./chunk-byn0ptqt.js";import"./chunk-7we3xfde.js";import"./chunk-tnm0nez5.js";import"./chunk-hfvknn03.js";import"./chunk-fvsefztj.js";import"./chunk-zdq7emrd.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-skd72bn4.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-21mmq3aj.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-yg5r7bnm.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{a as getStoreScript,b as clearStoreCache};
2
+ import{Hi as a,Ii as b}from"./chunk-zrjbge6f.js";import"./chunk-7we3xfde.js";import"./chunk-pjg5v73e.js";import"./chunk-t255mdy2.js";import"./chunk-fvsefztj.js";import"./chunk-tg33an38.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-a8dyw9eg.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-42akykta.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-swvm1wgn.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{a as getStoreScript,b as clearStoreCache};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ml as a,nl as b,ol as c,pl as d,ql as e,rl as f,sl as g}from"./chunk-hfvknn03.js";import"./chunk-89mqnh67.js";import"./chunk-y2f41kaq.js";import"./chunk-vhta1be7.js";import"./chunk-yg5r7bnm.js";import"./chunk-ejqpq0wc.js";export{e as productionApiDispatcher,g as isServerApiSource,b as generateApiTypes,a as discoverServerApi,f as createServerApi,d as createApiDispatcher,c as buildServerApi};
2
+ import{ml as a,nl as b,ol as c,pl as d,ql as e,rl as f,sl as g}from"./chunk-t255mdy2.js";import"./chunk-89mqnh67.js";import"./chunk-y2f41kaq.js";import"./chunk-vhta1be7.js";import"./chunk-swvm1wgn.js";import"./chunk-ejqpq0wc.js";export{e as productionApiDispatcher,g as isServerApiSource,b as generateApiTypes,a as discoverServerApi,f as createServerApi,d as createApiDispatcher,c as buildServerApi};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Et as H,Ht as F}from"./chunk-vhta1be7.js";import{Nw as I}from"./chunk-ejqpq0wc.js";import J from"fs";import z from"path";async function N(w,A,j){if(w.__stx_runtime_config)return;let b=H();if(b||j){w.__stx_runtime_config=b??F(j);return}let q=z.dirname(z.resolve(A));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((D)=>J.existsSync(z.join(q,D)))){let{loadStxConfig:D}=await import("./chunk-3pggfwbf.js"),G=await D(q);if(G.runtimeConfig)w.__stx_runtime_config=F(G.runtimeConfig);return}let B=z.dirname(q);if(B===q)return;q=B}}async function O(w,A){function j(b){if(b===null)return"null";if(Array.isArray(b))return`Array<${b.length?[...new Set(b.map(j))].join(" | "):"unknown"}>`;if(typeof b==="object")return`{ ${Object.entries(b).map(([q,B])=>`readonly ${JSON.stringify(q)}: ${j(B)}`).join("; ")} }`;return typeof b}await Bun.write(z.join(w,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
2
+ import{Et as H,Ht as F}from"./chunk-vhta1be7.js";import{Nw as I}from"./chunk-ejqpq0wc.js";import J from"fs";import z from"path";async function N(w,A,j){if(w.__stx_runtime_config)return;let b=H();if(b||j){w.__stx_runtime_config=b??F(j);return}let q=z.dirname(z.resolve(A));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((D)=>J.existsSync(z.join(q,D)))){let{loadStxConfig:D}=await import("./chunk-bhjq5phg.js"),G=await D(q);if(G.runtimeConfig)w.__stx_runtime_config=F(G.runtimeConfig);return}let B=z.dirname(q);if(B===q)return;q=B}}async function O(w,A){function j(b){if(b===null)return"null";if(Array.isArray(b))return`Array<${b.length?[...new Set(b.map(j))].join(" | "):"unknown"}>`;if(typeof b==="object")return`{ ${Object.entries(b).map(([q,B])=>`readonly ${JSON.stringify(q)}: ${j(B)}`).join("; ")} }`;return typeof b}await Bun.write(z.join(w,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
3
3
  declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${j(A.public??{})} }
4
4
  `),await Bun.write(z.join(w,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
5
5
  declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${j(A.private??{})} }
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{mo as a,no as b,oo as c,po as d,qo as e,ro as f,so as g,to as h,uo as i,vo as j,wo as k,xo as l,yo as m}from"./chunk-zdq7emrd.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-skd72bn4.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-21mmq3aj.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-yg5r7bnm.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{m as stripStxRuntimeImports,b as scanScriptTags,l as rewriteStxImportSpecifiers,j as processSignals,h as processScriptSetup,f as preEvalLiteralReactiveIfs,c as parseLoopExpression,d as hasSignalsSyntax,k as findMarkupIndexOutsideScripts,i as extractExports,g as convertSignalLoopsToAttributes,e as convertSignalDirectivesToAttributes,a as clearScriptScanCache};
2
+ import{mo as a,no as b,oo as c,po as d,qo as e,ro as f,so as g,to as h,uo as i,vo as j,wo as k,xo as l,yo as m}from"./chunk-tg33an38.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-a8dyw9eg.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-42akykta.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-swvm1wgn.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{m as stripStxRuntimeImports,b as scanScriptTags,l as rewriteStxImportSpecifiers,j as processSignals,h as processScriptSetup,f as preEvalLiteralReactiveIfs,c as parseLoopExpression,d as hasSignalsSyntax,k as findMarkupIndexOutsideScripts,i as extractExports,g as convertSignalLoopsToAttributes,e as convertSignalDirectivesToAttributes,a as clearScriptScanCache};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Am as O,Ho as R,Jp as H,lq as x,qr as g}from"./chunk-zdq7emrd.js";import b from"path";var v={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},M=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var T=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function f(q){let B=[],Q=0,G;T.lastIndex=0;while((G=T.exec(q))!==null){if(G.index>Q){let X=q.slice(Q,G.index);if(X.trim())B.push({type:B.length===0?"shell":"content",content:X})}let J=G[1],K=G[2];B.push({type:"suspense",name:J,content:K}),Q=G.index+G[0].length}if(Q<q.length){let J=q.slice(Q);if(J.trim())B.push({type:B.length===0?"shell":"content",content:J})}if(B.length===0)B.push({type:"shell",content:q});return B}async function r(q,B={},Q={}){let G={...g,...Q,streaming:{...v,...Q.streaming}},J=G.streaming?.bufferSize||16384;return new ReadableStream({async start(K){try{let X=await Bun.file(q).text(),z=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),L=z?z[1]:"",Y=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),j={...B,__filename:q,__dirname:b.dirname(q)};if(L.trim())await R(L,j,q);let D=f(Y),$=new Set;if(!D.some((w)=>w.type==="suspense")){let w=G.streaming?.strategy||"auto",U=new RegExp(M.source,"g");if(!(w!=="manual"&&U.test(Y))){let F=await H(Y,j,q,G,$);for(let V=0;V<F.length;V+=J)K.enqueue(F.slice(V,V+J)),await new Promise((W)=>setTimeout(W,0))}else{let F=[],V=new RegExp(M.source,"g"),W;while((W=V.exec(Y))!==null)F.push({name:W[1],content:W[2],start:W.index,end:W.index+W[0].length});let y=0;for(let A of F){if(A.start>y){let k=Y.slice(y,A.start);if(k.trim()){let E=await H(k,j,q,G,$);K.enqueue(E),await new Promise((S)=>setTimeout(S,0))}}let I=await H(A.content,j,q,G,$);K.enqueue(I),await new Promise((k)=>setTimeout(k,0)),y=A.end}if(y<Y.length){let A=Y.slice(y);if(A.trim()){let I=await H(A,j,q,G,$);K.enqueue(I)}}}}else{let w=new Map;for(let Z of D)if(Z.type==="shell"||Z.type==="content"){let F=await H(Z.content,j,q,G,$);K.enqueue(F)}else if(Z.type==="suspense"&&Z.name){let F=`stx-suspense-${Z.name}`;K.enqueue(`<div id="${F}" data-suspense="${Z.name}" style="display:contents;">
2
+ import{Am as O,Ho as R,Jp as H,lq as x,qr as g}from"./chunk-tg33an38.js";import b from"path";var v={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},M=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var T=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function f(q){let B=[],Q=0,G;T.lastIndex=0;while((G=T.exec(q))!==null){if(G.index>Q){let X=q.slice(Q,G.index);if(X.trim())B.push({type:B.length===0?"shell":"content",content:X})}let J=G[1],K=G[2];B.push({type:"suspense",name:J,content:K}),Q=G.index+G[0].length}if(Q<q.length){let J=q.slice(Q);if(J.trim())B.push({type:B.length===0?"shell":"content",content:J})}if(B.length===0)B.push({type:"shell",content:q});return B}async function r(q,B={},Q={}){let G={...g,...Q,streaming:{...v,...Q.streaming}},J=G.streaming?.bufferSize||16384;return new ReadableStream({async start(K){try{let X=await Bun.file(q).text(),z=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),L=z?z[1]:"",Y=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),j={...B,__filename:q,__dirname:b.dirname(q)};if(L.trim())await R(L,j,q);let D=f(Y),$=new Set;if(!D.some((w)=>w.type==="suspense")){let w=G.streaming?.strategy||"auto",U=new RegExp(M.source,"g");if(!(w!=="manual"&&U.test(Y))){let F=await H(Y,j,q,G,$);for(let V=0;V<F.length;V+=J)K.enqueue(F.slice(V,V+J)),await new Promise((W)=>setTimeout(W,0))}else{let F=[],V=new RegExp(M.source,"g"),W;while((W=V.exec(Y))!==null)F.push({name:W[1],content:W[2],start:W.index,end:W.index+W[0].length});let y=0;for(let A of F){if(A.start>y){let k=Y.slice(y,A.start);if(k.trim()){let E=await H(k,j,q,G,$);K.enqueue(E),await new Promise((S)=>setTimeout(S,0))}}let I=await H(A.content,j,q,G,$);K.enqueue(I),await new Promise((k)=>setTimeout(k,0)),y=A.end}if(y<Y.length){let A=Y.slice(y);if(A.trim()){let I=await H(A,j,q,G,$);K.enqueue(I)}}}}else{let w=new Map;for(let Z of D)if(Z.type==="shell"||Z.type==="content"){let F=await H(Z.content,j,q,G,$);K.enqueue(F)}else if(Z.type==="suspense"&&Z.name){let F=`stx-suspense-${Z.name}`;K.enqueue(`<div id="${F}" data-suspense="${Z.name}" style="display:contents;">
3
3
  <template data-suspense-fallback>Loading...</template>
4
4
  </div>`),w.set(Z.name,H(Z.content,j,q,G,$))}K.enqueue(`
5
5
  <script>
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Bt as a,Ct as b}from"./chunk-21mmq3aj.js";import"./chunk-vhta1be7.js";import"./chunk-ejqpq0wc.js";export{a as prepareRuntimeConfig,b as generateRuntimeConfigTypes};
2
+ import{Bt as a,Ct as b}from"./chunk-42akykta.js";import"./chunk-vhta1be7.js";import"./chunk-ejqpq0wc.js";export{a as prepareRuntimeConfig,b as generateRuntimeConfigTypes};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Gm as W,Jp as X}from"./chunk-zdq7emrd.js";import V from"fs";import M from"path";import*as Y from"readline";var j={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},Q={help:{description:"Show available commands",usage:"help [command]",handler:async(q,z)=>{if(q[0]&&Q[q[0]]){let A=Q[q[0]];console.log(`
2
+ import{Gm as W,Jp as X}from"./chunk-tg33an38.js";import V from"fs";import M from"path";import*as Y from"readline";var j={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},Q={help:{description:"Show available commands",usage:"help [command]",handler:async(q,z)=>{if(q[0]&&Q[q[0]]){let A=Q[q[0]];console.log(`
3
3
  ${j.bold}${q[0]}${j.reset} - ${A.description}`),console.log(` Usage: ${j.cyan}${A.usage}${j.reset}
4
4
  `)}else{console.log(`
5
5
  ${j.bold}Available Commands:${j.reset}
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Am as h,Bm as i,Cm as j,Dm as k,Em as l,Fm as m,Gm as n,Hm as o,Im as p,Jm as q,Km as r,tm as a,um as b,vm as c,wm as d,xm as e,ym as f,zm as g}from"./chunk-zdq7emrd.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-skd72bn4.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-21mmq3aj.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-yg5r7bnm.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{j as usesSignalsInScript,r as unescapeHtml,p as resetRejectedExpressionWarnings,g as replaceInterpolations,c as registerFilters,b as registerFilter,n as processExpressions,m as interpolateScriptsInTemplate,k as interpolateScriptExpressions,l as interpolateScriptAttributes,d as getAllFilters,f as findMustacheEnd,q as evaluateExpression,i as escapeHtmlValue,h as escapeHtml,a as defaultFilters,e as clearCustomFilters,o as applyFilters};
2
+ import{Am as h,Bm as i,Cm as j,Dm as k,Em as l,Fm as m,Gm as n,Hm as o,Im as p,Jm as q,Km as r,tm as a,um as b,vm as c,wm as d,xm as e,ym as f,zm as g}from"./chunk-tg33an38.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-a8dyw9eg.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-42akykta.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-swvm1wgn.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{j as usesSignalsInScript,r as unescapeHtml,p as resetRejectedExpressionWarnings,g as replaceInterpolations,c as registerFilters,b as registerFilter,n as processExpressions,m as interpolateScriptsInTemplate,k as interpolateScriptExpressions,l as interpolateScriptAttributes,d as getAllFilters,f as findMustacheEnd,q as evaluateExpression,i as escapeHtmlValue,h as escapeHtml,a as defaultFilters,e as clearCustomFilters,o as applyFilters};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Qo as a,Ro as b,So as c,To as d,Uo as e,Vo as f,Wo as g}from"./chunk-zdq7emrd.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-skd72bn4.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-21mmq3aj.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-yg5r7bnm.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{a as resetUnscopedSignalWarnings,g as processStackReplacements,f as processStackPushDirectives,e as processIncludes,b as partialsCache,c as onceStore,d as clearOnceStore};
2
+ import{Qo as a,Ro as b,So as c,To as d,Uo as e,Vo as f,Wo as g}from"./chunk-tg33an38.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-a8dyw9eg.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-42akykta.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-swvm1wgn.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{a as resetUnscopedSignalWarnings,g as processStackReplacements,f as processStackPushDirectives,e as processIncludes,b as partialsCache,c as onceStore,d as clearOnceStore};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{fo as b,go as c,ho as d}from"./chunk-zdq7emrd.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-skd72bn4.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-21mmq3aj.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import{mv as a}from"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-yg5r7bnm.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{b as rendersAsElement,c as processESImports,d as processComponents,a as freeIdentifiers};
2
+ import{fo as b,go as c,ho as d}from"./chunk-tg33an38.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-a8dyw9eg.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-42akykta.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import{mv as a}from"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-swvm1wgn.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{b as rendersAsElement,c as processESImports,d as processComponents,a as freeIdentifiers};
@@ -6500,6 +6500,89 @@ catch (e) {} }
6500
6500
  // Both return Promises and render into a temporary modal overlay.
6501
6501
 
6502
6502
  var _dialogId = 0;
6503
+
6504
+ // Shared across every open dialog, because four of the defects in #1998 were
6505
+ // each dialog acting as if it were the only one.
6506
+ var _dialogStack = [];
6507
+ // What WE set inert, so restoring never clears an app's own inert.
6508
+ var _dialogInerted = [];
6509
+ // Saved once, when the first dialog opens.
6510
+ var _dialogScrollLock = null;
6511
+
6512
+ /*
6513
+ * The page behind an aria-modal dialog does not scroll and is not reachable
6514
+ * by a virtual cursor (stacksjs/stx#1998, items 1 and 2).
6515
+ *
6516
+ * The backdrop is position:fixed;inset:0, so it stayed put while the content
6517
+ * behind it scrolled away underneath - the dialog claimed to be modal and the
6518
+ * page moved anyway. And the Tab trap, which #1875 added, only covers the
6519
+ * keyboard: aria-modal support for the virtual cursor is uneven, so a screen
6520
+ * reader could still browse the page behind the dialog.
6521
+ *
6522
+ * inert rather than aria-hidden on the siblings: aria-hidden on an element
6523
+ * that contains focus is itself a violation, and inert removes the subtree
6524
+ * from the tab order and the accessibility tree together. Everything except
6525
+ * the TOPMOST dialog goes inert, which also settles the two traps competing
6526
+ * for Tab while both were open - a backgrounded dialog's buttons stop being
6527
+ * focusable at all.
6528
+ */
6529
+ function _dialogSyncModality() {
6530
+ var top = _dialogStack.length ? _dialogStack[_dialogStack.length - 1] : null;
6531
+
6532
+ for (var i = 0; i < _dialogInerted.length; i++) {
6533
+ try { _dialogInerted[i].inert = false; }
6534
+ catch (_e) { /* element may be gone */ }
6535
+ }
6536
+ _dialogInerted = [];
6537
+
6538
+ if (!top) {
6539
+ if (_dialogScrollLock) {
6540
+ document.body.style.overflow = _dialogScrollLock.body;
6541
+ document.documentElement.style.overflow = _dialogScrollLock.html;
6542
+ document.body.style.paddingRight = _dialogScrollLock.pad;
6543
+ _dialogScrollLock = null;
6544
+ }
6545
+ return;
6546
+ }
6547
+
6548
+ if (!_dialogScrollLock) {
6549
+ _dialogScrollLock = {
6550
+ body: document.body.style.overflow,
6551
+ html: document.documentElement.style.overflow,
6552
+ pad: document.body.style.paddingRight
6553
+ };
6554
+ // Compensate for the scrollbar the lock removes, or the whole page shifts
6555
+ // sideways the moment a dialog opens.
6556
+ var gap = window.innerWidth - document.documentElement.clientWidth;
6557
+ if (gap > 0) {
6558
+ var existing = Number.parseFloat(window.getComputedStyle(document.body).paddingRight) || 0;
6559
+ document.body.style.paddingRight = (existing + gap) + 'px';
6560
+ }
6561
+ document.body.style.overflow = 'hidden';
6562
+ document.documentElement.style.overflow = 'hidden';
6563
+ }
6564
+
6565
+ var kids = document.body.children;
6566
+ for (var k = 0; k < kids.length; k++) {
6567
+ var kid = kids[k];
6568
+ if (kid === top || kid.inert) continue;
6569
+ try {
6570
+ kid.inert = true;
6571
+ _dialogInerted.push(kid);
6572
+ }
6573
+ catch (_e) { /* inert unsupported; the Tab trap still holds */ }
6574
+ }
6575
+ }
6576
+
6577
+ /** Dialogs animate unless the reader asked them not to (#1998 item 5). */
6578
+ function _dialogReducedMotion() {
6579
+ try {
6580
+ return !!(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches);
6581
+ }
6582
+ catch (_e) {
6583
+ return false;
6584
+ }
6585
+ }
6503
6586
  var _dialogIcons = {
6504
6587
  info: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#2563eb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>',
6505
6588
  warning: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#d97706" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>',
@@ -6527,14 +6610,23 @@ catch (e) {} }
6527
6610
  var icon = _dialogIcons[type] || _dialogIcons.info;
6528
6611
 
6529
6612
  return new Promise(function(resolve) {
6613
+ // Inline transitions cannot be reached by a stylesheet media query, so the
6614
+ // preference is read here instead (#1998 item 5). One matchMedia probe
6615
+ // rather than usePreferredReducedMotion(): that returns a signal with a
6616
+ // change listener, and an imperative dialog that reads the value once at
6617
+ // open time would leak one listener per call.
6618
+ var still = _dialogReducedMotion();
6619
+ var fade = still ? '' : 'transition:opacity 0.2s ease;';
6620
+ var scale = still ? '' : 'transition:transform 0.2s ease;';
6621
+
6530
6622
  var backdrop = document.createElement('div');
6531
6623
  backdrop.id = id;
6532
- backdrop.style.cssText = 'position:fixed;inset:0;z-index:999999;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease;font-family:system-ui,-apple-system,sans-serif';
6624
+ backdrop.style.cssText = 'position:fixed;inset:0;z-index:999999;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:' + (still ? '1' : '0') + ';' + fade + 'font-family:system-ui,-apple-system,sans-serif';
6533
6625
  backdrop.setAttribute('role', 'alertdialog');
6534
6626
  backdrop.setAttribute('aria-modal', 'true');
6535
6627
 
6536
6628
  var panel = document.createElement('div');
6537
- panel.style.cssText = 'max-width:24rem;width:calc(100% - 2rem);border-radius:0.75rem;padding:1.5rem;background:' + bg + ';color:' + textColor + ';box-shadow:0 20px 60px rgba(0,0,0,0.3);transform:scale(0.95);transition:transform 0.2s ease;text-align:center';
6629
+ panel.style.cssText = 'max-width:24rem;width:calc(100% - 2rem);border-radius:0.75rem;padding:1.5rem;background:' + bg + ';color:' + textColor + ';box-shadow:0 20px 60px rgba(0,0,0,0.3);transform:scale(' + (still ? '1' : '0.95') + ');' + scale + 'text-align:center';
6538
6630
 
6539
6631
  var iconDiv = document.createElement('div');
6540
6632
  iconDiv.style.cssText = 'display:flex;justify-content:center;margin-bottom:1rem';
@@ -6575,9 +6667,25 @@ catch (e) {} }
6575
6667
  if (closed) return;
6576
6668
  closed = true;
6577
6669
  document.removeEventListener('keydown', keyHandler, true);
6670
+
6671
+ // Out of the stack BEFORE resolving, so a caller that opens another
6672
+ // dialog the moment this one answers does not land under a backdrop
6673
+ // that is still fading.
6674
+ var at = _dialogStack.indexOf(backdrop);
6675
+ if (at !== -1) _dialogStack.splice(at, 1);
6676
+
6677
+ // The fade is 200ms and resolve() is immediate, so for those 200ms a
6678
+ // full-viewport element at z-index 999999 was still hit-testing at the
6679
+ // centre of the screen - after the caller's await had already returned
6680
+ // (#1998 item 6). Fading out is right; swallowing clicks is not.
6681
+ backdrop.style.pointerEvents = 'none';
6578
6682
  backdrop.style.opacity = '0';
6579
- panel.style.transform = 'scale(0.95)';
6580
- setTimeout(function() { backdrop.remove(); }, 200);
6683
+ if (!still) panel.style.transform = 'scale(0.95)';
6684
+ setTimeout(function() { backdrop.remove(); }, still ? 0 : 200);
6685
+
6686
+ // Unlocks the page and clears inert when this was the last dialog, or
6687
+ // hands modality back to the one underneath when it was not.
6688
+ _dialogSyncModality();
6581
6689
  if (previouslyFocused && typeof previouslyFocused.focus === 'function') {
6582
6690
  try { previouslyFocused.focus(); }
6583
6691
  catch (_e) { /* element may be gone; not worth failing the dialog over */ }
@@ -6585,8 +6693,11 @@ catch (e) {} }
6585
6693
  resolve(result);
6586
6694
  }
6587
6695
 
6696
+ // Declared out here rather than inside the branch: the focus decision
6697
+ // below needs to know whether a Cancel button exists at all.
6698
+ var cancelBtn = null;
6588
6699
  if (isConfirm) {
6589
- var cancelBtn = document.createElement('button');
6700
+ cancelBtn = document.createElement('button');
6590
6701
  cancelBtn.textContent = cancelText;
6591
6702
  cancelBtn.style.cssText = 'padding:0.5rem 1.25rem;border-radius:0.5rem;font-size:0.875rem;font-weight:500;cursor:pointer;border:1px solid ' + (isDark ? '#374151' : '#d1d5db') + ';background:transparent;color:' + textColor + ';transition:background 0.15s';
6592
6703
  cancelBtn.onmouseover = function() { this.style.background = isDark ? '#374151' : '#f3f4f6'; };
@@ -6607,11 +6718,15 @@ catch (e) {} }
6607
6718
  panel.appendChild(btnRow);
6608
6719
  backdrop.appendChild(panel);
6609
6720
  document.body.appendChild(backdrop);
6721
+ _dialogStack.push(backdrop);
6722
+ _dialogSyncModality();
6610
6723
 
6611
6724
  // Animate in
6612
- void backdrop.offsetHeight;
6613
- backdrop.style.opacity = '1';
6614
- panel.style.transform = 'scale(1)';
6725
+ if (!still) {
6726
+ void backdrop.offsetHeight;
6727
+ backdrop.style.opacity = '1';
6728
+ panel.style.transform = 'scale(1)';
6729
+ }
6615
6730
 
6616
6731
  // Escape, plus a real focus trap.
6617
6732
  //
@@ -6624,6 +6739,11 @@ catch (e) {} }
6624
6739
  // walked straight out into the page behind it. Capture phase so the trap
6625
6740
  // wins over anything the page has bound.
6626
6741
  var keyHandler = function(e) {
6742
+ // Every dialog binds its own capture-phase handler on document and none
6743
+ // of them checked whether they were on top, so ONE Escape resolved every
6744
+ // open dialog at once (#1998 item 4). The backgrounded dialogs are inert
6745
+ // too, which is what stops their traps competing for Tab.
6746
+ if (_dialogStack.length && _dialogStack[_dialogStack.length - 1] !== backdrop) return;
6627
6747
  if (e.key === 'Escape') {
6628
6748
  e.preventDefault();
6629
6749
  cleanup(isConfirm ? false : undefined);
@@ -6653,8 +6773,24 @@ catch (e) {} }
6653
6773
  };
6654
6774
  document.addEventListener('keydown', keyHandler, true);
6655
6775
 
6656
- // Focus the primary button
6657
- okBtn.focus();
6776
+ /*
6777
+ * Initial focus, which was an unconditional okBtn.focus() (#1998 item 3).
6778
+ *
6779
+ * type: 'error' already paints that button red, so the API knows the
6780
+ * action is destructive - and still handed it the keyboard, where a stray
6781
+ * Enter or Space confirmed the delete. An error-type confirm now defaults
6782
+ * to Cancel, and defaultFocus overrides either way.
6783
+ *
6784
+ * An alert has only one button, so it keeps it: there is nothing
6785
+ * destructive to land on and focus has to go somewhere inside the trap.
6786
+ */
6787
+ var focusTarget = okBtn;
6788
+ if (isConfirm && cancelBtn) {
6789
+ var want = opts.defaultFocus;
6790
+ if (want === 'cancel' || (!want && type === 'error')) focusTarget = cancelBtn;
6791
+ else if (want === 'confirm') focusTarget = okBtn;
6792
+ }
6793
+ focusTarget.focus();
6658
6794
  });
6659
6795
  }
6660
6796
 
@@ -1,17 +1,19 @@
1
1
  // @bun
2
- import"./chunk-ejqpq0wc.js";var N=0;function P(){return`eb-${++N}-${Date.now().toString(36)}`}function W(q,z={},A){let j=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return q.replace(j,(D,F,J,K)=>{let L=P(),M=Q(F||"");return T(L,J.trim(),K.trim(),M)})}function Q(q){let z={},A=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,j;while((j=A.exec(q))!==null){let D=j[1],F=j[2]||j[3]||j[4];switch(D){case"id":z.id=F;break;case"logErrors":z.logErrors=F==="true";break}}return z}function T(q,z,A,j){let D=j.logErrors!==!1;return`
3
- <div class="stx-error-boundary" data-boundary-id="${q}" data-has-error="false">
4
- <div class="stx-error-boundary-content" data-boundary-content="${q}">
5
- ${z}
2
+ import"./chunk-ejqpq0wc.js";var Z=0;function $(){return`eb-${++Z}-${Date.now().toString(36)}`}var U=/<!--stx-render-failed:([a-z-]+)-->/g;function w(q){return q.replace(U,"")}function O(q,z={},J){let j=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return q.replace(j,(Q,P,T,W)=>{let X=$(),Y=C(P||"");return G(X,T.trim(),W.trim(),Y)})}function C(q){let z={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,j;while((j=J.exec(q))!==null){let Q=j[1],P=j[2]||j[3]||j[4];switch(Q){case"id":z.id=P;break;case"logErrors":z.logErrors=P==="true";break}}return z}function G(q,z,J,j){let Q=j.logErrors!==!1,P=U.test(z);U.lastIndex=0;let T=P?` <div class="stx-error-boundary-fallback" data-boundary-fallback="${q}">
3
+ ${J}
4
+ </div>`:` <div class="stx-error-boundary-content" data-boundary-content="${q}">
5
+ ${w(z)}
6
6
  </div>
7
7
  <div class="stx-error-boundary-fallback" data-boundary-fallback="${q}" style="display: none;">
8
- ${A}
9
- </div>
8
+ ${J}
9
+ </div>`;return`
10
+ <div class="stx-error-boundary" data-boundary-id="${q}" data-has-error="${P}">
11
+ ${T}
10
12
  </div>
11
13
  <script>
12
14
  (function() {
13
15
  const boundaryId = '${q}';
14
- const logErrors = ${D};
16
+ const logErrors = ${Q};
15
17
  const boundary = document.querySelector('[data-boundary-id="' + boundaryId + '"]');
16
18
  const contentEl = document.querySelector('[data-boundary-content="' + boundaryId + '"]');
17
19
  const fallbackEl = document.querySelector('[data-boundary-fallback="' + boundaryId + '"]');
@@ -119,7 +121,7 @@ import"./chunk-ejqpq0wc.js";var N=0;function P(){return`eb-${++N}-${Date.now().t
119
121
  };
120
122
  })();
121
123
  </script>
122
- `}async function U(q,z,A){try{return await q()}catch(j){if(A)A(j instanceof Error?j:Error(String(j)));else console.error("[stx:errorBoundary] SSR Error:",j);return z}}function X(q,z={}){let A=z.onError?(j)=>z.onError(j,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(j)=>U(j,q,A)}function Y(){return`
124
+ `}async function H(q,z,J){try{return await q()}catch(j){if(J)J(j instanceof Error?j:Error(String(j)));else console.error("[stx:errorBoundary] SSR Error:",j);return z}}function V(q,z={}){let J=z.onError?(j)=>z.onError(j,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(j)=>H(j,q,J)}function v(){return`
123
125
  /* STX Error Boundary Styles */
124
126
  .stx-error-boundary {
125
127
  position: relative;
@@ -163,7 +165,7 @@ import"./chunk-ejqpq0wc.js";var N=0;function P(){return`eb-${++N}-${Date.now().t
163
165
  color: #fecaca;
164
166
  }
165
167
  }
166
- `}function Z(){return`
168
+ `}function x(){return`
167
169
  // STX Error Boundary Runtime
168
170
  (function() {
169
171
  if (typeof window === 'undefined') return;
@@ -228,4 +230,4 @@ import"./chunk-ejqpq0wc.js";var N=0;function P(){return`eb-${++N}-${Date.now().t
228
230
 
229
231
  console.log('[stx] Error boundary runtime initialized');
230
232
  })();
231
- `}export{U as withErrorBoundary,W as processErrorBoundaryDirectives,Z as generateErrorBoundaryRuntime,Y as generateErrorBoundaryCSS,X as createErrorBoundary};
233
+ `}export{H as withErrorBoundary,w as stripRenderFailedMarkers,O as processErrorBoundaryDirectives,x as generateErrorBoundaryRuntime,v as generateErrorBoundaryCSS,V as createErrorBoundary};
@@ -0,0 +1,32 @@
1
+ // @bun
2
+ import{nt as EJ}from"./chunk-y2f41kaq.js";import{Nw as xJ}from"./chunk-ejqpq0wc.js";import G from"path";import{hasLocalConfig as TJ}from"bunfig";var UJ={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function y(J){return`--stx-${J}`}function f(J,Q){let Z=Q.lastIndexOf("-");if(Z===-1)return typeof J[Q]==="string"?J[Q]:void 0;let $=J[Q.slice(0,Z)];if(!$||typeof $!=="object")return;let U=$[Q.slice(Z+1)];return typeof U==="string"?U:void 0}function jJ(J){let Q={};for(let[Z,$]of Object.entries(UJ)){let U=f(J,$.light);if(U===void 0)continue;Q[Z]=`var(${y(Z)}, ${U})`}return Q}function FJ(J){let Q=[],Z=[];for(let[$,U]of Object.entries(UJ)){let j=f(J,U.light),F=f(J,U.dark);if(j===void 0)continue;if(Q.push(` ${y($)}: ${j};`),F!==void 0)Z.push(` ${y($)}: ${F};`)}if(Q.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...Q,"}",".dark {",...Z,"}",""].join(`
3
+ `)}var WJ={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function XJ(J){return`--stx-radius-${J}`}function VJ(){let J={};for(let[Q,Z]of Object.entries(WJ))J[Q]=`var(${XJ(Q)}, ${Z.value})`;return J}function qJ(){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(WJ).map(([J,Q])=>` ${XJ(J)}: ${Q.value};`),"}",""].join(`
4
+ `)}function zJ(J){return typeof J==="object"&&J!==null&&!Array.isArray(J)}function C(J,Q){let Z={...J};for(let[$,U]of Object.entries(Q))Z[$]=zJ(U)&&zJ(Z[$])?C(Z[$],U):U;return Z}function GJ(J={},Q={}){let Z=J.theme||{},$=Q.theme||{},{extend:U,...j}=$,{extend:F,...X}=Z,W=X.colors||{};X.colors={...W,...jJ(W)};let V=X.borderRadius||{};X.borderRadius={...V,...VJ()};let q=C(X,j),z=C(F||{},U||{});if(Object.keys(z).length>0)q.extend=z;let w=[...J.safelist||[],...Q.safelist||[]],K={...J.shortcuts||{},...Q.shortcuts||{}},D=[...J.preflights||[],...Q.preflights||[]];return{config:{...J,...Q,theme:q,safelist:w,shortcuts:K,...D.length>0?{preflights:D}:{},content:[],output:""},safelist:w,shortcuts:K,includePreflight:Q.preflight!==!1,minify:Q.minify===!0,tokenCSS:FJ(W)+qJ()}}var T=/<script\b[^>]*>/iy,p=/<\/script\s*>/ig,b=/<style\b[^>]*>/iy,m=/<\/style\s*>/ig;function YJ(J,Q,Z,$){Z.lastIndex=Q;let U=Z.exec(J);if(!U||U.index!==Q)return-1;$.lastIndex=Z.lastIndex;let j=$.exec(J);if(!j)return-1;return j.index+j[0].length}function h(J,Q){return YJ(J,Q,T,p)}function wJ(J,Q){return YJ(J,Q,b,m)}function gJ(J,Q){if(!J.startsWith("<!--",Q))return-1;let Z=J.indexOf("-->",Q+4);if(Z===-1)return-1;return Z+3}function BJ(J,Q){if(J.startsWith("<!--",Q)){let U=gJ(J,Q);return U===-1?J.length:U}if(T.lastIndex=Q,T.exec(J)?.index===Q){p.lastIndex=T.lastIndex;let U=p.exec(J);return U?U.index+U[0].length:J.length}if(b.lastIndex=Q,b.exec(J)?.index===Q){m.lastIndex=b.lastIndex;let U=m.exec(J);return U?U.index+U[0].length:J.length}return-1}function uJ(J,Q){let Z=[],$=0,U=J.length,j=!1,F=null;while($<U){let X=J[$];if(j){if(F){if(X===F)F=null}else if(X==='"'||X==="'")F=X;else if(X===">")j=!1;$++;continue}if(X!=="<"){let z=J.indexOf("<",$+1);if(z===-1)break;$=z;continue}let W=Q(J,$);if(W>$){Z.push({start:$,end:W,token:J.slice($,W)}),$=W;continue}let V=BJ(J,$);if(V>$){$=V;continue}let q=J.charCodeAt($+1);if(q>=65&&q<=90||q>=97&&q<=122)j=!0;$++}return Z}function KQ(J){let Q=0,Z=0,$=0,U=!1,j=null;while($<J.length){if(U){let z=J[$];if(j){if(z===j)j=null}else if(z==='"'||z==="'")j=z;else if(z===">")U=!1;$++;continue}let F=J.indexOf("<",$),X=F===-1?J.length:F;while($<X){let z=J[$++];if(z==="{")Q++;else if(z==="}")Z++;if(Q>=2&&Z>=2)return!0}if(F===-1)break;let W=BJ(J,F);if(W>F){$=W;continue}let V=J.charCodeAt(F+1),q=V===47?J.charCodeAt(F+2):V;if(q>=65&&q<=90||q>=97&&q<=122)U=!0;$=F+1}return!1}function LJ(J,Q){while(J.size>=Q){let Z=J.keys().next();if(Z.done)return;J.delete(Z.value)}}var dJ=65536,pJ=12,g=new Map;function i(J,Q,Z,$){let U=$!==void 0&&J.length>=dJ,j=U?`${$}\x00${J}`:"";if(U){let q=g.get(j);if(q)return{output:q.output,tokens:q.tokens.slice()}}let F=uJ(J,Q);if(F.length===0)return{output:J,tokens:[]};let X=F.map((q)=>q.token),W="",V=0;for(let q=0;q<F.length;q++){let z=F[q];W+=J.slice(V,z.start),W+=Z(z.token,q),V=z.end}if(W+=J.slice(V),U)return LJ(g,pJ),g.set(j,{output:W,tokens:X}),{output:W,tokens:X.slice()};return{output:W,tokens:X}}var mJ=65536,hJ=4,u=new Map;function d(J,Q,Z){return{output:Q,scripts:Z,restore:($)=>$===Q?J:iJ($,Z)}}function DQ(J){let Q=J.length>=mJ;if(Q){let U=u.get(J);if(U)return d(J,U.output,U.scripts.slice())}let{output:Z,tokens:$}=i(J,h,(U,j)=>`\x00STX_SCRIPT_${j}\x00`);if(Q)return LJ(u,hJ),u.set(J,{output:Z,scripts:$}),d(J,Z,$.slice());return d(J,Z,$)}function iJ(J,Q){if(Q.length===0)return J;return J.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,$)=>Q[+$]??"")}function HJ(J,Q=""){let Z=`${J}${Q}`,$=0;for(let U=0;U<Z.length;U++){let j=Z.charCodeAt(U);$=($<<5)-$+j,$=$&$}return`stx-${Math.abs($).toString(36)}`}function OJ(J,Q,Z={}){let{prefix:$="",preserveHost:U=!0,scopeKeyframes:j=!0,scopeCustomProperties:F=!1}=Z;if(!J.trim())return"";let X=r(J),W=[],V=new Map;if(j)for(let q of X){let z=q.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let w=z[1],K=`${Q}_${w}`;V.set(w,K)}}for(let q of X){let z=KJ(q,Q,$,U,V,F);W.push(z)}return W.join(`
5
+
6
+ `)}function r(J){let Q=[],Z=J.replace(/\/\*[\s\S]*?\*\//g,""),$=0,U="",j=!1,F="";for(let X=0;X<Z.length;X++){let W=Z[X];if(W==="@"&&$===0)j=!0;if(W==="{")$++;else if(W==="}"){if($--,$===0){if(j){F+=W;let V=F.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(V){let[,q,z,w]=V;if(q==="keyframes")Q.push({selector:`@keyframes ${z.trim()}`,declarations:w.trim()});else if(q==="media"||q==="supports"||q==="container"){let K=r(w);Q.push({selector:`@${q} ${z.trim()}`,declarations:K.map((D)=>`${D.selector} { ${D.declarations} }`).join(`
7
+ `)})}else Q.push({selector:`@${q} ${z.trim()}`,declarations:w.trim()})}F="",j=!1}else if(U.trim()){U+=W;let V=U.match(/([^{]+)\{([^}]*)\}/);if(V)Q.push({selector:V[1].trim(),declarations:V[2].trim()});U=""}continue}}if(j)F+=W;else U+=W}return Q}function KJ(J,Q,Z,$,U,j){let{selector:F,declarations:X}=J;if(F.startsWith("@")){if(F.startsWith("@keyframes")){let q=F.replace("@keyframes ","").trim();return`@keyframes ${U.get(q)||q} { ${X} }`}if(F.startsWith("@media")||F.startsWith("@supports")||F.startsWith("@container")){let z=r(`x { ${X} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((w)=>KJ(w,Q,Z,$,U,j)).join(`
8
+ `);return`${F} {
9
+ ${z}
10
+ }`}return`${F} { ${X} }`}let W=rJ(F,Q,Z,$),V=X;for(let[q,z]of U)V=V.replace(new RegExp(`\\b${q}\\b`,"g"),z);if(j)V=V.replace(/--([a-z-]+)/gi,`--${Q}-$1`);return`${W} { ${V} }`}function rJ(J,Q,Z,$){let U=J.split(",").map((F)=>F.trim()),j=[];for(let F of U){if(F.startsWith(":host")){if($)j.push(F);else{let V=F.replace(/:host(\([^)]*\))?/,`.${Q}$1`);j.push(V)}continue}if(F.includes("::slotted")){j.push(F);continue}if(F===":root"){j.push(`:root .${Q}`);continue}let X=Z?`${Z} .${Q}`:`.${Q}`;j.push(`${X} ${F}`);let W=nJ(F,Q);if(W)j.push(Z?`${Z} ${W}`:W)}return j.join(", ")}function nJ(J,Q){let Z=0,$=J.length;for(let W=0;W<J.length;W++){let V=J[W];if(V==="["||V==="(")Z++;else if(V==="]"||V===")")Z--;else if(Z===0&&(V===" "||V===">"||V==="+"||V==="~")){$=W;break}}let U=J.slice(0,$),j=J.slice($);if(!U)return"";let F=U.length,X=0;for(let W=0;W<U.length;W++){let V=U[W];if(V==="["||V==="(")X++;else if(V==="]"||V===")")X--;else if(Z===0&&X===0&&V===":"){F=W;break}}return`${U.slice(0,F)}.${Q}${U.slice(F)}${j}`}var NJ=String.raw`(?<![\w-])scoped(?![\w-])`,n=/<style\s+([^>]*)>/gi,DJ=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,MJ=new RegExp(NJ,"i"),cJ=new RegExp(NJ,"gi"),c=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function lJ(J){n.lastIndex=0;let Q=n.exec(J);while(Q!==null){if(MJ.test(Q[1]))return!0;Q=n.exec(J)}return!1}function l(J){let Q=new Set,Z=[];c.lastIndex=0;let $=c.exec(J);while($!==null){let U=$[0].trim();if(Q.has(U))Z.push({start:$.index,end:$.index+$[0].length});else Q.add(U);$=c.exec(J)}return Z}function o(J){let Q=l(J);if(Q.length===0)return J;let Z=Array(Q.length+1),$=0;for(let U=0;U<Q.length;U++){let j=Q[U];Z[U]=J.slice($,j.start),$=j.end}return Z[Q.length]=J.slice($),Z.join("")}function AQ(J,Q){if(!lJ(J))return{html:J,hasScoped:!1};let Z=HJ(Q),$=`data-v-${Z}`,U=J,j=!1;if(DJ.lastIndex=0,U=U.replace(DJ,(F,X,W)=>{if(!MJ.test(X))return F;j=!0;let V=oJ(W,$),q=X.replace(cJ,"").trim(),z=q?` ${q}`:"";return`<style data-stx-scoped="${Z}"${z}>${V}</style>`}),!j)return{html:J,hasScoped:!1};return U=sJ(U,$),{html:U,hasScoped:!0}}function oJ(J,Q){return OJ(J,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Q}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Q}]`)}var aJ=(J)=>`\x00stx-scope-mask-${J}\x00`,IJ=/\u0000stx-scope-mask-(\d+)\u0000/g;function sJ(J,Q){let Z=i(J,(U,j)=>{let F=h(U,j);return F>j?F:wJ(U,j)},(U,j)=>aJ(j)),$=tJ(Z.output,Q);return IJ.lastIndex=0,$.replace(IJ,(U,j)=>Z.tokens[Number(j)])}function tJ(J,Q){let Z=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return J.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,($,U,j)=>{if(Z.has(U.toLowerCase()))return $;if($.includes(Q))return $;if(U.toLowerCase()==="style"||U.toLowerCase()==="script")return $;if(j)return $.replace(`<${U}${j}`,`<${U} ${Q}${j}`);if($.endsWith("/>"))return`<${U} ${Q} />`;return`<${U} ${Q}>`})}var Y={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"};import _J from"fs";class s{cache=new Map;maxSize;options;sizes;bytes=0;constructor(J=100,Q){this.maxSize=J,this.options=Q??null,this.sizes=Q?new Map:null}get byteSize(){return this.bytes}setMaxBytes(J){if(!this.options)return;this.options={...this.options,maxBytes:J};while(this.bytes>J&&this.cache.size>0){let Q=this.cache.keys().next().value;if(Q===void 0)break;this.delete(Q)}}get(J){if(!this.cache.has(J))return;let Q=this.cache.get(J);return this.cache.delete(J),this.cache.set(J,Q),Q}set(J,Q){if(this.cache.has(J))this.delete(J);let Z=this.options?this.options.sizeOf(Q):0;if(this.options&&Z>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+Z>this.options.maxBytes)){let $=this.cache.keys().next().value;if($===void 0)break;this.delete($)}if(this.cache.set(J,Q),this.sizes)this.sizes.set(J,Z),this.bytes+=Z}has(J){return this.cache.has(J)}delete(J){if(this.sizes){let Q=this.sizes.get(J);if(Q!==void 0)this.bytes-=Q,this.sizes.delete(J)}return this.cache.delete(J)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var M=new Map,eJ=500;function RQ(J,Q){if(Q?.includes("g"))return new RegExp(J,Q);let Z=`${J}:${Q||""}`;if(!M.has(Z)){if(M.size>=eJ){let $=M.keys().next().value;if($)M.delete($)}M.set(Z,new RegExp(J,Q))}return M.get(Z)}class PJ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(J){let Q=Array.from(new Set(J)),Z=Q.sort().join(","),$=this.pool.find((X)=>X.context.join(",")===Z);if($)return $.func;let U=this.fnCache,j=this.fnCacheMaxSize,F=(...X)=>{return(W)=>{try{let V=`${Z}:${W}`,q=U.get(V);if(!q){if(U.size>=j){let z=U.keys().next().value;if(z)U.delete(z)}q=Function(...Q,`
11
+ 'use strict';
12
+ try {
13
+ return ${W};
14
+ }
15
+ catch (e) {
16
+ if (e instanceof ReferenceError || e instanceof TypeError) {
17
+ return undefined;
18
+ }
19
+ throw e;
20
+ }
21
+ `),U.set(V,q)}return q(...X)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:F,context:Q.slice()});return F}clear(){this.pool.length=0,this.fnCache.clear()}}var TQ=new PJ;class AJ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(J){this.enabled=J}isEnabled(){return this.enabled}setBudget(J,Q){this.budgets.set(J,{warnThreshold:0.8,action:"warn",...Q})}setBudgets(J){for(let[Q,Z]of Object.entries(J))this.setBudget(Q,Z)}removeBudget(J){this.budgets.delete(J)}getBudgets(){let J={};for(let[Q,Z]of this.budgets.entries())J[Q]=Z;return J}onViolation(J){this.violationHandlers.push(J)}offViolation(J){let Q=this.violationHandlers.indexOf(J);if(Q!==-1)this.violationHandlers.splice(Q,1)}time(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}async timeAsync(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=await Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}checkBudget(J,Q){let Z=this.budgets.get(J);if(!Z)return;let $=Q/Z.maxTime*100,U=Z.warnThreshold!==void 0?Q>=Z.maxTime*Z.warnThreshold&&Q<Z.maxTime:!1,j=Q>=Z.maxTime;if(!U&&!j)return;let F={label:J,actualTime:Q,budgetTime:Z.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:U};this.violations.push(F);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(F)}catch{}let X=U?`[Performance Warning] "${J}" took ${Q.toFixed(2)}ms (${$.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${J}" took ${Q.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(X);break;case"warn":console.warn(X);break;case"error":console.error(X);break;case"throw":if(j)throw Error(X);else console.warn(X);break}}recordTime(J,Q){let Z=this.metrics.get(J);if(Z)Z.count++,Z.totalTime+=Q,Z.maxTime=Math.max(Z.maxTime,Q),Z.minTime=Math.min(Z.minTime,Q);else this.metrics.set(J,{count:1,totalTime:Q,maxTime:Q,minTime:Q})}getStats(J){if(J){let Z=this.metrics.get(J);if(!Z)return{};let $=this.budgets.get(J);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:$?.maxTime,budgetUtilization:$?Z.totalTime/Z.count/$.maxTime*100:void 0}}let Q={};for(let[Z,$]of this.metrics.entries()){let U=this.budgets.get(Z);Q[Z]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:U?.maxTime,budgetUtilization:U?$.totalTime/$.count/U.maxTime*100:void 0}}return Q}getViolations(J){if(J)return this.violations.filter((Q)=>Q.label===J);return[...this.violations]}getViolationStats(){let J={},Q=0,Z=0;for(let $ of this.violations)if(J[$.label]=(J[$.label]||0)+1,$.isWarning)Q++;else Z++;return{total:this.violations.length,byLabel:J,warnings:Q,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var a=null;function JQ(){if(!a)a=new AJ;return a}var bQ=new Proxy({},{get(J,Q){return JQ()[Q]}});var vJ=[];function RJ(J){let Q=new s(J);return vJ.push(Q),Q}function SQ(){for(let J of vJ)J.clear()}function t(J,...Q){return`${Q.map((Z)=>String(Z??"")).join("\x00")}\x00${J.length}\x00${Bun.hash(J)}`}function yQ(J){let Q=[];for(let Z of new Set(J))try{Q.push({path:Z,mtimeMs:_J.statSync(Z).mtimeMs})}catch{}return Q}function fQ(J){for(let Q of J)try{if(_J.statSync(Q.path).mtimeMs!==Q.mtimeMs)return!1}catch{return!1}return!0}var H=null,JJ=!1,L=null,v="",P=!1,SJ=256,I=new Map,O=new Map,N=null,R=null;function k(J){return Bun.hash(J).toString(16).padStart(16,"0").slice(0,16)}function e(J,Q){if(I.has(J))I.delete(J);else if(I.size>=SJ)I.delete(I.keys().next().value);I.set(J,Q)}function QQ(J){let Q=k(J);if(O.has(Q))O.delete(Q);else if(O.size>=SJ)O.delete(O.keys().next().value);return O.set(Q,J),Q}function rQ(J){let Q=O.get(J);if(Q===void 0)return;return O.delete(J),O.set(J,Q),Q}async function $Q(J){if(!N)return null;try{let Q=Bun.file(G.join(N,`cw-${k(J)}.css`));if(!await Q.exists())return null;return await Q.text()}catch{return null}}async function ZQ(J,Q){if(!N)return;try{if(!fs.existsSync(N))fs.mkdirSync(N,{recursive:!0});await Bun.write(G.join(N,`cw-${k(J)}.css`),Q)}catch{}}async function bJ(J){try{let Q=await import(J);if(Q&&Q.CSSGenerator)return{CSSGenerator:Q.CSSGenerator,config:Q.config,build:Q.build,defaultConfig:Q.defaultConfig,extractClasses:Q.extractClasses}}catch{}return null}var UQ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],jQ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function FQ(){let J=[],Q=process.cwd();while(Q!==G.dirname(Q)){for(let Z of["node_modules","pantry"])for(let $ of UQ)J.push(G.join(Q,Z,...$));Q=G.dirname(Q)}return J}function WQ(){let J=[],Q=process.env.HOME||process.env.USERPROFILE||"",Z=[Q&&G.join(Q,"Code","Tools","ts-css"),Q&&G.join(Q,"Code","Tools","crosswind"),Q&&G.join(Q,"repos","stacks-org","ts-css"),Q&&G.join(Q,"repos","stacks-org","crosswind"),G.join(process.cwd(),"..","ts-css"),G.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Z)J.push(G.join($,"packages","toolkit","dist","engine","index.js")),J.push(G.join($,"packages","toolkit","src","engine","index.ts"));if(Q)J.push(G.join(Q,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return J}async function yJ(){if(JJ)return H;JJ=!0;try{let J=async(U)=>{for(let j of U){if(!await Bun.file(j).exists())continue;let F=await bJ(j);if(F){if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded from ${G.dirname(G.dirname(j))}`);return F}}return null};if(process.env.CROSSWIND_SRC){let U=G.resolve(process.env.CROSSWIND_SRC),j=await J([U]);if(!j)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${U}`);return H=j,H}let Q=await J(FQ());if(Q)return H=Q,H;let Z=jQ;for(let U of Z){let j=await bJ(U);if(j){if(H=j,!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded`);return H}}let $=await J(WQ());if($)return H=$,H;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${Y.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${Y.reset}`),console.warn(`${Y.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${Y.reset}`),null}}function nQ(){QJ.clear(),H=null,JJ=!1,L=null,v="",I.clear(),O.clear(),R=null}var kJ=!1;async function fJ(J){try{let Q=TJ({name:"css",cwd:J})?"css":TJ({name:"crosswind",cwd:J})?"crosswind":null;if(!Q)return null;if(Q==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!kJ)kJ=!0,console.warn(`${Y.yellow}[ts-css]${Y.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:Z}=await import("bunfig"),$=await Z({name:Q,cwd:J,defaultConfig:{},checkEnv:!1,verbose:!1});if(!$?.path||!$.config||Object.keys($.config).length===0)return null;let U=G.relative(J,$.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from ${U||$.path}`);return $.config}catch(Q){if(Q instanceof Error&&Q.name==="ConfigNotFoundError")return null;return console.warn(`${Y.yellow}[ts-css]${Y.reset} Failed to load css config:`,Q instanceof Error?Q.message:Q),null}}async function XQ(J){let Q=null;try{let{loadStxConfig:Z}=await import("./chunk-bhjq5phg.js"),$=await Z(J);if($.css)if(typeof $.css==="string"){let U=G.isAbsolute($.css)?$.css:G.resolve(J,$.css);if(await Bun.file(U).exists()){let j=await import(U);Q=j.default||j,console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(Q={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let U=G.isAbsolute($.css.config)?$.css.config:G.resolve(J,$.css.config);if(await Bun.file(U).exists()){let j=await import(U);Q={...j.default||j,...Q}}}console.log(`${Y.green}[ts-css]${Y.reset} Using inline CSS config from stx.config.ts`)}}catch{}return Q||await fJ(J)}function VQ(J){try{let Q=new WeakSet;return k(JSON.stringify(J??{},(Z,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(Q.has($))return"[circular]";Q.add($)}return $})??"")}catch{return"unhashable"}}async function qQ(J){if(P)return v;P=!0;try{let Q=await yJ();if(!Q||!Q.build)return P=!1,"";if(!L)L=await fJ(J);if(!L)return P=!1,"";let Z=Q.defaultConfig?.theme||{},$=L.theme||{},U={...Q.defaultConfig,...L,theme:{...Z,...$,extend:{...Z.extend||{},...$.extend||{}}}},j=performance.now(),F=await Q.build(U),X=performance.now()-j;if(v=F.css,console.log(`${Y.cyan}[ts-css]${Y.reset} Built ${F.classes.size} classes in ${X.toFixed(1)}ms`),U.output){let W=G.isAbsolute(U.output)?U.output:G.join(J,U.output),V=G.dirname(W);if(!fs.existsSync(V))fs.mkdirSync(V,{recursive:!0});await Bun.write(W,F.css)}return P=!1,F.css}catch(Q){return console.error(`${Y.red}[ts-css]${Y.reset} Build error:`,Q),P=!1,v}}async function cQ(J){L=null,await qQ(J)}function lQ(){return v}function zQ(J){let Q=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,$=Z.exec(J);while($!==null){for(let F of $[1].split(/\s+/))if(F.trim())Q.add(F.trim());$=Z.exec(J)}let U=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,j=U.exec(J);while(j!==null){let F=j[1].match(/'([^']+)'/g);if(F){for(let X of F)for(let W of X.slice(1,-1).split(/\s+/))if(W.trim())Q.add(W.trim())}j=U.exec(J)}return Q}var QJ=RJ(64);async function GQ(J,Q){let Z=QJ.get(t(J,Q,R));if(Z!==void 0)return Z;let $=await YQ(J,Q);if($)QJ.set(t(J,Q,R),$);return $}async function YQ(J,Q){try{let Z=await yJ();if(!Z)return"";let $=typeof Z.extractClasses==="function"?Z.extractClasses(J):zQ(J);if($.size===0)return"";let U=Q?G.resolve(Q):process.cwd();if(!N)N=EJ(U,"cache");let j=[...$].sort().join(" "),F=`${R||"default"}::${j}`,X=I.get(F);if(X!==void 0)return e(F,X),X;let W=await $Q(F);if(W!==null)return e(F,W),W;if(!L)L=await XQ(U),R=VQ(L);let V=Z.defaultConfig||Z.config,q=L||{},z=GJ(V,q),{safelist:w,includePreflight:K,minify:D,tokenCSS:$J}=z,x=z.config,E=new Z.CSSGenerator(x),S=x.shortcuts||q.shortcuts||{},ZJ=Object.keys(S).filter((B)=>$.has(B)||w.includes(B));for(let B of w)if(!S[B])E.generate(B);for(let B of $)if(!S[B])E.generate(B);let A="";if(ZJ.length>0){let B=new Z.CSSGenerator(x);for(let CJ of ZJ)B.generate(CJ);if(A=B.toCSS(!1,D),A&&!A.endsWith(`
22
+ `))A+=`
23
+ `}let _=A+E.toCSS(K,D);return _=$J+_,e(F,_),ZQ(F,_),_}catch(Z){return console.warn("Failed to generate Css CSS:",Z),""}}async function oQ(J,Q,Z=!1,$=!1){let U=await GQ(J,Q);if(!U)return $?o(J):J;let j=Z?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${QQ(U)}.css">`:`<style data-css="generated">
24
+ ${U}
25
+ </style>`;if($)return wQ(J,j);let F=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(F.test(J)){let X=!1;return J.replace(F,()=>{if(X)return"";return X=!0,j})}if(J.includes("</head>"))return J.replace("</head>",`${j}
26
+ </head>`);if(J.includes("<body"))return J.replace(/<body([^>]*)>/,`<body$1>
27
+ ${j}`);return j+J}function wQ(J,Q){let Z=l(J).map((W)=>({...W,replacement:""})),$=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,U=$.exec(J);if(U!==null){let W=!0;while(U!==null)Z.push({start:U.index,end:U.index+U[0].length,replacement:W?Q:""}),W=!1,U=$.exec(J)}else{let W=J.indexOf("</head>");if(W!==-1)Z.push({start:W,end:W,replacement:`${Q}
28
+ `});else{let V=J.match(/<body([^>]*)>/);if(V?.index!==void 0)Z.push({start:V.index,end:V.index+V[0].length,replacement:`${V[0]}
29
+ ${Q}`});else Z.push({start:0,end:0,replacement:Q})}}Z.sort((W,V)=>W.start-V.start||W.end-V.end);for(let W=1;W<Z.length;W++)if(Z[W].start<Z[W-1].end)return BQ(o(J),Q);let j=Array(Z.length*2+1),F=0,X=0;for(let W of Z)j[X++]=J.slice(F,W.start),j[X++]=W.replacement,F=W.end;return j[X]=J.slice(F),j.join("")}function BQ(J,Q){let Z=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(Z.test(J)){let $=!1;return J.replace(Z,()=>{if($)return"";return $=!0,Q})}if(J.includes("</head>"))return J.replace("</head>",`${Q}
30
+ </head>`);if(J.includes("<body"))return J.replace(/<body([^>]*)>/,`<body$1>
31
+ ${Q}`);return Q+J}
32
+ export{s as Cs,RQ as Ds,bQ as Es,RJ as Fs,SQ as Gs,t as Hs,yQ as Is,fQ as Js,h as Ks,wJ as Ls,gJ as Ms,uJ as Ns,KQ as Os,LJ as Ps,i as Qs,DQ as Rs,iJ as Ss,C as Ts,GJ as Us,l as Vs,o as Ws,AQ as Xs,Y as Ys,rQ as Zs,yJ as _s,nQ as $s,fJ as at,XQ as bt,VQ as ct,qQ as dt,cQ as et,lQ as ft,zQ as gt,GQ as ht,oQ as it};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{qr as a,rr as b,sr as c,tr as d,ur as e,vr as f}from"./chunk-zdq7emrd.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-skd72bn4.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-21mmq3aj.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-yg5r7bnm.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{f as validateConfig,b as resolveStxDirectories,c as loadStxConfig,e as defineStxConfig,a as defaultConfig,d as config};
2
+ import{qr as a,rr as b,sr as c,tr as d,ur as e,vr as f}from"./chunk-tg33an38.js";import"./chunk-8y1ve8tc.js";import"./chunk-njx93b4z.js";import"./chunk-bqdfbwdf.js";import"./chunk-89mqnh67.js";import"./chunk-xvh1k1a4.js";import"./chunk-a8dyw9eg.js";import"./chunk-y2f41kaq.js";import"./chunk-xj6bcwqa.js";import"./chunk-42akykta.js";import"./chunk-vhta1be7.js";import"./chunk-tc4pj651.js";import"./chunk-san1eq0r.js";import"./chunk-avwywzsj.js";import"./chunk-wj21f1e0.js";import"./chunk-d86q27j8.js";import"./chunk-72x62kch.js";import"./chunk-swvm1wgn.js";import"./chunk-9nrgjtah.js";import"./chunk-ejqpq0wc.js";export{f as validateConfig,b as resolveStxDirectories,c as loadStxConfig,e as defineStxConfig,a as defaultConfig,d as config};