@stacksjs/stx 0.2.854 → 0.2.855

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 (80) hide show
  1. package/dist/{chunk-krnp1bae.js → chunk-0vg0j7xa.js} +1 -1
  2. package/dist/{chunk-kdhgvfxw.js → chunk-11y3106w.js} +1 -1
  3. package/dist/chunk-161ksm7f.js +2 -0
  4. package/dist/{chunk-ga0e15n5.js → chunk-1qybwj8k.js} +2 -2
  5. package/dist/{chunk-m2srr0pz.js → chunk-279n7sde.js} +1 -1
  6. package/dist/chunk-2y20dvab.js +2 -0
  7. package/dist/{chunk-djte6zvt.js → chunk-3pm6d9zj.js} +1 -1
  8. package/dist/{chunk-8vs6xk89.js → chunk-463zkecq.js} +1 -1
  9. package/dist/{chunk-5t4k477c.js → chunk-4cd94cd5.js} +1 -1
  10. package/dist/{chunk-1wczdwv6.js → chunk-4dfz7cdr.js} +2 -2
  11. package/dist/{chunk-ht550m3c.js → chunk-4wrddn8m.js} +2 -2
  12. package/dist/{chunk-w525ymys.js → chunk-5dykcrnv.js} +1 -1
  13. package/dist/{chunk-7zhtnnzk.js → chunk-5xcxc9f8.js} +1 -1
  14. package/dist/{chunk-h8bqgjw4.js → chunk-6w3gv9d6.js} +1 -1
  15. package/dist/{chunk-3gbexkdv.js → chunk-77kanny8.js} +4 -4
  16. package/dist/{chunk-y3gajdr9.js → chunk-7hp50cpd.js} +4 -4
  17. package/dist/{chunk-tks9wec7.js → chunk-7tteg9bn.js} +1 -1
  18. package/dist/{chunk-cj923dqv.js → chunk-81z64a84.js} +1 -1
  19. package/dist/{chunk-hn1c3te7.js → chunk-8gsd2n0j.js} +1 -1
  20. package/dist/{chunk-xk113s55.js → chunk-8kqqxqyp.js} +1 -1
  21. package/dist/chunk-8qe34jb8.js +3 -0
  22. package/dist/{chunk-txg0pp28.js → chunk-9hvfmqs1.js} +2 -2
  23. package/dist/{chunk-1026xh3q.js → chunk-9n3584wt.js} +1 -1
  24. package/dist/{chunk-j05z0m3r.js → chunk-bk0arddt.js} +1 -1
  25. package/dist/chunk-c557w9e6.js +2 -0
  26. package/dist/chunk-ck9zengd.js +2 -0
  27. package/dist/{chunk-dak3fb0d.js → chunk-cy60hmv2.js} +1 -1
  28. package/dist/chunk-dbag44ta.js +2 -0
  29. package/dist/{chunk-5wct6n72.js → chunk-dfcnaaym.js} +1 -1
  30. package/dist/{chunk-njj4mmdc.js → chunk-e8zpzt9s.js} +1 -1
  31. package/dist/{chunk-qndtva3r.js → chunk-eegs2at0.js} +1 -1
  32. package/dist/{chunk-kdc0xsds.js → chunk-f858fazq.js} +1 -1
  33. package/dist/{chunk-xsc8pksj.js → chunk-fba71th7.js} +3 -3
  34. package/dist/{chunk-vpqr2td2.js → chunk-fbpqkrvb.js} +1 -1
  35. package/dist/{chunk-9f1p4y5e.js → chunk-fzkyk5j4.js} +1 -1
  36. package/dist/{chunk-dq41v6hy.js → chunk-ggthncvg.js} +1 -1
  37. package/dist/{chunk-7bt73vzq.js → chunk-gxqtbbz0.js} +2 -2
  38. package/dist/{chunk-xt6gss6f.js → chunk-hfcagm39.js} +1 -1
  39. package/dist/{chunk-fgxagxde.js → chunk-hfe2byfx.js} +1 -1
  40. package/dist/{chunk-59br2agx.js → chunk-hgy98n76.js} +2 -2
  41. package/dist/chunk-j3s5y2k5.js +2 -0
  42. package/dist/{chunk-r8vx6aw7.js → chunk-jn6mdfrs.js} +1 -1
  43. package/dist/{chunk-wsz9vajc.js → chunk-k0arm18k.js} +1 -1
  44. package/dist/{chunk-2f2rxpm9.js → chunk-mhjxx64x.js} +5 -5
  45. package/dist/{chunk-5c5nr9sf.js → chunk-mv48q1p4.js} +6 -6
  46. package/dist/chunk-p91288ce.js +2 -0
  47. package/dist/{chunk-r4r1fydy.js → chunk-pesgcwrj.js} +1 -1
  48. package/dist/{chunk-41vnkj8n.js → chunk-pw6n7a9k.js} +1 -1
  49. package/dist/{chunk-16tghnfh.js → chunk-pwem4sed.js} +1 -1
  50. package/dist/{chunk-df71jdb5.js → chunk-q0jmc3m4.js} +1 -1
  51. package/dist/{chunk-spnq5xjw.js → chunk-qccpfn5x.js} +1 -1
  52. package/dist/{chunk-5mjsx45g.js → chunk-qxk9grjm.js} +1 -1
  53. package/dist/{chunk-pyc91z27.js → chunk-vbsr76qe.js} +1 -1
  54. package/dist/chunk-vgaqznwt.js +2 -0
  55. package/dist/chunk-w165qe5q.js +2 -0
  56. package/dist/{chunk-97qv554b.js → chunk-w835crjw.js} +1 -1
  57. package/dist/{chunk-rpk744cn.js → chunk-wz54wsm7.js} +1 -1
  58. package/dist/{chunk-3fjdwr6s.js → chunk-xfb7fdeq.js} +4 -4
  59. package/dist/{chunk-4qf5qh20.js → chunk-xn2gyhes.js} +1 -1
  60. package/dist/{chunk-f61153pm.js → chunk-ynd2nfvs.js} +4 -4
  61. package/dist/{chunk-4ekpj06v.js → chunk-yscys65t.js} +1 -1
  62. package/dist/{chunk-6ygjr05v.js → chunk-yzvp90yk.js} +1 -1
  63. package/dist/{chunk-6gt2br9n.js → chunk-zme05d1n.js} +1 -1
  64. package/dist/{chunk-9tbghxd0.js → chunk-zqb294v2.js} +1 -1
  65. package/dist/cli.js +7 -7
  66. package/dist/craft-entry.js +1 -1
  67. package/dist/craft.js +1 -1
  68. package/dist/pwa.js +1 -1
  69. package/dist/ssg.js +2 -2
  70. package/package.json +5 -5
  71. package/dist/chunk-0x4j65b0.js +0 -2
  72. package/dist/chunk-5k8n17b4.js +0 -2
  73. package/dist/chunk-cddvc63n.js +0 -2
  74. package/dist/chunk-dxgjmdnx.js +0 -2
  75. package/dist/chunk-ec54y5py.js +0 -2
  76. package/dist/chunk-g39txgtx.js +0 -2
  77. package/dist/chunk-hxz5cd52.js +0 -3
  78. package/dist/chunk-k4swzkyq.js +0 -2
  79. package/dist/chunk-vz0t4mnc.js +0 -2
  80. package/dist/chunk-wa06df5a.js +0 -2
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{P,t,l}from"./chunk-0dmpc70r.js";import{Q}from"./chunk-5c5nr9sf.js";import{ti}from"./chunk-kvafq9gy.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-0dmpc70r.js";import{Q}from"./chunk-mv48q1p4.js";import{ti}from"./chunk-kvafq9gy.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 kc(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 _c(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 Cc(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,o=Array.isArray(e)?e:[e],c=await ti(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 Ec={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},Tc={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
4
4
  export{kc,_c,Cc,Ec,Tc};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Xl,_m,Jl,Yl,Cm,Em}from"./chunk-r8vx6aw7.js";import"./chunk-5c5nr9sf.js";import"./chunk-njj4mmdc.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{Em as applySlots,Cm as extractSlotContent,_m as parseSlotElement,Xl as parseSlots,Yl as processSlots,Jl as renderSlot};
2
+ import{Xl,_m,Jl,Yl,Cm,Em}from"./chunk-jn6mdfrs.js";import"./chunk-mv48q1p4.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{Em as applySlots,Cm as extractSlotContent,_m as parseSlotElement,Xl as parseSlots,Yl as processSlots,Jl as renderSlot};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{or,i}from"./chunk-ynd2nfvs.js";import"./chunk-9hvfmqs1.js";import"./chunk-xfb7fdeq.js";import"./chunk-t5q31st4.js";import"./chunk-q0jmc3m4.js";import"./chunk-8qe34jb8.js";import"./chunk-279n7sde.js";import"./chunk-v8p8t3t4.js";import"./chunk-4wrddn8m.js";import{ve}from"./chunk-7hp50cpd.js";import"./chunk-zswtgwxg.js";import"./chunk-k0arm18k.js";import"./chunk-1qybwj8k.js";import"./chunk-qxk9grjm.js";import"./chunk-kvafq9gy.js";import"./chunk-tm8a2b69.js";import"./chunk-vw73gsxx.js";import"./chunk-9r999ees.js";import{Ne,Ws,qs}from"./chunk-mv48q1p4.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{or as buildModulesTag,ve as injectRouterScript,i as processDirectives,Ws as processJsonDirective,qs as processOnceDirective,Ne as validateClientScript};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{tm}from"./chunk-zqb294v2.js";import"./chunk-ynd2nfvs.js";import"./chunk-9hvfmqs1.js";import"./chunk-xfb7fdeq.js";import"./chunk-t5q31st4.js";import"./chunk-q0jmc3m4.js";import"./chunk-8qe34jb8.js";import"./chunk-279n7sde.js";import"./chunk-v8p8t3t4.js";import"./chunk-4wrddn8m.js";import"./chunk-7hp50cpd.js";import"./chunk-zswtgwxg.js";import"./chunk-k0arm18k.js";import"./chunk-1qybwj8k.js";import"./chunk-qxk9grjm.js";import"./chunk-kvafq9gy.js";import"./chunk-tm8a2b69.js";import"./chunk-vw73gsxx.js";import"./chunk-9r999ees.js";import"./chunk-mv48q1p4.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{tm as startInteractive};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{nt}from"./chunk-9r999ees.js";import{bt,qn}from"./chunk-f9thwm8c.js";import{Ir,Or,Nr,Dr,Ce}from"./chunk-0dmpc70r.js";import{De,yn,il,al}from"./chunk-5c5nr9sf.js";import{M}from"./chunk-v4bqmzj9.js";import{Ti}from"./chunk-njj4mmdc.js";import{b}from"./chunk-txg0pp28.js";import{i}from"./chunk-f61153pm.js";import{F,a}from"./chunk-ga0e15n5.js";import{Ac}from"./chunk-tm8a2b69.js";import{Nn,Mn,qe,Te,ha,ya,Dn}from"./chunk-xsc8pksj.js";import{ln,Mo}from"./chunk-5t4k477c.js";import{Ln}from"./chunk-12r22pf0.js";import{tn,tr,nr}from"./chunk-cwt26rvt.js";import{X}from"./chunk-y3gajdr9.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function W(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function J(n=!1){let l=n?qn():bt(),o=W(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function U(){let n=nt(),l=W(n);return{content:n,filename:`router.${l}.js`,hash:l}}import V 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 q(n,l,o={}){let r=V.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);il();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>De(R))),{context:D}=te({__filename:r,__dirname:V.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...F,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=Nn(f)+Mn(f)+qe(f),j=al();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,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 y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){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 dm(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"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Ce(e.app?.head,{known:Dr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Ln(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)ln(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=X(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],P=R.filter((s)=>!Y.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));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=J(n.debug),x=U();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 h=T(s.pattern),O=h.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 q(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:y,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=Nr(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Ir(t.html,u);if(g.htmlAttrs)t.html=Or(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 I=p[1];t.html=t.html.replace(" "+I,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${I}>`)}}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,D,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),G=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,G),t.fragment),H.push({pattern:s.pattern,compiledPath:z,fragmentPath:G,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).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:h}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let E=nr(o);if(E){let{copied:s,bytes:h}=Z(E,c.join(r,"public",tr));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${tn}/`)}let N={runtime:v.filename,router:x.filename},C=ha(H,N,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await Mo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Ti(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Ac(e._layerGraph),null,2));ya(C,r);let K=Date.now()-l;return console.log(`
2
+ import{nt}from"./chunk-9r999ees.js";import{bt,qn}from"./chunk-f9thwm8c.js";import{Ir,Or,Nr,Dr,Ce}from"./chunk-0dmpc70r.js";import{De,yn,il,al}from"./chunk-mv48q1p4.js";import{M}from"./chunk-v4bqmzj9.js";import{Ti}from"./chunk-e8zpzt9s.js";import{b}from"./chunk-9hvfmqs1.js";import{i}from"./chunk-ynd2nfvs.js";import{F,a}from"./chunk-1qybwj8k.js";import{Ac}from"./chunk-tm8a2b69.js";import{Nn,Mn,qe,Te,ha,ya,Dn}from"./chunk-fba71th7.js";import{ln,Mo}from"./chunk-4cd94cd5.js";import{Ln}from"./chunk-12r22pf0.js";import{tn,tr,nr}from"./chunk-cwt26rvt.js";import{X}from"./chunk-7hp50cpd.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function W(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function J(n=!1){let l=n?qn():bt(),o=W(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function U(){let n=nt(),l=W(n);return{content:n,filename:`router.${l}.js`,hash:l}}import V 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 q(n,l,o={}){let r=V.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);il();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>De(R))),{context:D}=te({__filename:r,__dirname:V.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...F,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=Nn(f)+Mn(f)+qe(f),j=al();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,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 y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){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 dm(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"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Ce(e.app?.head,{known:Dr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Ln(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)ln(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=X(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],P=R.filter((s)=>!Y.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));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=J(n.debug),x=U();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 h=T(s.pattern),O=h.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 q(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:y,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=Nr(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Ir(t.html,u);if(g.htmlAttrs)t.html=Or(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 I=p[1];t.html=t.html.replace(" "+I,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${I}>`)}}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,D,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),G=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,G),t.fragment),H.push({pattern:s.pattern,compiledPath:z,fragmentPath:G,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).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:h}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let E=nr(o);if(E){let{copied:s,bytes:h}=Z(E,c.join(r,"public",tr));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${tn}/`)}let N={runtime:v.filename,router:x.filename},C=ha(H,N,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await Mo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Ti(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Ac(e._layerGraph),null,2));ya(C,r);let K=Date.now()-l;return console.log(`
3
3
  [stx build] Done in ${K}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:N,outputDir:r,duration:K}}
4
4
  export{dm};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{nm}from"./chunk-6gt2br9n.js";import"./chunk-ga0e15n5.js";import"./chunk-5mjsx45g.js";import"./chunk-kvafq9gy.js";import"./chunk-tm8a2b69.js";import"./chunk-vw73gsxx.js";import"./chunk-9r999ees.js";import"./chunk-5c5nr9sf.js";import"./chunk-njj4mmdc.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{nm as buildApp};
2
+ import{nm}from"./chunk-zme05d1n.js";import"./chunk-1qybwj8k.js";import"./chunk-qxk9grjm.js";import"./chunk-kvafq9gy.js";import"./chunk-tm8a2b69.js";import"./chunk-vw73gsxx.js";import"./chunk-9r999ees.js";import"./chunk-mv48q1p4.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{nm as buildApp};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{R,u,f,P,d,K}from"./chunk-0dmpc70r.js";import{V,Ms,Ne,pe,It,Tr,Be,Fe,s,m,ke,E}from"./chunk-5c5nr9sf.js";import{lt}from"./chunk-ngnvyqk3.js";import{I}from"./chunk-xppm4cs4.js";import{ie}from"./chunk-v8p8t3t4.js";import{B,Ze}from"./chunk-ybq56wam.js";import{T,$n}from"./chunk-ym5qgw03.js";import C from"path";import{existsSync as ye}from"fs";function ae(c,e){let a=0;for(let r=e;r<c.length;r++){let S=c[r];if(S==="("||S==="["||S==="{")a++;else if(S===")"||S==="]"||S==="}")a--;else if(S===","&&a===0)return r}return-1}function $e(c,e,a){let r=c,S=new RegExp(`${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),n=S.exec(r);while(n){let g=n.index,t=g+n[0].length-1,D=1,W=t+1;while(W<r.length&&D>0){if(r[W]==="(")D++;else if(r[W]===")")D--;W++}if(D!==0)break;let re=r.substring(t+1,W-1),N=`${a}(${re})`;r=r.substring(0,g)+N+r.substring(W),S.lastIndex=g+N.length,n=S.exec(r)}return r}function Ee(c){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(c)}function he(c){let e=c,a=[],r=new Set,S=0,n=0,g=e.length,t=(N)=>{n++;while(n<g){if(e[n]==="\\"){n+=2;continue}if(e[n]===N){n++;return}n++}},D=()=>{n++;while(n<g){if(e[n]==="\\"){n+=2;continue}if(e[n]==="`"){n++;return}if(e[n]==="$"&&e[n+1]==="{"){n+=2;let N=1;while(n<g&&N>0)if(e[n]==="{")N++,n++;else if(e[n]==="}")N--,n++;else if(e[n]==="'"||e[n]==='"')t(e[n]);else if(e[n]==="`")D();else n++;continue}n++}},W=()=>{if(e[n]==="/"&&e[n+1]==="/"){while(n<g&&e[n]!==`
2
+ import{R,u,f,P,d,K}from"./chunk-0dmpc70r.js";import{V,Ms,Ne,pe,It,Tr,Be,Fe,s,m,ke,E}from"./chunk-mv48q1p4.js";import{lt}from"./chunk-ngnvyqk3.js";import{I}from"./chunk-xppm4cs4.js";import{ie}from"./chunk-v8p8t3t4.js";import{B,Ze}from"./chunk-ybq56wam.js";import{T,$n}from"./chunk-ym5qgw03.js";import C from"path";import{existsSync as ye}from"fs";function ae(c,e){let a=0;for(let r=e;r<c.length;r++){let S=c[r];if(S==="("||S==="["||S==="{")a++;else if(S===")"||S==="]"||S==="}")a--;else if(S===","&&a===0)return r}return-1}function $e(c,e,a){let r=c,S=new RegExp(`${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),n=S.exec(r);while(n){let g=n.index,t=g+n[0].length-1,D=1,W=t+1;while(W<r.length&&D>0){if(r[W]==="(")D++;else if(r[W]===")")D--;W++}if(D!==0)break;let re=r.substring(t+1,W-1),N=`${a}(${re})`;r=r.substring(0,g)+N+r.substring(W),S.lastIndex=g+N.length,n=S.exec(r)}return r}function Ee(c){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(c)}function he(c){let e=c,a=[],r=new Set,S=0,n=0,g=e.length,t=(N)=>{n++;while(n<g){if(e[n]==="\\"){n+=2;continue}if(e[n]===N){n++;return}n++}},D=()=>{n++;while(n<g){if(e[n]==="\\"){n+=2;continue}if(e[n]==="`"){n++;return}if(e[n]==="$"&&e[n+1]==="{"){n+=2;let N=1;while(n<g&&N>0)if(e[n]==="{")N++,n++;else if(e[n]==="}")N--,n++;else if(e[n]==="'"||e[n]==='"')t(e[n]);else if(e[n]==="`")D();else n++;continue}n++}},W=()=>{if(e[n]==="/"&&e[n+1]==="/"){while(n<g&&e[n]!==`
3
3
  `)n++;return!0}if(e[n]==="/"&&e[n+1]==="*"){n+=2;while(n<g-1&&!(e[n]==="*"&&e[n+1]==="/"))n++;return n+=2,!0}return!1},re=()=>{if(S!==0)return;let N=e.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(N){let Z=N[2];if(!r.has(Z))a.push(Z),r.add(Z);return}let te=e.slice(n).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(te){let Z=te[1];if(!r.has(Z))a.push(Z),r.add(Z);return}let Y=e.slice(n).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let Z=Y[1];if(!r.has(Z))a.push(Z),r.add(Z)}};while(n<g){if(W())continue;if(e[n]==="'"||e[n]==='"'){t(e[n]);continue}if(e[n]==="`"){D();continue}if(e[n]==="{"){S++,n++;continue}if(e[n]==="}"){S--,n++;continue}if(S===0&&/[a-z]/i.test(e[n])&&(n===0||/\s|[;{}()]/.test(e[n-1])))re();n++}return a.join(", ")}function ve(c,e=""){let a=he(c).split(",").map((r)=>r.trim()).filter(Boolean);return`
4
4
  (function() {
5
5
  ${lt("var",a)}
@@ -44,10 +44,10 @@ ${n}
44
44
  }
45
45
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
46
46
  }
47
- })();`;return a+c+r}function Te(c,e){if(B(c)){let n=B(c).tag.match(/data-stx-scope="([^"]*)"/);if(n)return{html:c,mergedIntoExisting:n[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=It(c),r=c.slice(a).match(/^(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(r){let S=r[1]+r[2],n=r[1].slice(1),g=S.match(/data-stx-scope="([^"]*)"/);if(g)return{html:c,mergedIntoExisting:g[1],stamped:!0,root:n};let t=c.slice(0,a),D=r[1],W=r[2];return{html:`${t}${D} data-stx-scope="${e}"${W}${c.slice(a+r[0].length)}`,mergedIntoExisting:null,stamped:!0,root:n}}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,"_"),r=e.__stx_scope_seq;return r?`stx_scope_${a}_${++r.n}_${r.key}`:`stx_scope_${a}_${++Ae}`}var le=new Set,de=new Set;function jh(){le.clear(),de.clear()}var Ce=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Ff(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),r=[],S=0,n=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=n.exec(a))!==null){let t=g[1]==="/",D=g[2],W=g[3]==="/"||Ce.has(D.toLowerCase());if(t){S=Math.max(0,S-1);continue}if(S===0)r.push(D);if(!W)S++}return r}function me(c){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(c)}var Ye=new R(500),fc=new Set;function Bh(){fc.clear()}function De(c){if(c.__onceStore instanceof Set)return c.__onceStore;return fc}async function us(c,e,a,r,S,n=new Set){let g=r.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,(h,k,x)=>{let p=k.trim(),i=`${a}:${p}`;if(D.has(i))return"";return D.add(i),k});{let h=/@includeIf\s*\(/g,k;while((k=h.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,_=p+1;while(_<t.length&&i>0){if(t[_]==="(")i++;else if(t[_]===")")i--;_++}if(i!==0)break;let l=t.substring(p+1,_-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){h.lastIndex=_;continue}let O=o[1],z=W(O,g,a),v="";if(z&&await Bun.file(z).exists())S.add(z),v=`@include(${l})`;t=t.substring(0,x)+v+t.substring(_),h.lastIndex=0}}for(let[h,k]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(t))!==null){let i=p.index,_=i+p[0].length-1,l=1,o=_+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(_+1,o-1),z=ae(O,0);if(z===-1){x.lastIndex=o;continue}let v=O.substring(0,z).trim(),H=O.substring(z+1).trim(),F=H.match(/^\s*['"]([^'"]+)['"]/);if(!F){x.lastIndex=o;continue}let w=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(${v})`,L;if(f(A)){let oe=d(A,Object.keys(e));L=Boolean(oe(...Object.values(e)))}else L=Boolean(u(A,e));let ee=k?!L:L,ne="";if(ee){let oe=W(w,g,a);if(oe&&await Bun.file(oe).exists())S.add(oe);ne=`@include('${w}'${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=m("Include",`Error evaluating ${h} condition: ${L}`,a,c,i);t=t.substring(0,i)+ee+t.substring(o),x.lastIndex=0}}}{let h=/@each\s*\(/g,k;while((k=h.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,_=p+1;while(_<t.length&&i>0){if(t[_]==="(")i++;else if(t[_]===")"){if(i--,i===0)break}_++}if(i!==0)break;let l=t.substring(p+1,_),o=t.substring(x,_+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){h.lastIndex=0,t=t.replace(o,"");continue}let[,z,v,H,F]=O;try{let w,J=v.trim();if(f(J))w=d(J,Object.keys(e))(...Object.values(e));else w=u(J,e);let j="";if(Array.isArray(w)&&w.length>0)for(let M of w){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(_+1),h.lastIndex=0}catch(w){let J=w instanceof Error?w.message:String(w);t=t.substring(0,x)+m("Each",`Error in @each: ${J}`,a,c,x)+t.substring(_+1),h.lastIndex=0}}}{let h=/@includeFirst\s*\(/g,k;while((k=h.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,_=p+1;while(_<t.length&&i>0){if(t[_]==="(")i++;else if(t[_]===")"){if(i--,i===0)break}_++}if(i!==0)break;let l=t.substring(p+1,_),o=t.substring(x,_+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){h.lastIndex=0,t=t.replace(o,"");continue}let z=O[1],v=l.slice(O[0].length),H,F=v.match(/^\s*,\s*\{/);if(F){v=v.slice(F[0].length-1);let j=1,M=1;while(M<v.length&&j>0){if(v[M]==="{")j++;else if(v[M]==="}"){if(j--,j===0)break}M++}H=v.substring(0,M+1),v=v.slice(M+1)}let w,J=v.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)w=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(r.debug){let ne=m("Include",`Error parsing includeFirst variables: ${ee}`,a,c,x,o);t=t.replace(o,()=>ne)}else t=t.replace(o,()=>w||"");continue}let A=!1;for(let L of j){let ee=W(L,g,a);if(!ee)continue;if(await s(ee)){let ne=await te(L,M,c,x);t=t.replace(o,()=>ne),A=!0;break}}if(!A)if(w!==void 0)t=t.replace(o,()=>w);else if(r.debug){let L=m("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=m("Include",`Error processing @includeFirst: ${M}`,a,c,x,o);t=t.replace(o,()=>A)}h.lastIndex=0}}function W(h,k,x){try{let p=h;if(!h.endsWith(".stx"))p=`${h}.stx`;let i=C.resolve(k),_=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let F of r._layerPartialDirs??[]){let w=C.resolve(F,p);if(w.startsWith(`${C.resolve(F)}${C.sep}`)&&ye(w))return w}l=C.resolve(k,p)}else l=C.resolve(_,p);let o=C.normalize(l),O=o.startsWith(i+C.sep)||o===i,z=o.startsWith(_+C.sep)||o===_,v=!1,H=C.dirname(_);if(o.startsWith(H+C.sep)){if(!C.relative(H,o).split(C.sep).some((j)=>j.startsWith(".")&&j!=="."&&j!==".."))v=!0}if(!O&&!z&&!v)return console.error(`Security: Path traversal attempt blocked for include path: ${h}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${i}, ${_}`),null;return o}catch(p){return console.error(`Error resolving path ${h}: ${p}`),null}}let re=C.resolve(a);n.add(re);function N(h,k,x,p){return r.onIncludeError?.({includePath:h,templatePath:a,message:k,partialsDir:g}),m("Include",k,a,x,p)}async function te(h,k={},x,p){let i=W(h,g,a);if(!i)return N(h,`Could not resolve path for include: ${h}`,x,p);let _=C.resolve(i);if(n.has(_)){let l=[...n,_].map((o)=>C.basename(o)).join(" -> ");return N(h,`Circular include detected: ${l}`,x,p)}try{S.add(i);let l;if(!l)try{l=await Bun.file(i).text()}catch(y){let q=y instanceof Error?y.message:String(y);return N(h,`Error loading include file ${h}: ${q}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:y}=await import("./chunk-dq41v6hy.js");l=y(l,e)}if(l&&(r.debug||!T()&&!$n()))try{let{warnUnbalancedTags:y}=await import("./chunk-7ycmnsh5.js");y(l,i)}catch{}try{let{processESImports:y}=await import("./chunk-w525ymys.js");l=await y(l,e,i,r,S)}catch(y){if(r.debug)console.warn(`[stx] partial ES import extraction skipped for ${i}:`,y instanceof Error?y.message:y)}let o=l,O=pe(o);if(O)o=O.content.trim();let v=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),H="";if(v)H=`<style${v[1]}>${v[2]}</style>`;let F=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(y,q,b)=>{if(!me(q))return"";return F.push({attrs:q,body:b}),`__STX_DATA_BLOCK_${F.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let w={...e};w.__stx_signals_gate=ke(l,i);for(let[y,q]of Object.entries(k))w[y]=q;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,j=[...l.matchAll(J)].sort((y,q)=>{let b=(y[1]||"").includes("server"),X=(q[1]||"").includes("server");return Number(X)-Number(b)}),M="",A=null,L=!1,ee=!1;for(let y of j){let q=y[1]||"",b=y[2]||"";if(me(q))continue;let X=q.includes("server"),be=Be(q);if(!X&&!/\bsrc\s*=/i.test(q))Ne(b,i,r.strict);if(!X&&b.trim()){let{interpolateScriptExpressions:U}=await import("./chunk-h8bqgjw4.js");b=U(b,w,h)}let ce="";try{let{extractAndStripCssImports:U,renderVendorStyleTags:Q}=await import("./chunk-xk113s55.js"),se=U(b,{filePath:i,projectRoot:process.cwd()});b=se.code,ce=Q(se.styles)}catch(U){if(r.debug)console.warn(`[stx] vendor-css extractor skipped for ${i}:`,U instanceof Error?U.message:U)}if(be&&b.trim())b=Fe(b);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-xk113s55.js");b=Q(b).code;let{hasUserImports:se,bundleClientScript:Se}=await import("./chunk-spnq5xjw.js");if(se(b))b=await Se(b,i,{projectRoot:process.cwd()})}catch(Q){if(r.debug)console.warn(`[stx] bundler skipped for ${i}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:U}=await import("./chunk-j05z0m3r.js");b=U(b)}let ge=Ee(b);if(!X){let{extractBridgeData:U,generateServerDataBridge:Q}=await import("./chunk-xk113s55.js"),se=Q(b,U(w));if(se)b=`${se}
47
+ })();`;return a+c+r}function Te(c,e){if(B(c)){let n=B(c).tag.match(/data-stx-scope="([^"]*)"/);if(n)return{html:c,mergedIntoExisting:n[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=It(c),r=c.slice(a).match(/^(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(r){let S=r[1]+r[2],n=r[1].slice(1),g=S.match(/data-stx-scope="([^"]*)"/);if(g)return{html:c,mergedIntoExisting:g[1],stamped:!0,root:n};let t=c.slice(0,a),D=r[1],W=r[2];return{html:`${t}${D} data-stx-scope="${e}"${W}${c.slice(a+r[0].length)}`,mergedIntoExisting:null,stamped:!0,root:n}}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,"_"),r=e.__stx_scope_seq;return r?`stx_scope_${a}_${++r.n}_${r.key}`:`stx_scope_${a}_${++Ae}`}var le=new Set,de=new Set;function jh(){le.clear(),de.clear()}var Ce=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Ff(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),r=[],S=0,n=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=n.exec(a))!==null){let t=g[1]==="/",D=g[2],W=g[3]==="/"||Ce.has(D.toLowerCase());if(t){S=Math.max(0,S-1);continue}if(S===0)r.push(D);if(!W)S++}return r}function me(c){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(c)}var Ye=new R(500),fc=new Set;function Bh(){fc.clear()}function De(c){if(c.__onceStore instanceof Set)return c.__onceStore;return fc}async function us(c,e,a,r,S,n=new Set){let g=r.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,(h,k,x)=>{let p=k.trim(),i=`${a}:${p}`;if(D.has(i))return"";return D.add(i),k});{let h=/@includeIf\s*\(/g,k;while((k=h.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,_=p+1;while(_<t.length&&i>0){if(t[_]==="(")i++;else if(t[_]===")")i--;_++}if(i!==0)break;let l=t.substring(p+1,_-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){h.lastIndex=_;continue}let O=o[1],z=W(O,g,a),v="";if(z&&await Bun.file(z).exists())S.add(z),v=`@include(${l})`;t=t.substring(0,x)+v+t.substring(_),h.lastIndex=0}}for(let[h,k]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(t))!==null){let i=p.index,_=i+p[0].length-1,l=1,o=_+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(_+1,o-1),z=ae(O,0);if(z===-1){x.lastIndex=o;continue}let v=O.substring(0,z).trim(),H=O.substring(z+1).trim(),F=H.match(/^\s*['"]([^'"]+)['"]/);if(!F){x.lastIndex=o;continue}let w=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(${v})`,L;if(f(A)){let oe=d(A,Object.keys(e));L=Boolean(oe(...Object.values(e)))}else L=Boolean(u(A,e));let ee=k?!L:L,ne="";if(ee){let oe=W(w,g,a);if(oe&&await Bun.file(oe).exists())S.add(oe);ne=`@include('${w}'${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=m("Include",`Error evaluating ${h} condition: ${L}`,a,c,i);t=t.substring(0,i)+ee+t.substring(o),x.lastIndex=0}}}{let h=/@each\s*\(/g,k;while((k=h.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,_=p+1;while(_<t.length&&i>0){if(t[_]==="(")i++;else if(t[_]===")"){if(i--,i===0)break}_++}if(i!==0)break;let l=t.substring(p+1,_),o=t.substring(x,_+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){h.lastIndex=0,t=t.replace(o,"");continue}let[,z,v,H,F]=O;try{let w,J=v.trim();if(f(J))w=d(J,Object.keys(e))(...Object.values(e));else w=u(J,e);let j="";if(Array.isArray(w)&&w.length>0)for(let M of w){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(_+1),h.lastIndex=0}catch(w){let J=w instanceof Error?w.message:String(w);t=t.substring(0,x)+m("Each",`Error in @each: ${J}`,a,c,x)+t.substring(_+1),h.lastIndex=0}}}{let h=/@includeFirst\s*\(/g,k;while((k=h.exec(t))!==null){let x=k.index,p=x+k[0].length-1,i=1,_=p+1;while(_<t.length&&i>0){if(t[_]==="(")i++;else if(t[_]===")"){if(i--,i===0)break}_++}if(i!==0)break;let l=t.substring(p+1,_),o=t.substring(x,_+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){h.lastIndex=0,t=t.replace(o,"");continue}let z=O[1],v=l.slice(O[0].length),H,F=v.match(/^\s*,\s*\{/);if(F){v=v.slice(F[0].length-1);let j=1,M=1;while(M<v.length&&j>0){if(v[M]==="{")j++;else if(v[M]==="}"){if(j--,j===0)break}M++}H=v.substring(0,M+1),v=v.slice(M+1)}let w,J=v.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)w=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(r.debug){let ne=m("Include",`Error parsing includeFirst variables: ${ee}`,a,c,x,o);t=t.replace(o,()=>ne)}else t=t.replace(o,()=>w||"");continue}let A=!1;for(let L of j){let ee=W(L,g,a);if(!ee)continue;if(await s(ee)){let ne=await te(L,M,c,x);t=t.replace(o,()=>ne),A=!0;break}}if(!A)if(w!==void 0)t=t.replace(o,()=>w);else if(r.debug){let L=m("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=m("Include",`Error processing @includeFirst: ${M}`,a,c,x,o);t=t.replace(o,()=>A)}h.lastIndex=0}}function W(h,k,x){try{let p=h;if(!h.endsWith(".stx"))p=`${h}.stx`;let i=C.resolve(k),_=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let F of r._layerPartialDirs??[]){let w=C.resolve(F,p);if(w.startsWith(`${C.resolve(F)}${C.sep}`)&&ye(w))return w}l=C.resolve(k,p)}else l=C.resolve(_,p);let o=C.normalize(l),O=o.startsWith(i+C.sep)||o===i,z=o.startsWith(_+C.sep)||o===_,v=!1,H=C.dirname(_);if(o.startsWith(H+C.sep)){if(!C.relative(H,o).split(C.sep).some((j)=>j.startsWith(".")&&j!=="."&&j!==".."))v=!0}if(!O&&!z&&!v)return console.error(`Security: Path traversal attempt blocked for include path: ${h}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${i}, ${_}`),null;return o}catch(p){return console.error(`Error resolving path ${h}: ${p}`),null}}let re=C.resolve(a);n.add(re);function N(h,k,x,p){return r.onIncludeError?.({includePath:h,templatePath:a,message:k,partialsDir:g}),m("Include",k,a,x,p)}async function te(h,k={},x,p){let i=W(h,g,a);if(!i)return N(h,`Could not resolve path for include: ${h}`,x,p);let _=C.resolve(i);if(n.has(_)){let l=[...n,_].map((o)=>C.basename(o)).join(" -> ");return N(h,`Circular include detected: ${l}`,x,p)}try{S.add(i);let l;if(!l)try{l=await Bun.file(i).text()}catch(y){let q=y instanceof Error?y.message:String(y);return N(h,`Error loading include file ${h}: ${q}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:y}=await import("./chunk-ggthncvg.js");l=y(l,e)}if(l&&(r.debug||!T()&&!$n()))try{let{warnUnbalancedTags:y}=await import("./chunk-7ycmnsh5.js");y(l,i)}catch{}try{let{processESImports:y}=await import("./chunk-5dykcrnv.js");l=await y(l,e,i,r,S)}catch(y){if(r.debug)console.warn(`[stx] partial ES import extraction skipped for ${i}:`,y instanceof Error?y.message:y)}let o=l,O=pe(o);if(O)o=O.content.trim();let v=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),H="";if(v)H=`<style${v[1]}>${v[2]}</style>`;let F=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(y,q,b)=>{if(!me(q))return"";return F.push({attrs:q,body:b}),`__STX_DATA_BLOCK_${F.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let w={...e};w.__stx_signals_gate=ke(l,i);for(let[y,q]of Object.entries(k))w[y]=q;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,j=[...l.matchAll(J)].sort((y,q)=>{let b=(y[1]||"").includes("server"),X=(q[1]||"").includes("server");return Number(X)-Number(b)}),M="",A=null,L=!1,ee=!1;for(let y of j){let q=y[1]||"",b=y[2]||"";if(me(q))continue;let X=q.includes("server"),be=Be(q);if(!X&&!/\bsrc\s*=/i.test(q))Ne(b,i,r.strict);if(!X&&b.trim()){let{interpolateScriptExpressions:U}=await import("./chunk-6w3gv9d6.js");b=U(b,w,h)}let ce="";try{let{extractAndStripCssImports:U,renderVendorStyleTags:Q}=await import("./chunk-8kqqxqyp.js"),se=U(b,{filePath:i,projectRoot:process.cwd()});b=se.code,ce=Q(se.styles)}catch(U){if(r.debug)console.warn(`[stx] vendor-css extractor skipped for ${i}:`,U instanceof Error?U.message:U)}if(be&&b.trim())b=Fe(b);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-8kqqxqyp.js");b=Q(b).code;let{hasUserImports:se,bundleClientScript:Se}=await import("./chunk-qccpfn5x.js");if(se(b))b=await Se(b,i,{projectRoot:process.cwd()})}catch(Q){if(r.debug)console.warn(`[stx] bundler skipped for ${i}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:U}=await import("./chunk-bk0arddt.js");b=U(b)}let ge=Ee(b);if(!X){let{extractBridgeData:U,generateServerDataBridge:Q}=await import("./chunk-8kqqxqyp.js"),se=Q(b,U(w));if(se)b=`${se}
48
48
  ${b}`}if(ge&&!X){L=!0,A=fe(i,e);let U=I(b),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-qndtva3r.js");await U(b,w,i)}catch(U){if(r.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(b),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:y}=await import("./chunk-h8bqgjw4.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(q,b)=>{let X=F[Number(b)];return`<script${X.attrs}>${y(X.body,w,h)}</script>`})}if(A){let y=Te(o,A);if(o=y.html,y.mergedIntoExisting){let b=A,X=y.mergedIntoExisting;M=M.split(`'${b}'`).join(`'${X}'`).split(`"${b}"`).join(`"${X}"`),A=X}else if(!y.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(y.stamped&&y.root!=="body"&&(L||ee)&&!de.has(i)){let b=Ff(o);if(b.length>1)de.add(i),console.warn(`[stx] ${C.relative(process.cwd(),i)} declares ${L?"signals":"bindings"} and has ${b.length} top-level elements (${b.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=y.stamped&&y.root!==null&&Tr(y.root);M=Ie(M,q?A:null)}if(o.includes("@include")||o.includes("@partial"))o=await us(o,w,i,r,S,n);let{processLoops:ne,reportDeferredLoopWarnings:oe}=await import("./chunk-41vnkj8n.js"),G=ne(o,w,i,void 0,!0);G=ie(G,w,i),G=oe(G);let{processMetaDirectives:xe,processSeoDirective:_e,processStructuredData:we}=await import("./chunk-5ppe8d51.js");if(G=xe(G,w,i,r),G=we(G,w,i),G=_e(G,w,i,r),G=E(G,w,i),H)G+=`
49
+ `;continue}if(X)try{let{extractVariables:U}=await import("./chunk-eegs2at0.js");await U(b,w,i)}catch(U){if(r.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(b),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:y}=await import("./chunk-6w3gv9d6.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(q,b)=>{let X=F[Number(b)];return`<script${X.attrs}>${y(X.body,w,h)}</script>`})}if(A){let y=Te(o,A);if(o=y.html,y.mergedIntoExisting){let b=A,X=y.mergedIntoExisting;M=M.split(`'${b}'`).join(`'${X}'`).split(`"${b}"`).join(`"${X}"`),A=X}else if(!y.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(y.stamped&&y.root!=="body"&&(L||ee)&&!de.has(i)){let b=Ff(o);if(b.length>1)de.add(i),console.warn(`[stx] ${C.relative(process.cwd(),i)} declares ${L?"signals":"bindings"} and has ${b.length} top-level elements (${b.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=y.stamped&&y.root!==null&&Tr(y.root);M=Ie(M,q?A:null)}if(o.includes("@include")||o.includes("@partial"))o=await us(o,w,i,r,S,n);let{processLoops:ne,reportDeferredLoopWarnings:oe}=await import("./chunk-pw6n7a9k.js"),G=ne(o,w,i,void 0,!0);G=ie(G,w,i),G=oe(G);let{processMetaDirectives:xe,processSeoDirective:_e,processStructuredData:we}=await import("./chunk-5ppe8d51.js");if(G=xe(G,w,i,r),G=we(G,w,i),G=_e(G,w,i,r),G=E(G,w,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(h,`Error processing include ${h}: ${o}`,x,p)}}let Y=/@include\s*\(/g,Z;while((Z=Y.exec(t))!==null){let h=Z.index,k=h+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(h,p),_=t.substring(k+1,p-1),l=_.match(/^\s*['"]([^'"]+)['"]/);if(!l){Y.lastIndex=p;continue}let o=l[1],O,z=_.substring(l[0].length),v=ae(z,0);if(v!==-1)O=z.substring(v+1).trim();let H={};if(O)try{H=P(O,e)}catch(w){let J=w instanceof Error?w.message:String(w);t=t.replace(i,m("Include",`Error parsing include variables for ${o}: ${J}`,a,c,h)),Y.lastIndex=0;continue}let F=await te(o,H,c,h);t=t.substring(0,h)+F+t.substring(p),Y.lastIndex=0}return t}function ds(c,e){let a=c;function r(S,n,g,t){let D=S,W=!0;while(W){W=!1;let re=new RegExp(`@${n}\\(['"]([^'"]+)['"]\\)`),N=D.match(re);if(!N||N.index===void 0)break;let te=N.index,Y=N[1],Z=te+N[0].length,h=new RegExp(`@${n}\\(`),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(h),O=l.match(k),z=o?p+o.index:1/0,v=O?p+O.index:1/0;if(z<v)x++,p=z+(o[0].length||1);else if(v<1/0){if(x--,x===0){i=v;break}p=v+g.length+1}else break}if(i===-1)break;let _=D.slice(Z,i);if(!e[Y])e[Y]=[];if(t)e[Y].unshift(_);else e[Y].push(_);D=D.substring(0,te)+D.substring(i+`@${g}`.length),W=!0}return D}return a=r(a,"push","endpush",!1),a=r(a,"prepend","endprepend",!0),a}function ps(c,e){return c.replace(/@stack\(['"]([^'"]+)['"]\)/g,(a,r)=>{if(!e[r]||e[r].length===0)return"";return e[r].join(`
53
53
  `)})}
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Se,ot,fi,zs,Bc,Fc,gi,zc,Hc,Hs,hi,Vc,Uc,yi,wn}from"./chunk-5c5nr9sf.js";import{k}from"./chunk-ngnvyqk3.js";import{a}from"./chunk-ga0e15n5.js";import{ko}from"./chunk-16tghnfh.js";import{c}from"./chunk-ehp792dy.js";import{existsSync as B,readFileSync as F}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),te=wn.filter((e)=>!ge.has(e)).sort(),ne=[...k].sort(),he=[...new Set([...te,...ne])].sort(),be=new Set(te),xe=new Set(ne),ye=new Set(he),ee=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function ke(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ie(e,t){let s=[];for(let p of t){if(p.offset===void 0)continue;let i=p.kind==="server"?be:xe;ee.lastIndex=0;for(let u of p.code.matchAll(ee)){let f=u.index+u[0].indexOf("{")+1;for(let m of u[1].matchAll(/[^,]+/g)){let b=m[0];if(/^\s*type\s/.test(b))continue;let S=/^\s*([A-Za-z_$][\w$]*)/.exec(b);if(!S)continue;let r=S[1];if(!ye.has(r)||i.has(r))continue;let d=p.offset+f+m.index+S[0].length-r.length,o=e.slice(0,d),w=o.split(`
2
+ import{Se,ot,fi,zs,Bc,Fc,gi,zc,Hc,Hs,hi,Vc,Uc,yi,wn}from"./chunk-mv48q1p4.js";import{k}from"./chunk-ngnvyqk3.js";import{a}from"./chunk-1qybwj8k.js";import{ko}from"./chunk-pwem4sed.js";import{c}from"./chunk-ehp792dy.js";import{existsSync as B,readFileSync as F}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),te=wn.filter((e)=>!ge.has(e)).sort(),ne=[...k].sort(),he=[...new Set([...te,...ne])].sort(),be=new Set(te),xe=new Set(ne),ye=new Set(he),ee=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function ke(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ie(e,t){let s=[];for(let p of t){if(p.offset===void 0)continue;let i=p.kind==="server"?be:xe;ee.lastIndex=0;for(let u of p.code.matchAll(ee)){let f=u.index+u[0].indexOf("{")+1;for(let m of u[1].matchAll(/[^,]+/g)){let b=m[0];if(/^\s*type\s/.test(b))continue;let S=/^\s*([A-Za-z_$][\w$]*)/.exec(b);if(!S)continue;let r=S[1];if(!ye.has(r)||i.has(r))continue;let d=p.offset+f+m.index+S[0].length-r.length,o=e.slice(0,d),w=o.split(`
3
3
  `).length;s.push({line:w,column:d-(o.lastIndexOf(`
4
4
  `)+1)+1,offset:d,length:r.length,name:r,kind:p.kind,message:ke(r,p.kind)})}}}return s}import N from"path";var we="@stacksjs/stx-typescript-plugin";function $e(e,t){let s=N.resolve(e);for(;;){let p=N.join(s,"tsconfig.json");if(t(p))return p;let i=N.dirname(s);if(i===s)return;s=i}}function re(e,t,s){let p=$e(e,s);if(!p)return;let i=new Set,u=(f)=>{if(i.has(f))return;i.add(f);let m=t(f);if(!m)return;let b=m.compilerOptions?.plugins;if(Array.isArray(b)){let r=b.find((o)=>o?.name===we),d=Array.isArray(r?.libs)?r.libs.filter((o)=>typeof o==="string"):[];return r?{configPath:f,libs:d.map((o)=>N.resolve(N.dirname(f),o))}:null}let S=typeof m.extends==="string"?[m.extends]:Array.isArray(m.extends)?m.extends:[];for(let r of[...S].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let d=N.resolve(N.dirname(f),r.endsWith(".json")?r:`${r}.json`),o=u(d);if(o!==void 0)return o}return};return u(p)??void 0}function pa(e,t="",s="",p=t){let i=e.startLine>1?`
5
5
  `.repeat(e.startLine-1):"",u=fi(hi(e)+e.code,p),f=zs(u.code),m=e.kind==="client"||e.kind==="plain"?zc(t,e.code):"",b=(i+f).split(`
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Bt,ce,_,u,f,P,t,ee,K,l,_e,Ai,z,En,Pi,Ht,Ii,pl,Ir,fl,ct,gl,Or,ml,Tn,Oi,hl,Nr,Dr,Ce,Ni}from"./chunk-0dmpc70r.js";import{pi,Dc,o,C,Ne,Ot,mn,Me,fe,J,kr,hn,Vs,qc,Kc,bn,$r,Ws,qs,Gc,wi,Xc,Jc,Yc,Zc,Le,je,Ks,ze,s,xn,m,p,W,Q,ke,E,Ei}from"./chunk-5c5nr9sf.js";import{jt}from"./chunk-v4bqmzj9.js";import{_n}from"./chunk-njj4mmdc.js";import{b}from"./chunk-txg0pp28.js";import{br,Ns}from"./chunk-9r999ees.js";import{wc,vc,mr,et,xc,O}from"./chunk-ga0e15n5.js";import{ri,si,oi,ii}from"./chunk-vw73gsxx.js";import{gc,ms}from"./chunk-df71jdb5.js";import{us,ds,ps}from"./chunk-3fjdwr6s.js";import{bs,Xo,Jo,ws,vs,Yo}from"./chunk-ht550m3c.js";import{hs,Uo}from"./chunk-m2srr0pz.js";import{Fo}from"./chunk-t5q31st4.js";import{ie,Wo,qo,Ko}from"./chunk-v8p8t3t4.js";import{dr,we,hc,pr,yc}from"./chunk-y3gajdr9.js";import{B,Ze}from"./chunk-ybq56wam.js";import{kc,_c}from"./chunk-5mjsx45g.js";import{T,$n,Mi}from"./chunk-ym5qgw03.js";import Kn from"fs";import se from"path";function pt(n){let e=Ot(n),c=e.find((x)=>x.closing&&x.name.toLowerCase()==="head");if(!c)return n;let a=new Set(["template","svg","noscript","math","textarea","title","xmp","iframe","noembed","noframes","plaintext"]),g=0,r=[];for(let x=0;x<e.length;x++){let w=e[x];if(w.start<c.end)continue;let v=w.name.toLowerCase();if(a.has(v)){g=Math.max(0,g+(w.closing?-1:w.selfClosing?0:1));continue}if(v!=="style"||w.closing||g>0)continue;let k=e[x+1];if(k?.name.toLowerCase()==="style"&&k.closing){if(/@scope\s*\{/.test(n.slice(w.end,k.start)))continue;r.push({start:w.start,end:k.end}),x++}}if(!r.length)return n;let d=r.map((x)=>n.slice(x.start,x.end)).join(`
2
+ import{Bt,ce,_,u,f,P,t,ee,K,l,_e,Ai,z,En,Pi,Ht,Ii,pl,Ir,fl,ct,gl,Or,ml,Tn,Oi,hl,Nr,Dr,Ce,Ni}from"./chunk-0dmpc70r.js";import{pi,Dc,o,C,Ne,Ot,mn,Me,fe,J,kr,hn,Vs,qc,Kc,bn,$r,Ws,qs,Gc,wi,Xc,Jc,Yc,Zc,Le,je,Ks,ze,s,xn,m,p,W,Q,ke,E,Ei}from"./chunk-mv48q1p4.js";import{jt}from"./chunk-v4bqmzj9.js";import{_n}from"./chunk-e8zpzt9s.js";import{b}from"./chunk-9hvfmqs1.js";import{br,Ns}from"./chunk-9r999ees.js";import{wc,vc,mr,et,xc,O}from"./chunk-1qybwj8k.js";import{ri,si,oi,ii}from"./chunk-vw73gsxx.js";import{gc,ms}from"./chunk-q0jmc3m4.js";import{us,ds,ps}from"./chunk-xfb7fdeq.js";import{bs,Xo,Jo,ws,vs,Yo}from"./chunk-4wrddn8m.js";import{hs,Uo}from"./chunk-279n7sde.js";import{Fo}from"./chunk-t5q31st4.js";import{ie,Wo,qo,Ko}from"./chunk-v8p8t3t4.js";import{dr,we,hc,pr,yc}from"./chunk-7hp50cpd.js";import{B,Ze}from"./chunk-ybq56wam.js";import{kc,_c}from"./chunk-qxk9grjm.js";import{T,$n,Mi}from"./chunk-ym5qgw03.js";import Kn from"fs";import se from"path";function pt(n){let e=Ot(n),c=e.find((x)=>x.closing&&x.name.toLowerCase()==="head");if(!c)return n;let a=new Set(["template","svg","noscript","math","textarea","title","xmp","iframe","noembed","noframes","plaintext"]),g=0,r=[];for(let x=0;x<e.length;x++){let w=e[x];if(w.start<c.end)continue;let v=w.name.toLowerCase();if(a.has(v)){g=Math.max(0,g+(w.closing?-1:w.selfClosing?0:1));continue}if(v!=="style"||w.closing||g>0)continue;let k=e[x+1];if(k?.name.toLowerCase()==="style"&&k.closing){if(/@scope\s*\{/.test(n.slice(w.end,k.start)))continue;r.push({start:w.start,end:k.end}),x++}}if(!r.length)return n;let d=r.map((x)=>n.slice(x.start,x.end)).join(`
3
3
  `),y=[n.slice(0,c.start),d,`
4
4
  `],h=c.start;for(let x of r)y.push(n.slice(h,x.start)),h=x.end;return y.push(n.slice(h)),y.join("")}function ft(){return`
5
5
  // STX Lifecycle Runtime
@@ -1295,7 +1295,7 @@ ${R}
1295
1295
  </style>`;a=a.replace(x,D),y.lastIndex=0}catch(R){}}}return a}import ot from"path";var Wn=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,Xn=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function zn(n,e){if(!e||!n.includes("/"))return n;let c=ot.dirname(e);return n.replace(Wn,(a,g,r,d)=>{let y=ot.resolve(c,d);return`${g}${r}${y.split(ot.sep).join("/")}${r}`})}function ur(n,e){if(!e||!n.includes("<script"))return n;return n.replace(Xn,(c,a,g,r)=>`${a}${zn(g,e)}${r}`)}var Te="<!--PARENT_CONTENT_PLACEHOLDER-->";function fr(n){return n.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Sr(n,e){let c=n.length,a=e,g=!0,r=[],d=(y)=>y+9<=c&&n[y]==="<"&&n[y+1]==="/"&&(n[y+2]==="s"||n[y+2]==="S")&&(n[y+3]==="c"||n[y+3]==="C")&&(n[y+4]==="r"||n[y+4]==="R")&&(n[y+5]==="i"||n[y+5]==="I")&&(n[y+6]==="p"||n[y+6]==="P")&&(n[y+7]==="t"||n[y+7]==="T")&&(n[y+8]===">"||/\s/.test(n[y+8]));while(a<c){let y=n[a];if(d(a))return a;if(y==="/"&&n[a+1]==="/"){if(a=n.indexOf(`
1296
1296
  `,a+2),a===-1)return-1;a+=1,g=!0;continue}if(y==="/"&&n[a+1]==="*"){let h=n.indexOf("*/",a+2);if(h===-1)return-1;a=h+2,g=!0;continue}if(y==="/"&&g){let h=a+1,x=!1;while(h<c){let w=n[h];if(w==="\\"){h+=2;continue}if(w==="[")x=!0;else if(w==="]")x=!1;else if(w==="/"&&!x){h++;break}else if(w===`
1297
1297
  `){h=-1;break}h++}if(h===-1){a++,g=!1;continue}while(h<c&&/[a-z]/.test(n[h]))h++;a=h,g=!1;continue}if(y==="'"||y==='"'){let h=y;a++;while(a<c){if(n[a]==="\\"){a+=2;continue}if(n[a]===h){a++;break}if(n[a]===`
1298
- `)break;a++}g=!1;continue}if(y==="`"){a++;while(a<c){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,g=!0;break}a++}if(r.length===0)g=!1;continue}if(y==="}"&&r.length>0){r.pop(),a++;while(a<c){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++,g=!1;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(y));else if(/[)\].\w$]/.test(y))g=!1;else g=!0;a++}return-1}function Er(n,e){let c=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${c}(?:\\s|=|/?>))[^>]*>`,"i").exec(n);if(!a)return null;let g=a.index+a[0].length,r=n.indexOf("</script>",g);if(r===-1)return null;let d=n.indexOf(">",r);if(d===-1)return null;return{start:a.index,end:d+1}}var Gn=4096;async function at(n,e,c){if(c.buildMode!=="serve"||e.length<Gn)return null;let{registerServeModuleBundle:a}=await import("./chunk-hn1c3te7.js");return`<script ${n} src="${a(e)}"></script>`}async function or(n,e,c,a){try{let{registeredModuleIdsIn:g,buildModuleRegistryScript:r}=await o("stx/client-module-registry",()=>import("./chunk-kdc0xsds.js")),d=[],y=await r(g(...n),{minify:Mi(e.buildMode,e.minifyClient),collectInputs:d});for(let h of d)c?.add(h);if(a)a.inputs=d,a.code=y??void 0;if(!y)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:h}=await import("./chunk-hn1c3te7.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${h(y)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${y.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function Zn(n,e,c,a){let g={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:k}=await o("stx/framework-composables",()=>import("./chunk-4ekpj06v.js"));g.frameworkScript=await k(n)}catch{}let r=null;try{r=await o("stx/store-loader",()=>import("./chunk-dxgjmdnx.js"))}catch{}let d=e.storesDir,y=!!a.__stx_native_screen||(r?.pageStoresAll()??!0),h=y?"":n.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),x=[],w=[],v=null;for(let k=0;k<8;k++){let S=null,M="",A=!1;try{if(r){let N=y?await r.getStoreScript(d).then((F)=>F?{code:F,stores:["*"],functions:null}:null):await r.getStoreScriptFor(d,[h],{reads:r.storesReadInFiles([...x,...w]),runOnce:!0});if(N)S=N.code,M=N.stores.join(","),A=!!N.functions&&!y}}catch{}if(v!==null&&M===v)break;v=M;let R=A?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",D=S?`<script ${R}>${S}</script>`:null;g.storeCode=S,g.storeTag=S?await at(R,S,e)??D:null;let j={};g.modulesTag=await or([n,D],e,c,j),g.modulesCode=j.code??null,x=j.inputs??[],g.composableTag=null,g.composableCode=null,w=[];try{let{getComposableScript:N}=await o("stx/composable-loader",()=>import("./chunk-vz0t4mnc.js")),F=e.composablesDir,I=[g.modulesCode??g.modulesTag,D,g.frameworkScript].filter((H)=>H!==null),L=await N(e._layerComposableDirs??F,n,I,w);if(L)g.composableCode=L,g.composableTag=await at('data-stx-scoped data-stx-run="always" data-stx-composables',L,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${L}</script>`}catch{}if(y||!r)break}return g}async function Jn(n,e,c,a={}){let{withModuleSubstitutes:g,moduleSubstitutionKey:r}=await import("./chunk-spnq5xjw.js"),d=await import("./chunk-05f4tjsq.js"),{messages:y,webModules:h}=e,x=null,w=null,v=r()===""&&!a.__stx_native_screen;if(y&&d.pageMessagesEnabled(e)&&v)try{x=await d.loadPageMessages(process.cwd(),y)}catch(R){Qn(R)}if(h&&Object.keys(h).length&&v)try{w=await(await import("./chunk-mmdqdkbd.js")).loadWebModules(process.cwd(),h)}catch(R){Yn(R)}let k=new Map([...w??[],...x?.stubs??[]]),S=()=>Zn(n,e,c,a),M=k.size?await g(k,S):await S(),A=null;if(x){let R=d.messageAreasIn(M.modulesCode,M.storeCode,M.composableCode),D=d.pageMessagesScript(x,d.pageLanguages(n,x),R);if(D)A=await at('data-stx-scoped data-stx-run="always" data-stx-messages',D,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${D.replace(/<\/script/gi,"<\\/script")}</script>`}return[A,M.modulesTag,M.storeTag,M.composableTag,M.frameworkScript].filter((R)=>R!==null)}var gr=!1;function Qn(n){if(gr)return;gr=!0,console.warn(`[stx] messages: ${n instanceof Error?n.message:String(n)}; pages ship every language`)}var hr=!1;function Yn(n){if(hr)return;hr=!0,console.warn(`[stx] ${n instanceof Error?n.message:String(n)}; pages bundle the real modules`)}function es(n,e=""){let c=Er(n,"data-stx-runtime");if(!c)return n;let a=dr(n);if(a===-1||a===c.start){if(!e)return n;return n.slice(0,c.end)+e+n.slice(c.end)}if(a<c.start)return n.slice(0,a)+n.slice(c.start,c.end)+e+`
1298
+ `)break;a++}g=!1;continue}if(y==="`"){a++;while(a<c){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,g=!0;break}a++}if(r.length===0)g=!1;continue}if(y==="}"&&r.length>0){r.pop(),a++;while(a<c){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"){a++,g=!1;break}if(n[a]==="$"&&n[a+1]==="{"){r.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(y));else if(/[)\].\w$]/.test(y))g=!1;else g=!0;a++}return-1}function Er(n,e){let c=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${c}(?:\\s|=|/?>))[^>]*>`,"i").exec(n);if(!a)return null;let g=a.index+a[0].length,r=n.indexOf("</script>",g);if(r===-1)return null;let d=n.indexOf(">",r);if(d===-1)return null;return{start:a.index,end:d+1}}var Gn=4096;async function at(n,e,c){if(c.buildMode!=="serve"||e.length<Gn)return null;let{registerServeModuleBundle:a}=await import("./chunk-8gsd2n0j.js");return`<script ${n} src="${a(e)}"></script>`}async function or(n,e,c,a){try{let{registeredModuleIdsIn:g,buildModuleRegistryScript:r}=await o("stx/client-module-registry",()=>import("./chunk-f858fazq.js")),d=[],y=await r(g(...n),{minify:Mi(e.buildMode,e.minifyClient),collectInputs:d});for(let h of d)c?.add(h);if(a)a.inputs=d,a.code=y??void 0;if(!y)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:h}=await import("./chunk-8gsd2n0j.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${h(y)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${y.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function Zn(n,e,c,a){let g={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:k}=await o("stx/framework-composables",()=>import("./chunk-yscys65t.js"));g.frameworkScript=await k(n)}catch{}let r=null;try{r=await o("stx/store-loader",()=>import("./chunk-2y20dvab.js"))}catch{}let d=e.storesDir,y=!!a.__stx_native_screen||(r?.pageStoresAll()??!0),h=y?"":n.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),x=[],w=[],v=null;for(let k=0;k<8;k++){let S=null,M="",A=!1;try{if(r){let N=y?await r.getStoreScript(d).then((F)=>F?{code:F,stores:["*"],functions:null}:null):await r.getStoreScriptFor(d,[h],{reads:r.storesReadInFiles([...x,...w]),runOnce:!0});if(N)S=N.code,M=N.stores.join(","),A=!!N.functions&&!y}}catch{}if(v!==null&&M===v)break;v=M;let R=A?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",D=S?`<script ${R}>${S}</script>`:null;g.storeCode=S,g.storeTag=S?await at(R,S,e)??D:null;let j={};g.modulesTag=await or([n,D],e,c,j),g.modulesCode=j.code??null,x=j.inputs??[],g.composableTag=null,g.composableCode=null,w=[];try{let{getComposableScript:N}=await o("stx/composable-loader",()=>import("./chunk-161ksm7f.js")),F=e.composablesDir,I=[g.modulesCode??g.modulesTag,D,g.frameworkScript].filter((H)=>H!==null),L=await N(e._layerComposableDirs??F,n,I,w);if(L)g.composableCode=L,g.composableTag=await at('data-stx-scoped data-stx-run="always" data-stx-composables',L,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${L}</script>`}catch{}if(y||!r)break}return g}async function Jn(n,e,c,a={}){let{withModuleSubstitutes:g,moduleSubstitutionKey:r}=await import("./chunk-qccpfn5x.js"),d=await import("./chunk-05f4tjsq.js"),{messages:y,webModules:h}=e,x=null,w=null,v=r()===""&&!a.__stx_native_screen;if(y&&d.pageMessagesEnabled(e)&&v)try{x=await d.loadPageMessages(process.cwd(),y)}catch(R){Qn(R)}if(h&&Object.keys(h).length&&v)try{w=await(await import("./chunk-mmdqdkbd.js")).loadWebModules(process.cwd(),h)}catch(R){Yn(R)}let k=new Map([...w??[],...x?.stubs??[]]),S=()=>Zn(n,e,c,a),M=k.size?await g(k,S):await S(),A=null;if(x){let R=d.messageAreasIn(M.modulesCode,M.storeCode,M.composableCode),D=d.pageMessagesScript(x,d.pageLanguages(n,x),R);if(D)A=await at('data-stx-scoped data-stx-run="always" data-stx-messages',D,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${D.replace(/<\/script/gi,"<\\/script")}</script>`}return[A,M.modulesTag,M.storeTag,M.composableTag,M.frameworkScript].filter((R)=>R!==null)}var gr=!1;function Qn(n){if(gr)return;gr=!0,console.warn(`[stx] messages: ${n instanceof Error?n.message:String(n)}; pages ship every language`)}var hr=!1;function Yn(n){if(hr)return;hr=!0,console.warn(`[stx] ${n instanceof Error?n.message:String(n)}; pages bundle the real modules`)}function es(n,e=""){let c=Er(n,"data-stx-runtime");if(!c)return n;let a=dr(n);if(a===-1||a===c.start){if(!e)return n;return n.slice(0,c.end)+e+n.slice(c.end)}if(a<c.start)return n.slice(0,a)+n.slice(c.start,c.end)+e+`
1299
1299
  `+n.slice(a,c.start)+n.slice(c.end);let g=n.slice(c.start,c.end),r=n.slice(0,c.start)+n.slice(c.end),d=dr(r);if(d===-1)return g+e+`
1300
1300
  `+r;return r.slice(0,d)+g+e+`
1301
1301
  `+r.slice(d)}function ts(n){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return n.replace(e,(c,a,g)=>{let r=n.slice(0,g);return r.lastIndexOf("<")>r.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(n,e,c,a,g){if(await _(),a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return n;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=ke(n,c);let r=!e.__stxProcessingDepth;bn(e);for(let d of a._layerGraph?.configDependencies??[])g.add(d);if(r&&a.runtimeConfig)await _n(e,c,a.runtimeConfig);if(r)Yc(e),e.__stx_scope_seq??={n:0,key:Ks(String(e.__filename??c))},e.__stx_head_injections=Ii(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!T()&&!$n())&&c&&c.endsWith(".stx"))Fo(n,c);try{return await ce.timeAsync("template-processing",async()=>{let d=await rs(n,e,c,a,g);if(r)d=wi(d);if(r&&a.autoShell&&a.buildMode!=="compile"){let y=Ce(a.app?.head,{known:Dr,source:"app.head"}),x=(e.__stx_runtime_head||null)??Ni(),w=(e.__stx_head_raw||"").trim(),v,k=w.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(k)v=k[1].trim(),w=w.replace(k[0],"").trim();let S=e.__sections?.title,M=S?E(S,e,c):void 0,A=x.title||v||M,R=!x.title&&(!!v||!!M),D=x.meta||[],j=new Set(D.map((V)=>ct(V)).filter(Boolean)),N={...y,...A&&{title:A},meta:[...(y.meta||[]).filter((V)=>!j.has(ct(V))),...D],link:[...y.link||[],...x.link||[]],script:[...y.script||[],...x.script||[]],headRaw:[y.headRaw,w].filter(Boolean).join(`
@@ -1310,7 +1310,7 @@ ${h.trim()}
1310
1310
  @endsection`}}if(D&&h.includes("<script")){let I=J(h),L=I.scripts.map((H)=>yr(H,c)??H);h=kr(I.output,L)}if(h=h.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(I,L,H)=>(R[L]=H,"")),h=h.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(I,L,H)=>{if(/^(['"]).*\1$/.test(H.trim()))return I;try{let V=u(H.trim(),e);if(V===void 0)return I;let X=(e.__stx_inline_section_values??=[]).push(V)-1;return R[L]=`{{ __stx_inline_section_values[${X}] }}`,""}catch{return I}}),h=h.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(I,L,H)=>{if(H.includes("@parent"))R[L]=H.replace("@parent",Te);else R[L]=H.trim();return""}),e.__sections=R,h=h.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(I,L,H)=>R[L]||H||""),!("slot"in e)||e.slot===void 0)h=h.replace(/\{\{\s*slot\s*\}\}/g,()=>R.content||"");if(h=ps(h,A),D){let I=[],L=J(h),H=fe(L.output,mn,(V,ae)=>`\x00STX_ORPHAN_STYLE_${ae}\x00`);if(h=H.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(V,ae,X)=>{let le=ae==="SCRIPT"?yr(L.scripts[Number(X)],c):H.tokens[Number(X)];if(le)I.push(le);return""}),I.length>0){let V=I.join(`
1311
1311
  `);R.content=R.content?`${R.content}
1312
1312
  ${V}`:V,e.__sections=R}}if(D)try{let I;if(se.isAbsolute(D))I=D,g.add(D);else I=await _e(()=>xn(D,c,d,g),null,()=>{throw new ee(`Failed to resolve layout path: ${D}`,c,void 0,void 0,`Layout referenced from ${c}`)});if(!I){let oe=(G)=>{if(!G)return[];try{let ye=se.isAbsolute(G)?G:se.resolve(process.cwd(),G);return Kn.readdirSync(ye).filter((xe)=>xe.endsWith(".stx")).map((xe)=>xe.replace(/\.stx$/,""))}catch{return[]}},te=[...oe(d.layoutsDir),...oe(d.fallbackLayoutsDir)].filter((G,ye,xe)=>xe.indexOf(G)===ye).sort(),he=[d.layoutsDir,d.fallbackLayoutsDir].filter((G)=>typeof G==="string"&&G.length>0),de=he.length>0?` Searched: ${he.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",re=`Layout not found: ${D} (referenced from ${c})`+(te.length>0?`. Available layouts: ${te.join(", ")}`:d.layoutsDir?`. No .stx layouts found in ${d.layoutsDir}`:"")+de;if(z.log(Error(re),{layoutPath:D,filePath:c,available:te},"error"),console.error(`[stx] ${re}`),d.debug)throw new ee(re,c);return h}let L=await _e(()=>Bun.file(I).text(),"",()=>{throw new ee(`Failed to read layout file: ${I}`,c,void 0,void 0,"Layout content could not be loaded")});L=ur(L,I),L=L.replace(/\{\{--[\s\S]*?--\}\}/g,"");let H=Array.isArray(e.__layoutChain)?e.__layoutChain:[];if(H.includes(I)){let oe=[...H.slice(H.indexOf(I)),I];throw new ee(oe.length===2?`Circular layout: ${I} extends itself`:`Circular layout: ${oe.join(" -> ")}`,c,void 0,void 0,"Remove the @extends or @layout line that points back at a layout already in use")}let V=L.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(V){if(d.debug)console.log(`Found nested layout: ${V[1]} in ${I}`);let oe={},te=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(re,G,ye)=>(oe[G]=ye.trim(),""));for(let[re,G]of Object.entries(oe))if(R[re]&&R[re].includes(Te)){let ye=R[re].indexOf(Te);R[re]=R[re].slice(0,ye)+G+R[re].slice(ye+Te.length)}else if(!R[re])R[re]=G;let he={...e,__sections:R,__layoutChain:[...H,I]},de=`@layout('${V[1]}')${te}`;return await i(de,he,I,d,g)}let ae=L.replace(/\{\{--[\s\S]*?--\}\}/g,""),X=ds(ae,A),le={};return X=X.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(oe,te,he)=>(le[te]=he.trim(),`@slot('${te}')`)),X=X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(oe,te,he)=>{if(R[te]){let de=R[te];if(de.includes(Te)){let re=le[te]||"",G=de.indexOf(Te);de=de.slice(0,G)+re+de.slice(G+Te.length)}return de}return he||""}),X=ns(X,R),X=X.replace(/\{\{\s*slot\s*\}\}/g,()=>R.content||""),X=ps(X,A),e.__originalFilePath=c,h=await xr(X,e,I,d,g),h=`<!-- stx-layout: ${D} -->
1313
- ${h}`,v(h)}catch(I){if(I instanceof K)throw I;throw new ee(`Error processing layout ${D}: ${I instanceof Error?I.message:String(I)}`,c)}return v(await xr(h,e,c,d,g))}function ns(n,e){return n.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,a,g)=>{let r=e[a];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return g||""})}function ss(n,e){if(n.__stx_sfc_mode=!0,n.__stx_options=e,e.buildMode)n.__stx_buildMode=e.buildMode;let c=e.envPrefix||"STX_PUBLIC_",a={};for(let[g,r]of Object.entries(process.env))if(g.startsWith(c)&&r!==void 0)a[g]=r;n.$env=a}async function is(n,e){await _e(()=>Zt(n,e),void 0,(c)=>{z.log(c,{filePath:n,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${n}: ${c.message}`)})}var lt="data-stx-source";function yr(n,e){if(!n)return n;let c=/^<script\b([^>]*)>/i.exec(n);if(!c||!/\bserver\b/.test(c[1])||c[1].includes(lt))return n;return`<script ${lt}="${encodeURIComponent(e)}"${n.slice(7)}`}function os(n){let e=new RegExp(`${lt}="([^"]*)"`).exec(n);return e?decodeURIComponent(e[1]):void 0}function wr(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function vr(n,e,c){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${wr(n)}</span><span style="display:block;margin-top:4px">${wr(c)}</span></div>`}async function as(n,e,c,a){let{scanScriptTags:g}=await o("stx/signal-processing",()=>import("./chunk-j05z0m3r.js")),r=[],d=!T()&&!$n();for(let h of g(n)){let x=h.attrs;if(!/\bserver\b/.test(x))continue;let w=h.start+h.fullMatch.indexOf(">")+1,v=Sr(n,w);if(v===-1)continue;let k=n.slice(w,v);if(!k.trim())continue;let S=os(x)??c,M={index:h.start,length:v+9-h.start};try{let{extractVariables:A}=await o("stx/variable-extractor",()=>import("./chunk-qndtva3r.js"));await A(k,e,S,{preserveExisting:!0,onFailure:(R)=>{if(R.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:S,kind:R.kind,message:R.message}),!d)return;r.push({...M,markup:vr(S,R.kind,R.message)})}})}catch(A){let R=A instanceof Error?A:Error(String(A));if(z.log(R,{filePath:S,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${S}: ${R.message}`),d)r.push({...M,markup:vr(S,"unknown",R.message)})}}if(r.length===0)return n;let y=n;for(let h of r.sort((x,w)=>w.index-x.index))y=y.slice(0,h.index)+h.markup+y.slice(h.index+h.length);return y}async function cs(n,e,c){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-h8bqgjw4.js"));return a(n,e,{skipServer:!0})}catch(a){let g=a instanceof Error?a:Error(String(a));return z.log(g,{filePath:c,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${c}: ${g.message}`),n}}async function xr(n,e,c,a,g){let r=n;await _();let d=a;if(r=await as(r,e,c,a),r=await Ut(r,e,c),r=await qt(r,e,c),r=await cs(r,e,c),await _(),r=await At(r,e,c,d),ke(r))r=Xo(r,e),r=vs(r,e),r=ws(r,e);r=Jo(r),await _();let{processStreamDirectives:y}=await o("stx/streaming",()=>import("./chunk-dq41v6hy.js"));r=y(r,e),r=await Uo(r,e,c,d,!0),await _(),r=await rr(r,e,c,d,g),r=await ms(r,e,c,d,g),await _(),r=wc(r,e,c,d);let{processDeferDirectives:h}=await o("stx/defer",()=>import("./chunk-dw9vnhc4.js"));r=h(r,e,c);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-vw9h1x2m.js"));r=x(r,e,c);let{processTransitionDirectives:w,processTransitionAttributes:v}=await o("stx/transitions",()=>import("./chunk-bz4bskx3.js"));r=w(r,e,c),r=v(r);let{processErrorBoundaryDirectives:k,stripRenderFailedMarkers:S}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));r=k(r,e,c),r=S(r);let{processSuspenseDirectives:M}=await o("stx/suspense",()=>import("./chunk-x2vybq9n.js"));r=M(r,e,c);let{processAsyncDirectives:A}=await o("stx/async-components",()=>import("./chunk-fsg958xx.js"));r=A(r,e,c);let{processKeepAliveDirectives:R}=await o("stx/keep-alive",()=>import("./chunk-q1z8edtn.js"));r=R(r,e,c);let{processVirtualListDirectives:D,processVirtualGridDirectives:j,processInfiniteListDirectives:N}=await o("stx/virtual-scrolling",()=>import("./chunk-knd3m4t4.js"));r=D(r,e,c),r=j(r,e,c),r=N(r,e,c),await _();let{processPartialHydrationDirectives:F,processStaticDirectives:I}=await o("stx/partial-hydration",()=>import("./chunk-dee5mtdv.js"));r=F(r,e,c),r=I(r);let{processComputedDirectives:L,processWatchDirectives:H}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));r=L(r,e,c),r=H(r,e,c);let{processFormValidationDirectives:V}=await o("stx/forms-validation",()=>import("./chunk-5wct6n72.js"));r=V(r,e,c);let{processHeadDirective:ae,processTitleDirective:X,processMetaDirective:le,resetHead:oe}=await o("stx/head",()=>import("./chunk-kez50h8a.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)oe();let te=ae(r);if(r=te.content,te.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${te.headContent}
1313
+ ${h}`,v(h)}catch(I){if(I instanceof K)throw I;throw new ee(`Error processing layout ${D}: ${I instanceof Error?I.message:String(I)}`,c)}return v(await xr(h,e,c,d,g))}function ns(n,e){return n.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,a,g)=>{let r=e[a];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return g||""})}function ss(n,e){if(n.__stx_sfc_mode=!0,n.__stx_options=e,e.buildMode)n.__stx_buildMode=e.buildMode;let c=e.envPrefix||"STX_PUBLIC_",a={};for(let[g,r]of Object.entries(process.env))if(g.startsWith(c)&&r!==void 0)a[g]=r;n.$env=a}async function is(n,e){await _e(()=>Zt(n,e),void 0,(c)=>{z.log(c,{filePath:n,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${n}: ${c.message}`)})}var lt="data-stx-source";function yr(n,e){if(!n)return n;let c=/^<script\b([^>]*)>/i.exec(n);if(!c||!/\bserver\b/.test(c[1])||c[1].includes(lt))return n;return`<script ${lt}="${encodeURIComponent(e)}"${n.slice(7)}`}function os(n){let e=new RegExp(`${lt}="([^"]*)"`).exec(n);return e?decodeURIComponent(e[1]):void 0}function wr(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function vr(n,e,c){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${wr(n)}</span><span style="display:block;margin-top:4px">${wr(c)}</span></div>`}async function as(n,e,c,a){let{scanScriptTags:g}=await o("stx/signal-processing",()=>import("./chunk-bk0arddt.js")),r=[],d=!T()&&!$n();for(let h of g(n)){let x=h.attrs;if(!/\bserver\b/.test(x))continue;let w=h.start+h.fullMatch.indexOf(">")+1,v=Sr(n,w);if(v===-1)continue;let k=n.slice(w,v);if(!k.trim())continue;let S=os(x)??c,M={index:h.start,length:v+9-h.start};try{let{extractVariables:A}=await o("stx/variable-extractor",()=>import("./chunk-eegs2at0.js"));await A(k,e,S,{preserveExisting:!0,onFailure:(R)=>{if(R.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:S,kind:R.kind,message:R.message}),!d)return;r.push({...M,markup:vr(S,R.kind,R.message)})}})}catch(A){let R=A instanceof Error?A:Error(String(A));if(z.log(R,{filePath:S,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${S}: ${R.message}`),d)r.push({...M,markup:vr(S,"unknown",R.message)})}}if(r.length===0)return n;let y=n;for(let h of r.sort((x,w)=>w.index-x.index))y=y.slice(0,h.index)+h.markup+y.slice(h.index+h.length);return y}async function cs(n,e,c){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-6w3gv9d6.js"));return a(n,e,{skipServer:!0})}catch(a){let g=a instanceof Error?a:Error(String(a));return z.log(g,{filePath:c,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${c}: ${g.message}`),n}}async function xr(n,e,c,a,g){let r=n;await _();let d=a;if(r=await as(r,e,c,a),r=await Ut(r,e,c),r=await qt(r,e,c),r=await cs(r,e,c),await _(),r=await At(r,e,c,d),ke(r))r=Xo(r,e),r=vs(r,e),r=ws(r,e);r=Jo(r),await _();let{processStreamDirectives:y}=await o("stx/streaming",()=>import("./chunk-ggthncvg.js"));r=y(r,e),r=await Uo(r,e,c,d,!0),await _(),r=await rr(r,e,c,d,g),r=await ms(r,e,c,d,g),await _(),r=wc(r,e,c,d);let{processDeferDirectives:h}=await o("stx/defer",()=>import("./chunk-dw9vnhc4.js"));r=h(r,e,c);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-vw9h1x2m.js"));r=x(r,e,c);let{processTransitionDirectives:w,processTransitionAttributes:v}=await o("stx/transitions",()=>import("./chunk-bz4bskx3.js"));r=w(r,e,c),r=v(r);let{processErrorBoundaryDirectives:k,stripRenderFailedMarkers:S}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));r=k(r,e,c),r=S(r);let{processSuspenseDirectives:M}=await o("stx/suspense",()=>import("./chunk-x2vybq9n.js"));r=M(r,e,c);let{processAsyncDirectives:A}=await o("stx/async-components",()=>import("./chunk-fsg958xx.js"));r=A(r,e,c);let{processKeepAliveDirectives:R}=await o("stx/keep-alive",()=>import("./chunk-q1z8edtn.js"));r=R(r,e,c);let{processVirtualListDirectives:D,processVirtualGridDirectives:j,processInfiniteListDirectives:N}=await o("stx/virtual-scrolling",()=>import("./chunk-knd3m4t4.js"));r=D(r,e,c),r=j(r,e,c),r=N(r,e,c),await _();let{processPartialHydrationDirectives:F,processStaticDirectives:I}=await o("stx/partial-hydration",()=>import("./chunk-dee5mtdv.js"));r=F(r,e,c),r=I(r);let{processComputedDirectives:L,processWatchDirectives:H}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));r=L(r,e,c),r=H(r,e,c);let{processFormValidationDirectives:V}=await o("stx/forms-validation",()=>import("./chunk-dfcnaaym.js"));r=V(r,e,c);let{processHeadDirective:ae,processTitleDirective:X,processMetaDirective:le,resetHead:oe}=await o("stx/head",()=>import("./chunk-kez50h8a.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)oe();let te=ae(r);if(r=te.content,te.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${te.headContent}
1314
1314
  `;if(r=X(r,e),r=le(r,e,c),r=Gt(r),r=Wo(r,e),r=Tt(r),r=Wt(r),r=await us(r,e,c,d,g),r=await ms(r,e,c,d,g),await _(),r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),r=wi(r),r=ie(r,e,c),r=hs(r),await _(),e.__stxProcessingDepth===1)r=Zc(r,e);if(r=qc(r,e,{filePath:c,buildMode:d.buildMode}),r=qo(r,e),r=Ko(r,e),r=Xe(r,e),r=Nt(r,e),r=Ft(r,e),r=await vt(r,e,c,d),r=await xc(r,e,c),r=await kc(r,e,c,d),await _(),r=_c(r,e,c,d),r=ri(r,e,c,d),r=si(r,e,c),r=oi(r,e,c,d),r=_t(r,e,c,d),r=Ws(r,e),r=qs(r),r=Gc(r),!d.skipEventDirectives)r=Dc(r,e,c);if(r=Kc(r,e,c,a.skipSignalsRuntime===!0&&Number(e.__stxProcessingDepth)>0),await _(),d.debug){let U=/\bx-data\s*=/.test(r),q=bs(n);if(U&&q)console.warn(`[stx] ${c}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
1315
1315
  Both work on the same page, but they manage separate scopes.
1316
1316
  Prefer signals (state/derived/effect) for new components.`)}r=gc(r,e),r=await Ei(r,e,c),await _(),r=Xc(r),r=Jc(r),r=ht(r);let{processXElementDirectives:he}=await o("stx/x-element",()=>import("./chunk-zhxdpzga.js"));r=he(r);let de=e.__originalFilePath||c,re=Le(e);if(r=await Yo(r,d,de,re),await _(),r=It(r,e),r=await Kt(r,e,c,d),await _(),d.media?.image?.autoSiblings){let U=d.publicDir||"public",{rewriteImagesWithSiblings:q}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-kfq4mwem.js"));r=await q(r,{publicDir:U})}if(d.seo?.enabled)r=ii(r,e,d);let G=(U,q,Z=!0)=>{if(!q)return U;let me=q.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),ne=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(U),pe=ne?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(ne[0]):null;if(me&&ne&&pe){if(Z){let Re=ne.index+pe.index;U=U.slice(0,Re)+me[0]+U.slice(Re+pe[0].length)}if(q=q.replace(me[0],"").trim(),!q)return U}if(/<\/head>/i.test(U))return U.replace(/<\/head>/i,`${q}
@@ -1324,6 +1324,6 @@ ${ft()}
1324
1324
  `+Re}else r=r.replace("</head>",`${q}
1325
1325
  </head>`)}else if(r.includes("<body"))r=r.replace(/<body([^>]*)>/,`<body$1>
1326
1326
  ${q}`);else r=q+`
1327
- `+r}{let{scanScriptTags:U}=await o("stx/signal-processing",()=>import("./chunk-j05z0m3r.js")),q=[];for(let Z of U(r)){if(!/\bserver\b/i.test(Z.attrs))continue;let me=Z.start+Z.fullMatch.indexOf(">")+1,ne=Sr(r,me);if(ne===-1)continue;let pe=ne+9;while(pe<r.length&&/\s/.test(r[pe]))pe++;q.push({start:Z.start,end:pe})}if(q.length>0){let Z=Array(q.length+1),me=0;for(let ne=0;ne<q.length;ne++){let{start:pe,end:Re}=q[ne];Z[ne]=r.slice(me,pe),me=Re}Z[q.length]=r.slice(me),r=Z.join("")}}let ut=Vs(r,c);if(ut.hasScoped)r=ut.html;let Ar=e.__stx_event_bindings||[],Ge=!1,dt=[],Rr=/\s:[a-z][\w.-]*\s*=/.test(r),{scanScriptTags:Mr}=await o("stx/signal-processing",()=>import("./chunk-j05z0m3r.js"));for(let U of Mr(r,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))dt.push({match:U.fullMatch,attrs:U.attrs,content:U.body});for(let{match:U,attrs:q,content:Z}of dt){Ge=!0;let me=Z;Ne(Z,c,a.strict,e.__originalFilePath);let ne=await je(Z,{eventBindings:Ar,attrs:q,hasColonDirectives:Rr,templateContent:n,filePath:c,projectRoot:process.cwd(),production:Mi(a.buildMode,a.minifyClient),serverData:re});r=r.replace(U,()=>ne)}if(Ge)e.__stx_event_bindings=[];if(!Ge&&e.__stxProcessingDepth===1){let U=e.__stx_event_bindings||[];if(U.length>0){let q=pi(U);if(q){let Z=r.lastIndexOf("</body>");r=Z===-1?r+q:r.slice(0,Z)+q+`
1327
+ `+r}{let{scanScriptTags:U}=await o("stx/signal-processing",()=>import("./chunk-bk0arddt.js")),q=[];for(let Z of U(r)){if(!/\bserver\b/i.test(Z.attrs))continue;let me=Z.start+Z.fullMatch.indexOf(">")+1,ne=Sr(r,me);if(ne===-1)continue;let pe=ne+9;while(pe<r.length&&/\s/.test(r[pe]))pe++;q.push({start:Z.start,end:pe})}if(q.length>0){let Z=Array(q.length+1),me=0;for(let ne=0;ne<q.length;ne++){let{start:pe,end:Re}=q[ne];Z[ne]=r.slice(me,pe),me=Re}Z[q.length]=r.slice(me),r=Z.join("")}}let ut=Vs(r,c);if(ut.hasScoped)r=ut.html;let Ar=e.__stx_event_bindings||[],Ge=!1,dt=[],Rr=/\s:[a-z][\w.-]*\s*=/.test(r),{scanScriptTags:Mr}=await o("stx/signal-processing",()=>import("./chunk-bk0arddt.js"));for(let U of Mr(r,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))dt.push({match:U.fullMatch,attrs:U.attrs,content:U.body});for(let{match:U,attrs:q,content:Z}of dt){Ge=!0;let me=Z;Ne(Z,c,a.strict,e.__originalFilePath);let ne=await je(Z,{eventBindings:Ar,attrs:q,hasColonDirectives:Rr,templateContent:n,filePath:c,projectRoot:process.cwd(),production:Mi(a.buildMode,a.minifyClient),serverData:re});r=r.replace(U,()=>ne)}if(Ge)e.__stx_event_bindings=[];if(!Ge&&e.__stxProcessingDepth===1){let U=e.__stx_event_bindings||[];if(U.length>0){let q=pi(U);if(q){let Z=r.lastIndexOf("</body>");r=Z===-1?r+q:r.slice(0,Z)+q+`
1328
1328
  `+r.slice(Z)}e.__stx_event_bindings=[]}}if(!d.skipSignalsRuntime&&!we(r)&&hc(r))r=await pr(r,d);if(r=yc(r),d.csp?.enabled&&d.csp.useNonce&&typeof e.cspNonce==="string")r=Et(r,e.cspNonce);return r}
1329
1329
  export{wt,Ae,uc,ls,jo,Bo,or,i};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-ngnvyqk3.js";import"./chunk-xppm4cs4.js";import"./chunk-0dmpc70r.js";import{w,S,C,Z}from"./chunk-5c5nr9sf.js";import"./chunk-v4bqmzj9.js";import"./chunk-njj4mmdc.js";import{lr}from"./chunk-14cvwsy1.js";import{existsSync as R}from"fs";import l from"path";var b=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useCompletion","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVirtualList","useVisibility","useWakeLock","useWindowSize"],F=new Set(b);var u=new Map,h=w(64),x=new Set,k=0,P=new Set(b);function z(){u.clear(),h.clear()}function I(s){let o=new Map;for(let t of s){let i=l.basename(t);if(i.endsWith(".d.ts"))continue;let r=i.replace(/\.[jt]s$/,"");if(r==="index")continue;if(r===i)continue;let a=o.get(r);if(a&&!a.endsWith(".js"))continue;o.set(r,t)}return[...o.values()].sort()}function M(s,o){let t=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${t}\\b`).test(s)}function L(s){if(!s)return[];let o=S(s,k),t=h.get(o);if(t)return t.slice();let i=s.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),r=[];for(let a of P){if(x.has(a))continue;let p=a.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${p}\\s*\\(`).test(i))r.push(a)}return r.sort(),h.set(o,r),r.slice()}function _(){let s=l.join(import.meta.dir,"composables"),o=import.meta.url.endsWith(".ts")?"ts":"js";if(R(l.join(s,`index.${o}`)))return s;let t=lr("@stacksjs/stx/composables");return t?l.dirname(t):void 0}async function V(s,o){let t=L(s);if(t.length===0)return null;let i=o??_();if(!i)return null;let r=`${i}\x00${t.join(",")}`,a=u.get(r);if(a!==void 0)return a||null;let p=Z({loader:"ts",target:"browser",define:C()}),O=new Set(t),m=[],d=new Set,f=[];try{let n=new Bun.Glob("*.{ts,js}");for await(let e of n.scan({cwd:i,absolute:!0}))f.push(e)}catch{return u.set(r,""),null}f=I(f);for(let n of f){let e;try{e=await Bun.file(n).text()}catch{continue}let g=[];try{g=p.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>O.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${l.basename(n).replace(/\.[jt]s$/,"")}
2
+ import"./chunk-ngnvyqk3.js";import"./chunk-xppm4cs4.js";import"./chunk-0dmpc70r.js";import{w,S,C,Z}from"./chunk-mv48q1p4.js";import"./chunk-v4bqmzj9.js";import"./chunk-e8zpzt9s.js";import{lr}from"./chunk-14cvwsy1.js";import{existsSync as R}from"fs";import l from"path";var b=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useCompletion","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVirtualList","useVisibility","useWakeLock","useWindowSize"],F=new Set(b);var u=new Map,h=w(64),x=new Set,k=0,P=new Set(b);function z(){u.clear(),h.clear()}function I(s){let o=new Map;for(let t of s){let i=l.basename(t);if(i.endsWith(".d.ts"))continue;let r=i.replace(/\.[jt]s$/,"");if(r==="index")continue;if(r===i)continue;let a=o.get(r);if(a&&!a.endsWith(".js"))continue;o.set(r,t)}return[...o.values()].sort()}function M(s,o){let t=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${t}\\b`).test(s)}function L(s){if(!s)return[];let o=S(s,k),t=h.get(o);if(t)return t.slice();let i=s.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),r=[];for(let a of P){if(x.has(a))continue;let p=a.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${p}\\s*\\(`).test(i))r.push(a)}return r.sort(),h.set(o,r),r.slice()}function _(){let s=l.join(import.meta.dir,"composables"),o=import.meta.url.endsWith(".ts")?"ts":"js";if(R(l.join(s,`index.${o}`)))return s;let t=lr("@stacksjs/stx/composables");return t?l.dirname(t):void 0}async function V(s,o){let t=L(s);if(t.length===0)return null;let i=o??_();if(!i)return null;let r=`${i}\x00${t.join(",")}`,a=u.get(r);if(a!==void 0)return a||null;let p=Z({loader:"ts",target:"browser",define:C()}),O=new Set(t),m=[],d=new Set,f=[];try{let n=new Bun.Glob("*.{ts,js}");for await(let e of n.scan({cwd:i,absolute:!0}))f.push(e)}catch{return u.set(r,""),null}f=I(f);for(let n of f){let e;try{e=await Bun.file(n).text()}catch{continue}let g=[];try{g=p.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>O.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${l.basename(n).replace(/\.[jt]s$/,"")}
3
3
  ${p.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${l.basename(n)} could not be bundled:`,c)}}let y=t.filter((n)=>!d.has(n)&&!M(s,n));if(y.length>0)console.warn(`[stx] could not bundle ${y.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(m.length===0)return u.set(r,""),null;let E=[...d].map((n)=>` try { if (!(${JSON.stringify(n)} in __s)) { __s[${JSON.stringify(n)}] = ${n}; if (!(${JSON.stringify(n)} in window)) window[${JSON.stringify(n)}] = ${n}; } } catch (e) {}`).join(`
4
4
  `),v=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
5
5
  ;(function(){
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{q,Me}from"./chunk-5c5nr9sf.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 nn(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,Me}from"./chunk-mv48q1p4.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 nn(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}}
3
3
  export{nn};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{a}from"./chunk-ga0e15n5.js";import{xo}from"./chunk-12r22pf0.js";import p from"path";async function nm(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(xo(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-5k8n17b4.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-1qybwj8k.js";import{xo}from"./chunk-12r22pf0.js";import p from"path";async function nm(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(xo(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-ck9zengd.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{nm};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{E}from"./chunk-5c5nr9sf.js";import{i}from"./chunk-f61153pm.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
2
+ import{E}from"./chunk-mv48q1p4.js";import{i}from"./chunk-ynd2nfvs.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
3
3
  ${e.bold}${t[0]}${e.reset} - ${n.description}`),console.log(` Usage: ${e.cyan}${n.usage}${e.reset}
4
4
  `)}else{console.log(`
5
5
  ${e.bold}Available Commands:${e.reset}