@stacksjs/stx 0.2.718 → 0.2.720

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 (81) hide show
  1. package/dist/{chunk-99wwvvmk.js → chunk-009y9zkg.js} +1 -1
  2. package/dist/{chunk-ztcm0tfd.js → chunk-04xtzbf6.js} +1 -1
  3. package/dist/{chunk-asxh3wqg.js → chunk-0azq3w1a.js} +70 -70
  4. package/dist/{chunk-my2a18wq.js → chunk-0ktg5dw9.js} +1 -1
  5. package/dist/{chunk-zb1627aa.js → chunk-0wfbhs15.js} +1 -1
  6. package/dist/{chunk-pg06986k.js → chunk-11k6atcw.js} +1 -1
  7. package/dist/{chunk-q5m1a3qh.js → chunk-1xt84h16.js} +1 -1
  8. package/dist/{chunk-v6jywzkh.js → chunk-2f3zw2wy.js} +1 -1
  9. package/dist/{chunk-nngqgb61.js → chunk-2gg3apz0.js} +1 -1
  10. package/dist/{chunk-r2gacnbg.js → chunk-2rj4t9wz.js} +1 -1
  11. package/dist/chunk-2sjvj2gb.js +2 -0
  12. package/dist/{chunk-fcfy00db.js → chunk-43anje0a.js} +1 -1
  13. package/dist/chunk-4m1zv168.js +2 -0
  14. package/dist/{chunk-pddyyt56.js → chunk-57ecpsqy.js} +1 -1
  15. package/dist/chunk-5awvckb2.js +2 -0
  16. package/dist/{chunk-yzwx8j20.js → chunk-5bm0nh5f.js} +2 -2
  17. package/dist/chunk-5dvb2e8f.js +2 -0
  18. package/dist/{chunk-cg2vjkv9.js → chunk-5rjfaj0b.js} +2 -2
  19. package/dist/{chunk-r8hex2ra.js → chunk-6h0n7h97.js} +2 -2
  20. package/dist/chunk-6r1wzzt3.js +2 -0
  21. package/dist/{chunk-3t77p36m.js → chunk-8csv4s4f.js} +3 -3
  22. package/dist/{chunk-h3pj7xkd.js → chunk-8deed4r2.js} +1 -1
  23. package/dist/{chunk-jztnab24.js → chunk-9v16zd8h.js} +1 -1
  24. package/dist/{chunk-sqdzxqnb.js → chunk-9vx6et01.js} +1 -1
  25. package/dist/{chunk-efwab9yz.js → chunk-a82dg51h.js} +1 -1
  26. package/dist/{chunk-bcymfrbv.js → chunk-b8a8900p.js} +1 -1
  27. package/dist/{chunk-f5xpr32k.js → chunk-bpds7e9v.js} +1 -1
  28. package/dist/chunk-ddxrb5zk.js +2 -0
  29. package/dist/{chunk-5qh4hywh.js → chunk-dffe3vx2.js} +1 -1
  30. package/dist/{chunk-y7pktn76.js → chunk-e13vngat.js} +1 -1
  31. package/dist/{chunk-dqchjtx2.js → chunk-ejp4d8cq.js} +1 -1
  32. package/dist/chunk-g9vag1n2.js +2 -0
  33. package/dist/{chunk-01b2xpaa.js → chunk-gwq82dpy.js} +4 -4
  34. package/dist/chunk-hgrtnyp3.js +2 -0
  35. package/dist/{chunk-akg3d6zs.js → chunk-hp957nrn.js} +2 -2
  36. package/dist/{chunk-amn1jp60.js → chunk-hpg5bjzb.js} +1 -1
  37. package/dist/{chunk-0vp8tbtw.js → chunk-hsqqhjhr.js} +1 -1
  38. package/dist/{chunk-c46ks6d4.js → chunk-jh8b3f9w.js} +1 -1
  39. package/dist/{chunk-zxd5vt3f.js → chunk-jtf6sxgd.js} +1 -1
  40. package/dist/chunk-jy8m3dah.js +3 -0
  41. package/dist/{chunk-c77deyem.js → chunk-kbw75yd7.js} +1 -1
  42. package/dist/{chunk-s23qhmg4.js → chunk-kn92y5yd.js} +2 -2
  43. package/dist/{chunk-p9j1yref.js → chunk-kxp881ch.js} +1 -1
  44. package/dist/{chunk-h2g21w62.js → chunk-m7hbk341.js} +1 -1
  45. package/dist/{chunk-qsz4tb20.js → chunk-mhpek1hj.js} +1 -1
  46. package/dist/{chunk-fpqpc0xa.js → chunk-n0bw2kzs.js} +1 -1
  47. package/dist/{chunk-ycdfgs9z.js → chunk-nb65s3b5.js} +4 -4
  48. package/dist/{chunk-fpa7tbsr.js → chunk-pcsgj3a5.js} +1 -1
  49. package/dist/{chunk-fqfrma6m.js → chunk-pqrgaahp.js} +1 -1
  50. package/dist/{chunk-rb9py354.js → chunk-pz837t6v.js} +1 -1
  51. package/dist/{chunk-nnv66x6a.js → chunk-qvwwpnyk.js} +3 -3
  52. package/dist/{chunk-dmf1w4k7.js → chunk-r1t5dcsn.js} +1 -1
  53. package/dist/{chunk-zxeegh47.js → chunk-rfb00eqz.js} +5 -5
  54. package/dist/{chunk-r96pgr62.js → chunk-rm9rmyh2.js} +1 -1
  55. package/dist/chunk-sey2x612.js +2 -0
  56. package/dist/{chunk-pqyc625v.js → chunk-ty5rncss.js} +1 -1
  57. package/dist/{chunk-h3jdg08e.js → chunk-ve78svbr.js} +1 -1
  58. package/dist/{chunk-za4e4w89.js → chunk-xhpf68p4.js} +1 -1
  59. package/dist/{chunk-p4tgxwk6.js → chunk-xvkqa756.js} +1 -1
  60. package/dist/{chunk-ph414g2y.js → chunk-y0bepgyh.js} +1 -1
  61. package/dist/chunk-y7b9kqz8.js +2 -0
  62. package/dist/{chunk-mvxv5th7.js → chunk-zc116ep8.js} +1 -1
  63. package/dist/{chunk-crz5b7ta.js → chunk-znknf1jt.js} +5 -5
  64. package/dist/cli.js +7 -7
  65. package/dist/craft-entry.js +1 -1
  66. package/dist/craft.js +1 -1
  67. package/dist/pwa.js +1 -1
  68. package/dist/ssg.js +2 -2
  69. package/dist/utils.js +1 -1
  70. package/package.json +5 -5
  71. package/dist/chunk-0w63b87e.js +0 -2
  72. package/dist/chunk-4m55etnr.js +0 -2
  73. package/dist/chunk-7z291h9k.js +0 -2
  74. package/dist/chunk-8rcvwxts.js +0 -2
  75. package/dist/chunk-a5p0ehhy.js +0 -2
  76. package/dist/chunk-axmh79c7.js +0 -2
  77. package/dist/chunk-dkd5v730.js +0 -2
  78. package/dist/chunk-g9y3crqw.js +0 -2
  79. package/dist/chunk-hkbtp57k.js +0 -2
  80. package/dist/chunk-jx9vy6j1.js +0 -3
  81. package/dist/chunk-ybejqn2w.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Jc,Yc}from"./chunk-ez35607j.js";import{H,Ss,ks,_s,Wo,qo,mr,Oe,pe,X,Es,ie,J,I,tt,yr,Jo,wr,Be,r,p,V,yn}from"./chunk-asxh3wqg.js";import{f,R,nt,d}from"./chunk-zkx2m308.js";import{n}from"./chunk-jx9vy6j1.js";import{se}from"./chunk-r3j4m04w.js";import{s}from"./chunk-05qf3e2p.js";import{g}from"./chunk-0dve54ne.js";import{createHash as Ct}from"crypto";import ee from"fs";import Q from"path";import{decode as sn,generateThumbHash as on}from"ts-images";import{createImageDeliveryCatalog as yt}from"ts-images/delivery";import De from"fs";function Ce(e,t,i){let o=Buffer.alloc(i),a=De.readSync(e,o,0,i,t);return o.subarray(0,a)}function je(e){if(e.length<25)return!1;let t=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(t(0,4)!=="RIFF"||t(8,12)!=="WEBP")return!1;let i=t(12,16);if(i==="VP8X")return(e[20]&16)!==0;if(i==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Me(e){let t;try{t=De.openSync(e,"r");let i=Ce(t,0,33);if(i.length>=3&&i[0]===255&&i[1]===216&&i[2]===255)return"none";if(i.length>=26&&i[0]===137&&i.toString("latin1",1,4)==="PNG"){let o=i[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ce(t,a,8);if(l.length<8)return"unknown";let m=l.toString("latin1",4,8);if(m==="tRNS")return"possible";if(m==="IDAT"||m==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(i.length>=25&&i.toString("latin1",0,4)==="RIFF"&&i.toString("latin1",8,12)==="WEBP"){if(je(i))return"possible";let o=i.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(t!==void 0)De.closeSync(t)}}import Jt from"fs";import Re from"os";import{join as dt}from"path";import{fileURLToPath as gt}from"url";import{Worker as mt}from"worker_threads";var ke=Symbol("stx.image-worker.unavailable");function Yt(e=typeof Re.availableParallelism==="function"?Re.availableParallelism():Re.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ae=0,ht=[];async function Qt(){if(Ae<Yt()){Ae++;return}await new Promise((e)=>ht.push(e)),Ae++}function en(){Ae--,ht.shift()?.()}var tn="@stacksjs/stx/builtins/image-warmup-worker";function nn(e=process.cwd()){let t=import.meta.url.endsWith(".ts")?"ts":"js";try{let i=new URL(`./image-warmup-worker.${t}`,import.meta.url);if(i.protocol==="file:"&&Jt.existsSync(gt(i)))return gt(i)}catch{}try{let i=typeof Bun<"u"?Bun.resolveSync(tn,e):void 0;return i&&rn(i)?i:void 0}catch{return}}function rn(e,t=process.env){let i=e.replace(/\\/g,"/");if(i.split("/").some((a)=>/@\d[^/]*@@@\d+$/.test(a)))return!1;return![t.BUN_INSTALL_CACHE_DIR,dt(t.BUN_INSTALL||dt(Re.homedir(),".bun"),"install","cache")].filter((a)=>!!a).map((a)=>`${a.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((a)=>i.startsWith(a))}var pt=!1;function me(e){if(!pt)pt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ke}function Le(e){return e instanceof Error?e.message:String(e)}async function ze(e,t){if(typeof mt!=="function")return me("node:worker_threads has no Worker in this runtime");let i=nn();if(!i)return me("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Qt();try{return await new Promise((o,a)=>{let c;try{c=new mt(i)}catch(y){o(me(`could not start ${i}: ${Le(y)}`));return}let l=!1,m=!1,u=(y)=>{if(m)return;m=!0,y(),c.terminate()};c.on("message",(y)=>{if(y.type==="ready"){l=!0,c.postMessage({task:e,args:t});return}if(y.type==="result"){u(()=>o(y.value));return}let w=Error(y.error?.message??"image worker failed");if(y.error?.name)w.name=y.error.name;if(y.error?.stack)w.stack=y.error.stack;u(()=>a(w))}),c.on("error",(y)=>{u(()=>l?a(y instanceof Error?y:Error(Le(y)||"image worker crashed")):o(me(`the worker failed before it was ready: ${Le(y)}`)))}),c.on("exit",(y)=>{u(()=>l?a(Error("image worker exited before it finished")):o(me(`the worker exited with code ${y} before it was ready`)))})})}finally{en()}}var an=new Set([".avif",".jpeg",".jpg",".png",".webp"]),cn=[320,640,960,1280,1920],he="/_stx/images",ln=`stx:${he}:alpha-1`,un=`stx:${he}:opaque-1`,fn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function dn(e,t){let i=Q.dirname(Bun.resolveSync(e,t));while(i!==Q.dirname(i)){let o=Q.join(i,"package.json");if(ee.existsSync(o)){let a=JSON.parse(ee.readFileSync(o,"utf8"));if(a.name===e)return a.version}i=Q.dirname(i)}return}function xt(){if(Pe!==void 0)return Pe;let e;try{e=Q.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=fn.map((t)=>{let i;try{i=e?dn(t,e):void 0}catch{}return`${t.replace("@stacksjs/","")}@${i??"unknown"}`}).join("+"),Pe}var bt=Symbol.for("stx.image-delivery");function ye(){let e=globalThis;return e[bt]??={catalog:new Map,transparent:new Set},e[bt]}var vt=new Set;function gn(e){return`/${e.split(Q.sep).map(encodeURIComponent).join("/")}`}function mn(e){let t=Q.extname(e),i=e.slice(0,-t.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=Ct("sha256").update(e).digest("hex").slice(0,8);return`${i||"image"}-${o}`}function wt(e,t=`stx:${he}`){let i=(o)=>`${he}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:t,async stat(o){let a=Q.join(e,o);try{let c=await ee.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:i(o)}:null}catch{return null}},async write(o,a){let c=Q.join(e,o);await ee.promises.mkdir(Q.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await ee.promises.writeFile(l,a),await ee.promises.rename(l,c),{bytes:a.byteLength,path:c,url:i(o)}},url:i}}async function Rt(e,t=e){let i=await ee.promises.readdir(t,{withFileTypes:!0});i.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of i){let c=Q.join(t,a.name);if(a.isDirectory()){o.push(...await Rt(e,c));continue}if(!a.isFile()||!an.has(Q.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:Q.relative(e,c)})}return o}function $t(e,t){return e.map((i)=>({key:gn(i.relativePath),input:i.absolutePath,name:mn(i.relativePath),...pn(i.absolutePath)?{options:{storage:t}}:{}}))}function pn(e){return Me(e)==="possible"}function hn(e){for(let t=3;t<e.length;t+=4)if(e[t]!==255)return!0;return!1}async function xn(e){let t=Object.entries(e).filter(([,a])=>a.fallback.format==="png"),i=new Set,o=8;for(let a=0;a<t.length;a+=8)await Promise.all(t.slice(a,a+8).map(async([c,l])=>{let m=l.variants.filter((u)=>u.format==="png").sort((u,y)=>u.width-y.width)[0];try{let u=await sn(new Uint8Array(await ee.promises.readFile(m?.path??l.fallback.path)));if(hn(u.data))i.add(c)}catch{i.add(c)}}));return i}function bn(e,t){let i=[];for(let o of t){let a=e[o],c=a?.variants.filter((m)=>m.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((m)=>{let u;try{return u=ee.openSync(m.path,"r"),!je(Ce(u,0,32))}catch{return!0}finally{if(u!==void 0)ee.closeSync(u)}}))continue;if(a.variants=a.variants.filter((m)=>m.format!=="webp"),delete a.sources.webp,i.push(o),!vt.has(o))vt.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return i}async function vn(e){let t=[],i=8;for(let o=0;o<e.length;o+=8){let a=e.slice(o,o+8),c=await Promise.all(a.map(async(l)=>{try{return await on(l.absolutePath),l}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${l.relativePath}`),null}}));t.push(...c.filter((l)=>l!==null))}return t}function Ue(e){return Q.join(e,"undecodable.json")}function wn(e){try{let t=ee.readFileSync(Ue(e),"utf-8"),i=JSON.parse(t);return i&&typeof i==="object"?i:{}}catch{return{}}}function $n(e,t){try{ee.mkdirSync(Q.dirname(Ue(e)),{recursive:!0}),ee.writeFileSync(Ue(e),JSON.stringify(t))}catch{}}function St(e){try{let t=ee.statSync(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}}function At(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let t=e.split(/[?#]/,1)[0];if(!t)return;try{return`/${t.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function ko(e){let t=At(e);return t?ye().catalog.get(t):void 0}function _o(e){let t=At(e);return t?ye().transparent.has(t):!1}function Co(e){let t=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),i=t(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:t(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<i).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function nh(e){let t=ko(e);if(!t)return;return{src:t.fallback.url,srcset:t.sources[t.fallback.format]||"",sources:Co(t).map(({format:i,srcset:o})=>({type:`image/${i}`,srcset:o})),width:t.source.width,height:t.source.height,placeholder:_o(e)?void 0:t.placeholder?.dataUrl}}function ts(){let e=ye();e.catalog=new Map,e.transparent=new Set}function Sn(e){let t=ye();t.catalog=new Map(e.entries),t.transparent=new Set(e.transparent)}async function rh(e,t,i={}){if(!e||!ee.existsSync(e))return ts(),{count:0,fingerprint:""};if(i.offThread){let h=await ze("delivery",{publicDir:e,outputDir:t});if(h!==ke)return Sn(h.state),h.result}let o=await Rt(e);if(o.length===0)return ts(),{count:0,fingerprint:""};let a=wn(t),c=o.filter((h)=>{let v=a[h.relativePath];if(!v)return!0;let S=St(h.absolutePath);return!S||S.mtimeMs!==v.mtimeMs||S.size!==v.size});if(c.length===0)return ts(),{count:0,fingerprint:""};let l=wt(Q.join(t,"_stx","images"),`${ln}:${xt()}`),m={outDir:Q.join(t,"_stx","images"),storage:wt(Q.join(t,"_stx","images"),`${un}:${xt()}`),baseUrl:he,widths:cn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},u=c,y;try{y=await yt({...m,entries:$t(c,l)})}catch(h){if(u=await vn(c),u.length===c.length)throw h;let v=new Set(u.map((A)=>A.relativePath)),S=!1;for(let A of c){if(v.has(A.relativePath))continue;let P=St(A.absolutePath);if(!P)continue;a[A.relativePath]=P,S=!0}if(S)$n(t,a);if(u.length===0)return ts(),{count:0,fingerprint:""};y=await yt({...m,entries:$t(u,l)})}let w=await xn(y.entries),x=bn(y.entries,w),C=ye();C.catalog=new Map(Object.entries(y.entries)),C.transparent=w;let b=w.size===0&&x.length===0?y.fingerprint:Ct("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...w].sort(),droppedWebp:x.sort()})).digest("hex");return{count:u.length,fingerprint:b}}class kt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let t of e.aliases)this.builtins.set(t.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,t,i,o){let a=Wo(e,o);if(a!==void 0)return a;for(let c of qo(e,t,i,o))if(await r(c))return c;return null}}var le=new kt;var re="\x00stx-boolean-attribute";function We(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Cn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Fe(e){let t=e.toLowerCase();return t.startsWith("aria-")||t.startsWith("data-")||Cn.has(t)}function oe(e,t){let i=[];for(let[o,a]of Object.entries(e.static)){if(t.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)i.push(p(c));continue}if(a===re){i.push(p(c));continue}i.push(`${p(c)}="${yn(c,We(String(a)))}"`)}return i}function ae(e,t){let i=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(t.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){i.push(p(c));continue}if(typeof a==="object")continue;i.push(`${p(c)}="${yn(c,We(String(a)))}"`)}return i}function Rn(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var He={name:"StxLink",aliases:["stx-link"],render(e,t,i){let o=Rn(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",m=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,u=[];if(o.reactive)u.push(`:href="${n(o.value)}"`);else u.push(`href="${n(mr(o.value,"navigable"))}"`);if(a)u.push(`class="${n(a)}"`);if(u.push("data-stx-link"),u.push(`data-stx-active-class="${n(c)}"`),u.push(`data-stx-exact-active-class="${n(l)}"`),m)u.push("data-stx-prefetch");let y=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(y)u.push(`data-stx-active-match="${n(y)}"`);let w=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return u.push(...oe(e,w)),u.push(...ae(e,w)),`<a ${u.join(" ")}>${t}</a>`}};var An=new Map;function qe(e){if(!e)return;let t=e.split("?")[0].split("#")[0];return An.get(t)}var kn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Xe=[320,640,768,1024,1280,1536,1920];function K(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let i=e.static[t];if(typeof i==="string")return i;return}function _e(e,t,i=!1){let o=e.serverDynamic[t];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[t];if(a!==void 0)return a!=="false"&&a!==!1;return i}function Ze(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),i=[];for(let o of t)if(o.includes(":")){let[a,c]=o.split(":"),l=kn[a];if(l)i.push(`(max-width: ${l}px) ${c}`);else{let m=Number.parseInt(a);if(!Number.isNaN(m))i.push(`(max-width: ${m}px) ${c}`)}}else i.push(o);return i.join(", ")}function Ve(e,t,i,o){return t.map((a)=>`${xe(e,a,void 0,i,o)} ${a}w`).join(", ")}function Pn(e,t,i,o,a){return t.map((c)=>{let l=i?i*c:void 0;return`${xe(e,l,void 0,o,a)} ${c}x`}).join(", ")}function xe(e,t,i,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(t)c.push(`w_${t}`);if(i)c.push(`h_${i}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(t)c.set("w",String(t));if(i)c.set("h",String(i));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(t)c.set("width",String(t));if(i)c.set("height",String(i));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function _n(e){return`var s=this.style;${e.map((t)=>`s.${t}=''`).join(";")}`}function In(e,t,i="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${i}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Ge={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,t,i){let o=K(e,"src")||"",a=ko(o),c=K(e,"alt")||"",l=K(e,"width")||(a?String(a.source.width):void 0),m=K(e,"height")||(a?String(a.source.height):void 0),u=K(e,"sizes"),y=K(e,"srcset"),w=K(e,"densities"),x=K(e,"format"),C=_o(o)||qe(o)?.transparent===!0,b=K(e,"placeholder")||(a&&!C?"thumbhash":void 0),h=K(e,"placeholderColor")||"#e5e7eb",v=K(e,"provider"),S=K(e,"class")||K(e,"className")||"",A=K(e,"style")||"",P=K(e,"objectFit")||K(e,"fit"),k=K(e,"objectPosition")||K(e,"position"),N=K(e,"quality"),U=_e(e,"lazy",!0),M=_e(e,"preload",!1),L=_e(e,"priority",!1),q=K(e,"loading"),O=K(e,"decoding")||"async",E=!!a||_e(e,"picture",!1)||!!x,B=l?Number.parseInt(l):void 0,T=m?Number.parseInt(m):void 0,z=y||"",G="";if(a)z=a.sources[a.fallback.format]||"",G=u?Ze(u):"100vw";else if(!z&&u&&v&&v!=="local"&&v!=="static")z=Ve(o,Xe,v,x),G=Ze(u);else if(!z&&w){let _=w.split(/\s+/).map((F)=>Number.parseFloat(F.replace("x","")));z=Pn(o,_,B,v,x)}else if(u)G=Ze(u);let j=[];if(A)j.push(A);if(P)j.push(`object-fit:${P}`);if(k)j.push(`object-position:${k}`);if(B&&T)j.push(`aspect-ratio:${B}/${T}`);let W=[],ce=b==="blur"||b==="color"||b==="thumbhash";if(ce&&!C){let _=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:h}:qe(o);if(_&&b==="color")j.push(`background-color:${_.color}`),W.push("backgroundColor");else if(_)j.push(`background-color:${_.color}`),j.push(`background-image:url(${_.dataUrl})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),W.push("backgroundColor","backgroundImage");else{let F=In(B||16,T||9,h);j.push(`background-image:url(${F})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),W.push("backgroundImage")}}else if(!ce&&b&&b!=="empty"&&b!=="none")j.push(`background-image:url(${n(b)})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),W.push("backgroundImage");let we=a?.fallback.url||xe(o,B,T,v,x),Y=[];if(Y.push(`src="${n(mr(we,"fetched"))}"`),Y.push(`alt="${n(c)}"`),l)Y.push(`width="${n(l)}"`);if(m)Y.push(`height="${n(m)}"`);let ne=q||(L||M?"eager":U?"lazy":"");if(ne)Y.push(`loading="${n(ne)}"`);if(L)Y.push('fetchpriority="high"');if(Y.push(`decoding="${n(O)}"`),S)Y.push(`class="${n(S)}"`);if(j.length>0)Y.push(`style="${n(j.join(";"))}"`);if(z)Y.push(`srcset="${n(mr(z,"fetched"))}"`);if(G)Y.push(`sizes="${n(G)}"`);let $e=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(W.length>0){let _=typeof e.static.onload==="string"?e.static.onload:"",F=_n(W)+(_?`;${_}`:"");Y.push(`onload="${n(F)}"`),$e.add("onload")}Y.push(...oe(e,$e)),Y.push(...ae(e,$e));let D=`<img ${Y.join(" ")} />`,Z="";if(M){let F=x==="webp"?"image/webp":x==="avif"?"image/avif":"";Z=`<link rel="preload" as="image" href="${n(we)}"${F?` type="${F}"`:""}${z?` imagesrcset="${n(z)}"`:""}${G?` imagesizes="${n(G)}"`:""} />
2
+ import{Jc,Yc}from"./chunk-ez35607j.js";import{H,Ss,ks,_s,Wo,qo,mr,Oe,pe,X,Es,ie,J,I,tt,yr,Jo,wr,Be,r,p,V,yn}from"./chunk-0azq3w1a.js";import{f,R,nt,d}from"./chunk-zkx2m308.js";import{n}from"./chunk-jy8m3dah.js";import{se}from"./chunk-r3j4m04w.js";import{s}from"./chunk-05qf3e2p.js";import{g}from"./chunk-0dve54ne.js";import{createHash as Ct}from"crypto";import ee from"fs";import Q from"path";import{decode as sn,generateThumbHash as on}from"ts-images";import{createImageDeliveryCatalog as yt}from"ts-images/delivery";import De from"fs";function Ce(e,t,i){let o=Buffer.alloc(i),a=De.readSync(e,o,0,i,t);return o.subarray(0,a)}function je(e){if(e.length<25)return!1;let t=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(t(0,4)!=="RIFF"||t(8,12)!=="WEBP")return!1;let i=t(12,16);if(i==="VP8X")return(e[20]&16)!==0;if(i==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Me(e){let t;try{t=De.openSync(e,"r");let i=Ce(t,0,33);if(i.length>=3&&i[0]===255&&i[1]===216&&i[2]===255)return"none";if(i.length>=26&&i[0]===137&&i.toString("latin1",1,4)==="PNG"){let o=i[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ce(t,a,8);if(l.length<8)return"unknown";let m=l.toString("latin1",4,8);if(m==="tRNS")return"possible";if(m==="IDAT"||m==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(i.length>=25&&i.toString("latin1",0,4)==="RIFF"&&i.toString("latin1",8,12)==="WEBP"){if(je(i))return"possible";let o=i.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(t!==void 0)De.closeSync(t)}}import Jt from"fs";import Re from"os";import{join as dt}from"path";import{fileURLToPath as gt}from"url";import{Worker as mt}from"worker_threads";var ke=Symbol("stx.image-worker.unavailable");function Yt(e=typeof Re.availableParallelism==="function"?Re.availableParallelism():Re.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ae=0,ht=[];async function Qt(){if(Ae<Yt()){Ae++;return}await new Promise((e)=>ht.push(e)),Ae++}function en(){Ae--,ht.shift()?.()}var tn="@stacksjs/stx/builtins/image-warmup-worker";function nn(e=process.cwd()){let t=import.meta.url.endsWith(".ts")?"ts":"js";try{let i=new URL(`./image-warmup-worker.${t}`,import.meta.url);if(i.protocol==="file:"&&Jt.existsSync(gt(i)))return gt(i)}catch{}try{let i=typeof Bun<"u"?Bun.resolveSync(tn,e):void 0;return i&&rn(i)?i:void 0}catch{return}}function rn(e,t=process.env){let i=e.replace(/\\/g,"/");if(i.split("/").some((a)=>/@\d[^/]*@@@\d+$/.test(a)))return!1;return![t.BUN_INSTALL_CACHE_DIR,dt(t.BUN_INSTALL||dt(Re.homedir(),".bun"),"install","cache")].filter((a)=>!!a).map((a)=>`${a.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((a)=>i.startsWith(a))}var pt=!1;function me(e){if(!pt)pt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ke}function Le(e){return e instanceof Error?e.message:String(e)}async function ze(e,t){if(typeof mt!=="function")return me("node:worker_threads has no Worker in this runtime");let i=nn();if(!i)return me("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Qt();try{return await new Promise((o,a)=>{let c;try{c=new mt(i)}catch(y){o(me(`could not start ${i}: ${Le(y)}`));return}let l=!1,m=!1,u=(y)=>{if(m)return;m=!0,y(),c.terminate()};c.on("message",(y)=>{if(y.type==="ready"){l=!0,c.postMessage({task:e,args:t});return}if(y.type==="result"){u(()=>o(y.value));return}let w=Error(y.error?.message??"image worker failed");if(y.error?.name)w.name=y.error.name;if(y.error?.stack)w.stack=y.error.stack;u(()=>a(w))}),c.on("error",(y)=>{u(()=>l?a(y instanceof Error?y:Error(Le(y)||"image worker crashed")):o(me(`the worker failed before it was ready: ${Le(y)}`)))}),c.on("exit",(y)=>{u(()=>l?a(Error("image worker exited before it finished")):o(me(`the worker exited with code ${y} before it was ready`)))})})}finally{en()}}var an=new Set([".avif",".jpeg",".jpg",".png",".webp"]),cn=[320,640,960,1280,1920],he="/_stx/images",ln=`stx:${he}:alpha-1`,un=`stx:${he}:opaque-1`,fn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function dn(e,t){let i=Q.dirname(Bun.resolveSync(e,t));while(i!==Q.dirname(i)){let o=Q.join(i,"package.json");if(ee.existsSync(o)){let a=JSON.parse(ee.readFileSync(o,"utf8"));if(a.name===e)return a.version}i=Q.dirname(i)}return}function xt(){if(Pe!==void 0)return Pe;let e;try{e=Q.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=fn.map((t)=>{let i;try{i=e?dn(t,e):void 0}catch{}return`${t.replace("@stacksjs/","")}@${i??"unknown"}`}).join("+"),Pe}var bt=Symbol.for("stx.image-delivery");function ye(){let e=globalThis;return e[bt]??={catalog:new Map,transparent:new Set},e[bt]}var vt=new Set;function gn(e){return`/${e.split(Q.sep).map(encodeURIComponent).join("/")}`}function mn(e){let t=Q.extname(e),i=e.slice(0,-t.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=Ct("sha256").update(e).digest("hex").slice(0,8);return`${i||"image"}-${o}`}function wt(e,t=`stx:${he}`){let i=(o)=>`${he}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:t,async stat(o){let a=Q.join(e,o);try{let c=await ee.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:i(o)}:null}catch{return null}},async write(o,a){let c=Q.join(e,o);await ee.promises.mkdir(Q.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await ee.promises.writeFile(l,a),await ee.promises.rename(l,c),{bytes:a.byteLength,path:c,url:i(o)}},url:i}}async function Rt(e,t=e){let i=await ee.promises.readdir(t,{withFileTypes:!0});i.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of i){let c=Q.join(t,a.name);if(a.isDirectory()){o.push(...await Rt(e,c));continue}if(!a.isFile()||!an.has(Q.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:Q.relative(e,c)})}return o}function $t(e,t){return e.map((i)=>({key:gn(i.relativePath),input:i.absolutePath,name:mn(i.relativePath),...pn(i.absolutePath)?{options:{storage:t}}:{}}))}function pn(e){return Me(e)==="possible"}function hn(e){for(let t=3;t<e.length;t+=4)if(e[t]!==255)return!0;return!1}async function xn(e){let t=Object.entries(e).filter(([,a])=>a.fallback.format==="png"),i=new Set,o=8;for(let a=0;a<t.length;a+=8)await Promise.all(t.slice(a,a+8).map(async([c,l])=>{let m=l.variants.filter((u)=>u.format==="png").sort((u,y)=>u.width-y.width)[0];try{let u=await sn(new Uint8Array(await ee.promises.readFile(m?.path??l.fallback.path)));if(hn(u.data))i.add(c)}catch{i.add(c)}}));return i}function bn(e,t){let i=[];for(let o of t){let a=e[o],c=a?.variants.filter((m)=>m.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((m)=>{let u;try{return u=ee.openSync(m.path,"r"),!je(Ce(u,0,32))}catch{return!0}finally{if(u!==void 0)ee.closeSync(u)}}))continue;if(a.variants=a.variants.filter((m)=>m.format!=="webp"),delete a.sources.webp,i.push(o),!vt.has(o))vt.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return i}async function vn(e){let t=[],i=8;for(let o=0;o<e.length;o+=8){let a=e.slice(o,o+8),c=await Promise.all(a.map(async(l)=>{try{return await on(l.absolutePath),l}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${l.relativePath}`),null}}));t.push(...c.filter((l)=>l!==null))}return t}function Ue(e){return Q.join(e,"undecodable.json")}function wn(e){try{let t=ee.readFileSync(Ue(e),"utf-8"),i=JSON.parse(t);return i&&typeof i==="object"?i:{}}catch{return{}}}function $n(e,t){try{ee.mkdirSync(Q.dirname(Ue(e)),{recursive:!0}),ee.writeFileSync(Ue(e),JSON.stringify(t))}catch{}}function St(e){try{let t=ee.statSync(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}}function At(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let t=e.split(/[?#]/,1)[0];if(!t)return;try{return`/${t.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function ko(e){let t=At(e);return t?ye().catalog.get(t):void 0}function _o(e){let t=At(e);return t?ye().transparent.has(t):!1}function Co(e){let t=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),i=t(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:t(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<i).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function nh(e){let t=ko(e);if(!t)return;return{src:t.fallback.url,srcset:t.sources[t.fallback.format]||"",sources:Co(t).map(({format:i,srcset:o})=>({type:`image/${i}`,srcset:o})),width:t.source.width,height:t.source.height,placeholder:_o(e)?void 0:t.placeholder?.dataUrl}}function ts(){let e=ye();e.catalog=new Map,e.transparent=new Set}function Sn(e){let t=ye();t.catalog=new Map(e.entries),t.transparent=new Set(e.transparent)}async function rh(e,t,i={}){if(!e||!ee.existsSync(e))return ts(),{count:0,fingerprint:""};if(i.offThread){let h=await ze("delivery",{publicDir:e,outputDir:t});if(h!==ke)return Sn(h.state),h.result}let o=await Rt(e);if(o.length===0)return ts(),{count:0,fingerprint:""};let a=wn(t),c=o.filter((h)=>{let v=a[h.relativePath];if(!v)return!0;let S=St(h.absolutePath);return!S||S.mtimeMs!==v.mtimeMs||S.size!==v.size});if(c.length===0)return ts(),{count:0,fingerprint:""};let l=wt(Q.join(t,"_stx","images"),`${ln}:${xt()}`),m={outDir:Q.join(t,"_stx","images"),storage:wt(Q.join(t,"_stx","images"),`${un}:${xt()}`),baseUrl:he,widths:cn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},u=c,y;try{y=await yt({...m,entries:$t(c,l)})}catch(h){if(u=await vn(c),u.length===c.length)throw h;let v=new Set(u.map((A)=>A.relativePath)),S=!1;for(let A of c){if(v.has(A.relativePath))continue;let P=St(A.absolutePath);if(!P)continue;a[A.relativePath]=P,S=!0}if(S)$n(t,a);if(u.length===0)return ts(),{count:0,fingerprint:""};y=await yt({...m,entries:$t(u,l)})}let w=await xn(y.entries),x=bn(y.entries,w),C=ye();C.catalog=new Map(Object.entries(y.entries)),C.transparent=w;let b=w.size===0&&x.length===0?y.fingerprint:Ct("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...w].sort(),droppedWebp:x.sort()})).digest("hex");return{count:u.length,fingerprint:b}}class kt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let t of e.aliases)this.builtins.set(t.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,t,i,o){let a=Wo(e,o);if(a!==void 0)return a;for(let c of qo(e,t,i,o))if(await r(c))return c;return null}}var le=new kt;var re="\x00stx-boolean-attribute";function We(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Cn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Fe(e){let t=e.toLowerCase();return t.startsWith("aria-")||t.startsWith("data-")||Cn.has(t)}function oe(e,t){let i=[];for(let[o,a]of Object.entries(e.static)){if(t.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)i.push(p(c));continue}if(a===re){i.push(p(c));continue}i.push(`${p(c)}="${yn(c,We(String(a)))}"`)}return i}function ae(e,t){let i=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(t.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){i.push(p(c));continue}if(typeof a==="object")continue;i.push(`${p(c)}="${yn(c,We(String(a)))}"`)}return i}function Rn(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var He={name:"StxLink",aliases:["stx-link"],render(e,t,i){let o=Rn(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",m=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,u=[];if(o.reactive)u.push(`:href="${n(o.value)}"`);else u.push(`href="${n(mr(o.value,"navigable"))}"`);if(a)u.push(`class="${n(a)}"`);if(u.push("data-stx-link"),u.push(`data-stx-active-class="${n(c)}"`),u.push(`data-stx-exact-active-class="${n(l)}"`),m)u.push("data-stx-prefetch");let y=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(y)u.push(`data-stx-active-match="${n(y)}"`);let w=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return u.push(...oe(e,w)),u.push(...ae(e,w)),`<a ${u.join(" ")}>${t}</a>`}};var An=new Map;function qe(e){if(!e)return;let t=e.split("?")[0].split("#")[0];return An.get(t)}var kn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Xe=[320,640,768,1024,1280,1536,1920];function K(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let i=e.static[t];if(typeof i==="string")return i;return}function _e(e,t,i=!1){let o=e.serverDynamic[t];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[t];if(a!==void 0)return a!=="false"&&a!==!1;return i}function Ze(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),i=[];for(let o of t)if(o.includes(":")){let[a,c]=o.split(":"),l=kn[a];if(l)i.push(`(max-width: ${l}px) ${c}`);else{let m=Number.parseInt(a);if(!Number.isNaN(m))i.push(`(max-width: ${m}px) ${c}`)}}else i.push(o);return i.join(", ")}function Ve(e,t,i,o){return t.map((a)=>`${xe(e,a,void 0,i,o)} ${a}w`).join(", ")}function Pn(e,t,i,o,a){return t.map((c)=>{let l=i?i*c:void 0;return`${xe(e,l,void 0,o,a)} ${c}x`}).join(", ")}function xe(e,t,i,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(t)c.push(`w_${t}`);if(i)c.push(`h_${i}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(t)c.set("w",String(t));if(i)c.set("h",String(i));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(t)c.set("width",String(t));if(i)c.set("height",String(i));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function _n(e){return`var s=this.style;${e.map((t)=>`s.${t}=''`).join(";")}`}function In(e,t,i="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${i}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Ge={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,t,i){let o=K(e,"src")||"",a=ko(o),c=K(e,"alt")||"",l=K(e,"width")||(a?String(a.source.width):void 0),m=K(e,"height")||(a?String(a.source.height):void 0),u=K(e,"sizes"),y=K(e,"srcset"),w=K(e,"densities"),x=K(e,"format"),C=_o(o)||qe(o)?.transparent===!0,b=K(e,"placeholder")||(a&&!C?"thumbhash":void 0),h=K(e,"placeholderColor")||"#e5e7eb",v=K(e,"provider"),S=K(e,"class")||K(e,"className")||"",A=K(e,"style")||"",P=K(e,"objectFit")||K(e,"fit"),k=K(e,"objectPosition")||K(e,"position"),N=K(e,"quality"),U=_e(e,"lazy",!0),M=_e(e,"preload",!1),L=_e(e,"priority",!1),q=K(e,"loading"),O=K(e,"decoding")||"async",E=!!a||_e(e,"picture",!1)||!!x,B=l?Number.parseInt(l):void 0,T=m?Number.parseInt(m):void 0,z=y||"",G="";if(a)z=a.sources[a.fallback.format]||"",G=u?Ze(u):"100vw";else if(!z&&u&&v&&v!=="local"&&v!=="static")z=Ve(o,Xe,v,x),G=Ze(u);else if(!z&&w){let _=w.split(/\s+/).map((F)=>Number.parseFloat(F.replace("x","")));z=Pn(o,_,B,v,x)}else if(u)G=Ze(u);let j=[];if(A)j.push(A);if(P)j.push(`object-fit:${P}`);if(k)j.push(`object-position:${k}`);if(B&&T)j.push(`aspect-ratio:${B}/${T}`);let W=[],ce=b==="blur"||b==="color"||b==="thumbhash";if(ce&&!C){let _=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:h}:qe(o);if(_&&b==="color")j.push(`background-color:${_.color}`),W.push("backgroundColor");else if(_)j.push(`background-color:${_.color}`),j.push(`background-image:url(${_.dataUrl})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),W.push("backgroundColor","backgroundImage");else{let F=In(B||16,T||9,h);j.push(`background-image:url(${F})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),W.push("backgroundImage")}}else if(!ce&&b&&b!=="empty"&&b!=="none")j.push(`background-image:url(${n(b)})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),W.push("backgroundImage");let we=a?.fallback.url||xe(o,B,T,v,x),Y=[];if(Y.push(`src="${n(mr(we,"fetched"))}"`),Y.push(`alt="${n(c)}"`),l)Y.push(`width="${n(l)}"`);if(m)Y.push(`height="${n(m)}"`);let ne=q||(L||M?"eager":U?"lazy":"");if(ne)Y.push(`loading="${n(ne)}"`);if(L)Y.push('fetchpriority="high"');if(Y.push(`decoding="${n(O)}"`),S)Y.push(`class="${n(S)}"`);if(j.length>0)Y.push(`style="${n(j.join(";"))}"`);if(z)Y.push(`srcset="${n(mr(z,"fetched"))}"`);if(G)Y.push(`sizes="${n(G)}"`);let $e=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(W.length>0){let _=typeof e.static.onload==="string"?e.static.onload:"",F=_n(W)+(_?`;${_}`:"");Y.push(`onload="${n(F)}"`),$e.add("onload")}Y.push(...oe(e,$e)),Y.push(...ae(e,$e));let D=`<img ${Y.join(" ")} />`,Z="";if(M){let F=x==="webp"?"image/webp":x==="avif"?"image/avif":"";Z=`<link rel="preload" as="image" href="${n(we)}"${F?` type="${F}"`:""}${z?` imagesrcset="${n(z)}"`:""}${G?` imagesizes="${n(G)}"`:""} />
3
3
  `}if(E){let _=[];if(a)for(let F of Co(a))_.push(`<source type="image/${F.format}" srcset="${n(F.srcset)}"${G?` sizes="${n(G)}"`:""} />`);if(!a&&(x==="avif"||x==="auto")){let F=xe(o,B,T,v,"avif"),te=z?Ve(o,Xe,v,"avif"):`${F}`;_.push(`<source type="image/avif" srcset="${n(te)}"${G?` sizes="${n(G)}"`:""} />`)}if(!a&&(x==="webp"||x==="auto")){let F=xe(o,B,T,v,"webp"),te=z?Ve(o,Xe,v,"webp"):`${F}`;_.push(`<source type="image/webp" srcset="${n(te)}"${G?` sizes="${n(G)}"`:""} />`)}return`${Z}<picture>
4
4
  ${_.join(`
5
5
  `)}
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{de,Sc,Rs,fn,m,De,Me}from"./chunk-asxh3wqg.js";import{cr,Ye,j}from"./chunk-cg2vjkv9.js";import{Zn,i}from"./chunk-zxeegh47.js";import{be}from"./chunk-01b2xpaa.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];g(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];g(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function g(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,o=t+u[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:g}=cr(s),a=await(e.renderer??((n)=>Ye(n)))(g);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=de(s);if(r)e=r.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),u;while((u=g.exec(s))!==null){let o=u[1],l=u[2],d=u[0],f=o.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),o.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
2
+ import{de,Sc,Rs,fn,m,De,Me}from"./chunk-0azq3w1a.js";import{cr,Ye,j}from"./chunk-5rjfaj0b.js";import{Zn,i}from"./chunk-rfb00eqz.js";import{be}from"./chunk-gwq82dpy.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];g(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];g(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function g(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,o=t+u[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:g}=cr(s),a=await(e.renderer??((n)=>Ye(n)))(g);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=de(s);if(r)e=r.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),u;while((u=g.exec(s))!==null){let o=u[1],l=u[2],d=u[0],f=o.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),o.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -14,5 +14,5 @@ ${a.join(`
14
14
  `)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=De(p),d=await Promise.all(a.map(async(w)=>{let C=w.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(C))return w;let h=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!h)return w;return await Me(h[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),x=[await Zn(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
15
15
  `);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${x}
16
16
  $1`);else t+=`
17
- ${x}`}t=await be(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-99wwvvmk.js");t=await o(t)}catch{}return t}
17
+ ${x}`}t=await be(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-009y9zkg.js");t=await o(t)}catch{}return t}
18
18
  export{Na};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{nn,ho,yo,bo,Xm,vo}from"./chunk-zb1627aa.js";import"./chunk-3fwdxxh1.js";import"./chunk-2mqzpzy7.js";import"./chunk-rbmt5w9v.js";export{yo as buildServerApi,Xm as createServerApi,nn as discoverServerApi,ho as generateApiTypes,vo as isServerApiSource,bo as productionApiDispatcher};
2
+ import{nn,ho,yo,bo,Xm,vo}from"./chunk-0wfbhs15.js";import"./chunk-3fwdxxh1.js";import"./chunk-2mqzpzy7.js";import"./chunk-rbmt5w9v.js";export{yo as buildServerApi,Xm as createServerApi,nn as discoverServerApi,ho as generateApiTypes,vo as isServerApiSource,bo as productionApiDispatcher};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{eh,mf,Ge,Ua,th,Zr,Qr,es}from"./chunk-ycdfgs9z.js";import"./chunk-c77deyem.js";import"./chunk-jx9vy6j1.js";import"./chunk-r3j4m04w.js";import"./chunk-m5nzpjej.js";import"./chunk-asxh3wqg.js";import"./chunk-za4e4w89.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{th as clearOnceStore,Ua as onceStore,Ge as partialsCache,Zr as processIncludes,Qr as processStackPushDirectives,es as processStackReplacements,eh as resetUnscopedSignalWarnings,mf as topLevelElements};
2
+ import{eh,mf,Ge,Ua,th,Zr,Qr,es}from"./chunk-nb65s3b5.js";import"./chunk-kbw75yd7.js";import"./chunk-jy8m3dah.js";import"./chunk-r3j4m04w.js";import"./chunk-m5nzpjej.js";import"./chunk-0azq3w1a.js";import"./chunk-xhpf68p4.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{th as clearOnceStore,Ua as onceStore,Ge as partialsCache,Zr as processIncludes,Qr as processStackPushDirectives,es as processStackReplacements,eh as resetUnscopedSignalWarnings,mf as topLevelElements};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{gn,Nf,Df,Mf,Lf,jf,m,Bf,ei,Ff,Rc,Ac}from"./chunk-asxh3wqg.js";import"./chunk-za4e4w89.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{gn as STX_ENGINE_BINDING_NAMES,ei as convertToCommonJS,Rc as extractScriptFromTemplate,m as extractVariables,Ac as hasVariables,Bf as isCompleteImport,jf as isMissingBindingFailure,Mf as isModuleResolutionFailure,Lf as isSyntaxFailure,Ff as splitDeclaration,Nf as stripTypeScript,Df as withoutStxReferrer};
2
+ import{gn,Nf,Df,Mf,Lf,jf,m,Bf,ei,Ff,Rc,Ac}from"./chunk-0azq3w1a.js";import"./chunk-xhpf68p4.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{gn as STX_ENGINE_BINDING_NAMES,ei as convertToCommonJS,Rc as extractScriptFromTemplate,m as extractVariables,Ac as hasVariables,Bf as isCompleteImport,jf as isMissingBindingFailure,Mf as isModuleResolutionFailure,Lf as isSyntaxFailure,Ff as splitDeclaration,Nf as stripTypeScript,Df as withoutStxReferrer};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{W,Oe}from"./chunk-asxh3wqg.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 Jt(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Oe(t,s);if(p>s){c=p;continue}let a=W(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{W,Oe}from"./chunk-0azq3w1a.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 Jt(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Oe(t,s);if(p>s){c=p;continue}let a=W(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{Jt};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{u,f,R,d,q}from"./chunk-zkx2m308.js";import{z,ws,U,Ie,de,br,Le,je,r,h,xe,k}from"./chunk-asxh3wqg.js";import{ot}from"./chunk-ez35607j.js";import{A}from"./chunk-zn3c0ew5.js";import{se}from"./chunk-r3j4m04w.js";import{L,Xe}from"./chunk-f4gqzg1y.js";import{T,Sn}from"./chunk-xaddgvkx.js";import C from"path";import{existsSync as St}from"fs";function at(a,t){let c=0;for(let i=t;i<a.length;i++){let b=a[i];if(b==="("||b==="["||b==="{")c++;else if(b===")"||b==="]"||b==="}")c--;else if(b===","&&c===0)return i}return-1}function yt(a,t,c){let i=a,b=new RegExp(`${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),s=b.exec(i);while(s){let g=s.index,e=g+s[0].length-1,D=1,Z=e+1;while(Z<i.length&&D>0){if(i[Z]==="(")D++;else if(i[Z]===")")D--;Z++}if(D!==0)break;let rt=i.substring(e+1,Z-1),N=`${c}(${rt})`;i=i.substring(0,g)+N+i.substring(Z),b.lastIndex=g+N.length,s=b.exec(i)}return i}function $t(a){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(a)}function mt(a){let t=a,c=[],i=new Set,b=0,s=0,g=t.length,e=(N)=>{s++;while(s<g){if(t[s]==="\\"){s+=2;continue}if(t[s]===N){s++;return}s++}},D=()=>{s++;while(s<g){if(t[s]==="\\"){s+=2;continue}if(t[s]==="`"){s++;return}if(t[s]==="$"&&t[s+1]==="{"){s+=2;let N=1;while(s<g&&N>0)if(t[s]==="{")N++,s++;else if(t[s]==="}")N--,s++;else if(t[s]==="'"||t[s]==='"')e(t[s]);else if(t[s]==="`")D();else s++;continue}s++}},Z=()=>{if(t[s]==="/"&&t[s+1]==="/"){while(s<g&&t[s]!==`
2
+ import{u,f,R,d,q}from"./chunk-zkx2m308.js";import{z,ws,U,Ie,de,br,Le,je,r,h,xe,k}from"./chunk-0azq3w1a.js";import{ot}from"./chunk-ez35607j.js";import{A}from"./chunk-zn3c0ew5.js";import{se}from"./chunk-r3j4m04w.js";import{L,Xe}from"./chunk-f4gqzg1y.js";import{T,Sn}from"./chunk-xaddgvkx.js";import C from"path";import{existsSync as St}from"fs";function at(a,t){let c=0;for(let i=t;i<a.length;i++){let b=a[i];if(b==="("||b==="["||b==="{")c++;else if(b===")"||b==="]"||b==="}")c--;else if(b===","&&c===0)return i}return-1}function yt(a,t,c){let i=a,b=new RegExp(`${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),s=b.exec(i);while(s){let g=s.index,e=g+s[0].length-1,D=1,Z=e+1;while(Z<i.length&&D>0){if(i[Z]==="(")D++;else if(i[Z]===")")D--;Z++}if(D!==0)break;let rt=i.substring(e+1,Z-1),N=`${c}(${rt})`;i=i.substring(0,g)+N+i.substring(Z),b.lastIndex=g+N.length,s=b.exec(i)}return i}function $t(a){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(a)}function mt(a){let t=a,c=[],i=new Set,b=0,s=0,g=t.length,e=(N)=>{s++;while(s<g){if(t[s]==="\\"){s+=2;continue}if(t[s]===N){s++;return}s++}},D=()=>{s++;while(s<g){if(t[s]==="\\"){s+=2;continue}if(t[s]==="`"){s++;return}if(t[s]==="$"&&t[s+1]==="{"){s+=2;let N=1;while(s<g&&N>0)if(t[s]==="{")N++,s++;else if(t[s]==="}")N--,s++;else if(t[s]==="'"||t[s]==='"')e(t[s]);else if(t[s]==="`")D();else s++;continue}s++}},Z=()=>{if(t[s]==="/"&&t[s+1]==="/"){while(s<g&&t[s]!==`
3
3
  `)s++;return!0}if(t[s]==="/"&&t[s+1]==="*"){s+=2;while(s<g-1&&!(t[s]==="*"&&t[s+1]==="/"))s++;return s+=2,!0}return!1},rt=()=>{if(b!==0)return;let N=t.slice(s).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(N){let H=N[2];if(!i.has(H))c.push(H),i.add(H);return}let et=t.slice(s).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(et){let H=et[1];if(!i.has(H))c.push(H),i.add(H);return}let Y=t.slice(s).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let H=Y[1];if(!i.has(H))c.push(H),i.add(H)}};while(s<g){if(Z())continue;if(t[s]==="'"||t[s]==='"'){e(t[s]);continue}if(t[s]==="`"){D();continue}if(t[s]==="{"){b++,s++;continue}if(t[s]==="}"){b--,s++;continue}if(b===0&&/[a-z]/i.test(t[s])&&(s===0||/\s|[;{}()]/.test(t[s-1])))rt();s++}return c.join(", ")}function Et(a,t=""){let c=mt(a).split(",").map((i)=>i.trim()).filter(Boolean);return`
4
4
  (function() {
5
5
  ${ot("var",c)}
@@ -44,10 +44,10 @@ ${s}
44
44
  }
45
45
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
46
46
  }
47
- })();`;return c+a+i}function It(a,t){if(L(a)){let b=L(a).tag.match(/data-stx-scope="([^"]*)"/);if(b)return{html:a,mergedIntoExisting:b[1],stamped:!0,root:"body"};return{html:Xe(a,(s,g)=>`<body${g} data-stx-scope="${t}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let c=a.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(c){let i=c[2]+c[3],b=c[2].slice(1),s=i.match(/data-stx-scope="([^"]*)"/);if(s)return{html:a,mergedIntoExisting:s[1],stamped:!0,root:b};let g=c[1],e=c[2],D=c[3];return{html:`${g}${e} data-stx-scope="${t}"${D}${a.slice(c[0].length)}`,mergedIntoExisting:null,stamped:!0,root:b}}return{html:a,mergedIntoExisting:null,stamped:!1,root:null}}var Mt=0;function ut(a,t){let c=C.basename(a,".stx").replace(/[^a-zA-Z0-9]/g,"_"),i=t.__stx_scope_seq;return i?`stx_scope_${c}_${++i.n}_${i.key}`:`stx_scope_${c}_${++Mt}`}var lt=new Set,pt=new Set;function eh(){lt.clear(),pt.clear()}var Tt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function mf(a){let t=(e)=>e.replace(/[^\n]/g," "),c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,t).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,t).replace(/<!--[\s\S]*?-->/g,t).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,t).replace(/\{\{[\s\S]*?\}\}/g,t).replace(/\{!![\s\S]*?!!\}/g,t),i=[],b=0,s=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=s.exec(c))!==null){let e=g[1]==="/",D=g[2],Z=g[3]==="/"||Tt.has(D.toLowerCase());if(e){b=Math.max(0,b-1);continue}if(b===0)i.push(D);if(!Z)b++}return i}function ft(a){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(a)}var Ge=new U(500),Ua=new Set;function th(){Ua.clear()}function Ct(a){if(a.__onceStore instanceof Set)return a.__onceStore;return Ua}async function Zr(a,t,c,i,b,s=new Set){let g=i.partialsDir||C.join(C.dirname(c),"partials");if(g&&!C.isAbsolute(g))g=C.resolve(process.cwd(),g);let e=yt(a,"@partial","@include"),D=Ct(t);e=e.replace(/@once([\s\S]*?)@endonce/g,(m,v,x)=>{let p=v.trim(),n=`${c}:${p}`;if(D.has(n))return"";return D.add(n),v});{let m=/@includeIf\s*\(/g,v;while((v=m.exec(e))!==null){let x=v.index,p=x+v[0].length-1,n=1,_=p+1;while(_<e.length&&n>0){if(e[_]==="(")n++;else if(e[_]===")")n--;_++}if(n!==0)break;let l=e.substring(p+1,_-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){m.lastIndex=_;continue}let O=o[1],P=Z(O,g,c),E="";if(P&&await Bun.file(P).exists())b.add(P),E=`@include(${l})`;e=e.substring(0,x)+E+e.substring(_),m.lastIndex=0}}for(let[m,v]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(e))!==null){let n=p.index,_=n+p[0].length-1,l=1,o=_+1;while(o<e.length&&l>0){if(e[o]==="(")l++;else if(e[o]===")")l--;o++}if(l!==0)break;let O=e.substring(_+1,o-1),P=at(O,0);if(P===-1){x.lastIndex=o;continue}let E=O.substring(0,P).trim(),V=O.substring(P+1).trim(),W=V.match(/^\s*['"]([^'"]+)['"]/);if(!W){x.lastIndex=o;continue}let w=W[1],J=V.substring(W[0].length),B,I=at(J,0);if(I!==-1)B=J.substring(I+1).trim();try{let M=`Boolean(${E})`,j;if(f(M)){let it=d(M,Object.keys(t));j=Boolean(it(...Object.values(t)))}else j=Boolean(u(M,t));let tt=v?!j:j,nt="";if(tt){let it=Z(w,g,c);if(it&&await Bun.file(it).exists())b.add(it);nt=`@include('${w}'${B?`, ${B}`:""})`}e=e.substring(0,n)+nt+e.substring(o),x.lastIndex=0}catch(M){let j=M instanceof Error?M.message:String(M),tt=h("Include",`Error evaluating ${m} condition: ${j}`,c,a,n);e=e.substring(0,n)+tt+e.substring(o),x.lastIndex=0}}}{let m=/@each\s*\(/g,v;while((v=m.exec(e))!==null){let x=v.index,p=x+v[0].length-1,n=1,_=p+1;while(_<e.length&&n>0){if(e[_]==="(")n++;else if(e[_]===")"){if(n--,n===0)break}_++}if(n!==0)break;let l=e.substring(p+1,_),o=e.substring(x,_+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let[,P,E,V,W]=O;try{let w,J=E.trim();if(f(J))w=d(J,Object.keys(t))(...Object.values(t));else w=u(J,t);let B="";if(Array.isArray(w)&&w.length>0)for(let I of w){let M={...t,[V]:I},j=await et(P,M,a,x);B+=j}else if(W)B=await et(W,{},a,x);e=e.substring(0,x)+B+e.substring(_+1),m.lastIndex=0}catch(w){let J=w instanceof Error?w.message:String(w);e=e.substring(0,x)+h("Each",`Error in @each: ${J}`,c,a,x)+e.substring(_+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,v;while((v=m.exec(e))!==null){let x=v.index,p=x+v[0].length-1,n=1,_=p+1;while(_<e.length&&n>0){if(e[_]==="(")n++;else if(e[_]===")"){if(n--,n===0)break}_++}if(n!==0)break;let l=e.substring(p+1,_),o=e.substring(x,_+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let P=O[1],E=l.slice(O[0].length),V,W=E.match(/^\s*,\s*\{/);if(W){E=E.slice(W[0].length-1);let B=1,I=1;while(I<E.length&&B>0){if(E[I]==="{")B++;else if(E[I]==="}"){if(B--,B===0)break}I++}V=E.substring(0,I+1),E=E.slice(I+1)}let w,J=E.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)w=J[1];try{let B=JSON.parse(P.replace(/'/g,'"')),I={};if(V)try{I=R(V,t)}catch(j){let tt=j instanceof Error?j.message:String(j);if(i.debug){let nt=h("Include",`Error parsing includeFirst variables: ${tt}`,c,a,x,o);e=e.replace(o,()=>nt)}else e=e.replace(o,()=>w||"");continue}let M=!1;for(let j of B){let tt=Z(j,g,c);if(!tt)continue;if(await r(tt)){let nt=await et(j,I,a,x);e=e.replace(o,()=>nt),M=!0;break}}if(!M)if(w!==void 0)e=e.replace(o,()=>w);else if(i.debug){let j=h("Include",`None of the includeFirst paths exist: ${P}`,c,a,x,o);e=e.replace(o,()=>j)}else e=e.replace(o,"")}catch(B){let I=B instanceof Error?B.message:String(B),M=h("Include",`Error processing @includeFirst: ${I}`,c,a,x,o);e=e.replace(o,()=>M)}m.lastIndex=0}}function Z(m,v,x){try{let p=m;if(!m.endsWith(".stx"))p=`${m}.stx`;let n=C.resolve(v),_=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let W of i._layerPartialDirs??[]){let w=C.resolve(W,p);if(w.startsWith(`${C.resolve(W)}${C.sep}`)&&St(w))return w}l=C.resolve(v,p)}else l=C.resolve(_,p);let o=C.normalize(l),O=o.startsWith(n+C.sep)||o===n,P=o.startsWith(_+C.sep)||o===_,E=!1,V=C.dirname(_);if(o.startsWith(V+C.sep)){if(!C.relative(V,o).split(C.sep).some((B)=>B.startsWith(".")&&B!=="."&&B!==".."))E=!0}if(!O&&!P&&!E)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${n}, ${_}`),null;return o}catch(p){return console.error(`Error resolving path ${m}: ${p}`),null}}let rt=C.resolve(c);s.add(rt);function N(m,v,x,p){return i.onIncludeError?.({includePath:m,templatePath:c,message:v,partialsDir:g}),h("Include",v,c,x,p)}async function et(m,v={},x,p){let n=Z(m,g,c);if(!n)return N(m,`Could not resolve path for include: ${m}`,x,p);let _=C.resolve(n);if(s.has(_)){let l=[...s,_].map((o)=>C.basename(o)).join(" -> ");return N(m,`Circular include detected: ${l}`,x,p)}try{b.add(n);let l;if(!l)try{l=await Bun.file(n).text()}catch(y){let K=y instanceof Error?y.message:String(y);return N(m,`Error loading include file ${m}: ${K}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:y}=await import("./chunk-my2a18wq.js");l=y(l,t)}if(l&&(i.debug||!T()&&!Sn()))try{let{warnUnbalancedTags:y}=await import("./chunk-m6d2bq3y.js");y(l,n)}catch{}try{let{processESImports:y}=await import("./chunk-r2gacnbg.js");l=await y(l,t,n,i,b)}catch(y){if(i.debug)console.warn(`[stx] partial ES import extraction skipped for ${n}:`,y instanceof Error?y.message:y)}let o=l,O=de(o);if(O)o=O.content.trim();let E=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),V="";if(E)V=`<style${E[1]}>${E[2]}</style>`;let W=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(y,K,S)=>{if(!ft(K))return"";return W.push({attrs:K,body:S}),`__STX_DATA_BLOCK_${W.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let w={...t};w.__stx_signals_gate=xe(l,n);for(let[y,K]of Object.entries(v))w[y]=K;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,B=[...l.matchAll(J)].sort((y,K)=>{let S=(y[1]||"").includes("server"),X=(K[1]||"").includes("server");return Number(X)-Number(S)}),I="",M=null,j=!1,tt=!1;for(let y of B){let K=y[1]||"",S=y[2]||"";if(ft(K))continue;let X=K.includes("server"),wt=Le(K);if(!X&&!/\bsrc\s*=/i.test(K))Ie(S,n,i.strict);if(!X&&S.trim()){let{interpolateScriptExpressions:F}=await import("./chunk-ztcm0tfd.js");S=F(S,w,m)}let ct="";try{let{extractAndStripCssImports:F,renderVendorStyleTags:Q}=await import("./chunk-dqchjtx2.js"),st=F(S,{filePath:n,projectRoot:process.cwd()});S=st.code,ct=Q(st.styles)}catch(F){if(i.debug)console.warn(`[stx] vendor-css extractor skipped for ${n}:`,F instanceof Error?F.message:F)}if(wt&&S.trim())S=je(S);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-dqchjtx2.js");S=Q(S).code;let{hasUserImports:st,bundleClientScript:bt}=await import("./chunk-sqdzxqnb.js");if(st(S))S=await bt(S,n,{projectRoot:process.cwd()})}catch(Q){if(i.debug)console.warn(`[stx] bundler skipped for ${n}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:F}=await import("./chunk-pqyc625v.js");S=F(S)}let dt=$t(S);if(!X){let{extractBridgeData:F,generateServerDataBridge:Q}=await import("./chunk-dqchjtx2.js"),st=Q(S,F(w));if(st)S=`${st}
47
+ })();`;return c+a+i}function It(a,t){if(L(a)){let b=L(a).tag.match(/data-stx-scope="([^"]*)"/);if(b)return{html:a,mergedIntoExisting:b[1],stamped:!0,root:"body"};return{html:Xe(a,(s,g)=>`<body${g} data-stx-scope="${t}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let c=a.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(c){let i=c[2]+c[3],b=c[2].slice(1),s=i.match(/data-stx-scope="([^"]*)"/);if(s)return{html:a,mergedIntoExisting:s[1],stamped:!0,root:b};let g=c[1],e=c[2],D=c[3];return{html:`${g}${e} data-stx-scope="${t}"${D}${a.slice(c[0].length)}`,mergedIntoExisting:null,stamped:!0,root:b}}return{html:a,mergedIntoExisting:null,stamped:!1,root:null}}var Mt=0;function ut(a,t){let c=C.basename(a,".stx").replace(/[^a-zA-Z0-9]/g,"_"),i=t.__stx_scope_seq;return i?`stx_scope_${c}_${++i.n}_${i.key}`:`stx_scope_${c}_${++Mt}`}var lt=new Set,pt=new Set;function eh(){lt.clear(),pt.clear()}var Tt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function mf(a){let t=(e)=>e.replace(/[^\n]/g," "),c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,t).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,t).replace(/<!--[\s\S]*?-->/g,t).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,t).replace(/\{\{[\s\S]*?\}\}/g,t).replace(/\{!![\s\S]*?!!\}/g,t),i=[],b=0,s=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=s.exec(c))!==null){let e=g[1]==="/",D=g[2],Z=g[3]==="/"||Tt.has(D.toLowerCase());if(e){b=Math.max(0,b-1);continue}if(b===0)i.push(D);if(!Z)b++}return i}function ft(a){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(a)}var Ge=new U(500),Ua=new Set;function th(){Ua.clear()}function Ct(a){if(a.__onceStore instanceof Set)return a.__onceStore;return Ua}async function Zr(a,t,c,i,b,s=new Set){let g=i.partialsDir||C.join(C.dirname(c),"partials");if(g&&!C.isAbsolute(g))g=C.resolve(process.cwd(),g);let e=yt(a,"@partial","@include"),D=Ct(t);e=e.replace(/@once([\s\S]*?)@endonce/g,(m,v,x)=>{let p=v.trim(),n=`${c}:${p}`;if(D.has(n))return"";return D.add(n),v});{let m=/@includeIf\s*\(/g,v;while((v=m.exec(e))!==null){let x=v.index,p=x+v[0].length-1,n=1,_=p+1;while(_<e.length&&n>0){if(e[_]==="(")n++;else if(e[_]===")")n--;_++}if(n!==0)break;let l=e.substring(p+1,_-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){m.lastIndex=_;continue}let O=o[1],P=Z(O,g,c),E="";if(P&&await Bun.file(P).exists())b.add(P),E=`@include(${l})`;e=e.substring(0,x)+E+e.substring(_),m.lastIndex=0}}for(let[m,v]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(e))!==null){let n=p.index,_=n+p[0].length-1,l=1,o=_+1;while(o<e.length&&l>0){if(e[o]==="(")l++;else if(e[o]===")")l--;o++}if(l!==0)break;let O=e.substring(_+1,o-1),P=at(O,0);if(P===-1){x.lastIndex=o;continue}let E=O.substring(0,P).trim(),V=O.substring(P+1).trim(),W=V.match(/^\s*['"]([^'"]+)['"]/);if(!W){x.lastIndex=o;continue}let w=W[1],J=V.substring(W[0].length),B,I=at(J,0);if(I!==-1)B=J.substring(I+1).trim();try{let M=`Boolean(${E})`,j;if(f(M)){let it=d(M,Object.keys(t));j=Boolean(it(...Object.values(t)))}else j=Boolean(u(M,t));let tt=v?!j:j,nt="";if(tt){let it=Z(w,g,c);if(it&&await Bun.file(it).exists())b.add(it);nt=`@include('${w}'${B?`, ${B}`:""})`}e=e.substring(0,n)+nt+e.substring(o),x.lastIndex=0}catch(M){let j=M instanceof Error?M.message:String(M),tt=h("Include",`Error evaluating ${m} condition: ${j}`,c,a,n);e=e.substring(0,n)+tt+e.substring(o),x.lastIndex=0}}}{let m=/@each\s*\(/g,v;while((v=m.exec(e))!==null){let x=v.index,p=x+v[0].length-1,n=1,_=p+1;while(_<e.length&&n>0){if(e[_]==="(")n++;else if(e[_]===")"){if(n--,n===0)break}_++}if(n!==0)break;let l=e.substring(p+1,_),o=e.substring(x,_+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let[,P,E,V,W]=O;try{let w,J=E.trim();if(f(J))w=d(J,Object.keys(t))(...Object.values(t));else w=u(J,t);let B="";if(Array.isArray(w)&&w.length>0)for(let I of w){let M={...t,[V]:I},j=await et(P,M,a,x);B+=j}else if(W)B=await et(W,{},a,x);e=e.substring(0,x)+B+e.substring(_+1),m.lastIndex=0}catch(w){let J=w instanceof Error?w.message:String(w);e=e.substring(0,x)+h("Each",`Error in @each: ${J}`,c,a,x)+e.substring(_+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,v;while((v=m.exec(e))!==null){let x=v.index,p=x+v[0].length-1,n=1,_=p+1;while(_<e.length&&n>0){if(e[_]==="(")n++;else if(e[_]===")"){if(n--,n===0)break}_++}if(n!==0)break;let l=e.substring(p+1,_),o=e.substring(x,_+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let P=O[1],E=l.slice(O[0].length),V,W=E.match(/^\s*,\s*\{/);if(W){E=E.slice(W[0].length-1);let B=1,I=1;while(I<E.length&&B>0){if(E[I]==="{")B++;else if(E[I]==="}"){if(B--,B===0)break}I++}V=E.substring(0,I+1),E=E.slice(I+1)}let w,J=E.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)w=J[1];try{let B=JSON.parse(P.replace(/'/g,'"')),I={};if(V)try{I=R(V,t)}catch(j){let tt=j instanceof Error?j.message:String(j);if(i.debug){let nt=h("Include",`Error parsing includeFirst variables: ${tt}`,c,a,x,o);e=e.replace(o,()=>nt)}else e=e.replace(o,()=>w||"");continue}let M=!1;for(let j of B){let tt=Z(j,g,c);if(!tt)continue;if(await r(tt)){let nt=await et(j,I,a,x);e=e.replace(o,()=>nt),M=!0;break}}if(!M)if(w!==void 0)e=e.replace(o,()=>w);else if(i.debug){let j=h("Include",`None of the includeFirst paths exist: ${P}`,c,a,x,o);e=e.replace(o,()=>j)}else e=e.replace(o,"")}catch(B){let I=B instanceof Error?B.message:String(B),M=h("Include",`Error processing @includeFirst: ${I}`,c,a,x,o);e=e.replace(o,()=>M)}m.lastIndex=0}}function Z(m,v,x){try{let p=m;if(!m.endsWith(".stx"))p=`${m}.stx`;let n=C.resolve(v),_=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let W of i._layerPartialDirs??[]){let w=C.resolve(W,p);if(w.startsWith(`${C.resolve(W)}${C.sep}`)&&St(w))return w}l=C.resolve(v,p)}else l=C.resolve(_,p);let o=C.normalize(l),O=o.startsWith(n+C.sep)||o===n,P=o.startsWith(_+C.sep)||o===_,E=!1,V=C.dirname(_);if(o.startsWith(V+C.sep)){if(!C.relative(V,o).split(C.sep).some((B)=>B.startsWith(".")&&B!=="."&&B!==".."))E=!0}if(!O&&!P&&!E)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${n}, ${_}`),null;return o}catch(p){return console.error(`Error resolving path ${m}: ${p}`),null}}let rt=C.resolve(c);s.add(rt);function N(m,v,x,p){return i.onIncludeError?.({includePath:m,templatePath:c,message:v,partialsDir:g}),h("Include",v,c,x,p)}async function et(m,v={},x,p){let n=Z(m,g,c);if(!n)return N(m,`Could not resolve path for include: ${m}`,x,p);let _=C.resolve(n);if(s.has(_)){let l=[...s,_].map((o)=>C.basename(o)).join(" -> ");return N(m,`Circular include detected: ${l}`,x,p)}try{b.add(n);let l;if(!l)try{l=await Bun.file(n).text()}catch(y){let K=y instanceof Error?y.message:String(y);return N(m,`Error loading include file ${m}: ${K}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:y}=await import("./chunk-0ktg5dw9.js");l=y(l,t)}if(l&&(i.debug||!T()&&!Sn()))try{let{warnUnbalancedTags:y}=await import("./chunk-m6d2bq3y.js");y(l,n)}catch{}try{let{processESImports:y}=await import("./chunk-2rj4t9wz.js");l=await y(l,t,n,i,b)}catch(y){if(i.debug)console.warn(`[stx] partial ES import extraction skipped for ${n}:`,y instanceof Error?y.message:y)}let o=l,O=de(o);if(O)o=O.content.trim();let E=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),V="";if(E)V=`<style${E[1]}>${E[2]}</style>`;let W=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(y,K,S)=>{if(!ft(K))return"";return W.push({attrs:K,body:S}),`__STX_DATA_BLOCK_${W.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let w={...t};w.__stx_signals_gate=xe(l,n);for(let[y,K]of Object.entries(v))w[y]=K;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,B=[...l.matchAll(J)].sort((y,K)=>{let S=(y[1]||"").includes("server"),X=(K[1]||"").includes("server");return Number(X)-Number(S)}),I="",M=null,j=!1,tt=!1;for(let y of B){let K=y[1]||"",S=y[2]||"";if(ft(K))continue;let X=K.includes("server"),wt=Le(K);if(!X&&!/\bsrc\s*=/i.test(K))Ie(S,n,i.strict);if(!X&&S.trim()){let{interpolateScriptExpressions:F}=await import("./chunk-04xtzbf6.js");S=F(S,w,m)}let ct="";try{let{extractAndStripCssImports:F,renderVendorStyleTags:Q}=await import("./chunk-ejp4d8cq.js"),st=F(S,{filePath:n,projectRoot:process.cwd()});S=st.code,ct=Q(st.styles)}catch(F){if(i.debug)console.warn(`[stx] vendor-css extractor skipped for ${n}:`,F instanceof Error?F.message:F)}if(wt&&S.trim())S=je(S);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-ejp4d8cq.js");S=Q(S).code;let{hasUserImports:st,bundleClientScript:bt}=await import("./chunk-9vx6et01.js");if(st(S))S=await bt(S,n,{projectRoot:process.cwd()})}catch(Q){if(i.debug)console.warn(`[stx] bundler skipped for ${n}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:F}=await import("./chunk-ty5rncss.js");S=F(S)}let dt=$t(S);if(!X){let{extractBridgeData:F,generateServerDataBridge:Q}=await import("./chunk-ejp4d8cq.js"),st=Q(S,F(w));if(st)S=`${st}
48
48
  ${S}`}if(dt&&!X){j=!0,M=ut(n,t);let F=A(S),Q=gt(F,M);I+=`${ct}<script data-stx-scoped data-stx-run="always" data-stx-owner="${M}">${Q}</script>
49
- `;continue}if(X)try{let{extractVariables:F}=await import("./chunk-qsz4tb20.js");await F(S,w,n)}catch(F){if(i.debug)console.warn(`Warning: Could not extract variables from server script in ${n}:`,F)}if(!X&&!dt){let F=K.replace(/\bclient\b/i,"").trim();M=ut(n,t);let Q=A(S),st=gt(Q,M);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(st))tt=!0;I+=`${ct}<script data-stx-scoped data-stx-run="always" data-stx-owner="${M}"${F?` ${F}`:""}>${st}</script>
50
- `}}if(W.length>0){let{interpolateScriptExpressions:y}=await import("./chunk-ztcm0tfd.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(K,S)=>{let X=W[Number(S)];return`<script${X.attrs}>${y(X.body,w,m)}</script>`})}if(M){let y=It(o,M);if(o=y.html,y.mergedIntoExisting){let S=M,X=y.mergedIntoExisting;I=I.split(`'${S}'`).join(`'${X}'`).split(`"${S}"`).join(`"${X}"`),M=X}else if(!y.stamped&&j&&!lt.has(n))lt.add(n),console.warn(`[stx] ${C.relative(process.cwd(),n)} 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"&&(j||tt)&&!pt.has(n)){let S=mf(o);if(S.length>1)pt.add(n),console.warn(`[stx] ${C.relative(process.cwd(),n)} declares ${j?"signals":"bindings"} and has ${S.length} top-level elements (${S.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let K=y.stamped&&y.root!==null&&br(y.root);I=Rt(I,K?M:null)}if(o.includes("@include")||o.includes("@partial"))o=await Zr(o,w,n,i,b,s);let{processLoops:nt,reportDeferredLoopWarnings:it}=await import("./chunk-8rcvwxts.js"),G=nt(o,w,n,void 0,!0);G=se(G,w,n),G=it(G);let{processMetaDirectives:ht,processSeoDirective:xt,processStructuredData:_t}=await import("./chunk-918xy0ra.js");if(G=ht(G,w,n,i),G=_t(G,w,n),G=xt(G,w,n,i),G=k(G,w,n),V)G+=`
49
+ `;continue}if(X)try{let{extractVariables:F}=await import("./chunk-mhpek1hj.js");await F(S,w,n)}catch(F){if(i.debug)console.warn(`Warning: Could not extract variables from server script in ${n}:`,F)}if(!X&&!dt){let F=K.replace(/\bclient\b/i,"").trim();M=ut(n,t);let Q=A(S),st=gt(Q,M);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(st))tt=!0;I+=`${ct}<script data-stx-scoped data-stx-run="always" data-stx-owner="${M}"${F?` ${F}`:""}>${st}</script>
50
+ `}}if(W.length>0){let{interpolateScriptExpressions:y}=await import("./chunk-04xtzbf6.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(K,S)=>{let X=W[Number(S)];return`<script${X.attrs}>${y(X.body,w,m)}</script>`})}if(M){let y=It(o,M);if(o=y.html,y.mergedIntoExisting){let S=M,X=y.mergedIntoExisting;I=I.split(`'${S}'`).join(`'${X}'`).split(`"${S}"`).join(`"${X}"`),M=X}else if(!y.stamped&&j&&!lt.has(n))lt.add(n),console.warn(`[stx] ${C.relative(process.cwd(),n)} 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"&&(j||tt)&&!pt.has(n)){let S=mf(o);if(S.length>1)pt.add(n),console.warn(`[stx] ${C.relative(process.cwd(),n)} declares ${j?"signals":"bindings"} and has ${S.length} top-level elements (${S.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let K=y.stamped&&y.root!==null&&br(y.root);I=Rt(I,K?M:null)}if(o.includes("@include")||o.includes("@partial"))o=await Zr(o,w,n,i,b,s);let{processLoops:nt,reportDeferredLoopWarnings:it}=await import("./chunk-g9vag1n2.js"),G=nt(o,w,n,void 0,!0);G=se(G,w,n),G=it(G);let{processMetaDirectives:ht,processSeoDirective:xt,processStructuredData:_t}=await import("./chunk-918xy0ra.js");if(G=ht(G,w,n,i),G=_t(G,w,n),G=xt(G,w,n,i),G=k(G,w,n),V)G+=`
51
51
  `+V;if(I)G+=`
52
52
  `+I;return G}catch(l){if(l instanceof q)throw l;let o=l instanceof Error?l.message:String(l);return N(m,`Error processing include ${m}: ${o}`,x,p)}}let Y=/@include\s*\(/g,H;while((H=Y.exec(e))!==null){let m=H.index,v=m+H[0].length-1,x=1,p=v+1;while(p<e.length&&x>0){if(e[p]==="(")x++;else if(e[p]===")")x--;p++}if(x!==0)break;let n=e.substring(m,p),_=e.substring(v+1,p-1),l=_.match(/^\s*['"]([^'"]+)['"]/);if(!l){Y.lastIndex=p;continue}let o=l[1],O,P=_.substring(l[0].length),E=at(P,0);if(E!==-1)O=P.substring(E+1).trim();let V={};if(O)try{V=R(O,t)}catch(w){let J=w instanceof Error?w.message:String(w);e=e.replace(n,h("Include",`Error parsing include variables for ${o}: ${J}`,c,a,m)),Y.lastIndex=0;continue}let W=await et(o,V,a,m);e=e.substring(0,m)+W+e.substring(p),Y.lastIndex=0}return e}function Qr(a,t){let c=a;function i(b,s,g,e){let D=b,Z=!0;while(Z){Z=!1;let rt=new RegExp(`@${s}\\(['"]([^'"]+)['"]\\)`),N=D.match(rt);if(!N||N.index===void 0)break;let et=N.index,Y=N[1],H=et+N[0].length,m=new RegExp(`@${s}\\(`),v=new RegExp(`@${g}(?![a-z])`),x=1,p=H,n=-1;while(x>0&&p<D.length){let l=D.slice(p),o=l.match(m),O=l.match(v),P=o?p+o.index:1/0,E=O?p+O.index:1/0;if(P<E)x++,p=P+(o[0].length||1);else if(E<1/0){if(x--,x===0){n=E;break}p=E+g.length+1}else break}if(n===-1)break;let _=D.slice(H,n);if(!t[Y])t[Y]=[];if(e)t[Y].unshift(_);else t[Y].push(_);D=D.substring(0,et)+D.substring(n+`@${g}`.length),Z=!0}return D}return c=i(c,"push","endpush",!1),c=i(c,"prepend","endprepend",!0),c}function es(a,t){return a.replace(/@stack\(['"]([^'"]+)['"]\)/g,(c,i)=>{if(!t[i]||t[i].length===0)return"";return t[i].join(`
53
53
  `)})}
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{j,Sf,Do,a,P,ph,fh}from"./chunk-cg2vjkv9.js";import"./chunk-bcymfrbv.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import"./chunk-asxh3wqg.js";import"./chunk-za4e4w89.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{P as config,j as defaultConfig,ph as defineStxConfig,Do as discoverConfig,a as loadStxConfig,Sf as resolveStxDirectories,fh as validateConfig};
2
+ import{j,Sf,Do,a,P,ph,fh}from"./chunk-5rjfaj0b.js";import"./chunk-b8a8900p.js";import"./chunk-4c86wr9a.js";import"./chunk-3fwdxxh1.js";import"./chunk-q7fh1xka.js";import"./chunk-2mqzpzy7.js";import"./chunk-0azq3w1a.js";import"./chunk-xhpf68p4.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{P as config,j as defaultConfig,ph as defineStxConfig,Do as discoverConfig,a as loadStxConfig,Sf as resolveStxDirectories,fh as validateConfig};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{qr}from"./chunk-x6hqe25e.js";import{S}from"./chunk-asxh3wqg.js";import{a}from"./chunk-cg2vjkv9.js";import{We,re}from"./chunk-hez09ssh.js";import{Na}from"./chunk-s23qhmg4.js";import{L}from"./chunk-f4gqzg1y.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as F,mkdirSync as y,copyFileSync as P,chmodSync as I,rmSync as he}from"fs";import{join as c,basename as ve,resolve as G}from"path";import{spawn as z}from"child_process";import{platform as xe}from"os";function E(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=S(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var Jl=`
2
+ import{qr}from"./chunk-x6hqe25e.js";import{S}from"./chunk-0azq3w1a.js";import{a}from"./chunk-5rjfaj0b.js";import{We,re}from"./chunk-hez09ssh.js";import{Na}from"./chunk-kn92y5yd.js";import{L}from"./chunk-f4gqzg1y.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as F,mkdirSync as y,copyFileSync as P,chmodSync as I,rmSync as he}from"fs";import{join as c,basename as ve,resolve as G}from"path";import{spawn as z}from"child_process";import{platform as xe}from"os";function E(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=S(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var Jl=`
3
3
  <script>
4
4
  (function() {
5
5
  'use strict';
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-ez35607j.js";import"./chunk-zn3c0ew5.js";import{w,x,C,Y}from"./chunk-asxh3wqg.js";import"./chunk-zkx2m308.js";import"./chunk-rbmt5w9v.js";import"./chunk-za4e4w89.js";import f 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","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","useVisibility","useWakeLock","useWindowSize"],L=new Set(b);var l=new Map,h=w(64),S=new Set,k=0,R=new Set(b);function T(){l.clear(),h.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=x(n,k),r=h.get(o);if(r)return r.slice();let a=n.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,""),t=[];for(let i of R){if(S.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),h.set(o,t),t.slice()}async function A(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=Y({loader:"ts",target:"browser",define:C()}),O=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.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(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
2
+ import"./chunk-ez35607j.js";import"./chunk-zn3c0ew5.js";import{w,x,C,Y}from"./chunk-0azq3w1a.js";import"./chunk-zkx2m308.js";import"./chunk-rbmt5w9v.js";import"./chunk-xhpf68p4.js";import f 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","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","useVisibility","useWakeLock","useWindowSize"],L=new Set(b);var l=new Map,h=w(64),S=new Set,k=0,R=new Set(b);function T(){l.clear(),h.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=x(n,k),r=h.get(o);if(r)return r.slice();let a=n.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,""),t=[];for(let i of R){if(S.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),h.set(o,t),t.slice()}async function A(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=Y({loader:"ts",target:"browser",define:C()}),O=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.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(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
3
3
  ${u.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let y=r.filter((s)=>!d.has(s)&&!I(n,s));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 l.set(t,""),null;let E=[...d].map((s)=>` try { if (!(${JSON.stringify(s)} in __s)) { __s[${JSON.stringify(s)}] = ${s}; if (!(${JSON.stringify(s)} in window)) window[${JSON.stringify(s)}] = ${s}; } } catch (e) {}`).join(`
4
4
  `),v=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
5
5
  ;(function(){