@stacksjs/stx 0.2.840 → 0.2.842

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 (127) hide show
  1. package/dist/chunk-0bacm8xg.js +2 -0
  2. package/dist/chunk-0gjx468c.js +2 -0
  3. package/dist/{chunk-zg44cf8a.js → chunk-0pghy8kw.js} +9 -9
  4. package/dist/{chunk-znwc8gta.js → chunk-1m2sx3rc.js} +1 -1
  5. package/dist/{chunk-p65ax8s0.js → chunk-20ep26hg.js} +1 -1
  6. package/dist/{chunk-b685aqy4.js → chunk-2bvjn3jg.js} +2 -2
  7. package/dist/chunk-31bkv5yk.js +2 -0
  8. package/dist/{chunk-v4ybemgb.js → chunk-32p5bqy2.js} +1 -1
  9. package/dist/chunk-38cj6zgb.js +2 -0
  10. package/dist/{chunk-4654xm1h.js → chunk-3cnf9vk3.js} +1 -1
  11. package/dist/{chunk-x110ssw2.js → chunk-4a989sxm.js} +1 -1
  12. package/dist/{chunk-1b1ntgt7.js → chunk-4y1a7nbm.js} +1 -1
  13. package/dist/{chunk-57x8wxdf.js → chunk-51r39yw4.js} +12 -12
  14. package/dist/{chunk-z9xjhc5m.js → chunk-5gjzfgc5.js} +5 -5
  15. package/dist/chunk-67gy8ktq.js +2 -0
  16. package/dist/{chunk-xqtt5t6d.js → chunk-694w19gx.js} +4 -4
  17. package/dist/{chunk-kvpzxnww.js → chunk-6dz3k0jc.js} +1 -1
  18. package/dist/{chunk-8gdtys3s.js → chunk-6hn9n00a.js} +1 -1
  19. package/dist/{chunk-azderqyk.js → chunk-736q5pgh.js} +4 -4
  20. package/dist/{chunk-dgn87554.js → chunk-7bd85w4d.js} +3 -3
  21. package/dist/{chunk-9razzga7.js → chunk-7rtm7nd1.js} +2 -2
  22. package/dist/{chunk-qcars8ar.js → chunk-7v54wqsh.js} +1 -1
  23. package/dist/{chunk-xbcnnk8x.js → chunk-7ywzjj7t.js} +1 -1
  24. package/dist/chunk-8tkg5ews.js +2 -0
  25. package/dist/chunk-ajq3fnxc.js +3 -0
  26. package/dist/{chunk-02cntwd8.js → chunk-ar86zwmp.js} +1 -1
  27. package/dist/chunk-b4tpv1jd.js +2 -0
  28. package/dist/{chunk-2fj5zev7.js → chunk-bdaz0k5c.js} +1 -1
  29. package/dist/chunk-bj2bgazr.js +2 -0
  30. package/dist/{chunk-vwddsdk5.js → chunk-bkcq0dxb.js} +2 -2
  31. package/dist/{chunk-gft9pg9n.js → chunk-c1xxnn0k.js} +1 -1
  32. package/dist/{chunk-2knr61g3.js → chunk-c656az66.js} +1 -1
  33. package/dist/{chunk-89d3h8mp.js → chunk-cqwhafc9.js} +5 -5
  34. package/dist/chunk-dmjx0mjy.js +2 -0
  35. package/dist/chunk-ds3yhz8f.js +2 -0
  36. package/dist/{chunk-mh4kpnjr.js → chunk-dt4qswne.js} +1 -1
  37. package/dist/{chunk-5pbxjx8s.js → chunk-e2dxyxaf.js} +1 -1
  38. package/dist/chunk-e2ghgjb0.js +2 -0
  39. package/dist/{chunk-8w0n2rae.js → chunk-ehgmm2sy.js} +1 -1
  40. package/dist/chunk-eqn3jm65.js +2 -0
  41. package/dist/{chunk-ns0171xk.js → chunk-er5tdp6k.js} +1 -1
  42. package/dist/{chunk-7m53tpxn.js → chunk-f8azcvh3.js} +2 -2
  43. package/dist/{chunk-d0dzzpfx.js → chunk-fg80w4zk.js} +2 -2
  44. package/dist/{chunk-6n5kew7a.js → chunk-fgxydvt9.js} +1 -1
  45. package/dist/chunk-fjkge1xy.js +2 -0
  46. package/dist/{chunk-rk2ex6qx.js → chunk-frqf7t08.js} +2 -2
  47. package/dist/{chunk-p9d2txcg.js → chunk-fstm9dcb.js} +1 -1
  48. package/dist/{chunk-x0ygwk9x.js → chunk-ft30g13p.js} +1 -1
  49. package/dist/{chunk-8370x30n.js → chunk-fvmd4kk6.js} +2 -2
  50. package/dist/{chunk-23r3rby6.js → chunk-fx094pwg.js} +2 -2
  51. package/dist/{chunk-xdzy4pm0.js → chunk-fzkjm2g2.js} +1 -1
  52. package/dist/chunk-g63jq20j.js +2 -0
  53. package/dist/{chunk-px5kda00.js → chunk-gjg82tsf.js} +2 -2
  54. package/dist/{chunk-t0jed809.js → chunk-gtchtap6.js} +2 -2
  55. package/dist/{chunk-rb17ssxh.js → chunk-h6hct02d.js} +1 -1
  56. package/dist/{chunk-2vprq4x0.js → chunk-hcf1wv74.js} +5 -5
  57. package/dist/chunk-hph5qt43.js +2 -0
  58. package/dist/chunk-ht0nncp5.js +2 -0
  59. package/dist/{chunk-ywpan1k5.js → chunk-hzgd52zc.js} +1 -1
  60. package/dist/{chunk-h8h79939.js → chunk-k4c4xa7b.js} +1 -1
  61. package/dist/{chunk-pqn7r8fw.js → chunk-kqpdnbvs.js} +1 -1
  62. package/dist/chunk-m7ev93s9.js +2 -0
  63. package/dist/{chunk-chjdnmqv.js → chunk-m87qhcsz.js} +60 -60
  64. package/dist/chunk-nwt1g6s6.js +2 -0
  65. package/dist/{chunk-s2k1x2rn.js → chunk-p32n92sy.js} +1 -1
  66. package/dist/{chunk-m7acbayx.js → chunk-p5x2j3xd.js} +2 -2
  67. package/dist/{chunk-ksc83y9t.js → chunk-p7q6e8k1.js} +1 -1
  68. package/dist/{chunk-3gzhh69y.js → chunk-pf49wf76.js} +1 -1
  69. package/dist/{chunk-7dnp8evg.js → chunk-ph9f3hwk.js} +4 -4
  70. package/dist/chunk-phfdcdhk.js +2 -0
  71. package/dist/{chunk-bp918end.js → chunk-py5x8fkq.js} +2 -2
  72. package/dist/{chunk-n7pvz99f.js → chunk-q1v3c6v8.js} +1 -1
  73. package/dist/{chunk-7y5gz0cs.js → chunk-q8yfdjww.js} +1 -1
  74. package/dist/{chunk-ebxz30e5.js → chunk-q9xzfnpz.js} +7 -7
  75. package/dist/chunk-qjtt6hjd.js +2 -0
  76. package/dist/chunk-qmg1srpk.js +2 -0
  77. package/dist/{chunk-xz2569ra.js → chunk-r65vb67k.js} +1 -1
  78. package/dist/{chunk-ecjx9z8a.js → chunk-sb0gtzcf.js} +1 -1
  79. package/dist/{chunk-y8zzvzww.js → chunk-sen1svvw.js} +1 -1
  80. package/dist/{chunk-8d4br2j5.js → chunk-t9mw38hk.js} +2 -2
  81. package/dist/{chunk-c87zgwzn.js → chunk-txakmp61.js} +1 -1
  82. package/dist/{chunk-8qbp5skx.js → chunk-tzd0f95w.js} +1 -1
  83. package/dist/{chunk-88rwr1w2.js → chunk-vvv8wyr7.js} +1 -1
  84. package/dist/{chunk-q1nj47gn.js → chunk-w20kjp62.js} +1 -1
  85. package/dist/chunk-wfv30y38.js +2 -0
  86. package/dist/chunk-wj84r15x.js +2 -0
  87. package/dist/{chunk-qzms4d8s.js → chunk-wr1werwe.js} +4 -4
  88. package/dist/{chunk-b90xw7v4.js → chunk-wrn3n4b8.js} +1 -1
  89. package/dist/{chunk-ca3c5qx2.js → chunk-x12e55sd.js} +5 -5
  90. package/dist/{chunk-x5wkbcsf.js → chunk-x4k11c9v.js} +1 -1
  91. package/dist/{chunk-vbw9jhz2.js → chunk-y5k93ysf.js} +85 -85
  92. package/dist/{chunk-g7rsd8st.js → chunk-yffv17js.js} +2 -2
  93. package/dist/{chunk-zrp4159x.js → chunk-yy83cyj1.js} +3 -3
  94. package/dist/cli.js +9 -9
  95. package/dist/config.js +9 -4
  96. package/dist/craft-entry.js +1 -1
  97. package/dist/craft.js +1 -1
  98. package/dist/native/compiler/render-screen.js +2 -1
  99. package/dist/native/testing.js +7 -1
  100. package/dist/pwa.js +3 -3
  101. package/dist/ssg.js +2 -2
  102. package/dist/utils.js +1 -1
  103. package/package.json +5 -5
  104. package/dist/chunk-03v59965.js +0 -2
  105. package/dist/chunk-2pgc087j.js +0 -2
  106. package/dist/chunk-40bkdswh.js +0 -2
  107. package/dist/chunk-4rswqcfc.js +0 -2
  108. package/dist/chunk-5khpy4na.js +0 -2
  109. package/dist/chunk-66eba1h4.js +0 -2
  110. package/dist/chunk-6efz68j8.js +0 -2
  111. package/dist/chunk-6nb07mdj.js +0 -2
  112. package/dist/chunk-a2p42cxf.js +0 -2
  113. package/dist/chunk-b3fx75th.js +0 -2
  114. package/dist/chunk-b6w3457c.js +0 -2
  115. package/dist/chunk-fpn5txnm.js +0 -2
  116. package/dist/chunk-g6r2313a.js +0 -2
  117. package/dist/chunk-g957a2m3.js +0 -2
  118. package/dist/chunk-ga8waz0a.js +0 -2
  119. package/dist/chunk-gbcwna5q.js +0 -2
  120. package/dist/chunk-jgx0ex9p.js +0 -3
  121. package/dist/chunk-ndah5rvs.js +0 -2
  122. package/dist/chunk-p2e02hh7.js +0 -2
  123. package/dist/chunk-qb3c05qq.js +0 -2
  124. package/dist/chunk-rmc6dfj4.js +0 -2
  125. package/dist/chunk-spdh99jy.js +0 -2
  126. package/dist/chunk-vv7b8p5z.js +0 -2
  127. package/dist/chunk-x42tsdbx.js +0 -2
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{P,t,l}from"./chunk-89d3h8mp.js";import{Q}from"./chunk-vbw9jhz2.js";import{Qo}from"./chunk-11y84h2d.js";import E from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var T={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function J(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function G(e,s){if({...T,...s.i18n}.cache&&v[e]){let r=v[e],o=s.i18n?.cacheMaxAge??0;if(!J(r,o))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=C(e,s).then((r)=>(k[e]="loaded",delete L[e],r)).catch((r)=>{throw k[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function C(e,s){let i={...T,...s.i18n},n=E.isAbsolute(i.translationsDir)?i.translationsDir:E.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await W(),o=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:te(i.format)}):await Y(e,i,n);if(o===void 0){let u=e!==i.defaultLocale?await C(i.defaultLocale,s):{};if(i.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let c=o;if(i.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return C(i.defaultLocale,s);return{}}}async function Y(e,s,i){let n=E.join(i,`${e}${Z(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let o=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return X(o);if(s.format==="json")return JSON.parse(o);throw r}catch{return}}}function Z(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function X(e){let s={},i=e.split(`
2
+ import{P,t,l}from"./chunk-cqwhafc9.js";import{Q}from"./chunk-y5k93ysf.js";import{Qo}from"./chunk-11y84h2d.js";import E from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var T={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function J(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function G(e,s){if({...T,...s.i18n}.cache&&v[e]){let r=v[e],o=s.i18n?.cacheMaxAge??0;if(!J(r,o))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=C(e,s).then((r)=>(k[e]="loaded",delete L[e],r)).catch((r)=>{throw k[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function C(e,s){let i={...T,...s.i18n},n=E.isAbsolute(i.translationsDir)?i.translationsDir:E.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await W(),o=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:te(i.format)}):await Y(e,i,n);if(o===void 0){let u=e!==i.defaultLocale?await C(i.defaultLocale,s):{};if(i.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let c=o;if(i.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return C(i.defaultLocale,s);return{}}}async function Y(e,s,i){let n=E.join(i,`${e}${Z(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let o=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return X(o);if(s.format==="json")return JSON.parse(o);throw r}catch{return}}}function Z(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function X(e){let s={},i=e.split(`
3
3
  `),n=[{obj:s,indent:-1}];for(let r of i){let o=r.replace(/#.*$/,"").trimEnd();if(!o.trim())continue;let c=o.search(/\S/);if(c===-1)continue;while(n.length>1&&n[n.length-1].indent>=c)n.pop();let u=n[n.length-1].obj,a=o.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(a){let[,,g,p]=a,f=g.trim(),m=p.trim();if(m==="")u[f]={},n.push({obj:u[f],indent:c});else u[f]=ee(m)}}return s}function ee(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function te(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function re(e,s){return G(e,s)}function ne(e,s){for(let i of e){let n=i.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let c=Number.parseInt(r[1],10);if(s===c)return r[2];continue}let o=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(o){let c=Number.parseInt(o[1],10),u=o[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(o[2],10);if(s>=c&&s<=u)return o[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ie(e,s={}){return j(e,s)}function j(e,s){let i="",n=0;while(n<e.length)if(e[n]==="{"){let r=se(e,n);if(r===-1){i+=e[n],n++;continue}let o=e.slice(n+1,r);i+=ae(o,s),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")i+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")i+=e[n+1],n+=2;else i+=e[n],n++;else i+=e[n],n++;return i}function se(e,s){let i=0;for(let n=s;n<e.length;n++)if(e[n]==="{")i++;else if(e[n]==="}"){if(i--,i===0)return n}return-1}function ae(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let n=i[0].trim(),r=s[n];if(i.length===1)return r!==void 0?String(r):`{${n}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(r,i.slice(2).join(","),s);case"select":return ue(r,i.slice(2).join(","));case"selectordinal":return de(r,i.slice(2).join(","));case"number":return pe(r,i[2]?.trim());case"date":return fe(r,i[2]?.trim());case"time":return me(r,i[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function oe(e){let s=[],i="",n=0;for(let r=0;r<e.length;r++){let o=e[r];if(o==="{")n++,i+=o;else if(o==="}")n--,i+=o;else if(o===","&&n===0)s.push(i),i="";else i+=o}if(i)s.push(i);return s}function le(e,s,i){let n=Number(e)||0,r=I(s),o=`=${n}`;if(r[o])return R(r[o],n,i);let c=ce(n);if(r[c])return R(r[c],n,i);if(r.other)return R(r.other,n,i);return String(n)}function R(e,s,i){let n=e.replace(/#/g,String(s));return j(n,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&n===0)return"one";return"other"}function ue(e,s){let i=String(e||""),n=I(s);if(n[i])return n[i];return n.other||String(e)}function de(e,s){let i=Number(e)||0,n=I(s),r=ge(i);if(n[r])return n[r].replace(/#/g,String(i));if(n.other)return n.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,n=s%100;if(i===1&&n!==11)return"one";if(i===2&&n!==12)return"two";if(i===3&&n!==13)return"few";return"other"}function I(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=i.exec(e);while(n!==null)s[n[1]]=n[2],n=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return i.toLocaleDateString(void 0,n)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return i.toLocaleTimeString(void 0,n)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,n={}){let r=e.split("."),o=s;for(let u of r){if(o===void 0||o===null)break;o=o[u]}if(o===void 0||o===null)return i?e:"";let c=String(o);if(be(c))return ie(c,n);if(c.includes("|")&&"count"in n){let u=Number(n.count),a=c.split("|");c=ne(a,u)}for(let[u,a]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");c=c.replace(new RegExp(`:${g}`,"g"),()=>String(a))}return c}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let n=s[1]?.length===4?s[1]:void 0;if(n)return he.has(n)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function bc(e,s,i,n){let r=e,o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,c={...T,...n.i18n},u=await re(c.locale,n);s.__translations=u,s.__locale=c.locale,s.__i18nConfig=c,r=await F(r,o,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>P(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,u,c.fallbackToKey,b);return y?Q(r,h,y,!1,p.length):w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return l("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let a=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...r.matchAll(a)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>P(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return Q(r,w,O(f,u,c.fallbackToKey,h),!1,p.length)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return l("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,s,i){let n=[];return e.replace(s,(o,...c)=>{let u=i(o,...c).then((a)=>({match:o,replacement:a}));return n.push(u),o}),(await Promise.all(n)).reduce((o,{match:c,replacement:u})=>o.replace(c,()=>u),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function U(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function wc(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,u,a)=>{let p={"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"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${a||p} -->`});let o=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(o,(c,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(c,u,a)=>`<span id="${`desc-${u}`}" class="sr-only">${a}</span>`),r}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,o,c)=>{let u=s.get(c);if(!u)u=`stx-a11y-component-${s.size}`,s.set(c,u);return`<${o}${u}`}),n=new Map([...s.entries()].map(([r,o])=>[o,r]));return{protectedSource:i,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(o,c,u)=>{let a=n.get(u);return a?`<${c}${a}`:o})}}function we(e,s){let i=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:r[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/"});r=n.exec(e)}let o=/<button([^>]*)>\s*<\/button>/gi;r=o.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:r[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/"});r=o.exec(e)}let c=/<a\s+([^>]*)>\s*<\/a>/gi;r=c.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:r[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"});r=c.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),M=r.index,N=e.substring(0,M),Se=e.substring(M),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:r[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/"})}r=u.exec(e)}let a=/<h([1-6])[^>]*>/gi,g=[];r=a.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=a.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.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 f=e.match(/<html\b([^>]*)>/i);if(f&&_(U(f[1],"lang"),U(f[1],"dir")))i.push({type:"missing-dir",element:f[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 m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(U(r[1],"role"))&&!/<th\b/i.test(d))i.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"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))i.push({type:"autoplay-audio",element:`<${r[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"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)i.push({type:"positive-tabindex",element:`tabindex="${r[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"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.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"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:r[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/"});r=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=i,r.querySelectorAll("img").forEach((a)=>{if(!a.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${a.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((a)=>{if(!(a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||a.textContent&&a.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${a.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/"})}),r.querySelectorAll("input, select, textarea").forEach((a)=>{let g=a.getAttribute("id"),p=g&&r.querySelector(`label[for="${g}"]`),f=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),m=a.closest("label")!==null;if(!p&&!f&&!m)n.push({type:"input-missing-label",element:`<${a.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 o=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),c=0;for(let a of o){let g=Number.parseInt(a.tagName.charAt(1));if(c>0&&g>c+1)n.push({type:"heading-skip",element:`<${a.outerHTML}>`,message:`Heading level skipped from h${c} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});c=g}let u=r.querySelector("html");if(i.includes("<html")&&u&&!u.hasAttribute("lang"))n.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(u&&_(u.getAttribute("lang"),u.getAttribute("dir")))n.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(r.querySelectorAll("a").forEach((a)=>{let g=a.textContent&&a.textContent.trim().length>0,p=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),f=a.hasAttribute("title"),m=a.querySelector("img[alt]");if(!g&&!p&&!f&&!m)n.push({type:"link-missing-text",element:`<${a.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"})}),i.includes("<nav")||i.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.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(r.querySelectorAll("table").forEach((a)=>{if(V(a.getAttribute("role")))return;let g=a.querySelector("caption");if(!a.querySelector("th"))n.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(!g&&!a.hasAttribute("aria-label")&&!a.hasAttribute("aria-labelledby"))n.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"})}),r.querySelectorAll('[style*="color"]').forEach((a)=>{let g=a.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${a.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/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((a)=>{if(!a.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${a.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"})}),r.querySelectorAll("[tabindex]").forEach((a)=>{if(Number.parseInt(a.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${a.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"})}),r.querySelectorAll('[role="button"]').forEach((a)=>{if(!a.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${a.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/"})}),i.includes("<body")&&!r.querySelector('main, [role="main"]'))n.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"});r.querySelectorAll("iframe").forEach((a)=>{if(!a.hasAttribute("title")&&!a.hasAttribute("aria-label"))n.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(r){console.error(`Error checking accessibility in ${s}:`,r)}return n}async function vc(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,o=Array.isArray(e)?e:[e],c=await Qo(o,{recursive:n,ignorePaths:r}),u=[];for(let a of c)try{let g=await Bun.file(a).text();if(a.endsWith("good-a11y.stx"))continue;let p=await Ae(g,a);if(u.push(a),p.length>0)i[a]=p}catch(g){console.error(`Error scanning ${a}:`,g)}return{results:i,scannedFiles:u}}var xc={name:"a11y",handler:(e,s,i,n)=>{if(!s.length)return e;let r=s[0].replace(/['"]/g,""),o=s.length>1?s[1].replace(/['"]/g,""):"",u={"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"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${o||u} -->${e}`},hasEndTag:!1},Sc={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
4
4
  export{bc,wc,vc,xc,Sc};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{nt}from"./chunk-2j5yane9.js";import{yt,Wn}from"./chunk-xbcnnk8x.js";import{Ar,Pr,Ir,Nr,Ce}from"./chunk-89d3h8mp.js";import{De,yn,tl,nl}from"./chunk-vbw9jhz2.js";import{M}from"./chunk-8370x30n.js";import{ki}from"./chunk-p65ax8s0.js";import{b}from"./chunk-vwddsdk5.js";import{i}from"./chunk-57x8wxdf.js";import{F,a}from"./chunk-chjdnmqv.js";import{Cc}from"./chunk-4657mnht.js";import{Nn,qe,Te,pa,fa,Mn}from"./chunk-7dnp8evg.js";import{cn,Oo}from"./chunk-qzms4d8s.js";import{Dn}from"./chunk-bp918end.js";import{en,er,tr}from"./chunk-c18pafmf.js";import{G}from"./chunk-xqtt5t6d.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Wn():yt(),o=J(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function V(){let n=nt(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,o={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);tl();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>De(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...F,..._,...o,buildMode:"compile",strict:!1},y=await i(e,D,r,T,A),w=Nn(y)+qe(y),j=nl();return{route:l,sourceFile:n,html:y,fragment:w,placeholders:j,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(A),contentHash:S,status:yn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function im(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Ce(e.app?.head,{known:Nr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Dn(A),y=n.serverApi??e.serverApi,w=typeof y==="object"?y:{};if(y)cn(o,w);if(e.runtimeConfig)M(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=G(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],P=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],H=[];for(let s of P){let f=T(s.pattern),O=f.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:h,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Ir(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Ar(t.html,u);if(g.htmlAttrs)t.html=Pr(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await b(t.html),O){let p=await Mn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Te(t.html,D,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),I=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),H.push({pattern:s.pattern,compiledPath:z,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:f}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let E=tr(o);if(E){let{copied:s,bytes:f}=Z(E,c.join(r,"public",er));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${en}/`)}let N={runtime:v.filename,router:x.filename},C=pa(H,N,r);if(C.routeRules=A,C.routerContainer=D,y)C.apiRoutes=await Oo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await ki(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Cc(e._layerGraph),null,2));fa(C,r);let K=Date.now()-l;return console.log(`
3
- [stx build] Done in ${K}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:N,outputDir:r,duration:K}}
2
+ import{nt}from"./chunk-2j5yane9.js";import{yt,Wn}from"./chunk-7ywzjj7t.js";import{Ar,Pr,Ir,Nr,Ce}from"./chunk-cqwhafc9.js";import{Me,yn,tl,nl}from"./chunk-y5k93ysf.js";import{D}from"./chunk-fvmd4kk6.js";import{ki}from"./chunk-20ep26hg.js";import{b}from"./chunk-bkcq0dxb.js";import{i}from"./chunk-51r39yw4.js";import{F,a}from"./chunk-m87qhcsz.js";import{Cc}from"./chunk-4657mnht.js";import{Nn,qe,Te,pa,fa,Dn}from"./chunk-ph9f3hwk.js";import{cn,Oo}from"./chunk-wr1werwe.js";import{Mn}from"./chunk-py5x8fkq.js";import{en,er,tr}from"./chunk-c18pafmf.js";import{G}from"./chunk-694w19gx.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Wn():yt(),o=J(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function V(){let n=nt(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,o={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);tl();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>Me(R))),{context:A}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),w=new Set,j={...F,..._,...o,buildMode:"compile",strict:!1},y=await i(e,A,r,j,w),C=Nn(y)+qe(y),P=nl();return{route:l,sourceFile:n,html:y,fragment:C,placeholders:P,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(w),contentHash:S,status:yn(e),streamTemplates:A.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function im(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Ce(e.app?.head,{known:Nr,source:"app.head"}),u=e.app?.colorMode,A=e.router?.container||"main",w=n.routeRules??e.routeRules??{},j=Mn(w),y=n.serverApi??e.serverApi,C=typeof y==="object"?y:{};if(y)cn(o,C);if(e.runtimeConfig)D(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let P=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of P)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=G(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${B.length} page routes (${R.length-B.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],H=[];for(let s of B){let f=j(s.pattern),O=f.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:h,debug:n.debug});if(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Ir(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Ar(t.html,u);if(g.htmlAttrs)t.html=Pr(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await b(t.html),O){let p=await Dn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Te(t.html,A,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),I=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),H.push({pattern:s.pattern,compiledPath:z,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:f}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let E=tr(o);if(E){let{copied:s,bytes:f}=Z(E,c.join(r,"public",er));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${en}/`)}let N={runtime:v.filename,router:x.filename},T=pa(H,N,r);if(T.routeRules=w,T.routerContainer=A,y)T.apiRoutes=await Oo(o,r,C);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await ki(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Cc(e._layerGraph),null,2));fa(T,r);let K=Date.now()-l;return console.log(`
3
+ [stx build] Done in ${K}ms \u2014 ${M.length} pages compiled`),{pageCount:M.length,assets:N,outputDir:r,duration:K}}
4
4
  export{im};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{createHash as g}from"crypto";import{readFile as b,stat as y}from"fs/promises";async function H(e){try{let t=await b(e);return g("sha256").update(t).digest("hex").slice(0,16)}catch{return""}}function l(e){return g("sha256").update(e).digest("hex").slice(0,16)}function m(e,t){let r=JSON.stringify(t,Object.keys(t).sort());return`${l(e)}-${l(r)}`}async function h(e){try{return(await y(e)).mtimeMs}catch{return 0}}async function L(e){try{return await y(e),!0}catch{return!1}}import{mkdir as v,readFile as A,writeFile as P,readdir as z,rm as k,stat as B}from"fs/promises";import{join as w,dirname as D}from"path";var c=new Map,d={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500};async function E(e){try{await v(e,{recursive:!0})}catch{}}function p(e,t,r){return w(e,r,`${t}.json`)}async function C(e,t,r){if((Date.now()-e.createdAt)/86400000>r)return!1;if(await h(t)!==e.srcMtime)return!1;return!0}async function Dr(e,t,r,a=d){if(!a.enabled)return null;let n=m(e,t),i=c.get(n);if(i){if(await C(i,e,a.maxAge))return i.lastAccessedAt=Date.now(),i.data;c.delete(n)}let o=p(a.directory,n,r);if(await L(o))try{let u=await A(o,"utf-8"),s=JSON.parse(u);if(await C(s,e,a.maxAge))return s.lastAccessedAt=Date.now(),c.set(n,s),s.data}catch{}return null}async function Lr(e,t,r,a,n=d){if(!n.enabled)return;let i=m(e,t),o=await H(e),u=await h(e),s={key:i,src:e,srcHash:o,srcMtime:u,optionsHash:m("",t),data:r,createdAt:Date.now(),lastAccessedAt:Date.now()};c.set(i,s);let f=p(n.directory,i,a);try{await E(D(f)),await P(f,JSON.stringify(s,null,2))}catch(x){console.warn(`[stx-media] Failed to write cache: ${x}`)}}async function jr(e,t=d){if(e==="all")c.clear();else c.clear();let r=e==="all"?["image","video"]:[e];for(let a of r){let n=w(t.directory,a);try{await k(n,{recursive:!0,force:!0})}catch{}}}
3
- export{H,L,Dr,Lr,jr};
2
+ import{createHash as g}from"crypto";import{readFile as b,stat as y}from"fs/promises";async function H(e){try{let t=await b(e);return g("sha256").update(t).digest("hex").slice(0,16)}catch{return""}}function l(e){return g("sha256").update(e).digest("hex").slice(0,16)}function m(e,t){let r=JSON.stringify(t,Object.keys(t).sort());return`${l(e)}-${l(r)}`}async function h(e){try{return(await y(e)).mtimeMs}catch{return 0}}async function L(e){try{return await y(e),!0}catch{return!1}}import{mkdir as v,readFile as A,writeFile as P,readdir as z,rm as k,stat as B}from"fs/promises";import{join as w,dirname as D}from"path";var c=new Map,d={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500};async function E(e){try{await v(e,{recursive:!0})}catch{}}function p(e,t,r){return w(e,r,`${t}.json`)}async function C(e,t,r){if((Date.now()-e.createdAt)/86400000>r)return!1;if(await h(t)!==e.srcMtime)return!1;return!0}async function Mr(e,t,r,a=d){if(!a.enabled)return null;let n=m(e,t),i=c.get(n);if(i){if(await C(i,e,a.maxAge))return i.lastAccessedAt=Date.now(),i.data;c.delete(n)}let o=p(a.directory,n,r);if(await L(o))try{let u=await A(o,"utf-8"),s=JSON.parse(u);if(await C(s,e,a.maxAge))return s.lastAccessedAt=Date.now(),c.set(n,s),s.data}catch{}return null}async function Lr(e,t,r,a,n=d){if(!n.enabled)return;let i=m(e,t),o=await H(e),u=await h(e),s={key:i,src:e,srcHash:o,srcMtime:u,optionsHash:m("",t),data:r,createdAt:Date.now(),lastAccessedAt:Date.now()};c.set(i,s);let f=p(n.directory,i,a);try{await E(D(f)),await P(f,JSON.stringify(s,null,2))}catch(x){console.warn(`[stx-media] Failed to write cache: ${x}`)}}async function jr(e,t=d){if(e==="all")c.clear();else c.clear();let r=e==="all"?["image","video"]:[e];for(let a of r){let n=w(t.directory,a);try{await k(n,{recursive:!0,force:!0})}catch{}}}
3
+ export{H,L,Mr,Lr,jr};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{He,M,jt}from"./chunk-8370x30n.js";import{T}from"./chunk-89d3h8mp.js";import{gt,Ee,j,Ke,Te,ga,bo,ma,Mn}from"./chunk-7dnp8evg.js";import{kt,de,tt}from"./chunk-2j5yane9.js";import{No}from"./chunk-qzms4d8s.js";import{Dn}from"./chunk-bp918end.js";import{we}from"./chunk-xqtt5t6d.js";import Z from"fs";import P from"path";var{serve:ae}=globalThis.Bun;import H from"zlib";import{promisify as Y}from"util";var K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((a)=>e.startsWith(a)))return!1;return K.some((a)=>e.startsWith(a))}function re(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function se(t){if(!t)return null;let e=re(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,F=new Map,z=0;function oe(t,e){if(e.length>J/8)return;F.set(t,e),z+=e.length;for(let[a,r]of F){if(z<=J)break;F.delete(a),z-=r.length}}async function Pn(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let r=se(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(i.length<(a.threshold??te))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=F.get(g);if(!l)l=r==="br"?await Y(H.brotliCompress)(i,{params:{[H.constants.BROTLI_PARAM_QUALITY]:h,[H.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await Y(H.gzip)(i),oe(g,l);if(l.length>=i.length)return f();let m=Q(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function Q(t){let e=new Headers(t),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new T(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",j(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Ee(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,k=async()=>{let s=await a();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let B=await s.clone().arrayBuffer();if(B.byteLength>1048576)return null;s.headers.set("Vary",j(s.headers.get("Vary")).Vary);let n={body:B,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return i();x=k().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let E=await x;return E?l(E):i()}}var ie={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Zg(t={}){let e=P.resolve(t.outputDir||".output"),a=t.port??3000,r=ga(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let i=Dn(r.routeRules),f=new G,h=No(e,r.apiRoutes??[]),g=Bun.file(P.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?M(l):void 0,v=new Map,k=new Map,x=new Map,E=new Map;for(let n of r.routes)try{let y=P.join(e,n.compiledPath),c=JSON.parse(await Bun.file(y).text());if(m)c.html=jt(c.html,m);v.set(n.pattern,c),x.set(n.pattern,tt(c.html)),E.set(n.pattern,we(c.html));let _=P.join(e,n.fragmentPath);if(Ke(c.html,r.routerContainer||"main")&&await Bun.file(_).exists()){let A=await Bun.file(_).text();k.set(n.pattern,m?jt(A,m):A)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:c}=de(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:c})}else s.set(n.pattern,n);let B=ae({port:a,async fetch(n){return Pn(n,await He(m??M(),async()=>{let c=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[c])return t.apiRoutes[c](n);let _=await h(n);if(_)return _;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=P.extname(u).toLowerCase(),L=ie[R]||"application/octet-stream",N=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);return new Response(Bun.file(u),{headers:{"Content-Type":L,"Cache-Control":N?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=Ee(n),C=null,q={};if(C=s.get(c)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let o=c.match(p);if(o){C=d,u.forEach((R,L)=>{q[R]=o[L+1]});break}}if(!C){let p=kt(c)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let O=i(c),W=Object.keys(O).length>0;return f.respond(n,O.cache,async()=>{let p=v.get(C.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=k.get(C.pattern);if(o){let R=x.get(C.pattern);return new Response(o,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...E.has(C.pattern)?{"X-STX-Runtime":E.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...j(),...O.cache?{}:{"Cache-Control":gt}}})}}let d=bo(n.method),u=v.get(C.pattern);if(!u){let o=s.get("/500")||null;if(o){let R=v.get(o.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...j(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:R,redirect:L,cookies:N,status:I,headers:D}=await Mn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(L)return ma(L,N,D);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:U}=await import("./chunk-p2e02hh7.js"),X=new Headers({...j(),...D,"Cache-Control":"private, no-store"});for(let V of N??[])X.append("Set-Cookie",V);if(A&&!d&&Ke(o,r.routerContainer||"main")){let V=tt(o);X.set("X-STX-Fragment","true"),X.set("X-STX-Runtime",we(o)?"true":"false"),X.set("X-STX-Layout",V.layout),X.set("X-STX-Layout-Group",V.group)}return U(S(A&&!d&&Ke(o,r.routerContainer||"main")?Te(o,r.routerContainer||"main",!0):o,R,{timeoutMs:30000}),{status:I??u.status??200,headers:X})}let w=new Headers({"Content-Type":"text/html",...j(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of N??[])w.append("Set-Cookie",S);for(let[S,U]of Object.entries(D??{}))w.set(S,U);if(w.set("Vary",j(w.get("Vary")).Vary),A&&!d&&Ke(o,r.routerContainer||"main")){let S=tt(o);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",we(o)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(Te(o,r.routerContainer||"main",!0),{status:I??u.status??200,headers:w})}return new Response(o,{status:I??u.status??200,headers:w})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${B.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:B.port,stop:()=>{f.invalidate(),B.stop()},invalidate:(n)=>f.invalidate(n)}}
2
+ import{He,D,jt}from"./chunk-fvmd4kk6.js";import{T}from"./chunk-cqwhafc9.js";import{gt,Ee,j,Ke,Te,ga,bo,ma,Dn}from"./chunk-ph9f3hwk.js";import{kt,de,tt}from"./chunk-2j5yane9.js";import{No}from"./chunk-wr1werwe.js";import{Mn}from"./chunk-py5x8fkq.js";import{we}from"./chunk-694w19gx.js";import Z from"fs";import P from"path";var{serve:ae}=globalThis.Bun;import V from"zlib";import{promisify as Y}from"util";var K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((a)=>e.startsWith(a)))return!1;return K.some((a)=>e.startsWith(a))}function re(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function se(t){if(!t)return null;let e=re(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,H=new Map,z=0;function oe(t,e){if(e.length>J/8)return;H.set(t,e),z+=e.length;for(let[a,r]of H){if(z<=J)break;H.delete(a),z-=r.length}}async function Pn(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let r=se(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(i.length<(a.threshold??te))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=H.get(g);if(!l)l=r==="br"?await Y(V.brotliCompress)(i,{params:{[V.constants.BROTLI_PARAM_QUALITY]:h,[V.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await Y(V.gzip)(i),oe(g,l);if(l.length>=i.length)return f();let m=Q(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function Q(t){let e=new Headers(t),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new T(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",j(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Ee(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,N=async()=>{let s=await a();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",j(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return i();x=N().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let M=await x;return M?l(M):i()}}var ie={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Zg(t={}){let e=P.resolve(t.outputDir||".output"),a=t.port??3000,r=ga(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let i=Mn(r.routeRules),f=new G,h=No(e,r.apiRoutes??[]),g=Bun.file(P.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?D(l):void 0,v=new Map,N=new Map,x=new Map,M=new Map;for(let n of r.routes)try{let y=P.join(e,n.compiledPath),c=JSON.parse(await Bun.file(y).text());if(m)c.html=jt(c.html,m);v.set(n.pattern,c),x.set(n.pattern,tt(c.html)),M.set(n.pattern,we(c.html));let X=P.join(e,n.fragmentPath);if(Ke(c.html,r.routerContainer||"main")&&await Bun.file(X).exists()){let A=await Bun.file(X).text();N.set(n.pattern,m?jt(A,m):A)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:c}=de(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:c})}else s.set(n.pattern,n);let E=ae({port:a,async fetch(n){return Pn(n,await He(m??D(),async()=>{let c=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[c])return t.apiRoutes[c](n);let X=await h(n);if(X)return X;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=P.extname(u).toLowerCase(),B=ie[R]||"application/octet-stream",_=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);return new Response(Bun.file(u),{headers:{"Content-Type":B,"Cache-Control":_?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=Ee(n),C=null,q={};if(C=s.get(c)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let o=c.match(p);if(o){C=d,u.forEach((R,B)=>{q[R]=o[B+1]});break}}if(!C){let p=kt(c)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let k=i(c),W=Object.keys(k).length>0;return f.respond(n,k.cache,async()=>{let p=v.get(C.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=N.get(C.pattern);if(o){let R=x.get(C.pattern);return new Response(o,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...M.has(C.pattern)?{"X-STX-Runtime":M.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...j(),...k.cache?{}:{"Cache-Control":gt}}})}}let d=bo(n.method),u=v.get(C.pattern);if(!u){let o=s.get("/500")||null;if(o){let R=v.get(o.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...j(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:R,redirect:B,cookies:_,status:F,headers:I}=await Dn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(B)return ma(B,_,I);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:U}=await import("./chunk-qmg1srpk.js"),L=new Headers({...j(),...I,"Cache-Control":"private, no-store"});for(let O of _??[])L.append("Set-Cookie",O);if(A&&!d&&Ke(o,r.routerContainer||"main")){let O=tt(o);L.set("X-STX-Fragment","true"),L.set("X-STX-Runtime",we(o)?"true":"false"),L.set("X-STX-Layout",O.layout),L.set("X-STX-Layout-Group",O.group)}return U(S(A&&!d&&Ke(o,r.routerContainer||"main")?Te(o,r.routerContainer||"main",!0):o,R,{timeoutMs:30000}),{status:F??u.status??200,headers:L})}let w=new Headers({"Content-Type":"text/html",...j(),...k.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of _??[])w.append("Set-Cookie",S);for(let[S,U]of Object.entries(I??{}))w.set(S,U);if(w.set("Vary",j(w.get("Vary")).Vary),A&&!d&&Ke(o,r.routerContainer||"main")){let S=tt(o);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",we(o)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(Te(o,r.routerContainer||"main",!0),{status:F??u.status??200,headers:w})}return new Response(o,{status:F??u.status??200,headers:w})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
3
3
  export{Pn,Zg};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{to,Ni,Tg,$g,Rg}from"./chunk-tzd0f95w.js";import"./chunk-7bd85w4d.js";export{$g as generateManifestLink,to as generatePwaTags,Tg as generateSwRegistrationScript,Rg as generateThemeColorMeta,Ni as injectPwaTags};
@@ -2,5 +2,5 @@
2
2
  import o from"fs";import u from"path";var h={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"};function p(e){let r=0;for(let t=0;t<e.length;t++){let n=e[t];r=(r<<5)-r+n,r=r&r}return Math.abs(r).toString(16).padStart(8,"0")}function x(e,r){let t=u.basename(e);for(let n of r)if(n.startsWith("*.")){let i=n.slice(1);if(t.endsWith(i))return!0}else if(n.includes("*")){let i=new RegExp(`^${n.replace(/\*/g,".*")}$`);if(i.test(t)||i.test(e))return!0}else if(t===n||e.includes(n))return!0;return!1}function S(e,r,t){let n=u.extname(e).toLowerCase(),i=h[n],c=(t.maxFileSizeKB||500)*1024;if(r>c)return!1;if(t.exclude&&x(e,t.exclude))return!1;if(t.include&&t.include.length>0){for(let s of t.include)if(s.startsWith("*.")){if(e.endsWith(s.slice(1)))return!0}else if(e.includes(s))return!0}if(i&&t[i]===!0)return!0;if(!i)return!1;return!1}function f(e,r,t,n){let i=o.readdirSync(e,{withFileTypes:!0});for(let c of i){let s=u.join(e,c.name);if(c.isDirectory()){if(["node_modules",".git",".stx"].includes(c.name))continue;f(s,r,t,n)}else if(c.isFile()){let a=o.statSync(s),l=u.relative(r,s);if(S(l,a.size,t)){let d=o.readFileSync(s),g=p(d),m=`/${l.replace(/\\/g,"/")}`;n.push({url:m,revision:g,size:a.size})}}}}function We(e,r){let t=r.pwa?.precache,n=[];if(!t?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!o.existsSync(e))return{entries:[],totalSize:0,fileCount:0};f(e,e,t,n),n.sort((c,s)=>c.url.localeCompare(s.url));let i=n.reduce((c,s)=>c+s.size,0);return{entries:n,totalSize:i,fileCount:n.length}}function An(e){if(e.entries.length===0)return"[]";return`[
3
3
  ${e.entries.map((t)=>` { url: '${t.url}', revision: '${t.revision}' }`).join(`,
4
4
  `)}
5
- ]`}function Mi(e){if(e<1024)return`${e} B`;if(e<1048576)return`${(e/1024).toFixed(1)} KB`;return`${(e/1048576).toFixed(2)} MB`}
6
- export{We,An,Mi};
5
+ ]`}function Di(e){if(e<1024)return`${e} B`;if(e<1048576)return`${(e/1024).toFixed(1)} KB`;return`${(e/1048576).toFixed(2)} MB`}
6
+ export{We,An,Di};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{H,L,Dr,Lr,jr}from"./chunk-d0dzzpfx.js";import{resolve as S,basename as z,extname as j,join as T}from"path";import{mkdir as q}from"fs/promises";var F={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class Di{config;constructor(e={}){this.config={...F,...e}}async get(e,s){return Dr(e,s,"image",this.config)}async set(e,s,r){return Lr(e,s,r,"image",this.config)}async clear(){return jr("image",this.config)}updateConfig(e){this.config={...this.config,...e}}}var w=null;function v(e){if(!w)w=new Di(e);else if(e)w.updateConfig(e);return w}async function Li(e,s,r){let t=r?{directory:`${r.outputDir}/../.cache`}:{};return v(t).get(e,s)}async function ji(e,s,r,t){let a=t?{directory:`${t.outputDir}/../.cache`}:{};return v(a).set(e,s,r)}async function Mg(){return v().clear()}async function x(){try{return await import("ts-images")}catch{return null}}function R(e){switch(e){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function k(e,s){let r=s?R(s):R("web"),t=e.formatQuality||{};return{jpeg:{...r.jpeg,...t.jpeg},png:{...r.png,...t.png},webp:{...r.webp,...t.webp},avif:{...r.avif,...t.avif}}}async function Dg(e,s,r){let t=await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:e,processed:!1};let a=await Li(e,s,r);if(a)return a;try{let c=S(e);if(!await L(c))return{src:e,processed:!1,errors:[`Source file not found: ${e}`]};let n=k(r,s.preset),p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await q(p,{recursive:!0});let d=await H(c),P=z(e,j(e)),b=s.outputFormat?[s.outputFormat]:r.defaultFormats||["avif","webp","jpeg"],o={src:e,processed:!0,variants:[],hash:d},u=null;if(s.transformations&&s.transformations.length>0)u=await El(c,s.transformations,t);for(let i of b){let l=n[i]||{},g=`${P}-${d}.${i}`,h=T(p,g);try{let m=await t.optimizeImage({input:u||c,output:h,format:i,quality:l.quality,progressive:l.progressive});if(m){if(o.variants.push({path:h,url:`${I}/${g}`,width:m.width||0,height:m.height||0,format:i,size:m.outputSize||0}),!o.originalWidth&&m.width)o.originalWidth=m.width,o.originalHeight=m.height}}catch(m){o.errors=o.errors||[],o.errors.push(`Failed to optimize ${i}: ${m}`)}}if(s.embedThumbhash||s.placeholder==="thumbhash")try{let i=await t.generateThumbHash(c);o.placeholder=i.dataUrl}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to generate thumbhash: ${i}`)}if(s.useDominantColor)try{let i=await t.generatePlaceholder(c,{strategy:"dominant-color"});o.dominantColor=i.dominantColor}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to extract dominant color: ${i}`)}return await ji(e,s,o,r),o}catch(c){return{src:e,processed:!1,errors:[`Processing failed: ${c}`]}}}async function Lg(e,s,r,t){let a=await x();if(!a)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await a.optimizeImage({input:e,output:t,format:s,quality:r}))?.outputSize}}catch(c){return{success:!1,error:String(c)}}}async function El(e,s,r){let t=r||await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let a=await t.decode(e);for(let c of s){let n=c.options||{};switch(c.type){case"resize":if(n.width||n.height)a=await t.resize(a,{width:n.width,height:n.height,fit:n.fit});break;case"blur":if(n.sigma!==void 0)a=await t.blur(a,n.sigma);break;case"sharpen":if(n.amount!==void 0)a=await t.sharpen(a,n.amount);break;case"grayscale":a=await t.grayscale(a);break;case"rotate":if(n.angle!==void 0)a=await t.rotate(a,n.angle);break;case"flip":a=await t.flip(a);break;case"flop":a=await t.flop(a);break;case"brightness":if(n.value!==void 0)a=await t.brightness(a,n.value);break;case"contrast":if(n.value!==void 0)a=await t.contrast(a,n.value);break;case"saturation":if(n.value!==void 0)a=await t.saturation(a,n.value);break}}return await t.encode(a,"png")}catch(a){return console.error(`[stx-media] Transformation failed: ${a}`),null}}import{resolve as E,basename as D,extname as Q,join as U}from"path";import{mkdir as V}from"fs/promises";async function O(){try{return await import("ts-images")}catch{return null}}var A=[320,480,640,768,1024,1280,1536,1920];async function jg(e,s,r){let t=await O();if(!t)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let a=E(e);if(!await L(a))return console.warn(`[stx-media] Source file not found: ${e}`),null;try{let c=s.responsiveWidths||r.breakpoints||A,n=s.formats||r.defaultFormats||["avif","webp","jpeg"],p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await V(p,{recursive:!0});let d=await H(a),P=D(e,Q(e)),b=r.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},o={src:e,byFormat:{},srcsets:{}};for(let i of n){o.byFormat[i]=[];let l=[];for(let g of c){let h=`${P}-${g}w-${d}.${i}`,m=U(p,h),y=`${I}/${h}`;try{let C=b[i]?.quality||80;if(await L(m)){o.byFormat[i].push({path:m,url:y,width:g,height:0,format:i,size:0}),l.push(`${y} ${g}w`);continue}let f=await t.processImage({input:a,output:m,format:i,quality:C,resize:{width:g}});if(f)o.byFormat[i].push({path:m,url:y,width:g,height:f.height||Math.round(g*(f.height||1)/(f.width||1)),format:i,size:f.outputSize||0}),l.push(`${y} ${g}w`)}catch(C){console.warn(`[stx-media] Failed to generate ${i} at ${g}w: ${C}`)}}o.srcsets[i]=l.join(", ")}let u=s.placeholder||r.placeholderStrategy||"thumbhash";if(u!=="none")try{if(u==="thumbhash"){let i=await t.generateThumbHash(a);o.placeholder={dataURL:i.dataUrl,width:i.width||32,height:i.height||32,strategy:"thumbhash"}}else{let i=await t.generatePlaceholder(a,{strategy:u,width:20});o.placeholder={dataURL:i.dataURL,width:i.width,height:i.height,strategy:u}}}catch(i){console.warn(`[stx-media] Failed to generate placeholder: ${i}`)}return o.sizes=s.sizes||B(c),o}catch(c){return console.error(`[stx-media] Responsive generation failed: ${c}`),null}}function B(e){let s=[...e].sort((t,a)=>t-a),r=[];for(let t=0;t<s.length-1;t++){let a=s[t];r.push(`(max-width: ${a}px) ${a}px`)}return r.push(`${s[s.length-1]}px`),r.join(", ")}function Bg(e,s="width"){if(!e||e.length===0)return"";if(s==="dpr")return e.filter((r)=>r.dpr).map((r)=>`${r.url} ${r.dpr}x`).join(", ");return e.map((r)=>`${r.url} ${r.width}w`).join(", ")}export{Di,Li,ji,Mg,Dg,Lg,El,jg,Bg};
2
+ import{H,L,Mr,Lr,jr}from"./chunk-fg80w4zk.js";import{resolve as S,basename as z,extname as j,join as T}from"path";import{mkdir as q}from"fs/promises";var F={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class Mi{config;constructor(e={}){this.config={...F,...e}}async get(e,s){return Mr(e,s,"image",this.config)}async set(e,s,r){return Lr(e,s,r,"image",this.config)}async clear(){return jr("image",this.config)}updateConfig(e){this.config={...this.config,...e}}}var w=null;function v(e){if(!w)w=new Mi(e);else if(e)w.updateConfig(e);return w}async function Li(e,s,r){let t=r?{directory:`${r.outputDir}/../.cache`}:{};return v(t).get(e,s)}async function ji(e,s,r,t){let a=t?{directory:`${t.outputDir}/../.cache`}:{};return v(a).set(e,s,r)}async function Dg(){return v().clear()}async function x(){try{return await import("ts-images")}catch{return null}}function R(e){switch(e){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function k(e,s){let r=s?R(s):R("web"),t=e.formatQuality||{};return{jpeg:{...r.jpeg,...t.jpeg},png:{...r.png,...t.png},webp:{...r.webp,...t.webp},avif:{...r.avif,...t.avif}}}async function Mg(e,s,r){let t=await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:e,processed:!1};let a=await Li(e,s,r);if(a)return a;try{let c=S(e);if(!await L(c))return{src:e,processed:!1,errors:[`Source file not found: ${e}`]};let n=k(r,s.preset),p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await q(p,{recursive:!0});let d=await H(c),P=z(e,j(e)),b=s.outputFormat?[s.outputFormat]:r.defaultFormats||["avif","webp","jpeg"],o={src:e,processed:!0,variants:[],hash:d},u=null;if(s.transformations&&s.transformations.length>0)u=await El(c,s.transformations,t);for(let i of b){let l=n[i]||{},g=`${P}-${d}.${i}`,h=T(p,g);try{let m=await t.optimizeImage({input:u||c,output:h,format:i,quality:l.quality,progressive:l.progressive});if(m){if(o.variants.push({path:h,url:`${I}/${g}`,width:m.width||0,height:m.height||0,format:i,size:m.outputSize||0}),!o.originalWidth&&m.width)o.originalWidth=m.width,o.originalHeight=m.height}}catch(m){o.errors=o.errors||[],o.errors.push(`Failed to optimize ${i}: ${m}`)}}if(s.embedThumbhash||s.placeholder==="thumbhash")try{let i=await t.generateThumbHash(c);o.placeholder=i.dataUrl}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to generate thumbhash: ${i}`)}if(s.useDominantColor)try{let i=await t.generatePlaceholder(c,{strategy:"dominant-color"});o.dominantColor=i.dominantColor}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to extract dominant color: ${i}`)}return await ji(e,s,o,r),o}catch(c){return{src:e,processed:!1,errors:[`Processing failed: ${c}`]}}}async function Lg(e,s,r,t){let a=await x();if(!a)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await a.optimizeImage({input:e,output:t,format:s,quality:r}))?.outputSize}}catch(c){return{success:!1,error:String(c)}}}async function El(e,s,r){let t=r||await x();if(!t)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let a=await t.decode(e);for(let c of s){let n=c.options||{};switch(c.type){case"resize":if(n.width||n.height)a=await t.resize(a,{width:n.width,height:n.height,fit:n.fit});break;case"blur":if(n.sigma!==void 0)a=await t.blur(a,n.sigma);break;case"sharpen":if(n.amount!==void 0)a=await t.sharpen(a,n.amount);break;case"grayscale":a=await t.grayscale(a);break;case"rotate":if(n.angle!==void 0)a=await t.rotate(a,n.angle);break;case"flip":a=await t.flip(a);break;case"flop":a=await t.flop(a);break;case"brightness":if(n.value!==void 0)a=await t.brightness(a,n.value);break;case"contrast":if(n.value!==void 0)a=await t.contrast(a,n.value);break;case"saturation":if(n.value!==void 0)a=await t.saturation(a,n.value);break}}return await t.encode(a,"png")}catch(a){return console.error(`[stx-media] Transformation failed: ${a}`),null}}import{resolve as E,basename as D,extname as Q,join as U}from"path";import{mkdir as V}from"fs/promises";async function O(){try{return await import("ts-images")}catch{return null}}var A=[320,480,640,768,1024,1280,1536,1920];async function jg(e,s,r){let t=await O();if(!t)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let a=E(e);if(!await L(a))return console.warn(`[stx-media] Source file not found: ${e}`),null;try{let c=s.responsiveWidths||r.breakpoints||A,n=s.formats||r.defaultFormats||["avif","webp","jpeg"],p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await V(p,{recursive:!0});let d=await H(a),P=D(e,Q(e)),b=r.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},o={src:e,byFormat:{},srcsets:{}};for(let i of n){o.byFormat[i]=[];let l=[];for(let g of c){let h=`${P}-${g}w-${d}.${i}`,m=U(p,h),y=`${I}/${h}`;try{let C=b[i]?.quality||80;if(await L(m)){o.byFormat[i].push({path:m,url:y,width:g,height:0,format:i,size:0}),l.push(`${y} ${g}w`);continue}let f=await t.processImage({input:a,output:m,format:i,quality:C,resize:{width:g}});if(f)o.byFormat[i].push({path:m,url:y,width:g,height:f.height||Math.round(g*(f.height||1)/(f.width||1)),format:i,size:f.outputSize||0}),l.push(`${y} ${g}w`)}catch(C){console.warn(`[stx-media] Failed to generate ${i} at ${g}w: ${C}`)}}o.srcsets[i]=l.join(", ")}let u=s.placeholder||r.placeholderStrategy||"thumbhash";if(u!=="none")try{if(u==="thumbhash"){let i=await t.generateThumbHash(a);o.placeholder={dataURL:i.dataUrl,width:i.width||32,height:i.height||32,strategy:"thumbhash"}}else{let i=await t.generatePlaceholder(a,{strategy:u,width:20});o.placeholder={dataURL:i.dataURL,width:i.width,height:i.height,strategy:u}}}catch(i){console.warn(`[stx-media] Failed to generate placeholder: ${i}`)}return o.sizes=s.sizes||B(c),o}catch(c){return console.error(`[stx-media] Responsive generation failed: ${c}`),null}}function B(e){let s=[...e].sort((t,a)=>t-a),r=[];for(let t=0;t<s.length-1;t++){let a=s[t];r.push(`(max-width: ${a}px) ${a}px`)}return r.push(`${s[s.length-1]}px`),r.join(", ")}function Bg(e,s="width"){if(!e||e.length===0)return"";if(s==="dpr")return e.filter((r)=>r.dpr).map((r)=>`${r.url} ${r.dpr}x`).join(", ");return e.map((r)=>`${r.url} ${r.width}w`).join(", ")}export{Mi,Li,ji,Dg,Mg,Lg,El,jg,Bg};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Se,bi,wi,lg,Dt,Jc,ug,Yc,Zh,Le,vn,je}from"./chunk-vbw9jhz2.js";import{sl,s}from"./chunk-x4f7efgp.js";import"./chunk-p65ax8s0.js";import"./chunk-8370x30n.js";import"./chunk-89d3h8mp.js";import"./chunk-zjqvbcwa.js";import"./chunk-23r3rby6.js";export{Se as BROWSER_CORE_IMPORTS,lg as STX_AUTO_IMPORTS,bi as extractAndStripCssImports,Le as extractBridgeData,sl as findInterpolationEnd,Yc as generateAutoImportDestructuring,Zh as generateBrowserAutoImportDestructuring,vn as generateServerDataBridge,Dt as injectBrowserCoreAutoImports,je as processClientScript,ug as referencesName,wi as renderVendorStyleTags,s as stripCommentsAndLiterals,Jc as transformAutoImports};
2
+ import{Se,bi,wi,lg,Mt,Jc,ug,Yc,Zh,Le,vn,je}from"./chunk-y5k93ysf.js";import{sl,s}from"./chunk-x4f7efgp.js";import"./chunk-20ep26hg.js";import"./chunk-fvmd4kk6.js";import"./chunk-cqwhafc9.js";import"./chunk-zjqvbcwa.js";import"./chunk-fx094pwg.js";export{Se as BROWSER_CORE_IMPORTS,lg as STX_AUTO_IMPORTS,bi as extractAndStripCssImports,Le as extractBridgeData,sl as findInterpolationEnd,Yc as generateAutoImportDestructuring,Zh as generateBrowserAutoImportDestructuring,vn as generateServerDataBridge,Mt as injectBrowserCoreAutoImports,je as processClientScript,ug as referencesName,wi as renderVendorStyleTags,s as stripCommentsAndLiterals,Jc as transformAutoImports};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{AsyncLocalStorage as R}from"async_hooks";var b=Symbol.for("stx.runtime-config.scope"),y=globalThis,m=y[b]??=new R;function He(n,f){return m.run(n,f)}function _n(){return m.getStore()}function Ks(){let n=m.getStore();if(!n)throw Error("useServerRuntimeConfig requires a server request or template render");return Object.freeze(Object.defineProperty({public:n.public},"private",{value:n.private}))}function _i(){return Ks().public}function M(n={},f=process.env){let s=new Set;function o(e,i){if(i===null)return e===null;if(Array.isArray(i))return Array.isArray(e)&&(!i.length||e.every((r)=>i.some((u)=>o(r,u))));if(typeof i==="object")return e!==null&&typeof e==="object"&&!Array.isArray(e)&&Object.entries(i).every(([r,u])=>Object.hasOwn(e,r)&&o(e[r],u));return typeof e===typeof i}function g(e,i){if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`);let t=Object.create(null);for(let[c,l]of Object.entries(e)){if(!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(c)||["constructor","prototype","__proto__"].includes(c))throw TypeError(`Invalid runtime config key: ${c}`);t[c]=g(l,[...i,c])}return Object.freeze(t)}let r=`STX_RUNTIME_${i.map((t)=>t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toUpperCase()).join("__")}`;if(s.has(r))throw TypeError(`Ambiguous runtime config environment key: ${r}`);s.add(r);let u=f[r],a=e;if(u!==void 0){try{a=typeof e==="string"?u:JSON.parse(u)}catch{throw TypeError(`Invalid runtime config override: ${r}`)}if(!o(a,e))throw TypeError(`Wrong runtime config override type: ${r}`)}function p(t){if(t===null||typeof t==="string"||typeof t==="boolean")return t;if(typeof t==="number"&&Number.isFinite(t))return t;if(Array.isArray(t))return Object.freeze(t.map(p));if(t&&typeof t==="object"&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null))return Object.freeze(Object.fromEntries(Object.entries(t).map(([c,l])=>[c,p(l)])));throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`)}return p(a)}return Object.freeze({public:g(n.public??{},["public"]),private:g(n.private??{},["private"])})}function C(n){return`<script data-stx-scoped data-stx-runtime-config type="application/json">${JSON.stringify(n.public).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function jt(n,f){let s=n.replace(/<script\b[^>]*\bdata-stx-runtime-config\b[^>]*>[\s\S]*?<\/script>/gi,""),o=/<head\b[^>]*>/i.exec(s),g=o?o.index+o[0].length:0;return s.slice(0,g)+C(f)+s.slice(g)}
3
- export{He,_n,Ks,_i,M,jt};
2
+ import{AsyncLocalStorage as R}from"async_hooks";var b=Symbol.for("stx.runtime-config.scope"),y=globalThis,m=y[b]??=new R;function He(n,f){return m.run(n,f)}function _n(){return m.getStore()}function Ks(){let n=m.getStore();if(!n)throw Error("useServerRuntimeConfig requires a server request or template render");return Object.freeze(Object.defineProperty({public:n.public},"private",{value:n.private}))}function _i(){return Ks().public}function D(n={},f=process.env){let s=new Set;function o(e,i){if(i===null)return e===null;if(Array.isArray(i))return Array.isArray(e)&&(!i.length||e.every((r)=>i.some((u)=>o(r,u))));if(typeof i==="object")return e!==null&&typeof e==="object"&&!Array.isArray(e)&&Object.entries(i).every(([r,u])=>Object.hasOwn(e,r)&&o(e[r],u));return typeof e===typeof i}function g(e,i){if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`);let t=Object.create(null);for(let[c,l]of Object.entries(e)){if(!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(c)||["constructor","prototype","__proto__"].includes(c))throw TypeError(`Invalid runtime config key: ${c}`);t[c]=g(l,[...i,c])}return Object.freeze(t)}let r=`STX_RUNTIME_${i.map((t)=>t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toUpperCase()).join("__")}`;if(s.has(r))throw TypeError(`Ambiguous runtime config environment key: ${r}`);s.add(r);let u=f[r],a=e;if(u!==void 0){try{a=typeof e==="string"?u:JSON.parse(u)}catch{throw TypeError(`Invalid runtime config override: ${r}`)}if(!o(a,e))throw TypeError(`Wrong runtime config override type: ${r}`)}function p(t){if(t===null||typeof t==="string"||typeof t==="boolean")return t;if(typeof t==="number"&&Number.isFinite(t))return t;if(Array.isArray(t))return Object.freeze(t.map(p));if(t&&typeof t==="object"&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null))return Object.freeze(Object.fromEntries(Object.entries(t).map(([c,l])=>[c,p(l)])));throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`)}return p(a)}return Object.freeze({public:g(n.public??{},["public"]),private:g(n.private??{},["private"])})}function C(n){return`<script data-stx-scoped data-stx-runtime-config type="application/json">${JSON.stringify(n.public).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function jt(n,f){let s=n.replace(/<script\b[^>]*\bdata-stx-runtime-config\b[^>]*>[\s\S]*?<\/script>/gi,""),o=/<head\b[^>]*>/i.exec(s),g=o?o.index+o[0].length:0;return s.slice(0,g)+C(f)+s.slice(g)}
3
+ export{He,_n,Ks,_i,D,jt};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import l from"fs";import u from"path";var m=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],x=3;function h(e,t){let r=u.resolve(u.dirname(t),e);for(let o of b){let s=r+o;try{if(l.statSync(s).isFile())return s}catch{}}return null}function Mr(e,t,r=0,o=new Set){if(!t||r>=x)return!1;for(let s of e.matchAll(g)){let n=h(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=l.readFileSync(n,"utf8")}catch{continue}if(m.test(i))return!0;if(Mr(i,n,r+1,o))return!0}return!1}var k=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useBroadcastStream","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useNativeDesktop","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],fl=["onMount","onDestroy"];function ct(e="const",t=[],r){let o=t.length?k.filter((s)=>!t.includes(s)):k;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var y=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=k.filter((e)=>!y.includes(e));function Ii(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],E=/\s@[a-z][\w.:-]*\s*=/i;function gl(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(Ii(e))return!0;return T(e,t)}function T(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(Mr(r[1],t))return!0;return!1}function ml(e,t){if(!e)return!1;let r=f(e);return E.test(r)||d(r,t)}var R=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function hl(e){return R.includes(e.toLowerCase())}var eo=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],_=["x-init","x-transition","x-effect","x-on"],yl=[...eo,..._];function bl(){return`{${eo.map((e)=>`'${e}':1`).join(",")}}`}var Oi=["class","style","text","html","show","model","if","ref"];function wl(){return`{${Oi.map((e)=>e==="if"?"'if':1":`${e}:1`).join(",")}}`}var p=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","keydown","keyup","keypress","input","change","submit","focus","blur","scroll","resize","touchstart","touchend","touchmove","contextmenu","wheel","pointerdown","pointerup","pointermove"];function vl(){return`/^(${p.join("|")})(?:\\.|$)/`}function xl(e){return p.some((t)=>e===t||e.startsWith(`${t}.`))}var w=65536,A=4,c=new Map;function f(e){if(!e)return e;if(!e.includes("<!--")&&!/<(?:pre|code)\b/i.test(e))return e;let t=e.length>=w;if(t){let s=c.get(e);if(s!==void 0)return s}let r=(s)=>s.replace(/(<[^>]*>)|([^<]+)/g,(n,i,a)=>i??" ".repeat(a.length)),o=e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/<!--[\s\S]*?-->/g,(s)=>" ".repeat(s.length));if(t){while(c.size>=A){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
3
- export{Mr,k,fl,ct,Ii,gl,ml,hl,eo,yl,bl,Oi,wl,vl,xl};
2
+ import l from"fs";import u from"path";var m=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],x=3;function h(e,t){let r=u.resolve(u.dirname(t),e);for(let o of b){let s=r+o;try{if(l.statSync(s).isFile())return s}catch{}}return null}function Dr(e,t,r=0,o=new Set){if(!t||r>=x)return!1;for(let s of e.matchAll(g)){let n=h(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=l.readFileSync(n,"utf8")}catch{continue}if(m.test(i))return!0;if(Dr(i,n,r+1,o))return!0}return!1}var k=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useBroadcastStream","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useNativeDesktop","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],fl=["onMount","onDestroy"];function ct(e="const",t=[],r){let o=t.length?k.filter((s)=>!t.includes(s)):k;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var y=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=k.filter((e)=>!y.includes(e));function Ii(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],E=/\s@[a-z][\w.:-]*\s*=/i;function gl(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(Ii(e))return!0;return T(e,t)}function T(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(Dr(r[1],t))return!0;return!1}function ml(e,t){if(!e)return!1;let r=f(e);return E.test(r)||d(r,t)}var R=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function hl(e){return R.includes(e.toLowerCase())}var eo=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],_=["x-init","x-transition","x-effect","x-on"],yl=[...eo,..._];function bl(){return`{${eo.map((e)=>`'${e}':1`).join(",")}}`}var Oi=["class","style","text","html","show","model","if","ref"];function wl(){return`{${Oi.map((e)=>e==="if"?"'if':1":`${e}:1`).join(",")}}`}var p=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","keydown","keyup","keypress","input","change","submit","focus","blur","scroll","resize","touchstart","touchend","touchmove","contextmenu","wheel","pointerdown","pointerup","pointermove"];function vl(){return`/^(${p.join("|")})(?:\\.|$)/`}function xl(e){return p.some((t)=>e===t||e.startsWith(`${t}.`))}var w=65536,A=4,c=new Map;function f(e){if(!e)return e;if(!e.includes("<!--")&&!/<(?:pre|code)\b/i.test(e))return e;let t=e.length>=w;if(t){let s=c.get(e);if(s!==void 0)return s}let r=(s)=>s.replace(/(<[^>]*>)|([^<]+)/g,(n,i,a)=>i??" ".repeat(a.length)),o=e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/<!--[\s\S]*?-->/g,(s)=>" ".repeat(s.length));if(t){while(c.size>=A){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
3
+ export{Dr,k,fl,ct,Ii,gl,ml,hl,eo,yl,bl,Oi,wl,vl,xl};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{q,Me}from"./chunk-vbw9jhz2.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function tn(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Me(t,s);if(p>s){c=p;continue}let a=q(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
2
+ import{q,De}from"./chunk-y5k93ysf.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function tn(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=De(t,s);if(p>s){c=p;continue}let a=q(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
3
3
  export{tn};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Zg}from"./chunk-fgxydvt9.js";import"./chunk-ph9f3hwk.js";import"./chunk-fzkjm2g2.js";import"./chunk-wr1werwe.js";import"./chunk-ajq3fnxc.js";import"./chunk-694w19gx.js";import"./chunk-m87qhcsz.js";import"./chunk-er5tdp6k.js";import"./chunk-11y84h2d.js";import"./chunk-4657mnht.js";import"./chunk-0pghy8kw.js";import"./chunk-2j5yane9.js";import"./chunk-y5k93ysf.js";import"./chunk-20ep26hg.js";import"./chunk-fvmd4kk6.js";import"./chunk-cqwhafc9.js";import"./chunk-zjqvbcwa.js";import"./chunk-fx094pwg.js";export{Zg as startProductionServer};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{pe,Fc,Hs,bn,m,Le,je}from"./chunk-vbw9jhz2.js";import{fr,et,F}from"./chunk-chjdnmqv.js";import{sr,i}from"./chunk-57x8wxdf.js";import{ve}from"./chunk-xqtt5t6d.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];g(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];g(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function g(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,o=t+u[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:g}=fr(s),a=await(e.renderer??((n)=>et(n)))(g);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=pe(s);if(r)e=r.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),u;while((u=g.exec(s))!==null){let o=u[1],l=u[2],d=u[0],f=o.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),o.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
2
+ import{pe,Fc,Hs,bn,m,Le,je}from"./chunk-y5k93ysf.js";import{fr,et,F}from"./chunk-m87qhcsz.js";import{sr,i}from"./chunk-51r39yw4.js";import{ve}from"./chunk-694w19gx.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];g(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];g(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function g(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,o=t+u[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:g}=fr(s),a=await(e.renderer??((n)=>et(n)))(g);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=pe(s);if(r)e=r.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),u;while((u=g.exec(s))!==null){let o=u[1],l=u[2],d=u[0],f=o.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),o.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -14,5 +14,5 @@ ${a.join(`
14
14
  `)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=Le(p),d=await Promise.all(a.map(async(w)=>{let C=w.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(C))return w;let h=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!h)return w;return await je(h[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),x=[await sr(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
15
15
  `);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${x}
16
16
  $1`);else t+=`
17
- ${x}`}t=await ve(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-4rswqcfc.js");t=await o(t)}catch{}return t}
17
+ ${x}`}t=await ve(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-38cj6zgb.js");t=await o(t)}catch{}return t}
18
18
  export{Za};
@@ -387,5 +387,5 @@ else {
387
387
  <script type="application/json" id="stx-island-manifest">
388
388
  ${JSON.stringify(t)}
389
389
  </script>
390
- `}var Mm={processPartialHydrationDirectives:eu,processStaticDirectives:au,generatePartialHydrationCSS:tu,generateIslandManifest:cu,createIslandRegistry:Ql,hydrateIsland:nu,hydrateByStrategy:ru,hydrateAll:su,isHydrated:ou,onHydrated:iu};
391
- export{Ql,eu,tu,nu,ru,su,ou,iu,au,cu,Mm};
390
+ `}var Dm={processPartialHydrationDirectives:eu,processStaticDirectives:au,generatePartialHydrationCSS:tu,generateIslandManifest:cu,createIslandRegistry:Ql,hydrateIsland:nu,hydrateByStrategy:ru,hydrateAll:su,isHydrated:ou,onHydrated:iu};
391
+ export{Ql,eu,tu,nu,ru,su,ou,iu,au,cu,Dm};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{a}from"./chunk-chjdnmqv.js";import{wo}from"./chunk-bp918end.js";import p from"path";async function Yg(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(wo(o),!e.ssr&&Object.keys(o).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let u,n;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");u=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-vv7b8p5z.js");n=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let d=Math.round(performance.now()-l);return{mode:r,ssg:u,ssr:n,duration:d}}
2
+ import{a}from"./chunk-m87qhcsz.js";import{wo}from"./chunk-py5x8fkq.js";import p from"path";async function Yg(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(wo(o),!e.ssr&&Object.keys(o).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let u,n;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");u=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-0bacm8xg.js");n=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let d=Math.round(performance.now()-l);return{mode:r,ssg:u,ssr:n,duration:d}}
3
3
  export{Yg};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{T,u,f,P,d,K}from"./chunk-89d3h8mp.js";import{V,Os,Ne,pe,Pt,Cr,Be,Fe,r,h,ke,_}from"./chunk-vbw9jhz2.js";import{ct}from"./chunk-23r3rby6.js";import{I}from"./chunk-zjqvbcwa.js";import{oe}from"./chunk-1b1ntgt7.js";import{B,Ze}from"./chunk-ybq56wam.js";import{E,Tn}from"./chunk-7vhm0jj5.js";import C from"path";import{existsSync as ye}from"fs";function ae(c,e){let a=0;for(let n=e;n<c.length;n++){let y=c[n];if(y==="("||y==="["||y==="{")a++;else if(y===")"||y==="]"||y==="}")a--;else if(y===","&&a===0)return n}return-1}function $e(c,e,a){let n=c,y=new RegExp(`${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),s=y.exec(n);while(s){let g=s.index,t=g+s[0].length-1,D=1,W=t+1;while(W<n.length&&D>0){if(n[W]==="(")D++;else if(n[W]===")")D--;W++}if(D!==0)break;let re=n.substring(t+1,W-1),N=`${a}(${re})`;n=n.substring(0,g)+N+n.substring(W),y.lastIndex=g+N.length,s=y.exec(n)}return n}function Ee(c){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(c)}function he(c){let e=c,a=[],n=new Set,y=0,s=0,g=e.length,t=(N)=>{s++;while(s<g){if(e[s]==="\\"){s+=2;continue}if(e[s]===N){s++;return}s++}},D=()=>{s++;while(s<g){if(e[s]==="\\"){s+=2;continue}if(e[s]==="`"){s++;return}if(e[s]==="$"&&e[s+1]==="{"){s+=2;let N=1;while(s<g&&N>0)if(e[s]==="{")N++,s++;else if(e[s]==="}")N--,s++;else if(e[s]==="'"||e[s]==='"')t(e[s]);else if(e[s]==="`")D();else s++;continue}s++}},W=()=>{if(e[s]==="/"&&e[s+1]==="/"){while(s<g&&e[s]!==`
2
+ import{T,u,f,P,d,K}from"./chunk-cqwhafc9.js";import{V,Os,Ne,pe,Pt,Cr,Be,Fe,r,h,ke,_}from"./chunk-y5k93ysf.js";import{ct}from"./chunk-fx094pwg.js";import{I}from"./chunk-zjqvbcwa.js";import{oe}from"./chunk-4y1a7nbm.js";import{B,Ze}from"./chunk-ybq56wam.js";import{E,Tn}from"./chunk-7vhm0jj5.js";import C from"path";import{existsSync as ye}from"fs";function ae(c,e){let a=0;for(let n=e;n<c.length;n++){let y=c[n];if(y==="("||y==="["||y==="{")a++;else if(y===")"||y==="]"||y==="}")a--;else if(y===","&&a===0)return n}return-1}function $e(c,e,a){let n=c,y=new RegExp(`${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),s=y.exec(n);while(s){let g=s.index,t=g+s[0].length-1,D=1,W=t+1;while(W<n.length&&D>0){if(n[W]==="(")D++;else if(n[W]===")")D--;W++}if(D!==0)break;let re=n.substring(t+1,W-1),N=`${a}(${re})`;n=n.substring(0,g)+N+n.substring(W),y.lastIndex=g+N.length,s=y.exec(n)}return n}function Ee(c){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(c)}function he(c){let e=c,a=[],n=new Set,y=0,s=0,g=e.length,t=(N)=>{s++;while(s<g){if(e[s]==="\\"){s+=2;continue}if(e[s]===N){s++;return}s++}},D=()=>{s++;while(s<g){if(e[s]==="\\"){s+=2;continue}if(e[s]==="`"){s++;return}if(e[s]==="$"&&e[s+1]==="{"){s+=2;let N=1;while(s<g&&N>0)if(e[s]==="{")N++,s++;else if(e[s]==="}")N--,s++;else if(e[s]==="'"||e[s]==='"')t(e[s]);else if(e[s]==="`")D();else s++;continue}s++}},W=()=>{if(e[s]==="/"&&e[s+1]==="/"){while(s<g&&e[s]!==`
3
3
  `)s++;return!0}if(e[s]==="/"&&e[s+1]==="*"){s+=2;while(s<g-1&&!(e[s]==="*"&&e[s+1]==="/"))s++;return s+=2,!0}return!1},re=()=>{if(y!==0)return;let N=e.slice(s).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(N){let Z=N[2];if(!n.has(Z))a.push(Z),n.add(Z);return}let te=e.slice(s).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(te){let Z=te[1];if(!n.has(Z))a.push(Z),n.add(Z);return}let Y=e.slice(s).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let Z=Y[1];if(!n.has(Z))a.push(Z),n.add(Z)}};while(s<g){if(W())continue;if(e[s]==="'"||e[s]==='"'){t(e[s]);continue}if(e[s]==="`"){D();continue}if(e[s]==="{"){y++,s++;continue}if(e[s]==="}"){y--,s++;continue}if(y===0&&/[a-z]/i.test(e[s])&&(s===0||/\s|[;{}()]/.test(e[s-1])))re();s++}return a.join(", ")}function ve(c,e=""){let a=he(c).split(",").map((n)=>n.trim()).filter(Boolean);return`
4
4
  (function() {
5
5
  ${ct("var",a)}
@@ -44,11 +44,11 @@ ${s}
44
44
  }
45
45
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
46
46
  }
47
- })();`;return a+c+n}function Te(c,e){if(B(c)){let s=B(c).tag.match(/data-stx-scope="([^"]*)"/);if(s)return{html:c,mergedIntoExisting:s[1],stamped:!0,root:"body"};return{html:Ze(c,(g,t)=>`<body${t} data-stx-scope="${e}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let a=Pt(c),n=c.slice(a).match(/^(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(n){let y=n[1]+n[2],s=n[1].slice(1),g=y.match(/data-stx-scope="([^"]*)"/);if(g)return{html:c,mergedIntoExisting:g[1],stamped:!0,root:s};let t=c.slice(0,a),D=n[1],W=n[2];return{html:`${t}${D} data-stx-scope="${e}"${W}${c.slice(a+n[0].length)}`,mergedIntoExisting:null,stamped:!0,root:s}}return{html:c,mergedIntoExisting:null,stamped:!1,root:null}}var Ae=0;function fe(c,e){let a=C.basename(c,".stx").replace(/[^a-zA-Z0-9]/g,"_"),n=e.__stx_scope_seq;return n?`stx_scope_${a}_${++n.n}_${n.key}`:`stx_scope_${a}_${++Ae}`}var le=new Set,de=new Set;function Oh(){le.clear(),de.clear()}var Ce=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Mf(c){let e=(t)=>t.replace(/[^\n]/g," "),a=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,e).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,e).replace(/<!--[\s\S]*?-->/g,e).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,e).replace(/\{\{[\s\S]*?\}\}/g,e).replace(/\{!![\s\S]*?!!\}/g,e),n=[],y=0,s=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=s.exec(a))!==null){let t=g[1]==="/",D=g[2],W=g[3]==="/"||Ce.has(D.toLowerCase());if(t){y=Math.max(0,y-1);continue}if(y===0)n.push(D);if(!W)y++}return n}function me(c){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(c)}var Ye=new T(500),lc=new Set;function Nh(){lc.clear()}function De(c){if(c.__onceStore instanceof Set)return c.__onceStore;return lc}async function cs(c,e,a,n,y,s=new Set){let g=n.partialsDir||C.join(C.dirname(a),"partials");if(g&&!C.isAbsolute(g))g=C.resolve(process.cwd(),g);let t=$e(c,"@partial","@include"),D=De(e);t=t.replace(/@once([\s\S]*?)@endonce/g,(m,k,x)=>{let p=k.trim(),i=`${a}:${p}`;if(D.has(i))return"";return D.add(i),k});{let m=/@includeIf\s*\(/g,k;while((k=m.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,w=p+1;while(w<t.length&&i>0){if(t[w]==="(")i++;else if(t[w]===")")i--;w++}if(i!==0)break;let l=t.substring(p+1,w-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){m.lastIndex=w;continue}let O=o[1],z=W(O,g,a),R="";if(z&&await Bun.file(z).exists())y.add(z),R=`@include(${l})`;t=t.substring(0,x)+R+t.substring(w),m.lastIndex=0}}for(let[m,k]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(t))!==null){let i=p.index,w=i+p[0].length-1,l=1,o=w+1;while(o<t.length&&l>0){if(t[o]==="(")l++;else if(t[o]===")")l--;o++}if(l!==0)break;let O=t.substring(w+1,o-1),z=ae(O,0);if(z===-1){x.lastIndex=o;continue}let R=O.substring(0,z).trim(),H=O.substring(z+1).trim(),F=H.match(/^\s*['"]([^'"]+)['"]/);if(!F){x.lastIndex=o;continue}let b=F[1],J=H.substring(F[0].length),j,M=ae(J,0);if(M!==-1)j=J.substring(M+1).trim();try{let A=`Boolean(${R})`,L;if(f(A)){let ie=d(A,Object.keys(e));L=Boolean(ie(...Object.values(e)))}else L=Boolean(u(A,e));let ee=k?!L:L,ne="";if(ee){let ie=W(b,g,a);if(ie&&await Bun.file(ie).exists())y.add(ie);ne=`@include('${b}'${j?`, ${j}`:""})`}t=t.substring(0,i)+ne+t.substring(o),x.lastIndex=0}catch(A){let L=A instanceof Error?A.message:String(A),ee=h("Include",`Error evaluating ${m} condition: ${L}`,a,c,i);t=t.substring(0,i)+ee+t.substring(o),x.lastIndex=0}}}{let m=/@each\s*\(/g,k;while((k=m.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,w=p+1;while(w<t.length&&i>0){if(t[w]==="(")i++;else if(t[w]===")"){if(i--,i===0)break}w++}if(i!==0)break;let l=t.substring(p+1,w),o=t.substring(x,w+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){m.lastIndex=0,t=t.replace(o,"");continue}let[,z,R,H,F]=O;try{let b,J=R.trim();if(f(J))b=d(J,Object.keys(e))(...Object.values(e));else b=u(J,e);let j="";if(Array.isArray(b)&&b.length>0)for(let M of b){let A={...e,[H]:M},L=await te(z,A,c,x);j+=L}else if(F)j=await te(F,{},c,x);t=t.substring(0,x)+j+t.substring(w+1),m.lastIndex=0}catch(b){let J=b instanceof Error?b.message:String(b);t=t.substring(0,x)+h("Each",`Error in @each: ${J}`,a,c,x)+t.substring(w+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,k;while((k=m.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,w=p+1;while(w<t.length&&i>0){if(t[w]==="(")i++;else if(t[w]===")"){if(i--,i===0)break}w++}if(i!==0)break;let l=t.substring(p+1,w),o=t.substring(x,w+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){m.lastIndex=0,t=t.replace(o,"");continue}let z=O[1],R=l.slice(O[0].length),H,F=R.match(/^\s*,\s*\{/);if(F){R=R.slice(F[0].length-1);let j=1,M=1;while(M<R.length&&j>0){if(R[M]==="{")j++;else if(R[M]==="}"){if(j--,j===0)break}M++}H=R.substring(0,M+1),R=R.slice(M+1)}let b,J=R.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)b=J[1];try{let j=JSON.parse(z.replace(/'/g,'"')),M={};if(H)try{M=P(H,e)}catch(L){let ee=L instanceof Error?L.message:String(L);if(n.debug){let ne=h("Include",`Error parsing includeFirst variables: ${ee}`,a,c,x,o);t=t.replace(o,()=>ne)}else t=t.replace(o,()=>b||"");continue}let A=!1;for(let L of j){let ee=W(L,g,a);if(!ee)continue;if(await r(ee)){let ne=await te(L,M,c,x);t=t.replace(o,()=>ne),A=!0;break}}if(!A)if(b!==void 0)t=t.replace(o,()=>b);else if(n.debug){let L=h("Include",`None of the includeFirst paths exist: ${z}`,a,c,x,o);t=t.replace(o,()=>L)}else t=t.replace(o,"")}catch(j){let M=j instanceof Error?j.message:String(j),A=h("Include",`Error processing @includeFirst: ${M}`,a,c,x,o);t=t.replace(o,()=>A)}m.lastIndex=0}}function W(m,k,x){try{let p=m;if(!m.endsWith(".stx"))p=`${m}.stx`;let i=C.resolve(k),w=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let F of n._layerPartialDirs??[]){let b=C.resolve(F,p);if(b.startsWith(`${C.resolve(F)}${C.sep}`)&&ye(b))return b}l=C.resolve(k,p)}else l=C.resolve(w,p);let o=C.normalize(l),O=o.startsWith(i+C.sep)||o===i,z=o.startsWith(w+C.sep)||o===w,R=!1,H=C.dirname(w);if(o.startsWith(H+C.sep)){if(!C.relative(H,o).split(C.sep).some((j)=>j.startsWith(".")&&j!=="."&&j!==".."))R=!0}if(!O&&!z&&!R)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${i}, ${w}`),null;return o}catch(p){return console.error(`Error resolving path ${m}: ${p}`),null}}let re=C.resolve(a);s.add(re);function N(m,k,x,p){return n.onIncludeError?.({includePath:m,templatePath:a,message:k,partialsDir:g}),h("Include",k,a,x,p)}async function te(m,k={},x,p){let i=W(m,g,a);if(!i)return N(m,`Could not resolve path for include: ${m}`,x,p);let w=C.resolve(i);if(s.has(w)){let l=[...s,w].map((o)=>C.basename(o)).join(" -> ");return N(m,`Circular include detected: ${l}`,x,p)}try{y.add(i);let l;if(!l)try{l=await Bun.file(i).text()}catch(v){let q=v instanceof Error?v.message:String(v);return N(m,`Error loading include file ${m}: ${q}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:v}=await import("./chunk-p2e02hh7.js");l=v(l,e)}if(l&&(n.debug||!E()&&!Tn()))try{let{warnUnbalancedTags:v}=await import("./chunk-yg5a54pj.js");v(l,i)}catch{}try{let{processESImports:v}=await import("./chunk-b3fx75th.js");l=await v(l,e,i,n,y)}catch(v){if(n.debug)console.warn(`[stx] partial ES import extraction skipped for ${i}:`,v instanceof Error?v.message:v)}let o=l,O=pe(o);if(O)o=O.content.trim();let R=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),H="";if(R)H=`<style${R[1]}>${R[2]}</style>`;let F=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(v,q,S)=>{if(!me(q))return"";return F.push({attrs:q,body:S}),`__STX_DATA_BLOCK_${F.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let b={...e};b.__stx_signals_gate=ke(l,i);for(let[v,q]of Object.entries(k))b[v]=q;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,j=[...l.matchAll(J)].sort((v,q)=>{let S=(v[1]||"").includes("server"),X=(q[1]||"").includes("server");return Number(X)-Number(S)}),M="",A=null,L=!1,ee=!1;for(let v of j){let q=v[1]||"",S=v[2]||"";if(me(q))continue;let X=q.includes("server"),be=Be(q);if(!X&&!/\bsrc\s*=/i.test(q))Ne(S,i,n.strict);if(!X&&S.trim()){let{interpolateScriptExpressions:U}=await import("./chunk-8gdtys3s.js");S=U(S,b,m)}let ce="";try{let{extractAndStripCssImports:U,renderVendorStyleTags:Q}=await import("./chunk-x0ygwk9x.js"),se=U(S,{filePath:i,projectRoot:process.cwd()});S=se.code,ce=Q(se.styles)}catch(U){if(n.debug)console.warn(`[stx] vendor-css extractor skipped for ${i}:`,U instanceof Error?U.message:U)}if(be&&S.trim())S=Fe(S);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-x0ygwk9x.js");S=Q(S).code;let{hasUserImports:se,bundleClientScript:Se}=await import("./chunk-mh4kpnjr.js");if(se(S))S=await Se(S,i,{projectRoot:process.cwd()})}catch(Q){if(n.debug)console.warn(`[stx] bundler skipped for ${i}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:U}=await import("./chunk-qcars8ar.js");S=U(S)}let ge=Ee(S);if(!X){let{extractBridgeData:U,generateServerDataBridge:Q}=await import("./chunk-x0ygwk9x.js"),se=Q(S,U(b));if(se)S=`${se}
47
+ })();`;return a+c+n}function Te(c,e){if(B(c)){let s=B(c).tag.match(/data-stx-scope="([^"]*)"/);if(s)return{html:c,mergedIntoExisting:s[1],stamped:!0,root:"body"};return{html:Ze(c,(g,t)=>`<body${t} data-stx-scope="${e}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let a=Pt(c),n=c.slice(a).match(/^(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(n){let y=n[1]+n[2],s=n[1].slice(1),g=y.match(/data-stx-scope="([^"]*)"/);if(g)return{html:c,mergedIntoExisting:g[1],stamped:!0,root:s};let t=c.slice(0,a),D=n[1],W=n[2];return{html:`${t}${D} data-stx-scope="${e}"${W}${c.slice(a+n[0].length)}`,mergedIntoExisting:null,stamped:!0,root:s}}return{html:c,mergedIntoExisting:null,stamped:!1,root:null}}var Ae=0;function fe(c,e){let a=C.basename(c,".stx").replace(/[^a-zA-Z0-9]/g,"_"),n=e.__stx_scope_seq;return n?`stx_scope_${a}_${++n.n}_${n.key}`:`stx_scope_${a}_${++Ae}`}var le=new Set,de=new Set;function Oh(){le.clear(),de.clear()}var Ce=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Df(c){let e=(t)=>t.replace(/[^\n]/g," "),a=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,e).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,e).replace(/<!--[\s\S]*?-->/g,e).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,e).replace(/\{\{[\s\S]*?\}\}/g,e).replace(/\{!![\s\S]*?!!\}/g,e),n=[],y=0,s=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=s.exec(a))!==null){let t=g[1]==="/",D=g[2],W=g[3]==="/"||Ce.has(D.toLowerCase());if(t){y=Math.max(0,y-1);continue}if(y===0)n.push(D);if(!W)y++}return n}function me(c){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(c)}var Ye=new T(500),lc=new Set;function Nh(){lc.clear()}function De(c){if(c.__onceStore instanceof Set)return c.__onceStore;return lc}async function cs(c,e,a,n,y,s=new Set){let g=n.partialsDir||C.join(C.dirname(a),"partials");if(g&&!C.isAbsolute(g))g=C.resolve(process.cwd(),g);let t=$e(c,"@partial","@include"),D=De(e);t=t.replace(/@once([\s\S]*?)@endonce/g,(m,k,x)=>{let p=k.trim(),i=`${a}:${p}`;if(D.has(i))return"";return D.add(i),k});{let m=/@includeIf\s*\(/g,k;while((k=m.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,w=p+1;while(w<t.length&&i>0){if(t[w]==="(")i++;else if(t[w]===")")i--;w++}if(i!==0)break;let l=t.substring(p+1,w-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){m.lastIndex=w;continue}let O=o[1],z=W(O,g,a),R="";if(z&&await Bun.file(z).exists())y.add(z),R=`@include(${l})`;t=t.substring(0,x)+R+t.substring(w),m.lastIndex=0}}for(let[m,k]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(t))!==null){let i=p.index,w=i+p[0].length-1,l=1,o=w+1;while(o<t.length&&l>0){if(t[o]==="(")l++;else if(t[o]===")")l--;o++}if(l!==0)break;let O=t.substring(w+1,o-1),z=ae(O,0);if(z===-1){x.lastIndex=o;continue}let R=O.substring(0,z).trim(),H=O.substring(z+1).trim(),F=H.match(/^\s*['"]([^'"]+)['"]/);if(!F){x.lastIndex=o;continue}let b=F[1],J=H.substring(F[0].length),j,M=ae(J,0);if(M!==-1)j=J.substring(M+1).trim();try{let A=`Boolean(${R})`,L;if(f(A)){let ie=d(A,Object.keys(e));L=Boolean(ie(...Object.values(e)))}else L=Boolean(u(A,e));let ee=k?!L:L,ne="";if(ee){let ie=W(b,g,a);if(ie&&await Bun.file(ie).exists())y.add(ie);ne=`@include('${b}'${j?`, ${j}`:""})`}t=t.substring(0,i)+ne+t.substring(o),x.lastIndex=0}catch(A){let L=A instanceof Error?A.message:String(A),ee=h("Include",`Error evaluating ${m} condition: ${L}`,a,c,i);t=t.substring(0,i)+ee+t.substring(o),x.lastIndex=0}}}{let m=/@each\s*\(/g,k;while((k=m.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,w=p+1;while(w<t.length&&i>0){if(t[w]==="(")i++;else if(t[w]===")"){if(i--,i===0)break}w++}if(i!==0)break;let l=t.substring(p+1,w),o=t.substring(x,w+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){m.lastIndex=0,t=t.replace(o,"");continue}let[,z,R,H,F]=O;try{let b,J=R.trim();if(f(J))b=d(J,Object.keys(e))(...Object.values(e));else b=u(J,e);let j="";if(Array.isArray(b)&&b.length>0)for(let M of b){let A={...e,[H]:M},L=await te(z,A,c,x);j+=L}else if(F)j=await te(F,{},c,x);t=t.substring(0,x)+j+t.substring(w+1),m.lastIndex=0}catch(b){let J=b instanceof Error?b.message:String(b);t=t.substring(0,x)+h("Each",`Error in @each: ${J}`,a,c,x)+t.substring(w+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,k;while((k=m.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,w=p+1;while(w<t.length&&i>0){if(t[w]==="(")i++;else if(t[w]===")"){if(i--,i===0)break}w++}if(i!==0)break;let l=t.substring(p+1,w),o=t.substring(x,w+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){m.lastIndex=0,t=t.replace(o,"");continue}let z=O[1],R=l.slice(O[0].length),H,F=R.match(/^\s*,\s*\{/);if(F){R=R.slice(F[0].length-1);let j=1,M=1;while(M<R.length&&j>0){if(R[M]==="{")j++;else if(R[M]==="}"){if(j--,j===0)break}M++}H=R.substring(0,M+1),R=R.slice(M+1)}let b,J=R.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)b=J[1];try{let j=JSON.parse(z.replace(/'/g,'"')),M={};if(H)try{M=P(H,e)}catch(L){let ee=L instanceof Error?L.message:String(L);if(n.debug){let ne=h("Include",`Error parsing includeFirst variables: ${ee}`,a,c,x,o);t=t.replace(o,()=>ne)}else t=t.replace(o,()=>b||"");continue}let A=!1;for(let L of j){let ee=W(L,g,a);if(!ee)continue;if(await r(ee)){let ne=await te(L,M,c,x);t=t.replace(o,()=>ne),A=!0;break}}if(!A)if(b!==void 0)t=t.replace(o,()=>b);else if(n.debug){let L=h("Include",`None of the includeFirst paths exist: ${z}`,a,c,x,o);t=t.replace(o,()=>L)}else t=t.replace(o,"")}catch(j){let M=j instanceof Error?j.message:String(j),A=h("Include",`Error processing @includeFirst: ${M}`,a,c,x,o);t=t.replace(o,()=>A)}m.lastIndex=0}}function W(m,k,x){try{let p=m;if(!m.endsWith(".stx"))p=`${m}.stx`;let i=C.resolve(k),w=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let F of n._layerPartialDirs??[]){let b=C.resolve(F,p);if(b.startsWith(`${C.resolve(F)}${C.sep}`)&&ye(b))return b}l=C.resolve(k,p)}else l=C.resolve(w,p);let o=C.normalize(l),O=o.startsWith(i+C.sep)||o===i,z=o.startsWith(w+C.sep)||o===w,R=!1,H=C.dirname(w);if(o.startsWith(H+C.sep)){if(!C.relative(H,o).split(C.sep).some((j)=>j.startsWith(".")&&j!=="."&&j!==".."))R=!0}if(!O&&!z&&!R)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${i}, ${w}`),null;return o}catch(p){return console.error(`Error resolving path ${m}: ${p}`),null}}let re=C.resolve(a);s.add(re);function N(m,k,x,p){return n.onIncludeError?.({includePath:m,templatePath:a,message:k,partialsDir:g}),h("Include",k,a,x,p)}async function te(m,k={},x,p){let i=W(m,g,a);if(!i)return N(m,`Could not resolve path for include: ${m}`,x,p);let w=C.resolve(i);if(s.has(w)){let l=[...s,w].map((o)=>C.basename(o)).join(" -> ");return N(m,`Circular include detected: ${l}`,x,p)}try{y.add(i);let l;if(!l)try{l=await Bun.file(i).text()}catch(v){let q=v instanceof Error?v.message:String(v);return N(m,`Error loading include file ${m}: ${q}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:v}=await import("./chunk-qmg1srpk.js");l=v(l,e)}if(l&&(n.debug||!E()&&!Tn()))try{let{warnUnbalancedTags:v}=await import("./chunk-yg5a54pj.js");v(l,i)}catch{}try{let{processESImports:v}=await import("./chunk-wj84r15x.js");l=await v(l,e,i,n,y)}catch(v){if(n.debug)console.warn(`[stx] partial ES import extraction skipped for ${i}:`,v instanceof Error?v.message:v)}let o=l,O=pe(o);if(O)o=O.content.trim();let R=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),H="";if(R)H=`<style${R[1]}>${R[2]}</style>`;let F=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(v,q,S)=>{if(!me(q))return"";return F.push({attrs:q,body:S}),`__STX_DATA_BLOCK_${F.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let b={...e};b.__stx_signals_gate=ke(l,i);for(let[v,q]of Object.entries(k))b[v]=q;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,j=[...l.matchAll(J)].sort((v,q)=>{let S=(v[1]||"").includes("server"),X=(q[1]||"").includes("server");return Number(X)-Number(S)}),M="",A=null,L=!1,ee=!1;for(let v of j){let q=v[1]||"",S=v[2]||"";if(me(q))continue;let X=q.includes("server"),be=Be(q);if(!X&&!/\bsrc\s*=/i.test(q))Ne(S,i,n.strict);if(!X&&S.trim()){let{interpolateScriptExpressions:U}=await import("./chunk-6hn9n00a.js");S=U(S,b,m)}let ce="";try{let{extractAndStripCssImports:U,renderVendorStyleTags:Q}=await import("./chunk-ft30g13p.js"),se=U(S,{filePath:i,projectRoot:process.cwd()});S=se.code,ce=Q(se.styles)}catch(U){if(n.debug)console.warn(`[stx] vendor-css extractor skipped for ${i}:`,U instanceof Error?U.message:U)}if(be&&S.trim())S=Fe(S);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-ft30g13p.js");S=Q(S).code;let{hasUserImports:se,bundleClientScript:Se}=await import("./chunk-dt4qswne.js");if(se(S))S=await Se(S,i,{projectRoot:process.cwd()})}catch(Q){if(n.debug)console.warn(`[stx] bundler skipped for ${i}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:U}=await import("./chunk-7v54wqsh.js");S=U(S)}let ge=Ee(S);if(!X){let{extractBridgeData:U,generateServerDataBridge:Q}=await import("./chunk-ft30g13p.js"),se=Q(S,U(b));if(se)S=`${se}
48
48
  ${S}`}if(ge&&!X){L=!0,A=fe(i,e);let U=I(S),Q=ue(U,A);M+=`${ce}<script data-stx-scoped data-stx-run="always" data-stx-owner="${A}">${Q}</script>
49
- `;continue}if(X)try{let{extractVariables:U}=await import("./chunk-3gzhh69y.js");await U(S,b,i)}catch(U){if(n.debug)console.warn(`Warning: Could not extract variables from server script in ${i}:`,U)}if(!X&&!ge){let U=q.replace(/\bclient\b/i,"").trim();A=fe(i,e);let Q=I(S),se=ue(Q,A);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(se))ee=!0;M+=`${ce}<script data-stx-scoped data-stx-run="always" data-stx-owner="${A}"${U?` ${U}`:""}>${se}</script>
50
- `}}if(F.length>0){let{interpolateScriptExpressions:v}=await import("./chunk-8gdtys3s.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(q,S)=>{let X=F[Number(S)];return`<script${X.attrs}>${v(X.body,b,m)}</script>`})}if(A){let v=Te(o,A);if(o=v.html,v.mergedIntoExisting){let S=A,X=v.mergedIntoExisting;M=M.split(`'${S}'`).join(`'${X}'`).split(`"${S}"`).join(`"${X}"`),A=X}else if(!v.stamped&&L&&!le.has(i))le.add(i),console.warn(`[stx] ${C.relative(process.cwd(),i)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(v.stamped&&v.root!=="body"&&(L||ee)&&!de.has(i)){let S=Mf(o);if(S.length>1)de.add(i),console.warn(`[stx] ${C.relative(process.cwd(),i)} declares ${L?"signals":"bindings"} and has ${S.length} top-level elements (${S.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let q=v.stamped&&v.root!==null&&Cr(v.root);M=Ie(M,q?A:null)}if(o.includes("@include")||o.includes("@partial"))o=await cs(o,b,i,n,y,s);let{processLoops:ne,reportDeferredLoopWarnings:ie}=await import("./chunk-66eba1h4.js"),G=ne(o,b,i,void 0,!0);G=oe(G,b,i),G=ie(G);let{processMetaDirectives:xe,processSeoDirective:_e,processStructuredData:we}=await import("./chunk-8w0n2rae.js");if(G=xe(G,b,i,n),G=we(G,b,i),G=_e(G,b,i,n),G=_(G,b,i),H)G+=`
49
+ `;continue}if(X)try{let{extractVariables:U}=await import("./chunk-pf49wf76.js");await U(S,b,i)}catch(U){if(n.debug)console.warn(`Warning: Could not extract variables from server script in ${i}:`,U)}if(!X&&!ge){let U=q.replace(/\bclient\b/i,"").trim();A=fe(i,e);let Q=I(S),se=ue(Q,A);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(se))ee=!0;M+=`${ce}<script data-stx-scoped data-stx-run="always" data-stx-owner="${A}"${U?` ${U}`:""}>${se}</script>
50
+ `}}if(F.length>0){let{interpolateScriptExpressions:v}=await import("./chunk-6hn9n00a.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(q,S)=>{let X=F[Number(S)];return`<script${X.attrs}>${v(X.body,b,m)}</script>`})}if(A){let v=Te(o,A);if(o=v.html,v.mergedIntoExisting){let S=A,X=v.mergedIntoExisting;M=M.split(`'${S}'`).join(`'${X}'`).split(`"${S}"`).join(`"${X}"`),A=X}else if(!v.stamped&&L&&!le.has(i))le.add(i),console.warn(`[stx] ${C.relative(process.cwd(),i)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(v.stamped&&v.root!=="body"&&(L||ee)&&!de.has(i)){let S=Df(o);if(S.length>1)de.add(i),console.warn(`[stx] ${C.relative(process.cwd(),i)} declares ${L?"signals":"bindings"} and has ${S.length} top-level elements (${S.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let q=v.stamped&&v.root!==null&&Cr(v.root);M=Ie(M,q?A:null)}if(o.includes("@include")||o.includes("@partial"))o=await cs(o,b,i,n,y,s);let{processLoops:ne,reportDeferredLoopWarnings:ie}=await import("./chunk-b4tpv1jd.js"),G=ne(o,b,i,void 0,!0);G=oe(G,b,i),G=ie(G);let{processMetaDirectives:xe,processSeoDirective:_e,processStructuredData:we}=await import("./chunk-ehgmm2sy.js");if(G=xe(G,b,i,n),G=we(G,b,i),G=_e(G,b,i,n),G=_(G,b,i),H)G+=`
51
51
  `+H;if(M)G+=`
52
52
  `+M;return G}catch(l){if(l instanceof K)throw l;let o=l instanceof Error?l.message:String(l);return N(m,`Error processing include ${m}: ${o}`,x,p)}}let Y=/@include\s*\(/g,Z;while((Z=Y.exec(t))!==null){let m=Z.index,k=m+Z[0].length-1,x=1,p=k+1;while(p<t.length&&x>0){if(t[p]==="(")x++;else if(t[p]===")")x--;p++}if(x!==0)break;let i=t.substring(m,p),w=t.substring(k+1,p-1),l=w.match(/^\s*['"]([^'"]+)['"]/);if(!l){Y.lastIndex=p;continue}let o=l[1],O,z=w.substring(l[0].length),R=ae(z,0);if(R!==-1)O=z.substring(R+1).trim();let H={};if(O)try{H=P(O,e)}catch(b){let J=b instanceof Error?b.message:String(b);t=t.replace(i,h("Include",`Error parsing include variables for ${o}: ${J}`,a,c,m)),Y.lastIndex=0;continue}let F=await te(o,H,c,m);t=t.substring(0,m)+F+t.substring(p),Y.lastIndex=0}return t}function ls(c,e){let a=c;function n(y,s,g,t){let D=y,W=!0;while(W){W=!1;let re=new RegExp(`@${s}\\(['"]([^'"]+)['"]\\)`),N=D.match(re);if(!N||N.index===void 0)break;let te=N.index,Y=N[1],Z=te+N[0].length,m=new RegExp(`@${s}\\(`),k=new RegExp(`@${g}(?![a-z])`),x=1,p=Z,i=-1;while(x>0&&p<D.length){let l=D.slice(p),o=l.match(m),O=l.match(k),z=o?p+o.index:1/0,R=O?p+O.index:1/0;if(z<R)x++,p=z+(o[0].length||1);else if(R<1/0){if(x--,x===0){i=R;break}p=R+g.length+1}else break}if(i===-1)break;let w=D.slice(Z,i);if(!e[Y])e[Y]=[];if(t)e[Y].unshift(w);else e[Y].push(w);D=D.substring(0,te)+D.substring(i+`@${g}`.length),W=!0}return D}return a=n(a,"push","endpush",!1),a=n(a,"prepend","endprepend",!0),a}function us(c,e){return c.replace(/@stack\(['"]([^'"]+)['"]\)/g,(a,n)=>{if(!e[n]||e[n].length===0)return"";return e[n].join(`
53
53
  `)})}
54
- export{Oh,Mf,Ye,lc,Nh,cs,ls,us};
54
+ export{Oh,Df,Ye,lc,Nh,cs,ls,us};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{He,_n,Ks,_i,D,jt}from"./chunk-fvmd4kk6.js";export{_n as currentRuntimeConfig,jt as injectRuntimeConfig,D as resolveRuntimeConfig,_i as useRuntimeConfig,Ks as useServerRuntimeConfig,He as withRuntimeConfig};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Bo,Fo,zo,Dh,ds,Mh}from"./chunk-5gjzfgc5.js";export{ds as clearImageDeliveryCatalog,Dh as deliveredImage,zo as efficientDeliverySources,Bo as getImageDelivery,Fo as isTransparentImage,Mh as prepareImageDelivery};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{zf,jh,Bh,Fh,zh,Hf,Vf,Hh,Vh,Yo,Uh,dr,pr,xs}from"./chunk-88rwr1w2.js";import{rt}from"./chunk-car6nhfe.js";import"./chunk-vbw9jhz2.js";import"./chunk-p65ax8s0.js";import"./chunk-8370x30n.js";import"./chunk-89d3h8mp.js";import"./chunk-zjqvbcwa.js";import"./chunk-23r3rby6.js";export{zh as __setSignalsGeneratorsForTest,rt as cacheEngineFingerprint,pr as cacheTemplate,dr as checkCache,Uh as clearDevCaches,Vf as getCachedRouterScript,Hf as getCachedSignalsRuntime,Hh as getServeClientAsset,Yo as getServeModuleBundle,xs as hashFilePath,Bh as invalidateFileCache,Fh as invalidateFileCacheByDir,jh as readFileCached,Vh as registerServeModuleBundle,zf as templateCache};
2
+ import{zf,jh,Bh,Fh,zh,Hf,Vf,Hh,Vh,Yo,Uh,dr,pr,xs}from"./chunk-vvv8wyr7.js";import{rt}from"./chunk-car6nhfe.js";import"./chunk-y5k93ysf.js";import"./chunk-20ep26hg.js";import"./chunk-fvmd4kk6.js";import"./chunk-cqwhafc9.js";import"./chunk-zjqvbcwa.js";import"./chunk-fx094pwg.js";export{zh as __setSignalsGeneratorsForTest,rt as cacheEngineFingerprint,pr as cacheTemplate,dr as checkCache,Uh as clearDevCaches,Vf as getCachedRouterScript,Hf as getCachedSignalsRuntime,Hh as getServeClientAsset,Yo as getServeModuleBundle,xs as hashFilePath,Bh as invalidateFileCache,Fh as invalidateFileCacheByDir,jh as readFileCached,Vh as registerServeModuleBundle,zf as templateCache};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ql,eu,tu,nu,ru,su,ou,iu,au,cu,Mm}from"./chunk-t0jed809.js";export{Ql as createIslandRegistry,Mm as default,cu as generateIslandManifest,tu as generatePartialHydrationCSS,su as hydrateAll,ru as hydrateByStrategy,nu as hydrateIsland,ou as isHydrated,iu as onHydrated,eu as processPartialHydrationDirectives,au as processStaticDirectives};
2
+ import{Ql,eu,tu,nu,ru,su,ou,iu,au,cu,Dm}from"./chunk-gtchtap6.js";export{Ql as createIslandRegistry,Dm as default,cu as generateIslandManifest,tu as generatePartialHydrationCSS,su as hydrateAll,ru as hydrateByStrategy,nu as hydrateIsland,ou as isHydrated,iu as onHydrated,eu as processPartialHydrationDirectives,au as processStaticDirectives};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import"./chunk-89d3h8mp.js";import"./chunk-23r3rby6.js";import"./chunk-zjqvbcwa.js";import"./chunk-vbw9jhz2.js";import"./chunk-8370x30n.js";import"./chunk-p65ax8s0.js";import"./chunk-11y84h2d.js";import"./chunk-ns0171xk.js";import{c}from"./chunk-z4g64re8.js";import u from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||c(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=l.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),m=JSON.parse(p);if(m.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
2
+ import"./chunk-cqwhafc9.js";import"./chunk-fx094pwg.js";import"./chunk-zjqvbcwa.js";import"./chunk-y5k93ysf.js";import"./chunk-fvmd4kk6.js";import"./chunk-20ep26hg.js";import"./chunk-11y84h2d.js";import"./chunk-er5tdp6k.js";import{c}from"./chunk-z4g64re8.js";import u from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||c(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=l.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),m=JSON.parse(p);if(m.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
3
3
  `)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{$a,Ra,Aa,Pa,Eh}from"./chunk-q8yfdjww.js";import"./chunk-x12e55sd.js";import"./chunk-gjg82tsf.js";import"./chunk-9xps62ek.js";import"./chunk-51r39yw4.js";import"./chunk-bkcq0dxb.js";import"./chunk-hcf1wv74.js";import"./chunk-4dxq7ft1.js";import"./chunk-5gjzfgc5.js";import"./chunk-ajq3fnxc.js";import"./chunk-wrn3n4b8.js";import"./chunk-4y1a7nbm.js";import"./chunk-t9mw38hk.js";import"./chunk-694w19gx.js";import"./chunk-bdaz0k5c.js";import"./chunk-vvv8wyr7.js";import"./chunk-m87qhcsz.js";import"./chunk-er5tdp6k.js";import"./chunk-11y84h2d.js";import"./chunk-4657mnht.js";import"./chunk-0pghy8kw.js";import"./chunk-2j5yane9.js";import"./chunk-y5k93ysf.js";import"./chunk-20ep26hg.js";import"./chunk-fvmd4kk6.js";import"./chunk-cqwhafc9.js";import"./chunk-zjqvbcwa.js";import"./chunk-fx094pwg.js";export{$a as buildNative,Eh as default,Ra as findCraftBinary,Pa as getAvailableFormats,Aa as getAvailableTargets};