@stacksjs/stx 0.2.297 → 0.2.300

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 (170) hide show
  1. package/dist/{chunk-nqwjb8k7.js → chunk-00mag1n0.js} +1 -1
  2. package/dist/{chunk-cyrcdgfj.js → chunk-01x1p6ek.js} +1 -1
  3. package/dist/chunk-18a38e8t.js +2 -0
  4. package/dist/{chunk-3qej6qse.js → chunk-19v7ftwt.js} +1 -1
  5. package/dist/chunk-1bn1wp3r.js +2 -0
  6. package/dist/{chunk-xtwybxtw.js → chunk-1zvyq6jj.js} +1 -1
  7. package/dist/{chunk-c5rehxqy.js → chunk-1zyqv8p8.js} +1 -1
  8. package/dist/chunk-2dsyd62p.js +2 -0
  9. package/dist/chunk-2j8hgkeb.js +2 -0
  10. package/dist/{chunk-mywp77gt.js → chunk-3bc8bqw2.js} +1 -1
  11. package/dist/chunk-3cgyqcze.js +2 -0
  12. package/dist/{chunk-9616c6wn.js → chunk-3x05529h.js} +1 -1
  13. package/dist/{chunk-d3kac3mv.js → chunk-42b81qv3.js} +1 -1
  14. package/dist/{chunk-ama74dgk.js → chunk-4bct6m06.js} +3 -3
  15. package/dist/chunk-4kzk4s3f.js +2 -0
  16. package/dist/{chunk-xc4b1ngp.js → chunk-4r5rpv5e.js} +1 -1
  17. package/dist/chunk-53fbj4xk.js +2 -0
  18. package/dist/{chunk-jmh31a2a.js → chunk-54fnvfp1.js} +2 -2
  19. package/dist/{chunk-fz91fd99.js → chunk-5c8f2rt7.js} +2 -2
  20. package/dist/{chunk-q7b4v144.js → chunk-5jsssr3k.js} +2 -2
  21. package/dist/{chunk-s8g3n7ym.js → chunk-5p0eexgt.js} +2 -2
  22. package/dist/{chunk-8bxtvsgm.js → chunk-634gaa9d.js} +1 -1
  23. package/dist/{chunk-hmf9z4jx.js → chunk-683tfkz4.js} +1 -1
  24. package/dist/chunk-69kf0b4q.js +2 -0
  25. package/dist/{chunk-vwqv8f0y.js → chunk-6bcw8twx.js} +1 -1
  26. package/dist/{chunk-k70fgb2f.js → chunk-6btbgxh1.js} +1 -1
  27. package/dist/{chunk-k78gvm0g.js → chunk-6rzwef28.js} +1 -1
  28. package/dist/{chunk-jf0te8tr.js → chunk-6s1v9snm.js} +1 -1
  29. package/dist/chunk-6sz2hd8t.js +2 -0
  30. package/dist/{chunk-ynt7y2n5.js → chunk-6w8fa3b8.js} +1 -1
  31. package/dist/{chunk-3mbkn6vk.js → chunk-6xbscz34.js} +2 -2
  32. package/dist/{chunk-xtx53xyz.js → chunk-7eea1cse.js} +1 -1
  33. package/dist/{chunk-nmkra8q5.js → chunk-7eg7ep8f.js} +2 -2
  34. package/dist/{chunk-70z62b1s.js → chunk-7t90r4dr.js} +2 -2
  35. package/dist/chunk-7v83gvj4.js +2 -0
  36. package/dist/chunk-7xbk9755.js +2 -0
  37. package/dist/chunk-8cdnh5w1.js +2 -0
  38. package/dist/{chunk-nnkz36zg.js → chunk-8jy8mt5m.js} +1 -1
  39. package/dist/{chunk-efr3ejqt.js → chunk-91007tan.js} +1 -1
  40. package/dist/chunk-9fsremeg.js +2 -0
  41. package/dist/{chunk-75re458k.js → chunk-9tecjny7.js} +2 -2
  42. package/dist/{chunk-phrd5kxe.js → chunk-9vft4bjw.js} +1 -1
  43. package/dist/{chunk-5ey1fdjf.js → chunk-9vpabjdm.js} +1 -1
  44. package/dist/{chunk-2v69c72j.js → chunk-9xa9kvtr.js} +1 -1
  45. package/dist/{chunk-d93d47k0.js → chunk-a5gkg0a5.js} +152 -152
  46. package/dist/{chunk-pzhq87vq.js → chunk-a9em3zm4.js} +2 -2
  47. package/dist/{chunk-ahsj1r5g.js → chunk-abb34awq.js} +1 -1
  48. package/dist/chunk-afyfe868.js +2 -0
  49. package/dist/{chunk-dn8006f7.js → chunk-bkbr9yz2.js} +1 -1
  50. package/dist/{chunk-psraz70k.js → chunk-bt6mqvzy.js} +1 -1
  51. package/dist/{chunk-412qbr7q.js → chunk-bz32kj1x.js} +2 -2
  52. package/dist/{chunk-4vpsvh6x.js → chunk-ctz53mbz.js} +1 -1
  53. package/dist/{chunk-nx96x8sh.js → chunk-d3r5pdz7.js} +1 -1
  54. package/dist/{chunk-ph3jj8j4.js → chunk-d7fd2wrb.js} +2 -2
  55. package/dist/{chunk-mx93vwmq.js → chunk-ddrsx18x.js} +1 -1
  56. package/dist/{chunk-bc7emj22.js → chunk-dfnevxkj.js} +1 -1
  57. package/dist/chunk-dr5q6kpc.js +2 -0
  58. package/dist/{chunk-gt6ahj63.js → chunk-dsbpsmqg.js} +1 -1
  59. package/dist/{chunk-b6xqp9s4.js → chunk-ejvftzg7.js} +3 -3
  60. package/dist/chunk-emx0n4yh.js +2 -0
  61. package/dist/{chunk-vqxpsd6r.js → chunk-ffetkbht.js} +1 -1
  62. package/dist/{chunk-9a1f6dz7.js → chunk-fj6fbqgb.js} +1 -1
  63. package/dist/{chunk-a84j7v61.js → chunk-fsq7492g.js} +1 -1
  64. package/dist/{chunk-p9bnsy2t.js → chunk-gfyfkxk6.js} +2 -2
  65. package/dist/{chunk-qzbwa5xe.js → chunk-gmfcddcw.js} +1 -1
  66. package/dist/{chunk-8x7rzbww.js → chunk-gp3e2xbc.js} +137 -137
  67. package/dist/chunk-h386tf3w.js +2 -0
  68. package/dist/{chunk-8zyv8jf3.js → chunk-hqqas72x.js} +1 -1
  69. package/dist/{chunk-knz3zy2t.js → chunk-jbrdrxrc.js} +2 -2
  70. package/dist/{chunk-4yqnabzy.js → chunk-jk4bexrn.js} +1 -1
  71. package/dist/chunk-jrqrbvx9.js +2 -0
  72. package/dist/chunk-jv41s3xp.js +2 -0
  73. package/dist/chunk-kd25rwsv.js +2 -0
  74. package/dist/{chunk-k7mewajj.js → chunk-kpgvx2p1.js} +1 -1
  75. package/dist/chunk-m7dw0h4b.js +2 -0
  76. package/dist/{chunk-wvxce7p4.js → chunk-m8qcap5h.js} +2 -2
  77. package/dist/chunk-mcn6cpkm.js +2 -0
  78. package/dist/chunk-mksxv28s.js +2 -0
  79. package/dist/{chunk-kp8ec2f4.js → chunk-mq0vtxe6.js} +2 -2
  80. package/dist/{chunk-fdnbqt4r.js → chunk-mtbtnryk.js} +1 -1
  81. package/dist/{chunk-vrhp2xnm.js → chunk-mzbnczgk.js} +2 -2
  82. package/dist/chunk-n2s7qj9d.js +30 -0
  83. package/dist/chunk-nkq9xwmy.js +2 -0
  84. package/dist/{chunk-vg8yh8te.js → chunk-nn4k6hvv.js} +1 -1
  85. package/dist/{chunk-x4mab1rw.js → chunk-p2gd0pcc.js} +1 -1
  86. package/dist/{chunk-ahdzc50z.js → chunk-peytnjme.js} +1 -1
  87. package/dist/{chunk-8h9xqc3p.js → chunk-q0h9kdms.js} +1 -1
  88. package/dist/{chunk-ahqn4s3t.js → chunk-q6xfyasj.js} +1 -1
  89. package/dist/{chunk-a668m28h.js → chunk-qg6pg6ze.js} +1 -1
  90. package/dist/{chunk-wb00aqm7.js → chunk-qga8gyr7.js} +1 -1
  91. package/dist/{chunk-mdd9yk4f.js → chunk-qx1zbx35.js} +1 -1
  92. package/dist/{chunk-0xtnepfj.js → chunk-qx7c8qnw.js} +1 -1
  93. package/dist/chunk-qya63wjh.js +2 -0
  94. package/dist/{chunk-29hfy1xw.js → chunk-rkz0rhx4.js} +1 -1
  95. package/dist/chunk-rwqg3tnk.js +2 -0
  96. package/dist/chunk-rxnxjw3d.js +2 -0
  97. package/dist/{chunk-3npkbgfm.js → chunk-s710wybv.js} +1 -1
  98. package/dist/chunk-s723t6p6.js +2 -0
  99. package/dist/{chunk-5t50pdtm.js → chunk-shem708r.js} +1 -1
  100. package/dist/chunk-syvg73q0.js +2 -0
  101. package/dist/{chunk-6sy85s25.js → chunk-tn1za8mt.js} +1 -1
  102. package/dist/{chunk-wk8v593t.js → chunk-tt7rdn02.js} +2 -2
  103. package/dist/{chunk-kgxkrnyt.js → chunk-v4vvm7mz.js} +1 -1
  104. package/dist/chunk-v54vyt8g.js +2 -0
  105. package/dist/chunk-v5jtjp8t.js +2 -0
  106. package/dist/{chunk-wvq1g6gr.js → chunk-v8474ah4.js} +1 -1
  107. package/dist/{chunk-hvqae2g1.js → chunk-vdzv694w.js} +1 -1
  108. package/dist/chunk-vpgzr79n.js +2 -0
  109. package/dist/{chunk-9rcrgt1d.js → chunk-vy9hqeyq.js} +2 -2
  110. package/dist/{chunk-fed3xsp9.js → chunk-w8yac9xp.js} +1 -1
  111. package/dist/{chunk-2b9r38hs.js → chunk-wbq4srvy.js} +1 -1
  112. package/dist/{chunk-ns50qry3.js → chunk-wd9fww03.js} +2 -2
  113. package/dist/{chunk-6tqbgd20.js → chunk-wdw9hb5y.js} +1 -1
  114. package/dist/{chunk-jem20v5k.js → chunk-weqpt9nt.js} +1 -1
  115. package/dist/{chunk-pfwhd5xs.js → chunk-x14vvxfh.js} +2 -2
  116. package/dist/{chunk-wyxw61az.js → chunk-x4prtyjs.js} +1 -1
  117. package/dist/{chunk-k0y7ta0d.js → chunk-y9nyqcha.js} +1 -1
  118. package/dist/chunk-yvgqs82c.js +2 -0
  119. package/dist/{chunk-6kdb8j9d.js → chunk-ze3qgdaf.js} +1 -1
  120. package/dist/chunk-zpfbwcyk.js +2 -0
  121. package/dist/{chunk-6xsxkzhy.js → chunk-zqrh41k8.js} +1 -1
  122. package/dist/chunk-zv2hvn7r.js +2 -0
  123. package/dist/cli.js +14 -14
  124. package/dist/craft-entry.js +1 -1
  125. package/dist/craft.js +1 -1
  126. package/dist/database.js +1 -1
  127. package/dist/dev-server/serve-app.js +2 -2
  128. package/dist/pwa.js +2 -2
  129. package/dist/spa-nav.d.ts +20 -0
  130. package/dist/spa-nav.js +12 -0
  131. package/dist/ssg.js +2 -2
  132. package/dist/utils.js +10 -0
  133. package/dist/visual-testing.js +1 -1
  134. package/package.json +5 -5
  135. package/dist/chunk-0dt7mxd4.js +0 -2
  136. package/dist/chunk-1286mhh3.js +0 -2
  137. package/dist/chunk-1hgjxmev.js +0 -2
  138. package/dist/chunk-21p24c6p.js +0 -2
  139. package/dist/chunk-2egqczsa.js +0 -2
  140. package/dist/chunk-2enzjhrh.js +0 -2
  141. package/dist/chunk-3nmkjd4b.js +0 -2
  142. package/dist/chunk-3y3vfypn.js +0 -30
  143. package/dist/chunk-4e7ws3aa.js +0 -2
  144. package/dist/chunk-5zdxwpr4.js +0 -2
  145. package/dist/chunk-c3bk5y81.js +0 -2
  146. package/dist/chunk-cfx3vjh6.js +0 -2
  147. package/dist/chunk-d54zmtbs.js +0 -2
  148. package/dist/chunk-f57xky9r.js +0 -2
  149. package/dist/chunk-fqggvrwy.js +0 -2
  150. package/dist/chunk-fz52r2f7.js +0 -2
  151. package/dist/chunk-gbewds58.js +0 -2
  152. package/dist/chunk-gw431w90.js +0 -2
  153. package/dist/chunk-hfjhybrn.js +0 -2
  154. package/dist/chunk-hqgnxvf8.js +0 -2
  155. package/dist/chunk-jt2r1vzy.js +0 -2
  156. package/dist/chunk-k2f4jwez.js +0 -2
  157. package/dist/chunk-m38tpeke.js +0 -2
  158. package/dist/chunk-mhgpjegm.js +0 -2
  159. package/dist/chunk-msc8zy8k.js +0 -2
  160. package/dist/chunk-pb5s3vwg.js +0 -2
  161. package/dist/chunk-ps3n1bvh.js +0 -2
  162. package/dist/chunk-q2dmpbqf.js +0 -2
  163. package/dist/chunk-qzrpby7b.js +0 -2
  164. package/dist/chunk-r6m67kjc.js +0 -2
  165. package/dist/chunk-s5phwqxc.js +0 -2
  166. package/dist/chunk-s7yjggwh.js +0 -2
  167. package/dist/chunk-t16fgjr4.js +0 -2
  168. package/dist/chunk-v24y3hz7.js +0 -2
  169. package/dist/chunk-vedg19rq.js +0 -2
  170. package/dist/chunk-vh7jr0sc.js +0 -2
@@ -2,4 +2,4 @@
2
2
  function A(h){let q=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;h=h.replace(q,(w,j)=>{return`const { ${j.split(",").map((k)=>k.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
3
3
  `});let v=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return h=h.replace(v,(w,j)=>{return`const { ${j.split(",").map((k)=>k.trim()).filter(Boolean).join(", ")} } = window.__composables
4
4
  `}),h}function B(h){return h.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}
5
- export{A as Yt,B as Zt};
5
+ export{A as Zt,B as _t};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ng as v,og as i,pg as t,sg as e,tg as HH,ug as KH,vg as QH,wg as YH,xg as ZH}from"./chunk-70z62b1s.js";import{_i as s}from"./chunk-ph3jj8j4.js";import{Tl as a}from"./chunk-d93d47k0.js";import{Gt as h}from"./chunk-kgxkrnyt.js";import{bu as f}from"./chunk-6kdb8j9d.js";import{existsSync as $H,readFileSync as qH}from"fs";import J from"path";function GH(K,Q="",V=""){let L=K.startLine>1?`
2
+ import{og as v,pg as i,qg as t,tg as e,ug as HH,vg as KH,wg as QH,xg as YH,yg as ZH}from"./chunk-7t90r4dr.js";import{$i as s}from"./chunk-d7fd2wrb.js";import{Ul as a}from"./chunk-a5gkg0a5.js";import{Ht as h}from"./chunk-v4vvm7mz.js";import{cu as f}from"./chunk-ze3qgdaf.js";import{existsSync as $H,readFileSync as qH}from"fs";import J from"path";function GH(K,Q="",V=""){let L=K.startLine>1?`
3
3
  `.repeat(K.startLine-1):"",N=t(i(K.code)),X=K.kind==="client"||K.kind==="plain"?HH(Q,K.code):"";return QH(`${L+N}
4
4
  ${X}
5
5
  export {}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ao as b,bo as c,co as d}from"./chunk-a5gkg0a5.js";import{cs as a}from"./chunk-6xbscz34.js";import"./chunk-bkbr9yz2.js";import"./chunk-nn4k6hvv.js";import"./chunk-1zyqv8p8.js";import"./chunk-1zvyq6jj.js";import"./chunk-4bct6m06.js";import"./chunk-v4vvm7mz.js";import"./chunk-s710wybv.js";import"./chunk-00mag1n0.js";import"./chunk-d3r5pdz7.js";import"./chunk-ze3qgdaf.js";import"./chunk-54fnvfp1.js";import"./chunk-42b81qv3.js";import"./chunk-6bcw8twx.js";export{b as rendersAsElement,c as processESImports,d as processComponents,a as freeIdentifiers};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{At as k,Bt as l,qt as a,rt as b,st as c,tt as d,ut as e,vt as f,wt as g,xt as h,yt as i,zt as j}from"./chunk-ama74dgk.js";import"./chunk-kgxkrnyt.js";import"./chunk-vwqv8f0y.js";export{e as resolveUserCssConfig,c as resetCssCache,h as rebuildCss,d as loadCssEngineConfig,b as loadCssEngine,l as injectCss,a as getCssServeAsset,i as getCachedCSS,k as generateCss,f as fingerprintConfig,j as extractClassNames,g as buildCss};
2
+ import{At as j,Bt as k,Ct as l,rt as a,st as b,tt as c,ut as d,vt as e,wt as f,xt as g,yt as h,zt as i}from"./chunk-4bct6m06.js";import"./chunk-v4vvm7mz.js";import"./chunk-6bcw8twx.js";export{e as resolveUserCssConfig,c as resetCssCache,h as rebuildCss,d as loadCssEngineConfig,b as loadCssEngine,l as injectCss,a as getCssServeAsset,i as getCachedCSS,k as generateCss,f as fingerprintConfig,j as extractClassNames,g as buildCss};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Bi as a,Ci as b,Di as c,Ei as d,Fi as e}from"./chunk-x4prtyjs.js";import"./chunk-6bcw8twx.js";export{c as renderSSRSuspense,a as processSuspenseDirectives,e as generateSuspenseRuntime,d as generateSuspenseCSS,b as createSSRSuspense};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  import{createHash as U}from"crypto";import Z from"fs";import Q from"path";import{generateThumbHash as w}from"ts-images";import{createImageDeliveryCatalog as T}from"ts-images/delivery";var L=new Set([".avif",".jpeg",".jpg",".png",".webp"]),F=[320,640,960,1280,1920],O="/_stx/images",Y=new Map;function R(j){return`/${j.split(Q.sep).map(encodeURIComponent).join("/")}`}function E(j){let q=Q.extname(j),G=j.slice(0,-q.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),J=U("sha256").update(j).digest("hex").slice(0,8);return`${G||"image"}-${J}`}function C(j){let q=(G)=>`${O}/${G.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:`stx:${O}`,async stat(G){let J=Q.join(j,G);try{let B=await Z.promises.stat(J);return B.size>0?{bytes:B.size,path:J,url:q(G)}:null}catch{return null}},async write(G,J){let B=Q.join(j,G);await Z.promises.mkdir(Q.dirname(B),{recursive:!0});let K=`${B}.${process.pid}.tmp`;return await Z.promises.writeFile(K,J),await Z.promises.rename(K,B),{bytes:J.byteLength,path:B,url:q(G)}},url:q}}async function z(j,q=j){let G=await Z.promises.readdir(q,{withFileTypes:!0});G.sort((B,K)=>B.name.localeCompare(K.name));let J=[];for(let B of G){let K=Q.join(q,B.name);if(B.isDirectory()){J.push(...await z(j,K));continue}if(!B.isFile()||!L.has(Q.extname(B.name).toLowerCase()))continue;J.push({absolutePath:K,relativePath:Q.relative(j,K)})}return J}function _(j){return j.map((q)=>({key:R(q.relativePath),input:q.absolutePath,name:E(q.relativePath)}))}async function I(j){let q=[],G=8;for(let J=0;J<j.length;J+=8){let B=j.slice(J,J+8),K=await Promise.all(B.map(async(M)=>{try{return await w(M.absolutePath),M}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${M.relativePath}`),null}}));q.push(...K.filter((M)=>M!==null))}return q}function V(j){return Q.join(j,"undecodable.json")}function k(j){try{let q=Z.readFileSync(V(j),"utf-8"),G=JSON.parse(q);return G&&typeof G==="object"?G:{}}catch{return{}}}function P(j,q){try{Z.mkdirSync(Q.dirname(V(j)),{recursive:!0}),Z.writeFileSync(V(j),JSON.stringify(q))}catch{}}function S(j){try{let q=Z.statSync(j);return{mtimeMs:q.mtimeMs,size:q.size}}catch{return}}function m(j){if(!j||j.startsWith("data:")||j.startsWith("blob:")||/^https?:\/\//i.test(j)||j.startsWith("//"))return;let q=j.split(/[?#]/,1)[0];if(!q)return;try{return`/${q.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function h(j){let q=m(j);return q?Y.get(q):void 0}function N(){Y=new Map}async function n(j,q){if(!j||!Z.existsSync(j))return N(),{count:0,fingerprint:""};let G=await z(j);if(G.length===0)return N(),{count:0,fingerprint:""};let J=k(q),B=G.filter((A)=>{let x=J[A.relativePath];if(!x)return!0;let $=S(A.absolutePath);return!$||$.mtimeMs!==x.mtimeMs||$.size!==x.size});if(B.length===0)return N(),{count:0,fingerprint:""};let K={outDir:Q.join(q,"_stx","images"),storage:C(Q.join(q,"_stx","images")),baseUrl:O,widths:F,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},M=B,X;try{X=await T({...K,entries:_(B)})}catch(A){if(M=await I(B),M.length===B.length)throw A;let x=new Set(M.map((W)=>W.relativePath)),$=!1;for(let W of B){if(x.has(W.relativePath))continue;let H=S(W.absolutePath);if(!H)continue;J[W.relativePath]=H,$=!0}if($)P(q,J);if(M.length===0)return N(),{count:0,fingerprint:""};X=await T({...K,entries:_(M)})}return Y=new Map(Object.entries(X.entries)),{count:M.length,fingerprint:X.fingerprint}}
3
- export{h as ct,N as dt,n as et};
3
+ export{h as dt,N as et,n as ft};
@@ -8,4 +8,4 @@ function N(D,G){let j=D[G],F=G+1;while(F<D.length){if(D[F]==="\\"){F+=2;continue
8
8
  `:" ",j++}G+=" ",j++;continue}if(H==="`"){G+=" ",j++;while(j<D.length&&D[j]!=="`"){if(D[j]==="\\"){G+=" ",j+=2;continue}if(D[j]==="$"&&D[j+1]==="{"){let J=j+2,K=M(D,J);if(G+=" ",G+=R(D.slice(J,K)),K<D.length)G+=" ";j=K+1;continue}G+=D[j]===`
9
9
  `?`
10
10
  `:" ",j++}G+=" ",j++;continue}G+=H,j++}return G}function U(D){let G=new Uint16Array(D.length),j=0,F=!0;for(let H=0;H<D.length;H++){let J=D[H];if(J===")"||J==="]"||J==="}")if(j===0)F=!1;else j--;if(G[H]=j,J==="("||J==="["||J==="{")j++}return{depths:G,balanced:F&&j===0}}
11
- export{M as $s,R as at,U as bt};
11
+ export{M as at,R as bt,U as ct};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{$k as e,Xk as a,Yk as b,Zk as c,_k as d}from"./chunk-jbrdrxrc.js";import"./chunk-6bcw8twx.js";export{b as injectPwaTags,e as generateThemeColorMeta,c as generateSwRegistrationScript,a as generatePwaTags,d as generateManifestLink};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Og as a,Pg as b,Qg as c,Rg as d,Sg as e,Tg as f}from"./chunk-a9em3zm4.js";import"./chunk-a5gkg0a5.js";import"./chunk-6xbscz34.js";import"./chunk-bkbr9yz2.js";import"./chunk-nn4k6hvv.js";import"./chunk-1zyqv8p8.js";import"./chunk-1zvyq6jj.js";import"./chunk-4bct6m06.js";import"./chunk-v4vvm7mz.js";import"./chunk-s710wybv.js";import"./chunk-00mag1n0.js";import"./chunk-d3r5pdz7.js";import"./chunk-ze3qgdaf.js";import"./chunk-54fnvfp1.js";import"./chunk-42b81qv3.js";import"./chunk-6bcw8twx.js";export{c as renderSlot,d as processSlots,a as parseSlots,b as parseSlotElement,e as extractSlotContent,f as applySlots};
@@ -394,4 +394,4 @@ else {
394
394
  ${JSON.stringify(j)}
395
395
  </script>
396
396
  `}var r={processPartialHydrationDirectives:b,processStaticDirectives:x,generatePartialHydrationCSS:H,generateIslandManifest:y,createIslandRegistry:f,hydrateIsland:S,hydrateByStrategy:h,hydrateAll:g,isHydrated:v,onHydrated:u};
397
- export{B as Vh,I as Wh,E as Xh,V as Yh,f as Zh,b as _h,H as $h,S as ai,h as bi,g as ci,v as di,u as ei,x as fi,y as gi,r as hi};
397
+ export{B as Wh,I as Xh,E as Yh,V as Zh,f as _h,b as $h,H as ai,S as bi,h as ci,g as di,v as ei,u as fi,x as gi,y as hi,r as ii};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{kk as a,lk as b,mk as c,nk as d}from"./chunk-5jsssr3k.js";import"./chunk-ejvftzg7.js";import"./chunk-a5gkg0a5.js";import"./chunk-6xbscz34.js";import"./chunk-bkbr9yz2.js";import"./chunk-nn4k6hvv.js";import"./chunk-1zyqv8p8.js";import"./chunk-1zvyq6jj.js";import"./chunk-4bct6m06.js";import"./chunk-v4vvm7mz.js";import"./chunk-s710wybv.js";import"./chunk-00mag1n0.js";import"./chunk-d3r5pdz7.js";import"./chunk-ze3qgdaf.js";import"./chunk-54fnvfp1.js";import"./chunk-42b81qv3.js";import"./chunk-6bcw8twx.js";export{b as getAvailableTargets,c as getAvailableFormats,d as default,a as buildNative};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ah as e,Bh as f,Ch as g,Dh as h,wh as a,xh as b,yh as c,zh as d}from"./chunk-hmf9z4jx.js";import"./chunk-vwqv8f0y.js";export{g as timingPlugin,c as pluginManager,a as definePlugin,f as debugPlugin,h as createVariablesPlugin,e as createFilterPlugin,d as createDirectivePlugin,b as PluginManager};
2
+ import{Ah as d,Bh as e,Ch as f,Dh as g,Eh as h,xh as a,yh as b,zh as c}from"./chunk-683tfkz4.js";import"./chunk-6bcw8twx.js";export{g as timingPlugin,c as pluginManager,a as definePlugin,f as debugPlugin,h as createVariablesPlugin,e as createFilterPlugin,d as createDirectivePlugin,b as PluginManager};
@@ -299,4 +299,4 @@ catch (error) {
299
299
  }
300
300
  })();
301
301
  </script>`}var N={name:"pwa.installButton",handler:(j,z,k,E)=>{let q=k.__stx_options||{};return H(j,q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Q={name:"pwa.updatePrompt",handler:(j,z,k,E)=>{let q=k.__stx_options||{};return J(j,q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},T={name:"pwa.offlineIndicator",handler:(j,z,k,E)=>{let q=k.__stx_options||{};return L(j,q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},V={name:"pwa.pushSubscribe",handler:(j,z,k,E)=>{let q=k.__stx_options||{};return M(j,q)},hasEndTag:!0,description:"Renders a push notification subscription button"},X=[N,Q,T,V];function Z(j){return[...j,...X]}
302
- export{N as ev,Q as fv,T as gv,V as hv,X as iv,Z as jv};
302
+ export{N as fv,Q as gv,T as hv,V as iv,X as jv,Z as kv};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Gt as IJ}from"./chunk-kgxkrnyt.js";import{nv as VJ}from"./chunk-vwqv8f0y.js";import O from"path";import{hasLocalConfig as FJ}from"bunfig";var JJ={fg:{light:"gray-900",dark:"gray-100",description:"Primary text"},"fg-strong":{light:"gray-700",dark:"gray-300",description:"Labels, secondary headings"},"fg-muted":{light:"gray-600",dark:"gray-400",description:"Supporting text"},"fg-soft":{light:"gray-500",dark:"gray-400",description:"De-emphasised text"},"fg-subtle":{light:"gray-400",dark:"gray-500",description:"Placeholders, disabled text"},surface:{light:"gray-50",dark:"gray-800",description:"Page and panel background"},"surface-raised":{light:"gray-100",dark:"gray-700",description:"Cards, popovers"},"surface-sunken":{light:"gray-200",dark:"gray-700",description:"Wells, track backgrounds"},line:{light:"gray-200",dark:"gray-700",description:"Default border, divider"},"line-strong":{light:"gray-300",dark:"gray-600",description:"Input border, focus ring track"},accent:{light:"indigo-600",dark:"indigo-400",description:"Primary action, selected state"},info:{light:"blue-600",dark:"blue-400",description:"Informational emphasis, links"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-500",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"indigo-600",dark:"indigo-500",description:"Primary button fill"},"info-solid":{light:"blue-600",dark:"blue-500",description:"Informational fill"},"danger-solid":{light:"red-600",dark:"red-500",description:"Destructive button fill"},"success-solid":{light:"green-600",dark:"green-500",description:"Confirmation fill"}};function g(Q){return`--stx-${Q}`}function m(Q,J){let Y=J.lastIndexOf("-");if(Y===-1)return typeof Q[J]==="string"?Q[J]:void 0;let $=Q[J.slice(0,Y)];if(!$||typeof $!=="object")return;let Z=$[J.slice(Y+1)];return typeof Z==="string"?Z:void 0}function QJ(Q){let J={};for(let[Y,$]of Object.entries(JJ)){let Z=m(Q,$.light);if(Z===void 0)continue;J[Y]=`var(${g(Y)}, ${Z})`}return J}function YJ(Q){let J=[],Y=[];for(let[$,Z]of Object.entries(JJ)){let q=m(Q,Z.light),U=m(Q,Z.dark);if(q===void 0)continue;if(J.push(` ${g($)}: ${q};`),U!==void 0)Y.push(` ${g($)}: ${U};`)}if(J.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...J,"}",".dark {",...Y,"}",""].join(`
2
+ import{Ht as IJ}from"./chunk-v4vvm7mz.js";import{ov as VJ}from"./chunk-6bcw8twx.js";import O from"path";import{hasLocalConfig as FJ}from"bunfig";var JJ={fg:{light:"gray-900",dark:"gray-100",description:"Primary text"},"fg-strong":{light:"gray-700",dark:"gray-300",description:"Labels, secondary headings"},"fg-muted":{light:"gray-600",dark:"gray-400",description:"Supporting text"},"fg-soft":{light:"gray-500",dark:"gray-400",description:"De-emphasised text"},"fg-subtle":{light:"gray-400",dark:"gray-500",description:"Placeholders, disabled text"},surface:{light:"gray-50",dark:"gray-800",description:"Page and panel background"},"surface-raised":{light:"gray-100",dark:"gray-700",description:"Cards, popovers"},"surface-sunken":{light:"gray-200",dark:"gray-700",description:"Wells, track backgrounds"},line:{light:"gray-200",dark:"gray-700",description:"Default border, divider"},"line-strong":{light:"gray-300",dark:"gray-600",description:"Input border, focus ring track"},accent:{light:"indigo-600",dark:"indigo-400",description:"Primary action, selected state"},info:{light:"blue-600",dark:"blue-400",description:"Informational emphasis, links"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-500",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"indigo-600",dark:"indigo-500",description:"Primary button fill"},"info-solid":{light:"blue-600",dark:"blue-500",description:"Informational fill"},"danger-solid":{light:"red-600",dark:"red-500",description:"Destructive button fill"},"success-solid":{light:"green-600",dark:"green-500",description:"Confirmation fill"}};function g(Q){return`--stx-${Q}`}function m(Q,J){let Y=J.lastIndexOf("-");if(Y===-1)return typeof Q[J]==="string"?Q[J]:void 0;let $=Q[J.slice(0,Y)];if(!$||typeof $!=="object")return;let Z=$[J.slice(Y+1)];return typeof Z==="string"?Z:void 0}function QJ(Q){let J={};for(let[Y,$]of Object.entries(JJ)){let Z=m(Q,$.light);if(Z===void 0)continue;J[Y]=`var(${g(Y)}, ${Z})`}return J}function YJ(Q){let J=[],Y=[];for(let[$,Z]of Object.entries(JJ)){let q=m(Q,Z.light),U=m(Q,Z.dark);if(q===void 0)continue;if(J.push(` ${g($)}: ${q};`),U!==void 0)Y.push(` ${g($)}: ${U};`)}if(J.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...J,"}",".dark {",...Y,"}",""].join(`
3
3
  `)}function $J(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function u(Q,J){let Y={...Q};for(let[$,Z]of Object.entries(J))Y[$]=$J(Z)&&$J(Y[$])?u(Y[$],Z):Z;return Y}function ZJ(Q={},J={}){let Y=Q.theme||{},$=J.theme||{},{extend:Z,...q}=$,{extend:U,...j}=Y,F=j.colors||{};j.colors={...F,...QJ(F)};let V=u(j,q),I=u(U||{},Z||{});if(Object.keys(I).length>0)V.extend=I;let L=[...Q.safelist||[],...J.safelist||[]],T={...Q.shortcuts||{},...J.shortcuts||{}},K=[...Q.preflights||[],...J.preflights||[]];return{config:{...Q,...J,theme:V,safelist:L,shortcuts:T,...K.length>0?{preflights:K}:{},content:[],output:""},safelist:L,shortcuts:T,includePreflight:J.preflight!==!1,minify:J.minify===!0,tokenCSS:YJ(F)}}var W={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 OJ from"fs";class h{cache=new Map;maxSize;options;sizes;bytes=0;constructor(Q=100,J){this.maxSize=Q,this.options=J??null,this.sizes=J?new Map:null}get byteSize(){return this.bytes}setMaxBytes(Q){if(!this.options)return;this.options={...this.options,maxBytes:Q};while(this.bytes>Q&&this.cache.size>0){let J=this.cache.keys().next().value;if(J===void 0)break;this.delete(J)}}get(Q){if(!this.cache.has(Q))return;let J=this.cache.get(Q);return this.cache.delete(Q),this.cache.set(Q,J),J}set(Q,J){if(this.cache.has(Q))this.delete(Q);let Y=this.options?this.options.sizeOf(J):0;if(this.options&&Y>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+Y>this.options.maxBytes)){let $=this.cache.keys().next().value;if($===void 0)break;this.delete($)}if(this.cache.set(Q,J),this.sizes)this.sizes.set(Q,Y),this.bytes+=Y}has(Q){return this.cache.has(Q)}delete(Q){if(this.sizes){let J=this.sizes.get(Q);if(J!==void 0)this.bytes-=J,this.sizes.delete(Q)}return this.cache.delete(Q)}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 B=new Map,_J=500;function mJ(Q,J){if(J?.includes("g"))return new RegExp(Q,J);let Y=`${Q}:${J||""}`;if(!B.has(Y)){if(B.size>=_J){let $=B.keys().next().value;if($)B.delete($)}B.set(Y,new RegExp(Q,J))}return B.get(Y)}class qJ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(Q){let J=Array.from(new Set(Q)),Y=J.sort().join(","),$=this.pool.find((j)=>j.context.join(",")===Y);if($)return $.func;let Z=this.fnCache,q=this.fnCacheMaxSize,U=(...j)=>{return(F)=>{try{let V=`${Y}:${F}`,I=Z.get(V);if(!I){if(Z.size>=q){let L=Z.keys().next().value;if(L)Z.delete(L)}I=Function(...J,`
4
4
  'use strict';
5
5
  try {
@@ -11,7 +11,7 @@ catch (e) {
11
11
  }
12
12
  throw e;
13
13
  }
14
- `),Z.set(V,I)}return I(...j)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:U,context:J.slice()});return U}clear(){this.pool.length=0,this.fnCache.clear()}}var uJ=new qJ;class UJ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(Q){this.enabled=Q}isEnabled(){return this.enabled}setBudget(Q,J){this.budgets.set(Q,{warnThreshold:0.8,action:"warn",...J})}setBudgets(Q){for(let[J,Y]of Object.entries(Q))this.setBudget(J,Y)}removeBudget(Q){this.budgets.delete(Q)}getBudgets(){let Q={};for(let[J,Y]of this.budgets.entries())Q[J]=Y;return Q}onViolation(Q){this.violationHandlers.push(Q)}offViolation(Q){let J=this.violationHandlers.indexOf(Q);if(J!==-1)this.violationHandlers.splice(J,1)}time(Q,J){if(!this.enabled)return J();let Y=performance.now(),$=J(),Z=performance.now()-Y;return this.recordTime(Q,Z),this.checkBudget(Q,Z),$}async timeAsync(Q,J){if(!this.enabled)return J();let Y=performance.now(),$=await J(),Z=performance.now()-Y;return this.recordTime(Q,Z),this.checkBudget(Q,Z),$}checkBudget(Q,J){let Y=this.budgets.get(Q);if(!Y)return;let $=J/Y.maxTime*100,Z=Y.warnThreshold!==void 0?J>=Y.maxTime*Y.warnThreshold&&J<Y.maxTime:!1,q=J>=Y.maxTime;if(!Z&&!q)return;let U={label:Q,actualTime:J,budgetTime:Y.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:Z};this.violations.push(U);while(this.violations.length>this.maxViolations)this.violations.shift();for(let F of this.violationHandlers)try{F(U)}catch{}let j=Z?`[Performance Warning] "${Q}" took ${J.toFixed(2)}ms (${$.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${Q}" took ${J.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(j);break;case"warn":console.warn(j);break;case"error":console.error(j);break;case"throw":if(q)throw Error(j);else console.warn(j);break}}recordTime(Q,J){let Y=this.metrics.get(Q);if(Y)Y.count++,Y.totalTime+=J,Y.maxTime=Math.max(Y.maxTime,J),Y.minTime=Math.min(Y.minTime,J);else this.metrics.set(Q,{count:1,totalTime:J,maxTime:J,minTime:J})}getStats(Q){if(Q){let Y=this.metrics.get(Q);if(!Y)return{};let $=this.budgets.get(Q);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:$?.maxTime,budgetUtilization:$?Y.totalTime/Y.count/$.maxTime*100:void 0}}let J={};for(let[Y,$]of this.metrics.entries()){let Z=this.budgets.get(Y);J[Y]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:Z?.maxTime,budgetUtilization:Z?$.totalTime/$.count/Z.maxTime*100:void 0}}return J}getViolations(Q){if(Q)return this.violations.filter((J)=>J.label===Q);return[...this.violations]}getViolationStats(){let Q={},J=0,Y=0;for(let $ of this.violations)if(Q[$.label]=(Q[$.label]||0)+1,$.isWarning)J++;else Y++;return{total:this.violations.length,byLabel:Q,warnings:J,errors:Y}}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 d=null;function HJ(){if(!d)d=new UJ;return d}var dJ=new Proxy({},{get(Q,J){return HJ()[J]}});var WJ=[];function jJ(Q){let J=new h(Q);return WJ.push(J),J}function lJ(){for(let Q of WJ)Q.clear()}function i(Q,...J){return`${J.map((Y)=>String(Y??"")).join("\x00")}\x00${Q.length}\x00${Bun.hash(Q)}`}function nJ(Q){let J=[];for(let Y of new Set(Q))try{J.push({path:Y,mtimeMs:OJ.statSync(Y).mtimeMs})}catch{}return J}function oJ(Q){for(let J of Q)try{if(OJ.statSync(J.path).mtimeMs!==J.mtimeMs)return!1}catch{return!1}return!0}var N=null,l=!1,X=null,M="",w=!1,NJ=256,_=new Map,z=new Map,H=null,E=null;function x(Q){return Bun.hash(Q).toString(16).padStart(16,"0").slice(0,16)}function c(Q,J){if(_.has(Q))_.delete(Q);else if(_.size>=NJ)_.delete(_.keys().next().value);_.set(Q,J)}function TJ(Q){let J=x(Q);if(z.has(J))z.delete(J);else if(z.size>=NJ)z.delete(z.keys().next().value);return z.set(J,Q),J}function YQ(Q){let J=z.get(Q);if(J===void 0)return;return z.delete(Q),z.set(Q,J),J}async function BJ(Q){if(!H)return null;try{let J=Bun.file(O.join(H,`cw-${x(Q)}.css`));if(!await J.exists())return null;return await J.text()}catch{return null}}async function wJ(Q,J){if(!H)return;try{if(!fs.existsSync(H))fs.mkdirSync(H,{recursive:!0});await Bun.write(O.join(H,`cw-${x(Q)}.css`),J)}catch{}}async function GJ(Q){try{let J=await import(Q);if(J&&J.CSSGenerator)return{CSSGenerator:J.CSSGenerator,config:J.config,build:J.build,defaultConfig:J.defaultConfig,extractClasses:J.extractClasses}}catch{}return null}var KJ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],RJ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function PJ(){let Q=[],J=process.cwd();while(J!==O.dirname(J)){for(let Y of["node_modules","pantry"])for(let $ of KJ)Q.push(O.join(J,Y,...$));J=O.dirname(J)}return Q}function DJ(){let Q=[],J=process.env.HOME||process.env.USERPROFILE||"",Y=[J&&O.join(J,"Code","Tools","ts-css"),J&&O.join(J,"Code","Tools","crosswind"),J&&O.join(J,"repos","stacks-org","ts-css"),J&&O.join(J,"repos","stacks-org","crosswind"),O.join(process.cwd(),"..","ts-css"),O.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Y)Q.push(O.join($,"packages","toolkit","dist","engine","index.js")),Q.push(O.join($,"packages","toolkit","src","engine","index.ts"));if(J)Q.push(O.join(J,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return Q}async function zJ(){if(l)return N;l=!0;try{let Q=async(Z)=>{for(let q of Z){if(!await Bun.file(q).exists())continue;let U=await GJ(q);if(U){if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[ts-css]${W.reset} CSS engine loaded from ${O.dirname(O.dirname(q))}`);return U}}return null};if(process.env.CROSSWIND_SRC){let Z=O.resolve(process.env.CROSSWIND_SRC),q=await Q([Z]);if(!q)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${Z}`);return N=q,N}let J=await Q(PJ());if(J)return N=J,N;let Y=RJ;for(let Z of Y){let q=await GJ(Z);if(q){if(N=q,!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[ts-css]${W.reset} CSS engine loaded`);return N}}let $=await Q(DJ());if($)return N=$,N;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${W.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${W.reset}`),console.warn(`${W.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${W.reset}`),null}}function $Q(){n.clear(),N=null,l=!1,X=null,M="",_.clear(),z.clear(),E=null}var XJ=!1;async function AJ(Q){try{let J=FJ({name:"css",cwd:Q})?"css":FJ({name:"crosswind",cwd:Q})?"crosswind":null;if(!J)return null;if(J==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!XJ)XJ=!0,console.warn(`${W.yellow}[ts-css]${W.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:Y}=await import("bunfig"),$=await Y({name:J,cwd:Q,defaultConfig:{},checkEnv:!1,verbose:!1});if(!$?.path||!$.config||Object.keys($.config).length===0)return null;let Z=O.relative(Q,$.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[ts-css]${W.reset} Loaded config from ${Z||$.path}`);return $.config}catch(J){if(J instanceof Error&&J.name==="ConfigNotFoundError")return null;return console.warn(`${W.yellow}[ts-css]${W.reset} Failed to load css config:`,J instanceof Error?J.message:J),null}}async function MJ(Q){let J=null;try{let{loadStxConfig:Y}=await import("./chunk-s7yjggwh.js"),$=await Y(Q);if($.css)if(typeof $.css==="string"){let Z=O.isAbsolute($.css)?$.css:O.resolve(Q,$.css);if(await Bun.file(Z).exists()){let q=await import(Z);J=q.default||q,console.log(`${W.green}[ts-css]${W.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(J={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let Z=O.isAbsolute($.css.config)?$.css.config:O.resolve(Q,$.css.config);if(await Bun.file(Z).exists()){let q=await import(Z);J={...q.default||q,...J}}}console.log(`${W.green}[ts-css]${W.reset} Using inline CSS config from stx.config.ts`)}}catch{}return J||await AJ(Q)}function EJ(Q){try{let J=new WeakSet;return x(JSON.stringify(Q??{},(Y,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(J.has($))return"[circular]";J.add($)}return $})??"")}catch{return"unhashable"}}async function SJ(Q){if(w)return M;w=!0;try{let J=await zJ();if(!J||!J.build)return w=!1,"";if(!X)X=await AJ(Q);if(!X)return w=!1,"";let Y=J.defaultConfig?.theme||{},$=X.theme||{},Z={...J.defaultConfig,...X,theme:{...Y,...$,extend:{...Y.extend||{},...$.extend||{}}}},q=performance.now(),U=await J.build(Z),j=performance.now()-q;if(M=U.css,console.log(`${W.cyan}[ts-css]${W.reset} Built ${U.classes.size} classes in ${j.toFixed(1)}ms`),Z.output){let F=O.isAbsolute(Z.output)?Z.output:O.join(Q,Z.output),V=O.dirname(F);if(!fs.existsSync(V))fs.mkdirSync(V,{recursive:!0});await Bun.write(F,U.css)}return w=!1,U.css}catch(J){return console.error(`${W.red}[ts-css]${W.reset} Build error:`,J),w=!1,M}}async function ZQ(Q){X=null,await SJ(Q)}function qQ(){return M}function vJ(Q){let J=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,$=Y.exec(Q);while($!==null){for(let U of $[1].split(/\s+/))if(U.trim())J.add(U.trim());$=Y.exec(Q)}let Z=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,q=Z.exec(Q);while(q!==null){let U=q[1].match(/'([^']+)'/g);if(U){for(let j of U)for(let F of j.slice(1,-1).split(/\s+/))if(F.trim())J.add(F.trim())}q=Z.exec(Q)}return J}var n=jJ(64);async function xJ(Q,J){let Y=n.get(i(Q,J,E));if(Y!==void 0)return Y;let $=await kJ(Q,J);if($)n.set(i(Q,J,E),$);return $}async function kJ(Q,J){try{let Y=await zJ();if(!Y)return"";let $=typeof Y.extractClasses==="function"?Y.extractClasses(Q):vJ(Q);if($.size===0)return"";let Z=J?O.resolve(J):process.cwd();if(!H)H=IJ(Z,"cache");let q=[...$].sort().join(" "),U=`${E||"default"}::${q}`,j=_.get(U);if(j!==void 0)return c(U,j),j;let F=await BJ(U);if(F!==null)return c(U,F),F;if(!X)X=await MJ(Z),E=EJ(X);let V=Y.defaultConfig||Y.config,I=X||{},L=ZJ(V,I),{safelist:T,includePreflight:K,minify:k,tokenCSS:LJ}=L,o=L.config,R=new Y.CSSGenerator(o);for(let G of T)R.generate(G);for(let G of $)R.generate(G);let A=R.toCSS(K,k),r=o.shortcuts||I.shortcuts||{};for(let[G,b]of Object.entries(r)){if(!$.has(G)&&!T.includes(G))continue;let y=b.split(/\s+/).filter(Boolean);for(let D of y)R.generate(D)}A=R.toCSS(K,k);let P=A.split(`
14
+ `),Z.set(V,I)}return I(...j)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:U,context:J.slice()});return U}clear(){this.pool.length=0,this.fnCache.clear()}}var uJ=new qJ;class UJ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(Q){this.enabled=Q}isEnabled(){return this.enabled}setBudget(Q,J){this.budgets.set(Q,{warnThreshold:0.8,action:"warn",...J})}setBudgets(Q){for(let[J,Y]of Object.entries(Q))this.setBudget(J,Y)}removeBudget(Q){this.budgets.delete(Q)}getBudgets(){let Q={};for(let[J,Y]of this.budgets.entries())Q[J]=Y;return Q}onViolation(Q){this.violationHandlers.push(Q)}offViolation(Q){let J=this.violationHandlers.indexOf(Q);if(J!==-1)this.violationHandlers.splice(J,1)}time(Q,J){if(!this.enabled)return J();let Y=performance.now(),$=J(),Z=performance.now()-Y;return this.recordTime(Q,Z),this.checkBudget(Q,Z),$}async timeAsync(Q,J){if(!this.enabled)return J();let Y=performance.now(),$=await J(),Z=performance.now()-Y;return this.recordTime(Q,Z),this.checkBudget(Q,Z),$}checkBudget(Q,J){let Y=this.budgets.get(Q);if(!Y)return;let $=J/Y.maxTime*100,Z=Y.warnThreshold!==void 0?J>=Y.maxTime*Y.warnThreshold&&J<Y.maxTime:!1,q=J>=Y.maxTime;if(!Z&&!q)return;let U={label:Q,actualTime:J,budgetTime:Y.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:Z};this.violations.push(U);while(this.violations.length>this.maxViolations)this.violations.shift();for(let F of this.violationHandlers)try{F(U)}catch{}let j=Z?`[Performance Warning] "${Q}" took ${J.toFixed(2)}ms (${$.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${Q}" took ${J.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(j);break;case"warn":console.warn(j);break;case"error":console.error(j);break;case"throw":if(q)throw Error(j);else console.warn(j);break}}recordTime(Q,J){let Y=this.metrics.get(Q);if(Y)Y.count++,Y.totalTime+=J,Y.maxTime=Math.max(Y.maxTime,J),Y.minTime=Math.min(Y.minTime,J);else this.metrics.set(Q,{count:1,totalTime:J,maxTime:J,minTime:J})}getStats(Q){if(Q){let Y=this.metrics.get(Q);if(!Y)return{};let $=this.budgets.get(Q);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:$?.maxTime,budgetUtilization:$?Y.totalTime/Y.count/$.maxTime*100:void 0}}let J={};for(let[Y,$]of this.metrics.entries()){let Z=this.budgets.get(Y);J[Y]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:Z?.maxTime,budgetUtilization:Z?$.totalTime/$.count/Z.maxTime*100:void 0}}return J}getViolations(Q){if(Q)return this.violations.filter((J)=>J.label===Q);return[...this.violations]}getViolationStats(){let Q={},J=0,Y=0;for(let $ of this.violations)if(Q[$.label]=(Q[$.label]||0)+1,$.isWarning)J++;else Y++;return{total:this.violations.length,byLabel:Q,warnings:J,errors:Y}}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 d=null;function HJ(){if(!d)d=new UJ;return d}var dJ=new Proxy({},{get(Q,J){return HJ()[J]}});var WJ=[];function jJ(Q){let J=new h(Q);return WJ.push(J),J}function lJ(){for(let Q of WJ)Q.clear()}function i(Q,...J){return`${J.map((Y)=>String(Y??"")).join("\x00")}\x00${Q.length}\x00${Bun.hash(Q)}`}function nJ(Q){let J=[];for(let Y of new Set(Q))try{J.push({path:Y,mtimeMs:OJ.statSync(Y).mtimeMs})}catch{}return J}function oJ(Q){for(let J of Q)try{if(OJ.statSync(J.path).mtimeMs!==J.mtimeMs)return!1}catch{return!1}return!0}var N=null,l=!1,X=null,M="",w=!1,NJ=256,_=new Map,z=new Map,H=null,E=null;function x(Q){return Bun.hash(Q).toString(16).padStart(16,"0").slice(0,16)}function c(Q,J){if(_.has(Q))_.delete(Q);else if(_.size>=NJ)_.delete(_.keys().next().value);_.set(Q,J)}function TJ(Q){let J=x(Q);if(z.has(J))z.delete(J);else if(z.size>=NJ)z.delete(z.keys().next().value);return z.set(J,Q),J}function YQ(Q){let J=z.get(Q);if(J===void 0)return;return z.delete(Q),z.set(Q,J),J}async function BJ(Q){if(!H)return null;try{let J=Bun.file(O.join(H,`cw-${x(Q)}.css`));if(!await J.exists())return null;return await J.text()}catch{return null}}async function wJ(Q,J){if(!H)return;try{if(!fs.existsSync(H))fs.mkdirSync(H,{recursive:!0});await Bun.write(O.join(H,`cw-${x(Q)}.css`),J)}catch{}}async function GJ(Q){try{let J=await import(Q);if(J&&J.CSSGenerator)return{CSSGenerator:J.CSSGenerator,config:J.config,build:J.build,defaultConfig:J.defaultConfig,extractClasses:J.extractClasses}}catch{}return null}var KJ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],RJ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function PJ(){let Q=[],J=process.cwd();while(J!==O.dirname(J)){for(let Y of["node_modules","pantry"])for(let $ of KJ)Q.push(O.join(J,Y,...$));J=O.dirname(J)}return Q}function DJ(){let Q=[],J=process.env.HOME||process.env.USERPROFILE||"",Y=[J&&O.join(J,"Code","Tools","ts-css"),J&&O.join(J,"Code","Tools","crosswind"),J&&O.join(J,"repos","stacks-org","ts-css"),J&&O.join(J,"repos","stacks-org","crosswind"),O.join(process.cwd(),"..","ts-css"),O.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Y)Q.push(O.join($,"packages","toolkit","dist","engine","index.js")),Q.push(O.join($,"packages","toolkit","src","engine","index.ts"));if(J)Q.push(O.join(J,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return Q}async function zJ(){if(l)return N;l=!0;try{let Q=async(Z)=>{for(let q of Z){if(!await Bun.file(q).exists())continue;let U=await GJ(q);if(U){if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[ts-css]${W.reset} CSS engine loaded from ${O.dirname(O.dirname(q))}`);return U}}return null};if(process.env.CROSSWIND_SRC){let Z=O.resolve(process.env.CROSSWIND_SRC),q=await Q([Z]);if(!q)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${Z}`);return N=q,N}let J=await Q(PJ());if(J)return N=J,N;let Y=RJ;for(let Z of Y){let q=await GJ(Z);if(q){if(N=q,!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[ts-css]${W.reset} CSS engine loaded`);return N}}let $=await Q(DJ());if($)return N=$,N;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${W.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${W.reset}`),console.warn(`${W.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${W.reset}`),null}}function $Q(){n.clear(),N=null,l=!1,X=null,M="",_.clear(),z.clear(),E=null}var XJ=!1;async function AJ(Q){try{let J=FJ({name:"css",cwd:Q})?"css":FJ({name:"crosswind",cwd:Q})?"crosswind":null;if(!J)return null;if(J==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!XJ)XJ=!0,console.warn(`${W.yellow}[ts-css]${W.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:Y}=await import("bunfig"),$=await Y({name:J,cwd:Q,defaultConfig:{},checkEnv:!1,verbose:!1});if(!$?.path||!$.config||Object.keys($.config).length===0)return null;let Z=O.relative(Q,$.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${W.green}[ts-css]${W.reset} Loaded config from ${Z||$.path}`);return $.config}catch(J){if(J instanceof Error&&J.name==="ConfigNotFoundError")return null;return console.warn(`${W.yellow}[ts-css]${W.reset} Failed to load css config:`,J instanceof Error?J.message:J),null}}async function MJ(Q){let J=null;try{let{loadStxConfig:Y}=await import("./chunk-yvgqs82c.js"),$=await Y(Q);if($.css)if(typeof $.css==="string"){let Z=O.isAbsolute($.css)?$.css:O.resolve(Q,$.css);if(await Bun.file(Z).exists()){let q=await import(Z);J=q.default||q,console.log(`${W.green}[ts-css]${W.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(J={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let Z=O.isAbsolute($.css.config)?$.css.config:O.resolve(Q,$.css.config);if(await Bun.file(Z).exists()){let q=await import(Z);J={...q.default||q,...J}}}console.log(`${W.green}[ts-css]${W.reset} Using inline CSS config from stx.config.ts`)}}catch{}return J||await AJ(Q)}function EJ(Q){try{let J=new WeakSet;return x(JSON.stringify(Q??{},(Y,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(J.has($))return"[circular]";J.add($)}return $})??"")}catch{return"unhashable"}}async function SJ(Q){if(w)return M;w=!0;try{let J=await zJ();if(!J||!J.build)return w=!1,"";if(!X)X=await AJ(Q);if(!X)return w=!1,"";let Y=J.defaultConfig?.theme||{},$=X.theme||{},Z={...J.defaultConfig,...X,theme:{...Y,...$,extend:{...Y.extend||{},...$.extend||{}}}},q=performance.now(),U=await J.build(Z),j=performance.now()-q;if(M=U.css,console.log(`${W.cyan}[ts-css]${W.reset} Built ${U.classes.size} classes in ${j.toFixed(1)}ms`),Z.output){let F=O.isAbsolute(Z.output)?Z.output:O.join(Q,Z.output),V=O.dirname(F);if(!fs.existsSync(V))fs.mkdirSync(V,{recursive:!0});await Bun.write(F,U.css)}return w=!1,U.css}catch(J){return console.error(`${W.red}[ts-css]${W.reset} Build error:`,J),w=!1,M}}async function ZQ(Q){X=null,await SJ(Q)}function qQ(){return M}function vJ(Q){let J=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,$=Y.exec(Q);while($!==null){for(let U of $[1].split(/\s+/))if(U.trim())J.add(U.trim());$=Y.exec(Q)}let Z=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,q=Z.exec(Q);while(q!==null){let U=q[1].match(/'([^']+)'/g);if(U){for(let j of U)for(let F of j.slice(1,-1).split(/\s+/))if(F.trim())J.add(F.trim())}q=Z.exec(Q)}return J}var n=jJ(64);async function xJ(Q,J){let Y=n.get(i(Q,J,E));if(Y!==void 0)return Y;let $=await kJ(Q,J);if($)n.set(i(Q,J,E),$);return $}async function kJ(Q,J){try{let Y=await zJ();if(!Y)return"";let $=typeof Y.extractClasses==="function"?Y.extractClasses(Q):vJ(Q);if($.size===0)return"";let Z=J?O.resolve(J):process.cwd();if(!H)H=IJ(Z,"cache");let q=[...$].sort().join(" "),U=`${E||"default"}::${q}`,j=_.get(U);if(j!==void 0)return c(U,j),j;let F=await BJ(U);if(F!==null)return c(U,F),F;if(!X)X=await MJ(Z),E=EJ(X);let V=Y.defaultConfig||Y.config,I=X||{},L=ZJ(V,I),{safelist:T,includePreflight:K,minify:k,tokenCSS:LJ}=L,o=L.config,R=new Y.CSSGenerator(o);for(let G of T)R.generate(G);for(let G of $)R.generate(G);let A=R.toCSS(K,k),r=o.shortcuts||I.shortcuts||{};for(let[G,b]of Object.entries(r)){if(!$.has(G)&&!T.includes(G))continue;let y=b.split(/\s+/).filter(Boolean);for(let D of y)R.generate(D)}A=R.toCSS(K,k);let P=A.split(`
15
15
  `);for(let[G,b]of Object.entries(r)){if(!$.has(G)&&!T.includes(G))continue;let y=b.split(/\s+/).filter(Boolean),D=[],f=[];for(let C of y){let a=C.startsWith("dark:"),s=`.${(a?C.slice(5):C).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let S=0;S<P.length;S++){let t=P[S].trim();if(t===`${s} {`||t.startsWith(`${s} {`)){let v=S,e="";while(v<P.length){if(e+=P[v],P[v].includes("}"))break;v++}let p=e.match(/\{([^}]+)\}/);if(p)if(a)f.push(p[1].trim());else D.push(p[1].trim());break}}}if(D.length)A+=`
16
16
  .${G} { ${D.join(" ")} }`;if(f.length)A+=`
17
17
  @media (prefers-color-scheme: dark) { .dark .${G} { ${f.join(" ")} } }`}return A=LJ+A,c(U,A),wJ(U,A),A}catch(Y){return console.warn("Failed to generate Css CSS:",Y),""}}async function UQ(Q,J,Y=!1){let $=await xJ(Q,J);if(!$)return Q;let Z=Y?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${TJ($)}.css">`:`<style data-css="generated">
@@ -19,4 +19,4 @@ ${$}
19
19
  </style>`,q=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(q.test(Q)){let U=!1;return Q.replace(q,()=>{if(U)return"";return U=!0,Z})}if(Q.includes("</head>"))return Q.replace("</head>",`${Z}
20
20
  </head>`);if(Q.includes("<body"))return Q.replace(/<body([^>]*)>/,`<body$1>
21
21
  ${Z}`);return Z+Q}
22
- export{h as ft,mJ as gt,dJ as ht,jJ as it,lJ as jt,i as kt,nJ as lt,oJ as mt,u as nt,ZJ as ot,W as pt,YQ as qt,zJ as rt,$Q as st,AJ as tt,MJ as ut,EJ as vt,SJ as wt,ZQ as xt,qQ as yt,vJ as zt,xJ as At,UQ as Bt};
22
+ export{h as gt,mJ as ht,dJ as it,jJ as jt,lJ as kt,i as lt,nJ as mt,oJ as nt,u as ot,ZJ as pt,W as qt,YQ as rt,zJ as st,$Q as tt,AJ as ut,MJ as vt,EJ as wt,SJ as xt,ZQ as yt,qQ as zt,vJ as At,xJ as Bt,UQ as Ct};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{$t as a,au as b}from"./chunk-d3r5pdz7.js";import"./chunk-6bcw8twx.js";export{b as warnUnbalancedTags,a as findUnbalancedTags};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ui as a,vi as b,wi as c,xi as d,yi as e,zi as f}from"./chunk-wvq1g6gr.js";import"./chunk-vwqv8f0y.js";export{c as processTransitionDirectives,f as processTransitionAttributes,b as performLeave,a as performEnter,e as generateTransitionRuntime,d as generateTransitionCSS};
2
+ import{Ai as f,vi as a,wi as b,xi as c,yi as d,zi as e}from"./chunk-v8474ah4.js";import"./chunk-6bcw8twx.js";export{c as processTransitionDirectives,f as processTransitionAttributes,b as performLeave,a as performEnter,e as generateTransitionRuntime,d as generateTransitionCSS};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Go as a,Ho as b,Io as c,Jo as d,Ko as e,Lo as f}from"./chunk-a5gkg0a5.js";import"./chunk-6xbscz34.js";import"./chunk-bkbr9yz2.js";import"./chunk-nn4k6hvv.js";import"./chunk-1zyqv8p8.js";import"./chunk-1zvyq6jj.js";import"./chunk-4bct6m06.js";import"./chunk-v4vvm7mz.js";import"./chunk-s710wybv.js";import"./chunk-00mag1n0.js";import"./chunk-d3r5pdz7.js";import"./chunk-ze3qgdaf.js";import"./chunk-54fnvfp1.js";import"./chunk-42b81qv3.js";import"./chunk-6bcw8twx.js";export{f as processStackReplacements,e as processStackPushDirectives,d as processIncludes,a as partialsCache,b as onceStore,c as clearOnceStore};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{lv as Ae,mv as u}from"./chunk-vwqv8f0y.js";function _(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>g.includes(a))}function m(e){return _(e.replace(/^\//,""))}var g;var b=u(()=>{g=["components","layouts","partials","emails"]});import h from"fs";import y from"path";function x(e,t){let a=e.filter((o)=>!m(o.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let o of a){let i=[];for(let c of o.params){let f=o.pattern.includes(`:${c}?`)?"?":"";i.push(`${c}${f}: string`)}let l=i.join("; ");r.push(` '${o.pattern}': { ${l} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
2
+ import{mv as Ae,nv as u}from"./chunk-6bcw8twx.js";function _(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>g.includes(a))}function m(e){return _(e.replace(/^\//,""))}var g;var b=u(()=>{g=["components","layouts","partials","emails"]});import h from"fs";import y from"path";function x(e,t){let a=e.filter((o)=>!m(o.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let o of a){let i=[];for(let c of o.params){let f=o.pattern.includes(`:${c}?`)?"?":"";i.push(`${c}${f}: string`)}let l=i.join("; ");r.push(` '${o.pattern}': { ${l} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
3
3
  `),s=y.join(t,"route-types.d.ts");try{if(h.existsSync(s)&&h.readFileSync(s,"utf8")===n)return;h.mkdirSync(t,{recursive:!0}),h.writeFileSync(s,n)}catch{}}function S(e,t,a){let r=process.cwd(),n=y.relative(r,a),s=e.filter((i)=>!m(i.pattern)),o=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let i of s){let l=y.relative(r,i.filePath).replace(/\\/g,"/"),c=JSON.stringify(i.params),f=i.layout?`, layout: '${y.relative(r,i.layout).replace(/\\/g,"/")}'`:"";o.push(` { pattern: '${i.pattern}', filePath: '${l}', isDynamic: ${i.isDynamic}, params: ${c}${f} },`)}o.push("] as const",""),o.push("export type RouteName = typeof routes[number]['pattern']",""),h.mkdirSync(t,{recursive:!0}),h.writeFileSync(y.join(t,"routes.ts"),o.join(`
4
4
  `))}var F=u(()=>{b()});import V from"path";function k(e,t){let r=V.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(V.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function v(e){let t=[],a="",r=0;while(r<e.length){let n=e.slice(r),s=/^\/:([^/?*]+)\?/.exec(n);if(s){t.push(s[1]),a+="(?:/([^/]+))?",r+=s[0].length;continue}let o=/^:([^/?*]+)\*/.exec(n);if(o){t.push(o[1]),a+="(.+)",r+=o[0].length;continue}let i=/^:([^/?*]+)/.exec(n);if(i){t.push(i[1]),a+="([^/]+)",r+=i[0].length;continue}a+=e[r].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),r+=1}return{regex:new RegExp(`^${a}$`),params:t}}function D(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let s={};return r.params.forEach((o,i)=>{s[o]=n[i+1]}),{route:r,params:s}}}return null}function W(e){let t=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return v(t)}var M=()=>{};import xe from"fs";import I from"path";function A(e,t){let a=[],r=I.dirname(e);while(r.startsWith(t)||r===t){let n=I.join(r,"_layout.stx");if(xe.existsSync(n))a.unshift(n);if(r===t)break;r=I.dirname(r)}return a}var N=()=>{};import P from"fs";import d from"path";function K(e,t){let a=[];if(!P.existsSync(e))return a;let r=P.readdirSync(e,{withFileTypes:!0});for(let n of r){let s=d.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(g.includes(n.name))continue;a.push(...K(s,t))}else if(n.isFile()){let o=d.extname(n.name);if(t.includes(o)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(s)}}}return a}class C{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((o)=>d.resolve(e,o)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=new Set;this.routes=[];for(let o of this.pagesDirs){let i=K(o,r);for(let l of i){let c=k(l,o);if(n.has(c))continue;n.add(c);let{regex:f,params:H}=v(c),O=t.layouts!==!1?A(l,o):[];this.routes.push({pattern:c,regex:f,params:H,filePath:l,isDynamic:H.length>0,layout:O.length>0?O[O.length-1]:void 0})}}this.routes.sort((o,i)=>{if(!o.isDynamic&&i.isDynamic)return-1;if(o.isDynamic&&!i.isDynamic)return 1;let l=o.pattern.split("/").length,c=i.pattern.split("/").length;if(l!==c)return c-l;return o.pattern.localeCompare(i.pattern)});let s=d.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");x(this.routes,s),S(this.routes,s,this.pagesDir)}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((s,o)=>{n[s]=r[o+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,s]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(s));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function $(e,t){return new C(e,t)}function z(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=d.join(e,r);if(P.existsSync(n))return n}return null}function Y(e,t){return e.map((a)=>{let r=d.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var J=u(()=>{F();M();N();b()});function Z(e){T=e.replace(/\/$/,"")}function Q(e,t,a={}){p[e]={path:t,name:e,params:a}}function ee(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")p[t]={path:a,name:t};else p[t]={...a,name:t}}function te(e,t={},a=!1){let r=p[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},s=r.path;s=s.replace(/:(\w+)/g,(i,l)=>{let c=n[l];if(c===void 0)return console.warn(`Missing parameter [${l}] for route [${e}].`),`:${l}`;return delete n[l],encodeURIComponent(String(c))});let o=Object.entries(n);if(o.length>0){let i=o.map(([l,c])=>`${encodeURIComponent(l)}=${encodeURIComponent(String(c))}`).join("&");s+=(s.includes("?")?"&":"?")+i}return a&&T?`${T}${s}`:s}function re(){for(let e of Object.keys(p))delete p[e];T=""}var p,T="";var ae=u(()=>{p={}});import ne from"fs";import oe from"path";function se(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function ie(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function le(e,t={}){return{handler:e,mode:t.mode??"universal"}}function B(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...s]=r.split("=");if(n){let o=n.trim(),i=s.join("=").trim();if(o)t[o]=decodeURIComponent(i)}}return t}function E(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function G(e,t){let a=e.headers.get("cookie")||"",r=B(a);return{get(n){return r[n]},set(n,s,o={}){r[n]=s,t.append("Set-Cookie",E(n,s,o))},delete(n){delete r[n],t.append("Set-Cookie",E(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function U(){return{get(e){if(typeof document>"u")return;return B(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=E(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=E(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return B(document.cookie)}}}function X(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}function R(e,t){w.set(e,t)}function j(e){return w.get(e)}function ce(e){return w.has(e)}function ue(){w.clear()}function he(){return Array.from(w.keys())}async function de(e,t="middleware"){let a=oe.resolve(e,t);if(!ne.existsSync(a))return;let r=ne.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let s=n.replace(/\.(ts|js)$/,""),o=oe.join(a,n);try{let l=(await import(o)).default;if(l&&typeof l.handler==="function")R(s,l);else if(typeof l==="function")R(s,{handler:l,mode:"universal"})}catch(i){console.warn(`Failed to load middleware '${s}' from ${o}:`,i)}}}function Se(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function pe(e,t,a,r=""){return{path:e,params:t,query:Se(r),fullPath:r?`${e}?${r}`:e,meta:a}}function fe(e,t,a,r){let n=r?.isServer??typeof window>"u",s=!n,o=new Headers;return{to:e,from:t,isClient:s,isServer:n,cookies:n&&a?G(a,o):U(),storage:X(),state:{},request:a,responseHeaders:o}}async function ge(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let s=j(n);if(!s)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(s.mode==="server"&&!r)continue;try{let o=await s.handler(t);if(o){if(o.type==="redirect")return{passed:!1,redirect:o,state:t.state,responseHeaders:t.responseHeaders};if(o.type==="abort")return{passed:!1,abort:o,state:t.state,responseHeaders:t.responseHeaders}}}catch(o){return console.error(`Error in middleware '${n}':`,o),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:o instanceof Error?o.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}var w;var me=u(()=>{w=new Map});function q(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function ye(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||q(n)}}var ve=()=>{};function ke(e){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function we(){if(L)return L;return L=ke(`
5
5
  ;(function(){
@@ -1981,4 +1981,4 @@ else {
1981
1981
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
1982
1982
  })();
1983
1983
  `),L}var L;var be=()=>{};var Ce={};Ae(Ce,{setAppUrl:()=>Z,runMiddleware:()=>ge,route:()=>te,resolveLayoutChain:()=>A,resetRoutes:()=>re,registerMiddleware:()=>R,patternToRegex:()=>v,navigateTo:()=>se,matchRoute:()=>D,loadMiddlewareFromDirectory:()=>de,isNonPageRoutePattern:()=>m,isNonPageRoutePath:()=>_,hasMiddleware:()=>ce,getRouterScript:()=>we,getMiddlewareNames:()=>he,getMiddleware:()=>j,generateRouteTypes:()=>x,generateRouteManifest:()=>S,formatRoutes:()=>Y,findErrorPage:()=>z,filePathToPattern:()=>k,extractLayoutMetadata:()=>ye,deriveLayoutGroup:()=>q,defineRoutes:()=>ee,defineRoute:()=>Q,defineMiddleware:()=>le,createStorageManager:()=>X,createServerCookieManager:()=>G,createRouter:()=>$,createRouteLocation:()=>pe,createMiddlewareContext:()=>fe,createClientCookieManager:()=>U,clearMiddleware:()=>ue,bracketPathToRegex:()=>W,abortNavigation:()=>ie,Router:()=>C,NON_PAGE_DIRS:()=>g});var Te=u(()=>{J();M();ae();me();N();ve();F();b();be()});
1984
- export{g as su,_ as tu,m as uu,x as vu,S as wu,k as xu,v as yu,D as zu,W as Au,A as Bu,C as Cu,$ as Du,z as Eu,Y as Fu,Z as Gu,Q as Hu,ee as Iu,te as Ju,re as Ku,se as Lu,ie as Mu,le as Nu,G as Ou,U as Pu,X as Qu,R as Ru,j as Su,ce as Tu,ue as Uu,he as Vu,de as Wu,pe as Xu,fe as Yu,ge as Zu,q as _u,ye as $u,ve as av,we as bv,Ce as cv,Te as dv};
1984
+ export{g as tu,_ as uu,m as vu,x as wu,S as xu,k as yu,v as zu,D as Au,W as Bu,A as Cu,C as Du,$ as Eu,z as Fu,Y as Gu,Z as Hu,Q as Iu,ee as Ju,te as Ku,re as Lu,se as Mu,ie as Nu,le as Ou,G as Pu,U as Qu,X as Ru,R as Su,j as Tu,ce as Uu,ue as Vu,he as Wu,de as Xu,pe as Yu,fe as Zu,ge as _u,q as $u,ye as av,ve as bv,we as cv,Ce as dv,Te as ev};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{lh as x,qh as B,rh as c,sh as u,th as n}from"./chunk-k78gvm0g.js";import{nv as v}from"./chunk-vwqv8f0y.js";import{resolve as JJ,basename as WJ,extname as _J,join as LJ}from"path";import{mkdir as QJ}from"fs/promises";var ZJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0};class V{config;constructor(K={}){this.config={...ZJ,...K}}async get(K,J){return c(K,J,"video",this.config)}async set(K,J,X){return u(K,J,X,"video",this.config)}async clear(){return n("video",this.config)}updateConfig(K){this.config={...this.config,...K}}}var S=null;function D(K){if(!S)S=new V(K);else if(K)S.updateConfig(K);return S}async function q(K,J,X){let N=X?{directory:`${X.outputDir}/../.cache`}:{};return D(N).get(K,J)}async function b(K,J,X,N){let Z=N?{directory:`${N.outputDir}/../.cache`}:{};return D(Z).set(K,J,X)}async function $J(){return D().clear()}import{resolve as y,basename as P,extname as f,join as U}from"path";import{mkdir as g}from"fs/promises";async function m(){try{return await import("ts-videos")}catch{return null}}async function h(K,J,X,N){let Z=await m();if(!Z)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let $=y(K);if(!await B($))return null;await g(X,{recursive:!0});let Y=await x($),z=P(K,f(K)),G=J.format||"webp",M=J.timestamp||0,E=`${z}-poster-${Y}.${G}`,W=U(X,E),Q=await Z.extractThumbnails($,{timestamps:[M],width:J.width||1280,height:J.height,format:G,quality:J.quality||85,outputDir:X,outputPattern:E.replace(`.${G}`,"")});if(Q&&Q.length>0){let _=Q[0];return{path:W,url:`${N}/${E}`,width:_.width||J.width||1280,height:_.height||720,timestamp:M,size:_.size||0}}return null}catch($){return console.warn(`[stx-media] Failed to generate poster: ${$}`),null}}async function d(K,J,X,N){let Z=await m();if(!Z)return[];try{let $=y(K);if(!await B($))return[];await g(X,{recursive:!0});let Y=await x($),z=P(K,f(K)),G=J.format||"webp",W=(await new Z.Input($).getInfo()).duration||60,Q=J.count||10,_=J.interval||W/Q,O=[];for(let w=0;w<Q&&w*_<W;w++)O.push(w*_);let L=await Z.extractThumbnails($,{timestamps:O,width:J.width||320,format:G,quality:J.quality||80,outputDir:X,outputPattern:`${z}-thumb-${Y}`});if(L&&L.length>0)return L.map((w,j)=>({path:w.path||U(X,`${z}-thumb-${Y}-${j}.${G}`),url:`${N}/${z}-thumb-${Y}-${j}.${G}`,width:w.width||J.width||320,height:w.height||180,timestamp:O[j],size:w.size||0}));return[]}catch($){return console.warn(`[stx-media] Failed to generate thumbnails: ${$}`),[]}}async function zJ(K,J,X,N){let Z=await m();if(!Z)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let $=y(K);if(!await B($))return null;await g(X,{recursive:!0});let Y=await x($),z=P(K,f(K)),E=(await new Z.Input($).getInfo()).duration||60,W=J.columns||10,Q=J.interval||5,_=J.thumbnailWidth||160,O=J.thumbnailHeight||90,L=J.format||"jpeg",w=Math.ceil(E/Q),j=Math.ceil(w/W),F=`${z}-sprite-${Y}.${L}`,k=U(X,F),T=[];for(let I=0;I<w;I++)T.push(I*Q);let A=await Z.extractThumbnails($,{timestamps:T,width:_,height:O,format:L,quality:J.quality||70,outputDir:U(X,".temp")});if(!A||A.length===0)return null;try{let I=await import("ts-images"),H=W*_,kJ=j*O,jJ=await I.createSprite({images:A.map((YJ)=>YJ.path),columns:W,padding:0,outputPath:k,format:L,quality:J.quality||70});return{url:`${N}/${F}`,path:k,columns:W,rows:j,thumbnailWidth:_,thumbnailHeight:O,interval:Q,totalFrames:w}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch($){return console.warn(`[stx-media] Failed to generate sprite sheet: ${$}`),null}}import{resolve as r,basename as e,extname as i,join as C}from"path";import{mkdir as R,writeFile as o}from"fs/promises";async function t(){try{return await import("ts-videos")}catch{return null}}var s=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}];async function p(K,J,X,N,Z){let $=await t();if(!$)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Y=r(K);if(!await B(Y))return null;let z=await x(Y),G=e(K,i(K)),M=C(X,`${G}-${z}-hls`);await R(M,{recursive:!0});let E=J.length>0?J:s,W=Z?.segmentDuration||6,O=(await new $.Input(Y).getInfo()).duration||0,L=[],w=0;for(let k of E){let T=C(M,k.label);await R(T,{recursive:!0});let A=`${k.label}.m3u8`,I=C(T,A);try{let H=await $.generateHLS(Y,{outputDir:T,segmentDuration:W,width:k.width,height:k.height,videoBitrate:k.bitrate,audioBitrate:k.audioBitrate,playlistName:k.label});if(H)L.push({quality:k,url:`${N}/${G}-${z}-hls/${k.label}/${A}`,path:I}),w+=H.segmentCount||Math.ceil(O/W)}catch(H){console.warn(`[stx-media] Failed to generate HLS for ${k.label}: ${H}`)}}if(L.length===0)return null;let j=C(M,"master.m3u8"),F=GJ(L,N,G,z);return await o(j,F),{manifestUrl:`${N}/${G}-${z}-hls/master.m3u8`,manifestPath:j,playlists:L,segmentCount:w,duration:O}}catch(Y){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Y}`),null}}function GJ(K,J,X,N){let Z=["#EXTM3U","#EXT-X-VERSION:3"];for(let $ of K){let{quality:Y}=$,z=Y.bitrate+(Y.audioBitrate||128000),G=`${Y.width}x${Y.height||Math.round(Y.width*9/16)}`;Z.push(`#EXT-X-STREAM-INF:BANDWIDTH=${z},RESOLUTION=${G},NAME="${Y.label}"`,`${Y.label}/${Y.label}.m3u8`)}return Z.join(`
2
+ import{mh as x,rh as B,sh as c,th as u,uh as n}from"./chunk-6rzwef28.js";import{ov as v}from"./chunk-6bcw8twx.js";import{resolve as JJ,basename as WJ,extname as _J,join as LJ}from"path";import{mkdir as QJ}from"fs/promises";var ZJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0};class V{config;constructor(K={}){this.config={...ZJ,...K}}async get(K,J){return c(K,J,"video",this.config)}async set(K,J,X){return u(K,J,X,"video",this.config)}async clear(){return n("video",this.config)}updateConfig(K){this.config={...this.config,...K}}}var S=null;function D(K){if(!S)S=new V(K);else if(K)S.updateConfig(K);return S}async function q(K,J,X){let N=X?{directory:`${X.outputDir}/../.cache`}:{};return D(N).get(K,J)}async function b(K,J,X,N){let Z=N?{directory:`${N.outputDir}/../.cache`}:{};return D(Z).set(K,J,X)}async function $J(){return D().clear()}import{resolve as y,basename as P,extname as f,join as U}from"path";import{mkdir as g}from"fs/promises";async function m(){try{return await import("ts-videos")}catch{return null}}async function h(K,J,X,N){let Z=await m();if(!Z)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let $=y(K);if(!await B($))return null;await g(X,{recursive:!0});let Y=await x($),z=P(K,f(K)),G=J.format||"webp",M=J.timestamp||0,E=`${z}-poster-${Y}.${G}`,W=U(X,E),Q=await Z.extractThumbnails($,{timestamps:[M],width:J.width||1280,height:J.height,format:G,quality:J.quality||85,outputDir:X,outputPattern:E.replace(`.${G}`,"")});if(Q&&Q.length>0){let _=Q[0];return{path:W,url:`${N}/${E}`,width:_.width||J.width||1280,height:_.height||720,timestamp:M,size:_.size||0}}return null}catch($){return console.warn(`[stx-media] Failed to generate poster: ${$}`),null}}async function d(K,J,X,N){let Z=await m();if(!Z)return[];try{let $=y(K);if(!await B($))return[];await g(X,{recursive:!0});let Y=await x($),z=P(K,f(K)),G=J.format||"webp",W=(await new Z.Input($).getInfo()).duration||60,Q=J.count||10,_=J.interval||W/Q,O=[];for(let w=0;w<Q&&w*_<W;w++)O.push(w*_);let L=await Z.extractThumbnails($,{timestamps:O,width:J.width||320,format:G,quality:J.quality||80,outputDir:X,outputPattern:`${z}-thumb-${Y}`});if(L&&L.length>0)return L.map((w,j)=>({path:w.path||U(X,`${z}-thumb-${Y}-${j}.${G}`),url:`${N}/${z}-thumb-${Y}-${j}.${G}`,width:w.width||J.width||320,height:w.height||180,timestamp:O[j],size:w.size||0}));return[]}catch($){return console.warn(`[stx-media] Failed to generate thumbnails: ${$}`),[]}}async function zJ(K,J,X,N){let Z=await m();if(!Z)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let $=y(K);if(!await B($))return null;await g(X,{recursive:!0});let Y=await x($),z=P(K,f(K)),E=(await new Z.Input($).getInfo()).duration||60,W=J.columns||10,Q=J.interval||5,_=J.thumbnailWidth||160,O=J.thumbnailHeight||90,L=J.format||"jpeg",w=Math.ceil(E/Q),j=Math.ceil(w/W),F=`${z}-sprite-${Y}.${L}`,k=U(X,F),T=[];for(let I=0;I<w;I++)T.push(I*Q);let A=await Z.extractThumbnails($,{timestamps:T,width:_,height:O,format:L,quality:J.quality||70,outputDir:U(X,".temp")});if(!A||A.length===0)return null;try{let I=await import("ts-images"),H=W*_,kJ=j*O,jJ=await I.createSprite({images:A.map((YJ)=>YJ.path),columns:W,padding:0,outputPath:k,format:L,quality:J.quality||70});return{url:`${N}/${F}`,path:k,columns:W,rows:j,thumbnailWidth:_,thumbnailHeight:O,interval:Q,totalFrames:w}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch($){return console.warn(`[stx-media] Failed to generate sprite sheet: ${$}`),null}}import{resolve as r,basename as e,extname as i,join as C}from"path";import{mkdir as R,writeFile as o}from"fs/promises";async function t(){try{return await import("ts-videos")}catch{return null}}var s=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}];async function p(K,J,X,N,Z){let $=await t();if(!$)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Y=r(K);if(!await B(Y))return null;let z=await x(Y),G=e(K,i(K)),M=C(X,`${G}-${z}-hls`);await R(M,{recursive:!0});let E=J.length>0?J:s,W=Z?.segmentDuration||6,O=(await new $.Input(Y).getInfo()).duration||0,L=[],w=0;for(let k of E){let T=C(M,k.label);await R(T,{recursive:!0});let A=`${k.label}.m3u8`,I=C(T,A);try{let H=await $.generateHLS(Y,{outputDir:T,segmentDuration:W,width:k.width,height:k.height,videoBitrate:k.bitrate,audioBitrate:k.audioBitrate,playlistName:k.label});if(H)L.push({quality:k,url:`${N}/${G}-${z}-hls/${k.label}/${A}`,path:I}),w+=H.segmentCount||Math.ceil(O/W)}catch(H){console.warn(`[stx-media] Failed to generate HLS for ${k.label}: ${H}`)}}if(L.length===0)return null;let j=C(M,"master.m3u8"),F=GJ(L,N,G,z);return await o(j,F),{manifestUrl:`${N}/${G}-${z}-hls/master.m3u8`,manifestPath:j,playlists:L,segmentCount:w,duration:O}}catch(Y){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Y}`),null}}function GJ(K,J,X,N){let Z=["#EXTM3U","#EXT-X-VERSION:3"];for(let $ of K){let{quality:Y}=$,z=Y.bitrate+(Y.audioBitrate||128000),G=`${Y.width}x${Y.height||Math.round(Y.width*9/16)}`;Z.push(`#EXT-X-STREAM-INF:BANDWIDTH=${z},RESOLUTION=${G},NAME="${Y.label}"`,`${Y.label}/${Y.label}.m3u8`)}return Z.join(`
3
3
  `)}async function l(K,J,X,N,Z){let $=await t();if(!$)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Y=r(K);if(!await B(Y))return null;let z=await x(Y),G=e(K,i(K)),M=C(X,`${G}-${z}-dash`);await R(M,{recursive:!0});let E=J.length>0?J:s,W=Z?.segmentDuration||4,Q=Z?.minBufferTime||2,L=(await new $.Input(Y).getInfo()).duration||0,w=[],j=[];for(let A of E){let I=C(M,A.label);await R(I,{recursive:!0});try{if(await $.generateDASH(Y,{outputDir:I,segmentDuration:W,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(w.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${N}/${G}-${z}-dash/${A.label}/video`}),A.audioBitrate)j.push({bandwidth:A.audioBitrate,url:`${N}/${G}-${z}-dash/${A.label}/audio`})}}catch(H){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${H}`)}}if(w.length===0)return null;let F=C(M,"manifest.mpd"),k=NJ(w,j,L,W,Q);await o(F,k);let T=[{type:"video",representations:w}];if(j.length>0)T.push({type:"audio",representations:j});return{manifestUrl:`${N}/${G}-${z}-dash/manifest.mpd`,manifestPath:F,adaptationSets:T,duration:L}}catch(Y){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Y}`),null}}function NJ(K,J,X,N,Z){let $=a(X),Y=a(Z),z=`<?xml version="1.0" encoding="UTF-8"?>
4
4
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
5
5
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -26,4 +26,4 @@ import{lh as x,qh as B,rh as c,sh as u,th as n}from"./chunk-k78gvm0g.js";import{
26
26
  </Representation>
27
27
  `}z+=` </AdaptationSet>
28
28
  `}return z+=` </Period>
29
- </MPD>`,z}function a(K){let J=Math.floor(K/3600),X=Math.floor(K%3600/60),N=Math.floor(K%60),Z="PT";if(J>0)Z+=`${J}H`;if(X>0)Z+=`${X}M`;return Z+=`${N}S`,Z}async function KJ(){try{return await import("ts-videos")}catch{return null}}function MJ(K){switch(K){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function OJ(K){switch(K){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function XJ(K){let J=await KJ();if(!J)return null;try{let X=JJ(K),Z=await new J.Input(X).getInfo();return{duration:Z.duration||0,width:Z.width||0,height:Z.height||0,frameRate:Z.frameRate||0,bitrate:Z.bitrate||0,codec:Z.videoCodec||"",audioCodec:Z.audioCodec}}catch(X){return console.warn(`[stx-media] Failed to analyze video: ${X}`),null}}async function wJ(K,J,X,N){let Z=await KJ();if(!Z)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:K,processed:!1};let $=await q(K,J,X);if($)return $;try{let Y=JJ(K);if(!await B(Y))return{src:K,processed:!1,errors:[`Source file not found: ${K}`]};let z=X.outputDir||"dist/videos",G=X.baseUrl||"/videos";await QJ(z,{recursive:!0});let M=await x(Y),E=WJ(K,_J(K)),W={src:K,processed:!0,hash:M};N?.({percentage:5,stage:"analyzing"}),W.metadata=await XJ(Y)||void 0;let Q={};if(J.quality)Q.bitrate=MJ(J.quality);if(J.platform)Object.assign(Q,OJ(J.platform));if(J.transcode)Object.assign(Q,J.transcode);if(Object.keys(Q).length>0||J.process){N?.({percentage:10,stage:"transcoding"});let _=`${E}-${M}.mp4`,O=LJ(z,_);try{let L=await AJ(Y,O,Q,Z,(w)=>N?.({percentage:10+w*0.5,stage:"transcoding"}));if(L)W.transcoded={path:O,url:`${G}/${_}`,duration:L.duration,size:L.size,video:{codec:Q.codec||"h264",width:L.width,height:L.height,bitrate:L.bitrate,frameRate:L.frameRate},audio:L.audioCodec?{codec:Q.audioCodec||"aac",bitrate:Q.audioBitrate||128000,sampleRate:Q.sampleRate||48000,channels:Q.channels||2}:void 0}}catch(L){W.errors=W.errors||[],W.errors.push(`Transcoding failed: ${L}`)}}if(J.generatePoster){N?.({percentage:65,stage:"generating-poster"});let _=typeof J.generatePoster==="object"?J.generatePoster:{timestamp:0},O=await h(Y,_,z,G);if(O)W.poster=O}if(X.thumbnails?.enabled){N?.({percentage:70,stage:"generating-thumbnails"});let _=await d(Y,X.thumbnails,z,G);if(_.length>0)W.thumbnails=_}if(J.streaming){N?.({percentage:80,stage:"generating-manifests"});let _=typeof J.streaming==="object"?J.streaming:X.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let O=await p(Y,_.qualities||X.streaming?.defaultQualities||[],z,G);if(O)W.streaming={...W.streaming,hls:O}}if(_.format==="dash"){let O=await l(Y,_.qualities||X.streaming?.defaultQualities||[],z,G);if(O)W.streaming={...W.streaming,dash:O}}}if(J.spriteSheet)N?.({percentage:90,stage:"generating-sprite-sheet"});return N?.({percentage:100,stage:"complete"}),await b(K,J,W,X),W}catch(Y){return{src:K,processed:!1,errors:[`Processing failed: ${Y}`]}}}async function AJ(K,J,X,N,Z){try{let Y=await new N.Conversion(K,J,{videoCodec:X.codec,videoBitrate:X.bitrate,width:X.maxWidth,height:X.maxHeight,frameRate:X.frameRate,audioCodec:X.audioCodec,audioBitrate:X.audioBitrate,sampleRate:X.sampleRate,channels:X.channels}).run((z)=>{Z?.(z.percentage/100)});return{duration:Y.duration||0,size:Y.size||0,width:Y.width||X.maxWidth||0,height:Y.height||X.maxHeight||0,bitrate:Y.bitrate||X.bitrate||0,frameRate:Y.frameRate||X.frameRate||30,audioCodec:Y.audioCodec}}catch($){return console.error(`[stx-media] Transcoding failed: ${$}`),null}}export{V as ah,q as bh,b as ch,$J as dh,h as eh,d as fh,zJ as gh,p as hh,l as ih,XJ as jh,wJ as kh};
29
+ </MPD>`,z}function a(K){let J=Math.floor(K/3600),X=Math.floor(K%3600/60),N=Math.floor(K%60),Z="PT";if(J>0)Z+=`${J}H`;if(X>0)Z+=`${X}M`;return Z+=`${N}S`,Z}async function KJ(){try{return await import("ts-videos")}catch{return null}}function MJ(K){switch(K){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function OJ(K){switch(K){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function XJ(K){let J=await KJ();if(!J)return null;try{let X=JJ(K),Z=await new J.Input(X).getInfo();return{duration:Z.duration||0,width:Z.width||0,height:Z.height||0,frameRate:Z.frameRate||0,bitrate:Z.bitrate||0,codec:Z.videoCodec||"",audioCodec:Z.audioCodec}}catch(X){return console.warn(`[stx-media] Failed to analyze video: ${X}`),null}}async function wJ(K,J,X,N){let Z=await KJ();if(!Z)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:K,processed:!1};let $=await q(K,J,X);if($)return $;try{let Y=JJ(K);if(!await B(Y))return{src:K,processed:!1,errors:[`Source file not found: ${K}`]};let z=X.outputDir||"dist/videos",G=X.baseUrl||"/videos";await QJ(z,{recursive:!0});let M=await x(Y),E=WJ(K,_J(K)),W={src:K,processed:!0,hash:M};N?.({percentage:5,stage:"analyzing"}),W.metadata=await XJ(Y)||void 0;let Q={};if(J.quality)Q.bitrate=MJ(J.quality);if(J.platform)Object.assign(Q,OJ(J.platform));if(J.transcode)Object.assign(Q,J.transcode);if(Object.keys(Q).length>0||J.process){N?.({percentage:10,stage:"transcoding"});let _=`${E}-${M}.mp4`,O=LJ(z,_);try{let L=await AJ(Y,O,Q,Z,(w)=>N?.({percentage:10+w*0.5,stage:"transcoding"}));if(L)W.transcoded={path:O,url:`${G}/${_}`,duration:L.duration,size:L.size,video:{codec:Q.codec||"h264",width:L.width,height:L.height,bitrate:L.bitrate,frameRate:L.frameRate},audio:L.audioCodec?{codec:Q.audioCodec||"aac",bitrate:Q.audioBitrate||128000,sampleRate:Q.sampleRate||48000,channels:Q.channels||2}:void 0}}catch(L){W.errors=W.errors||[],W.errors.push(`Transcoding failed: ${L}`)}}if(J.generatePoster){N?.({percentage:65,stage:"generating-poster"});let _=typeof J.generatePoster==="object"?J.generatePoster:{timestamp:0},O=await h(Y,_,z,G);if(O)W.poster=O}if(X.thumbnails?.enabled){N?.({percentage:70,stage:"generating-thumbnails"});let _=await d(Y,X.thumbnails,z,G);if(_.length>0)W.thumbnails=_}if(J.streaming){N?.({percentage:80,stage:"generating-manifests"});let _=typeof J.streaming==="object"?J.streaming:X.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let O=await p(Y,_.qualities||X.streaming?.defaultQualities||[],z,G);if(O)W.streaming={...W.streaming,hls:O}}if(_.format==="dash"){let O=await l(Y,_.qualities||X.streaming?.defaultQualities||[],z,G);if(O)W.streaming={...W.streaming,dash:O}}}if(J.spriteSheet)N?.({percentage:90,stage:"generating-sprite-sheet"});return N?.({percentage:100,stage:"complete"}),await b(K,J,W,X),W}catch(Y){return{src:K,processed:!1,errors:[`Processing failed: ${Y}`]}}}async function AJ(K,J,X,N,Z){try{let Y=await new N.Conversion(K,J,{videoCodec:X.codec,videoBitrate:X.bitrate,width:X.maxWidth,height:X.maxHeight,frameRate:X.frameRate,audioCodec:X.audioCodec,audioBitrate:X.audioBitrate,sampleRate:X.sampleRate,channels:X.channels}).run((z)=>{Z?.(z.percentage/100)});return{duration:Y.duration||0,size:Y.size||0,width:Y.width||X.maxWidth||0,height:Y.height||X.maxHeight||0,bitrate:Y.bitrate||X.bitrate||0,frameRate:Y.frameRate||X.frameRate||30,audioCodec:Y.audioCodec}}catch($){return console.error(`[stx-media] Transcoding failed: ${$}`),null}}export{V as bh,q as ch,b as dh,$J as eh,h as fh,d as gh,zJ as hh,p as ih,l as jh,XJ as kh,wJ as lh};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{uk as m}from"./chunk-b6xqp9s4.js";import{nv as z}from"./chunk-vwqv8f0y.js";import{existsSync as s,mkdirSync as T,copyFileSync as F,chmodSync as A}from"fs";import{join as Z,basename as Yq}from"path";import{spawn as j,execSync as Zq}from"child_process";import{tmpdir as c,homedir as P,platform as Lq}from"os";var Iq=`
2
+ import{vk as m}from"./chunk-ejvftzg7.js";import{ov as z}from"./chunk-6bcw8twx.js";import{existsSync as s,mkdirSync as T,copyFileSync as F,chmodSync as A}from"fs";import{join as Z,basename as Yq}from"path";import{spawn as j,execSync as Zq}from"child_process";import{tmpdir as c,homedir as P,platform as Lq}from"os";var Iq=`
3
3
  <script>
4
4
  (function() {
5
5
  'use strict';
@@ -3019,4 +3019,4 @@ Terminal=false
3019
3019
  Categories=Utility;
3020
3020
  Icon=${$.toLowerCase()}
3021
3021
  `;z("fs").writeFileSync(Z(Y,`${$.toLowerCase()}.desktop`),_);let E=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(z("fs").writeFileSync(Z(Y,`${$.toLowerCase()}.png`),E),J.icon&&s(J.icon))F(J.icon,Z(Y,`${$.toLowerCase()}.png`));let H=j("appimagetool",[Y,U],{env:{...process.env,ARCH:"x86_64"}});H.on("close",(x)=>{if(z("fs").rmSync(K,{recursive:!0,force:!0}),x===0)A(U,493),W({success:!0});else W({success:!1,error:`appimagetool exited with code ${x}. Install from https://appimage.github.io/appimagetool/`})}),H.on("error",(x)=>{z("fs").rmSync(K,{recursive:!0,force:!0}),W({success:!1,error:`appimagetool not found: ${x.message}`})})}catch(K){W({success:!1,error:K.message})}})}function Vq(){return[I()]}function Fq(q){switch(q){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 Aq={buildNative:Qq,getAvailableTargets:Vq,getAvailableFormats:Fq,detectPlatform:I},cq=Aq;
3022
- export{Iq as _j,D as $j,Cq as ak,yq as bk,N as ck,b as dk,h as ek,bq as fk,u as gk,Pq as hk,vq as ik,Qq as jk,Vq as kk,Fq as lk,cq as mk};
3022
+ export{Iq as $j,D as ak,Cq as bk,yq as ck,N as dk,b as ek,h as fk,bq as gk,u as hk,Pq as ik,vq as jk,Qq as kk,Vq as lk,Fq as mk,cq as nk};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{bj as O,cj as w,dj as Z}from"./chunk-efr3ejqt.js";import{al as R,hl as U,nl as T}from"./chunk-ns50qry3.js";import{Sp as k,Ul as M,hr as C,so as W}from"./chunk-d93d47k0.js";import{Yt as E,Zt as L}from"./chunk-nqwjb8k7.js";import{bu as B}from"./chunk-6kdb8j9d.js";import $ from"path";var Y=new Map;function b(Q,z){for(let J of Q.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(J[1])z.add(J[1]);for(let J of Q.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let H of(J[1]??"").split(",")){let K=((H.includes(":")?H.split(":").pop():H)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(K))z.add(K)}for(let J of Q.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let H of(J[1]??"").split(",")){let V=H.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(V))z.add(V)}}async function l(Q){let z;if(Q)z=$.resolve(Q);else{let q=await C();z=$.resolve(q.root||process.cwd(),q.storesDir||"stores")}let J=new Bun.Glob("*.ts"),H=[];try{for await(let q of J.scan({cwd:z,absolute:!0})){let y=$.basename(q,".ts");if(["index","types"].includes(y))continue;if(q.includes(".d.ts"))continue;H.push(q)}}catch{return Z(Y,z,"",""),null}let V=()=>[...new Set([...H,...H.flatMap((q)=>R(q))])],K=O(V()),P=w(Y,z,K);if(P!==void 0)return P||null;if(H.length===0)return Z(Y,z,K,""),null;let A=[];for(let q of H){let y=await Bun.file(q).text();A.push({file:q,hasUseStore:/useStore\s*\(/.test(y)})}A.sort((q,y)=>{if(q.hasUseStore===y.hasUseStore)return 0;return q.hasUseStore?1:-1});let N=A.map((q)=>q.file),G=[],X=new Set,F=k({loader:"ts",target:"browser",define:M()});for(let q of N)try{let y=await Bun.file(q).text(),I=$.basename(q,".ts");if(b(y,X),U(y))y=await T(y,q,{projectRoot:process.cwd(),externalizeUserModules:!1});y=W(y),y=E(y),y=L(y),y=y.replace(/^export\s+(default\s+)?/gm,""),y=F.transformSync(y),G.push(`// Store: ${I}
2
+ import{cj as O,dj as w,ej as Z}from"./chunk-91007tan.js";import{bl as R,il as U,ol as T}from"./chunk-wd9fww03.js";import{Tp as k,Vl as M,ir as C,to as W}from"./chunk-a5gkg0a5.js";import{Zt as E,_t as L}from"./chunk-00mag1n0.js";import{cu as B}from"./chunk-ze3qgdaf.js";import $ from"path";var Y=new Map;function b(Q,z){for(let J of Q.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(J[1])z.add(J[1]);for(let J of Q.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let H of(J[1]??"").split(",")){let K=((H.includes(":")?H.split(":").pop():H)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(K))z.add(K)}for(let J of Q.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let H of(J[1]??"").split(",")){let V=H.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(V))z.add(V)}}async function l(Q){let z;if(Q)z=$.resolve(Q);else{let q=await C();z=$.resolve(q.root||process.cwd(),q.storesDir||"stores")}let J=new Bun.Glob("*.ts"),H=[];try{for await(let q of J.scan({cwd:z,absolute:!0})){let y=$.basename(q,".ts");if(["index","types"].includes(y))continue;if(q.includes(".d.ts"))continue;H.push(q)}}catch{return Z(Y,z,"",""),null}let V=()=>[...new Set([...H,...H.flatMap((q)=>R(q))])],K=O(V()),P=w(Y,z,K);if(P!==void 0)return P||null;if(H.length===0)return Z(Y,z,K,""),null;let A=[];for(let q of H){let y=await Bun.file(q).text();A.push({file:q,hasUseStore:/useStore\s*\(/.test(y)})}A.sort((q,y)=>{if(q.hasUseStore===y.hasUseStore)return 0;return q.hasUseStore?1:-1});let N=A.map((q)=>q.file),G=[],X=new Set,F=k({loader:"ts",target:"browser",define:M()});for(let q of N)try{let y=await Bun.file(q).text(),I=$.basename(q,".ts");if(b(y,X),U(y))y=await T(y,q,{projectRoot:process.cwd(),externalizeUserModules:!1});y=W(y),y=E(y),y=L(y),y=y.replace(/^export\s+(default\s+)?/gm,""),y=F.transformSync(y),G.push(`// Store: ${I}
3
3
  ${y.trim()}`)}catch(y){console.warn(`[stx] Failed to load store ${q}:`,y)}if(G.length===0)return Z(Y,z,K,""),null;let j=G.join(`
4
4
 
5
5
  `),x=`;(function(){
@@ -8,4 +8,4 @@ ${B.filter((q)=>!X.has(q)&&new RegExp(`\\b${q}\\b`).test(j)).map((q)=>`var ${q}
8
8
  `)}
9
9
  ${j}
10
10
  })();`;return K=O(V()),Z(Y,z,K,x),x}function a(){Y.clear()}
11
- export{l as Yi,a as Zi};
11
+ export{l as Zi,a as _i};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  import{Broadcast as D,BroadcastServer as U}from"ts-broadcasting";import{channel as b}from"ts-broadcasting";import{Broadcast as N,BroadcastServer as p}from"ts-broadcasting";var z=null,H=[];function X(){return z}async function Y(j){if(z)return z;let k=j.driver??"bun",q=j.host??"0.0.0.0",G=j.port??6001,J=j.scheme??"ws",E={verbose:j.verbose??!1,driver:k,default:k,connections:{[k]:{driver:k,host:q,port:G,scheme:J}}};return z=new U(E),D.setServer(z),await z.start(),z}async function Z(){for(let j of H)clearInterval(j);if(H.length=0,!z)return;await z.stop(),z=null}async function $(j){let k=await import(j),q=k.default??k;if(typeof q!=="function")throw Error(`routes/channels.ts must export a default function, got ${typeof q}`);let G=0;return q({channel(E,A){if(G++,A.authorize&&z)z.channels.channel(E,A.authorize);if(A.interval&&A.data){let L=A.event??`${E}.updated`,M=A.data,Q=setInterval(async()=>{try{let T=await M();V(E,L,T)}catch{}},A.interval);H.push(Q)}}}),G}var K=!1;function F(){if(z)return!0;if(!K)K=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function V(j,k,q){if(!F())return;D.send(j,k,q)}function x(j,k,q){if(!F())return;D.toUser(j,k,q)}function C(j,k,q){if(!F())return;D.toUsers(j,k,q)}function S(j,k,q){if(!F())return;D.send(`private-${j}`,k,q)}function w(j,k,q){if(!F())return;D.presence(j,k,q)}
3
- export{X as yg,Y as zg,Z as Ag,$ as Bg,V as Cg,x as Dg,C as Eg,S as Fg,w as Gg,b as Hg,N as Ig,p as Jg};
3
+ export{X as zg,Y as Ag,Z as Bg,$ as Cg,V as Dg,x as Eg,C as Fg,S as Gg,w as Hg,b as Ig,N as Jg,p as Kg};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  function D(j){return j}class F{plugins=new Map;sortedPlugins=[];initialized=!1;async register(j,q){if(this.plugins.has(j.name))throw Error(`Plugin "${j.name}" is already registered`);if(j.dependencies){for(let w of j.dependencies)if(!this.plugins.has(w))throw Error(`Plugin "${j.name}" depends on "${w}" which is not registered`)}if(this.plugins.set(j.name,j),j.onRegister)await j.onRegister(q);this.sortPlugins()}async unregister(j){let q=this.plugins.get(j);if(!q)return!1;for(let[w,z]of this.plugins)if(z.dependencies?.includes(j))throw Error(`Cannot unregister "${j}" because "${w}" depends on it`);if(q.onUnregister)await q.onUnregister();return this.plugins.delete(j),this.sortPlugins(),!0}get(j){return this.plugins.get(j)}has(j){return this.plugins.has(j)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let j=[];for(let q of this.sortedPlugins)if(q.registerDirectives)j.push(...q.registerDirectives());return j}getAllFilters(){let j={};for(let q of this.sortedPlugins)if(q.registerFilters)Object.assign(j,q.registerFilters());return j}async runBeforeProcess(j){return this.runHooks("beforeProcess",j)}async runAfterParse(j){return this.runHooks("afterParse",j)}async runBeforeDirective(j,q){return this.runDirectiveHooks("beforeDirective",j,q)}async runAfterDirective(j,q){return this.runDirectiveHooks("afterDirective",j,q)}async runBeforeRender(j){return this.runHooks("beforeRender",j)}async runAfterRender(j){return this.runHooks("afterRender",j)}async runOnError(j){for(let q of this.sortedPlugins)if(q.onError)try{let w=await q.onError(j);if(w){if(w.template!==void 0)j.template=w.template;if(w.context)j.context={...j.context,...w.context};if(w.metadata)j.metadata={...j.metadata,...w.metadata};if(w.skip)return j}}catch(w){console.error(`Error in plugin "${q.name}" onError hook:`,w)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((j,q)=>(j.priority??100)-(q.priority??100))}async runHooks(j,q){let w={...q};for(let z of this.sortedPlugins){let B=z[j];if(B)try{let y=await B(w);if(y){if(y.template!==void 0)w.template=y.template;if(y.context)w.context={...w.context,...y.context};if(y.metadata)w.metadata={...w.metadata,...y.metadata};if(y.skip)break}}catch(y){console.error(`Error in plugin "${z.name}" ${j} hook:`,y)}}return w}async runDirectiveHooks(j,q,w){let z={...w};for(let B of this.sortedPlugins){let y=B[j];if(y)try{let A=await y(q,z);if(A){if(A.template!==void 0)z.template=A.template;if(A.context)z.context={...z.context,...A.context};if(A.metadata)z.metadata={...z.metadata,...A.metadata};if(A.skip)break}}catch(A){console.error(`Error in plugin "${B.name}" ${j} hook:`,A)}}return z}}var G=new F;function H(j,q,w={}){return{name:j,...w,registerDirectives:()=>q}}function I(j,q,w={}){return{name:j,...w,registerFilters:()=>q}}var J=D({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(j){console.log("[stx-debug] beforeProcess:",j.filePath)},afterParse(j){console.log("[stx-debug] afterParse:",j.template.length,"chars")},beforeDirective(j,q){console.log("[stx-debug] beforeDirective:",j)},afterDirective(j,q){console.log("[stx-debug] afterDirective:",j)},beforeRender(j){console.log("[stx-debug] beforeRender")},afterRender(j){console.log("[stx-debug] afterRender:",j.template.length,"chars")},onError(j){console.error("[stx-debug] onError:",j.error.message,"in phase:",j.phase)}}),K=D({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(j){j.metadata.startTime=performance.now()},afterRender(j){let q=j.metadata.startTime;if(q){let w=performance.now()-q;console.log(`[stx-timing] Processing took ${w.toFixed(2)}ms`)}}});function L(j){return D({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(q){return{context:{...q.context,...j}}}})}
3
- export{D as wh,F as xh,G as yh,H as zh,I as Ah,J as Bh,K as Ch,L as Dh};
3
+ export{D as xh,F as yh,G as zh,H as Ah,I as Bh,J as Ch,K as Dh,L as Eh};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Eo as a,Fo as b}from"./chunk-a5gkg0a5.js";import"./chunk-6xbscz34.js";import"./chunk-bkbr9yz2.js";import"./chunk-nn4k6hvv.js";import"./chunk-1zyqv8p8.js";import"./chunk-1zvyq6jj.js";import"./chunk-4bct6m06.js";import"./chunk-v4vvm7mz.js";import"./chunk-s710wybv.js";import"./chunk-00mag1n0.js";import"./chunk-d3r5pdz7.js";import"./chunk-ze3qgdaf.js";import"./chunk-54fnvfp1.js";import"./chunk-42b81qv3.js";import"./chunk-6bcw8twx.js";export{b as processLoops,a as parseLoopBinding};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  var{defineProperty:e,getOwnPropertyNames:g,getOwnPropertyDescriptor:h}=Object,i=Object.prototype.hasOwnProperty;function j(a){return this[a]}var m=(a)=>{var b=(f??=new WeakMap).get(a),c;if(b)return b;if(b=e({},"__esModule",{value:!0}),a&&typeof a==="object"||typeof a==="function"){for(var d of g(a))if(!i.call(b,d))e(b,d,{get:j.bind(a,d),enumerable:!(c=h(a,d))||c.enumerable})}return f.set(a,b),b},f;var k=(a)=>a;function l(a,b){this[a]=k.bind(null,b)}var n=(a,b)=>{for(var c in b)e(a,c,{get:b[c],enumerable:!0,configurable:!0,set:l.bind(b,c)})};var o=(a,b)=>()=>(a&&(b=a(a=0)),b);var p=import.meta.require;
3
- export{m as kv,n as lv,o as mv,p as nv};
3
+ export{m as lv,n as mv,o as nv,p as ov};
@@ -355,4 +355,4 @@ catch (error) {
355
355
  console.log('[stx] Async component runtime initialized');
356
356
  })();
357
357
  `}
358
- export{X as Fi,Y as Gi,Z as Hi,_ as Ii,$ as Ji};
358
+ export{X as Gi,Y as Hi,Z as Ii,_ as Ji,$ as Ki};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  import{createHash as Y}from"crypto";import{readFile as M,stat as w}from"fs/promises";async function G(q){try{let z=await M(q);return Y("sha256").update(z).digest("hex").slice(0,16)}catch{return""}}function u(q){return Y("sha256").update(q).digest("hex").slice(0,16)}function $(q){return Y("sha256").update(q).digest("hex").slice(0,16)}function X(q,z){let B=JSON.stringify(z,Object.keys(z).sort());return`${$(q)}-${$(B)}`}async function Z(q){try{return(await w(q)).mtimeMs}catch{return 0}}async function b(q){try{return await w(q),!0}catch{return!1}}import{mkdir as S,readFile as V,writeFile as E,readdir as A,rm as _,stat as j}from"fs/promises";import{join as U,dirname as x}from"path";var R=new Map,W={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500};async function F(q){try{await S(q,{recursive:!0})}catch{}}function K(q,z,B){return U(q,B,`${z}.json`)}async function v(q,z,B){if((Date.now()-q.createdAt)/86400000>B)return!1;if(await Z(z)!==q.srcMtime)return!1;return!0}async function g(q,z,B,J=W){if(!J.enabled)return null;let I=X(q,z),L=R.get(I);if(L){if(await v(L,q,J.maxAge))return L.lastAccessedAt=Date.now(),L.data;R.delete(I)}let Q=K(J.directory,I,B);if(await b(Q))try{let N=await V(Q,"utf-8"),O=JSON.parse(N);if(await v(O,q,J.maxAge))return O.lastAccessedAt=Date.now(),R.set(I,O),O.data}catch{}return null}async function l(q,z,B,J,I=W){if(!I.enabled)return;let L=X(q,z),Q=await G(q),N=await Z(q),O={key:L,src:q,srcHash:Q,srcMtime:N,optionsHash:X("",z),data:B,createdAt:Date.now(),lastAccessedAt:Date.now()};R.set(L,O);let T=K(I.directory,L,J);try{await F(x(T)),await E(T,JSON.stringify(O,null,2))}catch(H){console.warn(`[stx-media] Failed to write cache: ${H}`)}}async function m(q,z=W){if(q==="all")R.clear();else R.clear();let B=q==="all"?["image","video"]:[q];for(let J of B){let I=U(z.directory,J);try{await _(I,{recursive:!0,force:!0})}catch{}}}async function y(q=W){let z={memoryEntries:R.size,diskEntries:{image:0,video:0},totalSizeMB:0};for(let B of["image","video"]){let J=U(q.directory,B);try{let I=await A(J);z.diskEntries[B]=I.length;for(let L of I){let Q=U(J,L),N=await j(Q);z.totalSizeMB+=N.size/1048576}}catch{}}return z}async function f(q=W){let z=0,B=q.maxAge*24*60*60*1000;for(let J of["image","video"]){let I=U(q.directory,J);try{let L=await A(I);for(let Q of L){let N=U(I,Q);try{let O=await V(N,"utf-8"),T=JSON.parse(O);if(Date.now()-T.createdAt>B)await _(N),R.delete(T.key),z++}catch{await _(N).catch(()=>{}),z++}}}catch{}}return z}
3
- export{G as lh,u as mh,$ as nh,X as oh,Z as ph,b as qh,g as rh,l as sh,m as th,y as uh,f as vh};
3
+ export{G as mh,u as nh,$ as oh,X as ph,Z as qh,b as rh,g as sh,l as th,m as uh,y as vh,f as wh};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Sp as M,Ul as x}from"./chunk-d93d47k0.js";import"./chunk-3mbkn6vk.js";import"./chunk-dn8006f7.js";import"./chunk-vg8yh8te.js";import"./chunk-c5rehxqy.js";import"./chunk-xtwybxtw.js";import{it as B,kt as P}from"./chunk-ama74dgk.js";import"./chunk-kgxkrnyt.js";import"./chunk-3npkbgfm.js";import"./chunk-nqwjb8k7.js";import"./chunk-nx96x8sh.js";import"./chunk-6kdb8j9d.js";import"./chunk-jmh31a2a.js";import"./chunk-d3kac3mv.js";import"./chunk-vwqv8f0y.js";import G from"path";var T=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],O=new Set(T);var K=new Map,U=B(64),V=new Set,D=0,N=new Set(T);function f(){K.clear(),U.clear()}function S(H){let J=new Map;for(let Q of H){let Z=G.basename(Q);if(Z.endsWith(".d.ts"))continue;let z=Z.replace(/\.[jt]s$/,"");if(z==="index")continue;if(z===Z)continue;let X=J.get(z);if(X&&!X.endsWith(".js"))continue;J.set(z,Q)}return[...J.values()].sort()}function g(H,J){let Q=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Q}\\b`).test(H)}function y(H){if(!H)return[];let J=P(H,D),Q=U.get(J);if(Q)return Q.slice();let Z=H.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),z=[];for(let X of N){if(V.has(X))continue;let A=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${A}\\s*\\(`).test(Z))z.push(X)}return z.sort(),U.set(J,z),z.slice()}async function p(H,J){let Q=y(H);if(Q.length===0)return null;let Z=J??G.join(import.meta.dir,"composables"),z=`${Z}\x00${Q.join(",")}`,X=K.get(z);if(X!==void 0)return X||null;let A=M({loader:"ts",target:"browser",define:x()}),L=new Set(Q),W=[],C=new Set,F=[];try{let q=new Bun.Glob("*.{ts,js}");for await(let j of q.scan({cwd:Z,absolute:!0}))F.push(j)}catch{return K.set(z,""),null}F=S(F);for(let q of F){let j;try{j=await Bun.file(q).text()}catch{continue}let I=[];try{I=A.scan(j).exports.filter(($)=>$!=="default")}catch{continue}if(!I.some(($)=>L.has($)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${G.basename(q).replace(/\.[jt]s$/,"")}
2
+ import{Tp as M,Vl as x}from"./chunk-a5gkg0a5.js";import"./chunk-6xbscz34.js";import"./chunk-bkbr9yz2.js";import"./chunk-nn4k6hvv.js";import"./chunk-1zyqv8p8.js";import"./chunk-1zvyq6jj.js";import{jt as B,lt as P}from"./chunk-4bct6m06.js";import"./chunk-v4vvm7mz.js";import"./chunk-s710wybv.js";import"./chunk-00mag1n0.js";import"./chunk-d3r5pdz7.js";import"./chunk-ze3qgdaf.js";import"./chunk-54fnvfp1.js";import"./chunk-42b81qv3.js";import"./chunk-6bcw8twx.js";import G from"path";var T=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],O=new Set(T);var K=new Map,U=B(64),V=new Set,D=0,N=new Set(T);function f(){K.clear(),U.clear()}function S(H){let J=new Map;for(let Q of H){let Z=G.basename(Q);if(Z.endsWith(".d.ts"))continue;let z=Z.replace(/\.[jt]s$/,"");if(z==="index")continue;if(z===Z)continue;let X=J.get(z);if(X&&!X.endsWith(".js"))continue;J.set(z,Q)}return[...J.values()].sort()}function g(H,J){let Q=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Q}\\b`).test(H)}function y(H){if(!H)return[];let J=P(H,D),Q=U.get(J);if(Q)return Q.slice();let Z=H.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),z=[];for(let X of N){if(V.has(X))continue;let A=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${A}\\s*\\(`).test(Z))z.push(X)}return z.sort(),U.set(J,z),z.slice()}async function p(H,J){let Q=y(H);if(Q.length===0)return null;let Z=J??G.join(import.meta.dir,"composables"),z=`${Z}\x00${Q.join(",")}`,X=K.get(z);if(X!==void 0)return X||null;let A=M({loader:"ts",target:"browser",define:x()}),L=new Set(Q),W=[],C=new Set,F=[];try{let q=new Bun.Glob("*.{ts,js}");for await(let j of q.scan({cwd:Z,absolute:!0}))F.push(j)}catch{return K.set(z,""),null}F=S(F);for(let q of F){let j;try{j=await Bun.file(q).text()}catch{continue}let I=[];try{I=A.scan(j).exports.filter(($)=>$!=="default")}catch{continue}if(!I.some(($)=>L.has($)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${G.basename(q).replace(/\.[jt]s$/,"")}
3
3
  ${A.transformSync(j).trim()}`);for(let $ of I)C.add($)}catch($){console.warn(`[stx] framework composable ${G.basename(q)} could not be bundled:`,$)}}let Y=Q.filter((q)=>!C.has(q)&&!g(H,q));if(Y.length>0)console.warn(`[stx] could not bundle ${Y.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(W.length===0)return K.set(z,""),null;let k=[...C].map((q)=>` try { if (!(${JSON.stringify(q)} in __s)) { __s[${JSON.stringify(q)}] = ${q}; if (!(${JSON.stringify(q)} in window)) window[${JSON.stringify(q)}] = ${q}; } } catch (e) {}`).join(`
4
4
  `),w=`<script data-stx-framework-composables>
5
5
  ;(function(){
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Lg as a,Mg as b}from"./chunk-mzbnczgk.js";import"./chunk-x14vvxfh.js";import"./chunk-6bcw8twx.js";export{a as handleImageRequest,b as createImageHandler};
@@ -68,4 +68,4 @@ var J=0;function O(){return`stx-teleport-${++J}`}function P(k){let j=k.split(","
68
68
  })();
69
69
  </script>
70
70
  `}
71
- export{U as si,V as ti};
71
+ export{U as ti,V as ui};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{_s as Iq}from"./chunk-vg8yh8te.js";import{nv as N}from"./chunk-vwqv8f0y.js";var Sq={1001:{message:"Unclosed directive: {{directive}}",help:"Make sure to close the directive with the appropriate end tag"},1002:{message:"Unclosed expression at position {{position}}",help:"Check for missing closing braces }}"},1003:{message:"Invalid directive syntax: {{directive}}",help:"Review the directive documentation for correct syntax"},1004:{message:"Malformed expression: {{expression}}",help:"Check for syntax errors in your expression"},1005:{message:"Unexpected token: {{token}}",help:"Remove or fix the unexpected token"},1101:{message:"Undefined variable: {{variable}}",help:"Make sure the variable is defined in the template context"},1102:{message:"Type error: {{details}}",help:"Check that you are using the correct types"},1103:{message:"Evaluation error: {{details}}",help:"Review the expression for errors"},1104:{message:"Infinite loop detected in {{location}}",help:"Check your loop conditions"},1105:{message:"Circular reference detected: {{path}}",help:"Remove the circular dependency"},1201:{message:"Unsafe expression blocked: {{expression}}",help:"This expression contains potentially dangerous code"},1202:{message:"Path traversal attempt blocked: {{path}}",help:"Use only relative paths within allowed directories"},1203:{message:"Potential XSS attempt blocked",help:"Sanitize user input before rendering"},1204:{message:"Code injection attempt blocked: {{code}}",help:"Avoid executing dynamic code"},1205:{message:"Prohibited DOM API usage: {{api}}",help:"Use STX.useRefs(), STX.useRef(), STX.el() and other STX helpers instead of direct DOM manipulation"},1301:{message:"File not found: {{path}}",help:"Check that the file exists and the path is correct"},1302:{message:"Error reading file: {{path}}",help:"Check file permissions and encoding"},1303:{message:"Invalid file path: {{path}}",help:"Use a valid file path"},1304:{message:"Permission denied: {{path}}",help:"Check file permissions"},1401:{message:"Invalid configuration: {{details}}",help:"Review your stx.config.ts file"},1402:{message:"Missing required configuration: {{key}}",help:"Add the required configuration option"},1403:{message:"Deprecated configuration: {{key}}",help:"Update to the new configuration format"},1501:{message:"Component not found: {{name}}",help:"Check that the component exists in your components directory"},1502:{message:"Invalid props for component {{name}}: {{details}}",help:"Check the component prop requirements"},1503:{message:"Error rendering component {{name}}: {{details}}",help:"Check the component template for errors"},1601:{message:"Filter not found: {{filter}}",help:"Register the filter or check the filter name"},1602:{message:"Invalid arguments for filter {{filter}}: {{details}}",help:"Check the filter documentation for correct arguments"},1603:{message:"Expression evaluation timed out",help:"Simplify the expression or increase the timeout"}},P={},qq="en";function Pq(q){qq=q}function Lq(){return qq}function bq(q){P={...P,...q}}function Cq(){P={}}function Jq(q,Q={}){let J=P[q]||Sq[q]||{message:`Unknown error (code: ${q})`},Z=J.message,$=J.help;for(let[W,H]of Object.entries(Q)){let Y=`{{${W}}}`;if(Z=Z.replace(new RegExp(Y,"g"),H),$)$=$.replace(new RegExp(Y,"g"),H)}return{message:Z,help:$}}function yq(q,Q={}){let{message:J,help:Z}=Jq(q,Q);return Z?`${J}
2
+ import{$s as Iq}from"./chunk-nn4k6hvv.js";import{ov as N}from"./chunk-6bcw8twx.js";var Sq={1001:{message:"Unclosed directive: {{directive}}",help:"Make sure to close the directive with the appropriate end tag"},1002:{message:"Unclosed expression at position {{position}}",help:"Check for missing closing braces }}"},1003:{message:"Invalid directive syntax: {{directive}}",help:"Review the directive documentation for correct syntax"},1004:{message:"Malformed expression: {{expression}}",help:"Check for syntax errors in your expression"},1005:{message:"Unexpected token: {{token}}",help:"Remove or fix the unexpected token"},1101:{message:"Undefined variable: {{variable}}",help:"Make sure the variable is defined in the template context"},1102:{message:"Type error: {{details}}",help:"Check that you are using the correct types"},1103:{message:"Evaluation error: {{details}}",help:"Review the expression for errors"},1104:{message:"Infinite loop detected in {{location}}",help:"Check your loop conditions"},1105:{message:"Circular reference detected: {{path}}",help:"Remove the circular dependency"},1201:{message:"Unsafe expression blocked: {{expression}}",help:"This expression contains potentially dangerous code"},1202:{message:"Path traversal attempt blocked: {{path}}",help:"Use only relative paths within allowed directories"},1203:{message:"Potential XSS attempt blocked",help:"Sanitize user input before rendering"},1204:{message:"Code injection attempt blocked: {{code}}",help:"Avoid executing dynamic code"},1205:{message:"Prohibited DOM API usage: {{api}}",help:"Use STX.useRefs(), STX.useRef(), STX.el() and other STX helpers instead of direct DOM manipulation"},1301:{message:"File not found: {{path}}",help:"Check that the file exists and the path is correct"},1302:{message:"Error reading file: {{path}}",help:"Check file permissions and encoding"},1303:{message:"Invalid file path: {{path}}",help:"Use a valid file path"},1304:{message:"Permission denied: {{path}}",help:"Check file permissions"},1401:{message:"Invalid configuration: {{details}}",help:"Review your stx.config.ts file"},1402:{message:"Missing required configuration: {{key}}",help:"Add the required configuration option"},1403:{message:"Deprecated configuration: {{key}}",help:"Update to the new configuration format"},1501:{message:"Component not found: {{name}}",help:"Check that the component exists in your components directory"},1502:{message:"Invalid props for component {{name}}: {{details}}",help:"Check the component prop requirements"},1503:{message:"Error rendering component {{name}}: {{details}}",help:"Check the component template for errors"},1601:{message:"Filter not found: {{filter}}",help:"Register the filter or check the filter name"},1602:{message:"Invalid arguments for filter {{filter}}: {{details}}",help:"Check the filter documentation for correct arguments"},1603:{message:"Expression evaluation timed out",help:"Simplify the expression or increase the timeout"}},P={},qq="en";function Pq(q){qq=q}function Lq(){return qq}function bq(q){P={...P,...q}}function Cq(){P={}}function Jq(q,Q={}){let J=P[q]||Sq[q]||{message:`Unknown error (code: ${q})`},Z=J.message,$=J.help;for(let[W,H]of Object.entries(Q)){let Y=`{{${W}}}`;if(Z=Z.replace(new RegExp(Y,"g"),H),$)$=$.replace(new RegExp(Y,"g"),H)}return{message:Z,help:$}}function yq(q,Q={}){let{message:J,help:Z}=Jq(q,Q);return Z?`${J}
3
3
  Help: ${Z}`:J}var j={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function g(q){for(let[Q,J]of Object.entries(j))if(J===q)return Q;return}function vq(){return!1}function E(){return!vq()||process.env.STX_DEBUG==="true"}function oJ(){return!1}import xq from"path";var Qq={showRelativePaths:!1,enableAutoRecovery:E(),logRecoveryWarnings:!0},R={...Qq};function gq(q){R={...R,...q}}function L(){return{...R}}function fq(){R={...Qq}}function b(q){if(!R.showRelativePaths||!q)return q;let Q=R.baseDir||process.cwd();try{let J=xq.relative(Q,q);return J.startsWith("..")?q:J}catch{return q}}class A extends Error{code;filePath;line;column;context;numericCode;constructor(q,Q,J,Z,$,W,H){super(q);this.code=Q;this.filePath=J;this.line=Z;this.column=$;this.context=W;if(this.name="StxError",this.numericCode=H||j.EVALUATION_ERROR,this.filePath)this.filePath=b(this.filePath)}}class Zq extends A{constructor(q,Q,J,Z,$,W){super(q,"stx_SYNTAX_ERROR",Q,J,Z,$,W||j.INVALID_DIRECTIVE_SYNTAX);this.name="StxSyntaxError"}}class $q extends A{constructor(q,Q,J,Z,$,W){super(q,"stx_RUNTIME_ERROR",Q,J,Z,$,W||j.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Xq extends A{constructor(q,Q,J,Z,$,W){super(q,"stx_SECURITY_ERROR",Q,J,Z,$,W||j.UNSAFE_EXPRESSION);this.name="StxSecurityError"}}class Wq extends A{constructor(q,Q,J,Z,$,W){super(q,"stx_FILE_ERROR",Q,J,Z,$,W||j.FILE_NOT_FOUND);this.name="StxFileError"}}class Yq extends A{isFatal=!0;constructor(q,Q,J,Z,$,W){super(q,"stx_VALIDATION_ERROR",Q,J,Z,$,W||j.DOM_API_VIOLATION);this.name="StxValidationError"}}function f(q){let{type:Q,message:J,code:Z,filePath:$,line:W,column:H,template:Y,offset:X,snippet:B,suggestion:G,format:V="text"}=q,_=W,M=H;if(!_&&Y&&X!==void 0){let z=Gq(Y,X);_=z.line,M=z.column}let U=$?b($):void 0,w=Z?g(Z):void 0,O={type:Q,code:Z,codeName:w,message:J,filePath:U,line:_,column:M,snippet:B,suggestion:G,timestamp:new Date().toISOString()},F;switch(V){case"html":F=uq(O);break;case"json":F=JSON.stringify(O,null,2);break;case"console":F=dq(O,Y,X);break;case"text":default:F=hq(O,Y,X);break}return{formatted:F,data:O}}function hq(q,Q,J){let Z=[],$=q.code?` [${q.codeName||q.code}]`:"";if(Z.push(`[${q.type} Error${$}]`),q.filePath){let W=q.filePath;if(q.line){if(W+=`:${q.line}`,q.column)W+=`:${q.column}`}Z.push(`at ${W}`)}if(Z.push(`
4
4
  ${q.message}`),Q&&q.line){let W=pq(Q,q.line,2);if(W)Z.push(`
5
5
  ${W}`)}if(q.snippet)Z.push(`
@@ -57,4 +57,4 @@ catch (e) {
57
57
  border-width: 0;
58
58
  }
59
59
  `.trim()}function hJ(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function Nq(q){let Q=new Map,J=q.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,($,W,H)=>{let Y=Q.get(H);if(!Y)Y=`stx-a11y-component-${Q.size}`,Q.set(H,Y);return`<${W}${Y}`}),Z=new Map([...Q.entries()].map(([$,W])=>[W,$]));return{protectedSource:J,restore:($)=>$.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(W,H,Y)=>{let X=Z.get(Y);return X?`<${H}${X}`:W})}}function uJ(q,Q){let J=[],Z=/<img\s+([^>]*)>/gi,$;$=Z.exec(q);while($!==null){let F=$[1];if(!/\balt\s*=/i.test(F))J.push({type:"missing-alt",element:$[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});$=Z.exec(q)}let W=/<button([^>]*)>\s*<\/button>/gi;$=W.exec(q);while($!==null){let F=$[1];if(!/\baria-label\s*=/i.test(F)&&!/\btitle\s*=/i.test(F))J.push({type:"missing-accessible-name",element:$[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});$=W.exec(q)}let H=/<a\s+([^>]*)>\s*<\/a>/gi;$=H.exec(q);while($!==null){let F=$[1];if(!/\baria-label\s*=/i.test(F)&&!/\btitle\s*=/i.test(F))J.push({type:"link-missing-text",element:$[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});$=H.exec(q)}let Y=/<(input|select|textarea)\s+([^>]*)>/gi;$=Y.exec(q);while($!==null){let F=$[2];if(/\btype\s*=\s*["']hidden["']/i.test(F)){$=Y.exec(q);continue}let z=/\baria-label\s*=/i.test(F)||/\baria-labelledby\s*=/i.test(F),T=F.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!z){let Rq=T&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${T[1]}["']`,"i").test(q),t=$.index,e=q.substring(0,t),rJ=q.substring(t),Tq=(e.match(/<label\b/gi)||[]).length,Eq=(e.match(/<\/label>/gi)||[]).length,kq=Tq>Eq;if(!Rq&&!kq)J.push({type:"input-missing-label",element:$[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}$=Y.exec(q)}let X=/<h([1-6])[^>]*>/gi,B=[];$=X.exec(q);while($!==null)B.push(Number.parseInt($[1],10)),$=X.exec(q);let G=0;for(let F of B){if(G>0&&F>G+1)J.push({type:"heading-skip",element:`<h${F}>`,message:`Heading level skipped from h${G} to h${F}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});G=F}if(/<html\b/i.test(q)&&!/<html[^>]*\slang\s*=/i.test(q))J.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let V=q.match(/<html\b([^>]*)>/i);if(V&&a(S(V[1],"lang"),S(V[1],"dir")))J.push({type:"missing-dir",element:V[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let _=/<table([^>]*)>([\s\S]*?)<\/table>/gi;$=_.exec(q);while($!==null){let F=$[2];if(!Aq(S($[1],"role"))&&!/<th\b/i.test(F))J.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});$=_.exec(q)}let M=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;$=M.exec(q);while($!==null){if(!/\bmuted\b/i.test($[0]))J.push({type:"autoplay-audio",element:`<${$[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});$=M.exec(q)}let U=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;$=U.exec(q);while($!==null)J.push({type:"positive-tabindex",element:`tabindex="${$[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),$=U.exec(q);let w=/<iframe\s+([^>]*)>/gi;$=w.exec(q);while($!==null){let F=$[1];if(!/\btitle\s*=/i.test(F)&&!/\baria-label\s*=/i.test(F))J.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});$=w.exec(q)}let O=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;$=O.exec(q);while($!==null){let F=$[1].toLowerCase(),z=$[2];if(F!=="button"&&!/\btabindex\s*=/i.test(z))J.push({type:"button-not-focusable",element:$[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});$=O.exec(q)}return J}async function dJ(q,Q){let{protectedSource:J}=Nq(q);if(!hJ())return uJ(J,Q);let Z=[];try{let $=globalThis.document.createElement("div");$.innerHTML=J,$.querySelectorAll("img").forEach((X)=>{if(!X.hasAttribute("alt"))Z.push({type:"missing-alt",element:`<${X.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),$.querySelectorAll('button, a, [role="button"]').forEach((X)=>{if(!(X.hasAttribute("aria-label")||X.hasAttribute("aria-labelledby")||X.textContent&&X.textContent.trim().length>0))Z.push({type:"missing-accessible-name",element:`<${X.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),$.querySelectorAll("input, select, textarea").forEach((X)=>{let B=X.getAttribute("id"),G=B&&$.querySelector(`label[for="${B}"]`),V=X.hasAttribute("aria-label")||X.hasAttribute("aria-labelledby"),_=X.closest("label")!==null;if(!G&&!V&&!_)Z.push({type:"input-missing-label",element:`<${X.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let W=Array.from($.querySelectorAll("h1, h2, h3, h4, h5, h6")),H=0;for(let X of W){let B=Number.parseInt(X.tagName.charAt(1));if(H>0&&B>H+1)Z.push({type:"heading-skip",element:`<${X.outerHTML}>`,message:`Heading level skipped from h${H} to h${B}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});H=B}let Y=$.querySelector("html");if(J.includes("<html")&&Y&&!Y.hasAttribute("lang"))Z.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(Y&&a(Y.getAttribute("lang"),Y.getAttribute("dir")))Z.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if($.querySelectorAll("a").forEach((X)=>{let B=X.textContent&&X.textContent.trim().length>0,G=X.hasAttribute("aria-label")||X.hasAttribute("aria-labelledby"),V=X.hasAttribute("title"),_=X.querySelector("img[alt]");if(!B&&!G&&!V&&!_)Z.push({type:"link-missing-text",element:`<${X.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),J.includes("<nav")||J.includes("<header")){if(!$.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&$.querySelectorAll("a").length>5)Z.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if($.querySelectorAll("table").forEach((X)=>{if(Aq(X.getAttribute("role")))return;let B=X.querySelector("caption");if(!X.querySelector("th"))Z.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!B&&!X.hasAttribute("aria-label")&&!X.hasAttribute("aria-labelledby"))Z.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),$.querySelectorAll('[style*="color"]').forEach((X)=>{let B=X.getAttribute("style")||"";if(B.includes("color:")&&!B.includes("background"))Z.push({type:"potential-contrast-issue",element:`<${X.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),$.querySelectorAll("video[autoplay], audio[autoplay]").forEach((X)=>{if(!X.hasAttribute("muted"))Z.push({type:"autoplay-audio",element:`<${X.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),$.querySelectorAll("[tabindex]").forEach((X)=>{if(Number.parseInt(X.getAttribute("tabindex")||"0")>0)Z.push({type:"positive-tabindex",element:`<${X.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),$.querySelectorAll('[role="button"]').forEach((X)=>{if(!X.hasAttribute("tabindex"))Z.push({type:"button-not-focusable",element:`<${X.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),J.includes("<body")&&!$.querySelector('main, [role="main"]'))Z.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});$.querySelectorAll("iframe").forEach((X)=>{if(!X.hasAttribute("title")&&!X.hasAttribute("aria-label"))Z.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch($){console.error(`Error checking accessibility in ${Q}:`,$)}return Z}async function pJ(q,Q={}){let J={},{recursive:Z=!0,ignorePaths:$=[]}=Q,W=Array.isArray(q)?q:[q],H=await Iq(W,{recursive:Z,ignorePaths:$}),Y=[];for(let X of H)try{let B=await Bun.file(X).text();if(X.endsWith("good-a11y.stx"))continue;let G=await dJ(B,X);if(Y.push(X),G.length>0)J[X]=G}catch(B){console.error(`Error scanning ${X}:`,B)}return{results:J,scannedFiles:Y}}async function cQ(q,Q={}){return(await pJ(q,Q)).results}var mJ={fixMissingAlt:!0,fixMissingLabels:!0,fixMissingFormLabels:!0,fixTableHeaders:!0,fixMissingLang:!0,fixMissingDir:!0,fixPositiveTabindex:!0,fixButtonFocusable:!0,defaultLang:"en"};function cJ(q,Q={}){let J={...mJ,...Q},Z=[],{protectedSource:$,restore:W}=Nq(q),H=$;if(J.fixMissingAlt)H=H.replace(/<img([^>]*?)(?<!\balt\s*=\s*["'][^"']*["'])(\s*\/?>)/gi,(Y,X,B)=>{if(/\balt\s*=/i.test(X))return Y;let G=Y,V=`<img${X} alt=""${B}`;return Z.push({type:"missing-alt",description:"Added empty alt attribute to image",before:G,after:V}),V});if(J.fixMissingLabels)H=H.replace(/<button([^>]*)>\s*<\/button>/gi,(Y,X)=>{if(/\baria-label\s*=/i.test(X)||/\btitle\s*=/i.test(X))return Y;let B=Y,G=`<button${X} aria-label="Button"></button>`;return Z.push({type:"missing-accessible-name",description:"Added aria-label to empty button",before:B,after:G}),G}),H=H.replace(/<a([^>]*)>\s*(<(?:i|span|svg)[^>]*(?:class="[^"]*icon[^"]*")?[^>]*>.*?<\/(?:i|span|svg)>)?\s*<\/a>/gi,(Y,X,B)=>{if(/\baria-label\s*=/i.test(X)||/\btitle\s*=/i.test(X))return Y;if(!B&&Y.replace(/<a[^>]*>|<\/a>/gi,"").trim())return Y;let G=Y,V=`<a${X} aria-label="Link">${B||""}</a>`;return Z.push({type:"missing-accessible-name",description:"Added aria-label to link without text",before:G,after:V}),V});if(J.fixMissingFormLabels)H=H.replace(/<(input|select|textarea)([^>]*)>/gi,(Y,X,B)=>{if(/\baria-label\s*=/i.test(B)||/\baria-labelledby\s*=/i.test(B))return Y;if(/\btype\s*=\s*["']hidden["']/i.test(B))return Y;let G=B.match(/\bname\s*=\s*["']([^"']+)["']/i),V=B.match(/\bid\s*=\s*["']([^"']+)["']/i),_=G?.[1]||V?.[1]||X,M=Y,U=`<${X}${B} aria-label="${_}">`;return Z.push({type:"input-missing-label",description:`Added aria-label to ${X} element`,before:M,after:U}),U});if(J.fixMissingLang)H=H.replace(/<html([^>]*)>/gi,(Y,X)=>{if(/\blang\s*=/i.test(X))return Y;let B=Y,G=`<html${X} lang="${J.defaultLang}">`;return Z.push({type:"missing-lang",description:`Added lang="${J.defaultLang}" to html element`,before:B,after:G}),G});if(J.fixMissingDir)H=H.replace(/<html([^>]*)>/gi,(Y,X)=>{let B=S(X,"lang");if(!a(B,S(X,"dir")))return Y;let G=/\bdir\s*=/i.test(X)?`<html${X.replace(/\bdir\s*=\s*(["'])[^"']*\1/i,'dir="rtl"')}>`:`<html${X} dir="rtl">`;return Z.push({type:"missing-dir",description:`Added dir="rtl" to html element (lang="${B}" is right-to-left)`,before:Y,after:G}),G});if(J.fixPositiveTabindex)H=H.replace(/\btabindex\s*=\s*["']([1-9]\d*)["']/gi,(Y,X)=>{let B=Y,G='tabindex="0"';return Z.push({type:"positive-tabindex",description:`Changed tabindex="${X}" to tabindex="0"`,before:B,after:'tabindex="0"'}),'tabindex="0"'});if(J.fixButtonFocusable)H=H.replace(/<([a-z]+)(\s[^>]*role\s*=\s*["']button["'][^>]*)>/gi,(Y,X,B)=>{if(/\btabindex\s*=/i.test(B))return Y;if(X.toLowerCase()==="button")return Y;let G=Y,V=`<${X}${B} tabindex="0">`;return Z.push({type:"button-not-focusable",description:'Added tabindex="0" to element with role="button"',before:G,after:V}),V});if(J.fixTableHeaders)H=H.replace(/<th([^>]*)>/gi,(Y,X)=>{if(/\bscope\s*=/i.test(X))return Y;let B=Y,G=`<th${X} scope="col">`;return Z.push({type:"table-missing-scope",description:'Added scope="col" to table header',before:B,after:G}),G});return{original:q,fixed:W(H),fixCount:Z.length,fixes:Z}}async function lJ(q,Q={},J=!1){let Z=await Bun.file(q).text(),$=cJ(Z,Q);if(J&&$.fixCount>0)await Bun.write(q,$.fixed);return $}async function lQ(q,Q={},J={}){let Z={},{recursive:$=!0,ignorePaths:W=[],writeBack:H=!1,extensions:Y=[".stx",".html",".htm"]}=J,X=Y.length===1?`*${Y[0]}`:`*{${Y.join(",")}}`,B=zq.join(q,$?`**/${X}`:X),G=new Bun.Glob(B);for await(let V of G.scan()){if(W.some((M)=>V.includes(zq.normalize(M))))continue;try{let M=await lJ(V,Q,H);if(M.fixCount>0)Z[V]=M}catch(M){console.error(`Error fixing ${V}:`,M)}}return Z}var sJ={name:"a11y",handler:(q,Q,J,Z)=>{if(!Q.length)return q;let $=Q[0].replace(/['"]/g,""),W=Q.length>1?Q[1].replace(/['"]/g,""):"",Y={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[$]||"Make this element accessible";return`<!-- a11y-hint: ${W||Y} -->${q}`},hasEndTag:!1},iJ={name:"screenReader",handler:(q)=>{return`<span class="sr-only">${q}</span>`},hasEndTag:!0};function sQ(){return[sJ,iJ]}
60
- export{Pq as or,Lq as pr,bq as qr,Cq as rr,Jq as sr,yq as tr,j as ur,g as vr,vq as wr,E as xr,oJ as yr,gq as zr,L as Ar,fq as Br,b as Cr,A as Dr,Zq as Er,$q as Fr,Xq as Gr,Wq as Hr,Yq as Ir,f as Jr,C as Kr,cq as Lr,lq as Mr,sq as Nr,iq as Or,rq as Pr,h as Qr,nq as Rr,oq as Sr,d as Tr,y as Ur,tq as Vr,eq as Wr,qJ as Xr,Bq as Yr,Mq as Zr,HJ as _r,OQ as $r,m as as,jQ as bs,_J as cs,FJ as ds,DQ as es,r as fs,RQ as gs,TQ as hs,EQ as is,kQ as js,SQ as ks,wJ as ls,PQ as ms,x as ns,KJ as os,LQ as ps,bQ as qs,CQ as rs,yQ as ss,AJ as ts,RJ as us,gJ as vs,i as ws,o as xs,vQ as ys,xQ as zs,gQ as As,Aq as Bs,S as Cs,pQ as Ds,mQ as Es,hJ as Fs,uJ as Gs,dJ as Hs,pJ as Is,cQ as Js,cJ as Ks,lJ as Ls,lQ as Ms,sJ as Ns,iJ as Os,sQ as Ps};
60
+ export{Pq as pr,Lq as qr,bq as rr,Cq as sr,Jq as tr,yq as ur,j as vr,g as wr,vq as xr,E as yr,oJ as zr,gq as Ar,L as Br,fq as Cr,b as Dr,A as Er,Zq as Fr,$q as Gr,Xq as Hr,Wq as Ir,Yq as Jr,f as Kr,C as Lr,cq as Mr,lq as Nr,sq as Or,iq as Pr,rq as Qr,h as Rr,nq as Sr,oq as Tr,d as Ur,y as Vr,tq as Wr,eq as Xr,qJ as Yr,Bq as Zr,Mq as _r,HJ as $r,OQ as as,m as bs,jQ as cs,_J as ds,FJ as es,DQ as fs,r as gs,RQ as hs,TQ as is,EQ as js,kQ as ks,SQ as ls,wJ as ms,PQ as ns,x as os,KJ as ps,LQ as qs,bQ as rs,CQ as ss,yQ as ts,AJ as us,RJ as vs,gJ as ws,i as xs,o as ys,vQ as zs,xQ as As,gQ as Bs,Aq as Cs,S as Ds,pQ as Es,mQ as Fs,hJ as Gs,uJ as Hs,dJ as Is,pJ as Js,cQ as Ks,cJ as Ls,lJ as Ms,lQ as Ns,sJ as Os,iJ as Ps,sQ as Qs};