@stacksjs/stx 0.2.465 → 0.2.467

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 (121) hide show
  1. package/dist/chunk-01jqpwpv.js +2 -0
  2. package/dist/{chunk-nmk9en1n.js → chunk-01zwbzyw.js} +324 -164
  3. package/dist/{chunk-qc7zybaa.js → chunk-02e24cym.js} +1 -1
  4. package/dist/{chunk-gasb5fhy.js → chunk-0gq32mfe.js} +2 -2
  5. package/dist/{chunk-ag1v2tkm.js → chunk-0nnmk0xv.js} +2399 -2398
  6. package/dist/{chunk-sgbgwezf.js → chunk-0v5dpk7r.js} +1 -1
  7. package/dist/{chunk-n003eq8w.js → chunk-1sdtg9np.js} +2 -2
  8. package/dist/{chunk-yc4hf2ea.js → chunk-2cqymwe8.js} +2 -2
  9. package/dist/chunk-2k0x6yc2.js +2 -0
  10. package/dist/{chunk-1byqqwgm.js → chunk-2tn3dkcy.js} +2 -2
  11. package/dist/{chunk-2nvnd83c.js → chunk-3ar8gdyd.js} +1 -1
  12. package/dist/chunk-4ahzhnfw.js +2 -0
  13. package/dist/{chunk-ysptfks9.js → chunk-4r2fg64t.js} +1 -1
  14. package/dist/{chunk-27k24mk0.js → chunk-4rj1y6j2.js} +1 -1
  15. package/dist/chunk-50xcmvad.js +2 -0
  16. package/dist/{chunk-se9qddyx.js → chunk-544e2jvd.js} +4 -4
  17. package/dist/chunk-60935ydz.js +2 -0
  18. package/dist/{chunk-3q3174cn.js → chunk-62ckway4.js} +2 -2
  19. package/dist/chunk-63kwa14j.js +2 -0
  20. package/dist/{chunk-2e4pegf1.js → chunk-6h93aacc.js} +1 -1
  21. package/dist/{chunk-y8h823cb.js → chunk-74j18qk0.js} +28 -28
  22. package/dist/{chunk-azcvytqc.js → chunk-762z26nw.js} +1 -1
  23. package/dist/chunk-7fjatz47.js +2 -0
  24. package/dist/chunk-7j1cpa9d.js +2 -0
  25. package/dist/{chunk-cstvhr0r.js → chunk-7rgds0w1.js} +1099 -1099
  26. package/dist/{chunk-gm6g6gar.js → chunk-8efg91ak.js} +2 -2
  27. package/dist/chunk-9mnfma5c.js +2 -0
  28. package/dist/{chunk-5mmqe3hj.js → chunk-9zx4p42m.js} +1 -1
  29. package/dist/chunk-b772p9d9.js +2 -0
  30. package/dist/{chunk-pxmbee61.js → chunk-c2s3xx78.js} +5 -5
  31. package/dist/{chunk-5e6p2ndj.js → chunk-cfk3skk4.js} +1 -1
  32. package/dist/chunk-cg8hg6cs.js +3 -0
  33. package/dist/{chunk-pw34r8r5.js → chunk-cmej3vrr.js} +1 -1
  34. package/dist/{chunk-gjrbnzap.js → chunk-d2zw2e5m.js} +3 -3
  35. package/dist/chunk-dv4g1506.js +2 -0
  36. package/dist/{chunk-x9a5a282.js → chunk-e15a8txv.js} +2 -2
  37. package/dist/{chunk-en3e0y6m.js → chunk-ee0gqprs.js} +1 -1
  38. package/dist/chunk-ehwzvs2d.js +2 -0
  39. package/dist/{chunk-5zaj400e.js → chunk-fqpd0cfq.js} +1 -1
  40. package/dist/chunk-gp4x34wk.js +2 -0
  41. package/dist/chunk-h4g5m641.js +2 -0
  42. package/dist/{chunk-xt4990k8.js → chunk-hh7r7zpe.js} +1 -1
  43. package/dist/{chunk-n6p2at6g.js → chunk-hpm19gkn.js} +1 -1
  44. package/dist/chunk-jqppdrhr.js +2 -0
  45. package/dist/{chunk-7knc20mz.js → chunk-k9sbgax8.js} +1 -1
  46. package/dist/chunk-kw1p1140.js +2 -0
  47. package/dist/chunk-m08fk6ds.js +12 -0
  48. package/dist/{chunk-nmnbdtsq.js → chunk-m62a5a28.js} +6 -6
  49. package/dist/{chunk-7xckcy9x.js → chunk-n4wfef43.js} +1 -1
  50. package/dist/{chunk-j9y50qt9.js → chunk-ptek61ts.js} +1 -1
  51. package/dist/chunk-pypadz0a.js +2 -0
  52. package/dist/chunk-qyq7j8hp.js +2 -0
  53. package/dist/chunk-r7a26zjz.js +2 -0
  54. package/dist/chunk-rcez4f14.js +2 -0
  55. package/dist/{chunk-32kk8y2r.js → chunk-rgwvqmhh.js} +1 -1
  56. package/dist/chunk-rz7xew70.js +2 -0
  57. package/dist/{chunk-0avd5kkb.js → chunk-s0xpe9cj.js} +20 -20
  58. package/dist/chunk-s6jh1701.js +2 -0
  59. package/dist/{chunk-1bazr47z.js → chunk-sjha9z8e.js} +1 -1
  60. package/dist/{chunk-ktvr45qg.js → chunk-t61vdbje.js} +6 -6
  61. package/dist/{chunk-4xcypfmg.js → chunk-tg39b5t1.js} +1 -1
  62. package/dist/chunk-tmbytj7c.js +2 -0
  63. package/dist/{chunk-4acykd9n.js → chunk-v0vadrje.js} +1 -1
  64. package/dist/{chunk-p7j2g8y2.js → chunk-v83bpj84.js} +4 -4
  65. package/dist/{chunk-z14y48en.js → chunk-vqdqf0cp.js} +3 -3
  66. package/dist/chunk-vxsm8q1c.js +18 -0
  67. package/dist/{chunk-abb9xmdg.js → chunk-w1vvzdp0.js} +1 -1
  68. package/dist/{chunk-jbdqs7t6.js → chunk-w5m8xrs4.js} +1 -1
  69. package/dist/{chunk-769t2y70.js → chunk-xf4s69fr.js} +1 -1
  70. package/dist/chunk-xjb0yzvq.js +2 -0
  71. package/dist/{chunk-gj90pnre.js → chunk-y36av1ac.js} +7 -7
  72. package/dist/chunk-y8923540.js +30 -0
  73. package/dist/{chunk-pfm6cfph.js → chunk-ynvce0q6.js} +2 -2
  74. package/dist/chunk-yq2mckms.js +2 -0
  75. package/dist/{chunk-9g339c7b.js → chunk-z80d9dd2.js} +2 -2
  76. package/dist/{chunk-vvb3wq2p.js → chunk-z990jtmx.js} +1 -1
  77. package/dist/chunk-zak38e27.js +2 -0
  78. package/dist/{chunk-6bwe6vsc.js → chunk-zmcvjkpv.js} +1 -1
  79. package/dist/cli.js +43 -43
  80. package/dist/client-script-bundler.js +1 -1
  81. package/dist/craft-entry.js +2 -2
  82. package/dist/craft.js +2 -2
  83. package/dist/database.js +2 -2
  84. package/dist/pwa.js +3 -3
  85. package/dist/signals.js +318 -158
  86. package/dist/ssg.js +2 -2
  87. package/dist/strip-literals.js +23 -8
  88. package/dist/theme-tokens.d.ts +83 -0
  89. package/dist/theme-tokens.js +57 -0
  90. package/dist/ts-css-config.js +6 -2
  91. package/package.json +5 -5
  92. package/dist/chunk-0880qx3m.js +0 -2
  93. package/dist/chunk-0zf49qxk.js +0 -2
  94. package/dist/chunk-1tsz7v68.js +0 -2
  95. package/dist/chunk-2mv3wh0s.js +0 -2
  96. package/dist/chunk-4wjef6d8.js +0 -18
  97. package/dist/chunk-6ry01675.js +0 -2
  98. package/dist/chunk-97ezbs97.js +0 -2
  99. package/dist/chunk-99qf5fff.js +0 -2
  100. package/dist/chunk-a201b6rx.js +0 -2
  101. package/dist/chunk-aqdkct70.js +0 -2
  102. package/dist/chunk-bb7p822h.js +0 -2
  103. package/dist/chunk-bj31r6sj.js +0 -2
  104. package/dist/chunk-c1gp4xjy.js +0 -2
  105. package/dist/chunk-c8z3fghp.js +0 -2
  106. package/dist/chunk-esc6fahf.js +0 -2
  107. package/dist/chunk-f2rh0zhs.js +0 -2
  108. package/dist/chunk-h5k0c1jp.js +0 -2
  109. package/dist/chunk-hqfgbtsy.js +0 -30
  110. package/dist/chunk-j2pdtq0d.js +0 -2
  111. package/dist/chunk-kewh1a68.js +0 -2
  112. package/dist/chunk-kvfcm30m.js +0 -2
  113. package/dist/chunk-nahzfs7d.js +0 -2
  114. package/dist/chunk-s1075erh.js +0 -2
  115. package/dist/chunk-s2fpethy.js +0 -2
  116. package/dist/chunk-tps20cx5.js +0 -2
  117. package/dist/chunk-ts3jftxq.js +0 -2
  118. package/dist/chunk-wfmy7a0b.js +0 -2
  119. package/dist/chunk-xsdj6k6c.js +0 -2
  120. package/dist/chunk-y3cqh2jv.js +0 -12
  121. package/dist/chunk-yn2d8x8m.js +0 -3
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{b,u,n,g,I}from"./chunk-ag1v2tkm.js";import q from"path";var M={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var O=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function z(e){let t=[],o=0,s;O.lastIndex=0;while((s=O.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 Ql(e,t={},o={}){let s={...I,...o,streaming:{...M,...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:q.dirname(e)};if(m.trim())await u(m,y,e);let E=z(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 k=c.slice(v,_.start);if(k.trim()){let D=await n(k,y,e,s,l);i.enqueue(D),await new Promise((H)=>setTimeout(H,0))}}let C=await n(_.content,y,e,s,l);i.enqueue(C),await new Promise((k)=>setTimeout(k,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,d,n,g,I}from"./chunk-0nnmk0xv.js";import q from"path";var M={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var O=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function z(e){let t=[],o=0,s;O.lastIndex=0;while((s=O.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 Ql(e,t={},o={}){let s={...I,...o,streaming:{...M,...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:q.dirname(e)};if(m.trim())await d(m,y,e);let E=z(c),u=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,u);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 k=c.slice(v,_.start);if(k.trim()){let D=await n(k,y,e,s,u);i.enqueue(D),await new Promise((H)=>setTimeout(H,0))}}let C=await n(_.content,y,e,s,u);i.enqueue(C),await new Promise((k)=>setTimeout(k,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await n(_,y,e,s,u);i.enqueue(C)}}}}else{let h=new Map;for(let l of E)if(l.type==="shell"||l.type==="content"){let p=await n(l.content,y,e,s,u);i.enqueue(p)}else if(l.type==="suspense"&&l.name){let p=`stx-suspense-${l.name}`;i.enqueue(`<div id="${p}" data-suspense="${l.name}" style="display:contents;">
3
3
  <template data-suspense-fallback>Loading...</template>
4
- </div>`),h.set(d.name,n(d.content,y,e,s,l))}i.enqueue(`
4
+ </div>`),h.set(l.name,n(l.content,y,e,s,u))}i.enqueue(`
5
5
  <script>
6
6
  (function() {
7
7
  window.__stxSuspense = window.__stxSuspense || {
@@ -17,7 +17,7 @@ import{b,u,n,g,I}from"./chunk-ag1v2tkm.js";import q from"path";var M={enabled:!0
17
17
  }
18
18
  };
19
19
  })();
20
- </script>`);let S=Array.from(h.entries()).map(async([d,p])=>{i.enqueue(await yo(d,p))});await Promise.all(S)}i.close()}catch(a){i.error(a)}}})}async function yo(e,t){try{let s=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
20
+ </script>`);let S=Array.from(h.entries()).map(async([l,p])=>{i.enqueue(await yo(l,p))});await Promise.all(S)}i.close()}catch(a){i.error(a)}}})}async function yo(e,t){try{let s=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
21
21
  <script>
22
22
  window.__stxSuspense.resolve('${e}', \`${s}\`);
23
23
  </script>`}catch(o){let s=o instanceof Error?o.message:String(o);return`
@@ -43,12 +43,12 @@ window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading conte
43
43
  }
44
44
  };
45
45
  })();
46
- </script>`;function A(e,t,o){if(!t||t<=0)return e;let s,r=new Promise((i,a)=>{s=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,r]).finally(()=>clearTimeout(s))}function ed(e,t=[],o={}){let s=o.timeoutMs??0;return new ReadableStream({async start(r){try{if(r.enqueue(e),t.length>0)r.enqueue(_a),await Promise.all(t.map(async(i)=>{let a=A(i.render(),s,i.id);r.enqueue(await yo(i.id,a))}));r.close()}catch(i){r.error(i)}}})}var B=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function td(e,t){return e.replace(B,(o,s,r)=>{let i=s.trim(),a=r.split(/@fallback/i),w=a[0].trim(),m=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[i]=w,`<div data-suspense="${i}">${m}</div>`})}function nd(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let o=Object.entries(t).filter(([,s])=>typeof s==="function");return o.length>0?o.map(([s,r])=>({id:s,render:r})):void 0}async function rd(e,t={},o={}){let s={...I,...o,streaming:{...M,...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:q.dirname(e)};if(m.trim())await u(m,y,e);let E=new Set,l=s.streaming?.strategy||"auto",R=new RegExp(T.source,"g");if(!(l!=="manual"&&R.test(c))){let S=await n(c,y,e,s,E);for(let d=0;d<S.length;d+=r)i.enqueue(S.slice(d,d+r))}else{let S=[],d=new RegExp(T.source,"g"),p;while((p=d.exec(c))!==null)S.push({name:p[1],content:p[2],start:p.index,end:p.index+p[0].length});let x=0;for(let f of S){if(f.start>x){let _=c.slice(x,f.start);if(_.trim()){let C=await n(_,y,e,s,E);i.enqueue(C)}}let v=await n(f.content,y,e,s,E);i.enqueue(v),x=f.end}if(x<c.length){let f=c.slice(x);if(f.trim()){let v=await n(f,y,e,s,E);i.enqueue(v)}}}i.close()}catch(a){i.error(a)}}})}async function sd(e,t={}){let o={...I,...t,streaming:{...M,...t.streaming}},s=await Bun.file(e).text(),r=s.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),i=r?r[1]:"",a=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=a,m={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let l=c[1],R=c[2];m[l]=R}let y=a.replace(T,"");return{renderShell:async(l={})=>{let R={...l,__filename:e,__dirname:q.dirname(e)};return await u(i,R,e),n(y,R,e,o,new Set)},renderSection:async(l,R={})=>{try{if(!m[l])return`<div class="error-message">Section "${b(l)}" not found in template "${b(e)}"</div>`;let h={...R,__filename:e,__dirname:q.dirname(e)};await u(i,h,e);let S=new Set;return await n(m[l],h,e,o,S)}catch(h){let S=h instanceof Error?h.message:String(h);return g("Expression",S,e,m[l]||"",0,m[l]||"")}},getSections:()=>Object.keys(m),getTemplate:()=>w}}var Ta={name:"suspense",hasEndTag:!0,handler:(e,t,o,s)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let r=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${r} -->${e}<!-- @endsuspense:${r} -->`}},Ra={name:"island",hasEndTag:!0,handler:(e,t,o,s)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let r=t[0].replace(/['"`]/g,""),i=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${r}-${Math.random().toString(36).substring(2,9)}`,w=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),m=w?w[1].trim():"",c=w?e.replace(w[0],""):e;return`<div data-island="${r}" data-island-id="${a}" data-priority="${i}">
46
+ </script>`;function A(e,t,o){if(!t||t<=0)return e;let s,r=new Promise((i,a)=>{s=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,r]).finally(()=>clearTimeout(s))}function eu(e,t=[],o={}){let s=o.timeoutMs??0;return new ReadableStream({async start(r){try{if(r.enqueue(e),t.length>0)r.enqueue(_a),await Promise.all(t.map(async(i)=>{let a=A(i.render(),s,i.id);r.enqueue(await yo(i.id,a))}));r.close()}catch(i){r.error(i)}}})}var B=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function tu(e,t){return e.replace(B,(o,s,r)=>{let i=s.trim(),a=r.split(/@fallback/i),w=a[0].trim(),m=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[i]=w,`<div data-suspense="${i}">${m}</div>`})}function nu(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let o=Object.entries(t).filter(([,s])=>typeof s==="function");return o.length>0?o.map(([s,r])=>({id:s,render:r})):void 0}async function ru(e,t={},o={}){let s={...I,...o,streaming:{...M,...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:q.dirname(e)};if(m.trim())await d(m,y,e);let E=new Set,u=s.streaming?.strategy||"auto",R=new RegExp(T.source,"g");if(!(u!=="manual"&&R.test(c))){let S=await n(c,y,e,s,E);for(let l=0;l<S.length;l+=r)i.enqueue(S.slice(l,l+r))}else{let S=[],l=new RegExp(T.source,"g"),p;while((p=l.exec(c))!==null)S.push({name:p[1],content:p[2],start:p.index,end:p.index+p[0].length});let x=0;for(let f of S){if(f.start>x){let _=c.slice(x,f.start);if(_.trim()){let C=await n(_,y,e,s,E);i.enqueue(C)}}let v=await n(f.content,y,e,s,E);i.enqueue(v),x=f.end}if(x<c.length){let f=c.slice(x);if(f.trim()){let v=await n(f,y,e,s,E);i.enqueue(v)}}}i.close()}catch(a){i.error(a)}}})}async function su(e,t={}){let o={...I,...t,streaming:{...M,...t.streaming}},s=await Bun.file(e).text(),r=s.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),i=r?r[1]:"",a=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=a,m={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let u=c[1],R=c[2];m[u]=R}let y=a.replace(T,"");return{renderShell:async(u={})=>{let R={...u,__filename:e,__dirname:q.dirname(e)};return await d(i,R,e),n(y,R,e,o,new Set)},renderSection:async(u,R={})=>{try{if(!m[u])return`<div class="error-message">Section "${b(u)}" not found in template "${b(e)}"</div>`;let h={...R,__filename:e,__dirname:q.dirname(e)};await d(i,h,e);let S=new Set;return await n(m[u],h,e,o,S)}catch(h){let S=h instanceof Error?h.message:String(h);return g("Expression",S,e,m[u]||"",0,m[u]||"")}},getSections:()=>Object.keys(m),getTemplate:()=>w}}var Ta={name:"suspense",hasEndTag:!0,handler:(e,t,o,s)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let r=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${r} -->${e}<!-- @endsuspense:${r} -->`}},Ra={name:"island",hasEndTag:!0,handler:(e,t,o,s)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let r=t[0].replace(/['"`]/g,""),i=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${r}-${Math.random().toString(36).substring(2,9)}`,w=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),m=w?w[1].trim():"",c=w?e.replace(w[0],""):e;return`<div data-island="${r}" data-island-id="${a}" data-priority="${i}">
47
47
  ${c}
48
48
  <script type="application/json" data-island-props="${a}">
49
49
  ${m?`{${m}}`:"{}"}
50
50
  </script>
51
- </div>`}};function od(e={}){let t=[];if(e.streaming?.enabled)t.push(Ta);if(e.hydration?.enabled)t.push(Ra);return t}async function id(e,t,o,s={}){return e}function ad(e,t={}){let o=new TextEncoder,s=e.pipeThrough(new TransformStream({transform(i,a){a.enqueue(o.encode(i))}})),r=new Headers(t.headers);if(!r.has("Content-Type"))r.set("Content-Type","text/html; charset=utf-8");if(!r.has("Transfer-Encoding"))r.set("Transfer-Encoding","chunked");if(!r.has("X-Content-Type-Options"))r.set("X-Content-Type-Options","nosniff");if(!r.has("X-Accel-Buffering"))r.set("X-Accel-Buffering","no");return new Response(s,{...t,headers:r})}function cd(e={mode:"full"}){let{mode:t,components:o={},dynamicImports:s=!0}=e,r=Object.entries(o).map(([i,a])=>`'${i}': ${s?`() => import('${a}')`:`require('${a}')`}`).join(`,
51
+ </div>`}};function ou(e={}){let t=[];if(e.streaming?.enabled)t.push(Ta);if(e.hydration?.enabled)t.push(Ra);return t}async function iu(e,t,o,s={}){return e}function au(e,t={}){let o=new TextEncoder,s=e.pipeThrough(new TransformStream({transform(i,a){a.enqueue(o.encode(i))}})),r=new Headers(t.headers);if(!r.has("Content-Type"))r.set("Content-Type","text/html; charset=utf-8");if(!r.has("Transfer-Encoding"))r.set("Transfer-Encoding","chunked");if(!r.has("X-Content-Type-Options"))r.set("X-Content-Type-Options","nosniff");if(!r.has("X-Accel-Buffering"))r.set("X-Accel-Buffering","no");return new Response(s,{...t,headers:r})}function cu(e={mode:"full"}){let{mode:t,components:o={},dynamicImports:s=!0}=e,r=Object.entries(o).map(([i,a])=>`'${i}': ${s?`() => import('${a}')`:`require('${a}')`}`).join(`,
52
52
  `);if(t==="loader")return`
53
53
  (function() {
54
54
  window.__stx = window.__stx || {};
@@ -191,4 +191,4 @@ else {
191
191
  stx.hydrate();
192
192
  }
193
193
  })();`}
194
- export{Ql,yo,_a,ed,td,nd,rd,sd,Ta,Ra,od,id,ad,cd};
194
+ export{Ql,yo,_a,eu,tu,nu,ru,su,Ta,Ra,ou,iu,au,cu};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{y}from"./chunk-2jbyks2t.js";import{P,Tt}from"./chunk-pf0d8y9n.js";import{w,He,L,o}from"./chunk-ag1v2tkm.js";import{ie,ht,yt}from"./chunk-z14y48en.js";import{Ae,Ut,ut,H}from"./chunk-gm6g6gar.js";import f from"path";var l=new Map;function v(a,s){for(let n of a.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(n[1])s.add(n[1]);for(let n of a.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let r of(n[1]??"").split(",")){let i=((r.includes(":")?r.split(":").pop():r)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(i))s.add(i)}for(let n of a.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let r of(n[1]??"").split(",")){let c=r.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(c))s.add(c)}}async function ql(a){let s;if(a)s=f.resolve(a);else{let t=await o();s=f.resolve(t.root||process.cwd(),t.storesDir||"stores")}let n=new Bun.Glob("*.ts"),r=[];try{for await(let t of n.scan({cwd:s,absolute:!0})){let e=f.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return H(l,s,"",""),null}let c=()=>[...new Set([...r,...r.flatMap((t)=>ie(t))])],i=Ae(c()),d=ut(l,s,i);if(d!==void 0)return d||null;if(r.length===0)return H(l,s,i,""),null;let p=[];for(let t of r){let e=await Bun.file(t).text();p.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}p.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let h=p.map((t)=>t.file),u=[],m=new Set,b=L({loader:"ts",target:"browser",define:w()});for(let t of h)try{let e=await Bun.file(t).text(),x=f.basename(t,".ts");if(v(e,m),ht(e))e=await yt(e,t,{projectRoot:process.cwd(),externalizeUserModules:!1});e=He(e),e=P(e),e=Tt(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=b.transformSync(e),u.push(`// Store: ${x}
2
+ import{y}from"./chunk-2jbyks2t.js";import{P,Tt}from"./chunk-pf0d8y9n.js";import{w,He,L,o}from"./chunk-0nnmk0xv.js";import{ie,ht,yt}from"./chunk-vqdqf0cp.js";import{Ae,Ut,dt,H}from"./chunk-8efg91ak.js";import f from"path";var l=new Map;function v(a,s){for(let n of a.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(n[1])s.add(n[1]);for(let n of a.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let r of(n[1]??"").split(",")){let i=((r.includes(":")?r.split(":").pop():r)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(i))s.add(i)}for(let n of a.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let r of(n[1]??"").split(",")){let c=r.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(c))s.add(c)}}async function ql(a){let s;if(a)s=f.resolve(a);else{let t=await o();s=f.resolve(t.root||process.cwd(),t.storesDir||"stores")}let n=new Bun.Glob("*.ts"),r=[];try{for await(let t of n.scan({cwd:s,absolute:!0})){let e=f.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return H(l,s,"",""),null}let c=()=>[...new Set([...r,...r.flatMap((t)=>ie(t))])],i=Ae(c()),d=dt(l,s,i);if(d!==void 0)return d||null;if(r.length===0)return H(l,s,i,""),null;let p=[];for(let t of r){let e=await Bun.file(t).text();p.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}p.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let h=p.map((t)=>t.file),u=[],m=new Set,b=L({loader:"ts",target:"browser",define:w()});for(let t of h)try{let e=await Bun.file(t).text(),x=f.basename(t,".ts");if(v(e,m),ht(e))e=await yt(e,t,{projectRoot:process.cwd(),externalizeUserModules:!1});e=He(e),e=P(e),e=Tt(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=b.transformSync(e),u.push(`// Store: ${x}
3
3
  ${e.trim()}`)}catch(e){console.warn(`[stx] Failed to load store ${t}:`,e)}if(u.length===0)return H(l,s,i,""),null;let g=u.join(`
4
4
 
5
5
  `),S=`;(function(){
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import"./chunk-pfm6cfph.js";import"./chunk-2n5pjbw9.js";import"./chunk-gjrbnzap.js";import{a}from"./chunk-7tt84v1y.js";import f from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},o=t.snapshotDir||a(e.root,"story","snapshots");await f.promises.mkdir(o,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((i)=>t.filter.some((p)=>i.fileName.toLowerCase().includes(p.toLowerCase())));for(let i of r)await h(i,o,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let o=e.story;if(!o)return;for(let r of o.variants){n.total++;let i=l.join(t,`${e.id}-${r.id}.snap`),p=g(r.source||""),c=await w(i);if(s.update||!c){let u={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:p};if(await f.promises.writeFile(i,JSON.stringify(u,null,2)),!c)n.new++;n.passed++}else try{let u=await f.promises.readFile(i,"utf-8"),m=JSON.parse(u);if(m.hash===p)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,p)})}catch(u){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${u}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await f.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
2
+ import"./chunk-ynvce0q6.js";import"./chunk-2n5pjbw9.js";import"./chunk-d2zw2e5m.js";import{a}from"./chunk-7tt84v1y.js";import f from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},o=t.snapshotDir||a(e.root,"story","snapshots");await f.promises.mkdir(o,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((i)=>t.filter.some((p)=>i.fileName.toLowerCase().includes(p.toLowerCase())));for(let i of r)await h(i,o,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let o=e.story;if(!o)return;for(let r of o.variants){n.total++;let i=l.join(t,`${e.id}-${r.id}.snap`),p=g(r.source||""),c=await w(i);if(s.update||!c){let u={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:p};if(await f.promises.writeFile(i,JSON.stringify(u,null,2)),!c)n.new++;n.passed++}else try{let u=await f.promises.readFile(i,"utf-8"),m=JSON.parse(u);if(m.hash===p)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,p)})}catch(u){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${u}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await f.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
3
3
  `)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Iu,Vo,Du,Uo,Za,Qa,xt,tn,Ou,ec,tc,nc,f}from"./chunk-0nnmk0xv.js";import"./chunk-d2zw2e5m.js";import"./chunk-2n5pjbw9.js";import"./chunk-0trfbqa7.js";import"./chunk-w5m8xrs4.js";import"./chunk-zydg3wgt.js";import"./chunk-y36av1ac.js";import"./chunk-v83bpj84.js";import"./chunk-ynvce0q6.js";import"./chunk-pf0d8y9n.js";import"./chunk-2jbyks2t.js";import"./chunk-88px183j.js";import"./chunk-jz7pvh7b.js";export{xt as buildCss,ec as extractClassNames,Qa as fingerprintConfig,tc as generateCss,Ou as getCachedCSS,Iu as getCssServeAsset,f as injectCss,Vo as loadCssEngine,Uo as loadCssEngineConfig,tn as rebuildCss,Du as resetCssCache,Za as resolveUserCssConfig,nc as withLinkedModuleBundles};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Br,$o,Eo,hu}from"./chunk-2tn3dkcy.js";export{Br as NATIVE_COMPONENTS,$o as compileToNative,Eo as createHotReloadServer,hu as default};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{So,ko,Co,mu}from"./chunk-s0xpe9cj.js";import"./chunk-vxsm8q1c.js";import"./chunk-0nnmk0xv.js";import"./chunk-d2zw2e5m.js";import"./chunk-2n5pjbw9.js";import"./chunk-0trfbqa7.js";import"./chunk-w5m8xrs4.js";import"./chunk-zydg3wgt.js";import"./chunk-y36av1ac.js";import"./chunk-v83bpj84.js";import"./chunk-ynvce0q6.js";import"./chunk-pf0d8y9n.js";import"./chunk-2jbyks2t.js";import"./chunk-88px183j.js";import"./chunk-jz7pvh7b.js";export{So as buildNative,mu as default,Co as getAvailableFormats,ko as getAvailableTargets};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{W,qr,Kr,Ha,wt,Lo,Xr,jo,wu,Ne,Gr,me}from"./chunk-0nnmk0xv.js";import"./chunk-d2zw2e5m.js";import"./chunk-2n5pjbw9.js";import{mi,s}from"./chunk-m08fk6ds.js";import"./chunk-0trfbqa7.js";import"./chunk-w5m8xrs4.js";import"./chunk-zydg3wgt.js";import"./chunk-y36av1ac.js";import"./chunk-v83bpj84.js";import"./chunk-ynvce0q6.js";import"./chunk-pf0d8y9n.js";import"./chunk-2jbyks2t.js";import"./chunk-88px183j.js";import"./chunk-jz7pvh7b.js";export{W as BROWSER_CORE_IMPORTS,Ha as STX_AUTO_IMPORTS,qr as extractAndStripCssImports,Ne as extractBridgeData,mi as findInterpolationEnd,jo as generateAutoImportDestructuring,wu as generateBrowserAutoImportDestructuring,Gr as generateServerDataBridge,wt as injectBrowserCoreAutoImports,me as processClientScript,Xr as referencesName,Kr as renderVendorStyleTags,s as stripCommentsAndLiterals,Lo as transformAutoImports};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{z}from"./chunk-9g339c7b.js";import R from"fs";import g from"path";import C from"crypto";var S=new Set(["webp","avif","jpeg","png"]),T=new Set(["cover","contain","fill","inside","outside"]),q=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),k=4096,D=80,U="cover";async function to(e,t){let r=t.routePath??"/_stx/img",h=new URL(e.url);if(h.pathname!==r)return null;let a=A(h,t);if(!a.ok)return new Response(a.error,{status:a.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:n,srcUrl:d,width:l,height:i,format:s,quality:u,fit:c}=a,m;try{m=R.statSync(n)}catch{return new Response(`Source image not found: ${d}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!m.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let w=t.cacheDir??".stx/cache/img";await R.promises.mkdir(w,{recursive:!0});let b=`${n}:${m.mtimeMs}:${m.size}`,I=`${l}x${i}:${s}:${u}:${c}`,f=C.createHash("sha256").update(`${b}|${I}`).digest("hex").slice(0,16),o=g.join(w,`${f}.${s}`),p={"Content-Type":z(s),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${f}"`,"X-Stx-Image-Cache":"HIT"};if(e.headers.get("if-none-match")===`"${f}"`)return new Response(null,{status:304,headers:p});let v=Bun.file(o);if(await v.exists())return new Response(v,{headers:p});try{let x=Buffer.from(await Bun.file(n).arrayBuffer()),{resizeAndConvert:P}=await L(),F=await P(x,{width:l,height:i,format:s,quality:u,fit:c});return await Bun.write(o,F),p["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(F),{headers:p})}catch(x){let P=x.message;return new Response(`Image processing failed: ${P}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function Gi(e){return async(t)=>await to(t,e)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}function A(e,t){let r=e.searchParams.get("src");if(!r)return{ok:!1,error:"Missing required param: src",status:400};if(!r.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(r.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let h=g.extname(r).toLowerCase();if(!q.has(h))return{ok:!1,error:`Unsupported source extension: ${h}`,status:400};let a=g.resolve(t.publicDir),n=g.resolve(a,r.slice(1));if(!n.startsWith(`${a}${g.sep}`)&&n!==a)return{ok:!1,error:"src is outside publicDir",status:400};let d=t.maxWidth??k,l=t.maxHeight??k,i=e.searchParams.get("w"),s=e.searchParams.get("h"),u=i?Number.parseInt(i,10):0,c=s?Number.parseInt(s,10):0;if(i&&(!Number.isFinite(u)||u<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(s&&(!Number.isFinite(c)||c<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!i&&!s)return{ok:!1,error:"At least one of w or h is required",status:400};let m=Math.min(u||d,d),w=Math.min(c||l,l),b=e.searchParams.get("f")||"webp";if(!S.has(b))return{ok:!1,error:`Invalid f (must be one of: ${[...S].join(", ")})`,status:400};let I=b,f=e.searchParams.get("q"),o=f?Number.parseInt(f,10):t.defaultQuality??D;if(!Number.isFinite(o)||o<1||o>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let y=e.searchParams.get("fit")||t.defaultFit||U;if(!T.has(y))return{ok:!1,error:`Invalid fit (must be one of: ${[...T].join(", ")})`,status:400};return{ok:!0,srcFsPath:n,srcUrl:r,width:m,height:w,format:I,quality:o,fit:y}}async function L(){return await import("./chunk-2nvnd83c.js")}
2
+ import{z}from"./chunk-z80d9dd2.js";import R from"fs";import g from"path";import C from"crypto";var S=new Set(["webp","avif","jpeg","png"]),T=new Set(["cover","contain","fill","inside","outside"]),q=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),k=4096,D=80,U="cover";async function to(e,t){let r=t.routePath??"/_stx/img",h=new URL(e.url);if(h.pathname!==r)return null;let a=A(h,t);if(!a.ok)return new Response(a.error,{status:a.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:n,srcUrl:d,width:l,height:i,format:s,quality:u,fit:c}=a,m;try{m=R.statSync(n)}catch{return new Response(`Source image not found: ${d}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!m.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let w=t.cacheDir??".stx/cache/img";await R.promises.mkdir(w,{recursive:!0});let b=`${n}:${m.mtimeMs}:${m.size}`,I=`${l}x${i}:${s}:${u}:${c}`,f=C.createHash("sha256").update(`${b}|${I}`).digest("hex").slice(0,16),o=g.join(w,`${f}.${s}`),p={"Content-Type":z(s),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${f}"`,"X-Stx-Image-Cache":"HIT"};if(e.headers.get("if-none-match")===`"${f}"`)return new Response(null,{status:304,headers:p});let v=Bun.file(o);if(await v.exists())return new Response(v,{headers:p});try{let x=Buffer.from(await Bun.file(n).arrayBuffer()),{resizeAndConvert:P}=await L(),F=await P(x,{width:l,height:i,format:s,quality:u,fit:c});return await Bun.write(o,F),p["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(F),{headers:p})}catch(x){let P=x.message;return new Response(`Image processing failed: ${P}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function Gi(e){return async(t)=>await to(t,e)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}function A(e,t){let r=e.searchParams.get("src");if(!r)return{ok:!1,error:"Missing required param: src",status:400};if(!r.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(r.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let h=g.extname(r).toLowerCase();if(!q.has(h))return{ok:!1,error:`Unsupported source extension: ${h}`,status:400};let a=g.resolve(t.publicDir),n=g.resolve(a,r.slice(1));if(!n.startsWith(`${a}${g.sep}`)&&n!==a)return{ok:!1,error:"src is outside publicDir",status:400};let d=t.maxWidth??k,l=t.maxHeight??k,i=e.searchParams.get("w"),s=e.searchParams.get("h"),u=i?Number.parseInt(i,10):0,c=s?Number.parseInt(s,10):0;if(i&&(!Number.isFinite(u)||u<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(s&&(!Number.isFinite(c)||c<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!i&&!s)return{ok:!1,error:"At least one of w or h is required",status:400};let m=Math.min(u||d,d),w=Math.min(c||l,l),b=e.searchParams.get("f")||"webp";if(!S.has(b))return{ok:!1,error:`Invalid f (must be one of: ${[...S].join(", ")})`,status:400};let I=b,f=e.searchParams.get("q"),o=f?Number.parseInt(f,10):t.defaultQuality??D;if(!Number.isFinite(o)||o<1||o>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let y=e.searchParams.get("fit")||t.defaultFit||U;if(!T.has(y))return{ok:!1,error:`Invalid fit (must be one of: ${[...T].join(", ")})`,status:400};return{ok:!0,srcFsPath:n,srcUrl:r,width:m,height:w,format:I,quality:o,fit:y}}async function L(){return await import("./chunk-3ar8gdyd.js")}
3
3
  export{to,Gi};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{K,hs,ys,bs,n}from"./chunk-0nnmk0xv.js";import"./chunk-d2zw2e5m.js";import"./chunk-2n5pjbw9.js";import"./chunk-0trfbqa7.js";import"./chunk-w5m8xrs4.js";import"./chunk-zydg3wgt.js";import"./chunk-y36av1ac.js";import"./chunk-v83bpj84.js";import"./chunk-ynvce0q6.js";import"./chunk-pf0d8y9n.js";import"./chunk-2jbyks2t.js";import"./chunk-88px183j.js";import"./chunk-jz7pvh7b.js";export{K as injectRouterScript,n as processDirectives,hs as processJsonDirective,ys as processOnceDirective,bs as validateClientScript};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{_o}from"./chunk-4wjef6d8.js";import{d}from"./chunk-yn2d8x8m.js";import{existsSync as z,mkdirSync as v,copyFileSync as k,chmodSync as T}from"fs";import{join as o,basename as te}from"path";import{spawn as E,execSync as re}from"child_process";import{tmpdir as M,homedir as q,platform as ae}from"os";var ld=`
2
+ import{_o}from"./chunk-vxsm8q1c.js";import{u}from"./chunk-cg8hg6cs.js";var lu=`
3
3
  <script>
4
4
  (function() {
5
5
  'use strict';
@@ -931,7 +931,7 @@ else if (data.type === 'event' && data.method) {
931
931
  }
932
932
  })();
933
933
  </script>
934
- `.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${a}`)}function dd(){return!1}function ud(e,r={}){let a=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(a,(i,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return bo(t)})}function wo(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let a=bo(r);if(e.includes("</head>"))return e.replace("</head>",`${a}
934
+ `.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${a}`)}function uu(){return!1}function du(e,r={}){let a=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(a,(i,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return bo(t)})}function wo(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let a=bo(r);if(e.includes("</head>"))return e.replace("</head>",`${a}
935
935
  </head>`);if(e.includes("<body"))return e.replace(/(<body[^>]*>)/,`$1
936
936
  ${a}`);return a+e}var jr={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:(e,r)=>{let a=e.checked?"checked":"",i=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
937
937
  <input type="checkbox" class="craft-checkbox" ${a} ${i}>
@@ -1365,7 +1365,7 @@ ${a}`);return a+e}var jr={button:{nativeType:"craft-button",fallbackTag:"button"
1365
1365
  }
1366
1366
  }
1367
1367
  </style>
1368
- `,pd=`
1368
+ `,pu=`
1369
1369
  <script id="craft-component-runtime">
1370
1370
  (function() {
1371
1371
  if (window.__stxCraftComponentRuntime) return;
@@ -2934,17 +2934,17 @@ ${a}`);return a+e}var jr={button:{nativeType:"craft-button",fallbackTag:"button"
2934
2934
  document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
2935
2935
  })();
2936
2936
  </script>
2937
- `;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,s,t)=>R("sidebar",s,t.trim(),r,a)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,s)=>R("sidebar",s,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,s,t)=>R(s,t,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,s,t,n)=>R(s,t,n.trim(),r,a)),e}function R(e,r,a,i,s){let t=i.components?.[e]||jr[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${a}</div>`;let n=A(r),c=[t.fallbackClasses||`${s}-${e}`];if(n.class)c.push(n.class),delete n.class;if(t.render)return n.__fallbackClasses=c.join(" "),t.render(n,a);let l=ee(n,t,c);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${l}>`;return`<${t.fallbackTag} ${l}>${a}</${t.fallbackTag}>`}function A(e){let r={},a=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,i;while((i=a.exec(e))!==null){let[s,t,n,c]=i,l=n??c;if(s.startsWith(":"))r[t]=l;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=l;else if(l===void 0)r[t]=!0;else r[t]=l}return r}function j(e,r){let a=I(String(e.id||`craft-sidebar-${K(r||JSON.stringify(e))}`)),i=Q(e.spaces)||Y(r),s=i.length?[]:X(e.sections)||F(r),t=String(e.selectedSpace||i[0]?.id||""),n=i.find((g)=>g.id===t)||i[0],c=String(e.selectedItem||e.selected||(i.length?n?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),l={id:a,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:c,sections:s,spaces:i,selectedSpace:t||void 0},f=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),p=Number(e.width||e.sidebarWidth||286),u=e.native===!1||e.native==="false"?"false":"true",x=l.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${C(l.searchPlaceholder)}"></div>`:"",b;if(i.length)b=G(i,t,c);else if(s.length)b=s.map((g)=>D(g,c)).join("");else b=r;return`<aside class="${h(f)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${h(a)}" data-native="${u}" style="--craft-sidebar-width:${p}px">
2937
+ `;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,s,t)=>R("sidebar",s,t.trim(),r,a)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,s)=>R("sidebar",s,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,s,t)=>R(s,t,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,s,t,n)=>R(s,t,n.trim(),r,a)),e}function R(e,r,a,i,s){let t=i.components?.[e]||jr[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${a}</div>`;let n=A(r),c=[t.fallbackClasses||`${s}-${e}`];if(n.class)c.push(n.class),delete n.class;if(t.render)return n.__fallbackClasses=c.join(" "),t.render(n,a);let d=ee(n,t,c);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${d}>`;return`<${t.fallbackTag} ${d}>${a}</${t.fallbackTag}>`}function A(e){let r={},a=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,i;while((i=a.exec(e))!==null){let[s,t,n,c]=i,d=n??c;if(s.startsWith(":"))r[t]=d;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=d;else if(d===void 0)r[t]=!0;else r[t]=d}return r}function j(e,r){let a=I(String(e.id||`craft-sidebar-${K(r||JSON.stringify(e))}`)),i=Q(e.spaces)||Y(r),s=i.length?[]:X(e.sections)||F(r),t=String(e.selectedSpace||i[0]?.id||""),n=i.find((g)=>g.id===t)||i[0],c=String(e.selectedItem||e.selected||(i.length?n?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),d={id:a,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:c,sections:s,spaces:i,selectedSpace:t||void 0},l=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),p=Number(e.width||e.sidebarWidth||286),f=e.native===!1||e.native==="false"?"false":"true",x=d.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${C(d.searchPlaceholder)}"></div>`:"",b;if(i.length)b=G(i,t,c);else if(s.length)b=s.map((g)=>D(g,c)).join("");else b=r;return`<aside class="${h(l)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${h(a)}" data-native="${f}" style="--craft-sidebar-width:${p}px">
2938
2938
  ${x}
2939
2939
  ${b}
2940
2940
  </aside>
2941
- <script type="application/json" data-craft-sidebar-config="${h(a)}">${Z(l)}</script>`}function H(e,r){let a=I(String(e.id||e.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${h(a)}">
2941
+ <script type="application/json" data-craft-sidebar-config="${h(a)}">${Z(d)}</script>`}function H(e,r){let a=I(String(e.id||e.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${h(a)}">
2942
2942
  ${e.label?`<div class="craft-sidebar-space-title">${C(String(e.label))}</div>`:""}
2943
2943
  ${r}
2944
2944
  </section>`}function V(e,r){let a=String(e.header||e.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${h(String(e.id||"section"))}">
2945
2945
  ${a?`<div class="craft-sidebar-section-title">${C(a)}</div>`:""}
2946
2946
  ${r}
2947
- </section>`}function W(e,r){let a={id:String(e.id||I(String(e.label||r||"item"))),label:String(e.label||r||""),icon:e.icon?String(e.icon):void 0,badge:e.badge?String(e.badge):void 0,tintColor:e.tintColor?String(e.tintColor):void 0};return O(a,String(e.selected||"")==="true")}function F(e){let r=[],a=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,i;while((i=a.exec(e))!==null){let s=A(i[1]||""),t=i[2]||"",n=String(s.id||I(String(s.header||s.title||`section-${r.length+1}`))),c=String(s.header||s.title||n),l=J(t);r.push({id:n,header:c,title:c,items:l})}return r}function J(e){let r=[],a=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,i;while((i=a.exec(e))!==null){let s=A(i[1]||""),t=String(s.label||(i[2]||"").replace(/<[^>]*>/g,"").trim()),n=String(s.id||I(t||`item-${r.length+1}`));r.push({id:n,label:t,icon:s.icon?String(s.icon):void 0,badge:s.badge?String(s.badge):void 0,tintColor:s.tintColor?String(s.tintColor):void 0})}return r}function Y(e){let r=[],a=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,i;while((i=a.exec(e))!==null){let s=A(i[1]||""),t=i[2]||"",n=String(s.label||s.title||`Space ${r.length+1}`);r.push({id:String(s.id||I(n)),label:n,icon:s.icon?String(s.icon):void 0,tint:s.tint?String(s.tint):void 0,sections:F(t)})}return r}function Q(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let r=JSON.parse(e);return Array.isArray(r)?r:void 0}catch{return}}function G(e,r,a){let i=e.map((t)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${h(t.id)}" data-selected="${t.id===r?"true":"false"}" title="${h(t.label||t.id)}">${t.icon?`<span class="craft-sidebar-item-icon" data-icon="${h(t.icon)}"></span>`:C((t.label||t.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${e.map((t)=>`<section class="craft-sidebar-space" data-space-id="${h(t.id)}" data-selected="${t.id===r?"true":"false"}">
2947
+ </section>`}function W(e,r){let a={id:String(e.id||I(String(e.label||r||"item"))),label:String(e.label||r||""),icon:e.icon?String(e.icon):void 0,badge:e.badge?String(e.badge):void 0,tintColor:e.tintColor?String(e.tintColor):void 0};return O(a,String(e.selected||"")==="true")}function F(e){let r=[],a=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,i;while((i=a.exec(e))!==null){let s=A(i[1]||""),t=i[2]||"",n=String(s.id||I(String(s.header||s.title||`section-${r.length+1}`))),c=String(s.header||s.title||n),d=J(t);r.push({id:n,header:c,title:c,items:d})}return r}function J(e){let r=[],a=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,i;while((i=a.exec(e))!==null){let s=A(i[1]||""),t=String(s.label||(i[2]||"").replace(/<[^>]*>/g,"").trim()),n=String(s.id||I(t||`item-${r.length+1}`));r.push({id:n,label:t,icon:s.icon?String(s.icon):void 0,badge:s.badge?String(s.badge):void 0,tintColor:s.tintColor?String(s.tintColor):void 0})}return r}function Y(e){let r=[],a=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,i;while((i=a.exec(e))!==null){let s=A(i[1]||""),t=i[2]||"",n=String(s.label||s.title||`Space ${r.length+1}`);r.push({id:String(s.id||I(n)),label:n,icon:s.icon?String(s.icon):void 0,tint:s.tint?String(s.tint):void 0,sections:F(t)})}return r}function Q(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let r=JSON.parse(e);return Array.isArray(r)?r:void 0}catch{return}}function G(e,r,a){let i=e.map((t)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${h(t.id)}" data-selected="${t.id===r?"true":"false"}" title="${h(t.label||t.id)}">${t.icon?`<span class="craft-sidebar-item-icon" data-icon="${h(t.icon)}"></span>`:C((t.label||t.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${e.map((t)=>`<section class="craft-sidebar-space" data-space-id="${h(t.id)}" data-selected="${t.id===r?"true":"false"}">
2948
2948
  ${t.label?`<div class="craft-sidebar-space-title">${C(t.label)}</div>`:""}
2949
2949
  ${t.sections.map((n)=>D(n,a)).join("")}
2950
2950
  </section>`).join("")}</div>
@@ -2955,16 +2955,16 @@ ${a}`);return a+e}var jr={button:{nativeType:"craft-button",fallbackTag:"button"
2955
2955
  ${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${h(e.icon)}"${a}></span>`:""}
2956
2956
  <span class="craft-sidebar-item-label">${C(e.label)}</span>
2957
2957
  ${e.badge?`<span class="craft-sidebar-item-badge">${C(e.badge)}</span>`:""}
2958
- </button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function K(e){let r=5381;for(let a=0;a<e.length;a++)r=r*33^e.charCodeAt(a);return(r>>>0).toString(36)}function C(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function h(e){return C(e).replace(/`/g,"&#96;")}function Z(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function ee(e,r,a){let i=[];i.push(`class="${a.join(" ")}"`),i.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)i.push(s);else if(t!==!1&&t!==void 0&&t!==null){let n=String(t).replace(/"/g,"&quot;");i.push(`${s}="${n}"`)}return i.join(" ")}function fd(e,r){jr[e]=r}function gd(){return{...jr}}async function So(e){let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||P(),format:e.format||"app",error:`Input file not found: ${e.input}`};let a=e.target||P(),i=e.format||ue(a),s=e.output||o(process.cwd(),"dist","native");if(!z(s))v(s,{recursive:!0});let t=await _o(e.input,{context:e.context,options:{isDev:!1}});if(t=wo(t,{debug:e.verbose}),t=xo(t),!t.includes("craft-component-styles")){if(t.includes("</head>"))t=t.replace("</head>",`${vo}
2959
- </head>`)}let n=e.name||te(e.input,".stx"),c=e.version||"1.0.0",l=e.craftPath||await fe();if(!l)return{success:!1,target:a,format:i,error:"Craft binary not found. Please install Craft or specify craftPath."};if(e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${a}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${l}`);let f;switch(a){case"macos":f=await ie(t,n,c,s,i,e,l);break;case"windows":f=await oe(t,n,c,s,i,e,l);break;case"linux":f=await ce(t,n,c,s,i,e,l);break;case"ios":f=await de(t,n,c,s,e,l);break;case"android":f=await le(t,n,c,s,e,l);break;default:f={success:!1,target:a,format:i,error:`Unsupported target: ${a}`}}return f.duration=Date.now()-r,f}catch(a){return{success:!1,target:e.target||P(),format:e.format||"app",error:a.message,duration:Date.now()-r}}}async function ie(e,r,a,i,s,t,n){let c=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,l=o(i,`${r}.app`),f=o(l,"Contents"),p=o(f,"MacOS"),u=o(f,"Resources");v(p,{recursive:!0}),v(u,{recursive:!0});let x=o(u,"index.html");await Bun.write(x,e);let b="";if(t.sidebar?.enabled&&t.sidebar?.config)b=o(u,"sidebar-config.json"),await Bun.write(b,JSON.stringify(t.sidebar.config));let g=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",m=t.menubarOnly??t.systemTray;if((t.bundleStyle||(await se(n)?"executable":"launcher"))==="executable"){let S=o(p,r);k(n,S),T(S,493);let w={html:"index.html",title:t.window?.title||r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools)};if(m)w.menubarOnly=!0;else if(t.systemTray)w.systemTray=!0;if(t.window?.frameless)w.frameless=!0;if(t.window?.transparent)w.transparent=!0;if(t.window?.alwaysOnTop)w.alwaysOnTop=!0;if(t.window?.resizable===!1)w.resizable=!1;await Bun.write(o(u,"craft.json"),`${JSON.stringify(w,null,2)}
2958
+ </button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function K(e){let r=5381;for(let a=0;a<e.length;a++)r=r*33^e.charCodeAt(a);return(r>>>0).toString(36)}function C(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function h(e){return C(e).replace(/`/g,"&#96;")}function Z(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function ee(e,r,a){let i=[];i.push(`class="${a.join(" ")}"`),i.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)i.push(s);else if(t!==!1&&t!==void 0&&t!==null){let n=String(t).replace(/"/g,"&quot;");i.push(`${s}="${n}"`)}return i.join(" ")}function fu(e,r){jr[e]=r}function gu(){return{...jr}}import{existsSync as z,mkdirSync as v,copyFileSync as k,chmodSync as T}from"fs";import{join as o,basename as te}from"path";import{spawn as E,execSync as re}from"child_process";import{tmpdir as M,homedir as q,platform as ae}from"os";async function So(e){let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||P(),format:e.format||"app",error:`Input file not found: ${e.input}`};let a=e.target||P(),i=e.format||ue(a),s=e.output||o(process.cwd(),"dist","native");if(!z(s))v(s,{recursive:!0});let t=await _o(e.input,{context:e.context,options:{isDev:!1}});if(t=wo(t,{debug:e.verbose}),t=xo(t),!t.includes("craft-component-styles")){if(t.includes("</head>"))t=t.replace("</head>",`${vo}
2959
+ </head>`)}let n=e.name||te(e.input,".stx"),c=e.version||"1.0.0",d=e.craftPath||await fe();if(!d)return{success:!1,target:a,format:i,error:"Craft binary not found. Please install Craft or specify craftPath."};if(e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${a}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${d}`);let l;switch(a){case"macos":l=await ie(t,n,c,s,i,e,d);break;case"windows":l=await oe(t,n,c,s,i,e,d);break;case"linux":l=await ce(t,n,c,s,i,e,d);break;case"ios":l=await de(t,n,c,s,e,d);break;case"android":l=await le(t,n,c,s,e,d);break;default:l={success:!1,target:a,format:i,error:`Unsupported target: ${a}`}}return l.duration=Date.now()-r,l}catch(a){return{success:!1,target:e.target||P(),format:e.format||"app",error:a.message,duration:Date.now()-r}}}async function ie(e,r,a,i,s,t,n){let c=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,d=o(i,`${r}.app`),l=o(d,"Contents"),p=o(l,"MacOS"),f=o(l,"Resources");v(p,{recursive:!0}),v(f,{recursive:!0});let x=o(f,"index.html");await Bun.write(x,e);let b="";if(t.sidebar?.enabled&&t.sidebar?.config)b=o(f,"sidebar-config.json"),await Bun.write(b,JSON.stringify(t.sidebar.config));let g=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",m=t.menubarOnly??t.systemTray;if((t.bundleStyle||(await se(n)?"executable":"launcher"))==="executable"){let S=o(p,r);k(n,S),T(S,493);let w={html:"index.html",title:t.window?.title||r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools)};if(m)w.menubarOnly=!0;else if(t.systemTray)w.systemTray=!0;if(t.window?.frameless)w.frameless=!0;if(t.window?.transparent)w.transparent=!0;if(t.window?.alwaysOnTop)w.alwaysOnTop=!0;if(t.window?.resizable===!1)w.resizable=!1;await Bun.write(o(f,"craft.json"),`${JSON.stringify(w,null,2)}
2960
2960
  `)}else{let S=o(p,"craft");k(n,S),T(S,493);let w=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",U=`#!/bin/bash
2961
2961
  set -euo pipefail
2962
2962
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
2963
2963
  RESOURCES="$DIR/../Resources"
2964
2964
  exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
2965
2965
  ${[`--title "${t.window?.title||r}"`,`--width ${t.window?.width||1200}`,`--height ${t.window?.height||800}`,m?"--menubar-only":t.systemTray?"--system-tray":"",t.devTools?"":"--no-devtools",t.window?.frameless?"--frameless":"",t.window?.transparent?"--transparent":"",t.window?.alwaysOnTop?"--always-on-top":"",t.window?.resizable===!1?"--no-resize":"",w].filter(Boolean).join(" \\\n ")}
2966
- `,N=o(p,r);await Bun.write(N,U),T(N,493)}let B=Boolean(t.icon&&await Bun.file(t.icon).exists());if(B)k(t.icon,o(u,"AppIcon.icns"));let L={CFBundleExecutable:r,CFBundleIdentifier:c,CFBundleName:r,CFBundleDisplayName:r,CFBundleShortVersionString:a,CFBundleVersion:a,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:t.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:t.menubarOnly??Boolean(t.systemTray),...B?{CFBundleIconFile:"AppIcon"}:{},...t.category?{LSApplicationCategoryType:t.category}:{},...t.copyright?{NSHumanReadableCopyright:t.copyright}:{},...t.infoPlist||{}};if(await Bun.write(o(f,"Info.plist"),ne(L)),s==="dmg"){let S=o(i,`${r}-${a}.dmg`),w=await pe(l,S,r);if(!w.success)return{success:!1,target:"macos",format:"dmg",error:w.error};return{success:!0,target:"macos",format:"dmg",outputPath:S}}return{success:!0,target:"macos",format:"app",outputPath:l}}async function se(e){try{let r=Bun.spawn([e,"--version"],{stdout:"pipe",stderr:"pipe"}),[a,i]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text()]);await r.exited;let t=`${a}
2967
- ${i}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!t)return!1;let[n,c,l]=t.slice(1).map(Number);if(n>0||c>0)return!0;return l>=57}catch{return!1}}function _(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ne(e){return`<?xml version="1.0" encoding="UTF-8"?>
2966
+ `,N=o(p,r);await Bun.write(N,U),T(N,493)}let B=Boolean(t.icon&&await Bun.file(t.icon).exists());if(B)k(t.icon,o(f,"AppIcon.icns"));let L={CFBundleExecutable:r,CFBundleIdentifier:c,CFBundleName:r,CFBundleDisplayName:r,CFBundleShortVersionString:a,CFBundleVersion:a,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:t.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:t.menubarOnly??Boolean(t.systemTray),...B?{CFBundleIconFile:"AppIcon"}:{},...t.category?{LSApplicationCategoryType:t.category}:{},...t.copyright?{NSHumanReadableCopyright:t.copyright}:{},...t.infoPlist||{}};if(await Bun.write(o(l,"Info.plist"),ne(L)),s==="dmg"){let S=o(i,`${r}-${a}.dmg`),w=await pe(d,S,r);if(!w.success)return{success:!1,target:"macos",format:"dmg",error:w.error};return{success:!0,target:"macos",format:"dmg",outputPath:S}}return{success:!0,target:"macos",format:"app",outputPath:d}}async function se(e){try{let r=Bun.spawn([e,"--version"],{stdout:"pipe",stderr:"pipe"}),[a,i]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text()]);await r.exited;let t=`${a}
2967
+ ${i}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!t)return!1;let[n,c,d]=t.slice(1).map(Number);if(n>0||c>0)return!0;return d>=57}catch{return!1}}function _(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ne(e){return`<?xml version="1.0" encoding="UTF-8"?>
2968
2968
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
2969
2969
  <plist version="1.0">
2970
2970
  <dict>
@@ -2973,7 +2973,7 @@ ${Object.entries(e).map(([a,i])=>{let s=typeof i==="boolean"?`<${i}/>`:typeof i=
2973
2973
  `)}
2974
2974
  </dict>
2975
2975
  </plist>
2976
- `}async function oe(e,r,a,i,s,t,n){let c=o(i,r);v(c,{recursive:!0});let l=o(c,"index.html");await Bun.write(l,e),k(n,o(c,"craft.exe"));let f=`@echo off
2976
+ `}async function oe(e,r,a,i,s,t,n){let c=o(i,r);v(c,{recursive:!0});let d=o(c,"index.html");await Bun.write(d,e),k(n,o(c,"craft.exe"));let l=`@echo off
2977
2977
  set DIR=%~dp0
2978
2978
  "%DIR%craft.exe" --html-file "%DIR%index.html" ^
2979
2979
  --title "${t.window?.title||r}" ^
@@ -2981,7 +2981,7 @@ set DIR=%~dp0
2981
2981
  --height ${t.window?.height||800} ^
2982
2982
  ${t.systemTray?"--system-tray":""} ^
2983
2983
  ${t.devTools?"":"--no-devtools"}
2984
- `;if(await Bun.write(o(c,`${r}.bat`),f),s==="zip"){let p=o(i,`${r}-${a}-windows.zip`),u=await be(c,p);if(!u.success)return{success:!1,target:"windows",format:"zip",error:u.error};return{success:!0,target:"windows",format:"zip",outputPath:p}}return{success:!0,target:"windows",format:"app",outputPath:c}}async function ce(e,r,a,i,s,t,n){let c=o(i,r);v(c,{recursive:!0});let l=o(c,"index.html");await Bun.write(l,e);let f=o(c,"craft");k(n,f),T(f,493);let p=`#!/bin/bash
2984
+ `;if(await Bun.write(o(c,`${r}.bat`),l),s==="zip"){let p=o(i,`${r}-${a}-windows.zip`),f=await be(c,p);if(!f.success)return{success:!1,target:"windows",format:"zip",error:f.error};return{success:!0,target:"windows",format:"zip",outputPath:p}}return{success:!0,target:"windows",format:"app",outputPath:c}}async function ce(e,r,a,i,s,t,n){let c=o(i,r);v(c,{recursive:!0});let d=o(c,"index.html");await Bun.write(d,e);let l=o(c,"craft");k(n,l),T(l,493);let p=`#!/bin/bash
2985
2985
  set -euo pipefail
2986
2986
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
2987
2987
  exec "$DIR/craft" --html-file "$DIR/index.html" \\
@@ -2990,15 +2990,15 @@ exec "$DIR/craft" --html-file "$DIR/index.html" \\
2990
2990
  --height ${t.window?.height||800} \\
2991
2991
  ${t.systemTray?"--system-tray":""} \\
2992
2992
  ${t.devTools?"":"--no-devtools"}
2993
- `,u=o(c,r.toLowerCase());await Bun.write(u,p),T(u,493);let x=`[Desktop Entry]
2993
+ `,f=o(c,r.toLowerCase());await Bun.write(f,p),T(f,493);let x=`[Desktop Entry]
2994
2994
  Type=Application
2995
2995
  Name=${r}
2996
- Exec=${u}
2996
+ Exec=${f}
2997
2997
  Terminal=false
2998
2998
  Categories=Utility;
2999
2999
  `;if(await Bun.write(o(c,`${r.toLowerCase()}.desktop`),x),s==="deb"){let b=o(i,`${r.toLowerCase()}_${a}_amd64.deb`),g=await ge(c,b,r,a,t);if(!g.success)return{success:!1,target:"linux",format:"deb",error:g.error};return{success:!0,target:"linux",format:"deb",outputPath:b}}if(s==="appimage"){let b=o(i,`${r}-${a}-x86_64.AppImage`),g=await me(c,b,r,t);if(!g.success)return{success:!1,target:"linux",format:"appimage",error:g.error};return{success:!0,target:"linux",format:"appimage",outputPath:b}}return{success:!0,target:"linux",format:"app",outputPath:c}}async function de(e,r,a,i,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function le(e,r,a,i,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}async function fe(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let e=[o(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),o(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),o(q(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),o(q(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",o(q(),".local/bin/craft"),o(process.env.LOCALAPPDATA||"","craft","craft.exe"),o(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let r of e)if(await Bun.file(r).exists())return r;try{let a=re("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
3000
- `)[0];if(a&&await Bun.file(a).exists())return a}catch{}return null}function P(){switch(ae()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function ue(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function pe(e,r,a){return new Promise((i)=>{let s=E("hdiutil",["create","-volname",a,"-srcfolder",e,"-ov","-format","UDZO",r]);s.on("close",(t)=>{if(t===0)i({success:!0});else i({success:!1,error:`hdiutil exited with code ${t}`})}),s.on("error",(t)=>{i({success:!1,error:t.message})})})}async function be(e,r){return new Promise((a)=>{let i=E("zip",["-r",r,"."],{cwd:e});i.on("close",(s)=>{if(s===0)a({success:!0});else a({success:!1,error:`zip exited with code ${s}`})}),i.on("error",(s)=>{a({success:!1,error:s.message})})})}async function ge(e,r,a,i,s){return new Promise((t)=>{try{let n=o(M(),`stx-deb-${Date.now()}`),c=o(n,"DEBIAN"),l=o(n,"usr","bin"),f=o(n,"usr","share","applications"),p=o(n,"usr","share",a.toLowerCase());v(c,{recursive:!0}),v(l,{recursive:!0}),v(f,{recursive:!0}),v(p,{recursive:!0});let u=d("fs").readdirSync(e);for(let m of u)k(o(e,m),o(p,m));let x=`#!/bin/bash
3001
- exec /usr/share/${a.toLowerCase()}/${a.toLowerCase()} "$@"`;d("fs").writeFileSync(o(l,a.toLowerCase()),x),T(o(l,a.toLowerCase()),493);let b=`Package: ${a.toLowerCase()}
3000
+ `)[0];if(a&&await Bun.file(a).exists())return a}catch{}return null}function P(){switch(ae()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function ue(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function pe(e,r,a){return new Promise((i)=>{let s=E("hdiutil",["create","-volname",a,"-srcfolder",e,"-ov","-format","UDZO",r]);s.on("close",(t)=>{if(t===0)i({success:!0});else i({success:!1,error:`hdiutil exited with code ${t}`})}),s.on("error",(t)=>{i({success:!1,error:t.message})})})}async function be(e,r){return new Promise((a)=>{let i=E("zip",["-r",r,"."],{cwd:e});i.on("close",(s)=>{if(s===0)a({success:!0});else a({success:!1,error:`zip exited with code ${s}`})}),i.on("error",(s)=>{a({success:!1,error:s.message})})})}async function ge(e,r,a,i,s){return new Promise((t)=>{try{let n=o(M(),`stx-deb-${Date.now()}`),c=o(n,"DEBIAN"),d=o(n,"usr","bin"),l=o(n,"usr","share","applications"),p=o(n,"usr","share",a.toLowerCase());v(c,{recursive:!0}),v(d,{recursive:!0}),v(l,{recursive:!0}),v(p,{recursive:!0});let f=u("fs").readdirSync(e);for(let m of f)k(o(e,m),o(p,m));let x=`#!/bin/bash
3001
+ exec /usr/share/${a.toLowerCase()}/${a.toLowerCase()} "$@"`;u("fs").writeFileSync(o(d,a.toLowerCase()),x),T(o(d,a.toLowerCase()),493);let b=`Package: ${a.toLowerCase()}
3002
3002
  Version: ${i}
3003
3003
  Section: utils
3004
3004
  Priority: optional
@@ -3006,17 +3006,17 @@ Architecture: amd64
3006
3006
  Depends: libgtk-3-0, libwebkit2gtk-4.0-37
3007
3007
  Maintainer: ${s.author||"Unknown"}
3008
3008
  Description: ${s.description||a}
3009
- `;d("fs").writeFileSync(o(c,"control"),b);let g=E("dpkg-deb",["--build",n,r]);g.on("close",(m)=>{if(d("fs").rmSync(n,{recursive:!0,force:!0}),m===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${m}`})}),g.on("error",(m)=>{d("fs").rmSync(n,{recursive:!0,force:!0}),t({success:!1,error:m.message})})}catch(n){t({success:!1,error:n.message})}})}async function me(e,r,a,i){return new Promise((s)=>{try{let t=o(M(),`stx-appimage-${Date.now()}`),n=o(t,`${a}.AppDir`),c=o(n,"usr"),l=o(c,"bin"),f=o(c,"share");v(l,{recursive:!0}),v(f,{recursive:!0});let p=o(f,a.toLowerCase());v(p,{recursive:!0});let u=d("fs").readdirSync(e);for(let y of u)k(o(e,y),o(p,y));let x=`#!/bin/bash
3009
+ `;u("fs").writeFileSync(o(c,"control"),b);let g=E("dpkg-deb",["--build",n,r]);g.on("close",(m)=>{if(u("fs").rmSync(n,{recursive:!0,force:!0}),m===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${m}`})}),g.on("error",(m)=>{u("fs").rmSync(n,{recursive:!0,force:!0}),t({success:!1,error:m.message})})}catch(n){t({success:!1,error:n.message})}})}async function me(e,r,a,i){return new Promise((s)=>{try{let t=o(M(),`stx-appimage-${Date.now()}`),n=o(t,`${a}.AppDir`),c=o(n,"usr"),d=o(c,"bin"),l=o(c,"share");v(d,{recursive:!0}),v(l,{recursive:!0});let p=o(l,a.toLowerCase());v(p,{recursive:!0});let f=u("fs").readdirSync(e);for(let y of f)k(o(e,y),o(p,y));let x=`#!/bin/bash
3010
3010
  SELF=$(readlink -f "$0")
3011
3011
  HERE=\${SELF%/*}
3012
3012
  export PATH="\${HERE}/usr/bin:\${PATH}"
3013
3013
  exec "\${HERE}/usr/share/${a.toLowerCase()}/${a.toLowerCase()}" "$@"
3014
- `;d("fs").writeFileSync(o(n,"AppRun"),x),T(o(n,"AppRun"),493);let b=`[Desktop Entry]
3014
+ `;u("fs").writeFileSync(o(n,"AppRun"),x),T(o(n,"AppRun"),493);let b=`[Desktop Entry]
3015
3015
  Type=Application
3016
3016
  Name=${a}
3017
3017
  Exec=${a.toLowerCase()}
3018
3018
  Terminal=false
3019
3019
  Categories=Utility;
3020
3020
  Icon=${a.toLowerCase()}
3021
- `;d("fs").writeFileSync(o(n,`${a.toLowerCase()}.desktop`),b);let g=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(d("fs").writeFileSync(o(n,`${a.toLowerCase()}.png`),g),i.icon&&z(i.icon))k(i.icon,o(n,`${a.toLowerCase()}.png`));let m=E("appimagetool",[n,r],{env:{...process.env,ARCH:"x86_64"}});m.on("close",(y)=>{if(d("fs").rmSync(t,{recursive:!0,force:!0}),y===0)T(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${y}. Install from https://appimage.github.io/appimagetool/`})}),m.on("error",(y)=>{d("fs").rmSync(t,{recursive:!0,force:!0}),s({success:!1,error:`appimagetool not found: ${y.message}`})})}catch(t){s({success:!1,error:t.message})}})}function ko(){return[P()]}function Co(e){switch(e){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var he={buildNative:So,getAvailableTargets:ko,getAvailableFormats:Co,detectPlatform:P},md=he;
3022
- export{ld,bo,dd,ud,wo,jr,vo,pd,xo,fd,gd,So,ko,Co,md};
3021
+ `;u("fs").writeFileSync(o(n,`${a.toLowerCase()}.desktop`),b);let g=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(u("fs").writeFileSync(o(n,`${a.toLowerCase()}.png`),g),i.icon&&z(i.icon))k(i.icon,o(n,`${a.toLowerCase()}.png`));let m=E("appimagetool",[n,r],{env:{...process.env,ARCH:"x86_64"}});m.on("close",(y)=>{if(u("fs").rmSync(t,{recursive:!0,force:!0}),y===0)T(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${y}. Install from https://appimage.github.io/appimagetool/`})}),m.on("error",(y)=>{u("fs").rmSync(t,{recursive:!0,force:!0}),s({success:!1,error:`appimagetool not found: ${y.message}`})})}catch(t){s({success:!1,error:t.message})}})}function ko(){return[P()]}function Co(e){switch(e){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var he={buildNative:So,getAvailableTargets:ko,getAvailableFormats:Co,detectPlatform:P},mu=he;
3022
+ export{lu,bo,uu,du,wo,jr,vo,pu,xo,fu,gu,So,ko,Co,mu};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Or,bl,wl}from"./chunk-fqpd0cfq.js";import"./chunk-vqdqf0cp.js";import"./chunk-0gq32mfe.js";import"./chunk-0nnmk0xv.js";import"./chunk-d2zw2e5m.js";import"./chunk-2n5pjbw9.js";import"./chunk-0trfbqa7.js";import"./chunk-w5m8xrs4.js";import"./chunk-zydg3wgt.js";import"./chunk-y36av1ac.js";import"./chunk-v83bpj84.js";import"./chunk-ynvce0q6.js";import"./chunk-pf0d8y9n.js";import"./chunk-2jbyks2t.js";import"./chunk-88px183j.js";import"./chunk-jz7pvh7b.js";export{wl as clearComposableCache,bl as getComposableScript,Or as listComposableModules};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{cn,xs}from"./chunk-jbdqs7t6.js";import"./chunk-zydg3wgt.js";export{xs as generateRuntimeConfigTypes,cn as prepareRuntimeConfig};
2
+ import{cn,xs}from"./chunk-w5m8xrs4.js";import"./chunk-zydg3wgt.js";export{xs as generateRuntimeConfigTypes,cn as prepareRuntimeConfig};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{d}from"./chunk-yn2d8x8m.js";import{mkdir as w,writeFile as h}from"fs/promises";import{join as l}from"path";var f="https://api.iconify.design";async function D(){let e=await fetch(`${f}/collections`);if(!e.ok)throw Error(`Failed to fetch collections: ${e.statusText}`);return await e.json()}async function P(e,t){try{let c=d.resolve("@iconify/json"),r=`${`${c.substring(0,c.lastIndexOf("/node_modules/@iconify/json/"))}/node_modules/@iconify/json`}/json/${e}.json`,s=Bun.file(r);if(await s.exists()){let a=await s.json();if(t&&t.length>0){let p={};for(let y of t)if(a.icons[y])p[y]=a.icons[y];return{...a,icons:p}}return a}}catch{}let n=t&&t.length>0?`${f}/${e}.json?icons=${t.join(",")}`:`${f}/${e}.json`,i=await fetch(n);if(!i.ok)throw Error(`Failed to fetch icons for ${e}: ${i.statusText}`);return await i.json()}function F(e,t=24,n=24){return{body:e.body,width:e.width||t,height:e.height||n,viewBox:`0 0 ${e.width||t} ${e.height||n}`}}function T(e,t){let n=u(e);return`import type { IconData } from '@stacksjs/iconify-core'
2
+ import{u}from"./chunk-cg8hg6cs.js";import{mkdir as w,writeFile as m}from"fs/promises";import{join as l}from"path";var f="https://api.iconify.design";async function D(){let e=await fetch(`${f}/collections`);if(!e.ok)throw Error(`Failed to fetch collections: ${e.statusText}`);return await e.json()}async function P(e,t){try{let c=u.resolve("@iconify/json"),r=`${`${c.substring(0,c.lastIndexOf("/node_modules/@iconify/json/"))}/node_modules/@iconify/json`}/json/${e}.json`,s=Bun.file(r);if(await s.exists()){let a=await s.json();if(t&&t.length>0){let d={};for(let y of t)if(a.icons[y])d[y]=a.icons[y];return{...a,icons:d}}return a}}catch{}let n=t&&t.length>0?`${f}/${e}.json?icons=${t.join(",")}`:`${f}/${e}.json`,i=await fetch(n);if(!i.ok)throw Error(`Failed to fetch icons for ${e}: ${i.statusText}`);return await i.json()}function F(e,t=24,n=24){return{body:e.body,width:e.width||t,height:e.height||n,viewBox:`0 0 ${e.width||t} ${e.height||n}`}}function T(e,t){let n=h(e);return`import type { IconData } from '@stacksjs/iconify-core'
3
3
 
4
4
  export const ${n}: IconData = ${JSON.stringify(t,null,2)}
5
5
 
@@ -44,7 +44,7 @@ const svg = \`<svg xmlns="http://www.w3.org/2000/svg" width="\${iconWidth}" heig
44
44
 
45
45
  {!! svg !!}
46
46
  `}function _(e){let t=new Set;return`// Icon data exports
47
- ${e.map((i)=>{let o=u(i);if(t.has(o)){let r=i.replace(/[^a-zA-Z0-9]/g,"_");if(/^[0-9]/.test(r))r=`_${r}`;o=r;let s=2;while(t.has(o))o=`${r}_${s}`,s++}return t.add(o),`export { default as ${o} } from './${i}.js'`}).join(`
47
+ ${e.map((i)=>{let o=h(i);if(t.has(o)){let r=i.replace(/[^a-zA-Z0-9]/g,"_");if(/^[0-9]/.test(r))r=`_${r}`;o=r;let s=2;while(t.has(o))o=`${r}_${s}`,s++}return t.add(o),`export { default as ${o} } from './${i}.js'`}).join(`
48
48
  `)}
49
49
 
50
50
  export * from './types.js'
@@ -155,7 +155,7 @@ ${t.license?.url?`License: ${t.license.url}`:""}
155
155
 
156
156
  - Icons: ${t.author?.name||"Iconify"}${t.author?.url?` (${t.author.url})`:""}
157
157
  - Iconify: https://iconify.design/
158
- `}function M(e,t,n){let i=n.length,c=n.slice(0,5).map(u),o=c.map((s)=>`${s.charAt(0).toUpperCase()}${s.slice(1)}Icon`),r=n.map((s)=>`- \`${u(s)}\``).join(`
158
+ `}function M(e,t,n){let i=n.length,c=n.slice(0,5).map(h),o=c.map((s)=>`${s.charAt(0).toUpperCase()}${s.slice(1)}Icon`),r=n.map((s)=>`- \`${h(s)}\``).join(`
159
159
  `);return`# ${t.name}
160
160
 
161
161
  > ${t.name} icons for stx from Iconify
@@ -338,14 +338,14 @@ You can also use the \`size\` property as a shorthand for setting both width and
338
338
  You can also control icon size via CSS:
339
339
 
340
340
  \`\`\`css
341
- .${u(e)}-icon {
341
+ .${h(e)}-icon {
342
342
  width: 1em;
343
343
  height: 1em;
344
344
  }
345
345
  \`\`\`
346
346
 
347
347
  \`\`\`html
348
- <${o[0]||"DraftsIcon"} class="${u(e)}-icon" />
348
+ <${o[0]||"DraftsIcon"} class="${h(e)}-icon" />
349
349
  \`\`\`
350
350
 
351
351
  ## Available Icons
@@ -502,4 +502,4 @@ ${t.license?.url?`See [license details](${t.license.url}) for more information.`
502
502
  - [Iconify documentation](https://iconify.design/docs/)
503
503
  - [stx iconify integration guide](../../docs/iconify.md)
504
504
  `}async function G(e,t,n,i){console.log(`
505
- \uD83D\uDCE6 Generating package for ${e}...`);let o=(await D())[e];if(!o)throw Error(`Collection ${e} not found`);console.log(` Collection: ${o.name}`),console.log(` Total icons: ${o.total}`);let r=await P(e,n),s=Object.keys(r.icons);console.log(` Generating ${s.length} icons...`);let a=l(t,`iconify-${e}`),p=l(a,"src");await w(p,{recursive:!0});let y=r.width||24,b=r.height||24;for(let m of s){let g=r.icons[m],I=F(g,y,b),z=T(m,I);await h(l(p,`${m}.ts`),z);let k=A(m,I);await h(l(p,`${m}-icon.stx`),k)}let v=_(s);await h(l(p,"index.ts"),v);let C=E(e);await h(l(p,"types.ts"),C);let S=N(e,o,s.length);await h(l(a,"package.json"),S);let x=U(e);await h(l(a,"build.ts"),x);let j=R(e,o,s.length);if(await h(l(a,"README.md"),j),i){let m=l(i,`iconify-${e}.md`),g=M(e,o,s);await w(i,{recursive:!0}),await h(m,g),console.log(` \u2713 Generated documentation in ${m}`)}console.log(` \u2713 Generated ${s.length} icons in ${a}`)}var B=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","let","static","yield","implements","interface","package","private","protected","public","await","eval","arguments"]);function u(e){let t=e.replace(/-([a-z0-9])/g,(n)=>n[1].toUpperCase());if(t=t.replace(/[^a-zA-Z0-9_$]/g,"_"),/^[0-9]/.test(t))t=`_${t}`;if(B.has(t))t=`${t}_`;return t}function W(e){let t=u(e);return t.charAt(0).toUpperCase()+t.slice(1)}export{D as fetchCollections,G as generatePackage};
505
+ \uD83D\uDCE6 Generating package for ${e}...`);let o=(await D())[e];if(!o)throw Error(`Collection ${e} not found`);console.log(` Collection: ${o.name}`),console.log(` Total icons: ${o.total}`);let r=await P(e,n),s=Object.keys(r.icons);console.log(` Generating ${s.length} icons...`);let a=l(t,`iconify-${e}`),d=l(a,"src");await w(d,{recursive:!0});let y=r.width||24,b=r.height||24;for(let p of s){let g=r.icons[p],I=F(g,y,b),z=T(p,I);await m(l(d,`${p}.ts`),z);let k=A(p,I);await m(l(d,`${p}-icon.stx`),k)}let v=_(s);await m(l(d,"index.ts"),v);let C=E(e);await m(l(d,"types.ts"),C);let S=N(e,o,s.length);await m(l(a,"package.json"),S);let x=U(e);await m(l(a,"build.ts"),x);let j=R(e,o,s.length);if(await m(l(a,"README.md"),j),i){let p=l(i,`iconify-${e}.md`),g=M(e,o,s);await w(i,{recursive:!0}),await m(p,g),console.log(` \u2713 Generated documentation in ${p}`)}console.log(` \u2713 Generated ${s.length} icons in ${a}`)}var B=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","let","static","yield","implements","interface","package","private","protected","public","await","eval","arguments"]);function h(e){let t=e.replace(/-([a-z0-9])/g,(n)=>n[1].toUpperCase());if(t=t.replace(/[^a-zA-Z0-9_$]/g,"_"),/^[0-9]/.test(t))t=`_${t}`;if(B.has(t))t=`${t}_`;return t}function W(e){let t=h(e);return t.charAt(0).toUpperCase()+t.slice(1)}export{D as fetchCollections,G as generatePackage};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{u,ls,ri,si,yc,bc,wc,vc,xc,Sc,Ve,L,Ue,kc,Wn,Cc,ci,$c,We,r,qn,li,g,ee,Fd}from"./chunk-ag1v2tkm.js";import"./chunk-gjrbnzap.js";import"./chunk-2n5pjbw9.js";import"./chunk-0trfbqa7.js";import"./chunk-jbdqs7t6.js";import"./chunk-zydg3wgt.js";import"./chunk-gj90pnre.js";import"./chunk-p7j2g8y2.js";import"./chunk-pfm6cfph.js";import"./chunk-pf0d8y9n.js";import"./chunk-2jbyks2t.js";import"./chunk-88px183j.js";import"./chunk-jz7pvh7b.js";export{ee as clearComponentCache,$c as componentClientSignalNames,ls as convertToCommonJS,g as createDetailedErrorMessage,xc as extractDirectiveNames,ri as extractScriptFromTemplate,u as extractVariables,r as fileExists,Fd as getComponentCacheStats,bc as getPositionInfo,L as getSharedTranspiler,li as getSourceLineInfo,vc as hasDirectives,si as hasVariables,Cc as isHydrateTrigger,Sc as isJavaScriptScript,We as renderComponentWithSlot,qn as resolveTemplatePath,kc as scopeOnRootElement,Ve as shouldTranspileTypeScript,ci as slotContentHasExpressions,Ue as transpileTypeScript,Wn as userComponentFileExists,wc as validateDirective,yc as validateTemplate};
2
+ import{d,ls,ri,si,yc,bc,wc,vc,xc,Sc,Ve,L,Ue,kc,Wn,Cc,ci,$c,We,r,qn,li,g,ee,Fu}from"./chunk-0nnmk0xv.js";import"./chunk-d2zw2e5m.js";import"./chunk-2n5pjbw9.js";import"./chunk-0trfbqa7.js";import"./chunk-w5m8xrs4.js";import"./chunk-zydg3wgt.js";import"./chunk-y36av1ac.js";import"./chunk-v83bpj84.js";import"./chunk-ynvce0q6.js";import"./chunk-pf0d8y9n.js";import"./chunk-2jbyks2t.js";import"./chunk-88px183j.js";import"./chunk-jz7pvh7b.js";export{ee as clearComponentCache,$c as componentClientSignalNames,ls as convertToCommonJS,g as createDetailedErrorMessage,xc as extractDirectiveNames,ri as extractScriptFromTemplate,d as extractVariables,r as fileExists,Fu as getComponentCacheStats,bc as getPositionInfo,L as getSharedTranspiler,li as getSourceLineInfo,vc as hasDirectives,si as hasVariables,Cc as isHydrateTrigger,Sc as isJavaScriptScript,We as renderComponentWithSlot,qn as resolveTemplatePath,kc as scopeOnRootElement,Ve as shouldTranspileTypeScript,ci as slotContentHasExpressions,Ue as transpileTypeScript,Wn as userComponentFileExists,wc as validateDirective,yc as validateTemplate};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ui,eo,Wc,Wi,qi,qc,Kc}from"./chunk-hh7r7zpe.js";import"./chunk-fqpd0cfq.js";import"./chunk-vqdqf0cp.js";import"./chunk-0gq32mfe.js";import{ze,rc}from"./chunk-0nnmk0xv.js";import"./chunk-d2zw2e5m.js";import"./chunk-2n5pjbw9.js";import"./chunk-0trfbqa7.js";import"./chunk-w5m8xrs4.js";import"./chunk-zydg3wgt.js";import"./chunk-y36av1ac.js";import"./chunk-v83bpj84.js";import"./chunk-ynvce0q6.js";import"./chunk-pf0d8y9n.js";import"./chunk-2jbyks2t.js";import"./chunk-88px183j.js";import"./chunk-jz7pvh7b.js";export{Ui as buildVirtualSource,ze as extractScriptBlocks,rc as extractTemplateExpressions,Wi as findRuntimeTypeDeclarations,qi as findStxModuleDeclarations,Kc as formatTypecheckDiagnostics,Wc as sourcePathFor,qc as typecheckStxFiles,eo as virtualPathFor};